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=Q,s.getApp=function(e=L){const t=R.get(e);if(!t&&e===L&&(0,r.getDefaultAppConfig)())return Y();if(!t)throw V.create("no-app",{appName:e});return t},s.getApps=function(){return Array.from(R.values())},s.initializeApp=Y,s.initializeServerApp=function(e,t){if((0,r.isBrowser)()&&!(0,r.isWebWorker)())throw V.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 V.create("finalization-registry-not-supported",{});const o=""+(c=JSON.stringify(a),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),i=G.get(o);var c;if(i)return i.incRefCount(t.releaseOnDeref),i;const l=new n.ComponentContainer(o);for(const e of H.values())l.addComponent(e);const d=new J(s,t,o,l);return G.set(o,d),d},s.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw V.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"),o=e("idb");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class i{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const c="@firebase/app",l="0.10.18",d=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",y="@firebase/database-compat",x="@firebase/functions",T="@firebase/functions-compat",_="@firebase/installations",v="@firebase/installations-compat",E="@firebase/messaging",S="@firebase/messaging-compat",j="@firebase/performance",I="@firebase/performance-compat",P="@firebase/remote-config",C="@firebase/remote-config-compat",A="@firebase/storage",F="@firebase/storage-compat",M="@firebase/firestore",D="@firebase/vertexai",O="@firebase/firestore-compat",N="firebase",L=s._DEFAULT_ENTRY_NAME="[DEFAULT]",B={[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",[y]:"fire-rtdb-compat",[x]:"fire-fn",[T]:"fire-fn-compat",[_]:"fire-iid",[v]:"fire-iid-compat",[E]:"fire-fcm",[S]:"fire-fcm-compat",[j]:"fire-perf",[I]:"fire-perf-compat",[P]:"fire-rc",[C]:"fire-rc-compat",[A]:"fire-gcs",[F]:"fire-gcs-compat",[M]:"fire-fst",[O]:"fire-fst-compat",[D]:"fire-vertex","fire-js":"fire-js",[N]:"fire-js-all"},R=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){d.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function q(e){const t=e.name;if(H.has(t))return d.debug(`There were multiple attempts to register component ${t}.`),!1;H.set(t,e);for(const t of R.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 K={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},V=new r.ErrorFactory("app","Firebase",K);
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class z{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 V.create("app-deleted",{appName:this._name})}}
/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class J extends z{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,l,"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(){Q(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw V.create("server-app-deleted")}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.SDK_VERSION="11.2.0";function Y(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:L,automaticDataCollectionEnabled:!1},t),o=a.name;if("string"!=typeof o||!o)throw V.create("bad-app-name",{appName:String(o)});if(s||(s=(0,r.getDefaultAppConfig)()),!s)throw V.create("no-options");const i=R.get(o);if(i){if((0,r.deepEqual)(s,i.options)&&(0,r.deepEqual)(a,i.config))return i;throw V.create("duplicate-app",{appName:o})}const c=new n.ComponentContainer(o);for(const e of H.values())c.addComponent(e);const l=new z(s,a,c);return R.set(o,l),l}async function Q(e){let t=!1;const s=e.name;if(R.has(s))t=!0,R.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=B[e])&&void 0!==a?a:e;s&&(r+=`-${s}`);const o=r.match(/\s|\//),i=t.match(/\s|\//);if(o||i){const e=[`Unable to register library "${r}" with version "${t}":`];return o&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),o&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void d.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,o.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw V.create("idb-open",{originalErrorMessage:e.message})})),ee}async function 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)d.warn(e.message);else{const t=V.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});d.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 oe(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){d.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=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),ie(s)>t){e.dates.pop();break}}else if(s.push({agent:a.agent,dates:[a.date]}),ie(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 d.warn(e),""}}}function re(){return(new Date).toISOString().substring(0,10)}class oe{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)d.warn(e.message);else{const t=V.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const 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 ie(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 i(e),"PRIVATE")),q(new n.Component("heartbeat",e=>new ae(e),"PRIVATE")),X(c,l,ce),X(c,l,"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=x(e,t),a={method:"DELETE",headers:n},r=await T(()=>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=Y,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=Q,s.onIdChange=function(e,t){const{appConfig:s}=e;return function(e,t){F();const s=j(e);let n=I.get(s);n||(n=new Set,I.set(s,n));n.add(t)}(s,t),()=>{!function(e,t){const s=j(e),n=I.get(s);if(!n)return;n.delete(t),0===n.size&&I.delete(s);M()}(s,t)}};var n=e("@firebase/app"),a=e("@firebase/component"),r=e("@firebase/util"),o=e("idb");const i="@firebase/installations",c="0.6.12",l=1e4,d=`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 y({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function x(e,{refreshToken:t}){const s=y(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 T(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 _(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 v=/^[cdef][\w-]{21}$/,E="";function S(){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 v.test(t)?t:E}catch(e){return E}}function j(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 I=new Map;function P(e,t){const s=j(e);C(s,t),function(e,t){const s=F();s&&s.postMessage({key:e,fid:t});M()}(s,t)}function C(e,t){const s=I.get(e);if(s)for(const e of s)e(t)}let A=null;function F(){return!A&&"BroadcastChannel"in self&&(A=new BroadcastChannel("[Firebase] FID Change"),A.onmessage=e=>{C(e.data.key,e.data.fid)}),A}function M(){0===I.size&&A&&(A.close(),A=null)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const D="firebase-installations-database",O=1,N="firebase-installations-store";let L=null;function B(){return L||(L=(0,o.openDB)(D,O,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(N)}})),L}async function R(e,t){const s=j(e),n=(await B()).transaction(N,"readwrite"),a=n.objectStore(N),r=await a.get(s);return await a.put(t,s),await n.done,r&&r.fid===t.fid||P(e,t.fid),t}async function G(e){const t=j(e),s=(await B()).transaction(N,"readwrite");await s.objectStore(N).delete(t),await s.done}async function H(e,t){const s=j(e),n=(await B()).transaction(N,"readwrite"),a=n.objectStore(N),r=await a.get(s),o=t(r);return o===undefined?await a.delete(s):await a.put(o,s),await n.done,!o||r&&r.fid===o.fid||P(e,o.fid),o}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e){let t;const s=await H(e.appConfig,s=>{const n=function(e){const t=e||{fid:S(),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=y(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={fid:s,authVersion:m,appId:e.appId,sdkVersion:d},i={method:"POST",headers:a,body:JSON.stringify(o)},c=await T(()=>fetch(n,i));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 R(e.appConfig,s)}catch(s){throw g(s)&&409===s.customData.serverCode?await G(e.appConfig):await R(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===E?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function q(e){let t=await W(e.appConfig);for(;1===t.registrationStatus;)await _(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+l<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}async function K({appConfig:e,heartbeatServiceProvider:t},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=x(e,s),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={installation:{sdkVersion:d,appId:e.appId}},i={method:"POST",headers:a,body:JSON.stringify(o)},c=await T(()=>fetch(n,i));if(c.ok){return b(await c.json())}throw await w("Generate Auth Token",c)}async function V(e,t=!1){let s;const n=await H(e.appConfig,n=>{if(!J(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 z(e.appConfig);for(;1===s.authToken.requestStatus;)await _(100),s=await z(e.appConfig);const n=s.authToken;return 0===n.requestStatus?V(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 K(e,t),n=Object.assign(Object.assign({},t),{authToken:s});return await R(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 R(e.appConfig,s)}else await G(e.appConfig);throw s}}(e,t),t}});return s?await s:n.authToken}function z(e){return H(e,e=>{if(!J(e))throw p.create("not-registered");const t=e.authToken;return 1===(s=t).requestStatus&&s.requestTime+l<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 J(e){return e!==undefined&&2===e.registrationStatus}async function Y(e){const t=e,{installationEntry:s,registrationPromise:n}=await U(t);return n?n.catch(console.error):V(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 Q(e,t=!1){const s=e;await async function(e){const{registrationPromise:t}=await U(e);t&&await t}(s);return(await V(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:()=>Y(s),getToken:e=>Q(s,e)}};(0,n._registerComponent)(new a.Component(Z,ee,"PUBLIC")),(0,n._registerComponent)(new a.Component("installations-internal",te,"PRIVATE")),(0,n.registerVersion)(i,c),(0,n.registerVersion)(i,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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},o=s.LogLevel.INFO,i={[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=i[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=o,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 o=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:o,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 P.create("only-available-in-window");e.swRegistration||await G(e);return async function(e){const t=await E(e.firebaseDependencies);t&&(await C(e.firebaseDependencies,t.token),await async function(e){const t=j(e),s=(await v()).transaction(T,"readwrite");await s.objectStore(T).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,o.getApp)()){return z().then(e=>{if(!e)throw P.create("unsupported-browser")},e=>{throw P.create("indexed-db-unsupported")}),(0,o._getProvider)((0,r.getModularInstance)(e),"messaging").getImmediate()},s.getToken=async function(e,t){return H(e=(0,r.getModularInstance)(e),t)},s.isSupported=z,s.onMessage=function(e,t){return function(e,t){if(!navigator)throw P.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,r.getModularInstance)(e),t)},e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),r=e("@firebase/util"),o=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const i="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",l="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",d="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 y="firebase-messaging-database",x=1,T="firebase-messaging-store";let _=null;function v(){return _||(_=(0,a.openDB)(y,x,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(T)}})),_}async function E(e){const t=j(e),s=await v(),n=await s.transaction(T).objectStore(T).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 o;if(n<2)return;if(!s.objectStoreNames.contains(w))return;const i=r.objectStore(w),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey: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 S(e,t),t}}async function S(e,t){const s=j(e),n=(await v()).transaction(T,"readwrite");return await n.objectStore(T).put(t,s),await n.done,t}function j({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 I={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},P=new r.ErrorFactory("messaging","Messaging",I);async function C(e,t){const s={method:"DELETE",headers:await F(e)};try{const n=await fetch(`${A(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw P.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw P.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function A({projectId:e}){return`${d}/projects/${e}/registrations`}async function F({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 M({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==l&&(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 D=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 E(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+D?async function(e,t){try{const s=await async function(e,t){const s=await F(e),n=M(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let r;try{const s=await fetch(`${A(e.appConfig)}/${t.token}`,a);r=await s.json()}catch(e){throw P.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw P.create("token-update-failed",{errorInfo:e})}if(!r.token)throw P.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await S(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await C(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return N(e.firebaseDependencies,s)}return N(e.firebaseDependencies,s)}async function N(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 F(e),n=M(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let r;try{const t=await fetch(A(e.appConfig),a);r=await t.json()}catch(e){throw P.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw P.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw P.create("token-subscribe-no-token");return r.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await S(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,o;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const i=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;i&&(e.fcmOptions.link=i);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}function B(e){return P.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
!function(e,t){const 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 R{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 B("App Configuration Object");if(!e.name)throw B("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw B(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(i,{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 P.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function H(e,t){if(!navigator)throw P.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw P.create("permission-blocked");
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=l)}(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 P.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",K=e=>{const t=new R(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>q(t,e)),t},V=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>H(t,e)}};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function z(){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,o._registerComponent)(new n.Component("messaging",K,"PUBLIC")),(0,o._registerComponent)(new n.Component("messaging-internal",V,"PRIVATE")),(0,o.registerVersion)(W,$),(0,o.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"),o=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const i="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var l,d;
/**
 * @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"}(l||(l={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(d||(d={}));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=y(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 o;if(n<2)return;if(!s.objectStoreNames.contains(f))return;const i=r.objectStore(f),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:m(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}}})).close(),await 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=y(e),n=(await k()).transaction(p,"readwrite");return await n.objectStore(p).put(t,s),await n.done,t}function y({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 x={"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."},T=new r.ErrorFactory("messaging","Messaging",x);async function _(e,t){const s={method:"DELETE",headers:await E(e)};try{const n=await fetch(`${v(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw T.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw T.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function v({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function E({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 S({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==i&&(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 j(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 E(e),n=S(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let r;try{const s=await fetch(`${v(e.appConfig)}/${t.token}`,a);r=await s.json()}catch(e){throw T.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw T.create("token-update-failed",{errorInfo:e})}if(!r.token)throw T.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 _(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return P(e.firebaseDependencies,s)}return P(e.firebaseDependencies,s)}async function I(e){const t=await b(e.firebaseDependencies);t&&(await _(e.firebaseDependencies,t.token),await async function(e){const t=y(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 P(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 E(e),n=S(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let r;try{const t=await fetch(v(e.appConfig),a);r=await t.json()}catch(e){throw T.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw T.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw T.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 C(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=l.DISPLAY_NOTIFICATION.toString():a.message_type=l.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 A(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 C(t,s);const n=await M();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=d.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,o;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const i=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;i&&(e.fcmOptions.link=i);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}(s);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function F(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),o=new URL(self.location.origin);if(r.host!==o.host)return;let i=await async function(e){const t=await M();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 l;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */return i?i=await i.focus():(i=await self.clients.openWindow(a),await(l=3e3,new Promise(e=>{setTimeout(e,l)}))),i?(n.messageType=d.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,i.postMessage(n)):void 0}function M(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function D(e){return T.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 D("App Configuration Object");if(!e.name)throw D("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw D(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 N=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(A(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var s,n;const{newSubscription:a}=e;if(!a)return void await I(t);const r=await b(t.firebaseDependencies);await I(t),t.vapidKey=null!==(n=null===(s=null==r?void 0:r.subscriptionOptions)||void 0===s?void 0:s.vapidKey)&&void 0!==n?n:i,await j(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(F(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.
 */o._registerComponent(new n.Component("messaging-sw",N,"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=o.getApp()){return L().then(e=>{if(!e)throw T.create("unsupported-browser")},e=>{throw T.create("indexed-db-unsupported")}),o._getProvider(r.getModularInstance(e),"messaging-sw").getImmediate()},s.isSupported=L,s.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw T.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=P,s=C){const n=t*Math.pow(s,e),a=Math.round(F*n*(Math.random()-.5)*2);return Math.min(A,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[l(JSON.stringify({alg:"none",type:"JWT"})),l(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 S(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],o=s[r];if(E(n)&&E(o)){if(!e(n,o))return!1}else if(n!==o)return!1}for(const e of a)if(!n.includes(e))return!1;return!0},s.deepExtend=m,s.errorPrefix=I,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.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(I(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(I(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(I(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},o=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,o=r?e[t+1]:0,i=t+2<e.length,c=i?e[t+2]:0,l=a>>2,d=(3&a)<<4|o>>4;let m=(15&o)<<2|c>>6,u=63&c;i||(u=64,r||(m=64)),n.push(s[l],s[d],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++],o=e[s++];t[n++]=String.fromCharCode((15&a)<<12|(63&r)<<6|63&o)}}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 o=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==o||null==c)throw new i;const l=a<<2|r>>4;if(n.push(l),64!==o){const e=r<<4&240|o>>2;if(n.push(e),64!==c){const e=o<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}s.DecodeBase64StringError=i;const c=function(e){const t=r(e);return o.encodeByteArray(t,!0)};s.base64Encode=c;const l=function(e){return c(e).replace(/\./g,"")};s.base64urlEncodeWithoutPadding=l;const d=function(e){try{return o.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function 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=d;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&&d(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 y extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,x.prototype.create)}}s.FirebaseError=y;class x{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(T,(e,s)=>{const n=t[s];return null!=n?String(n):`<${s}?>`})}(a,s):"Error",o=`${this.serviceName}: ${r} (${n}).`;return new y(n,o,s)}}s.ErrorFactory=x;const T=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function _(e){return JSON.parse(e)}const v=function(e){let t={},s={},n={},a="";try{const r=e.split(".");t=_(d(r[0])||""),s=_(d(r[1])||""),a=r[2],n=s.d||{},delete s.d}catch(e){}return{header:t,claims:s,data:n,signature:a}};s.decode=v;s.isValidTimestamp=function(e){const t=v(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=v(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};s.isValidFormat=function(e){const t=v(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function E(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=v(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],o=this.chain_[1],i=this.chain_[2],c=this.chain_[3],l=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=c^o&(i^c),a=1518500249):(n=o^i^c,a=1859775393):e<60?(n=o&i|c&(o|i),a=2400959708):(n=o^i^c,a=3395469782);const t=(r<<5|r>>>27)+n+l+a+s[e]&4294967295;l=c,c=i,i=4294967295&(o<<30|o>>>2),o=r,r=t}this.chain_[0]=this.chain_[0]+r&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+i&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+l&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 S{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=j),n.error===undefined&&(n.error=j),n.complete===undefined&&(n.complete=j);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 j(){}
/**
 * @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 I(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 P=1e3,C=2,A=s.MAX_VALUE_MILLIS=144e5,F=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 o(e){try{c(n.next(e))}catch(e){r(e)}}function i(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(o,i)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var i=o(e("@json-schema-tools/traverse")),c=o(e("@json-schema-tools/reference-resolver")),l=o(e("fast-safe-stringify")),d=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,l.default)(e))].join("\n")};s.NonStringRefError=d;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 o=r[a];c.default.protocolHandlerMap[o]=this.options.protocolHandlerMap[o]}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,o,l,d,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,o=t,r.label=1;case 1:return a<o.length?(l=o[a],d=void 0,this.refCache[l]===undefined?[3,2]:(d=this.refCache[l],[3,5])):[3,11];case 2:if("#"!==l)return[3,3];if(this.options.rootSchema===undefined)throw new Error("options.rootSchema was not provided, but one of the schemas references '#'");return d=this.options.rootSchema,[3,5];case 3:return u=c.default.resolve(l,this.options.rootSchema),s.push(u),[4,u];case 4:d=r.sent(),r.label=5;case 5:return!0!==this.options.recursive||!0===d||!1===d||"#"===l?[3,9]:(h=n(n({},this.options),{refCache:this.refCache}),0===(f=new e(d,h)).refs.length?[3,7]:(p=f._resolve(),s.push(p),[4,p]));case 6:return g=r.sent(),this.refCache[l]=m(d,g),[3,8];case 7:this.refCache[l]=d,r.label=8;case 8:return[3,10];case 9:this.refCache[l]=d,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,i.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,i.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new d(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 o(e){try{c(n.next(e))}catch(e){r(e)}}function i(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(o,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=e("./errors"),i=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,i.default)(e)];case 1:return t=n.sent(),[3,3];case 2:throw n.sent(),new o.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 o.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 o=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};s.InvalidFileSystemPathError=o}}},{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 o(e){try{c(n.next(e))}catch(e){r(e)}}function i(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(o,i)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var i=o(e("./default-protocol-handler-map")),c=o(e("./reference-resolver")),l=n(n({},i.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(l)}}},{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 o(e){try{c(n.next(e))}catch(e){r(e)}}function i(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(o,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=e("./errors"),i=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,l,d,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,i.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 l=a.sent(),new o.NonJsonRefError({$ref:e},l.message);case 4:if(c!==undefined)return f=c,n&&(f=(0,i.default)(n,f)),[2,f];if(!1===e.includes("://"))throw new o.InvalidFileSystemPathError(e);d=0,m=Object.keys(this.protocolHandlerMap),a.label=5;case 5:return d<m.length?(u=m[d],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,i.default)(n,f)),[2,f];a.label=7;case 7:return d++,[3,5];case 8:throw new o.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("")},o=function(e,t){var s=t.find(function(t){return t===e});return s||!1},i=function(e,t){return void 0===t&&(t=1),e[e.length-t]};s.default=function e(t,c,l,d,m,u,h,f,p){void 0===l&&(l=s.defaultOptions),void 0===d&&(d=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),l);if(0===d&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===d?t:c(t,!1,r(h),i(u));var k=t;!1===g.mutable&&(k=n({},t)),u.push(k),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===d||(k=c(k,!1,r(h),i(u,2)))),m.push(t),f.push([t,k]);var b=function(t,s){var n=o(t,m);return n?(p.push(n),!0===g.skipFirstMutation&&n===m[0]?c(t,!0,r(s),i(u)):f.find(function(e){var t=e[0];return n===t})[1]):e(t,c,l,d+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=o(t.items,m);if(w)if(p.push(w),!0===g.skipFirstMutation&&w===m[0])k.items=c(t.items,!0,r(h),i(u));else{var y=f.find(function(e){var t=e[0];return w===t})[1];k.items=y}else k.items=e(t.items,c,l,d+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 x=t.properties,T={};Object.keys(t.properties).forEach(function(e){T[e]=b(x[e],a(a([],h,!0),["properties",e.toString()],!1))}),k.properties=T}if(t.patternProperties!==undefined){var _=t.patternProperties,v={};Object.keys(t.patternProperties).forEach(function(e){v[e]=b(_[e],a(a([],h,!0),["patternProperties",e.toString()],!1))}),k.patternProperties=v}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(k.additionalProperties=b(t.additionalProperties,a(a([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===d)return k;if(!0===g.bfs)return u.pop(),k;var E=-1!==p.indexOf(t);return u.pop(),c(k,E,r(h),i(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 o=["list","set","delete","clear"],i={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:i,name:s.controllerName,state:n}),this.messenger.registerMethodActionHandlers(this,o)}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 o={address:e,chainId:s,isEns:!1,memo:n,name:t,addressType:r,lastUpdatedAt:Date.now()},i=(0,a.normalizeEnsName)(t);return i&&(o.name=i,o.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[s]:{...this.state.addressBook[s],[e]:o}}}),"*"!==String(s)&&this.messenger.publish("AddressBookController:contactUpdated",o),!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 o=e("@metamask/base-controller"),i={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class l extends o.BaseController{constructor({messenger:e,state:t,allAnnouncements:s}){const o={...i,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:o}),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=l,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/accounts.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/accounts.cjs","./utils/authentication.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/authentication.cjs","./utils/bridge-status.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge.cjs","./utils/history.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/history.cjs","./utils/intent-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs","./utils/keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/keyring.cjs","./utils/metrics.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs","./utils/network.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/network.cjs","./utils/snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs","./utils/trace.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/trace.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-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/bridge-status-controller/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,o,i,c,l,d,m,u,h,f,p,g,k,b,w,y,x,T,_=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)};Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusController=void 0;const E=e("@metamask/bridge-controller"),S=e("@metamask/polling-controller"),j=e("@metamask/transaction-controller"),I=e("@metamask/utils"),P=e("./bridge-status-controller.intent.cjs"),C=e("./constants.cjs"),A=e("./types.cjs"),F=e("./utils/accounts.cjs"),M=e("./utils/authentication.cjs"),D=e("./utils/bridge.cjs"),O=e("./utils/bridge-status.cjs"),N=e("./utils/history.cjs"),L=e("./utils/intent-api.cjs"),B=e("./utils/keyring.cjs"),R=e("./utils/metrics.cjs"),G=e("./utils/network.cjs"),H=e("./utils/snaps.cjs"),U=e("./utils/trace.cjs"),q=e("./utils/transaction.cjs"),W={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class $ extends((0,S.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,fetchFn:S,addTransactionBatchFn:$,config:K,traceFn:V}){super({name:C.BRIDGE_STATUS_CONTROLLER_NAME,metadata:W,messenger:e,state:{...C.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),n.set(this,{}),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.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=E.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=C.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=C.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const t=(0,G.getSelectedChainId)(this.messenger);v(this,w,"f").call(this,e,t)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:s}=e;if(!t&&!s)throw new Error("Either txMetaId or txHash must be provided");let a;if(t?this.state.txHistory[t]&&(a=t):s&&(a=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===s)),!a)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${s}`));const r=this.state.txHistory[a],o=r.attempts?.counter??0;if(this.update(e=>{a&&(e.txHistory[a].attempts=undefined)}),(0,N.shouldPollHistoryItem)(r)){if(!v(this,n,"f")[a]&&(v(this,f,"f").call(this,a),!r.featureId)){const e=(0,F.getAccountByAddress)(this.messenger,r.account),t=(0,R.getRequestParamFromHistory)(r),s=(0,R.getRequestMetadataFromHistory)(r,e),{security_warnings:n,...i}=s;v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.PollingStatusUpdated,a,{...(0,R.getTradeDataFromHistory)(r),...(0,R.getPriceImpactFromQuote)(r.quote),...i,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:E.MetricsActionType.SWAPBRIDGE_V1,polling_status:E.PollingStatus.ManuallyRestarted,retry_attempts:o})}}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],m.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===E.StatusTypes.PENDING||e.status.status===E.StatusTypes.UNKNOWN).filter(e=>Boolean(e.txMetaId)).filter(e=>!v(this,n,"f")[e.txMetaId]).filter(e=>(0,N.shouldPollHistoryItem)(e)).forEach(e=>{const t=e.txMetaId;(0,O.shouldSkipFetchDueToFetchFailures)(e.attempts)||v(this,f,"f").call(this,t)})}),u.set(this,(...e)=>{const{historyKey:t,txHistoryItem:s}=(0,N.getInitialHistoryItem)(...e);this.update(e=>{e.txHistory[t]=s})}),h.set(this,(e,t)=>{this.update(s=>{(0,N.rekeyHistoryItemInState)(s,e,t)})}),f.set(this,e=>{const t=v(this,n,"f")[e];t&&this.stopPollingByPollingToken(t);const s=this.state.txHistory[e];s&&(0,N.shouldPollHistoryItem)(s)&&(v(this,n,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;if(!t?.id)throw new Error("Cannot start polling: bridgeTxMeta.id is required for polling");v(this,u,"f").call(this,e),v(this,f,"f").call(this,t.id)},this._executePoll=async e=>{await v(this,g,"f").call(this,e)},p.set(this,e=>{const{attempts:t}=this.state.txHistory[e],s=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},a=v(this,n,"f")[e];if(s.counter>=C.MAX_ATTEMPTS&&a){this.stopPollingByPollingToken(a),delete v(this,n,"f")[e];const t=this.state.txHistory[e];if(t&&!t.featureId){const n=(0,F.getAccountByAddress)(this.messenger,t.account),a=(0,R.getRequestParamFromHistory)(t),r=(0,R.getRequestMetadataFromHistory)(t,n),{security_warnings:o,...i}=r;v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.PollingStatusUpdated,e,{...(0,R.getTradeDataFromHistory)(t),...(0,R.getPriceImpactFromQuote)(t.quote),...i,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:E.MetricsActionType.SWAPBRIDGE_V1,polling_status:E.PollingStatus.MaxPollingReached,retry_attempts:s.counter})}}this.update(t=>{t.txHistory[e].attempts=s})}),g.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state,s=t[e];if(s&&!(0,O.shouldSkipFetchDueToFetchFailures)(s.attempts))try{let t,c=[];if(s.quote.intent){const n=await v(this,a,"f").getIntentTransactionStatus(e,s.quote.srcChainId,s.quote.intent.protocol,v(this,r,"f"),s.status.srcChain.txHash);if(null===n?.bridgeStatus||n?.bridgeStatus===undefined)return;t=n.bridgeStatus.status}else{const n=v(this,k,"f").call(this,e);if(!n)return;v(this,b,"f").call(this,e,n);const a=(0,O.getStatusRequestWithSrcTxHash)(s.quote,n),l=await(0,O.fetchBridgeTxStatus)(a,v(this,r,"f"),await(0,M.getJwt)(this.messenger),v(this,o,"f"),v(this,i,"f").customBridgeApiBaseUrl);t=l.status,c=l.validationFailures}if(c.length>0)throw v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:c,refresh_count:s.attempts?.counter??0}),new Error(`Bridge status validation failed: ${c.join(", ")}`);const l={...s,status:t,completionTime:t.status===E.StatusTypes.COMPLETE||t.status===E.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=l}),s.quote.intent&&v(this,a,"f").syncTransactionFromIntentStatus(e,s);const d=v(this,n,"f")[e];if((t.status===E.StatusTypes.COMPLETE||t.status===E.StatusTypes.FAILED)&&d){if(this.stopPollingByPollingToken(d),delete v(this,n,"f")[e],s.featureId)return;t.status===E.StatusTypes.COMPLETE&&(v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",s.quote.destAsset.assetId)),t.status===E.StatusTypes.FAILED&&v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),v(this,p,"f").call(this,e)}}),k.set(this,e=>{const{txHistory:t}=this.state,s=t[e].status.srcChain.txHash;if(s)return s;const n=(0,q.getTransactionMetaById)(this.messenger,e);return n?.hash}),b.set(this,(e,t)=>{const{txHistory:s}=this.state;s[e].status.srcChain.txHash||this.update(s=>{s.txHistory[e].status.srcChain.txHash=t})}),w.set(this,(e,t)=>{const s=Object.keys(this.state.txHistory).filter(s=>{const n=this.state.txHistory[s],a=(0,I.numberToHex)(n.quote.srcChainId);return n.account===e&&a===t});s.forEach(e=>{v(this,n,"f")[e]&&this.stopPollingByPollingToken(v(this,n,"f")[e])}),this.update(e=>{e.txHistory=s.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),y.set(this,async(e,t,s,n,a,r)=>{if(n&&(0,E.isEvmTxData)(n)){const o=async()=>{a&&await(0,q.submitEvmTransaction)({messenger:this.messenger,transactionType:j.TransactionType.bridgeApproval,trade:a});const e=await(0,q.submitEvmTransaction)({messenger:this.messenger,transactionType:t?j.TransactionType.bridgeApproval:j.TransactionType.swapApproval,trade:n,requireApproval:r});return await(0,q.handleApprovalDelay)(s),e};return await v(this,l,"f").call(this,(0,U.getApprovalTraceParams)(e,!1),o)}return undefined}),x.set(this,async e=>{const t=await(0,q.getAddTransactionBatchParams)({messenger:this.messenger,...e});return await(0,q.addTransactionBatch)(this.messenger,v(this,c,"f"),t)}),this.submitTx=async(e,t,s,n,a=E.MetaMetricsSwapsEventSource.MainView,o,i)=>{(0,D.stopPollingForQuotes)(this.messenger,t.featureId,n);const c=(0,F.getAccountByAddress)(this.messenger,e);if(!c)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const d=(0,E.isHardwareWallet)(c),m=(0,R.getPreConfirmationPropertiesFromQuote)(t,s,d,a,o,i);let p,g,k=!1;const b=Date.now(),w=(0,E.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),_=(0,E.isTronChainId)(t.quote.srcChainId);try{if(!t.featureId&&v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Submitted,undefined,m),(0,E.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,E.isTronTrade)(t.approval)){const e=await v(this,l,"f").call(this,(0,U.getApprovalTraceParams)(t,!1),async()=>t.approval&&(0,E.isTronTrade)(t.approval)?await(0,H.handleNonEvmTx)(this.messenger,t.approval,t,c):undefined);g=e?.id,await(0,q.handleApprovalDelay)(t.quote.srcChainId)}p=await v(this,l,"f").call(this,(0,U.getTraceParams)(t,!1),async()=>{if(!(0,E.isTronTrade)(t.trade)&&!(0,E.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(0,H.handleNonEvmTx)(this.messenger,t.trade,t,c)})}else{const e=v(this,r,"f")===A.BridgeClientId.MOBILE&&d;p=await v(this,l,"f").call(this,(0,U.getTraceParams)(t,s),async()=>{if(!(0,E.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");const n=(0,E.formatChainIdToHex)(t.quote.srcChainId);if(k=await(0,q.checkIsDelegatedAccount)(this.messenger,t.trade.from,[n]),s||t.quote.gasIncluded7702||k){const{tradeMeta:s,approvalMeta:n}=await v(this,x,"f").call(this,{isBridgeTx:w,resetApproval:t.resetApproval,approval:t.approval&&(0,E.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e,isDelegatedAccount:k});return g=n?.id,s}const r=await v(this,y,"f").call(this,t,w,t.quote.srcChainId,t.approval&&(0,E.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);g=r?.id,e&&r?(await(0,q.handleMobileHardwareWalletDelay)(e),await(0,q.waitForTxConfirmation)(this.messenger,r.id)):await(0,q.handleMobileHardwareWalletDelay)(e);const l=(0,q.generateActionId)().toString();v(this,u,"f").call(this,{accountAddress:c.address,quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:b,approvalTxId:g,location:a,abTests:o,activeAbTests:i,actionId:l});const d=await(0,q.submitEvmTransaction)({messenger:this.messenger,transactionType:w?j.TransactionType.bridge:j.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined,actionId:l});return v(this,h,"f").call(this,l,d),d})}}catch(e){throw!t.featureId&&v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...m}),e}try{!((0,E.isNonEvmChainId)(t.quote.srcChainId)||s||t.quote.gasIncluded7702||k)||v(this,u,"f").call(this,{accountAddress:c.address,bridgeTxMeta:p,quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:b,approvalTxId:g,location:a,abTests:o,activeAbTests:i}),(0,E.isNonEvmChainId)(t.quote.srcChainId)&&(v(this,f,"f").call(this,p.id),w||_||v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Completed,p.id))}catch{}return p},this.submitIntent=async e=>{const{quoteResponse:t,accountAddress:s,location:n,abTests:a,activeAbTests:c}=e;(0,D.stopPollingForQuotes)(this.messenger);const l=Date.now(),d=(0,F.getAccountByAddress)(this.messenger,s),m=Boolean(d)&&(0,E.isHardwareWallet)(d),h=(0,R.getPreConfirmationPropertiesFromQuote)(t,!1,m,n,a,c);try{const e=(0,L.getIntentFromQuote)(t),d=(0,E.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),h=m&&v(this,r,"f")===A.BridgeClientId.MOBILE,p=await v(this,y,"f").call(this,t,d,t.quote.srcChainId,t.approval,t.resetApproval,h),g=p?.id;g&&await(0,q.waitForTxConfirmation)(this.messenger,g);const{srcChainId:k,requestId:b}=t.quote,w={srcChainId:k,quoteId:b,signature:await(0,B.signTypedMessage)({messenger:this.messenger,accountAddress:s,typedData:e.typedData}),order:e.order,userAddress:s,aggregatorId:e.protocol},{id:x,status:T}=await(0,L.postSubmitOrder)({params:w,clientId:v(this,r,"f"),jwt:await(0,M.getJwt)(this.messenger),fetchFn:v(this,o,"f"),bridgeApiBaseUrl:v(this,i,"f").customBridgeApiBaseUrl}),_=d?j.TransactionType.bridge:j.TransactionType.swap,S=(0,G.getNetworkClientIdByChainId)(this.messenger,k),I={chainId:(0,E.formatChainIdToHex)(k),from:s,to:e.settlementContract??"0x9008D19f58AAbd9eD0D60971565AA8510560ab41",data:`0x${x.slice(-8)}`,value:"0x0",gas:"0x5208",gasPrice:"0x3b9aca00"},P={...await(0,q.addSyntheticTransaction)(this.messenger,I,{requireApproval:!1,networkClientId:S,type:_}),status:(0,L.mapIntentOrderStatusToTransactionStatus)(T),isIntentTx:!0,orderUid:x};try{const e=x,r={...P,id:e,originalTransactionId:P.id};v(this,u,"f").call(this,{accountAddress:s,bridgeTxMeta:r,quoteResponse:t,slippagePercentage:0,isStxEnabled:!1,approvalTxId:g,startTime:l,location:n,abTests:a,activeAbTests:c}),v(this,f,"f").call(this,e)}catch(e){console.error("📝 [submitIntent] Failed to add to bridge history",e)}return P}catch(e){throw v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...h}),e}},T.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,o=s?.active_ab_tests??a,i={action_type:E.MetricsActionType.SWAPBRIDGE_V1,location:s?.location??(t?this.state.txHistory?.[t]?.location:undefined)??E.MetaMetricsSwapsEventSource.MainView,...s??{},...r&&Object.keys(r).length>0&&{ab_tests:r},...o&&o.length>0&&{active_ab_tests:o}};if(!t)return void(0,D.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:i});const c=this.state.txHistory[t];if(!c)return void(0,D.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:i});const{featureId:l,approvalTxId:d,quote:m}=c,u=(0,R.getRequestParamFromHistory)(c);if(e===E.UnifiedSwapBridgeEventName.StatusValidationFailed)return void(0,D.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:{...i,chain_id_source:u.chain_id_source,chain_id_destination:u.chain_id_destination,token_address_source:u.token_address_source,token_address_destination:u.token_address_destination,refresh_count:c.attempts?.counter??0}});if(l)return;const h=(0,F.getAccountByAddress)(this.messenger,c.account),f=(0,q.getTransactions)(this.messenger),p=f.find(e=>e.id===t),g=f.find(e=>e.id===d),k={...i,...u,...(0,R.getRequestMetadataFromHistory)(c,h),...(0,R.getTradeDataFromHistory)(c),...(0,R.getTxStatusesFromHistory)(c),...(0,R.getFinalizedTxProperties)(c,p,g),...(0,R.getPriceImpactFromQuote)(m)};(0,D.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:k})}),_(this,r,s,"f"),_(this,o,S,"f"),_(this,c,$,"f"),_(this,i,{customBridgeApiBaseUrl:K?.customBridgeApiBaseUrl??C.BRIDGE_PROD_API_BASE_URL},"f"),_(this,l,V??((e,t)=>t?.()),"f"),_(this,a,new P.IntentManager({messenger:this.messenger,customBridgeApiBaseUrl:v(this,i,"f").customBridgeApiBaseUrl,fetchFn:v(this,o,"f")}),"f"),this.messenger.registerActionHandler(`${C.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${C.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${C.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${C.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${C.BRIDGE_STATUS_CONTROLLER_NAME}:submitIntent`,this.submitIntent.bind(this)),this.messenger.registerActionHandler(`${C.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${C.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength(C.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:s,id:n,actionId:a}=e;if(t&&[j.TransactionType.bridge,j.TransactionType.swap,j.TransactionType.bridgeApproval,j.TransactionType.swapApproval].includes(t)&&[j.TransactionStatus.failed,j.TransactionStatus.dropped,j.TransactionStatus.rejected].includes(s)&&(v(this,d,"f").call(this,e),s!==j.TransactionStatus.rejected)){let t;this.state.txHistory[n]?t=n:a&&this.state.txHistory[a]&&(t=a),v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Failed,t??n,(0,R.getEVMTxPropertiesFromTransactionMeta)(e))}}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:s,chainId:n}=e;t===j.TransactionType.swap&&v(this,T,"f").call(this,E.UnifiedSwapBridgeEventName.Completed,s),t!==j.TransactionType.bridge||(0,E.isNonEvmChainId)(n)||v(this,f,"f").call(this,s)}),v(this,m,"f").call(this)}}s.BridgeStatusController=$,n=new WeakMap,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=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,y=new WeakMap,x=new WeakMap,T=new WeakMap}}},{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/authentication.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/authentication.cjs","./utils/intent-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.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-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,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},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.IntentManager=void 0;const l=e("@metamask/bridge-controller"),d=e("./utils/authentication.cjs"),m=e("./utils/intent-api.cjs"),u=e("./utils/transaction.cjs");e("./utils/validators.cjs");s.IntentManager=class{constructor({messenger:e,customBridgeApiBaseUrl:t,fetchFn:s}){n.add(this),a.set(this,void 0),r.set(this,new Map),this.getIntentTransactionStatus=async(e,t,s,a,r)=>{try{const i=await this.intentApi.getOrderStatus(e,s,t,a);return c(this,n,"m",o).call(this,e,i,t,r)}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=c(this,r,"f").get(e);if(n)try{const t=(0,u.getTransactionMetaById)(c(this,a,"f"),s);if(!t)return void console.warn("[Intent polling] Skipping update, transaction not found",{originalTxId:s,bridgeHistoryKey:e});const{bridgeStatus:o,orderStatus:i}=n,d=o?.txHash,m=o?.status.status===l.StatusTypes.COMPLETE,h=o?.status.status===l.StatusTypes.COMPLETE||o?.status.status===l.StatusTypes.FAILED,f=t.txReceipt,p=d?{txReceipt:{...f,transactionHash:d,status:m?"0x1":"0x0"}}:{};(0,u.updateTransaction)(c(this,a,"f"),t,{status:o?.transactionStatus,...d?{hash:d}:{},...p},`BridgeStatusController - Intent order status updated: ${i}`),h&&c(this,r,"f").delete(e)}catch(t){console.error("[Intent polling] Failed to update transaction status",{originalTxId:s,bridgeHistoryKey:e,error:t})}},i(this,a,e,"f"),this.intentApi=new m.IntentApiImpl(t,s,async()=>await(0,d.getJwt)(e))}},a=new WeakMap,r=new WeakMap,n=new WeakSet,o=function(e,t,s,n){const a=(0,m.translateIntentOrderToBridgeStatus)(t,s,n),o={orderStatus:t.status,bridgeStatus:a};return c(this,r,"f").set(e,o),o}}}},{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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),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}})}}},{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/accounts.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getAccountByAddress=void 0;s.getAccountByAddress=(e,t)=>e.call("AccountsController:getAccountByAddress",t)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/accounts.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/authentication.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getJwt=void 0;s.getJwt=async e=>{try{return await e.call("AuthenticationController:getBearerToken")}catch(e){return console.error("Error getting JWT token for bridge-api request",e),undefined}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/authentication.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-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.getStatusRequestParams=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"),o=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,o,i,c)=>{const l=(0,s.getStatusRequestDto)(e),d=new URLSearchParams(l),m=`${(0,s.getBridgeStatusUrl)(c)}?${d.toString()}`,u=await i(m,{headers:(0,n.getClientHeaders)({clientId:t,jwt:o})}),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:o}=e;return{bridgeId:s,srcTxHash:t,bridge:n[0],srcChainId:a,destChainId:r,quote:e,refuel:Boolean(o)}};s.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=o.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1};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)})}}},{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/bridge.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-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.trackMetricsEvent=s.stopPollingForQuotes=void 0;const n=e("@metamask/bridge-controller");s.stopPollingForQuotes=(e,t,s)=>{e.call("BridgeController:stopPollingForQuotes",n.AbortReason.TransactionSubmitted,t?undefined:s)};s.trackMetricsEvent=({messenger:e,eventName:t,properties:s})=>{e.call("BridgeController:trackUnifiedSwapBridgeEvent",t,s)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.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=void 0;const n=e("bignumber.js"),a=(e,t)=>e&&t?new n.BigNumber(e,16).times(new n.BigNumber(t,16)):null;s.calcActualGasUsed=({pricingData:e},t,s)=>{const r=e?.quotedGasInUsd&&e?.quotedGasAmount?new n.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,o=a(t?.gasUsed,t?.effectiveGasPrice)?.plus(a(s?.gasUsed,s?.effectiveGasPrice)??0),i=o?.div(new n.BigNumber(10).pow(18)).toString(10);return o&&i?{amount:o.toString(10),usd:r?.multipliedBy(i).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/history.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-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.shouldPollHistoryItem=s.getInitialHistoryItem=s.getHistoryKey=s.rekeyHistoryItemInState=void 0;const n=e("@metamask/bridge-controller");function a(e,t,s){const n=e??t??s;if(!n)throw new Error("Cannot add tx to history: either actionId, bridgeTxMeta.id, or syntheticTransactionId must be provided");return 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.getHistoryKey=a;s.getInitialHistoryItem=e=>{const{bridgeTxMeta:t,quoteResponse:s,startTime:r,slippagePercentage:o,initialDestAssetBalance:i,targetContractAddress:c,approvalTxId:l,isStxEnabled:d,location:m,abTests:u,activeAbTests:h,accountAddress:f,originalTransactionId:p,actionId:g}=e;return{historyKey:a(g,t?.id,p),txHistoryItem:{txMetaId:t?.id,actionId:g,originalTransactionId:p??t?.id,batchId:t?.batchId,quote:s.quote,startTime:r,estimatedProcessingTimeInSeconds:s.estimatedProcessingTimeInSeconds,slippagePercentage:o,pricingData:{amountSent:s.sentAmount?.amount??"0",amountSentInUsd:s.sentAmount?.usd??undefined,quotedGasInUsd:s.gasFee?.effective?.usd??undefined,quotedReturnInUsd:s.toTokenAmount?.usd??undefined,quotedGasAmount:s.gasFee?.effective?.amount??undefined},initialDestAssetBalance:i,targetContractAddress:c,account:f,status:{status:n.StatusTypes.PENDING,srcChain:{chainId:s.quote.srcChainId,txHash:t?.hash}},hasApprovalTx:Boolean(s.approval),approvalTxId:l,isStxEnabled:Boolean(d),featureId:s.featureId,location:m,...u&&{abTests:u},...h&&{activeAbTests:h}}}};s.shouldPollHistoryItem=e=>{const t=Boolean(e?.quote?.intent);return[(0,n.isCrossChain)(e.quote.srcChainId,e.quote.destChainId),t,(0,n.isTronChainId)(e.quote.srcChainId)].some(Boolean)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/history.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-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,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},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.postSubmitOrder=s.getIntentFromQuote=s.mapIntentOrderStatusToTransactionStatus=s.translateIntentOrderToBridgeStatus=s.IntentApiImpl=void 0;const c=e("@metamask/bridge-controller"),l=e("@metamask/transaction-controller"),d=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),o(this,n,e,"f"),o(this,a,t,"f"),o(this,r,s,"f")}async getOrderStatus(e,t,s,o){const l=`${i(this,n,"f")}/getOrderStatus?orderId=${e}&aggregatorId=${encodeURIComponent(t)}&srcChainId=${s}`;try{const e=await i(this,r,"f").call(this),t=await i(this,a,"f").call(this,l,{method:"GET",headers:(0,c.getClientHeaders)({clientId:o,jwt:e})});if(!(0,d.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 d.IntentOrderStatus.PENDING:case d.IntentOrderStatus.SUBMITTED:return l.TransactionStatus.submitted;case d.IntentOrderStatus.CONFIRMED:case d.IntentOrderStatus.COMPLETED:return l.TransactionStatus.confirmed;case d.IntentOrderStatus.FAILED:case d.IntentOrderStatus.EXPIRED:case d.IntentOrderStatus.CANCELLED:return l.TransactionStatus.failed;default:return l.TransactionStatus.submitted}}s.translateIntentOrderToBridgeStatus=(e,t,s)=>{let n;switch(e.status){case d.IntentOrderStatus.CONFIRMED:case d.IntentOrderStatus.COMPLETED:n=c.StatusTypes.COMPLETE;break;case d.IntentOrderStatus.FAILED:case d.IntentOrderStatus.EXPIRED:case d.IntentOrderStatus.CANCELLED:n=c.StatusTypes.FAILED;break;case d.IntentOrderStatus.PENDING:n=c.StatusTypes.PENDING;break;case d.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,s.getIntentFromQuote=function(e){const{intent:t}=e.quote;if(!t)throw new Error("submitIntent: missing intent data");return t};s.postSubmitOrder=async({params:e,clientId:t,jwt:s,fetchFn:n,bridgeApiBaseUrl:a})=>{const r=`${a}/submitOrder`;try{const a=await n(r,{method:"POST",headers:{"Content-Type":"application/json",...(0,c.getClientHeaders)({clientId:t,jwt:s})},body:JSON.stringify(e)});if(!(0,d.validateIntentStatusResponse)(a))throw new Error("Invalid submitOrder response");return a}catch(e){if(e instanceof Error)throw new Error(`Failed to submit intent: ${e.message}`);throw new Error("Failed to submit intent")}}}}},{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/keyring.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.signTypedMessage=void 0;const n=e("@metamask/keyring-controller");s.signTypedMessage=async({messenger:e,accountAddress:t,typedData:s})=>await e.call("KeyringController:signTypedMessage",{from:t,data:s},n.SignTypedDataVersion.V4)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/keyring.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-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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"),o=e("./gas.cjs"),i=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,o=e.destChain?.txHash?e.status:n.StatusTypes.PENDING,i=(0,n.formatChainIdToHex)(a.srcChainId),c=(0,n.isEthUsdt)(i,a.srcAsset.address),l=e.srcChain.txHash?n.StatusTypes.COMPLETE:undefined,d=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING;return{allowance_reset_transaction:c?l:undefined,approval_transaction:t||s?d:undefined,source_transaction:r,destination_transaction:e.status===n.StatusTypes.FAILED?n.StatusTypes.FAILED:o}};s.getFinalizedTxProperties=(e,t,s)=>{const n=s?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===a.TransactionType.swap?t?.time:e.completionTime,l=(0,o.calcActualGasUsed)(e,t?.txReceipt,s?.txReceipt),d=t?.type===a.TransactionType.swap?(0,i.getActualSwapReceivedAmount)(e,l,t):(0,i.getActualBridgeReceivedAmount)(e),m=e.pricingData?.quotedGasAmount&&l?.amount?new r.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new r.BigNumber(10).pow(18)).div(l.amount).toNumber():0,u=e.pricingData?.quotedReturnInUsd&&d?.usd?new r.BigNumber(e.pricingData.quotedReturnInUsd).div(d.usd).toNumber():0;return{actual_time_minutes:c&&n?(c-n)/6e4:0,usd_actual_return:Number(d?.usd??0),usd_actual_gas:l?.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,o,i)=>{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,...o&&Object.keys(o).length>0&&{ab_tests:o},...i&&i.length>0&&{active_ab_tests:i}}};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/network.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-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.getNetworkClientIdByChainId=s.getSelectedChainId=void 0;const n=e("@metamask/bridge-controller");s.getSelectedChainId=e=>{const{selectedNetworkClientId:t}=e.call("NetworkController:getState");return e.call("NetworkController:getNetworkClientById",t).configuration.chainId};s.getNetworkClientIdByChainId=(e,t)=>{const s=(0,n.formatChainIdToHex)(t);return e.call("NetworkController:findNetworkClientIdByChainId",s)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/network.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-controller/dist/index.cjs","@metamask/snaps-controllers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-controllers/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/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.handleNonEvmTx=s.handleNonEvmTxResponse=s.getTxMetaFields=s.getClientRequest=s.createClientTransactionRequest=void 0;const n=e("@metamask/bridge-controller"),a=(e("@metamask/snaps-controllers"),e("@metamask/transaction-controller")),r=e("uuid");s.createClientTransactionRequest=(e,t,s,n,a)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,r.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:s,accountId:n,...a&&{options:a}}}});s.getClientRequest=(e,t,a,r)=>{const o=(0,n.formatChainIdToCaip)(t),i=(0,n.extractTradeData)(e),c=(0,n.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,s.createClientTransactionRequest)(r,i,o,a,c)};s.getTxMetaFields=(e,t)=>{let s;try{s=(0,n.formatChainIdToHex)(e.quote.destChainId)}catch{s=a.CHAIN_IDS.MAINNET}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,o,i)=>{const c=i.address,l=i.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 m=(0,n.isCrossChain)(o.quote.srcChainId,o.quote.destChainId);let u;try{u=(0,n.formatChainIdToHex)(o.quote.srcChainId)}catch{u="0x1"}const h=(0,n.extractTradeData)(t);return{...(0,s.getTxMetaFields)(o),time:Date.now(),id:d??(0,r.v4)(),chainId:u,networkClientId:l??"mainnet",txParams:{from:c,data:h},type:m?a.TransactionType.bridge:a.TransactionType.swap,status:a.TransactionStatus.submitted,hash:d,origin:l,isSolana:!0,isBridgeTx:m}};s.handleNonEvmTx=async(e,t,n,a)=>{if(!a.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const r=(0,s.getClientRequest)(t,n.quote.srcChainId,a.id,a.metadata?.snap?.id),o=await e.call("SnapController:handleRequest",r);return(0,s.handleNonEvmTxResponse)(o,t,n,a)}}}},{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-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,o=e.quote.destTokenAmount;if(!s?.txReceipt)return null;const i=(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,o=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 o?.data?new a.BigNumber(o.data,16).div(new a.BigNumber(10).pow(r.destAsset.decimals)):null})(e,s),c=r?.quotedReturnInUsd&&o?new a.BigNumber(r.quotedReturnInUsd).div(o).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:i,usd:i&&c?c.multipliedBy(i):null}};s.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:s,status:n}=e,r=s?.quotedReturnInUsd?new a.BigNumber(s.quotedReturnInUsd).div(t.destTokenAmount):null,o=n.destChain?.amount;return o&&r?{amount:o,usd:r.multipliedBy(o).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/trace.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-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.getApprovalTraceParams=s.getTraceParams=void 0;const n=e("@metamask/bridge-controller"),a=e("../constants.cjs");s.getTraceParams=(e,t)=>({name:(0,n.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?a.TraceName.BridgeTransactionCompleted:a.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,n.formatChainIdToCaip)(e.quote.srcChainId),stxEnabled:t}});s.getApprovalTraceParams=(e,t)=>({name:(0,n.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?a.TraceName.BridgeTransactionApprovalCompleted:a.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,n.formatChainIdToCaip)(e.quote.srcChainId),stxEnabled:t}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/trace.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","./accounts.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/accounts.cjs","./network.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/network.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/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/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/index.cjs","@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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.submitEvmTransaction=s.addTransactionBatch=s.findAndUpdateTransactionsInBatch=s.getAddTransactionBatchParams=s.toBatchTxParams=s.waitForTxConfirmation=s.handleMobileHardwareWalletDelay=s.handleApprovalDelay=s.addSyntheticTransaction=s.generateActionId=s.addTransaction=s.checkIsDelegatedAccount=s.updateTransaction=s.getTransactionMetaByHash=s.getTransactionMetaById=s.getTransactions=s.calculateGasFees=s.getTxGasEstimates=s.getGasFeeEstimates=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/controller-utils"),r=e("@metamask/transaction-controller"),o=e("@metamask/utils"),i=e("bignumber.js"),c=e("./accounts.cjs"),l=e("./network.cjs"),d=e("../constants.cjs");s.getGasFeeEstimates=async(e,t)=>{const{estimates:s}=await e.call("TransactionController:estimateGasFee",t);return n.BRIDGE_PREFERRED_GAS_ESTIMATE in s&&"object"==typeof s[n.BRIDGE_PREFERRED_GAS_ESTIMATE]&&"maxFeePerGas"in s[n.BRIDGE_PREFERRED_GAS_ESTIMATE]&&"maxPriorityFeePerGas"in s[n.BRIDGE_PREFERRED_GAS_ESTIMATE]?s[n.BRIDGE_PREFERRED_GAS_ESTIMATE]:{}};s.getTxGasEstimates=async(e,t)=>{const{gasFeeEstimates:n}=e.call("GasFeeController:getState"),a="estimatedBaseFee"in n?n.estimatedBaseFee:"0",{maxFeePerGas:r,maxPriorityFeePerGas:o}=await(0,s.getGasFeeEstimates)(e,t);return{baseAndPriorityFeePerGas:o?new i.BigNumber(a,10).times(10**9).plus(o,16):undefined,maxFeePerGas:r,maxPriorityFeePerGas:o}};s.calculateGasFees=async(e,t,{chainId:n,gasLimit:r,...o},i,c,l)=>{if(e)return{};if(l)return{...l,gas:r?.toString()};const d={...o,gas:r?.toString(),data:o.data,to:o.to,value:o.value},{maxFeePerGas:m,maxPriorityFeePerGas:u}=await(0,s.getTxGasEstimates)(t,{transactionParams:d,networkClientId:i,chainId:c});return{maxFeePerGas:m,maxPriorityFeePerGas:u,gas:(0,a.toHex)(d.gas??0)}};s.getTransactions=e=>e.call("TransactionController:getState").transactions??[];s.getTransactionMetaById=(e,t)=>(0,s.getTransactions)(e).find(e=>e.id===t);s.getTransactionMetaByHash=(e,t)=>(0,s.getTransactions)(e).find(e=>e.hash===t);s.updateTransaction=(e,t,s,n)=>e.call("TransactionController:updateTransaction",{...t,...s},n);s.checkIsDelegatedAccount=async(e,t,s)=>{try{return(await e.call("TransactionController:isAtomicBatchSupported",{address:t,chainIds:s})).some(e=>e.isSupported&&e.delegationAddress)}catch{return!1}};s.addTransaction=async(e,...t)=>{const{result:n}=await e.call("TransactionController:addTransaction",...t);return await(async(e,t)=>{const n=await t,a=(0,s.getTransactionMetaByHash)(e,n);if(!a)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return a})(e,n)};s.generateActionId=()=>(Date.now()+Math.random()).toString();s.addSyntheticTransaction=async(e,...t)=>{const{transactionMeta:n}=await e.call("TransactionController:addTransaction",t[0],{origin:"metamask",actionId:(0,s.generateActionId)(),isStateOnly:!0,...t[1]});return n};s.handleApprovalDelay=async e=>{if([n.ChainId.LINEA,n.ChainId.BASE].includes(e)){(0,o.createProjectLogger)("bridge")("Delaying submitting bridge tx to make Linea and Base confirmation more likely");const e=new Promise(e=>setTimeout(e,d.APPROVAL_DELAY_MS));await e}};s.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};s.waitForTxConfirmation=async(e,t,{timeoutMs:n=3e5,pollMs:a=3e3}={})=>{const o=Date.now();for(;;){const i=(0,s.getTransactionMetaById)(e,t);if(i){if(i.status===r.TransactionStatus.confirmed)return i;if(i.status===r.TransactionStatus.failed||i.status===r.TransactionStatus.dropped||i.status===r.TransactionStatus.rejected)throw new Error("Approval transaction did not confirm")}if(Date.now()-o>n)throw new Error("Timed out waiting for approval confirmation");await new Promise(e=>setTimeout(e,a))}};s.toBatchTxParams=(e,{chainId:t,gasLimit:s,...n},{maxFeePerGas:r,maxPriorityFeePerGas:o,gas:i})=>{const c={...n,data:n.data,to:n.to,value:n.value};return e?c:{...c,gas:(0,a.toHex)(i??0),maxFeePerGas:(0,a.toHex)(r??0),maxPriorityFeePerGas:(0,a.toHex)(o??0)}};s.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:a,resetApproval:o,trade:i,quoteResponse:{quote:{feeData:{txFee:d},gasIncluded:m,gasIncluded7702:u,gasSponsored:h},sentAmount:f,toTokenAmount:p},requireApproval:g=!1,isDelegatedAccount:k=!1})=>{const b=m||u;if(!(0,c.getAccountByAddress)(e,i.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const w=(0,n.formatChainIdToHex)(i.chainId),y=(0,l.getNetworkClientIdByChainId)(e,w),x=!0===u;let T=!x&&!k;m&&!u&&(T=!0);const _=[];if(o){const n=await(0,s.calculateGasFees)(x,e,o,y,w,b?d:undefined);_.push({type:t?r.TransactionType.bridgeApproval:r.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(x,o,n)})}if(a){const n=await(0,s.calculateGasFees)(x,e,a,y,w,b?d:undefined);_.push({type:t?r.TransactionType.bridgeApproval:r.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(x,a,n)})}const v=await(0,s.calculateGasFees)(x,e,i,y,w,b?d:undefined);_.push({type:t?r.TransactionType.bridge:r.TransactionType.swap,params:(0,s.toBatchTxParams)(x,i,v),assetsFiatValues:{sending:f?.valueInCurrency?.toString(),receiving:p?.valueInCurrency?.toString()}});return{disable7702:T,isGasFeeIncluded:Boolean(u),isGasFeeSponsored:Boolean(h),networkClientId:y,requireApproval:g,origin:"metamask",from:i.from,transactions:_}};s.findAndUpdateTransactionsInBatch=({messenger:e,batchId:t,txDataByType:n})=>{const a=(0,s.getTransactions)(e),o={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(n).forEach(([n,i])=>{if(i===undefined)return;const c=a.find(e=>{if(e.batchId!==t)return!1;if(Array.isArray(e.txParams.authorizationList)&&e.txParams.authorizationList.length>0||Boolean(e.delegationAddress)){if((n===r.TransactionType.swap||n===r.TransactionType.bridge)&&e.type===r.TransactionType.batch)return!0;if((n===r.TransactionType.swapApproval||n===r.TransactionType.bridgeApproval)&&e.txParams.data===i)return!0}return e.txParams.data===i});if(c){const t={...c,type:n};(0,s.updateTransaction)(e,c,{type:n},`Update tx type to ${n}`);const a=[r.TransactionType.bridgeApproval,r.TransactionType.swapApproval];o[a.includes(n)?"approvalMeta":"tradeMeta"]=t}}),o};s.addTransactionBatch=async(e,t,...n)=>{const a={[r.TransactionType.bridgeApproval]:n[0].transactions.find(({type:e})=>e===r.TransactionType.bridgeApproval)?.params.data,[r.TransactionType.swapApproval]:n[0].transactions.find(({type:e})=>e===r.TransactionType.swapApproval)?.params.data,[r.TransactionType.bridge]:n[0].transactions.find(({type:e})=>e===r.TransactionType.bridge)?.params.data,[r.TransactionType.swap]:n[0].transactions.find(({type:e})=>e===r.TransactionType.swap)?.params.data},{batchId:o}=await t(...n),{approvalMeta:i,tradeMeta:c}=(0,s.findAndUpdateTransactionsInBatch)({messenger:e,batchId:o,txDataByType:a});if(!c)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:i,tradeMeta:c}};const m=async(e,t,n,r,o)=>{const{gas:i}=t;if(o)return{maxFeePerGas:(0,a.toHex)(o.maxFeePerGas),maxPriorityFeePerGas:(0,a.toHex)(o.maxPriorityFeePerGas),gas:i?(0,a.toHex)(i):undefined};const{maxFeePerGas:c,maxPriorityFeePerGas:l}=await(0,s.getTxGasEstimates)(e,{transactionParams:t,chainId:r,networkClientId:n});return{maxFeePerGas:c,maxPriorityFeePerGas:l,gas:i?(0,a.toHex)(i):undefined}};s.submitEvmTransaction=async({messenger:e,trade:t,transactionType:a,requireApproval:r=!1,txFee:o,actionId:i=(0,s.generateActionId)()})=>{if(!(0,c.getAccountByAddress)(e,t.from))throw new Error("Failed to submit cross-chain swap transaction: unknown account in trade data");const d=(0,n.formatChainIdToHex)(t.chainId),u=(0,l.getNetworkClientIdByChainId)(e,d),h={actionId:i,networkClientId:u,requireApproval:r,type:a,origin:"metamask"},{gasLimit:f,...p}=t,g={...p,chainId:d,...f&&0!==f&&{gasLimit:f.toString(),gas:f.toString()}},k={...g,...await m(e,g,u,d,o)};return await(0,s.addTransaction)(e,k,h)}}}},{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-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)(),o=(0,a.type)({}),i=(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)([o,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)([o,n.BridgeAssetSchema]))}),l=(0,a.type)({});s.StatusResponseSchema=(0,a.type)({status:(0,a.enums)(Object.values(n.StatusTypes)),srcChain:i,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)(l)});var d;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"}(d||(s.IntentOrderStatus=d={}));const m=(0,a.type)({id:(0,a.string)(),status:(0,a.enums)(Object.values(d)),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/transaction-controller/dist/TransactionController.cjs",{"./gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","./gas-flows/LineaGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs","./gas-flows/OptimismLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs","./gas-flows/RandomisedEstimationsGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs","./gas-flows/ScrollLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs","./gas-flows/TestGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs","./helpers/AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs","./helpers/GasFeePoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs","./helpers/IncomingTransactionHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs","./helpers/MethodDataHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs","./helpers/MultichainTrackingHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs","./helpers/PendingTransactionTracker.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs","./helpers/ResimulateHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs","./hooks/ExtraTransactionsPublishHook.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils/balance-changes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs","./utils/batch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs","./utils/eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs","./utils/external-transactions.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/external-transactions.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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/bridge-status-controller/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/bridge-status-controller/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/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","./utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./utils/gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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/bridge-status-controller/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/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/nonce.cjs","./utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","./utils/retry.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/retry.cjs","./utils/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/swaps.cjs","./utils/transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","./utils/validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,m,u,h,f,p,g,k,b,w,y,x,T,_,v,E,S,j,I,P,C,A,F,M,D,O,N,L,B,R,G,H,U,q,W,$,K,V,z,J,Y,Q,X,Z,ee,te,se,ne,ae,re,oe,ie,ce,le,de,me,ue,he,fe,pe,ge,ke,be,we,ye,xe,Te,_e,ve,Ee,Se,je,Ie,Pe,Ce,Ae,Fe,Me,De,Oe,Ne,Le,Be,Re,Ge,He,Ue,qe,We,$e,Ke,Ve,ze,Je,Ye,Qe,Xe,Ze=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},et=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)},tt=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 st=e("@metamask/base-controller"),nt=e("@metamask/controller-utils"),at=tt(e("@metamask/eth-query")),rt=e("@metamask/network-controller"),ot=e("@metamask/nonce-tracker"),it=e("@metamask/rpc-errors"),ct=e("@metamask/utils"),lt=e("events"),dt=e("lodash"),mt=e("uuid"),ut=e("./gas-flows/DefaultGasFeeFlow.cjs"),ht=e("./gas-flows/LineaGasFeeFlow.cjs"),ft=e("./gas-flows/OptimismLayer1GasFeeFlow.cjs"),pt=e("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs"),gt=e("./gas-flows/ScrollLayer1GasFeeFlow.cjs"),kt=e("./gas-flows/TestGasFeeFlow.cjs"),bt=e("./helpers/AccountsApiRemoteTransactionSource.cjs"),wt=e("./helpers/GasFeePoller.cjs"),yt=e("./helpers/IncomingTransactionHelper.cjs"),xt=e("./helpers/MethodDataHelper.cjs"),Tt=e("./helpers/MultichainTrackingHelper.cjs"),_t=e("./helpers/PendingTransactionTracker.cjs"),vt=e("./helpers/ResimulateHelper.cjs"),Et=e("./hooks/ExtraTransactionsPublishHook.cjs"),St=e("./logger.cjs"),jt=e("./types.cjs"),It=e("./utils/balance-changes.cjs"),Pt=e("./utils/batch.cjs"),Ct=e("./utils/eip7702.cjs"),At=e("./utils/external-transactions.cjs"),Ft=e("./utils/feature-flags.cjs"),Mt=e("./utils/first-time-interaction.cjs"),Dt=e("./utils/gas.cjs"),Ot=e("./utils/gas-fee-tokens.cjs"),Nt=e("./utils/gas-fees.cjs"),Lt=e("./utils/gas-flow.cjs"),Bt=e("./utils/layer1-gas-fee-flow.cjs"),Rt=e("./utils/nonce.cjs"),Gt=e("./utils/prepare.cjs"),Ht=e("./utils/retry.cjs"),Ut=e("./utils/swaps.cjs"),qt=e("./utils/transaction-type.cjs"),Wt=e("./utils/utils.cjs"),$t=e("./utils/validation.cjs"),Kt={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 Vt="TransactionController";var zt;!function(e){e.Approved="approved",e.NotApproved="not-approved",e.SkippedViaBeforePublishHook="skipped-via-before-publish-hook"}(zt||(s.ApprovalState=zt={}));const Jt=["abortTransactionSigning","addTransaction","addTransactionBatch","approveTransactionsWithSameNonce","clearUnapprovedTransactions","confirmExternalTransaction","emulateNewTransaction","emulateTransactionUpdate","estimateGas","estimateGasBatch","estimateGasBuffered","estimateGasFee","getGasFeeTokens","getLayer1GasFee","getNonceLock","getTransactions","handleMethodData","isAtomicBatchSupported","setTransactionActive","speedUpTransaction","startIncomingTransactionPolling","stopIncomingTransactionPolling","stopTransaction","updateAtomicBatchData","updateCustodialTransaction","updateEditableParams","updateIncomingTransactions","updateTransaction"];class Yt extends st.BaseController{constructor(e){const{disableSwaps:t,getCurrentAccountEIP1559Compatibility:s,getCurrentNetworkEIP1559Compatibility:q,getExternalPendingTransactions:W,getGasFeeEstimates:$,getNetworkClientRegistry:K,getNetworkState:z,getPermittedAccounts:J,getSavedGasFees:Y,getSimulationConfig:Q,hooks:X,incomingTransactions:ee={},isAutomaticGasFeeUpdateEnabled:te,isEIP7702GasFeeTokensEnabled:se,isFirstTimeInteractionEnabled:ne,isSimulationEnabled:ae,messenger:re,pendingTransactions:oe={},publicKeyEIP7702:ie,securityProviderRequest:ce,sign:le,state:me,testGasFeeFlows:ue,trace:he}=e;super({name:Vt,metadata:Kt,messenger:re,state:{methodData:{},transactions:[],transactionBatches:[],lastFetchedBlockNumbers:{},submitHistory:[],...me}}),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,new Set),c.set(this,void 0),l.set(this,void 0),d.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),y.set(this,void 0),x.set(this,void 0),T.set(this,void 0),_.set(this,new lt.EventEmitter),v.set(this,void 0),E.set(this,void 0),S.set(this,void 0),j.set(this,void 0),I.set(this,void 0),P.set(this,void 0),C.set(this,void 0),A.set(this,void 0),F.set(this,void 0),M.set(this,void 0),D.set(this,void 0),O.set(this,void 0),N.set(this,void 0),L.set(this,void 0),B.set(this,void 0),R.set(this,new Map),G.set(this,new Set),H.set(this,void 0),U.set(this,void 0),Se.set(this,()=>{et(this,F,"f").checkForPendingTransactionAndStartPolling()}),this.messenger=re,Ze(this,a,X?.afterAdd??(()=>Promise.resolve({})),"f"),Ze(this,r,X?.afterSign??(()=>!0),"f"),Ze(this,o,X?.afterSimulate??(()=>Promise.resolve({})),"f"),Ze(this,c,X?.beforeCheckPendingTransaction??(()=>Promise.resolve(!0)),"f"),Ze(this,l,X?.beforePublish??(()=>Promise.resolve(!0)),"f"),Ze(this,d,X?.beforeSign??(()=>Promise.resolve({})),"f"),Ze(this,u,X?.getAdditionalSignArguments??(()=>[]),"f"),Ze(this,h,s??(()=>Promise.resolve(!0)),"f"),Ze(this,f,q,"f"),Ze(this,p,W??(()=>[]),"f"),Ze(this,g,$??(()=>Promise.resolve({})),"f"),Ze(this,k,z,"f"),Ze(this,b,J,"f"),Ze(this,w,Y??(e=>undefined),"f"),Ze(this,y,Q??(()=>Promise.resolve({})),"f"),Ze(this,T,ee,"f"),Ze(this,v,te??(e=>!1),"f"),Ze(this,E,se??(()=>Promise.resolve(!1)),"f"),Ze(this,S,ne??(()=>!0),"f"),Ze(this,j,ae??(()=>!0),"f"),Ze(this,I,t??!1,"f"),Ze(this,P,X?.isTimeoutEnabled??(()=>!0),"f"),Ze(this,M,oe,"f"),Ze(this,D,ie,"f"),Ze(this,O,X?.publish??(()=>Promise.resolve({transactionHash:undefined})),"f"),Ze(this,N,X?.publishBatch,"f"),Ze(this,L,ce,"f"),Ze(this,B,le,"f"),Ze(this,H,!0===ue,"f"),Ze(this,U,he??((e,t)=>t?.()),"f");const fe=e=>this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);Ze(this,F,new Tt.MultichainTrackingHelper({findNetworkClientIdByChainId:fe,getNetworkClientById:e=>this.messenger.call("NetworkController:getNetworkClientById",e),getNetworkClientRegistry:K,removePendingTransactionTrackerListeners:et(this,n,"m",Pe).bind(this),createNonceTracker:et(this,n,"m",ve).bind(this),createPendingTransactionTracker:et(this,n,"m",Ee).bind(this),onNetworkStateChange:e=>{this.messenger.subscribe("NetworkController:stateChange",e)}}),"f"),et(this,F,"f").initialize(),Ze(this,m,et(this,n,"m",De).call(this),"f"),Ze(this,C,et(this,n,"m",Oe).call(this),"f");const pe=new wt.GasFeePoller({findNetworkClientIdByChainId:fe,gasFeeFlows:et(this,m,"f"),getGasFeeControllerEstimates:et(this,g,"f"),getProvider:e=>et(this,n,"m",de).call(this,{networkClientId:e}),getTransactions:()=>this.state.transactions,getTransactionBatches:()=>this.state.transactionBatches,layer1GasFeeFlows:et(this,C,"f"),messenger:this.messenger,onStateChange:e=>{this.messenger.subscribe("TransactionController:stateChange",e)}});pe.hub.on("transaction-updated",et(this,n,"m",Be).bind(this)),pe.hub.on("transaction-batch-updated",et(this,n,"m",Re).bind(this)),Ze(this,A,new xt.MethodDataHelper({getProvider:e=>et(this,n,"m",de).call(this,{networkClientId:e}),getState:()=>this.state.methodData}),"f"),et(this,A,"f").hub.on("update",({fourBytePrefix:e,methodData:t})=>{this.update(s=>{s.methodData[e]=t})}),Ze(this,x,new yt.IncomingTransactionHelper({client:et(this,T,"f").client,getCurrentAccount:()=>et(this,n,"m",He).call(this),getLocalTransactions:()=>this.state.transactions,includeTokenTransfers:et(this,T,"f").includeTokenTransfers,isEnabled:et(this,T,"f").isEnabled,messenger:this.messenger,remoteTransactionSource:new bt.AccountsApiRemoteTransactionSource,trimTransactions:et(this,n,"m",Z).bind(this),updateTransactions:et(this,T,"f").updateTransactions}),"f"),et(this,n,"m",Ie).call(this,et(this,x,"f")),this.messenger.subscribe("TransactionController:stateChange",et(this,Se,"f")),new vt.ResimulateHelper({simulateTransaction:et(this,n,"m",Le).bind(this),onTransactionsUpdate:e=>{this.messenger.subscribe("TransactionController:stateChange",e,e=>e.transactions)},getTransactions:()=>this.state.transactions}),et(this,n,"m",V).call(this),et(this,Se,"f").call(this),et(this,n,"m",$e).call(this)}destroy(){et(this,n,"m",je).call(this)}async handleMethodData(e,t){return et(this,A,"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:et(this,n,"m",ie).bind(this),getEthQuery:e=>et(this,n,"m",le).call(this,{networkClientId:e}),getGasFeeEstimates:et(this,g,"f"),getInternalAccounts:et(this,n,"m",Ue).bind(this),getSimulationConfig:et(this,y,"f").bind(this),getPendingTransactionTracker:e=>et(this,n,"m",Ee).call(this,{provider:et(this,n,"m",de).call(this,{networkClientId:e}),blockTracker:t,chainId:et(this,n,"m",ie).call(this,e),networkClientId:e}),getTransaction:e=>et(this,n,"m",ae).call(this,e),isSimulationEnabled:et(this,j,"f"),messenger:this.messenger,publishBatchHook:et(this,N,"f"),publicKeyEIP7702:et(this,D,"f"),publishTransaction:(e,t)=>et(this,n,"m",Q).call(this,e,t),request:e,signTransaction:et(this,n,"m",we).bind(this),update:this.update.bind(this),updateTransaction:et(this,n,"m",Ne).bind(this)})}async isAtomicBatchSupported(e){return(0,Pt.isAtomicBatchSupported)({...e,getEthQuery:e=>et(this,n,"m",le).call(this,{chainId:e}),messenger:this.messenger,publicKeyEIP7702:et(this,D,"f")})}async addTransaction(e,t){(0,St.projectLogger)("Adding transaction",e,t);const{actionId:s,assetsFiatValues:r,batchId:o,deviceConfirmedOn:i,disableGasBuffer:c,gasFeeToken:l,isGasFeeIncluded:d,isGasFeeSponsored:m,isStateOnly:u,method:h,nestedTransactions:f,networkClientId:p,origin:g,publishHook:k,requestId:w,requiredAssets:y,requireApproval:x,securityAlertResponse:T,skipInitialGasEstimate:_,swaps:v={},traceContext:E,type:j}=t;if(e=(0,Wt.normalizeTransactionParams)(e),!et(this,F,"f").has(p))throw new Error(`Network client not found - ${p}`);const P=et(this,n,"m",ie).call(this,p),C=et(this,n,"m",le).call(this,{networkClientId:p}),A=g===undefined?undefined:await(et(this,b,"f")?.call(this,g)),M=et(this,n,"m",Ue).call(this);await(0,$t.validateTransactionOrigin)({data:e.data,from:e.from,internalAccounts:M,origin:g,permittedAddresses:A,txParams:e,type:j});const D=(0,Ct.getDelegationAddress)(e.from,C).catch(()=>undefined),O=await et(this,n,"m",be).call(this,p);(0,$t.validateTxParams)(e,O,P),e.type||(0,Wt.setEnvelopeType)(e,O);if(o?.length&&this.state.transactions.some(e=>e.batchId?.toLowerCase()===o?.toLowerCase())&&g&&g!==nt.ORIGIN_METAMASK)throw new it.JsonRpcError($t.ErrorCode.DuplicateBundleId,"Batch ID already exists");const N=et(this,n,"m",ue).call(this,e,g),B=j??(await(0,qt.determineTransactionType)(e,C)).type;let R={actionId:s,assetsFiatValues:r,batchId:o,chainId:P,dappSuggestedGasFees:N,deviceConfirmedOn:i,disableGasBuffer:c,id:(0,mt.v1)(),isGasFeeTokenIgnoredIfBalance:Boolean(l),isGasFeeIncluded:d,isGasFeeSponsored:m,isFirstTimeInteraction:undefined,isStateOnly:u,nestedTransactions:f,networkClientId:p,origin:g,requestId:w,requiredAssets:y,securityAlertResponse:T,selectedGasFeeToken:l,status:jt.TransactionStatus.unapproved,time:Date.now(),txParams:e,type:B,userEditedGasLimit:!1,verifiedOnBlockchain:!1};const{updateTransaction:G}=await et(this,a,"f").call(this,{transactionMeta:R});if(G&&((0,St.projectLogger)("Updating transaction using afterAdd hook"),R.txParamsOriginal=(0,dt.cloneDeep)(R.txParams),G(R)),_){const e=(0,dt.cloneDeep)(R);et(this,n,"m",K).call(this,e).then(()=>(et(this,n,"m",Ne).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(dt.noop)}else await et(this,U,"f").call(this,{name:"Estimate Gas Properties",parentContext:E},e=>et(this,n,"m",K).call(this,R,{traceContext:e}));if(h&&et(this,L,"f")){const e=await et(this,L,"f").call(this,R,h);R.securityProviderResponse=e}return R=(0,Ut.updateSwapsTransaction)(R,B,v,{isSwapsDisabled:et(this,I,"f"),cancelTransaction:et(this,n,"m",X).bind(this),messenger:this.messenger}),et(this,n,"m",$).call(this,R),D.then(e=>(et(this,n,"m",Ne).call(this,{transactionId:R.id,skipResimulateCheck:!0,skipValidation:!0},t=>{t.delegationAddress=e}),undefined)).catch(dt.noop),!1===x||u?(0,St.projectLogger)("Skipping simulation & first interaction update as approval not required"):(et(this,n,"m",Le).call(this,R,{traceContext:E}).catch(e=>{throw(0,St.projectLogger)("Error while updating simulation data",e),e}),(0,Mt.updateFirstTimeInteraction)({existingTransactions:this.state.transactions,getTransaction:e=>et(this,n,"m",ne).call(this,e),isFirstTimeInteractionEnabled:et(this,S,"f"),trace:et(this,U,"f"),traceContext:E,transactionMeta:R,updateTransaction:et(this,n,"m",Ne).bind(this)}).catch(e=>{(0,St.projectLogger)("Error while updating first interaction properties",e)})),this.messenger.publish(`${Vt}:unapprovedTransactionAdded`,R),{result:et(this,n,"m",J).call(this,R,{actionId:s,publishHook:k,requireApproval:x,traceContext:E}),transactionMeta:R}}startIncomingTransactionPolling(){et(this,x,"f").start()}stopIncomingTransactionPolling(){et(this,x,"f").stop()}async updateIncomingTransactions({tags:e}={}){await et(this,x,"f").update({tags:e})}async stopTransaction(e,t,{estimatedBaseFee:a,actionId:r}={}){await et(this,n,"m",q).call(this,{actionId:r,estimatedBaseFee:a,gasValues:t,label:"cancel",rate:s.CANCEL_RATE,transactionId:e,transactionType:jt.TransactionType.cancel,prepareTransactionParams:e=>{delete e.data,e.to=e.from,e.value="0x0"},afterSubmit:e=>{this.messenger.publish(`${Vt}:transactionFinished`,e),et(this,_,"f").emit(`${e.id}:finished`,e)}})}async speedUpTransaction(e,t,{actionId:a,estimatedBaseFee:r}={}){await et(this,n,"m",q).call(this,{actionId:a,estimatedBaseFee:r,gasValues:t,label:"speed up",rate:s.SPEED_UP_RATE,transactionId:e,transactionType:jt.TransactionType.retry,afterSubmit:e=>{this.messenger.publish(`${Vt}:speedupTransactionAdded`,e)}})}async estimateGas(e,t,{ignoreDelegationSignatures:s}={}){const a=et(this,n,"m",le).call(this,{networkClientId:t}),{estimatedGas:r,simulationFails:o}=await(0,Dt.estimateGas)({chainId:et(this,n,"m",ie).call(this,t),ethQuery:a,ignoreDelegationSignatures:s,isSimulationEnabled:et(this,j,"f").call(this),getSimulationConfig:et(this,y,"f"),messenger:this.messenger,txParams:e});return{gas:r,simulationFails:o}}async estimateGasBatch({chainId:e,from:t,transactions:s}){const a=et(this,n,"m",le).call(this,{chainId:e});return(0,Dt.estimateGasBatch)({chainId:e,ethQuery:a,from:t,getSimulationConfig:et(this,y,"f"),isAtomicBatchSupported:this.isAtomicBatchSupported.bind(this),messenger:this.messenger,transactions:s})}async estimateGasBuffered(e,t,s){const a=et(this,n,"m",le).call(this,{networkClientId:s}),{blockGasLimit:r,estimatedGas:o,simulationFails:i}=await(0,Dt.estimateGas)({chainId:et(this,n,"m",ie).call(this,s),ethQuery:a,isSimulationEnabled:et(this,j,"f").call(this),getSimulationConfig:et(this,y,"f"),messenger:this.messenger,txParams:e});return{gas:(0,Dt.addGasBuffer)(o,r,t),simulationFails:i}}updateTransaction(e,t){const{id:s}=e;et(this,n,"m",Ne).call(this,{transactionId:s},()=>({...e})),(0,St.projectLogger)("Transaction updated",{transactionId:s,note:t})}updateSecurityAlertResponse(e,t){if(!t)throw new Error("updateSecurityAlertResponse: securityAlertResponse should not be null");const s=et(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,`${Vt}: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===jt.TransactionType.incoming&&n.to?.toLowerCase()===e.toLowerCase())});this.update(e=>{e.transactions=et(this,n,"m",Z).call(this,s)})}updateTransactionSendFlowHistory(e,t,s){return et(this,n,"m",ae).call(this,e)}async confirmExternalTransaction(e,t,s){const a=et(this,n,"m",he).call(this,e);try{const e=a.id,r={...a,status:jt.TransactionStatus.confirmed,txReceipt:t};s&&(r.baseFeePerGas=s),et(this,n,"m",fe).call(this,e),this.updateTransaction(r,`${Vt}:confirmExternalTransaction - Add external transaction`),et(this,n,"m",ye).call(this,r),et(this,n,"m",_e).call(this,r).catch(e=>{throw(0,St.projectLogger)("Error while updating post balance",e),e}),this.messenger.publish(`${Vt}:transactionConfirmed`,r)}catch(e){console.error("Failed to confirm external transaction",e)}}updateTransactionGasFees(e,{defaultGasEstimates:t,estimateUsed:s,estimateSuggested:a,gas:r,gasLimit:o,gasPrice:i,maxPriorityFeePerGas:c,maxFeePerGas:l,originalGasEstimate:d,userEditedGasLimit:m,userFeeLevel:u}){const h=et(this,n,"m",ne).call(this,e);if(!h)throw new Error("Cannot update transaction as no transaction metadata found");(0,Wt.validateIfTransactionUnapprovedOrSubmitted)(h,"updateTransactionGasFees");const f=(0,dt.cloneDeep)(h),p=h.gasFeeEstimates,g=et(this,v,"f").call(this,h),k=u,b=Object.values(jt.GasFeeEstimateLevel).includes(k),w=p&&g&&b;w&&(0,wt.updateTransactionGasEstimates)({txMeta:f,userFeeLevel:k});const y={gas:r,gasLimit:o};w?Object.assign(y,{gasPrice:f.txParams.gasPrice,maxPriorityFeePerGas:f.txParams.maxPriorityFeePerGas,maxFeePerGas:f.txParams.maxFeePerGas}):Object.assign(y,{gasPrice:i,maxPriorityFeePerGas:c,maxFeePerGas:l});const x={txParams:(0,dt.pickBy)(y),defaultGasEstimates:t,estimateUsed:s,estimateSuggested:a,originalGasEstimate:d,userEditedGasLimit:m,userFeeLevel:k},T=(0,dt.pickBy)(x);return et(this,n,"m",Ne).call(this,{transactionId:e,skipResimulateCheck:!0},e=>{const{txParams:t,...s}=T;Object.assign(e,s),t&&Object.assign(e.txParams,t)}),et(this,n,"m",ne).call(this,e)}updatePreviousGasParams(e,{gasLimit:t,maxFeePerGas:s,maxPriorityFeePerGas:a}){const r=et(this,n,"m",ne).call(this,e);if(!r)throw new Error("Cannot update transaction as no transaction metadata found");(0,Wt.validateIfTransactionUnapprovedOrSubmitted)(r,"updatePreviousGasParams");const o={previousGas:{gasLimit:t,maxFeePerGas:s,maxPriorityFeePerGas:a}};o.previousGas=(0,dt.pickBy)(o.previousGas);const i=(0,dt.merge)({},r,o);return this.updateTransaction(i,`${Vt}:updatePreviousGasParams - Previous gas values updated`),et(this,n,"m",ne).call(this,e)}async getNonceLock(e,t){return et(this,F,"f").getNonceLock(e,t)}async updateEditableParams(e,{containerTypes:t,data:s,from:a,gas:r,gasPrice:o,maxFeePerGas:i,maxPriorityFeePerGas:c,to:l,updateType:d,value:m}){const u=et(this,n,"m",ne).call(this,e);if(!u)throw new Error("Cannot update editable params as no transaction metadata found");(0,Wt.validateIfTransactionUnapproved)(u,"updateEditableParams");const h={txParams:{data:s,from:a,to:l,value:m,gas:r,gasPrice:o,maxFeePerGas:i,maxPriorityFeePerGas:c}};h.txParams=(0,dt.pickBy)(h.txParams);const f=(0,dt.merge)({},u,h),{networkClientId:p}=u,g=et(this,n,"m",de).call(this,{networkClientId:p}),k=new at.default(g);if(!1!==d){const{type:e}=await(0,qt.determineTransactionType)(f.txParams,k);f.type=e}return t&&(f.containerTypes=t),await(0,Bt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:et(this,C,"f"),messenger:this.messenger,provider:g,transactionMeta:f}),this.updateTransaction(f,`Update Editable Params for ${e}`),et(this,n,"m",ne).call(this,e)}setTransactionActive(e,t){if(!et(this,n,"m",ne).call(this,e))throw new Error(`Transaction with id ${e} not found`);et(this,n,"m",Ne).call(this,{transactionId:e,skipValidation:!0,skipResimulateCheck:!0},e=>{e.isActive=t})}async approveTransactionsWithSameNonce(e=[],{hasNonce:t}={}){if((0,St.projectLogger)("Approving transactions with same nonce",{transactions:e}),0===e.length)return"";const s=e[0],{chainId:a}=s,r=et(this,n,"m",ce).call(this,{chainId:a}),o=(0,Gt.prepareTransaction)(a,s),c=(0,Gt.serializeTransaction)(o);if(et(this,i,"f").has(c))return"";let l,d;et(this,i,"f").add(c);try{const a=s.from;d=!0!==t?await this.getNonceLock(a,r):undefined;const o=d?(0,ct.add0x)(d.nextNonce.toString(16)):s.nonce;d&&(0,St.projectLogger)("Using nonce from nonce tracker",o,d.nonceDetails),l=await Promise.all(e.map(e=>(e.nonce=o,et(this,n,"m",W).call(this,e.chainId,e))))}catch(e){throw(0,St.projectLogger)("Error while signing transactions with same nonce",e),e}finally{d?.releaseLock(),et(this,i,"f").delete(c)}return l}updateCustodialTransaction(e){const{transactionId:t,errorMessage:s,hash:a,status:r,gasLimit:o,gasPrice:i,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,type:m}=e,u=et(this,n,"m",ne).call(this,t);if(!u)throw new Error("Cannot update custodial transaction as no transaction metadata found");if(r&&![jt.TransactionStatus.submitted,jt.TransactionStatus.signed,jt.TransactionStatus.failed].includes(r))throw new Error(`Cannot update custodial transaction with status: ${r}`);const h=(0,dt.merge)({},u,(0,dt.pickBy)({hash:a,status:r}));return h.status===jt.TransactionStatus.submitted&&(h.submittedTime=(new Date).getTime()),h.status===jt.TransactionStatus.failed&&(h.error=(0,Wt.normalizeTxError)(new Error(s))),h.txParams=(0,dt.merge)({},h.txParams,(0,dt.pickBy)({gasLimit:o,gasPrice:i,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,type:m})),m===jt.TransactionEnvelopeType.legacy&&(delete h.txParams.maxFeePerGas,delete h.txParams.maxPriorityFeePerGas),this.updateTransaction(h,`${Vt}:updateCustodialTransaction - Custodial transaction updated`),r&&[jt.TransactionStatus.submitted,jt.TransactionStatus.failed].includes(r)&&(this.messenger.publish(`${Vt}:transactionFinished`,h),et(this,_,"f").emit(`${h.id}:finished`,h)),h}getTransactions({initialList:e,limit:t,searchCriteria:s={}}={}){const n=(0,dt.mapValues)(s,e=>"function"==typeof e?e:t=>t===e),a=e??this.state.transactions,r=(0,dt.sortBy)((0,dt.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:o}=a.txParams;if(!e.has(o)){if(!(e.size<t))continue;e.add(o)}s.unshift(a)}return s}return r}async estimateGasFee({transactionParams:e,chainId:t,networkClientId:s}){const{id:n,provider:a}=et(this,F,"f").getNetworkClient({chainId:t,networkClientId:s}),r={txParams:e,chainId:t,networkClientId:n},o=(0,Lt.getGasFeeFlow)(r,et(this,m,"f"),this.messenger),i=new at.default(a),c=await et(this,g,"f").call(this,{networkClientId:n});return o.getGasFees({ethQuery:i,gasFeeControllerData:c,messenger:this.messenger,transactionMeta:r})}async getLayer1GasFee({transactionParams:e,chainId:t,networkClientId:s}){const a=et(this,n,"m",de).call(this,{chainId:t,networkClientId:s});return await(0,Bt.getTransactionLayer1GasFee)({layer1GasFeeFlows:et(this,C,"f"),messenger:this.messenger,provider:a,transactionMeta:{txParams:e,chainId:t}})}clearUnapprovedTransactions(){const e=this.state.transactions.filter(({status:e})=>e!==jt.TransactionStatus.unapproved);this.update(t=>{t.transactions=et(this,n,"m",Z).call(this,e)})}abortTransactionSigning(e){if(!et(this,n,"m",ne).call(this,e))throw new Error("Cannot abort signing as no transaction metadata found");const t=et(this,R,"f").get(e);if(!t)throw new Error("Cannot abort signing as transaction is not waiting for signing");t(),et(this,R,"f").delete(e)}async updateAtomicBatchData({transactionId:e,transactionIndex:t,transactionData:s}){(0,St.projectLogger)("Updating atomic batch data",{transactionId:e,transactionIndex:t,transactionData:s});const a=et(this,n,"m",Ne).call(this,{transactionId:e},e=>{const{nestedTransactions:n,txParams:a}=e,r=a.from,o=n?.[t];if(!o)throw new Error(`Nested transaction not found with index - ${t}`);o.data=s;const i=(0,Ct.generateEIP7702BatchTransaction)(r,n);e.txParams.data=i.data}),r=(0,dt.cloneDeep)({...a,txParams:{...a.txParams,gas:undefined}});return await et(this,n,"m",We).call(this,r),et(this,n,"m",Ne).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,St.projectLogger)("Updating batch transactions",{transactionId:e,batchTransactions:t}),et(this,n,"m",Ne).call(this,{transactionId:e},e=>{e.batchTransactions=t})}updateSelectedGasFeeToken(e,t){et(this,n,"m",Ne).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}){et(this,n,"m",Ne).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===jt.TransactionType.swap?this.messenger.publish("TransactionController:transactionNewSwap",{transactionMeta:t}):t.type===jt.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})}async getGasFeeTokens(e){const{chainId:t,data:s,from:a,to:r,value:o}=e,i=et(this,n,"m",le).call(this,{chainId:t}),c={chainId:t,delegationAddress:await(0,Ct.getDelegationAddress)(a,i),isExternalSign:!0,txParams:{data:s,from:a,to:r,value:o}};return(await et(this,n,"m",Xe).call(this,c)).gasFeeTokens}}s.TransactionController=Yt,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=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,y=new WeakMap,x=new WeakMap,T=new WeakMap,_=new WeakMap,v=new WeakMap,E=new WeakMap,S=new WeakMap,j=new WeakMap,I=new WeakMap,P=new WeakMap,C=new WeakMap,A=new WeakMap,F=new WeakMap,M=new WeakMap,D=new WeakMap,O=new WeakMap,N=new WeakMap,L=new WeakMap,B=new WeakMap,R=new WeakMap,G=new WeakMap,H=new WeakMap,U=new WeakMap,Se=new WeakMap,n=new WeakSet,q=async function({actionId:e,afterSubmit:t,estimatedBaseFee:s,gasValues:a,label:r,prepareTransactionParams:o,rate:i,transactionId:c,transactionType:l}){a&&(a=(0,Wt.normalizeGasFeeValues)(a),(0,Wt.validateGasValues)(a)),(0,St.projectLogger)(`Creating ${r} transaction`,c,a);const d=et(this,n,"m",ne).call(this,c);if(!d)return;if(!et(this,B,"f"))throw new Error("No sign method defined.");const m=(0,Ht.getTransactionParamsWithIncreasedGasFee)(d.txParams,i,a);o?.(m);const u=(0,Gt.prepareTransaction)(d.chainId,m),h=await et(this,B,"f").call(this,u,d.txParams.from),f=et(this,n,"m",ke).call(this,d,h),p=(0,Gt.serializeTransaction)(h),g=m.maxFeePerGas??m.gasPrice,k=m.maxFeePerGas?f.txParams.maxFeePerGas:f.txParams.gasPrice;(0,St.projectLogger)(`Submitting ${r} transaction`,{oldFee:k,newFee:g,txParams:m});const{networkClientId:b}=d,w=et(this,n,"m",le).call(this,{networkClientId:b}),y={...f,actionId:e,estimatedBaseFee:s,id:(0,mt.v1)(),originalGasEstimate:d.txParams.gas,originalType:d.type,rawTx:p,time:Date.now(),txParams:m,type:l},x=await et(this,n,"m",Fe).call(this,w,{...y,origin:r});y.hash=x,et(this,n,"m",$).call(this,y),this.messenger.publish(`${Vt}:transactionApproved`,{transactionMeta:y,actionId:e}),this.messenger.publish(`${Vt}:transactionSubmitted`,{transactionMeta:y,actionId:e}),t?.(y)},W=async function(e,t){if(!et(this,B,"f"))throw new Error("No sign method defined.");const s=(0,Wt.normalizeTransactionParams)(t),n=(0,Wt.isEIP1559Transaction)(s)?jt.TransactionEnvelopeType.feeMarket:jt.TransactionEnvelopeType.legacy,a={...s,type:n,gasLimit:s.gas,chainId:e},{from:r}=a,o=(0,Gt.prepareTransaction)(e,a),i=await et(this,B,"f").call(this,o,r);return(0,Gt.serializeTransaction)(i)},$=function(e){(0,$t.validateTxParams)(e.txParams),this.update(t=>{t.transactions=et(this,n,"m",Z).call(this,[...t.transactions,e])})},K=async function(e,{traceContext:t}={}){const s=e.txParams.type!==jt.TransactionEnvelopeType.legacy&&await et(this,n,"m",be).call(this,e.networkClientId),{networkClientId:a}=e,r=et(this,n,"m",le).call(this,{networkClientId:a}),o=et(this,n,"m",de).call(this,{networkClientId:a});await et(this,U,"f").call(this,{name:"Update Gas",parentContext:t},async()=>{await et(this,n,"m",We).call(this,e)}),await et(this,U,"f").call(this,{name:"Update Gas Fees",parentContext:t},async()=>await(0,Nt.updateGasFees)({eip1559:s,ethQuery:r,gasFeeFlows:et(this,m,"f"),getGasFeeEstimates:et(this,g,"f"),getSavedGasFees:et(this,w,"f").bind(this),messenger:this.messenger,txMeta:e})),await et(this,U,"f").call(this,{name:"Update Layer 1 Gas Fees",parentContext:t},async()=>await(0,Bt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:et(this,C,"f"),messenger:this.messenger,provider:o,transactionMeta:e}))},V=function(){this.clearUnapprovedTransactions(),et(this,n,"m",z).call(this)},z=function(){const e=this.state.transactions.filter(e=>[jt.TransactionStatus.approved,jt.TransactionStatus.signed].includes(e.status));for(const t of e){const e=t.requiredTransactionIds??[],s=e.length>0&&e.every(e=>{const t=et(this,n,"m",ne).call(this,e);return t?.status===jt.TransactionStatus.confirmed})?"Transaction incomplete at startup with all required transactions confirmed":"Transaction incomplete at startup";et(this,n,"m",Je).call(this,t,new Error(s));for(const t of e){const e=et(this,n,"m",ne).call(this,t);e&&!et(this,n,"m",ee).call(this,e.status)&&et(this,n,"m",Je).call(this,e,new Error("Parent transaction incomplete at startup"))}}},J=async function(e,{actionId:t,publishHook:s,requireApproval:a,shouldShowRequest:r=!0,traceContext:o}){const{id:i,isStateOnly:c}=e;if(c)return et(this,n,"m",Ne).call(this,{transactionId:i,skipValidation:!0},e=>{e.status=jt.TransactionStatus.submitted,e.submittedTime=(new Date).getTime()}),"";let l;const{meta:d,isCompleted:m}=et(this,n,"m",oe).call(this,i),u=m?Promise.resolve(d):et(this,n,"m",ge).call(this,i);if(d&&!m)try{if(!1!==a){const t=await et(this,U,"f").call(this,{name:"Await Approval",parentContext:o},t=>et(this,n,"m",se).call(this,e,{shouldShowRequest:r,traceContext:t}));l=t.resultCallbacks;const s=t.value,a=s?.txMeta;a&&((0,St.projectLogger)("Updating transaction with approval data",{customNonce:a.customNonceValue,params:a.txParams}),this.updateTransaction(a,"TransactionController#processApproval - Updated with approval data"))}const{isCompleted:c}=et(this,n,"m",oe).call(this,i);if(!c){const e=await et(this,n,"m",Y).call(this,i,o,s);e===zt.SkippedViaBeforePublishHook&&l&&l.success();const a=et(this,n,"m",ne).call(this,i);e===zt.Approved&&this.messenger.publish(`${Vt}:transactionApproved`,{transactionMeta:a,actionId:t})}}catch(e){const s=e,{isCompleted:a}=et(this,n,"m",oe).call(this,i);a||(et(this,n,"m",Ve).call(this,s)?et(this,n,"m",ze).call(this,i,t,s):et(this,n,"m",Je).call(this,d,s,t))}finally{et(this,G,"f").delete(i)}const h=await u;switch(h?.status){case jt.TransactionStatus.failed:{const e=h.error;throw l?.error(e),it.rpcErrors.internal(e.message)}case jt.TransactionStatus.submitted:return l?.success(),h.hash;default:{const e=it.rpcErrors.internal(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(h??i)}`);throw l?.error(e),e}}},Y=async function(e,t,s){let a,r,o=et(this,n,"m",ae).call(this,e);(0,St.projectLogger)("Approving transaction",o);try{if(!et(this,B,"f"))return et(this,n,"m",Je).call(this,o,new Error("No sign method defined.")),zt.NotApproved;if(!o.chainId)return et(this,n,"m",Je).call(this,o,new Error("No chainId defined.")),zt.NotApproved;if(et(this,i,"f").has(e))return(0,St.projectLogger)("Skipping approval as signing in progress",e),zt.NotApproved;et(this,i,"f").add(e),a=()=>et(this,i,"f").delete(e);const{networkClientId:c}=o,d=et(this,n,"m",le).call(this,{networkClientId:c}),[m,u]=await(0,Rt.getNextNonce)(o,e=>et(this,F,"f").getNonceLock(e,o.networkClientId));r=u,o=et(this,n,"m",Ne).call(this,{transactionId:e},e=>{const{chainId:t,txParams:s}=e,{gas:n,type:a}=s;e.status=jt.TransactionStatus.approved,e.txParams.chainId=t,e.txParams.gasLimit=n,e.txParams.nonce=m,!a&&(0,Wt.isEIP1559Transaction)(s)&&(e.txParams.type=jt.TransactionEnvelopeType.feeMarket)}),et(this,n,"m",ye).call(this,o);const h=await et(this,U,"f").call(this,{name:"Sign",parentContext:t},()=>et(this,n,"m",we).call(this,o));if(o=et(this,n,"m",ae).call(this,e),!await et(this,l,"f").call(this,o))return(0,St.projectLogger)("Skipping publishing transaction based on hook"),this.messenger.publish(`${Vt}:transactionPublishingSkipped`,o),zt.SkippedViaBeforePublishHook;if(!h&&!o.isExternalSign)return zt.NotApproved;let f;const p=o.type===jt.TransactionType.swap;p&&((0,St.projectLogger)("Determining pre-transaction balance"),f=await(0,nt.query)(d,"getBalance",[o.txParams.from])),(0,St.projectLogger)("Publishing transaction",o.txParams),r?.(),r=undefined;let g=et(this,n,"m",Qe).bind(this,{ethQuery:d,publishHookOverride:s,traceContext:t});if(o.batchTransactions?.length){(0,St.projectLogger)("Found batch transactions",o.batchTransactions);g=new Et.ExtraTransactionsPublishHook({addTransactionBatch:this.addTransactionBatch.bind(this),getTransaction:et(this,n,"m",ae).bind(this),originalPublishHook:g}).getHook()}const{transactionHash:k}=await g(o,h??"0x");return o=et(this,n,"m",Ne).call(this,{transactionId:e},e=>{e.hash=k,e.status=jt.TransactionStatus.submitted,e.submittedTime=(new Date).getTime(),p&&(e.preTxBalance=f,(0,St.projectLogger)("Updated pre-transaction balance",f))}),this.messenger.publish(`${Vt}:transactionSubmitted`,{transactionMeta:o}),this.messenger.publish(`${Vt}:transactionFinished`,o),et(this,_,"f").emit(`${e}:finished`,o),et(this,n,"m",ye).call(this,o),zt.Approved}catch(e){return et(this,n,"m",Je).call(this,o,e),zt.NotApproved}finally{a?.(),r?.()}},Q=async function(e,t,{skipSubmitHistory:s}={}){try{const a=await(0,nt.query)(e,"sendRawTransaction",[t.rawTx]);return!0!==s&&et(this,n,"m",qe).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=et(this,n,"m",ne).call(this,e);if(!a)return;et(this,n,"m",Ke).call(this,e);const r={...a,status:jt.TransactionStatus.rejected,error:(0,Wt.normalizeTxError)(s??it.providerErrors.userRejectedRequest())};this.messenger.publish(`${Vt}:transactionFinished`,r),et(this,_,"f").emit(`${a.id}:finished`,r),this.messenger.publish(`${Vt}:transactionRejected`,{transactionMeta:r,actionId:t}),et(this,n,"m",ye).call(this,r)},Z=function(e){const t=new Set,s=(0,Ft.getTransactionHistoryLimit)(this.messenger),a=[...e].sort((e,t)=>e.time>t.time?-1:1).filter(e=>{const{chainId:a,status:r,txParams:o,time:i}=e;if(o){const e=`${String(o.nonce)}-${(0,nt.convertHexToDecimal)(a)}-${new Date(i).toDateString()}`;if(t.has(e))return!0;if(t.size<s||!et(this,n,"m",ee).call(this,r))return t.add(e),!0}return!1});return a.reverse(),a},ee=function(e){return e===jt.TransactionStatus.rejected||e===jt.TransactionStatus.confirmed||e===jt.TransactionStatus.failed||e===jt.TransactionStatus.dropped},te=function(e){return[jt.TransactionStatus.confirmed,jt.TransactionStatus.failed,jt.TransactionStatus.rejected,jt.TransactionStatus.submitted].includes(e)},se=async function(e,{shouldShowRequest:t,traceContext:s}){const a=et(this,n,"m",re).call(this,e),{origin:r}=e,o=nt.ApprovalType.Transaction,i={txId:e.id};return await et(this,U,"f").call(this,{name:"Notification Display",id:a,parentContext:s}),await this.messenger.call("ApprovalController:addRequest",{id:a,origin:r??nt.ORIGIN_METAMASK,type:o,requestData:i,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=et(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)},oe=function(e){const t=et(this,n,"m",ne).call(this,e);if(!t)return{meta:undefined,isCompleted:!1};return{meta:t,isCompleted:et(this,n,"m",te).call(this,t.status)}},ie=function(e){return et(this,F,"f").getNetworkClient({networkClientId:e}).configuration.chainId},ce=function({chainId:e,networkClientId:t}){return t||et(this,F,"f").getNetworkClient({chainId:e}).id},le=function({chainId:e,networkClientId:t}){return new at.default(et(this,n,"m",de).call(this,{chainId:e,networkClientId:t}))},de=function({chainId:e,networkClientId:t}){return et(this,F,"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=et(this,n,"m",ce).call(this,{chainId:e});t.push({...s,networkClientId:a})}catch(t){(0,St.projectLogger)("Failed to get network client ID for incoming transaction",{chainId:e,error:t})}}this.update(e=>{const{transactions:s}=e;e.transactions=et(this,n,"m",Z).call(this,[...t,...s]),(0,St.projectLogger)("Added incoming transactions to state",t.length,t)}),this.messenger.publish(`${Vt}:incomingTransactionsReceived`,t)},ue=function(e,t){if(!t||t===nt.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 o={};return s!==undefined?o.gasPrice=s:n===undefined&&a===undefined||(o.maxFeePerGas=n,o.maxPriorityFeePerGas=a),r!==undefined&&(o.gas=r),o},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),o=r.filter(e=>e.status===jt.TransactionStatus.confirmed),i=r.filter(e=>e.status===jt.TransactionStatus.submitted);return(0,At.validateConfirmedExternalTransaction)(e,o,i),this.update(t=>{t.transactions=et(this,n,"m",Z).call(this,[...t.transactions,e])}),e},fe=function(e){const t=et(this,n,"m",ne).call(this,e);if(!t)return;const s=t.txParams?.nonce,a=t.txParams?.from,{chainId:r}=t,o=this.state.transactions.filter(t=>t.id!==e&&t.txParams.from===a&&s&&t.txParams.nonce===s&&t.chainId===r&&t.type!==jt.TransactionType.incoming&&t.isTransfer===undefined),i=o.map(e=>e.id);if(0!==o.length){this.update(e=>{for(const s of e.transactions)i.includes(s.id)&&(s.replacedBy=t?.hash,s.replacedById=t?.id)});for(const e of this.state.transactions)i.includes(e.id)&&e.status!==jt.TransactionStatus.failed&&et(this,n,"m",pe).call(this,e)}},pe=function(e){const t={...e,status:jt.TransactionStatus.dropped};this.messenger.publish(`${Vt}:transactionDropped`,{transactionMeta:t}),this.updateTransaction(t,"TransactionController#setTransactionStatusDropped - Transaction dropped"),et(this,n,"m",ye).call(this,t)},ge=async function(e){return new Promise(t=>{et(this,_,"f").once(`${e}:finished`,e=>{t(e)})})},ke=function(e,t){const s=(0,dt.cloneDeep)(e);for(const e of["r","s","v"]){const n=t[e];n!==undefined&&null!==n&&(s[e]=(0,ct.add0x)(n.toString(16)))}return s},be=async function(e){const t=await et(this,f,"f").call(this,e),s=await et(this,h,"f").call(this);return t&&s},we=async function(e){let t=e;const{id:s}=t;(0,St.projectLogger)("Calling before sign hook",t);const{updateTransaction:a}=await et(this,d,"f").call(this,{transactionMeta:t})??{};a&&(et(this,n,"m",Ne).call(this,{transactionId:s,skipResimulateCheck:!0},a),(0,St.projectLogger)("Updated transaction after before sign hook")),t=et(this,n,"m",ae).call(this,s);const{networkClientId:o}=t,c=et(this,n,"m",le).call(this,{networkClientId:o});await(0,Ot.checkGasFeeTokenBeforePublish)({ethQuery:c,fetchGasFeeTokens:async e=>(await et(this,n,"m",Xe).call(this,e)).gasFeeTokens,transaction:t,updateTransaction:(e,t)=>et(this,n,"m",Ne).call(this,{transactionId:e},t)}),t=et(this,n,"m",ae).call(this,s);const{chainId:l,isExternalSign:m,txParams:h}=t;if(m)return(0,St.projectLogger)("Skipping sign as signed externally"),undefined;const{authorizationList:f,from:p}=h,g=await(0,Ct.signAuthorizationList)({authorizationList:f,messenger:this.messenger,transactionMeta:t});g&&et(this,n,"m",Ne).call(this,{transactionId:s},e=>{e.txParams.authorizationList=g}),t=et(this,n,"m",ae).call(this,s);const k=et(this,n,"m",ae).call(this,s),{txParams:b}=k,w=(0,Gt.prepareTransaction)(l,b);et(this,i,"f").add(s),(0,St.projectLogger)("Signing transaction",b);const y=await new Promise((e,t)=>{et(this,B,"f")?.call(this,w,p,...et(this,u,"f").call(this,k)).then(e,t),et(this,R,"f").set(s,()=>t(new Error("Signing aborted by user")))});if(et(this,R,"f").delete(s),!y)return(0,St.projectLogger)("Skipping signed status as no signed transaction"),undefined;const x=(0,dt.cloneDeep)(k);if(!et(this,r,"f").call(this,x,y))return this.updateTransaction(x,"TransactionController#signTransaction - Update after sign"),(0,St.projectLogger)("Skipping signed status based on hook"),undefined;const T={...et(this,n,"m",ke).call(this,x,y),status:jt.TransactionStatus.signed,txParams:b};this.updateTransaction(T,"TransactionController#approveTransaction - Transaction signed"),et(this,n,"m",ye).call(this,T);const _=(0,Gt.serializeTransaction)(y),v=(0,dt.merge)({},T,{rawTx:_});return this.updateTransaction(v,"TransactionController#approveTransaction - RawTransaction added"),_},ye=function(e){this.messenger.publish(`${Vt}:transactionStatusUpdated`,{transactionMeta:e})},xe=function(e,t,s){return(0,Rt.getAndFormatTransactionsForNonceTracker)(s,t,e,this.state.transactions)},Te=function(e){(0,St.projectLogger)("Processing confirmed transaction",e.id),et(this,n,"m",fe).call(this,e.id),this.messenger.publish(`${Vt}:transactionConfirmed`,e),et(this,n,"m",ye).call(this,e),et(this,n,"m",_e).call(this,e).catch(e=>{throw(0,St.projectLogger)("Error while updating post balance",e),e})},_e=async function(e){try{const{networkClientId:t,type:s}=e;if(s!==jt.TransactionType.swap)return;const a=et(this,n,"m",le).call(this,{networkClientId:t}),{updatedTransactionMeta:r,approvalTransactionMeta:o}=await(0,Ut.updatePostTransactionBalance)(e,{ethQuery:a,getTransaction:et(this,n,"m",ne).bind(this),updateTransaction:this.updateTransaction.bind(this)});this.messenger.publish(`${Vt}:postTransactionBalanceUpdated`,{transactionMeta:r,approvalTransactionMeta:o})}catch(e){(0,St.projectLogger)("Error while updating post transaction balance",e)}},ve=function({provider:e,blockTracker:t,chainId:s}){return new ot.NonceTracker({provider:e,blockTracker:t,getPendingTransactions:et(this,n,"m",Ae).bind(this,s),getConfirmedTransactions:et(this,n,"m",xe).bind(this,[jt.TransactionStatus.confirmed],s)})},Ee=function({provider:e,blockTracker:t,chainId:s,networkClientId:a}){const r=new at.default(e),o=new _t.PendingTransactionTracker({blockTracker:t,getChainId:()=>s,getEthQuery:()=>r,getGlobalLock:()=>et(this,F,"f").acquireNonceLockForChainIdKey({chainId:s}),getNetworkClientId:()=>a,getTransactions:()=>this.state.transactions,hooks:{beforeCheckPendingTransaction:et(this,c,"f").bind(this)},isResubmitEnabled:et(this,M,"f").isResubmitEnabled,isTimeoutEnabled:et(this,P,"f"),messenger:this.messenger,publishTransaction:(e,t)=>et(this,n,"m",Q).call(this,e,t,{skipSubmitHistory:!0})});return et(this,n,"m",Ce).call(this,o),o},je=function(){et(this,F,"f").stopAllTracking()},Ie=function(e){e.hub.on("transactions",et(this,n,"m",me).bind(this))},Pe=function(e){e.hub.removeAllListeners("transaction-confirmed"),e.hub.removeAllListeners("transaction-dropped"),e.hub.removeAllListeners("transaction-failed"),e.hub.removeAllListeners("transaction-updated")},Ce=function(e){e.hub.on("transaction-confirmed",et(this,n,"m",Te).bind(this)),e.hub.on("transaction-dropped",et(this,n,"m",pe).bind(this)),e.hub.on("transaction-failed",et(this,n,"m",Je).bind(this)),e.hub.on("transaction-updated",this.updateTransaction.bind(this))},Ae=function(e,t){return[...et(this,n,"m",xe).call(this,[jt.TransactionStatus.approved,jt.TransactionStatus.signed,jt.TransactionStatus.submitted],t,e),...et(this,p,"f").call(this,t,e)]},Fe=async function(e,t){try{return await et(this,n,"m",Q).call(this,e,t)}catch(e){if(et(this,n,"m",Me).call(this,e))throw new Error("Previous transaction is already confirmed");throw e}},Me=function(e){return Boolean(e?.message?.includes("nonce too low"))||Boolean(e?.data?.message?.includes("nonce too low"))},De=function(){return et(this,H,"f")?[new kt.TestGasFeeFlow]:[new pt.RandomisedEstimationsGasFeeFlow,new ht.LineaGasFeeFlow,new ut.DefaultGasFeeFlow]},Oe=function(){return[new ft.OptimismLayer1GasFeeFlow,new gt.ScrollLayer1GasFeeFlow]},Ne=function({transactionId:e,skipValidation:t,skipResimulateCheck:s},a){let r;this.update(n=>{const o=n.transactions.findIndex(({id:t})=>t===e);if(-1===o)throw new Error(`Cannot update transaction as ID not found - ${e}`);let i=n.transactions[o];const c=(0,dt.cloneDeep)(i);i=a(i)??i,!0!==t&&(i.txParams=(0,Wt.normalizeTransactionParams)(i.txParams),(0,$t.validateTxParams)(i.txParams)),!s&&et(this,j,"f").call(this)&&(r=(0,vt.shouldResimulate)(c,i)),n.transactions[o]=i});const o=et(this,n,"m",ne).call(this,e);return r?.resimulate&&et(this,n,"m",Le).call(this,o,{blockTime:r.blockTime}).catch(e=>{throw(0,St.projectLogger)("Error during re-simulation",e),e}),o},Le=async function(e,{blockTime:t,traceContext:s}={}){const{chainId:a,id:r,nestedTransactions:o,networkClientId:i,simulationData:c,txParams:l}=e;let d,m={error:{code:jt.SimulationErrorCode.Disabled,message:"Simulation disabled"},tokenBalanceChanges:[]},u=[],h=!1;const f=et(this,G,"f").has(r);if(et(this,j,"f").call(this)&&!f){const r=await et(this,U,"f").call(this,{name:"Simulate",parentContext:s},()=>(0,It.getBalanceChanges)({blockTime:t,chainId:a,ethQuery:et(this,n,"m",le).call(this,{networkClientId:i}),getSimulationConfig:(t,s)=>et(this,y,"f").call(this,t,{txMeta:e,...s}),nestedTransactions:o,txParams:l}));m=r.simulationData,d=r.gasUsed,t&&c&&(0,vt.hasSimulationDataChanged)(c,m)&&(m={...m,isUpdatedAfterSecurityCheck:!0});const f=await et(this,n,"m",Xe).call(this,e);u=f?.gasFeeTokens??[],h=f?.isGasFeeSponsored??!1}if(!et(this,n,"m",ne).call(this,r))return void(0,St.projectLogger)("Cannot update simulation data as transaction not found",r,m);const p=et(this,n,"m",Ne).call(this,{transactionId:r,skipResimulateCheck:Boolean(t)},e=>{e.gasFeeTokens=u,e.isGasFeeSponsored=h,e.gasUsed=d,f||(e.simulationData=m)});(0,St.projectLogger)("Updated simulation data",r,p),await et(this,n,"m",Ye).call(this,p)},Be=function({transactionId:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:s,layer1GasFee:a}){et(this,n,"m",Ne).call(this,{transactionId:e},e=>{(0,wt.updateTransactionGasProperties)({txMeta:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:s,isTxParamsGasFeeUpdatesEnabled:et(this,v,"f"),layer1GasFee:a})})},Re=function({transactionBatchId:e,gasFeeEstimates:t}){et(this,n,"m",Ge).call(this,e,e=>({...e,gasFeeEstimates:t}))},Ge=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})},He=function(){return this.messenger.call("AccountsController:getSelectedAccount")},Ue=function(){const e=this.messenger.call("AccountsController:getState");return Object.values(e.internalAccounts?.accounts??{}).filter(e=>"eip155:eoa"===e.type).map(e=>e.address)},qe=function(e,t){const{chainId:s,networkClientId:n,origin:a,rawTx:r,txParams:o}=e,{networkConfigurationsByChainId:i}=et(this,k,"f").call(this),c=i[s],l=c?.rpcEndpoints.find(e=>e.networkClientId===n),d=l?.url,m={chainId:s,hash:t,networkType:l?.name??n,networkUrl:d,origin:a,rawTransaction:r,time:Date.now(),transaction:o};(0,St.projectLogger)("Updating submit history",m);const u=(0,Ft.getSubmitHistoryLimit)(this.messenger);this.update(e=>{const{submitHistory:t}=e;t.length>=u&&t.pop(),t.unshift(m)})},We=async function(e){const{chainId:t,networkClientId:s}=e,a=et(this,F,"f").getNetworkClient({networkClientId:s}).configuration.type===rt.NetworkClientType.Custom,r=et(this,n,"m",le).call(this,{networkClientId:s});await(0,Dt.updateGas)({chainId:t,ethQuery:r,isCustomNetwork:a,isSimulationEnabled:et(this,j,"f").call(this),getSimulationConfig:et(this,y,"f"),messenger:this.messenger,txMeta:e})},$e=function(){this.messenger.registerMethodActionHandlers(this,Jt)},Ke=function(e){this.update(t=>{const s=t.transactions.filter(({id:t})=>t!==e);t.transactions=et(this,n,"m",Z).call(this,s)})},Ve=function(e){return[it.errorCodes.provider.userRejectedRequest,$t.ErrorCode.RejectedUpgrade].includes(e.code)},ze=function(e,t,s){if(et(this,n,"m",X).call(this,e,t,s),s.code===it.errorCodes.provider.userRejectedRequest)throw it.providerErrors.userRejectedRequest({message:"MetaMask Tx Signature: User denied transaction signature.",data:s?.data});throw s},Je=function(e,t,s){let a;try{a=et(this,n,"m",Ne).call(this,{transactionId:e.id,skipValidation:!0},e=>{e.status=jt.TransactionStatus.failed,e.error=(0,Wt.normalizeTxError)(t)})}catch(s){(0,St.projectLogger)("Failed to mark transaction as failed",s),a={...e,status:jt.TransactionStatus.failed,error:(0,Wt.normalizeTxError)(t)}}this.messenger.publish(`${Vt}:transactionFailed`,{actionId:s,error:t.message,transactionMeta:a}),et(this,n,"m",ye).call(this,a),this.messenger.publish(`${Vt}:transactionFinished`,a),et(this,_,"f").emit(`${e.id}:finished`,a)},Ye=async function(e){(0,St.projectLogger)("Calling afterSimulate hook",e);const{id:t}=e,s=await et(this,o,"f").call(this,{transactionMeta:e}),{skipSimulation:a,updateTransaction:r}=s??{};if(a?et(this,G,"f").add(t):!1===a&&et(this,G,"f").delete(t),!r)return;const i=et(this,n,"m",Ne).call(this,{transactionId:t,skipResimulateCheck:!0},e=>{e.txParamsOriginal=(0,dt.cloneDeep)(e.txParams),r(e)});(0,St.projectLogger)("Updated transaction with afterSimulate data",i)},Qe=async function({ethQuery:e,publishHookOverride:t,traceContext:s},a,r){let o;return await et(this,U,"f").call(this,{name:"Publish",parentContext:s},async()=>{const s=t??et(this,O,"f");({transactionHash:o}=await s(a,r)),o??(o=await et(this,n,"m",Q).call(this,e,{...a,rawTx:r}))}),(0,St.projectLogger)("Publish successful",o),{transactionHash:o}},Xe=async function(e){const{chainId:t}=e;return await(0,Ot.getGasFeeTokens)({chainId:t,getSimulationConfig:et(this,y,"f"),isEIP7702GasFeeTokensEnabled:et(this,E,"f"),messenger:this.messenger,publicKeyEIP7702:et(this,D,"f"),transactionMeta:e})}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs",{"../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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"),o=e("../logger.cjs"),i="https://accounts.api.cx.metamask.io",c=`${i}/v1/accounts/`,l="x-metamask-clientproduct",d="metamask-transaction-controller",m=[1,10,56,137,8453,42161,59144,534352,1329,143,999],u=(0,a.createModuleLogger)(o.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 o=`${i}/v1/networks/${t}/accounts/${s}/relationships/${a}`;u("Getting account address relationship",{request:e,url:o});const c={[l]:d},h=await(0,n.successfulFetch)(o,{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:o,startTimestamp:i,tags:m}=e;let h=`${c}${t}/transactions`;const f=[];if(s){const e=s.join(",");f.push(`networks=${e}`)}i&&f.push(`startTimestamp=${i}`),r&&f.push(`endTimestamp=${r}`),a&&f.push(`cursor=${a}`),o&&f.push(`sortDirection=${o}`),f.length&&(h+=`?${f.join("&")}`),u("Getting account transactions",{request:e,url:h});const p=[d,...m??[]].join("__"),g={[l]:p},k=await(0,n.successfulFetch)(h,{headers:g}),b=await k.json();return u("Retrieved account transactions",b),b}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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"),o=e("../constants.cjs"),i=e("../errors.cjs"),c=e("../logger.cjs"),l=(0,a.createModuleLogger)(c.projectLogger,"simulation-api"),d="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")}${d}`,t=await fetch(e);return t.json()}(),s=(0,n.convertHexToDecimal)(e),a=t[s];if(!a?.confirmations)throw l("Chain is not supported",e),new i.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();o.DELEGATION_MANAGER_ADDRESSES.includes(s)&&(t.overrides=t.overrides??{},t.overrides[s]={code:o.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS})}return t}(t);l("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(l("Received response",k),k.error){const{code:e,message:t}=k.error;throw new i.SimulationError(t,e)}return k?.result}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/errors.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,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.DefaultGasFeeFlow=void 0;const d=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:i}=t;let c;switch(s){case d.GAS_ESTIMATE_TYPES.FEE_MARKET:p("Using fee market estimates",i),c=l(this,n,"m",a).call(this,i);break;case d.GAS_ESTIMATE_TYPES.LEGACY:p("Using legacy estimates",i),c=l(this,n,"m",r).call(this,i);break;case d.GAS_ESTIMATE_TYPES.ETH_GASPRICE:p("Using eth_gasPrice estimates",i),c=l(this,n,"m",o).call(this,i);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]:l(this,n,"m",i).call(this,e,s)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...t}},r=function(e){const t=Object.values(h.GasFeeEstimateLevel).reduce((t,s)=>({...t,[s]:l(this,n,"m",c).call(this,e,s)}),{});return{type:h.GasFeeEstimateType.Legacy,...t}},o=function(e){return{type:h.GasFeeEstimateType.GasPrice,gasPrice:(0,f.gweiDecimalToWeiHex)(e.gasPrice)}},i=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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,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.LineaGasFeeFlow=void 0;const d=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=[d.ChainId["linea-mainnet"],d.ChainId["linea-goerli"],d.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 l(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 l(this,n,"m",r).call(this,s,t);p("Received Linea response",a);const m=l(this,n,"m",o).call(this,a.baseFeePerGas,k);p("Generated base fees",l(this,n,"m",c).call(this,m));const u=l(this,n,"m",o).call(this,a.priorityFeePerGas,b);p("Generated priority fees",l(this,n,"m",c).call(this,u));const h=l(this,n,"m",i).call(this,m,u);p("Generated max fees",l(this,n,"m",c).call(this,h));return{estimates:Object.values(f.GasFeeEstimateLevel).reduce((e,t)=>({...e,[t]:{maxFeePerGas:(0,d.toHex)(h[t]),maxPriorityFeePerGas:(0,d.toHex)(u[t])}}),{type:f.GasFeeEstimateType.FeeMarket})}},r=function(e,t){return(0,d.query)(t,"linea_estimateGas",[{from:e.txParams.from,to:e.txParams.to,value:e.txParams.value,input:e.txParams.data}])},o=function(e,t){const s=(0,d.hexToBN)(e);return{low:s.muln(t.low),medium:s.muln(t.medium),high:s.muln(t.high)}},i=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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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 o=e("@metamask/controller-utils"),i=e("@metamask/utils"),c=e("./OracleLayer1GasFeeFlow.cjs"),l=e("../constants.cjs"),d=[l.CHAIN_IDS.OPTIMISM,l.CHAIN_IDS.OPTIMISM_TESTNET,l.CHAIN_IDS.BASE,l.CHAIN_IDS.BASE_TESTNET,l.CHAIN_IDS.OPBNB,l.CHAIN_IDS.OPBNB_TESTNET,l.CHAIN_IDS.ZORA];class m extends c.OracleLayer1GasFeeFlow{constructor(){super(...arguments),n.add(this)}async matchesTransaction({transactionMeta:e}){const t=(0,i.hexToNumber)(e.chainId),s=await r(this,n,"m",a).call(this);return!!s?.has(t)||d.includes(e.chainId)}}s.OptimismLayer1GasFeeFlow=m,n=new WeakSet,a=async function(){try{const e=await(0,o.handleFetch)("https://gas.api.cx.metamask.io/v1/supportedNetworks");return new Set(e?.partialSupport?.optimism??[])}catch{return null}}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,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)},d=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=d(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),y=[{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,o=l(this,n,"m",c).call(this,t,s.chainId),i=await l(this,n,"m",a).call(this,o,s),d=await l(this,n,"m",r).call(this,o,s);return{layer1Fee:(0,h.add0x)((0,k.padHexToEvenLength)(i.add(d).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=l(this,n,"m",o).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}},o=function(e,s){const a=l(this,n,"m",i).call(this,e),{chainId:r}=e;let o=(0,g.prepareTransaction)(r,a);if(s){const e=t.from("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789","hex"),s=Uint8Array.from(e);o=o.sign(s)}return o},i=function(e){return{...e.txParams,gasLimit:e.txParams.gas}},c=function(e,t){return new m.Contract(this.getOracleAddressForChain(t),y,new u.Web3Provider(e))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","./DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,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 l=e("@metamask/gas-fee-controller"),d=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,d.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 o=a-r,i=n.slice(0,o),c=n.slice(-r),l=function(e,t){const s=10**e;return t+Math.floor(Math.random()*(s-t))}(r,Number(c)),m=`0x${(BigInt(i+"0".repeat(r))+BigInt(l)).toString(16)}`;return(0,d.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:i,gasFeeEstimates:d}=s,m=(0,f.getGasFeeRandomisation)(t),u=m.randomisedGasFeeDigits[r.chainId],h=m.preservedNumberOfDigits??2;if(i===l.GAS_ESTIMATE_TYPES.FEE_MARKET){g("Randomising fee market estimates",d);const e=c(this,n,"m",o).call(this,d,u,h);return g("Added randomised fee market estimates",e),{estimates:e}}return await c(this,n,"m",a).call(this,e)},o=function(e,t,s){const a=Object.values(h.GasFeeEstimateLevel).reduce((a,r)=>({...a,[r]:c(this,n,"m",i).call(this,e,r,t,s)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...a}},i=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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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 o extends n.OracleLayer1GasFeeFlow{getOracleAddressForChain(e){return"0x5300000000000000000000000000000000000002"}shouldSignTransaction(){return!0}async matchesTransaction({transactionMeta:e}){return r.includes(e.chainId)}}s.ScrollLayer1GasFeeFlow=o}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,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)},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};Object.defineProperty(s,"__esModule",{value:!0}),s.TestGasFeeFlow=void 0;const c=e("@metamask/controller-utils"),l=e("../types.cjs"),d=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*d,h=(o(this,a,"f")+1)*d,f=o(this,a,"f")*d,p=h-u,g=f-u,k=h+u,b=f+u;return i(this,a,o(this,a,"f")+1,"f"),{estimates:{type:l.GasFeeEstimateType.FeeMarket,low:{maxFeePerGas:o(this,n,"m",r).call(this,p,m),maxPriorityFeePerGas:o(this,n,"m",r).call(this,g,m)},medium:{maxFeePerGas:o(this,n,"m",r).call(this,h,m),maxPriorityFeePerGas:o(this,n,"m",r).call(this,f,m)},high:{maxFeePerGas:o(this,n,"m",r).call(this,k,m),maxPriorityFeePerGas:o(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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","../index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/index.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,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)},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 l=e("@metamask/controller-utils"),d=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,l=await i(this,n,"m",a).call(this,e,c??s.SUPPORTED_CHAIN_IDS);k("Fetched transactions",l.length,l);const d=await Promise.all(l.map(e=>i(this,n,"m",o).call(this,t,e)));k("Normalized transactions",d);const m=i(this,n,"m",r).call(this,e,d);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},o=async function(e,t){const s=String(t.blockNumber),n=`0x${t.chainId.toString(16)}`,{hash:a}=t,r=new Date(t.timestamp).getTime(),o=(0,m.v1)({msecs:r}),{from:i}=t,c=(0,l.BNToHex)(new d.default(t.gas)),h=(0,l.BNToHex)(new d.default(t.gasPrice)),f=(0,l.BNToHex)(new d.default(t.gasUsed)),p=(0,l.BNToHex)(new d.default(t.nonce)),k=t.methodId,b=g.TransactionType.incoming,w=t.isError?g.TransactionStatus.failed:g.TransactionStatus.confirmed,y=t.valueTransfers.find(t=>(t.to.toLowerCase()===e.toLowerCase()||t.from.toLowerCase()===e.toLowerCase())&&t.contractAddress),x=y?.to.toLowerCase()===e.toLowerCase()&&i.toLowerCase()!==e.toLowerCase(),T=i.toLowerCase()===e.toLowerCase(),_=y?.amount,v=y?.contractAddress,E=y?.decimal,S=y?.symbol,j=(0,l.BNToHex)(new d.default(x?y?.amount??t.value:t.value)),I=x?e:t.to,P={blockNumber:s,chainId:n,error:w===g.TransactionStatus.failed?new Error("Transaction failed"):undefined,hash:a,id:o,isTransfer:x,networkClientId:"",status:w,time:r,toSmartContract:!1,transferInformation:y?{amount:_,contractAddress:v,decimals:E,symbol:S}:undefined,txParams:{chainId:n,data:k,from:i,gas:c,gasPrice:h,gasUsed:f,nonce:p,to:I,value:j},type:b,verifiedOnBlockchain:!1};return T&&(P.type=(await(0,u.determineTransactionType)(P.txParams)).type),P}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs",{"../gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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/bridge-status-controller/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,o,i,c,l,d,m,u,h,f,p,g,k,b,w,y,x,T,_,v,E,S=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},j=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)},I=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 P=I(e("@metamask/eth-query")),C=e("@metamask/utils"),A=I(e("events")),F=e("../gas-flows/DefaultGasFeeFlow.cjs"),M=e("../logger.cjs"),D=e("../types.cjs"),O=e("../utils/gas-flow.cjs"),N=e("../utils/layer1-gas-fee-flow.cjs"),L=(0,C.createModuleLogger)(M.projectLogger,"gas-fee-poller");function B(e,t,s,n){const{type:a}=t;if(n){if(a===D.GasFeeEstimateType.FeeMarket){const n=t;e.maxFeePerGas=n[s]?.maxFeePerGas,e.maxPriorityFeePerGas=n[s]?.maxPriorityFeePerGas}if(a===D.GasFeeEstimateType.GasPrice){const s=t;e.maxFeePerGas=s.gasPrice,e.maxPriorityFeePerGas=s.gasPrice}if(a===D.GasFeeEstimateType.Legacy){const n=t[s];e.maxFeePerGas=n,e.maxPriorityFeePerGas=n}delete e.gasPrice}else{if(a===D.GasFeeEstimateType.FeeMarket){const n=t;e.gasPrice=n[s]?.maxFeePerGas}if(a===D.GasFeeEstimateType.GasPrice){const s=t;e.gasPrice=s.gasPrice}if(a===D.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:y,onStateChange:x}){n.add(this),this.hub=new A.default,a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.set(this,void 0),m.set(this,void 0),u.set(this,void 0),h.set(this,!1),S(this,a,e,"f"),S(this,r,t,"f"),S(this,d,w,"f"),S(this,o,s,"f"),S(this,i,g,"f"),S(this,c,k,"f"),S(this,l,b,"f"),S(this,m,y,"f"),x(()=>{const e=j(this,n,"m",_).call(this),t=j(this,n,"m",v).call(this);e.length||t.length?j(this,n,"m",f).call(this):j(this,n,"m",p).call(this)})}},a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,n=new WeakSet,f=function(){j(this,h,"f")||(j(this,n,"m",g).call(this),S(this,h,!0,"f"),L("Started polling"))},p=function(){j(this,h,"f")&&(clearTimeout(j(this,u,"f")),S(this,u,undefined,"f"),S(this,h,!1,"f"),L("Stopped polling"))},g=async function e(){await j(this,n,"m",k).call(this),await j(this,n,"m",b).call(this),S(this,u,setTimeout(()=>j(this,n,"m",e).call(this),1e4),"f")},k=async function(){const e=j(this,n,"m",_).call(this);if(!e.length)return;L("Found unapproved transactions",e.length);const t=await j(this,n,"m",E).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 j(this,n,"m",w).call(this,e,a)}))},b=async function(){const e=j(this,n,"m",v).call(this);if(!e.length)return;L("Found unapproved transaction batches",e.length);const t=await j(this,n,"m",E).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 j(this,n,"m",y).call(this,e,a)}))},w=async function(e,t){const{id:s}=e,[a,r]=await Promise.all([j(this,n,"m",x).call(this,e,t),j(this,n,"m",T).call(this,e)]);(a||r)&&this.hub.emit("transaction-updated",{transactionId:s,gasFeeEstimates:a?.gasFeeEstimates,gasFeeEstimatesLoaded:a?.gasFeeEstimatesLoaded,layer1GasFee:r})},y=async function(e,t){const{id:s}=e,n=new P.default(j(this,i,"f").call(this,e.networkClientId)),a=new F.DefaultGasFeeFlow,r={ethQuery:n,gasFeeControllerData:t,messenger:j(this,m,"f"),transactionMeta:{...e,txParams:{...e.transactions?.[0],from:e.from,gas:e.gas},time:Date.now()}};let o;try{o=(await a.getGasFees(r)).estimates}catch(t){L("Failed to get gas fees for batch",e.id,t)}o&&this.hub.emit("transaction-batch-updated",{transactionBatchId:s,gasFeeEstimates:o,gasFeeEstimatesLoaded:!0})},x=async function(e,t){const{networkClientId:s}=e,n=new P.default(j(this,i,"f").call(this,s)),a=(0,O.getGasFeeFlow)(e,j(this,r,"f"),j(this,m,"f"));a&&L("Found gas fee flow",a.constructor.name,e.id);const o={ethQuery:n,gasFeeControllerData:t,messenger:j(this,m,"f"),transactionMeta:e};let c;if(a)try{c=(await a.getGasFees(o)).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})},T=async function(e){const{networkClientId:t}=e,s=j(this,i,"f").call(this,t),n=await(0,N.getTransactionLayer1GasFee)({layer1GasFeeFlows:j(this,d,"f"),messenger:j(this,m,"f"),provider:s,transactionMeta:e});return n&&L("Updated layer 1 gas fee",n,e.id),n},_=function(){return j(this,c,"f").call(this).filter(e=>e.status===D.TransactionStatus.unapproved)},v=function(){return j(this,l,"f").call(this).filter(e=>e.status===D.TransactionStatus.unapproved)},E=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??j(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 j(this,o,"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,o=Object.values(D.GasFeeEstimateLevel).includes(r);if(s(a)&&o&&e){const t=a.txParams.type!==D.TransactionEnvelopeType.legacy;B(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;B(s,n,t,e.txParams.type!==D.TransactionEnvelopeType.legacy)}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","./AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,m,u,h,f,p,g,k,b,w,y,x,T,_,v,E,S,j,I,P,C,A,F,M,D,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},N=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.IncomingTransactionHelper=s.WebSocketState=void 0;const B=L(e("events")),R=e("./AccountsApiRemoteTransactionSource.cjs"),G=e("../logger.cjs"),H=e("../utils/feature-flags.cjs"),U=e("../utils/utils.cjs");var q;!function(e){e.CONNECTED="connected",e.DISCONNECTED="disconnected"}(q||(s.WebSocketState=q={}));s.IncomingTransactionHelper=class{constructor({client:e,getCurrentAccount:t,getLocalTransactions:s,includeTokenTransfers:_,isEnabled:E,messenger:S,remoteTransactionSource:P,trimTransactions:C,updateTransactions:A}){n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.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,!1),g.set(this,void 0),k.set(this,void 0),b.set(this,[...R.SUPPORTED_CHAIN_IDS]),w.set(this,e=>{N(this,n,"m",v).call(this,e)}),y.set(this,e=>{N(this,n,"m",j).call(this,e)}),x.set(this,()=>{N(this,n,"m",I).call(this)}),T.set(this,({chainIds:e,status:t})=>{N(this,n,"m",D).call(this,e,t)}),this.hub=new B.default,O(this,a,e,"f"),O(this,r,t,"f"),O(this,o,s,"f"),O(this,i,_,"f"),O(this,c,E??(()=>!0),"f"),O(this,l,!1,"f"),O(this,d,!1,"f"),O(this,m,S,"f"),O(this,u,P,"f"),O(this,f,C,"f"),O(this,g,A,"f"),O(this,k,(0,H.isIncomingTransactionsUseBackendWebSocketServiceEnabled)(S),"f"),N(this,k,"f")&&(N(this,m,"f").subscribe("BackendWebSocketService:connectionStateChanged",N(this,w,"f")),N(this,m,"f").subscribe("AccountActivityService:statusChanged",N(this,T,"f")))}start(){N(this,k,"f")||N(this,n,"m",_).call(this,!0)}stop(){N(this,h,"f")&&clearTimeout(N(this,h,"f")),N(this,l,"f")&&(O(this,l,!1,"f"),(0,G.incomingTransactionsLogger)("Stopped polling"))}async update({chainIds:e,isInterval:t,tags:s}={}){const a=N(this,n,"m",M).call(this,s,t);if((0,G.incomingTransactionsLogger)("Checking for incoming transactions",{isInterval:Boolean(t),tags:a}),!N(this,n,"m",A).call(this))return;const c=N(this,r,"f").call(this),l=N(this,i,"f")??!0,d=N(this,g,"f")??!1;let m=[];try{m=await N(this,u,"f").fetchTransactions({address:c.address,chainIds:e,includeTokenTransfers:l,tags:a,updateTransactions:d})}catch(e){return void(0,G.incomingTransactionsLogger)("Error while fetching remote transactions",e)}if(!m.length)return;N(this,n,"m",C).call(this,m),(0,G.incomingTransactionsLogger)("Found potential transactions",m.length,m);const h=N(this,o,"f").call(this),p=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(!p.length)return void(0,G.incomingTransactionsLogger)("All transactions are already known");(0,G.incomingTransactionsLogger)("Found unique transactions",p.length,p);const k=N(this,f,"f").call(this,[...p,...h]),b=p.map(e=>e.id),w=k.filter(e=>b.includes(e.id));w.length?((0,G.incomingTransactionsLogger)("Adding new transactions",w.length,w),this.hub.emit("transactions",w)):(0,G.incomingTransactionsLogger)("All unique transactions truncated due to limit")}},a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=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,y=new WeakMap,x=new WeakMap,T=new WeakMap,n=new WeakSet,_=function(e=!1){if(N(this,l,"f"))return;if(!N(this,n,"m",A).call(this))return;const t=N(this,n,"m",F).call(this);(0,G.incomingTransactionsLogger)("Started polling",{interval:t}),O(this,l,!0,"f"),N(this,d,"f")||N(this,n,"m",P).call(this).catch(t=>{(0,G.incomingTransactionsLogger)(e?"Initial polling failed":"Polling failed",t)})},v=function(e){e.state===q.CONNECTED?((0,G.incomingTransactionsLogger)("WebSocket connected, starting enhanced mode"),N(this,n,"m",E).call(this)):e.state===q.DISCONNECTED&&((0,G.incomingTransactionsLogger)("WebSocket disconnected, stopping enhanced mode"),N(this,n,"m",S).call(this))},E=function(){N(this,n,"m",A).call(this)&&(N(this,p,"f")||((0,G.incomingTransactionsLogger)("Started transaction history retrieval (event-driven)"),O(this,p,!0,"f"),this.update().catch(e=>{(0,G.incomingTransactionsLogger)("Initial update in transaction history retrieval failed",e)}),N(this,m,"f").subscribe("AccountActivityService:transactionUpdated",N(this,y,"f")),N(this,m,"f").subscribe("AccountsController:selectedAccountChange",N(this,x,"f"))))},S=function(){N(this,p,"f")&&((0,G.incomingTransactionsLogger)("Stopped transaction history retrieval"),O(this,p,!1,"f"),N(this,m,"f").unsubscribe("AccountActivityService:transactionUpdated",N(this,y,"f")),N(this,m,"f").unsubscribe("AccountsController:selectedAccountChange",N(this,x,"f")))},j=function(e){(0,G.incomingTransactionsLogger)("Received relevant transaction update, triggering update",{txId:e.id,chain:e.chain}),this.update().catch(e=>{(0,G.incomingTransactionsLogger)("Update after transaction event failed",e)})},I=function(){(0,G.incomingTransactionsLogger)("Selected account changed, triggering update"),this.update().catch(e=>{(0,G.incomingTransactionsLogger)("Update after account change failed",e)})},P=async function e(){O(this,d,!0,"f");try{const e=N(this,k,"f")?N(this,b,"f"):undefined;await this.update({chainIds:e,isInterval:!0})}catch(e){console.error("Error while checking incoming transactions",e)}O(this,d,!1,"f"),N(this,l,"f")&&(N(this,h,"f")&&clearTimeout(N(this,h,"f")),O(this,h,setTimeout(()=>N(this,n,"m",e).call(this),N(this,n,"m",F).call(this)),"f"))},C=function(e){e.sort((e,t)=>e.time<t.time?-1:1)},A=function(){return N(this,c,"f").call(this)},F=function(){return(0,H.getIncomingTransactionsPollingInterval)(N(this,m,"f"))},M=function(e,t){const s=[];return N(this,a,"f")&&s.push(N(this,a,"f")),e?.length?s.push(...e):t&&s.push("automatic-polling"),s?.length?s:undefined},D=function(e,t){if(!N(this,k,"f"))return;let s=!1;for(const n of e){const e=(0,U.caip2ToHex)(n);if(e&&R.SUPPORTED_CHAIN_IDS.includes(e))if("up"===t){const t=N(this,b,"f").indexOf(e);-1!==t&&(N(this,b,"f").splice(t,1),s=!0,(0,G.incomingTransactionsLogger)("Supported network came up, removed from polling list",{chainId:e}))}else"down"!==t||N(this,b,"f").includes(e)||(N(this,b,"f").push(e),s=!0,(0,G.incomingTransactionsLogger)("Supported network went down, added to polling list",{chainId:e}));else(0,G.incomingTransactionsLogger)("Chain ID not recognized or not supported",{caip2ChainId:n,hexChainId:e})}s?0===N(this,b,"f").length?((0,G.incomingTransactionsLogger)("Stopping fallback polling - all networks up"),this.stop()):((0,G.incomingTransactionsLogger)("Starting fallback polling - some networks need polling",{chainsToPoll:N(this,b,"f")}),N(this,n,"m",_).call(this)):(0,G.incomingTransactionsLogger)("No changes to polling list",{chainsToPoll:N(this,b,"f")})}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l=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)},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),o.set(this,void 0),i.set(this,new h.Mutex),this.hub=new p.default,l(this,a,e,"f"),l(this,r,t,"f"),l(this,o,new Map,"f")}async lookup(e,t){k("lookup",e,t);const s=await d(this,i,"f").acquire();try{const s=d(this,r,"f").call(this)[e];if(s)return k("Cached",s),s;let i=d(this,o,"f").get(t);if(!i){const e=d(this,a,"f").call(this,t);i=new f.MethodRegistry({provider:e}),d(this,o,"f").set(t,i),k("Created registry",t)}const l=await d(this,n,"m",c).call(this,e,i);return k("Result",l),this.hub.emit("update",{fourBytePrefix:e,methodData:l}),l}finally{s()}}},a=new WeakMap,r=new WeakMap,o=new WeakMap,i=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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,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:y,onNetworkStateChange:x}){n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.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,o,s,"f"),p(this,i,k,"f"),p(this,c,b,"f"),p(this,l,y,"f"),x((e,t)=>{const s=g(this,o,"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,o,"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,d,"f").get(e);s||(s=new Map,g(this,d,"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,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=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,i,"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}),o=g(this,l,"f").call(this,{provider:t,blockTracker:s,chainId:n,networkClientId:e});g(this,m,"f").set(e,{nonceTracker:a,pendingTransactionTracker:o})}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","./TransactionPoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,m,u,h,f,p,g,k,b,w,y,x,T,_,v,E,S,j,I,P,C,A,F,M,D,O,N,L,B,R,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},K=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.PendingTransactionTracker=void 0;const z=e("@metamask/controller-utils"),J=V(e("events")),Y=e("lodash"),Q=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:_,getNetworkClientId:v,getTransactions:E,isTimeoutEnabled:S,hooks:j,isResubmitEnabled:I,messenger:P,publishTransaction:C}){n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.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),y.set(this,void 0),this.startIfPendingTransactions=()=>{const e=K(this,n,"m",D).call(this);e.length?K(this,n,"m",x).call(this,e):this.stop()},this.hub=new J.default,$(this,r,new Map,"f"),$(this,i,t,"f"),$(this,c,s,"f"),$(this,l,_,"f"),$(this,d,v,"f"),$(this,m,E,"f"),$(this,u,I??(()=>!0),"f"),$(this,h,new Map,"f"),$(this,f,K(this,n,"m",T).bind(this),"f"),$(this,g,P,"f"),$(this,k,C,"f"),$(this,b,!1,"f"),$(this,y,undefined,"f"),$(this,w,new Q.TransactionPoller({blockTracker:e,chainId:t(),messenger:P}),"f"),$(this,a,j?.beforeCheckPendingTransaction??(()=>Promise.resolve(!0)),"f"),$(this,o,S,"f"),$(this,p,(0,X.createModuleLogger)(se,`${t()}:${v()}`),"f")}addTransactionToPoll(e){K(this,n,"m",x).call(this,[e]),$(this,y,e,"f")}async forceCheckTransaction(e){const t=await K(this,l,"f").call(this);try{await K(this,n,"m",P).call(this,e)}catch(e){K(this,p,"f").call(this,"Failed to check transaction",e)}finally{t()}}stop(){K(this,b,"f")&&(K(this,w,"f").stop(),$(this,b,!1,"f"),K(this,p,"f").call(this,"Stopped polling"))}},a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=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,y=new WeakMap,n=new WeakSet,x=function(e){K(this,w,"f").setPendingTransactions(e),K(this,b,"f")||(K(this,w,"f").start(K(this,f,"f")),$(this,b,!0,"f"),K(this,p,"f").call(this,"Started polling"))},T=async function(e){const t=await K(this,l,"f").call(this);try{await K(this,n,"m",_).call(this)}catch(e){K(this,p,"f").call(this,"Failed to check transactions",e)}finally{t()}try{await K(this,n,"m",v).call(this,e)}catch(e){K(this,p,"f").call(this,"Failed to resubmit transactions",e)}},_=async function(){K(this,p,"f").call(this,"Checking transactions");const e=[...K(this,n,"m",D).call(this),...K(this,y,"f")?[K(this,y,"f")]:[]];e.length?(K(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=>K(this,n,"m",P).call(this,e)))):K(this,p,"f").call(this,"No pending transactions to check")},v=async function(e){if(!K(this,u,"f").call(this)||!K(this,b,"f"))return;K(this,p,"f").call(this,"Resubmitting transactions");const t=K(this,n,"m",D).call(this);if(t.length){K(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 K(this,n,"m",S).call(this,s,e)}catch(e){const t=e.value?.message?.toLowerCase()??e.message?.toLowerCase()??String(e);if(K(this,n,"m",E).call(this,t)){K(this,p,"f").call(this,"Ignoring known transaction error",t);continue}K(this,n,"m",O).call(this,s,e.message,"There was an error when resubmitting this transaction.")}}else K(this,p,"f").call(this,"No pending transactions to resubmit")},E=function(e){return te.some(t=>e.includes(t))},S=async function(e,t){if(!K(this,n,"m",j).call(this,e,t))return;if(!await K(this,a,"f").call(this,e))return;const s=K(this,c,"f").call(this,e.networkClientId);await K(this,k,"f").call(this,s,e);const r=(e.retryCount??0)+1;K(this,n,"m",B).call(this,(0,Y.merge)({},e,{retryCount:r}),"PendingTransactionTracker:transaction-retry - Retry count increased")},j=function(e,t){const s=(0,Y.cloneDeep)(e);s.firstRetryBlockNumber||(s.firstRetryBlockNumber=t,K(this,n,"m",B).call(this,s,"PendingTransactionTracker:#isResubmitDue - First retry block number set"));const{firstRetryBlockNumber:a}=s,r=Number.parseInt(t,16)-Number.parseInt(a,16),o=e.retryCount??0;return r>=Math.min(50,Math.pow(2,o))},I=function(e){const{hash:t,id:s}=e;K(this,y,"f")?.id===s&&$(this,y,undefined,"f"),t&&K(this,h,"f").delete(t)},P=async function(e){const{hash:t,id:s,isIntentComplete:r,txParams:{from:o}}=e;if(r)await K(this,n,"m",C).call(this,e);else{if(!t&&await K(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 K(this,n,"m",N).call(this,e,t)}if(K(this,n,"m",M).call(this,e))return K(this,p,"f").call(this,"Nonce already taken",s),void K(this,n,"m",L).call(this,e);try{const s=await K(this,n,"m",R).call(this,t),a="0x1"===s?.status;if("0x0"===s?.status)return K(this,p,"f").call(this,"Transaction receipt has failed status"),void K(this,n,"m",N).call(this,e,new Error("Transaction failed on-chain"));const{blockNumber:r,blockHash:i}=s??{};if(a&&r&&i)return void await K(this,n,"m",C).call(this,e,{...s,blockNumber:r,blockHash:i});K(this,p,"f").call(this,"No receipt status",{hash:t,receipt:s});const c=await K(this,n,"m",U).call(this,o),l=parseInt(c,16);if(!s&&await K(this,n,"m",A).call(this,e,l))return;await K(this,n,"m",F).call(this,e,l)&&K(this,n,"m",L).call(this,e)}catch(t){K(this,p,"f").call(this,"Failed to check transaction",s,t),K(this,n,"m",O).call(this,e,t.message,"There was a problem loading this transaction.")}}},C=async function(e,t){const{id:s}=e,{blockHash:a}=t??{};K(this,p,"f").call(this,"Transaction confirmed",s);const r=K(this,y,"f")?.id===s;if(K(this,n,"m",I).call(this,e),r)return void this.hub.emit("transaction-confirmed",e);const o=(0,Y.cloneDeep)(e);if(t&&a){const{baseFeePerGas:e,timestamp:s}=await K(this,n,"m",H).call(this,a,!1);o.baseFeePerGas=e,o.blockTimestamp=s,o.txParams={...o.txParams,gasUsed:t.gasUsed},o.txReceipt=t,o.verifiedOnBlockchain=!0}o.status=Z.TransactionStatus.confirmed,K(this,n,"m",B).call(this,o,"PendingTransactionTracker:#onTransactionConfirmed - Transaction confirmed"),this.hub.emit("transaction-confirmed",o)},A=async function(e,t){const{chainId:s,hash:a,id:r,submittedTime:i,txParams:{nonce:c}}=e;if(!a||!c)return!1;if(!K(this,o,"f").call(this,e))return K(this,p,"f").call(this,"Timeout disabled for transaction",e),!1;const l=(0,ee.getTimeoutAttempts)(s,K(this,g,"f"));if(l===undefined||0===l)return K(this,p,"f").call(this,"Timeout disabled due to threshold",{chainId:s,threshold:l}),!1;const d=parseInt(c,16);if(d>t)return K(this,p,"f").call(this,"Skipping timeout as queued transaction",{transactionNonce:d,nextNonce:t}),!1;try{if(null!==await K(this,n,"m",G).call(this,a)){const e=Date.now();return K(this,p,"f").call(this,"Transaction found on network, recording timestamp",r),K(this,h,"f").set(a,e),!1}const t=K(this,h,"f").get(a)??i;if(t===undefined)return K(this,p,"f").call(this,"Transaction not yet seen on network and has no submitted time, skipping timeout check",r),!1;const{blockTime:o}=(0,ee.getAcceleratedPollingParams)(s,K(this,g,"f")),c=Date.now()-t,d=o*l;return K(this,p,"f").call(this,"Checking timeout duration",{transactionId:r,durationSinceLastSeen:c,timeoutDuration:d,threshold:l,blockTime:o}),c<d?!1:(K(this,p,"f").call(this,"Hit timeout duration threshold",r),K(this,h,"f").delete(a),K(this,n,"m",N).call(this,e,new Error("Transaction not found on network after timeout")),!0)}catch(e){return K(this,p,"f").call(this,"Failed to check transaction by hash",r,e),!1}},F=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 o=K(this,r,"f").get(s);return o===undefined&&(o=0,K(this,r,"f").set(s,o)),o<3?(K(this,p,"f").call(this,"Incrementing dropped block count",{id:n,droppedBlockCount:o}),K(this,r,"f").set(s,o+1),!1):(K(this,p,"f").call(this,"Hit dropped block count",n),K(this,r,"f").delete(s),!0)},M=function(e){const{id:t,txParams:s}=e;return K(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)},D=function(){return K(this,n,"m",W).call(this).filter(e=>e.status===Z.TransactionStatus.submitted&&!e.verifiedOnBlockchain&&!e.isUserOperation&&!e.isStateOnly)},O=function(e,t,s){K(this,n,"m",B).call(this,{...e,warning:{error:t,message:s}},"PendingTransactionTracker:#warnTransaction - Warning added")},N=function(e,t){K(this,p,"f").call(this,"Transaction failed",e.id,t),K(this,n,"m",I).call(this,e),this.hub.emit("transaction-failed",e,t)},L=function(e){K(this,p,"f").call(this,"Transaction dropped",e.id),K(this,n,"m",I).call(this,e),this.hub.emit("transaction-dropped",e)},B=function(e,t){this.hub.emit("transaction-updated",e,t)},R=async function(e){return await(0,z.query)(K(this,c,"f").call(this),"getTransactionReceipt",[e])},G=async function(e){return await(0,z.query)(K(this,c,"f").call(this),"getTransactionByHash",[e])},H=async function(e,t){return await(0,z.query)(K(this,c,"f").call(this),"getBlockByHash",[e,t])},U=async function(e){return await(0,z.query)(K(this,c,"f").call(this),"getTransactionCount",[e])},q=function(){const e=K(this,i,"f").call(this);return K(this,m,"f").call(this).filter(t=>t.chainId===e)},W=function(){const e=K(this,d,"f").call(this);return K(this,m,"f").call(this).filter(t=>t.networkClientId===e)}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,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"),y=(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 x(e,t){return!T(e?.difference??"0x0",t?.difference??"0x0",!1===e?.isDecrease,!1===t?.isDecrease)}function T(e,t,n,a){let r=new p.BN((0,f.remove0x)(e),"hex"),o=new p.BN((0,f.remove0x)(t),"hex");return n&&(r=r.neg()),a&&(o=o.neg()),(0,w.getPercentageChange)(r,o)<=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),o.set(this,void 0),u(this,r,e,"f"),u(this,o,t,"f"),s(h(this,n,"m",i).bind(this))}},a=new WeakMap,r=new WeakMap,o=new WeakMap,n=new WeakSet,i=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",d).call(this,t)})},c=function(e){const{id:t}=e;if(h(this,a,"f").has(t))return;const r=()=>{h(this,o,"f").call(this,e).catch(e=>{y("Error during transaction resimulation",e)}).finally(()=>{h(this,a,"f").has(t)&&h(this,n,"m",l).call(this,t,r)})};h(this,n,"m",l).call(this,t,r),y(`Started resimulating transaction ${t} every ${s.RESIMULATE_INTERVAL_MS} milliseconds`)},l=function(e,t){const n=setTimeout(t,s.RESIMULATE_INTERVAL_MS);h(this,a,"f").set(e,n)},d=function(e){h(this,a,"f").has(e)&&(h(this,n,"m",m).call(this,e),y(`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 o=Object.keys(a).filter(e=>a[e]!==r[e]);return y("Transaction parameters updated",{transactionId:n,updatedProperties:o,originalParams:r,newParams:a}),s.RESIMULATE_PARAMS.some(e=>o.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 y("Security alert updated",{transactionId:a,originalSecurityAlertResponse:n,newSecurityAlertResponse:r}),r?.result_type===s.BLOCKAID_RESULT_TYPE_MALICIOUS}(e,t),o=function(e,t){const{simulationData:s}=e,{simulationData:n,txParams:a}=t;if(!n||(0,g.isEqual)(s,n))return!1;return!T(a?.value??"0x0",n?.nativeBalanceChange?.difference??"0x0",!1,!1===n?.nativeBalanceChange?.isDecrease)}(e,t),i=a||r||o;let c;if(r||o){c=Math.floor(Date.now()/1e3)+s.BLOCK_TIME_ADDITIONAL_SECONDS}return i&&y("Transaction should be resimulated",{transactionId:n,blockTime:c,parametersUpdated:a,securityAlert:r,valueAndNativeBalanceMismatch:o}),{blockTime:c,resimulate:i}},s.hasSimulationDataChanged=function(e,t){if((0,g.isEqual)(e,t))return!1;if(x(e?.nativeBalanceChange,t?.nativeBalanceChange))return y("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 y("Missing new token balance",{address:s.address,id:s.id}),!0;if(x(s,e))return y("Simulation data token balance changed",{originalTokenBalanceChange:s,newTokenBalanceChange:e}),!0}return!1}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,m,u,h,f,p,g,k,b,w,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)};Object.defineProperty(s,"__esModule",{value:!0}),s.TransactionPoller=void 0;const T=e("@metamask/utils"),_=e("lodash"),v=e("../logger.cjs"),E=e("../utils/feature-flags.cjs"),S=(0,T.createModuleLogger)(v.projectLogger,"transaction-poller");var j;!function(e){e.Accelerated="Accelerated",e.BlockTracker="BlockTracker",e.Websocket="Websocket"}(j||(j={}));s.TransactionPoller=class{constructor({blockTracker:e,chainId:t,messenger:s}){n.add(this),a.set(this,0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.set(this,void 0),m.set(this,!1),u.set(this,void 0),k.set(this,e=>{if(!x(this,m,"f"))return;if("confirmed"!==e.status&&"dropped"!==e.status&&"failed"!==e.status)return;const t=x(this,d,"f")?.some(t=>t.hash?.toLowerCase()===e.id.toLowerCase());t&&x(this,n,"m",f).call(this,j.Websocket).catch(()=>{})}),y(this,r,e,"f"),y(this,o,t,"f"),y(this,i,s,"f")}start(e){x(this,m,"f")||(y(this,l,e,"f"),y(this,m,!0,"f"),x(this,n,"m",b).call(this),x(this,n,"m",h).call(this),S("Started"))}stop(){x(this,m,"f")&&(y(this,m,!1,"f"),y(this,l,undefined,"f"),y(this,a,0,"f"),y(this,d,undefined,"f"),x(this,n,"m",p).call(this),x(this,n,"m",g).call(this),x(this,n,"m",w).call(this),S("Stopped"))}setPendingTransactions(e){const t=(x(this,d,"f")??[]).map(e=>e.id);y(this,d,e,"f");const s=e.map(e=>e.id),r=!(0,_.isEqual)(t,s);x(this,m,"f")&&r&&(S("Detected new pending transactions",s),y(this,a,0,"f"),x(this,c,"f")&&(x(this,n,"m",g).call(this),x(this,n,"m",h).call(this)))}},a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,u=new WeakMap,k=new WeakMap,n=new WeakSet,h=function e(){if(!x(this,m,"f"))return;const{countMax:t,intervalMs:s}=(0,E.getAcceleratedPollingParams)(x(this,o,"f"),x(this,i,"f"));if(x(this,a,"f")>=t)return y(this,c,e=>x(this,n,"m",f).call(this,j.BlockTracker,e),"f"),x(this,r,"f").on("latest",x(this,c,"f")),void S("Added block tracker listener");x(this,n,"m",p).call(this),y(this,u,setTimeout(async()=>{await x(this,n,"m",f).call(this,j.Accelerated),x(this,n,"m",e).call(this)},s),"f")},f=async function(e,t){switch(e){case j.Websocket:S("AccountActivityService:transactionUpdated received");break;case j.Accelerated:S("Accelerated interval",x(this,a,"f")+1);break;case j.BlockTracker:S("Block tracker interval",t)}const s=t??await x(this,r,"f").getLatestBlock();await(x(this,l,"f")?.call(this,s)),e===j.Accelerated&&x(this,m,"f")&&y(this,a,x(this,a,"f")+1,"f")},p=function(){x(this,u,"f")&&(clearTimeout(x(this,u,"f")),y(this,u,undefined,"f"))},g=function(){x(this,c,"f")&&(x(this,r,"f").removeListener("latest",x(this,c,"f")),y(this,c,undefined,"f"))},b=function(){x(this,i,"f").subscribe("AccountActivityService:transactionUpdated",x(this,k,"f"))},w=function(){x(this,i,"f").unsubscribe("AccountActivityService:transactionUpdated",x(this,k,"f"))}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,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},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.CollectPublishHook=void 0;const d=e("@metamask/utils"),m=e("lodash"),u=e("../logger.cjs"),h=(0,d.createModuleLogger)(u.projectLogger,"collect-publish-hook");s.CollectPublishHook=class{constructor(e){n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),c(this,o,(0,d.createDeferredPromise)(),"f"),c(this,a,[],"f"),c(this,r,e,"f")}getHook(){return l(this,n,"m",i).bind(this)}ready(){return l(this,o,"f").promise}success(e){if(h("Success",{transactionHashes:e}),e.length!==l(this,r,"f"))throw new Error("Transaction hash count mismatch");for(let t=0;t<l(this,a,"f").length;t++){const s=l(this,a,"f")[t],n=e[t];s.promise.resolve({transactionHash:n})}}error(e){h("Error",{error:e});for(const t of l(this,a,"f"))t.promise.reject(e)}},a=new WeakMap,r=new WeakMap,o=new WeakMap,n=new WeakSet,i=function(e,t){const s=e.txParams.nonce??"0x0",n=parseInt(s,16);h("Processing transaction",{nonce:n,signedTx:t,transactionMeta:e});const i=(0,d.createDeferredPromise)();if(l(this,a,"f").push({nonce:n,promise:i,signedTransaction:t}),c(this,a,(0,m.sortBy)(l(this,a,"f"),e=>e.nonce),"f"),l(this,a,"f").length===l(this,r,"f")){h("All transactions signed");const e=l(this,a,"f").map(e=>e.signedTransaction);l(this,o,"f").resolve({signedTransactions:e})}return i.promise}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,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},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.ExtraTransactionsPublishHook=void 0;const d=e("@metamask/utils"),m=e("../logger.cjs"),u=(0,d.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),o.set(this,void 0),c(this,a,e,"f"),c(this,r,t,"f"),c(this,o,s,"f")}getHook(){return l(this,n,"m",i).bind(this)}},a=new WeakMap,r=new WeakMap,o=new WeakMap,n=new WeakSet,i=async function(e,t){u("Publishing transaction as batch",{transactionMeta:e,signedTx:t});const{batchTransactions:s,batchTransactionsOptions:n,id:i,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,y=t,x=(0,d.createDeferredPromise)(),T={existingTransaction:{id:i,onPublish:({newSignature:e,transactionHash:t})=>{if(e){const t=l(this,r,"f").call(this,i);return u("Calling original publish hook with new signature",{latestTransactionMeta:t,newSignature:e}),void l(this,o,"f").call(this,t,e).then(x.resolve).catch(x.reject)}x.resolve({transactionHash:t})},signedTransaction:y},params:{data:p,gas:k,maxFeePerGas:b,maxPriorityFeePerGas:w,to:f,value:g}},_=(s??[]).map(e=>{const{isAfter:t,type:s,...n}=e;return{isAfter:t,params:n,type:s}}),v=[..._.filter(e=>!1===e.isAfter).map(({isAfter:e,...t})=>({...t})),T,..._.filter(e=>e.isAfter===undefined||e.isAfter).map(({isAfter:e,...t})=>({...t}))];u("Adding transaction batch",{from:h,networkClientId:c,transactions:v});const E=n??{disable7702:!0,disableHook:!1,disableSequential:!0};return await l(this,a,"f").call(this,{from:h,networkClientId:c,requireApproval:!1,transactions:v,...E}),x.promise}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,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:l}){n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,{}),f(this,a,e,"f"),f(this,r,t,"f"),f(this,o,l,"f"),f(this,i,s,"f")}getHook(){return p(this,n,"m",l).bind(this)}},a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,n=new WeakSet,l=async function({from:e,networkClientId:t,transactions:s}){w("Starting sequential publish batch hook",{from:e,networkClientId:t});const c=p(this,i,"f").call(this,t),l=[];for(const e of s)try{const s=p(this,r,"f").call(this,String(e.id)),i=await p(this,a,"f").call(this,p(this,o,"f").call(this,t),s);w("Transaction published",{transactionHash:i});const m={...s,hash:i},u=p(this,n,"m",d).call(this,c,m.id,m.hash);c.addTransactionToPoll(m),await u,l.push({transactionHash:i})}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:l}),c.stop(),{results:l}},d=async function(e,t,s){return new Promise((a,r)=>{const o=p(this,n,"m",m).bind(this,t,s,a,e),i=p(this,n,"m",u).bind(this,t,s,r,e);p(this,c,"f")[t]={onConfirmed:o,onFailedOrDropped:i},e.hub.on("transaction-confirmed",o),e.hub.on("transaction-failed",i),e.hub.on("transaction-dropped",i)})},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,o){r.id===e&&(w("Transaction failed or dropped",{transactionHash:t,error:o}),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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/index.cjs",{"./TransactionController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","./helpers/AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","./utils/transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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 o=e("./utils/gas-flow.cjs");Object.defineProperty(s,"mergeGasFeeEstimates",{enumerable:!0,get:function(){return o.mergeGasFeeEstimates}});var i=e("./utils/utils.cjs");Object.defineProperty(s,"isEIP1559Transaction",{enumerable:!0,get:function(){return i.isEIP1559Transaction}}),Object.defineProperty(s,"normalizeTransactionParams",{enumerable:!0,get:function(){return i.normalizeTransactionParams}});var c=e("./constants.cjs");Object.defineProperty(s,"CHAIN_IDS",{enumerable:!0,get:function(){return c.CHAIN_IDS}});var l=e("./helpers/AccountsApiRemoteTransactionSource.cjs");Object.defineProperty(s,"INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS",{enumerable:!0,get:function(){return l.SUPPORTED_CHAIN_IDS}});var d=e("./utils/prepare.cjs");Object.defineProperty(s,"HARDFORK",{enumerable:!0,get:function(){return d.HARDFORK}})}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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,o,i,c,l,d,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.moneyAccountDeposit="moneyAccountDeposit",e.moneyAccountWithdraw="moneyAccountWithdraw",e.musdClaim="musdClaim",e.musdConversion="musdConversion",e.perpsAcrossDeposit="perpsAcrossDeposit",e.perpsDeposit="perpsDeposit",e.perpsDepositAndOrder="perpsDepositAndOrder",e.perpsRelayDeposit="perpsRelayDeposit",e.perpsWithdraw="perpsWithdraw",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"}(o||(s.TransactionContainerType=o={})),function(e){e.legacy="0x0",e.accessList="0x1",e.feeMarket="0x2",e.setCode="0x4"}(i||(s.TransactionEnvelopeType=i={})),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"}(l||(s.GasFeeEstimateLevel=l={})),function(e){e.FeeMarket="fee-market",e.Legacy="legacy",e.GasPrice="eth_gasPrice"}(d||(s.GasFeeEstimateType=d={})),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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs",{"../api/simulation-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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"),o=e("@metamask/metamask-eth-abis"),i=e("@metamask/utils"),c=n(e("bn.js")),l=e("./balance.cjs"),d=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,i.createModuleLogger)(h.projectLogger,"balance-changes"),k=["Transfer","TransferSingle","TransferBatch","Deposit","Withdrawal"],b={[p.ERC20]:{abi:o.abiERC20,standard:f.SimulationTokenStandard.erc20},[p.ERC721]:{abi:o.abiERC721,standard:f.SimulationTokenStandard.erc721},[p.ERC1155]:{abi:o.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 y(e){if(Array.isArray(e))return e.map(y);let t=e;return t=t.toHexString?.()??t,t=t.toLowerCase?.()??t,t}function x(e){return"Transfer"===e.name&&e.tokenStandard===f.SimulationTokenStandard.erc721&&0===parseInt(e.args.from,16)}function T(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 _(e){switch(e){case f.SimulationTokenStandard.erc721:return new a.Interface(o.abiERC721);case f.SimulationTokenStandard.erc1155:return new a.Interface(o.abiERC1155);default:return new a.Interface(o.abiERC20)}}function v(e,t,s){const n=_(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 E(e,t,s){const n=_(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 S(e){return[...e.logs??[],...(e.calls??[]).map(e=>S(e)).flat()]}function j(e){if(!e)return[];return[...e.error?[e.error]:[],...(e.calls??[]).flatMap(e=>j(e))]}function I(e,t,s=0){const n=(0,r.hexToBN)(t).add(new c.default(s)),a=(0,r.hexToBN)(e),o=n.sub(a),i=o.isNeg(),l=(0,r.toHex)(o.abs());return o.isZero()?(g("Balance change is zero"),undefined):{previousBalance:e,newBalance:(0,r.toHex)(n),difference:l,isDecrease:i}}async function P({request:e,params:t,before:s=[],after:n=[]}){const{blockTime:a,chainId:o,ethQuery:i,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"),o=(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(o)}(e),w=(0,r.toHex)(b);g("Required balance",w);const{balanceRaw:y}=await(0,l.getNativeBalance)(f,i),x=(0,r.toHex)(y),T=(0,r.hexToBN)(x);g("Current balance",x);const _=T.lt(b);return await(0,d.simulateTransactions)(o,{...t,getSimulationConfig:m,transactions:k,withGas:!0,withDefaultBlockOverrides:!0,...a&&{blockOverrides:{...t?.blockOverrides,time:(0,r.toHex)(a)}},..._&&{overrides:{...t?.overrides,[f]:{...t?.overrides?.[f],balance:w}}}})}s.getBalanceChanges=async function(e){let t;g("Request",e);try{const s=await P({request:e,params:{withCallTrace:!0,withLogs:!0}}),n=s.transactions?.[0];t=j(n?.callTrace);const r=n?.error;if(r)throw new u.SimulationError(r);const o=function(e,t){const s=t.transactions[0];if(!s)return undefined;const{txParams:n}=e,a=n.from,{stateDiff:r}=s,o=r?.pre?.[a]?.balance,i=r?.post?.[a]?.balance;if(!o||!i)return undefined;return I(o,i,s.gasCost)}(e,s),i=function(e){const t=S(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=y(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",i);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,o=t.filter(e=>[e.args.from,e.args.to].includes(r));g("Filtered user events",o);for(const e of o){const t=T(e);g("Extracted token IDs",t);for(const o of t){const t={address:e.contractAddress,standard:e.tokenStandard,id:o},i=JSON.stringify(t);if(s.has(i)){g("Ignoring additional event with same contract and token ID",t);continue}s.add(i);const c=E(e.tokenStandard,r,o),l={from:r,to:e.contractAddress,data:c};x(e)||n.set(t,l),a.set(t,l)}}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 o=await P({request:e,before:[...a.before.values()],after:[...a.after.values()]});if(g("Balance simulation response",o),o.transactions.length!==r)throw new u.SimulationInvalidResponseError;let i=0;return[...a.after.keys()].map((e,t)=>{const s=I(!a.before.get(e)?"0x0":v(n,e,o.transactions[i++]),v(n,e,o.transactions[t+a.before.size+1]));return s?{...e,...s}:undefined}).filter(e=>e!==undefined)}(e,i),l=n?.gasUsed;return{simulationData:{callTraceErrors:t,nativeBalanceChange:o,tokenBalanceChanges:c},gasUsed:l}}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/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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/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.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:o}=await r(s,t);return n.isLessThanOrEqualTo(o)}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs",{"../gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","../helpers/GasFeePoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs","../hooks/CollectPublishHook.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs","../hooks/SequentialPublishBatchHook.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs","../index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/index.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs","./feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas.cjs","./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/validation.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",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.isAtomicBatchSupported=s.addTransactionBatch=s.ERROR_MESSAGE_NO_UPGRADE_CONTRACT=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/rpc-errors"),r=e("@metamask/utils"),o=e("uuid"),i=e("./eip7702.cjs"),c=e("./feature-flags.cjs"),l=e("./gas.cjs"),d=e("./validation.cjs"),m=e("../index.cjs"),u=e("../gas-flows/DefaultGasFeeFlow.cjs"),h=e("../helpers/GasFeePoller.cjs"),f=e("../hooks/CollectPublishHook.cjs"),p=e("../hooks/SequentialPublishBatchHook.cjs"),g=e("../logger.cjs"),k=e("../types.cjs"),b=(0,r.createModuleLogger)(g.projectLogger,"batch");function w(){const e=(0,o.v4)(),t=new Uint8Array((0,o.parse)(e));return(0,r.bytesToHex)(t)}async function y(e,t,s,a,r,o){const{assetsFiatValues:i,existingTransaction:c,params:l,type:d}=t,{addTransaction:u,getTransaction:f,request:p,updateTransaction:g}=a,{from:k,networkClientId:w,origin:y}=p;if(c){const{id:t,onPublish:r}=c;let i=f(t);const d=i.txParams.nonce;let{signedTransaction:m}=c;const u=d?parseInt(d,16):undefined,h=o>0&&u!==undefined?u+o:undefined;if(g({transactionId:t},t=>{t.batchId=e,h&&(t.txParams.nonce=(0,n.toHex)(h))}),h){const e=await x({transactionId:t,request:a});m=e.newSignature,i=e.transactionMeta}return s(i,m).then(r).catch(()=>{}),b("Processed existing transaction with hook",{id:t,params:l}),{id:t,params:l}}const T={...r,txParams:{...l,from:k,gas:r?.gas??l.gas}};r&&(0,h.updateTransactionGasEstimates)({txMeta:T,userFeeLevel:m.GasFeeEstimateLevel.Medium});const{transactionMeta:_}=await u(T.txParams,{assetsFiatValues:i,batchId:e,disableGasBuffer:!0,networkClientId:w,origin:y,publishHook:s,requireApproval:!1,type:d}),{id:v,txParams:E}=_,S={data:E.data,gas:E.gas,maxFeePerGas:E.maxFeePerGas,maxPriorityFeePerGas:E.maxPriorityFeePerGas,to:E.to,value:E.value};return b("Processed new transaction with hook",{id:v,params:S,type:d}),{id:v,params:S,type:d}}async function x({request:e,transactionId:t}){const{getTransaction:s,signTransaction:n}=e,a=s(t);b("Re-signing existing transaction",{transactionId:t,txParams:a.txParams});const r=await n(a);if(!r)throw new Error("Failed to re-sign transaction");const o=s(t);return b("New signature",r),{newSignature:r,transactionMeta:o}}s.ERROR_MESSAGE_NO_UPGRADE_CONTRACT="Upgrade contract address not found",s.addTransactionBatch=async function(e){const{getInternalAccounts:t,messenger:r,request:o}=e,h=(0,c.getBatchSizeLimit)(r);if((0,d.validateBatchRequest)({internalAccounts:t(),request:o,sizeLimit:h}),b("Adding",o),!o.disable7702)try{return await async function(e){const{addTransaction:t,getChainId:n,messenger:r,publicKeyEIP7702:o,request:l}=e,{batchId:d,disableUpgrade:u,from:h,gasFeeToken:f,gasLimit7702:p,networkClientId:g,origin:y,overwriteUpgrade:T,requestId:_,requiredAssets:v,requireApproval:E,securityAlertId:S,skipInitialGasEstimate:j,transactions:I,validateSecurity:P}=l,C=n(g),A=e.getEthQuery(g),F=(0,i.doesChainSupportEIP7702)(C,r);if(!F)throw b("Chain does not support EIP-7702",C),a.rpcErrors.internal("Chain does not support EIP-7702");if(!o)throw a.rpcErrors.internal(i.ERROR_MESSGE_PUBLIC_KEY);let M=!1;if(!u){const{delegationAddress:e,isSupported:t}=await(0,i.isAccountUpgradedToEIP7702)(h,C,o,r,A);if(b("Account",{delegationAddress:e,isSupported:t}),!t&&e&&!T)throw b("Account upgraded to unsupported contract",h,e),a.rpcErrors.internal("Account upgraded to unsupported contract");M=!t,M&&e&&b("Overwriting authorization as already upgraded",{current:e})}const D=await Promise.all(I.map(e=>async function(e,t,s){const{from:n}=e,{params:a,type:r}=t;if(r)return{...a,type:r};const{type:o}=await(0,m.determineTransactionType)({from:n,...a},s);return{...a,type:o}}(l,e,A))),O={...(0,i.generateEIP7702BatchTransaction)(h,D),from:h,gas:p,maxFeePerGas:D[0]?.maxFeePerGas,maxPriorityFeePerGas:D[0]?.maxPriorityFeePerGas};if(M){const e=(0,c.getEIP7702UpgradeContractAddress)(C,r,o);if(!e)throw a.rpcErrors.internal(s.ERROR_MESSAGE_NO_UPGRADE_CONTRACT);O.type=k.TransactionEnvelopeType.setCode,O.authorizationList=[{address:e}]}if(P){const e={method:"eth_sendTransaction",params:[{...O,authorizationList:undefined,type:k.TransactionEnvelopeType.feeMarket}],delegationMock:O.authorizationList?.[0]?.address,origin:y};b("Security request",e),P(e,C).catch(e=>{b("Security validation failed",e)})}b("Adding batch transaction",O,g);const N=d??w(),L=S?{securityAlertId:S}:undefined,B=I.find(e=>e.existingTransaction)?.existingTransaction;if(B)return await async function({batchId:e,existingTransaction:t,nestedTransactions:s,request:n,txParams:a}){const{getTransaction:r,estimateGas:o,updateTransaction:i}=n,c=r(t.id);if(!c)throw new Error("Existing transaction not found");b("Converting existing transaction to 7702",{batchId:e,txParams:a});const{networkClientId:l}=c,d=await o(a,l);b("Estimated gas for converted EIP-7702 transaction",d),i({transactionId:c.id},t=>{var n;t.batchId=e,t.nestedTransactions=s,t.txParams=a,t.txParams.gas=d.gas,t.txParams.gasLimit=d.gas,t.txParams.maxFeePerGas=c.txParams.maxFeePerGas,t.txParams.maxPriorityFeePerGas=c.txParams.maxPriorityFeePerGas,t.txParams.nonce=c.txParams.nonce,(n=t.txParams).type??(n.type=k.TransactionEnvelopeType.feeMarket)});const{newSignature:m}=await x({request:n,transactionId:c.id});t.onPublish?.({transactionHash:undefined,newSignature:m}),b("Transaction updated to EIP-7702",{batchId:e,txParams:a,newSignature:m})}({batchId:N,existingTransaction:B,nestedTransactions:D,request:e,txParams:O}),{batchId:N};const{result:R}=await t(O,{batchId:N,gasFeeToken:f,isGasFeeIncluded:l.isGasFeeIncluded,isGasFeeSponsored:l.isGasFeeSponsored,nestedTransactions:D,networkClientId:g,origin:y,requestId:_,requireApproval:E,requiredAssets:v,securityAlertResponse:L,skipInitialGasEstimate:j,type:k.TransactionType.batch}),G=await R;return b("Batch transaction added",{batchId:N,transactionHash:G}),{batchId:N}}(e)}catch(e){if(!(e instanceof a.JsonRpcError&&"Chain does not support EIP-7702"===e.message))throw e}return await async function(e){const{messenger:t,publishBatchHook:s,request:r,update:o}=e,{batchId:i,from:c,networkClientId:d,origin:h,requireApproval:g,transactions:k}=r;let x,T=!1;b("Adding transaction batch using hook",r);const _=new p.SequentialPublishBatchHook({publishTransaction:e.publishTransaction,getTransaction:e.getTransaction,getEthQuery:e.getEthQuery,getPendingTransactionTracker:e.getPendingTransactionTracker});let{disable7702:v,disableSequential:E}=r;const{disableHook:S,useHook:j}=r;j&&(v=!0,E=!0);let I,P=null;!S&&s?P=s:E||(P=_.getHook(),T=!0);if(!P)throw b("No supported batch methods found",{disable7702:v,disableHook:S,disableSequential:E}),a.rpcErrors.internal("Can't process batch");const C=i??w(),A=k.map(e=>({...e,origin:h})),F=A.length,M=new f.CollectPublishHook(F);try{g&&(I=await async function({batchId:e,request:t}){const{messenger:s,request:n,isSimulationEnabled:a,getChainId:r,getEthQuery:o,getGasFeeEstimates:i,getSimulationConfig:c,update:d}=t,{from:h,origin:f,networkClientId:p,transactions:g}=n,k=o(p);if(!a())throw new Error("Cannot create transaction batch as simulation not supported");b("Preparing approval data for batch");const w=r(p),{totalGasLimit:y}=await(0,l.simulateGasBatch)({chainId:w,from:h,getSimulationConfig:c,transactions:g}),x=(E={chainId:w,from:h,gas:y,id:e,networkClientId:p,origin:f,transactions:g},{...E,status:m.TransactionStatus.unapproved}),T=new u.DefaultGasFeeFlow,_=await i({networkClientId:p}),v=await T.getGasFees({ethQuery:k,gasFeeControllerData:_,messenger:s,transactionMeta:{...x,txParams:{from:h,gas:y},time:Date.now()}});var E;return x.gasFeeEstimates=v.estimates,b("Saving transaction batch metadata",x),function(e,t){t(t=>{t.transactionBatches=[...t.transactionBatches,e]})}(x,d),x}({batchId:C,request:e}),x=(await async function(e,t){const s=String(e.id),{origin:a}=e,r=n.ApprovalType.TransactionBatch,o={txBatchId:s};return b("Requesting approval for transaction batch",s),await t.call("ApprovalController:addRequest",{id:s,origin:a??n.ORIGIN_METAMASK,requestData:o,expectsResult:!0,type:r},!0)}(I,t)).resultCallbacks);const s=M.getHook(),a=[];let r=0;for(const t of A){const n=await y(C,t,s,e,I,r);a.push(n),r+=1}const{signedTransactions:o}=await M.ready(),i={from:c,networkClientId:d,transactions:a.map((e,t)=>({...e,signedTx:o[t]}))};b("Calling publish batch hook",i);let h=await P(i);if(b("Publish batch hook result",h),!h&&!T&&!E){b("Fallback to sequential publish batch hook due to empty results");const e=_.getHook();h=await e(i)}if(!h?.results?.length)throw new Error("Publish batch hook did not return a result");const f=h.results.map(({transactionHash:e})=>e);return M.success(f),x?.success(),b("Completed batch transaction with hook",f),{batchId:C}}catch(e){throw b("Publish batch hook failed",e),M.error(e),x?.error(e),e}finally{b("Cleaning up publish batch hook",C),function(e,t){e(e=>{e.transactionBatches=e.transactionBatches.filter(e=>e.id!==t)})}(o,C)}}(e)},s.isAtomicBatchSupported=async function(e){const{address:t,chainIds:s,getEthQuery:n,messenger:r,publicKeyEIP7702:o}=e;if(!o)throw a.rpcErrors.internal(i.ERROR_MESSGE_PUBLIC_KEY);const l=(0,c.getEIP7702SupportedChains)(r).filter(e=>!s||s.includes(e)),d=(await Promise.all(l.map(async e=>{try{const s=n(e),{isSupported:a,delegationAddress:l}=await(0,i.isAccountUpgradedToEIP7702)(t,e,o,r,s);return{chainId:e,delegationAddress:l,isSupported:a,upgradeContractAddress:(0,c.getEIP7702UpgradeContractAddress)(e,r,o)}}catch(t){return b("Error checking atomic batch support",e,t),undefined}}))).filter(e=>Boolean(e));return b("Atomic batch supported results",d),d}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","./feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","@ethersproject/abi":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/abi/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@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.signAuthorizationList=s.generateEIP7702BatchTransaction=s.isAccountUpgradedToEIP7702=s.getDelegationAddress=s.doesChainSupportEIP7702=s.ERROR_MESSGE_PUBLIC_KEY=s.CALLS_SIGNATURE=s.BATCH_FUNCTION_NAME=s.DELEGATION_PREFIX=void 0;const n=e("@ethersproject/abi"),a=e("@ethersproject/contracts"),r=e("@metamask/controller-utils"),o=e("@metamask/utils"),i=e("./feature-flags.cjs"),c=e("../constants.cjs"),l=e("../logger.cjs");s.DELEGATION_PREFIX="0xef0100",s.BATCH_FUNCTION_NAME="execute",s.CALLS_SIGNATURE="(address,uint256,bytes)[]",s.ERROR_MESSGE_PUBLIC_KEY="EIP-7702 public key not specified";const d=(0,o.createModuleLogger)(l.projectLogger,"eip-7702");async function m(e,t){const n=await(0,r.query)(t,"eth_getCode",[e]),a=(0,o.add0x)(n?.toLowerCase?.()??"");return 48===n?.length&&a.startsWith(s.DELEGATION_PREFIX)?(0,o.add0x)(a.slice(s.DELEGATION_PREFIX.length)):undefined}async function u(e,t,s,n){const a=function(e,t,s){const{chainId:n,nonce:a}=e,{txParams:o,chainId:i}=t,{nonce:c}=o,l=n??i;let m=a;m??(m=(0,r.toHex)(parseInt(c,16)+1+s));const u={...e,chainId:l,nonce:m};return d("Prepared authorization",u),u}(e,t,n),{txParams:i}=t,{from:c}=i,{address:l,chainId:m,nonce:u}=a,h=parseInt(m,16),f=parseInt(u,16),p=await s.call("KeyringController:signEip7702Authorization",{chainId:h,contractAddress:l,from:c,nonce:f}),g=p.slice(0,66),k=(0,o.add0x)(p.slice(66,130)),b=parseInt(p.slice(130,132),16),w={address:l,chainId:m,nonce:u,r:g,s:k,yParity:(0,r.toHex)(b-27==0?0:1)};return d("Signed authorization",w),w}s.doesChainSupportEIP7702=function(e,t){return(0,i.getEIP7702SupportedChains)(t).some(t=>t.toLowerCase()===e.toLowerCase())},s.getDelegationAddress=m,s.isAccountUpgradedToEIP7702=async function(e,t,s,n,a){const r=(0,i.getEIP7702ContractAddresses)(t,n,s),o=await m(e,a),c=Boolean(o&&r.some(e=>e.toLowerCase()===o.toLowerCase()));return{delegationAddress:o,isSupported:c}},s.generateEIP7702BatchTransaction=function(e,t){const r=a.Contract.getInterface(c.ABI_IERC7821),o=t.map(e=>{const{data:t,to:s,value:n}=e;return[s??"0x0000000000000000000000000000000000000000",n??"0x0",t??"0x"]}),i="0x01".padEnd(66,"0"),l=n.defaultAbiCoder.encode([s.CALLS_SIGNATURE],[o]),m=r.encodeFunctionData(s.BATCH_FUNCTION_NAME,[i,l]);return d("Transaction data",m),{data:m,to:e}},s.signAuthorizationList=async function({authorizationList:e,messenger:t,transactionMeta:s}){if(!e)return undefined;const n=[];let a=0;for(const r of e){const e=await u(r,s,t,a);n.push(e),a+=1}return n}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/external-transactions.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.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.validateConfirmedExternalTransaction=void 0;const n=e("@metamask/rpc-errors"),a=e("../types.cjs");s.validateConfirmedExternalTransaction=function(e,t,s){if(!e?.txParams)throw n.rpcErrors.invalidParams('"transactionMeta" or "transactionMeta.txParams" is missing');if(e.status!==a.TransactionStatus.confirmed)throw n.rpcErrors.invalidParams('External transaction status should be "confirmed"');const r=e.txParams.nonce;if(s&&s.length>0){if(s.find(e=>e.txParams?.nonce===r))throw n.rpcErrors.invalidParams("External transaction nonce should not be in pending txs")}if(t&&t.length>0){if(t.find(e=>e.txParams?.nonce===r))throw n.rpcErrors.invalidParams("External transaction nonce should not be in confirmed txs")}}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/external-transactions.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","./signature.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/signature.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isIncomingTransactionsUseBackendWebSocketServiceEnabled=s.getTimeoutAttempts=s.getIncomingTransactionsPollingInterval=s.getGasEstimateBuffer=s.getGasEstimateFallback=s.getGasFeeRandomisation=s.getAcceleratedPollingParams=s.getTransactionHistoryLimit=s.getSubmitHistoryLimit=s.getBatchSizeLimit=s.getEIP7702UpgradeContractAddress=s.getEIP7702ContractAddresses=s.getEIP7702SupportedChains=s.FeatureFlag=void 0;const n=e("@metamask/utils"),a=e("./signature.cjs"),r=e("./utils.cjs"),o=e("../logger.cjs");var i;!function(e){e.EIP7702="confirmations_eip_7702",e.GasBuffer="confirmations_gas_buffer",e.IncomingTransactions="confirmations_incoming_transactions",e.Transactions="confirmations_transactions"}(i||(s.FeatureFlag=i={}));const c=(0,n.createModuleLogger)(o.projectLogger,"feature-flags");function l(e,t,s){const n=d(t);return(n?.[i.EIP7702]?.contracts?.[e.toLowerCase()]??[]).filter(t=>(0,a.isValidSignature)([t.address,(0,r.padHexToEvenLength)(e)],t.signature,s)).map(e=>e.address)}function d(e){const t=e.call("RemoteFeatureFlagController:getState").remoteFeatureFlags;return c("Retrieved feature flags",t),t}s.getEIP7702SupportedChains=function(e){const t=d(e);return t?.[i.EIP7702]?.supportedChains??[]},s.getEIP7702ContractAddresses=l,s.getEIP7702UpgradeContractAddress=function(e,t,s){return l(e,t,s)?.[0]},s.getBatchSizeLimit=function(e){const t=d(e);return t?.[i.Transactions]?.batchSizeLimit??10},s.getSubmitHistoryLimit=function(e){const t=d(e);return t?.[i.Transactions]?.submitHistoryLimit??100},s.getTransactionHistoryLimit=function(e){const t=d(e);return t?.[i.Transactions]?.transactionHistoryLimit??40},s.getAcceleratedPollingParams=function(e,t){const s=d(t),n=s?.[i.Transactions]?.acceleratedPolling,a=n?.perChainConfig?.[e]?.countMax??n?.defaultCountMax??10,r=n?.perChainConfig?.[e]?.intervalMs??n?.defaultIntervalMs??3e3;return{blockTime:n?.perChainConfig?.[e]?.blockTime??12e3,countMax:a,intervalMs:r}},s.getGasFeeRandomisation=function(e){const t=d(e),s=t?.[i.Transactions]?.gasFeeRandomisation??{};return{randomisedGasFeeDigits:s.randomisedGasFeeDigits??{},preservedNumberOfDigits:s.preservedNumberOfDigits}},s.getGasEstimateFallback=function(e,t){const s=d(t),n=s?.[i.Transactions]?.gasEstimateFallback,a=n?.perChainConfig?.[e],r=a?.percentage??n?.default?.percentage??35;return{fixed:a?.fixed??n?.default?.fixed,percentage:r}},s.getGasEstimateBuffer=function({chainId:e,isCustomRPC:t,isUpgradeWithDataToSelf:s,messenger:n}){const a=d(n),r=a?.[i.GasBuffer],o=r?.perChainConfig?.[e],c=t?undefined:o?.included,l=t?undefined:r?.included;return(s?o?.eip7702:undefined)??c??o?.base??l??r?.default??1},s.getIncomingTransactionsPollingInterval=function(e){const t=d(e);return t?.[i.IncomingTransactions]?.pollingIntervalMs??24e4},s.getTimeoutAttempts=function(e,t){const s=d(t),n=s?.[i.Transactions]?.timeoutAttempts;return n?.perChainConfig?.[e]??n?.default},s.isIncomingTransactionsUseBackendWebSocketServiceEnabled=function(e){const t=d(e);return t?.[i.IncomingTransactions]?.useBackendWebSocketService??!1}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/first-time-interaction.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/validation.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.updateFirstTimeInteraction=void 0;const n=e("@metamask/utils"),a=e("./transaction-type.cjs"),r=e("./validation.cjs"),o=e("../api/accounts-api.cjs"),i=e("../logger.cjs"),c=e("../types.cjs"),l=[c.TransactionType.tokenMethodTransfer,c.TransactionType.tokenMethodTransferFrom];function d(e){const{data:t,to:s}=e?.txParams??{};if(t&&l.includes(e?.type)){const e=(0,a.decodeTransactionData)(t);return e?.args?._to??e?.args?.to??s}return s}s.updateFirstTimeInteraction=async function({existingTransactions:e,getTransaction:t,isFirstTimeInteractionEnabled:s,trace:a,traceContext:c,transactionMeta:l,updateTransaction:m}){if(!s())return;const{chainId:u,id:h,txParams:{from:f}}=l,p=d(l),g={chainId:(0,n.hexToNumber)(u),to:p,from:f};(0,r.validateParamTo)(p);const k=p?.toLowerCase();if(!e.find(e=>e.id!==h&&e.chainId===u&&e.txParams?.from?.toLowerCase()===f?.toLowerCase()&&d(e)?.toLowerCase()===k))try{const{count:e}=await a({name:"Account Address Relationship",parentContext:c},()=>(0,o.getAccountAddressRelationship)(g)),s=e===undefined?undefined:0===e;if(!t(h))return void(0,i.projectLogger)("Cannot update first time interaction as transaction not found",h);m({transactionId:h,note:"TransactionController#updateFirstInteraction - Update first time interaction"},e=>{e.isFirstTimeInteraction=s}),(0,i.projectLogger)("Updated first time interaction",h,{isFirstTimeInteraction:s})}catch(e){(0,i.projectLogger)("Error fetching account address relationship, skipping first time interaction update",e)}}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/first-time-interaction.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-fee-tokens.cjs",{"../api/simulation-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","./balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/balance.cjs","./batch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs","./eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs","./feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.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){Object.defineProperty(s,"__esModule",{value:!0}),s.checkGasFeeTokenBeforePublish=s.getGasFeeTokens=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/utils"),r=e("./balance.cjs"),o=e("./batch.cjs"),i=e("./eip7702.cjs"),c=e("./feature-flags.cjs"),l=e("../api/simulation-api.cjs"),d=e("../logger.cjs"),m=(0,a.createModuleLogger)(d.projectLogger,"gas-fee-tokens");s.getGasFeeTokens=async function({chainId:e,isEIP7702GasFeeTokensEnabled:t,messenger:s,publicKeyEIP7702:a,transactionMeta:r,getSimulationConfig:d}){const{delegationAddress:u,txParams:h}=r,{authorizationList:f}=h,p=h.data,g=h.from,k=h.to,b=h.value;m("Request",{chainId:e,txParams:h});const w=await t(r)&&(0,i.doesChainSupportEIP7702)(e,s);let y=f?.map(e=>({address:e.address,from:g}));!w||u||y||(y=function({chainId:e,from:t,messenger:s,publicKeyEIP7702:a}){if(!a)throw n.rpcErrors.internal(i.ERROR_MESSGE_PUBLIC_KEY);const r=(0,c.getEIP7702UpgradeContractAddress)(e,s,a);if(!r)throw n.rpcErrors.internal(o.ERROR_MESSAGE_NO_UPGRADE_CONTRACT);return[{address:r,from:t}]}({chainId:e,from:g,messenger:s,publicKeyEIP7702:a}));try{const t=await(0,l.simulateTransactions)(e,{getSimulationConfig:d,transactions:[{authorizationList:y,data:p,from:g,to:k,value:b}],suggestFees:{withTransfer:!0,withFeeTransfer:!0,with7702:w}});m("Response",t);const s=function(e){const t=e.transactions?.[0]?.fees?.[0],s=e.sponsorship?.isSponsored??!1;return{gasFeeTokens:(t?.tokenFees??[]).map(e=>({amount:e.balanceNeededToken,balance:e.currentBalanceToken,decimals:e.token.decimals,fee:e.serviceFee,gas:t.gas,gasTransfer:e.transferEstimate,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas,rateWei:e.rateWei,recipient:e.feeRecipient,symbol:e.token.symbol,tokenAddress:e.token.address})),isGasFeeSponsored:s}}(t);return m("Gas fee tokens",s),s}catch(e){return m("Failed to gas fee tokens",e),{gasFeeTokens:[],isGasFeeSponsored:!1}}},s.checkGasFeeTokenBeforePublish=async function({ethQuery:e,fetchGasFeeTokens:t,transaction:s,updateTransaction:n}){const{isGasFeeTokenIgnoredIfBalance:a,selectedGasFeeToken:o}=s;if(!o||!a)return;if(m("Checking gas fee token before publish",{selectedGasFeeToken:o}),await(0,r.isNativeBalanceSufficientForGas)(s,e))return m("Ignoring gas fee token before publish due to sufficient native balance"),void n(s.id,e=>{e.isExternalSign=!1,e.selectedGasFeeToken=undefined});const i=await t({...s,isExternalSign:!0});if(n(s.id,e=>{e.gasFeeTokens=i,e.isExternalSign=!0,e.txParams.nonce=undefined}),m("Updated gas fee tokens before publish",i),!i?.some(e=>e.tokenAddress.toLowerCase()===o.toLowerCase()))throw new Error("Gas fee token not found and insufficient native balance");m("Publishing with selected gas fee token",{selectedGasFeeToken:o})}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-fee-tokens.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/swaps.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.gweiDecimalToWeiDecimal=s.gweiDecimalToWeiHex=s.updateGasFees=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils"),r=e("./gas-flow.cjs"),o=e("./swaps.cjs"),i=e("../logger.cjs"),c=e("../types.cjs"),l=(0,a.createModuleLogger)(i.projectLogger,"gas-fees");function d(e){return(0,n.toHex)((0,n.gweiDecToWEIBN)(e))}s.updateGasFees=async function(e){const{txMeta:t}=e,s={...t.txParams},i=o.SWAP_TRANSACTION_TYPES.includes(t.type)?undefined:e.getSavedGasFees(t.chainId),m=await async function(e){const{eip1559:t,ethQuery:s,gasFeeFlows:o,getGasFeeEstimates:i,messenger:d,txMeta:m}=e,{networkClientId:u}=m;if(!t&&m.txParams.gasPrice||t&&m.txParams.maxFeePerGas&&m.txParams.maxPriorityFeePerGas)return{};const h=(0,r.getGasFeeFlow)(m,o,d);try{const e=await i({networkClientId:u}),t=await h.getGasFees({ethQuery:s,gasFeeControllerData:e,messenger:d,transactionMeta:m}),n=t.estimates?.type;switch(n){case c.GasFeeEstimateType.FeeMarket:return t.estimates.medium;case c.GasFeeEstimateType.Legacy:return{gasPrice:t.estimates.medium};case c.GasFeeEstimateType.GasPrice:return{gasPrice:t.estimates.gasPrice};default:throw new Error(`Unsupported gas fee estimate type returned from flow: ${n}`)}}catch(e){l("Failed to get suggested gas fees",e)}const f=await(0,n.query)(s,"gasPrice");return{gasPrice:f?(0,a.add0x)(f.toString(16)):undefined}}(e);l("Suggested gas fees",m);const u={...e,initialParams:s,savedGasFees:i,suggestedGasFees:m};t.txParams.maxFeePerGas=function(e){const{savedGasFees:t,eip1559:s,initialParams:n,suggestedGasFees:a}=e;if(!s)return undefined;if(t){const e=d(t.maxBaseFee);return l("Using maxFeePerGas from savedGasFees",e),e}if(n.maxFeePerGas)return l("Using maxFeePerGas from request",n.maxFeePerGas),n.maxFeePerGas;if(n.gasPrice&&!n.maxPriorityFeePerGas)return l("Setting maxFeePerGas to gasPrice from request",n.gasPrice),n.gasPrice;if(a.maxFeePerGas)return l("Using suggested maxFeePerGas",a.maxFeePerGas),a.maxFeePerGas;if(a.gasPrice)return l("Setting maxFeePerGas to suggested gasPrice",a.gasPrice),a.gasPrice;return l("maxFeePerGas not set"),undefined}(u),t.txParams.maxPriorityFeePerGas=function(e){const{eip1559:t,initialParams:s,savedGasFees:n,suggestedGasFees:a,txMeta:r}=e;if(!t)return undefined;if(n){const e=d(n.priorityFee);return l("Using maxPriorityFeePerGas from savedGasFees.priorityFee",e),e}if(s.maxPriorityFeePerGas)return l("Using maxPriorityFeePerGas from request",s.maxPriorityFeePerGas),s.maxPriorityFeePerGas;if(s.gasPrice&&!s.maxFeePerGas)return l("Setting maxPriorityFeePerGas to gasPrice from request",s.gasPrice),s.gasPrice;if(a.maxPriorityFeePerGas)return l("Using suggested maxPriorityFeePerGas",a.maxPriorityFeePerGas),a.maxPriorityFeePerGas;if(r.txParams.maxFeePerGas)return l("Setting maxPriorityFeePerGas to maxFeePerGas",r.txParams.maxFeePerGas),r.txParams.maxFeePerGas;return l("maxPriorityFeePerGas not set"),undefined}(u),t.txParams.gasPrice=function(e){const{eip1559:t,initialParams:s,suggestedGasFees:n}=e;if(t)return undefined;if(s.gasPrice)return l("Using gasPrice from request",s.gasPrice),s.gasPrice;if(n.maxFeePerGas)return l("Using suggested maxFeePerGas",n.maxFeePerGas),n.maxFeePerGas;if(n.gasPrice)return l("Using suggested gasPrice",n.gasPrice),n.gasPrice;return l("gasPrice not set"),undefined}(u),t.userFeeLevel=function(e){const{initialParams:t,savedGasFees:s,suggestedGasFees:a,txMeta:r}=e;if(s)return c.UserFeeLevel.CUSTOM;if(!t.maxFeePerGas&&!t.maxPriorityFeePerGas&&t.gasPrice)return r.origin===n.ORIGIN_METAMASK?c.UserFeeLevel.CUSTOM:c.UserFeeLevel.DAPP_SUGGESTED;if(!t.maxFeePerGas&&!t.maxPriorityFeePerGas&&a.maxFeePerGas&&a.maxPriorityFeePerGas)return c.UserFeeLevel.MEDIUM;if(!t.maxFeePerGas&&!t.maxPriorityFeePerGas&&a.gasPrice)return c.UserFeeLevel.MEDIUM;if(r.origin===n.ORIGIN_METAMASK)return c.UserFeeLevel.MEDIUM;return c.UserFeeLevel.DAPP_SUGGESTED}(u),l("Updated gas fee properties",{maxFeePerGas:t.txParams.maxFeePerGas,maxPriorityFeePerGas:t.txParams.maxPriorityFeePerGas,gasPrice:t.txParams.gasPrice}),(t.txParams.maxFeePerGas||t.txParams.maxPriorityFeePerGas)&&delete t.txParams.gasPrice,t.txParams.gasPrice&&(delete t.txParams.maxFeePerGas,delete t.txParams.maxPriorityFeePerGas),function(e){e.defaultGasEstimates??(e.defaultGasEstimates={}),e.defaultGasEstimates.maxFeePerGas=e.txParams.maxFeePerGas,e.defaultGasEstimates.maxPriorityFeePerGas=e.txParams.maxPriorityFeePerGas,e.defaultGasEstimates.gasPrice=e.txParams.gasPrice,e.defaultGasEstimates.estimateType=e.userFeeLevel}(t)},s.gweiDecimalToWeiHex=d,s.gweiDecimalToWeiDecimal=function(e){return(1e9*Number(e)).toString().split(".")[0]}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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){Object.defineProperty(s,"__esModule",{value:!0}),s.mergeGasFeeEstimates=s.getGasFeeFlow=void 0;const n=e("@metamask/controller-utils"),a=e("../types.cjs");function r(e,t){return(0,n.weiHexToGweiDec)(e[t])}s.getGasFeeFlow=function(e,t,s){return t.find(t=>t.matchesTransaction({transactionMeta:e,messenger:s}))},s.mergeGasFeeEstimates=function({gasFeeControllerEstimates:e,transactionGasFeeEstimates:t}){const s=t.type;return s===a.GasFeeEstimateType.FeeMarket?Object.values(a.GasFeeEstimateLevel).reduce((s,a)=>{return{...s,[a]:(r=e?.[a],o=t[a],{...r,suggestedMaxFeePerGas:(0,n.weiHexToGweiDec)(o.maxFeePerGas),suggestedMaxPriorityFeePerGas:(0,n.weiHexToGweiDec)(o.maxPriorityFeePerGas)})};var r,o},{...e}):s===a.GasFeeEstimateType.Legacy?Object.values(a.GasFeeEstimateLevel).reduce((e,s)=>({...e,[s]:r(t,s)}),{}):s===a.GasFeeEstimateType.GasPrice?{gasPrice:(o=t,(0,n.weiHexToGweiDec)(o.gasPrice))}:e;var o}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas.cjs",{"../api/simulation-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs","./feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.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","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.simulateGasBatch=s.addGasBuffer=s.estimateGasBatch=s.estimateGas=s.updateGas=s.DUMMY_AUTHORIZATION_SIGNATURE=s.INTRINSIC_GAS=s.MAX_GAS_BLOCK_PERCENT=s.DEFAULT_GAS_MULTIPLIER=s.FIXED_GAS=s.log=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils"),r=e("bignumber.js"),o=e("./eip7702.cjs"),i=e("./feature-flags.cjs"),c=e("../api/simulation-api.cjs"),l=e("../logger.cjs"),d=e("../types.cjs");async function m({chainId:e,ethQuery:t,ignoreDelegationSignatures:r,isSimulationEnabled:o,getSimulationConfig:c,messenger:l,txParams:m}){const u={...m},{authorizationList:h,data:g,from:k,value:b,to:w}=u;if(r&&!o)throw new Error("Gas estimation with ignored delegation signatures is not supported as simulation disabled");const{gasLimit:y,number:x}=await async function(e){return await(0,n.query)(e,"getBlockByNumber",["latest",!1])}(t),T=(0,n.hexToBN)(y),{percentage:_,fixed:v}=(0,i.getGasEstimateFallback)(e,l),E=v?(0,n.toHex)(v):(0,n.BNToHex)((0,n.fractionBN)(T,_,100));(0,s.log)("Estimation fallback values",E),u.data=g?(0,a.add0x)(g):g,u.value=b??"0x0",u.authorizationList=function(e,t){return e?.map(e=>({...e,chainId:e.chainId??t,nonce:e.nonce??"0x1",r:e.r??s.DUMMY_AUTHORIZATION_SIGNATURE,s:e.s??s.DUMMY_AUTHORIZATION_SIGNATURE,yParity:e.yParity??"0x1"}))}(u.authorizationList,e),delete u.gasPrice,delete u.maxFeePerGas,delete u.maxPriorityFeePerGas;let S,j=E;const I=m.type===d.TransactionEnvelopeType.setCode&&Boolean(h?.length)&&Boolean(g)&&"0x"!==g&&k?.toLowerCase()===w?.toLowerCase();try{j=o&&I?await async function(e,t,a,r){const o=await(0,n.query)(t,"estimateGas",[{...e,data:"0x"}]);(0,s.log)("Upgrade only gas",o);const i=e.authorizationList?.[0].address;let c;try{c=await f({chainId:a,delegationAddress:i,getSimulationConfig:r,transaction:e})}catch(e){(0,s.log)("Error while simulating data portion of upgrade",e)}if(c===undefined){try{c=await p(t,{...e,authorizationList:undefined,type:undefined},i)}catch(e){throw(0,s.log)("Error while estimating data portion of upgrade",e),e}(0,s.log)("Success estimating data portion of upgrade",c)}(0,s.log)("Execute gas",c);const l=(0,n.BNToHex)((0,n.hexToBN)(o).add((0,n.hexToBN)(c)).subn(s.INTRINSIC_GAS));return(0,s.log)("Total type 4 gas",l),l}(u,t,e,c):r&&o?await f({chainId:e,getSimulationConfig:c,transaction:u}):await p(t,u)}catch(e){S={reason:e.message,errorKey:e.errorKey,debug:{blockNumber:x,blockGasLimit:y}},(0,s.log)("Estimation failed",{...S,fallback:E})}return{blockGasLimit:y,estimatedGas:j,isUpgradeWithDataToSelf:I,simulationFails:S}}function u(e,t,r){const o=(0,n.hexToBN)(e),i=(0,n.fractionBN)((0,n.hexToBN)(t),s.MAX_GAS_BLOCK_PERCENT,100),c=(0,n.fractionBN)(o,100*r,100);if(o.gt(i)){const t=(0,a.add0x)(e);return(0,s.log)("Using estimated value",t),t}if(c.lt(i)){const e=(0,a.add0x)((0,n.BNToHex)(c));return(0,s.log)("Using padded estimate",e,r),e}const l=(0,a.add0x)((0,n.BNToHex)(i));return(0,s.log)("Using 90% of block gas limit",l),l}async function h({chainId:e,from:t,getSimulationConfig:a,transactions:r}){try{const s=await(0,c.simulateTransactions)(e,{getSimulationConfig:a,transactions:r.map(e=>({...e.params,from:t}))});if(s?.transactions?.length!==r.length)throw new Error("Simulation response does not match transaction count");return s.transactions.reduce((e,t)=>{const s=t?.gasLimit;if(!s)throw new Error("No simulated gas returned for one of the transactions");return e.gasLimits.push(s),e.totalGasLimit=(0,n.BNToHex)((0,n.hexToBN)(e.totalGasLimit).add((0,n.hexToBN)(s))),e},{totalGasLimit:"0x0",gasLimits:[]})}catch(e){throw(0,s.log)("Error while simulating gas batch",e),new Error("Cannot estimate transaction batch total gas as simulation failed")}}async function f({chainId:e,delegationAddress:t,getSimulationConfig:s,transaction:n}){const r=await(0,c.simulateTransactions)(e,{getSimulationConfig:s,transactions:[{to:n.to,from:n.from,data:n.data,value:n.value}],overrides:{[n.from]:{code:t&&o.DELEGATION_PREFIX+(0,a.remove0x)(t)}}}),i=r?.transactions?.[0].gasLimit;if(!i)throw new Error("No simulated gas returned");return i}function p(e,t,s){const{from:r}=t,i=[t];return s&&(i.push("latest"),i.push({[r]:{code:o.DELEGATION_PREFIX+(0,a.remove0x)(s)}})),(0,n.query)(e,"estimateGas",i)}s.log=(0,a.createModuleLogger)(l.projectLogger,"gas"),s.FIXED_GAS="0x5208",s.DEFAULT_GAS_MULTIPLIER=1.5,s.MAX_GAS_BLOCK_PERCENT=90,s.INTRINSIC_GAS=21e3,s.DUMMY_AUTHORIZATION_SIGNATURE="0x1111111111111111111111111111111111111111111111111111111111111111",s.updateGas=async function(e){const{txMeta:t}=e,a={...t.txParams},[r,o,c]=await async function(e){const{chainId:t,isCustomNetwork:a,isSimulationEnabled:r,getSimulationConfig:o,messenger:c,txMeta:l}=e,{disableGasBuffer:h}=l;if(l.txParams.gas)return(0,s.log)("Using value from request",l.txParams.gas),[l.txParams.gas,undefined,l.txParams.gas];if(await async function({ethQuery:e,txMeta:t,isCustomNetwork:s}){const{txParams:{to:a,data:r,type:o}}=t;if(s||!a||r||o===d.TransactionEnvelopeType.setCode)return!1;const i=await async function(e,t){return await(0,n.query)(e,"getCode",[t])}(e,a);return!i||"0x"===i}(e))return(0,s.log)("Using fixed value",s.FIXED_GAS),[s.FIXED_GAS,undefined,s.FIXED_GAS];const{blockGasLimit:f,estimatedGas:p,isUpgradeWithDataToSelf:g,simulationFails:k}=await m({chainId:t,ethQuery:e.ethQuery,isSimulationEnabled:r,getSimulationConfig:o,messenger:c,txParams:l.txParams});(0,s.log)("Original estimated gas",p),k&&(0,s.log)("Using original fallback estimate as simulation failed");h&&(0,s.log)("Gas buffer disabled");if(k||h)return[p,k,p];const b=(0,i.getGasEstimateBuffer)({chainId:t,isCustomRPC:a,isUpgradeWithDataToSelf:g,messenger:c});(0,s.log)("Buffer",b);const w=u(p,f,b);return(0,s.log)("Buffered gas",w),[w,k,p]}(e);t.txParams.gas=r,t.simulationFails=o,t.gasLimitNoBuffer=c,a.gas||(t.originalGasEstimate=t.txParams.gas),t.defaultGasEstimates??(t.defaultGasEstimates={}),t.defaultGasEstimates.gas=t.txParams.gas},s.estimateGas=m,s.estimateGasBatch=async function({chainId:e,ethQuery:t,from:n,getSimulationConfig:a,isAtomicBatchSupported:i,messenger:c,transactions:l}){const u=(await i({address:n,chainIds:[e]})).find(t=>t.chainId===e),f=Boolean(u&&!u.isSupported);if(f&&!u?.upgradeContractAddress)throw new Error("Upgrade contract address not found");if(u){const i=f?[{address:u.upgradeContractAddress}]:undefined,h=f?d.TransactionEnvelopeType.setCode:undefined,p={...(0,o.generateEIP7702BatchTransaction)(n,l),authorizationList:i,from:n,type:h},{estimatedGas:g}=await m({chainId:e,ethQuery:t,isSimulationEnabled:!0,getSimulationConfig:a,messenger:c,txParams:p}),k=new r.BigNumber(g).toNumber();return(0,s.log)("Estimated EIP-7702 gas limit",k),{totalGasLimit:k,gasLimits:[k]}}if(l.every(e=>e.gas!==undefined)){const e=l.map(e=>new r.BigNumber(e.gas).toNumber()),t=e.reduce((e,t)=>e+t,0);return(0,s.log)("Using batch parameter gas limits",{gasLimits:e,total:t}),{totalGasLimit:t,gasLimits:e}}const{gasLimits:p}=await h({chainId:e,from:n,getSimulationConfig:a,transactions:l.map(e=>({params:e}))}),g=l.map((e,t)=>e.gas?new r.BigNumber(e.gas).toNumber():new r.BigNumber(p[t]).toNumber()),k=g.reduce((e,t)=>e+t,0);return(0,s.log)("Simulated batch gas limits",{totalGasLimit:k,gasLimits:g}),{totalGasLimit:k,gasLimits:g}},s.addGasBuffer=u,s.simulateGasBatch=h}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/gas.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/layer1-gas-fee-flow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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.getTransactionLayer1GasFee=s.updateTransactionLayer1GasFee=void 0;const n=e("@metamask/utils"),a=e("../logger.cjs"),r=(0,n.createModuleLogger)(a.projectLogger,"layer-1-gas-fee-flow");async function o({layer1GasFeeFlows:e,messenger:t,provider:s,transactionMeta:n}){const a=await async function(e,t,s){for(const n of t)if(await n.matchesTransaction({transactionMeta:e,messenger:s}))return n;return undefined}(n,e,t);if(!a)return undefined;r("Found layer 1 gas fee flow",a.constructor.name,n.id);try{const{layer1Fee:e}=await a.getLayer1Fee({provider:s,transactionMeta:n});return e}catch(e){return r("Failed to get layer 1 gas fee",n.id,e),undefined}}s.updateTransactionLayer1GasFee=async function(e){const t=await o(e);if(!t)return;const{transactionMeta:s}=e;s.layer1GasFee=t,r("Updated layer 1 gas fee",t,s.id)},s.getTransactionLayer1GasFee=o}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/layer1-gas-fee-flow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/nonce.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getAndFormatTransactionsForNonceTracker=s.getNextNonce=void 0;const n=e("@metamask/controller-utils"),a=e("../logger.cjs"),r=(0,a.createModuleLogger)(a.projectLogger,"nonce");s.getNextNonce=async function(e,t){const{customNonceValue:s,isExternalSign:a,txParams:{from:o,nonce:i}}=e;if(a)return r("Skipping nonce as signed externally"),[undefined,undefined];const c=s?(0,n.toHex)(s):undefined;if(c)return r("Using custom nonce",c),[c,undefined];if(i)return r("Using existing nonce",i),[i,undefined];const l=await t(o),d=(0,n.toHex)(l.nextNonce),m=l.releaseLock.bind(l);return r("Using nonce from nonce tracker",d,l.nonceDetails),[d,m]},s.getAndFormatTransactionsForNonceTracker=function(e,t,s,n){return n.filter(({chainId:n,isTransfer:a,isUserOperation:r,status:o,txParams:{from:i,nonce:c}})=>!a&&!r&&n===e&&s.includes(o)&&i.toLowerCase()===t.toLowerCase()&&c).flatMap(({status:e,txParams:{authorizationList:t,from:s,gas:n,value:a,nonce:r}})=>[r,...(t??[]).map(e=>e.nonce).filter(e=>e!==undefined)].map(t=>({status:e,history:[{}],txParams:{from:s??"",gas:n??"",value:a??"",nonce:t??""}})))}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/nonce.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs",{"@ethereumjs/common":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/common/dist/cjs/index.js","@ethereumjs/tx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/tx/dist/cjs/index.js","@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.serializeTransaction=s.prepareTransaction=s.HARDFORK=void 0;const n=e("@ethereumjs/common"),a=e("@ethereumjs/tx"),r=e("@metamask/utils"),o=e("lodash");function i(e){const t={chainId:parseInt(e,16),defaultHardfork:s.HARDFORK};return n.Common.custom(t,{eips:[7702]})}function c(e){return e?"0x0"===e?"0x":e.replace?.(/^0x(00)+/u,"0x")??e:e}s.HARDFORK=n.Hardfork.Prague,s.prepareTransaction=function(e,t){const s=function(e){const t=(0,o.cloneDeep)(e);return function(e){if(!e)return;for(const t of e)t.nonce=c(t.nonce),t.r=c(t.r),t.s=c(t.s),t.yParity=c(t.yParity)}(t.authorizationList),t}(t);return a.TransactionFactory.fromTxData(s,{freeze:!1,common:i(e)})},s.serializeTransaction=function(e){return(0,r.bytesToHex)(e.serialize())}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/retry.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.getTransactionParamsWithIncreasedGasFee=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils");function r(e,t){const s=(0,n.convertHexToDecimal)(e),r=parseInt(""+s*t,10);return(0,a.add0x)(r.toString(16))}s.getTransactionParamsWithIncreasedGasFee=function(e,t,s){const n=function(e,t,s){if(s&&"gasPrice"in s)return s.gasPrice;const n=e.gasPrice;if(!n||"0x0"===n)return undefined;return r(n,t)}(e,t,s),a=function(e,t,s){if(s&&"maxFeePerGas"in s&&"maxPriorityFeePerGas"in s)return s;const n=e.maxFeePerGas,a=e.maxPriorityFeePerGas;if(!n||!a||"0x0"===n||"0x0"===a)return undefined;const o=r(n,t),i=r(a,t);return{maxFeePerGas:o,maxPriorityFeePerGas:i}}(e,t,s);if(a){const t={...e,...a};return delete t.gasPrice,t}if(n){const t={...e,gasPrice:n};return delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,t}throw new Error("Cannot increase gas fee as no current values and no new values were provided")}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/retry.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/signature.cjs",{"@ethersproject/wallet":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/wallet/lib/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.isValidSignature=void 0;const n=e("@ethersproject/wallet"),a=e("@metamask/utils");s.isValidSignature=function(e,t,s){try{const r=(0,a.add0x)(e.map(a.remove0x).join("")),o=(0,a.hexToBytes)(r);return(0,n.verifyMessage)(o,t).toLowerCase()===s.toLowerCase()}catch{return!1}}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/signature.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/swaps.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/constants.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-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.updatePostTransactionBalance=s.updateSwapsTransaction=s.SWAP_TRANSACTION_TYPES=s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=s.DEFAULT_TOKEN_ADDRESS=s.UPDATE_POST_TX_BALANCE_ATTEMPTS=s.UPDATE_POST_TX_BALANCE_TIMEOUT=void 0;const n=e("@metamask/controller-utils"),a=e("lodash"),r=e("./utils.cjs"),o=e("../constants.cjs"),i=e("../logger.cjs"),c=e("../types.cjs"),l=(0,i.createModuleLogger)(i.projectLogger,"swaps");s.UPDATE_POST_TX_BALANCE_TIMEOUT=5e3,s.UPDATE_POST_TX_BALANCE_ATTEMPTS=6;const d="0x539";s.DEFAULT_TOKEN_ADDRESS="0x0000000000000000000000000000000000000000";const m={name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},u={name:"Binance Coin",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},h={name:"Matic",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},f={name:"Avalanche",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},p={name:"Test Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},g={name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},k={...m},b={...m},w={...m},y={name:"Sei",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},x={name:"Mon",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18},T={name:"Hyperliquid",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18};function _(e,t){return!(!e||!t)&&e===s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[t]?.address}function v(e){return new Promise(t=>setTimeout(t,e))}s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP={[o.CHAIN_IDS.MAINNET]:m,[d]:p,[o.CHAIN_IDS.BSC]:u,[o.CHAIN_IDS.POLYGON]:h,[o.CHAIN_IDS.GOERLI]:g,[o.CHAIN_IDS.AVALANCHE]:f,[o.CHAIN_IDS.OPTIMISM]:b,[o.CHAIN_IDS.ARBITRUM]:k,[o.CHAIN_IDS.ZKSYNC_ERA]:w,[o.CHAIN_IDS.SEI]:y,[o.CHAIN_IDS.MONAD]:x,[o.CHAIN_IDS.HYPEREVM]:T},s.SWAP_TRANSACTION_TYPES=[c.TransactionType.swap,c.TransactionType.swapAndSend,c.TransactionType.swapApproval],s.updateSwapsTransaction=function(e,t,n,{isSwapsDisabled:o,cancelTransaction:i,messenger:l}){if(o||!s.SWAP_TRANSACTION_TYPES.includes(t))return e;if(t===c.TransactionType.swap&&!1===n?.hasApproveTx&&e.simulationFails)throw i(e.id),new Error("Simulation failed");const d=n?.meta;if(!d)return e;let m=e;return t===c.TransactionType.swapApproval&&(m=function(e,{type:t,sourceTokenSymbol:s}){(0,r.validateIfTransactionUnapproved)(e,"updateSwapApprovalTransaction");let n={type:t,sourceTokenSymbol:s};return n=(0,a.pickBy)({type:t,sourceTokenSymbol:s}),(0,a.merge)({},e,n)}(e,d),l.publish("TransactionController:transactionNewSwapApproval",{transactionMeta:m})),t===c.TransactionType.swapAndSend&&(m=function(e,{approvalTxId:t,destinationTokenAddress:s,destinationTokenAmount:n,destinationTokenDecimals:o,destinationTokenSymbol:i,estimatedBaseFee:c,sourceTokenAddress:l,sourceTokenAmount:d,sourceTokenDecimals:m,sourceTokenSymbol:u,swapAndSendRecipient:h,swapMetaData:f,swapTokenValue:p,type:g}){(0,r.validateIfTransactionUnapproved)(e,"updateSwapTransaction");let k={approvalTxId:t,destinationTokenAddress:s,destinationTokenAmount:n,destinationTokenDecimals:o,destinationTokenSymbol:i,estimatedBaseFee:c,sourceTokenAddress:l,sourceTokenAmount:d,sourceTokenDecimals:m,sourceTokenSymbol:u,swapAndSendRecipient:h,swapMetaData:f,swapTokenValue:p,type:g};return k=(0,a.pickBy)(k),(0,a.merge)({},e,k)}(e,d),l.publish("TransactionController:transactionNewSwapAndSend",{transactionMeta:m})),t===c.TransactionType.swap&&(m=function(e,{sourceTokenSymbol:t,destinationTokenSymbol:s,type:n,destinationTokenDecimals:o,destinationTokenAddress:i,swapMetaData:c,swapTokenValue:l,estimatedBaseFee:d,approvalTxId:m}){(0,r.validateIfTransactionUnapproved)(e,"updateSwapTransaction");let u={sourceTokenSymbol:t,destinationTokenSymbol:s,type:n,destinationTokenDecimals:o,destinationTokenAddress:i,swapMetaData:c,swapTokenValue:l,estimatedBaseFee:d,approvalTxId:m};return u=(0,a.pickBy)(u),(0,a.merge)({},e,u)}(e,d),l.publish("TransactionController:transactionNewSwap",{transactionMeta:m})),m},s.updatePostTransactionBalance=async function(e,{ethQuery:t,getTransaction:a,updateTransaction:r}){l("Updating post transaction balance",e.id);const o=e.id;let i,c;for(let r=0;r<s.UPDATE_POST_TX_BALANCE_ATTEMPTS;r++){l("Querying balance",{attempt:r});const d=await(0,n.query)(t,"getBalance",[e.txParams.from]);i={...a(o)??{}},c=i.approvalTxId?a(i.approvalTxId):undefined,i.postTxBalance=d.toString(16);const m=_(e.destinationTokenAddress,e.chainId);if(!m||e.preTxBalance!==i.postTxBalance){l("Finishing post balance update",{isDefaultTokenAddress:m,preTxBalance:e.preTxBalance,postTxBalance:i.postTxBalance});break}l("Waiting for balance to update",{delay:s.UPDATE_POST_TX_BALANCE_TIMEOUT}),await v(s.UPDATE_POST_TX_BALANCE_TIMEOUT)}return r(i,"TransactionController#updatePostTransactionBalance - Add post transaction balance"),l("Completed post balance update",i?.postTxBalance),{updatedTransactionMeta:i,approvalTransactionMeta:c}}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/eip7702.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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.decodeTransactionData=s.determineTransactionType=s.ESTIMATE_GAS_ERROR=void 0;const n=e("@ethersproject/abi"),a=e("@metamask/controller-utils"),r=e("@metamask/metamask-eth-abis"),o=e("./eip7702.cjs"),i=e("../types.cjs");s.ESTIMATE_GAS_ERROR="eth_estimateGas rpc method error";const c=new n.Interface(r.abiERC20),l=new n.Interface(r.abiERC721),d=new n.Interface(r.abiERC1155),m=new n.Interface(r.abiFiatTokenV2);function u(e,t){if(!e||e.length<10)return undefined;const s=e.substring(0,10).toLowerCase();for(const n of[c,l,d,m])try{return t?.getMethodName?n.getFunction(s)?.name:n.parseTransaction({data:e})}catch{}return undefined}s.determineTransactionType=async function(e,t){const{data:s,to:n}=e;if(s&&!n)return{type:i.TransactionType.deployContract,getCodeResponse:undefined};let r,c=Boolean(s?.length);if(t){const e=await async function(e,t){let s;try{s=await(0,a.query)(e,"getCode",[t])}catch(e){s=null}const n=!!s&&("0x"!==s&&"0x0"!==s&&!s.startsWith(o.DELEGATION_PREFIX));return{contractCode:s,isContractAddress:n}}(t,n);r=e.contractCode,c=e.isContractAddress}if(!c)return{type:i.TransactionType.simpleSend,getCodeResponse:r};const l=0!==Number(e.value??"0"),d={type:i.TransactionType.contractInteraction,getCodeResponse:r};if(!s||l)return d;const m=function(e){return u(e,{getMethodName:!0})}(s);if(!m)return d;const h=[i.TransactionType.tokenMethodApprove,i.TransactionType.tokenMethodSetApprovalForAll,i.TransactionType.tokenMethodTransfer,i.TransactionType.tokenMethodTransferFrom,i.TransactionType.tokenMethodSafeTransferFrom,i.TransactionType.tokenMethodIncreaseAllowance].find(e=>e.toLowerCase()===m.toLowerCase());return h?{type:h,getCodeResponse:r}:d},s.decodeTransactionData=u}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/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","@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.caip2ToHex=s.setEnvelopeType=s.getPercentageChange=s.toBN=s.bnFromHex=s.padHexToEvenLength=s.normalizeGasFeeValues=s.normalizeTxError=s.validateIfTransactionUnapprovedOrSubmitted=s.validateIfTransactionUnapproved=s.validateGasValues=s.isEIP1559Transaction=s.normalizeTransactionParams=s.ESTIMATE_GAS_ERROR=void 0;const a=e("@metamask/controller-utils"),r=e("@metamask/utils"),o=n(e("bn.js")),i=e("../types.cjs");s.ESTIMATE_GAS_ERROR="eth_estimateGas rpc method error";const c={accessList:e=>e,authorizationList:e=>e,data:e=>(0,r.add0x)(d(e)),from:e=>(0,r.add0x)(e).toLowerCase(),gas:e=>(0,r.add0x)(e),gasLimit:e=>(0,r.add0x)(e),gasPrice:e=>(0,r.add0x)(e),nonce:e=>(0,r.add0x)(e),to:e=>(0,r.add0x)(e).toLowerCase(),value:e=>(0,r.add0x)(e),maxFeePerGas:e=>(0,r.add0x)(e),maxPriorityFeePerGas:e=>(0,r.add0x)(e),estimatedBaseFee:e=>(0,r.add0x)(e),type:e=>(0,r.add0x)(e)};s.normalizeTransactionParams=function(e){const t={from:""};for(const s of(0,r.getKnownPropertyNames)(c))e[s]&&(t[s]=c[s](e[s]));return t.value??(t.value="0x0"),t.gasLimit&&!t.gas&&(t.gas=t.gasLimit),t},s.isEIP1559Transaction=function(e){const t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);return t(e,"maxFeePerGas")&&t(e,"maxPriorityFeePerGas")};function l(e){try{return JSON.parse(JSON.stringify(e)),!0}catch{return!1}}function d(e){const t=e.toLowerCase().startsWith("0x")?e.slice(0,2):"",s=t?e.slice(2):e;return t+(s.length%2==0?s:`0${s}`)}function m(e){const t=e,s=t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t;return 0===s.length?new o.default(0):new o.default(s,16)}s.validateGasValues=e=>{Object.keys(e).forEach(t=>{const s=e[t];if("string"!=typeof s||!(0,r.isStrictHexString)(s))throw new TypeError(`expected hex string for ${t} but received: ${s}`)})},s.validateIfTransactionUnapproved=function(e,t){if(e?.status!==i.TransactionStatus.unapproved)throw new Error(`TransactionsController: Can only call ${t} on an unapproved transaction.\n      Current tx status: ${e?.status}`)},s.validateIfTransactionUnapprovedOrSubmitted=function(e,t){const s=[i.TransactionStatus.unapproved,i.TransactionStatus.submitted];if(!e||!s.includes(e.status))throw new Error(`TransactionsController: Can only call ${t} on an unapproved or submitted transaction.\n      Current tx status: ${e?.status}`)},s.normalizeTxError=function(e){return{name:e.name,message:e.message,stack:e.stack,code:e.code,rpc:l(e.value)?e.value:undefined}},s.normalizeGasFeeValues=function(e){const t=e=>"string"==typeof e?(0,r.add0x)(e):e;return"gasPrice"in e?{gasPrice:t(e.gasPrice)}:{maxFeePerGas:t(e.maxFeePerGas),maxPriorityFeePerGas:t(e.maxPriorityFeePerGas)}},s.padHexToEvenLength=d,s.bnFromHex=m,s.toBN=function(e){if(e instanceof o.default)return e;if("function"==typeof o.default.isBN&&o.default.isBN(e))return e;if(null!==e&&"object"==typeof e&&"function"==typeof e.toHexString)return m(e.toHexString());if(null!==e&&"object"==typeof e&&"string"==typeof e._hex)return m(e._hex);if("string"==typeof e)return m(e);if("bigint"==typeof e)return new o.default(e.toString());if("number"==typeof e)return new o.default(e);throw new Error("Unexpected value returned from oracle contract")},s.getPercentageChange=function(e,t){const s=new o.default(10).pow(new o.default(18)),n=e.mul(s),a=t.mul(s),r=a.sub(n);return r.isZero()?0:n.isZero()&&!a.isZero()?100:r.muln(100).div(n).abs().toNumber()},s.setEnvelopeType=function(e,t){e.accessList?e.type=i.TransactionEnvelopeType.accessList:e.authorizationList?e.type=i.TransactionEnvelopeType.setCode:e.type=t?i.TransactionEnvelopeType.feeMarket:i.TransactionEnvelopeType.legacy},s.caip2ToHex=function(e){if(!(0,r.isCaipChainId)(e))return undefined;try{const{reference:t}=(0,r.parseCaipChainId)(e);return(0,a.toHex)(t)}catch{return undefined}}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/validation.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/utils.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/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){Object.defineProperty(s,"__esModule",{value:!0}),s.validateBatchRequest=s.validateParamTo=s.validateTxParams=s.validateTransactionOrigin=s.ErrorCode=void 0;const n=e("@ethersproject/abi"),a=e("@metamask/controller-utils"),r=e("@metamask/metamask-eth-abis"),o=e("@metamask/rpc-errors"),i=e("@metamask/utils"),c=e("./utils.cjs"),l=e("../types.cjs");var d;!function(e){e[e.DuplicateBundleId=5720]="DuplicateBundleId",e[e.BundleTooLarge=5740]="BundleTooLarge",e[e.RejectedUpgrade=5750]="RejectedUpgrade"}(d||(s.ErrorCode=d={}));const m=[l.TransactionEnvelopeType.feeMarket,l.TransactionEnvelopeType.setCode];function u(e,t){const s=e.type;switch(t){case"authorizationList":if(s&&s!==l.TransactionEnvelopeType.setCode)throw o.rpcErrors.invalidParams(`Invalid transaction envelope type: specified type "${s}" but including authorizationList requires type: "${l.TransactionEnvelopeType.setCode}"`);break;case"maxFeePerGas":case"maxPriorityFeePerGas":if(s&&!m.includes(s))throw o.rpcErrors.invalidParams(`Invalid transaction envelope type: specified type "${s}" but including maxFeePerGas and maxPriorityFeePerGas requires type: "${m.join(", ")}"`);break;default:if(s&&m.includes(s))throw o.rpcErrors.invalidParams(`Invalid transaction envelope type: specified type "${s}" but included a gasPrice instead of maxFeePerGas and maxPriorityFeePerGas`)}}function h(e,t,s){if(void 0!==e[s])throw o.rpcErrors.invalidParams(`Invalid transaction params: specified ${t} but also included ${s}, these cannot be mixed`)}function f(e,t){const s=e[t];if("string"!=typeof s||!(0,i.isStrictHexString)(s))throw o.rpcErrors.invalidParams(`Invalid transaction params: ${String(t)} is not a valid hexadecimal string. got: (${String(s)})`)}function p(e){f(e,"address"),function(e,t,s){const n=(0,i.remove0x)(e).length/2;if(n!==t)throw o.rpcErrors.invalidParams(`Invalid transaction params: ${s} must be ${t} bytes. got: ${n} bytes`)}(e.address,20,"address");for(const t of["chainId","nonce","r","s"])e[t]&&f(e,t);const{yParity:t}=e;if(t&&!["0x0","0x1"].includes(t))throw o.rpcErrors.invalidParams(`Invalid transaction params: yParity must be '0x0' or '0x1'. got: ${t}`)}s.validateTransactionOrigin=async function({data:e,from:t,internalAccounts:s,origin:n,permittedAddresses:r,txParams:i,type:c}){if(!n||n===a.ORIGIN_METAMASK)return;const{authorizationList:d,to:m,type:u}=i;if(r&&!r.includes(t))throw o.providerErrors.unauthorized({data:{origin:n}});if(c===l.TransactionType.batch)return;if(d||u===l.TransactionEnvelopeType.setCode)throw o.rpcErrors.invalidParams("External EIP-7702 transactions are not supported");if(Boolean(e&&"0x"!==e)&&s?.some(e=>e.toLowerCase()===m?.toLowerCase()))throw o.rpcErrors.invalidParams("External transactions to internal accounts cannot include data")},s.validateTxParams=function(e,t=!0,s){!function(e){if(e&&!Object.values(l.TransactionEnvelopeType).includes(e))throw o.rpcErrors.invalidParams(`Invalid transaction envelope type: "${e}". Must be one of: ${Object.values(l.TransactionEnvelopeType).join(", ")}`)}(e.type),function(e,t){if((0,c.isEIP1559Transaction)(e)&&!t)throw o.rpcErrors.invalidParams("Invalid transaction params: params specify an EIP-1559 transaction but the current network does not support EIP-1559")}(e,t),function(e){if(!e||"string"!=typeof e)throw o.rpcErrors.invalidParams(`Invalid "from" address ${e}: not a string.`);if(!(0,a.isValidHexAddress)(e))throw o.rpcErrors.invalidParams('Invalid "from" address.')}(e.from),function(e){if("0x"===e.to||e.to===undefined){if(!e.data)throw o.rpcErrors.invalidParams('Invalid "to" address.');delete e.to}else if(e.to!==undefined&&!(0,a.isValidHexAddress)(e.to))throw o.rpcErrors.invalidParams('Invalid "to" address.')}(e),function(e){if(e!==undefined){if(e.includes("-"))throw o.rpcErrors.invalidParams(`Invalid transaction value "${e}": not a positive number.`);if(e.includes("."))throw o.rpcErrors.invalidParams(`Invalid transaction value "${e}": number must be in wei.`);const t=parseInt(e,10);if(!(Number.isFinite(t)&&!Number.isNaN(t)&&!isNaN(Number(e))&&Number.isSafeInteger(t)))throw o.rpcErrors.invalidParams(`Invalid transaction value ${e}: number must be a valid number.`)}}(e.value),function(e){if(e){const t=new n.Interface(r.abiERC20);try{t.parseTransaction({data:e})}catch(e){if(e.message.match(/BUFFER_OVERRUN/u))throw o.rpcErrors.invalidParams("Invalid transaction params: data out-of-bounds, BUFFER_OVERRUN.")}}}(e.data),function(e,t){if(e&&t&&e.toLowerCase?.()!==t.toLowerCase())throw o.rpcErrors.invalidParams(`Invalid transaction params: chainId must match the network client, got: ${e}, expected: ${t}`)}(e.chainId,s),function(e){e.gasPrice&&(u(e,"gasPrice"),h(e,"gasPrice","maxFeePerGas"),h(e,"gasPrice","maxPriorityFeePerGas"),f(e,"gasPrice"));e.maxFeePerGas&&(u(e,"maxFeePerGas"),h(e,"maxFeePerGas","gasPrice"),f(e,"maxFeePerGas"));e.maxPriorityFeePerGas&&(u(e,"maxPriorityFeePerGas"),h(e,"maxPriorityFeePerGas","gasPrice"),f(e,"maxPriorityFeePerGas"));e.gasLimit&&f(e,"gasLimit");e.gas&&f(e,"gas")}(e),function(e){const{authorizationList:t}=e;if(!t)return;if(u(e,"authorizationList"),!Array.isArray(t))throw o.rpcErrors.invalidParams("Invalid transaction params: authorizationList must be an array");for(const e of t)p(e)}(e)},s.validateParamTo=function(e){if(!e||"string"!=typeof e)throw o.rpcErrors.invalidParams('Invalid "to" address')},s.validateBatchRequest=function({internalAccounts:e,request:t,sizeLimit:s}){const{origin:n}=t,r=n&&n!==a.ORIGIN_METAMASK,i=e.map(e=>e.toLowerCase());if(r&&t.transactions.some(e=>{const t=e.params.to?.toLowerCase(),s=e.params.data,n=i.includes(t),a=Boolean(s&&"0x"!==s);return n&&a}))throw o.rpcErrors.invalidParams("External calls to internal accounts cannot include data");if(r&&t.transactions.length>s)throw new o.JsonRpcError(d.BundleTooLarge,`Batch size cannot exceed ${s}. got: ${t.transactions.length}`)}}}},{package:"@metamask/bridge-status-controller>@metamask/transaction-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/transaction-controller/dist/utils/validation.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,o="[BigNumber Error] ",i=o+"Number primitive has more than 15 significant digits: ",c=1e14,l=14,d=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=l-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,o=e.s,i=t.s,c=e.e,l=t.e;if(!o||!i)return null;if(s=a&&!a[0],n=r&&!r[0],s||n)return s?n?0:-i:o;if(o!=i)return o;if(s=o<0,n=c==l,!a||!r)return n?0:!a^s?1:-1;if(!n)return c>l^s?1:-1;for(i=(c=a.length)<(l=r.length)?c:l,o=0;o<i;o++)if(a[o]!=r[o])return a[o]>r[o]^s?1:-1;return c==l?0:c>l^s?1:-1}function k(e,t,s,n){if(e<t||e>s||e!==r(e))throw Error(o+(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/l)==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 y(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,x,T,_,v,E,S,j,I,P,C=W.prototype={constructor:W,toString:null,valueOf:null},A=new W(1),F=20,M=4,D=-7,O=21,N=-1e7,L=1e7,B=!1,R=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,o,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<N?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 T(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 z(p=new W(e),F+p.e+1,M);if(f=String(e),u="number"==typeof e){if(0*e!=0)return T(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(i+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(!o&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){o=!0,m=-1,c=0;continue}return T(p,String(e),u,t)}u=!1,(c=(f=x(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>d||e!==r(e)))throw Error(i+p.s*e);if((c=c-m-1)>L)p.c=p.e=null;else if(c<N)p.c=[p.e=0];else{if(p.e=c,p.c=[],m=(c+1)%l,c<0&&(m+=l),m<h){for(m&&p.c.push(+f.slice(0,m)),h-=l;m<h;)p.c.push(+f.slice(m,m+=l));m=l-(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,o,i,c;if(null==s?s=M:k(s,0,8),!e.c)return e.toString();if(a=e.c[0],o=e.e,null==t)c=p(e.c),c=1==n||2==n&&(o<=D||o>=O)?w(c,o):y(c,o,"0");else if(r=(e=z(new W(e),t,s)).e,i=(c=p(e.c)).length,1==n||2==n&&(t<=r||r<=D)){for(;i<t;c+="0",i++);c=w(c,r)}else if(t-=o+(2===n&&r>o),c=y(c,r,"0"),r+1>i){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=r-i)>0)for(r+1==i&&(c+=".");t--;c+="0");return e.s<0&&a?"-"+c:c}function K(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 V(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*l-1)>L?e.c=e.e=null:s<N?e.c=[e.e=0]:(e.e=s,e.c=t),e}function z(e,t,s,n){var o,i,d,u,h,f,p,g=e.c,k=m;if(g){e:{for(o=1,u=g[0];u>=10;u/=10,o++);if((i=t-o)<0)i+=l,d=t,h=g[f=0],p=r(h/k[o-d-1]%10);else if((f=a((i+1)/l))>=g.length){if(!n)break e;for(;g.length<=f;g.push(0));h=p=0,o=1,d=(i%=l)-l+1}else{for(h=u=g[f],o=1;u>=10;u/=10,o++);p=(d=(i%=l)-l+o)<0?0:r(h/k[o-d-1]%10)}if(n=n||t<0||null!=g[f+1]||(d<0?h:h%k[o-d-1]),n=s<4?(p||n)&&(0==s||s==(e.s<0?3:2)):p>5||5==p&&(4==s||n||6==s&&(i>0?d>0?h/k[o-d]: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[(l-t%l)%l],e.e=-t||0):g[0]=e.e=0,e;if(0==i?(g.length=f,u=1,f--):(g.length=f+1,u=k[l-i],g[f]=d>0?r(h/k[o-d]%k[d])*u:0),n)for(;;){if(0==f){for(i=1,d=g[0];d>=10;d/=10,i++);for(d=g[0]+=u,u=1;d>=10;d/=10,u++);i!=u&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[f]+=u,g[f]!=c)break;g[f--]=0,u=1}for(i=g.length;0===g[--i];g.pop());}e.e>L?e.c=e.e=null:e.e<N&&(e.c=[e.e=0])}return e}function J(e){var t,s=e.e;return null===s?e.toString():(t=p(e.c),t=s<=D||s>=O?w(t,s):y(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(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(k(s=e[t],0,h,t),F=s),e.hasOwnProperty(t="ROUNDING_MODE")&&(k(s=e[t],0,8,t),M=s),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((s=e[t])&&s.pop?(k(s[0],-h,0,t),k(s[1],0,h,t),D=s[0],O=s[1]):(k(s,-h,h,t),D=-(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),N=s[0],L=s[1];else{if(k(s,-h,h,t),!s)throw Error(o+t+" cannot be zero: "+s);N=-(L=s<0?-s:s)}if(e.hasOwnProperty(t="CRYPTO")){if((s=e[t])!==!!s)throw Error(o+t+" not true or false: "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw B=!s,Error(o+"crypto unavailable");B=s}else B=s}if(e.hasOwnProperty(t="MODULO_MODE")&&(k(s=e[t],0,9,t),R=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(o+t+" not an object: "+s);H=s}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(s=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(s))throw Error(o+t+" invalid: "+s);q="0123456789"==s.slice(0,10),U=s}}return{DECIMAL_PLACES:F,ROUNDING_MODE:M,EXPONENTIAL_AT:[D,O],RANGE:[N,L],CRYPTO:B,MODULO_MODE:R,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,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&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)%l)<1&&(t+=l),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===i||1===i||-1===i))return!0;throw Error(o+"Invalid BigNumber: "+e)},W.maximum=W.max=function(){return K(arguments,-1)},W.minimum=W.min=function(){return K(arguments,1)},W.random=(_=9007199254740992,v=Math.random()*_&2097151?function(){return r(Math.random()*_)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,s,n,i,c,d=0,u=[],f=new W(A);if(null==e?e=F:k(e,0,h),i=a(e/l),B)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));d<i;)(c=131072*t[d]+(t[d+1]>>>11))>=9e15?(s=crypto.getRandomValues(new Uint32Array(2)),t[d]=s[0],t[d+1]=s[1]):(u.push(c%1e14),d+=2);d=i/2}else{if(!crypto.randomBytes)throw B=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(i*=7);d<i;)(c=281474976710656*(31&t[d])+1099511627776*t[d+1]+4294967296*t[d+2]+16777216*t[d+3]+(t[d+4]<<16)+(t[d+5]<<8)+t[d+6])>=9e15?crypto.randomBytes(7).copy(t,d):(u.push(c%1e14),d+=7);d=i/7}if(!B)for(;d<i;)(c=v())<9e15&&(u[d++]=c%1e14);for(i=u[--d],e%=l,i&&e&&(c=m[l-e],u[d]=r(i/c)*c);0===u[d];u.pop(),d--);if(d<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=l);for(d=1,c=u[0];c>=10;c/=10,d++);d<l&&(n-=l-d)}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},x=function(){var e="0123456789";function t(e,t,s,n){for(var a,r,o=[0],i=0,c=e.length;i<c;){for(r=o.length;r--;o[r]*=t);for(o[0]+=n.indexOf(e.charAt(i++)),a=0;a<o.length;a++)o[a]>s-1&&(null==o[a+1]&&(o[a+1]=0),o[a+1]+=o[a]/s|0,o[a]%=s)}return o.reverse()}return function(n,a,r,o,i){var c,l,d,m,u,h,f,g,k=n.indexOf("."),b=F,w=M;for(k>=0&&(m=G,G=0,n=n.replace(".",""),h=(g=new W(a)).pow(n.length-k),G=m,g.c=t(y(p(h.c),h.e,"0"),10,r,e),g.e=g.c.length),d=m=(f=t(n,a,r,i?(c=U,e):(c=e,U))).length;0==f[--m];f.pop());if(!f[0])return c.charAt(0);if(k<0?--d:(h.c=f,h.e=d,h.s=o,f=(h=s(h,g,b,w,r)).c,u=h.r,d=h.e),k=f[l=d+b+1],m=r/2,u=u||l<0||null!=f[l+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[l-1]||w==(h.s<0?8:7)),l<1||!f[0])n=u?y(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(f.length=l,u)for(--r;++f[--l]>r;)f[l]=0,l||(++d,f=[1].concat(f));for(m=f.length;!f[--m];);for(k=0,n="";k<=m;n+=c.charAt(f[k++]));n=y(n,d,c.charAt(0))}return n}}(),s=function(){function e(e,t,s){var n,a,r,o,i=0,c=e.length,l=t%u,d=t/u|0;for(e=e.slice();c--;)i=((a=l*(r=e[c]%u)+(n=d*r+(o=e[c]/u|0)*l)%u*u+i)/s|0)+(n/u|0)+d*o,e[c]=a%s;return i&&(e=[i].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,o,i,d){var m,u,h,p,g,k,b,w,y,x,T,_,v,E,S,j,I,P=n.s==a.s?1:-1,C=n.c,A=a.c;if(!(C&&C[0]&&A&&A[0]))return new W(n.s&&a.s&&(C?!A||C[0]!=A[0]:A)?C&&0==C[0]||!A?0*P:P/0:NaN);for(y=(w=new W(P)).c=[],P=o+(u=n.e-a.e)+1,d||(d=c,u=f(n.e/l)-f(a.e/l),P=P/l|0),h=0;A[h]==(C[h]||0);h++);if(A[h]>(C[h]||0)&&u--,P<0)y.push(1),p=!0;else{for(E=C.length,j=A.length,h=0,P+=2,(g=r(d/(A[0]+1)))>1&&(A=e(A,g,d),C=e(C,g,d),j=A.length,E=C.length),v=j,T=(x=C.slice(0,j)).length;T<j;x[T++]=0);I=A.slice(),I=[0].concat(I),S=A[0],A[1]>=d/2&&S++;do{if(g=0,(m=t(A,x,j,T))<0){if(_=x[0],j!=T&&(_=_*d+(x[1]||0)),(g=r(_/S))>1)for(g>=d&&(g=d-1),b=(k=e(A,g,d)).length,T=x.length;1==t(k,x,b,T);)g--,s(k,j<b?I:A,b,d),b=k.length,m=1;else 0==g&&(m=g=1),b=(k=A.slice()).length;if(b<T&&(k=[0].concat(k)),s(x,k,T,d),T=x.length,-1==m)for(;t(A,x,j,T)<1;)g++,s(x,j<T?I:A,T,d),T=x.length}else 0===m&&(g++,x=[0]);y[h++]=g,x[0]?x[T++]=C[v]||0:(x=[C[v]],T=1)}while((v++<E||null!=x[0])&&P--);p=null!=x[0],y[0]||y.splice(0,1)}if(d==c){for(h=1,P=y[0];P>=10;P/=10,h++);z(w,o+(w.e=h+u*l-1)+1,i,p)}else w.e=u,w.r=+p;return w}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,j=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,T=function(e,t,s,n){var a,r=s?t:t.replace(P,"");if(I.test(r))e.s=isNaN(r)?null:r<0?-1:1;else{if(!s&&(r=r.replace(E,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(S,"$1").replace(j,"0.$1")),t!=r))return new W(r,a);if(W.DEBUG)throw Error(o+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},C.absoluteValue=C.abs=function(){var e=new W(this);return e.s<0&&(e.s=1),e},C.comparedTo=function(e,t){return g(this,new W(e,t))},C.decimalPlaces=C.dp=function(e,t){var s,n,a,r=this;if(null!=e)return k(e,0,h),null==t?t=M:k(t,0,8),z(new W(r),e+r.e+1,t);if(!(s=r.c))return null;if(n=((a=s.length-1)-f(this.e/l))*l,a=s[a])for(;a%10==0;a/=10,n--);return n<0&&(n=0),n},C.dividedBy=C.div=function(e,t){return s(this,new W(e,t),F,M)},C.dividedToIntegerBy=C.idiv=function(e,t){return s(this,new W(e,t),0,1)},C.exponentiatedBy=C.pow=function(e,t){var s,n,i,c,d,m,u,h,f=this;if((e=new W(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+J(e));if(null!=t&&(t=new W(t)),d=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(+J(f),d?e.s*(2-b(e)):+J(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||d&&f.c[1]>=24e7:f.c[0]<8e13||d&&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/l+2))}for(d?(s=new W(.5),m&&(e.s=1),u=b(e)):u=(i=Math.abs(+J(e)))%2,h=new W(A);;){if(u){if(!(h=h.times(f)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(i){if(0===(i=r(i/2)))break;u=i%2}else if(z(e=e.times(s),e.e+1,1),e.e>14)u=b(e);else{if(0===(i=+J(e)))break;u=i%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=A.div(h)),t?h.mod(t):c?z(h,G,M,undefined):h)},C.integerValue=function(e){var t=new W(this);return null==e?e=M:k(e,0,8),z(t,t.e+1,e)},C.isEqualTo=C.eq=function(e,t){return 0===g(this,new W(e,t))},C.isFinite=function(){return!!this.c},C.isGreaterThan=C.gt=function(e,t){return g(this,new W(e,t))>0},C.isGreaterThanOrEqualTo=C.gte=function(e,t){return 1===(t=g(this,new W(e,t)))||0===t},C.isInteger=function(){return!!this.c&&f(this.e/l)>this.c.length-2},C.isLessThan=C.lt=function(e,t){return g(this,new W(e,t))<0},C.isLessThanOrEqualTo=C.lte=function(e,t){return-1===(t=g(this,new W(e,t)))||0===t},C.isNaN=function(){return!this.s},C.isNegative=function(){return this.s<0},C.isPositive=function(){return this.s>0},C.isZero=function(){return!!this.c&&0==this.c[0]},C.minus=function(e,t){var s,n,a,r,o=this,i=o.s;if(t=(e=new W(e,t)).s,!i||!t)return new W(NaN);if(i!=t)return e.s=-t,o.plus(e);var d=o.e/l,m=e.e/l,u=o.c,h=e.c;if(!d||!m){if(!u||!h)return u?(e.s=-t,e):new W(h?o:NaN);if(!u[0]||!h[0])return h[0]?(e.s=-t,e):new W(u[0]?o:3==M?-0:0)}if(d=f(d),m=f(m),u=u.slice(),i=d-m){for((r=i<0)?(i=-i,a=u):(m=d,a=h),a.reverse(),t=i;t--;a.push(0));a.reverse()}else for(n=(r=(i=u.length)<(t=h.length))?i:t,i=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>i;){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]?V(e,u,m):(e.s=3==M?-1:1,e.c=[e.e=0],e)},C.modulo=C.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==R?(a=e.s,e.s=1,n=s(r,e,0,3),e.s=a,n.s*=a):n=s(r,e,0,R),(e=r.minus(n.times(e))).c[0]||1!=R||(e.s=r.s),e)},C.multipliedBy=C.times=function(e,t){var s,n,a,r,o,i,d,m,h,p,g,k,b,w,y,x=this,T=x.c,_=(e=new W(e,t)).c;if(!(T&&_&&T[0]&&_[0]))return!x.s||!e.s||T&&!T[0]&&!_||_&&!_[0]&&!T?e.c=e.e=e.s=null:(e.s*=x.s,T&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=f(x.e/l)+f(e.e/l),e.s*=x.s,(d=T.length)<(p=_.length)&&(b=T,T=_,_=b,a=d,d=p,p=a),a=d+p,b=[];a--;b.push(0));for(w=c,y=u,a=p;--a>=0;){for(s=0,g=_[a]%y,k=_[a]/y|0,r=a+(o=d);r>a;)s=((m=g*(m=T[--o]%y)+(i=k*m+(h=T[o]/y|0)*g)%y*y+b[r]+s)/w|0)+(i/y|0)+k*h,b[r--]=m%w;b[r]=s}return s?++n:b.splice(0,1),V(e,b,n)},C.negated=function(){var e=new W(this);return e.s=-e.s||null,e},C.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/l,o=e.e/l,i=n.c,d=e.c;if(!r||!o){if(!i||!d)return new W(a/0);if(!i[0]||!d[0])return d[0]?e:new W(i[0]?n:0*a)}if(r=f(r),o=f(o),i=i.slice(),a=r-o){for(a>0?(o=r,s=d):(a=-a,s=i),s.reverse();a--;s.push(0));s.reverse()}for((a=i.length)-(t=d.length)<0&&(s=d,d=i,i=s,t=a),a=0;t;)a=(i[--t]=i[t]+d[t]+a)/c|0,i[t]=c===i[t]?0:i[t]%c;return a&&(i=[a].concat(i),++o),V(e,i,o)},C.precision=C.sd=function(e,t){var s,n,a,r=this;if(null!=e&&e!==!!e)return k(e,1,h),null==t?t=M:k(t,0,8),z(new W(r),e,t);if(!(s=r.c))return null;if(n=(a=s.length-1)*l+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},C.shiftedBy=function(e){return k(e,-9007199254740991,d),this.times("1e"+e)},C.squareRoot=C.sqrt=function(){var e,t,n,a,r,o=this,i=o.c,c=o.s,l=o.e,d=F+4,m=new W("0.5");if(1!==c||!i||!i[0])return new W(!c||c<0&&(!i||i[0])?NaN:i?o:1/0);if(0==(c=Math.sqrt(+J(o)))||c==1/0?(((t=p(i)).length+l)%2==0&&(t+="0"),c=Math.sqrt(+t),l=f((l+1)/2)-(l<0||l%2),n=new W(t=c==1/0?"5e"+l:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+l)):n=new W(c+""),n.c[0])for((c=(l=n.e)+d)<3&&(c=0);;)if(r=n,n=m.times(r.plus(s(o,r,d,1))),p(r.c).slice(0,c)===(t=p(n.c)).slice(0,c)){if(n.e<l&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(a||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(z(n,n.e+F+2,1),e=!n.times(n).eq(o));break}if(!a&&(z(r,r.e+F+2,0),r.times(r).eq(o))){n=r;break}d+=4,c+=4,a=1}return z(n,n.e+F+1,M,e)},C.toExponential=function(e,t){return null!=e&&(k(e,0,h),e++),$(this,e,t,1)},C.toFixed=function(e,t){return null!=e&&(k(e,0,h),e=e+this.e+1),$(this,e,t)},C.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(o+"Argument not an object: "+s);if(n=a.toFixed(e,t),a.c){var r,i=n.split("."),c=+s.groupSize,l=+s.secondaryGroupSize,d=s.groupSeparator||"",m=i[0],u=i[1],h=a.s<0,f=h?m.slice(1):m,p=f.length;if(l&&(r=c,c=l,l=r,p-=r),c>0&&p>0){for(r=p%c||c,m=f.substr(0,r);r<p;r+=c)m+=d+f.substr(r,c);l>0&&(m+=d+f.slice(r)),h&&(m="-"+m)}n=u?m+(s.decimalSeparator||"")+((l=+s.fractionGroupSize)?u.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(s.fractionGroupSeparator||"")):u):m}return(s.prefix||"")+n+(s.suffix||"")},C.toFraction=function(e){var t,n,a,r,i,c,d,u,h,f,g,k,b=this,w=b.c;if(null!=e&&(!(d=new W(e)).isInteger()&&(d.c||1!==d.s)||d.lt(A)))throw Error(o+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+J(d));if(!w)return new W(b);for(t=new W(A),h=n=new W(A),a=u=new W(A),k=p(w),i=t.e=k.length-b.e-1,t.c[0]=m[(c=i%l)<0?l+c:c],e=!e||d.comparedTo(t)>0?i>0?t:h:d,c=L,L=1/0,d=new W(k),u.c[0]=0;f=s(d,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=d.minus(f.times(r=t)),d=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,i*=2,M).minus(b).abs().comparedTo(s(u,n,i,M).minus(b).abs())<1?[h,a]:[u,n],L=c,g},C.toNumber=function(){return+J(this)},C.toPrecision=function(e,t){return null!=e&&k(e,1,h),$(this,e,t,2)},C.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<=D||a>=O?w(p(s.c),a):y(p(s.c),a,"0"):10===e&&q?t=y(p((s=z(new W(s),F+a+1,M)).c),s.e,"0"):(k(e,2,U.length,"Base"),t=x(y(p(s.c),a,"0"),10,e,n,!0)),n<0&&s.c[0]&&(t="-"+t)),t},C.valueOf=C.toJSON=function(){return J(this)},C._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",o="utf-8",i={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function l(e,t,s,n=g(),a=c){const r=s||await p(e,n,!1,a),o=await m(r,t);return o.salt=n,JSON.stringify(o)}async function d(e,t,s=g(),n=c){const a=await p(e,s,!0,n),r=await f(a);return{vault:await l(e,t,a,s),exportedKeyString:r}}async function m(e,s){const n=JSON.stringify(s),a=t.from(n,o),i=globalThis.crypto.getRandomValues(new Uint8Array(16)),c=w(e),l=await globalThis.crypto.subtle.encrypt({name:r,iv:i},c,a),d=new Uint8Array(l),m=t.from(i).toString("base64"),u={data:t.from(d).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,o=w(s||await p(e,a,!1,r));return await h(o,n)}async function h(e,s){const n=t.from(s.data,"base64"),a=t.from(s.iv,"base64"),i=w(e);let c;try{const e=await crypto.subtle.decrypt({name:r,iv:a},i,n),s=new Uint8Array(e),l=t.from(s).toString(o);c=JSON.parse(l)}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=i){const c=t.from(e,o),l=t.from(s,"base64"),d=await globalThis.crypto.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),m=await globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:l,iterations:a.params.iterations,hash:"SHA-256"},d,{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 y(e,t=c){const{keyMetadata:s}=JSON.parse(e);return b(s)&&s.algorithm===t.algorithm&&s.params.iterations===t.params.iterations}s.encrypt=l,s.encryptWithDetail=d,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 y(e,s)?e:l(t,await u(t,e),undefined,undefined,s)},s.updateVaultWithDetail=async function(e,t,s=c){return y(e.vault,s)?e:d(t,await u(t,e.vault),undefined,s)},s.isVaultUpdated=y}).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/connectivity-controller/dist/ConnectivityController.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/connectivity-controller/dist/types.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){Object.defineProperty(s,"__esModule",{value:!0}),s.ConnectivityController=s.getDefaultConnectivityControllerState=s.controllerName=void 0;const n=e("@metamask/base-controller"),a=e("./types.cjs");s.controllerName="ConnectivityController";const r={connectivityStatus:{persist:!1,includeInDebugSnapshot:!0,includeInStateLogs:!0,usedInUi:!0}};function o(){return{connectivityStatus:a.CONNECTIVITY_STATUSES.Online}}s.getDefaultConnectivityControllerState=o;class i extends n.BaseController{constructor({messenger:e,connectivityAdapter:t}){const n=t.getStatus();super({messenger:e,metadata:r,name:s.controllerName,state:{...o(),connectivityStatus:n}}),t.onConnectivityChange(e=>{this.update(t=>{t.connectivityStatus=e})})}}s.ConnectivityController=i}}},{package:"@metamask/connectivity-controller",file:"node_modules/@metamask/connectivity-controller/dist/ConnectivityController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/connectivity-controller/dist/index.cjs",{"./ConnectivityController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/connectivity-controller/dist/ConnectivityController.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/connectivity-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.getDefaultConnectivityControllerState=s.ConnectivityController=s.CONNECTIVITY_STATUSES=void 0;var n=e("./types.cjs");Object.defineProperty(s,"CONNECTIVITY_STATUSES",{enumerable:!0,get:function(){return n.CONNECTIVITY_STATUSES}});var a=e("./ConnectivityController.cjs");Object.defineProperty(s,"ConnectivityController",{enumerable:!0,get:function(){return a.ConnectivityController}}),Object.defineProperty(s,"getDefaultConnectivityControllerState",{enumerable:!0,get:function(){return a.getDefaultConnectivityControllerState}})}}},{package:"@metamask/connectivity-controller",file:"node_modules/@metamask/connectivity-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/connectivity-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.CONNECTIVITY_STATUSES=void 0,s.CONNECTIVITY_STATUSES={Online:"online",Offline:"offline"}}}},{package:"@metamask/connectivity-controller",file:"node_modules/@metamask/connectivity-controller/dist/types.cjs"}],["/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},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.DelegationController=s.controllerName=void 0;const i=e("@metamask/base-controller"),c=e("@metamask/keyring-controller"),l=e("@metamask/utils"),d=e("./constants.cjs"),m=e("./utils.cjs");s.controllerName="DelegationController";const u={delegations:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};class h extends i.BaseController{constructor({messenger:e,state:t,hashDelegation:o,getDelegationEnvironment:i}){super({messenger:e,metadata:u,name:s.controllerName,state:{delegations:{},...t}}),n.set(this,void 0),a.set(this,void 0),r(this,n,o,"f"),r(this,a,i,"f")}async signDelegation(e){const{delegation:t,chainId:s}=e,{DelegationManager:n}=o(this,a,"f").call(this,s),r=(0,m.createTypedMessageParams)({chainId:(0,l.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=o(this,n,"f").call(this,t.delegation);if(!(0,m.isHexEqual)(t.delegation.authority,d.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!==d.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:o}=e;return{data:{types:a.SIGNABLE_DELEGATION_TYPED_DATA,primaryType:"Delegation",domain:{chainId:t,name:"DelegationManager",version:"1",verifyingContract:o},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"},o={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,megaEthMainnet:4326,celo:42220,ronin:2020,tempoMainnet:4217,bscTestnet:97,arbitrumSepolia:421614,baseSepolia:84532,berachainBepolia:80069,chiado:10200,citreaTestnet:5115,hoodiTestnet:560048,inkSepolia:763373,lineaSepolia:59141,megaEthTestnet:6343,monadTestnet:10143,optimismSepolia:11155420,polygonAmoy:80002,seiTestnet:1328,sepolia:11155111,sonicTestnet:14601,unichainSepolia:1301,celoSepolia:11142220,roninSaigon:202601,tempoModeratoTestnet:42431,lineaGoerli:59140},i={"1.0.0":{[o.optimism]:r,[o.polygon]:r,[o.base]:r,[o.arbitrum]:r,[o.linea]:r,[o.sepolia]:{...r,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"},[o.lineaSepolia]:{...r,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"}},"1.1.0":{[o.arbitrum]:a,[o.base]:a,[o.linea]:a,[o.optimism]:a,[o.polygon]:a,[o.sepolia]:a,[o.lineaSepolia]:a,[o.baseSepolia]:{...a,SimpleFactory:"0xE8eA1DE8D6AfE400B7C8C1A81B7C29B7876b4d02"}},"1.3.0":{[o.mainnet]:n,[o.polygon]:n,[o.bsc]:n,[o.optimism]:n,[o.arbitrum]:n,[o.ink]:n,[o.linea]:n,[o.base]:n,[o.gnosis]:n,[o.berachain]:n,[o.unichain]:n,[o.arbitrumNova]:n,[o.sei]:n,[o.sonic]:n,[o.monad]:n,[o.megaEthMainnet]:n,[o.celo]:n,[o.ronin]:n,[o.tempoMainnet]:n,[o.bscTestnet]:n,[o.citreaTestnet]:n,[o.megaEthTestnet]:n,[o.chiado]:n,[o.lineaSepolia]:n,[o.berachainBepolia]:n,[o.baseSepolia]:n,[o.arbitrumSepolia]:n,[o.sepolia]:n,[o.optimismSepolia]:n,[o.unichainSepolia]:n,[o.polygonAmoy]:n,[o.inkSepolia]:n,[o.monadTestnet]:n,[o.seiTestnet]:n,[o.sonicTestnet]:n,[o.hoodiTestnet]:n,[o.celoSepolia]:n,[o.roninSaigon]:n,[o.tempoModeratoTestnet]:n}};s.CHAIN_ID=o,s.DELEGATOR_CONTRACTS=i}}},{package:"@metamask/delegation-deployments",file:"node_modules/@metamask/delegation-deployments/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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,o,i,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"}(o||(s.EIP5792ErrorCode=o={})),function(e){e[e.UnsupportedAsset=5771]="UnsupportedAsset",e[e.UnsupportedChain=5772]="UnsupportedChain",e[e.MalformedRequiredAssets=5773]="MalformedRequiredAssets"}(i||(s.EIP7682ErrorCode=i={})),function(e){e[e.PENDING=100]="PENDING",e[e.CONFIRMED=200]="CONFIRMED",e[e.FAILED_OFFCHAIN=400]="FAILED_OFFCHAIN",e[e.REVERTED=500]="REVERTED",e[e.REVERTED_PARTIAL=600]="REVERTED_PARTIAL"}(c||(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/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 o=s[0],{chainId:i,txReceipt:c}=o,l=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}(o),d=c,m=d?.logs??[],u=d&&[{blockHash:d.blockHash,blockNumber:d.blockNumber,gasUsed:d.gasUsed,logs:m.map(e=>({address:e.address,data:e.data,topics:e.topics})),status:d.status,transactionHash:d.transactionHash}];return{version:r.VERSION,id:t,chainId:i,atomic:!0,status:l,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:o,getIsSmartTransaction:i,isAtomicBatchSupported:c,isRelaySupported:l,getSendBundleSupportedChains:d,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 o=r.call("PreferencesController:getState").useTransactionSimulations,i=await Promise.all(t.map(({chainId:e})=>e).map(e=>n(e))),c=await a(e),l=t.map((e,t)=>({...e,relaySupportedForChain:i[t]}));return e.reduce((e,t)=>{const n=l.find(({chainId:e})=>e===t)??{},{isSupported:a=!1,relaySupportedForChain:r}=n,i=s(t),d=c[t]??!1;return o&&(i&&d||a&&r)&&(e[t]={alternateGasFees:{supported:!0}}),e},{})}(u,h,i,l,d,t);return u.reduce((e,r)=>{const i=h.find(({chainId:e})=>e===r)??{},{delegationAddress:c,isSupported:l,upgradeContractAddress:d}=i,u=o();let f=!1;try{const e=(0,a.getAccountKeyringType)(s,t);f=n.KEYRING_TYPES_SUPPORTING_7702.includes(e)}catch{}if(!l&&!(!u&&d&&!c&&f))return e;const p=l?"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/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"),o=e("lodash"),i=e("uuid"),c=e("../constants.cjs"),l=e("../utils.cjs");function d(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:o}=e,i=[...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(i?.length)throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capabilities: ${i.join(", ")}`);r?.auxiliaryFunds&&h({auxiliaryFunds:r.auxiliaryFunds,chainId:o,keyringType:t,isAuxiliaryFundsSupported:s});for(const e of a)e.capabilities?.auxiliaryFunds&&h({auxiliaryFunds:e.capabilities.auxiliaryFunds,chainId:o,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,o.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,o){const{addTransactionBatch:h,addTransaction:p,getDismissSmartAccountSuggestionEnabled:g,isAtomicBatchSupported:k,validateSecurity:b,getPermittedAccountsForOrigin:w,isAuxiliaryFundsSupported:y}=e,{calls:x,from:T}=s,{networkClientId:_,origin:v}=o,E=x.map(e=>({params:e})),{chainId:S}=t.call("NetworkController:getNetworkClientById",_).configuration,[j]=await w(),I=T??j;if(!I)throw n.providerErrors.unauthorized();const P=(0,i.v4)(),C=b.bind(null,P),A=o.id?String(o.id):"";let F;return F=1===Object.keys(E).length?await async function({addTransaction:e,chainId:t,from:s,messenger:n,networkClientId:o,origin:h,requestId:p,securityAlertId:g,sendCalls:k,transactions:b,validateSecurity:w,isAuxiliaryFundsSupported:y}){const x=(0,l.getAccountKeyringType)(s,n);!function(e,t,s,n){d(e),u(e,s,n),m(e,t)}(k,t,x,y);const T={from:s,...b[0].params,type:a.TransactionEnvelopeType.feeMarket},_={method:c.MessageType.SendTransaction,params:[T],origin:h};w(_,t);const v=f(k),E=function(){const e=(0,i.v4)(),t=new Uint8Array((0,i.parse)(e));return(0,r.bytesToHex)(t)}();return await e(T,{batchId:E,networkClientId:o,origin:h,requestId:p,requiredAssets:v,securityAlertResponse:{securityAlertId:g}}),E}({addTransaction:p,chainId:S,from:I,messenger:t,networkClientId:_,origin:v,requestId:A,securityAlertId:P,sendCalls:s,transactions:E,validateSecurity:C,isAuxiliaryFundsSupported:y}):await async function({addTransactionBatch:e,isAtomicBatchSupported:t,chainId:s,from:a,getDismissSmartAccountSuggestionEnabled:r,networkClientId:o,messenger:i,origin:h,requestId:p,sendCalls:g,securityAlertId:k,transactions:b,validateSecurity:w,isAuxiliaryFundsSupported:y}){const x=await t({address:a,chainIds:[s]}),T=x?.[0],_=(0,l.getAccountKeyringType)(a,i),v=r();!function(e,t,s,a,r,o){d(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,o),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,v,T,_,y);const E=f(g),S=await e({from:a,networkClientId:o,origin:h,requestId:p,requiredAssets:E,securityAlertId:k,transactions:b,validateSecurity:w});return S.batchId}({addTransactionBatch:h,isAtomicBatchSupported:k,chainId:S,from:I,getDismissSmartAccountSuggestionEnabled:g,messenger:t,networkClientId:_,origin:v,requestId:A,sendCalls:s,securityAlertId:P,transactions:E,validateSecurity:C,isAuxiliaryFundsSupported:y}),{id:F}}}}},{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 o=e("./methods/wallet_sendCalls.cjs");Object.defineProperty(s,"walletSendCalls",{enumerable:!0,get:function(){return o.walletSendCalls}});var i=e("./methods/wallet_getCallsStatus.cjs");Object.defineProperty(s,"walletGetCallsStatus",{enumerable:!0,get:function(){return i.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 o=e.params[0];t.result=await s(o,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:o}){if(!o)throw n.rpcErrors.methodNotSupported();(0,r.validateParams)(e.params,a.GetCapabilitiesStruct);const i=e.params[0],c=e.params[1];await(0,r.validateAndNormalizeKeyholder)(i,{getPermittedAccountsForOrigin:s});const l=await o(i,c,e);t.result=l}}}},{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:o}){if(!o)throw n.rpcErrors.methodNotSupported();(0,r.validateParams)(e.params,a.SendCallsStruct);const i=e.params[0],c=i.from?await(0,r.validateAndNormalizeKeyholder)(i.from,{getPermittedAccountsForOrigin:s}):undefined,l={...i,from:c};t.result=await o(l,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 o(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()),o=a?.metadata?.keyring?.type;if(!o)throw new n.JsonRpcError(r.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported as account type is unknown");return o},s.validateAndNormalizeKeyholder=async function(e,{getPermittedAccountsForOrigin:t}){if("string"==typeof e&&e.length>0&&o(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=o}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DELEGATION_INDICATOR_PREFIX=s.METHOD_NAMES=void 0,s.METHOD_NAMES={UPGRADE_ACCOUNT:"wallet_upgradeAccount",GET_ACCOUNT_UPGRADE_STATUS:"wallet_getAccountUpgradeStatus"},s.DELEGATION_INDICATOR_PREFIX="0xef0100"}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","./wallet_getAccountUpgradeStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs","./wallet_upgradeAccount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.METHOD_NAMES=s.validateAndNormalizeAddress=s.validateParams=s.walletGetAccountUpgradeStatus=s.walletUpgradeAccount=void 0;var n=e("./wallet_upgradeAccount.cjs");Object.defineProperty(s,"walletUpgradeAccount",{enumerable:!0,get:function(){return n.walletUpgradeAccount}});var a=e("./wallet_getAccountUpgradeStatus.cjs");Object.defineProperty(s,"walletGetAccountUpgradeStatus",{enumerable:!0,get:function(){return a.walletGetAccountUpgradeStatus}});var r=e("./utils.cjs");Object.defineProperty(s,"validateParams",{enumerable:!0,get:function(){return r.validateParams}}),Object.defineProperty(s,"validateAndNormalizeAddress",{enumerable:!0,get:function(){return r.validateAndNormalizeAddress}});var o=e("./constants.cjs");Object.defineProperty(s,"METHOD_NAMES",{enumerable:!0,get:function(){return o.METHOD_NAMES}})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.GetAccountUpgradeStatusParamsStruct=s.UpgradeAccountParamsStruct=void 0;const n=e("@metamask/superstruct"),a=e("@metamask/utils");s.UpgradeAccountParamsStruct=(0,n.object)({account:a.HexChecksumAddressStruct,chainId:(0,n.optional)(a.StrictHexStruct)}),s.GetAccountUpgradeStatusParamsStruct=(0,n.object)({account:a.HexChecksumAddressStruct,chainId:(0,n.optional)(a.StrictHexStruct)})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs",{"@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateParams=s.validateAndNormalizeAddress=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/superstruct"),r=e("@metamask/utils");s.validateAndNormalizeAddress=async function(e,t,s){if("string"!=typeof e||0===e.length||!(0,r.isHexAddress)(e))throw n.rpcErrors.invalidParams({message:"Invalid parameters: must provide an EVM address."});if(!(await s(t)).map(e=>e.toLowerCase()).includes(e.toLowerCase()))throw n.providerErrors.unauthorized();return e},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 parameters"))}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetAccountUpgradeStatus=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/utils"),r=e("./constants.cjs"),o=e("./types.cjs"),i=e("./utils.cjs");s.walletGetAccountUpgradeStatus=async function(e,t,s){const{params:c,origin:l}=e;(0,i.validateParams)(c,o.GetAccountUpgradeStatusParamsStruct);const{account:d,chainId:m}=c,u=await(0,i.validateAndNormalizeAddress)(d,l,s.getPermittedAccountsForOrigin);let h;if(m!==undefined)h=m;else{const e=s.getCurrentChainIdForDomain(l);if(!e)throw n.rpcErrors.invalidParams({message:`Could not determine current chain ID for origin: ${l}`});h=e}const{isSupported:f}=await s.isEip7702Supported({address:u,chainId:h});if(f)try{const e=h,a=s.getSelectedNetworkClientIdForChain(e);if(!a)throw n.rpcErrors.invalidParams({message:`Network client ID not found for chain ID ${h}`});const{isUpgraded:o,upgradedAddress:i}=await(async(e,t,s)=>{const n=await s(e,t);if(!n||"0x"===n||n.length<=2)return{isUpgraded:!1,upgradedAddress:null};if(!n.startsWith(r.DELEGATION_INDICATOR_PREFIX))return{isUpgraded:!1,upgradedAddress:null};const a=r.DELEGATION_INDICATOR_PREFIX.length+40;return n.length!==a?{isUpgraded:!1,upgradedAddress:null}:{isUpgraded:!0,upgradedAddress:`0x${n.slice(8,48)}`}})(u,a,s.getCode);t.result={isSupported:f,account:u,isUpgraded:o,upgradedAddress:i,chainId:h}}catch(e){if(e instanceof n.JsonRpcError)throw e;throw n.rpcErrors.internal({message:`Failed to get account upgrade status: ${(0,a.getErrorMessage)(e)}`})}else t.result={isSupported:f,account:u,isUpgraded:!1,upgradedAddress:null,chainId:h}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletUpgradeAccount=void 0;const n=e("@metamask/rpc-errors"),a=e("./types.cjs"),r=e("./utils.cjs");s.walletUpgradeAccount=async function(e,t,s){const{params:o,origin:i}=e;(0,r.validateParams)(o,a.UpgradeAccountParamsStruct);const{account:c,chainId:l}=o,d=await(0,r.validateAndNormalizeAddress)(c,i,s.getPermittedAccountsForOrigin);let m;if(l!==undefined)m=l;else{const e=s.getCurrentChainIdForDomain(i);if(!e)throw n.rpcErrors.invalidParams({message:`No network configuration found for origin: ${i}`});m=e}try{const e=m,{isSupported:a,upgradeContractAddress:r}=await s.isEip7702Supported({address:d,chainId:e});if(!a)throw n.rpcErrors.invalidParams({message:`Account upgrade not supported on chain ID ${m}`});if(!r)throw n.rpcErrors.invalidParams({message:`No upgrade contract address available for chain ID ${m}`});const o=await s.upgradeAccount(d,r,m);t.result={transactionHash:o.transactionHash,upgradedAccount:d,delegatedTo:o.delegatedTo}}catch(e){if(e instanceof n.JsonRpcError)throw e;throw n.rpcErrors.internal({message:`Failed to upgrade account: ${e instanceof Error?e.message:String(e)}`})}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs",{"@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","punycode/punycode.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/punycode/punycode.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,i,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)},l=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.EnsController=s.DEFAULT_ENS_NETWORK_MAP=void 0;const d=e("@ethersproject/providers"),m=e("@metamask/base-controller"),u=e("@metamask/controller-utils"),h=e("@metamask/utils"),f=e("punycode/punycode.js"),p=(0,h.createProjectLogger)("ens-controller"),g=["clear","delete","get","resetState","reverseResolveAddress","set"];s.DEFAULT_ENS_NETWORK_MAP={1:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",4:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",5:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",17e3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",11155111:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"};const k={ensEntries:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},ensResolutionsByAddress:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},b={ensEntries:{},ensResolutionsByAddress:{}};class w extends m.BaseController{constructor({registriesByChainId:e=s.DEFAULT_ENS_NETWORK_MAP,messenger:t,state:i={},onNetworkDidChange:l}){super({name:"EnsController",metadata:k,messenger:t,state:{...b,ensEntries:Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,u.toHex)(e),{".":{address:t,chainId:(0,u.toHex)(e),ensName:"."}}])),...i}}),n.add(this),a.set(this,null),this.messenger.registerMethodActionHandlers(this,g),c(this,n,"m",r).call(this,e),l&&l(({selectedNetworkClientId:t})=>{this.resetState(),c(this,n,"m",o).call(this,t,e)})}resetState(){this.update(e=>{e.ensResolutionsByAddress={}})}clear(){this.update(e=>{e.ensEntries={}})}delete(e,t){const s=(0,u.normalizeEnsName)(t);return!!((0,u.isSafeDynamicKey)(e)&&s&&this.state.ensEntries[e]?.[s])&&(this.update(t=>{delete t.ensEntries[e][s],0===Object.keys(t.ensEntries[e]).length&&delete t.ensEntries[e]}),!0)}get(e,t){const s=(0,u.normalizeEnsName)(t);return s&&this.state.ensEntries[e]&&this.state.ensEntries[e][s]||null}set(e,t,s){if(!Number.isInteger(Number.parseInt(e,10))||!t||"string"!=typeof t||s&&!(0,u.isValidHexAddress)(s))throw new Error(`Invalid ENS entry: { chainId:${e}, ensName:${t}, address:${s}}`);const n=(0,u.normalizeEnsName)(t);if(!n)throw new Error(`Invalid ENS name: ${t}`);const a=s?(0,u.toChecksumHexAddress)(s):null,r=this.state.ensEntries[e];return r?.[n]?.address!==a&&(this.update(t=>{t.ensEntries={...this.state.ensEntries,[e]:{...this.state.ensEntries[e],[n]:{address:a,chainId:e,ensName:n}}}}),!0)}async reverseResolveAddress(e){if(!c(this,a,"f"))return undefined;const t=(0,u.toChecksumHexAddress)(e);if(this.state.ensResolutionsByAddress[t])return this.state.ensResolutionsByAddress[t];let s,n;try{s=await c(this,a,"f").lookupAddress(t)}catch(e){return p(e),undefined}if(!s)return undefined;try{n=await c(this,a,"f").resolveName(s)}catch(e){return p(e),undefined}return n?"0x0000000000000000000000000000000000000000"===n||"0x"===n||(0,u.toChecksumHexAddress)(n)!==t?undefined:(this.update(e=>{e.ensResolutionsByAddress[t]=(0,f.toASCII)(s)}),s):undefined}}s.EnsController=w,a=new WeakMap,n=new WeakSet,r=function(e){const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState");c(this,n,"m",o).call(this,t,e)},o=function(e,t){const{configuration:{chainId:s},provider:r}=this.messenger.call("NetworkController:getNetworkClientById",e);t?.[parseInt(s,16)]&&c(this,n,"m",i).call(this,s)?l(this,a,new d.Web3Provider(r,{chainId:(0,u.convertHexToDecimal)(s),name:u.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP[s],ensAddress:t[parseInt(s,16)]}),"f"):l(this,a,null,"f")},i=function(e){return Boolean(this.state.ensEntries[e])},s.default=w}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/EnsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/index.cjs",{"./EnsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),a=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./EnsController.cjs"),s)}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("./base-filter");t.exports=class extends n{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js",{"@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("@metamask/safe-event-emitter").default;t.exports=class extends n{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach(e=>this.emit("update",e))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("./base-filter"),a=e("./getBlocksForRange"),{incrementHexInt:r}=e("./hexUtils");t.exports=class extends n{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const s=t,n=r(e),o=(await a({provider:this.provider,fromBlock:n,toBlock:s})).map(e=>e.hash);this.addResults(o)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/block-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function a(e){if(e===undefined||null===e)return e;return"0x"+e.toString(16)}t.exports=async function({provider:e,fromBlock:t,toBlock:s}){t||(t=s);const r=n(t),o=n(s),i=Array(o-r+1).fill().map((e,t)=>r+t).map(a);let c=await Promise.all(i.map(t=>async function(e,t,s){for(let n=0;n<3;n++)try{return e.request({id:1,jsonrpc:"2.0",method:t,params:s})}catch(e){console.error(`provider.request failed: ${e.stack||e.message||e}`)}return null}(e,"eth_getBlockByNumber",[t,!1])));return c=c.filter(e=>null!==e),c}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e){return e.sort((e,t)=>"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:a(e)-a(t))}function a(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function r(e){if(e===undefined||null===e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function o(){return Math.floor(16*Math.random()).toString(16)}t.exports={minBlockRef:function(...e){return n(e)[0]},maxBlockRef:function(...e){const t=n(e);return t[t.length-1]},sortBlockRefs:n,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:a,incrementHexInt:function(e){if(e===undefined||null===e)return e;return r(a(e)+1)},intToHex:r,unsafeRandomBytes:function(e){let t="0x";for(let s=0;s<e;s++)t+=o(),t+=o();return t}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js",{"./block-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./log-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js","./tx-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("async-mutex").Mutex,{createAsyncMiddleware:a,createScaffoldMiddleware:r}=e("@metamask/json-rpc-engine"),o=e("./log-filter.js"),i=e("./block-filter.js"),c=e("./tx-filter.js"),{intToHex:l,hexToInt:d}=e("./hexUtils");function m(e){return u(async(...t)=>{const s=await e(...t);return l(s.id)})}function u(e){return a(async(t,s)=>{const n=await e.apply(null,t.params);s.result=n})}function h(e,t){const s=[];for(let t in e)s.push(e[t]);return s}t.exports=function({blockTracker:e,provider:t}){let s=0,a={};const f=new n,p=function({mutex:e}){return t=>async(s,n,a,r)=>{(await e.acquire())(),t(s,n,a,r)}}({mutex:f}),g=r({eth_newFilter:p(m(b)),eth_newBlockFilter:p(m(w)),eth_newPendingTransactionFilter:p(m(y)),eth_uninstallFilter:p(u(_)),eth_getFilterChanges:p(u(x)),eth_getFilterLogs:p(u(T))}),k=async({oldBlock:e,newBlock:t})=>{if(0===a.length)return;const s=await f.acquire();try{await Promise.all(h(a).map(async s=>{try{await s.update({oldBlock:e,newBlock:t})}catch(e){console.error(e)}}))}catch(e){console.error(e)}s()};return g.newLogFilter=b,g.newBlockFilter=w,g.newPendingTransactionFilter=y,g.uninstallFilter=_,g.getFilterChanges=x,g.getFilterLogs=T,g.destroy=()=>{!async function(){const e=h(a).length;a={},E({prevFilterCount:e,newFilterCount:0})}()},g;async function b(e){const s=new o({provider:t,params:e});await v(s);return s}async function w(){const e=new i({provider:t});await v(e);return e}async function y(){const e=new c({provider:t});await v(e);return e}async function x(e){const t=d(e),s=a[t];if(!s)throw new Error(`No filter for index "${t}"`);return s.getChangesAndClear()}async function T(e){const t=d(e),s=a[t];if(!s)throw new Error(`No filter for index "${t}"`);let n=[];return"log"===s.type&&(n=s.getAllResults()),n}async function _(e){const t=d(e),s=a[t],n=Boolean(s);return n&&await async function(e){const t=h(a).length;delete a[e];const s=h(a).length;E({prevFilterCount:t,newFilterCount:s})}(t),n}async function v(t){const n=h(a).length,r=await e.getLatestBlock();await t.initialize({currentBlock:r}),s++,a[s]=t,t.id=s,t.idHex=l(s);return E({prevFilterCount:n,newFilterCount:h(a).length}),s}function E({prevFilterCount:t,newFilterCount:s}){0===t&&s>0?e.on("sync",k):t>0&&0===s&&e.removeListener("sync",k)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js",{"./base-filter-history":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js",pify:"/home/runner/work/metamask-extension/metamask-extension/node_modules/pify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("@metamask/eth-query"),a=e("pify"),r=e("./base-filter-history"),{bnToHex:o,hexToInt:i,incrementHexInt:c,minBlockRef:l,blockRefIsNumber:d}=e("./hexUtils");t.exports=class extends r{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new n(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:undefined,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(e=>e.toLowerCase()))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const s=l(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:s}),a=await this._fetchLogs(n);this.addInitialResults(a)}async update({oldBlock:e,newBlock:t}){const s=t;let n;n=e?c(e):t;const a=Object.assign({},this.params,{fromBlock:n,toBlock:s}),r=(await this._fetchLogs(a)).filter(e=>this.matchLog(e));this.addResults(r)}async _fetchLogs(e){return await a(t=>this.ethQuery.getLogs(e,t))()}matchLog(e){if(i(this.params.fromBlock)>=i(e.blockNumber))return!1;if(d(this.params.toBlock)&&i(this.params.toBlock)<=i(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every((t,s)=>{let n=e.topics[s];if(!n)return!1;n=n.toLowerCase();let a=Array.isArray(t)?t:[t];if(a.includes(null))return!0;a=a.map(e=>e.toLowerCase());return a.includes(n)})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/log-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js",{"./getBlocksForRange.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./index.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("@metamask/safe-event-emitter").default,{createAsyncMiddleware:a,createScaffoldMiddleware:r}=e("@metamask/json-rpc-engine"),o=e("./index.js"),{unsafeRandomBytes:i,incrementHexInt:c}=e("./hexUtils.js"),l=e("./getBlocksForRange.js");function d(e){return null===e||e===undefined?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}t.exports=function({blockTracker:e,provider:t}){const s={},m=o({blockTracker:e,provider:t});let u=!1;const h=new n,f=r({eth_subscribe:a(async function(n,a){if(u)throw new Error("SubscriptionManager - attempting to use after destroying");const r=n.params[0],o=i(16);let h;switch(r){case"newHeads":h=f({subId:o});break;case"logs":const e=n.params[1];h=g({subId:o,filter:await m.newLogFilter(e)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${r}"`)}return s[o]=h,void(a.result=o);function f({subId:s}){const n={type:r,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const a=n,r=c(e);(await l({provider:t,fromBlock:r,toBlock:a})).map(d).filter(e=>null!==e).forEach(e=>{p(s,e)})}};return e.on("sync",n.update),n}function g({subId:e,filter:t}){t.on("update",t=>p(e,t));return{type:r,destroy:async()=>await m.uninstallFilter(t.idHex)}}}),eth_unsubscribe:a(async function(e,t){if(u)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],a=s[n];if(!a)return void(t.result=!1);delete s[n],await a.destroy(),t.result=!0})});return f.destroy=function(){h.removeAllListeners();for(const e in s)s[e].destroy(),delete s[e];u=!0},{events:h,middleware:f};function p(e,t){h.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("./base-filter"),a=e("./getBlocksForRange"),{incrementHexInt:r}=e("./hexUtils");t.exports=class extends n{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,s=r(e),n=await a({provider:this.provider,fromBlock:s,toBlock:t}),o=[];for(const e of n)o.push(...e.transactions);this.addResults(o)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/tx-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs",{"@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createLedgerError=function(e,t){const s=a(e);if(s){const e=t?`${s.message} (${t})`:s.message;return new n.HardwareWalletError(e,{code:s.code,severity:s.severity,category:s.category,userMessage:s.userMessage??e})}const r=t?`Unknown Ledger error: ${e} (${t})`:`Unknown Ledger error: ${e}`;return new n.HardwareWalletError(r,{code:n.ErrorCode.Unknown,severity:n.Severity.Err,category:n.Category.Unknown,userMessage:r})},s.isKnownLedgerError=function(e){return e in n.LEDGER_ERROR_MAPPINGS},s.getLedgerErrorMapping=a;const n=e("@metamask/hw-wallet-sdk");function a(e){return n.LEDGER_ERROR_MAPPINGS[e]}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","./ledger-error-handler.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs","./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs","./ledger-iframe-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs","./ledger-keyring-v2.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs","./ledger-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs","./ledger-mobile-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs","./ledger-transport-middleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),a=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./ledger-keyring.cjs"),s),a(e("./ledger-keyring-v2.cjs"),s),a(e("./ledger-iframe-bridge.cjs"),s),a(e("./ledger-mobile-bridge.cjs"),s),a(e("./ledger-transport-middleware.cjs"),s),a(e("./ledger-hw-app.cjs"),s),a(e("./errors.cjs"),s),a(e("./ledger-error-handler.cjs"),s)}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","@ledgerhq/hw-transport":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-transport/lib/Transport.js","@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.handleLedgerTransportError=function(e,t){if(e instanceof n.TransportStatusError){const t=`0x${e.statusCode.toString(16)}`;if((0,r.isKnownLedgerError)(t)){const e=(0,r.createLedgerError)(t);throw i.has(t)&&(e.message=(s=e.message).startsWith(o)?s:`${o}${s}`),e}throw new a.HardwareWalletError(e.message,{code:a.ErrorCode.Unknown,severity:a.Severity.Err,category:a.Category.Unknown,userMessage:e.message,cause:e})}var s;if(e instanceof a.HardwareWalletError)throw e;if(e instanceof Error)throw new a.HardwareWalletError(e.message,{code:a.ErrorCode.Unknown,severity:a.Severity.Err,category:a.Category.Unknown,userMessage:e.message,cause:e});throw new a.HardwareWalletError(t,{code:a.ErrorCode.Unknown,severity:a.Severity.Err,category:a.Category.Unknown,userMessage:t})};const n=e("@ledgerhq/hw-transport"),a=e("@metamask/hw-wallet-sdk"),r=e("./errors.cjs"),o="Ledger: ",i=new Set(["0x6985","0x6a80","0x5515","0x650f"])}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs",{"@ledgerhq/hw-app-eth":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.MetaMaskLedgerHwAppEth=void 0;const a=n(e("@ledgerhq/hw-app-eth")),r=e("buffer");class o extends a.default{constructor(){super(...arguments),this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii"}async openEthApp(){await this.transport.send(224,216,0,0,r.Buffer.from(this.ethAppName,this.transportEncoding))}async closeApps(){await this.transport.send(176,167,0,0)}async getAppNameAndVersion(){const e=await this.transport.send(176,1,0,0);if(1!==e[0])throw new Error("Incorrect format return from getAppNameAndVersion.");let t=1;const s=e[t]??0;t+=1;const n=e.slice(t,t+=s).toString(this.transportEncoding),a=e[t]??0;t+=1;return{appName:n,version:e.slice(t,t+=a).toString(this.transportEncoding)}}}s.MetaMaskLedgerHwAppEth=o}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"}]],[],{});