LavaPack.loadBundle([["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js",{"@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/logger":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"FirebaseError",{enumerable:!0,get:function(){return i.FirebaseError}}),n._DEFAULT_ENTRY_NAME=n.SDK_VERSION=void 0,n._addComponent=U,n._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},n._apps=void 0,n._clearComponents=function(){H.clear()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n._components=void 0,n._getProvider=q,n._isFirebaseApp=$,n._isFirebaseServerApp=function(e){return e.settings!==undefined},n._registerComponent=W,n._removeServiceInstance=function(e,t,n=R){q(e,t).clearInstance(n)},n._serverApps=void 0,n.deleteApp=Q,n.getApp=function(e=R){const t=L.get(e);if(!t&&e===R&&(0,i.getDefaultAppConfig)())return J();if(!t)throw V.create("no-app",{appName:e});return t},n.getApps=function(){return Array.from(L.values())},n.initializeApp=J,n.initializeServerApp=function(e,t){if((0,i.isBrowser)()&&!(0,i.isWebWorker)())throw V.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let n;n=$(e)?e.options:e;const a=Object.assign(Object.assign({},t),n);a.releaseOnDeref!==undefined&&delete a.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw V.create("finalization-registry-not-supported",{});const r=""+(c=JSON.stringify(a),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),o=G.get(r);var c;if(o)return o.incRefCount(t.releaseOnDeref),o;const l=new s.ComponentContainer(r);for(const e of H.values())l.addComponent(e);const d=new Y(n,t,r,l);return G.set(r,d),d},n.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw V.create("invalid-log-argument");(0,a.setUserLogHandler)(e,t)},n.registerVersion=X,n.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 s=e("@firebase/component"),a=e("@firebase/logger"),i=e("@firebase/util"),r=e("idb");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class o{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const c="@firebase/app",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",T="@firebase/functions",_="@firebase/functions-compat",x="@firebase/installations",E="@firebase/installations-compat",v="@firebase/messaging",I="@firebase/messaging-compat",S="@firebase/performance",C="@firebase/performance-compat",A="@firebase/remote-config",j="@firebase/remote-config-compat",P="@firebase/storage",O="@firebase/storage-compat",N="@firebase/firestore",F="@firebase/vertexai",M="@firebase/firestore-compat",D="firebase",R=n._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",[T]:"fire-fn",[_]:"fire-fn-compat",[x]:"fire-iid",[E]:"fire-iid-compat",[v]:"fire-fcm",[I]:"fire-fcm-compat",[S]:"fire-perf",[C]:"fire-perf-compat",[A]:"fire-rc",[j]:"fire-rc-compat",[P]:"fire-gcs",[O]:"fire-gcs-compat",[N]:"fire-fst",[M]:"fire-fst-compat",[F]:"fire-vertex","fire-js":"fire-js",[D]:"fire-js-all"},L=n._apps=new Map,G=n._serverApps=new Map,H=n._components=new Map;function U(e,t){try{e.container.addComponent(t)}catch(n){d.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function W(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 L.values())U(t,e);for(const t of G.values())U(t,e);return!0}function q(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.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 i.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,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new s.Component("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw V.create("app-deleted",{appName:this._name})}}
/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Y extends z{constructor(e,t,n,s){const a=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,i={name:n,automaticDataCollectionEnabled:a};if(e.apiKey!==undefined)super(e,i,s);else{super(e.options,i,s)}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.
 */n.SDK_VERSION="11.2.0";function J(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:R,automaticDataCollectionEnabled:!1},t),r=a.name;if("string"!=typeof r||!r)throw V.create("bad-app-name",{appName:String(r)});if(n||(n=(0,i.getDefaultAppConfig)()),!n)throw V.create("no-options");const o=L.get(r);if(o){if((0,i.deepEqual)(n,o.options)&&(0,i.deepEqual)(a,o.config))return o;throw V.create("duplicate-app",{appName:r})}const c=new s.ComponentContainer(r);for(const e of H.values())c.addComponent(e);const l=new z(n,a,c);return L.set(r,l),l}async function Q(e){let t=!1;const n=e.name;if(L.has(n))t=!0,L.delete(n);else if(G.has(n)){e.decRefCount()<=0&&(G.delete(n),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function X(e,t,n){var a;let i=null!==(a=B[e])&&void 0!==a?a:e;n&&(i+=`-${n}`);const r=i.match(/\s|\//),o=t.match(/\s|\//);if(r||o){const e=[`Unable to register library "${i}" with version "${t}":`];return r&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),r&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void d.warn(e.join(" "))}W(new s.Component(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,r.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw V.create("idb-open",{originalErrorMessage:e.message})})),ee}async function ne(e,t){try{const n=(await te()).transaction(Z,"readwrite"),s=n.objectStore(Z);await s.put(t,se(e)),await n.done}catch(e){if(e instanceof i.FirebaseError)d.warn(e.message);else{const t=V.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}function se(e){return`${e.name}!${e.options.appId}`}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ae{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new re(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=ie();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(e=>e.date===s))return;return this._heartbeatsCache.heartbeats.push({date:s,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}catch(e){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=ie(),{heartbeatsToSend:n,unsentEntries:s}=function(e,t=1024){const n=[];let s=e.slice();for(const a of e){const e=n.find(e=>e.agent===a.agent);if(e){if(e.dates.push(a.date),oe(n)>t){e.dates.pop();break}}else if(n.push({agent:a.agent,dates:[a.date]}),oe(n)>t){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),a=(0,i.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(e){return d.warn(e),""}}}function ie(){return(new Date).toISOString().substring(0,10)}class re{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,i.isIndexedDBAvailable)()&&(0,i.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),n=await t.objectStore(Z).get(se(e));return await t.done,n}catch(e){if(e instanceof i.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 n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function oe(e){return(0,i.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="",W(new s.Component("platform-logger",e=>new o(e),"PRIVATE")),W(new s.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Provider=n.ComponentContainer=n.Component=void 0;var s=e("@firebase/util");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.Component=class{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};const 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 i{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new s.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),s=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(s)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(s)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e))try{this.getOrInitializeService({instanceIdentifier:a})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=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,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(s)}return s}onInit(e,t){var n;const s=this.normalizeInstanceIdentifier(t),a=null!==(n=this.onInitCallbacks.get(s))&&void 0!==n?n:new Set;a.add(e),this.onInitCallbacks.set(s,a);const i=this.instances.get(s);return i&&e(i,s),()=>{a.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const s of n)try{s(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=e,s===a?undefined:s),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var s;return n||null}normalizeInstanceIdentifier(e=a){return this.component?this.component.multipleInstances?e:a:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}n.Provider=i;n.ComponentContainer=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new i(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/component",file:"node_modules/@firebase/component/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deleteInstallations=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function(e){const{appConfig:t}=e,n=await H(t,e=>e&&0===e.registrationStatus?undefined:e);if(n){if(1===n.registrationStatus)throw p.create("delete-pending-registration");if(2===n.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 n=function(e,{fid:t}){return`${k(e)}/${t}`}(e,t),s=T(e,t),a={method:"DELETE",headers:s},i=await _(()=>fetch(n,a));if(!i.ok)throw await w("Delete Installation",i)}(t,n),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.
 */,n.getId=J,n.getInstallations=
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,s.getApp)()){return(0,s._getProvider)(e,"installations").getImmediate()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getToken=Q,n.onIdChange=function(e,t){const{appConfig:n}=e;return function(e,t){O();const n=S(e);let s=C.get(n);s||(s=new Set,C.set(n,s));s.add(t)}(n,t),()=>{!function(e,t){const n=S(e),s=C.get(n);if(!s)return;s.delete(t),0===s.size&&C.delete(n);N()}(n,t)}};var s=e("@firebase/app"),a=e("@firebase/component"),i=e("@firebase/util"),r=e("idb");const o="@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 i.ErrorFactory("installations","Installations",f);function g(e){return e instanceof i.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 n=(await t.json()).error;return p.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function y({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function T(e,{refreshToken:t}){const n=y(e);return n.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)),n}async function _(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 x(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 E=/^[cdef][\w-]{21}$/,v="";function I(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e);return E.test(t)?t:v}catch(e){return v}}function S(e){return`${e.appName}!${e.appId}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const C=new Map;function A(e,t){const n=S(e);j(n,t),function(e,t){const n=O();n&&n.postMessage({key:e,fid:t});N()}(n,t)}function j(e,t){const n=C.get(e);if(n)for(const e of n)e(t)}let P=null;function O(){return!P&&"BroadcastChannel"in self&&(P=new BroadcastChannel("[Firebase] FID Change"),P.onmessage=e=>{j(e.data.key,e.data.fid)}),P}function N(){0===C.size&&P&&(P.close(),P=null)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const F="firebase-installations-database",M=1,D="firebase-installations-store";let R=null;function B(){return R||(R=(0,r.openDB)(F,M,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(D)}})),R}async function L(e,t){const n=S(e),s=(await B()).transaction(D,"readwrite"),a=s.objectStore(D),i=await a.get(n);return await a.put(t,n),await s.done,i&&i.fid===t.fid||A(e,t.fid),t}async function G(e){const t=S(e),n=(await B()).transaction(D,"readwrite");await n.objectStore(D).delete(t),await n.done}async function H(e,t){const n=S(e),s=(await B()).transaction(D,"readwrite"),a=s.objectStore(D),i=await a.get(n),r=t(i);return r===undefined?await a.delete(n):await a.put(r,n),await s.done,!r||i&&i.fid===r.fid||A(e,r.fid),r}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e){let t;const n=await H(e.appConfig,n=>{const s=function(e){const t=e||{fid:I(),registrationStatus:0};return $(t)}(n),a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(p.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const s=k(e),a=y(e),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const r={fid:n,authVersion:m,appId:e.appId,sdkVersion:d},o={method:"POST",headers:a,body:JSON.stringify(r)},c=await _(()=>fetch(s,o));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:b(e.authToken)}}throw await w("Create Installation",c)}(e,t);return L(e.appConfig,n)}catch(n){throw g(n)&&409===n.customData.serverCode?await G(e.appConfig):await L(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:s}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:W(e)}:{installationEntry:t}}(e,s);return t=a.registrationPromise,a.installationEntry});return n.fid===v?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function W(e){let t=await q(e.appConfig);for(;1===t.registrationStatus;)await x(100),t=await q(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await U(e);return n||t}return t}function q(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},n){const s=function(e,{fid:t}){return`${k(e)}/${t}/authTokens:generate`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e,n),a=T(e,n),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const r={installation:{sdkVersion:d,appId:e.appId}},o={method:"POST",headers:a,body:JSON.stringify(r)},c=await _(()=>fetch(s,o));if(c.ok){return b(await c.json())}throw await w("Generate Auth Token",c)}async function V(e,t=!1){let n;const s=await H(e.appConfig,s=>{if(!Y(s))throw p.create("not-registered");const a=s.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+h}(e)}(a))return s;if(1===a.requestStatus)return n=async function(e,t){let n=await z(e.appConfig);for(;1===n.authToken.requestStatus;)await x(100),n=await z(e.appConfig);const s=n.authToken;return 0===s.requestStatus?V(e,t):s}(e,t),s;{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})}(s);return n=async function(e,t){try{const n=await K(e,t),s=Object.assign(Object.assign({},t),{authToken:n});return await L(e.appConfig,s),n}catch(n){if(!g(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await L(e.appConfig,n)}else await G(e.appConfig);throw n}}(e,t),t}});return n?await n:s.authToken}function z(e){return H(e,e=>{if(!Y(e))throw p.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+l<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */})}function Y(e){return e!==undefined&&2===e.registrationStatus}async function J(e){const t=e,{installationEntry:n,registrationPromise:s}=await U(t);return s?s.catch(console.error):V(t).catch(console.error),n.fid}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Q(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await U(e);t&&await t}(n);return(await V(n,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(),n=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw X(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:(0,s._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),n=(0,s._getProvider)(t,Z).getImmediate();return{getId:()=>J(n),getToken:e=>Q(n,e)}};(0,s._registerComponent)(new a.Component(Z,ee,"PUBLIC")),(0,s._registerComponent)(new a.Component("installations-internal",te,"PRIVATE")),(0,s.registerVersion)(o,c),(0,s.registerVersion)(o,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const s=[];var a;n.LogLevel=void 0,(a=n.LogLevel||(n.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 i={debug:n.LogLevel.DEBUG,verbose:n.LogLevel.VERBOSE,info:n.LogLevel.INFO,warn:n.LogLevel.WARN,error:n.LogLevel.ERROR,silent:n.LogLevel.SILENT},r=n.LogLevel.INFO,o={[n.LogLevel.DEBUG]:"log",[n.LogLevel.VERBOSE]:"log",[n.LogLevel.INFO]:"info",[n.LogLevel.WARN]:"warn",[n.LogLevel.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const s=(new Date).toISOString(),a=o[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${s}]  ${e.name}:`,...n)};n.Logger=class{constructor(e){this.name=e,this._logLevel=r,this._logHandler=c,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?i[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.DEBUG,...e),this._logHandler(this,n.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.VERBOSE,...e),this._logHandler(this,n.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.INFO,...e),this._logHandler(this,n.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.WARN,...e),this._logHandler(this,n.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.ERROR,...e),this._logHandler(this,n.LogLevel.ERROR,...e)}},n.setLogLevel=function(e){s.forEach(t=>{t.setLogLevel(e)})},n.setUserLogHandler=function(e,t){for(const a of s){let s=null;t&&t.level&&(s=i[t.level]),a.userLogHandler=null===e?null:(t,a,...i)=>{const r=i.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!=s?s:t.logLevel)&&e({level:n.LogLevel[a].toLowerCase(),message:r,args:i,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deleteToken=function(e){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return async function(e){if(!navigator)throw A.create("only-available-in-window");e.swRegistration||await G(e);return async function(e){const t=await v(e.firebaseDependencies);t&&(await j(e.firebaseDependencies,t.token),await async function(e){const t=S(e),n=(await E()).transaction(_,"readwrite");await n.objectStore(_).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();if(n)return n.unsubscribe();return!0}(e)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=(0,i.getModularInstance)(e))},n.getMessaging=
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,r.getApp)()){return z().then(e=>{if(!e)throw A.create("unsupported-browser")},e=>{throw A.create("indexed-db-unsupported")}),(0,r._getProvider)((0,i.getModularInstance)(e),"messaging").getImmediate()},n.getToken=async function(e,t){return H(e=(0,i.getModularInstance)(e),t)},n.isSupported=z,n.onMessage=function(e,t){return function(e,t){if(!navigator)throw A.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,i.getModularInstance)(e),t)},e("@firebase/installations");var s=e("@firebase/component"),a=e("idb"),i=e("@firebase/util"),r=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",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,"/"),n=atob(t),s=new Uint8Array(n.length);for(let e=0;e<n.length;++e)s[e]=n.charCodeAt(e);return s}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(h||(h={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(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",T=1,_="firebase-messaging-store";let x=null;function E(){return x||(x=(0,a.openDB)(y,T,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(_)}})),x}async function v(e){const t=S(e),n=await E(),s=await n.transaction(_).objectStore(_).get(t);if(s)return s;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(k))return null}let t=null;return(await(0,a.openDB)(k,b,{upgrade:async(n,s,a,i)=>{var r;if(s<2)return;if(!n.objectStoreNames.contains(w))return;const o=i.objectStore(w),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===s){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(r=e.createTime)&&void 0!==r?r: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===s){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===s){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 I(e,t),t}}async function I(e,t){const n=S(e),s=(await E()).transaction(_,"readwrite");return await s.objectStore(_).put(t,n),await s.done,t}function S({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const C={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},A=new i.ErrorFactory("messaging","Messaging",C);async function j(e,t){const n={method:"DELETE",headers:await O(e)};try{const s=await fetch(`${P(e.appConfig)}/${t}`,n),a=await s.json();if(a.error){const e=a.error.message;throw A.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw A.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function P({projectId:e}){return`${d}/projects/${e}/registrations`}async function O({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function N({p256dh:e,auth:t,endpoint:n,vapidKey:s}){const a={web:{endpoint:n,auth:t,p256dh:e}};return s!==l&&(a.web.applicationPubKey=s),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 F=6048e5;async function M(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:g(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:p(t.getKey("auth")),p256dh:p(t.getKey("p256dh"))},s=await v(e.firebaseDependencies);if(s){if(function(e,t){const n=t.vapidKey===e.vapidKey,s=t.endpoint===e.endpoint,a=t.auth===e.auth,i=t.p256dh===e.p256dh;return n&&s&&a&&i}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(s.subscriptionOptions,n))return Date.now()>=s.createTime+F?async function(e,t){try{const n=await async function(e,t){const n=await O(e),s=N(t.subscriptionOptions),a={method:"PATCH",headers:n,body:JSON.stringify(s)};let i;try{const n=await fetch(`${P(e.appConfig)}/${t.token}`,a);i=await n.json()}catch(e){throw A.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw A.create("token-update-failed",{errorInfo:e})}if(!i.token)throw A.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),s=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await I(e.firebaseDependencies,s),n}catch(e){throw e}}(e,{token:s.token,createTime:Date.now(),subscriptionOptions:n}):s.token;try{await j(e.firebaseDependencies,s.token)}catch(e){console.warn(e)}return D(e.firebaseDependencies,n)}return D(e.firebaseDependencies,n)}async function D(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await O(e),s=N(t),a={method:"POST",headers:n,body:JSON.stringify(s)};let i;try{const t=await fetch(P(e.appConfig),a);i=await t.json()}catch(e){throw A.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw A.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw A.create("token-subscribe-no-token");return i.token}(e,t),s={token:n,createTime:Date.now(),subscriptionOptions:t};return await I(e,s),s.token}function R(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const s=t.notification.body;s&&(e.notification.body=s);const a=t.notification.image;a&&(e.notification.image=a);const i=t.notification.icon;i&&(e.notification.icon=i)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,s,a,i,r;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const o=null!==(a=null===(s=t.fcmOptions)||void 0===s?void 0:s.link)&&void 0!==a?a:null===(i=t.notification)||void 0===i?void 0:i.click_action;o&&(e.fcmOptions.link=o);const c=null===(r=t.fcmOptions)||void 0===r?void 0:r.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 A.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
!function(e,t){const n=[];for(let s=0;s<e.length;s++)n.push(e.charAt(s)),s<t.length&&n.push(t.charAt(s));n.join("")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class L{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=function(e){if(!e||!e.options)throw B("App Configuration Object");if(!e.name)throw B("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw B(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function G(e){try{e.swRegistration=await navigator.serviceWorker.register(o,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,n)=>{const s=setTimeout(()=>n(new Error(`Service worker not registered after ${u} ms`)),u),a=e.installing||e.waiting;e.active?(clearTimeout(s),t()):a?a.onstatechange=e=>{var n;"activated"===(null===(n=e.target)||void 0===n?void 0:n.state)&&(a.onstatechange=null,clearTimeout(s),t())}:(clearTimeout(s),n(new Error("No incoming service worker found.")))})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e.swRegistration)}catch(e){throw A.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 A.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw A.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 A.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),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.
 */async function U(e,t,n){const s=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(s,{message_id:n[m],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function W(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===f.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(R(n)):e.onMessageHandler.next(R(n)));const s=n.data;var a;"object"==typeof(a=s)&&a&&m in a&&"1"===s["google.c.a.e"]&&await U(e,n.messageType,s)}const q="@firebase/messaging",$="0.12.16",K=e=>{const t=new L(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>W(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,i.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,i.isIndexedDBAvailable)()&&(0,i.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,r._registerComponent)(new s.Component("messaging",K,"PUBLIC")),(0,r._registerComponent)(new s.Component("messaging-internal",V,"PRIVATE")),(0,r.registerVersion)(q,$),(0,r.registerVersion)(q,$,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/index.sw.cjs",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),e("@firebase/installations");var s=e("@firebase/component"),a=e("idb"),i=e("@firebase/util"),r=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var 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,"/"),n=atob(t),s=new Uint8Array(n.length);for(let e=0;e<n.length;++e)s[e]=n.charCodeAt(e);return s}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(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),n=await k(),s=await n.transaction(p).objectStore(p).get(t);if(s)return s;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(h))return null}let t=null;return(await a.openDB(h,5,{upgrade:async(n,s,a,i)=>{var r;if(s<2)return;if(!n.objectStoreNames.contains(f))return;const o=i.objectStore(f),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===s){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(r=e.createTime)&&void 0!==r?r: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===s){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===s){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 n=y(e),s=(await k()).transaction(p,"readwrite");return await s.objectStore(p).put(t,n),await s.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 T={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},_=new i.ErrorFactory("messaging","Messaging",T);async function x(e,t){const n={method:"DELETE",headers:await v(e)};try{const s=await fetch(`${E(e.appConfig)}/${t}`,n),a=await s.json();if(a.error){const e=a.error.message;throw _.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw _.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function E({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function v({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function I({p256dh:e,auth:t,endpoint:n,vapidKey:s}){const a={web:{endpoint:n,auth:t,p256dh:e}};return s!==o&&(a.web.applicationPubKey=s),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 S(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:u(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:m(t.getKey("auth")),p256dh:m(t.getKey("p256dh"))},s=await b(e.firebaseDependencies);if(s){if(function(e,t){const n=t.vapidKey===e.vapidKey,s=t.endpoint===e.endpoint,a=t.auth===e.auth,i=t.p256dh===e.p256dh;return n&&s&&a&&i}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(s.subscriptionOptions,n))return Date.now()>=s.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await v(e),s=I(t.subscriptionOptions),a={method:"PATCH",headers:n,body:JSON.stringify(s)};let i;try{const n=await fetch(`${E(e.appConfig)}/${t.token}`,a);i=await n.json()}catch(e){throw _.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw _.create("token-update-failed",{errorInfo:e})}if(!i.token)throw _.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),s=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await w(e.firebaseDependencies,s),n}catch(e){throw e}}(e,{token:s.token,createTime:Date.now(),subscriptionOptions:n}):s.token;try{await x(e.firebaseDependencies,s.token)}catch(e){console.warn(e)}return A(e.firebaseDependencies,n)}return A(e.firebaseDependencies,n)}async function C(e){const t=await b(e.firebaseDependencies);t&&(await x(e.firebaseDependencies,t.token),await async function(e){const t=y(e),n=(await k()).transaction(p,"readwrite");await n.objectStore(p).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function A(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await v(e),s=I(t),a={method:"POST",headers:n,body:JSON.stringify(s)};let i;try{const t=await fetch(E(e.appConfig),a);i=await t.json()}catch(e){throw _.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw _.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw _.create("token-subscribe-no-token");return i.token}(e,t),s={token:n,createTime:Date.now(),subscriptionOptions:t};return await w(e,s),s.token}async function j(e,t){const n=function(e,t){var n,s;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===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label)||(a.analytics_label=null===(s=e.fcmOptions)||void 0===s?void 0:s.analytics_label);return a}(t,await e.firebaseDependencies.installations.getId());!function(e,t,n){const s={};s.event_time_ms=Math.floor(Date.now()).toString(),s.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!n||(s.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(n));e.logEvents.push(s)}(e,n,t.productId)}async function P(e,t){const n=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!n)return;t.deliveryMetricsExportedToBigQueryEnabled&&await j(t,n);const s=await N();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(s))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=d.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(s,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:s}=Notification;n&&s&&n.length>s&&console.warn(`This browser only supports ${s} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={[c]:e},t}(n)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const s=t.notification.body;s&&(e.notification.body=s);const a=t.notification.image;a&&(e.notification.image=a);const i=t.notification.icon;i&&(e.notification.icon=i)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,s,a,i,r;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const o=null!==(a=null===(s=t.fcmOptions)||void 0===s?void 0:s.link)&&void 0!==a?a:null===(i=t.notification)||void 0===i?void 0:i.click_action;o&&(e.fcmOptions.link=o);const c=null===(r=t.fcmOptions)||void 0===r?void 0:r.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function O(e){var t,n;const s=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n[c];if(!s)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const a=function(e){var t,n,s;const a=null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(s=e.notification)||void 0===s?void 0:s.click_action;if(a)return a;return i=e.data,"object"==typeof i&&i&&"google.c.a.c_id"in i?self.location.origin:null;var i;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(s);if(!a)return;const i=new URL(a,self.location.href),r=new URL(self.location.origin);if(i.host!==r.host)return;let o=await async function(e){const t=await N();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(i);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 o?o=await o.focus():(o=await self.clients.openWindow(a),await(l=3e3,new Promise(e=>{setTimeout(e,l)}))),o?(s.messageType=d.NOTIFICATION_CLICKED,s.isFirebaseMessaging=!0,o.postMessage(s)):void 0}function N(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function F(e){return _.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e,t){const n=[];for(let s=0;s<e.length;s++)n.push(e.charAt(s)),s<t.length&&n.push(t.charAt(s));n.join("")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class M{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=function(e){if(!e||!e.options)throw F("App Configuration Object");if(!e.name)throw F("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw F(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const D=e=>{const t=new M(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(P(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var n,s;const{newSubscription:a}=e;if(!a)return void await C(t);const i=await b(t.firebaseDependencies);await C(t),t.vapidKey=null!==(s=null===(n=null==i?void 0:i.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==s?s:o,await S(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(O(e))}),t};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function R(){return i.isIndexedDBAvailable()&&await i.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.
 */r._registerComponent(new s.Component("messaging-sw",D,"PUBLIC")),n.experimentalSetDeliveryMetricsExportedToBigQueryEnabled=function(e,t){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=i.getModularInstance(e),t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getMessaging=function(e=r.getApp()){return R().then(e=>{if(!e)throw _.create("unsupported-browser")},e=>{throw _.create("indexed-db-unsupported")}),r._getProvider(i.getModularInstance(e),"messaging-sw").getImmediate()},n.isSupported=R,n.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw _.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=i.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",{_process:"/home/runner/work/metamask-extension/metamask-extension/node_modules/process/browser.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.Sha1=n.RANDOM_FACTOR=n.MAX_VALUE_MILLIS=n.FirebaseError=n.ErrorFactory=n.Deferred=n.DecodeBase64StringError=n.CONSTANTS=void 0,n.areCookiesEnabled=function(){if("undefined"==typeof navigator||!navigator.cookieEnabled)return!1;return!0}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.assertionError=n.assert=void 0,n.async=function(e,t){return(...n)=>{Promise.resolve(!0).then(()=>{e(...n)}).catch(e=>{t&&t(e)})}},n.base64urlEncodeWithoutPadding=n.base64Encode=n.base64Decode=n.base64=void 0,n.calculateBackoffMillis=function(e,t=A,n=j){const s=t*Math.pow(n,e),a=Math.round(O*s*(Math.random()-.5)*2);return Math.min(P,s+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.
 */,n.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.createMockUserToken=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",s=e.iat||0,a=e.sub||e.user_id;if(!a)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:a,user_id:a,firebase:{sign_in_provider:"custom",identities:{}}},e);return[l(JSON.stringify({alg:"none",type:"JWT"})),l(JSON.stringify(i)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.createSubscribe=function(e,t){const n=new I(e,t);return n.subscribe.bind(n)},n.decode=void 0,n.deepCopy=function(e){return m(undefined,e)},n.deepEqual=function e(t,n){if(t===n)return!0;const s=Object.keys(t),a=Object.keys(n);for(const i of s){if(!a.includes(i))return!1;const s=t[i],r=n[i];if(v(s)&&v(r)){if(!e(s,r))return!1}else if(s!==r)return!1}for(const e of a)if(!s.includes(e))return!1;return!0},n.deepExtend=m,n.errorPrefix=C,n.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:undefined)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getExperimentalSetting=n.getDefaults=n.getDefaultEmulatorHostnameAndPort=n.getDefaultEmulatorHost=n.getDefaultAppConfig=void 0,n.getGlobal=h,n.getModularInstance=
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e){return e&&e._delegate?e._delegate:e},n.getUA=k,n.isAdmin=void 0,n.isBrowser=function(){return"undefined"!=typeof window||w()},n.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},n.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},n.isElectron=function(){return k().indexOf("Electron/")>=0},n.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},n.isIE=function(){const e=k();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},n.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},n.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(k())},n.isNode=b,n.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},n.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},n.isSafari=function(){return!b()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},n.isUWP=function(){return k().indexOf("MSAppHost/")>=0},n.isValidTimestamp=n.isValidFormat=void 0,n.isWebWorker=w,n.issuedAtTime=void 0,n.jsonEval=x,n.map=function(e,t,n){const s={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(s[a]=t.call(n,e[a],a,e));return s},n.ordinal=function(e){if(!Number.isFinite(e))return`${e}`;return e+function(e){e=Math.abs(e);const t=e%100;if(t>=10&&t<=20)return"th";const n=e%10;if(1===n)return"st";if(2===n)return"nd";if(3===n)return"rd";return"th"}(e)},n.promiseWithTimeout=
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e,t=2e3){const n=new g;return setTimeout(()=>n.reject("timeout!"),t),e.then(n.resolve,n.reject),n.promise}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.querystring=function(e){const t=[];for(const[n,s]of Object.entries(e))Array.isArray(s)?s.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return t.length?"&"+t.join("&"):""},n.querystringDecode=function(e){const t={},n=e.replace(/^\?/,"").split("&");return n.forEach(e=>{if(e){const[n,s]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(s)}}),t},n.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},n.stringToByteArray=n.stringLength=void 0,n.stringify=function(e){return JSON.stringify(e)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateArgCount=void 0,n.validateCallback=function(e,t,n,s){if(s&&!n)return;if("function"!=typeof n)throw new Error(C(e,t)+"must be a valid function.")},n.validateContextObject=function(e,t,n,s){if(s&&!n)return;if("object"!=typeof n||null===n)throw new Error(C(e,t)+"must be a valid context object.")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(s);a.onsuccess=()=>{a.result.close(),n||self.indexedDB.deleteDatabase(s),e(!0)},a.onupgradeneeded=()=>{n=!1},a.onerror=()=>{var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},n.validateNamespace=function(e,t,n){if(n&&!t)return;if("string"!=typeof t)throw new Error(C(e,"namespace")+"must be a valid firebase namespace.")};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const t=n.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},s=function(e,t){if(!e)throw 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.
 */n.assert=s;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.
 */n.assertionError=a;const i=function(e){const t=[];let n=0;for(let s=0;s<e.length;s++){let a=e.charCodeAt(s);a<128?t[n++]=a:a<2048?(t[n++]=a>>6|192,t[n++]=63&a|128):55296==(64512&a)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++s)),t[n++]=a>>18|240,t[n++]=a>>12&63|128,t[n++]=a>>6&63|128,t[n++]=63&a|128):(t[n++]=a>>12|224,t[n++]=a>>6&63|128,t[n++]=63&a|128)}return t},r=n.base64={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let t=0;t<e.length;t+=3){const a=e[t],i=t+1<e.length,r=i?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,l=a>>2,d=(3&a)<<4|r>>4;let m=(15&r)<<2|c>>6,u=63&c;o||(u=64,i||(m=64)),s.push(n[l],n[d],n[m],n[u])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,s=0;for(;n<e.length;){const a=e[n++];if(a<128)t[s++]=String.fromCharCode(a);else if(a>191&&a<224){const i=e[n++];t[s++]=String.fromCharCode((31&a)<<6|63&i)}else if(a>239&&a<365){const i=((7&a)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[s++]=String.fromCharCode(55296+(i>>10)),t[s++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],r=e[n++];t[s++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&r)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let t=0;t<e.length;){const a=n[e.charAt(t++)],i=t<e.length?n[e.charAt(t)]:0;++t;const r=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==a||null==i||null==r||null==c)throw new o;const l=a<<2|i>>4;if(s.push(l),64!==r){const e=i<<4&240|r>>2;if(s.push(e),64!==c){const e=r<<6&192|c;s.push(e)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class o extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}n.DecodeBase64StringError=o;const c=function(e){const t=i(e);return r.encodeByteArray(t,!0)};n.base64Encode=c;const l=function(e){return c(e).replace(/\./g,"")};n.base64urlEncodeWithoutPadding=l;const d=function(e){try{return r.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 n in t)t.hasOwnProperty(n)&&u(n)&&(e[n]=m(e[n],t[n]));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.
 */n.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}`)}};n.getDefaults=f;const p=e=>{var t,n;return null===(n=null===(t=f())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]};n.getDefaultEmulatorHost=p;n.getDefaultEmulatorHostnameAndPort=e=>{const t=p(e);if(!t)return undefined;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const s=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),s]:[t.substring(0,n),s]};n.getDefaultAppConfig=()=>{var e;return null===(e=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.
 */
n.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,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function k(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function 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}n.Deferred=g;class y extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,T.prototype.create)}}n.FirebaseError=y;class T{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},s=`${this.service}/${e}`,a=this.errors[e],i=a?function(e,t){return e.replace(_,(e,n)=>{const s=t[n];return null!=s?String(s):`<${n}?>`})}(a,n):"Error",r=`${this.serviceName}: ${i} (${s}).`;return new y(s,r,n)}}n.ErrorFactory=T;const _=/\{\$([^}]+)}/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 x(e){return JSON.parse(e)}const E=function(e){let t={},n={},s={},a="";try{const i=e.split(".");t=x(d(i[0])||""),n=x(d(i[1])||""),a=i[2],s=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:s,signature:a}};n.decode=E;n.isValidTimestamp=function(e){const t=E(e).claims,n=Math.floor((new Date).getTime()/1e3);let s=0,a=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?s=t.nbf:t.hasOwnProperty("iat")&&(s=t.iat),a=t.hasOwnProperty("exp")?t.exp:s+86400),!!n&&!!s&&!!a&&n>=s&&n<=a};n.issuedAtTime=function(e){const t=E(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};n.isValidFormat=function(e){const t=E(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function v(e){return null!==e&&"object"==typeof e}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.isAdmin=function(e){const t=E(e).claims;return"object"==typeof t&&!0===t.admin};n.Sha1=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const n=this.W_;if("string"==typeof e)for(let s=0;s<16;s++)n[s]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let s=0;s<16;s++)n[s]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=n[e-3]^n[e-8]^n[e-14]^n[e-16];n[e]=4294967295&(t<<1|t>>>31)}let s,a,i=this.chain_[0],r=this.chain_[1],o=this.chain_[2],c=this.chain_[3],l=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(s=c^r&(o^c),a=1518500249):(s=r^o^c,a=1859775393):e<60?(s=r&o|c&(r|o),a=2400959708):(s=r^o^c,a=3395469782);const t=(i<<5|i>>>27)+s+l+a+n[e]&4294967295;l=c,c=o,o=4294967295&(r<<30|r>>>2),r=i,i=t}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+r&4294967295,this.chain_[2]=this.chain_[2]+o&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 n=t-this.blockSize;let s=0;const a=this.buf_;let i=this.inbuf_;for(;s<t;){if(0===i)for(;s<=n;)this.compress_(e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(a[i]=e.charCodeAt(s),++i,++s,i===this.blockSize){this.compress_(a),i=0;break}}else for(;s<t;)if(a[i]=e[s],++i,++s,i===this.blockSize){this.compress_(a),i=0;break}}this.inbuf_=i,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let n=0;for(let t=0;t<5;t++)for(let s=24;s>=0;s-=8)e[n]=this.chain_[t]>>s&255,++n;return e}};class I{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let s;if(e===undefined&&t===undefined&&n===undefined)throw new Error("Missing Observer.");s=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},s.next===undefined&&(s.next=S),s.error===undefined&&(s.error=S),s.complete===undefined&&(s.complete=S);const a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(e){}}),this.observers.push(s),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 S(){}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function C(e,t){return`${e} failed: ${t} argument `}n.validateArgCount=function(e,t,n,s){let a;if(s<t?a="at least "+t:s>n&&(a=0===n?"none":"no more than "+n),a){throw new Error(e+" failed: Was called with "+s+(1===s?" argument.":" arguments.")+" Expects "+a+".")}};n.stringToByteArray=function(e){const t=[];let n=0;for(let a=0;a<e.length;a++){let i=e.charCodeAt(a);if(i>=55296&&i<=56319){const t=i-55296;a++,s(a<e.length,"Surrogate pair missing trail surrogate.");i=65536+(t<<10)+(e.charCodeAt(a)-56320)}i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):i<65536?(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.stringLength=function(e){let t=0;for(let n=0;n<e.length;n++){const s=e.charCodeAt(n);s<128?t++:s<2048?t+=2:s>=55296&&s<=56319?(t+=4,n++):t+=3}return t};const A=1e3,j=2,P=n.MAX_VALUE_MILLIS=144e5,O=n.RANDOM_FACTOR=.5}).call(this)}).call(this,e("_process"))}}},{package:"@metamask/notification-services-controller>firebase>@firebase/util",file:"node_modules/@firebase/util/dist/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});class s{static parse(e){if(""===e)return new s([]);if(!e.startsWith("/"))throw new a(e);const[,...t]=e.split("/");return new s(t.map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~")))}constructor(e){this.tokens=e}toString(){if(0===this.tokens.length)return"";return`/${this.tokens.map(e=>e.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`}shmeval(e){for(const t of this.tokens){if(!e.hasOwnProperty(t))throw new i(e,t);e=e[t]}return e}}n.default=s;class a extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}n.InvalidPtrError=a;class i extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}n.EvalError=i}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver>@json-schema-spec/json-pointer",file:"node_modules/@json-schema-spec/json-pointer/lib/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js",{"@json-schema-tools/reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js","@json-schema-tools/traverse":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js","fast-safe-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-safe-stringify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},s.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(a,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function o(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((s=s.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,s,a,i,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(n=1,s&&(a=2&o[0]?s.return:o[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,o[1])).done)return a;switch(s=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,s=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(6===o[0]&&r.label<a[1]){r.label=a[1],a=o;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(o);break}a[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e],s=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var o=r(e("@json-schema-tools/traverse")),c=r(e("@json-schema-tools/reference-resolver")),l=r(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")};n.NonStringRefError=d;var m=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var n=s(s({},t),e);return delete n.$ref,n}return t},u=function(){function e(e,t){var n;if(void 0===t&&(t={}),this.options=t,this.refCache={},n=!0===this.options.mutate||!0===e||!1===e?e:s({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=n),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=n),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var a=0,i=Object.keys(this.options.protocolHandlerMap);a<i.length;a++){var r=i[a];c.default.protocolHandlerMap[r]=this.options.protocolHandlerMap[r]}this.schema=n,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return a(this,void 0,void 0,function(){return i(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,n,a,r,l,d,u,h,f,p,g,k=this;return i(this,function(i){switch(i.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return k.refCache[e]===undefined}),n=[],a=0,r=t,i.label=1;case 1:return a<r.length?(l=r[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),n.push(u),[4,u];case 4:d=i.sent(),i.label=5;case 5:return!0!==this.options.recursive||!0===d||!1===d||"#"===l?[3,9]:(h=s(s({},this.options),{refCache:this.refCache}),0===(f=new e(d,h)).refs.length?[3,7]:(p=f._resolve(),n.push(p),[4,p]));case 6:return g=i.sent(),this.refCache[l]=m(d,g),[3,8];case 7:this.refCache[l]=d,i.label=8;case 8:return[3,10];case 9:this.refCache[l]=d,i.label=10;case 10:return a++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=m(this.schema,this.refCache[this.schema.$ref]):(0,o.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=k.refCache[e.$ref];return m(e,t)}return e},{mutable:!0}),[4,Promise.all(n)];case 12:return i.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,o.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new d(t);e.push(t.$ref)}return t}),e},e}();n.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,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var a=s(e("./dereferencer")),i=e("./dereferencer");Object.defineProperty(n,"NonStringRefError",{enumerable:!0,get:function(){return i.NonStringRefError}}),n.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.jsonSchema=void 0,n.jsonSchema={$schema:"https://meta.json-schema.tools/",$id:"https://meta.json-schema.tools/",title:"JSONSchema",default:{},oneOf:[{$ref:"#/definitions/JSONSchemaObject"},{$ref:"#/definitions/JSONSchemaBoolean"}],definitions:{JSONSchemaBoolean:{title:"JSONSchemaBoolean",description:"Always valid if true. Never valid if false. Is constant.",type:"boolean"},JSONSchemaObject:{title:"JSONSchemaObject",type:"object",properties:{$id:{title:"$id",type:"string",format:"uri-reference"},$schema:{title:"$schema",type:"string",format:"uri"},$ref:{title:"$ref",type:"string",format:"uri-reference"},$comment:{title:"$comment",type:"string"},title:{title:"title",type:"string"},description:{title:"description",type:"string"},default:!0,readOnly:{title:"readOnly",type:"boolean",default:!1},examples:{title:"examples",type:"array",items:!0},multipleOf:{title:"multipleOf",type:"number",exclusiveMinimum:0},maximum:{title:"maximum",type:"number"},exclusiveMaximum:{title:"exclusiveMaximum",type:"number"},minimum:{title:"minimum",type:"number"},exclusiveMinimum:{title:"exclusiveMinimum",type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{title:"pattern",type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{title:"items",anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{title:"uniqueItems",type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{title:"definitions",type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{title:"properties",type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{title:"patternProperties",type:"object",additionalProperties:{$ref:"#"},propertyNames:{title:"propertyNames",format:"regex"},default:{}},dependencies:{title:"dependencies",type:"object",additionalProperties:{title:"dependenciesSet",anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{title:"enum",type:"array",items:!0,minItems:1,uniqueItems:!0},type:{title:"type",anyOf:[{$ref:"#/definitions/simpleTypes"},{title:"arrayOfSimpleTypes",type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{title:"format",type:"string"},contentMediaType:{title:"contentMediaType",type:"string"},contentEncoding:{title:"contentEncoding",type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}}},schemaArray:{title:"schemaArray",type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{title:"nonNegativeInteger",type:"integer",minimum:0},nonNegativeIntegerDefault0:{title:"nonNegativeIntegerDefaultZero",type:"integer",minimum:0,default:0},simpleTypes:{title:"simpleTypes",type:"string",enum:["array","boolean","integer","null","number","object","string"]},stringArray:{title:"stringArray",type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}},n.default=n.jsonSchema}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/meta-schema",file:"node_modules/@json-schema-tools/meta-schema/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js",{"./errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js","isomorphic-fetch":"/home/runner/work/metamask-extension/metamask-extension/node_modules/isomorphic-fetch/fetch-npm-browserify.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(a,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function o(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((s=s.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,s,a,i,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(n=1,s&&(a=2&o[0]?s.return:o[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,o[1])).done)return a;switch(s=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,s=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(6===o[0]&&r.label<a[1]){r.label=a[1],a=o;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(o);break}a[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e],s=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./errors"),o=i(e("isomorphic-fetch")),c=function(e){return s(void 0,void 0,void 0,function(){var t,n;return a(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,(0,o.default)(e)];case 1:return t=s.sent(),[3,3];case 2:throw s.sent(),new r.InvalidRemoteURLError(e);case 3:return s.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,s.sent()];case 5:throw n=s.sent(),new r.NonJsonRefError({$ref:e},n.message);case 6:return[2]}})})};n.default={https:c,http:c}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidFileSystemPathError=n.InvalidRemoteURLError=n.NotResolvableError=n.NonJsonRefError=void 0;var s=function(e,t){this.name="NonJsonRefError",this.message=["NonJsonRefError","The resolved value at the reference: ".concat(e.$ref," was not JSON.parse 'able"),"The non-json content in question: ".concat(t)].join("\n")};n.NonJsonRefError=s;var 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")};n.NotResolvableError=a;var i=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};n.InvalidRemoteURLError=i;var r=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};n.InvalidFileSystemPathError=r}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/errors.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js",{"./default-protocol-handler-map":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js","./reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},s.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(a,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function o(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((s=s.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,s,a,i,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(n=1,s&&(a=2&o[0]?s.return:o[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,o[1])).done)return a;switch(s=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,s=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(6===o[0]&&r.label<a[1]){r.label=a[1],a=o;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(o);break}a[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e],s=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var o=r(e("./default-protocol-handler-map")),c=r(e("./reference-resolver")),l=s(s({},o.default),{file:function(){return a(void 0,void 0,void 0,function(){return i(this,function(e){return[2,undefined]})})}});n.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,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(a,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function o(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((s=s.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,s,a,i,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(n=1,s&&(a=2&o[0]?s.return:o[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,o[1])).done)return a;switch(s=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,s=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(6===o[0]&&r.label<a[1]){r.label=a[1],a=o;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(o);break}a[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e],s=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./errors"),o=i(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return s(this,arguments,void 0,function(e,t){var n,s,i,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,o.default)(e,t))];(n=e.split("#")).length>1&&(s=n[n.length-1]),i=n[0],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(i,t)];case 2:return c=a.sent(),[3,4];case 3:throw l=a.sent(),new r.NonJsonRefError({$ref:e},l.message);case 4:if(c!==undefined)return f=c,s&&(f=(0,o.default)(s,f)),[2,f];if(!1===e.includes("://"))throw new r.InvalidFileSystemPathError(e);d=0,m=Object.keys(this.protocolHandlerMap),a.label=5;case 5:return d<m.length?(u=m[d],i.startsWith(u)?[4,this.protocolHandlerMap[u](i,t)]:[3,7]):[3,8];case 6:if((h=a.sent())!==undefined)return f=h,s&&(f=(0,o.default)(s,f)),[2,f];a.label=7;case 7:return d++,[3,5];case 8:throw new r.NotResolvableError(e)}})})},e}();n.default=c}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js",{"@json-schema-spec/json-pointer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidJsonPointerRefError=void 0;var a=s(e("@json-schema-spec/json-pointer")),i=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};n.InvalidJsonPointerRefError=i,n.default=function(e,t){try{var n=e.replace("#","");return a.default.parse(n).shmeval(t)}catch(t){throw new i(e,t.message)}}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},s.apply(this,arguments)},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var s,a=0,i=t.length;a<i;a++)!s&&a in t||(s||(s=Array.prototype.slice.call(t,0,a)),s[a]=t[a]);return e.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(n,"__esModule",{value:!0}),n.defaultOptions=void 0,n.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var i=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},r=function(e,t){var n=t.find(function(t){return t===e});return n||!1},o=function(e,t){return void 0===t&&(t=1),e[e.length-t]};n.default=function e(t,c,l,d,m,u,h,f,p){void 0===l&&(l=n.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=s(s({},n.defaultOptions),l);if(0===d&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===d?t:c(t,!1,i(h),o(u));var k=t;!1===g.mutable&&(k=s({},t)),u.push(k),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===d||(k=c(k,!1,i(h),o(u,2)))),m.push(t),f.push([t,k]);var b=function(t,n){var s=r(t,m);return s?(p.push(s),!0===g.skipFirstMutation&&s===m[0]?c(t,!0,i(n),o(u)):f.find(function(e){var t=e[0];return s===t})[1]):e(t,c,l,d+1,m,u,n,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=r(t.items,m);if(w)if(p.push(w),!0===g.skipFirstMutation&&w===m[0])k.items=c(t.items,!0,i(h),o(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 T=t.properties,_={};Object.keys(t.properties).forEach(function(e){_[e]=b(T[e],a(a([],h,!0),["properties",e.toString()],!1))}),k.properties=_}if(t.patternProperties!==undefined){var x=t.patternProperties,E={};Object.keys(t.patternProperties).forEach(function(e){E[e]=b(x[e],a(a([],h,!0),["patternProperties",e.toString()],!1))}),k.patternProperties=E}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 v=-1!==p.indexOf(t);return u.pop(),c(k,v,i(h),o(u))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/dist/accounts-api-service/accounts-api-service.cjs",{"@metamask/base-data-service":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AccountsApiService=n.serviceName=void 0;const s=e("@metamask/base-data-service"),a=e("@metamask/controller-utils"),i=e("@metamask/superstruct"),r=e("@metamask/utils");n.serviceName="AccountsApiService";const o=["fetchMultiAccountTransactionsV4"],c=(0,i.type)({unprocessedNetworks:(0,i.array)((0,i.string)()),pageInfo:(0,i.type)({count:(0,i.number)(),hasPreviousPage:(0,i.boolean)(),hasNextPage:(0,i.boolean)(),startCursor:(0,i.optional)((0,i.nullable)((0,i.string)())),endCursor:(0,i.optional)((0,i.nullable)((0,i.string)()))}),data:(0,i.array)((0,i.type)({hash:(0,i.string)(),timestamp:(0,i.string)(),chainId:(0,i.number)(),blockNumber:(0,i.number)(),blockHash:(0,i.string)(),gas:(0,i.number)(),gasUsed:(0,i.number)(),gasPrice:(0,i.string)(),effectiveGasPrice:(0,i.string)(),nonce:(0,i.number)(),cumulativeGasUsed:(0,i.number)(),methodId:(0,i.optional)((0,i.nullable)((0,i.string)())),value:(0,i.string)(),to:(0,i.string)(),from:(0,i.string)(),isError:(0,i.optional)((0,i.boolean)()),valueTransfers:(0,i.optional)((0,i.array)((0,i.type)({from:(0,i.string)(),to:(0,i.string)(),amount:(0,i.string)(),decimal:(0,i.number)(),contractAddress:(0,i.optional)((0,i.string)()),symbol:(0,i.string)(),name:(0,i.string)(),transferType:(0,i.string)()}))),logs:(0,i.optional)((0,i.array)((0,i.type)({data:(0,i.string)(),topics:(0,i.array)((0,i.string)()),address:(0,i.string)(),logIndex:(0,i.number)()}))),transactionType:(0,i.optional)((0,i.string)()),transactionCategory:(0,i.optional)((0,i.string)()),transactionProtocol:(0,i.optional)((0,i.string)())}))});class l extends s.BaseDataService{constructor({messenger:e,queryClientConfig:t={},policyOptions:s={}}){super({name:n.serviceName,messenger:e,queryClientConfig:t,policyOptions:s}),this.messenger.registerMethodActionHandlers(this,o)}async fetchMultiAccountTransactionsV4(e,t,n){const s={accountAddresses:[...e.accountAddresses].sort(),...t};let o;if(t?.networks&&(s.networks=[...t.networks].sort()),e){o=new URL("/v4/multiaccount/transactions","https://accounts.api.cx.metamask.io");for(const[e,t]of Object.entries(s))t!==undefined&&o.searchParams.append(e,Array.isArray(t)?t.join(","):t.toString())}const l=await this.fetchInfiniteQuery({queryKey:[`${this.name}:fetchMultiAccountTransactionsV4`,s],queryFn:async({signal:e})=>{const t=await fetch(o,{signal:e});if(!t.ok)throw new a.HttpError(t.status,`Accounts API failed with status '${t.status}'`);return t.json()},staleTime:(0,r.inMilliseconds)(30,r.Duration.Second),getPreviousPageParam:({pageInfo:e})=>e.hasPreviousPage?{before:e.startCursor}:undefined,getNextPageParam:({pageInfo:e})=>e.hasNextPage?e.endCursor:undefined},n),[d,m]=(0,i.validate)(l,c);if(d)throw new Error(`Malformed response received from Accounts API: ${d.failures().map(e=>`At ${e.path.join(".")}->${e.key}, ${e.message}`).join("; ")}`);return m}}n.AccountsApiService=l}}},{package:"@metamask-previews/accounts-api",file:"node_modules/@metamask-previews/accounts-api/dist/accounts-api-service/accounts-api-service.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/dist/index.cjs",{"./accounts-api-service/accounts-api-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/dist/accounts-api-service/accounts-api-service.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AccountsApiService=void 0;var s=e("./accounts-api-service/accounts-api-service.cjs");Object.defineProperty(n,"AccountsApiService",{enumerable:!0,get:function(){return s.AccountsApiService}})}}},{package:"@metamask-previews/accounts-api",file:"node_modules/@metamask-previews/accounts-api/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/constants.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.CHAIN_IDS_WITH_NO_NATIVE_TOKEN=n.DAYS=n.DAY=n.HOURS=n.HOUR=n.MINUTES=n.MINUTE=n.SECONDS=n.SECOND=n.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP=n.ApprovalType=n.ORIGIN_METAMASK=n.NFT_API_TIMEOUT=n.NFT_API_VERSION=n.NFT_API_BASE_URL=n.OPENSEA_PROXY_URL=n.NETWORKS_BYPASSING_VALIDATION=n.BUILT_IN_NETWORKS=n.BUILT_IN_CUSTOM_NETWORKS_RPC=n.TESTNET_TICKER_SYMBOLS=n.ASSET_TYPES=n.GWEI=n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID=n.ERC1155_METADATA_URI_INTERFACE_ID=n.ERC1155_INTERFACE_ID=n.ERC721_ENUMERABLE_INTERFACE_ID=n.ERC721_METADATA_INTERFACE_ID=n.ERC721_INTERFACE_ID=n.ERC20=n.ERC1155=n.ERC721=n.MAX_SAFE_CHAIN_ID=n.GANACHE_CHAIN_ID=n.IPFS_DEFAULT_GATEWAY_URL=n.FALL_BACK_VS_CURRENCY=n.RPC=void 0;const s=e("./types.cjs");var a;n.RPC="rpc",n.FALL_BACK_VS_CURRENCY="ETH",n.IPFS_DEFAULT_GATEWAY_URL="https://cloudflare-ipfs.com/ipfs/",n.GANACHE_CHAIN_ID="0x539",n.MAX_SAFE_CHAIN_ID=0xfffffffffffec,n.ERC721="ERC721",n.ERC1155="ERC1155",n.ERC20="ERC20",n.ERC721_INTERFACE_ID="0x80ac58cd",n.ERC721_METADATA_INTERFACE_ID="0x5b5e139f",n.ERC721_ENUMERABLE_INTERFACE_ID="0x780e9d63",n.ERC1155_INTERFACE_ID="0xd9b67a26",n.ERC1155_METADATA_URI_INTERFACE_ID="0x0e89341c",n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID="0x4e2312e0",n.GWEI="gwei",n.ASSET_TYPES={NATIVE:"NATIVE",TOKEN:"TOKEN",NFT:"NFT",UNKNOWN:"UNKNOWN"},n.TESTNET_TICKER_SYMBOLS={GOERLI:"GoerliETH",SEPOLIA:"SepoliaETH",LINEA_GOERLI:"LineaETH",LINEA_SEPOLIA:"LineaETH",MEGAETH_TESTNET:"MegaETH",MEGAETH_TESTNET_V2:"MegaETH"},n.BUILT_IN_CUSTOM_NETWORKS_RPC={MEGAETH_TESTNET:"https://carrot.megaeth.com/rpc","megaeth-testnet":"https://carrot.megaeth.com/rpc","megaeth-testnet-v2":"https://carrot.megaeth.com/rpc","monad-testnet":"https://testnet-rpc.monad.xyz"},n.BUILT_IN_NETWORKS={[s.NetworkType.goerli]:{chainId:s.ChainId.goerli,ticker:s.NetworksTicker.goerli,rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl.goerli}},[s.NetworkType.sepolia]:{chainId:s.ChainId.sepolia,ticker:s.NetworksTicker.sepolia,rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl.sepolia}},[s.NetworkType.mainnet]:{chainId:s.ChainId.mainnet,ticker:s.NetworksTicker.mainnet,rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl.mainnet}},[s.NetworkType["linea-goerli"]]:{chainId:s.ChainId["linea-goerli"],ticker:s.NetworksTicker["linea-goerli"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["linea-goerli"]}},[s.NetworkType["linea-sepolia"]]:{chainId:s.ChainId["linea-sepolia"],ticker:s.NetworksTicker["linea-sepolia"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["linea-sepolia"]}},[s.NetworkType["linea-mainnet"]]:{chainId:s.ChainId["linea-mainnet"],ticker:s.NetworksTicker["linea-mainnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["linea-mainnet"]}},[s.NetworkType["megaeth-testnet"]]:{chainId:s.ChainId["megaeth-testnet"],ticker:s.NetworksTicker["megaeth-testnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["megaeth-testnet"]}},[s.NetworkType["megaeth-testnet-v2"]]:{chainId:s.ChainId["megaeth-testnet-v2"],ticker:s.NetworksTicker["megaeth-testnet-v2"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["megaeth-testnet-v2"]}},[s.NetworkType["monad-testnet"]]:{chainId:s.ChainId["monad-testnet"],ticker:s.NetworksTicker["monad-testnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["monad-testnet"]}},[s.NetworkType["base-mainnet"]]:{chainId:s.ChainId["base-mainnet"],ticker:s.NetworksTicker["base-mainnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["base-mainnet"]}},[s.NetworkType["arbitrum-mainnet"]]:{chainId:s.ChainId["arbitrum-mainnet"],ticker:s.NetworksTicker["arbitrum-mainnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["arbitrum-mainnet"]}},[s.NetworkType["bsc-mainnet"]]:{chainId:s.ChainId["bsc-mainnet"],ticker:s.NetworksTicker["bsc-mainnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["bsc-mainnet"]}},[s.NetworkType["optimism-mainnet"]]:{chainId:s.ChainId["optimism-mainnet"],ticker:s.NetworksTicker["optimism-mainnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["optimism-mainnet"]}},[s.NetworkType["polygon-mainnet"]]:{chainId:s.ChainId["polygon-mainnet"],ticker:s.NetworksTicker["polygon-mainnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["polygon-mainnet"]}},[s.NetworkType["sei-mainnet"]]:{chainId:s.ChainId["sei-mainnet"],ticker:s.NetworksTicker["sei-mainnet"],rpcPrefs:{blockExplorerUrl:s.BlockExplorerUrl["sei-mainnet"]}},[s.NetworkType.rpc]:{chainId:undefined,blockExplorerUrl:undefined,ticker:undefined,rpcPrefs:undefined}},n.NETWORKS_BYPASSING_VALIDATION={"0x3e7":{name:"HyperEVM",symbol:"HYPE",rpcUrl:"https://rpc.hyperliquid.xyz"}},n.OPENSEA_PROXY_URL="https://proxy.api.cx.metamask.io/opensea/v1/api/v2",n.NFT_API_BASE_URL="https://nft.api.cx.metamask.io",n.NFT_API_VERSION="1",n.NFT_API_TIMEOUT=15e3,n.ORIGIN_METAMASK="metamask",function(e){e.AddEthereumChain="wallet_addEthereumChain",e.ConnectAccounts="connect_accounts",e.EthDecrypt="eth_decrypt",e.EthGetEncryptionPublicKey="eth_getEncryptionPublicKey",e.EthSignTypedData="eth_signTypedData",e.PersonalSign="personal_sign",e.ResultError="result_error",e.ResultSuccess="result_success",e.SnapDialogAlert="snap_dialog:alert",e.SnapDialogConfirmation="snap_dialog:confirmation",e.SnapDialogPrompt="snap_dialog:prompt",e.SnapDialogDefault="snap_dialog",e.SwitchEthereumChain="wallet_switchEthereumChain",e.Transaction="transaction",e.TransactionBatch="transaction_batch",e.Unlock="unlock",e.WalletConnect="wallet_connect",e.WalletRequestPermissions="wallet_requestPermissions",e.WatchAsset="wallet_watchAsset"}(a||(n.ApprovalType=a={})),n.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP={[s.ChainId.goerli]:s.BuiltInNetworkName.Goerli,[s.ChainId.sepolia]:s.BuiltInNetworkName.Sepolia,[s.ChainId.mainnet]:s.BuiltInNetworkName.Mainnet,[s.ChainId["linea-goerli"]]:s.BuiltInNetworkName.LineaGoerli,[s.ChainId["linea-sepolia"]]:s.BuiltInNetworkName.LineaSepolia,[s.ChainId["linea-mainnet"]]:s.BuiltInNetworkName.LineaMainnet,[s.ChainId.aurora]:s.BuiltInNetworkName.Aurora},n.SECOND=1e3,n.SECONDS=n.SECOND,n.MINUTE=60*n.SECONDS,n.MINUTES=n.MINUTE,n.HOUR=60*n.MINUTES,n.HOURS=n.HOUR,n.DAY=24*n.HOURS,n.DAYS=n.DAY,n.CHAIN_IDS_WITH_NO_NATIVE_TOKEN=["eip155:42431","eip155:4217"]}}},{package:"@metamask-previews/accounts-api>@metamask/controller-utils",file:"node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/create-service-policy.cjs",{cockatiel:"/home/runner/work/metamask-extension/metamask-extension/node_modules/cockatiel/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createServicePolicy=n.DEFAULT_DEGRADED_THRESHOLD=n.DEFAULT_CIRCUIT_BREAK_DURATION=n.DEFAULT_MAX_CONSECUTIVE_FAILURES=n.DEFAULT_MAX_RETRIES=n.handleWhen=n.handleAll=n.ExponentialBackoff=n.ConstantBackoff=n.CircuitState=n.CockatielEventEmitter=n.BrokenCircuitError=void 0;const s=e("cockatiel");Object.defineProperty(n,"BrokenCircuitError",{enumerable:!0,get:function(){return s.BrokenCircuitError}}),Object.defineProperty(n,"CircuitState",{enumerable:!0,get:function(){return s.CircuitState}}),Object.defineProperty(n,"CockatielEventEmitter",{enumerable:!0,get:function(){return s.EventEmitter}}),Object.defineProperty(n,"ExponentialBackoff",{enumerable:!0,get:function(){return s.ExponentialBackoff}}),Object.defineProperty(n,"ConstantBackoff",{enumerable:!0,get:function(){return s.ConstantBackoff}}),Object.defineProperty(n,"handleAll",{enumerable:!0,get:function(){return s.handleAll}}),Object.defineProperty(n,"handleWhen",{enumerable:!0,get:function(){return s.handleWhen}});const a="available",i="degraded",r="unavailable",o="unknown";n.DEFAULT_MAX_RETRIES=3,n.DEFAULT_MAX_CONSECUTIVE_FAILURES=3*(1+n.DEFAULT_MAX_RETRIES),n.DEFAULT_CIRCUIT_BREAK_DURATION=18e5,n.DEFAULT_DEGRADED_THRESHOLD=5e3;const c=e=>"object"!=typeof e||null===e||!("httpStatus"in e)||"number"!=typeof e.httpStatus||e.httpStatus>=500;function l(e){return e===s.CircuitState.Open?{state:e,openedAt:Date.now()}:{state:e}}n.createServicePolicy=function(e={}){const{maxRetries:t=n.DEFAULT_MAX_RETRIES,retryFilterPolicy:d=s.handleAll,maxConsecutiveFailures:m=n.DEFAULT_MAX_CONSECUTIVE_FAILURES,circuitBreakDuration:u=n.DEFAULT_CIRCUIT_BREAK_DURATION,degradedThreshold:h=n.DEFAULT_DEGRADED_THRESHOLD,backoff:f=new s.ExponentialBackoff}=e;let p=o;const g=(0,s.retry)(d,{maxAttempts:t,backoff:f}),k=g.onRetry.bind(g),b=new s.ConsecutiveBreaker(m),w=(0,s.circuitBreaker)((0,s.handleWhen)(c),{halfOpenAfter:u,breaker:b});let y=l(w.state);w.onStateChange(e=>{y=l(e)}),w.onBreak(()=>{p=r});const T=w.onBreak.bind(w),_=new s.EventEmitter,x=_.addListener,E=new s.EventEmitter,v=E.addListener;return g.onGiveUp(e=>{w.state===s.CircuitState.Closed&&(p=i,_.emit(e))}),g.onSuccess(({duration:e})=>{w.state===s.CircuitState.Closed&&(e>h?(p=i,_.emit()):p!==a&&(p=a,E.emit()))}),{...(0,s.wrap)(g,w),circuitBreakerPolicy:w,circuitBreakDuration:u,getCircuitState:()=>w.state,getRemainingCircuitOpenDuration:()=>y.state===s.CircuitState.Open?y.openedAt+u-Date.now():null,reset:()=>{const{dispose:e}=w.isolate();e(),b.success(),p=o},retryPolicy:g,onBreak:T,onDegraded:x,onAvailable:v,onRetry:k}}}}},{package:"@metamask-previews/accounts-api>@metamask/controller-utils",file:"node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/create-service-policy.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/index.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/constants.cjs","./create-service-policy.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/create-service-policy.cjs","./siwe.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/siwe.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/types.cjs","./util.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/util.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,a)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.convertHexToDecimal=n.BNToHex=n.CHAIN_IDS_WITH_NO_NATIVE_TOKEN=n.NETWORKS_BYPASSING_VALIDATION=n.DAYS=n.DAY=n.HOURS=n.HOUR=n.MINUTES=n.MINUTE=n.SECONDS=n.SECOND=n.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP=n.ApprovalType=n.ORIGIN_METAMASK=n.NFT_API_TIMEOUT=n.NFT_API_VERSION=n.NFT_API_BASE_URL=n.OPENSEA_PROXY_URL=n.BUILT_IN_NETWORKS=n.BUILT_IN_CUSTOM_NETWORKS_RPC=n.TESTNET_TICKER_SYMBOLS=n.ASSET_TYPES=n.GWEI=n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID=n.ERC1155_METADATA_URI_INTERFACE_ID=n.ERC1155_INTERFACE_ID=n.ERC721_ENUMERABLE_INTERFACE_ID=n.ERC721_METADATA_INTERFACE_ID=n.ERC721_INTERFACE_ID=n.ERC20=n.ERC1155=n.ERC721=n.MAX_SAFE_CHAIN_ID=n.GANACHE_CHAIN_ID=n.IPFS_DEFAULT_GATEWAY_URL=n.FALL_BACK_VS_CURRENCY=n.RPC=n.handleWhen=n.handleAll=n.createServicePolicy=n.ExponentialBackoff=n.DEFAULT_MAX_RETRIES=n.DEFAULT_MAX_CONSECUTIVE_FAILURES=n.DEFAULT_DEGRADED_THRESHOLD=n.DEFAULT_CIRCUIT_BREAK_DURATION=n.ConstantBackoff=n.CockatielEventEmitter=n.CircuitState=n.BrokenCircuitError=void 0,n.isEqualCaseInsensitive=n.weiHexToGweiDec=n.toHex=n.toChecksumHexAddress=n.timeoutFetch=n.successfulFetch=n.safelyExecuteWithTimeout=n.safelyExecute=n.query=n.normalizeEnsName=n.isValidHexAddress=n.isValidJson=n.isSmartContractCode=n.isSafeDynamicKey=n.isSafeChainId=n.isPlainObject=n.isNonEmptyArray=n.HttpError=n.hexToText=n.hexToBN=n.handleFetch=n.gweiDecToWEIBN=n.getBuyURL=n.fromHex=n.fractionBN=n.fetchWithErrorHandling=void 0;var i=e("./create-service-policy.cjs");Object.defineProperty(n,"BrokenCircuitError",{enumerable:!0,get:function(){return i.BrokenCircuitError}}),Object.defineProperty(n,"CircuitState",{enumerable:!0,get:function(){return i.CircuitState}}),Object.defineProperty(n,"CockatielEventEmitter",{enumerable:!0,get:function(){return i.CockatielEventEmitter}}),Object.defineProperty(n,"ConstantBackoff",{enumerable:!0,get:function(){return i.ConstantBackoff}}),Object.defineProperty(n,"DEFAULT_CIRCUIT_BREAK_DURATION",{enumerable:!0,get:function(){return i.DEFAULT_CIRCUIT_BREAK_DURATION}}),Object.defineProperty(n,"DEFAULT_DEGRADED_THRESHOLD",{enumerable:!0,get:function(){return i.DEFAULT_DEGRADED_THRESHOLD}}),Object.defineProperty(n,"DEFAULT_MAX_CONSECUTIVE_FAILURES",{enumerable:!0,get:function(){return i.DEFAULT_MAX_CONSECUTIVE_FAILURES}}),Object.defineProperty(n,"DEFAULT_MAX_RETRIES",{enumerable:!0,get:function(){return i.DEFAULT_MAX_RETRIES}}),Object.defineProperty(n,"ExponentialBackoff",{enumerable:!0,get:function(){return i.ExponentialBackoff}}),Object.defineProperty(n,"createServicePolicy",{enumerable:!0,get:function(){return i.createServicePolicy}}),Object.defineProperty(n,"handleAll",{enumerable:!0,get:function(){return i.handleAll}}),Object.defineProperty(n,"handleWhen",{enumerable:!0,get:function(){return i.handleWhen}});var r=e("./constants.cjs");Object.defineProperty(n,"RPC",{enumerable:!0,get:function(){return r.RPC}}),Object.defineProperty(n,"FALL_BACK_VS_CURRENCY",{enumerable:!0,get:function(){return r.FALL_BACK_VS_CURRENCY}}),Object.defineProperty(n,"IPFS_DEFAULT_GATEWAY_URL",{enumerable:!0,get:function(){return r.IPFS_DEFAULT_GATEWAY_URL}}),Object.defineProperty(n,"GANACHE_CHAIN_ID",{enumerable:!0,get:function(){return r.GANACHE_CHAIN_ID}}),Object.defineProperty(n,"MAX_SAFE_CHAIN_ID",{enumerable:!0,get:function(){return r.MAX_SAFE_CHAIN_ID}}),Object.defineProperty(n,"ERC721",{enumerable:!0,get:function(){return r.ERC721}}),Object.defineProperty(n,"ERC1155",{enumerable:!0,get:function(){return r.ERC1155}}),Object.defineProperty(n,"ERC20",{enumerable:!0,get:function(){return r.ERC20}}),Object.defineProperty(n,"ERC721_INTERFACE_ID",{enumerable:!0,get:function(){return r.ERC721_INTERFACE_ID}}),Object.defineProperty(n,"ERC721_METADATA_INTERFACE_ID",{enumerable:!0,get:function(){return r.ERC721_METADATA_INTERFACE_ID}}),Object.defineProperty(n,"ERC721_ENUMERABLE_INTERFACE_ID",{enumerable:!0,get:function(){return r.ERC721_ENUMERABLE_INTERFACE_ID}}),Object.defineProperty(n,"ERC1155_INTERFACE_ID",{enumerable:!0,get:function(){return r.ERC1155_INTERFACE_ID}}),Object.defineProperty(n,"ERC1155_METADATA_URI_INTERFACE_ID",{enumerable:!0,get:function(){return r.ERC1155_METADATA_URI_INTERFACE_ID}}),Object.defineProperty(n,"ERC1155_TOKEN_RECEIVER_INTERFACE_ID",{enumerable:!0,get:function(){return r.ERC1155_TOKEN_RECEIVER_INTERFACE_ID}}),Object.defineProperty(n,"GWEI",{enumerable:!0,get:function(){return r.GWEI}}),Object.defineProperty(n,"ASSET_TYPES",{enumerable:!0,get:function(){return r.ASSET_TYPES}}),Object.defineProperty(n,"TESTNET_TICKER_SYMBOLS",{enumerable:!0,get:function(){return r.TESTNET_TICKER_SYMBOLS}}),Object.defineProperty(n,"BUILT_IN_CUSTOM_NETWORKS_RPC",{enumerable:!0,get:function(){return r.BUILT_IN_CUSTOM_NETWORKS_RPC}}),Object.defineProperty(n,"BUILT_IN_NETWORKS",{enumerable:!0,get:function(){return r.BUILT_IN_NETWORKS}}),Object.defineProperty(n,"OPENSEA_PROXY_URL",{enumerable:!0,get:function(){return r.OPENSEA_PROXY_URL}}),Object.defineProperty(n,"NFT_API_BASE_URL",{enumerable:!0,get:function(){return r.NFT_API_BASE_URL}}),Object.defineProperty(n,"NFT_API_VERSION",{enumerable:!0,get:function(){return r.NFT_API_VERSION}}),Object.defineProperty(n,"NFT_API_TIMEOUT",{enumerable:!0,get:function(){return r.NFT_API_TIMEOUT}}),Object.defineProperty(n,"ORIGIN_METAMASK",{enumerable:!0,get:function(){return r.ORIGIN_METAMASK}}),Object.defineProperty(n,"ApprovalType",{enumerable:!0,get:function(){return r.ApprovalType}}),Object.defineProperty(n,"CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP",{enumerable:!0,get:function(){return r.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP}}),Object.defineProperty(n,"SECOND",{enumerable:!0,get:function(){return r.SECOND}}),Object.defineProperty(n,"SECONDS",{enumerable:!0,get:function(){return r.SECONDS}}),Object.defineProperty(n,"MINUTE",{enumerable:!0,get:function(){return r.MINUTE}}),Object.defineProperty(n,"MINUTES",{enumerable:!0,get:function(){return r.MINUTES}}),Object.defineProperty(n,"HOUR",{enumerable:!0,get:function(){return r.HOUR}}),Object.defineProperty(n,"HOURS",{enumerable:!0,get:function(){return r.HOURS}}),Object.defineProperty(n,"DAY",{enumerable:!0,get:function(){return r.DAY}}),Object.defineProperty(n,"DAYS",{enumerable:!0,get:function(){return r.DAYS}}),Object.defineProperty(n,"NETWORKS_BYPASSING_VALIDATION",{enumerable:!0,get:function(){return r.NETWORKS_BYPASSING_VALIDATION}}),Object.defineProperty(n,"CHAIN_IDS_WITH_NO_NATIVE_TOKEN",{enumerable:!0,get:function(){return r.CHAIN_IDS_WITH_NO_NATIVE_TOKEN}});var o=e("./util.cjs");Object.defineProperty(n,"BNToHex",{enumerable:!0,get:function(){return o.BNToHex}}),Object.defineProperty(n,"convertHexToDecimal",{enumerable:!0,get:function(){return o.convertHexToDecimal}}),Object.defineProperty(n,"fetchWithErrorHandling",{enumerable:!0,get:function(){return o.fetchWithErrorHandling}}),Object.defineProperty(n,"fractionBN",{enumerable:!0,get:function(){return o.fractionBN}}),Object.defineProperty(n,"fromHex",{enumerable:!0,get:function(){return o.fromHex}}),Object.defineProperty(n,"getBuyURL",{enumerable:!0,get:function(){return o.getBuyURL}}),Object.defineProperty(n,"gweiDecToWEIBN",{enumerable:!0,get:function(){return o.gweiDecToWEIBN}}),Object.defineProperty(n,"handleFetch",{enumerable:!0,get:function(){return o.handleFetch}}),Object.defineProperty(n,"hexToBN",{enumerable:!0,get:function(){return o.hexToBN}}),Object.defineProperty(n,"hexToText",{enumerable:!0,get:function(){return o.hexToText}}),Object.defineProperty(n,"HttpError",{enumerable:!0,get:function(){return o.HttpError}}),Object.defineProperty(n,"isNonEmptyArray",{enumerable:!0,get:function(){return o.isNonEmptyArray}}),Object.defineProperty(n,"isPlainObject",{enumerable:!0,get:function(){return o.isPlainObject}}),Object.defineProperty(n,"isSafeChainId",{enumerable:!0,get:function(){return o.isSafeChainId}}),Object.defineProperty(n,"isSafeDynamicKey",{enumerable:!0,get:function(){return o.isSafeDynamicKey}}),Object.defineProperty(n,"isSmartContractCode",{enumerable:!0,get:function(){return o.isSmartContractCode}}),Object.defineProperty(n,"isValidJson",{enumerable:!0,get:function(){return o.isValidJson}}),Object.defineProperty(n,"isValidHexAddress",{enumerable:!0,get:function(){return o.isValidHexAddress}}),Object.defineProperty(n,"normalizeEnsName",{enumerable:!0,get:function(){return o.normalizeEnsName}}),Object.defineProperty(n,"query",{enumerable:!0,get:function(){return o.query}}),Object.defineProperty(n,"safelyExecute",{enumerable:!0,get:function(){return o.safelyExecute}}),Object.defineProperty(n,"safelyExecuteWithTimeout",{enumerable:!0,get:function(){return o.safelyExecuteWithTimeout}}),Object.defineProperty(n,"successfulFetch",{enumerable:!0,get:function(){return o.successfulFetch}}),Object.defineProperty(n,"timeoutFetch",{enumerable:!0,get:function(){return o.timeoutFetch}}),Object.defineProperty(n,"toChecksumHexAddress",{enumerable:!0,get:function(){return o.toChecksumHexAddress}}),Object.defineProperty(n,"toHex",{enumerable:!0,get:function(){return o.toHex}}),Object.defineProperty(n,"weiHexToGweiDec",{enumerable:!0,get:function(){return o.weiHexToGweiDec}}),Object.defineProperty(n,"isEqualCaseInsensitive",{enumerable:!0,get:function(){return o.isEqualCaseInsensitive}}),a(e("./types.cjs"),n),a(e("./siwe.cjs"),n)}}},{package:"@metamask-previews/accounts-api>@metamask/controller-utils",file:"node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/logger.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const s=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return s.createModuleLogger}}),n.projectLogger=(0,s.createProjectLogger)("controller-utils")}}},{package:"@metamask-previews/accounts-api>@metamask/controller-utils",file:"node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/siwe.cjs",{"./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/logger.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","@spruceid/siwe-parser":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@spruceid/siwe-parser/dist/parsers.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.detectSIWE=n.isValidSIWEOrigin=n.parseDomainParts=void 0;const s=e("@metamask/utils"),a=e("@spruceid/siwe-parser"),i=e("./logger.cjs"),r=(0,i.createModuleLogger)(i.projectLogger,"detect-siwe");function o(e){try{const a="string"!=typeof(n=e)?n:(0,s.remove0x)(n),i=t.from(a,"hex");return 32===i.length?e:i.toString("utf8")}catch(t){return r(t),e}var n}const c={"http:":"80","https:":"443"};n.parseDomainParts=(e,t)=>e.match(/^[^/:]*:\/\//u)?new URL(e):new URL(`${t}//${e}`);n.isValidSIWEOrigin=e=>{try{const{origin:t,siwe:s}=e;if(!t||!s?.parsedMessage?.domain)return!1;const a=new URL(t),i=(0,n.parseDomainParts)(s.parsedMessage.domain,a.protocol);return 0===i.hostname.localeCompare(a.hostname,undefined,{sensitivity:"accent"})&&(""!==i.port&&i.port!==a.port?""===a.port&&i.port===c[a.protocol]:""===i.username||i.username===a.username)}catch(e){return r(e),!1}};n.detectSIWE=e=>{try{const{data:t}=e,n=o(t);return{isSIWEMessage:!0,parsedMessage:new a.ParsedMessage(n)}}catch{return{isSIWEMessage:!1,parsedMessage:null}}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask-previews/accounts-api>@metamask/controller-utils",file:"node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/siwe.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a;Object.defineProperty(n,"__esModule",{value:!0}),n.NetworkNickname=n.BlockExplorerUrl=n.NetworksTicker=n.ChainId=n.BuiltInNetworkName=n.isInfuraNetworkType=n.isNetworkType=n.NetworkType=n.CustomNetworkType=n.InfuraNetworkType=void 0,n.InfuraNetworkType={mainnet:"mainnet",goerli:"goerli",sepolia:"sepolia","linea-goerli":"linea-goerli","linea-sepolia":"linea-sepolia","linea-mainnet":"linea-mainnet","base-mainnet":"base-mainnet","arbitrum-mainnet":"arbitrum-mainnet","bsc-mainnet":"bsc-mainnet","optimism-mainnet":"optimism-mainnet","polygon-mainnet":"polygon-mainnet","sei-mainnet":"sei-mainnet"},n.CustomNetworkType={"megaeth-testnet":"megaeth-testnet","megaeth-testnet-v2":"megaeth-testnet-v2","monad-testnet":"monad-testnet"},n.NetworkType={...n.InfuraNetworkType,...n.CustomNetworkType,rpc:"rpc"},n.isNetworkType=function(e){return Object.values(n.NetworkType).includes(e)},n.isInfuraNetworkType=function(e){return Object.keys(n.InfuraNetworkType).includes(e)},function(e){e.Mainnet="mainnet",e.Goerli="goerli",e.Sepolia="sepolia",e.LineaGoerli="linea-goerli",e.LineaSepolia="linea-sepolia",e.LineaMainnet="linea-mainnet",e.Aurora="aurora",e.MegaETHTestnet="megaeth-testnet",e.MegaETHTestnetV2="megaeth-testnet-v2",e.MonadTestnet="monad-testnet",e.BaseMainnet="base-mainnet",e.ArbitrumOne="arbitrum-mainnet",e.BscMainnet="bsc-mainnet",e.OptimismMainnet="optimism-mainnet",e.PolygonMainnet="polygon-mainnet",e.SeiMainnet="sei-mainnet",e.MegaETHMainnet="megaeth-mainnet"}(s||(n.BuiltInNetworkName=s={})),n.ChainId={[s.Mainnet]:"0x1",[s.Goerli]:"0x5",[s.Sepolia]:"0xaa36a7",[s.Aurora]:"0x4e454152",[s.LineaGoerli]:"0xe704",[s.LineaSepolia]:"0xe705",[s.LineaMainnet]:"0xe708",[s.MegaETHTestnet]:"0x18c6",[s.MegaETHTestnetV2]:"0x18c7",[s.MonadTestnet]:"0x279f",[s.BaseMainnet]:"0x2105",[s.ArbitrumOne]:"0xa4b1",[s.BscMainnet]:"0x38",[s.OptimismMainnet]:"0xa",[s.PolygonMainnet]:"0x89",[s.SeiMainnet]:"0x531",[s.MegaETHMainnet]:"0x10e6"},function(e){e.mainnet="ETH",e.goerli="GoerliETH",e.sepolia="SepoliaETH",e["linea-goerli"]="LineaETH",e["linea-sepolia"]="LineaETH",e["linea-mainnet"]="ETH",e["megaeth-testnet"]="MegaETH",e["megaeth-testnet-v2"]="MegaETH",e["monad-testnet"]="MON",e["base-mainnet"]="ETH",e["arbitrum-mainnet"]="ETH",e["bsc-mainnet"]="BNB",e["optimism-mainnet"]="ETH",e["polygon-mainnet"]="POL",e["sei-mainnet"]="SEI",e.rpc=""}(a||(n.NetworksTicker=a={})),n.BlockExplorerUrl={[s.Mainnet]:"https://etherscan.io",[s.Goerli]:"https://goerli.etherscan.io",[s.Sepolia]:"https://sepolia.etherscan.io",[s.LineaGoerli]:"https://goerli.lineascan.build",[s.LineaSepolia]:"https://sepolia.lineascan.build",[s.LineaMainnet]:"https://lineascan.build",[s.MegaETHTestnet]:"https://megaexplorer.xyz",[s.MegaETHTestnetV2]:"https://megaeth-testnet-v2.blockscout.com",[s.MonadTestnet]:"https://testnet.monadexplorer.com",[s.BaseMainnet]:"https://basescan.org",[s.ArbitrumOne]:"https://arbiscan.io",[s.BscMainnet]:"https://bscscan.com",[s.OptimismMainnet]:"https://optimistic.etherscan.io",[s.PolygonMainnet]:"https://polygonscan.com",[s.SeiMainnet]:"https://seitrace.com"},n.NetworkNickname={[s.Mainnet]:"Ethereum Mainnet",[s.Goerli]:"Goerli",[s.Sepolia]:"Sepolia",[s.LineaGoerli]:"Linea Goerli",[s.LineaSepolia]:"Linea Sepolia",[s.LineaMainnet]:"Linea",[s.MegaETHTestnet]:"Mega Testnet",[s.MegaETHTestnetV2]:"MegaETH Testnet",[s.MonadTestnet]:"Monad Testnet",[s.BaseMainnet]:"Base Mainnet",[s.ArbitrumOne]:"Arbitrum One",[s.BscMainnet]:"BSC Mainnet",[s.OptimismMainnet]:"Optimism Mainnet",[s.PolygonMainnet]:"Polygon Mainnet",[s.SeiMainnet]:"Sei Mainnet"}}}},{package:"@metamask-previews/accounts-api>@metamask/controller-utils",file:"node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/util.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/constants.cjs","@metamask/ethjs-unit":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ethjs-unit/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","eth-ens-namehash":"/home/runner/work/metamask-extension/metamask-extension/node_modules/eth-ens-namehash/index.js","fast-deep-equal":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-deep-equal/index.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,n){(function(t){(function(){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.isEqualCaseInsensitive=n.isValidJson=n.isNonEmptyArray=n.isPlainObject=n.convertHexToDecimal=n.query=n.normalizeEnsName=n.timeoutFetch=n.fetchWithErrorHandling=n.handleFetch=n.successfulFetch=n.HttpError=n.isSmartContractCode=n.isValidHexAddress=n.toChecksumHexAddress=n.safelyExecuteWithTimeout=n.safelyExecute=n.toHex=n.fromHex=n.hexToText=n.hexToBN=n.getBuyURL=n.weiHexToGweiDec=n.gweiDecToWEIBN=n.fractionBN=n.BNToHex=n.isSafeChainId=n.isSafeDynamicKey=n.PROTOTYPE_POLLUTION_BLOCKLIST=void 0;const a=e("@metamask/ethjs-unit"),i=e("@metamask/utils"),r=s(e("bn.js")),o=s(e("eth-ens-namehash")),c=s(e("fast-deep-equal")),l=e("lodash"),d=e("./constants.cjs"),m=new Error("timeout");function u(e){return e?new r.default((0,i.remove0x)(e),16):new r.default(0)}n.PROTOTYPE_POLLUTION_BLOCKLIST=["__proto__","constructor","prototype"],n.isSafeDynamicKey=function(e){return"string"==typeof e&&!n.PROTOTYPE_POLLUTION_BLOCKLIST.some(t=>e===t)},n.isSafeChainId=function(e){if(!(0,i.isHexString)(e))return!1;const t=Number.parseInt(e,(0,i.isStrictHexString)(e)?16:10);return Number.isSafeInteger(t)&&t>0&&t<=d.MAX_SAFE_CHAIN_ID},n.BNToHex=function(e){return(0,i.add0x)(e.toString(16))},n.fractionBN=function(e,t,n){const s=new r.default(t),a=new r.default(n);return e.mul(s).div(a)},n.gweiDecToWEIBN=function(e){if(Number.isNaN(e))return new r.default(0);const t=e.toString().split("."),n=t[0]||"0";let s=t[1]||"";if(!s)return(0,a.toWei)(n,"gwei");if(s.length<=9)return(0,a.toWei)(`${n}.${s}`,"gwei");const i=s.slice(9)[0];s=s.slice(0,9);let o=(0,a.toWei)(`${n}.${s}`,"gwei");return Number(i)>=5&&(o=o.add(new r.default(1))),o},n.weiHexToGweiDec=function(e){const t=new r.default((0,i.remove0x)(e),16);return(0,a.fromWei)(t,"gwei")},n.getBuyURL=function(e="1",t,n=5){switch(e){case"1":return`https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${n}&address=${t}&crypto_currency=ETH`;case"5":return"https://goerli-faucet.slock.it/";case"11155111":return"https://sepoliafaucet.net/";default:return undefined}},n.hexToBN=u,n.hexToText=function(e){try{const n=(0,i.remove0x)(e);return t.from(n,"hex").toString("utf8")}catch{return e}},n.fromHex=function(e){return r.default.isBN(e)?e:new r.default(u(e).toString(10))},n.toHex=function(e){return"string"==typeof e&&(0,i.isStrictHexString)(e)?e:`0x${r.default.isBN(e)||"bigint"==typeof e?e.toString(16):new r.default(e.toString(),10).toString(16)}`},n.safelyExecute=async function(e,t=!1){try{return await e()}catch(e){return t&&console.error(e),undefined}},n.safelyExecuteWithTimeout=async function(e,t=!1,n=500){try{return await Promise.race([e(),new Promise((e,t)=>setTimeout(()=>{t(m)},n))])}catch(e){return t&&console.error(e),undefined}},n.toChecksumHexAddress=(0,l.memoize)(function(e){if("string"!=typeof e)return e;const t=(0,i.add0x)(e);if(!(0,i.isHexString)(t))return t;try{return(0,i.getChecksumAddress)(t)}catch(e){if(e instanceof Error&&"Invalid hex address."===e.message)return t;throw e}}),n.isValidHexAddress=(0,l.memoize)(function(e,{allowNonPrefixed:t=!0}={}){const n=t?(0,i.add0x)(e):e;return!!(0,i.isStrictHexString)(n)&&(0,i.isHexChecksumAddress)(n)},(e,{allowNonPrefixed:t=!0}={})=>`${e}-${t}`),n.isSmartContractCode=function(e){return!!e&&("0x"!==e&&"0x0"!==e)};class h extends Error{constructor(e,t){super(t??`Fetch failed with status '${e}'`),this.httpStatus=e}}async function f(e,t){const n=await fetch(e,t);if(!n.ok)throw new h(n.status,`Fetch failed with status '${n.status}' for request '${String(e)}'`);return n}async function p(e,t){const n=await f(e,t);return await n.json()}n.HttpError=h,n.successfulFetch=f,n.handleFetch=p,n.fetchWithErrorHandling=async function({url:e,options:t,timeout:n,errorCodesToCatch:s}){let a;try{a=n?Promise.race([await p(e,t),new Promise((e,t)=>setTimeout(()=>{t(m)},n))]):await p(e,t)}catch(e){!function(e,t=[]){if(!e)return;if(!(e instanceof Error))throw e;if(!t.some(t=>e.message.includes(`Fetch failed with status '${t}'`))&&!e.message.includes("Failed to fetch")&&e!==m)throw e;console.error(e)}(e,s)}return a},n.timeoutFetch=async function(e,t,n=500){return Promise.race([f(e,t),new Promise((e,t)=>setTimeout(()=>{t(m)},n))])},n.normalizeEnsName=function(e){if("."===e)return e;if(e&&"string"==typeof e)try{const t=o.default.normalize(e.trim());if(t.match(/^(([\w\d-]+)\.)*[\w\d-]{7,}\.(eth|test)$/u))return t}catch{}return null},n.query=function(e,t,n=[]){return new Promise((s,a)=>{const i=(e,t)=>{e?a(e):s(t)};t in e&&"function"==typeof e[t]?e[t](...n,i):e.sendAsync({method:t,params:n},i)})};n.convertHexToDecimal=(e="0x0")=>(0,i.isStrictHexString)(e)?parseInt(e,16):Number(e)?Number(e):0,n.isPlainObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)},n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isValidJson=function(e){try{return(0,c.default)(e,JSON.parse(JSON.stringify(e)))}catch{return!1}},n.isEqualCaseInsensitive=function(e,t){return"string"==typeof e&&"string"==typeof t&&e.toLowerCase()===t.toLowerCase()}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask-previews/accounts-api>@metamask/controller-utils",file:"node_modules/@metamask-previews/accounts-api/node_modules/@metamask/controller-utils/dist/util.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=n.controllerName=n.AddressType=void 0;const s=e("@metamask/base-controller"),a=e("@metamask/controller-utils");var i;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(i||(n.AddressType=i={})),n.controllerName="AddressBookController";const r=["list","set","delete","clear"],o={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};n.getDefaultAddressBookControllerState=()=>({addressBook:{}});class c extends s.BaseController{constructor({messenger:e,state:t}){const s={...(0,n.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:o,name:n.controllerName,state:s}),this.messenger.registerMethodActionHandlers(this,r)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,n)=>{const s=n;return[...t,...Object.values(e[s])]},[])}clear(){this.update(e=>{e.addressBook={}})}delete(e,t){if(t=(0,a.toChecksumHexAddress)(t),![e,t].every(e=>(0,a.isSafeDynamicKey)(e))||!(0,a.isValidHexAddress)(t)||!this.state.addressBook[e]?.[t])return!1;const n={...this.state.addressBook[e][t]};return this.update(n=>{const s=n.addressBook[e];s?.[t]&&(delete s[t],0===Object.keys(s).length&&delete n.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",n),!0}set(e,t,n=(0,a.toHex)(1),s="",i){if(e=(0,a.toChecksumHexAddress)(e),!(0,a.isValidHexAddress)(e))return!1;const r={address:e,chainId:n,isEns:!1,memo:s,name:t,addressType:i,lastUpdatedAt:Date.now()},o=(0,a.normalizeEnsName)(t);return o&&(r.name=o,r.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[n]:{...this.state.addressBook[n],[e]:r}}}),"*"!==String(n)&&this.messenger.publish("AddressBookController:contactUpdated",r),!0}}n.AddressBookController=c,n.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=void 0;var s=e("./AddressBookController.cjs");Object.defineProperty(n,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return s.getDefaultAddressBookControllerState}}),Object.defineProperty(n,"AddressBookController",{enumerable:!0,get:function(){return s.AddressBookController}})}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;const r=e("@metamask/base-controller"),o={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class l extends r.BaseController{constructor({messenger:e,state:t,allAnnouncements:n}){const r={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:r}),s.add(this),i(this,s,"m",a).call(this,n)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const n of Object.keys(e).map(Number))t[n].isShown=e[n]})}}n.AnnouncementController=l,s=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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;var s=e("./AnnouncementController.cjs");Object.defineProperty(n,"AnnouncementController",{enumerable:!0,get:function(){return s.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/dist/BaseDataService.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/messenger":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/node_modules/@metamask/messenger/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","@tanstack/query-core":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@tanstack/query-core/build/lib/index.js","fast-deep-equal":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-deep-equal/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},d=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},m=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.BaseDataService=void 0;const u=e("@metamask/controller-utils"),h=(e("@metamask/messenger"),e("@metamask/utils")),f=e("@tanstack/query-core"),p=m(e("fast-deep-equal")),g={retry:!1,staleTime:(0,h.inMilliseconds)(1,h.Duration.Minute)};n.BaseDataService=class{constructor({name:e,messenger:t,queryClientConfig:n={},policyOptions:m}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),this.name=e,l(this,a,t,"f"),this.messenger=t,l(this,r,new f.QueryClient({...n,defaultOptions:{queries:{...g,...n.defaultOptions?.queries},mutations:n.defaultOptions?.mutations}}),"f"),l(this,i,(0,u.createServicePolicy)(m),"f"),l(this,o,d(this,r,"f").getQueryCache().subscribe(e=>{["added","updated","removed"].includes(e.type)&&d(this,s,"m",c).call(this,e.query.queryHash,e.type)}),"f"),d(this,a,"f").registerActionHandler(`${this.name}:invalidateQueries`,this.invalidateQueries.bind(this))}async fetchQuery(e){return d(this,r,"f").fetchQuery({...e,queryFn:t=>d(this,i,"f").execute(()=>e.queryFn(t))})}async fetchInfiniteQuery(e,t){const n=d(this,r,"f").getQueryCache().find({queryKey:e.queryKey});if(!n?.state.data||t===undefined){return(await d(this,r,"f").fetchInfiniteQuery({...e,queryFn:n=>d(this,i,"f").execute(()=>e.queryFn({...n,pageParam:n.pageParam??t}))})).pages[0]}const{pages:s}=n.state.data,a=e.getPreviousPageParam?.(s[0],s),o=(0,p.default)(t,a)?"backward":"forward",c=await n.fetch(undefined,{meta:{fetchMore:{direction:o,pageParam:t}}}),l=c.pageParams.findIndex(e=>(0,p.default)(e,t));return c.pages[l]}async invalidateQueries(e,t){return d(this,r,"f").invalidateQueries(e,t)}destroy(){d(this,o,"f").call(this),this.messenger.clearSubscriptions(),this.messenger.clearActions()}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakSet,c=function(e,t){const n="added"===t||"updated"===t?(0,f.dehydrate)(d(this,r,"f"),{shouldDehydrateQuery:t=>t.queryHash===e}):null;d(this,a,"f").publish(`${this.name}:cacheUpdated`,{type:t,hash:e,state:n}),d(this,a,"f").publish(`${this.name}:cacheUpdated:${e}`,{type:t,state:n})}}}},{package:"@metamask-previews/accounts-api>@metamask/base-data-service",file:"node_modules/@metamask/base-data-service/dist/BaseDataService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/dist/index.cjs",{"./BaseDataService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/dist/BaseDataService.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BaseDataService=void 0;var s=e("./BaseDataService.cjs");Object.defineProperty(n,"BaseDataService",{enumerable:!0,get:function(){return s.BaseDataService}})}}},{package:"@metamask-previews/accounts-api>@metamask/base-data-service",file:"node_modules/@metamask/base-data-service/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/node_modules/@metamask/messenger/dist/Messenger.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p,g,k,b=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},w=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.Messenger=n.MOCK_ANY_NAMESPACE=void 0,n.MOCK_ANY_NAMESPACE="MOCK_ANY_NAMESPACE";n.Messenger=class{constructor({captureException:e,namespace:t,parent:n}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,new Map),o.set(this,new Map),c.set(this,new Map),l.set(this,new Map),d.set(this,new Map),m.set(this,new Map),b(this,a,t,"f"),b(this,i,n,"f"),this.captureException=e??w(this,i,"f")?.captureException}registerActionHandler(e,t){if(!w(this,s,"m",k).call(this,e))throw new Error(`Only allowed registering action handlers prefixed by '${w(this,a,"f")}:'`);w(this,s,"m",u).call(this,e,t),w(this,i,"f")&&this.delegate({actions:[e],messenger:w(this,i,"f")})}registerMethodActionHandlers(e,t){for(const n of t){const t=e[n];if("function"==typeof t){const s=`${e.name}:${n}`;this.registerActionHandler(s,t.bind(e))}}}unregisterActionHandler(e){if(!w(this,s,"m",k).call(this,e))throw new Error(`Only allowed unregistering action handlers prefixed by '${w(this,a,"f")}:'`);w(this,s,"m",h).call(this,e)}clearActions(){for(const e of w(this,r,"f").keys())w(this,s,"m",h).call(this,e)}call(e,...t){const n=w(this,r,"f").get(e);if(!n)throw new Error(`A handler for ${e} has not been registered`);return n(...t)}registerInitialEventPayload({eventType:e,getPayload:t}){if(!w(this,s,"m",k).call(this,e))throw new Error(`Only allowed registering initial payloads for events prefixed by '${w(this,a,"f")}:'`);w(this,i,"f")&&!w(this,c,"f").get(e)?.has(w(this,i,"f"))&&this.delegate({events:[e],messenger:w(this,i,"f")}),w(this,s,"m",f).call(this,{eventType:e,getPayload:t})}publish(e,...t){if(!w(this,s,"m",k).call(this,e))throw new Error(`Only allowed publishing events prefixed by '${w(this,a,"f")}:'`);w(this,i,"f")&&!w(this,c,"f").get(e)?.has(w(this,i,"f"))&&this.delegate({events:[e],messenger:w(this,i,"f")}),w(this,s,"m",p).call(this,e,...t)}subscribe(e,t,n){const a=t;if(w(this,s,"m",g).call(this,e,a,{delegation:!1,selector:n}),n){const t=w(this,d,"f").get(e);if(t){const e=n(...t());w(this,m,"f").set(a,e)}}}unsubscribe(e,t){const n=w(this,o,"f").get(e),s=t;if(!n)throw new Error(`Subscription not found for event: ${e}`);const a=n.get(s);if(!a)throw new Error(`Subscription not found for event: ${e}`);a.selector&&w(this,m,"f").delete(s),n.delete(s)}clearEventSubscriptions(e){const t=w(this,o,"f").get(e);if(t){for(const[e,n]of t.entries())n.delegation||t.delete(e);0===t.size&&w(this,o,"f").delete(e)}}clearSubscriptions(){for(const e of w(this,o,"f").keys())this.clearEventSubscriptions(e)}delegate({actions:e,events:t,messenger:n}){for(const t of e??[]){const e=(...e)=>{const n=w(this,r,"f").get(t);if(!n)throw new Error(`A handler for ${t} has not been registered`);return n(...e)};let s=w(this,l,"f").get(t);if(s||(s=new Set,w(this,l,"f").set(t,s)),s.has(n))throw new Error(`The action '${t}' has already been delegated to this messenger`);s.add(n),n._internalRegisterDelegatedActionHandler(t,e)}for(const e of t??[]){const t=(...t)=>{n._internalPublishDelegated(e,...t)};let a=w(this,c,"f").get(e);if(a||(a=new Map,w(this,c,"f").set(e,a)),a.has(n))throw new Error(`The event '${e}' has already been delegated to this messenger`);a.set(n,t);const i=w(this,d,"f").get(e);i&&n._internalRegisterDelegatedInitialEventPayload({eventType:e,getPayload:i}),w(this,s,"m",g).call(this,e,t,{delegation:!0})}}revoke({actions:e,events:t,messenger:n}){if(n===w(this,i,"f"))throw new Error("Cannot revoke from parent");for(const t of e??[]){const e=w(this,l,"f").get(t);e?.has(n)&&(n._internalUnregisterDelegatedActionHandler(t),e.delete(n),0===e.size&&w(this,l,"f").delete(t))}for(const e of t??[]){const t=w(this,c,"f").get(e);if(!t)continue;const s=t.get(n);s&&(this.unsubscribe(e,s),t.delete(n),0===t.size&&w(this,c,"f").delete(e))}}_internalRegisterDelegatedActionHandler(e,t){w(this,s,"m",u).call(this,e,t)}_internalUnregisterDelegatedActionHandler(e){w(this,s,"m",h).call(this,e)}_internalRegisterDelegatedInitialEventPayload({eventType:e,getPayload:t}){w(this,s,"m",f).call(this,{eventType:e,getPayload:t})}_internalPublishDelegated(e,...t){w(this,s,"m",p).call(this,e,...t)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,s=new WeakSet,u=function(e,t){if(w(this,r,"f").has(e))throw new Error(`A handler for ${e} has already been registered`);w(this,r,"f").set(e,t)},h=function(e){w(this,r,"f").delete(e)},f=function({eventType:e,getPayload:t}){w(this,d,"f").set(e,t);const n=w(this,c,"f").get(e);if(n)for(const s of n.keys())s._internalRegisterDelegatedInitialEventPayload({eventType:e,getPayload:t})},p=function(e,...t){const n=w(this,o,"f").get(e);if(n)for(const[e,{selector:s}]of n.entries())try{if(s){const n=w(this,m,"f").get(e),a=s(...t);a!==n&&(w(this,m,"f").set(e,a),e(a,n))}else e(...t)}catch(e){this.captureException?this.captureException(e instanceof Error?e:new Error(String(e))):console.error(e)}},g=function(e,t,n){let s=w(this,o,"f").get(e);s||(s=new Map,w(this,o,"f").set(e,s)),s.set(t,n)},k=function(e){return w(this,a,"f")===n.MOCK_ANY_NAMESPACE||e.startsWith(`${w(this,a,"f")}:`)}}}},{package:"@metamask-previews/accounts-api>@metamask/base-data-service>@metamask/messenger",file:"node_modules/@metamask/base-data-service/node_modules/@metamask/messenger/dist/Messenger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/node_modules/@metamask/messenger/dist/index.cjs",{"./Messenger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-data-service/node_modules/@metamask/messenger/dist/Messenger.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Messenger=n.MOCK_ANY_NAMESPACE=void 0;var s=e("./Messenger.cjs");Object.defineProperty(n,"MOCK_ANY_NAMESPACE",{enumerable:!0,get:function(){return s.MOCK_ANY_NAMESPACE}}),Object.defineProperty(n,"Messenger",{enumerable:!0,get:function(){return s.Messenger}})}}},{package:"@metamask-previews/accounts-api>@metamask/base-data-service>@metamask/messenger",file:"node_modules/@metamask/base-data-service/node_modules/@metamask/messenger/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/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p,g,k,b,w,y,T,_,x=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},E=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusController=void 0;const v=e("@metamask/bridge-controller"),I=e("@metamask/polling-controller"),S=e("@metamask/transaction-controller"),C=e("@metamask/utils"),A=e("./bridge-status-controller.intent.cjs"),j=e("./constants.cjs"),P=e("./types.cjs"),O=e("./utils/accounts.cjs"),N=e("./utils/authentication.cjs"),F=e("./utils/bridge.cjs"),M=e("./utils/bridge-status.cjs"),D=e("./utils/history.cjs"),R=e("./utils/intent-api.cjs"),B=e("./utils/keyring.cjs"),L=e("./utils/metrics.cjs"),G=e("./utils/network.cjs"),H=e("./utils/snaps.cjs"),U=e("./utils/trace.cjs"),W=e("./utils/transaction.cjs"),q={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class $ extends((0,I.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:n,fetchFn:I,addTransactionBatchFn:$,config:K,traceFn:V}){super({name:j.BRIDGE_STATUS_CONTROLLER_NAME,metadata:q,messenger:e,state:{...j.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),s.set(this,{}),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.set(this,({id:e,actionId:t})=>{let n=this.state.txHistory[e]?e:undefined;if(!n&&t&&this.state.txHistory[t]&&(n=t),n??(n=Object.keys(this.state.txHistory).find(t=>this.state.txHistory[t].approvalTxId===e)),!n)return;const s=n;this.update(e=>{e.txHistory[s].status.status=v.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=j.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=j.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const t=(0,G.getSelectedChainId)(this.messenger);E(this,w,"f").call(this,e,t)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:n}=e;if(!t&&!n)throw new Error("Either txMetaId or txHash must be provided");let a;if(t?this.state.txHistory[t]&&(a=t):n&&(a=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===n)),!a)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${n}`));const i=this.state.txHistory[a],r=i.attempts?.counter??0;if(this.update(e=>{a&&(e.txHistory[a].attempts=undefined)}),(0,D.shouldPollHistoryItem)(i)){if(!E(this,s,"f")[a]&&(E(this,f,"f").call(this,a),!i.featureId)){const e=(0,O.getAccountByAddress)(this.messenger,i.account),t=(0,L.getRequestParamFromHistory)(i),n=(0,L.getRequestMetadataFromHistory)(i,e),{security_warnings:s,...o}=n;E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.PollingStatusUpdated,a,{...(0,L.getTradeDataFromHistory)(i),...(0,L.getPriceImpactFromQuote)(i.quote),...o,chain_id_source:t.chain_id_source,chain_id_destination:t.chain_id_destination,token_symbol_source:t.token_symbol_source,token_symbol_destination:t.token_symbol_destination,action_type:v.MetricsActionType.SWAPBRIDGE_V1,polling_status:v.PollingStatus.ManuallyRestarted,retry_attempts:r})}}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],m.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===v.StatusTypes.PENDING||e.status.status===v.StatusTypes.UNKNOWN).filter(e=>Boolean(e.txMetaId)).filter(e=>!E(this,s,"f")[e.txMetaId]).filter(e=>(0,D.shouldPollHistoryItem)(e)).forEach(e=>{const t=e.txMetaId;(0,M.shouldSkipFetchDueToFetchFailures)(e.attempts)||E(this,f,"f").call(this,t)})}),u.set(this,(...e)=>{const{historyKey:t,txHistoryItem:n}=(0,D.getInitialHistoryItem)(...e);this.update(e=>{e.txHistory[t]=n})}),h.set(this,(e,t)=>{this.update(n=>{(0,D.rekeyHistoryItemInState)(n,e,t)})}),f.set(this,e=>{const t=E(this,s,"f")[e];t&&this.stopPollingByPollingToken(t);const n=this.state.txHistory[e];n&&(0,D.shouldPollHistoryItem)(n)&&(E(this,s,"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");E(this,u,"f").call(this,e),E(this,f,"f").call(this,t.id)},this._executePoll=async e=>{await E(this,g,"f").call(this,e)},p.set(this,e=>{const{attempts:t}=this.state.txHistory[e],n=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},a=E(this,s,"f")[e];if(n.counter>=j.MAX_ATTEMPTS&&a){this.stopPollingByPollingToken(a),delete E(this,s,"f")[e];const t=this.state.txHistory[e];if(t&&!t.featureId){const s=(0,O.getAccountByAddress)(this.messenger,t.account),a=(0,L.getRequestParamFromHistory)(t),i=(0,L.getRequestMetadataFromHistory)(t,s),{security_warnings:r,...o}=i;E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.PollingStatusUpdated,e,{...(0,L.getTradeDataFromHistory)(t),...(0,L.getPriceImpactFromQuote)(t.quote),...o,chain_id_source:a.chain_id_source,chain_id_destination:a.chain_id_destination,token_symbol_source:a.token_symbol_source,token_symbol_destination:a.token_symbol_destination,action_type:v.MetricsActionType.SWAPBRIDGE_V1,polling_status:v.PollingStatus.MaxPollingReached,retry_attempts:n.counter})}}this.update(t=>{t.txHistory[e].attempts=n})}),g.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state,n=t[e];if(n&&!(0,M.shouldSkipFetchDueToFetchFailures)(n.attempts))try{let t,c=[];if(n.quote.intent){const s=await E(this,a,"f").getIntentTransactionStatus(e,n.quote.srcChainId,n.quote.intent.protocol,E(this,i,"f"),n.status.srcChain.txHash);if(null===s?.bridgeStatus||s?.bridgeStatus===undefined)return;t=s.bridgeStatus.status}else{const s=E(this,k,"f").call(this,e);if(!s)return;E(this,b,"f").call(this,e,s);const a=(0,M.getStatusRequestWithSrcTxHash)(n.quote,s),l=await(0,M.fetchBridgeTxStatus)(a,E(this,i,"f"),await(0,N.getJwt)(this.messenger),E(this,r,"f"),E(this,o,"f").customBridgeApiBaseUrl);t=l.status,c=l.validationFailures}if(c.length>0)throw E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:c,refresh_count:n.attempts?.counter??0}),new Error(`Bridge status validation failed: ${c.join(", ")}`);const l={...n,status:t,completionTime:t.status===v.StatusTypes.COMPLETE||t.status===v.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=l}),n.quote.intent&&E(this,a,"f").syncTransactionFromIntentStatus(e,n);const d=E(this,s,"f")[e];if((t.status===v.StatusTypes.COMPLETE||t.status===v.StatusTypes.FAILED)&&d){if(this.stopPollingByPollingToken(d),delete E(this,s,"f")[e],n.featureId)return;t.status===v.StatusTypes.COMPLETE&&(E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",n.quote.destAsset.assetId)),t.status===v.StatusTypes.FAILED&&E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),E(this,p,"f").call(this,e)}}),k.set(this,e=>{const{txHistory:t}=this.state,n=t[e].status.srcChain.txHash;if(n)return n;const s=(0,W.getTransactionMetaById)(this.messenger,e);return s?.hash}),b.set(this,(e,t)=>{const{txHistory:n}=this.state;n[e].status.srcChain.txHash||this.update(n=>{n.txHistory[e].status.srcChain.txHash=t})}),w.set(this,(e,t)=>{const n=Object.keys(this.state.txHistory).filter(n=>{const s=this.state.txHistory[n],a=(0,C.numberToHex)(s.quote.srcChainId);return s.account===e&&a===t});n.forEach(e=>{E(this,s,"f")[e]&&this.stopPollingByPollingToken(E(this,s,"f")[e])}),this.update(e=>{e.txHistory=n.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),y.set(this,async(e,t,n,s,a,i)=>{if(s&&(0,v.isEvmTxData)(s)){const r=async()=>{a&&await(0,W.submitEvmTransaction)({messenger:this.messenger,transactionType:S.TransactionType.bridgeApproval,trade:a});const e=await(0,W.submitEvmTransaction)({messenger:this.messenger,transactionType:t?S.TransactionType.bridgeApproval:S.TransactionType.swapApproval,trade:s,requireApproval:i});return await(0,W.handleApprovalDelay)(n),e};return await E(this,l,"f").call(this,(0,U.getApprovalTraceParams)(e,!1),r)}return undefined}),T.set(this,async e=>{const t=await(0,W.getAddTransactionBatchParams)({messenger:this.messenger,...e});return await(0,W.addTransactionBatch)(this.messenger,E(this,c,"f"),t)}),this.submitTx=async(e,t,n,s,a=v.MetaMetricsSwapsEventSource.MainView,r,o)=>{(0,F.stopPollingForQuotes)(this.messenger,t.featureId,s);const c=(0,O.getAccountByAddress)(this.messenger,e);if(!c)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const d=(0,v.isHardwareWallet)(c),m=(0,L.getPreConfirmationPropertiesFromQuote)(t,n,d,a,r,o);let p,g,k=!1;const b=Date.now(),w=(0,v.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),x=(0,v.isTronChainId)(t.quote.srcChainId);try{if(!t.featureId&&E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Submitted,undefined,m),(0,v.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,v.isTronTrade)(t.approval)){const e=await E(this,l,"f").call(this,(0,U.getApprovalTraceParams)(t,!1),async()=>t.approval&&(0,v.isTronTrade)(t.approval)?await(0,H.handleNonEvmTx)(this.messenger,t.approval,t,c):undefined);g=e?.id,await(0,W.handleApprovalDelay)(t.quote.srcChainId)}p=await E(this,l,"f").call(this,(0,U.getTraceParams)(t,!1),async()=>{if(!(0,v.isTronTrade)(t.trade)&&!(0,v.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=E(this,i,"f")===P.BridgeClientId.MOBILE&&d;p=await E(this,l,"f").call(this,(0,U.getTraceParams)(t,n),async()=>{if(!(0,v.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");const s=(0,v.formatChainIdToHex)(t.quote.srcChainId);if(k=await(0,W.checkIsDelegatedAccount)(this.messenger,t.trade.from,[s]),n||t.quote.gasIncluded7702||k){const{tradeMeta:n,approvalMeta:s}=await E(this,T,"f").call(this,{isBridgeTx:w,resetApproval:t.resetApproval,approval:t.approval&&(0,v.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e,isDelegatedAccount:k});return g=s?.id,n}const i=await E(this,y,"f").call(this,t,w,t.quote.srcChainId,t.approval&&(0,v.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);g=i?.id,e&&i?(await(0,W.handleMobileHardwareWalletDelay)(e),await(0,W.waitForTxConfirmation)(this.messenger,i.id)):await(0,W.handleMobileHardwareWalletDelay)(e);const l=(0,W.generateActionId)().toString();E(this,u,"f").call(this,{accountAddress:c.address,quoteResponse:t,slippagePercentage:0,isStxEnabled:n,startTime:b,approvalTxId:g,location:a,abTests:r,activeAbTests:o,actionId:l});const d=await(0,W.submitEvmTransaction)({messenger:this.messenger,transactionType:w?S.TransactionType.bridge:S.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined,actionId:l});return E(this,h,"f").call(this,l,d),d})}}catch(e){throw!t.featureId&&E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...m}),e}try{!((0,v.isNonEvmChainId)(t.quote.srcChainId)||n||t.quote.gasIncluded7702||k)||E(this,u,"f").call(this,{accountAddress:c.address,bridgeTxMeta:p,quoteResponse:t,slippagePercentage:0,isStxEnabled:n,startTime:b,approvalTxId:g,location:a,abTests:r,activeAbTests:o}),(0,v.isNonEvmChainId)(t.quote.srcChainId)&&(E(this,f,"f").call(this,p.id),w||x||E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Completed,p.id))}catch{}return p},this.submitIntent=async e=>{const{quoteResponse:t,accountAddress:n,location:s,abTests:a,activeAbTests:c}=e;(0,F.stopPollingForQuotes)(this.messenger);const l=Date.now(),d=(0,O.getAccountByAddress)(this.messenger,n),m=Boolean(d)&&(0,v.isHardwareWallet)(d),h=(0,L.getPreConfirmationPropertiesFromQuote)(t,!1,m,s,a,c);try{const e=(0,R.getIntentFromQuote)(t),d=(0,v.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),h=m&&E(this,i,"f")===P.BridgeClientId.MOBILE,p=await E(this,y,"f").call(this,t,d,t.quote.srcChainId,t.approval,t.resetApproval,h),g=p?.id;g&&await(0,W.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:n,typedData:e.typedData}),order:e.order,userAddress:n,aggregatorId:e.protocol},{id:T,status:_}=await(0,R.postSubmitOrder)({params:w,clientId:E(this,i,"f"),jwt:await(0,N.getJwt)(this.messenger),fetchFn:E(this,r,"f"),bridgeApiBaseUrl:E(this,o,"f").customBridgeApiBaseUrl}),x=d?S.TransactionType.bridge:S.TransactionType.swap,I=(0,G.getNetworkClientIdByChainId)(this.messenger,k),C={chainId:(0,v.formatChainIdToHex)(k),from:n,to:e.settlementContract??"0x9008D19f58AAbd9eD0D60971565AA8510560ab41",data:`0x${T.slice(-8)}`,value:"0x0",gas:"0x5208",gasPrice:"0x3b9aca00"},A={...await(0,W.addSyntheticTransaction)(this.messenger,C,{requireApproval:!1,networkClientId:I,type:x}),status:(0,R.mapIntentOrderStatusToTransactionStatus)(_),isIntentTx:!0,orderUid:T};try{const e=T,i={...A,id:e,originalTransactionId:A.id};E(this,u,"f").call(this,{accountAddress:n,bridgeTxMeta:i,quoteResponse:t,slippagePercentage:0,isStxEnabled:!1,approvalTxId:g,startTime:l,location:s,abTests:a,activeAbTests:c}),E(this,f,"f").call(this,e)}catch(e){console.error("📝 [submitIntent] Failed to add to bridge history",e)}return A}catch(e){throw E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...h}),e}},_.set(this,(e,t,n)=>{const s=t?this.state.txHistory?.[t]?.abTests:undefined,a=t?this.state.txHistory?.[t]?.activeAbTests:undefined,i=n?.ab_tests??s,r=n?.active_ab_tests??a,o={action_type:v.MetricsActionType.SWAPBRIDGE_V1,location:n?.location??(t?this.state.txHistory?.[t]?.location:undefined)??v.MetaMetricsSwapsEventSource.MainView,...n??{},...i&&Object.keys(i).length>0&&{ab_tests:i},...r&&r.length>0&&{active_ab_tests:r}};if(!t)return void(0,F.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:o});const c=this.state.txHistory[t];if(!c)return void(0,F.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:o});const{featureId:l,approvalTxId:d,quote:m}=c,u=(0,L.getRequestParamFromHistory)(c);if(e===v.UnifiedSwapBridgeEventName.StatusValidationFailed)return void(0,F.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:{...o,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,O.getAccountByAddress)(this.messenger,c.account),f=(0,W.getTransactions)(this.messenger),p=f.find(e=>e.id===t),g=f.find(e=>e.id===d),k={...o,...u,...(0,L.getRequestMetadataFromHistory)(c,h),...(0,L.getTradeDataFromHistory)(c),...(0,L.getTxStatusesFromHistory)(c),...(0,L.getFinalizedTxProperties)(c,p,g),...(0,L.getPriceImpactFromQuote)(m)};(0,F.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:k})}),x(this,i,n,"f"),x(this,r,I,"f"),x(this,c,$,"f"),x(this,o,{customBridgeApiBaseUrl:K?.customBridgeApiBaseUrl??j.BRIDGE_PROD_API_BASE_URL},"f"),x(this,l,V??((e,t)=>t?.()),"f"),x(this,a,new A.IntentManager({messenger:this.messenger,customBridgeApiBaseUrl:E(this,o,"f").customBridgeApiBaseUrl,fetchFn:E(this,r,"f")}),"f"),this.messenger.registerActionHandler(`${j.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${j.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${j.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${j.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${j.BRIDGE_STATUS_CONTROLLER_NAME}:submitIntent`,this.submitIntent.bind(this)),this.messenger.registerActionHandler(`${j.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${j.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength(j.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:n,id:s,actionId:a}=e;if(t&&[S.TransactionType.bridge,S.TransactionType.swap,S.TransactionType.bridgeApproval,S.TransactionType.swapApproval].includes(t)&&[S.TransactionStatus.failed,S.TransactionStatus.dropped,S.TransactionStatus.rejected].includes(n)&&(E(this,d,"f").call(this,e),n!==S.TransactionStatus.rejected)){let t;this.state.txHistory[s]?t=s:a&&this.state.txHistory[a]&&(t=a),E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Failed,t??s,(0,L.getEVMTxPropertiesFromTransactionMeta)(e))}}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:n,chainId:s}=e;t===S.TransactionType.swap&&E(this,_,"f").call(this,v.UnifiedSwapBridgeEventName.Completed,n),t!==S.TransactionType.bridge||(0,v.isNonEvmChainId)(s)||E(this,f,"f").call(this,n)}),E(this,m,"f").call(this)}}n.BridgeStatusController=$,s=new WeakMap,a=new WeakMap,i=new WeakMap,r=new WeakMap,o=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,T=new WeakMap,_=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,n){var s,a,i,r,o=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.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");n.IntentManager=class{constructor({messenger:e,customBridgeApiBaseUrl:t,fetchFn:n}){s.add(this),a.set(this,void 0),i.set(this,new Map),this.getIntentTransactionStatus=async(e,t,n,a,i)=>{try{const o=await this.intentApi.getOrderStatus(e,n,t,a);return c(this,s,"m",r).call(this,e,o,t,i)}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 n=t.originalTransactionId??t.txMetaId;if(!n)return;const s=c(this,i,"f").get(e);if(s)try{const t=(0,u.getTransactionMetaById)(c(this,a,"f"),n);if(!t)return void console.warn("[Intent polling] Skipping update, transaction not found",{originalTxId:n,bridgeHistoryKey:e});const{bridgeStatus:r,orderStatus:o}=s,d=r?.txHash,m=r?.status.status===l.StatusTypes.COMPLETE,h=r?.status.status===l.StatusTypes.COMPLETE||r?.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:r?.transactionStatus,...d?{hash:d}:{},...p},`BridgeStatusController - Intent order status updated: ${o}`),h&&c(this,i,"f").delete(e)}catch(t){console.error("[Intent polling] Failed to update transaction status",{originalTxId:n,bridgeHistoryKey:e,error:t})}},o(this,a,e,"f"),this.intentApi=new m.IntentApiImpl(t,n,async()=>await(0,d.getJwt)(e))}},a=new WeakMap,i=new WeakMap,s=new WeakSet,r=function(e,t,n,s){const a=(0,m.translateIntentOrderToBridgeStatus)(t,n,s),r={orderStatus:t.status,bridgeStatus:a};return c(this,i,"f").set(e,r),r}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.TraceName=n.APPROVAL_DELAY_MS=n.BRIDGE_PROD_API_BASE_URL=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.BRIDGE_STATUS_CONTROLLER_NAME=n.MAX_ATTEMPTS=n.REFRESH_INTERVAL_MS=void 0,n.REFRESH_INTERVAL_MS=1e4,n.MAX_ATTEMPTS=7,n.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{}},n.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",n.APPROVAL_DELAY_MS=5e3,function(e){e.BridgeTransactionApprovalCompleted="Bridge Transaction Approval Completed",e.BridgeTransactionCompleted="Bridge Transaction Completed",e.SwapTransactionApprovalCompleted="Swap Transaction Approval Completed",e.SwapTransactionCompleted="Swap Transaction Completed"}(s||(n.TraceName=s={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/index.cjs",{"./bridge-status-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusController=n.BridgeStatusAction=n.BridgeId=n.MAX_ATTEMPTS=n.BRIDGE_STATUS_CONTROLLER_NAME=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.REFRESH_INTERVAL_MS=void 0;var s=e("./constants.cjs");Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return s.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(n,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return s.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(n,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return s.MAX_ATTEMPTS}});var a=e("./types.cjs");Object.defineProperty(n,"BridgeId",{enumerable:!0,get:function(){return a.BridgeId}}),Object.defineProperty(n,"BridgeStatusAction",{enumerable:!0,get:function(){return a.BridgeStatusAction}});var i=e("./bridge-status-controller.cjs");Object.defineProperty(n,"BridgeStatusController",{enumerable:!0,get:function(){return i.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusAction=n.BridgeId=n.BridgeClientId=void 0;e("./constants.cjs");var s,a,i;!function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(s||(n.BridgeClientId=s={})),function(e){e.HOP="hop",e.CELER="celer",e.CELERCIRCLE="celercircle",e.CONNEXT="connext",e.POLYGON="polygon",e.AVALANCHE="avalanche",e.MULTICHAIN="multichain",e.AXELAR="axelar",e.ACROSS="across",e.STARGATE="stargate",e.RELAY="relay",e.MAYAN="mayan"}(a||(n.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"}(i||(n.BridgeStatusAction=i={}))}}},{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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getAccountByAddress=void 0;n.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getJwt=void 0;n.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getStatusRequestParams=n.shouldSkipFetchDueToFetchFailures=n.getStatusRequestWithSrcTxHash=n.fetchBridgeTxStatus=n.getStatusRequestDto=n.getBridgeStatusUrl=void 0;const s=e("@metamask/bridge-controller"),a=e("@metamask/superstruct"),i=e("./validators.cjs"),r=e("../constants.cjs");n.getBridgeStatusUrl=e=>`${e}/getTxStatus`;n.getStatusRequestDto=e=>{const{quote:t,...n}=e;return{...Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};n.fetchBridgeTxStatus=async(e,t,r,o,c)=>{const l=(0,n.getStatusRequestDto)(e),d=new URLSearchParams(l),m=`${(0,n.getBridgeStatusUrl)(c)}?${d.toString()}`,u=await o(m,{headers:(0,s.getClientHeaders)({clientId:t,jwt:r})}),h=[];try{(0,i.validateBridgeStatusResponse)(u)}catch(t){t instanceof a.StructError&&t.failures().forEach(({path:t})=>{const n=u?.bridge??(e.bridge||e.bridgeId)??"unknown",s=t?.join(".")||"unknown";h.push([n,s].join("|"))})}return{status:u,validationFailures:h}};n.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:n,bridges:s,srcChainId:a,destChainId:i,refuel:r}=e;return{bridgeId:n,srcTxHash:t,bridge:s[0],srcChainId:a,destChainId:i,quote:e,refuel:Boolean(r)}};n.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=r.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1};n.getStatusRequestParams=e=>({bridgeId:e.quote.bridgeId,bridge:e.quote.bridges[0],srcChainId:e.quote.srcChainId,destChainId:e.quote.destChainId,quote:e.quote,refuel:Boolean(e.quote.refuel)})}}},{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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.trackMetricsEvent=n.stopPollingForQuotes=void 0;const s=e("@metamask/bridge-controller");n.stopPollingForQuotes=(e,t,n)=>{e.call("BridgeController:stopPollingForQuotes",s.AbortReason.TransactionSubmitted,t?undefined:n)};n.trackMetricsEvent=({messenger:e,eventName:t,properties:n})=>{e.call("BridgeController:trackUnifiedSwapBridgeEvent",t,n)}}}},{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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calcActualGasUsed=void 0;const s=e("bignumber.js"),a=(e,t)=>e&&t?new s.BigNumber(e,16).times(new s.BigNumber(t,16)):null;n.calcActualGasUsed=({pricingData:e},t,n)=>{const i=e?.quotedGasInUsd&&e?.quotedGasAmount?new s.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,r=a(t?.gasUsed,t?.effectiveGasPrice)?.plus(a(n?.gasUsed,n?.effectiveGasPrice)??0),o=r?.div(new s.BigNumber(10).pow(18)).toString(10);return r&&o?{amount:r.toString(10),usd:i?.multipliedBy(o).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.shouldPollHistoryItem=n.getInitialHistoryItem=n.getHistoryKey=n.rekeyHistoryItemInState=void 0;const s=e("@metamask/bridge-controller");function a(e,t,n){const s=e??t??n;if(!s)throw new Error("Cannot add tx to history: either actionId, bridgeTxMeta.id, or syntheticTransactionId must be provided");return s}n.rekeyHistoryItemInState=(e,t,n)=>{const s=e.txHistory[t];return!!s&&(e.txHistory[n.id]={...s,txMetaId:n.id,originalTransactionId:s.originalTransactionId??n.id,status:{...s.status,srcChain:{...s.status.srcChain,txHash:n.hash??s.status.srcChain?.txHash}}},delete e.txHistory[t],!0)},n.getHistoryKey=a;n.getInitialHistoryItem=e=>{const{bridgeTxMeta:t,quoteResponse:n,startTime:i,slippagePercentage:r,initialDestAssetBalance:o,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:n.quote,startTime:i,estimatedProcessingTimeInSeconds:n.estimatedProcessingTimeInSeconds,slippagePercentage:r,pricingData:{amountSent:n.sentAmount?.amount??"0",amountSentInUsd:n.sentAmount?.usd??undefined,quotedGasInUsd:n.gasFee?.effective?.usd??undefined,quotedReturnInUsd:n.toTokenAmount?.usd??undefined,quotedGasAmount:n.gasFee?.effective?.amount??undefined},initialDestAssetBalance:o,targetContractAddress:c,account:f,status:{status:s.StatusTypes.PENDING,srcChain:{chainId:n.quote.srcChainId,txHash:t?.hash}},hasApprovalTx:Boolean(n.approval),approvalTxId:l,isStxEnabled:Boolean(d),featureId:n.featureId,location:m,...u&&{abTests:u},...h&&{activeAbTests:h}}}};n.shouldPollHistoryItem=e=>{const t=Boolean(e?.quote?.intent);return[(0,s.isCrossChain)(e.quote.srcChainId,e.quote.destChainId),t,(0,s.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/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.postSubmitOrder=n.getIntentFromQuote=n.mapIntentOrderStatusToTransactionStatus=n.translateIntentOrderToBridgeStatus=n.IntentApiImpl=void 0;const c=e("@metamask/bridge-controller"),l=e("@metamask/transaction-controller"),d=e("./validators.cjs");n.IntentApiImpl=class{constructor(e,t,n){s.set(this,void 0),a.set(this,void 0),i.set(this,void 0),r(this,s,e,"f"),r(this,a,t,"f"),r(this,i,n,"f")}async getOrderStatus(e,t,n,r){const l=`${o(this,s,"f")}/getOrderStatus?orderId=${e}&aggregatorId=${encodeURIComponent(t)}&srcChainId=${n}`;try{const e=await o(this,i,"f").call(this),t=await o(this,a,"f").call(this,l,{method:"GET",headers:(0,c.getClientHeaders)({clientId:r,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")}}},s=new WeakMap,a=new WeakMap,i=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}}n.translateIntentOrderToBridgeStatus=(e,t,n)=>{let s;switch(e.status){case d.IntentOrderStatus.CONFIRMED:case d.IntentOrderStatus.COMPLETED:s=c.StatusTypes.COMPLETE;break;case d.IntentOrderStatus.FAILED:case d.IntentOrderStatus.EXPIRED:case d.IntentOrderStatus.CANCELLED:s=c.StatusTypes.FAILED;break;case d.IntentOrderStatus.PENDING:s=c.StatusTypes.PENDING;break;case d.IntentOrderStatus.SUBMITTED:s=c.StatusTypes.SUBMITTED;break;default:s=c.StatusTypes.UNKNOWN}const a=e.txHash??n;return{status:{status:s,srcChain:{chainId:t,txHash:a}},txHash:a,transactionStatus:m(e.status)}},n.mapIntentOrderStatusToTransactionStatus=m,n.getIntentFromQuote=function(e){const{intent:t}=e.quote;if(!t)throw new Error("submitIntent: missing intent data");return t};n.postSubmitOrder=async({params:e,clientId:t,jwt:n,fetchFn:s,bridgeApiBaseUrl:a})=>{const i=`${a}/submitOrder`;try{const a=await s(i,{method:"POST",headers:{"Content-Type":"application/json",...(0,c.getClientHeaders)({clientId:t,jwt:n})},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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.signTypedMessage=void 0;const s=e("@metamask/keyring-controller");n.signTypedMessage=async({messenger:e,accountAddress:t,typedData:n})=>await e.call("KeyringController:signTypedMessage",{from:t,data:n},s.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/transaction-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getEVMTxPropertiesFromTransactionMeta=n.getRequestMetadataFromHistory=n.getTradeDataFromHistory=n.getPreConfirmationPropertiesFromQuote=n.getPriceImpactFromQuote=n.getTradeDataFromQuote=n.getRequestParamFromHistory=n.getFinalizedTxProperties=n.getTxStatusesFromHistory=void 0;const s=e("@metamask/bridge-controller"),a=e("@metamask/transaction-controller"),i=e("bignumber.js"),r=e("./gas.cjs"),o=e("./swap-received-amount.cjs");n.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:n,quote:a})=>{const i=e.srcChain.txHash?s.StatusTypes.COMPLETE:s.StatusTypes.PENDING,r=e.destChain?.txHash?e.status:s.StatusTypes.PENDING,o=(0,s.formatChainIdToHex)(a.srcChainId),c=(0,s.isEthUsdt)(o,a.srcAsset.address),l=e.srcChain.txHash?s.StatusTypes.COMPLETE:undefined,d=e.srcChain.txHash?s.StatusTypes.COMPLETE:s.StatusTypes.PENDING;return{allowance_reset_transaction:c?l:undefined,approval_transaction:t||n?d:undefined,source_transaction:i,destination_transaction:e.status===s.StatusTypes.FAILED?s.StatusTypes.FAILED:r}};n.getFinalizedTxProperties=(e,t,n)=>{const s=n?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===a.TransactionType.swap?t?.time:e.completionTime,l=(0,r.calcActualGasUsed)(e,t?.txReceipt,n?.txReceipt),d=t?.type===a.TransactionType.swap?(0,o.getActualSwapReceivedAmount)(e,l,t):(0,o.getActualBridgeReceivedAmount)(e),m=e.pricingData?.quotedGasAmount&&l?.amount?new i.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new i.BigNumber(10).pow(18)).div(l.amount).toNumber():0,u=e.pricingData?.quotedReturnInUsd&&d?.usd?new i.BigNumber(e.pricingData.quotedReturnInUsd).div(d.usd).toNumber():0;return{actual_time_minutes:c&&s?(c-s)/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}};n.getRequestParamFromHistory=e=>({chain_id_source:(0,s.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,s.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId});n.getTradeDataFromQuote=e=>({usd_quoted_gas:Number(e.gasFee?.effective?.usd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,s.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});n.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});n.getPreConfirmationPropertiesFromQuote=(e,t,a,i=s.MetaMetricsSwapsEventSource.MainView,r,o)=>{const{quote:c}=e;return{...(0,n.getPriceImpactFromQuote)(c),...(0,n.getTradeDataFromQuote)(e),chain_id_source:(0,s.formatChainIdToCaip)(c.srcChainId),token_symbol_source:c.srcAsset.symbol,chain_id_destination:(0,s.formatChainIdToCaip)(c.destChainId),token_symbol_destination:c.destAsset.symbol,is_hardware_wallet:a,swap_type:(0,s.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:s.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1,location:i,...r&&Object.keys(r).length>0&&{ab_tests:r},...o&&o.length>0&&{active_ab_tests:o}}};n.getTradeDataFromHistory=e=>({usd_quoted_gas:Number(e.pricingData?.quotedGasInUsd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,s.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});n.getRequestMetadataFromHistory=(e,t)=>{const{quote:n,slippagePercentage:a,isStxEnabled:i}=e;return{slippage_limit:a,custom_slippage:(0,s.isCustomSlippage)(a),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,s.getSwapType)(n.srcChainId,n.destChainId),is_hardware_wallet:(0,s.isHardwareWallet)(t),stx_enabled:i??!1,security_warnings:[]}};n.getEVMTxPropertiesFromTransactionMeta=e=>({source_transaction:[a.TransactionStatus.failed,a.TransactionStatus.dropped,a.TransactionStatus.rejected].includes(e.status)?s.StatusTypes.FAILED:s.StatusTypes.COMPLETE,error_message:e.error?.message??"",chain_id_source:(0,s.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,s.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:0,stx_enabled:!1,token_address_source:(0,s.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,s.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",custom_slippage:!1,is_hardware_wallet:!1,swap_type:e.type&&[a.TransactionType.swap,a.TransactionType.swapApproval].includes(e.type)?s.MetricsSwapType.SINGLE:s.MetricsSwapType.CROSSCHAIN,security_warnings:[],price_impact:0,usd_quoted_gas:0,gas_included:!1,gas_included_7702:!1,quoted_time_minutes:0,usd_quoted_return:0,provider:"",actual_time_minutes:0,quote_vs_execution_ratio:0,quoted_vs_used_gas_ratio:0,usd_actual_return:0,usd_actual_gas:0,action_type:s.MetricsActionType.SWAPBRIDGE_V1})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getNetworkClientIdByChainId=n.getSelectedChainId=void 0;const s=e("@metamask/bridge-controller");n.getSelectedChainId=e=>{const{selectedNetworkClientId:t}=e.call("NetworkController:getState");return e.call("NetworkController:getNetworkClientById",t).configuration.chainId};n.getNetworkClientIdByChainId=(e,t)=>{const n=(0,s.formatChainIdToHex)(t);return e.call("NetworkController:findNetworkClientIdByChainId",n)}}}},{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/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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handleNonEvmTx=n.handleNonEvmTxResponse=n.getTxMetaFields=n.getClientRequest=n.createClientTransactionRequest=void 0;const s=e("@metamask/bridge-controller"),a=(e("@metamask/snaps-controllers"),e("@metamask/transaction-controller")),i=e("uuid");n.createClientTransactionRequest=(e,t,n,s,a)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,i.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:n,accountId:s,...a&&{options:a}}}});n.getClientRequest=(e,t,a,i)=>{const r=(0,s.formatChainIdToCaip)(t),o=(0,s.extractTradeData)(e),c=(0,s.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,n.createClientTransactionRequest)(i,o,r,a,c)};n.getTxMetaFields=(e,t)=>{let n;try{n=(0,s.formatChainIdToHex)(e.quote.destChainId)}catch{n=a.CHAIN_IDS.MAINNET}return{destinationChainId:n,sourceTokenAmount:e.quote.srcTokenAmount,sourceTokenSymbol:e.quote.srcAsset.symbol,sourceTokenDecimals:e.quote.srcAsset.decimals,sourceTokenAddress:e.quote.srcAsset.address,destinationTokenAmount:e.quote.destTokenAmount,destinationTokenSymbol:e.quote.destAsset.symbol,destinationTokenDecimals:e.quote.destAsset.decimals,destinationTokenAddress:e.quote.destAsset.address,approvalTxId:t,swapTokenValue:e.sentAmount.amount}};n.handleNonEvmTxResponse=(e,t,r,o)=>{const c=o.address,l=o.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,s.isCrossChain)(r.quote.srcChainId,r.quote.destChainId);let u;try{u=(0,s.formatChainIdToHex)(r.quote.srcChainId)}catch{u="0x1"}const h=(0,s.extractTradeData)(t);return{...(0,n.getTxMetaFields)(r),time:Date.now(),id:d??(0,i.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}};n.handleNonEvmTx=async(e,t,s,a)=>{if(!a.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const i=(0,n.getClientRequest)(t,s.quote.srcChainId,a.id,a.metadata?.snap?.id),r=await e.call("SnapController:handleRequest",i);return(0,n.handleNonEvmTxResponse)(r,t,s,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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getActualBridgeReceivedAmount=n.getActualSwapReceivedAmount=void 0;const s=e("@metamask/bridge-controller"),a=e("bignumber.js");n.getActualSwapReceivedAmount=(e,t,n)=>{const{pricingData:i}=e,r=e.quote.destTokenAmount;if(!n?.txReceipt)return null;const o=(0,s.isNativeAddress)(e.quote.destAsset.address)?((e,t,n)=>{const{preTxBalance:s,postTxBalance:i}=n;return s&&i&&s!==i?t&&i&&s?new a.BigNumber(i,16).minus(s,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,n):((e,t)=>{const{txReceipt:n}=t;if(!n?.logs||"0x0"===n.status)return null;const{account:s,quote:i}=e,r=n.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),n=e.address?.toLowerCase()===i.destAsset.address?.toLowerCase(),a=e.topics?.[2]&&(e.topics[2]===s||e.topics[2].match(s?.slice(2)));return t&&n&&a});return r?.data?new a.BigNumber(r.data,16).div(new a.BigNumber(10).pow(i.destAsset.decimals)):null})(e,n),c=i?.quotedReturnInUsd&&r?new a.BigNumber(i.quotedReturnInUsd).div(r).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:o,usd:o&&c?c.multipliedBy(o):null}};n.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:n,status:s}=e,i=n?.quotedReturnInUsd?new a.BigNumber(n.quotedReturnInUsd).div(t.destTokenAmount):null,r=s.destChain?.amount;return r&&i?{amount:r,usd:i.multipliedBy(r).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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getApprovalTraceParams=n.getTraceParams=void 0;const s=e("@metamask/bridge-controller"),a=e("../constants.cjs");n.getTraceParams=(e,t)=>({name:(0,s.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?a.TraceName.BridgeTransactionCompleted:a.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,s.formatChainIdToCaip)(e.quote.srcChainId),stxEnabled:t}});n.getApprovalTraceParams=(e,t)=>({name:(0,s.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?a.TraceName.BridgeTransactionApprovalCompleted:a.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,s.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/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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitEvmTransaction=n.addTransactionBatch=n.findAndUpdateTransactionsInBatch=n.getAddTransactionBatchParams=n.toBatchTxParams=n.waitForTxConfirmation=n.handleMobileHardwareWalletDelay=n.handleApprovalDelay=n.addSyntheticTransaction=n.generateActionId=n.addTransaction=n.checkIsDelegatedAccount=n.updateTransaction=n.getTransactionMetaByHash=n.getTransactionMetaById=n.getTransactions=n.calculateGasFees=n.getTxGasEstimates=n.getGasFeeEstimates=void 0;const s=e("@metamask/bridge-controller"),a=e("@metamask/controller-utils"),i=e("@metamask/transaction-controller"),r=e("@metamask/utils"),o=e("bignumber.js"),c=e("./accounts.cjs"),l=e("./network.cjs"),d=e("../constants.cjs");n.getGasFeeEstimates=async(e,t)=>{const{estimates:n}=await e.call("TransactionController:estimateGasFee",t);return s.BRIDGE_PREFERRED_GAS_ESTIMATE in n&&"object"==typeof n[s.BRIDGE_PREFERRED_GAS_ESTIMATE]&&"maxFeePerGas"in n[s.BRIDGE_PREFERRED_GAS_ESTIMATE]&&"maxPriorityFeePerGas"in n[s.BRIDGE_PREFERRED_GAS_ESTIMATE]?n[s.BRIDGE_PREFERRED_GAS_ESTIMATE]:{}};n.getTxGasEstimates=async(e,t)=>{const{gasFeeEstimates:s}=e.call("GasFeeController:getState"),a="estimatedBaseFee"in s?s.estimatedBaseFee:"0",{maxFeePerGas:i,maxPriorityFeePerGas:r}=await(0,n.getGasFeeEstimates)(e,t);return{baseAndPriorityFeePerGas:r?new o.BigNumber(a,10).times(10**9).plus(r,16):undefined,maxFeePerGas:i,maxPriorityFeePerGas:r}};n.calculateGasFees=async(e,t,{chainId:s,gasLimit:i,...r},o,c,l)=>{if(e)return{};if(l)return{...l,gas:i?.toString()};const d={...r,gas:i?.toString(),data:r.data,to:r.to,value:r.value},{maxFeePerGas:m,maxPriorityFeePerGas:u}=await(0,n.getTxGasEstimates)(t,{transactionParams:d,networkClientId:o,chainId:c});return{maxFeePerGas:m,maxPriorityFeePerGas:u,gas:(0,a.toHex)(d.gas??0)}};n.getTransactions=e=>e.call("TransactionController:getState").transactions??[];n.getTransactionMetaById=(e,t)=>(0,n.getTransactions)(e).find(e=>e.id===t);n.getTransactionMetaByHash=(e,t)=>(0,n.getTransactions)(e).find(e=>e.hash===t);n.updateTransaction=(e,t,n,s)=>e.call("TransactionController:updateTransaction",{...t,...n},s);n.checkIsDelegatedAccount=async(e,t,n)=>{try{return(await e.call("TransactionController:isAtomicBatchSupported",{address:t,chainIds:n})).some(e=>e.isSupported&&e.delegationAddress)}catch{return!1}};n.addTransaction=async(e,...t)=>{const{result:s}=await e.call("TransactionController:addTransaction",...t);return await(async(e,t)=>{const s=await t,a=(0,n.getTransactionMetaByHash)(e,s);if(!a)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return a})(e,s)};n.generateActionId=()=>(Date.now()+Math.random()).toString();n.addSyntheticTransaction=async(e,...t)=>{const{transactionMeta:s}=await e.call("TransactionController:addTransaction",t[0],{origin:"metamask",actionId:(0,n.generateActionId)(),isStateOnly:!0,...t[1]});return s};n.handleApprovalDelay=async e=>{if([s.ChainId.LINEA,s.ChainId.BASE].includes(e)){(0,r.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}};n.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};n.waitForTxConfirmation=async(e,t,{timeoutMs:s=3e5,pollMs:a=3e3}={})=>{const r=Date.now();for(;;){const o=(0,n.getTransactionMetaById)(e,t);if(o){if(o.status===i.TransactionStatus.confirmed)return o;if(o.status===i.TransactionStatus.failed||o.status===i.TransactionStatus.dropped||o.status===i.TransactionStatus.rejected)throw new Error("Approval transaction did not confirm")}if(Date.now()-r>s)throw new Error("Timed out waiting for approval confirmation");await new Promise(e=>setTimeout(e,a))}};n.toBatchTxParams=(e,{chainId:t,gasLimit:n,...s},{maxFeePerGas:i,maxPriorityFeePerGas:r,gas:o})=>{const c={...s,data:s.data,to:s.to,value:s.value};return e?c:{...c,gas:(0,a.toHex)(o??0),maxFeePerGas:(0,a.toHex)(i??0),maxPriorityFeePerGas:(0,a.toHex)(r??0)}};n.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:a,resetApproval:r,trade:o,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,o.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const w=(0,s.formatChainIdToHex)(o.chainId),y=(0,l.getNetworkClientIdByChainId)(e,w),T=!0===u;let _=!T&&!k;m&&!u&&(_=!0);const x=[];if(r){const s=await(0,n.calculateGasFees)(T,e,r,y,w,b?d:undefined);x.push({type:t?i.TransactionType.bridgeApproval:i.TransactionType.swapApproval,params:(0,n.toBatchTxParams)(T,r,s)})}if(a){const s=await(0,n.calculateGasFees)(T,e,a,y,w,b?d:undefined);x.push({type:t?i.TransactionType.bridgeApproval:i.TransactionType.swapApproval,params:(0,n.toBatchTxParams)(T,a,s)})}const E=await(0,n.calculateGasFees)(T,e,o,y,w,b?d:undefined);x.push({type:t?i.TransactionType.bridge:i.TransactionType.swap,params:(0,n.toBatchTxParams)(T,o,E),assetsFiatValues:{sending:f?.valueInCurrency?.toString(),receiving:p?.valueInCurrency?.toString()}});return{disable7702:_,isGasFeeIncluded:Boolean(u),isGasFeeSponsored:Boolean(h),networkClientId:y,requireApproval:g,origin:"metamask",from:o.from,transactions:x}};n.findAndUpdateTransactionsInBatch=({messenger:e,batchId:t,txDataByType:s})=>{const a=(0,n.getTransactions)(e),r={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(s).forEach(([s,o])=>{if(o===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((s===i.TransactionType.swap||s===i.TransactionType.bridge)&&e.type===i.TransactionType.batch)return!0;if((s===i.TransactionType.swapApproval||s===i.TransactionType.bridgeApproval)&&e.txParams.data===o)return!0}return e.txParams.data===o});if(c){const t={...c,type:s};(0,n.updateTransaction)(e,c,{type:s},`Update tx type to ${s}`);const a=[i.TransactionType.bridgeApproval,i.TransactionType.swapApproval];r[a.includes(s)?"approvalMeta":"tradeMeta"]=t}}),r};n.addTransactionBatch=async(e,t,...s)=>{const a={[i.TransactionType.bridgeApproval]:s[0].transactions.find(({type:e})=>e===i.TransactionType.bridgeApproval)?.params.data,[i.TransactionType.swapApproval]:s[0].transactions.find(({type:e})=>e===i.TransactionType.swapApproval)?.params.data,[i.TransactionType.bridge]:s[0].transactions.find(({type:e})=>e===i.TransactionType.bridge)?.params.data,[i.TransactionType.swap]:s[0].transactions.find(({type:e})=>e===i.TransactionType.swap)?.params.data},{batchId:r}=await t(...s),{approvalMeta:o,tradeMeta:c}=(0,n.findAndUpdateTransactionsInBatch)({messenger:e,batchId:r,txDataByType:a});if(!c)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:o,tradeMeta:c}};const m=async(e,t,s,i,r)=>{const{gas:o}=t;if(r)return{maxFeePerGas:(0,a.toHex)(r.maxFeePerGas),maxPriorityFeePerGas:(0,a.toHex)(r.maxPriorityFeePerGas),gas:o?(0,a.toHex)(o):undefined};const{maxFeePerGas:c,maxPriorityFeePerGas:l}=await(0,n.getTxGasEstimates)(e,{transactionParams:t,chainId:i,networkClientId:s});return{maxFeePerGas:c,maxPriorityFeePerGas:l,gas:o?(0,a.toHex)(o):undefined}};n.submitEvmTransaction=async({messenger:e,trade:t,transactionType:a,requireApproval:i=!1,txFee:r,actionId:o=(0,n.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,s.formatChainIdToHex)(t.chainId),u=(0,l.getNetworkClientIdByChainId)(e,d),h={actionId:o,networkClientId:u,requireApproval:i,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,r)};return await(0,n.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateIntentStatusResponse=n.IntentOrderStatus=n.validateBridgeStatusResponse=n.StatusResponseSchema=void 0;const s=e("@metamask/bridge-controller"),a=e("@metamask/superstruct"),i=(0,a.number)(),r=(0,a.type)({}),o=(0,a.type)({chainId:i,txHash:(0,a.optional)((0,a.string)()),amount:(0,a.optional)((0,a.string)()),token:(0,a.optional)((0,a.union)([r,s.BridgeAssetSchema]))}),c=(0,a.type)({chainId:i,txHash:(0,a.optional)((0,a.string)()),amount:(0,a.optional)((0,a.string)()),token:(0,a.optional)((0,a.union)([r,s.BridgeAssetSchema]))}),l=(0,a.type)({});n.StatusResponseSchema=(0,a.type)({status:(0,a.enums)(Object.values(s.StatusTypes)),srcChain:o,destChain:(0,a.optional)(c),bridge:(0,a.optional)((0,a.string)()),isExpectedToken:(0,a.optional)((0,a.boolean)()),isUnrecognizedRouterAddress:(0,a.optional)((0,a.boolean)()),refuel:(0,a.optional)(l)});var d;n.validateBridgeStatusResponse=e=>((0,a.assert)(e,n.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||(n.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)()]))})});n.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/bignumber.js/bignumber.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){!function(e){var n,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,i=Math.floor,r="[BigNumber Error] ",o=r+"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,n,s=1,a=e.length,i=e[0]+"";s<a;){for(t=e[s++]+"",n=l-t.length;n--;t="0"+t);i+=t}for(a=i.length;48===i.charCodeAt(--a););return i.slice(0,a+1||1)}function g(e,t){var n,s,a=e.c,i=t.c,r=e.s,o=t.s,c=e.e,l=t.e;if(!r||!o)return null;if(n=a&&!a[0],s=i&&!i[0],n||s)return n?s?0:-o:r;if(r!=o)return r;if(n=r<0,s=c==l,!a||!i)return s?0:!a^n?1:-1;if(!s)return c>l^n?1:-1;for(o=(c=a.length)<(l=i.length)?c:l,r=0;r<o;r++)if(a[r]!=i[r])return a[r]>i[r]^n?1:-1;return c==l?0:c>l^n?1:-1}function k(e,t,n,s){if(e<t||e>n||e!==i(e))throw Error(r+(s||"Argument")+("number"==typeof e?e<t||e>n?" 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,n){var s,a;if(t<0){for(a=n+".";++t;a+=n);e=a+e}else if(++t>(s=e.length)){for(a=n,t-=s;--t;a+=n);e+=a}else t<s&&(e=e.slice(0,t)+"."+e.slice(t));return e}n=function e(t){var n,T,_,x,E,v,I,S,C,A,j=q.prototype={constructor:q,toString:null,valueOf:null},P=new q(1),O=20,N=4,F=-7,M=21,D=-1e7,R=1e7,B=!1,L=1,G=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},U="0123456789abcdefghijklmnopqrstuvwxyz",W=!0;function q(e,t){var n,a,r,c,m,u,h,f,p=this;if(!(p instanceof q))return new q(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>R?p.c=p.e=null:e.e<D?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>R?p.c=p.e=null:(p.e=c,p.c=[e]))}f=String(e)}else{if(!s.test(f=String(e)))return _(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&&W)return z(p=new q(e),O+p.e+1,N);if(f=String(e),u="number"==typeof e){if(0*e!=0)return _(p,f,u,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,q.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(n=U.slice(0,t),c=m=0,h=f.length;m<h;m++)if(n.indexOf(a=f.charAt(m))<0){if("."==a){if(m>c){c=h;continue}}else if(!r&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){r=!0,m=-1,c=0;continue}return _(p,String(e),u,t)}u=!1,(c=(f=T(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):c=f.length}for(m=0;48===f.charCodeAt(m);m++);for(h=f.length;48===f.charCodeAt(--h););if(f=f.slice(m,++h)){if(h-=m,u&&q.DEBUG&&h>15&&(e>d||e!==i(e)))throw Error(o+p.s*e);if((c=c-m-1)>R)p.c=p.e=null;else if(c<D)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,n,s){var a,i,r,o,c;if(null==n?n=N:k(n,0,8),!e.c)return e.toString();if(a=e.c[0],r=e.e,null==t)c=p(e.c),c=1==s||2==s&&(r<=F||r>=M)?w(c,r):y(c,r,"0");else if(i=(e=z(new q(e),t,n)).e,o=(c=p(e.c)).length,1==s||2==s&&(t<=i||i<=F)){for(;o<t;c+="0",o++);c=w(c,i)}else if(t-=r+(2===s&&i>r),c=y(c,i,"0"),i+1>o){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-o)>0)for(i+1==o&&(c+=".");t--;c+="0");return e.s<0&&a?"-"+c:c}function K(e,t){for(var n,s,a=1,i=new q(e[0]);a<e.length;a++)(!(s=new q(e[a])).s||(n=g(i,s))===t||0===n&&i.s===t)&&(i=s);return i}function V(e,t,n){for(var s=1,a=t.length;!t[--a];t.pop());for(a=t[0];a>=10;a/=10,s++);return(n=s+n*l-1)>R?e.c=e.e=null:n<D?e.c=[e.e=0]:(e.e=n,e.c=t),e}function z(e,t,n,s){var r,o,d,u,h,f,p,g=e.c,k=m;if(g){e:{for(r=1,u=g[0];u>=10;u/=10,r++);if((o=t-r)<0)o+=l,d=t,h=g[f=0],p=i(h/k[r-d-1]%10);else if((f=a((o+1)/l))>=g.length){if(!s)break e;for(;g.length<=f;g.push(0));h=p=0,r=1,d=(o%=l)-l+1}else{for(h=u=g[f],r=1;u>=10;u/=10,r++);p=(d=(o%=l)-l+r)<0?0:i(h/k[r-d-1]%10)}if(s=s||t<0||null!=g[f+1]||(d<0?h:h%k[r-d-1]),s=n<4?(p||s)&&(0==n||n==(e.s<0?3:2)):p>5||5==p&&(4==n||s||6==n&&(o>0?d>0?h/k[r-d]:0:g[f-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,s?(t-=e.e+1,g[0]=k[(l-t%l)%l],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,u=1,f--):(g.length=f+1,u=k[l-o],g[f]=d>0?i(h/k[r-d]%k[d])*u:0),s)for(;;){if(0==f){for(o=1,d=g[0];d>=10;d/=10,o++);for(d=g[0]+=u,u=1;d>=10;d/=10,u++);o!=u&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[f]+=u,g[f]!=c)break;g[f--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}e.e>R?e.c=e.e=null:e.e<D&&(e.c=[e.e=0])}return e}function Y(e){var t,n=e.e;return null===n?e.toString():(t=p(e.c),t=n<=F||n>=M?w(t,n):y(t,n,"0"),e.s<0?"-"+t:t)}return q.clone=e,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.EUCLID=9,q.config=q.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(r+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(k(n=e[t],0,h,t),O=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(k(n=e[t],0,8,t),N=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(k(n[0],-h,0,t),k(n[1],0,h,t),F=n[0],M=n[1]):(k(n,-h,h,t),F=-(M=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)k(n[0],-h,-1,t),k(n[1],1,h,t),D=n[0],R=n[1];else{if(k(n,-h,h,t),!n)throw Error(r+t+" cannot be zero: "+n);D=-(R=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(r+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw B=!n,Error(r+"crypto unavailable");B=n}else B=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(k(n=e[t],0,9,t),L=n),e.hasOwnProperty(t="POW_PRECISION")&&(k(n=e[t],0,h,t),G=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(r+t+" not an object: "+n);H=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(r+t+" invalid: "+n);W="0123456789"==n.slice(0,10),U=n}}return{DECIMAL_PLACES:O,ROUNDING_MODE:N,EXPONENTIAL_AT:[F,M],RANGE:[D,R],CRYPTO:B,MODULO_MODE:L,POW_PRECISION:G,FORMAT:H,ALPHABET:U}},q.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!q.DEBUG)return!0;var t,n,s=e.c,a=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(s)){if((1===o||-1===o)&&a>=-h&&a<=h&&a===i(a)){if(0===s[0]){if(0===a&&1===s.length)return!0;break e}if((t=(a+1)%l)<1&&(t+=l),String(s[0]).length==t){for(t=0;t<s.length;t++)if((n=s[t])<0||n>=c||n!==i(n))break e;if(0!==n)return!0}}}else if(null===s&&null===a&&(null===o||1===o||-1===o))return!0;throw Error(r+"Invalid BigNumber: "+e)},q.maximum=q.max=function(){return K(arguments,-1)},q.minimum=q.min=function(){return K(arguments,1)},q.random=(x=9007199254740992,E=Math.random()*x&2097151?function(){return i(Math.random()*x)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,s,o,c,d=0,u=[],f=new q(P);if(null==e?e=O:k(e,0,h),o=a(e/l),B)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));d<o;)(c=131072*t[d]+(t[d+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[d]=n[0],t[d+1]=n[1]):(u.push(c%1e14),d+=2);d=o/2}else{if(!crypto.randomBytes)throw B=!1,Error(r+"crypto unavailable");for(t=crypto.randomBytes(o*=7);d<o;)(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=o/7}if(!B)for(;d<o;)(c=E())<9e15&&(u[d++]=c%1e14);for(o=u[--d],e%=l,o&&e&&(c=m[l-e],u[d]=i(o/c)*c);0===u[d];u.pop(),d--);if(d<0)u=[s=0];else{for(s=-1;0===u[0];u.splice(0,1),s-=l);for(d=1,c=u[0];c>=10;c/=10,d++);d<l&&(s-=l-d)}return f.e=s,f.c=u,f}),q.sum=function(){for(var e=1,t=arguments,n=new q(t[0]);e<t.length;)n=n.plus(t[e++]);return n},T=function(){var e="0123456789";function t(e,t,n,s){for(var a,i,r=[0],o=0,c=e.length;o<c;){for(i=r.length;i--;r[i]*=t);for(r[0]+=s.indexOf(e.charAt(o++)),a=0;a<r.length;a++)r[a]>n-1&&(null==r[a+1]&&(r[a+1]=0),r[a+1]+=r[a]/n|0,r[a]%=n)}return r.reverse()}return function(s,a,i,r,o){var c,l,d,m,u,h,f,g,k=s.indexOf("."),b=O,w=N;for(k>=0&&(m=G,G=0,s=s.replace(".",""),h=(g=new q(a)).pow(s.length-k),G=m,g.c=t(y(p(h.c),h.e,"0"),10,i,e),g.e=g.c.length),d=m=(f=t(s,a,i,o?(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=r,f=(h=n(h,g,b,w,i)).c,u=h.r,d=h.e),k=f[l=d+b+1],m=i/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])s=u?y(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(f.length=l,u)for(--i;++f[--l]>i;)f[l]=0,l||(++d,f=[1].concat(f));for(m=f.length;!f[--m];);for(k=0,s="";k<=m;s+=c.charAt(f[k++]));s=y(s,d,c.charAt(0))}return s}}(),n=function(){function e(e,t,n){var s,a,i,r,o=0,c=e.length,l=t%u,d=t/u|0;for(e=e.slice();c--;)o=((a=l*(i=e[c]%u)+(s=d*i+(r=e[c]/u|0)*l)%u*u+o)/n|0)+(s/u|0)+d*r,e[c]=a%n;return o&&(e=[o].concat(e)),e}function t(e,t,n,s){var a,i;if(n!=s)i=n>s?1:-1;else for(a=i=0;a<n;a++)if(e[a]!=t[a]){i=e[a]>t[a]?1:-1;break}return i}function n(e,t,n,s){for(var a=0;n--;)e[n]-=a,a=e[n]<t[n]?1:0,e[n]=a*s+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(s,a,r,o,d){var m,u,h,p,g,k,b,w,y,T,_,x,E,v,I,S,C,A=s.s==a.s?1:-1,j=s.c,P=a.c;if(!(j&&j[0]&&P&&P[0]))return new q(s.s&&a.s&&(j?!P||j[0]!=P[0]:P)?j&&0==j[0]||!P?0*A:A/0:NaN);for(y=(w=new q(A)).c=[],A=r+(u=s.e-a.e)+1,d||(d=c,u=f(s.e/l)-f(a.e/l),A=A/l|0),h=0;P[h]==(j[h]||0);h++);if(P[h]>(j[h]||0)&&u--,A<0)y.push(1),p=!0;else{for(v=j.length,S=P.length,h=0,A+=2,(g=i(d/(P[0]+1)))>1&&(P=e(P,g,d),j=e(j,g,d),S=P.length,v=j.length),E=S,_=(T=j.slice(0,S)).length;_<S;T[_++]=0);C=P.slice(),C=[0].concat(C),I=P[0],P[1]>=d/2&&I++;do{if(g=0,(m=t(P,T,S,_))<0){if(x=T[0],S!=_&&(x=x*d+(T[1]||0)),(g=i(x/I))>1)for(g>=d&&(g=d-1),b=(k=e(P,g,d)).length,_=T.length;1==t(k,T,b,_);)g--,n(k,S<b?C:P,b,d),b=k.length,m=1;else 0==g&&(m=g=1),b=(k=P.slice()).length;if(b<_&&(k=[0].concat(k)),n(T,k,_,d),_=T.length,-1==m)for(;t(P,T,S,_)<1;)g++,n(T,S<_?C:P,_,d),_=T.length}else 0===m&&(g++,T=[0]);y[h++]=g,T[0]?T[_++]=j[E]||0:(T=[j[E]],_=1)}while((E++<v||null!=T[0])&&A--);p=null!=T[0],y[0]||y.splice(0,1)}if(d==c){for(h=1,A=y[0];A>=10;A/=10,h++);z(w,r+(w.e=h+u*l-1)+1,o,p)}else w.e=u,w.r=+p;return w}}(),v=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,S=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,A=/^\s*\+(?=[\w.])|^\s+|\s+$/g,_=function(e,t,n,s){var a,i=n?t:t.replace(A,"");if(C.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(v,function(e,t,n){return a="x"==(n=n.toLowerCase())?16:"b"==n?2:8,s&&s!=a?e:t}),s&&(a=s,i=i.replace(I,"$1").replace(S,"0.$1")),t!=i))return new q(i,a);if(q.DEBUG)throw Error(r+"Not a"+(s?" base "+s:"")+" number: "+t);e.s=null}e.c=e.e=null},j.absoluteValue=j.abs=function(){var e=new q(this);return e.s<0&&(e.s=1),e},j.comparedTo=function(e,t){return g(this,new q(e,t))},j.decimalPlaces=j.dp=function(e,t){var n,s,a,i=this;if(null!=e)return k(e,0,h),null==t?t=N:k(t,0,8),z(new q(i),e+i.e+1,t);if(!(n=i.c))return null;if(s=((a=n.length-1)-f(this.e/l))*l,a=n[a])for(;a%10==0;a/=10,s--);return s<0&&(s=0),s},j.dividedBy=j.div=function(e,t){return n(this,new q(e,t),O,N)},j.dividedToIntegerBy=j.idiv=function(e,t){return n(this,new q(e,t),0,1)},j.exponentiatedBy=j.pow=function(e,t){var n,s,o,c,d,m,u,h,f=this;if((e=new q(e)).c&&!e.isInteger())throw Error(r+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new q(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 q(Math.pow(+Y(f),d?e.s*(2-b(e)):+Y(e))),t?h.mod(t):h;if(m=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new q(NaN);(s=!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 q(m?1/c:c);G&&(c=a(G/l+2))}for(d?(n=new q(.5),m&&(e.s=1),u=b(e)):u=(o=Math.abs(+Y(e)))%2,h=new q(P);;){if(u){if(!(h=h.times(f)).c)break;c?h.c.length>c&&(h.c.length=c):s&&(h=h.mod(t))}if(o){if(0===(o=i(o/2)))break;u=o%2}else if(z(e=e.times(n),e.e+1,1),e.e>14)u=b(e);else{if(0===(o=+Y(e)))break;u=o%2}f=f.times(f),c?f.c&&f.c.length>c&&(f.c.length=c):s&&(f=f.mod(t))}return s?h:(m&&(h=P.div(h)),t?h.mod(t):c?z(h,G,N,undefined):h)},j.integerValue=function(e){var t=new q(this);return null==e?e=N:k(e,0,8),z(t,t.e+1,e)},j.isEqualTo=j.eq=function(e,t){return 0===g(this,new q(e,t))},j.isFinite=function(){return!!this.c},j.isGreaterThan=j.gt=function(e,t){return g(this,new q(e,t))>0},j.isGreaterThanOrEqualTo=j.gte=function(e,t){return 1===(t=g(this,new q(e,t)))||0===t},j.isInteger=function(){return!!this.c&&f(this.e/l)>this.c.length-2},j.isLessThan=j.lt=function(e,t){return g(this,new q(e,t))<0},j.isLessThanOrEqualTo=j.lte=function(e,t){return-1===(t=g(this,new q(e,t)))||0===t},j.isNaN=function(){return!this.s},j.isNegative=function(){return this.s<0},j.isPositive=function(){return this.s>0},j.isZero=function(){return!!this.c&&0==this.c[0]},j.minus=function(e,t){var n,s,a,i,r=this,o=r.s;if(t=(e=new q(e,t)).s,!o||!t)return new q(NaN);if(o!=t)return e.s=-t,r.plus(e);var d=r.e/l,m=e.e/l,u=r.c,h=e.c;if(!d||!m){if(!u||!h)return u?(e.s=-t,e):new q(h?r:NaN);if(!u[0]||!h[0])return h[0]?(e.s=-t,e):new q(u[0]?r:3==N?-0:0)}if(d=f(d),m=f(m),u=u.slice(),o=d-m){for((i=o<0)?(o=-o,a=u):(m=d,a=h),a.reverse(),t=o;t--;a.push(0));a.reverse()}else for(s=(i=(o=u.length)<(t=h.length))?o:t,o=t=0;t<s;t++)if(u[t]!=h[t]){i=u[t]<h[t];break}if(i&&(a=u,u=h,h=a,e.s=-e.s),(t=(s=h.length)-(n=u.length))>0)for(;t--;u[n++]=0);for(t=c-1;s>o;){if(u[--s]<h[s]){for(n=s;n&&!u[--n];u[n]=t);--u[n],u[s]+=c}u[s]-=h[s]}for(;0==u[0];u.splice(0,1),--m);return u[0]?V(e,u,m):(e.s=3==N?-1:1,e.c=[e.e=0],e)},j.modulo=j.mod=function(e,t){var s,a,i=this;return e=new q(e,t),!i.c||!e.s||e.c&&!e.c[0]?new q(NaN):!e.c||i.c&&!i.c[0]?new q(i):(9==L?(a=e.s,e.s=1,s=n(i,e,0,3),e.s=a,s.s*=a):s=n(i,e,0,L),(e=i.minus(s.times(e))).c[0]||1!=L||(e.s=i.s),e)},j.multipliedBy=j.times=function(e,t){var n,s,a,i,r,o,d,m,h,p,g,k,b,w,y,T=this,_=T.c,x=(e=new q(e,t)).c;if(!(_&&x&&_[0]&&x[0]))return!T.s||!e.s||_&&!_[0]&&!x||x&&!x[0]&&!_?e.c=e.e=e.s=null:(e.s*=T.s,_&&x?(e.c=[0],e.e=0):e.c=e.e=null),e;for(s=f(T.e/l)+f(e.e/l),e.s*=T.s,(d=_.length)<(p=x.length)&&(b=_,_=x,x=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(n=0,g=x[a]%y,k=x[a]/y|0,i=a+(r=d);i>a;)n=((m=g*(m=_[--r]%y)+(o=k*m+(h=_[r]/y|0)*g)%y*y+b[i]+n)/w|0)+(o/y|0)+k*h,b[i--]=m%w;b[i]=n}return n?++s:b.splice(0,1),V(e,b,s)},j.negated=function(){var e=new q(this);return e.s=-e.s||null,e},j.plus=function(e,t){var n,s=this,a=s.s;if(t=(e=new q(e,t)).s,!a||!t)return new q(NaN);if(a!=t)return e.s=-t,s.minus(e);var i=s.e/l,r=e.e/l,o=s.c,d=e.c;if(!i||!r){if(!o||!d)return new q(a/0);if(!o[0]||!d[0])return d[0]?e:new q(o[0]?s:0*a)}if(i=f(i),r=f(r),o=o.slice(),a=i-r){for(a>0?(r=i,n=d):(a=-a,n=o),n.reverse();a--;n.push(0));n.reverse()}for((a=o.length)-(t=d.length)<0&&(n=d,d=o,o=n,t=a),a=0;t;)a=(o[--t]=o[t]+d[t]+a)/c|0,o[t]=c===o[t]?0:o[t]%c;return a&&(o=[a].concat(o),++r),V(e,o,r)},j.precision=j.sd=function(e,t){var n,s,a,i=this;if(null!=e&&e!==!!e)return k(e,1,h),null==t?t=N:k(t,0,8),z(new q(i),e,t);if(!(n=i.c))return null;if(s=(a=n.length-1)*l+1,a=n[a]){for(;a%10==0;a/=10,s--);for(a=n[0];a>=10;a/=10,s++);}return e&&i.e+1>s&&(s=i.e+1),s},j.shiftedBy=function(e){return k(e,-9007199254740991,d),this.times("1e"+e)},j.squareRoot=j.sqrt=function(){var e,t,s,a,i,r=this,o=r.c,c=r.s,l=r.e,d=O+4,m=new q("0.5");if(1!==c||!o||!o[0])return new q(!c||c<0&&(!o||o[0])?NaN:o?r:1/0);if(0==(c=Math.sqrt(+Y(r)))||c==1/0?(((t=p(o)).length+l)%2==0&&(t+="0"),c=Math.sqrt(+t),l=f((l+1)/2)-(l<0||l%2),s=new q(t=c==1/0?"5e"+l:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+l)):s=new q(c+""),s.c[0])for((c=(l=s.e)+d)<3&&(c=0);;)if(i=s,s=m.times(i.plus(n(r,i,d,1))),p(i.c).slice(0,c)===(t=p(s.c)).slice(0,c)){if(s.e<l&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(a||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(z(s,s.e+O+2,1),e=!s.times(s).eq(r));break}if(!a&&(z(i,i.e+O+2,0),i.times(i).eq(r))){s=i;break}d+=4,c+=4,a=1}return z(s,s.e+O+1,N,e)},j.toExponential=function(e,t){return null!=e&&(k(e,0,h),e++),$(this,e,t,1)},j.toFixed=function(e,t){return null!=e&&(k(e,0,h),e=e+this.e+1),$(this,e,t)},j.toFormat=function(e,t,n){var s,a=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=H;else if("object"!=typeof n)throw Error(r+"Argument not an object: "+n);if(s=a.toFixed(e,t),a.c){var i,o=s.split("."),c=+n.groupSize,l=+n.secondaryGroupSize,d=n.groupSeparator||"",m=o[0],u=o[1],h=a.s<0,f=h?m.slice(1):m,p=f.length;if(l&&(i=c,c=l,l=i,p-=i),c>0&&p>0){for(i=p%c||c,m=f.substr(0,i);i<p;i+=c)m+=d+f.substr(i,c);l>0&&(m+=d+f.slice(i)),h&&(m="-"+m)}s=u?m+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?u.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):u):m}return(n.prefix||"")+s+(n.suffix||"")},j.toFraction=function(e){var t,s,a,i,o,c,d,u,h,f,g,k,b=this,w=b.c;if(null!=e&&(!(d=new q(e)).isInteger()&&(d.c||1!==d.s)||d.lt(P)))throw Error(r+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+Y(d));if(!w)return new q(b);for(t=new q(P),h=s=new q(P),a=u=new q(P),k=p(w),o=t.e=k.length-b.e-1,t.c[0]=m[(c=o%l)<0?l+c:c],e=!e||d.comparedTo(t)>0?o>0?t:h:d,c=R,R=1/0,d=new q(k),u.c[0]=0;f=n(d,t,0,1),1!=(i=s.plus(f.times(a))).comparedTo(e);)s=a,a=i,h=u.plus(f.times(i=h)),u=i,t=d.minus(f.times(i=t)),d=i;return i=n(e.minus(s),a,0,1),u=u.plus(i.times(h)),s=s.plus(i.times(a)),u.s=h.s=b.s,g=n(h,a,o*=2,N).minus(b).abs().comparedTo(n(u,s,o,N).minus(b).abs())<1?[h,a]:[u,s],R=c,g},j.toNumber=function(){return+Y(this)},j.toPrecision=function(e,t){return null!=e&&k(e,1,h),$(this,e,t,2)},j.toString=function(e){var t,n=this,s=n.s,a=n.e;return null===a?s?(t="Infinity",s<0&&(t="-"+t)):t="NaN":(null==e?t=a<=F||a>=M?w(p(n.c),a):y(p(n.c),a,"0"):10===e&&W?t=y(p((n=z(new q(n),O+a+1,N)).c),n.e,"0"):(k(e,2,U.length,"Base"),t=T(y(p(n.c),a,"0"),10,e,s,!0)),s<0&&n.c[0]&&(t="-"+t)),t},j.valueOf=j.toJSON=function(){return Y(this)},j._isBigNumber=!0,null!=t&&q.set(t),q}(),n.default=n.BigNumber=n,"function"==typeof define&&define.amd?define(function(){return n}):void 0!==t&&t.exports?t.exports=n:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=n)}(this)}}},{package:"@metamask/bridge-status-controller>bignumber.js",file:"node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/browser-passworder/dist/index.js",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.isVaultUpdated=n.updateVaultWithDetail=n.updateVault=n.generateSalt=n.serializeBufferForStorage=n.serializeBufferFromStorage=n.keyFromPassword=n.exportKey=n.importKey=n.decryptWithKey=n.decryptWithDetail=n.decrypt=n.encryptWithKey=n.encryptWithDetail=n.encrypt=void 0;const s=e("@metamask/utils"),a="jwk",i="AES-GCM",r="utf-8",o={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function l(e,t,n,s=g(),a=c){const i=n||await p(e,s,!1,a),r=await m(i,t);return r.salt=s,JSON.stringify(r)}async function d(e,t,n=g(),s=c){const a=await p(e,n,!0,s),i=await f(a);return{vault:await l(e,t,a,n),exportedKeyString:i}}async function m(e,n){const s=JSON.stringify(n),a=t.from(s,r),o=globalThis.crypto.getRandomValues(new Uint8Array(16)),c=w(e),l=await globalThis.crypto.subtle.encrypt({name:i,iv:o},c,a),d=new Uint8Array(l),m=t.from(o).toString("base64"),u={data:t.from(d).toString("base64"),iv:m};return k(e)&&(u.keyMetadata=e.derivationOptions),u}async function u(e,t,n){const s=JSON.parse(t),{salt:a,keyMetadata:i}=s,r=w(n||await p(e,a,!1,i));return await h(r,s)}async function h(e,n){const s=t.from(n.data,"base64"),a=t.from(n.iv,"base64"),o=w(e);let c;try{const e=await crypto.subtle.decrypt({name:i,iv:a},o,s),n=new Uint8Array(e),l=t.from(n).toString(r);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,n,s=!1,a=o){const c=t.from(e,r),l=t.from(n,"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:i,length:256},s,["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,s.isPlainObject)(e)&&(0,s.hasProperty)(e,"key")&&(0,s.hasProperty)(e,"derivationOptions")&&e.key instanceof CryptoKey&&b(e.derivationOptions)}function b(e){return(0,s.isPlainObject)(e)&&(0,s.hasProperty)(e,"algorithm")&&(0,s.hasProperty)(e,"params")}function w(e){return k(e)?e.key:e}function y(e,t=c){const{keyMetadata:n}=JSON.parse(e);return b(n)&&n.algorithm===t.algorithm&&n.params.iterations===t.params.iterations}n.encrypt=l,n.encryptWithDetail=d,n.encryptWithKey=m,n.decrypt=u,n.decryptWithDetail=async function(e,t){const n=JSON.parse(t),{salt:s,keyMetadata:a}=n,i=await p(e,s,!0,a);return{exportedKeyString:await f(i),vault:await u(e,t,i),salt:s}},n.decryptWithKey=h,n.importKey=async function(e){const t=JSON.parse(e);return n=t,(0,s.isPlainObject)(n)&&(0,s.hasProperty)(n,"key")&&(0,s.hasProperty)(n,"derivationOptions")&&b(n.derivationOptions)?{key:await globalThis.crypto.subtle.importKey(a,t.key,i,!0,["encrypt","decrypt"]),derivationOptions:t.derivationOptions}:await globalThis.crypto.subtle.importKey(a,t,i,!0,["encrypt","decrypt"]);var n},n.exportKey=f,n.keyFromPassword=p,n.serializeBufferFromStorage=function(e){const t="0x"===e.slice(0,2)?e.slice(2):e,n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const s=t.substr(e,2);n[e/2]=parseInt(s,16)}return n},n.serializeBufferForStorage=function(e){let t="0x";return e.forEach(e=>{t+=function(e){let t=e.toString(16);for(;t.length<2;)t=`0${t}`;return t}(e)}),t},n.generateSalt=g,n.updateVault=async function(e,t,n=c){return y(e,n)?e:l(t,await u(t,e),undefined,undefined,n)},n.updateVaultWithDetail=async function(e,t,n=c){return y(e.vault,n)?e:d(t,await u(t,e.vault),undefined,n)},n.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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ConnectivityController=n.getDefaultConnectivityControllerState=n.controllerName=void 0;const s=e("@metamask/base-controller"),a=e("./types.cjs");n.controllerName="ConnectivityController";const i={connectivityStatus:{persist:!1,includeInDebugSnapshot:!0,includeInStateLogs:!0,usedInUi:!0}};function r(){return{connectivityStatus:a.CONNECTIVITY_STATUSES.Online}}n.getDefaultConnectivityControllerState=r;class o extends s.BaseController{constructor({messenger:e,connectivityAdapter:t}){const s=t.getStatus();super({messenger:e,metadata:i,name:n.controllerName,state:{...r(),connectivityStatus:s}}),t.onConnectivityChange(e=>{this.update(t=>{t.connectivityStatus=e})})}}n.ConnectivityController=o}}},{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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getDefaultConnectivityControllerState=n.ConnectivityController=n.CONNECTIVITY_STATUSES=void 0;var s=e("./types.cjs");Object.defineProperty(n,"CONNECTIVITY_STATUSES",{enumerable:!0,get:function(){return s.CONNECTIVITY_STATUSES}});var a=e("./ConnectivityController.cjs");Object.defineProperty(n,"ConnectivityController",{enumerable:!0,get:function(){return a.ConnectivityController}}),Object.defineProperty(n,"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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.CONNECTIVITY_STATUSES=void 0,n.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,n){var s,a,i=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},r=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=n.controllerName=void 0;const o=e("@metamask/base-controller"),c=e("@metamask/keyring-controller"),l=e("@metamask/utils"),d=e("./constants.cjs"),m=e("./utils.cjs");n.controllerName="DelegationController";const u={delegations:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};class h extends o.BaseController{constructor({messenger:e,state:t,hashDelegation:r,getDelegationEnvironment:o}){super({messenger:e,metadata:u,name:n.controllerName,state:{delegations:{},...t}}),s.set(this,void 0),a.set(this,void 0),i(this,s,r,"f"),i(this,a,o,"f")}async signDelegation(e){const{delegation:t,chainId:n}=e,{DelegationManager:s}=r(this,a,"f").call(this,n),i=(0,m.createTypedMessageParams)({chainId:(0,l.hexToNumber)(n),from:t.delegator,delegation:{...t,signature:"0x"},verifyingContract:s});return await this.messenger.call("KeyringController:signTypedMessage",i,c.SignTypedDataVersion.V4)}store(e){const{entry:t}=e,n=r(this,s,"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[n]=t})}list(e){const t=this.messenger.call("AccountsController:getSelectedAccount").address;let n=Object.values(this.state.delegations);e?.from&&(n=n.filter(t=>(0,m.isHexEqual)(t.delegation.delegator,e.from))),(!e?.from||e?.from&&!(0,m.isHexEqual)(e.from,t))&&(n=n.filter(e=>(0,m.isHexEqual)(e.delegation.delegate,t)));const s=e?.chainId;s&&(n=n.filter(e=>(0,m.isHexEqual)(e.chainId,s)));const a=e?.tags;return a&&a.length>0&&(n=n.filter(e=>a.every(t=>e.tags.includes(t)))),n}retrieve(e){return this.state.delegations[e]??null}chain(e){const t=[],n=this.retrieve(e);if(!n)return null;t.push(n);for(let e=n.delegation.authority;e!==d.ROOT_AUTHORITY;){const n=this.retrieve(e);if(!n)throw new Error("Invalid delegation chain");t.push(n),e=n.delegation.authority}return t}delete(e){if(!this.retrieve(e))return 0;const t=Object.entries(this.state.delegations),n=[e],s=[];for(;n.length>0;){const e=n.pop();t.filter(([t,n])=>n.delegation.authority===e).forEach(([e])=>{n.push(e)}),s.push(e)}return this.update(e=>{s.forEach(t=>{delete e.delegations[t]})}),s.length}}n.DelegationController=h,s=new WeakMap,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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SIGNABLE_DELEGATION_TYPED_DATA=n.ROOT_AUTHORITY=void 0,n.ROOT_AUTHORITY="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";n.SIGNABLE_DELEGATION_TYPED_DATA={EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Caveat:[{name:"enforcer",type:"address"},{name:"terms",type:"bytes"}],Delegation:[{name:"delegate",type:"address"},{name:"delegator",type:"address"},{name:"authority",type:"bytes32"},{name:"caveats",type:"Caveat[]"},{name:"salt",type:"uint256"}]}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/index.cjs",{"./DelegationController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=void 0;var s=e("./DelegationController.cjs");Object.defineProperty(n,"DelegationController",{enumerable:!0,get:function(){return s.DelegationController}})}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createTypedMessageParams=n.toDelegationStruct=n.isHexEqual=void 0;const s=e("@metamask/utils"),a=e("./constants.cjs");n.isHexEqual=function(e,t){return e.toLowerCase()===t.toLowerCase()};n.toDelegationStruct=e=>{const t=e.caveats.map(e=>({enforcer:(0,s.getChecksumAddress)(e.enforcer),terms:e.terms,args:e.args})),n="0x"===e.salt?0n:BigInt(e.salt);return{delegate:(0,s.getChecksumAddress)(e.delegate),delegator:(0,s.getChecksumAddress)(e.delegator),authority:e.authority,caveats:t,salt:n,signature:e.signature}},n.createTypedMessageParams=function(e){const{chainId:t,from:s,delegation:i,verifyingContract:r}=e;return{data:{types:a.SIGNABLE_DELEGATION_TYPED_DATA,primaryType:"Delegation",domain:{chainId:t,name:"DelegationManager",version:"1",verifyingContract:r},message:(0,n.toDelegationStruct)(i)},from:s}}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-deployments/dist/index.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var s={DelegationManager:"0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c",MultiSigDeleGatorImpl:"0x56a9EdB16a0105eb5a4C54f4C062e2868844f3A7",HybridDeleGatorImpl:"0x48dBe696A4D990079e039489bA2053B36E8FFEC4",EIP7702StatelessDeleGatorImpl:"0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B",AllowedCalldataEnforcer:"0xc2b0d624c1c4319760C96503BA27C347F3260f55",AllowedMethodsEnforcer:"0x2c21fD0Cb9DC8445CB3fb0DC5E7Bb0Aca01842B5",AllowedTargetsEnforcer:"0x7F20f61b1f09b08D970938F6fa563634d65c4EeB",BlockNumberEnforcer:"0x5d9818dF0AE3f66e9c3D0c5029DAF99d1823ca6c",DeployedEnforcer:"0x24ff2AA430D53a8CD6788018E902E098083dcCd2",ERC20BalanceChangeEnforcer:"0xcdF6aB796408598Cea671d79506d7D48E97a5437",ERC20TransferAmountEnforcer:"0xf100b0819427117EcF76Ed94B358B1A5b5C6D2Fc",ERC20PeriodTransferEnforcer:"0x474e3Ae7E169e940607cC624Da8A15Eb120139aB",ERC20StreamingEnforcer:"0x56c97aE02f233B29fa03502Ecc0457266d9be00e",ERC721BalanceChangeEnforcer:"0x8aFdf96eDBbe7e1eD3f5Cd89C7E084841e12A09e",ERC721TransferEnforcer:"0x3790e6B7233f779b09DA74C72b6e94813925b9aF",ERC1155BalanceChangeEnforcer:"0x63c322732695cAFbbD488Fc6937A0A7B66fC001A",ExactCalldataBatchEnforcer:"0x982FD5C86BBF425d7d1451f974192d4525113DfD",ExactCalldataEnforcer:"0x99F2e9bF15ce5eC84685604836F71aB835DBBdED",ExactExecutionBatchEnforcer:"0x1e141e455d08721Dd5BCDA1BaA6Ea5633Afd5017",ExactExecutionEnforcer:"0x146713078D39eCC1F5338309c28405ccf85Abfbb",IdEnforcer:"0xC8B5D93463c893401094cc70e66A206fb5987997",LimitedCallsEnforcer:"0x04658B29F6b82ed55274221a06Fc97D318E25416",NativeBalanceChangeEnforcer:"0xbD7B277507723490Cd50b12EaaFe87C616be6880",ArgsEqualityCheckEnforcer:"0x44B8C6ae3C304213c3e298495e12497Ed3E56E41",NativeTokenPaymentEnforcer:"0x4803a326ddED6dDBc60e659e5ed12d85c7582811",NativeTokenTransferAmountEnforcer:"0xF71af580b9c3078fbc2BBF16FbB8EEd82b330320",NativeTokenStreamingEnforcer:"0xD10b97905a320b13a0608f7E9cC506b56747df19",NativeTokenPeriodTransferEnforcer:"0x9BC0FAf4Aca5AE429F4c06aEEaC517520CB16BD9",NonceEnforcer:"0xDE4f2FAC4B3D87A1d9953Ca5FC09FCa7F366254f",OwnershipTransferEnforcer:"0x7EEf9734E7092032B5C56310Eb9BbD1f4A524681",RedeemerEnforcer:"0xE144b0b2618071B4E56f746313528a669c7E65c5",SpecificActionERC20TransferBatchEnforcer:"0x6649b61c873F6F9686A1E1ae9ee98aC380c7bA13",TimestampEnforcer:"0x1046bb45C8d673d4ea75321280DB34899413c069",ValueLteEnforcer:"0x92Bf12322527cAA612fd31a0e810472BBB106A8F",MultiTokenPeriodEnforcer:"0xFB2f1a9BD76d3701B730E5d69C3219D42D80eBb7"},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"},i={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"},r={arbitrum:42161,arbitrumNova:42170,base:8453,berachain:80094,bsc:56,gnosis:100,ink:57073,linea:59144,mainnet:1,monad:143,optimism:10,polygon:137,sei:1329,sonic:146,unichain:130,bscTestnet:97,arbitrumSepolia:421614,baseSepolia:84532,berachainBepolia:80069,chiado:10200,citreaTestnet:5115,hoodiTestnet:560048,inkSepolia:763373,lineaSepolia:59141,megaEthTestnet:6342,monadTestnet:10143,optimismSepolia:11155420,polygonAmoy:80002,seiTestnet:1328,sepolia:11155111,sonicTestnet:14601,unichainSepolia:1301,lineaGoerli:59140},o={"1.0.0":{[r.optimism]:i,[r.polygon]:i,[r.base]:i,[r.arbitrum]:i,[r.linea]:i,[r.sepolia]:{...i,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"},[r.lineaSepolia]:{...i,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"}},"1.1.0":{[r.arbitrum]:a,[r.base]:a,[r.linea]:a,[r.optimism]:a,[r.polygon]:a,[r.sepolia]:a,[r.lineaSepolia]:a,[r.baseSepolia]:{...a,SimpleFactory:"0xE8eA1DE8D6AfE400B7C8C1A81B7C29B7876b4d02"}},"1.3.0":{[r.mainnet]:s,[r.polygon]:s,[r.bsc]:s,[r.optimism]:s,[r.arbitrum]:s,[r.ink]:s,[r.linea]:s,[r.base]:s,[r.gnosis]:s,[r.berachain]:s,[r.unichain]:s,[r.arbitrumNova]:s,[r.sei]:s,[r.sonic]:s,[r.monad]:s,[r.bscTestnet]:s,[r.citreaTestnet]:s,[r.megaEthTestnet]:s,[r.chiado]:s,[r.lineaSepolia]:s,[r.berachainBepolia]:s,[r.baseSepolia]:s,[r.arbitrumSepolia]:s,[r.sepolia]:s,[r.optimismSepolia]:s,[r.unichainSepolia]:s,[r.polygonAmoy]:s,[r.inkSepolia]:s,[r.monadTestnet]:s,[r.seiTestnet]:s,[r.sonicTestnet]:s,[r.hoodiTestnet]:s}};n.CHAIN_ID=r,n.DELEGATOR_CONTRACTS=o}}},{package:"@metamask/delegation-deployments",file:"node_modules/@metamask/delegation-deployments/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.GetCallsStatusCode=n.EIP7682ErrorCode=n.EIP5792ErrorCode=n.SupportedCapabilities=n.MessageType=n.KEYRING_TYPES_SUPPORTING_7702=n.VERSION=void 0;const s=e("@metamask/keyring-controller");var a,i,r,o,c;n.VERSION="2.0.0",n.KEYRING_TYPES_SUPPORTING_7702=[s.KeyringTypes.hd,s.KeyringTypes.simple],function(e){e.SendTransaction="eth_sendTransaction"}(a||(n.MessageType=a={})),function(e){e.AuxiliaryFunds="auxiliaryFunds"}(i||(n.SupportedCapabilities=i={})),function(e){e[e.UnsupportedNonOptionalCapability=5700]="UnsupportedNonOptionalCapability",e[e.UnsupportedChainId=5710]="UnsupportedChainId",e[e.UnknownBundleId=5730]="UnknownBundleId",e[e.RejectedUpgrade=5750]="RejectedUpgrade"}(r||(n.EIP5792ErrorCode=r={})),function(e){e[e.UnsupportedAsset=5771]="UnsupportedAsset",e[e.UnsupportedChain=5772]="UnsupportedChain",e[e.MalformedRequiredAssets=5773]="MalformedRequiredAssets"}(o||(n.EIP7682ErrorCode=o={})),function(e){e[e.PENDING=100]="PENDING",e[e.CONFIRMED=200]="CONFIRMED",e[e.FAILED_OFFCHAIN=400]="FAILED_OFFCHAIN",e[e.REVERTED=500]="REVERTED",e[e.REVERTED_PARTIAL=600]="REVERTED_PARTIAL"}(c||(n.GetCallsStatusCode=c={}))}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCallsStatus=void 0;const s=e("@metamask/rpc-errors"),a=e("@metamask/transaction-controller"),i=e("../constants.cjs");n.getCallsStatus=function(e,t){const n=e.call("TransactionController:getState").transactions.filter(e=>e.batchId===t);if(!n?.length)throw new s.JsonRpcError(i.EIP5792ErrorCode.UnknownBundleId,"No matching bundle found");const r=n[0],{chainId:o,txReceipt:c}=r,l=function(e){const{hash:t,status:n}=e;if(n===a.TransactionStatus.confirmed)return i.GetCallsStatusCode.CONFIRMED;if(n===a.TransactionStatus.failed)return t?i.GetCallsStatusCode.REVERTED:i.GetCallsStatusCode.FAILED_OFFCHAIN;if(n===a.TransactionStatus.dropped)return i.GetCallsStatusCode.REVERTED;return i.GetCallsStatusCode.PENDING}(r),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:i.VERSION,id:t,chainId:o,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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCapabilities=void 0;const s=e("../constants.cjs"),a=e("../utils.cjs");n.getCapabilities=async function(e,t,n,i){const{getDismissSmartAccountSuggestionEnabled:r,getIsSmartTransaction:o,isAtomicBatchSupported:c,isRelaySupported:l,getSendBundleSupportedChains:d,isAuxiliaryFundsSupported:m}=e;let u=i?.map(e=>e.toLowerCase());if(!u?.length){const e=t.call("NetworkController:getState").networkConfigurationsByChainId;u=Object.keys(e)}const h=await c({address:n,chainIds:u}),f=await async function(e,t,n,s,a,i){const r=i.call("PreferencesController:getState").useTransactionSimulations,o=await Promise.all(t.map(({chainId:e})=>e).map(e=>s(e))),c=await a(e),l=t.map((e,t)=>({...e,relaySupportedForChain:o[t]}));return e.reduce((e,t)=>{const s=l.find(({chainId:e})=>e===t)??{},{isSupported:a=!1,relaySupportedForChain:i}=s,o=n(t),d=c[t]??!1;return r&&(o&&d||a&&i)&&(e[t]={alternateGasFees:{supported:!0}}),e},{})}(u,h,o,l,d,t);return u.reduce((e,i)=>{const o=h.find(({chainId:e})=>e===i)??{},{delegationAddress:c,isSupported:l,upgradeContractAddress:d}=o,u=r();let f=!1;try{const e=(0,a.getAccountKeyringType)(n,t);f=s.KEYRING_TYPES_SUPPORTING_7702.includes(e)}catch{}if(!l&&!(!u&&d&&!c&&f))return e;const p=l?"supported":"ready",g=i;return e[g]===undefined&&(e[g]={}),e[g].atomic={status:p},f&&m(i)&&(e[g].auxiliaryFunds={supported:!0}),e},f)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.processSendCalls=void 0;const s=e("@metamask/rpc-errors"),a=e("@metamask/transaction-controller"),i=e("@metamask/utils"),r=e("lodash"),o=e("uuid"),c=e("../constants.cjs"),l=e("../utils.cjs");function d(e){const{version:t}=e;if(t!==c.VERSION)throw s.rpcErrors.invalidInput(`Version not supported: Got ${t}, expected ${c.VERSION}`)}function m(e,t){const{chainId:n}=e;if(n&&n.toLowerCase()!==t.toLowerCase())throw s.rpcErrors.invalidParams(`Chain ID must match the dApp selected network: Got ${n}, expected ${t}`)}function u(e,t,n){const{calls:a,capabilities:i,chainId:r}=e,o=[...Object.keys(i??{}).filter(e=>e!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==i?.[e].optional),...a.flatMap(e=>Object.keys(e.capabilities??{}).filter(t=>t!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==e.capabilities?.[t].optional))];if(o?.length)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capabilities: ${o.join(", ")}`);i?.auxiliaryFunds&&h({auxiliaryFunds:i.auxiliaryFunds,chainId:r,keyringType:t,isAuxiliaryFundsSupported:n});for(const e of a)e.capabilities?.auxiliaryFunds&&h({auxiliaryFunds:e.capabilities.auxiliaryFunds,chainId:r,keyringType:t,isAuxiliaryFundsSupported:n})}function h({auxiliaryFunds:e,chainId:t,keyringType:n,isAuxiliaryFundsSupported:a}){if(e.optional)return;if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(n))throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capability: ${c.SupportedCapabilities.AuxiliaryFunds}`);if(!a(t))throw new s.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 s.JsonRpcError(c.EIP7682ErrorCode.UnsupportedAsset,`The requested asset ${t.address} is not available through the wallet’s auxiliary fund system: unsupported token standard ${t.standard}`)}function f(e){const t=[...e.capabilities?.auxiliaryFunds?.requiredAssets??[],...e.calls.flatMap(e=>e.capabilities?.auxiliaryFunds?.requiredAssets??[])];if(0===t.length)return undefined;const n=(0,r.groupBy)(t,e=>`${e.address.toLowerCase()}-${e.standard}`);return Object.values(n).map(e=>{if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+BigInt(t.amount),0n);return{...e[0],amount:(0,i.add0x)(t.toString(16))}})}n.processSendCalls=async function(e,t,n,r){const{addTransactionBatch:h,addTransaction:p,getDismissSmartAccountSuggestionEnabled:g,isAtomicBatchSupported:k,validateSecurity:b,getPermittedAccountsForOrigin:w,isAuxiliaryFundsSupported:y}=e,{calls:T,from:_}=n,{networkClientId:x,origin:E}=r,v=T.map(e=>({params:e})),{chainId:I}=t.call("NetworkController:getNetworkClientById",x).configuration,[S]=await w(),C=_??S;if(!C)throw s.providerErrors.unauthorized();const A=(0,o.v4)(),j=b.bind(null,A),P=r.id?String(r.id):"";let O;return O=1===Object.keys(v).length?await async function({addTransaction:e,chainId:t,from:n,messenger:s,networkClientId:r,origin:h,requestId:p,securityAlertId:g,sendCalls:k,transactions:b,validateSecurity:w,isAuxiliaryFundsSupported:y}){const T=(0,l.getAccountKeyringType)(n,s);!function(e,t,n,s){d(e),u(e,n,s),m(e,t)}(k,t,T,y);const _={from:n,...b[0].params,type:a.TransactionEnvelopeType.feeMarket},x={method:c.MessageType.SendTransaction,params:[_],origin:h};w(x,t);const E=f(k),v=function(){const e=(0,o.v4)(),t=new Uint8Array((0,o.parse)(e));return(0,i.bytesToHex)(t)}();return await e(_,{batchId:v,networkClientId:r,origin:h,requestId:p,requiredAssets:E,securityAlertResponse:{securityAlertId:g}}),v}({addTransaction:p,chainId:I,from:C,messenger:t,networkClientId:x,origin:E,requestId:P,securityAlertId:A,sendCalls:n,transactions:v,validateSecurity:j,isAuxiliaryFundsSupported:y}):await async function({addTransactionBatch:e,isAtomicBatchSupported:t,chainId:n,from:a,getDismissSmartAccountSuggestionEnabled:i,networkClientId:r,messenger:o,origin:h,requestId:p,sendCalls:g,securityAlertId:k,transactions:b,validateSecurity:w,isAuxiliaryFundsSupported:y}){const T=await t({address:a,chainIds:[n]}),_=T?.[0],x=(0,l.getAccountKeyringType)(a,o),E=i();!function(e,t,n,a,i,r){d(e),function(e,t,n){if(m(e,t),!n)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedChainId,`EIP-7702 not supported on chain: ${t}`)}(e,t,a),u(e,i,r),function(e,t,n){if(t?.delegationAddress)return;if(e)throw new s.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade disabled by the user");if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(n))throw new s.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported on account")}(n,a,i)}(g,n,E,_,x,y);const v=f(g),I=await e({from:a,networkClientId:r,origin:h,requestId:p,requiredAssets:v,securityAlertId:k,transactions:b,validateSecurity:w});return I.batchId}({addTransactionBatch:h,isAtomicBatchSupported:k,chainId:I,from:C,getDismissSmartAccountSuggestionEnabled:g,messenger:t,networkClientId:x,origin:E,requestId:P,sendCalls:n,securityAlertId:A,transactions:v,validateSecurity:j,isAuxiliaryFundsSupported:y}),{id:O}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/index.cjs",{"./hooks/getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs","./hooks/getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs","./hooks/processSendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs","./methods/wallet_getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs","./methods/wallet_getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs","./methods/wallet_sendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCapabilities=n.walletGetCallsStatus=n.walletSendCalls=n.getCapabilities=n.getCallsStatus=n.processSendCalls=void 0;var s=e("./hooks/processSendCalls.cjs");Object.defineProperty(n,"processSendCalls",{enumerable:!0,get:function(){return s.processSendCalls}});var a=e("./hooks/getCallsStatus.cjs");Object.defineProperty(n,"getCallsStatus",{enumerable:!0,get:function(){return a.getCallsStatus}});var i=e("./hooks/getCapabilities.cjs");Object.defineProperty(n,"getCapabilities",{enumerable:!0,get:function(){return i.getCapabilities}});var r=e("./methods/wallet_sendCalls.cjs");Object.defineProperty(n,"walletSendCalls",{enumerable:!0,get:function(){return r.walletSendCalls}});var o=e("./methods/wallet_getCallsStatus.cjs");Object.defineProperty(n,"walletGetCallsStatus",{enumerable:!0,get:function(){return o.walletGetCallsStatus}});var c=e("./methods/wallet_getCapabilities.cjs");Object.defineProperty(n,"walletGetCapabilities",{enumerable:!0,get:function(){return c.walletGetCapabilities}})}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCallsStatus=void 0;const s=e("@metamask/rpc-errors"),a=e("../types.cjs"),i=e("../utils.cjs");n.walletGetCallsStatus=async function(e,t,{getCallsStatus:n}){if(!n)throw s.rpcErrors.methodNotSupported();(0,i.validateParams)(e.params,a.GetCallsStatusStruct);const r=e.params[0];t.result=await n(r,e)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCapabilities=void 0;const s=e("@metamask/rpc-errors"),a=e("../types.cjs"),i=e("../utils.cjs");n.walletGetCapabilities=async function(e,t,{getPermittedAccountsForOrigin:n,getCapabilities:r}){if(!r)throw s.rpcErrors.methodNotSupported();(0,i.validateParams)(e.params,a.GetCapabilitiesStruct);const o=e.params[0],c=e.params[1];await(0,i.validateAndNormalizeKeyholder)(o,{getPermittedAccountsForOrigin:n});const l=await r(o,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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletSendCalls=void 0;const s=e("@metamask/rpc-errors"),a=e("../types.cjs"),i=e("../utils.cjs");n.walletSendCalls=async function(e,t,{getPermittedAccountsForOrigin:n,processSendCalls:r}){if(!r)throw s.rpcErrors.methodNotSupported();(0,i.validateParams)(e.params,a.SendCallsStruct);const o=e.params[0],c=o.from?await(0,i.validateAndNormalizeKeyholder)(o.from,{getPermittedAccountsForOrigin:n}):undefined,l={...o,from:c};t.result=await r(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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SendCallsStruct=n.CapabilitiesStruct=n.GetCapabilitiesStruct=n.GetCallsStatusStruct=void 0;const s=e("@metamask/superstruct"),a=e("@metamask/utils");n.GetCallsStatusStruct=(0,s.tuple)([a.StrictHexStruct]),n.GetCapabilitiesStruct=(0,s.tuple)([a.HexChecksumAddressStruct,(0,s.optional)((0,s.array)(a.StrictHexStruct))]);const i=(0,s.type)({address:(0,s.nonempty)(a.HexChecksumAddressStruct),amount:(0,s.nonempty)(a.StrictHexStruct),standard:(0,s.nonempty)((0,s.string)())});n.CapabilitiesStruct=(0,s.record)((0,s.string)(),(0,s.type)({optional:(0,s.optional)((0,s.boolean)()),requiredAssets:(0,s.optional)((0,s.array)(i))})),n.SendCallsStruct=(0,s.tuple)([(0,s.object)({version:(0,s.nonempty)((0,s.string)()),id:(0,s.optional)(a.StrictHexStruct),from:(0,s.optional)(a.HexChecksumAddressStruct),chainId:a.StrictHexStruct,atomicRequired:(0,s.boolean)(),calls:(0,s.array)((0,s.object)({to:(0,s.optional)(a.HexChecksumAddressStruct),data:(0,s.optional)(a.StrictHexStruct),value:(0,s.optional)(a.StrictHexStruct),capabilities:(0,s.optional)(n.CapabilitiesStruct)})),capabilities:(0,s.optional)(n.CapabilitiesStruct)})])}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.resemblesAddress=n.validateParams=n.validateAndNormalizeKeyholder=n.getAccountKeyringType=void 0;const s=e("@metamask/rpc-errors"),a=e("@metamask/superstruct"),i=e("./constants.cjs");function r(e){return 42===e.length}n.getAccountKeyringType=function(e,t){const{accounts:n}=t.call("AccountsController:getState").internalAccounts,a=Object.values(n).find(t=>t.address.toLowerCase()===e.toLowerCase()),r=a?.metadata?.keyring?.type;if(!r)throw new s.JsonRpcError(i.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported as account type is unknown");return r},n.validateAndNormalizeKeyholder=async function(e,{getPermittedAccountsForOrigin:t}){if("string"==typeof e&&e.length>0&&r(e)){const n=(await t()).map(e=>e.toLowerCase()),a=e.toLowerCase();if(n.includes(a))return a;throw s.providerErrors.unauthorized()}throw s.rpcErrors.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})},n.validateParams=function(e,t){const[n]=(0,a.validate)(e,t);if(n)throw s.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(n,"Invalid params"))},n.resemblesAddress=r}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs",{"./gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","./gas-flows/LineaGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs","./gas-flows/OptimismLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs","./gas-flows/RandomisedEstimationsGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs","./gas-flows/ScrollLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs","./gas-flows/TestGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs","./helpers/AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs","./helpers/GasFeePoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs","./helpers/IncomingTransactionHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs","./helpers/MethodDataHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs","./helpers/MultichainTrackingHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs","./helpers/PendingTransactionTracker.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs","./helpers/ResimulateHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs","./hooks/ExtraTransactionsPublishHook.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils/balance-changes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs","./utils/batch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs","./utils/eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs","./utils/external-transactions.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/external-transactions.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","./utils/first-time-interaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/first-time-interaction.cjs","./utils/gas-fee-tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fee-tokens.cjs","./utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","./utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./utils/gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas.cjs","./utils/layer1-gas-fee-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/layer1-gas-fee-flow.cjs","./utils/nonce.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/nonce.cjs","./utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","./utils/retry.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/retry.cjs","./utils/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/swaps.cjs","./utils/transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","./utils/validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/validation.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/network-controller/dist/index.cjs","@metamask/nonce-tracker":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/nonce-tracker/dist/index.js","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p,g,k,b,w,y,T,_,x,E,v,I,S,C,A,j,P,O,N,F,M,D,R,B,L,G,H,U,W,q,$,K,V,z,Y,J,Q,X,Z,ee,te,ne,se,ae,ie,re,oe,ce,le,de,me,ue,he,fe,pe,ge,ke,be,we,ye,Te,_e,xe,Ee,ve,Ie,Se,Ce,Ae,je,Pe,Oe,Ne,Fe,Me,De,Re,Be,Le,Ge,He,Ue,We,qe,$e,Ke,Ve,ze,Ye,Je,Qe,Xe,Ze,et,tt=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},nt=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},st=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.TransactionController=n.ApprovalState=n.SPEED_UP_RATE=n.CANCEL_RATE=void 0;const at=e("@metamask/base-controller"),it=e("@metamask/controller-utils"),rt=st(e("@metamask/eth-query")),ot=e("@metamask/network-controller"),ct=e("@metamask/nonce-tracker"),lt=e("@metamask/rpc-errors"),dt=e("@metamask/utils"),mt=e("events"),ut=e("lodash"),ht=e("uuid"),ft=e("./gas-flows/DefaultGasFeeFlow.cjs"),pt=e("./gas-flows/LineaGasFeeFlow.cjs"),gt=e("./gas-flows/OptimismLayer1GasFeeFlow.cjs"),kt=e("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs"),bt=e("./gas-flows/ScrollLayer1GasFeeFlow.cjs"),wt=e("./gas-flows/TestGasFeeFlow.cjs"),yt=e("./helpers/AccountsApiRemoteTransactionSource.cjs"),Tt=e("./helpers/GasFeePoller.cjs"),_t=e("./helpers/IncomingTransactionHelper.cjs"),xt=e("./helpers/MethodDataHelper.cjs"),Et=e("./helpers/MultichainTrackingHelper.cjs"),vt=e("./helpers/PendingTransactionTracker.cjs"),It=e("./helpers/ResimulateHelper.cjs"),St=e("./hooks/ExtraTransactionsPublishHook.cjs"),Ct=e("./logger.cjs"),At=e("./types.cjs"),jt=e("./utils/balance-changes.cjs"),Pt=e("./utils/batch.cjs"),Ot=e("./utils/eip7702.cjs"),Nt=e("./utils/external-transactions.cjs"),Ft=e("./utils/feature-flags.cjs"),Mt=e("./utils/first-time-interaction.cjs"),Dt=e("./utils/gas.cjs"),Rt=e("./utils/gas-fee-tokens.cjs"),Bt=e("./utils/gas-fees.cjs"),Lt=e("./utils/gas-flow.cjs"),Gt=e("./utils/layer1-gas-fee-flow.cjs"),Ht=e("./utils/nonce.cjs"),Ut=e("./utils/prepare.cjs"),Wt=e("./utils/retry.cjs"),qt=e("./utils/swaps.cjs"),$t=e("./utils/transaction-type.cjs"),Kt=e("./utils/utils.cjs"),Vt=e("./utils/validation.cjs"),zt={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}};n.CANCEL_RATE=1.1,n.SPEED_UP_RATE=1.1;const Yt="TransactionController";var Jt;!function(e){e.Approved="approved",e.NotApproved="not-approved",e.SkippedViaBeforePublishHook="skipped-via-before-publish-hook"}(Jt||(n.ApprovalState=Jt={}));class Qt extends at.BaseController{constructor(e){const{disableSwaps:t,getCurrentAccountEIP1559Compatibility:n,getCurrentNetworkEIP1559Compatibility:W,getExternalPendingTransactions:q,getGasFeeEstimates:$,getNetworkClientRegistry:K,getNetworkState:z,getPermittedAccounts:Y,getSavedGasFees:J,getSimulationConfig:Q,hooks:X,incomingTransactions:ee={},isAutomaticGasFeeUpdateEnabled:te,isEIP7702GasFeeTokensEnabled:ne,isFirstTimeInteractionEnabled:se,isSimulationEnabled:ae,messenger:ie,pendingTransactions:re={},publicKeyEIP7702:oe,securityProviderRequest:ce,sign:le,state:me,testGasFeeFlows:ue,trace:he}=e;super({name:Yt,metadata:zt,messenger:ie,state:{methodData:{},transactions:[],transactionBatches:[],lastFetchedBlockNumbers:{},submitHistory:[],...me}}),s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.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),T.set(this,void 0),_.set(this,void 0),x.set(this,new mt.EventEmitter),E.set(this,void 0),v.set(this,void 0),I.set(this,void 0),S.set(this,void 0),C.set(this,void 0),A.set(this,void 0),j.set(this,void 0),P.set(this,void 0),O.set(this,void 0),N.set(this,void 0),F.set(this,void 0),M.set(this,void 0),D.set(this,void 0),R.set(this,void 0),B.set(this,void 0),L.set(this,new Map),G.set(this,new Set),H.set(this,void 0),U.set(this,void 0),Se.set(this,()=>{nt(this,O,"f").checkForPendingTransactionAndStartPolling()}),this.messenger=ie,tt(this,a,X?.afterAdd??(()=>Promise.resolve({})),"f"),tt(this,i,X?.afterSign??(()=>!0),"f"),tt(this,r,X?.afterSimulate??(()=>Promise.resolve({})),"f"),tt(this,c,X?.beforeCheckPendingTransaction??(()=>Promise.resolve(!0)),"f"),tt(this,l,X?.beforePublish??(()=>Promise.resolve(!0)),"f"),tt(this,d,X?.beforeSign??(()=>Promise.resolve({})),"f"),tt(this,u,X?.getAdditionalSignArguments??(()=>[]),"f"),tt(this,h,n??(()=>Promise.resolve(!0)),"f"),tt(this,f,W,"f"),tt(this,p,q??(()=>[]),"f"),tt(this,g,$??(()=>Promise.resolve({})),"f"),tt(this,k,z,"f"),tt(this,b,Y,"f"),tt(this,w,J??(e=>undefined),"f"),tt(this,y,Q??(()=>Promise.resolve({})),"f"),tt(this,_,ee,"f"),tt(this,E,te??(e=>!1),"f"),tt(this,v,ne??(()=>Promise.resolve(!1)),"f"),tt(this,I,se??(()=>!0),"f"),tt(this,S,ae??(()=>!0),"f"),tt(this,C,t??!1,"f"),tt(this,A,X?.isTimeoutEnabled??(()=>!0),"f"),tt(this,N,re,"f"),tt(this,F,oe,"f"),tt(this,M,X?.publish??(()=>Promise.resolve({transactionHash:undefined})),"f"),tt(this,D,X?.publishBatch,"f"),tt(this,R,ce,"f"),tt(this,B,le,"f"),tt(this,H,!0===ue,"f"),tt(this,U,he??((e,t)=>t?.()),"f");const fe=e=>this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);tt(this,O,new Et.MultichainTrackingHelper({findNetworkClientIdByChainId:fe,getNetworkClientById:e=>this.messenger.call("NetworkController:getNetworkClientById",e),getNetworkClientRegistry:K,removePendingTransactionTrackerListeners:nt(this,s,"m",je).bind(this),createNonceTracker:nt(this,s,"m",ve).bind(this),createPendingTransactionTracker:nt(this,s,"m",Ie).bind(this),onNetworkStateChange:e=>{this.messenger.subscribe("NetworkController:stateChange",e)}}),"f"),nt(this,O,"f").initialize(),tt(this,m,nt(this,s,"m",Me).call(this),"f"),tt(this,j,nt(this,s,"m",De).call(this),"f");const pe=new Tt.GasFeePoller({findNetworkClientIdByChainId:fe,gasFeeFlows:nt(this,m,"f"),getGasFeeControllerEstimates:nt(this,g,"f"),getProvider:e=>nt(this,s,"m",de).call(this,{networkClientId:e}),getTransactions:()=>this.state.transactions,getTransactionBatches:()=>this.state.transactionBatches,layer1GasFeeFlows:nt(this,j,"f"),messenger:this.messenger,onStateChange:e=>{this.messenger.subscribe("TransactionController:stateChange",e)}});pe.hub.on("transaction-updated",nt(this,s,"m",Le).bind(this)),pe.hub.on("transaction-batch-updated",nt(this,s,"m",Ge).bind(this)),tt(this,P,new xt.MethodDataHelper({getProvider:e=>nt(this,s,"m",de).call(this,{networkClientId:e}),getState:()=>this.state.methodData}),"f"),nt(this,P,"f").hub.on("update",({fourBytePrefix:e,methodData:t})=>{this.update(n=>{n.methodData[e]=t})}),tt(this,T,new _t.IncomingTransactionHelper({client:nt(this,_,"f").client,getCurrentAccount:()=>nt(this,s,"m",Ue).call(this),getLocalTransactions:()=>this.state.transactions,includeTokenTransfers:nt(this,_,"f").includeTokenTransfers,isEnabled:nt(this,_,"f").isEnabled,messenger:this.messenger,remoteTransactionSource:new yt.AccountsApiRemoteTransactionSource,trimTransactions:nt(this,s,"m",Z).bind(this),updateTransactions:nt(this,_,"f").updateTransactions}),"f"),nt(this,s,"m",Ae).call(this,nt(this,T,"f")),this.messenger.subscribe("TransactionController:stateChange",nt(this,Se,"f")),new It.ResimulateHelper({simulateTransaction:nt(this,s,"m",Be).bind(this),onTransactionsUpdate:e=>{this.messenger.subscribe("TransactionController:stateChange",e,e=>e.transactions)},getTransactions:()=>this.state.transactions}),nt(this,s,"m",V).call(this),nt(this,Se,"f").call(this),nt(this,s,"m",Ke).call(this)}destroy(){nt(this,s,"m",Ce).call(this)}async handleMethodData(e,t){return nt(this,P,"f").lookup(e,t)}async addTransactionBatch(e){const{blockTracker:t}=this.messenger.call("NetworkController:getNetworkClientById",e.networkClientId);return await(0,Pt.addTransactionBatch)({addTransaction:this.addTransaction.bind(this),estimateGas:this.estimateGas.bind(this),getChainId:nt(this,s,"m",oe).bind(this),getEthQuery:e=>nt(this,s,"m",le).call(this,{networkClientId:e}),getGasFeeEstimates:nt(this,g,"f"),getInternalAccounts:nt(this,s,"m",We).bind(this),getSimulationConfig:nt(this,y,"f").bind(this),getPendingTransactionTracker:e=>nt(this,s,"m",Ie).call(this,{provider:nt(this,s,"m",de).call(this,{networkClientId:e}),blockTracker:t,chainId:nt(this,s,"m",oe).call(this,e),networkClientId:e}),getTransaction:e=>nt(this,s,"m",ae).call(this,e),isSimulationEnabled:nt(this,S,"f"),messenger:this.messenger,publishBatchHook:nt(this,D,"f"),publicKeyEIP7702:nt(this,F,"f"),publishTransaction:(e,t)=>nt(this,s,"m",Q).call(this,e,t),request:e,signTransaction:nt(this,s,"m",ye).bind(this),update:this.update.bind(this),updateTransaction:nt(this,s,"m",Re).bind(this)})}async isAtomicBatchSupported(e){return(0,Pt.isAtomicBatchSupported)({...e,getEthQuery:e=>nt(this,s,"m",le).call(this,{chainId:e}),messenger:this.messenger,publicKeyEIP7702:nt(this,F,"f")})}async addTransaction(e,t){(0,Ct.projectLogger)("Adding transaction",e,t);const{actionId:n,assetsFiatValues:i,batchId:r,deviceConfirmedOn:o,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:T,securityAlertResponse:_,skipInitialGasEstimate:x,swaps:E={},traceContext:v,type:S}=t;if(e=(0,Kt.normalizeTransactionParams)(e),!nt(this,O,"f").has(p))throw new Error(`Network client not found - ${p}`);const A=nt(this,s,"m",oe).call(this,p),j=nt(this,s,"m",le).call(this,{networkClientId:p}),P=g===undefined?undefined:await(nt(this,b,"f")?.call(this,g)),N=nt(this,s,"m",We).call(this);await(0,Vt.validateTransactionOrigin)({data:e.data,from:e.from,internalAccounts:N,origin:g,permittedAddresses:P,txParams:e,type:S});const F=(0,Ot.getDelegationAddress)(e.from,j).catch(()=>undefined),M=await nt(this,s,"m",we).call(this,p);(0,Vt.validateTxParams)(e,M,A),e.type||(0,Kt.setEnvelopeType)(e,M);if(r?.length&&this.state.transactions.some(e=>e.batchId?.toLowerCase()===r?.toLowerCase())&&g&&g!==it.ORIGIN_METAMASK)throw new lt.JsonRpcError(Vt.ErrorCode.DuplicateBundleId,"Batch ID already exists");const D=nt(this,s,"m",ue).call(this,e,g),B=S??(await(0,$t.determineTransactionType)(e,j)).type,L=nt(this,s,"m",ge).call(this,n);let G=L?(0,ut.cloneDeep)(L):{actionId:n,assetsFiatValues:i,batchId:r,chainId:A,dappSuggestedGasFees:D,deviceConfirmedOn:o,disableGasBuffer:c,id:(0,ht.v1)(),isGasFeeTokenIgnoredIfBalance:Boolean(l),isGasFeeIncluded:d,isGasFeeSponsored:m,isFirstTimeInteraction:undefined,isStateOnly:u,nestedTransactions:f,networkClientId:p,origin:g,requestId:w,requiredAssets:y,securityAlertResponse:_,selectedGasFeeToken:l,status:At.TransactionStatus.unapproved,time:Date.now(),txParams:e,type:B,userEditedGasLimit:!1,verifiedOnBlockchain:!1};const{updateTransaction:H}=await nt(this,a,"f").call(this,{transactionMeta:G});if(H&&((0,Ct.projectLogger)("Updating transaction using afterAdd hook"),G.txParamsOriginal=(0,ut.cloneDeep)(G.txParams),H(G)),x){const e=(0,ut.cloneDeep)(G);nt(this,s,"m",K).call(this,e).then(()=>(nt(this,s,"m",Re).call(this,{transactionId:e.id,skipResimulateCheck:!0,skipValidation:!0},t=>{t.txParams.gas=e.txParams.gas,t.txParams.gasPrice=e.txParams.gasPrice,t.txParams.maxFeePerGas=e.txParams.maxFeePerGas,t.txParams.maxPriorityFeePerGas=e.txParams.maxPriorityFeePerGas}),undefined)).catch(ut.noop)}else await nt(this,U,"f").call(this,{name:"Estimate Gas Properties",parentContext:v},e=>nt(this,s,"m",K).call(this,G,{traceContext:e}));if(!L){if(h&&nt(this,R,"f")){const e=await nt(this,R,"f").call(this,G,h);G.securityProviderResponse=e}G=(0,qt.updateSwapsTransaction)(G,B,E,{isSwapsDisabled:nt(this,C,"f"),cancelTransaction:nt(this,s,"m",X).bind(this),messenger:this.messenger}),nt(this,s,"m",$).call(this,G),F.then(e=>(nt(this,s,"m",Re).call(this,{transactionId:G.id,skipResimulateCheck:!0,skipValidation:!0},t=>{t.delegationAddress=e}),undefined)).catch(ut.noop),!1===T||u?(0,Ct.projectLogger)("Skipping simulation & first interaction update as approval not required"):(nt(this,s,"m",Be).call(this,G,{traceContext:v}).catch(e=>{throw(0,Ct.projectLogger)("Error while updating simulation data",e),e}),(0,Mt.updateFirstTimeInteraction)({existingTransactions:this.state.transactions,getTransaction:e=>nt(this,s,"m",se).call(this,e),isFirstTimeInteractionEnabled:nt(this,I,"f"),trace:nt(this,U,"f"),traceContext:v,transactionMeta:G,updateTransaction:nt(this,s,"m",Re).bind(this)}).catch(e=>{(0,Ct.projectLogger)("Error while updating first interaction properties",e)})),this.messenger.publish(`${Yt}:unapprovedTransactionAdded`,G)}return{result:nt(this,s,"m",Y).call(this,G,{actionId:n,isExisting:Boolean(L),publishHook:k,requireApproval:T,traceContext:v}),transactionMeta:G}}startIncomingTransactionPolling(){nt(this,T,"f").start()}stopIncomingTransactionPolling(){nt(this,T,"f").stop()}async updateIncomingTransactions({tags:e}={}){await nt(this,T,"f").update({tags:e})}async stopTransaction(e,t,{estimatedBaseFee:a,actionId:i}={}){await nt(this,s,"m",W).call(this,{actionId:i,estimatedBaseFee:a,gasValues:t,label:"cancel",rate:n.CANCEL_RATE,transactionId:e,transactionType:At.TransactionType.cancel,prepareTransactionParams:e=>{delete e.data,e.to=e.from,e.value="0x0"},afterSubmit:e=>{this.messenger.publish(`${Yt}:transactionFinished`,e),nt(this,x,"f").emit(`${e.id}:finished`,e)}})}async speedUpTransaction(e,t,{actionId:a,estimatedBaseFee:i}={}){await nt(this,s,"m",W).call(this,{actionId:a,estimatedBaseFee:i,gasValues:t,label:"speed up",rate:n.SPEED_UP_RATE,transactionId:e,transactionType:At.TransactionType.retry,afterSubmit:e=>{this.messenger.publish(`${Yt}:speedupTransactionAdded`,e)}})}async estimateGas(e,t,{ignoreDelegationSignatures:n}={}){const a=nt(this,s,"m",le).call(this,{networkClientId:t}),{estimatedGas:i,simulationFails:r}=await(0,Dt.estimateGas)({chainId:nt(this,s,"m",oe).call(this,t),ethQuery:a,ignoreDelegationSignatures:n,isSimulationEnabled:nt(this,S,"f").call(this),getSimulationConfig:nt(this,y,"f"),messenger:this.messenger,txParams:e});return{gas:i,simulationFails:r}}async estimateGasBatch({chainId:e,from:t,transactions:n}){const a=nt(this,s,"m",le).call(this,{chainId:e});return(0,Dt.estimateGasBatch)({chainId:e,ethQuery:a,from:t,getSimulationConfig:nt(this,y,"f"),isAtomicBatchSupported:this.isAtomicBatchSupported.bind(this),messenger:this.messenger,transactions:n})}async estimateGasBuffered(e,t,n){const a=nt(this,s,"m",le).call(this,{networkClientId:n}),{blockGasLimit:i,estimatedGas:r,simulationFails:o}=await(0,Dt.estimateGas)({chainId:nt(this,s,"m",oe).call(this,n),ethQuery:a,isSimulationEnabled:nt(this,S,"f").call(this),getSimulationConfig:nt(this,y,"f"),messenger:this.messenger,txParams:e});return{gas:(0,Dt.addGasBuffer)(r,i,t),simulationFails:o}}updateTransaction(e,t){const{id:n}=e;nt(this,s,"m",Re).call(this,{transactionId:n},()=>({...e})),(0,Ct.projectLogger)("Transaction updated",{transactionId:n,note:t})}updateSecurityAlertResponse(e,t){if(!t)throw new Error("updateSecurityAlertResponse: securityAlertResponse should not be null");const n=nt(this,s,"m",se).call(this,e);if(!n)throw new Error("Cannot update security alert response as no transaction metadata found");const a={...n,securityAlertResponse:t};this.updateTransaction(a,`${Yt}:updatesecurityAlertResponse - securityAlertResponse updated`)}wipeTransactions({address:e,chainId:t}={}){if(!t&&!e)return void this.update(e=>{e.transactions=[]});const n=this.state.transactions.filter(({chainId:n,txParams:s,type:a})=>{if(!(!t||t===n))return!0;return!(!e||s.from?.toLowerCase()===e.toLowerCase()||a===At.TransactionType.incoming&&s.to?.toLowerCase()===e.toLowerCase())});this.update(e=>{e.transactions=nt(this,s,"m",Z).call(this,n)})}updateTransactionSendFlowHistory(e,t,n){return nt(this,s,"m",ae).call(this,e)}async confirmExternalTransaction(e,t,n){const a=nt(this,s,"m",he).call(this,e);try{const e=a.id,i={...a,status:At.TransactionStatus.confirmed,txReceipt:t};n&&(i.baseFeePerGas=n),nt(this,s,"m",fe).call(this,e),this.updateTransaction(i,`${Yt}:confirmExternalTransaction - Add external transaction`),nt(this,s,"m",Te).call(this,i),nt(this,s,"m",Ee).call(this,i).catch(e=>{throw(0,Ct.projectLogger)("Error while updating post balance",e),e}),this.messenger.publish(`${Yt}:transactionConfirmed`,i)}catch(e){console.error("Failed to confirm external transaction",e)}}updateTransactionGasFees(e,{defaultGasEstimates:t,estimateUsed:n,estimateSuggested:a,gas:i,gasLimit:r,gasPrice:o,maxPriorityFeePerGas:c,maxFeePerGas:l,originalGasEstimate:d,userEditedGasLimit:m,userFeeLevel:u}){const h=nt(this,s,"m",se).call(this,e);if(!h)throw new Error("Cannot update transaction as no transaction metadata found");(0,Kt.validateIfTransactionUnapprovedOrSubmitted)(h,"updateTransactionGasFees");const f=(0,ut.cloneDeep)(h),p=h.gasFeeEstimates,g=nt(this,E,"f").call(this,h),k=u,b=Object.values(At.GasFeeEstimateLevel).includes(k),w=p&&g&&b;w&&(0,Tt.updateTransactionGasEstimates)({txMeta:f,userFeeLevel:k});const y={gas:i,gasLimit:r};w?Object.assign(y,{gasPrice:f.txParams.gasPrice,maxPriorityFeePerGas:f.txParams.maxPriorityFeePerGas,maxFeePerGas:f.txParams.maxFeePerGas}):Object.assign(y,{gasPrice:o,maxPriorityFeePerGas:c,maxFeePerGas:l});const T={txParams:(0,ut.pickBy)(y),defaultGasEstimates:t,estimateUsed:n,estimateSuggested:a,originalGasEstimate:d,userEditedGasLimit:m,userFeeLevel:k},_=(0,ut.pickBy)(T);return nt(this,s,"m",Re).call(this,{transactionId:e,skipResimulateCheck:!0},e=>{const{txParams:t,...n}=_;Object.assign(e,n),t&&Object.assign(e.txParams,t)}),nt(this,s,"m",se).call(this,e)}updatePreviousGasParams(e,{gasLimit:t,maxFeePerGas:n,maxPriorityFeePerGas:a}){const i=nt(this,s,"m",se).call(this,e);if(!i)throw new Error("Cannot update transaction as no transaction metadata found");(0,Kt.validateIfTransactionUnapprovedOrSubmitted)(i,"updatePreviousGasParams");const r={previousGas:{gasLimit:t,maxFeePerGas:n,maxPriorityFeePerGas:a}};r.previousGas=(0,ut.pickBy)(r.previousGas);const o=(0,ut.merge)({},i,r);return this.updateTransaction(o,`${Yt}:updatePreviousGasParams - Previous gas values updated`),nt(this,s,"m",se).call(this,e)}async getNonceLock(e,t){return nt(this,O,"f").getNonceLock(e,t)}async updateEditableParams(e,{containerTypes:t,data:n,from:a,gas:i,gasPrice:r,maxFeePerGas:o,maxPriorityFeePerGas:c,to:l,updateType:d,value:m}){const u=nt(this,s,"m",se).call(this,e);if(!u)throw new Error("Cannot update editable params as no transaction metadata found");(0,Kt.validateIfTransactionUnapproved)(u,"updateEditableParams");const h={txParams:{data:n,from:a,to:l,value:m,gas:i,gasPrice:r,maxFeePerGas:o,maxPriorityFeePerGas:c}};h.txParams=(0,ut.pickBy)(h.txParams);const f=(0,ut.merge)({},u,h),{networkClientId:p}=u,g=nt(this,s,"m",de).call(this,{networkClientId:p}),k=new rt.default(g);if(!1!==d){const{type:e}=await(0,$t.determineTransactionType)(f.txParams,k);f.type=e}return t&&(f.containerTypes=t),await(0,Gt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:nt(this,j,"f"),messenger:this.messenger,provider:g,transactionMeta:f}),this.updateTransaction(f,`Update Editable Params for ${e}`),nt(this,s,"m",se).call(this,e)}setTransactionActive(e,t){if(!nt(this,s,"m",se).call(this,e))throw new Error(`Transaction with id ${e} not found`);nt(this,s,"m",Re).call(this,{transactionId:e,skipValidation:!0,skipResimulateCheck:!0},e=>{e.isActive=t})}async approveTransactionsWithSameNonce(e=[],{hasNonce:t}={}){if((0,Ct.projectLogger)("Approving transactions with same nonce",{transactions:e}),0===e.length)return"";const n=e[0],{chainId:a}=n,i=nt(this,s,"m",ce).call(this,{chainId:a}),r=(0,Ut.prepareTransaction)(a,n),c=(0,Ut.serializeTransaction)(r);if(nt(this,o,"f").has(c))return"";let l,d;nt(this,o,"f").add(c);try{const a=n.from;d=!0!==t?await this.getNonceLock(a,i):undefined;const r=d?(0,dt.add0x)(d.nextNonce.toString(16)):n.nonce;d&&(0,Ct.projectLogger)("Using nonce from nonce tracker",r,d.nonceDetails),l=await Promise.all(e.map(e=>(e.nonce=r,nt(this,s,"m",q).call(this,e.chainId,e))))}catch(e){throw(0,Ct.projectLogger)("Error while signing transactions with same nonce",e),e}finally{d?.releaseLock(),nt(this,o,"f").delete(c)}return l}updateCustodialTransaction(e){const{transactionId:t,errorMessage:n,hash:a,status:i,gasLimit:r,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,type:m}=e,u=nt(this,s,"m",se).call(this,t);if(!u)throw new Error("Cannot update custodial transaction as no transaction metadata found");if(i&&![At.TransactionStatus.submitted,At.TransactionStatus.signed,At.TransactionStatus.failed].includes(i))throw new Error(`Cannot update custodial transaction with status: ${i}`);const h=(0,ut.merge)({},u,(0,ut.pickBy)({hash:a,status:i}));return h.status===At.TransactionStatus.submitted&&(h.submittedTime=(new Date).getTime()),h.status===At.TransactionStatus.failed&&(h.error=(0,Kt.normalizeTxError)(new Error(n))),h.txParams=(0,ut.merge)({},h.txParams,(0,ut.pickBy)({gasLimit:r,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,type:m})),m===At.TransactionEnvelopeType.legacy&&(delete h.txParams.maxFeePerGas,delete h.txParams.maxPriorityFeePerGas),this.updateTransaction(h,`${Yt}:updateCustodialTransaction - Custodial transaction updated`),i&&[At.TransactionStatus.submitted,At.TransactionStatus.failed].includes(i)&&(this.messenger.publish(`${Yt}:transactionFinished`,h),nt(this,x,"f").emit(`${h.id}:finished`,h)),h}getTransactions({initialList:e,limit:t,searchCriteria:n={}}={}){const s=(0,ut.mapValues)(n,e=>"function"==typeof e?e:t=>t===e),a=e??this.state.transactions,i=(0,ut.sortBy)((0,ut.pickBy)(a,e=>{for(const[t,n]of Object.entries(s))if(t in e.txParams){if(!1===n(e.txParams[t]))return!1}else if(!1===n(e[t]))return!1;return!0}),"time");if(t!==undefined){const e=new Set,n=[];for(let s=i.length-1;s>-1;s--){const a=i[s],{nonce:r}=a.txParams;if(!e.has(r)){if(!(e.size<t))continue;e.add(r)}n.unshift(a)}return n}return i}async estimateGasFee({transactionParams:e,chainId:t,networkClientId:n}){const{id:s,provider:a}=nt(this,O,"f").getNetworkClient({chainId:t,networkClientId:n}),i={txParams:e,chainId:t,networkClientId:s},r=(0,Lt.getGasFeeFlow)(i,nt(this,m,"f"),this.messenger),o=new rt.default(a),c=await nt(this,g,"f").call(this,{networkClientId:s});return r.getGasFees({ethQuery:o,gasFeeControllerData:c,messenger:this.messenger,transactionMeta:i})}async getLayer1GasFee({transactionParams:e,chainId:t,networkClientId:n}){const a=nt(this,s,"m",de).call(this,{chainId:t,networkClientId:n});return await(0,Gt.getTransactionLayer1GasFee)({layer1GasFeeFlows:nt(this,j,"f"),messenger:this.messenger,provider:a,transactionMeta:{txParams:e,chainId:t}})}clearUnapprovedTransactions(){const e=this.state.transactions.filter(({status:e})=>e!==At.TransactionStatus.unapproved);this.update(t=>{t.transactions=nt(this,s,"m",Z).call(this,e)})}abortTransactionSigning(e){if(!nt(this,s,"m",se).call(this,e))throw new Error("Cannot abort signing as no transaction metadata found");const t=nt(this,L,"f").get(e);if(!t)throw new Error("Cannot abort signing as transaction is not waiting for signing");t(),nt(this,L,"f").delete(e)}async updateAtomicBatchData({transactionId:e,transactionIndex:t,transactionData:n}){(0,Ct.projectLogger)("Updating atomic batch data",{transactionId:e,transactionIndex:t,transactionData:n});const a=nt(this,s,"m",Re).call(this,{transactionId:e},e=>{const{nestedTransactions:s,txParams:a}=e,i=a.from,r=s?.[t];if(!r)throw new Error(`Nested transaction not found with index - ${t}`);r.data=n;const o=(0,Ot.generateEIP7702BatchTransaction)(i,s);e.txParams.data=o.data}),i=(0,ut.cloneDeep)({...a,txParams:{...a.txParams,gas:undefined}});return await nt(this,s,"m",$e).call(this,i),nt(this,s,"m",Re).call(this,{transactionId:e},e=>{e.txParams.gas=i.txParams.gas,e.simulationFails=i.simulationFails,e.gasLimitNoBuffer=i.gasLimitNoBuffer}),a.txParams.data}updateBatchTransactions({transactionId:e,batchTransactions:t}){(0,Ct.projectLogger)("Updating batch transactions",{transactionId:e,batchTransactions:t}),nt(this,s,"m",Re).call(this,{transactionId:e},e=>{e.batchTransactions=t})}updateSelectedGasFeeToken(e,t){nt(this,s,"m",Re).call(this,{transactionId:e},e=>{const n=e.gasFeeTokens?.some(e=>e.tokenAddress.toLowerCase()===t?.toLowerCase());if(t&&!n)throw new Error(`No matching gas fee token found with address - ${t}`);e.selectedGasFeeToken=t})}updateRequiredTransactionIds({transactionId:e,requiredTransactionIds:t,append:n}){nt(this,s,"m",Re).call(this,{transactionId:e},e=>{const{requiredTransactionIds:s}=e;e.requiredTransactionIds=[...s&&!1!==n?s:[],...t]})}emulateNewTransaction(e){const t=this.state.transactions.find(t=>t.id===e);t&&(t.type===At.TransactionType.swap?this.messenger.publish("TransactionController:transactionNewSwap",{transactionMeta:t}):t.type===At.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})}}n.TransactionController=Qt,a=new WeakMap,i=new WeakMap,r=new WeakMap,o=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,T=new WeakMap,_=new WeakMap,x=new WeakMap,E=new WeakMap,v=new WeakMap,I=new WeakMap,S=new WeakMap,C=new WeakMap,A=new WeakMap,j=new WeakMap,P=new WeakMap,O=new WeakMap,N=new WeakMap,F=new WeakMap,M=new WeakMap,D=new WeakMap,R=new WeakMap,B=new WeakMap,L=new WeakMap,G=new WeakMap,H=new WeakMap,U=new WeakMap,Se=new WeakMap,s=new WeakSet,W=async function({actionId:e,afterSubmit:t,estimatedBaseFee:n,gasValues:a,label:i,prepareTransactionParams:r,rate:o,transactionId:c,transactionType:l}){if(nt(this,s,"m",ge).call(this,e))return;a&&(a=(0,Kt.normalizeGasFeeValues)(a),(0,Kt.validateGasValues)(a)),(0,Ct.projectLogger)(`Creating ${i} transaction`,c,a);const d=nt(this,s,"m",se).call(this,c);if(!d)return;if(!nt(this,B,"f"))throw new Error("No sign method defined.");const m=(0,Wt.getTransactionParamsWithIncreasedGasFee)(d.txParams,o,a);r?.(m);const u=(0,Ut.prepareTransaction)(d.chainId,m),h=await nt(this,B,"f").call(this,u,d.txParams.from),f=nt(this,s,"m",be).call(this,d,h),p=(0,Ut.serializeTransaction)(h),g=m.maxFeePerGas??m.gasPrice,k=m.maxFeePerGas?f.txParams.maxFeePerGas:f.txParams.gasPrice;(0,Ct.projectLogger)(`Submitting ${i} transaction`,{oldFee:k,newFee:g,txParams:m});const{networkClientId:b}=d,w=nt(this,s,"m",le).call(this,{networkClientId:b}),y={...f,actionId:e,estimatedBaseFee:n,id:(0,ht.v1)(),originalGasEstimate:d.txParams.gas,originalType:d.type,rawTx:p,time:Date.now(),txParams:m,type:l},T=await nt(this,s,"m",Ne).call(this,w,{...y,origin:i});y.hash=T,nt(this,s,"m",$).call(this,y),this.messenger.publish(`${Yt}:transactionApproved`,{transactionMeta:y,actionId:e}),this.messenger.publish(`${Yt}:transactionSubmitted`,{transactionMeta:y,actionId:e}),t?.(y)},q=async function(e,t){if(!nt(this,B,"f"))throw new Error("No sign method defined.");const n=(0,Kt.normalizeTransactionParams)(t),s=(0,Kt.isEIP1559Transaction)(n)?At.TransactionEnvelopeType.feeMarket:At.TransactionEnvelopeType.legacy,a={...n,type:s,gasLimit:n.gas,chainId:e},{from:i}=a,r=(0,Ut.prepareTransaction)(e,a),o=await nt(this,B,"f").call(this,r,i);return(0,Ut.serializeTransaction)(o)},$=function(e){(0,Vt.validateTxParams)(e.txParams),this.update(t=>{t.transactions=nt(this,s,"m",Z).call(this,[...t.transactions,e])})},K=async function(e,{traceContext:t}={}){const n=e.txParams.type!==At.TransactionEnvelopeType.legacy&&await nt(this,s,"m",we).call(this,e.networkClientId),{networkClientId:a}=e,i=nt(this,s,"m",le).call(this,{networkClientId:a}),r=nt(this,s,"m",de).call(this,{networkClientId:a});await nt(this,U,"f").call(this,{name:"Update Gas",parentContext:t},async()=>{await nt(this,s,"m",$e).call(this,e)}),await nt(this,U,"f").call(this,{name:"Update Gas Fees",parentContext:t},async()=>await(0,Bt.updateGasFees)({eip1559:n,ethQuery:i,gasFeeFlows:nt(this,m,"f"),getGasFeeEstimates:nt(this,g,"f"),getSavedGasFees:nt(this,w,"f").bind(this),messenger:this.messenger,txMeta:e})),await nt(this,U,"f").call(this,{name:"Update Layer 1 Gas Fees",parentContext:t},async()=>await(0,Gt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:nt(this,j,"f"),messenger:this.messenger,provider:r,transactionMeta:e}))},V=function(){this.clearUnapprovedTransactions(),nt(this,s,"m",z).call(this)},z=function(){const e=this.state.transactions.filter(e=>[At.TransactionStatus.approved,At.TransactionStatus.signed].includes(e.status));for(const t of e){const e=t.requiredTransactionIds??[],n=e.length>0&&e.every(e=>{const t=nt(this,s,"m",se).call(this,e);return t?.status===At.TransactionStatus.confirmed})?"Transaction incomplete at startup with all required transactions confirmed":"Transaction incomplete at startup";nt(this,s,"m",Je).call(this,t,new Error(n));for(const t of e){const e=nt(this,s,"m",se).call(this,t);e&&!nt(this,s,"m",ee).call(this,e.status)&&nt(this,s,"m",Je).call(this,e,new Error("Parent transaction incomplete at startup"))}}},Y=async function(e,{actionId:t,isExisting:n=!1,publishHook:a,requireApproval:i,shouldShowRequest:r=!0,traceContext:o}){const{id:c,isStateOnly:l}=e;if(l)return nt(this,s,"m",Re).call(this,{transactionId:c,skipValidation:!0},e=>{e.status=At.TransactionStatus.submitted,e.submittedTime=(new Date).getTime()}),"";let d;const{meta:m,isCompleted:u}=nt(this,s,"m",re).call(this,c),h=u?Promise.resolve(m):nt(this,s,"m",ke).call(this,c);if(m&&!n&&!u)try{if(!1!==i){const t=await nt(this,U,"f").call(this,{name:"Await Approval",parentContext:o},t=>nt(this,s,"m",ne).call(this,e,{shouldShowRequest:r,traceContext:t}));d=t.resultCallbacks;const n=t.value,a=n?.txMeta;a&&((0,Ct.projectLogger)("Updating transaction with approval data",{customNonce:a.customNonceValue,params:a.txParams}),this.updateTransaction(a,"TransactionController#processApproval - Updated with approval data"))}const{isCompleted:n}=nt(this,s,"m",re).call(this,c);if(!n){const e=await nt(this,s,"m",J).call(this,c,o,a);e===Jt.SkippedViaBeforePublishHook&&d&&d.success();const n=nt(this,s,"m",se).call(this,c);e===Jt.Approved&&this.messenger.publish(`${Yt}:transactionApproved`,{transactionMeta:n,actionId:t})}}catch(e){const n=e,{isCompleted:a}=nt(this,s,"m",re).call(this,c);a||(nt(this,s,"m",ze).call(this,n)?nt(this,s,"m",Ye).call(this,c,t,n):nt(this,s,"m",Je).call(this,m,n,t))}finally{nt(this,G,"f").delete(c)}const f=await h;switch(f?.status){case At.TransactionStatus.failed:{const e=f.error;throw d?.error(e),lt.rpcErrors.internal(e.message)}case At.TransactionStatus.submitted:return d?.success(),f.hash;default:{const e=lt.rpcErrors.internal(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(f??c)}`);throw d?.error(e),e}}},J=async function(e,t,n){let a,i,r=nt(this,s,"m",ae).call(this,e);(0,Ct.projectLogger)("Approving transaction",r);try{if(!nt(this,B,"f"))return nt(this,s,"m",Je).call(this,r,new Error("No sign method defined.")),Jt.NotApproved;if(!r.chainId)return nt(this,s,"m",Je).call(this,r,new Error("No chainId defined.")),Jt.NotApproved;if(nt(this,o,"f").has(e))return(0,Ct.projectLogger)("Skipping approval as signing in progress",e),Jt.NotApproved;nt(this,o,"f").add(e),a=()=>nt(this,o,"f").delete(e);const{networkClientId:c}=r,d=nt(this,s,"m",le).call(this,{networkClientId:c}),[m,u]=await(0,Ht.getNextNonce)(r,e=>nt(this,O,"f").getNonceLock(e,r.networkClientId));i=u,r=nt(this,s,"m",Re).call(this,{transactionId:e},e=>{const{chainId:t,txParams:n}=e,{gas:s,type:a}=n;e.status=At.TransactionStatus.approved,e.txParams.chainId=t,e.txParams.gasLimit=s,e.txParams.nonce=m,!a&&(0,Kt.isEIP1559Transaction)(n)&&(e.txParams.type=At.TransactionEnvelopeType.feeMarket)}),nt(this,s,"m",Te).call(this,r);const h=await nt(this,U,"f").call(this,{name:"Sign",parentContext:t},()=>nt(this,s,"m",ye).call(this,r));if(r=nt(this,s,"m",ae).call(this,e),!await nt(this,l,"f").call(this,r))return(0,Ct.projectLogger)("Skipping publishing transaction based on hook"),this.messenger.publish(`${Yt}:transactionPublishingSkipped`,r),Jt.SkippedViaBeforePublishHook;if(!h&&!r.isExternalSign)return Jt.NotApproved;let f;const p=r.type===At.TransactionType.swap;p&&((0,Ct.projectLogger)("Determining pre-transaction balance"),f=await(0,it.query)(d,"getBalance",[r.txParams.from])),(0,Ct.projectLogger)("Publishing transaction",r.txParams),i?.(),i=undefined;let g=nt(this,s,"m",Xe).bind(this,{ethQuery:d,publishHookOverride:n,traceContext:t});if(r.batchTransactions?.length){(0,Ct.projectLogger)("Found batch transactions",r.batchTransactions);g=new St.ExtraTransactionsPublishHook({addTransactionBatch:this.addTransactionBatch.bind(this),getTransaction:nt(this,s,"m",ae).bind(this),originalPublishHook:g}).getHook()}const{transactionHash:k}=await g(r,h??"0x");return r=nt(this,s,"m",Re).call(this,{transactionId:e},e=>{e.hash=k,e.status=At.TransactionStatus.submitted,e.submittedTime=(new Date).getTime(),p&&(e.preTxBalance=f,(0,Ct.projectLogger)("Updated pre-transaction balance",f))}),this.messenger.publish(`${Yt}:transactionSubmitted`,{transactionMeta:r}),this.messenger.publish(`${Yt}:transactionFinished`,r),nt(this,x,"f").emit(`${e}:finished`,r),nt(this,s,"m",Te).call(this,r),Jt.Approved}catch(e){return nt(this,s,"m",Je).call(this,r,e),Jt.NotApproved}finally{a?.(),i?.()}},Q=async function(e,t,{skipSubmitHistory:n}={}){try{const a=await(0,it.query)(e,"sendRawTransaction",[t.rawTx]);return!0!==n&&nt(this,s,"m",qe).call(this,t,a),a}catch(e){const t=e,n=t?.data?.message??t?.message??String(e);throw new Error(n)}},X=function(e,t,n){const a=nt(this,s,"m",se).call(this,e);if(!a)return;nt(this,s,"m",Ve).call(this,e);const i={...a,status:At.TransactionStatus.rejected,error:(0,Kt.normalizeTxError)(n??lt.providerErrors.userRejectedRequest())};this.messenger.publish(`${Yt}:transactionFinished`,i),nt(this,x,"f").emit(`${a.id}:finished`,i),this.messenger.publish(`${Yt}:transactionRejected`,{transactionMeta:i,actionId:t}),nt(this,s,"m",Te).call(this,i)},Z=function(e){const t=new Set,n=(0,Ft.getTransactionHistoryLimit)(this.messenger),a=[...e].sort((e,t)=>e.time>t.time?-1:1).filter(e=>{const{chainId:a,status:i,txParams:r,time:o}=e;if(r){const e=`${String(r.nonce)}-${(0,it.convertHexToDecimal)(a)}-${new Date(o).toDateString()}`;if(t.has(e))return!0;if(t.size<n||!nt(this,s,"m",ee).call(this,i))return t.add(e),!0}return!1});return a.reverse(),a},ee=function(e){return e===At.TransactionStatus.rejected||e===At.TransactionStatus.confirmed||e===At.TransactionStatus.failed||e===At.TransactionStatus.dropped},te=function(e){return[At.TransactionStatus.confirmed,At.TransactionStatus.failed,At.TransactionStatus.rejected,At.TransactionStatus.submitted].includes(e)},ne=async function(e,{shouldShowRequest:t,traceContext:n}){const a=nt(this,s,"m",ie).call(this,e),{origin:i}=e,r=it.ApprovalType.Transaction,o={txId:e.id};return await nt(this,U,"f").call(this,{name:"Notification Display",id:a,parentContext:n}),await this.messenger.call("ApprovalController:addRequest",{id:a,origin:i??it.ORIGIN_METAMASK,type:r,requestData:o,expectsResult:!0},t)},se=function(e){const{transactions:t}=this.state;return t.find(({id:t})=>t===e)},ae=function(e,t="TransactionController"){const n=nt(this,s,"m",se).call(this,e);if(!n)throw new Error(`${t}: No transaction found with id ${e}`);return n},ie=function(e){return String(e.id)},re=function(e){const t=nt(this,s,"m",se).call(this,e);if(!t)return{meta:undefined,isCompleted:!1};return{meta:t,isCompleted:nt(this,s,"m",te).call(this,t.status)}},oe=function(e){return nt(this,O,"f").getNetworkClient({networkClientId:e}).configuration.chainId},ce=function({chainId:e,networkClientId:t}){return t||nt(this,O,"f").getNetworkClient({chainId:e}).id},le=function({chainId:e,networkClientId:t}){return new rt.default(nt(this,s,"m",de).call(this,{chainId:e,networkClientId:t}))},de=function({chainId:e,networkClientId:t}){return nt(this,O,"f").getNetworkClient({chainId:e,networkClientId:t}).provider},me=function(e){if(!e.length)return;const t=[];for(const n of e){const{chainId:e}=n;try{const a=nt(this,s,"m",ce).call(this,{chainId:e});t.push({...n,networkClientId:a})}catch(t){(0,Ct.projectLogger)("Failed to get network client ID for incoming transaction",{chainId:e,error:t})}}this.update(e=>{const{transactions:n}=e;e.transactions=nt(this,s,"m",Z).call(this,[...t,...n]),(0,Ct.projectLogger)("Added incoming transactions to state",t.length,t)}),this.messenger.publish(`${Yt}:incomingTransactionsReceived`,t)},ue=function(e,t){if(!t||t===it.ORIGIN_METAMASK)return undefined;const{gasPrice:n,maxFeePerGas:s,maxPriorityFeePerGas:a,gas:i}=e;if(n===undefined&&s===undefined&&a===undefined&&i===undefined)return undefined;const r={};return n!==undefined?r.gasPrice=n:s===undefined&&a===undefined||(r.maxFeePerGas=s,r.maxPriorityFeePerGas=a),i!==undefined&&(r.gas=i),r},he=function(e){const{chainId:t}=e,{transactions:n}=this.state,a=e?.txParams?.from,i=n.filter(e=>e.txParams.from===a&&e.chainId===t),r=i.filter(e=>e.status===At.TransactionStatus.confirmed),o=i.filter(e=>e.status===At.TransactionStatus.submitted);return(0,Nt.validateConfirmedExternalTransaction)(e,r,o),this.update(t=>{t.transactions=nt(this,s,"m",Z).call(this,[...t.transactions,e])}),e},fe=function(e){const t=nt(this,s,"m",se).call(this,e);if(!t)return;const n=t.txParams?.nonce,a=t.txParams?.from,{chainId:i}=t,r=this.state.transactions.filter(t=>t.id!==e&&t.txParams.from===a&&n&&t.txParams.nonce===n&&t.chainId===i&&t.type!==At.TransactionType.incoming&&t.isTransfer===undefined),o=r.map(e=>e.id);if(0!==r.length){this.update(e=>{for(const n of e.transactions)o.includes(n.id)&&(n.replacedBy=t?.hash,n.replacedById=t?.id)});for(const e of this.state.transactions)o.includes(e.id)&&e.status!==At.TransactionStatus.failed&&nt(this,s,"m",pe).call(this,e)}},pe=function(e){const t={...e,status:At.TransactionStatus.dropped};this.messenger.publish(`${Yt}:transactionDropped`,{transactionMeta:t}),this.updateTransaction(t,"TransactionController#setTransactionStatusDropped - Transaction dropped"),nt(this,s,"m",Te).call(this,t)},ge=function(e){return this.state.transactions.find(t=>e&&t.actionId===e)},ke=async function(e){return new Promise(t=>{nt(this,x,"f").once(`${e}:finished`,e=>{t(e)})})},be=function(e,t){const n=(0,ut.cloneDeep)(e);for(const e of["r","s","v"]){const s=t[e];s!==undefined&&null!==s&&(n[e]=(0,dt.add0x)(s.toString(16)))}return n},we=async function(e){const t=await nt(this,f,"f").call(this,e),n=await nt(this,h,"f").call(this);return t&&n},ye=async function(e){let t=e;const{id:n}=t;(0,Ct.projectLogger)("Calling before sign hook",t);const{updateTransaction:a}=await nt(this,d,"f").call(this,{transactionMeta:t})??{};a&&(nt(this,s,"m",Re).call(this,{transactionId:n,skipResimulateCheck:!0},a),(0,Ct.projectLogger)("Updated transaction after before sign hook")),t=nt(this,s,"m",ae).call(this,n);const{networkClientId:r}=t,c=nt(this,s,"m",le).call(this,{networkClientId:r});await(0,Rt.checkGasFeeTokenBeforePublish)({ethQuery:c,fetchGasFeeTokens:async e=>(await nt(this,s,"m",Ze).call(this,e)).gasFeeTokens,transaction:t,updateTransaction:(e,t)=>nt(this,s,"m",Re).call(this,{transactionId:e},t)}),t=nt(this,s,"m",ae).call(this,n);const{chainId:l,isExternalSign:m,txParams:h}=t;if(m)return(0,Ct.projectLogger)("Skipping sign as signed externally"),undefined;const{authorizationList:f,from:p}=h,g=await(0,Ot.signAuthorizationList)({authorizationList:f,messenger:this.messenger,transactionMeta:t});g&&nt(this,s,"m",Re).call(this,{transactionId:n},e=>{e.txParams.authorizationList=g}),t=nt(this,s,"m",ae).call(this,n);const k=nt(this,s,"m",ae).call(this,n),{txParams:b}=k,w=(0,Ut.prepareTransaction)(l,b);nt(this,o,"f").add(n),(0,Ct.projectLogger)("Signing transaction",b);const y=await new Promise((e,t)=>{nt(this,B,"f")?.call(this,w,p,...nt(this,u,"f").call(this,k)).then(e,t),nt(this,L,"f").set(n,()=>t(new Error("Signing aborted by user")))});if(nt(this,L,"f").delete(n),!y)return(0,Ct.projectLogger)("Skipping signed status as no signed transaction"),undefined;const T=(0,ut.cloneDeep)(k);if(!nt(this,i,"f").call(this,T,y))return this.updateTransaction(T,"TransactionController#signTransaction - Update after sign"),(0,Ct.projectLogger)("Skipping signed status based on hook"),undefined;const _={...nt(this,s,"m",be).call(this,T,y),status:At.TransactionStatus.signed,txParams:b};this.updateTransaction(_,"TransactionController#approveTransaction - Transaction signed"),nt(this,s,"m",Te).call(this,_);const x=(0,Ut.serializeTransaction)(y),E=(0,ut.merge)({},_,{rawTx:x});return this.updateTransaction(E,"TransactionController#approveTransaction - RawTransaction added"),x},Te=function(e){this.messenger.publish(`${Yt}:transactionStatusUpdated`,{transactionMeta:e})},_e=function(e,t,n){return(0,Ht.getAndFormatTransactionsForNonceTracker)(n,t,e,this.state.transactions)},xe=function(e){(0,Ct.projectLogger)("Processing confirmed transaction",e.id),nt(this,s,"m",fe).call(this,e.id),this.messenger.publish(`${Yt}:transactionConfirmed`,e),nt(this,s,"m",Te).call(this,e),nt(this,s,"m",Ee).call(this,e).catch(e=>{throw(0,Ct.projectLogger)("Error while updating post balance",e),e})},Ee=async function(e){try{const{networkClientId:t,type:n}=e;if(n!==At.TransactionType.swap)return;const a=nt(this,s,"m",le).call(this,{networkClientId:t}),{updatedTransactionMeta:i,approvalTransactionMeta:r}=await(0,qt.updatePostTransactionBalance)(e,{ethQuery:a,getTransaction:nt(this,s,"m",se).bind(this),updateTransaction:this.updateTransaction.bind(this)});this.messenger.publish(`${Yt}:postTransactionBalanceUpdated`,{transactionMeta:i,approvalTransactionMeta:r})}catch(e){(0,Ct.projectLogger)("Error while updating post transaction balance",e)}},ve=function({provider:e,blockTracker:t,chainId:n}){return new ct.NonceTracker({provider:e,blockTracker:t,getPendingTransactions:nt(this,s,"m",Oe).bind(this,n),getConfirmedTransactions:nt(this,s,"m",_e).bind(this,[At.TransactionStatus.confirmed],n)})},Ie=function({provider:e,blockTracker:t,chainId:n,networkClientId:a}){const i=new rt.default(e),r=new vt.PendingTransactionTracker({blockTracker:t,getChainId:()=>n,getEthQuery:()=>i,getGlobalLock:()=>nt(this,O,"f").acquireNonceLockForChainIdKey({chainId:n}),getNetworkClientId:()=>a,getTransactions:()=>this.state.transactions,hooks:{beforeCheckPendingTransaction:nt(this,c,"f").bind(this)},isResubmitEnabled:nt(this,N,"f").isResubmitEnabled,isTimeoutEnabled:nt(this,A,"f"),messenger:this.messenger,publishTransaction:(e,t)=>nt(this,s,"m",Q).call(this,e,t,{skipSubmitHistory:!0})});return nt(this,s,"m",Pe).call(this,r),r},Ce=function(){nt(this,O,"f").stopAllTracking()},Ae=function(e){e.hub.on("transactions",nt(this,s,"m",me).bind(this))},je=function(e){e.hub.removeAllListeners("transaction-confirmed"),e.hub.removeAllListeners("transaction-dropped"),e.hub.removeAllListeners("transaction-failed"),e.hub.removeAllListeners("transaction-updated")},Pe=function(e){e.hub.on("transaction-confirmed",nt(this,s,"m",xe).bind(this)),e.hub.on("transaction-dropped",nt(this,s,"m",pe).bind(this)),e.hub.on("transaction-failed",nt(this,s,"m",Je).bind(this)),e.hub.on("transaction-updated",this.updateTransaction.bind(this))},Oe=function(e,t){return[...nt(this,s,"m",_e).call(this,[At.TransactionStatus.approved,At.TransactionStatus.signed,At.TransactionStatus.submitted],t,e),...nt(this,p,"f").call(this,t,e)]},Ne=async function(e,t){try{return await nt(this,s,"m",Q).call(this,e,t)}catch(e){if(nt(this,s,"m",Fe).call(this,e))throw new Error("Previous transaction is already confirmed");throw e}},Fe=function(e){return Boolean(e?.message?.includes("nonce too low"))||Boolean(e?.data?.message?.includes("nonce too low"))},Me=function(){return nt(this,H,"f")?[new wt.TestGasFeeFlow]:[new kt.RandomisedEstimationsGasFeeFlow,new pt.LineaGasFeeFlow,new ft.DefaultGasFeeFlow]},De=function(){return[new gt.OptimismLayer1GasFeeFlow,new bt.ScrollLayer1GasFeeFlow]},Re=function({transactionId:e,skipValidation:t,skipResimulateCheck:n},a){let i;this.update(s=>{const r=s.transactions.findIndex(({id:t})=>t===e);if(-1===r)throw new Error(`Cannot update transaction as ID not found - ${e}`);let o=s.transactions[r];const c=(0,ut.cloneDeep)(o);o=a(o)??o,!0!==t&&(o.txParams=(0,Kt.normalizeTransactionParams)(o.txParams),(0,Vt.validateTxParams)(o.txParams)),!n&&nt(this,S,"f").call(this)&&(i=(0,It.shouldResimulate)(c,o)),s.transactions[r]=o});const r=nt(this,s,"m",se).call(this,e);return i?.resimulate&&nt(this,s,"m",Be).call(this,r,{blockTime:i.blockTime}).catch(e=>{throw(0,Ct.projectLogger)("Error during re-simulation",e),e}),r},Be=async function(e,{blockTime:t,traceContext:n}={}){const{chainId:a,id:i,nestedTransactions:r,networkClientId:o,simulationData:c,txParams:l}=e;let d,m={error:{code:At.SimulationErrorCode.Disabled,message:"Simulation disabled"},tokenBalanceChanges:[]},u=[],h=!1;const f=nt(this,G,"f").has(i);if(nt(this,S,"f").call(this)&&!f){const i=await nt(this,U,"f").call(this,{name:"Simulate",parentContext:n},()=>(0,jt.getBalanceChanges)({blockTime:t,chainId:a,ethQuery:nt(this,s,"m",le).call(this,{networkClientId:o}),getSimulationConfig:(t,n)=>nt(this,y,"f").call(this,t,{txMeta:e,...n}),nestedTransactions:r,txParams:l}));m=i.simulationData,d=i.gasUsed,t&&c&&(0,It.hasSimulationDataChanged)(c,m)&&(m={...m,isUpdatedAfterSecurityCheck:!0});const f=await nt(this,s,"m",Ze).call(this,e);u=f?.gasFeeTokens??[],h=f?.isGasFeeSponsored??!1}if(!nt(this,s,"m",se).call(this,i))return void(0,Ct.projectLogger)("Cannot update simulation data as transaction not found",i,m);const p=nt(this,s,"m",Re).call(this,{transactionId:i,skipResimulateCheck:Boolean(t)},e=>{e.gasFeeTokens=u,e.isGasFeeSponsored=h,e.gasUsed=d,f||(e.simulationData=m)});(0,Ct.projectLogger)("Updated simulation data",i,p),await nt(this,s,"m",Qe).call(this,p)},Le=function({transactionId:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:n,layer1GasFee:a}){nt(this,s,"m",Re).call(this,{transactionId:e},e=>{(0,Tt.updateTransactionGasProperties)({txMeta:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:n,isTxParamsGasFeeUpdatesEnabled:nt(this,E,"f"),layer1GasFee:a})})},Ge=function({transactionBatchId:e,gasFeeEstimates:t}){nt(this,s,"m",He).call(this,e,e=>({...e,gasFeeEstimates:t}))},He=function(e,t){this.update(n=>{const s=n.transactionBatches.findIndex(t=>t.id===e);if(-1===s)throw new Error(`Cannot update batch, ID not found - ${e}`);const a=n.transactionBatches[s],i=t(a);n.transactionBatches[s]=i??a})},Ue=function(){return this.messenger.call("AccountsController:getSelectedAccount")},We=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:n,networkClientId:s,origin:a,rawTx:i,txParams:r}=e,{networkConfigurationsByChainId:o}=nt(this,k,"f").call(this),c=o[n],l=c?.rpcEndpoints.find(e=>e.networkClientId===s),d=l?.url,m={chainId:n,hash:t,networkType:l?.name??s,networkUrl:d,origin:a,rawTransaction:i,time:Date.now(),transaction:r};(0,Ct.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)})},$e=async function(e){const{chainId:t,networkClientId:n}=e,a=nt(this,O,"f").getNetworkClient({networkClientId:n}).configuration.type===ot.NetworkClientType.Custom,i=nt(this,s,"m",le).call(this,{networkClientId:n});await(0,Dt.updateGas)({chainId:t,ethQuery:i,isCustomNetwork:a,isSimulationEnabled:nt(this,S,"f").call(this),getSimulationConfig:nt(this,y,"f"),messenger:this.messenger,txMeta:e})},Ke=function(){this.messenger.registerActionHandler(`${Yt}:addTransaction`,this.addTransaction.bind(this)),this.messenger.registerActionHandler(`${Yt}:addTransactionBatch`,this.addTransactionBatch.bind(this)),this.messenger.registerActionHandler(`${Yt}:confirmExternalTransaction`,this.confirmExternalTransaction.bind(this)),this.messenger.registerActionHandler(`${Yt}:emulateNewTransaction`,this.emulateNewTransaction.bind(this)),this.messenger.registerActionHandler(`${Yt}:emulateTransactionUpdate`,this.emulateTransactionUpdate.bind(this)),this.messenger.registerActionHandler(`${Yt}:estimateGas`,this.estimateGas.bind(this)),this.messenger.registerActionHandler(`${Yt}:estimateGasBatch`,this.estimateGasBatch.bind(this)),this.messenger.registerActionHandler(`${Yt}:getGasFeeTokens`,nt(this,s,"m",et).bind(this)),this.messenger.registerActionHandler(`${Yt}:getNonceLock`,this.getNonceLock.bind(this)),this.messenger.registerActionHandler(`${Yt}:getTransactions`,this.getTransactions.bind(this)),this.messenger.registerActionHandler(`${Yt}:updateCustodialTransaction`,this.updateCustodialTransaction.bind(this)),this.messenger.registerActionHandler(`${Yt}:updateTransaction`,this.updateTransaction.bind(this))},Ve=function(e){this.update(t=>{const n=t.transactions.filter(({id:t})=>t!==e);t.transactions=nt(this,s,"m",Z).call(this,n)})},ze=function(e){return[lt.errorCodes.provider.userRejectedRequest,Vt.ErrorCode.RejectedUpgrade].includes(e.code)},Ye=function(e,t,n){if(nt(this,s,"m",X).call(this,e,t,n),n.code===lt.errorCodes.provider.userRejectedRequest)throw lt.providerErrors.userRejectedRequest({message:"MetaMask Tx Signature: User denied transaction signature.",data:n?.data});throw n},Je=function(e,t,n){let a;try{a=nt(this,s,"m",Re).call(this,{transactionId:e.id,skipValidation:!0},e=>{e.status=At.TransactionStatus.failed,e.error=(0,Kt.normalizeTxError)(t)})}catch(n){(0,Ct.projectLogger)("Failed to mark transaction as failed",n),a={...e,status:At.TransactionStatus.failed,error:(0,Kt.normalizeTxError)(t)}}this.messenger.publish(`${Yt}:transactionFailed`,{actionId:n,error:t.message,transactionMeta:a}),nt(this,s,"m",Te).call(this,a),this.messenger.publish(`${Yt}:transactionFinished`,a),nt(this,x,"f").emit(`${e.id}:finished`,a)},Qe=async function(e){(0,Ct.projectLogger)("Calling afterSimulate hook",e);const{id:t}=e,n=await nt(this,r,"f").call(this,{transactionMeta:e}),{skipSimulation:a,updateTransaction:i}=n??{};if(a?nt(this,G,"f").add(t):!1===a&&nt(this,G,"f").delete(t),!i)return;const o=nt(this,s,"m",Re).call(this,{transactionId:t,skipResimulateCheck:!0},e=>{e.txParamsOriginal=(0,ut.cloneDeep)(e.txParams),i(e)});(0,Ct.projectLogger)("Updated transaction with afterSimulate data",o)},Xe=async function({ethQuery:e,publishHookOverride:t,traceContext:n},a,i){let r;return await nt(this,U,"f").call(this,{name:"Publish",parentContext:n},async()=>{const n=t??nt(this,M,"f");({transactionHash:r}=await n(a,i)),r??(r=await nt(this,s,"m",Q).call(this,e,{...a,rawTx:i}))}),(0,Ct.projectLogger)("Publish successful",r),{transactionHash:r}},Ze=async function(e){const{chainId:t}=e;return await(0,Rt.getGasFeeTokens)({chainId:t,getSimulationConfig:nt(this,y,"f"),isEIP7702GasFeeTokensEnabled:nt(this,v,"f"),messenger:this.messenger,publicKeyEIP7702:nt(this,F,"f"),transactionMeta:e})},et=async function(e){const{chainId:t,data:n,from:a,to:i,value:r}=e,o=nt(this,s,"m",le).call(this,{chainId:t}),c={chainId:t,delegationAddress:await(0,Ot.getDelegationAddress)(a,o),isExternalSign:!0,txParams:{data:n,from:a,to:i,value:r}};return(await nt(this,s,"m",Ze).call(this,c)).gasFeeTokens}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs",{"../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getAccountTransactions=n.getAccountAddressRelationship=void 0;const s=e("@metamask/controller-utils"),a=e("@metamask/utils"),i=e("../errors.cjs"),r=e("../logger.cjs"),o="https://accounts.api.cx.metamask.io",c=`${o}/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)(r.projectLogger,"accounts-api");n.getAccountAddressRelationship=async function(e){const{chainId:t,from:n,to:a}=e;if(!m.includes(t))throw u("Unsupported chain ID for account relationship API",t),new i.FirstTimeInteractionError("Unsupported chain ID");const r=`${o}/v1/networks/${t}/accounts/${n}/relationships/${a}`;u("Getting account address relationship",{request:e,url:r});const c={[l]:d},h=await(0,s.successfulFetch)(r,{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 i.FirstTimeInteractionError(t,e)}return f},n.getAccountTransactions=async function(e){const{address:t,chainIds:n,cursor:a,endTimestamp:i,sortDirection:r,startTimestamp:o,tags:m}=e;let h=`${c}${t}/transactions`;const f=[];if(n){const e=n.join(",");f.push(`networks=${e}`)}o&&f.push(`startTimestamp=${o}`),i&&f.push(`endTimestamp=${i}`),a&&f.push(`cursor=${a}`),r&&f.push(`sortDirection=${r}`),f.length&&(h+=`?${f.join("&")}`),u("Getting account transactions",{request:e,url:h});const p=[d,...m??[]].join("__"),g={[l]:p},k=await(0,s.successfulFetch)(h,{headers:g}),b=await k.json();return u("Retrieved account transactions",b),b}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.simulateTransactions=void 0;const s=e("@metamask/controller-utils"),a=e("@metamask/utils"),i=e("lodash"),r=e("../constants.cjs"),o=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)}n.simulateTransactions=async function(e,t){let n=await async function(e){const t=await async function(){const e=`${u("ethereum-mainnet")}${d}`,t=await fetch(e);return t.json()}(),n=(0,s.convertHexToDecimal)(e),a=t[n];if(!a?.confirmations)throw l("Chain is not supported",e),new o.SimulationChainNotSupportedError(e);return u(a.network)}(e);const{newUrl:a,authorization:c}=await t.getSimulationConfig(n)||{};a&&(n=a);const h=m;m+=1;const f=function(e){const t=(0,i.cloneDeep)(e);for(const e of t.transactions){const n=e.to?.toLowerCase();r.DELEGATION_MANAGER_ADDRESSES.includes(n)&&(t.overrides=t.overrides??{},t.overrides[n]={code:r.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS})}return t}(t);l("Sending request",n,t);const p={"Content-Type":"application/json"};c&&(p.Authorization=c);const g=await fetch(n,{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 o.SimulationError(t,e)}return k?.result}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS=n.DELEGATION_MANAGER_ADDRESSES=n.ABI_IERC7821=n.ABI_SIMULATION_ERC721_LEGACY=n.ABI_SIMULATION_ERC20_WRAPPED=n.CHAIN_IDS=void 0,n.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"},n.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"}],n.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"}],n.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"}],n.DELEGATION_MANAGER_ADDRESSES=["0xdb9b1e94b5b69df7e401ddbede43491141047db3"],n.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS=" "}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SimulationRevertedError=n.SimulationInvalidResponseError=n.SimulationChainNotSupportedError=n.FirstTimeInteractionError=n.SimulationError=void 0;const s=e("./types.cjs");class a extends Error{constructor(e,t){super(e??"Simulation failed"),this.code=t}}n.SimulationError=a;class i extends Error{constructor(e,t){super(e??"Error checking first time interaction"),this.code=t}}n.FirstTimeInteractionError=i;n.SimulationChainNotSupportedError=class extends a{constructor(e){super(`Chain is not supported: ${e}`,s.SimulationErrorCode.ChainNotSupported)}};n.SimulationInvalidResponseError=class extends a{constructor(){super("Invalid response from simulation API",s.SimulationErrorCode.InvalidResponse)}};n.SimulationRevertedError=class extends a{constructor(){super("Transaction was reverted",s.SimulationErrorCode.Reverted)}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","@metamask/gas-fee-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.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");n.DefaultGasFeeFlow=class{constructor(){s.add(this)}matchesTransaction(){return!0}async getGasFees(e){const{gasFeeControllerData:t}=e,{gasEstimateType:n,gasFeeEstimates:o}=t;let c;switch(n){case d.GAS_ESTIMATE_TYPES.FEE_MARKET:p("Using fee market estimates",o),c=l(this,s,"m",a).call(this,o);break;case d.GAS_ESTIMATE_TYPES.LEGACY:p("Using legacy estimates",o),c=l(this,s,"m",i).call(this,o);break;case d.GAS_ESTIMATE_TYPES.ETH_GASPRICE:p("Using eth_gasPrice estimates",o),c=l(this,s,"m",r).call(this,o);break;default:throw new Error(`Unsupported gas estimate type: ${n}`)}return{estimates:c}}},s=new WeakSet,a=function(e){const t=Object.values(h.GasFeeEstimateLevel).reduce((t,n)=>({...t,[n]:l(this,s,"m",o).call(this,e,n)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...t}},i=function(e){const t=Object.values(h.GasFeeEstimateLevel).reduce((t,n)=>({...t,[n]:l(this,s,"m",c).call(this,e,n)}),{});return{type:h.GasFeeEstimateType.Legacy,...t}},r=function(e){return{type:h.GasFeeEstimateType.GasPrice,gasPrice:(0,f.gweiDecimalToWeiHex)(e.gasPrice)}},o=function(e,t){return{maxFeePerGas:(0,f.gweiDecimalToWeiHex)(e[t].suggestedMaxFeePerGas),maxPriorityFeePerGas:(0,f.gweiDecimalToWeiHex)(e[t].suggestedMaxPriorityFeePerGas)}},c=function(e,t){return(0,f.gweiDecimalToWeiHex)(e[t])}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.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};n.LineaGasFeeFlow=class{constructor(){s.add(this)}matchesTransaction({transactionMeta:e}){return g.includes(e.chainId)}async getGasFees(e){try{return await l(this,s,"m",a).call(this,e)}catch(t){return p("Using default flow as fallback due to error",t),(new u.DefaultGasFeeFlow).getGasFees(e)}}},s=new WeakSet,a=async function(e){const{ethQuery:t,transactionMeta:n}=e,a=await l(this,s,"m",i).call(this,n,t);p("Received Linea response",a);const m=l(this,s,"m",r).call(this,a.baseFeePerGas,k);p("Generated base fees",l(this,s,"m",c).call(this,m));const u=l(this,s,"m",r).call(this,a.priorityFeePerGas,b);p("Generated priority fees",l(this,s,"m",c).call(this,u));const h=l(this,s,"m",o).call(this,m,u);p("Generated max fees",l(this,s,"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})}},i=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}])},r=function(e,t){const n=(0,d.hexToBN)(e);return{low:n.muln(t.low),medium:n.muln(t.medium),high:n.muln(t.high)}},o=function(e,t){return{low:e.low.add(t.low),medium:e.medium.add(t.medium),high:e.high.add(t.high)}},c=function(e){return Object.values(f.GasFeeEstimateLevel).map(t=>e[t].toString(10))}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.OptimismLayer1GasFeeFlow=void 0;const r=e("@metamask/controller-utils"),o=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),s.add(this)}async matchesTransaction({transactionMeta:e}){const t=(0,o.hexToNumber)(e.chainId),n=await i(this,s,"m",a).call(this);return!!n?.has(t)||d.includes(e.chainId)}}n.OptimismLayer1GasFeeFlow=m,s=new WeakSet,a=async function(){try{const e=await(0,r.handleFetch)("https://gas.api.cx.metamask.io/v1/supportedNetworks");return new Set(e?.partialSupport?.optimism??[])}catch{return null}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var s,a,i,r,o,c,l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.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"}];n.OracleLayer1GasFeeFlow=class{constructor(){s.add(this)}getOracleAddressForChain(e){return"0x420000000000000000000000000000000000000F"}shouldSignTransaction(){return!1}async getLayer1Fee(e){try{const{provider:t,transactionMeta:n}=e,r=l(this,s,"m",c).call(this,t,n.chainId),o=await l(this,s,"m",a).call(this,r,n),d=await l(this,s,"m",i).call(this,r,n);return{layer1Fee:(0,h.add0x)((0,k.padHexToEvenLength)(o.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")}}},s=new WeakSet,a=async function(e,t){const n=l(this,s,"m",r).call(this,t,this.shouldSignTransaction()).serialize(),a=await e.getL1Fee(n);if(a===undefined)throw new Error("No value returned from oracle contract");return(0,k.toBN)(a)},i=async function(e,t){const{gasUsed:n}=t;if(!n)return w;try{const t=await e.getOperatorFee(n);return t===undefined?w:(0,k.toBN)(t)}catch(e){return b("Failed to get operator layer 1 gas fee",e),w}},r=function(e,n){const a=l(this,s,"m",o).call(this,e),{chainId:i}=e;let r=(0,g.prepareTransaction)(i,a);if(n){const e=t.from("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789","hex"),n=Uint8Array.from(e);r=r.sign(n)}return r},o=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/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","./DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","@metamask/gas-fee-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.randomiseDecimalGWEIAndConvertToHex=n.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,n){const s=(0,p.gweiDecimalToWeiDecimal)(e),a=s.length,i=Math.min(t,a-n);if(0===Number(s)||i<=0)return`0x${Number(s).toString(16)}`;const r=a-i,o=s.slice(0,r),c=s.slice(-i),l=function(e,t){const n=10**e;return t+Math.floor(Math.random()*(n-t))}(i,Number(c)),m=`0x${(BigInt(o+"0".repeat(i))+BigInt(l)).toString(16)}`;return(0,d.add0x)(m)}n.RandomisedEstimationsGasFeeFlow=class{constructor(){s.add(this)}matchesTransaction({transactionMeta:e,messenger:t}){const{chainId:n}=e;return(0,f.getGasFeeRandomisation)(t).randomisedGasFeeDigits[n]!==undefined}async getGasFees(e){try{return await c(this,s,"m",i).call(this,e)}catch(t){return g("Using default flow as fallback due to error",t),await c(this,s,"m",a).call(this,e)}}},s=new WeakSet,a=async function(e){return(new m.DefaultGasFeeFlow).getGasFees(e)},i=async function(e){const{messenger:t,gasFeeControllerData:n,transactionMeta:i}=e,{gasEstimateType:o,gasFeeEstimates:d}=n,m=(0,f.getGasFeeRandomisation)(t),u=m.randomisedGasFeeDigits[i.chainId],h=m.preservedNumberOfDigits??2;if(o===l.GAS_ESTIMATE_TYPES.FEE_MARKET){g("Randomising fee market estimates",d);const e=c(this,s,"m",r).call(this,d,u,h);return g("Added randomised fee market estimates",e),{estimates:e}}return await c(this,s,"m",a).call(this,e)},r=function(e,t,n){const a=Object.values(h.GasFeeEstimateLevel).reduce((a,i)=>({...a,[i]:c(this,s,"m",o).call(this,e,i,t,n)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...a}},o=function(e,t,n,s){return{maxFeePerGas:(0,p.gweiDecimalToWeiHex)(e[t].suggestedMaxFeePerGas),maxPriorityFeePerGas:k(e[t].suggestedMaxPriorityFeePerGas,n,s)}},n.randomiseDecimalGWEIAndConvertToHex=k}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ScrollLayer1GasFeeFlow=void 0;const s=e("./OracleLayer1GasFeeFlow.cjs"),a=e("../constants.cjs"),i=[a.CHAIN_IDS.SCROLL,a.CHAIN_IDS.SCROLL_SEPOLIA];class r extends s.OracleLayer1GasFeeFlow{getOracleAddressForChain(e){return"0x5300000000000000000000000000000000000002"}shouldSignTransaction(){return!0}async matchesTransaction({transactionMeta:e}){return i.includes(e.chainId)}}n.ScrollLayer1GasFeeFlow=r}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},o=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n};Object.defineProperty(n,"__esModule",{value:!0}),n.TestGasFeeFlow=void 0;const c=e("@metamask/controller-utils"),l=e("../types.cjs"),d=1e15;n.TestGasFeeFlow=class{constructor(){s.add(this),a.set(this,1)}matchesTransaction(){return!0}async getGasFees(e){const{transactionMeta:t}=e,{txParams:n}=t,{gas:c}=n;if(!c)throw new Error("Cannot estimate fee without gas value");const m=parseInt(c,16),u=.5*d,h=(r(this,a,"f")+1)*d,f=r(this,a,"f")*d,p=h-u,g=f-u,k=h+u,b=f+u;return o(this,a,r(this,a,"f")+1,"f"),{estimates:{type:l.GasFeeEstimateType.FeeMarket,low:{maxFeePerGas:r(this,s,"m",i).call(this,p,m),maxPriorityFeePerGas:r(this,s,"m",i).call(this,g,m)},medium:{maxFeePerGas:r(this,s,"m",i).call(this,h,m),maxPriorityFeePerGas:r(this,s,"m",i).call(this,f,m)},high:{maxFeePerGas:r(this,s,"m",i).call(this,k,m),maxPriorityFeePerGas:r(this,s,"m",i).call(this,b,m)}}}}},a=new WeakMap,s=new WeakSet,i=function(e,t){const n=Math.ceil(e/t);return(0,c.toHex)(n)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccountsApiRemoteTransactionSource=n.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");n.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");n.AccountsApiRemoteTransactionSource=class{constructor(){s.add(this)}getSupportedChains(){return n.SUPPORTED_CHAIN_IDS}async fetchTransactions(e){const{address:t,chainIds:c}=e,l=await o(this,s,"m",a).call(this,e,c??n.SUPPORTED_CHAIN_IDS);k("Fetched transactions",l.length,l);const d=await Promise.all(l.map(e=>o(this,s,"m",r).call(this,t,e)));k("Normalized transactions",d);const m=o(this,s,"m",i).call(this,e,d);return k("Filtered transactions",m.length,m),m}},s=new WeakSet,a=async function(e,t){const{address:n,tags:s}=e,a=[];try{const e=await(0,h.getAccountTransactions)({address:n,chainIds:t,sortDirection:"DESC",tags:s});e?.data&&a.push(...e.data)}catch(e){k("Error while fetching transactions",e)}return a},i=function(e,t){const{address:n,includeTokenTransfers:s,updateTransactions:a}=e;let i=t;return a||(i=i.filter(e=>e.txParams.to===n)),s||(i=i.filter(e=>!e.isTransfer)),i},r=async function(e,t){const n=String(t.blockNumber),s=`0x${t.chainId.toString(16)}`,{hash:a}=t,i=new Date(t.timestamp).getTime(),r=(0,m.v1)({msecs:i}),{from:o}=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),T=y?.to.toLowerCase()===e.toLowerCase()&&o.toLowerCase()!==e.toLowerCase(),_=o.toLowerCase()===e.toLowerCase(),x=y?.amount,E=y?.contractAddress,v=y?.decimal,I=y?.symbol,S=(0,l.BNToHex)(new d.default(T?y?.amount??t.value:t.value)),C=T?e:t.to,A={blockNumber:n,chainId:s,error:w===g.TransactionStatus.failed?new Error("Transaction failed"):undefined,hash:a,id:r,isTransfer:T,networkClientId:"",status:w,time:i,toSmartContract:!1,transferInformation:y?{amount:x,contractAddress:E,decimals:v,symbol:I}:undefined,txParams:{chainId:s,data:k,from:o,gas:c,gasPrice:h,gasUsed:f,nonce:p,to:C,value:S},type:b,verifiedOnBlockchain:!1};return _&&(A.type=(await(0,u.determineTransactionType)(A.txParams)).type),A}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs",{"../gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","../utils/layer1-gas-fee-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/layer1-gas-fee-flow.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p,g,k,b,w,y,T,_,x,E,v,I=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},S=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},C=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.updateTransactionGasEstimates=n.updateTransactionGasProperties=n.GasFeePoller=void 0;const A=C(e("@metamask/eth-query")),j=e("@metamask/utils"),P=C(e("events")),O=e("../gas-flows/DefaultGasFeeFlow.cjs"),N=e("../logger.cjs"),F=e("../types.cjs"),M=e("../utils/gas-flow.cjs"),D=e("../utils/layer1-gas-fee-flow.cjs"),R=(0,j.createModuleLogger)(N.projectLogger,"gas-fee-poller");function B(e,t,n,s){const{type:a}=t;if(s){if(a===F.GasFeeEstimateType.FeeMarket){const s=t;e.maxFeePerGas=s[n]?.maxFeePerGas,e.maxPriorityFeePerGas=s[n]?.maxPriorityFeePerGas}if(a===F.GasFeeEstimateType.GasPrice){const n=t;e.maxFeePerGas=n.gasPrice,e.maxPriorityFeePerGas=n.gasPrice}if(a===F.GasFeeEstimateType.Legacy){const s=t[n];e.maxFeePerGas=s,e.maxPriorityFeePerGas=s}delete e.gasPrice}else{if(a===F.GasFeeEstimateType.FeeMarket){const s=t;e.gasPrice=s[n]?.maxFeePerGas}if(a===F.GasFeeEstimateType.GasPrice){const n=t;e.gasPrice=n.gasPrice}if(a===F.GasFeeEstimateType.Legacy){const s=t;e.gasPrice=s[n]}delete e.maxFeePerGas,delete e.maxPriorityFeePerGas}}n.GasFeePoller=class{constructor({findNetworkClientIdByChainId:e,gasFeeFlows:t,getGasFeeControllerEstimates:n,getProvider:g,getTransactions:k,getTransactionBatches:b,layer1GasFeeFlows:w,messenger:y,onStateChange:T}){s.add(this),this.hub=new P.default,a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.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),I(this,a,e,"f"),I(this,i,t,"f"),I(this,d,w,"f"),I(this,r,n,"f"),I(this,o,g,"f"),I(this,c,k,"f"),I(this,l,b,"f"),I(this,m,y,"f"),T(()=>{const e=S(this,s,"m",x).call(this),t=S(this,s,"m",E).call(this);e.length||t.length?S(this,s,"m",f).call(this):S(this,s,"m",p).call(this)})}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,s=new WeakSet,f=function(){S(this,h,"f")||(S(this,s,"m",g).call(this),I(this,h,!0,"f"),R("Started polling"))},p=function(){S(this,h,"f")&&(clearTimeout(S(this,u,"f")),I(this,u,undefined,"f"),I(this,h,!1,"f"),R("Stopped polling"))},g=async function e(){await S(this,s,"m",k).call(this),await S(this,s,"m",b).call(this),I(this,u,setTimeout(()=>S(this,s,"m",e).call(this),1e4),"f")},k=async function(){const e=S(this,s,"m",x).call(this);if(!e.length)return;R("Found unapproved transactions",e.length);const t=await S(this,s,"m",v).call(this,e);R("Retrieved gas fee controller data",t),await Promise.all(e.flatMap(e=>{const{chainId:n}=e,a=t.get(n);return S(this,s,"m",w).call(this,e,a)}))},b=async function(){const e=S(this,s,"m",E).call(this);if(!e.length)return;R("Found unapproved transaction batches",e.length);const t=await S(this,s,"m",v).call(this,e);R("Retrieved gas fee controller data",t),await Promise.all(e.flatMap(e=>{const{chainId:n}=e,a=t.get(n);return S(this,s,"m",y).call(this,e,a)}))},w=async function(e,t){const{id:n}=e,[a,i]=await Promise.all([S(this,s,"m",T).call(this,e,t),S(this,s,"m",_).call(this,e)]);(a||i)&&this.hub.emit("transaction-updated",{transactionId:n,gasFeeEstimates:a?.gasFeeEstimates,gasFeeEstimatesLoaded:a?.gasFeeEstimatesLoaded,layer1GasFee:i})},y=async function(e,t){const{id:n}=e,s=new A.default(S(this,o,"f").call(this,e.networkClientId)),a=new O.DefaultGasFeeFlow,i={ethQuery:s,gasFeeControllerData:t,messenger:S(this,m,"f"),transactionMeta:{...e,txParams:{...e.transactions?.[0],from:e.from,gas:e.gas},time:Date.now()}};let r;try{r=(await a.getGasFees(i)).estimates}catch(t){R("Failed to get gas fees for batch",e.id,t)}r&&this.hub.emit("transaction-batch-updated",{transactionBatchId:n,gasFeeEstimates:r,gasFeeEstimatesLoaded:!0})},T=async function(e,t){const{networkClientId:n}=e,s=new A.default(S(this,o,"f").call(this,n)),a=(0,M.getGasFeeFlow)(e,S(this,i,"f"),S(this,m,"f"));a&&R("Found gas fee flow",a.constructor.name,e.id);const r={ethQuery:s,gasFeeControllerData:t,messenger:S(this,m,"f"),transactionMeta:e};let c;if(a)try{c=(await a.getGasFees(r)).estimates}catch(t){R("Failed to get suggested gas fees",e.id,t)}return!c&&e.gasFeeEstimatesLoaded?undefined:(R("Updated gas fee estimates",{gasFeeEstimates:c,transaction:e.id}),{gasFeeEstimates:c,gasFeeEstimatesLoaded:!0})},_=async function(e){const{networkClientId:t}=e,n=S(this,o,"f").call(this,t),s=await(0,D.getTransactionLayer1GasFee)({layer1GasFeeFlows:S(this,d,"f"),messenger:S(this,m,"f"),provider:n,transactionMeta:e});return s&&R("Updated layer 1 gas fee",s,e.id),s},x=function(){return S(this,c,"f").call(this).filter(e=>e.status===F.TransactionStatus.unapproved)},E=function(){return S(this,l,"f").call(this).filter(e=>e.status===F.TransactionStatus.unapproved)},v=async function(e){const t=new Map;for(const n of e){const{chainId:e,networkClientId:s}=n;if(t.has(e))continue;const i=s??S(this,a,"f").call(this,e);t.set(e,i)}R("Extracted network client IDs by chain ID",t);const n=Array.from(t.entries()).map(async([e,t])=>[e,await S(this,r,"f").call(this,{networkClientId:t})]);return new Map(await Promise.all(n))},n.updateTransactionGasProperties=function({gasFeeEstimates:e,gasFeeEstimatesLoaded:t,isTxParamsGasFeeUpdatesEnabled:n,layer1GasFee:s,txMeta:a}){const i=a.userFeeLevel,r=Object.values(F.GasFeeEstimateLevel).includes(i);if(n(a)&&r&&e){const t=a.txParams.type!==F.TransactionEnvelopeType.legacy;B(a.txParams,e,i,t)}e&&(a.gasFeeEstimates=e),t!==undefined&&(a.gasFeeEstimatesLoaded=t),s&&(a.layer1GasFee=s)},n.updateTransactionGasEstimates=function({txMeta:e,userFeeLevel:t}){const{txParams:n,gasFeeEstimates:s}=e;if(!s)return;B(n,s,t,e.txParams.type!==F.TransactionEnvelopeType.legacy)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","./AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p,g,k,b,w,y,T,_,x,E,v,I,S,C,A,j,P,O,N,F=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},M=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},D=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.IncomingTransactionHelper=n.WebSocketState=void 0;const R=D(e("events")),B=e("./AccountsApiRemoteTransactionSource.cjs"),L=e("../logger.cjs"),G=e("../utils/feature-flags.cjs"),H=e("../utils/utils.cjs");var U;!function(e){e.CONNECTED="connected",e.DISCONNECTED="disconnected"}(U||(n.WebSocketState=U={}));n.IncomingTransactionHelper=class{constructor({client:e,getCurrentAccount:t,getLocalTransactions:n,includeTokenTransfers:_,isEnabled:E,messenger:v,remoteTransactionSource:C,trimTransactions:A,updateTransactions:j}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.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,[...B.SUPPORTED_CHAIN_IDS]),b.set(this,e=>{M(this,s,"m",x).call(this,e)}),w.set(this,e=>{M(this,s,"m",I).call(this,e)}),y.set(this,()=>{M(this,s,"m",S).call(this)}),T.set(this,({chainIds:e,status:t})=>{M(this,s,"m",N).call(this,e,t)}),this.hub=new R.default,F(this,a,e,"f"),F(this,i,t,"f"),F(this,r,n,"f"),F(this,o,_,"f"),F(this,c,E??(()=>!0),"f"),F(this,l,!1,"f"),F(this,d,!1,"f"),F(this,m,v,"f"),F(this,u,C,"f"),F(this,f,A,"f"),F(this,p,j,"f"),F(this,g,(0,G.isIncomingTransactionsUseBackendWebSocketServiceEnabled)(v),"f"),M(this,g,"f")&&(M(this,m,"f").subscribe("BackendWebSocketService:connectionStateChanged",M(this,b,"f")),M(this,m,"f").subscribe("AccountActivityService:statusChanged",M(this,T,"f")))}start(){M(this,g,"f")||M(this,s,"m",_).call(this,!0)}stop(){M(this,h,"f")&&clearTimeout(M(this,h,"f")),M(this,l,"f")&&(F(this,l,!1,"f"),(0,L.incomingTransactionsLogger)("Stopped polling"))}async update({chainIds:e,isInterval:t,tags:n}={}){const a=M(this,s,"m",O).call(this,n,t);if((0,L.incomingTransactionsLogger)("Checking for incoming transactions",{isInterval:Boolean(t),tags:a}),!M(this,s,"m",j).call(this))return;const c=M(this,i,"f").call(this),l=M(this,o,"f")??!0,d=M(this,p,"f")??!1;let m=[];try{m=await M(this,u,"f").fetchTransactions({address:c.address,chainIds:e,includeTokenTransfers:l,tags:a,updateTransactions:d})}catch(e){return void(0,L.incomingTransactionsLogger)("Error while fetching remote transactions",e)}if(!m.length)return;M(this,s,"m",A).call(this,m),(0,L.incomingTransactionsLogger)("Found potential transactions",m.length,m);const h=M(this,r,"f").call(this),g=m.filter(e=>!h.some(t=>t.hash?.toLowerCase()===e.hash?.toLowerCase()&&t.txParams.from?.toLowerCase()===e.txParams.from?.toLowerCase()&&t.type===e.type));if(!g.length)return void(0,L.incomingTransactionsLogger)("All transactions are already known");(0,L.incomingTransactionsLogger)("Found unique transactions",g.length,g);const k=M(this,f,"f").call(this,[...g,...h]),b=g.map(e=>e.id),w=k.filter(e=>b.includes(e.id));w.length?((0,L.incomingTransactionsLogger)("Adding new transactions",w.length,w),this.hub.emit("transactions",w)):(0,L.incomingTransactionsLogger)("All unique transactions truncated due to limit")}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=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,T=new WeakMap,s=new WeakSet,_=function(e=!1){if(M(this,l,"f"))return;if(!M(this,s,"m",j).call(this))return;const t=M(this,s,"m",P).call(this);(0,L.incomingTransactionsLogger)("Started polling",{interval:t}),F(this,l,!0,"f"),M(this,d,"f")||M(this,s,"m",C).call(this).catch(t=>{(0,L.incomingTransactionsLogger)(e?"Initial polling failed":"Polling failed",t)})},x=function(e){e.state===U.CONNECTED?((0,L.incomingTransactionsLogger)("WebSocket connected, starting enhanced mode"),M(this,s,"m",E).call(this)):e.state===U.DISCONNECTED&&((0,L.incomingTransactionsLogger)("WebSocket disconnected, stopping enhanced mode"),M(this,s,"m",v).call(this))},E=function(){M(this,s,"m",j).call(this)&&((0,L.incomingTransactionsLogger)("Started transaction history retrieval (event-driven)"),this.update().catch(e=>{(0,L.incomingTransactionsLogger)("Initial update in transaction history retrieval failed",e)}),M(this,m,"f").subscribe("AccountActivityService:transactionUpdated",M(this,w,"f")),M(this,m,"f").subscribe("AccountsController:selectedAccountChange",M(this,y,"f")))},v=function(){(0,L.incomingTransactionsLogger)("Stopped transaction history retrieval"),M(this,m,"f").unsubscribe("AccountActivityService:transactionUpdated",M(this,w,"f")),M(this,m,"f").unsubscribe("AccountsController:selectedAccountChange",M(this,y,"f"))},I=function(e){(0,L.incomingTransactionsLogger)("Received relevant transaction update, triggering update",{txId:e.id,chain:e.chain}),this.update().catch(e=>{(0,L.incomingTransactionsLogger)("Update after transaction event failed",e)})},S=function(){(0,L.incomingTransactionsLogger)("Selected account changed, triggering update"),this.update().catch(e=>{(0,L.incomingTransactionsLogger)("Update after account change failed",e)})},C=async function e(){F(this,d,!0,"f");try{const e=M(this,g,"f")?M(this,k,"f"):undefined;await this.update({chainIds:e,isInterval:!0})}catch(e){console.error("Error while checking incoming transactions",e)}F(this,d,!1,"f"),M(this,l,"f")&&(M(this,h,"f")&&clearTimeout(M(this,h,"f")),F(this,h,setTimeout(()=>M(this,s,"m",e).call(this),M(this,s,"m",P).call(this)),"f"))},A=function(e){e.sort((e,t)=>e.time<t.time?-1:1)},j=function(){return M(this,c,"f").call(this)},P=function(){return(0,G.getIncomingTransactionsPollingInterval)(M(this,m,"f"))},O=function(e,t){const n=[];return M(this,a,"f")&&n.push(M(this,a,"f")),e?.length?n.push(...e):t&&n.push("automatic-polling"),n?.length?n:undefined},N=function(e,t){if(!M(this,g,"f"))return;let n=!1;for(const s of e){const e=(0,H.caip2ToHex)(s);if(e&&B.SUPPORTED_CHAIN_IDS.includes(e))if("up"===t){const t=M(this,k,"f").indexOf(e);-1!==t&&(M(this,k,"f").splice(t,1),n=!0,(0,L.incomingTransactionsLogger)("Supported network came up, removed from polling list",{chainId:e}))}else"down"!==t||M(this,k,"f").includes(e)||(M(this,k,"f").push(e),n=!0,(0,L.incomingTransactionsLogger)("Supported network went down, added to polling list",{chainId:e}));else(0,L.incomingTransactionsLogger)("Chain ID not recognized or not supported",{caip2ChainId:s,hexChainId:e})}n?0===M(this,k,"f").length?((0,L.incomingTransactionsLogger)("Stopping fallback polling - all networks up"),this.stop()):((0,L.incomingTransactionsLogger)("Starting fallback polling - some networks need polling",{chainsToPoll:M(this,k,"f")}),M(this,s,"m",_).call(this)):(0,L.incomingTransactionsLogger)("No changes to polling list",{chainsToPoll:M(this,k,"f")})}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js","eth-method-registry":"/home/runner/work/metamask-extension/metamask-extension/node_modules/eth-method-registry/dist/index.js",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},d=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},m=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.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");n.MethodDataHelper=class{constructor({getProvider:e,getState:t}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,new h.Mutex),this.hub=new p.default,l(this,a,e,"f"),l(this,i,t,"f"),l(this,r,new Map,"f")}async lookup(e,t){k("lookup",e,t);const n=await d(this,o,"f").acquire();try{const n=d(this,i,"f").call(this)[e];if(n)return k("Cached",n),n;let o=d(this,r,"f").get(t);if(!o){const e=d(this,a,"f").call(this,t);o=new f.MethodRegistry({provider:e}),d(this,r,"f").set(t,o),k("Created registry",t)}const l=await d(this,s,"m",c).call(this,e,o);return k("Result",l),this.hub.emit("update",{fourBytePrefix:e,methodData:l}),l}finally{n()}}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakSet,c=async function(e,t){const n=await t.lookup(e);if(!n)return k("No method found",e),{registryMethod:"",parsedRegistryMethod:{name:undefined,args:undefined}};k("Parsing",n);return{registryMethod:n,parsedRegistryMethod:t.parse(n)}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},g=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.MultichainTrackingHelper=void 0;const k=e("async-mutex"),b=e("../logger.cjs"),w=(0,b.createModuleLogger)(b.projectLogger,"multichain-tracking");n.MultichainTrackingHelper=class{constructor({findNetworkClientIdByChainId:e,getNetworkClientById:t,getNetworkClientRegistry:n,removePendingTransactionTrackerListeners:k,createNonceTracker:b,createPendingTransactionTracker:y,onNetworkStateChange:T}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.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),n=Array.from(g(this,m,"f").keys()),a=n.filter(e=>!t.includes(e));a.forEach(e=>{g(this,s,"m",h).call(this,e)});const i=t.filter(e=>!n.includes(e));i.forEach(e=>{g(this,s,"m",f).call(this,e)}),i.length&&w("Added trackers",i),a.length&&w("Removed trackers",a)}),p(this,a,e,"f"),p(this,i,t,"f"),p(this,r,n,"f"),p(this,o,k,"f"),p(this,c,b,"f"),p(this,l,y,"f"),T((e,t)=>{const n=g(this,r,"f").call(this);t.forEach(({op:e,path:t})=>{if("remove"===e&&"networkConfigurations"===t[0]){const e=t[1];delete n[e]}}),g(this,u,"f").call(this,n)})}initialize(){const e=g(this,r,"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 n=g(this,d,"f").get(e);n||(n=new Map,g(this,d,"f").set(e,n));let s=n.get(t);return s||(s=new k.Mutex,n.set(t,s)),await s.acquire()}async getNonceLock(e,t){const n=g(this,i,"f").call(this,t),s=await this.acquireNonceLockForChainIdKey({chainId:n.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),n=()=>{t.releaseLock(),s?.()};return{...t,releaseLock:n}}catch(e){throw s?.(),e}}stopAllTracking(){for(const[e]of g(this,m,"f"))g(this,s,"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 n,s=t;try{t&&(n=g(this,i,"f").call(this,t))}catch(n){if(w("No network client found with ID",t),!e)throw n}return!n&&e&&(s=g(this,a,"f").call(this,e),n=g(this,i,"f").call(this,s)),{...n,id:s}}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,u=new WeakMap,s=new WeakSet,h=function(e){const t=g(this,m,"f").get(e);t&&(t.pendingTransactionTracker.stop(),g(this,o,"f").call(this,t.pendingTransactionTracker),g(this,m,"f").delete(e))},f=function(e){if(g(this,m,"f").get(e))return;const{provider:t,blockTracker:n,configuration:{chainId:s}}=g(this,i,"f").call(this,e),a=g(this,c,"f").call(this,{provider:t,blockTracker:n,chainId:s}),r=g(this,l,"f").call(this,{provider:t,blockTracker:n,chainId:s,networkClientId:e});g(this,m,"f").set(e,{nonceTracker:a,pendingTransactionTracker:r})}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","./TransactionPoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p,g,k,b,w,y,T,_,x,E,v,I,S,C,A,j,P,O,N,F,M,D,R,B,L,G,H,U,W,q,$=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},K=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},V=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.PendingTransactionTracker=void 0;const z=e("@metamask/controller-utils"),Y=V(e("events")),J=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"],ne=(0,X.createModuleLogger)(X.projectLogger,"pending-transactions");n.PendingTransactionTracker=class{constructor({blockTracker:e,getChainId:t,getEthQuery:n,getGlobalLock:x,getNetworkClientId:E,getTransactions:v,isTimeoutEnabled:I,hooks:S,isResubmitEnabled:C,messenger:A,publishTransaction:j}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.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,s,"m",F).call(this);e.length?K(this,s,"m",T).call(this,e):this.stop()},this.hub=new Y.default,$(this,i,new Map,"f"),$(this,o,t,"f"),$(this,c,n,"f"),$(this,l,x,"f"),$(this,d,E,"f"),$(this,m,v,"f"),$(this,u,C??(()=>!0),"f"),$(this,h,new Map,"f"),$(this,f,K(this,s,"m",_).bind(this),"f"),$(this,g,A,"f"),$(this,k,j,"f"),$(this,b,!1,"f"),$(this,y,undefined,"f"),$(this,w,new Q.TransactionPoller({blockTracker:e,chainId:t(),messenger:A}),"f"),$(this,a,S?.beforeCheckPendingTransaction??(()=>Promise.resolve(!0)),"f"),$(this,r,I,"f"),$(this,p,(0,X.createModuleLogger)(ne,`${t()}:${E()}`),"f")}addTransactionToPoll(e){K(this,s,"m",T).call(this,[e]),$(this,y,e,"f")}async forceCheckTransaction(e){const t=await K(this,l,"f").call(this);try{await K(this,s,"m",A).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,i=new WeakMap,r=new WeakMap,o=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,s=new WeakSet,T=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"))},_=async function(e){const t=await K(this,l,"f").call(this);try{await K(this,s,"m",x).call(this)}catch(e){K(this,p,"f").call(this,"Failed to check transactions",e)}finally{t()}try{await K(this,s,"m",E).call(this,e)}catch(e){K(this,p,"f").call(this,"Failed to resubmit transactions",e)}},x=async function(){K(this,p,"f").call(this,"Checking transactions");const e=[...K(this,s,"m",F).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,s,"m",A).call(this,e)))):K(this,p,"f").call(this,"No pending transactions to check")},E=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,s,"m",F).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 n of t)try{await K(this,s,"m",I).call(this,n,e)}catch(e){const t=e.value?.message?.toLowerCase()??e.message?.toLowerCase()??String(e);if(K(this,s,"m",v).call(this,t)){K(this,p,"f").call(this,"Ignoring known transaction error",t);continue}K(this,s,"m",M).call(this,n,e.message,"There was an error when resubmitting this transaction.")}}else K(this,p,"f").call(this,"No pending transactions to resubmit")},v=function(e){return te.some(t=>e.includes(t))},I=async function(e,t){if(!K(this,s,"m",S).call(this,e,t))return;if(!await K(this,a,"f").call(this,e))return;const n=K(this,c,"f").call(this,e.networkClientId);await K(this,k,"f").call(this,n,e);const i=(e.retryCount??0)+1;K(this,s,"m",B).call(this,(0,J.merge)({},e,{retryCount:i}),"PendingTransactionTracker:transaction-retry - Retry count increased")},S=function(e,t){const n=(0,J.cloneDeep)(e);n.firstRetryBlockNumber||(n.firstRetryBlockNumber=t,K(this,s,"m",B).call(this,n,"PendingTransactionTracker:#isResubmitDue - First retry block number set"));const{firstRetryBlockNumber:a}=n,i=Number.parseInt(t,16)-Number.parseInt(a,16),r=e.retryCount??0;return i>=Math.min(50,Math.pow(2,r))},C=function(e){const{hash:t,id:n}=e;K(this,y,"f")?.id===n&&$(this,y,undefined,"f"),t&&K(this,h,"f").delete(t)},A=async function(e){const{hash:t,id:n,isIntentComplete:i,txParams:{from:r}}=e;if(i)await K(this,s,"m",j).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,s,"m",D).call(this,e,t)}if(K(this,s,"m",N).call(this,e))return K(this,p,"f").call(this,"Nonce already taken",n),void K(this,s,"m",R).call(this,e);try{const n=await K(this,s,"m",L).call(this,t),a="0x1"===n?.status;if("0x0"===n?.status)return K(this,p,"f").call(this,"Transaction receipt has failed status"),void K(this,s,"m",D).call(this,e,new Error("Transaction failed on-chain"));const{blockNumber:i,blockHash:o}=n??{};if(a&&i&&o)return void await K(this,s,"m",j).call(this,e,{...n,blockNumber:i,blockHash:o});K(this,p,"f").call(this,"No receipt status",{hash:t,receipt:n});const c=await K(this,s,"m",U).call(this,r),l=parseInt(c,16);if(!n&&await K(this,s,"m",P).call(this,e,l))return;await K(this,s,"m",O).call(this,e,l)&&K(this,s,"m",R).call(this,e)}catch(t){K(this,p,"f").call(this,"Failed to check transaction",n,t),K(this,s,"m",M).call(this,e,t.message,"There was a problem loading this transaction.")}}},j=async function(e,t){const{id:n}=e,{blockHash:a}=t??{};K(this,p,"f").call(this,"Transaction confirmed",n);const i=K(this,y,"f")?.id===n;if(K(this,s,"m",C).call(this,e),i)return void this.hub.emit("transaction-confirmed",e);const r=(0,J.cloneDeep)(e);if(t&&a){const{baseFeePerGas:e,timestamp:n}=await K(this,s,"m",H).call(this,a,!1);r.baseFeePerGas=e,r.blockTimestamp=n,r.txParams={...r.txParams,gasUsed:t.gasUsed},r.txReceipt=t,r.verifiedOnBlockchain=!0}r.status=Z.TransactionStatus.confirmed,K(this,s,"m",B).call(this,r,"PendingTransactionTracker:#onTransactionConfirmed - Transaction confirmed"),this.hub.emit("transaction-confirmed",r)},P=async function(e,t){const{chainId:n,hash:a,id:i,submittedTime:o,txParams:{nonce:c}}=e;if(!a||!c)return!1;if(!K(this,r,"f").call(this,e))return K(this,p,"f").call(this,"Timeout disabled for transaction",e),!1;const l=(0,ee.getTimeoutAttempts)(n,K(this,g,"f"));if(l===undefined||0===l)return K(this,p,"f").call(this,"Timeout disabled due to threshold",{chainId:n,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,s,"m",G).call(this,a)){const e=Date.now();return K(this,p,"f").call(this,"Transaction found on network, recording timestamp",i),K(this,h,"f").set(a,e),!1}const t=K(this,h,"f").get(a)??o;if(t===undefined)return K(this,p,"f").call(this,"Transaction not yet seen on network and has no submitted time, skipping timeout check",i),!1;const{blockTime:r}=(0,ee.getAcceleratedPollingParams)(n,K(this,g,"f")),c=Date.now()-t,d=r*l;return K(this,p,"f").call(this,"Checking timeout duration",{transactionId:i,durationSinceLastSeen:c,timeoutDuration:d,threshold:l,blockTime:r}),c<d?!1:(K(this,p,"f").call(this,"Hit timeout duration threshold",i),K(this,h,"f").delete(a),K(this,s,"m",D).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",i,e),!1}},O=async function(e,t){const{hash:n,id:s,txParams:{nonce:a}}=e;if(!a||!n)return!1;if(parseInt(a,16)>=t)return!1;let r=K(this,i,"f").get(n);return r===undefined&&(r=0,K(this,i,"f").set(n,r)),r<3?(K(this,p,"f").call(this,"Incrementing dropped block count",{id:s,droppedBlockCount:r}),K(this,i,"f").set(n,r+1),!1):(K(this,p,"f").call(this,"Hit dropped block count",s),K(this,i,"f").delete(n),!0)},N=function(e){const{id:t,txParams:n}=e;return K(this,s,"m",W).call(this).some(e=>e.id!==t&&e.txParams.from===n.from&&e.status===Z.TransactionStatus.confirmed&&e.txParams.nonce&&e.txParams.nonce===n.nonce&&e.type!==Z.TransactionType.incoming&&e.isTransfer===undefined)},F=function(){return K(this,s,"m",q).call(this).filter(e=>e.status===Z.TransactionStatus.submitted&&!e.verifiedOnBlockchain&&!e.isUserOperation&&!e.isStateOnly)},M=function(e,t,n){K(this,s,"m",B).call(this,{...e,warning:{error:t,message:n}},"PendingTransactionTracker:#warnTransaction - Warning added")},D=function(e,t){K(this,p,"f").call(this,"Transaction failed",e.id,t),K(this,s,"m",C).call(this,e),this.hub.emit("transaction-failed",e,t)},R=function(e){K(this,p,"f").call(this,"Transaction dropped",e.id),K(this,s,"m",C).call(this,e),this.hub.emit("transaction-dropped",e)},B=function(e,t){this.hub.emit("transaction-updated",e,t)},L=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])},W=function(){const e=K(this,o,"f").call(this);return K(this,m,"f").call(this).filter(t=>t.chainId===e)},q=function(){const e=K(this,d,"f").call(this);return K(this,m,"f").call(this).filter(t=>t.networkClientId===e)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},h=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.hasSimulationDataChanged=n.shouldResimulate=n.ResimulateHelper=n.RESIMULATE_INTERVAL_MS=n.BLOCK_TIME_ADDITIONAL_SECONDS=n.VALUE_COMPARISON_PERCENT_THRESHOLD=n.BLOCKAID_RESULT_TYPE_MALICIOUS=n.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");n.RESIMULATE_PARAMS=["to","value","data"],n.BLOCKAID_RESULT_TYPE_MALICIOUS="Malicious",n.VALUE_COMPARISON_PERCENT_THRESHOLD=5,n.BLOCK_TIME_ADDITIONAL_SECONDS=60,n.RESIMULATE_INTERVAL_MS=3e3;function T(e,t){return!_(e?.difference??"0x0",t?.difference??"0x0",!1===e?.isDecrease,!1===t?.isDecrease)}function _(e,t,s,a){let i=new p.BN((0,f.remove0x)(e),"hex"),r=new p.BN((0,f.remove0x)(t),"hex");return s&&(i=i.neg()),a&&(r=r.neg()),(0,w.getPercentageChange)(i,r)<=n.VALUE_COMPARISON_PERCENT_THRESHOLD}n.ResimulateHelper=class{constructor({getTransactions:e,simulateTransaction:t,onTransactionsUpdate:n}){s.add(this),a.set(this,new Map),i.set(this,void 0),r.set(this,void 0),u(this,i,e,"f"),u(this,r,t,"f"),n(h(this,s,"m",o).bind(this))}},a=new WeakMap,i=new WeakMap,r=new WeakMap,s=new WeakSet,o=function(){const e=h(this,i,"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 n=e.find(e=>e.id===t);n?.isActive?h(this,s,"m",c).call(this,n):h(this,s,"m",d).call(this,t)})},c=function(e){const{id:t}=e;if(h(this,a,"f").has(t))return;const i=()=>{h(this,r,"f").call(this,e).catch(e=>{y("Error during transaction resimulation",e)}).finally(()=>{h(this,a,"f").has(t)&&h(this,s,"m",l).call(this,t,i)})};h(this,s,"m",l).call(this,t,i),y(`Started resimulating transaction ${t} every ${n.RESIMULATE_INTERVAL_MS} milliseconds`)},l=function(e,t){const s=setTimeout(t,n.RESIMULATE_INTERVAL_MS);h(this,a,"f").set(e,s)},d=function(e){h(this,a,"f").has(e)&&(h(this,s,"m",m).call(this,e),y(`Stopped resimulating transaction ${e} every ${n.RESIMULATE_INTERVAL_MS} milliseconds`))},m=function(e){const t=h(this,a,"f").get(e);t&&(clearTimeout(t),h(this,a,"f").delete(e))},n.shouldResimulate=function(e,t){const{id:s}=t,a=function(e,t){const{id:s,txParams:a}=t,{txParams:i}=e;if(!i||(0,g.isEqual)(i,a))return!1;const r=Object.keys(a).filter(e=>a[e]!==i[e]);return y("Transaction parameters updated",{transactionId:s,updatedProperties:r,originalParams:i,newParams:a}),n.RESIMULATE_PARAMS.some(e=>r.includes(e))}(e,t),i=function(e,t){const{securityAlertResponse:s}=e,{id:a,securityAlertResponse:i}=t;if((0,g.isEqual)(s,i))return!1;return y("Security alert updated",{transactionId:a,originalSecurityAlertResponse:s,newSecurityAlertResponse:i}),i?.result_type===n.BLOCKAID_RESULT_TYPE_MALICIOUS}(e,t),r=function(e,t){const{simulationData:n}=e,{simulationData:s,txParams:a}=t;if(!s||(0,g.isEqual)(n,s))return!1;return!_(a?.value??"0x0",s?.nativeBalanceChange?.difference??"0x0",!1,!1===s?.nativeBalanceChange?.isDecrease)}(e,t),o=a||i||r;let c;if(i||r){c=Math.floor(Date.now()/1e3)+n.BLOCK_TIME_ADDITIONAL_SECONDS}return o&&y("Transaction should be resimulated",{transactionId:s,blockTime:c,parametersUpdated:a,securityAlert:i,valueAndNativeBalanceMismatch:r}),{blockTime:c,resimulate:o}},n.hasSimulationDataChanged=function(e,t){if((0,g.isEqual)(e,t))return!1;if(T(e?.nativeBalanceChange,t?.nativeBalanceChange))return y("Simulation data native balance changed"),!0;if(e.tokenBalanceChanges.length!==t.tokenBalanceChanges.length)return!0;for(const n of e.tokenBalanceChanges){const e=t.tokenBalanceChanges.find(({address:e,id:t})=>e===n.address&&t===n.id);if(!e)return y("Missing new token balance",{address:n.address,id:n.id}),!0;if(T(n,e))return y("Simulation data token balance changed",{originalTokenBalanceChange:n,newTokenBalanceChange:e}),!0}return!1}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f,p,g,k,b,w,y=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},T=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.TransactionPoller=void 0;const _=e("@metamask/utils"),x=e("lodash"),E=e("../logger.cjs"),v=e("../utils/feature-flags.cjs"),I=(0,_.createModuleLogger)(E.projectLogger,"transaction-poller");var S;!function(e){e.Accelerated="Accelerated",e.BlockTracker="BlockTracker",e.Websocket="Websocket"}(S||(S={}));n.TransactionPoller=class{constructor({blockTracker:e,chainId:t,messenger:n}){s.add(this),a.set(this,0),i.set(this,void 0),r.set(this,void 0),o.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(!T(this,m,"f"))return;if("confirmed"!==e.status&&"dropped"!==e.status&&"failed"!==e.status)return;const t=T(this,d,"f")?.some(t=>t.hash?.toLowerCase()===e.id.toLowerCase());t&&T(this,s,"m",f).call(this,S.Websocket).catch(()=>{})}),y(this,i,e,"f"),y(this,r,t,"f"),y(this,o,n,"f")}start(e){T(this,m,"f")||(y(this,l,e,"f"),y(this,m,!0,"f"),T(this,s,"m",b).call(this),T(this,s,"m",h).call(this),I("Started"))}stop(){T(this,m,"f")&&(y(this,m,!1,"f"),y(this,l,undefined,"f"),y(this,a,0,"f"),y(this,d,undefined,"f"),T(this,s,"m",p).call(this),T(this,s,"m",g).call(this),T(this,s,"m",w).call(this),I("Stopped"))}setPendingTransactions(e){const t=(T(this,d,"f")??[]).map(e=>e.id);y(this,d,e,"f");const n=e.map(e=>e.id),i=!(0,x.isEqual)(t,n);T(this,m,"f")&&i&&(I("Detected new pending transactions",n),y(this,a,0,"f"),T(this,c,"f")&&(T(this,s,"m",g).call(this),T(this,s,"m",h).call(this)))}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,u=new WeakMap,k=new WeakMap,s=new WeakSet,h=function e(){if(!T(this,m,"f"))return;const{countMax:t,intervalMs:n}=(0,v.getAcceleratedPollingParams)(T(this,r,"f"),T(this,o,"f"));if(T(this,a,"f")>=t)return y(this,c,e=>T(this,s,"m",f).call(this,S.BlockTracker,e),"f"),T(this,i,"f").on("latest",T(this,c,"f")),void I("Added block tracker listener");T(this,s,"m",p).call(this),y(this,u,setTimeout(async()=>{await T(this,s,"m",f).call(this,S.Accelerated),T(this,s,"m",e).call(this)},n),"f")},f=async function(e,t){switch(e){case S.Websocket:I("AccountActivityService:transactionUpdated received");break;case S.Accelerated:I("Accelerated interval",T(this,a,"f")+1);break;case S.BlockTracker:I("Block tracker interval",t)}const n=t??await T(this,i,"f").getLatestBlock();await(T(this,l,"f")?.call(this,n)),e===S.Accelerated&&T(this,m,"f")&&y(this,a,T(this,a,"f")+1,"f")},p=function(){T(this,u,"f")&&(clearTimeout(T(this,u,"f")),y(this,u,undefined,"f"))},g=function(){T(this,c,"f")&&(T(this,i,"f").removeListener("latest",T(this,c,"f")),y(this,c,undefined,"f"))},b=function(){T(this,o,"f").subscribe("AccountActivityService:transactionUpdated",T(this,k,"f"))},w=function(){T(this,o,"f").unsubscribe("AccountActivityService:transactionUpdated",T(this,k,"f"))}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.CollectPublishHook=void 0;const d=e("@metamask/utils"),m=e("lodash"),u=e("../logger.cjs"),h=(0,d.createModuleLogger)(u.projectLogger,"collect-publish-hook");n.CollectPublishHook=class{constructor(e){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),c(this,r,(0,d.createDeferredPromise)(),"f"),c(this,a,[],"f"),c(this,i,e,"f")}getHook(){return l(this,s,"m",o).bind(this)}ready(){return l(this,r,"f").promise}success(e){if(h("Success",{transactionHashes:e}),e.length!==l(this,i,"f"))throw new Error("Transaction hash count mismatch");for(let t=0;t<l(this,a,"f").length;t++){const n=l(this,a,"f")[t],s=e[t];n.promise.resolve({transactionHash:s})}}error(e){h("Error",{error:e});for(const t of l(this,a,"f"))t.promise.reject(e)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,s=new WeakSet,o=function(e,t){const n=e.txParams.nonce??"0x0",s=parseInt(n,16);h("Processing transaction",{nonce:s,signedTx:t,transactionMeta:e});const o=(0,d.createDeferredPromise)();if(l(this,a,"f").push({nonce:s,promise:o,signedTransaction:t}),c(this,a,(0,m.sortBy)(l(this,a,"f"),e=>e.nonce),"f"),l(this,a,"f").length===l(this,i,"f")){h("All transactions signed");const e=l(this,a,"f").map(e=>e.signedTransaction);l(this,r,"f").resolve({signedTransactions:e})}return o.promise}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.ExtraTransactionsPublishHook=void 0;const d=e("@metamask/utils"),m=e("../logger.cjs"),u=(0,d.createModuleLogger)(m.projectLogger,"extra-transactions-publish-hook");n.ExtraTransactionsPublishHook=class{constructor({addTransactionBatch:e,getTransaction:t,originalPublishHook:n}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),c(this,a,e,"f"),c(this,i,t,"f"),c(this,r,n,"f")}getHook(){return l(this,s,"m",o).bind(this)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,s=new WeakSet,o=async function(e,t){u("Publishing transaction as batch",{transactionMeta:e,signedTx:t});const{batchTransactions:n,batchTransactionsOptions:s,id:o,networkClientId:c,txParams:m}=e,h=m.from,f=m.to,p=m.data,g=m.value,k=m.gas,b=m.maxFeePerGas,w=m.maxPriorityFeePerGas,y=t,T=(0,d.createDeferredPromise)(),_={existingTransaction:{id:o,onPublish:({newSignature:e,transactionHash:t})=>{if(e){const t=l(this,i,"f").call(this,o);return u("Calling original publish hook with new signature",{latestTransactionMeta:t,newSignature:e}),void l(this,r,"f").call(this,t,e).then(T.resolve).catch(T.reject)}T.resolve({transactionHash:t})},signedTransaction:y},params:{data:p,gas:k,maxFeePerGas:b,maxPriorityFeePerGas:w,to:f,value:g}},x=(n??[]).map(e=>{const{isAfter:t,type:n,...s}=e;return{isAfter:t,params:s,type:n}}),E=[...x.filter(e=>!1===e.isAfter).map(({isAfter:e,...t})=>({...t})),_,...x.filter(e=>e.isAfter===undefined||e.isAfter).map(({isAfter:e,...t})=>({...t}))];u("Adding transaction batch",{from:h,networkClientId:c,transactions:E});const v=s??{disable7702:!0,disableHook:!1,disableSequential:!0};return await l(this,a,"f").call(this,{from:h,networkClientId:c,requireApproval:!1,transactions:E,...v}),T.promise}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u,h,f=this&&this.__classPrivateFieldSet||function(e,t,n,s,a){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!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"===s?a.call(e,n):a?a.value=n:t.set(e,n),n},p=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.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");n.SequentialPublishBatchHook=class{constructor({publishTransaction:e,getTransaction:t,getPendingTransactionTracker:n,getEthQuery:l}){s.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),c.set(this,{}),f(this,a,e,"f"),f(this,i,t,"f"),f(this,r,l,"f"),f(this,o,n,"f")}getHook(){return p(this,s,"m",l).bind(this)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakSet,l=async function({from:e,networkClientId:t,transactions:n}){w("Starting sequential publish batch hook",{from:e,networkClientId:t});const c=p(this,o,"f").call(this,t),l=[];for(const e of n)try{const n=p(this,i,"f").call(this,String(e.id)),o=await p(this,a,"f").call(this,p(this,r,"f").call(this,t),n);w("Transaction published",{transactionHash:o});const m={...n,hash:o},u=p(this,s,"m",d).call(this,c,m.id,m.hash);c.addTransactionToPoll(m),await u,l.push({transactionHash:o})}catch(t){throw w("Batch transaction failed",{transaction:e,error:t}),c.stop(),g.rpcErrors.internal("Failed to publish batch transaction")}return w("Sequential publish batch hook completed",{results:l}),c.stop(),{results:l}},d=async function(e,t,n){return new Promise((a,i)=>{const r=p(this,s,"m",m).bind(this,t,n,a,e),o=p(this,s,"m",u).bind(this,t,n,i,e);p(this,c,"f")[t]={onConfirmed:r,onFailedOrDropped:o},e.hub.on("transaction-confirmed",r),e.hub.on("transaction-failed",o),e.hub.on("transaction-dropped",o)})},m=function(e,t,n,a,i){i.id===e&&(w("Transaction confirmed",{transactionHash:t}),p(this,s,"m",h).call(this,a,e),n(i))},u=function(e,t,n,a,i,r){i.id===e&&(w("Transaction failed or dropped",{transactionHash:t,error:r}),p(this,s,"m",h).call(this,a,e),n(new Error(`Transaction ${t} failed or dropped.`)))},h=function(e,t){const n=p(this,c,"f")[t];e.hub.off("transaction-confirmed",n.onConfirmed),e.hub.off("transaction-failed",n.onFailedOrDropped),e.hub.off("transaction-dropped",n.onFailedOrDropped),delete p(this,c,"f")[t]}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs",{"./TransactionController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./helpers/AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","./utils/transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.HARDFORK=n.INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS=n.CHAIN_IDS=n.normalizeTransactionParams=n.isEIP1559Transaction=n.mergeGasFeeEstimates=n.determineTransactionType=n.WalletDevice=n.UserFeeLevel=n.TransactionType=n.TransactionStatus=n.TransactionEnvelopeType=n.TransactionContainerType=n.SimulationTokenStandard=n.SimulationErrorCode=n.GasFeeEstimateType=n.GasFeeEstimateLevel=n.TransactionController=n.SPEED_UP_RATE=n.CANCEL_RATE=void 0;var s=e("./TransactionController.cjs");Object.defineProperty(n,"CANCEL_RATE",{enumerable:!0,get:function(){return s.CANCEL_RATE}}),Object.defineProperty(n,"SPEED_UP_RATE",{enumerable:!0,get:function(){return s.SPEED_UP_RATE}}),Object.defineProperty(n,"TransactionController",{enumerable:!0,get:function(){return s.TransactionController}});var a=e("./types.cjs");Object.defineProperty(n,"GasFeeEstimateLevel",{enumerable:!0,get:function(){return a.GasFeeEstimateLevel}}),Object.defineProperty(n,"GasFeeEstimateType",{enumerable:!0,get:function(){return a.GasFeeEstimateType}}),Object.defineProperty(n,"SimulationErrorCode",{enumerable:!0,get:function(){return a.SimulationErrorCode}}),Object.defineProperty(n,"SimulationTokenStandard",{enumerable:!0,get:function(){return a.SimulationTokenStandard}}),Object.defineProperty(n,"TransactionContainerType",{enumerable:!0,get:function(){return a.TransactionContainerType}}),Object.defineProperty(n,"TransactionEnvelopeType",{enumerable:!0,get:function(){return a.TransactionEnvelopeType}}),Object.defineProperty(n,"TransactionStatus",{enumerable:!0,get:function(){return a.TransactionStatus}}),Object.defineProperty(n,"TransactionType",{enumerable:!0,get:function(){return a.TransactionType}}),Object.defineProperty(n,"UserFeeLevel",{enumerable:!0,get:function(){return a.UserFeeLevel}}),Object.defineProperty(n,"WalletDevice",{enumerable:!0,get:function(){return a.WalletDevice}});var i=e("./utils/transaction-type.cjs");Object.defineProperty(n,"determineTransactionType",{enumerable:!0,get:function(){return i.determineTransactionType}});var r=e("./utils/gas-flow.cjs");Object.defineProperty(n,"mergeGasFeeEstimates",{enumerable:!0,get:function(){return r.mergeGasFeeEstimates}});var o=e("./utils/utils.cjs");Object.defineProperty(n,"isEIP1559Transaction",{enumerable:!0,get:function(){return o.isEIP1559Transaction}}),Object.defineProperty(n,"normalizeTransactionParams",{enumerable:!0,get:function(){return o.normalizeTransactionParams}});var c=e("./constants.cjs");Object.defineProperty(n,"CHAIN_IDS",{enumerable:!0,get:function(){return c.CHAIN_IDS}});var l=e("./helpers/AccountsApiRemoteTransactionSource.cjs");Object.defineProperty(n,"INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS",{enumerable:!0,get:function(){return l.SUPPORTED_CHAIN_IDS}});var d=e("./utils/prepare.cjs");Object.defineProperty(n,"HARDFORK",{enumerable:!0,get:function(){return d.HARDFORK}})}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.incomingTransactionsLogger=n.projectLogger=void 0;const s=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return s.createModuleLogger}}),n.projectLogger=(0,s.createProjectLogger)("transaction-controller"),n.incomingTransactionsLogger=(0,s.createModuleLogger)(n.projectLogger,"incoming-transactions")}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,a,i,r,o,c,l,d,m,u;Object.defineProperty(n,"__esModule",{value:!0}),n.SimulationErrorCode=n.SimulationTokenStandard=n.GasFeeEstimateType=n.GasFeeEstimateLevel=n.UserFeeLevel=n.TransactionEnvelopeType=n.TransactionContainerType=n.TransactionType=n.WalletDevice=n.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"}(s||(n.TransactionStatus=s={})),function(e){e.MM_MOBILE="metamask_mobile",e.MM_EXTENSION="metamask_extension",e.OTHER="other_device"}(a||(n.WalletDevice=a={})),function(e){e.batch="batch",e.bridge="bridge",e.bridgeApproval="bridgeApproval",e.cancel="cancel",e.contractInteraction="contractInteraction",e.deployContract="contractDeployment",e.ethDecrypt="eth_decrypt",e.ethGetEncryptionPublicKey="eth_getEncryptionPublicKey",e.gasPayment="gas_payment",e.incoming="incoming",e.lendingDeposit="lendingDeposit",e.lendingWithdraw="lendingWithdraw",e.musdClaim="musdClaim",e.musdConversion="musdConversion",e.perpsAcrossDeposit="perpsAcrossDeposit",e.perpsDeposit="perpsDeposit",e.perpsDepositAndOrder="perpsDepositAndOrder",e.perpsRelayDeposit="perpsRelayDeposit",e.personalSign="personal_sign",e.predictAcrossDeposit="predictAcrossDeposit",e.predictBuy="predictBuy",e.predictClaim="predictClaim",e.predictDeposit="predictDeposit",e.predictDepositAndOrder="predictDepositAndOrder",e.predictSell="predictSell",e.predictWithdraw="predictWithdraw",e.predictRelayDeposit="predictRelayDeposit",e.relayDeposit="relayDeposit",e.retry="retry",e.revokeDelegation="revokeDelegation",e.simpleSend="simpleSend",e.signTypedData="eth_signTypedData",e.smart="smart",e.stakingClaim="stakingClaim",e.stakingDeposit="stakingDeposit",e.stakingUnstake="stakingUnstake",e.swap="swap",e.swapAndSend="swapAndSend",e.swapApproval="swapApproval",e.tokenMethodApprove="approve",e.tokenMethodSafeTransferFrom="safetransferfrom",e.tokenMethodTransfer="transfer",e.tokenMethodTransferFrom="transferfrom",e.tokenMethodSetApprovalForAll="setapprovalforall",e.tokenMethodIncreaseAllowance="increaseAllowance",e.shieldSubscriptionApprove="shieldSubscriptionApprove"}(i||(n.TransactionType=i={})),function(e){e.EnforcedSimulations="enforcedSimulations"}(r||(n.TransactionContainerType=r={})),function(e){e.legacy="0x0",e.accessList="0x1",e.feeMarket="0x2",e.setCode="0x4"}(o||(n.TransactionEnvelopeType=o={})),function(e){e.CUSTOM="custom",e.DAPP_SUGGESTED="dappSuggested",e.MEDIUM="medium"}(c||(n.UserFeeLevel=c={})),function(e){e.Low="low",e.Medium="medium",e.High="high"}(l||(n.GasFeeEstimateLevel=l={})),function(e){e.FeeMarket="fee-market",e.Legacy="legacy",e.GasPrice="eth_gasPrice"}(d||(n.GasFeeEstimateType=d={})),function(e){e.erc20="erc20",e.erc721="erc721",e.erc1155="erc1155"}(m||(n.SimulationTokenStandard=m={})),function(e){e.ChainNotSupported="chain-not-supported",e.Disabled="disabled",e.InvalidResponse="invalid-response",e.Reverted="reverted"}(u||(n.SimulationErrorCode=u={}))}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs",{"../api/simulation-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance.cjs","@ethersproject/abi":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/abi/lib/index.js","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.getBalanceChanges=n.SupportedToken=void 0;const a=e("@ethersproject/abi"),i=e("@metamask/controller-utils"),r=e("@metamask/metamask-eth-abis"),o=e("@metamask/utils"),c=s(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||(n.SupportedToken=p={}));const g=(0,o.createModuleLogger)(h.projectLogger,"balance-changes"),k=["Transfer","TransferSingle","TransferBatch","Deposit","Withdrawal"],b={[p.ERC20]:{abi:r.abiERC20,standard:f.SimulationTokenStandard.erc20},[p.ERC721]:{abi:r.abiERC721,standard:f.SimulationTokenStandard.erc721},[p.ERC1155]:{abi:r.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 T(e){return"Transfer"===e.name&&e.tokenStandard===f.SimulationTokenStandard.erc721&&0===parseInt(e.args.from,16)}function _(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 x(e){switch(e){case f.SimulationTokenStandard.erc721:return new a.Interface(r.abiERC721);case f.SimulationTokenStandard.erc1155:return new a.Interface(r.abiERC1155);default:return new a.Interface(r.abiERC20)}}function E(e,t,n){const s=x(t.standard);try{if(t.standard===f.SimulationTokenStandard.erc721){const t=s.decodeFunctionResult("ownerOf",n.return);return t[0].toLowerCase()===e.toLowerCase()?"0x1":"0x0"}const a=s.decodeFunctionResult("balanceOf",n.return);return(0,i.toHex)(a[0])}catch(e){throw g("Failed to decode balance transaction",e,{token:t,response:n}),new u.SimulationError(`Failed to decode balance transaction for token ${t.address}: ${String(e)}`)}}function v(e,t,n){const s=x(e);switch(e){case f.SimulationTokenStandard.erc721:return s.encodeFunctionData("ownerOf",[n]);case f.SimulationTokenStandard.erc1155:return s.encodeFunctionData("balanceOf",[t,n]);default:return s.encodeFunctionData("balanceOf",[t])}}function I(e){return[...e.logs??[],...(e.calls??[]).map(e=>I(e)).flat()]}function S(e){if(!e)return[];return[...e.error?[e.error]:[],...(e.calls??[]).flatMap(e=>S(e))]}function C(e,t,n=0){const s=(0,i.hexToBN)(t).add(new c.default(n)),a=(0,i.hexToBN)(e),r=s.sub(a),o=r.isNeg(),l=(0,i.toHex)(r.abs());return r.isZero()?(g("Balance change is zero"),undefined):{previousBalance:e,newBalance:(0,i.toHex)(s),difference:l,isDecrease:o}}async function A({request:e,params:t,before:n=[],after:s=[]}){const{blockTime:a,chainId:r,ethQuery:o,getSimulationConfig:m,txParams:u}=e,{authorizationList:h}=u,f=u.from,p=h?.map(e=>({address:e.address,from:f})),k=[...n,{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},...s],b=function(e){const{txParams:t}=e,n=(0,i.hexToBN)(t.gas??"0x0"),s=(0,i.hexToBN)(t.maxFeePerGas??t.gasPrice??"0x0"),a=(0,i.hexToBN)(t.value??"0x0"),r=(e.nestedTransactions??[]).map(e=>(0,i.hexToBN)(e.value??"0x0")).reduce((e,t)=>e.add(t),new c.default(0));return n.mul(s).add(a).add(r)}(e),w=(0,i.toHex)(b);g("Required balance",w);const{balanceRaw:y}=await(0,l.getNativeBalance)(f,o),T=(0,i.toHex)(y),_=(0,i.hexToBN)(T);g("Current balance",T);const x=_.lt(b);return await(0,d.simulateTransactions)(r,{...t,getSimulationConfig:m,transactions:k,withGas:!0,withDefaultBlockOverrides:!0,...a&&{blockOverrides:{...t?.blockOverrides,time:(0,i.toHex)(a)}},...x&&{overrides:{...t?.overrides,[f]:{...t?.overrides?.[f],balance:w}}}})}n.getBalanceChanges=async function(e){let t;g("Request",e);try{const n=await A({request:e,params:{withCallTrace:!0,withLogs:!0}}),s=n.transactions?.[0];t=S(s?.callTrace);const i=s?.error;if(i)throw new u.SimulationError(i);const r=function(e,t){const n=t.transactions[0];if(!n)return undefined;const{txParams:s}=e,a=s.from,{stateDiff:i}=n,r=i?.pre?.[a]?.balance,o=i?.post?.[a]?.balance;if(!r||!o)return undefined;return C(r,o,n.gasCost)}(e,n),o=function(e){const t=I(e.transactions[0]?.callTrace??{});g("Extracted logs",t);const n=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 n=Object.values(p);for(const s of n)try{const n=t.get(s),{abi:a,standard:i}=b[s];return{...n.parseLog(e),abi:a,standard:i}}catch{continue}return undefined}(e,n);if(!t)return g("Failed to parse log",e),undefined;const s=t.abi.find(e=>e.name===t.name)?.inputs;if(!s)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,n,s)=>{const a=t[s].name.replace("_",""),i=y(n);return e[a]=i,e},{})}(t.args,s);return{contractAddress:e.address,tokenStandard:t.standard,name:t.name,args:a,abi:t.abi}}).filter(e=>e!==undefined)}(n);g("Parsed events",o);const c=await async function(e,t){const{txParams:n}=e,s=n.from,a=function(e,t){const n=new Set,s=new Map,a=new Map,i=e.txParams.from,r=t.filter(e=>[e.args.from,e.args.to].includes(i));g("Filtered user events",r);for(const e of r){const t=_(e);g("Extracted token IDs",t);for(const r of t){const t={address:e.contractAddress,standard:e.tokenStandard,id:r},o=JSON.stringify(t);if(n.has(o)){g("Ignoring additional event with same contract and token ID",t);continue}n.add(o);const c=v(e.tokenStandard,i,r),l={from:i,to:e.contractAddress,data:c};T(e)||s.set(t,l),a.set(t,l)}}return{before:s,after:a}}(e,t);g("Generated balance transactions",[...a.after.values()]);const i=a.before.size+a.after.size+1;if(1===i)return[];const r=await A({request:e,before:[...a.before.values()],after:[...a.after.values()]});if(g("Balance simulation response",r),r.transactions.length!==i)throw new u.SimulationInvalidResponseError;let o=0;return[...a.after.keys()].map((e,t)=>{const n=C(!a.before.get(e)?"0x0":E(s,e,r.transactions[o++]),E(s,e,r.transactions[t+a.before.size+1]));return n?{...e,...n}:undefined}).filter(e=>e!==undefined)}(e,o),l=s?.gasUsed;return{simulationData:{callTraceErrors:t,nativeBalanceChange:r,tokenBalanceChanges:c},gasUsed:l}}catch(n){g("Failed to get balance changes",n,e);let s=n;w.some(e=>s.message?.includes(e))&&(s=new u.SimulationRevertedError);const{code:a,message:i}=s;return{simulationData:{callTraceErrors:t,tokenBalanceChanges:[],error:{code:a,message:i}},gasUsed:undefined}}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNativeBalanceSufficientForGas=n.getNativeBalance=void 0;const s=e("@metamask/controller-utils"),a=e("bignumber.js");async function i(e,t){const n=await(0,s.query)(t,"getBalance",[e,"latest"]),i=new a.BigNumber(n).toString(10);return{balanceHuman:new a.BigNumber(i).shiftedBy(-18).toString(10),balanceRaw:i}}n.getNativeBalance=i,n.isNativeBalanceSufficientForGas=async function(e,t){const n=e.txParams.from,s=new a.BigNumber(e.txParams.gas??"0x0").multipliedBy(e.txParams.maxFeePerGas??e.txParams.gasPrice??"0x0"),{balanceRaw:r}=await i(n,t);return s.isLessThanOrEqualTo(r)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs",{"../gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","../helpers/GasFeePoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs","../hooks/CollectPublishHook.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs","../hooks/SequentialPublishBatchHook.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs","../index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs","./feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas.cjs","./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/validation.cjs","@metamask/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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isAtomicBatchSupported=n.addTransactionBatch=n.ERROR_MESSAGE_NO_UPGRADE_CONTRACT=void 0;const s=e("@metamask/controller-utils"),a=e("@metamask/rpc-errors"),i=e("@metamask/utils"),r=e("uuid"),o=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,i.createModuleLogger)(g.projectLogger,"batch");function w(){const e=(0,r.v4)(),t=new Uint8Array((0,r.parse)(e));return(0,i.bytesToHex)(t)}async function y(e,t,n,a,i,r){const{assetsFiatValues:o,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:i}=c;let o=f(t);const d=o.txParams.nonce;let{signedTransaction:m}=c;const u=d?parseInt(d,16):undefined,h=r>0&&u!==undefined?u+r:undefined;if(g({transactionId:t},t=>{t.batchId=e,h&&(t.txParams.nonce=(0,s.toHex)(h))}),h){const e=await T({transactionId:t,request:a});m=e.newSignature,o=e.transactionMeta}return n(o,m).then(i).catch(()=>{}),b("Processed existing transaction with hook",{id:t,params:l}),{id:t,params:l}}const _={...i,txParams:{...l,from:k,gas:i?.gas??l.gas}};i&&(0,h.updateTransactionGasEstimates)({txMeta:_,userFeeLevel:m.GasFeeEstimateLevel.Medium});const{transactionMeta:x}=await u(_.txParams,{assetsFiatValues:o,batchId:e,disableGasBuffer:!0,networkClientId:w,origin:y,publishHook:n,requireApproval:!1,type:d}),{id:E,txParams:v}=x,I={data:v.data,gas:v.gas,maxFeePerGas:v.maxFeePerGas,maxPriorityFeePerGas:v.maxPriorityFeePerGas,to:v.to,value:v.value};return b("Processed new transaction with hook",{id:E,params:I,type:d}),{id:E,params:I,type:d}}async function T({request:e,transactionId:t}){const{getTransaction:n,signTransaction:s}=e,a=n(t);b("Re-signing existing transaction",{transactionId:t,txParams:a.txParams});const i=await s(a);if(!i)throw new Error("Failed to re-sign transaction");const r=n(t);return b("New signature",i),{newSignature:i,transactionMeta:r}}n.ERROR_MESSAGE_NO_UPGRADE_CONTRACT="Upgrade contract address not found",n.addTransactionBatch=async function(e){const{getInternalAccounts:t,messenger:i,request:r}=e,h=(0,c.getBatchSizeLimit)(i);if((0,d.validateBatchRequest)({internalAccounts:t(),request:r,sizeLimit:h}),b("Adding",r),!r.disable7702)try{return await async function(e){const{addTransaction:t,getChainId:s,messenger:i,publicKeyEIP7702:r,request:l}=e,{batchId:d,disableUpgrade:u,from:h,gasFeeToken:f,gasLimit7702:p,networkClientId:g,origin:y,overwriteUpgrade:_,requestId:x,requiredAssets:E,requireApproval:v,securityAlertId:I,skipInitialGasEstimate:S,transactions:C,validateSecurity:A}=l,j=s(g),P=e.getEthQuery(g),O=(0,o.doesChainSupportEIP7702)(j,i);if(!O)throw b("Chain does not support EIP-7702",j),a.rpcErrors.internal("Chain does not support EIP-7702");if(!r)throw a.rpcErrors.internal(o.ERROR_MESSGE_PUBLIC_KEY);let N=!1;if(!u){const{delegationAddress:e,isSupported:t}=await(0,o.isAccountUpgradedToEIP7702)(h,j,r,i,P);if(b("Account",{delegationAddress:e,isSupported:t}),!t&&e&&!_)throw b("Account upgraded to unsupported contract",h,e),a.rpcErrors.internal("Account upgraded to unsupported contract");N=!t,N&&e&&b("Overwriting authorization as already upgraded",{current:e})}const F=await Promise.all(C.map(e=>async function(e,t,n){const{from:s}=e,{params:a,type:i}=t;if(i)return{...a,type:i};const{type:r}=await(0,m.determineTransactionType)({from:s,...a},n);return{...a,type:r}}(l,e,P))),M={...(0,o.generateEIP7702BatchTransaction)(h,F),from:h,gas:p,maxFeePerGas:F[0]?.maxFeePerGas,maxPriorityFeePerGas:F[0]?.maxPriorityFeePerGas};if(N){const e=(0,c.getEIP7702UpgradeContractAddress)(j,i,r);if(!e)throw a.rpcErrors.internal(n.ERROR_MESSAGE_NO_UPGRADE_CONTRACT);M.type=k.TransactionEnvelopeType.setCode,M.authorizationList=[{address:e}]}if(A){const e={method:"eth_sendTransaction",params:[{...M,authorizationList:undefined,type:k.TransactionEnvelopeType.feeMarket}],delegationMock:M.authorizationList?.[0]?.address,origin:y};b("Security request",e),A(e,j).catch(e=>{b("Security validation failed",e)})}b("Adding batch transaction",M,g);const D=d??w(),R=I?{securityAlertId:I}:undefined,B=C.find(e=>e.existingTransaction)?.existingTransaction;if(B)return await async function({batchId:e,existingTransaction:t,nestedTransactions:n,request:s,txParams:a}){const{getTransaction:i,estimateGas:r,updateTransaction:o}=s,c=i(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 r(a,l);b("Estimated gas for converted EIP-7702 transaction",d),o({transactionId:c.id},t=>{var s;t.batchId=e,t.nestedTransactions=n,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,(s=t.txParams).type??(s.type=k.TransactionEnvelopeType.feeMarket)});const{newSignature:m}=await T({request:s,transactionId:c.id});t.onPublish?.({transactionHash:undefined,newSignature:m}),b("Transaction updated to EIP-7702",{batchId:e,txParams:a,newSignature:m})}({batchId:D,existingTransaction:B,nestedTransactions:F,request:e,txParams:M}),{batchId:D};const{result:L}=await t(M,{batchId:D,gasFeeToken:f,isGasFeeIncluded:l.isGasFeeIncluded,isGasFeeSponsored:l.isGasFeeSponsored,nestedTransactions:F,networkClientId:g,origin:y,requestId:x,requireApproval:v,requiredAssets:E,securityAlertResponse:R,skipInitialGasEstimate:S,type:k.TransactionType.batch}),G=await L;return b("Batch transaction added",{batchId:D,transactionHash:G}),{batchId:D}}(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:n,request:i,update:r}=e,{batchId:o,from:c,networkClientId:d,origin:h,requireApproval:g,transactions:k}=i;let T,_=!1;b("Adding transaction batch using hook",i);const x=new p.SequentialPublishBatchHook({publishTransaction:e.publishTransaction,getTransaction:e.getTransaction,getEthQuery:e.getEthQuery,getPendingTransactionTracker:e.getPendingTransactionTracker});let{disable7702:E,disableSequential:v}=i;const{disableHook:I,useHook:S}=i;S&&(E=!0,v=!0);let C,A=null;!I&&n?A=n:v||(A=x.getHook(),_=!0);if(!A)throw b("No supported batch methods found",{disable7702:E,disableHook:I,disableSequential:v}),a.rpcErrors.internal("Can't process batch");const j=o??w(),P=k.map(e=>({...e,origin:h})),O=P.length,N=new f.CollectPublishHook(O);try{g&&(C=await async function({batchId:e,request:t}){const{messenger:n,request:s,isSimulationEnabled:a,getChainId:i,getEthQuery:r,getGasFeeEstimates:o,getSimulationConfig:c,update:d}=t,{from:h,origin:f,networkClientId:p,transactions:g}=s,k=r(p);if(!a())throw new Error("Cannot create transaction batch as simulation not supported");b("Preparing approval data for batch");const w=i(p),{totalGasLimit:y}=await(0,l.simulateGasBatch)({chainId:w,from:h,getSimulationConfig:c,transactions:g}),T=(v={chainId:w,from:h,gas:y,id:e,networkClientId:p,origin:f,transactions:g},{...v,status:m.TransactionStatus.unapproved}),_=new u.DefaultGasFeeFlow,x=await o({networkClientId:p}),E=await _.getGasFees({ethQuery:k,gasFeeControllerData:x,messenger:n,transactionMeta:{...T,txParams:{from:h,gas:y},time:Date.now()}});var v;return T.gasFeeEstimates=E.estimates,b("Saving transaction batch metadata",T),function(e,t){t(t=>{t.transactionBatches=[...t.transactionBatches,e]})}(T,d),T}({batchId:j,request:e}),T=(await async function(e,t){const n=String(e.id),{origin:a}=e,i=s.ApprovalType.TransactionBatch,r={txBatchId:n};return b("Requesting approval for transaction batch",n),await t.call("ApprovalController:addRequest",{id:n,origin:a??s.ORIGIN_METAMASK,requestData:r,expectsResult:!0,type:i},!0)}(C,t)).resultCallbacks);const n=N.getHook(),a=[];let i=0;for(const t of P){const s=await y(j,t,n,e,C,i);a.push(s),i+=1}const{signedTransactions:r}=await N.ready(),o={from:c,networkClientId:d,transactions:a.map((e,t)=>({...e,signedTx:r[t]}))};b("Calling publish batch hook",o);let h=await A(o);if(b("Publish batch hook result",h),!h&&!_&&!v){b("Fallback to sequential publish batch hook due to empty results");const e=x.getHook();h=await e(o)}if(!h?.results?.length)throw new Error("Publish batch hook did not return a result");const f=h.results.map(({transactionHash:e})=>e);return N.success(f),T?.success(),b("Completed batch transaction with hook",f),{batchId:j}}catch(e){throw b("Publish batch hook failed",e),N.error(e),T?.error(e),e}finally{b("Cleaning up publish batch hook",j),function(e,t){e(e=>{e.transactionBatches=e.transactionBatches.filter(e=>e.id!==t)})}(r,j)}}(e)},n.isAtomicBatchSupported=async function(e){const{address:t,chainIds:n,getEthQuery:s,messenger:i,publicKeyEIP7702:r}=e;if(!r)throw a.rpcErrors.internal(o.ERROR_MESSGE_PUBLIC_KEY);const l=(0,c.getEIP7702SupportedChains)(i).filter(e=>!n||n.includes(e)),d=(await Promise.all(l.map(async e=>{try{const n=s(e),{isSupported:a,delegationAddress:l}=await(0,o.isAccountUpgradedToEIP7702)(t,e,r,i,n);return{chainId:e,delegationAddress:l,isSupported:a,upgradeContractAddress:(0,c.getEIP7702UpgradeContractAddress)(e,i,r)}}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/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","./feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","@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,n){Object.defineProperty(n,"__esModule",{value:!0}),n.signAuthorizationList=n.generateEIP7702BatchTransaction=n.isAccountUpgradedToEIP7702=n.getDelegationAddress=n.doesChainSupportEIP7702=n.ERROR_MESSGE_PUBLIC_KEY=n.CALLS_SIGNATURE=n.BATCH_FUNCTION_NAME=n.DELEGATION_PREFIX=void 0;const s=e("@ethersproject/abi"),a=e("@ethersproject/contracts"),i=e("@metamask/controller-utils"),r=e("@metamask/utils"),o=e("./feature-flags.cjs"),c=e("../constants.cjs"),l=e("../logger.cjs");n.DELEGATION_PREFIX="0xef0100",n.BATCH_FUNCTION_NAME="execute",n.CALLS_SIGNATURE="(address,uint256,bytes)[]",n.ERROR_MESSGE_PUBLIC_KEY="EIP-7702 public key not specified";const d=(0,r.createModuleLogger)(l.projectLogger,"eip-7702");async function m(e,t){const s=await(0,i.query)(t,"eth_getCode",[e]),a=(0,r.add0x)(s?.toLowerCase?.()??"");return 48===s?.length&&a.startsWith(n.DELEGATION_PREFIX)?(0,r.add0x)(a.slice(n.DELEGATION_PREFIX.length)):undefined}async function u(e,t,n,s){const a=function(e,t,n){const{chainId:s,nonce:a}=e,{txParams:r,chainId:o}=t,{nonce:c}=r,l=s??o;let m=a;m??(m=(0,i.toHex)(parseInt(c,16)+1+n));const u={...e,chainId:l,nonce:m};return d("Prepared authorization",u),u}(e,t,s),{txParams:o}=t,{from:c}=o,{address:l,chainId:m,nonce:u}=a,h=parseInt(m,16),f=parseInt(u,16),p=await n.call("KeyringController:signEip7702Authorization",{chainId:h,contractAddress:l,from:c,nonce:f}),g=p.slice(0,66),k=(0,r.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,i.toHex)(b-27==0?0:1)};return d("Signed authorization",w),w}n.doesChainSupportEIP7702=function(e,t){return(0,o.getEIP7702SupportedChains)(t).some(t=>t.toLowerCase()===e.toLowerCase())},n.getDelegationAddress=m,n.isAccountUpgradedToEIP7702=async function(e,t,n,s,a){const i=(0,o.getEIP7702ContractAddresses)(t,s,n),r=await m(e,a),c=Boolean(r&&i.some(e=>e.toLowerCase()===r.toLowerCase()));return{delegationAddress:r,isSupported:c}},n.generateEIP7702BatchTransaction=function(e,t){const i=a.Contract.getInterface(c.ABI_IERC7821),r=t.map(e=>{const{data:t,to:n,value:s}=e;return[n??"0x0000000000000000000000000000000000000000",s??"0x0",t??"0x"]}),o="0x01".padEnd(66,"0"),l=s.defaultAbiCoder.encode([n.CALLS_SIGNATURE],[r]),m=i.encodeFunctionData(n.BATCH_FUNCTION_NAME,[o,l]);return d("Transaction data",m),{data:m,to:e}},n.signAuthorizationList=async function({authorizationList:e,messenger:t,transactionMeta:n}){if(!e)return undefined;const s=[];let a=0;for(const i of e){const e=await u(i,n,t,a);s.push(e),a+=1}return s}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/external-transactions.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateConfirmedExternalTransaction=void 0;const s=e("@metamask/rpc-errors"),a=e("../types.cjs");n.validateConfirmedExternalTransaction=function(e,t,n){if(!e?.txParams)throw s.rpcErrors.invalidParams('"transactionMeta" or "transactionMeta.txParams" is missing');if(e.status!==a.TransactionStatus.confirmed)throw s.rpcErrors.invalidParams('External transaction status should be "confirmed"');const i=e.txParams.nonce;if(n&&n.length>0){if(n.find(e=>e.txParams?.nonce===i))throw s.rpcErrors.invalidParams("External transaction nonce should not be in pending txs")}if(t&&t.length>0){if(t.find(e=>e.txParams?.nonce===i))throw s.rpcErrors.invalidParams("External transaction nonce should not be in confirmed txs")}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/external-transactions.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","./signature.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/signature.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isIncomingTransactionsUseBackendWebSocketServiceEnabled=n.getTimeoutAttempts=n.getIncomingTransactionsPollingInterval=n.getGasEstimateBuffer=n.getGasEstimateFallback=n.getGasFeeRandomisation=n.getAcceleratedPollingParams=n.getTransactionHistoryLimit=n.getSubmitHistoryLimit=n.getBatchSizeLimit=n.getEIP7702UpgradeContractAddress=n.getEIP7702ContractAddresses=n.getEIP7702SupportedChains=n.FeatureFlag=void 0;const s=e("@metamask/utils"),a=e("./signature.cjs"),i=e("./utils.cjs"),r=e("../logger.cjs");var o;!function(e){e.EIP7702="confirmations_eip_7702",e.GasBuffer="confirmations_gas_buffer",e.IncomingTransactions="confirmations_incoming_transactions",e.Transactions="confirmations_transactions"}(o||(n.FeatureFlag=o={}));const c=(0,s.createModuleLogger)(r.projectLogger,"feature-flags");function l(e,t,n){const s=d(t);return(s?.[o.EIP7702]?.contracts?.[e.toLowerCase()]??[]).filter(t=>(0,a.isValidSignature)([t.address,(0,i.padHexToEvenLength)(e)],t.signature,n)).map(e=>e.address)}function d(e){const t=e.call("RemoteFeatureFlagController:getState").remoteFeatureFlags;return c("Retrieved feature flags",t),t}n.getEIP7702SupportedChains=function(e){const t=d(e);return t?.[o.EIP7702]?.supportedChains??[]},n.getEIP7702ContractAddresses=l,n.getEIP7702UpgradeContractAddress=function(e,t,n){return l(e,t,n)?.[0]},n.getBatchSizeLimit=function(e){const t=d(e);return t?.[o.Transactions]?.batchSizeLimit??10},n.getSubmitHistoryLimit=function(e){const t=d(e);return t?.[o.Transactions]?.submitHistoryLimit??100},n.getTransactionHistoryLimit=function(e){const t=d(e);return t?.[o.Transactions]?.transactionHistoryLimit??40},n.getAcceleratedPollingParams=function(e,t){const n=d(t),s=n?.[o.Transactions]?.acceleratedPolling,a=s?.perChainConfig?.[e]?.countMax??s?.defaultCountMax??10,i=s?.perChainConfig?.[e]?.intervalMs??s?.defaultIntervalMs??3e3;return{blockTime:s?.perChainConfig?.[e]?.blockTime??12e3,countMax:a,intervalMs:i}},n.getGasFeeRandomisation=function(e){const t=d(e),n=t?.[o.Transactions]?.gasFeeRandomisation??{};return{randomisedGasFeeDigits:n.randomisedGasFeeDigits??{},preservedNumberOfDigits:n.preservedNumberOfDigits}},n.getGasEstimateFallback=function(e,t){const n=d(t),s=n?.[o.Transactions]?.gasEstimateFallback,a=s?.perChainConfig?.[e],i=a?.percentage??s?.default?.percentage??35;return{fixed:a?.fixed??s?.default?.fixed,percentage:i}},n.getGasEstimateBuffer=function({chainId:e,isCustomRPC:t,isUpgradeWithDataToSelf:n,messenger:s}){const a=d(s),i=a?.[o.GasBuffer],r=i?.perChainConfig?.[e],c=t?undefined:r?.included,l=t?undefined:i?.included;return(n?r?.eip7702:undefined)??c??r?.base??l??i?.default??1},n.getIncomingTransactionsPollingInterval=function(e){const t=d(e);return t?.[o.IncomingTransactions]?.pollingIntervalMs??24e4},n.getTimeoutAttempts=function(e,t){const n=d(t),s=n?.[o.Transactions]?.timeoutAttempts;return s?.perChainConfig?.[e]??s?.default},n.isIncomingTransactionsUseBackendWebSocketServiceEnabled=function(e){const t=d(e);return t?.[o.IncomingTransactions]?.useBackendWebSocketService??!1}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/first-time-interaction.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/validation.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.updateFirstTimeInteraction=void 0;const s=e("@metamask/utils"),a=e("./transaction-type.cjs"),i=e("./validation.cjs"),r=e("../api/accounts-api.cjs"),o=e("../logger.cjs"),c=e("../types.cjs"),l=[c.TransactionType.tokenMethodTransfer,c.TransactionType.tokenMethodTransferFrom];function d(e){const{data:t,to:n}=e?.txParams??{};if(t&&l.includes(e?.type)){const e=(0,a.decodeTransactionData)(t);return e?.args?._to??e?.args?.to??n}return n}n.updateFirstTimeInteraction=async function({existingTransactions:e,getTransaction:t,isFirstTimeInteractionEnabled:n,trace:a,traceContext:c,transactionMeta:l,updateTransaction:m}){if(!n())return;const{chainId:u,id:h,txParams:{from:f}}=l,p=d(l),g={chainId:(0,s.hexToNumber)(u),to:p,from:f};(0,i.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,r.getAccountAddressRelationship)(g)),n=e===undefined?undefined:0===e;if(!t(h))return void(0,o.projectLogger)("Cannot update first time interaction as transaction not found",h);m({transactionId:h,note:"TransactionController#updateFirstInteraction - Update first time interaction"},e=>{e.isFirstTimeInteraction=n}),(0,o.projectLogger)("Updated first time interaction",h,{isFirstTimeInteraction:n})}catch(e){(0,o.projectLogger)("Error fetching account address relationship, skipping first time interaction update",e)}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/first-time-interaction.cjs"}]],[],{});