LavaPack.loadBundle([["/home/runner/work/metamask-extension/metamask-extension/node_modules/@ensdomains/content-hash/src/profiles.js",{buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js",cids:"/home/runner/work/metamask-extension/metamask-extension/node_modules/cids/src/index.js","js-base64":"/home/runner/work/metamask-extension/metamask-extension/node_modules/js-base64/base64.js",multihashes:"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ensdomains/content-hash/node_modules/multihashes/src/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(t){(function(){const n=e("cids"),a=e("multihashes"),i=e("js-base64"),r=e=>{let t=e.slice(0,2),s=e.slice(2),n="";return n="0x"===t?s:e,a.fromHexString(n)},o=e=>{try{const{multihash:t}=e;if(t.length<38){const e=a.decode(t);if("identity"===e.name&&e.length<36)return!1}return!0}catch(e){return!1}},c={skynet:e=>i.toUint8Array(e),swarm:e=>{const t=a.encode(r(e),"keccak-256");return new n(1,"swarm-manifest",t).bytes},ipfs:e=>new n(e).toV1().bytes,ipns:e=>{const t=new n(e);if(!o(t))throw Error("ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead");return new n(1,"libp2p-key",t.multihash).bytes},utf8:e=>t.from(e,"utf8"),arweave:e=>i.toUint8Array(e)},l={hexMultiHash:e=>{const t=new n(e);return a.decode(t.multihash).digest.toString("hex")},ipfs:e=>{const t=new n(e).toV1();return t.toString("libp2p-key"===t.codec?"base36":"base32")},ipns:e=>{const t=new n(e).toV1();return o(t)?t.toString("base36"):(console.warn("[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key"),String(a.decode(new n(e).multihash).digest))},utf8:e=>e.toString("utf8"),base64:e=>i.fromUint8Array(e,!0)},d={"skynet-ns":{encode:c.skynet,decode:l.base64},"swarm-ns":{encode:c.swarm,decode:l.hexMultiHash},"ipfs-ns":{encode:c.ipfs,decode:l.ipfs},"ipns-ns":{encode:c.ipns,decode:l.ipns},"arweave-ns":{encode:c.arweave,decode:l.base64},default:{encode:c.utf8,decode:l.utf8}};s.hexStringToBuffer=r,s.profiles=d}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@ensdomains/content-hash",file:"node_modules/@ensdomains/content-hash/src/profiles.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js",{"@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/logger":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"FirebaseError",{enumerable:!0,get:function(){return i.FirebaseError}}),s._DEFAULT_ENTRY_NAME=s.SDK_VERSION=void 0,s._addComponent=U,s._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},s._apps=void 0,s._clearComponents=function(){H.clear()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s._components=void 0,s._getProvider=W,s._isFirebaseApp=$,s._isFirebaseServerApp=function(e){return e.settings!==undefined},s._registerComponent=q,s._removeServiceInstance=function(e,t,s=L){W(e,t).clearInstance(s)},s._serverApps=void 0,s.deleteApp=J,s.getApp=function(e=L){const t=B.get(e);if(!t&&e===L&&(0,i.getDefaultAppConfig)())return z();if(!t)throw K.create("no-app",{appName:e});return t},s.getApps=function(){return Array.from(B.values())},s.initializeApp=z,s.initializeServerApp=function(e,t){if((0,i.isBrowser)()&&!(0,i.isWebWorker)())throw K.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let s;s=$(e)?e.options:e;const a=Object.assign(Object.assign({},t),s);a.releaseOnDeref!==undefined&&delete a.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw K.create("finalization-registry-not-supported",{});const 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 n.ComponentContainer(r);for(const e of H.values())l.addComponent(e);const d=new Q(s,t,r,l);return G.set(r,d),d},s.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw K.create("invalid-log-argument");(0,a.setUserLogHandler)(e,t)},s.registerVersion=X,s.setLogLevel=function(e){(0,a.setLogLevel)(e)}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */;var n=e("@firebase/component"),a=e("@firebase/logger"),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",b="@firebase/auth-compat",k="@firebase/database",w="@firebase/data-connect",_="@firebase/database-compat",T="@firebase/functions",E="@firebase/functions-compat",S="@firebase/installations",I="@firebase/installations-compat",A="@firebase/messaging",y="@firebase/messaging-compat",x="@firebase/performance",v="@firebase/performance-compat",C="@firebase/remote-config",j="@firebase/remote-config-compat",P="@firebase/storage",D="@firebase/storage-compat",N="@firebase/firestore",R="@firebase/vertexai",O="@firebase/firestore-compat",M="firebase",L=s._DEFAULT_ENTRY_NAME="[DEFAULT]",F={[c]:"fire-core",[m]:"fire-core-compat",[h]:"fire-analytics",[u]:"fire-analytics-compat",[p]:"fire-app-check",[f]:"fire-app-check-compat",[g]:"fire-auth",[b]:"fire-auth-compat",[k]:"fire-rtdb",[w]:"fire-data-connect",[_]:"fire-rtdb-compat",[T]:"fire-fn",[E]:"fire-fn-compat",[S]:"fire-iid",[I]:"fire-iid-compat",[A]:"fire-fcm",[y]:"fire-fcm-compat",[x]:"fire-perf",[v]:"fire-perf-compat",[C]:"fire-rc",[j]:"fire-rc-compat",[P]:"fire-gcs",[D]:"fire-gcs-compat",[N]:"fire-fst",[O]:"fire-fst-compat",[R]:"fire-vertex","fire-js":"fire-js",[M]:"fire-js-all"},B=s._apps=new Map,G=s._serverApps=new Map,H=s._components=new Map;function U(e,t){try{e.container.addComponent(t)}catch(s){d.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function q(e){const t=e.name;if(H.has(t))return d.debug(`There were multiple attempts to register component ${t}.`),!1;H.set(t,e);for(const t of B.values())U(t,e);for(const t of G.values())U(t,e);return!0}function W(e,t){const s=e.container.getProvider("heartbeat").getImmediate({optional:!0});return s&&s.triggerHeartbeat(),e.container.getProvider(t)}function $(e){return e.options!==undefined}const V={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},K=new i.ErrorFactory("app","Firebase",V);
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class Y{constructor(e,t,s){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=s,this.container.addComponent(new n.Component("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw K.create("app-deleted",{appName:this._name})}}
/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Q extends Y{constructor(e,t,s,n){const a=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,i={name:s,automaticDataCollectionEnabled:a};if(e.apiKey!==undefined)super(e,i,n);else{super(e.options,i,n)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:a},t),this._finalizationRegistry=null,"undefined"!=typeof FinalizationRegistry&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=undefined,t.releaseOnDeref=undefined,X(c,l,"serverapp")}toJSON(){return undefined}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==undefined&&null!==this._finalizationRegistry&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){J(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw K.create("server-app-deleted")}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.SDK_VERSION="11.2.0";function z(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:L,automaticDataCollectionEnabled:!1},t),r=a.name;if("string"!=typeof r||!r)throw K.create("bad-app-name",{appName:String(r)});if(s||(s=(0,i.getDefaultAppConfig)()),!s)throw K.create("no-options");const o=B.get(r);if(o){if((0,i.deepEqual)(s,o.options)&&(0,i.deepEqual)(a,o.config))return o;throw K.create("duplicate-app",{appName:r})}const c=new n.ComponentContainer(r);for(const e of H.values())c.addComponent(e);const l=new Y(s,a,c);return B.set(r,l),l}async function J(e){let t=!1;const s=e.name;if(B.has(s))t=!0,B.delete(s);else if(G.has(s)){e.decRefCount()<=0&&(G.delete(s),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function X(e,t,s){var a;let i=null!==(a=F[e])&&void 0!==a?a:e;s&&(i+=`-${s}`);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(" "))}q(new n.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 K.create("idb-open",{originalErrorMessage:e.message})})),ee}async function se(e,t){try{const s=(await te()).transaction(Z,"readwrite"),n=s.objectStore(Z);await n.put(t,ne(e)),await s.done}catch(e){if(e instanceof i.FirebaseError)d.warn(e.message);else{const t=K.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}function ne(e){return`${e.name}!${e.options.appId}`}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ae{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new re(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=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===n||this._heartbeatsCache.heartbeats.some(e=>e.date===n))return;return this._heartbeatsCache.heartbeats.push({date:n,agent:s}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}catch(e){d.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=ie(),{heartbeatsToSend:s,unsentEntries:n}=function(e,t=1024){const s=[];let n=e.slice();for(const a of e){const e=s.find(e=>e.agent===a.agent);if(e){if(e.dates.push(a.date),oe(s)>t){e.dates.pop();break}}else if(s.push({agent:a.agent,dates:[a.date]}),oe(s)>t){s.pop();break}n=n.slice(1)}return{heartbeatsToSend:s,unsentEntries:n}}(this._heartbeatsCache.heartbeats),a=(0,i.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:s}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(e){return d.warn(e),""}}}function 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),s=await t.objectStore(Z).get(ne(e));return await t.done,s}catch(e){if(e instanceof i.FirebaseError)d.warn(e.message);else{const t=K.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}}}function 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="",q(new n.Component("platform-logger",e=>new o(e),"PRIVATE")),q(new n.Component("heartbeat",e=>new ae(e),"PRIVATE")),X(c,l,ce),X(c,l,"esm2017"),X("fire-js","")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app",file:"node_modules/@firebase/app/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js",{"@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.Provider=s.ComponentContainer=s.Component=void 0;var n=e("@firebase/util");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
s.Component=class{constructor(e,t,s){this.name=e,this.instanceFactory=t,this.type=s,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};const a="[DEFAULT]";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class 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 n.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&e.resolve(s)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const s=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(s)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:s})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e))try{this.getOrInitializeService({instanceIdentifier:a})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:s});t.resolve(e)}catch(e){}}}}clearInstance(e=a){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=a){return this.instances.has(e)}getOptions(e=a){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,s=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(s))throw Error(`${this.name}(${s}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:s,options:t});for(const[e,t]of this.instancesDeferred.entries()){s===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var s;const n=this.normalizeInstanceIdentifier(t),a=null!==(s=this.onInitCallbacks.get(n))&&void 0!==s?s:new Set;a.add(e),this.onInitCallbacks.set(n,a);const i=this.instances.get(n);return i&&e(i,n),()=>{a.delete(e)}}invokeOnInitCallbacks(e,t){const s=this.onInitCallbacks.get(t);if(s)for(const n of s)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let s=this.instances.get(e);if(!s&&this.component&&(s=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===a?undefined:n),options:t}),this.instances.set(e,s),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(s,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,s)}catch(e){}var n;return s||null}normalizeInstanceIdentifier(e=a){return this.component?this.component.multipleInstances?e:a:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}s.Provider=i;s.ComponentContainer=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new 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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.deleteInstallations=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function(e){const{appConfig:t}=e,s=await H(t,e=>e&&0===e.registrationStatus?undefined:e);if(s){if(1===s.registrationStatus)throw p.create("delete-pending-registration");if(2===s.registrationStatus){if(!navigator.onLine)throw p.create("app-offline");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
await async function(e,t){const s=function(e,{fid:t}){return`${b(e)}/${t}`}(e,t),n=T(e,t),a={method:"DELETE",headers:n},i=await E(()=>fetch(s,a));if(!i.ok)throw await w("Delete Installation",i)}(t,s),await G(t)}}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.getId=z,s.getInstallations=
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,n.getApp)()){return(0,n._getProvider)(e,"installations").getImmediate()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.getToken=J,s.onIdChange=function(e,t){const{appConfig:s}=e;return function(e,t){D();const s=x(e);let n=v.get(s);n||(n=new Set,v.set(s,n));n.add(t)}(s,t),()=>{!function(e,t){const s=x(e),n=v.get(s);if(!n)return;n.delete(t),0===n.size&&v.delete(s);N()}(s,t)}};var n=e("@firebase/app"),a=e("@firebase/component"),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 b({projectId:e}){return`${u}/projects/${e}/installations`}function k(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function w(e,t){const s=(await t.json()).error;return p.create("request-failed",{requestName:e,serverCode:s.code,serverMessage:s.message,serverStatus:s.status})}function _({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function T(e,{refreshToken:t}){const s=_(e);return s.append("Authorization",function(e){return`${m} ${e}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t)),s}async function E(e){const t=await e();return t.status>=500&&t.status<600?e():t}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function S(e){return new Promise(t=>{setTimeout(t,e)})}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const I=/^[cdef][\w-]{21}$/,A="";function y(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(s=e,btoa(String.fromCharCode(...s)).replace(/\+/g,"-").replace(/\//g,"_"));var s;return t.substr(0,22)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e);return I.test(t)?t:A}catch(e){return A}}function x(e){return`${e.appName}!${e.appId}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const v=new Map;function C(e,t){const s=x(e);j(s,t),function(e,t){const s=D();s&&s.postMessage({key:e,fid:t});N()}(s,t)}function j(e,t){const s=v.get(e);if(s)for(const e of s)e(t)}let P=null;function D(){return!P&&"BroadcastChannel"in self&&(P=new BroadcastChannel("[Firebase] FID Change"),P.onmessage=e=>{j(e.data.key,e.data.fid)}),P}function N(){0===v.size&&P&&(P.close(),P=null)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R="firebase-installations-database",O=1,M="firebase-installations-store";let L=null;function F(){return L||(L=(0,r.openDB)(R,O,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(M)}})),L}async function B(e,t){const s=x(e),n=(await F()).transaction(M,"readwrite"),a=n.objectStore(M),i=await a.get(s);return await a.put(t,s),await n.done,i&&i.fid===t.fid||C(e,t.fid),t}async function G(e){const t=x(e),s=(await F()).transaction(M,"readwrite");await s.objectStore(M).delete(t),await s.done}async function H(e,t){const s=x(e),n=(await F()).transaction(M,"readwrite"),a=n.objectStore(M),i=await a.get(s),r=t(i);return r===undefined?await a.delete(s):await a.put(r,s),await n.done,!r||i&&i.fid===r.fid||C(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 s=await H(e.appConfig,s=>{const n=function(e){const t=e||{fid:y(),registrationStatus:0};return $(t)}(s),a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(p.create("app-offline"))}}const s={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(e,t){try{const s=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:s}){const n=b(e),a=_(e),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const r={fid:s,authVersion:m,appId:e.appId,sdkVersion:d},o={method:"POST",headers:a,body:JSON.stringify(r)},c=await E(()=>fetch(n,o));if(c.ok){const e=await c.json();return{fid:e.fid||s,registrationStatus:2,refreshToken:e.refreshToken,authToken:k(e.authToken)}}throw await w("Create Installation",c)}(e,t);return B(e.appConfig,s)}catch(s){throw g(s)&&409===s.customData.serverCode?await G(e.appConfig):await B(e.appConfig,{fid:t.fid,registrationStatus:0}),s}}(e,s);return{installationEntry:s,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:q(e)}:{installationEntry:t}}(e,n);return t=a.registrationPromise,a.installationEntry});return s.fid===A?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function q(e){let t=await W(e.appConfig);for(;1===t.registrationStatus;)await S(100),t=await W(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:s}=await U(e);return s||t}return t}function W(e){return H(e,e=>{if(!e)throw p.create("installation-not-found");return $(e)})}function $(e){return 1===(t=e).registrationStatus&&t.registrationTime+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 V({appConfig:e,heartbeatServiceProvider:t},s){const n=function(e,{fid:t}){return`${b(e)}/${t}/authTokens:generate`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e,s),a=T(e,s),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 E(()=>fetch(n,o));if(c.ok){return k(await c.json())}throw await w("Generate Auth Token",c)}async function K(e,t=!1){let s;const n=await H(e.appConfig,n=>{if(!Q(n))throw p.create("not-registered");const a=n.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+h}(e)}(a))return n;if(1===a.requestStatus)return s=async function(e,t){let s=await Y(e.appConfig);for(;1===s.authToken.requestStatus;)await S(100),s=await Y(e.appConfig);const n=s.authToken;return 0===n.requestStatus?K(e,t):n}(e,t),n;{if(!navigator.onLine)throw p.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(n);return s=async function(e,t){try{const s=await V(e,t),n=Object.assign(Object.assign({},t),{authToken:s});return await B(e.appConfig,n),s}catch(s){if(!g(s)||401!==s.customData.serverCode&&404!==s.customData.serverCode){const s=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await B(e.appConfig,s)}else await G(e.appConfig);throw s}}(e,t),t}});return s?await s:n.authToken}function Y(e){return H(e,e=>{if(!Q(e))throw p.create("not-registered");const t=e.authToken;return 1===(s=t).requestStatus&&s.requestTime+l<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var s;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */})}function Q(e){return e!==undefined&&2===e.registrationStatus}async function z(e){const t=e,{installationEntry:s,registrationPromise:n}=await U(t);return n?n.catch(console.error):K(t).catch(console.error),s.fid}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function J(e,t=!1){const s=e;await async function(e){const{registrationPromise:t}=await U(e);t&&await t}(s);return(await K(s,t)).token}function X(e){return p.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Z="installations",ee=e=>{const t=e.getProvider("app").getImmediate(),s=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const s of t)if(!e.options[s])throw X(s);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:s,heartbeatServiceProvider:(0,n._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),s=(0,n._getProvider)(t,Z).getImmediate();return{getId:()=>z(s),getToken:e=>J(s,e)}};(0,n._registerComponent)(new a.Component(Z,ee,"PUBLIC")),(0,n._registerComponent)(new a.Component("installations-internal",te,"PRIVATE")),(0,n.registerVersion)(o,c),(0,n.registerVersion)(o,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0});
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const n=[];var a;s.LogLevel=void 0,(a=s.LogLevel||(s.LogLevel={}))[a.DEBUG=0]="DEBUG",a[a.VERBOSE=1]="VERBOSE",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.SILENT=5]="SILENT";const i={debug:s.LogLevel.DEBUG,verbose:s.LogLevel.VERBOSE,info:s.LogLevel.INFO,warn:s.LogLevel.WARN,error:s.LogLevel.ERROR,silent:s.LogLevel.SILENT},r=s.LogLevel.INFO,o={[s.LogLevel.DEBUG]:"log",[s.LogLevel.VERBOSE]:"log",[s.LogLevel.INFO]:"info",[s.LogLevel.WARN]:"warn",[s.LogLevel.ERROR]:"error"},c=(e,t,...s)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),a=o[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${n}]  ${e.name}:`,...s)};s.Logger=class{constructor(e){this.name=e,this._logLevel=r,this._logHandler=c,this._userLogHandler=null,n.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in s.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?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,s.LogLevel.DEBUG,...e),this._logHandler(this,s.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.VERBOSE,...e),this._logHandler(this,s.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.INFO,...e),this._logHandler(this,s.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.WARN,...e),this._logHandler(this,s.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.ERROR,...e),this._logHandler(this,s.LogLevel.ERROR,...e)}},s.setLogLevel=function(e){n.forEach(t=>{t.setLogLevel(e)})},s.setUserLogHandler=function(e,t){for(const a of n){let n=null;t&&t.level&&(n=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!=n?n:t.logLevel)&&e({level:s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.deleteToken=function(e){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return async function(e){if(!navigator)throw C.create("only-available-in-window");e.swRegistration||await G(e);return async function(e){const t=await A(e.firebaseDependencies);t&&(await j(e.firebaseDependencies,t.token),await async function(e){const t=x(e),s=(await I()).transaction(E,"readwrite");await s.objectStore(E).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();if(s)return s.unsubscribe();return!0}(e)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=(0,i.getModularInstance)(e))},s.getMessaging=
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,r.getApp)()){return Y().then(e=>{if(!e)throw C.create("unsupported-browser")},e=>{throw C.create("indexed-db-unsupported")}),(0,r._getProvider)((0,i.getModularInstance)(e),"messaging").getImmediate()},s.getToken=async function(e,t){return H(e=(0,i.getModularInstance)(e),t)},s.isSupported=Y,s.onMessage=function(e,t){return function(e,t){if(!navigator)throw C.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,i.getModularInstance)(e),t)},e("@firebase/installations");var n=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,"/"),s=atob(t),n=new Uint8Array(s.length);for(let e=0;e<s.length;++e)n[e]=s.charCodeAt(e);return n}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(h||(h={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(f||(f={}));const b="fcm_token_details_db",k=5,w="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const _="firebase-messaging-database",T=1,E="firebase-messaging-store";let S=null;function I(){return S||(S=(0,a.openDB)(_,T,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(E)}})),S}async function A(e){const t=x(e),s=await I(),n=await s.transaction(E).objectStore(E).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(b))return null}let t=null;return(await(0,a.openDB)(b,k,{upgrade:async(s,n,a,i)=>{var r;if(n<2)return;if(!s.objectStoreNames.contains(w))return;const o=i.objectStore(w),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(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===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:p(e.auth),p256dh:p(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:p(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:p(e.auth),p256dh:p(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:p(e.vapidKey)}}}}})).close(),await(0,a.deleteDB)(b),await(0,a.deleteDB)("fcm_vapid_details_db"),await(0,a.deleteDB)("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await y(e,t),t}}async function y(e,t){const s=x(e),n=(await I()).transaction(E,"readwrite");return await n.objectStore(E).put(t,s),await n.done,t}function x({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const v={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},C=new i.ErrorFactory("messaging","Messaging",v);async function j(e,t){const s={method:"DELETE",headers:await D(e)};try{const n=await fetch(`${P(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw C.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw C.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function P({projectId:e}){return`${d}/projects/${e}/registrations`}async function D({appConfig:e,installations:t}){const s=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${s}`})}function N({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==l&&(a.web.applicationPubKey=n),a}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R=6048e5;async function O(e){const t=await async function(e,t){const s=await e.pushManager.getSubscription();if(s)return s;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:g(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:p(t.getKey("auth")),p256dh:p(t.getKey("p256dh"))},n=await A(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,i=t.p256dh===e.p256dh;return s&&n&&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.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+R?async function(e,t){try{const s=await async function(e,t){const s=await D(e),n=N(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let i;try{const s=await fetch(`${P(e.appConfig)}/${t.token}`,a);i=await s.json()}catch(e){throw C.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw C.create("token-update-failed",{errorInfo:e})}if(!i.token)throw C.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await y(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await j(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return M(e.firebaseDependencies,s)}return M(e.firebaseDependencies,s)}async function M(e,t){const s=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const s=await D(e),n=N(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let i;try{const t=await fetch(P(e.appConfig),a);i=await t.json()}catch(e){throw C.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw C.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw C.create("token-subscribe-no-token");return i.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await y(e,n),n.token}function L(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const s=t.notification.title;s&&(e.notification.title=s);const n=t.notification.body;n&&(e.notification.body=n);const a=t.notification.image;a&&(e.notification.image=a);const 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 s,n,a,i,r;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const o=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(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 F(e){return C.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
!function(e,t){const s=[];for(let n=0;n<e.length;n++)s.push(e.charAt(n)),n<t.length&&s.push(t.charAt(n));s.join("")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class B{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw F("App Configuration Object");if(!e.name)throw F("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw F(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:s}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function G(e){try{e.swRegistration=await navigator.serviceWorker.register(o,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,s)=>{const n=setTimeout(()=>s(new Error(`Service worker not registered after ${u} ms`)),u),a=e.installing||e.waiting;e.active?(clearTimeout(n),t()):a?a.onstatechange=e=>{var s;"activated"===(null===(s=e.target)||void 0===s?void 0:s.state)&&(a.onstatechange=null,clearTimeout(n),t())}:(clearTimeout(n),s(new Error("No incoming service worker found.")))})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e.swRegistration)}catch(e){throw C.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function H(e,t){if(!navigator)throw C.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw C.create("permission-blocked");
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=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 C.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),O(e)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e,t,s){const n=function(e){switch(e){case f.NOTIFICATION_CLICKED:return"notification_open";case f.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(n,{message_id:s[m],message_name:s["google.c.a.c_l"],message_time:s["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function q(e,t){const s=t.data;if(!s.isFirebaseMessaging)return;e.onMessageHandler&&s.messageType===f.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(L(s)):e.onMessageHandler.next(L(s)));const n=s.data;var a;"object"==typeof(a=n)&&a&&m in a&&"1"===n["google.c.a.e"]&&await U(e,s.messageType,n)}const W="@firebase/messaging",$="0.12.16",V=e=>{const t=new B(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>q(t,e)),t},K=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>H(t,e)}};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function Y(){try{await(0,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 n.Component("messaging",V,"PUBLIC")),(0,r._registerComponent)(new n.Component("messaging-internal",K,"PRIVATE")),(0,r.registerVersion)(W,$),(0,r.registerVersion)(W,$,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/index.sw.cjs",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),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,"/"),s=atob(t),n=new Uint8Array(s.length);for(let e=0;e<s.length;++e)n[e]=s.charCodeAt(e);return n}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(l||(l={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(d||(d={}));const h="fcm_token_details_db",f="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const p="firebase-messaging-store";let g=null;function b(){return g||(g=a.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(p)}})),g}async function k(e){const t=_(e),s=await b(),n=await s.transaction(p).objectStore(p).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(h))return null}let t=null;return(await a.openDB(h,5,{upgrade:async(s,n,a,i)=>{var r;if(n<2)return;if(!s.objectStoreNames.contains(f))return;const o=i.objectStore(f),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(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===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}}})).close(),await a.deleteDB(h),await a.deleteDB("fcm_vapid_details_db"),await a.deleteDB("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await w(e,t),t}}async function w(e,t){const s=_(e),n=(await b()).transaction(p,"readwrite");return await n.objectStore(p).put(t,s),await n.done,t}function _({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const T={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},E=new i.ErrorFactory("messaging","Messaging",T);async function S(e,t){const s={method:"DELETE",headers:await A(e)};try{const n=await fetch(`${I(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw E.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw E.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function I({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function A({appConfig:e,installations:t}){const s=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${s}`})}function y({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==o&&(a.web.applicationPubKey=n),a}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function x(e){const t=await async function(e,t){const s=await e.pushManager.getSubscription();if(s)return s;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:u(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:m(t.getKey("auth")),p256dh:m(t.getKey("p256dh"))},n=await k(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,i=t.p256dh===e.p256dh;return s&&n&&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.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+6048e5?async function(e,t){try{const s=await async function(e,t){const s=await A(e),n=y(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let i;try{const s=await fetch(`${I(e.appConfig)}/${t.token}`,a);i=await s.json()}catch(e){throw E.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw E.create("token-update-failed",{errorInfo:e})}if(!i.token)throw E.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await w(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await S(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return C(e.firebaseDependencies,s)}return C(e.firebaseDependencies,s)}async function v(e){const t=await k(e.firebaseDependencies);t&&(await S(e.firebaseDependencies,t.token),await async function(e){const t=_(e),s=(await b()).transaction(p,"readwrite");await s.objectStore(p).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();return!s||s.unsubscribe()}async function C(e,t){const s=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const s=await A(e),n=y(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let i;try{const t=await fetch(I(e.appConfig),a);i=await t.json()}catch(e){throw E.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw E.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw E.create("token-subscribe-no-token");return i.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await w(e,n),n.token}async function j(e,t){const s=function(e,t){var s,n;const a={};e.from&&(a.project_number=e.from);e.fcmMessageId&&(a.message_id=e.fcmMessageId);a.instance_id=t,e.notification?a.message_type=l.DISPLAY_NOTIFICATION.toString():a.message_type=l.DATA_MESSAGE.toString();a.sdk_platform=3..toString(),a.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(a.collapse_key=e.collapse_key);a.event=1..toString(),!(null===(s=e.fcmOptions)||void 0===s?void 0:s.analytics_label)||(a.analytics_label=null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label);return a}(t,await e.firebaseDependencies.installations.getId());!function(e,t,s){const n={};n.event_time_ms=Math.floor(Date.now()).toString(),n.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!s||(n.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(s));e.logEvents.push(n)}(e,s,t.productId)}async function P(e,t){const s=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!s)return;t.deliveryMetricsExportedToBigQueryEnabled&&await j(t,s);const n=await N();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(n))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=d.PUSH_RECEIVED;for(const s of e)s.postMessage(t)}(n,s);if(s.notification&&await function(e){var t;const{actions:s}=e,{maxActions:n}=Notification;s&&n&&s.length>n&&console.warn(`This browser only supports ${n} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={[c]:e},t}(s)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const s=t.notification.title;s&&(e.notification.title=s);const n=t.notification.body;n&&(e.notification.body=n);const a=t.notification.image;a&&(e.notification.image=a);const 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 s,n,a,i,r;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const o=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(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}(s);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function D(e){var t,s;const n=null===(s=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===s?void 0:s[c];if(!n)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const a=function(e){var t,s,n;const a=null!==(s=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==s?s:null===(n=e.notification)||void 0===n?void 0:n.click_action;if(a)return a;return 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.
 */(n);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 s of t){const t=new URL(s.url,self.location.href);if(e.host===t.host)return s}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?(n.messageType=d.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,o.postMessage(n)):void 0}function N(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function R(e){return E.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e,t){const s=[];for(let n=0;n<e.length;n++)s.push(e.charAt(n)),n<t.length&&s.push(t.charAt(n));s.join("")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class O{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw R("App Configuration Object");if(!e.name)throw R("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw R(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:s}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const M=e=>{const t=new O(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(P(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var s,n;const{newSubscription:a}=e;if(!a)return void await v(t);const i=await k(t.firebaseDependencies);await v(t),t.vapidKey=null!==(n=null===(s=null==i?void 0:i.subscriptionOptions)||void 0===s?void 0:s.vapidKey)&&void 0!==n?n:o,await x(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(D(e))}),t};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function L(){return 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 n.Component("messaging-sw",M,"PUBLIC")),s.experimentalSetDeliveryMetricsExportedToBigQueryEnabled=function(e,t){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=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.
 */,s.getMessaging=function(e=r.getApp()){return L().then(e=>{if(!e)throw E.create("unsupported-browser")},e=>{throw E.create("indexed-db-unsupported")}),r._getProvider(i.getModularInstance(e),"messaging-sw").getImmediate()},s.isSupported=L,s.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw E.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=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,s){(function(e){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.Sha1=s.RANDOM_FACTOR=s.MAX_VALUE_MILLIS=s.FirebaseError=s.ErrorFactory=s.Deferred=s.DecodeBase64StringError=s.CONSTANTS=void 0,s.areCookiesEnabled=function(){if("undefined"==typeof navigator||!navigator.cookieEnabled)return!1;return!0}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.assertionError=s.assert=void 0,s.async=function(e,t){return(...s)=>{Promise.resolve(!0).then(()=>{e(...s)}).catch(e=>{t&&t(e)})}},s.base64urlEncodeWithoutPadding=s.base64Encode=s.base64Decode=s.base64=void 0,s.calculateBackoffMillis=function(e,t=C,s=j){const n=t*Math.pow(s,e),a=Math.round(D*n*(Math.random()-.5)*2);return Math.min(P,n+a)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.createMockUserToken=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const s=t||"demo-project",n=e.iat||0,a=e.sub||e.user_id;if(!a)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${s}`,aud:s,iat:n,exp:n+3600,auth_time:n,sub:a,user_id:a,firebase:{sign_in_provider:"custom",identities:{}}},e);return[l(JSON.stringify({alg:"none",type:"JWT"})),l(JSON.stringify(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.
 */,s.createSubscribe=function(e,t){const s=new y(e,t);return s.subscribe.bind(s)},s.decode=void 0,s.deepCopy=function(e){return m(undefined,e)},s.deepEqual=function e(t,s){if(t===s)return!0;const n=Object.keys(t),a=Object.keys(s);for(const i of n){if(!a.includes(i))return!1;const n=t[i],r=s[i];if(A(n)&&A(r)){if(!e(n,r))return!1}else if(n!==r)return!1}for(const e of a)if(!n.includes(e))return!1;return!0},s.deepExtend=m,s.errorPrefix=v,s.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const s=e.indexOf("#",t);return e.substring(t,s>0?s:undefined)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.getExperimentalSetting=s.getDefaults=s.getDefaultEmulatorHostnameAndPort=s.getDefaultEmulatorHost=s.getDefaultAppConfig=void 0,s.getGlobal=h,s.getModularInstance=
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e){return e&&e._delegate?e._delegate:e},s.getUA=b,s.isAdmin=void 0,s.isBrowser=function(){return"undefined"!=typeof window||w()},s.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},s.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},s.isElectron=function(){return b().indexOf("Electron/")>=0},s.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},s.isIE=function(){const e=b();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},s.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},s.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(b())},s.isNode=k,s.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},s.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},s.isSafari=function(){return!k()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},s.isUWP=function(){return b().indexOf("MSAppHost/")>=0},s.isValidTimestamp=s.isValidFormat=void 0,s.isWebWorker=w,s.issuedAtTime=void 0,s.jsonEval=S,s.map=function(e,t,s){const n={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=t.call(s,e[a],a,e));return n},s.ordinal=function(e){if(!Number.isFinite(e))return`${e}`;return e+function(e){e=Math.abs(e);const t=e%100;if(t>=10&&t<=20)return"th";const s=e%10;if(1===s)return"st";if(2===s)return"nd";if(3===s)return"rd";return"th"}(e)},s.promiseWithTimeout=
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e,t=2e3){const s=new g;return setTimeout(()=>s.reject("timeout!"),t),e.then(s.resolve,s.reject),s.promise}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.querystring=function(e){const t=[];for(const[s,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(s)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(s)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""},s.querystringDecode=function(e){const t={},s=e.replace(/^\?/,"").split("&");return s.forEach(e=>{if(e){const[s,n]=e.split("=");t[decodeURIComponent(s)]=decodeURIComponent(n)}}),t},s.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},s.stringToByteArray=s.stringLength=void 0,s.stringify=function(e){return JSON.stringify(e)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.validateArgCount=void 0,s.validateCallback=function(e,t,s,n){if(n&&!s)return;if("function"!=typeof s)throw new Error(v(e,t)+"must be a valid function.")},s.validateContextObject=function(e,t,s,n){if(n&&!s)return;if("object"!=typeof s||null===s)throw new Error(v(e,t)+"must be a valid context object.")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let s=!0;const n="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(n);a.onsuccess=()=>{a.result.close(),s||self.indexedDB.deleteDatabase(n),e(!0)},a.onupgradeneeded=()=>{s=!1},a.onerror=()=>{var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},s.validateNamespace=function(e,t,s){if(s&&!t)return;if("string"!=typeof t)throw new Error(v(e,"namespace")+"must be a valid firebase namespace.")};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const t=s.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},n=function(e,t){if(!e)throw a(t)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.assert=n;const a=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.assertionError=a;const i=function(e){const t=[];let s=0;for(let n=0;n<e.length;n++){let a=e.charCodeAt(n);a<128?t[s++]=a:a<2048?(t[s++]=a>>6|192,t[s++]=63&a|128):55296==(64512&a)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),t[s++]=a>>18|240,t[s++]=a>>12&63|128,t[s++]=a>>6&63|128,t[s++]=63&a|128):(t[s++]=a>>12|224,t[s++]=a>>6&63|128,t[s++]=63&a|128)}return t},r=s.base64={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const s=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const a=e[t],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)),n.push(s[l],s[d],s[m],s[u])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let s=0,n=0;for(;s<e.length;){const a=e[s++];if(a<128)t[n++]=String.fromCharCode(a);else if(a>191&&a<224){const i=e[s++];t[n++]=String.fromCharCode((31&a)<<6|63&i)}else if(a>239&&a<365){const i=((7&a)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536;t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}else{const i=e[s++],r=e[s++];t[n++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&r)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const s=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const a=s[e.charAt(t++)],i=t<e.length?s[e.charAt(t)]:0;++t;const r=t<e.length?s[e.charAt(t)]:64;++t;const c=t<e.length?s[e.charAt(t)]:64;if(++t,null==a||null==i||null==r||null==c)throw new o;const l=a<<2|i>>4;if(n.push(l),64!==r){const e=i<<4&240|r>>2;if(n.push(e),64!==c){const e=r<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class o extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}s.DecodeBase64StringError=o;const c=function(e){const t=i(e);return r.encodeByteArray(t,!0)};s.base64Encode=c;const l=function(e){return c(e).replace(/\./g,"")};s.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 s in t)t.hasOwnProperty(s)&&u(s)&&(e[s]=m(e[s],t[s]));return e}function u(e){return"__proto__"!==e}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function h(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.base64Decode=d;const f=()=>{try{return h().__FIREBASE_DEFAULTS__||(()=>{if(void 0===e||void 0===e.env)return})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&d(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};s.getDefaults=f;const p=e=>{var t,s;return null===(s=null===(t=f())||void 0===t?void 0:t.emulatorHosts)||void 0===s?void 0:s[e]};s.getDefaultEmulatorHost=p;s.getDefaultEmulatorHostnameAndPort=e=>{const t=p(e);if(!t)return undefined;const s=t.lastIndexOf(":");if(s<=0||s+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(s+1),10);return"["===t[0]?[t.substring(1,s-1),n]:[t.substring(0,s),n]};s.getDefaultAppConfig=()=>{var e;return null===(e=f())||void 0===e?void 0:e.config};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
s.getExperimentalSetting=e=>{var t;return null===(t=f())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,s)=>{t?this.reject(t):this.resolve(s),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,s))}}}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function b(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function k(){var e;const t=null===(e=f())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function w(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}s.Deferred=g;class _ extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,_.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,T.prototype.create)}}s.FirebaseError=_;class T{constructor(e,t,s){this.service=e,this.serviceName=t,this.errors=s}create(e,...t){const s=t[0]||{},n=`${this.service}/${e}`,a=this.errors[e],i=a?function(e,t){return e.replace(E,(e,s)=>{const n=t[s];return null!=n?String(n):`<${s}?>`})}(a,s):"Error",r=`${this.serviceName}: ${i} (${n}).`;return new _(n,r,s)}}s.ErrorFactory=T;const E=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function S(e){return JSON.parse(e)}const I=function(e){let t={},s={},n={},a="";try{const i=e.split(".");t=S(d(i[0])||""),s=S(d(i[1])||""),a=i[2],n=s.d||{},delete s.d}catch(e){}return{header:t,claims:s,data:n,signature:a}};s.decode=I;s.isValidTimestamp=function(e){const t=I(e).claims,s=Math.floor((new Date).getTime()/1e3);let n=0,a=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?n=t.nbf:t.hasOwnProperty("iat")&&(n=t.iat),a=t.hasOwnProperty("exp")?t.exp:n+86400),!!s&&!!n&&!!a&&s>=n&&s<=a};s.issuedAtTime=function(e){const t=I(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};s.isValidFormat=function(e){const t=I(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function A(e){return null!==e&&"object"==typeof e}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
s.isAdmin=function(e){const t=I(e).claims;return"object"==typeof t&&!0===t.admin};s.Sha1=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const s=this.W_;if("string"==typeof e)for(let n=0;n<16;n++)s[n]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let n=0;n<16;n++)s[n]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=s[e-3]^s[e-8]^s[e-14]^s[e-16];s[e]=4294967295&(t<<1|t>>>31)}let n,a,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?(n=c^r&(o^c),a=1518500249):(n=r^o^c,a=1859775393):e<60?(n=r&o|c&(r|o),a=2400959708):(n=r^o^c,a=3395469782);const t=(i<<5|i>>>27)+n+l+a+s[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 s=t-this.blockSize;let n=0;const a=this.buf_;let i=this.inbuf_;for(;n<t;){if(0===i)for(;n<=s;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(a[i]=e.charCodeAt(n),++i,++n,i===this.blockSize){this.compress_(a),i=0;break}}else for(;n<t;)if(a[i]=e[n],++i,++n,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 s=0;for(let t=0;t<5;t++)for(let n=24;n>=0;n-=8)e[s]=this.chain_[t]>>n&255,++s;return e}};class y{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,s){let n;if(e===undefined&&t===undefined&&s===undefined)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const s of t)if(s in e&&"function"==typeof e[s])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:s},n.next===undefined&&(n.next=x),n.error===undefined&&(n.error=x),n.complete===undefined&&(n.complete=x);const a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),a}unsubscribeOne(e){this.observers!==undefined&&this.observers[e]!==undefined&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&this.onNoObservers!==undefined&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==undefined&&this.observers[e]!==undefined)try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,e!==undefined&&(this.finalError=e),this.task.then(()=>{this.observers=undefined,this.onNoObservers=undefined}))}}function x(){}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function v(e,t){return`${e} failed: ${t} argument `}s.validateArgCount=function(e,t,s,n){let a;if(n<t?a="at least "+t:n>s&&(a=0===s?"none":"no more than "+s),a){throw new Error(e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+a+".")}};s.stringToByteArray=function(e){const t=[];let s=0;for(let a=0;a<e.length;a++){let i=e.charCodeAt(a);if(i>=55296&&i<=56319){const t=i-55296;a++,n(a<e.length,"Surrogate pair missing trail surrogate.");i=65536+(t<<10)+(e.charCodeAt(a)-56320)}i<128?t[s++]=i:i<2048?(t[s++]=i>>6|192,t[s++]=63&i|128):i<65536?(t[s++]=i>>12|224,t[s++]=i>>6&63|128,t[s++]=63&i|128):(t[s++]=i>>18|240,t[s++]=i>>12&63|128,t[s++]=i>>6&63|128,t[s++]=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.
 */
s.stringLength=function(e){let t=0;for(let s=0;s<e.length;s++){const n=e.charCodeAt(s);n<128?t++:n<2048?t+=2:n>=55296&&n<=56319?(t+=4,s++):t+=3}return t};const C=1e3,j=2,P=s.MAX_VALUE_MILLIS=144e5,D=s.RANDOM_FACTOR=.5}).call(this)}).call(this,e("_process"))}}},{package:"@metamask/notification-services-controller>firebase>@firebase/util",file:"node_modules/@firebase/util/dist/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0});class n{static parse(e){if(""===e)return new n([]);if(!e.startsWith("/"))throw new a(e);const[,...t]=e.split("/");return new n(t.map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~")))}constructor(e){this.tokens=e}toString(){if(0===this.tokens.length)return"";return`/${this.tokens.map(e=>e.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`}shmeval(e){for(const t of this.tokens){if(!e.hasOwnProperty(t))throw new i(e,t);e=e[t]}return e}}s.default=n;class a extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}s.InvalidPtrError=a;class i extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}s.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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function o(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(r,o)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var s,n,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(s)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=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],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.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")};s.NonStringRefError=d;var m=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var s=n(n({},t),e);return delete s.$ref,s}return t},u=function(){function e(e,t){var s;if(void 0===t&&(t={}),this.options=t,this.refCache={},s=!0===this.options.mutate||!0===e||!1===e?e:n({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=s),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=s),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var a=0,i=Object.keys(this.options.protocolHandlerMap);a<i.length;a++){var r=i[a];c.default.protocolHandlerMap[r]=this.options.protocolHandlerMap[r]}this.schema=s,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,s,a,r,l,d,u,h,f,p,g,b=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 b.refCache[e]===undefined}),s=[],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),s.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=n(n({},this.options),{refCache:this.refCache}),0===(f=new e(d,h)).refs.length?[3,7]:(p=f._resolve(),s.push(p),[4,p]));case 6:return g=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=b.refCache[e.$ref];return m(e,t)}return e},{mutable:!0}),[4,Promise.all(s)];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}();s.default=u}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/index.js",{"./dereferencer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var a=n(e("./dereferencer")),i=e("./dereferencer");Object.defineProperty(s,"NonStringRefError",{enumerable:!0,get:function(){return i.NonStringRefError}}),s.default=a.default}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/meta-schema/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.jsonSchema=void 0,s.jsonSchema={$schema:"https://meta.json-schema.tools/",$id:"https://meta.json-schema.tools/",title:"JSONSchema",default:{},oneOf:[{$ref:"#/definitions/JSONSchemaObject"},{$ref:"#/definitions/JSONSchemaBoolean"}],definitions:{JSONSchemaBoolean:{title:"JSONSchemaBoolean",description:"Always valid if true. Never valid if false. Is constant.",type:"boolean"},JSONSchemaObject:{title:"JSONSchemaObject",type:"object",properties:{$id:{title:"$id",type:"string",format:"uri-reference"},$schema:{title:"$schema",type:"string",format:"uri"},$ref:{title:"$ref",type:"string",format:"uri-reference"},$comment:{title:"$comment",type:"string"},title:{title:"title",type:"string"},description:{title:"description",type:"string"},default:!0,readOnly:{title:"readOnly",type:"boolean",default:!1},examples:{title:"examples",type:"array",items:!0},multipleOf:{title:"multipleOf",type:"number",exclusiveMinimum:0},maximum:{title:"maximum",type:"number"},exclusiveMaximum:{title:"exclusiveMaximum",type:"number"},minimum:{title:"minimum",type:"number"},exclusiveMinimum:{title:"exclusiveMinimum",type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{title:"pattern",type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{title:"items",anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{title:"uniqueItems",type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{title:"definitions",type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{title:"properties",type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{title:"patternProperties",type:"object",additionalProperties:{$ref:"#"},propertyNames:{title:"propertyNames",format:"regex"},default:{}},dependencies:{title:"dependencies",type:"object",additionalProperties:{title:"dependenciesSet",anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{title:"enum",type:"array",items:!0,minItems:1,uniqueItems:!0},type:{title:"type",anyOf:[{$ref:"#/definitions/simpleTypes"},{title:"arrayOfSimpleTypes",type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{title:"format",type:"string"},contentMediaType:{title:"contentMediaType",type:"string"},contentEncoding:{title:"contentEncoding",type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}}},schemaArray:{title:"schemaArray",type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{title:"nonNegativeInteger",type:"integer",minimum:0},nonNegativeIntegerDefault0:{title:"nonNegativeIntegerDefaultZero",type:"integer",minimum:0,default:0},simpleTypes:{title:"simpleTypes",type:"string",enum:["array","boolean","integer","null","number","object","string"]},stringArray:{title:"stringArray",type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}},s.default=s.jsonSchema}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/meta-schema",file:"node_modules/@json-schema-tools/meta-schema/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js",{"./errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js","isomorphic-fetch":"/home/runner/work/metamask-extension/metamask-extension/node_modules/isomorphic-fetch/fetch-npm-browserify.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function o(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(r,o)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,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(s)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=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],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var r=e("./errors"),o=i(e("isomorphic-fetch")),c=function(e){return n(void 0,void 0,void 0,function(){var t,s;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,(0,o.default)(e)];case 1:return t=n.sent(),[3,3];case 2:throw n.sent(),new r.InvalidRemoteURLError(e);case 3:return n.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,n.sent()];case 5:throw s=n.sent(),new r.NonJsonRefError({$ref:e},s.message);case 6:return[2]}})})};s.default={https:c,http:c}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.InvalidFileSystemPathError=s.InvalidRemoteURLError=s.NotResolvableError=s.NonJsonRefError=void 0;var n=function(e,t){this.name="NonJsonRefError",this.message=["NonJsonRefError","The resolved value at the reference: ".concat(e.$ref," was not JSON.parse 'able"),"The non-json content in question: ".concat(t)].join("\n")};s.NonJsonRefError=n;var a=function(e){this.name="NotResolvableError",this.message=["NotResolvableError","Could not resolve the reference: ".concat(e),"No protocol handler was found, and it was not found to be an internal reference"].join("\n")};s.NotResolvableError=a;var i=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};s.InvalidRemoteURLError=i;var r=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};s.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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function o(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(r,o)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var s,n,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(s)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=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],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=r(e("./default-protocol-handler-map")),c=r(e("./reference-resolver")),l=n(n({},o.default),{file:function(){return a(void 0,void 0,void 0,function(){return i(this,function(e){return[2,undefined]})})}});s.default=new c.default(l)}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/index-web.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js",{"./errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js","./resolve-pointer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function o(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(r,o)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,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(s)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=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],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var r=e("./errors"),o=i(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return n(this,arguments,void 0,function(e,t){var s,n,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))];(s=e.split("#")).length>1&&(n=s[s.length-1]),i=s[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,n&&(f=(0,o.default)(n,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,n&&(f=(0,o.default)(n,f)),[2,f];a.label=7;case 7:return d++,[3,5];case 8:throw new r.NotResolvableError(e)}})})},e}();s.default=c}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js",{"@json-schema-spec/json-pointer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.InvalidJsonPointerRefError=void 0;var a=n(e("@json-schema-spec/json-pointer")),i=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};s.InvalidJsonPointerRefError=i,s.default=function(e,t){try{var s=e.replace("#","");return a.default.parse(s).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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__spreadArray||function(e,t,s){if(s||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(s,"__esModule",{value:!0}),s.defaultOptions=void 0,s.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var i=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},r=function(e,t){var s=t.find(function(t){return t===e});return s||!1},o=function(e,t){return void 0===t&&(t=1),e[e.length-t]};s.default=function e(t,c,l,d,m,u,h,f,p){void 0===l&&(l=s.defaultOptions),void 0===d&&(d=0),void 0===m&&(m=[]),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===f&&(f=[]),void 0===p&&(p=[]);var g=n(n({},s.defaultOptions),l);if(0===d&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===d?t:c(t,!1,i(h),o(u));var b=t;!1===g.mutable&&(b=n({},t)),u.push(b),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===d||(b=c(b,!1,i(h),o(u,2)))),m.push(t),f.push([t,b]);var k=function(t,s){var n=r(t,m);return n?(p.push(n),!0===g.skipFirstMutation&&n===m[0]?c(t,!0,i(s),o(u)):f.find(function(e){var t=e[0];return n===t})[1]):e(t,c,l,d+1,m,u,s,f,p)};if(t.anyOf)b.anyOf=t.anyOf.map(function(e,t){return k(e,a(a([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)b.allOf=t.allOf.map(function(e,t){return k(e,a(a([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)b.oneOf=t.oneOf.map(function(e,t){return k(e,a(a([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)b.items=t.items.map(function(e,t){return k(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])b.items=c(t.items,!0,i(h),o(u));else{var _=f.find(function(e){var t=e[0];return w===t})[1];b.items=_}else b.items=e(t.items,c,l,d+1,m,u,a(a([],h,!0),["items"],!1),f,p)}if(t.additionalItems!==undefined&&(b.additionalItems=k(t.additionalItems,a(a([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var T=t.properties,E={};Object.keys(t.properties).forEach(function(e){E[e]=k(T[e],a(a([],h,!0),["properties",e.toString()],!1))}),b.properties=E}if(t.patternProperties!==undefined){var S=t.patternProperties,I={};Object.keys(t.patternProperties).forEach(function(e){I[e]=k(S[e],a(a([],h,!0),["patternProperties",e.toString()],!1))}),b.patternProperties=I}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(b.additionalProperties=k(t.additionalProperties,a(a([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===d)return b;if(!0===g.bfs)return u.pop(),b;var A=-1!==p.indexOf(t);return u.pop(),c(b,A,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/address-book-controller/dist/AddressBookController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AddressBookController=s.getDefaultAddressBookControllerState=s.controllerName=s.AddressType=void 0;const n=e("@metamask/base-controller"),a=e("@metamask/controller-utils");var i;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(i||(s.AddressType=i={})),s.controllerName="AddressBookController";const r=["list","set","delete","clear"],o={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};s.getDefaultAddressBookControllerState=()=>({addressBook:{}});class c extends n.BaseController{constructor({messenger:e,state:t}){const n={...(0,s.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:o,name:s.controllerName,state:n}),this.messenger.registerMethodActionHandlers(this,r)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,s)=>{const n=s;return[...t,...Object.values(e[n])]},[])}clear(){this.update(e=>{e.addressBook={}})}delete(e,t){if(t=(0,a.toChecksumHexAddress)(t),![e,t].every(e=>(0,a.isSafeDynamicKey)(e))||!(0,a.isValidHexAddress)(t)||!this.state.addressBook[e]?.[t])return!1;const s={...this.state.addressBook[e][t]};return this.update(s=>{const n=s.addressBook[e];n?.[t]&&(delete n[t],0===Object.keys(n).length&&delete s.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",s),!0}set(e,t,s=(0,a.toHex)(1),n="",i){if(e=(0,a.toChecksumHexAddress)(e),!(0,a.isValidHexAddress)(e))return!1;const r={address:e,chainId:s,isEns:!1,memo:n,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,[s]:{...this.state.addressBook[s],[e]:r}}}),"*"!==String(s)&&this.messenger.publish("AddressBookController:contactUpdated",r),!0}}s.AddressBookController=c,s.default=c}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/index.cjs",{"./AddressBookController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AddressBookController=s.getDefaultAddressBookControllerState=void 0;var n=e("./AddressBookController.cjs");Object.defineProperty(s,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return n.getDefaultAddressBookControllerState}}),Object.defineProperty(s,"AddressBookController",{enumerable:!0,get:function(){return n.AddressBookController}})}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.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:s}){const r={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:r}),n.add(this),i(this,n,"m",a).call(this,s)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const s of Object.keys(e).map(Number))t[s].isShown=e[s]})}}s.AnnouncementController=l,n=new WeakSet,a=function(e){this.update(t=>{Object.values(e).forEach(e=>{t.announcements[e.id]=t.announcements[e.id]??{...e,isShown:!1}})})}}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/index.cjs",{"./AnnouncementController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AnnouncementController=void 0;var n=e("./AnnouncementController.cjs");Object.defineProperty(s,"AnnouncementController",{enumerable:!0,get:function(){return n.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs",{"./bridge-status-controller.intent.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/bridge-status.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs","./utils/gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./utils/intent-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs","./utils/metrics.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u,h,f,p,g,b,k,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R,O,M=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},L=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusController=void 0;const F=e("@metamask/bridge-controller"),B=e("@metamask/controller-utils"),G=e("@metamask/keyring-controller"),H=e("@metamask/polling-controller"),U=e("@metamask/transaction-controller"),q=e("@metamask/utils"),W=e("./bridge-status-controller.intent.cjs"),$=e("./constants.cjs"),V=e("./types.cjs"),K=e("./utils/bridge-status.cjs"),Y=e("./utils/gas.cjs"),Q=e("./utils/intent-api.cjs"),z=e("./utils/metrics.cjs"),J=e("./utils/transaction.cjs"),X={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class Z extends((0,H.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,fetchFn:H,addTransactionFn:Z,addTransactionBatchFn:ee,updateTransactionFn:te,estimateGasFeeFn:se,config:ne,traceFn:ae}){super({name:$.BRIDGE_STATUS_CONTROLLER_NAME,metadata:X,messenger:e,state:{...$.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),n.add(this),a.set(this,{}),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,({id:e,actionId:t})=>{let s=this.state.txHistory[e]?e:undefined;if(!s&&t&&this.state.txHistory[t]&&(s=t),s??(s=Object.keys(this.state.txHistory).find(t=>this.state.txHistory[t].approvalTxId===e)),!s)return;const n=s;this.update(e=>{e.txHistory[n].status.status=F.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=$.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=$.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),s=this.messenger.call("NetworkController:getNetworkClientById",t).configuration.chainId;L(this,y,"f").call(this,e,s)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:s}=e;if(!t&&!s)throw new Error("Either txMetaId or txHash must be provided");let n;if(t?this.state.txHistory[t]&&(n=t):s&&(n=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===s)),!n)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${s}`));const i=this.state.txHistory[n],r=i.attempts?.counter??0;if(this.update(e=>{n&&(e.txHistory[n].attempts=undefined)}),L(this,w,"f").call(this,i)){if(!L(this,a,"f")[n]&&(L(this,k,"f").call(this,n),!i.featureId)){const e=this.messenger.call("AccountsController:getAccountByAddress",i.account),t=(0,z.getRequestParamFromHistory)(i),s=(0,z.getRequestMetadataFromHistory)(i,e),{security_warnings:a,...o}=s;L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.PollingStatusUpdated,n,{...(0,z.getTradeDataFromHistory)(i),...(0,z.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:F.MetricsActionType.SWAPBRIDGE_V1,polling_status:F.PollingStatus.ManuallyRestarted,retry_attempts:r})}}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],p.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===F.StatusTypes.PENDING||e.status.status===F.StatusTypes.UNKNOWN).filter(e=>Boolean(e.txMetaId)).filter(e=>!L(this,a,"f")[e.txMetaId]).filter(e=>L(this,w,"f").call(this,e)).forEach(e=>{const t=e.txMetaId;(0,K.shouldSkipFetchDueToFetchFailures)(e.attempts)||L(this,k,"f").call(this,t)})}),g.set(this,(e,t)=>{const{bridgeTxMeta:s,statusRequest:n,quoteResponse:a,startTime:i,slippagePercentage:r,initialDestAssetBalance:o,targetContractAddress:c,approvalTxId:l,isStxEnabled:d,location:m,abTests:u,activeAbTests:h,accountAddress:f}=e,p=(0,J.getHistoryKey)(t,s?.id),g={txMetaId:s?.id,actionId:t,originalTransactionId:s?.originalTransactionId||s?.id,batchId:s?.batchId,quote:a.quote,startTime:i,estimatedProcessingTimeInSeconds:a.estimatedProcessingTimeInSeconds,slippagePercentage:r,pricingData:{amountSent:a.sentAmount?.amount??"0",amountSentInUsd:a.sentAmount?.usd??undefined,quotedGasInUsd:a.gasFee?.effective?.usd??undefined,quotedReturnInUsd:a.toTokenAmount?.usd??undefined,quotedGasAmount:a.gasFee?.effective?.amount??undefined},initialDestAssetBalance:o,targetContractAddress:c,account:f,status:{status:F.StatusTypes.PENDING,srcChain:{chainId:n.srcChainId,txHash:n.srcTxHash}},hasApprovalTx:Boolean(a.approval),approvalTxId:l,isStxEnabled:Boolean(d),featureId:a.featureId,location:m,...u&&{abTests:u},...h&&{activeAbTests:h}};this.update(e=>{e.txHistory[p]=g})}),b.set(this,(e,t)=>{this.update(s=>{(0,J.rekeyHistoryItemInState)(s,e,t)})}),k.set(this,e=>{const t=L(this,a,"f")[e];t&&this.stopPollingByPollingToken(t);const s=this.state.txHistory[e];s&&L(this,w,"f").call(this,s)&&(L(this,a,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),w.set(this,e=>{const t=Boolean(e?.quote?.intent);return[(0,F.isCrossChain)(e.quote.srcChainId,e.quote.destChainId),t,(0,F.isTronChainId)(e.quote.srcChainId)].some(Boolean)}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;if(!t?.id)throw new Error("Cannot start polling: bridgeTxMeta.id is required for polling");L(this,g,"f").call(this,e),L(this,k,"f").call(this,t.id)},this._executePoll=async e=>{await L(this,E,"f").call(this,e)},T.set(this,e=>{const{attempts:t}=this.state.txHistory[e],s=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},n=L(this,a,"f")[e];if(s.counter>=$.MAX_ATTEMPTS&&n){this.stopPollingByPollingToken(n),delete L(this,a,"f")[e];const t=this.state.txHistory[e];if(t&&!t.featureId){const n=this.messenger.call("AccountsController:getAccountByAddress",t.account),a=(0,z.getRequestParamFromHistory)(t),i=(0,z.getRequestMetadataFromHistory)(t,n),{security_warnings:r,...o}=i;L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.PollingStatusUpdated,e,{...(0,z.getTradeDataFromHistory)(t),...(0,z.getPriceImpactFromQuote)(t.quote),...o,chain_id_source:a.chain_id_source,chain_id_destination:a.chain_id_destination,token_symbol_source:a.token_symbol_source,token_symbol_destination:a.token_symbol_destination,action_type:F.MetricsActionType.SWAPBRIDGE_V1,polling_status:F.PollingStatus.MaxPollingReached,retry_attempts:s.counter})}}this.update(t=>{t.txHistory[e].attempts=s})}),E.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state,s=t[e];if(s&&!(0,K.shouldSkipFetchDueToFetchFailures)(s.attempts))try{let t,n=[];if(s.quote.intent){const n=await L(this,i,"f").getIntentTransactionStatus(e,s.quote.srcChainId,s.quote.intent.protocol,L(this,r,"f"),s.status.srcChain.txHash);if(null===n?.bridgeStatus||n?.bridgeStatus===undefined)return;t=n.bridgeStatus.status}else{const a=L(this,I,"f").call(this,e);if(!a)return;L(this,A,"f").call(this,e,a);const i=(0,K.getStatusRequestWithSrcTxHash)(s.quote,a),l=await(0,K.fetchBridgeTxStatus)(i,L(this,r,"f"),await L(this,S,"f").call(this),L(this,o,"f"),L(this,c,"f").customBridgeApiBaseUrl);t=l.status,n=l.validationFailures}if(n.length>0)throw L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:n,refresh_count:s.attempts?.counter??0}),new Error(`Bridge status validation failed: ${n.join(", ")}`);const l={...s,status:t,completionTime:t.status===F.StatusTypes.COMPLETE||t.status===F.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=l}),s.quote.intent&&L(this,i,"f").syncTransactionFromIntentStatus(e,s);const d=L(this,a,"f")[e];if((t.status===F.StatusTypes.COMPLETE||t.status===F.StatusTypes.FAILED)&&d){if(this.stopPollingByPollingToken(d),delete L(this,a,"f")[e],s.featureId)return;t.status===F.StatusTypes.COMPLETE&&(L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",s.quote.destAsset.assetId)),t.status===F.StatusTypes.FAILED&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),L(this,T,"f").call(this,e)}}),S.set(this,async()=>{try{return await this.messenger.call("AuthenticationController:getBearerToken")}catch(e){return console.error("Error getting JWT token for bridge-api request",e),undefined}}),I.set(this,e=>{const{txHistory:t}=this.state,s=t[e].status.srcChain.txHash;if(s)return s;const n=this.messenger.call("TransactionController:getState").transactions.find(t=>t.id===e);return n?.hash}),A.set(this,(e,t)=>{const{txHistory:s}=this.state;s[e].status.srcChain.txHash||this.update(s=>{s.txHistory[e].status.srcChain.txHash=t})}),y.set(this,(e,t)=>{const s=Object.keys(this.state.txHistory).filter(s=>{const n=this.state.txHistory[s],a=(0,q.numberToHex)(n.quote.srcChainId);return n.account===e&&a===t});s.forEach(e=>{L(this,a,"f")[e]&&this.stopPollingByPollingToken(L(this,a,"f")[e])}),this.update(e=>{e.txHistory=s.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),x.set(this,async(e,t,s)=>{if(!s.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const n=(0,J.getClientRequest)(e,t.quote.srcChainId,s),a=await this.messenger.call("SnapController:handleRequest",n),i={...t,trade:e};return(0,J.handleNonEvmTxResponse)(a,i,s)}),v.set(this,async e=>{const t=await e,s=this.messenger.call("TransactionController:getState").transactions.find(e=>e.hash===t);if(!s)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return s}),C.set(this,async(e,{timeoutMs:t=3e5,pollMs:s=3e3}={})=>await(0,J.waitForTxConfirmation)(this.messenger,e,{timeoutMs:t,pollMs:s})),j.set(this,async(e,t,s,n,a)=>{if(s&&(0,F.isEvmTxData)(s)){const i=async()=>{await L(this,D,"f").call(this,n);const i=await L(this,P,"f").call(this,{transactionType:e?U.TransactionType.bridgeApproval:U.TransactionType.swapApproval,trade:s,requireApproval:a});return await(0,J.handleApprovalDelay)(t),i};return await L(this,h,"f").call(this,{name:e?$.TraceName.BridgeTransactionApprovalCompleted:$.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t),stxEnabled:!1}},i)}return undefined}),P.set(this,async({transactionType:e,trade:t,requireApproval:s=!1,txFee:n,actionId:a})=>{const i=a??(0,J.generateActionId)().toString();if(!this.messenger.call("AccountsController:getAccountByAddress",t.from))throw new Error("Failed to submit cross-chain swap transaction: unknown account in trade data");const r=(0,F.formatChainIdToHex)(t.chainId),o=this.messenger.call("NetworkController:findNetworkClientIdByChainId",r),c={actionId:i,networkClientId:o,requireApproval:s,type:e,origin:"metamask"},{gasLimit:d,...m}=t,u={...m,chainId:r,...d&&0!==d&&{gasLimit:d.toString(),gas:d.toString()}},h={...u,...await L(this,N,"f").call(this,u,o,r,n)},{result:f}=await L(this,l,"f").call(this,h,c);return await L(this,v,"f").call(this,f)}),D.set(this,async e=>{e&&await L(this,P,"f").call(this,{transactionType:U.TransactionType.bridgeApproval,trade:e})}),N.set(this,async(e,t,s,n)=>{const{gas:a}=e;if(n)return{maxFeePerGas:(0,B.toHex)(n.maxFeePerGas),maxPriorityFeePerGas:(0,B.toHex)(n.maxPriorityFeePerGas),gas:a?(0,B.toHex)(a):undefined};const{gasFeeEstimates:i}=this.messenger.call("GasFeeController:getState"),{estimates:r}=await L(this,u,"f").call(this,{transactionParams:e,chainId:s,networkClientId:t}),{maxFeePerGas:o,maxPriorityFeePerGas:c}=(0,Y.getTxGasEstimates)({networkGasFeeEstimates:i,txGasFeeEstimates:r});return{maxFeePerGas:o,maxPriorityFeePerGas:c,gas:a?(0,B.toHex)(a):undefined}}),R.set(this,async e=>{const t=await(0,J.getAddTransactionBatchParams)({messenger:this.messenger,estimateGasFeeFn:L(this,u,"f"),...e}),s={[U.TransactionType.bridgeApproval]:t.transactions.find(({type:e})=>e===U.TransactionType.bridgeApproval)?.params.data,[U.TransactionType.swapApproval]:t.transactions.find(({type:e})=>e===U.TransactionType.swapApproval)?.params.data,[U.TransactionType.bridge]:t.transactions.find(({type:e})=>e===U.TransactionType.bridge)?.params.data,[U.TransactionType.swap]:t.transactions.find(({type:e})=>e===U.TransactionType.swap)?.params.data},{batchId:n}=await L(this,d,"f").call(this,t),{approvalMeta:a,tradeMeta:i}=(0,J.findAndUpdateTransactionsInBatch)({messenger:this.messenger,updateTransactionFn:L(this,m,"f"),batchId:n,txDataByType:s});if(!i)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:a,tradeMeta:i}}),this.submitTx=async(e,t,s,a,i=F.MetaMetricsSwapsEventSource.MainView,o,c)=>{this.messenger.call("BridgeController:stopPollingForQuotes",F.AbortReason.TransactionSubmitted,t.featureId?undefined:a);const l=L(this,n,"m",_).call(this,e);if(!l)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const d=(0,F.isHardwareWallet)(l),m=(0,z.getPreConfirmationPropertiesFromQuote)(t,s,d,i,o,c);let u,f;!t.featureId&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Submitted,undefined,m);let p=!1;const w=Date.now(),T=(0,F.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),E=(0,F.isTronChainId)(t.quote.srcChainId);if((0,F.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,F.isTronTrade)(t.approval)){const e=await L(this,h,"f").call(this,{name:T?$.TraceName.BridgeTransactionApprovalCompleted:$.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{return t.approval&&(0,F.isTronTrade)(t.approval)?await L(this,x,"f").call(this,t.approval,t,l):undefined}catch(e){throw!t.featureId&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...m}),e}});f=e?.id,await(0,J.handleApprovalDelay)(t.quote.srcChainId)}u=await L(this,h,"f").call(this,{name:T?$.TraceName.BridgeTransactionCompleted:$.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{if(!(0,F.isTronTrade)(t.trade)&&!(0,F.isBitcoinTrade)(t.trade)&&"string"!=typeof t.trade)throw new Error("Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction");return await L(this,x,"f").call(this,t.trade,t,l)}catch(e){throw!t.featureId&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...m}),e}})}else{const e=L(this,r,"f")===V.BridgeClientId.MOBILE&&d;u=await L(this,h,"f").call(this,{name:T?$.TraceName.BridgeTransactionCompleted:$.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:s}},async()=>{if(!(0,F.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");const n=(0,F.formatChainIdToHex)(t.quote.srcChainId);if(p=await(async()=>{try{return(await this.messenger.call("TransactionController:isAtomicBatchSupported",{address:t.trade.from,chainIds:[n]})).some(e=>e.isSupported&&e.delegationAddress)}catch{return!1}})(),s||t.quote.gasIncluded7702||p){const{tradeMeta:s,approvalMeta:n}=await L(this,R,"f").call(this,{isBridgeTx:T,resetApproval:t.resetApproval,approval:t.approval&&(0,F.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e,isDelegatedAccount:p});return f=n?.id,s}const a=await L(this,j,"f").call(this,T,t.quote.srcChainId,t.approval&&(0,F.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);f=a?.id,await(0,J.handleMobileHardwareWalletDelay)(e);const r=(0,J.generateActionId)().toString();L(this,g,"f").call(this,{accountAddress:l.address,statusRequest:{...(0,J.getStatusRequestParams)(t),srcTxHash:""},quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:w,approvalTxId:f,location:i,abTests:o,activeAbTests:c},r);const d=await L(this,P,"f").call(this,{transactionType:T?U.TransactionType.bridge:U.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined,actionId:r});return L(this,b,"f").call(this,r,d),d})}try{!((0,F.isNonEvmChainId)(t.quote.srcChainId)||s||t.quote.gasIncluded7702||p)||L(this,g,"f").call(this,{accountAddress:l.address,bridgeTxMeta:u,statusRequest:{...(0,J.getStatusRequestParams)(t),srcTxHash:u.hash},quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:w,approvalTxId:f,location:i,abTests:o,activeAbTests:c}),(0,F.isNonEvmChainId)(t.quote.srcChainId)&&(L(this,k,"f").call(this,u.id),T||E||L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Completed,u.id))}catch{}return u},this.submitIntent=async e=>{const{quoteResponse:t,accountAddress:s,location:a,abTests:o,activeAbTests:c}=e;this.messenger.call("BridgeController:stopPollingForQuotes",F.AbortReason.TransactionSubmitted);const d=L(this,n,"m",_).call(this,s),m=Boolean(d)&&(0,F.isHardwareWallet)(d),u=(0,z.getPreConfirmationPropertiesFromQuote)(t,!1,m,a,o,c);try{const e=(0,J.getIntentFromQuote)(t),n=(0,F.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),d=m&&L(this,r,"f")===V.BridgeClientId.MOBILE,u=await L(this,j,"f").call(this,n,t.quote.srcChainId,t.approval,t.resetApproval,d),h=u?.id;h&&await L(this,C,"f").call(this,h);const{srcChainId:f,requestId:p}=t.quote,b={srcChainId:f,quoteId:p,signature:await this.messenger.call("KeyringController:signTypedMessage",{from:s,data:e.typedData},G.SignTypedDataVersion.V4),order:e.order,userAddress:s,aggregatorId:e.protocol},w=await L(this,i,"f").submitIntent(b,L(this,r,"f")),_=w.id,T=n?U.TransactionType.bridge:U.TransactionType.swap,E=this.messenger.call("NetworkController:findNetworkClientIdByChainId",(0,F.formatChainIdToHex)(f)),S={chainId:(0,F.formatChainIdToHex)(f),from:s,to:e.settlementContract??"0x9008D19f58AAbd9eD0D60971565AA8510560ab41",data:`0x${_.slice(-8)}`,value:"0x0",gas:"0x5208",gasPrice:"0x3b9aca00"},{transactionMeta:I}=await L(this,l,"f").call(this,S,{origin:"metamask",actionId:(0,J.generateActionId)(),requireApproval:!1,isStateOnly:!0,networkClientId:E,type:T}),A=I,y=(0,Q.mapIntentOrderStatusToTransactionStatus)(w.status),x={...{...A,status:y},isIntentTx:!0,orderUid:_};try{const e=_,n={...x,id:e,originalTransactionId:x.id},i=Date.now();L(this,g,"f").call(this,{accountAddress:s,bridgeTxMeta:n,statusRequest:{...(0,J.getStatusRequestParams)(t),srcTxHash:x.hash??""},quoteResponse:t,slippagePercentage:0,isStxEnabled:!1,approvalTxId:h,startTime:i,location:a,abTests:o,activeAbTests:c}),L(this,k,"f").call(this,e)}catch(e){console.error("📝 [submitIntent] Failed to add to bridge history",e)}return x}catch(e){throw L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...u}),e}},O.set(this,(e,t,s)=>{const n=t?this.state.txHistory?.[t]?.abTests:undefined,a=t?this.state.txHistory?.[t]?.activeAbTests:undefined,i=s?.ab_tests??n,r=s?.active_ab_tests??a,o={action_type:F.MetricsActionType.SWAPBRIDGE_V1,location:s?.location??(t?this.state.txHistory?.[t]?.location:undefined)??F.MetaMetricsSwapsEventSource.MainView,...s??{},...i&&Object.keys(i).length>0&&{ab_tests:i},...r&&r.length>0&&{active_ab_tests:r}};if(!t)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,o);const c=this.state.txHistory[t];if(!c)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,o);const l=(0,z.getRequestParamFromHistory)(c);if(e===F.UnifiedSwapBridgeEventName.StatusValidationFailed)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,{...o,chain_id_source:l.chain_id_source,chain_id_destination:l.chain_id_destination,token_address_source:l.token_address_source,token_address_destination:l.token_address_destination,refresh_count:c.attempts?.counter??0});if(c.featureId)return;const d=this.messenger.call("AccountsController:getAccountByAddress",c.account),{transactions:m}=this.messenger.call("TransactionController:getState"),u=m?.find(e=>e.id===t),h=m?.find(e=>e.id===c.approvalTxId),f={...o,...l,...(0,z.getRequestMetadataFromHistory)(c,d),...(0,z.getTradeDataFromHistory)(c),...(0,z.getTxStatusesFromHistory)(c),...(0,z.getFinalizedTxProperties)(c,u,h),...(0,z.getPriceImpactFromQuote)(c.quote)};this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,f)}),M(this,r,s,"f"),M(this,o,H,"f"),M(this,l,Z,"f"),M(this,d,ee,"f"),M(this,m,te,"f"),M(this,u,se,"f"),M(this,c,{customBridgeApiBaseUrl:ne?.customBridgeApiBaseUrl??$.BRIDGE_PROD_API_BASE_URL},"f"),M(this,h,ae??((e,t)=>t?.()),"f"),M(this,i,new W.IntentManager({messenger:this.messenger,updateTransactionFn:L(this,m,"f"),customBridgeApiBaseUrl:L(this,c,"f").customBridgeApiBaseUrl,fetchFn:L(this,o,"f"),getJwt:L(this,S,"f")}),"f"),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:submitIntent`,this.submitIntent.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength($.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:s,id:n,actionId:a}=e;if(t&&[U.TransactionType.bridge,U.TransactionType.swap,U.TransactionType.bridgeApproval,U.TransactionType.swapApproval].includes(t)&&[U.TransactionStatus.failed,U.TransactionStatus.dropped,U.TransactionStatus.rejected].includes(s)&&(L(this,f,"f").call(this,e),s!==U.TransactionStatus.rejected)){let t;this.state.txHistory[n]?t=n:a&&this.state.txHistory[a]&&(t=a),L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,t??n,(0,z.getEVMTxPropertiesFromTransactionMeta)(e))}}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:s,chainId:n}=e;t===U.TransactionType.swap&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Completed,s),t!==U.TransactionType.bridge||(0,F.isNonEvmChainId)(n)||L(this,k,"f").call(this,s)}),L(this,p,"f").call(this)}}s.BridgeStatusController=Z,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,b=new WeakMap,k=new WeakMap,w=new WeakMap,T=new WeakMap,E=new WeakMap,S=new WeakMap,I=new WeakMap,A=new WeakMap,y=new WeakMap,x=new WeakMap,v=new WeakMap,C=new WeakMap,j=new WeakMap,P=new WeakMap,D=new WeakMap,N=new WeakMap,R=new WeakMap,O=new WeakMap,n=new WeakSet,_=function(e){return this.messenger.call("AccountsController:getAccountByAddress",e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.cjs",{"./utils/intent-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs","./utils/validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.IntentManager=void 0;const d=e("@metamask/bridge-controller"),m=e("./utils/intent-api.cjs");e("./utils/validators.cjs");s.IntentManager=class{constructor({messenger:e,updateTransactionFn:t,customBridgeApiBaseUrl:s,fetchFn:u,getJwt:h}){n.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,new Map),this.getIntentTransactionStatus=async(e,t,s,a,i="")=>{try{const r=await this.intentApi.getOrderStatus(e,s,t,a);return l(this,n,"m",o).call(this,e,r,t,i.toString())}catch(e){if(e instanceof Error)throw new Error(`[Intent polling] Failed to get intent order status from API: ${e.message}`);return undefined}},this.syncTransactionFromIntentStatus=(e,t)=>{const s=t.originalTransactionId??t.txMetaId;if(!s)return;const n=l(this,r,"f").get(e);if(n)try{const{transactions:t}=l(this,a,"f").call("TransactionController:getState"),o=t.find(e=>e.id===s);if(!o)return void console.warn("[Intent polling] Skipping update, transaction not found",{originalTxId:s,bridgeHistoryKey:e});const{bridgeStatus:c,orderStatus:m}=n,u=c?.txHash,h=c?.status.status===d.StatusTypes.COMPLETE,f=c?.status.status===d.StatusTypes.COMPLETE||c?.status.status===d.StatusTypes.FAILED,p=o.txReceipt,g=u?{txReceipt:{...p,transactionHash:u,status:h?"0x1":"0x0"}}:{},b={...o,status:c?.transactionStatus,...u?{hash:u}:{},...g};l(this,i,"f").call(this,b,`BridgeStatusController - Intent order status updated: ${m}`),f&&l(this,r,"f").delete(e)}catch(t){console.error("[Intent polling] Failed to update transaction status",{originalTxId:s,bridgeHistoryKey:e,error:t})}},this.submitIntent=async(e,t)=>this.intentApi.submitIntent(e,t),c(this,a,e,"f"),c(this,i,t,"f"),this.intentApi=new m.IntentApiImpl(s,u,h)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,n=new WeakSet,o=function(e,t,s,n){const a=(0,m.translateIntentOrderToBridgeStatus)(t,s,n),i={orderStatus:t.status,bridgeStatus:a};return l(this,r,"f").set(e,i),i}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=s.APPROVAL_DELAY_MS=s.BRIDGE_PROD_API_BASE_URL=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.BRIDGE_STATUS_CONTROLLER_NAME=s.MAX_ATTEMPTS=s.REFRESH_INTERVAL_MS=void 0,s.REFRESH_INTERVAL_MS=1e4,s.MAX_ATTEMPTS=7,s.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{}},s.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",s.APPROVAL_DELAY_MS=5e3,function(e){e.BridgeTransactionApprovalCompleted="Bridge Transaction Approval Completed",e.BridgeTransactionCompleted="Bridge Transaction Completed",e.SwapTransactionApprovalCompleted="Swap Transaction Approval Completed",e.SwapTransactionCompleted="Swap Transaction Completed"}(n||(s.TraceName=n={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/index.cjs",{"./bridge-status-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getTxMetaFields=s.BridgeStatusController=s.BridgeStatusAction=s.BridgeId=s.MAX_ATTEMPTS=s.BRIDGE_STATUS_CONTROLLER_NAME=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.REFRESH_INTERVAL_MS=void 0;var n=e("./constants.cjs");Object.defineProperty(s,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return n.REFRESH_INTERVAL_MS}}),Object.defineProperty(s,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(s,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return n.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(s,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return n.MAX_ATTEMPTS}});var a=e("./types.cjs");Object.defineProperty(s,"BridgeId",{enumerable:!0,get:function(){return a.BridgeId}}),Object.defineProperty(s,"BridgeStatusAction",{enumerable:!0,get:function(){return a.BridgeStatusAction}});var i=e("./bridge-status-controller.cjs");Object.defineProperty(s,"BridgeStatusController",{enumerable:!0,get:function(){return i.BridgeStatusController}});var r=e("./utils/transaction.cjs");Object.defineProperty(s,"getTxMetaFields",{enumerable:!0,get:function(){return r.getTxMetaFields}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusAction=s.BridgeId=s.BridgeClientId=void 0;e("./constants.cjs");var n,a,i;!function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(n||(s.BridgeClientId=n={})),function(e){e.HOP="hop",e.CELER="celer",e.CELERCIRCLE="celercircle",e.CONNEXT="connext",e.POLYGON="polygon",e.AVALANCHE="avalanche",e.MULTICHAIN="multichain",e.AXELAR="axelar",e.ACROSS="across",e.STARGATE="stargate",e.RELAY="relay",e.MAYAN="mayan"}(a||(s.BridgeId=a={})),function(e){e.StartPollingForBridgeTxStatus="StartPollingForBridgeTxStatus",e.WipeBridgeStatus="WipeBridgeStatus",e.GetState="GetState",e.ResetState="ResetState",e.SubmitTx="SubmitTx",e.SubmitIntent="SubmitIntent",e.RestartPollingForFailedAttempts="RestartPollingForFailedAttempts",e.GetBridgeHistoryItemByTxMetaId="GetBridgeHistoryItemByTxMetaId"}(i||(s.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/bridge-status.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.shouldSkipFetchDueToFetchFailures=s.getStatusRequestWithSrcTxHash=s.fetchBridgeTxStatus=s.getStatusRequestDto=s.getBridgeStatusUrl=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/superstruct"),i=e("./validators.cjs"),r=e("../constants.cjs");s.getBridgeStatusUrl=e=>`${e}/getTxStatus`;s.getStatusRequestDto=e=>{const{quote:t,...s}=e;return{...Object.fromEntries(Object.entries(s).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};s.fetchBridgeTxStatus=async(e,t,r,o,c)=>{const l=(0,s.getStatusRequestDto)(e),d=new URLSearchParams(l),m=`${(0,s.getBridgeStatusUrl)(c)}?${d.toString()}`,u=await o(m,{headers:(0,n.getClientHeaders)({clientId:t,jwt:r})}),h=[];try{(0,i.validateBridgeStatusResponse)(u)}catch(t){t instanceof a.StructError&&t.failures().forEach(({path:t})=>{const s=u?.bridge??(e.bridge||e.bridgeId)??"unknown",n=t?.join(".")||"unknown";h.push([s,n].join("|"))})}return{status:u,validationFailures:h}};s.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:s,bridges:n,srcChainId:a,destChainId:i,refuel:r}=e;return{bridgeId:s,srcTxHash:t,bridge:n[0],srcChainId:a,destChainId:i,quote:e,refuel:Boolean(r)}};s.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}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.calcActualGasUsed=s.calculateGasFees=s.getTxGasEstimates=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/controller-utils"),i=e("bignumber.js");s.getTxGasEstimates=({txGasFeeEstimates:e,networkGasFeeEstimates:t})=>{const{estimatedBaseFee:s="0"}=t;return((e,t)=>{const{maxFeePerGas:s,maxPriorityFeePerGas:a}=e?.[n.BRIDGE_PREFERRED_GAS_ESTIMATE]??{};return{baseAndPriorityFeePerGas:a?new i.BigNumber(t,10).times(10**9).plus(a,16):undefined,maxFeePerGas:s,maxPriorityFeePerGas:a}})(e,s)};s.calculateGasFees=async(e,t,n,{chainId:i,gasLimit:r,...o},c,l,d)=>{if(e)return{};if(d)return{...d,gas:r?.toString()};const m={...o,gas:r?.toString(),data:o.data,to:o.to,value:o.value},{gasFeeEstimates:u}=t.call("GasFeeController:getState"),{estimates:h}=await n({transactionParams:m,chainId:l,networkClientId:c}),{maxFeePerGas:f,maxPriorityFeePerGas:p}=(0,s.getTxGasEstimates)({networkGasFeeEstimates:u,txGasFeeEstimates:h});return{maxFeePerGas:f,maxPriorityFeePerGas:p,gas:(0,a.toHex)(m.gas??0)}};const r=(e,t)=>e&&t?new i.BigNumber(e,16).times(new i.BigNumber(t,16)):null;s.calcActualGasUsed=({pricingData:e},t,s)=>{const n=e?.quotedGasInUsd&&e?.quotedGasAmount?new i.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,a=r(t?.gasUsed,t?.effectiveGasPrice)?.plus(r(s?.gasUsed,s?.effectiveGasPrice)??0),o=a?.div(new i.BigNumber(10).pow(18)).toString(10);return a&&o?{amount:a.toString(10),usd:n?.multipliedBy(o).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs",{"./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},o=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.mapIntentOrderStatusToTransactionStatus=s.translateIntentOrderToBridgeStatus=s.IntentApiImpl=void 0;const c=e("@metamask/bridge-controller"),l=e("@metamask/transaction-controller"),d=e("./validators.cjs");s.IntentApiImpl=class{constructor(e,t,s){n.set(this,void 0),a.set(this,void 0),i.set(this,void 0),r(this,n,e,"f"),r(this,a,t,"f"),r(this,i,s,"f")}async submitIntent(e,t){const s=`${o(this,n,"f")}/submitOrder`;try{const n=await o(this,i,"f").call(this),r=await o(this,a,"f").call(this,s,{method:"POST",headers:{"Content-Type":"application/json",...(0,c.getClientHeaders)({clientId:t,jwt:n})},body:JSON.stringify(e)});if(!(0,d.validateIntentStatusResponse)(r))throw new Error("Invalid submitOrder response");return r}catch(e){if(e instanceof Error)throw new Error(`Failed to submit intent: ${e.message}`);throw new Error("Failed to submit intent")}}async getOrderStatus(e,t,s,r){const l=`${o(this,n,"f")}/getOrderStatus?orderId=${e}&aggregatorId=${encodeURIComponent(t)}&srcChainId=${s}`;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")}}},n=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}}s.translateIntentOrderToBridgeStatus=(e,t,s)=>{let n;switch(e.status){case d.IntentOrderStatus.CONFIRMED:case d.IntentOrderStatus.COMPLETED:n=c.StatusTypes.COMPLETE;break;case d.IntentOrderStatus.FAILED:case d.IntentOrderStatus.EXPIRED:case d.IntentOrderStatus.CANCELLED:n=c.StatusTypes.FAILED;break;case d.IntentOrderStatus.PENDING:n=c.StatusTypes.PENDING;break;case d.IntentOrderStatus.SUBMITTED:n=c.StatusTypes.SUBMITTED;break;default:n=c.StatusTypes.UNKNOWN}const a=e.txHash??s??"";return{status:{status:n,srcChain:{chainId:t,txHash:a}},txHash:a,transactionStatus:m(e.status)}},s.mapIntentOrderStatusToTransactionStatus=m}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs",{"./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./swap-received-amount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getEVMTxPropertiesFromTransactionMeta=s.getRequestMetadataFromHistory=s.getTradeDataFromHistory=s.getPreConfirmationPropertiesFromQuote=s.getPriceImpactFromQuote=s.getTradeDataFromQuote=s.getRequestParamFromHistory=s.getFinalizedTxProperties=s.getTxStatusesFromHistory=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/transaction-controller"),i=e("bignumber.js"),r=e("./gas.cjs"),o=e("./swap-received-amount.cjs");s.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:s,quote:a})=>{const i=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING,r=e.destChain?.txHash?e.status:n.StatusTypes.PENDING,o=(0,n.formatChainIdToHex)(a.srcChainId),c=(0,n.isEthUsdt)(o,a.srcAsset.address),l=e.srcChain.txHash?n.StatusTypes.COMPLETE:undefined,d=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING;return{allowance_reset_transaction:c?l:undefined,approval_transaction:t||s?d:undefined,source_transaction:i,destination_transaction:e.status===n.StatusTypes.FAILED?n.StatusTypes.FAILED:r}};s.getFinalizedTxProperties=(e,t,s)=>{const n=s?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===a.TransactionType.swap?t?.time:e.completionTime,l=(0,r.calcActualGasUsed)(e,t?.txReceipt,s?.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&&n?(c-n)/6e4:0,usd_actual_return:Number(d?.usd??0),usd_actual_gas:l?.usd??0,quote_vs_execution_ratio:u,quoted_vs_used_gas_ratio:m}};s.getRequestParamFromHistory=e=>({chain_id_source:(0,n.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,n.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId});s.getTradeDataFromQuote=e=>({usd_quoted_gas:Number(e.gasFee?.effective?.usd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});s.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});s.getPreConfirmationPropertiesFromQuote=(e,t,a,i=n.MetaMetricsSwapsEventSource.MainView,r,o)=>{const{quote:c}=e;return{...(0,s.getPriceImpactFromQuote)(c),...(0,s.getTradeDataFromQuote)(e),chain_id_source:(0,n.formatChainIdToCaip)(c.srcChainId),token_symbol_source:c.srcAsset.symbol,chain_id_destination:(0,n.formatChainIdToCaip)(c.destChainId),token_symbol_destination:c.destAsset.symbol,is_hardware_wallet:a,swap_type:(0,n.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:n.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1,location:i,...r&&Object.keys(r).length>0&&{ab_tests:r},...o&&o.length>0&&{active_ab_tests:o}}};s.getTradeDataFromHistory=e=>({usd_quoted_gas:Number(e.pricingData?.quotedGasInUsd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});s.getRequestMetadataFromHistory=(e,t)=>{const{quote:s,slippagePercentage:a,isStxEnabled:i}=e;return{slippage_limit:a,custom_slippage:(0,n.isCustomSlippage)(a),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,n.getSwapType)(s.srcChainId,s.destChainId),is_hardware_wallet:(0,n.isHardwareWallet)(t),stx_enabled:i??!1,security_warnings:[]}};s.getEVMTxPropertiesFromTransactionMeta=e=>({source_transaction:[a.TransactionStatus.failed,a.TransactionStatus.dropped,a.TransactionStatus.rejected].includes(e.status)?n.StatusTypes.FAILED:n.StatusTypes.COMPLETE,error_message:e.error?.message??"",chain_id_source:(0,n.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,n.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:0,stx_enabled:!1,token_address_source:(0,n.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,n.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",custom_slippage:!1,is_hardware_wallet:!1,swap_type:e.type&&[a.TransactionType.swap,a.TransactionType.swapApproval].includes(e.type)?n.MetricsSwapType.SINGLE:n.MetricsSwapType.CROSSCHAIN,security_warnings:[],price_impact:0,usd_quoted_gas:0,gas_included:!1,gas_included_7702:!1,quoted_time_minutes:0,usd_quoted_return:0,provider:"",actual_time_minutes:0,quote_vs_execution_ratio:0,quoted_vs_used_gas_ratio:0,usd_actual_return:0,usd_actual_gas:0,action_type:n.MetricsActionType.SWAPBRIDGE_V1})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs",{uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createClientTransactionRequest=void 0;const n=e("uuid");s.createClientTransactionRequest=(e,t,s,a,i)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,n.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:s,accountId:a,...i&&{options:i}}}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getActualBridgeReceivedAmount=s.getActualSwapReceivedAmount=void 0;const n=e("@metamask/bridge-controller"),a=e("bignumber.js");s.getActualSwapReceivedAmount=(e,t,s)=>{const{pricingData:i}=e,r=e.quote.destTokenAmount;if(!s?.txReceipt)return null;const o=(0,n.isNativeAddress)(e.quote.destAsset.address)?((e,t,s)=>{const{preTxBalance:n,postTxBalance:i}=s;return n&&i&&n!==i?t&&i&&n?new a.BigNumber(i,16).minus(n,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new a.BigNumber(e.quote.destTokenAmount).div(new a.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,s):((e,t)=>{const{txReceipt:s}=t;if(!s?.logs||"0x0"===s.status)return null;const{account:n,quote:i}=e,r=s.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),s=e.address?.toLowerCase()===i.destAsset.address?.toLowerCase(),a=e.topics?.[2]&&(e.topics[2]===n||e.topics[2].match(n?.slice(2)));return t&&s&&a});return r?.data?new a.BigNumber(r.data,16).div(new a.BigNumber(10).pow(i.destAsset.decimals)):null})(e,s),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}};s.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:s,status:n}=e,i=s?.quotedReturnInUsd?new a.BigNumber(s.quotedReturnInUsd).div(t.destTokenAmount):null,r=n.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/transaction.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getIntentFromQuote=s.getHistoryKey=s.findAndUpdateTransactionsInBatch=s.getAddTransactionBatchParams=s.toBatchTxParams=s.rekeyHistoryItemInState=s.waitForTxConfirmation=s.getClientRequest=s.handleMobileHardwareWalletDelay=s.handleApprovalDelay=s.handleNonEvmTxResponse=s.getTxMetaFields=s.getStatusRequestParams=s.generateActionId=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/controller-utils"),i=e("@metamask/transaction-controller"),r=e("@metamask/utils"),o=e("uuid"),c=e("./gas.cjs"),l=e("./snaps.cjs"),d=e("../constants.cjs");s.generateActionId=()=>(Date.now()+Math.random()).toString();s.getStatusRequestParams=e=>({bridgeId:e.quote.bridgeId,bridge:e.quote.bridges[0],srcChainId:e.quote.srcChainId,destChainId:e.quote.destChainId,quote:e.quote,refuel:Boolean(e.quote.refuel)});s.getTxMetaFields=(e,t)=>{let s;try{s=(0,n.formatChainIdToHex)(e.quote.destChainId)}catch{s="0x1"}return{destinationChainId:s,sourceTokenAmount:e.quote.srcTokenAmount,sourceTokenSymbol:e.quote.srcAsset.symbol,sourceTokenDecimals:e.quote.srcAsset.decimals,sourceTokenAddress:e.quote.srcAsset.address,destinationTokenAmount:e.quote.destTokenAmount,destinationTokenSymbol:e.quote.destAsset.symbol,destinationTokenDecimals:e.quote.destAsset.decimals,destinationTokenAddress:e.quote.destAsset.address,approvalTxId:t,swapTokenValue:e.sentAmount.amount}};s.handleNonEvmTxResponse=(e,t,a)=>{const r=a.address,c=a.metadata.snap?.id;let l;"string"==typeof e?l=e:e&&"object"==typeof e&&("transactionId"in e&&e.transactionId?l=e.transactionId:"result"in e&&e.result&&"object"==typeof e.result?l=e.result.signature||e.result.txid||e.result.hash||e.result.txHash:"signature"in e&&e.signature&&"string"==typeof e.signature&&(l=e.signature));const d=(0,n.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);let m;try{m=(0,n.formatChainIdToHex)(t.quote.srcChainId)}catch{m="0x1"}const u=(0,n.extractTradeData)(t.trade);return{...(0,s.getTxMetaFields)(t),time:Date.now(),id:l??(0,o.v4)(),chainId:m,networkClientId:c??m,txParams:{from:r,data:u},type:d?i.TransactionType.bridge:i.TransactionType.swap,status:i.TransactionStatus.submitted,hash:l,origin:c,isSolana:!0,isBridgeTx:d}};s.handleApprovalDelay=async e=>{if([n.ChainId.LINEA,n.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}};s.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};s.getClientRequest=(e,t,s)=>{const a=(0,n.formatChainIdToCaip)(t),i=(0,n.extractTradeData)(e),r=(0,n.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,l.createClientTransactionRequest)(s.metadata.snap?.id,i,a,s.id,r)};s.waitForTxConfirmation=async(e,t,{timeoutMs:s=3e5,pollMs:n=3e3}={})=>{const a=Date.now();for(;;){const{transactions:r}=e.call("TransactionController:getState"),o=r.find(e=>e.id===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()-a>s)throw new Error("Timed out waiting for approval confirmation");await new Promise(e=>setTimeout(e,n))}};s.rekeyHistoryItemInState=(e,t,s)=>{const n=e.txHistory[t];return!!n&&(e.txHistory[s.id]={...n,txMetaId:s.id,originalTransactionId:n.originalTransactionId??s.id,status:{...n.status,srcChain:{...n.status.srcChain,txHash:s.hash??n.status.srcChain?.txHash}}},delete e.txHistory[t],!0)};s.toBatchTxParams=(e,{chainId:t,gasLimit:s,...n},{maxFeePerGas:i,maxPriorityFeePerGas:r,gas:o})=>{const c={...n,data:n.data,to:n.to,value:n.value};return e?c:{...c,gas:(0,a.toHex)(o??0),maxFeePerGas:(0,a.toHex)(i??0),maxPriorityFeePerGas:(0,a.toHex)(r??0)}};s.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:a,resetApproval:r,trade:o,quoteResponse:{quote:{feeData:{txFee:l},gasIncluded:d,gasIncluded7702:m,gasSponsored:u},sentAmount:h,toTokenAmount:f},requireApproval:p=!1,isDelegatedAccount:g=!1,estimateGasFeeFn:b})=>{const k=d||m;if(!e.call("AccountsController:getAccountByAddress",o.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const w=(0,n.formatChainIdToHex)(o.chainId),_=e.call("NetworkController:findNetworkClientIdByChainId",w),T=!0===m,E=!T&&!g,S=[];if(r){const n=await(0,c.calculateGasFees)(T,e,b,r,_,w,k?l:undefined);S.push({type:t?i.TransactionType.bridgeApproval:i.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(T,r,n)})}if(a){const n=await(0,c.calculateGasFees)(T,e,b,a,_,w,k?l:undefined);S.push({type:t?i.TransactionType.bridgeApproval:i.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(T,a,n)})}const I=await(0,c.calculateGasFees)(T,e,b,o,_,w,k?l:undefined);S.push({type:t?i.TransactionType.bridge:i.TransactionType.swap,params:(0,s.toBatchTxParams)(T,o,I),assetsFiatValues:{sending:h?.valueInCurrency?.toString(),receiving:f?.valueInCurrency?.toString()}});return{disable7702:E,isGasFeeIncluded:Boolean(m),isGasFeeSponsored:Boolean(u),networkClientId:_,requireApproval:p,origin:"metamask",from:o.from,transactions:S}};s.findAndUpdateTransactionsInBatch=({messenger:e,updateTransactionFn:t,batchId:s,txDataByType:n})=>{const a=e.call("TransactionController:getState").transactions,r={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(n).forEach(([e,n])=>{if(n===undefined)return;const o=a.find(t=>{if(t.batchId!==s)return!1;if(Array.isArray(t.txParams.authorizationList)&&t.txParams.authorizationList.length>0||Boolean(t.delegationAddress)){if((e===i.TransactionType.swap||e===i.TransactionType.bridge)&&t.type===i.TransactionType.batch)return!0;if((e===i.TransactionType.swapApproval||e===i.TransactionType.bridgeApproval)&&t.txParams.data===n)return!0}return t.txParams.data===n});if(o){const s={...o,type:e};t(s,`Update tx type to ${e}`),r[[i.TransactionType.bridgeApproval,i.TransactionType.swapApproval].includes(e)?"approvalMeta":"tradeMeta"]=s}}),r},s.getHistoryKey=function(e,t){const s=e??t;if(!s)throw new Error("Cannot add tx to history: either actionId or bridgeTxMeta.id must be provided");return s},s.getIntentFromQuote=function(e){const{intent:t}=e.quote;if(!t)throw new Error("submitIntent: missing intent data");return t}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateIntentStatusResponse=s.IntentOrderStatus=s.validateBridgeStatusResponse=s.StatusResponseSchema=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/superstruct"),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,n.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,n.BridgeAssetSchema]))}),l=(0,a.type)({});s.StatusResponseSchema=(0,a.type)({status:(0,a.enums)(Object.values(n.StatusTypes)),srcChain:o,destChain:(0,a.optional)(c),bridge:(0,a.optional)((0,a.string)()),isExpectedToken:(0,a.optional)((0,a.boolean)()),isUnrecognizedRouterAddress:(0,a.optional)((0,a.boolean)()),refuel:(0,a.optional)(l)});var d;s.validateBridgeStatusResponse=e=>((0,a.assert)(e,s.StatusResponseSchema),!0),function(e){e.PENDING="pending",e.SUBMITTED="submitted",e.CONFIRMED="confirmed",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.EXPIRED="expired"}(d||(s.IntentOrderStatus=d={}));const m=(0,a.type)({id:(0,a.string)(),status:(0,a.enums)(Object.values(d)),txHash:(0,a.optional)((0,a.string)()),metadata:(0,a.type)({txHashes:(0,a.optional)((0,a.union)([(0,a.array)((0,a.string)()),(0,a.string)()]))})});s.validateIntentStatusResponse=e=>(0,a.is)(e,m)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/assets.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","@ethersproject/bignumber":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/bignumber/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u,h,f,p,g,b,k,w,_,T,E,S,I,A,y,x,v,C,j,P=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},D=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeController=void 0;const N=e("@ethersproject/bignumber"),R=e("@ethersproject/contracts"),O=e("@ethersproject/providers"),M=e("@metamask/metamask-eth-abis"),L=e("@metamask/polling-controller"),F=e("./constants/bridge.cjs"),B=e("./constants/chains.cjs"),G=e("./constants/swaps.cjs"),H=e("./constants/traces.cjs"),U=e("./selectors.cjs"),q=e("./types.cjs"),W=e("./utils/assets.cjs"),$=e("./utils/balance.cjs"),V=e("./utils/bridge.cjs"),K=e("./utils/caip-formatters.cjs"),Y=e("./utils/feature-flags.cjs"),Q=e("./utils/fetch.cjs"),z=e("./utils/metrics/constants.cjs"),J=e("./utils/metrics/properties.cjs"),X=e("./utils/quote.cjs"),Z=e("./utils/quote-fees.cjs"),ee=e("./utils/snaps.cjs"),te={quoteRequest:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotes:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesInitialLoadTime:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLastFetched:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLoadingStatus:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quoteFetchError:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesRefreshCount:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetExchangeRates:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},minimumBalanceForRentExemptionInLamports:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0}};class se extends((0,L.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,clientVersion:L,getLayer1GasFee:se,fetchFn:ne,config:ae,trackMetaMetricsFn:ie,traceFn:re,getUseAssetsControllerForRates:oe}){super({name:F.BRIDGE_CONTROLLER_NAME,metadata:te,messenger:e,state:{...(0,V.getDefaultBridgeControllerState)(),...t}}),n.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,z.MetaMetricsSwapsEventSource.MainView),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),this._executePoll=async e=>{await D(this,_,"f").call(this,e)},this.updateBridgeQuoteRequestParams=async(e,t)=>{D(this,C,"f").call(this,e),this.resetState(z.AbortReason.QuoteRequestUpdated);const s={...F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,...e};if(this.update(e=>{e.quoteRequest=s}),(0,X.isValidQuoteRequest)(s)){P(this,i,Date.now(),"f");const a=(0,V.isNonEvmChainId)(s.srcChainId),r=a?undefined:D(this,n,"m",I).call(this,(0,K.formatChainIdToHex)(s.srcChainId))?.configuration;let o,c=Boolean(e.resetApproval);a?o=e.insufficientBal:r?.rpcUrl?.includes("tenderly")?o=!0:(this.update(e=>{e.quotesLoadingStatus=q.RequestStatus.LOADING}),c=await D(this,w,"f").call(this,s),o=e.insufficientBal??await D(this,k,"f").call(this,s)),this.setChainIntervalLength(),this.startPolling({updatedQuoteRequest:{...s,insufficientBal:o,resetApproval:c},context:t})}},this.fetchQuotes=async(e,t=null,s=null)=>{const a=(0,Y.getBridgeFeatureFlags)(this.messenger),i=await D(this,A,"f").call(this),r=s?a.quoteRequestOverrides?.[s]:undefined,m=await D(this,w,"f").call(this,e),{quotes:u,validationFailures:f}=await(0,Q.fetchBridgeQuotes)(r?{...e,...r,resetApproval:m}:{...e,resetApproval:m},t,D(this,o,"f"),i,D(this,d,"f"),D(this,h,"f").customBridgeApiBaseUrl??F.BRIDGE_PROD_API_BASE_URL,s,D(this,c,"f"));D(this,p,"f").call(this,f);const g=await(0,Z.appendFeesToQuotes)(u,this.messenger,D(this,l,"f"),D(this,n,"m",S).call(this,e.walletAddress));return(0,X.sortQuotes)(g,s)},p.set(this,e=>{0!==e.length&&this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesValidationFailed,{failures:e,location:D(this,r,"f")})}),g.set(this,()=>D(this,f,"f").call(this)?{...this.messenger.call("AssetsController:getExchangeRatesForBridge"),historicalPrices:{},...this.state}:{...this.messenger.call("MultichainAssetsRatesController:getState"),...this.messenger.call("CurrencyRateController:getState"),...this.messenger.call("TokenRatesController:getState"),...this.state}),b.set(this,async({srcChainId:e,srcTokenAddress:t,destChainId:s,destTokenAddress:n})=>{const i=new Set([]),r=D(this,g,"f").call(this);t&&e&&!(0,U.selectIsAssetExchangeRateInState)(r,e,t)&&(0,W.getAssetIdsForToken)(t,e).forEach(e=>i.add(e)),n&&s&&!(0,U.selectIsAssetExchangeRateInState)(r,s,n)&&(0,W.getAssetIdsForToken)(n,s).forEach(e=>i.add(e));const l=D(this,f,"f").call(this)?this.messenger.call("AssetsController:getExchangeRatesForBridge").currentCurrency:this.messenger.call("CurrencyRateController:getState").currentCurrency;if(0===i.size)return;const m=await(0,Q.fetchAssetPrices)({assetIds:i,currencies:new Set([l]),clientId:D(this,o,"f"),clientVersion:D(this,c,"f"),fetchFn:D(this,d,"f"),signal:D(this,a,"f")?.signal}),u=(0,W.toExchangeRates)(l,m);this.update(e=>{e.assetExchangeRates={...e.assetExchangeRates,...u}})}),k.set(this,async e=>{try{const t=(0,K.formatChainIdToHex)(e.srcChainId),s=D(this,n,"m",I).call(this,t)?.provider,a=(0,K.formatAddressToCaipReference)(e.srcTokenAddress);return!(s&&a&&e.srcTokenAmount&&t&&await(0,$.hasSufficientBalance)(s,e.walletAddress,a,e.srcTokenAmount,t))}catch(e){return console.warn("Failed to set insufficientBal",e),!0}}),w.set(this,async e=>{if((0,V.isNonEvmChainId)(e.srcChainId))return!1;try{const t=(0,K.formatAddressToCaipReference)(e.srcTokenAddress);if((0,V.isEthUsdt)(e.srcChainId,t)){const s=N.BigNumber.from(await D(this,j,"f").call(this,e.walletAddress,t,e.destChainId));return s.lt(e.srcTokenAmount)&&s.gt(0)}return!1}catch(e){return console.warn("Failed to set resetApproval",e),!0}}),this.stopPollingForQuotes=(e,t)=>{this.stopAllPolling(),this.state.quotesLoadingStatus===q.RequestStatus.LOADING&&t&&this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesReceived,t),D(this,a,"f")?.abort(e)},this.setLocation=e=>{P(this,r,e,"f")},this.resetState=(e=z.AbortReason.ResetState)=>{this.stopPollingForQuotes(e),this.update(e=>{e.quoteRequest=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,e.quotesInitialLoadTime=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesInitialLoadTime,e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,e.quotesLastFetched=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLastFetched,e.quotesLoadingStatus=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLoadingStatus,e.quoteFetchError=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,e.quotesRefreshCount=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount,e.assetExchangeRates=F.DEFAULT_BRIDGE_CONTROLLER_STATE.assetExchangeRates,e.minimumBalanceForRentExemptionInLamports=F.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports})},this.setChainIntervalLength=()=>{const{state:e}=this,{srcChainId:t}=e.quoteRequest,s=(0,Y.getBridgeFeatureFlags)(this.messenger),n=t?s.chains[(0,K.formatChainIdToCaip)(t)]?.refreshRate:undefined,a=s.refreshRate;this.setIntervalLength(n??a)},_.set(this,async({updatedQuoteRequest:e,context:t})=>{D(this,a,"f")?.abort(z.AbortReason.NewQuoteRequest),P(this,a,new AbortController,"f"),D(this,b,"f").call(this,e).catch(e=>console.warn("Failed to fetch asset exchange rates",e)),this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesRequested,t);const{sse:s,maxRefreshCount:r}=(0,Y.getBridgeFeatureFlags)(this.messenger),o=s?.enabled&&(0,Y.hasMinimumRequiredVersion)(D(this,c,"f"),s.minimumVersion);this.update(t=>{t.quoteRequest=e,t.quoteFetchError=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,t.quotesLastFetched=Date.now(),t.quotesLoadingStatus=q.RequestStatus.LOADING});const l=await D(this,A,"f").call(this);try{await D(this,u,"f").call(this,{name:(0,V.isCrossChain)(e.srcChainId,e.destChainId)?H.TraceName.BridgeQuotesFetched:H.TraceName.SwapQuotesFetched,data:{srcChainId:(0,K.formatChainIdToCaip)(e.srcChainId),destChainId:(0,K.formatChainIdToCaip)(e.destChainId)}},async()=>{const t=D(this,n,"m",S).call(this,e.walletAddress);if(D(this,E,"f").call(this,e.srcChainId,t?.metadata?.snap?.id),o)return void await D(this,T,"f").call(this,e,l,t);const s=await this.fetchQuotes(e,D(this,a,"f")?.signal);this.update(e=>{e.quotesRefreshCount===F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount&&D(this,i,"f")&&(e.quotesInitialLoadTime=Date.now()-D(this,i,"f")),e.quotes=s,e.quotesLoadingStatus=q.RequestStatus.FETCHED})})}catch(e){if(this.update(e=>{e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes}),e.toString().includes("AbortError")||e.toString().includes("FetchRequestCanceledException")||[z.AbortReason.ResetState,z.AbortReason.NewQuoteRequest,z.AbortReason.QuoteRequestUpdated,z.AbortReason.TransactionSubmitted].includes(e))return;this.update(t=>{let s;try{s=e?.message??e.toString()}catch{}finally{t.quoteFetchError=s??"Unknown error"}t.quotesLoadingStatus=q.RequestStatus.ERROR}),this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesError,t),console.log(`Failed to ${o?"stream":"fetch"} bridge quotes`,e)}this.update(e=>{e.quotesRefreshCount+=1}),(e.insufficientBal||!e.insufficientBal&&this.state.quotesRefreshCount>=r)&&this.stopAllPolling()}),T.set(this,async(e,t,s)=>{let n=0;const r=new Set;await(0,Q.fetchBridgeQuoteStream)(D(this,d,"f"),e,D(this,a,"f")?.signal,D(this,o,"f"),t,D(this,h,"f").customBridgeApiBaseUrl??F.BRIDGE_PROD_API_BASE_URL,{onValidationFailure:D(this,p,"f"),onValidQuoteReceived:async e=>{const t=(async()=>{const t=await(0,Z.appendFeesToQuotes)([e],this.messenger,D(this,l,"f"),s);t.length>0&&(n+=1),this.update(e=>{1===n&&(e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,!e.quotesInitialLoadTime&&D(this,i,"f")&&(e.quotesInitialLoadTime=Date.now()-D(this,i,"f"))),e.quotes=[...e.quotes,...t]})})();r.add(t),t.catch(e=>{console.error("Error appending fees to quote",e)}).finally(()=>{r.delete(t)}),await t},onClose:async()=>{await Promise.allSettled(Array.from(r)),this.update(e=>{0===n&&(e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes),e.quotesLoadingStatus=q.RequestStatus.FETCHED})}},D(this,c,"f"))}),E.set(this,async(e,t)=>{if(!(0,V.isSolanaChainId)(e)||!t)return;const s=await(0,ee.getMinimumBalanceForRentExemptionInLamports)(t,this.messenger);this.update(e=>{e.minimumBalanceForRentExemptionInLamports=s})}),A.set(this,async()=>{try{return await this.messenger.call("AuthenticationController:getBearerToken")}catch(e){return console.error("Error getting JWT token for bridge-api request",e),undefined}}),y.set(this,()=>({slippage_limit:this.state.quoteRequest.slippage,swap_type:(0,J.getSwapTypeFromQuote)(this.state.quoteRequest),custom_slippage:(0,J.isCustomSlippage)(this.state.quoteRequest.slippage)})),x.set(this,()=>({quotes_count:this.state.quotes.length,quotes_list:this.state.quotes.map(({quote:e})=>(0,J.formatProviderLabel)(e)),initial_load_time_all_quotes:this.state.quotesInitialLoadTime??0,has_gas_included_quote:this.state.quotes.some(({quote:e})=>e.gasIncluded)})),v.set(this,(e,t)=>{const s=t,a={...t,location:s?.location??D(this,r,"f"),action_type:z.MetricsActionType.SWAPBRIDGE_V1};switch(e){case z.UnifiedSwapBridgeEventName.ButtonClicked:case z.UnifiedSwapBridgeEventName.PageViewed:return{...(0,J.getRequestParams)(this.state.quoteRequest),...a};case z.UnifiedSwapBridgeEventName.QuotesValidationFailed:return{...(0,J.getRequestParams)(this.state.quoteRequest),refresh_count:this.state.quotesRefreshCount,...a};case z.UnifiedSwapBridgeEventName.QuotesReceived:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),...D(this,x,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),refresh_count:this.state.quotesRefreshCount,...a};case z.UnifiedSwapBridgeEventName.QuotesRequested:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...a};case z.UnifiedSwapBridgeEventName.QuotesError:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),error_message:this.state.quoteFetchError,has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...a};case z.UnifiedSwapBridgeEventName.AllQuotesOpened:case z.UnifiedSwapBridgeEventName.AllQuotesSorted:case z.UnifiedSwapBridgeEventName.QuoteSelected:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),...D(this,x,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),...a};case z.UnifiedSwapBridgeEventName.Failed:return{...a,...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),...D(this,x,"f").call(this),...t};case z.UnifiedSwapBridgeEventName.AssetDetailTooltipClicked:case z.UnifiedSwapBridgeEventName.AssetPickerOpened:return a;case z.UnifiedSwapBridgeEventName.Submitted:case z.UnifiedSwapBridgeEventName.Completed:return t;case z.UnifiedSwapBridgeEventName.InputChanged:default:return a}}),C.set(this,e=>{Object.entries(e).forEach(([t,s])=>{const n=J.toInputChangedPropertyKey[t],a=J.toInputChangedPropertyValue[t]?.(e);n&&a!==undefined&&s!==this.state.quoteRequest[t]&&this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.InputChanged,{input:n,input_value:a,location:D(this,r,"f")})})}),this.trackUnifiedSwapBridgeEvent=(e,t)=>{try{const s=D(this,v,"f").call(this,e,t);D(this,m,"f").call(this,e,s)}catch(t){console.error(`Error tracking cross-chain swaps MetaMetrics event ${e}`,t)}},j.set(this,async(e,t,s)=>{const a=D(this,n,"m",I).call(this,B.CHAIN_IDS.MAINNET),i=a?.provider;if(!i)throw new Error("No provider found");const r=new O.Web3Provider(i),o=new R.Contract(t,M.abiERC20,r),c=(0,V.isCrossChain)(B.CHAIN_IDS.MAINNET,s)?F.METABRIDGE_ETHEREUM_ADDRESS:G.SWAPS_CONTRACT_ADDRESSES[B.CHAIN_IDS.MAINNET];return(await o.allowance(e,c)).toString()}),this.setIntervalLength(F.REFRESH_INTERVAL_MS),P(this,a,new AbortController,"f"),P(this,l,se,"f"),P(this,o,s,"f"),P(this,c,L,"f"),P(this,d,ne,"f"),P(this,m,ie,"f"),P(this,h,ae??{},"f"),P(this,u,re??((e,t)=>t?.()),"f"),P(this,f,oe??(()=>!1),"f"),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:setChainIntervalLength`,this.setChainIntervalLength.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:updateBridgeQuoteRequestParams`,this.updateBridgeQuoteRequestParams.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:trackUnifiedSwapBridgeEvent`,this.trackUnifiedSwapBridgeEvent.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:stopPollingForQuotes`,this.stopPollingForQuotes.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:fetchQuotes`,this.fetchQuotes.bind(this))}}s.BridgeController=se,a=new WeakMap,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,b=new WeakMap,k=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,E=new WeakMap,A=new WeakMap,y=new WeakMap,x=new WeakMap,v=new WeakMap,C=new WeakMap,j=new WeakMap,n=new WeakSet,S=function(e){const t=e??this.state.quoteRequest.walletAddress;if(!t)throw new Error("Account address is required");return this.messenger.call("AccountsController:getAccountByAddress",t)},I=function(e){const t=this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);if(!t)throw new Error(`No network client found for chainId: ${e}`);return this.messenger.call("NetworkController:getNetworkClientById",t)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.METABRIDGE_CHAIN_TO_ADDRESS_MAP=s.DEFAULT_BRIDGE_CONTROLLER_STATE=s.DEFAULT_FEATURE_FLAG_CONFIG=s.DEFAULT_CHAIN_RANKING=s.BRIDGE_CONTROLLER_NAME=s.DEFAULT_MAX_REFRESH_COUNT=s.REFRESH_INTERVAL_MS=s.BRIDGE_MM_FEE_RATE=s.BRIDGE_PREFERRED_GAS_ESTIMATE=s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=s.BRIDGE_QUOTE_MAX_ETA_SECONDS=s.METABRIDGE_ETHEREUM_ADDRESS=s.ETH_USDT_ADDRESS=s.BridgeClientId=s.BRIDGE_PROD_API_BASE_URL=s.BRIDGE_DEV_API_BASE_URL=s.ALLOWED_BRIDGE_CHAIN_IDS=void 0;const n=e("@ethersproject/constants"),a=e("@metamask/keyring-api"),i=e("./chains.cjs");var r;s.ALLOWED_BRIDGE_CHAIN_IDS=[i.CHAIN_IDS.MAINNET,i.CHAIN_IDS.BSC,i.CHAIN_IDS.POLYGON,i.CHAIN_IDS.ZKSYNC_ERA,i.CHAIN_IDS.AVALANCHE,i.CHAIN_IDS.OPTIMISM,i.CHAIN_IDS.ARBITRUM,i.CHAIN_IDS.LINEA_MAINNET,i.CHAIN_IDS.BASE,i.CHAIN_IDS.SEI,i.CHAIN_IDS.MONAD,i.CHAIN_IDS.HYPEREVM,i.CHAIN_IDS.MEGAETH,a.SolScope.Mainnet,a.BtcScope.Mainnet,a.TrxScope.Mainnet],s.BRIDGE_DEV_API_BASE_URL="https://bridge.dev-api.cx.metamask.io",s.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(r||(s.BridgeClientId=r={})),s.ETH_USDT_ADDRESS="0xdac17f958d2ee523a2206206994597c13d831ec7",s.METABRIDGE_ETHEREUM_ADDRESS="0x0439e60F02a8900a951603950d8D4527f400C3f1",s.BRIDGE_QUOTE_MAX_ETA_SECONDS=3600,s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=.5,s.BRIDGE_PREFERRED_GAS_ESTIMATE="medium",s.BRIDGE_MM_FEE_RATE=.875,s.REFRESH_INTERVAL_MS=3e4,s.DEFAULT_MAX_REFRESH_COUNT=5,s.BRIDGE_CONTROLLER_NAME="BridgeController",s.DEFAULT_CHAIN_RANKING=[{chainId:"eip155:1",name:"Ethereum"},{chainId:"eip155:56",name:"BNB"},{chainId:"bip122:000000000019d6689c085ae165831e93",name:"BTC"},{chainId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana"},{chainId:"tron:728126428",name:"Tron"},{chainId:"eip155:8453",name:"Base"},{chainId:"eip155:42161",name:"Arbitrum"},{chainId:"eip155:59144",name:"Linea"},{chainId:"eip155:137",name:"Polygon"},{chainId:"eip155:43114",name:"Avalanche"},{chainId:"eip155:10",name:"Optimism"},{chainId:"eip155:143",name:"Monad"},{chainId:"eip155:1329",name:"Sei"},{chainId:"eip155:999",name:"HyperEVM"},{chainId:"eip155:4326",name:"MegaETH"},{chainId:"eip155:324",name:"zkSync"}],s.DEFAULT_FEATURE_FLAG_CONFIG={minimumVersion:"0.0.0",refreshRate:s.REFRESH_INTERVAL_MS,maxRefreshCount:s.DEFAULT_MAX_REFRESH_COUNT,support:!1,chains:{},chainRanking:[...s.DEFAULT_CHAIN_RANKING]},s.DEFAULT_BRIDGE_CONTROLLER_STATE={quoteRequest:{srcTokenAddress:n.AddressZero},quotesInitialLoadTime:null,quotes:[],quotesLastFetched:null,quotesLoadingStatus:null,quoteFetchError:null,quotesRefreshCount:0,assetExchangeRates:{},minimumBalanceForRentExemptionInLamports:"0"},s.METABRIDGE_CHAIN_TO_ADDRESS_MAP={[i.CHAIN_IDS.MAINNET]:s.METABRIDGE_ETHEREUM_ADDRESS}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.NETWORK_TO_NAME_MAP=s.MEGAETH_DISPLAY_NAME=s.HYPEREVM_DISPLAY_NAME=s.MONAD_DISPLAY_NAME=s.SEI_DISPLAY_NAME=s.MODE_DISPLAY_NAME=s.MODE_SEPOLIA_DISPLAY_NAME=s.SONEIUM_DISPLAY_NAME=s.INK_DISPLAY_NAME=s.INK_SEPOLIA_DISPLAY_NAME=s.LISK_SEPOLIA_DISPLAY_NAME=s.LISK_DISPLAY_NAME=s.METACHAIN_ONE_DISPLAY_NAME=s.BERACHAIN_DISPLAY_NAME=s.OP_BNB_DISPLAY_NAME=s.SCROLL_SEPOLIA_DISPLAY_NAME=s.SCROLL_DISPLAY_NAME=s.MOONRIVER_DISPLAY_NAME=s.MOONBEAM_DISPLAY_NAME=s.POLYGON_ZKEVM_DISPLAY_NAME=s.CRONOS_DISPLAY_NAME=s.AURORA_DISPLAY_NAME=s.BASE_DISPLAY_NAME=s.ZK_SYNC_ERA_DISPLAY_NAME=s.GNOSIS_DISPLAY_NAME=s.CELO_DISPLAY_NAME=s.PALM_DISPLAY_NAME=s.HARMONY_DISPLAY_NAME=s.FANTOM_DISPLAY_NAME=s.OPTIMISM_DISPLAY_NAME=s.BNB_DISPLAY_NAME=s.ARBITRUM_DISPLAY_NAME=s.AVALANCHE_DISPLAY_NAME=s.POLYGON_DISPLAY_NAME=s.BSC_DISPLAY_NAME=s.LOCALHOST_DISPLAY_NAME=s.LINEA_MAINNET_DISPLAY_NAME=s.LINEA_SEPOLIA_DISPLAY_NAME=s.LINEA_GOERLI_DISPLAY_NAME=s.SEPOLIA_DISPLAY_NAME=s.GOERLI_DISPLAY_NAME=s.MAINNET_DISPLAY_NAME=s.NETWORK_TYPES=s.CHAIN_IDS=void 0,s.CHAIN_IDS={MAINNET:"0x1",GOERLI:"0x5",LOCALHOST:"0x539",BSC:"0x38",BSC_TESTNET:"0x61",OPTIMISM:"0xa",OPTIMISM_TESTNET:"0xaa37dc",OPTIMISM_GOERLI:"0x1a4",BASE:"0x2105",BASE_TESTNET:"0x14a33",OPBNB:"0xcc",OPBNB_TESTNET:"0x15eb",POLYGON:"0x89",POLYGON_TESTNET:"0x13881",AVALANCHE:"0xa86a",AVALANCHE_TESTNET:"0xa869",FANTOM:"0xfa",FANTOM_TESTNET:"0xfa2",CELO:"0xa4ec",ARBITRUM:"0xa4b1",HARMONY:"0x63564c40",PALM:"0x2a15c308d",SEPOLIA:"0xaa36a7",HOLESKY:"0x4268",LINEA_GOERLI:"0xe704",LINEA_SEPOLIA:"0xe705",AMOY:"0x13882",BASE_SEPOLIA:"0x14a34",BLAST_SEPOLIA:"0xa0c71fd",OPTIMISM_SEPOLIA:"0xaa37dc",PALM_TESTNET:"0x2a15c3083",CELO_TESTNET:"0xaef3",ZK_SYNC_ERA_TESTNET:"0x12c",MANTA_SEPOLIA:"0x138b",UNICHAIN_SEPOLIA:"0x515",LINEA_MAINNET:"0xe708",AURORA:"0x4e454152",MOONBEAM:"0x504",MOONBEAM_TESTNET:"0x507",MOONRIVER:"0x505",CRONOS:"0x19",GNOSIS:"0x64",ZKSYNC_ERA:"0x144",TEST_ETH:"0x539",ARBITRUM_GOERLI:"0x66eed",BLAST:"0x13e31",FILECOIN:"0x13a",POLYGON_ZKEVM:"0x44d",SCROLL:"0x82750",SCROLL_SEPOLIA:"0x8274f",WETHIO:"0x4e",CHZ:"0x15b38",NUMBERS:"0x290b",SEI:"0x531",APE_TESTNET:"0x8157",APE_MAINNET:"0x8173",BERACHAIN:"0x138d5",METACHAIN_ONE:"0x1b6e6",ARBITRUM_SEPOLIA:"0x66eee",NEAR:"0x18d",NEAR_TESTNET:"0x18e",B3:"0x208d",B3_TESTNET:"0x7c9",GRAVITY_ALPHA_MAINNET:"0x659",GRAVITY_ALPHA_TESTNET_SEPOLIA:"0x34c1",LISK:"0x46f",LISK_SEPOLIA:"0x106a",INK_SEPOLIA:"0xba5eD",INK:"0xdef1",MODE_SEPOLIA:"0x397",MODE:"0x868b",MONAD:"0x8f",HYPEREVM:"0x3e7",MEGAETH:"0x10e6"},s.NETWORK_TYPES={GOERLI:"goerli",LOCALHOST:"localhost",MAINNET:"mainnet",SEPOLIA:"sepolia",LINEA_GOERLI:"linea-goerli",LINEA_SEPOLIA:"linea-sepolia",LINEA_MAINNET:"linea-mainnet"},s.MAINNET_DISPLAY_NAME="Ethereum Mainnet",s.GOERLI_DISPLAY_NAME="Goerli",s.SEPOLIA_DISPLAY_NAME="Sepolia",s.LINEA_GOERLI_DISPLAY_NAME="Linea Goerli",s.LINEA_SEPOLIA_DISPLAY_NAME="Linea Sepolia",s.LINEA_MAINNET_DISPLAY_NAME="Linea Mainnet",s.LOCALHOST_DISPLAY_NAME="Localhost 8545",s.BSC_DISPLAY_NAME="Binance Smart Chain",s.POLYGON_DISPLAY_NAME="Polygon",s.AVALANCHE_DISPLAY_NAME="Avalanche Network C-Chain",s.ARBITRUM_DISPLAY_NAME="Arbitrum One",s.BNB_DISPLAY_NAME="BNB Chain",s.OPTIMISM_DISPLAY_NAME="OP Mainnet",s.FANTOM_DISPLAY_NAME="Fantom Opera",s.HARMONY_DISPLAY_NAME="Harmony Mainnet Shard 0",s.PALM_DISPLAY_NAME="Palm",s.CELO_DISPLAY_NAME="Celo Mainnet",s.GNOSIS_DISPLAY_NAME="Gnosis",s.ZK_SYNC_ERA_DISPLAY_NAME="zkSync Era Mainnet",s.BASE_DISPLAY_NAME="Base Mainnet",s.AURORA_DISPLAY_NAME="Aurora Mainnet",s.CRONOS_DISPLAY_NAME="Cronos",s.POLYGON_ZKEVM_DISPLAY_NAME="Polygon zkEVM",s.MOONBEAM_DISPLAY_NAME="Moonbeam",s.MOONRIVER_DISPLAY_NAME="Moonriver",s.SCROLL_DISPLAY_NAME="Scroll",s.SCROLL_SEPOLIA_DISPLAY_NAME="Scroll Sepolia",s.OP_BNB_DISPLAY_NAME="opBNB",s.BERACHAIN_DISPLAY_NAME="Berachain Artio",s.METACHAIN_ONE_DISPLAY_NAME="Metachain One Mainnet",s.LISK_DISPLAY_NAME="Lisk",s.LISK_SEPOLIA_DISPLAY_NAME="Lisk Sepolia",s.INK_SEPOLIA_DISPLAY_NAME="Ink Sepolia",s.INK_DISPLAY_NAME="Ink Mainnet",s.SONEIUM_DISPLAY_NAME="Soneium Mainnet",s.MODE_SEPOLIA_DISPLAY_NAME="Mode Sepolia",s.MODE_DISPLAY_NAME="Mode Mainnet",s.SEI_DISPLAY_NAME="Sei Network",s.MONAD_DISPLAY_NAME="Monad",s.HYPEREVM_DISPLAY_NAME="HyperEVM",s.MEGAETH_DISPLAY_NAME="MegaETH",s.NETWORK_TO_NAME_MAP={[s.NETWORK_TYPES.GOERLI]:s.GOERLI_DISPLAY_NAME,[s.NETWORK_TYPES.MAINNET]:s.MAINNET_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_GOERLI]:s.LINEA_GOERLI_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_SEPOLIA]:s.LINEA_SEPOLIA_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_MAINNET]:s.LINEA_MAINNET_DISPLAY_NAME,[s.NETWORK_TYPES.LOCALHOST]:s.LOCALHOST_DISPLAY_NAME,[s.NETWORK_TYPES.SEPOLIA]:s.SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.ARBITRUM]:s.ARBITRUM_DISPLAY_NAME,[s.CHAIN_IDS.AVALANCHE]:s.AVALANCHE_DISPLAY_NAME,[s.CHAIN_IDS.BSC]:s.BSC_DISPLAY_NAME,[s.CHAIN_IDS.BASE]:s.BASE_DISPLAY_NAME,[s.CHAIN_IDS.GOERLI]:s.GOERLI_DISPLAY_NAME,[s.CHAIN_IDS.MAINNET]:s.MAINNET_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_GOERLI]:s.LINEA_GOERLI_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_MAINNET]:s.LINEA_MAINNET_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_SEPOLIA]:s.LINEA_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.LOCALHOST]:s.LOCALHOST_DISPLAY_NAME,[s.CHAIN_IDS.OPTIMISM]:s.OPTIMISM_DISPLAY_NAME,[s.CHAIN_IDS.POLYGON]:s.POLYGON_DISPLAY_NAME,[s.CHAIN_IDS.SCROLL]:s.SCROLL_DISPLAY_NAME,[s.CHAIN_IDS.SCROLL_SEPOLIA]:s.SCROLL_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.SEPOLIA]:s.SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.OPBNB]:s.OP_BNB_DISPLAY_NAME,[s.CHAIN_IDS.ZKSYNC_ERA]:s.ZK_SYNC_ERA_DISPLAY_NAME,[s.CHAIN_IDS.BERACHAIN]:s.BERACHAIN_DISPLAY_NAME,[s.CHAIN_IDS.METACHAIN_ONE]:s.METACHAIN_ONE_DISPLAY_NAME,[s.CHAIN_IDS.LISK]:s.LISK_DISPLAY_NAME,[s.CHAIN_IDS.LISK_SEPOLIA]:s.LISK_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.SEI]:s.SEI_DISPLAY_NAME,[s.CHAIN_IDS.MONAD]:s.MONAD_DISPLAY_NAME,[s.CHAIN_IDS.HYPEREVM]:s.HYPEREVM_DISPLAY_NAME,[s.CHAIN_IDS.MEGAETH]:s.MEGAETH_DISPLAY_NAME}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ALLOWED_CONTRACT_ADDRESSES=s.SWAPS_WRAPPED_TOKENS_ADDRESSES=s.SWAPS_CONTRACT_ADDRESSES=s.SWAPS_API_V2_BASE_URL=void 0;const n=e("./chains.cjs");s.SWAPS_API_V2_BASE_URL="https://swap.api.cx.metamask.io";const a="0x881d40237659c251811cec9c364ef91dc08d300c";s.SWAPS_CONTRACT_ADDRESSES={[n.CHAIN_IDS.MAINNET]:a,[n.CHAIN_IDS.LOCALHOST]:a,[n.CHAIN_IDS.BSC]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.POLYGON]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.AVALANCHE]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.ARBITRUM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.OPTIMISM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.ZKSYNC_ERA]:"0xf504c1fe13d14df615e66dcd0abf39e60c697f34",[n.CHAIN_IDS.LINEA_MAINNET]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.BASE]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.SEI]:"0x962287c9d5B8a682389E61edAE90ec882325d08b"};const i="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";s.SWAPS_WRAPPED_TOKENS_ADDRESSES={[n.CHAIN_IDS.MAINNET]:i,[n.CHAIN_IDS.LOCALHOST]:i,[n.CHAIN_IDS.BSC]:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",[n.CHAIN_IDS.POLYGON]:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",[n.CHAIN_IDS.AVALANCHE]:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",[n.CHAIN_IDS.ARBITRUM]:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",[n.CHAIN_IDS.OPTIMISM]:"0x4200000000000000000000000000000000000006",[n.CHAIN_IDS.ZKSYNC_ERA]:"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",[n.CHAIN_IDS.LINEA_MAINNET]:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",[n.CHAIN_IDS.BASE]:"0x4200000000000000000000000000000000000006",[n.CHAIN_IDS.SEI]:"0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7"},s.ALLOWED_CONTRACT_ADDRESSES={[n.CHAIN_IDS.MAINNET]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.MAINNET],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.MAINNET]],[n.CHAIN_IDS.LOCALHOST]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.LOCALHOST],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.LOCALHOST]],[n.CHAIN_IDS.BSC]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.BSC],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.BSC]],[n.CHAIN_IDS.POLYGON]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.POLYGON],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.POLYGON]],[n.CHAIN_IDS.AVALANCHE]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.AVALANCHE],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.AVALANCHE]],[n.CHAIN_IDS.ARBITRUM]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.ARBITRUM],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.ARBITRUM]],[n.CHAIN_IDS.OPTIMISM]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.OPTIMISM],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.OPTIMISM]],[n.CHAIN_IDS.ZKSYNC_ERA]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.ZKSYNC_ERA],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.ZKSYNC_ERA]],[n.CHAIN_IDS.LINEA_MAINNET]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.LINEA_MAINNET],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.LINEA_MAINNET]],[n.CHAIN_IDS.BASE]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.BASE],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.BASE]],[n.CHAIN_IDS.SEI]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.SEI],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.SEI]]}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SYMBOL_TO_SLIP44_MAP=s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=s.DEFAULT_TOKEN_ADDRESS=void 0;const n=e("@metamask/keyring-api"),a=e("./chains.cjs");s.DEFAULT_TOKEN_ADDRESS="0x0000000000000000000000000000000000000000";const i="AVAX",r="BNB",o="ETH",c="POL",l="TESTETH",d="SOL",m="SEI",u="BTC",h="TRX",f="MON",p="HYPE",g={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},b={symbol:r,name:"Binance Coin",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},k={symbol:c,name:"Polygon",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},w={symbol:i,name:"Avalanche",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},_={symbol:l,name:"Test Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},T={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},E={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},S={...g},I={...g},A={...g},y={...g},x={...g},v={symbol:d,name:"Solana",address:s.DEFAULT_TOKEN_ADDRESS,decimals:9,iconUrl:""},C={symbol:u,name:"Bitcoin",address:s.DEFAULT_TOKEN_ADDRESS,decimals:8,iconUrl:""},j={symbol:m,name:"Sei",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},P={symbol:h,name:"Tron",address:s.DEFAULT_TOKEN_ADDRESS,decimals:6,iconUrl:""},D={symbol:f,name:"Mon",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},N={symbol:p,name:"Hyperliquid",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},R={...g};s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP={[a.CHAIN_IDS.MAINNET]:g,[a.CHAIN_IDS.LOCALHOST]:_,[a.CHAIN_IDS.BSC]:b,[a.CHAIN_IDS.POLYGON]:k,[a.CHAIN_IDS.GOERLI]:T,[a.CHAIN_IDS.SEPOLIA]:E,[a.CHAIN_IDS.AVALANCHE]:w,[a.CHAIN_IDS.OPTIMISM]:I,[a.CHAIN_IDS.ARBITRUM]:S,[a.CHAIN_IDS.ZKSYNC_ERA]:A,[a.CHAIN_IDS.LINEA_MAINNET]:y,[a.CHAIN_IDS.BASE]:x,[a.CHAIN_IDS.SEI]:j,[a.CHAIN_IDS.MONAD]:D,[a.CHAIN_IDS.HYPEREVM]:N,[a.CHAIN_IDS.MEGAETH]:R,[n.SolScope.Mainnet]:v,[n.SolScope.Devnet]:v,[n.BtcScope.Mainnet]:C,[n.TrxScope.Mainnet]:P},s.SYMBOL_TO_SLIP44_MAP={SOL:"slip44:501",BTC:"slip44:0",ETH:"slip44:60",POL:"slip44:966",BNB:"slip44:714",AVAX:"slip44:9005",TESTETH:"slip44:60",SEI:"slip44:19000118",TRX:"slip44:195",MON:"slip44:268435779",HYPE:"slip44:2457"}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=void 0,function(e){e.BridgeQuotesFetched="Bridge Quotes Fetched",e.SwapQuotesFetched="Swap Quotes Fetched"}(n||(s.TraceName=n={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs",{"./bridge-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs","./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","./utils/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs","./utils/trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./utils/validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isNonEvmChainId=s.isTronChainId=s.isBitcoinChainId=s.isSolanaChainId=s.isNativeAddress=s.isEthUsdt=s.MetricsSwapType=s.MetricsActionType=s.ALLOWED_CONTRACT_ADDRESSES=s.SWAPS_WRAPPED_TOKENS_ADDRESSES=s.SWAPS_CONTRACT_ADDRESSES=s.SWAPS_API_V2_BASE_URL=s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=s.BRIDGE_PROD_API_BASE_URL=s.BRIDGE_DEV_API_BASE_URL=s.METABRIDGE_CHAIN_TO_ADDRESS_MAP=s.DEFAULT_BRIDGE_CONTROLLER_STATE=s.DEFAULT_MAX_REFRESH_COUNT=s.REFRESH_INTERVAL_MS=s.BRIDGE_MM_FEE_RATE=s.BRIDGE_PREFERRED_GAS_ESTIMATE=s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=s.BRIDGE_QUOTE_MAX_ETA_SECONDS=s.BRIDGE_CONTROLLER_NAME=s.BridgeClientId=s.ALLOWED_BRIDGE_CHAIN_IDS=s.FeatureId=s.BridgeAssetSchema=s.ActionTypes=s.FeeType=s.BridgeBackgroundAction=s.BridgeUserAction=s.RequestStatus=s.ChainId=s.SortOrder=s.AssetType=s.StatusTypes=s.AbortReason=s.getQuotesReceivedProperties=s.isCustomSlippage=s.isHardwareWallet=s.getSwapType=s.getRequestParams=s.formatProviderLabel=s.PollingStatus=s.MetaMetricsSwapsEventSource=s.InputAmountPreset=s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=s.UnifiedSwapBridgeEventName=s.BridgeController=void 0,s.fetchTokens=s.getSwapsContractAddress=s.isValidSwapsContractAddress=s.BRIDGE_DEFAULT_SLIPPAGE=s.getBridgeFeatureFlags=s.DEFAULT_FEATURE_FLAG_CONFIG=s.selectMinimumBalanceForRentExemptionInSOL=s.selectBridgeFeatureFlags=s.selectIsQuoteExpired=s.selectExchangeRateByChainIdAndAddress=s.selectDefaultSlippagePercentage=s.selectBridgeQuotes=s.isEvmTxData=s.isTronTrade=s.isBitcoinTrade=s.extractTradeData=s.formatAddressToAssetId=s.formatAddressToCaipReference=s.formatChainIdToHex=s.formatChainIdToCaip=s.getClientHeaders=s.fetchBridgeTokens=s.calcLatestSrcBalance=s.calcSlippagePercentage=s.formatEtaInMinutes=s.isValidQuoteRequest=s.isCrossChain=s.getDefaultBridgeControllerState=s.getNativeAssetForChainId=void 0;var n=e("./bridge-controller.cjs");Object.defineProperty(s,"BridgeController",{enumerable:!0,get:function(){return n.BridgeController}});var a=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"UnifiedSwapBridgeEventName",{enumerable:!0,get:function(){return a.UnifiedSwapBridgeEventName}}),Object.defineProperty(s,"UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY",{enumerable:!0,get:function(){return a.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY}}),Object.defineProperty(s,"InputAmountPreset",{enumerable:!0,get:function(){return a.InputAmountPreset}}),Object.defineProperty(s,"MetaMetricsSwapsEventSource",{enumerable:!0,get:function(){return a.MetaMetricsSwapsEventSource}}),Object.defineProperty(s,"PollingStatus",{enumerable:!0,get:function(){return a.PollingStatus}});var i=e("./utils/metrics/properties.cjs");Object.defineProperty(s,"formatProviderLabel",{enumerable:!0,get:function(){return i.formatProviderLabel}}),Object.defineProperty(s,"getRequestParams",{enumerable:!0,get:function(){return i.getRequestParams}}),Object.defineProperty(s,"getSwapType",{enumerable:!0,get:function(){return i.getSwapType}}),Object.defineProperty(s,"isHardwareWallet",{enumerable:!0,get:function(){return i.isHardwareWallet}}),Object.defineProperty(s,"isCustomSlippage",{enumerable:!0,get:function(){return i.isCustomSlippage}}),Object.defineProperty(s,"getQuotesReceivedProperties",{enumerable:!0,get:function(){return i.getQuotesReceivedProperties}});var r=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"AbortReason",{enumerable:!0,get:function(){return r.AbortReason}});var o=e("./types.cjs");Object.defineProperty(s,"StatusTypes",{enumerable:!0,get:function(){return o.StatusTypes}});var c=e("./types.cjs");Object.defineProperty(s,"AssetType",{enumerable:!0,get:function(){return c.AssetType}}),Object.defineProperty(s,"SortOrder",{enumerable:!0,get:function(){return c.SortOrder}}),Object.defineProperty(s,"ChainId",{enumerable:!0,get:function(){return c.ChainId}}),Object.defineProperty(s,"RequestStatus",{enumerable:!0,get:function(){return c.RequestStatus}}),Object.defineProperty(s,"BridgeUserAction",{enumerable:!0,get:function(){return c.BridgeUserAction}}),Object.defineProperty(s,"BridgeBackgroundAction",{enumerable:!0,get:function(){return c.BridgeBackgroundAction}});var l=e("./utils/validators.cjs");Object.defineProperty(s,"FeeType",{enumerable:!0,get:function(){return l.FeeType}}),Object.defineProperty(s,"ActionTypes",{enumerable:!0,get:function(){return l.ActionTypes}}),Object.defineProperty(s,"BridgeAssetSchema",{enumerable:!0,get:function(){return l.BridgeAssetSchema}}),Object.defineProperty(s,"FeatureId",{enumerable:!0,get:function(){return l.FeatureId}});var d=e("./constants/bridge.cjs");Object.defineProperty(s,"ALLOWED_BRIDGE_CHAIN_IDS",{enumerable:!0,get:function(){return d.ALLOWED_BRIDGE_CHAIN_IDS}}),Object.defineProperty(s,"BridgeClientId",{enumerable:!0,get:function(){return d.BridgeClientId}}),Object.defineProperty(s,"BRIDGE_CONTROLLER_NAME",{enumerable:!0,get:function(){return d.BRIDGE_CONTROLLER_NAME}}),Object.defineProperty(s,"BRIDGE_QUOTE_MAX_ETA_SECONDS",{enumerable:!0,get:function(){return d.BRIDGE_QUOTE_MAX_ETA_SECONDS}}),Object.defineProperty(s,"BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE",{enumerable:!0,get:function(){return d.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE}}),Object.defineProperty(s,"BRIDGE_PREFERRED_GAS_ESTIMATE",{enumerable:!0,get:function(){return d.BRIDGE_PREFERRED_GAS_ESTIMATE}}),Object.defineProperty(s,"BRIDGE_MM_FEE_RATE",{enumerable:!0,get:function(){return d.BRIDGE_MM_FEE_RATE}}),Object.defineProperty(s,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return d.REFRESH_INTERVAL_MS}}),Object.defineProperty(s,"DEFAULT_MAX_REFRESH_COUNT",{enumerable:!0,get:function(){return d.DEFAULT_MAX_REFRESH_COUNT}}),Object.defineProperty(s,"DEFAULT_BRIDGE_CONTROLLER_STATE",{enumerable:!0,get:function(){return d.DEFAULT_BRIDGE_CONTROLLER_STATE}}),Object.defineProperty(s,"METABRIDGE_CHAIN_TO_ADDRESS_MAP",{enumerable:!0,get:function(){return d.METABRIDGE_CHAIN_TO_ADDRESS_MAP}}),Object.defineProperty(s,"BRIDGE_DEV_API_BASE_URL",{enumerable:!0,get:function(){return d.BRIDGE_DEV_API_BASE_URL}}),Object.defineProperty(s,"BRIDGE_PROD_API_BASE_URL",{enumerable:!0,get:function(){return d.BRIDGE_PROD_API_BASE_URL}});var m=e("./constants/tokens.cjs");Object.defineProperty(s,"SWAPS_CHAINID_DEFAULT_TOKEN_MAP",{enumerable:!0,get:function(){return m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP}});var u=e("./constants/swaps.cjs");Object.defineProperty(s,"SWAPS_API_V2_BASE_URL",{enumerable:!0,get:function(){return u.SWAPS_API_V2_BASE_URL}}),Object.defineProperty(s,"SWAPS_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return u.SWAPS_CONTRACT_ADDRESSES}}),Object.defineProperty(s,"SWAPS_WRAPPED_TOKENS_ADDRESSES",{enumerable:!0,get:function(){return u.SWAPS_WRAPPED_TOKENS_ADDRESSES}}),Object.defineProperty(s,"ALLOWED_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return u.ALLOWED_CONTRACT_ADDRESSES}});var h=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"MetricsActionType",{enumerable:!0,get:function(){return h.MetricsActionType}}),Object.defineProperty(s,"MetricsSwapType",{enumerable:!0,get:function(){return h.MetricsSwapType}});var f=e("./utils/bridge.cjs");Object.defineProperty(s,"isEthUsdt",{enumerable:!0,get:function(){return f.isEthUsdt}}),Object.defineProperty(s,"isNativeAddress",{enumerable:!0,get:function(){return f.isNativeAddress}}),Object.defineProperty(s,"isSolanaChainId",{enumerable:!0,get:function(){return f.isSolanaChainId}}),Object.defineProperty(s,"isBitcoinChainId",{enumerable:!0,get:function(){return f.isBitcoinChainId}}),Object.defineProperty(s,"isTronChainId",{enumerable:!0,get:function(){return f.isTronChainId}}),Object.defineProperty(s,"isNonEvmChainId",{enumerable:!0,get:function(){return f.isNonEvmChainId}}),Object.defineProperty(s,"getNativeAssetForChainId",{enumerable:!0,get:function(){return f.getNativeAssetForChainId}}),Object.defineProperty(s,"getDefaultBridgeControllerState",{enumerable:!0,get:function(){return f.getDefaultBridgeControllerState}}),Object.defineProperty(s,"isCrossChain",{enumerable:!0,get:function(){return f.isCrossChain}});var p=e("./utils/quote.cjs");Object.defineProperty(s,"isValidQuoteRequest",{enumerable:!0,get:function(){return p.isValidQuoteRequest}}),Object.defineProperty(s,"formatEtaInMinutes",{enumerable:!0,get:function(){return p.formatEtaInMinutes}}),Object.defineProperty(s,"calcSlippagePercentage",{enumerable:!0,get:function(){return p.calcSlippagePercentage}});var g=e("./utils/balance.cjs");Object.defineProperty(s,"calcLatestSrcBalance",{enumerable:!0,get:function(){return g.calcLatestSrcBalance}});var b=e("./utils/fetch.cjs");Object.defineProperty(s,"fetchBridgeTokens",{enumerable:!0,get:function(){return b.fetchBridgeTokens}}),Object.defineProperty(s,"getClientHeaders",{enumerable:!0,get:function(){return b.getClientHeaders}});var k=e("./utils/caip-formatters.cjs");Object.defineProperty(s,"formatChainIdToCaip",{enumerable:!0,get:function(){return k.formatChainIdToCaip}}),Object.defineProperty(s,"formatChainIdToHex",{enumerable:!0,get:function(){return k.formatChainIdToHex}}),Object.defineProperty(s,"formatAddressToCaipReference",{enumerable:!0,get:function(){return k.formatAddressToCaipReference}}),Object.defineProperty(s,"formatAddressToAssetId",{enumerable:!0,get:function(){return k.formatAddressToAssetId}});var w=e("./utils/trade-utils.cjs");Object.defineProperty(s,"extractTradeData",{enumerable:!0,get:function(){return w.extractTradeData}}),Object.defineProperty(s,"isBitcoinTrade",{enumerable:!0,get:function(){return w.isBitcoinTrade}}),Object.defineProperty(s,"isTronTrade",{enumerable:!0,get:function(){return w.isTronTrade}}),Object.defineProperty(s,"isEvmTxData",{enumerable:!0,get:function(){return w.isEvmTxData}});var _=e("./selectors.cjs");Object.defineProperty(s,"selectBridgeQuotes",{enumerable:!0,get:function(){return _.selectBridgeQuotes}}),Object.defineProperty(s,"selectDefaultSlippagePercentage",{enumerable:!0,get:function(){return _.selectDefaultSlippagePercentage}}),Object.defineProperty(s,"selectExchangeRateByChainIdAndAddress",{enumerable:!0,get:function(){return _.selectExchangeRateByChainIdAndAddress}}),Object.defineProperty(s,"selectIsQuoteExpired",{enumerable:!0,get:function(){return _.selectIsQuoteExpired}}),Object.defineProperty(s,"selectBridgeFeatureFlags",{enumerable:!0,get:function(){return _.selectBridgeFeatureFlags}}),Object.defineProperty(s,"selectMinimumBalanceForRentExemptionInSOL",{enumerable:!0,get:function(){return _.selectMinimumBalanceForRentExemptionInSOL}});var T=e("./constants/bridge.cjs");Object.defineProperty(s,"DEFAULT_FEATURE_FLAG_CONFIG",{enumerable:!0,get:function(){return T.DEFAULT_FEATURE_FLAG_CONFIG}});var E=e("./utils/feature-flags.cjs");Object.defineProperty(s,"getBridgeFeatureFlags",{enumerable:!0,get:function(){return E.getBridgeFeatureFlags}});var S=e("./utils/slippage.cjs");Object.defineProperty(s,"BRIDGE_DEFAULT_SLIPPAGE",{enumerable:!0,get:function(){return S.BRIDGE_DEFAULT_SLIPPAGE}});var I=e("./utils/swaps.cjs");Object.defineProperty(s,"isValidSwapsContractAddress",{enumerable:!0,get:function(){return I.isValidSwapsContractAddress}}),Object.defineProperty(s,"getSwapsContractAddress",{enumerable:!0,get:function(){return I.getSwapsContractAddress}}),Object.defineProperty(s,"fetchTokens",{enumerable:!0,get:function(){return I.fetchTokens}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",reselect:"/home/runner/work/metamask-extension/metamask-extension/node_modules/reselect/dist/cjs/reselect.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.selectDefaultSlippagePercentage=s.selectMinimumBalanceForRentExemptionInSOL=s.selectBridgeQuotes=s.selectIsQuoteExpired=s.selectIsAssetExchangeRateInState=s.selectExchangeRateByChainIdAndAddress=s.selectBridgeFeatureFlags=void 0;const n=e("@ethersproject/constants"),a=e("@metamask/utils"),i=e("bignumber.js"),r=e("lodash"),o=e("reselect"),c=e("./constants/bridge.cjs"),l=e("./types.cjs"),d=e("./utils/bridge.cjs"),m=e("./utils/caip-formatters.cjs"),u=e("./utils/feature-flags.cjs"),h=e("./utils/quote.cjs"),f=e("./utils/slippage.cjs"),p=o.createStructuredSelector.withTypes(),g=o.createSelector.withTypes(),b=o.createSelector.withTypes();s.selectBridgeFeatureFlags=b([e=>e.remoteFeatureFlags.bridgeConfig],e=>(0,u.processFeatureFlags)(e));const k=(e,t,s)=>{if(!t)return{};const n=(0,m.formatAddressToCaipReference)(s??""),r=(0,m.formatAddressToAssetId)(n,t);if(!r)return{};const{assetExchangeRates:o,currencyRates:c,marketData:l,conversionRates:u}=e,h=o?.[r.toLowerCase()]??o?.[r];if(h?.exchangeRate&&h?.usdExchangeRate)return h;if((0,d.isNonEvmChainId)(t)){const e=u,t=e?.[r],s=t?.rate;if(s){const e=Object.values(c??{}).find(e=>e?.conversionRate!==undefined&&null!==e?.conversionRate&&e?.usdConversionRate!==undefined&&null!==e?.usdConversionRate),t=e?.conversionRate!==undefined&&null!==e?.conversionRate&&e?.usdConversionRate!==undefined&&null!==e?.usdConversionRate?new i.BigNumber(e.usdConversionRate).div(e.conversionRate):undefined;return{exchangeRate:s,usdExchangeRate:t?new i.BigNumber(s).times(t).toString():undefined}}return{}}if((0,d.isNativeAddress)(n)){const{symbol:e}=(0,d.getNativeAssetForChainId)(t),s=c?.[e];return s?{exchangeRate:s.conversionRate?.toString(),usdExchangeRate:s.usdConversionRate?.toString()}:{}}if(!(0,d.isNonEvmChainId)(t)){const e=(l??{})[(0,m.formatChainIdToHex)(t)],s=(0,a.isStrictHexString)(n)?e?.[n]:null,r=s?.currency,o=r!==undefined&&null!==r?c?.[r]:undefined,d=s?.price??0;if(s&&o)return{exchangeRate:new i.BigNumber(d).multipliedBy(o.conversionRate??0).toString(),usdExchangeRate:new i.BigNumber(d).multipliedBy(o.usdConversionRate??0).toString()}}return{}};s.selectExchangeRateByChainIdAndAddress=(e,t,s)=>k(e,t,s);s.selectIsAssetExchangeRateInState=(...e)=>Boolean(k(...e)?.exchangeRate)&&Boolean(k(...e)?.usdExchangeRate);const w=g([e=>e.gasFeeEstimatesByChainId,e=>e.quotes?.[0]?.quote.srcChainId],(e,t)=>{if(!t)return null;if((0,d.isNonEvmChainId)(t))return null;const s=e?.[(0,m.formatChainIdToHex)(t)]?.gasFeeEstimates;return s?{estimatedBaseFeeInDecGwei:s.estimatedBaseFee,feePerGasInDecGwei:s[c.BRIDGE_PREFERRED_GAS_ESTIMATE]?.suggestedMaxFeePerGas,maxFeePerGasInDecGwei:s.high?.suggestedMaxFeePerGas}:null}),_=g([({quotes:e})=>e,w,g([e=>e,({quoteRequest:{srcChainId:e}})=>e,({quoteRequest:{srcTokenAddress:e}})=>e],s.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{destChainId:e}})=>e,({quoteRequest:{destTokenAddress:e}})=>e],s.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{srcChainId:e}})=>e],(e,t)=>(0,s.selectExchangeRateByChainIdAndAddress)(e,t,n.AddressZero))],(e,t,s,n,a)=>e.map(e=>{const i=(0,h.calcSentAmount)(e.quote,s),r=(0,h.calcToAmount)(e.quote.destTokenAmount,e.quote.destAsset,n),o=(0,h.calcToAmount)(e.quote.minDestTokenAmount,e.quote.destAsset,n),c=(0,h.calcIncludedTxFees)(e.quote,s,n);let l,m,u,f;(0,d.isEvmQuoteResponse)(e)?(u=(0,h.calcRelayerFee)(e,a),f=(0,h.calcEstimatedAndMaxTotalGasFee)({bridgeQuote:e,...t,...a}),l=(0,h.calcTotalEstimatedNetworkFee)(f,u),m=(0,h.calcTotalMaxNetworkFee)(f,u)):(l=(0,h.calcNonEvmTotalNetworkFee)(e,a),f={effective:l,total:l,max:l},m=l);const p=(0,h.calcAdjustedReturn)(r,l,e.quote),g=(0,h.calcCost)(p,i);return{...e,sentAmount:i,toTokenAmount:r,minToTokenAmount:o,swapRate:(0,h.calcSwapRate)(i.amount,r.amount),totalNetworkFee:l,totalMaxNetworkFee:m,gasFee:f,adjustedReturn:p,cost:g,includedTxFees:c}})),T=g([_,(e,{sortOrder:t})=>t],(e,t)=>t===l.SortOrder.ETA_ASC?(0,r.orderBy)(e,e=>e.estimatedProcessingTimeInSeconds,"asc"):e.every(e=>e.cost.valueInCurrency)?(0,r.orderBy)(e,({cost:e})=>Number(e.valueInCurrency),"asc"):e.every(e=>e.quote.priceData?.priceImpact)?(0,r.orderBy)(e,({quote:e})=>Number(e.priceData?.priceImpact),"asc"):(0,r.orderBy)(e,({quote:e})=>Number(e.destTokenAmount),"desc")),E=g([T],e=>e.length>0?e[0]:null),S=g([E,T,(e,{selectedQuote:t})=>t],(e,t,s)=>t.find(e=>e.quote.requestId===s?.quote.requestId)??e),I=g([s.selectBridgeFeatureFlags,e=>e.quoteRequest.insufficientBal,e=>e.quotesRefreshCount],(e,t,s)=>!t&&e.maxRefreshCount>s),A=g([s.selectBridgeFeatureFlags,e=>e.quoteRequest.srcChainId],(e,t)=>(t?e.chains[(0,m.formatChainIdToCaip)(t)]?.refreshRate:e.refreshRate)??e.refreshRate);s.selectIsQuoteExpired=g([I,({quotesLastFetched:e})=>e,A,(e,t,s)=>s],(e,t,s,n)=>Boolean(!e&&t&&n-t>s)),s.selectBridgeQuotes=p({sortedQuotes:T,recommendedQuote:E,activeQuote:S,quotesLastFetchedMs:e=>e.quotesLastFetched,isLoading:e=>e.quotesLoadingStatus===l.RequestStatus.LOADING,quoteFetchError:e=>e.quoteFetchError,quotesRefreshCount:e=>e.quotesRefreshCount,quotesInitialLoadTimeMs:e=>e.quotesInitialLoadTime,isQuoteGoingToRefresh:I});s.selectMinimumBalanceForRentExemptionInSOL=e=>new i.BigNumber(e.minimumBalanceForRentExemptionInLamports??0).div(10**9).toString(),s.selectDefaultSlippagePercentage=g([e=>(0,s.selectBridgeFeatureFlags)(e).chains,(e,t)=>t.srcTokenAddress,(e,t)=>t.destTokenAddress,(e,t)=>t.srcChainId?(0,m.formatChainIdToCaip)(t.srcChainId):undefined,(e,t)=>t.destChainId?(0,m.formatChainIdToCaip)(t.destChainId):undefined],(e,t,s,n,a)=>(0,f.getDefaultSlippagePercentage)({srcTokenAddress:t,destTokenAddress:s,srcChainId:n,destChainId:a},n?e[n]?.stablecoins:undefined,a?e[a]?.stablecoins:undefined))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l;Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeBackgroundAction=s.BridgeUserAction=s.RequestStatus=s.ChainId=s.StatusTypes=s.SortOrder=s.AssetType=void 0,function(e){e.native="NATIVE",e.token="TOKEN",e.NFT="NFT",e.unknown="UNKNOWN"}(n||(s.AssetType=n={})),function(e){e.COST_ASC="cost_ascending",e.ETA_ASC="time_descending"}(a||(s.SortOrder=a={})),function(e){e.SUBMITTED="SUBMITTED",e.UNKNOWN="UNKNOWN",e.FAILED="FAILED",e.PENDING="PENDING",e.COMPLETE="COMPLETE"}(i||(s.StatusTypes=i={})),function(e){e[e.ETH=1]="ETH",e[e.OPTIMISM=10]="OPTIMISM",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ZKSYNC=324]="ZKSYNC",e[e.BASE=8453]="BASE",e[e.ARBITRUM=42161]="ARBITRUM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.LINEA=59144]="LINEA",e[e.SOLANA=0x416edef1601be]="SOLANA",e[e.BTC=20000000000001]="BTC",e[e.TRON=728126428]="TRON",e[e.SEI=1329]="SEI",e[e.MONAD=143]="MONAD",e[e.HYPEREVM=999]="HYPEREVM",e[e.MEGAETH=4326]="MEGAETH"}(r||(s.ChainId=r={})),function(e){e[e.LOADING=0]="LOADING",e[e.FETCHED=1]="FETCHED",e[e.ERROR=2]="ERROR"}(o||(s.RequestStatus=o={})),function(e){e.SELECT_DEST_NETWORK="selectDestNetwork",e.UPDATE_QUOTE_PARAMS="updateBridgeQuoteRequestParams"}(c||(s.BridgeUserAction=c={})),function(e){e.SET_CHAIN_INTERVAL_LENGTH="setChainIntervalLength",e.RESET_STATE="resetState",e.TRACK_METAMETRICS_EVENT="trackUnifiedSwapBridgeEvent",e.STOP_POLLING_FOR_QUOTES="stopPollingForQuotes",e.FETCH_QUOTES="fetchQuotes"}(l||(s.BridgeBackgroundAction=l={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.toExchangeRates=s.getAssetIdsForToken=void 0;const n=e("./bridge.cjs"),a=e("./caip-formatters.cjs");s.getAssetIdsForToken=(e,t)=>{const s=[],i=(0,a.formatAddressToAssetId)(e,t);return i&&(s.push(i),(0,n.getNativeAssetForChainId)(t)?.assetId&&s.push((0,n.getNativeAssetForChainId)(t).assetId)),s};s.toExchangeRates=(e,t)=>Object.entries(t).reduce((t,[s,n])=>(n&&(t[s]={exchangeRate:n[e],usdExchangeRate:n.usd}),t),{})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hasSufficientBalance=s.calcLatestSrcBalance=s.fetchTokenBalance=void 0;const n=e("@ethersproject/address"),a=e("@ethersproject/contracts"),i=e("@ethersproject/providers"),r=e("@metamask/metamask-eth-abis"),o=e("./bridge.cjs");s.fetchTokenBalance=async(e,t,s)=>{const n=new i.Web3Provider(s),o=new a.Contract(e,r.abiERC20,n),c="function"==typeof o?.balanceOf?o.balanceOf(t):Promise.resolve(undefined);return await c};s.calcLatestSrcBalance=async(e,t,a,r)=>{if(a&&r){if((0,o.isNativeAddress)(a)){const s=new i.Web3Provider(e);return await s.getBalance((0,n.getAddress)(t))}return await(0,s.fetchTokenBalance)(a,t,e)}return undefined};s.hasSufficientBalance=async(e,t,n,a,i)=>{const r=await(0,s.calcLatestSrcBalance)(e,t,n,i);return!!r&&r.gte(a)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isEvmQuoteResponse=s.isNonEvmChainId=s.isTronChainId=s.isBitcoinChainId=s.isSolanaChainId=s.isNativeAddress=s.isSwapsDefaultTokenSymbol=s.isSwapsDefaultTokenAddress=s.sumHexes=s.isEthUsdt=s.getEthUsdtResetData=s.getNativeAssetForChainId=s.getDefaultBridgeControllerState=s.isCrossChain=void 0;const n=e("@ethersproject/constants"),a=e("@ethersproject/contracts"),i=e("@metamask/keyring-api"),r=e("@metamask/metamask-eth-abis"),o=e("@metamask/utils"),c=e("./caip-formatters.cjs"),l=e("../constants/bridge.cjs"),d=e("../constants/chains.cjs"),m=e("../constants/swaps.cjs"),u=e("../constants/tokens.cjs"),h=e("../types.cjs");s.isCrossChain=(e,t)=>{try{return!!t&&(0,c.formatChainIdToCaip)(e)!==(0,c.formatChainIdToCaip)(t)}catch{return!1}};s.getDefaultBridgeControllerState=()=>l.DEFAULT_BRIDGE_CONTROLLER_STATE;const f=(e,t)=>`${(0,c.formatChainIdToCaip)(e)}/${u.SYMBOL_TO_SLIP44_MAP[t]}`;s.getNativeAssetForChainId=e=>{const t=(0,c.formatChainIdToCaip)(e),s=u.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToCaip)(e)]??u.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToHex)(e)];if(!s)throw new Error(`No XChain Swaps native asset found for chainId: ${e}`);return{...s,chainId:(0,c.formatChainIdToDec)(e),assetId:f(t,s.symbol)}};s.getEthUsdtResetData=e=>{const t=(0,s.isCrossChain)(d.CHAIN_IDS.MAINNET,e)?l.METABRIDGE_ETHEREUM_ADDRESS:m.SWAPS_CONTRACT_ADDRESSES[d.CHAIN_IDS.MAINNET];return new a.Contract(l.ETH_USDT_ADDRESS,r.abiERC20).interface.encodeFunctionData("approve",[t,"0"])};s.isEthUsdt=(e,t)=>(0,c.formatChainIdToDec)(e)===h.ChainId.ETH&&t.toLowerCase()===l.ETH_USDT_ADDRESS.toLowerCase();s.sumHexes=(...e)=>{if(0===e.length)return"0x0";return`0x${e.reduce((e,t)=>e+BigInt(t),BigInt(0)).toString(16)}`};s.isSwapsDefaultTokenAddress=(e,t)=>!(!e||!t)&&e===(0,s.getNativeAssetForChainId)(t)?.address;s.isSwapsDefaultTokenSymbol=(e,t)=>!(!e||!t)&&e===(0,s.getNativeAssetForChainId)(t)?.symbol;s.isNativeAddress=e=>e===n.AddressZero||""===e||!e||!(0,o.isStrictHexString)(e)&&Object.values(u.SYMBOL_TO_SLIP44_MAP).some(t=>e.includes(t)||t.endsWith(e));s.isSolanaChainId=e=>(0,o.isCaipChainId)(e)?e===i.SolScope.Mainnet.toString():e.toString()===h.ChainId.SOLANA.toString();s.isBitcoinChainId=e=>(0,o.isCaipChainId)(e)?e===i.BtcScope.Mainnet.toString():e.toString()===h.ChainId.BTC.toString();s.isTronChainId=e=>(0,o.isCaipChainId)(e)?e===i.TrxScope.Mainnet.toString():e.toString()===h.ChainId.TRON.toString();s.isNonEvmChainId=e=>(0,s.isSolanaChainId)(e)||(0,s.isBitcoinChainId)(e)||(0,s.isTronChainId)(e);s.isEvmQuoteResponse=e=>!(0,s.isNonEvmChainId)(e.quote.srcChainId)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/multichain-network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-network-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.formatAddressToAssetId=s.formatAddressToCaipReference=s.formatChainIdToHex=s.formatChainIdToDec=s.formatChainIdToCaip=void 0;const n=e("@ethersproject/address"),a=e("@ethersproject/constants"),i=e("@metamask/controller-utils"),r=e("@metamask/keyring-api"),o=e("@metamask/multichain-network-controller"),c=e("@metamask/utils"),l=e("./bridge.cjs"),d=e("../types.cjs");s.formatChainIdToCaip=e=>(0,c.isCaipChainId)(e)?e:(0,c.isStrictHexString)(e)?(0,o.toEvmCaipChainId)(e):(0,l.isSolanaChainId)(e)?r.SolScope.Mainnet:(0,l.isBitcoinChainId)(e)?r.BtcScope.Mainnet:(0,l.isTronChainId)(e)?r.TrxScope.Mainnet:(0,o.toEvmCaipChainId)((0,c.numberToHex)(Number(e)));s.formatChainIdToDec=e=>(0,c.isStrictHexString)(e)?(0,i.convertHexToDecimal)(e):e===r.SolScope.Mainnet?d.ChainId.SOLANA:e===r.BtcScope.Mainnet?d.ChainId.BTC:e===r.TrxScope.Mainnet?d.ChainId.TRON:(0,c.isCaipChainId)(e)?Number(e.split(":").at(-1)):"string"==typeof e?parseInt(e,10):e;s.formatChainIdToHex=e=>{if((0,c.isStrictHexString)(e))return e;if("number"==typeof e||parseInt(e,10))return(0,c.numberToHex)(Number(e));if((0,c.isCaipChainId)(e)){const{reference:t}=(0,c.parseCaipChainId)(e);if((0,c.isCaipReference)(t)&&!isNaN(Number(t)))return(0,c.numberToHex)(Number(t))}throw new Error(`Invalid cross-chain swaps chainId: ${e}`)};s.formatAddressToCaipReference=e=>{if((0,c.isStrictHexString)(e))return(0,n.getAddress)(e);if((0,l.isNativeAddress)(e))return a.AddressZero;const t=e.split(":").at(-1);if(!t)throw new Error("Invalid address");return t};s.formatAddressToAssetId=(e,t)=>{if((0,c.isCaipAssetType)(e))return e;if(!t)return undefined;const n=(0,s.formatChainIdToCaip)(t);if((0,l.isNativeAddress)(e))return(0,l.getNativeAssetForChainId)(n).assetId;if(n===r.SolScope.Mainnet)return c.CaipAssetTypeStruct.create(`${n}/token:${e}`);if(n===r.TrxScope.Mainnet)return c.CaipAssetTypeStruct.create(`${n}/trc20:${e}`);if(!(0,c.isStrictHexString)(e))return undefined;const a=(0,i.toChecksumHexAddress)(e);return c.CaipAssetTypeStruct.create(`${n}/erc20:${a}`)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hasMinimumRequiredVersion=s.getBridgeFeatureFlags=s.processFeatureFlags=s.formatFeatureFlags=void 0;const n=e("./caip-formatters.cjs"),a=e("./validators.cjs"),i=e("../constants/bridge.cjs");s.formatFeatureFlags=e=>{return{...e,chains:(t=e.chains,Object.entries(t).reduce((e,[t,s])=>({...e,[(0,n.formatChainIdToCaip)(t)]:s}),{}))};var t};s.processFeatureFlags=e=>{if((0,a.validateFeatureFlagsResponse)(e)){const t=(0,s.formatFeatureFlags)(e);return t.chainRanking&&0!==t.chainRanking.length?t:{...t,chainRanking:[...i.DEFAULT_CHAIN_RANKING]}}return i.DEFAULT_FEATURE_FLAG_CONFIG},s.getBridgeFeatureFlags=function(e){const t=e.call("RemoteFeatureFlagController:getState"),n=t?.remoteFeatureFlags?.bridgeConfigV2,a=t?.remoteFeatureFlags?.bridgeConfig;return(0,s.processFeatureFlags)(n||a)};s.hasMinimumRequiredVersion=(e,t)=>{const[s,n,a]=e.split(".").map(Number),[i,r,o]=t.split(".").map(Number);return s>i||(s===i&&n>r||s===i&&n===r&&a>=o)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchServerEvents=void 0;s.fetchServerEvents=async(e,{onMessage:t,onError:s,onClose:n,fetchFn:a,...i})=>{let r;try{const s=await a(e,i);if(!s.ok||!s.body)throw new Error(`${s.status}`);r=s.body.getReader();const o=new TextDecoder("utf-8");let c="";for(;;){const{done:e,value:s}=await r.read();if(e)break;c+=o.decode(s,{stream:!0});const n=c.split("\n\n");c=n.pop()||"";for(const e of n){const s=e.split("\n");let n;const a=[];for(const e of s)e.startsWith("event:")?n=e.slice(6).trim():e.startsWith("data:")&&a.push(e.slice(5).trim());if("error"===n)throw new Error(`Bridge-api error: ${a.join("\n")}`);if(a.length>0){const e=JSON.parse(a.join("\n"));await t(e,n)}}}await(n?.())}catch(e){s?.(e)}finally{try{await(r?.cancel())}catch(e){console.error("Error cleaning up stream reader",e)}}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./fetch-server-events.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchBridgeQuoteStream=s.fetchAssetPrices=s.fetchBridgeQuotes=s.fetchBridgeTokens=s.getClientHeaders=void 0;const n=e("@metamask/superstruct"),a=e("./bridge.cjs"),i=e("./caip-formatters.cjs"),r=e("./fetch-server-events.cjs"),o=e("./trade-utils.cjs"),c=e("./validators.cjs");s.getClientHeaders=({clientId:e,clientVersion:t,jwt:s})=>({"X-Client-Id":e,...s?{Authorization:`Bearer ${s}`}:{},...t?{"Client-Version":t}:{}}),s.fetchBridgeTokens=async function(e,t,n,a,r,o){const l=`${r}/getTokens?chainId=${(0,i.formatChainIdToDec)(e)}`,d=await a(l,{headers:(0,s.getClientHeaders)({clientId:t,clientVersion:o,jwt:n})}),m={};return d.forEach(e=>{(0,c.validateSwapsTokenObject)(e)&&(m[e.address]=e)}),m};const l=e=>{const t=e.destWalletAddress??e.walletAddress,s={walletAddress:(0,i.formatAddressToCaipReference)(e.walletAddress),destWalletAddress:(0,i.formatAddressToCaipReference)(t),srcChainId:(0,i.formatChainIdToDec)(e.srcChainId),destChainId:(0,i.formatChainIdToDec)(e.destChainId),srcTokenAddress:(0,i.formatAddressToCaipReference)(e.srcTokenAddress),destTokenAddress:(0,i.formatAddressToCaipReference)(e.destTokenAddress),srcTokenAmount:e.srcTokenAmount,insufficientBal:Boolean(e.insufficientBal),resetApproval:Boolean(e.resetApproval),gasIncluded:Boolean(e.gasIncluded),gasIncluded7702:Boolean(e.gasIncluded7702)};e.slippage!==undefined&&(s.slippage=e.slippage),e.fee!==undefined&&(s.fee=e.fee),e.aggIds&&e.aggIds.length>0&&(s.aggIds=e.aggIds),e.bridgeIds&&e.bridgeIds.length>0&&(s.bridgeIds=e.bridgeIds);const n=new URLSearchParams;return Object.entries(s).forEach(([e,t])=>{n.append(e,t.toString())}),n};s.fetchBridgeQuotes=async function(e,t,i,r,d,m,u,h){const f=`${m}/getQuote?${l(e)}`,p=await d(f,{headers:(0,s.getClientHeaders)({clientId:i,clientVersion:h,jwt:r}),signal:t}),g=new Set([]),b=p.filter(e=>{try{return(0,c.validateQuoteResponse)(e)}catch(t){return t instanceof n.StructError&&t.failures().forEach(({branch:t,path:s})=>{const n=t?.[0]?.quote?.bridgeId??t?.[0]?.quote?.bridges?.[0]??e?.quote?.bridgeId??e?.quote?.bridges?.[0]??"unknown",a=s?.join(".")||"unknown";g.add([n,a].join("|"))}),!1}}).map(t=>({...t,featureId:u??undefined,resetApproval:e.resetApproval&&t.approval&&(0,o.isEvmTxData)(t.approval)?{...t.approval,data:(0,a.getEthUsdtResetData)(e.destChainId)}:undefined})),k=Array.from(g);return g.size>0&&console.warn("Quote validation failed",k),{quotes:b,validationFailures:k}};s.fetchAssetPrices=async e=>{const{currencies:t,...n}=e,a=await Promise.allSettled(Array.from(t).map(async e=>await(async e=>{const{currency:t,assetIds:n,clientId:a,clientVersion:i,fetchFn:r,signal:o}=e,c=Array.from(n).filter(Boolean);if(0===c.length)return{};const l=`https://price.api.cx.metamask.io/v3/spot-prices?${new URLSearchParams({assetIds:c.filter(Boolean).join(","),vsCurrency:t})}`,d=await r(l,{headers:(0,s.getClientHeaders)({clientId:a,clientVersion:i}),signal:o});return d&&"object"==typeof d?Object.entries(d).reduce((e,[s,n])=>n?(e[s]||(e[s]={}),n[t]&&(e[s][t]=n[t].toString()),e):e,{}):{}})({...n,currency:e}))).then(e=>e.reduce((e,t)=>("fulfilled"===t.status&&Object.entries(t.value).forEach(([t,s])=>{e[t]||(e[t]={}),Object.entries(s).forEach(([s,n])=>{e[t][s]=n})}),e),{}));return a},s.fetchBridgeQuoteStream=async function(e,t,i,d,m,u,h,f){const p=`${u}/getQuoteStream?${l(t)}`;await(0,r.fetchServerEvents)(p,{headers:{...(0,s.getClientHeaders)({clientId:d,clientVersion:f,jwt:m}),"Content-Type":"text/event-stream"},signal:i,onMessage:async e=>{const s=new Set([]);try{if((0,c.validateQuoteResponse)(e))return await h.onValidQuoteReceived({...e,resetApproval:t.resetApproval&&e.approval&&(0,o.isEvmTxData)(e.approval)?{...e.approval,data:(0,a.getEthUsdtResetData)(t.destChainId)}:undefined})}catch(t){t instanceof n.StructError&&t.failures().forEach(({branch:t,path:n})=>{const a=t?.[0]?.quote?.bridgeId??t?.[0]?.quote?.bridges?.[0]??e?.quote?.bridgeId??(e?.quote?.bridges?.[0]||"unknown"),i=n?.join(".")||"unknown";s.add([a,i].join("|"))});const a=Array.from(s);if(s.size>0)return console.warn("Quote validation failed",a),h.onValidationFailure(a);throw t}return undefined},onError:e=>{throw e},onClose:async()=>{await h.onClose()},fetchFn:e})}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l;Object.defineProperty(s,"__esModule",{value:!0}),s.MetricsSwapType=s.MetricsActionType=s.InputAmountPreset=s.MetaMetricsSwapsEventSource=s.AbortReason=s.PollingStatus=s.UnifiedSwapBridgeEventName=s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=void 0,s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY="Unified SwapBridge",function(e){e.ButtonClicked="Unified SwapBridge Button Clicked",e.PageViewed="Unified SwapBridge Page Viewed",e.InputChanged="Unified SwapBridge Input Changed",e.InputSourceDestinationSwitched="Unified SwapBridge Source Destination Switched",e.QuotesRequested="Unified SwapBridge Quotes Requested",e.QuotesReceived="Unified SwapBridge Quotes Received",e.QuotesError="Unified SwapBridge Quotes Error",e.Submitted="Unified SwapBridge Submitted",e.Completed="Unified SwapBridge Completed",e.Failed="Unified SwapBridge Failed",e.AllQuotesOpened="Unified SwapBridge All Quotes Opened",e.AllQuotesSorted="Unified SwapBridge All Quotes Sorted",e.QuoteSelected="Unified SwapBridge Quote Selected",e.AssetDetailTooltipClicked="Unified SwapBridge Asset Detail Tooltip Clicked",e.QuotesValidationFailed="Unified SwapBridge Quotes Failed Validation",e.StatusValidationFailed="Unified SwapBridge Status Failed Validation",e.AssetPickerOpened="Unified SwapBridge Asset Picker Opened",e.PollingStatusUpdated="Unified SwapBridge Polling Status Updated"}(n||(s.UnifiedSwapBridgeEventName=n={})),function(e){e.MaxPollingReached="max_polling_reached",e.ManuallyRestarted="manually_restarted"}(a||(s.PollingStatus=a={})),function(e){e.NewQuoteRequest="New Quote Request",e.QuoteRequestUpdated="Quote Request Updated",e.ResetState="Reset controller state",e.TransactionSubmitted="Transaction submitted"}(i||(s.AbortReason=i={})),function(e){e.MainView="Main View",e.TokenView="Token View",e.TrendingExplore="Trending Explore",e.Rewards="Rewards"}(r||(s.MetaMetricsSwapsEventSource=r={})),function(e){e.PERCENT_25="25%",e.PERCENT_50="50%",e.PERCENT_75="75%",e.PERCENT_90="90%",e.MAX="MAX"}(o||(s.InputAmountPreset=o={})),function(e){e.CROSSCHAIN_V1="crosschain-v1",e.SWAPBRIDGE_V1="swapbridge-v1"}(c||(s.MetricsActionType=c={})),function(e){e.SINGLE="single_chain",e.CROSSCHAIN="crosschain"}(l||(s.MetricsSwapType=l={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs",{"../../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","../bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","../caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getQuotesReceivedProperties=s.isCustomSlippage=s.isHardwareWallet=s.getRequestParams=s.formatProviderLabel=s.getSwapTypeFromQuote=s.getSwapType=s.toInputChangedPropertyValue=s.toInputChangedPropertyKey=void 0;const n=e("./constants.cjs"),a=e("../../constants/bridge.cjs"),i=e("../../types.cjs"),r=e("../bridge.cjs"),o=e("../caip-formatters.cjs");s.toInputChangedPropertyKey={srcTokenAddress:"token_source",destTokenAddress:"token_destination",srcChainId:"chain_source",destChainId:"chain_destination",slippage:"slippage"},s.toInputChangedPropertyValue={srcTokenAddress:({srcTokenAddress:e,srcChainId:t})=>t?(0,o.formatAddressToAssetId)(e??"",t):undefined,destTokenAddress:({destTokenAddress:e,destChainId:t})=>t?(0,o.formatAddressToAssetId)(e??"",t):undefined,srcChainId:({srcChainId:e})=>e?(0,o.formatChainIdToCaip)(e):undefined,destChainId:({destChainId:e})=>e?(0,o.formatChainIdToCaip)(e):undefined,slippage:({slippage:e})=>e?Number(e):e};s.getSwapType=(e,t)=>e&&!(0,r.isCrossChain)(e,t??e)?n.MetricsSwapType.SINGLE:n.MetricsSwapType.CROSSCHAIN;s.getSwapTypeFromQuote=e=>(0,s.getSwapType)(e.srcChainId,e.destChainId);s.formatProviderLabel=({bridgeId:e,bridges:t})=>`${e}_${t[0]}`;s.getRequestParams=({srcChainId:e,destChainId:t,srcTokenAddress:s,destTokenAddress:n})=>{const a=(0,o.formatChainIdToCaip)(e??i.ChainId.ETH);return{chain_id_source:a,chain_id_destination:t?(0,o.formatChainIdToCaip)(t):null,token_address_source:s?(0,o.formatAddressToAssetId)(s,a)??(0,r.getNativeAssetForChainId)(a)?.assetId??null:(0,r.getNativeAssetForChainId)(a)?.assetId??null,token_address_destination:n?(0,o.formatAddressToAssetId)(n,t??a)??null:null}};s.isHardwareWallet=e=>e?.metadata?.keyring.type?.includes("Hardware")??!1;s.isCustomSlippage=e=>e!==a.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;s.getQuotesReceivedProperties=(e,t=[],n=!0,a,i)=>{const r=e?(0,s.formatProviderLabel)(e.quote):"_";return{can_submit:n,gas_included:Boolean(e?.quote?.gasIncluded),gas_included_7702:Boolean(e?.quote?.gasIncluded7702),quoted_time_minutes:e?.estimatedProcessingTimeInSeconds?e.estimatedProcessingTimeInSeconds/60:0,usd_quoted_gas:Number(e?.gasFee?.effective?.usd??0),usd_quoted_return:Number(e?.toTokenAmount?.usd??0),usd_balance_source:i??0,best_quote_provider:a?(0,s.formatProviderLabel)(a.quote):r,provider:r,warnings:t,price_impact:Number(e?.quote.priceData?.priceImpact??0)}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.appendFeesToQuotes=void 0;const n=e("@metamask/utils"),a=e("./bridge.cjs"),i=e("./caip-formatters.cjs"),r=e("./snaps.cjs"),o=e("./trade-utils.cjs"),c=e("../constants/chains.cjs");s.appendFeesToQuotes=async(e,t,s,l)=>{const d=await(async(e,t)=>{if(e.some(({quote:e})=>{const t=(0,i.formatChainIdToCaip)(e.srcChainId);return![c.CHAIN_IDS.OPTIMISM,c.CHAIN_IDS.BASE].map(i.formatChainIdToCaip).includes(t)}))return undefined;const s=Promise.allSettled(e.map(async e=>{const{quote:s,trade:i,approval:r}=e,o=(0,n.numberToHex)(s.srcChainId),c=e=>({from:e.from,to:e.to,value:e.value,data:e.data,gasLimit:e.gasLimit?.toString()}),l=r?await t({transactionParams:c(r),chainId:o}):"0x0",d=await t({transactionParams:c(i),chainId:o});return l===undefined||d===undefined?undefined:{...e,l1GasFeesInHexWei:(0,a.sumHexes)(l,d)}}));return(await s).reduce((e,t)=>("fulfilled"===t.status&&t.value?e.push(t.value):"rejected"===t.status&&console.error("Error calculating L1 gas fees for quote",t.reason),e),[])})(e,s),m=await(async(e,t,s)=>{if(e.some(({quote:{srcChainId:e}})=>!(0,a.isNonEvmChainId)(e)))return undefined;const n=Promise.allSettled(e.map(async e=>{const{trade:n,quote:a}=e;if(!s?.metadata?.snap?.id||!n)return e;try{const c=(0,i.formatChainIdToCaip)(a.srcChainId),l=(0,o.extractTradeData)(n),d=(0,o.isTronTrade)(n)?{visible:n.visible,type:n.raw_data?.contract?.[0]?.type,feeLimit:n.raw_data?.fee_limit}:undefined,m=await t.call("SnapController:handleRequest",(0,r.computeFeeRequest)(s?.metadata?.snap?.id,l,s?.id,c,d)),u=m?.find(e=>"base"===e.type)||m?.find(e=>"priority"===e.type)||m?.[0],h=u?.asset?.amount||"0";return{...e,nonEvmFeesInNative:h}}catch(t){return console.error(`Failed to compute non-EVM fees for quote ${a.requestId}:`,t),{...e,nonEvmFeesInNative:undefined}}}));return(await n).reduce((e,t)=>("fulfilled"===t.status&&t.value&&e.push(t.value),e),[])})(e,t,l);return d??m??e}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sortQuotes=s.formatEtaInMinutes=s.calcSlippagePercentage=s.calcCost=s.calcSwapRate=s.calcAdjustedReturn=s.calcIncludedTxFees=s.calcTotalMaxNetworkFee=s.calcTotalEstimatedNetworkFee=s.calcEstimatedAndMaxTotalGasFee=s.calcRelayerFee=s.calcSentAmount=s.calcToAmount=s.calcNonEvmTotalNetworkFee=s.getQuoteIdentifier=s.isValidQuoteRequest=void 0;const n=e("@metamask/controller-utils"),a=e("bignumber.js"),i=e("./bridge.cjs"),r=e("./validators.cjs");s.isValidQuoteRequest=(e,t=!0)=>{const s=["srcTokenAddress","destTokenAddress","srcChainId","destChainId","walletAddress"];if(t&&s.push("srcTokenAmount"),e.destChainId&&e.srcChainId&&e.destChainId!==e.srcChainId&&((0,i.isNonEvmChainId)(e.destChainId)||(0,i.isNonEvmChainId)(e.srcChainId))&&(s.push("destWalletAddress"),!e.destWalletAddress))return!1;const n=[];return e.slippage!==undefined&&n.push("slippage"),s.every(t=>t in e&&"string"==typeof e[t]&&e[t]!==undefined&&""!==e[t]&&null!==e[t])&&n.every(t=>t in e&&"number"==typeof e[t]&&e[t]!==undefined&&!isNaN(Number(e[t]))&&null!==e[t])&&(!t||Boolean((e.srcTokenAmount??"").match(/^[1-9]\d*$/u)))};s.getQuoteIdentifier=e=>`${e.bridgeId}-${e.bridges[0]}-${e.steps.length}`;const o=(e,t)=>{const s=new a.BigNumber(10).pow(t??0);return new a.BigNumber(e).div(s)};s.calcNonEvmTotalNetworkFee=(e,{exchangeRate:t,usdExchangeRate:s})=>{const{nonEvmFeesInNative:n}=e,i=new a.BigNumber(n??"0");return{amount:i.toString(),valueInCurrency:t?i.times(t).toString():null,usd:s?i.times(s).toString():null}};s.calcToAmount=(e,t,{exchangeRate:s,usdExchangeRate:n})=>{const a=o(e,t.decimals);return{amount:a.toString(),valueInCurrency:s?a.times(s).toString():null,usd:n?a.times(n).toString():null}};s.calcSentAmount=({srcTokenAmount:e,srcAsset:t,feeData:s},{exchangeRate:n,usdExchangeRate:i})=>{const r=Object.values(s).filter(e=>e&&e.amount&&e.asset?.assetId===t.assetId).reduce((e,{amount:t})=>e.plus(t),new a.BigNumber(e)),c=o(r,t.decimals);return{amount:c.toString(),valueInCurrency:n?c.times(n).toString():null,usd:i?c.times(i).toString():null}};s.calcRelayerFee=(e,{exchangeRate:t,usdExchangeRate:r})=>{const{quote:c,trade:l}=e,d=new a.BigNumber((0,n.convertHexToDecimal)(l.value||"0x0"));let m=o(d,18);if((0,i.isNativeAddress)(c.srcAsset.address)){const e=(0,s.calcSentAmount)(c,{exchangeRate:t,usdExchangeRate:r}).amount;m=m.minus(e)}return{amount:m,valueInCurrency:t?m.times(t):null,usd:r?m.times(r):null}};const c=({approvalGasLimit:e,resetApprovalGasLimit:t,tradeGasLimit:s,l1GasFeesInHexWei:i,feePerGasInDecGwei:r,nativeToDisplayCurrencyExchangeRate:o,nativeToUsdExchangeRate:c})=>{const l=new a.BigNumber(s?.toString()??"0").plus(e?.toString()??"0").plus(t?.toString()??"0"),d=(0,n.weiHexToGweiDec)((0,n.toHex)(i??"0")),m=l.times(r??"0").plus(d).times(new a.BigNumber(10).pow(-9)),u=o?m.times(o.toString()):null,h=c?m.times(c.toString()):null;return{amount:m.toString(),valueInCurrency:u?.toString()??null,usd:h?.toString()??null}};s.calcEstimatedAndMaxTotalGasFee=({bridgeQuote:{approval:e,trade:t,l1GasFeesInHexWei:s,resetApproval:n},feePerGasInDecGwei:a,maxFeePerGasInDecGwei:i,exchangeRate:r,usdExchangeRate:o})=>{const{amount:l,valueInCurrency:d,usd:m}=c({approvalGasLimit:e?.effectiveGas??e?.gasLimit,resetApprovalGasLimit:n?.effectiveGas??n?.gasLimit,tradeGasLimit:t?.effectiveGas??t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:r,nativeToUsdExchangeRate:o}),{amount:u,valueInCurrency:h,usd:f}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:n?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:r,nativeToUsdExchangeRate:o}),{amount:p,valueInCurrency:g,usd:b}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:n?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:i,nativeToDisplayCurrencyExchangeRate:r,nativeToUsdExchangeRate:o});return{effective:{amount:l,valueInCurrency:d,usd:m},total:{amount:u,valueInCurrency:h,usd:f},max:{amount:p,valueInCurrency:g,usd:b}}};s.calcTotalEstimatedNetworkFee=({total:e},t)=>({amount:new a.BigNumber(e?.amount??"0").plus(t.amount).toString(),valueInCurrency:e?.valueInCurrency?new a.BigNumber(e.valueInCurrency).plus(t.valueInCurrency??"0").toString():null,usd:e?.usd?new a.BigNumber(e.usd).plus(t.usd??"0").toString():null});s.calcTotalMaxNetworkFee=(e,t)=>({amount:new a.BigNumber(e.max.amount).plus(t.amount).toString(),valueInCurrency:e.max.valueInCurrency?new a.BigNumber(e.max.valueInCurrency).plus(t.valueInCurrency??"0").toString():null,usd:e.max.usd?new a.BigNumber(e.max.usd).plus(t.usd??"0").toString():null});s.calcIncludedTxFees=({gasIncluded:e,gasIncluded7702:t,srcAsset:s,feeData:{txFee:n}},a,i)=>{if(!n||!e&&!t)return null;const{exchangeRate:r,usdExchangeRate:c}=n.asset.assetId===s.assetId?a:i,l=o(n.amount,n.asset.decimals);return{amount:l.toString(),valueInCurrency:r?l.times(r).toString():null,usd:c?l.times(c).toString():null}};s.calcAdjustedReturn=(e,t,{feeData:{txFee:s},destAsset:{assetId:n}})=>s?.asset?.assetId===n?{valueInCurrency:e.valueInCurrency,usd:e.usd}:{valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new a.BigNumber(e.valueInCurrency).minus(t.valueInCurrency).toString():null,usd:e.usd&&t.usd?new a.BigNumber(e.usd).minus(t.usd).toString():null};s.calcSwapRate=(e,t)=>new a.BigNumber(t).div(e).toString();s.calcCost=(e,t)=>({valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new a.BigNumber(t.valueInCurrency).minus(e.valueInCurrency).toString():null,usd:e.usd&&t.usd?new a.BigNumber(t.usd).minus(e.usd).toString():null});s.calcSlippagePercentage=(e,t)=>{const n=(0,s.calcCost)(e,t);return n.valueInCurrency&&t.valueInCurrency?new a.BigNumber(n.valueInCurrency).div(t.valueInCurrency).times(100).abs().toString():n.usd&&t.usd?new a.BigNumber(n.usd).div(t.usd).times(100).abs().toString():null};s.formatEtaInMinutes=e=>e<60?"< 1":(e/60).toFixed();s.sortQuotes=(e,t)=>t===r.FeatureId.PERPS?e.sort((e,t)=>e.estimatedProcessingTimeInSeconds-t.estimatedProcessingTimeInSeconds):e}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getDefaultSlippagePercentage=s.BRIDGE_DEFAULT_SLIPPAGE=void 0;const n=e("./bridge.cjs");s.BRIDGE_DEFAULT_SLIPPAGE=.5;const a=undefined;s.getDefaultSlippagePercentage=({srcTokenAddress:e,destTokenAddress:t,srcChainId:i,destChainId:r},o,c)=>!i||(0,n.isCrossChain)(i,r)?s.BRIDGE_DEFAULT_SLIPPAGE:(0,n.isSolanaChainId)(i)?a:e&&t&&o?.map(e=>e.toLowerCase()).includes(e.toLowerCase())&&(c??o)?.map(e=>e.toLowerCase()).includes(t.toLowerCase())?.5:2}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.computeFeeRequest=s.getMinimumBalanceForRentExemptionInLamports=s.getMinimumBalanceForRentExemptionRequest=void 0;const n=e("@metamask/keyring-api"),a=e("uuid"),i=e("../constants/bridge.cjs");s.getMinimumBalanceForRentExemptionRequest=e=>({snapId:e,origin:"metamask",handler:"onProtocolRequest",request:{method:" ",jsonrpc:"2.0",params:{scope:n.SolScope.Mainnet,request:{id:(0,a.v4)(),jsonrpc:"2.0",method:"getMinimumBalanceForRentExemption",params:[0,{commitment:"confirmed"}]}}}});s.getMinimumBalanceForRentExemptionInLamports=async(e,t)=>String(await t.call("SnapController:handleRequest",(0,s.getMinimumBalanceForRentExemptionRequest)(e)).catch(e=>(console.error("Error setting minimum balance for rent exemption",e),i.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports)));s.computeFeeRequest=(e,t,s,n,i)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,a.v4)(),jsonrpc:"2.0",method:"computeFee",params:{transaction:t,accountId:s,scope:n,...i&&{options:i}}}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchTokens=s.DEV_BASE_URL=s.API_BASE_URL=s.getSwapsContractAddress=s.isValidSwapsContractAddress=void 0;const n=e("./caip-formatters.cjs"),a=e("../constants/chains.cjs"),i=e("../constants/swaps.cjs"),r=e("../constants/tokens.cjs");function o(e){return e?{"X-Client-Id":e}:undefined}s.isValidSwapsContractAddress=function(e,t){return!(!t||!i.ALLOWED_CONTRACT_ADDRESSES[e])&&i.ALLOWED_CONTRACT_ADDRESSES[e].some(e=>t.toLowerCase()===e.toLowerCase())},s.getSwapsContractAddress=function(e){return i.SWAPS_CONTRACT_ADDRESSES[e]},s.API_BASE_URL="https://swap.api.cx.metamask.io",s.DEV_BASE_URL="https://swap.dev-api.cx.metamask.io",s.fetchTokens=async function(e,t,i){const[c,l]=e===a.CHAIN_IDS.LOCALHOST?[a.CHAIN_IDS.MAINNET,s.DEV_BASE_URL]:[e,s.API_BASE_URL],d=`${l}/networks/${(0,n.formatChainIdToDec)(c)}/tokens`,m=(await t(d,{headers:o(i)})).filter(e=>e.address!==r.DEFAULT_TOKEN_ADDRESS),u=r.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[e];return m.push(u),m}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs",{buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(e){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.extractTradeData=s.isTronTrade=s.isBitcoinTrade=s.isEvmTxData=void 0;s.isEvmTxData=e=>"object"==typeof e&&null!==e&&"data"in e&&"chainId"in e&&"to"in e;s.isBitcoinTrade=e=>"object"==typeof e&&null!==e&&"unsignedPsbtBase64"in e;s.isTronTrade=e=>"object"==typeof e&&null!==e&&"raw_data_hex"in e;s.extractTradeData=t=>(0,s.isBitcoinTrade)(t)?t.unsignedPsbtBase64:(0,s.isTronTrade)(t)?e.from(t.raw_data_hex,"hex").toString("base64"):"string"==typeof t?t:(0,s.isEvmTxData)(t)?t.data:""}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateQuoteResponse=s.QuoteResponseSchema=s.TronTradeDataSchema=s.BitcoinTradeDataSchema=s.TxDataSchema=s.QuoteSchema=s.IntentSchema=s.IntentOrderSchema=s.StepSchema=s.ProtocolSchema=s.FeeDataSchema=s.validateSwapsTokenObject=s.validateFeatureFlagsResponse=s.PlatformConfigSchema=s.PriceImpactThresholdSchema=s.ChainConfigurationSchema=s.ChainRankingSchema=s.ChainRankingItemSchema=s.BridgeAssetSchema=s.truthyString=s.ActionTypes=s.FeatureId=s.FeeType=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/superstruct"),i=e("@metamask/utils");var r,o,c;!function(e){e.METABRIDGE="metabridge",e.REFUEL="refuel",e.TX_FEE="txFee"}(r||(s.FeeType=r={})),function(e){e.PERPS="perps"}(o||(s.FeatureId=o={})),function(e){e.BRIDGE="bridge",e.SWAP="swap",e.REFUEL="refuel"}(c||(s.ActionTypes=c={}));const l=(0,a.define)("HexAddress",e=>(0,n.isValidHexAddress)(e,{allowNonPrefixed:!1})),d=(0,a.define)("HexString",e=>(0,i.isStrictHexString)(e)),m=(0,a.define)("VersionString",e=>"string"==typeof e&&/^(\d+\.*){2}\d+$/u.test(e)&&3===e.split(".").length);s.truthyString=e=>Boolean(e?.length);const u=(0,a.pattern)((0,a.string)(),/^\d+$/u),h=(0,a.number)();s.BridgeAssetSchema=(0,a.type)({chainId:h,address:(0,a.string)(),assetId:i.CaipAssetTypeStruct,symbol:(0,a.string)(),name:(0,a.string)(),decimals:(0,a.number)(),icon:(0,a.optional)((0,a.nullable)((0,a.string)())),iconUrl:(0,a.optional)((0,a.nullable)((0,a.string)()))});const f=(0,a.type)({standard:(0,a.record)((0,a.string)(),(0,a.string)()),other:(0,a.record)((0,a.string)(),(0,a.string)())});s.ChainRankingItemSchema=(0,a.type)({chainId:i.CaipChainIdStruct,name:(0,a.string)()}),s.ChainRankingSchema=(0,a.optional)((0,a.array)(s.ChainRankingItemSchema)),s.ChainConfigurationSchema=(0,a.type)({isActiveSrc:(0,a.boolean)(),isActiveDest:(0,a.boolean)(),refreshRate:(0,a.optional)((0,a.number)()),topAssets:(0,a.optional)((0,a.array)((0,a.string)())),stablecoins:(0,a.optional)((0,a.array)((0,a.string)())),isUnifiedUIEnabled:(0,a.optional)((0,a.boolean)()),isSingleSwapBridgeButtonEnabled:(0,a.optional)((0,a.boolean)()),isGaslessSwapEnabled:(0,a.optional)((0,a.boolean)()),noFeeAssets:(0,a.optional)((0,a.array)((0,a.string)())),defaultPairs:(0,a.optional)(f)}),s.PriceImpactThresholdSchema=(0,a.type)({gasless:(0,a.number)(),normal:(0,a.number)(),warning:(0,a.optional)((0,a.number)()),error:(0,a.optional)((0,a.number)())});const p=(0,a.type)({aggIds:(0,a.optional)((0,a.array)((0,a.string)())),bridgeIds:(0,a.optional)((0,a.array)((0,a.string)())),fee:(0,a.optional)((0,a.number)())}),g=(0,a.enums)(Object.values(o));s.PlatformConfigSchema=(0,a.type)({priceImpactThreshold:(0,a.optional)(s.PriceImpactThresholdSchema),quoteRequestOverrides:(0,a.optional)((0,a.record)(g,(0,a.optional)(p))),minimumVersion:(0,a.string)(),refreshRate:(0,a.number)(),maxRefreshCount:(0,a.number)(),support:(0,a.boolean)(),chains:(0,a.record)((0,a.string)(),s.ChainConfigurationSchema),bip44DefaultPairs:(0,a.optional)((0,a.record)((0,a.string)(),(0,a.optional)(f))),sse:(0,a.optional)((0,a.type)({enabled:(0,a.boolean)(),minimumVersion:m})),chainRanking:s.ChainRankingSchema});s.validateFeatureFlagsResponse=e=>(0,a.is)(e,s.PlatformConfigSchema);s.validateSwapsTokenObject=e=>(0,a.is)(e,s.BridgeAssetSchema),s.FeeDataSchema=(0,a.type)({amount:u,asset:s.BridgeAssetSchema}),s.ProtocolSchema=(0,a.type)({name:(0,a.string)(),displayName:(0,a.optional)((0,a.string)()),icon:(0,a.optional)((0,a.string)())}),s.StepSchema=(0,a.type)({action:(0,a.enums)(Object.values(c)),srcChainId:h,destChainId:(0,a.optional)(h),srcAsset:s.BridgeAssetSchema,destAsset:s.BridgeAssetSchema,srcAmount:(0,a.string)(),destAmount:(0,a.string)(),protocol:s.ProtocolSchema});const b=s.StepSchema,k=(0,a.union)([u,(0,a.number)()]),w=(0,a.string)();s.IntentOrderSchema=(0,a.type)({sellToken:l,buyToken:l,receiver:(0,a.optional)(l),validTo:k,appData:(0,a.string)(),appDataHash:d,feeAmount:u,kind:(0,a.enums)(["sell","buy"]),partiallyFillable:(0,a.boolean)(),sellAmount:(0,a.optional)(u),buyAmount:(0,a.optional)(u),from:(0,a.optional)(l)}),s.IntentSchema=(0,a.type)({protocol:w,order:s.IntentOrderSchema,settlementContract:(0,a.optional)(l),typedData:(0,a.type)({types:(0,a.record)((0,a.string)(),(0,a.array)((0,a.type)({name:(0,a.string)(),type:(0,a.string)()}))),primaryType:(0,a.string)(),domain:(0,a.record)((0,a.string)(),(0,a.any)()),message:(0,a.record)((0,a.string)(),(0,a.any)())})}),s.QuoteSchema=(0,a.type)({requestId:(0,a.string)(),srcChainId:h,srcAsset:s.BridgeAssetSchema,srcTokenAmount:(0,a.string)(),destChainId:h,destAsset:s.BridgeAssetSchema,destTokenAmount:(0,a.string)(),minDestTokenAmount:(0,a.string)(),feeData:(0,a.type)({[r.METABRIDGE]:s.FeeDataSchema,[r.TX_FEE]:(0,a.optional)((0,a.intersection)([s.FeeDataSchema,(0,a.type)({maxFeePerGas:(0,a.string)(),maxPriorityFeePerGas:(0,a.string)()})]))}),gasIncluded:(0,a.optional)((0,a.boolean)()),gasIncluded7702:(0,a.optional)((0,a.boolean)()),bridgeId:(0,a.string)(),bridges:(0,a.array)((0,a.string)()),steps:(0,a.array)(s.StepSchema),refuel:(0,a.optional)(b),priceData:(0,a.optional)((0,a.type)({totalFromAmountUsd:(0,a.optional)((0,a.string)()),totalToAmountUsd:(0,a.optional)((0,a.string)()),priceImpact:(0,a.optional)((0,a.string)()),totalFeeAmountUsd:(0,a.optional)((0,a.string)())})),intent:(0,a.optional)(s.IntentSchema),gasSponsored:(0,a.optional)((0,a.boolean)())}),s.TxDataSchema=(0,a.type)({chainId:(0,a.number)(),to:l,from:l,value:d,data:d,gasLimit:(0,a.nullable)((0,a.number)()),effectiveGas:(0,a.optional)((0,a.number)())}),s.BitcoinTradeDataSchema=(0,a.type)({unsignedPsbtBase64:(0,a.string)(),inputsToSign:(0,a.nullable)((0,a.array)((0,a.type)({})))}),s.TronTradeDataSchema=(0,a.type)({raw_data_hex:(0,a.string)(),visible:(0,a.optional)((0,a.boolean)()),raw_data:(0,a.optional)((0,a.nullable)((0,a.type)({contract:(0,a.optional)((0,a.array)((0,a.type)({type:(0,a.optional)((0,a.string)())}))),fee_limit:(0,a.optional)((0,a.number)())})))}),s.QuoteResponseSchema=(0,a.type)({quote:s.QuoteSchema,estimatedProcessingTimeInSeconds:(0,a.number)(),approval:(0,a.optional)((0,a.union)([s.TxDataSchema,s.TronTradeDataSchema])),trade:(0,a.union)([s.TxDataSchema,s.BitcoinTradeDataSchema,s.TronTradeDataSchema,(0,a.string)()])});s.validateQuoteResponse=e=>((0,a.assert)(e,s.QuoteResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){!function(e){var s,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,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,s,n=1,a=e.length,i=e[0]+"";n<a;){for(t=e[n++]+"",s=l-t.length;s--;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 s,n,a=e.c,i=t.c,r=e.s,o=t.s,c=e.e,l=t.e;if(!r||!o)return null;if(s=a&&!a[0],n=i&&!i[0],s||n)return s?n?0:-o:r;if(r!=o)return r;if(s=r<0,n=c==l,!a||!i)return n?0:!a^s?1:-1;if(!n)return c>l^s?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]^s?1:-1;return c==l?0:c>l^s?1:-1}function b(e,t,s,n){if(e<t||e>s||e!==i(e))throw Error(r+(n||"Argument")+("number"==typeof e?e<t||e>s?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function k(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 _(e,t,s){var n,a;if(t<0){for(a=s+".";++t;a+=s);e=a+e}else if(++t>(n=e.length)){for(a=s,t-=n;--t;a+=s);e+=a}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var s,T,E,S,I,A,y,x,v,C,j=W.prototype={constructor:W,toString:null,valueOf:null},P=new W(1),D=20,N=4,R=-7,O=21,M=-1e7,L=1e7,F=!1,B=1,G=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},U="0123456789abcdefghijklmnopqrstuvwxyz",q=!0;function W(e,t){var s,a,r,c,m,u,h,f,p=this;if(!(p instanceof W))return new W(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>L?p.c=p.e=null:e.e<M?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,m=e;m>=10;m/=10,c++);return void(c>L?p.c=p.e=null:(p.e=c,p.c=[e]))}f=String(e)}else{if(!n.test(f=String(e)))return E(p,f,u);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(c=f.indexOf("."))>-1&&(f=f.replace(".","")),(m=f.search(/e/i))>0?(c<0&&(c=m),c+=+f.slice(m+1),f=f.substring(0,m)):c<0&&(c=f.length)}else{if(b(t,2,U.length,"Base"),10==t&&q)return Y(p=new W(e),D+p.e+1,N);if(f=String(e),u="number"==typeof e){if(0*e!=0)return E(p,f,u,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,W.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(s=U.slice(0,t),c=m=0,h=f.length;m<h;m++)if(s.indexOf(a=f.charAt(m))<0){if("."==a){if(m>c){c=h;continue}}else if(!r&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){r=!0,m=-1,c=0;continue}return E(p,String(e),u,t)}u=!1,(c=(f=T(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):c=f.length}for(m=0;48===f.charCodeAt(m);m++);for(h=f.length;48===f.charCodeAt(--h););if(f=f.slice(m,++h)){if(h-=m,u&&W.DEBUG&&h>15&&(e>d||e!==i(e)))throw Error(o+p.s*e);if((c=c-m-1)>L)p.c=p.e=null;else if(c<M)p.c=[p.e=0];else{if(p.e=c,p.c=[],m=(c+1)%l,c<0&&(m+=l),m<h){for(m&&p.c.push(+f.slice(0,m)),h-=l;m<h;)p.c.push(+f.slice(m,m+=l));m=l-(f=f.slice(m)).length}else m-=h;for(;m--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function $(e,t,s,n){var a,i,r,o,c;if(null==s?s=N:b(s,0,8),!e.c)return e.toString();if(a=e.c[0],r=e.e,null==t)c=p(e.c),c=1==n||2==n&&(r<=R||r>=O)?w(c,r):_(c,r,"0");else if(i=(e=Y(new W(e),t,s)).e,o=(c=p(e.c)).length,1==n||2==n&&(t<=i||i<=R)){for(;o<t;c+="0",o++);c=w(c,i)}else if(t-=r+(2===n&&i>r),c=_(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 V(e,t){for(var s,n,a=1,i=new W(e[0]);a<e.length;a++)(!(n=new W(e[a])).s||(s=g(i,n))===t||0===s&&i.s===t)&&(i=n);return i}function K(e,t,s){for(var n=1,a=t.length;!t[--a];t.pop());for(a=t[0];a>=10;a/=10,n++);return(s=n+s*l-1)>L?e.c=e.e=null:s<M?e.c=[e.e=0]:(e.e=s,e.c=t),e}function Y(e,t,s,n){var r,o,d,u,h,f,p,g=e.c,b=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/b[r-d-1]%10);else if((f=a((o+1)/l))>=g.length){if(!n)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/b[r-d-1]%10)}if(n=n||t<0||null!=g[f+1]||(d<0?h:h%b[r-d-1]),n=s<4?(p||n)&&(0==s||s==(e.s<0?3:2)):p>5||5==p&&(4==s||n||6==s&&(o>0?d>0?h/b[r-d]:0:g[f-1])%10&1||s==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=b[(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=b[l-o],g[f]=d>0?i(h/b[r-d]%b[d])*u:0),n)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>L?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function Q(e){var t,s=e.e;return null===s?e.toString():(t=p(e.c),t=s<=R||s>=O?w(t,s):_(t,s,"0"),e.s<0?"-"+t:t)}return W.clone=e,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(e){var t,s;if(null!=e){if("object"!=typeof e)throw Error(r+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(s=e[t],0,h,t),D=s),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(s=e[t],0,8,t),N=s),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((s=e[t])&&s.pop?(b(s[0],-h,0,t),b(s[1],0,h,t),R=s[0],O=s[1]):(b(s,-h,h,t),R=-(O=s<0?-s:s))),e.hasOwnProperty(t="RANGE"))if((s=e[t])&&s.pop)b(s[0],-h,-1,t),b(s[1],1,h,t),M=s[0],L=s[1];else{if(b(s,-h,h,t),!s)throw Error(r+t+" cannot be zero: "+s);M=-(L=s<0?-s:s)}if(e.hasOwnProperty(t="CRYPTO")){if((s=e[t])!==!!s)throw Error(r+t+" not true or false: "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!s,Error(r+"crypto unavailable");F=s}else F=s}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(s=e[t],0,9,t),B=s),e.hasOwnProperty(t="POW_PRECISION")&&(b(s=e[t],0,h,t),G=s),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(s=e[t]))throw Error(r+t+" not an object: "+s);H=s}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(s=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(s))throw Error(r+t+" invalid: "+s);q="0123456789"==s.slice(0,10),U=s}}return{DECIMAL_PLACES:D,ROUNDING_MODE:N,EXPONENTIAL_AT:[R,O],RANGE:[M,L],CRYPTO:F,MODULO_MODE:B,POW_PRECISION:G,FORMAT:H,ALPHABET:U}},W.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!W.DEBUG)return!0;var t,s,n=e.c,a=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&a>=-h&&a<=h&&a===i(a)){if(0===n[0]){if(0===a&&1===n.length)return!0;break e}if((t=(a+1)%l)<1&&(t+=l),String(n[0]).length==t){for(t=0;t<n.length;t++)if((s=n[t])<0||s>=c||s!==i(s))break e;if(0!==s)return!0}}}else if(null===n&&null===a&&(null===o||1===o||-1===o))return!0;throw Error(r+"Invalid BigNumber: "+e)},W.maximum=W.max=function(){return V(arguments,-1)},W.minimum=W.min=function(){return V(arguments,1)},W.random=(S=9007199254740992,I=Math.random()*S&2097151?function(){return i(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,s,n,o,c,d=0,u=[],f=new W(P);if(null==e?e=D:b(e,0,h),o=a(e/l),F)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));d<o;)(c=131072*t[d]+(t[d+1]>>>11))>=9e15?(s=crypto.getRandomValues(new Uint32Array(2)),t[d]=s[0],t[d+1]=s[1]):(u.push(c%1e14),d+=2);d=o/2}else{if(!crypto.randomBytes)throw F=!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(!F)for(;d<o;)(c=I())<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=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=l);for(d=1,c=u[0];c>=10;c/=10,d++);d<l&&(n-=l-d)}return f.e=n,f.c=u,f}),W.sum=function(){for(var e=1,t=arguments,s=new W(t[0]);e<t.length;)s=s.plus(t[e++]);return s},T=function(){var e="0123456789";function t(e,t,s,n){for(var a,i,r=[0],o=0,c=e.length;o<c;){for(i=r.length;i--;r[i]*=t);for(r[0]+=n.indexOf(e.charAt(o++)),a=0;a<r.length;a++)r[a]>s-1&&(null==r[a+1]&&(r[a+1]=0),r[a+1]+=r[a]/s|0,r[a]%=s)}return r.reverse()}return function(n,a,i,r,o){var c,l,d,m,u,h,f,g,b=n.indexOf("."),k=D,w=N;for(b>=0&&(m=G,G=0,n=n.replace(".",""),h=(g=new W(a)).pow(n.length-b),G=m,g.c=t(_(p(h.c),h.e,"0"),10,i,e),g.e=g.c.length),d=m=(f=t(n,a,i,o?(c=U,e):(c=e,U))).length;0==f[--m];f.pop());if(!f[0])return c.charAt(0);if(b<0?--d:(h.c=f,h.e=d,h.s=r,f=(h=s(h,g,k,w,i)).c,u=h.r,d=h.e),b=f[l=d+k+1],m=i/2,u=u||l<0||null!=f[l+1],u=w<4?(null!=b||u)&&(0==w||w==(h.s<0?3:2)):b>m||b==m&&(4==w||u||6==w&&1&f[l-1]||w==(h.s<0?8:7)),l<1||!f[0])n=u?_(c.charAt(1),-k,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(b=0,n="";b<=m;n+=c.charAt(f[b++]));n=_(n,d,c.charAt(0))}return n}}(),s=function(){function e(e,t,s){var n,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)+(n=d*i+(r=e[c]/u|0)*l)%u*u+o)/s|0)+(n/u|0)+d*r,e[c]=a%s;return o&&(e=[o].concat(e)),e}function t(e,t,s,n){var a,i;if(s!=n)i=s>n?1:-1;else for(a=i=0;a<s;a++)if(e[a]!=t[a]){i=e[a]>t[a]?1:-1;break}return i}function s(e,t,s,n){for(var a=0;s--;)e[s]-=a,a=e[s]<t[s]?1:0,e[s]=a*n+e[s]-t[s];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,a,r,o,d){var m,u,h,p,g,b,k,w,_,T,E,S,I,A,y,x,v,C=n.s==a.s?1:-1,j=n.c,P=a.c;if(!(j&&j[0]&&P&&P[0]))return new W(n.s&&a.s&&(j?!P||j[0]!=P[0]:P)?j&&0==j[0]||!P?0*C:C/0:NaN);for(_=(w=new W(C)).c=[],C=r+(u=n.e-a.e)+1,d||(d=c,u=f(n.e/l)-f(a.e/l),C=C/l|0),h=0;P[h]==(j[h]||0);h++);if(P[h]>(j[h]||0)&&u--,C<0)_.push(1),p=!0;else{for(A=j.length,x=P.length,h=0,C+=2,(g=i(d/(P[0]+1)))>1&&(P=e(P,g,d),j=e(j,g,d),x=P.length,A=j.length),I=x,E=(T=j.slice(0,x)).length;E<x;T[E++]=0);v=P.slice(),v=[0].concat(v),y=P[0],P[1]>=d/2&&y++;do{if(g=0,(m=t(P,T,x,E))<0){if(S=T[0],x!=E&&(S=S*d+(T[1]||0)),(g=i(S/y))>1)for(g>=d&&(g=d-1),k=(b=e(P,g,d)).length,E=T.length;1==t(b,T,k,E);)g--,s(b,x<k?v:P,k,d),k=b.length,m=1;else 0==g&&(m=g=1),k=(b=P.slice()).length;if(k<E&&(b=[0].concat(b)),s(T,b,E,d),E=T.length,-1==m)for(;t(P,T,x,E)<1;)g++,s(T,x<E?v:P,E,d),E=T.length}else 0===m&&(g++,T=[0]);_[h++]=g,T[0]?T[E++]=j[I]||0:(T=[j[I]],E=1)}while((I++<A||null!=T[0])&&C--);p=null!=T[0],_[0]||_.splice(0,1)}if(d==c){for(h=1,C=_[0];C>=10;C/=10,h++);Y(w,r+(w.e=h+u*l-1)+1,o,p)}else w.e=u,w.r=+p;return w}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,x=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,s,n){var a,i=s?t:t.replace(C,"");if(v.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!s&&(i=i.replace(A,function(e,t,s){return a="x"==(s=s.toLowerCase())?16:"b"==s?2:8,n&&n!=a?e:t}),n&&(a=n,i=i.replace(y,"$1").replace(x,"0.$1")),t!=i))return new W(i,a);if(W.DEBUG)throw Error(r+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},j.absoluteValue=j.abs=function(){var e=new W(this);return e.s<0&&(e.s=1),e},j.comparedTo=function(e,t){return g(this,new W(e,t))},j.decimalPlaces=j.dp=function(e,t){var s,n,a,i=this;if(null!=e)return b(e,0,h),null==t?t=N:b(t,0,8),Y(new W(i),e+i.e+1,t);if(!(s=i.c))return null;if(n=((a=s.length-1)-f(this.e/l))*l,a=s[a])for(;a%10==0;a/=10,n--);return n<0&&(n=0),n},j.dividedBy=j.div=function(e,t){return s(this,new W(e,t),D,N)},j.dividedToIntegerBy=j.idiv=function(e,t){return s(this,new W(e,t),0,1)},j.exponentiatedBy=j.pow=function(e,t){var s,n,o,c,d,m,u,h,f=this;if((e=new W(e)).c&&!e.isInteger())throw Error(r+"Exponent not an integer: "+Q(e));if(null!=t&&(t=new W(t)),d=e.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!e.c||!e.c[0])return h=new W(Math.pow(+Q(f),d?e.s*(2-k(e)):+Q(e))),t?h.mod(t):h;if(m=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new W(NaN);(n=!m&&f.isInteger()&&t.isInteger())&&(f=f.mod(t))}else{if(e.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||d&&f.c[1]>=24e7:f.c[0]<8e13||d&&f.c[0]<=9999975e7)))return c=f.s<0&&k(e)?-0:0,f.e>-1&&(c=1/c),new W(m?1/c:c);G&&(c=a(G/l+2))}for(d?(s=new W(.5),m&&(e.s=1),u=k(e)):u=(o=Math.abs(+Q(e)))%2,h=new W(P);;){if(u){if(!(h=h.times(f)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(o){if(0===(o=i(o/2)))break;u=o%2}else if(Y(e=e.times(s),e.e+1,1),e.e>14)u=k(e);else{if(0===(o=+Q(e)))break;u=o%2}f=f.times(f),c?f.c&&f.c.length>c&&(f.c.length=c):n&&(f=f.mod(t))}return n?h:(m&&(h=P.div(h)),t?h.mod(t):c?Y(h,G,N,undefined):h)},j.integerValue=function(e){var t=new W(this);return null==e?e=N:b(e,0,8),Y(t,t.e+1,e)},j.isEqualTo=j.eq=function(e,t){return 0===g(this,new W(e,t))},j.isFinite=function(){return!!this.c},j.isGreaterThan=j.gt=function(e,t){return g(this,new W(e,t))>0},j.isGreaterThanOrEqualTo=j.gte=function(e,t){return 1===(t=g(this,new W(e,t)))||0===t},j.isInteger=function(){return!!this.c&&f(this.e/l)>this.c.length-2},j.isLessThan=j.lt=function(e,t){return g(this,new W(e,t))<0},j.isLessThanOrEqualTo=j.lte=function(e,t){return-1===(t=g(this,new W(e,t)))||0===t},j.isNaN=function(){return!this.s},j.isNegative=function(){return this.s<0},j.isPositive=function(){return this.s>0},j.isZero=function(){return!!this.c&&0==this.c[0]},j.minus=function(e,t){var s,n,a,i,r=this,o=r.s;if(t=(e=new W(e,t)).s,!o||!t)return new W(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 W(h?r:NaN);if(!u[0]||!h[0])return h[0]?(e.s=-t,e):new W(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(n=(i=(o=u.length)<(t=h.length))?o:t,o=t=0;t<n;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=(n=h.length)-(s=u.length))>0)for(;t--;u[s++]=0);for(t=c-1;n>o;){if(u[--n]<h[n]){for(s=n;s&&!u[--s];u[s]=t);--u[s],u[n]+=c}u[n]-=h[n]}for(;0==u[0];u.splice(0,1),--m);return u[0]?K(e,u,m):(e.s=3==N?-1:1,e.c=[e.e=0],e)},j.modulo=j.mod=function(e,t){var n,a,i=this;return e=new W(e,t),!i.c||!e.s||e.c&&!e.c[0]?new W(NaN):!e.c||i.c&&!i.c[0]?new W(i):(9==B?(a=e.s,e.s=1,n=s(i,e,0,3),e.s=a,n.s*=a):n=s(i,e,0,B),(e=i.minus(n.times(e))).c[0]||1!=B||(e.s=i.s),e)},j.multipliedBy=j.times=function(e,t){var s,n,a,i,r,o,d,m,h,p,g,b,k,w,_,T=this,E=T.c,S=(e=new W(e,t)).c;if(!(E&&S&&E[0]&&S[0]))return!T.s||!e.s||E&&!E[0]&&!S||S&&!S[0]&&!E?e.c=e.e=e.s=null:(e.s*=T.s,E&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=f(T.e/l)+f(e.e/l),e.s*=T.s,(d=E.length)<(p=S.length)&&(k=E,E=S,S=k,a=d,d=p,p=a),a=d+p,k=[];a--;k.push(0));for(w=c,_=u,a=p;--a>=0;){for(s=0,g=S[a]%_,b=S[a]/_|0,i=a+(r=d);i>a;)s=((m=g*(m=E[--r]%_)+(o=b*m+(h=E[r]/_|0)*g)%_*_+k[i]+s)/w|0)+(o/_|0)+b*h,k[i--]=m%w;k[i]=s}return s?++n:k.splice(0,1),K(e,k,n)},j.negated=function(){var e=new W(this);return e.s=-e.s||null,e},j.plus=function(e,t){var s,n=this,a=n.s;if(t=(e=new W(e,t)).s,!a||!t)return new W(NaN);if(a!=t)return e.s=-t,n.minus(e);var i=n.e/l,r=e.e/l,o=n.c,d=e.c;if(!i||!r){if(!o||!d)return new W(a/0);if(!o[0]||!d[0])return d[0]?e:new W(o[0]?n:0*a)}if(i=f(i),r=f(r),o=o.slice(),a=i-r){for(a>0?(r=i,s=d):(a=-a,s=o),s.reverse();a--;s.push(0));s.reverse()}for((a=o.length)-(t=d.length)<0&&(s=d,d=o,o=s,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),K(e,o,r)},j.precision=j.sd=function(e,t){var s,n,a,i=this;if(null!=e&&e!==!!e)return b(e,1,h),null==t?t=N:b(t,0,8),Y(new W(i),e,t);if(!(s=i.c))return null;if(n=(a=s.length-1)*l+1,a=s[a]){for(;a%10==0;a/=10,n--);for(a=s[0];a>=10;a/=10,n++);}return e&&i.e+1>n&&(n=i.e+1),n},j.shiftedBy=function(e){return b(e,-9007199254740991,d),this.times("1e"+e)},j.squareRoot=j.sqrt=function(){var e,t,n,a,i,r=this,o=r.c,c=r.s,l=r.e,d=D+4,m=new W("0.5");if(1!==c||!o||!o[0])return new W(!c||c<0&&(!o||o[0])?NaN:o?r:1/0);if(0==(c=Math.sqrt(+Q(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),n=new W(t=c==1/0?"5e"+l:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+l)):n=new W(c+""),n.c[0])for((c=(l=n.e)+d)<3&&(c=0);;)if(i=n,n=m.times(i.plus(s(r,i,d,1))),p(i.c).slice(0,c)===(t=p(n.c)).slice(0,c)){if(n.e<l&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(a||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Y(n,n.e+D+2,1),e=!n.times(n).eq(r));break}if(!a&&(Y(i,i.e+D+2,0),i.times(i).eq(r))){n=i;break}d+=4,c+=4,a=1}return Y(n,n.e+D+1,N,e)},j.toExponential=function(e,t){return null!=e&&(b(e,0,h),e++),$(this,e,t,1)},j.toFixed=function(e,t){return null!=e&&(b(e,0,h),e=e+this.e+1),$(this,e,t)},j.toFormat=function(e,t,s){var n,a=this;if(null==s)null!=e&&t&&"object"==typeof t?(s=t,t=null):e&&"object"==typeof e?(s=e,e=t=null):s=H;else if("object"!=typeof s)throw Error(r+"Argument not an object: "+s);if(n=a.toFixed(e,t),a.c){var i,o=n.split("."),c=+s.groupSize,l=+s.secondaryGroupSize,d=s.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)}n=u?m+(s.decimalSeparator||"")+((l=+s.fractionGroupSize)?u.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(s.fractionGroupSeparator||"")):u):m}return(s.prefix||"")+n+(s.suffix||"")},j.toFraction=function(e){var t,n,a,i,o,c,d,u,h,f,g,b,k=this,w=k.c;if(null!=e&&(!(d=new W(e)).isInteger()&&(d.c||1!==d.s)||d.lt(P)))throw Error(r+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+Q(d));if(!w)return new W(k);for(t=new W(P),h=n=new W(P),a=u=new W(P),b=p(w),o=t.e=b.length-k.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=L,L=1/0,d=new W(b),u.c[0]=0;f=s(d,t,0,1),1!=(i=n.plus(f.times(a))).comparedTo(e);)n=a,a=i,h=u.plus(f.times(i=h)),u=i,t=d.minus(f.times(i=t)),d=i;return i=s(e.minus(n),a,0,1),u=u.plus(i.times(h)),n=n.plus(i.times(a)),u.s=h.s=k.s,g=s(h,a,o*=2,N).minus(k).abs().comparedTo(s(u,n,o,N).minus(k).abs())<1?[h,a]:[u,n],L=c,g},j.toNumber=function(){return+Q(this)},j.toPrecision=function(e,t){return null!=e&&b(e,1,h),$(this,e,t,2)},j.toString=function(e){var t,s=this,n=s.s,a=s.e;return null===a?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=a<=R||a>=O?w(p(s.c),a):_(p(s.c),a,"0"):10===e&&q?t=_(p((s=Y(new W(s),D+a+1,N)).c),s.e,"0"):(b(e,2,U.length,"Base"),t=T(_(p(s.c),a,"0"),10,e,n,!0)),n<0&&s.c[0]&&(t="-"+t)),t},j.valueOf=j.toJSON=function(){return Q(this)},j._isBigNumber=!0,null!=t&&W.set(t),W}(),s.default=s.BigNumber=s,"function"==typeof define&&define.amd?define(function(){return s}):void 0!==t&&t.exports?t.exports=s:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=s)}(this)}}},{package:"@metamask/bridge-status-controller>bignumber.js",file:"node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/browser-passworder/dist/index.js",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(t){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.isVaultUpdated=s.updateVaultWithDetail=s.updateVault=s.generateSalt=s.serializeBufferForStorage=s.serializeBufferFromStorage=s.keyFromPassword=s.exportKey=s.importKey=s.decryptWithKey=s.decryptWithDetail=s.decrypt=s.encryptWithKey=s.encryptWithDetail=s.encrypt=void 0;const n=e("@metamask/utils"),a="jwk",i="AES-GCM",r="utf-8",o={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function l(e,t,s,n=g(),a=c){const i=s||await p(e,n,!1,a),r=await m(i,t);return r.salt=n,JSON.stringify(r)}async function d(e,t,s=g(),n=c){const a=await p(e,s,!0,n),i=await f(a);return{vault:await l(e,t,a,s),exportedKeyString:i}}async function m(e,s){const n=JSON.stringify(s),a=t.from(n,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 b(e)&&(u.keyMetadata=e.derivationOptions),u}async function u(e,t,s){const n=JSON.parse(t),{salt:a,keyMetadata:i}=n,r=w(s||await p(e,a,!1,i));return await h(r,n)}async function h(e,s){const n=t.from(s.data,"base64"),a=t.from(s.iv,"base64"),o=w(e);let c;try{const e=await crypto.subtle.decrypt({name:i,iv:a},o,n),s=new Uint8Array(e),l=t.from(s).toString(r);c=JSON.parse(l)}catch(e){throw new Error("Incorrect password")}return c}async function f(e){return b(e)?JSON.stringify({key:await globalThis.crypto.subtle.exportKey(a,e.key),derivationOptions:e.derivationOptions}):JSON.stringify(await globalThis.crypto.subtle.exportKey(a,e))}async function p(e,s,n=!1,a=o){const c=t.from(e,r),l=t.from(s,"base64"),d=await globalThis.crypto.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),m=await globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:l,iterations:a.params.iterations,hash:"SHA-256"},d,{name:i,length:256},n,["encrypt","decrypt"]);return a?{key:m,derivationOptions:a}:m}function g(e=32){const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);return btoa(String.fromCharCode.apply(null,t))}function b(e){return(0,n.isPlainObject)(e)&&(0,n.hasProperty)(e,"key")&&(0,n.hasProperty)(e,"derivationOptions")&&e.key instanceof CryptoKey&&k(e.derivationOptions)}function k(e){return(0,n.isPlainObject)(e)&&(0,n.hasProperty)(e,"algorithm")&&(0,n.hasProperty)(e,"params")}function w(e){return b(e)?e.key:e}function _(e,t=c){const{keyMetadata:s}=JSON.parse(e);return k(s)&&s.algorithm===t.algorithm&&s.params.iterations===t.params.iterations}s.encrypt=l,s.encryptWithDetail=d,s.encryptWithKey=m,s.decrypt=u,s.decryptWithDetail=async function(e,t){const s=JSON.parse(t),{salt:n,keyMetadata:a}=s,i=await p(e,n,!0,a);return{exportedKeyString:await f(i),vault:await u(e,t,i),salt:n}},s.decryptWithKey=h,s.importKey=async function(e){const t=JSON.parse(e);return s=t,(0,n.isPlainObject)(s)&&(0,n.hasProperty)(s,"key")&&(0,n.hasProperty)(s,"derivationOptions")&&k(s.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 s},s.exportKey=f,s.keyFromPassword=p,s.serializeBufferFromStorage=function(e){const t="0x"===e.slice(0,2)?e.slice(2):e,s=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const n=t.substr(e,2);s[e/2]=parseInt(n,16)}return s},s.serializeBufferForStorage=function(e){let t="0x";return e.forEach(e=>{t+=function(e){let t=e.toString(16);for(;t.length<2;)t=`0${t}`;return t}(e)}),t},s.generateSalt=g,s.updateVault=async function(e,t,s=c){return _(e,s)?e:l(t,await u(t,e),undefined,undefined,s)},s.updateVaultWithDetail=async function(e,t,s=c){return _(e.vault,s)?e:d(t,await u(t,e.vault),undefined,s)},s.isVaultUpdated=_}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/browser-passworder",file:"node_modules/@metamask/browser-passworder/dist/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},r=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.DelegationController=s.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");s.controllerName="DelegationController";const u={delegations:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};class h extends o.BaseController{constructor({messenger:e,state:t,hashDelegation:r,getDelegationEnvironment:o}){super({messenger:e,metadata:u,name:s.controllerName,state:{delegations:{},...t}}),n.set(this,void 0),a.set(this,void 0),i(this,n,r,"f"),i(this,a,o,"f")}async signDelegation(e){const{delegation:t,chainId:s}=e,{DelegationManager:n}=r(this,a,"f").call(this,s),i=(0,m.createTypedMessageParams)({chainId:(0,l.hexToNumber)(s),from:t.delegator,delegation:{...t,signature:"0x"},verifyingContract:n});return await this.messenger.call("KeyringController:signTypedMessage",i,c.SignTypedDataVersion.V4)}store(e){const{entry:t}=e,s=r(this,n,"f").call(this,t.delegation);if(!(0,m.isHexEqual)(t.delegation.authority,d.ROOT_AUTHORITY)&&!this.state.delegations[t.delegation.authority])throw new Error("Invalid authority");this.update(e=>{e.delegations[s]=t})}list(e){const t=this.messenger.call("AccountsController:getSelectedAccount").address;let s=Object.values(this.state.delegations);e?.from&&(s=s.filter(t=>(0,m.isHexEqual)(t.delegation.delegator,e.from))),(!e?.from||e?.from&&!(0,m.isHexEqual)(e.from,t))&&(s=s.filter(e=>(0,m.isHexEqual)(e.delegation.delegate,t)));const n=e?.chainId;n&&(s=s.filter(e=>(0,m.isHexEqual)(e.chainId,n)));const a=e?.tags;return a&&a.length>0&&(s=s.filter(e=>a.every(t=>e.tags.includes(t)))),s}retrieve(e){return this.state.delegations[e]??null}chain(e){const t=[],s=this.retrieve(e);if(!s)return null;t.push(s);for(let e=s.delegation.authority;e!==d.ROOT_AUTHORITY;){const s=this.retrieve(e);if(!s)throw new Error("Invalid delegation chain");t.push(s),e=s.delegation.authority}return t}delete(e){if(!this.retrieve(e))return 0;const t=Object.entries(this.state.delegations),s=[e],n=[];for(;s.length>0;){const e=s.pop();t.filter(([t,s])=>s.delegation.authority===e).forEach(([e])=>{s.push(e)}),n.push(e)}return this.update(e=>{n.forEach(t=>{delete e.delegations[t]})}),n.length}}s.DelegationController=h,n=new WeakMap,a=new WeakMap}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SIGNABLE_DELEGATION_TYPED_DATA=s.ROOT_AUTHORITY=void 0,s.ROOT_AUTHORITY="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";s.SIGNABLE_DELEGATION_TYPED_DATA={EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Caveat:[{name:"enforcer",type:"address"},{name:"terms",type:"bytes"}],Delegation:[{name:"delegate",type:"address"},{name:"delegator",type:"address"},{name:"authority",type:"bytes32"},{name:"caveats",type:"Caveat[]"},{name:"salt",type:"uint256"}]}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/index.cjs",{"./DelegationController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DelegationController=void 0;var n=e("./DelegationController.cjs");Object.defineProperty(s,"DelegationController",{enumerable:!0,get:function(){return n.DelegationController}})}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createTypedMessageParams=s.toDelegationStruct=s.isHexEqual=void 0;const n=e("@metamask/utils"),a=e("./constants.cjs");s.isHexEqual=function(e,t){return e.toLowerCase()===t.toLowerCase()};s.toDelegationStruct=e=>{const t=e.caveats.map(e=>({enforcer:(0,n.getChecksumAddress)(e.enforcer),terms:e.terms,args:e.args})),s="0x"===e.salt?0n:BigInt(e.salt);return{delegate:(0,n.getChecksumAddress)(e.delegate),delegator:(0,n.getChecksumAddress)(e.delegator),authority:e.authority,caveats:t,salt:s,signature:e.signature}},s.createTypedMessageParams=function(e){const{chainId:t,from:n,delegation: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,s.toDelegationStruct)(i)},from:n}}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-deployments/dist/index.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0});var n={DelegationManager:"0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c",MultiSigDeleGatorImpl:"0x56a9EdB16a0105eb5a4C54f4C062e2868844f3A7",HybridDeleGatorImpl:"0x48dBe696A4D990079e039489bA2053B36E8FFEC4",EIP7702StatelessDeleGatorImpl:"0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B",AllowedCalldataEnforcer:"0xc2b0d624c1c4319760C96503BA27C347F3260f55",AllowedMethodsEnforcer:"0x2c21fD0Cb9DC8445CB3fb0DC5E7Bb0Aca01842B5",AllowedTargetsEnforcer:"0x7F20f61b1f09b08D970938F6fa563634d65c4EeB",BlockNumberEnforcer:"0x5d9818dF0AE3f66e9c3D0c5029DAF99d1823ca6c",DeployedEnforcer:"0x24ff2AA430D53a8CD6788018E902E098083dcCd2",ERC20BalanceChangeEnforcer:"0xcdF6aB796408598Cea671d79506d7D48E97a5437",ERC20TransferAmountEnforcer:"0xf100b0819427117EcF76Ed94B358B1A5b5C6D2Fc",ERC20PeriodTransferEnforcer:"0x474e3Ae7E169e940607cC624Da8A15Eb120139aB",ERC20StreamingEnforcer:"0x56c97aE02f233B29fa03502Ecc0457266d9be00e",ERC721BalanceChangeEnforcer:"0x8aFdf96eDBbe7e1eD3f5Cd89C7E084841e12A09e",ERC721TransferEnforcer:"0x3790e6B7233f779b09DA74C72b6e94813925b9aF",ERC1155BalanceChangeEnforcer:"0x63c322732695cAFbbD488Fc6937A0A7B66fC001A",ExactCalldataBatchEnforcer:"0x982FD5C86BBF425d7d1451f974192d4525113DfD",ExactCalldataEnforcer:"0x99F2e9bF15ce5eC84685604836F71aB835DBBdED",ExactExecutionBatchEnforcer:"0x1e141e455d08721Dd5BCDA1BaA6Ea5633Afd5017",ExactExecutionEnforcer:"0x146713078D39eCC1F5338309c28405ccf85Abfbb",IdEnforcer:"0xC8B5D93463c893401094cc70e66A206fb5987997",LimitedCallsEnforcer:"0x04658B29F6b82ed55274221a06Fc97D318E25416",NativeBalanceChangeEnforcer:"0xbD7B277507723490Cd50b12EaaFe87C616be6880",ArgsEqualityCheckEnforcer:"0x44B8C6ae3C304213c3e298495e12497Ed3E56E41",NativeTokenPaymentEnforcer:"0x4803a326ddED6dDBc60e659e5ed12d85c7582811",NativeTokenTransferAmountEnforcer:"0xF71af580b9c3078fbc2BBF16FbB8EEd82b330320",NativeTokenStreamingEnforcer:"0xD10b97905a320b13a0608f7E9cC506b56747df19",NativeTokenPeriodTransferEnforcer:"0x9BC0FAf4Aca5AE429F4c06aEEaC517520CB16BD9",NonceEnforcer:"0xDE4f2FAC4B3D87A1d9953Ca5FC09FCa7F366254f",OwnershipTransferEnforcer:"0x7EEf9734E7092032B5C56310Eb9BbD1f4A524681",RedeemerEnforcer:"0xE144b0b2618071B4E56f746313528a669c7E65c5",SpecificActionERC20TransferBatchEnforcer:"0x6649b61c873F6F9686A1E1ae9ee98aC380c7bA13",TimestampEnforcer:"0x1046bb45C8d673d4ea75321280DB34899413c069",ValueLteEnforcer:"0x92Bf12322527cAA612fd31a0e810472BBB106A8F",MultiTokenPeriodEnforcer:"0xFB2f1a9BD76d3701B730E5d69C3219D42D80eBb7"},a={DelegationManager:"0x56D56e07e3d6Ee5a24e30203A37a0a460f42D7A3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x6ff518884f21168c30c58CB21184D6AdBC18Ad90",MultiSigDeleGatorImpl:"0xd1f421EDbA5e3FA9efe3874827114b20C5BEC40C",HybridDeleGatorImpl:"0x941f3a016F8726d5643Ce62452d0D78492D42b42",AllowedCalldataEnforcer:"0xff71d60f3208469cBCE0859717B5198042DCB3F3",AllowedMethodsEnforcer:"0xe32C2561792e8446Abe73B9f557B881C13906186",AllowedTargetsEnforcer:"0x06aaE4c67EEA95277c46Bf79b1583d4a01772D22",BlockNumberEnforcer:"0x8E470D2Ae278457b42d2405E0B8Cd4BE21Ed9045",DeployedEnforcer:"0xf9088f013dBD9ebb7Cebd66fEB48253c6Ac5a820",ERC20BalanceGteEnforcer:"0xB7B6f32ec6343261D814e55Ed8C5925d91Cab861",ERC20TransferAmountEnforcer:"0x9A069b18032B31429A363AeCFb1B6A0564b44471",IdEnforcer:"0x91015c3b9D9523966eD2399885e5Df7A567f916c",LimitedCallsEnforcer:"0xe694bFfffEA3E85923b1210b37e6a0175e910863",NonceEnforcer:"0xE83BCFD8bBE672A96747e831050a91cf44F4F87A",TimestampEnforcer:"0x550FdD13eEBC1f22ea2a2480024BacBF0Ad7e5CE",ValueLteEnforcer:"0xBE32a6DB7471F63BB168C088c57Db01AfAe87967",NativeTokenTransferAmountEnforcer:"0x5eD3833d7B957A8DB8A461c3AF2d668Ec25382E0",NativeBalanceGteEnforcer:"0x376a98860E210DdEda3689fb39565592c563cB0A",ArgsEqualityCheckEnforcer:"0x7378dE585998d3E18Ce147867C335C25B3dB8Ee5",NativeTokenPaymentEnforcer:"0x87Fe18EbF99e42fcE8A03a25F1d20E119407f8e7",RedeemerEnforcer:"0x926672b130D1EF60A9d6b11D2048d121b30f40C1"},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]:n,[r.polygon]:n,[r.bsc]:n,[r.optimism]:n,[r.arbitrum]:n,[r.ink]:n,[r.linea]:n,[r.base]:n,[r.gnosis]:n,[r.berachain]:n,[r.unichain]:n,[r.arbitrumNova]:n,[r.sei]:n,[r.sonic]:n,[r.monad]:n,[r.bscTestnet]:n,[r.citreaTestnet]:n,[r.megaEthTestnet]:n,[r.chiado]:n,[r.lineaSepolia]:n,[r.berachainBepolia]:n,[r.baseSepolia]:n,[r.arbitrumSepolia]:n,[r.sepolia]:n,[r.optimismSepolia]:n,[r.unichainSepolia]:n,[r.polygonAmoy]:n,[r.inkSepolia]:n,[r.monadTestnet]:n,[r.seiTestnet]:n,[r.sonicTestnet]:n,[r.hoodiTestnet]:n}};s.CHAIN_ID=r,s.DELEGATOR_CONTRACTS=o}}},{package:"@metamask/delegation-deployments",file:"node_modules/@metamask/delegation-deployments/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.GetCallsStatusCode=s.EIP7682ErrorCode=s.EIP5792ErrorCode=s.SupportedCapabilities=s.MessageType=s.KEYRING_TYPES_SUPPORTING_7702=s.VERSION=void 0;const n=e("@metamask/keyring-controller");var a,i,r,o,c;s.VERSION="2.0.0",s.KEYRING_TYPES_SUPPORTING_7702=[n.KeyringTypes.hd,n.KeyringTypes.simple],function(e){e.SendTransaction="eth_sendTransaction"}(a||(s.MessageType=a={})),function(e){e.AuxiliaryFunds="auxiliaryFunds"}(i||(s.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||(s.EIP5792ErrorCode=r={})),function(e){e[e.UnsupportedAsset=5771]="UnsupportedAsset",e[e.UnsupportedChain=5772]="UnsupportedChain",e[e.MalformedRequiredAssets=5773]="MalformedRequiredAssets"}(o||(s.EIP7682ErrorCode=o={})),function(e){e[e.PENDING=100]="PENDING",e[e.CONFIRMED=200]="CONFIRMED",e[e.FAILED_OFFCHAIN=400]="FAILED_OFFCHAIN",e[e.REVERTED=500]="REVERTED",e[e.REVERTED_PARTIAL=600]="REVERTED_PARTIAL"}(c||(s.GetCallsStatusCode=c={}))}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getCallsStatus=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/transaction-controller"),i=e("../constants.cjs");s.getCallsStatus=function(e,t){const s=e.call("TransactionController:getState").transactions.filter(e=>e.batchId===t);if(!s?.length)throw new n.JsonRpcError(i.EIP5792ErrorCode.UnknownBundleId,"No matching bundle found");const r=s[0],{chainId:o,txReceipt:c}=r,l=function(e){const{hash:t,status:s}=e;if(s===a.TransactionStatus.confirmed)return i.GetCallsStatusCode.CONFIRMED;if(s===a.TransactionStatus.failed)return t?i.GetCallsStatusCode.REVERTED:i.GetCallsStatusCode.FAILED_OFFCHAIN;if(s===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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getCapabilities=void 0;const n=e("../constants.cjs"),a=e("../utils.cjs");s.getCapabilities=async function(e,t,s,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:s,chainIds:u}),f=await async function(e,t,s,n,a,i){const r=i.call("PreferencesController:getState").useTransactionSimulations,o=await Promise.all(t.map(({chainId:e})=>e).map(e=>n(e))),c=await a(e),l=t.map((e,t)=>({...e,relaySupportedForChain:o[t]}));return e.reduce((e,t)=>{const n=l.find(({chainId:e})=>e===t)??{},{isSupported:a=!1,relaySupportedForChain:i}=n,o=s(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)(s,t);f=n.KEYRING_TYPES_SUPPORTING_7702.includes(e)}catch{}if(!l&&!(!u&&d&&!c&&f))return e;const p=l?"supported":"ready",g=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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.processSendCalls=void 0;const n=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 n.rpcErrors.invalidInput(`Version not supported: Got ${t}, expected ${c.VERSION}`)}function m(e,t){const{chainId:s}=e;if(s&&s.toLowerCase()!==t.toLowerCase())throw n.rpcErrors.invalidParams(`Chain ID must match the dApp selected network: Got ${s}, expected ${t}`)}function u(e,t,s){const{calls:a,capabilities: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 n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capabilities: ${o.join(", ")}`);i?.auxiliaryFunds&&h({auxiliaryFunds:i.auxiliaryFunds,chainId:r,keyringType:t,isAuxiliaryFundsSupported:s});for(const e of a)e.capabilities?.auxiliaryFunds&&h({auxiliaryFunds:e.capabilities.auxiliaryFunds,chainId:r,keyringType:t,isAuxiliaryFundsSupported:s})}function h({auxiliaryFunds:e,chainId:t,keyringType:s,isAuxiliaryFundsSupported:a}){if(e.optional)return;if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(s))throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capability: ${c.SupportedCapabilities.AuxiliaryFunds}`);if(!a(t))throw new n.JsonRpcError(c.EIP7682ErrorCode.UnsupportedChain,`The wallet no longer supports auxiliary funds on the requested chain: ${t}`);if(e?.requiredAssets)for(const t of e.requiredAssets)if("erc20"!==t.standard)throw new n.JsonRpcError(c.EIP7682ErrorCode.UnsupportedAsset,`The requested asset ${t.address} is not available through the wallet’s auxiliary fund system: unsupported token standard ${t.standard}`)}function f(e){const t=[...e.capabilities?.auxiliaryFunds?.requiredAssets??[],...e.calls.flatMap(e=>e.capabilities?.auxiliaryFunds?.requiredAssets??[])];if(0===t.length)return undefined;const s=(0,r.groupBy)(t,e=>`${e.address.toLowerCase()}-${e.standard}`);return Object.values(s).map(e=>{if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+BigInt(t.amount),0n);return{...e[0],amount:(0,i.add0x)(t.toString(16))}})}s.processSendCalls=async function(e,t,s,r){const{addTransactionBatch:h,addTransaction:p,getDismissSmartAccountSuggestionEnabled:g,isAtomicBatchSupported:b,validateSecurity:k,getPermittedAccountsForOrigin:w,isAuxiliaryFundsSupported:_}=e,{calls:T,from:E}=s,{networkClientId:S,origin:I}=r,A=T.map(e=>({params:e})),{chainId:y}=t.call("NetworkController:getNetworkClientById",S).configuration,[x]=await w(),v=E??x;if(!v)throw n.providerErrors.unauthorized();const C=(0,o.v4)(),j=k.bind(null,C),P=r.id?String(r.id):"";let D;return D=1===Object.keys(A).length?await async function({addTransaction:e,chainId:t,from:s,messenger:n,networkClientId:r,origin:h,requestId:p,securityAlertId:g,sendCalls:b,transactions:k,validateSecurity:w,isAuxiliaryFundsSupported:_}){const T=(0,l.getAccountKeyringType)(s,n);!function(e,t,s,n){d(e),u(e,s,n),m(e,t)}(b,t,T,_);const E={from:s,...k[0].params,type:a.TransactionEnvelopeType.feeMarket},S={method:c.MessageType.SendTransaction,params:[E],origin:h};w(S,t);const I=f(b),A=function(){const e=(0,o.v4)(),t=new Uint8Array((0,o.parse)(e));return(0,i.bytesToHex)(t)}();return await e(E,{batchId:A,networkClientId:r,origin:h,requestId:p,requiredAssets:I,securityAlertResponse:{securityAlertId:g}}),A}({addTransaction:p,chainId:y,from:v,messenger:t,networkClientId:S,origin:I,requestId:P,securityAlertId:C,sendCalls:s,transactions:A,validateSecurity:j,isAuxiliaryFundsSupported:_}):await async function({addTransactionBatch:e,isAtomicBatchSupported:t,chainId:s,from:a,getDismissSmartAccountSuggestionEnabled:i,networkClientId:r,messenger:o,origin:h,requestId:p,sendCalls:g,securityAlertId:b,transactions:k,validateSecurity:w,isAuxiliaryFundsSupported:_}){const T=await t({address:a,chainIds:[s]}),E=T?.[0],S=(0,l.getAccountKeyringType)(a,o),I=i();!function(e,t,s,a,i,r){d(e),function(e,t,s){if(m(e,t),!s)throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedChainId,`EIP-7702 not supported on chain: ${t}`)}(e,t,a),u(e,i,r),function(e,t,s){if(t?.delegationAddress)return;if(e)throw new n.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade disabled by the user");if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(s))throw new n.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported on account")}(s,a,i)}(g,s,I,E,S,_);const A=f(g),y=await e({from:a,networkClientId:r,origin:h,requestId:p,requiredAssets:A,securityAlertId:b,transactions:k,validateSecurity:w});return y.batchId}({addTransactionBatch:h,isAtomicBatchSupported:b,chainId:y,from:v,getDismissSmartAccountSuggestionEnabled:g,messenger:t,networkClientId:S,origin:I,requestId:P,sendCalls:s,securityAlertId:C,transactions:A,validateSecurity:j,isAuxiliaryFundsSupported:_}),{id:D}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/index.cjs",{"./hooks/getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs","./hooks/getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs","./hooks/processSendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs","./methods/wallet_getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs","./methods/wallet_getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs","./methods/wallet_sendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCapabilities=s.walletGetCallsStatus=s.walletSendCalls=s.getCapabilities=s.getCallsStatus=s.processSendCalls=void 0;var n=e("./hooks/processSendCalls.cjs");Object.defineProperty(s,"processSendCalls",{enumerable:!0,get:function(){return n.processSendCalls}});var a=e("./hooks/getCallsStatus.cjs");Object.defineProperty(s,"getCallsStatus",{enumerable:!0,get:function(){return a.getCallsStatus}});var i=e("./hooks/getCapabilities.cjs");Object.defineProperty(s,"getCapabilities",{enumerable:!0,get:function(){return i.getCapabilities}});var r=e("./methods/wallet_sendCalls.cjs");Object.defineProperty(s,"walletSendCalls",{enumerable:!0,get:function(){return r.walletSendCalls}});var o=e("./methods/wallet_getCallsStatus.cjs");Object.defineProperty(s,"walletGetCallsStatus",{enumerable:!0,get:function(){return o.walletGetCallsStatus}});var c=e("./methods/wallet_getCapabilities.cjs");Object.defineProperty(s,"walletGetCapabilities",{enumerable:!0,get:function(){return c.walletGetCapabilities}})}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCallsStatus=void 0;const n=e("@metamask/rpc-errors"),a=e("../types.cjs"),i=e("../utils.cjs");s.walletGetCallsStatus=async function(e,t,{getCallsStatus:s}){if(!s)throw n.rpcErrors.methodNotSupported();(0,i.validateParams)(e.params,a.GetCallsStatusStruct);const r=e.params[0];t.result=await s(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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCapabilities=void 0;const n=e("@metamask/rpc-errors"),a=e("../types.cjs"),i=e("../utils.cjs");s.walletGetCapabilities=async function(e,t,{getPermittedAccountsForOrigin:s,getCapabilities:r}){if(!r)throw n.rpcErrors.methodNotSupported();(0,i.validateParams)(e.params,a.GetCapabilitiesStruct);const o=e.params[0],c=e.params[1];await(0,i.validateAndNormalizeKeyholder)(o,{getPermittedAccountsForOrigin:s});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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletSendCalls=void 0;const n=e("@metamask/rpc-errors"),a=e("../types.cjs"),i=e("../utils.cjs");s.walletSendCalls=async function(e,t,{getPermittedAccountsForOrigin:s,processSendCalls:r}){if(!r)throw n.rpcErrors.methodNotSupported();(0,i.validateParams)(e.params,a.SendCallsStruct);const o=e.params[0],c=o.from?await(0,i.validateAndNormalizeKeyholder)(o.from,{getPermittedAccountsForOrigin:s}):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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SendCallsStruct=s.CapabilitiesStruct=s.GetCapabilitiesStruct=s.GetCallsStatusStruct=void 0;const n=e("@metamask/superstruct"),a=e("@metamask/utils");s.GetCallsStatusStruct=(0,n.tuple)([a.StrictHexStruct]),s.GetCapabilitiesStruct=(0,n.tuple)([a.HexChecksumAddressStruct,(0,n.optional)((0,n.array)(a.StrictHexStruct))]);const i=(0,n.type)({address:(0,n.nonempty)(a.HexChecksumAddressStruct),amount:(0,n.nonempty)(a.StrictHexStruct),standard:(0,n.nonempty)((0,n.string)())});s.CapabilitiesStruct=(0,n.record)((0,n.string)(),(0,n.type)({optional:(0,n.optional)((0,n.boolean)()),requiredAssets:(0,n.optional)((0,n.array)(i))})),s.SendCallsStruct=(0,n.tuple)([(0,n.object)({version:(0,n.nonempty)((0,n.string)()),id:(0,n.optional)(a.StrictHexStruct),from:(0,n.optional)(a.HexChecksumAddressStruct),chainId:a.StrictHexStruct,atomicRequired:(0,n.boolean)(),calls:(0,n.array)((0,n.object)({to:(0,n.optional)(a.HexChecksumAddressStruct),data:(0,n.optional)(a.StrictHexStruct),value:(0,n.optional)(a.StrictHexStruct),capabilities:(0,n.optional)(s.CapabilitiesStruct)})),capabilities:(0,n.optional)(s.CapabilitiesStruct)})])}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.resemblesAddress=s.validateParams=s.validateAndNormalizeKeyholder=s.getAccountKeyringType=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/superstruct"),i=e("./constants.cjs");function r(e){return 42===e.length}s.getAccountKeyringType=function(e,t){const{accounts:s}=t.call("AccountsController:getState").internalAccounts,a=Object.values(s).find(t=>t.address.toLowerCase()===e.toLowerCase()),r=a?.metadata?.keyring?.type;if(!r)throw new n.JsonRpcError(i.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported as account type is unknown");return r},s.validateAndNormalizeKeyholder=async function(e,{getPermittedAccountsForOrigin:t}){if("string"==typeof e&&e.length>0&&r(e)){const s=(await t()).map(e=>e.toLowerCase()),a=e.toLowerCase();if(s.includes(a))return a;throw n.providerErrors.unauthorized()}throw n.rpcErrors.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})},s.validateParams=function(e,t){const[s]=(0,a.validate)(e,t);if(s)throw n.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(s,"Invalid params"))},s.resemblesAddress=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,s){var n,a,i,r,o,c,l,d,m,u,h,f,p,g,b,k,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R,O,M,L,F,B,G,H,U,q,W,$,V,K,Y,Q,z,J,X,Z,ee,te,se,ne,ae,ie,re,oe,ce,le,de,me,ue,he,fe,pe,ge,be,ke,we,_e,Te,Ee,Se,Ie,Ae,ye,xe,ve,Ce,je,Pe,De,Ne,Re,Oe,Me,Le,Fe,Be,Ge,He,Ue,qe,We,$e,Ve,Ke,Ye,Qe,ze,Je,Xe,Ze,et,tt=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},st=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},nt=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.TransactionController=s.ApprovalState=s.SPEED_UP_RATE=s.CANCEL_RATE=void 0;const at=e("@metamask/base-controller"),it=e("@metamask/controller-utils"),rt=nt(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"),bt=e("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs"),kt=e("./gas-flows/ScrollLayer1GasFeeFlow.cjs"),wt=e("./gas-flows/TestGasFeeFlow.cjs"),_t=e("./helpers/AccountsApiRemoteTransactionSource.cjs"),Tt=e("./helpers/GasFeePoller.cjs"),Et=e("./helpers/IncomingTransactionHelper.cjs"),St=e("./helpers/MethodDataHelper.cjs"),It=e("./helpers/MultichainTrackingHelper.cjs"),At=e("./helpers/PendingTransactionTracker.cjs"),yt=e("./helpers/ResimulateHelper.cjs"),xt=e("./hooks/ExtraTransactionsPublishHook.cjs"),vt=e("./logger.cjs"),Ct=e("./types.cjs"),jt=e("./utils/balance-changes.cjs"),Pt=e("./utils/batch.cjs"),Dt=e("./utils/eip7702.cjs"),Nt=e("./utils/external-transactions.cjs"),Rt=e("./utils/feature-flags.cjs"),Ot=e("./utils/first-time-interaction.cjs"),Mt=e("./utils/gas.cjs"),Lt=e("./utils/gas-fee-tokens.cjs"),Ft=e("./utils/gas-fees.cjs"),Bt=e("./utils/gas-flow.cjs"),Gt=e("./utils/layer1-gas-fee-flow.cjs"),Ht=e("./utils/nonce.cjs"),Ut=e("./utils/prepare.cjs"),qt=e("./utils/retry.cjs"),Wt=e("./utils/swaps.cjs"),$t=e("./utils/transaction-type.cjs"),Vt=e("./utils/utils.cjs"),Kt=e("./utils/validation.cjs"),Yt={transactions:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},transactionBatches:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},methodData:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},lastFetchedBlockNumbers:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1},submitHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};s.CANCEL_RATE=1.1,s.SPEED_UP_RATE=1.1;const Qt="TransactionController";var zt;!function(e){e.Approved="approved",e.NotApproved="not-approved",e.SkippedViaBeforePublishHook="skipped-via-before-publish-hook"}(zt||(s.ApprovalState=zt={}));class Jt extends at.BaseController{constructor(e){const{disableSwaps:t,getCurrentAccountEIP1559Compatibility:s,getCurrentNetworkEIP1559Compatibility:q,getExternalPendingTransactions:W,getGasFeeEstimates:$,getNetworkClientRegistry:V,getNetworkState:Y,getPermittedAccounts:Q,getSavedGasFees:z,getSimulationConfig:J,hooks:X,incomingTransactions:ee={},isAutomaticGasFeeUpdateEnabled:te,isEIP7702GasFeeTokensEnabled:se,isFirstTimeInteractionEnabled:ne,isSimulationEnabled:ae,messenger:ie,pendingTransactions:re={},publicKeyEIP7702:oe,securityProviderRequest:ce,sign:le,state:me,testGasFeeFlows:ue,trace:he}=e;super({name:Qt,metadata:Yt,messenger:ie,state:{methodData:{},transactions:[],transactionBatches:[],lastFetchedBlockNumbers:{},submitHistory:[],...me}}),n.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),b.set(this,void 0),k.set(this,void 0),w.set(this,void 0),_.set(this,void 0),T.set(this,void 0),E.set(this,void 0),S.set(this,new mt.EventEmitter),I.set(this,void 0),A.set(this,void 0),y.set(this,void 0),x.set(this,void 0),v.set(this,void 0),C.set(this,void 0),j.set(this,void 0),P.set(this,void 0),D.set(this,void 0),N.set(this,void 0),R.set(this,void 0),O.set(this,void 0),M.set(this,void 0),L.set(this,void 0),F.set(this,void 0),B.set(this,new Map),G.set(this,new Set),H.set(this,void 0),U.set(this,void 0),xe.set(this,()=>{st(this,D,"f").checkForPendingTransactionAndStartPolling()}),this.messenger=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,s??(()=>Promise.resolve(!0)),"f"),tt(this,f,q,"f"),tt(this,p,W??(()=>[]),"f"),tt(this,g,$??(()=>Promise.resolve({})),"f"),tt(this,b,Y,"f"),tt(this,k,Q,"f"),tt(this,w,z??(e=>undefined),"f"),tt(this,_,J??(()=>Promise.resolve({})),"f"),tt(this,E,ee,"f"),tt(this,I,te??(e=>!1),"f"),tt(this,A,se??(()=>Promise.resolve(!1)),"f"),tt(this,y,ne??(()=>!0),"f"),tt(this,x,ae??(()=>!0),"f"),tt(this,v,t??!1,"f"),tt(this,C,X?.isTimeoutEnabled??(()=>!0),"f"),tt(this,N,re,"f"),tt(this,R,oe,"f"),tt(this,O,X?.publish??(()=>Promise.resolve({transactionHash:undefined})),"f"),tt(this,M,X?.publishBatch,"f"),tt(this,L,ce,"f"),tt(this,F,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,D,new It.MultichainTrackingHelper({findNetworkClientIdByChainId:fe,getNetworkClientById:e=>this.messenger.call("NetworkController:getNetworkClientById",e),getNetworkClientRegistry:V,removePendingTransactionTrackerListeners:st(this,n,"m",je).bind(this),createNonceTracker:st(this,n,"m",Ae).bind(this),createPendingTransactionTracker:st(this,n,"m",ye).bind(this),onNetworkStateChange:e=>{this.messenger.subscribe("NetworkController:stateChange",e)}}),"f"),st(this,D,"f").initialize(),tt(this,m,st(this,n,"m",Oe).call(this),"f"),tt(this,j,st(this,n,"m",Me).call(this),"f");const pe=new Tt.GasFeePoller({findNetworkClientIdByChainId:fe,gasFeeFlows:st(this,m,"f"),getGasFeeControllerEstimates:st(this,g,"f"),getProvider:e=>st(this,n,"m",de).call(this,{networkClientId:e}),getTransactions:()=>this.state.transactions,getTransactionBatches:()=>this.state.transactionBatches,layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,onStateChange:e=>{this.messenger.subscribe("TransactionController:stateChange",e)}});pe.hub.on("transaction-updated",st(this,n,"m",Be).bind(this)),pe.hub.on("transaction-batch-updated",st(this,n,"m",Ge).bind(this)),tt(this,P,new St.MethodDataHelper({getProvider:e=>st(this,n,"m",de).call(this,{networkClientId:e}),getState:()=>this.state.methodData}),"f"),st(this,P,"f").hub.on("update",({fourBytePrefix:e,methodData:t})=>{this.update(s=>{s.methodData[e]=t})}),tt(this,T,new Et.IncomingTransactionHelper({client:st(this,E,"f").client,getCurrentAccount:()=>st(this,n,"m",Ue).call(this),getLocalTransactions:()=>this.state.transactions,includeTokenTransfers:st(this,E,"f").includeTokenTransfers,isEnabled:st(this,E,"f").isEnabled,messenger:this.messenger,remoteTransactionSource:new _t.AccountsApiRemoteTransactionSource,trimTransactions:st(this,n,"m",Z).bind(this),updateTransactions:st(this,E,"f").updateTransactions}),"f"),st(this,n,"m",Ce).call(this,st(this,T,"f")),this.messenger.subscribe("TransactionController:stateChange",st(this,xe,"f")),new yt.ResimulateHelper({simulateTransaction:st(this,n,"m",Fe).bind(this),onTransactionsUpdate:e=>{this.messenger.subscribe("TransactionController:stateChange",e,e=>e.transactions)},getTransactions:()=>this.state.transactions}),st(this,n,"m",K).call(this),st(this,xe,"f").call(this),st(this,n,"m",Ve).call(this)}destroy(){st(this,n,"m",ve).call(this)}async handleMethodData(e,t){return st(this,P,"f").lookup(e,t)}async addTransactionBatch(e){const{blockTracker:t}=this.messenger.call("NetworkController:getNetworkClientById",e.networkClientId);return await(0,Pt.addTransactionBatch)({addTransaction:this.addTransaction.bind(this),estimateGas:this.estimateGas.bind(this),getChainId:st(this,n,"m",oe).bind(this),getEthQuery:e=>st(this,n,"m",le).call(this,{networkClientId:e}),getGasFeeEstimates:st(this,g,"f"),getInternalAccounts:st(this,n,"m",qe).bind(this),getSimulationConfig:st(this,_,"f").bind(this),getPendingTransactionTracker:e=>st(this,n,"m",ye).call(this,{provider:st(this,n,"m",de).call(this,{networkClientId:e}),blockTracker:t,chainId:st(this,n,"m",oe).call(this,e),networkClientId:e}),getTransaction:e=>st(this,n,"m",ae).call(this,e),isSimulationEnabled:st(this,x,"f"),messenger:this.messenger,publishBatchHook:st(this,M,"f"),publicKeyEIP7702:st(this,R,"f"),publishTransaction:(e,t)=>st(this,n,"m",J).call(this,e,t),request:e,signTransaction:st(this,n,"m",_e).bind(this),update:this.update.bind(this),updateTransaction:st(this,n,"m",Le).bind(this)})}async isAtomicBatchSupported(e){return(0,Pt.isAtomicBatchSupported)({...e,getEthQuery:e=>st(this,n,"m",le).call(this,{chainId:e}),messenger:this.messenger,publicKeyEIP7702:st(this,R,"f")})}async addTransaction(e,t){(0,vt.projectLogger)("Adding transaction",e,t);const{actionId:s,assetsFiatValues:i,batchId:r,deviceConfirmedOn:o,disableGasBuffer:c,gasFeeToken:l,isGasFeeIncluded:d,isGasFeeSponsored:m,isStateOnly:u,method:h,nestedTransactions:f,networkClientId:p,origin:g,publishHook:b,requestId:w,requiredAssets:_,requireApproval:T,securityAlertResponse:E,skipInitialGasEstimate:S,swaps:I={},traceContext:A,type:x}=t;if(e=(0,Vt.normalizeTransactionParams)(e),!st(this,D,"f").has(p))throw new Error(`Network client not found - ${p}`);const C=st(this,n,"m",oe).call(this,p),j=st(this,n,"m",le).call(this,{networkClientId:p}),P=g===undefined?undefined:await(st(this,k,"f")?.call(this,g)),N=st(this,n,"m",qe).call(this);await(0,Kt.validateTransactionOrigin)({data:e.data,from:e.from,internalAccounts:N,origin:g,permittedAddresses:P,txParams:e,type:x});const R=(0,Dt.getDelegationAddress)(e.from,j).catch(()=>undefined),O=await st(this,n,"m",we).call(this,p);(0,Kt.validateTxParams)(e,O,C),e.type||(0,Vt.setEnvelopeType)(e,O);if(r?.length&&this.state.transactions.some(e=>e.batchId?.toLowerCase()===r?.toLowerCase())&&g&&g!==it.ORIGIN_METAMASK)throw new lt.JsonRpcError(Kt.ErrorCode.DuplicateBundleId,"Batch ID already exists");const M=st(this,n,"m",ue).call(this,e,g),F=x??(await(0,$t.determineTransactionType)(e,j)).type,B=st(this,n,"m",ge).call(this,s);let G=B?(0,ut.cloneDeep)(B):{actionId:s,assetsFiatValues:i,batchId:r,chainId:C,dappSuggestedGasFees:M,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:_,securityAlertResponse:E,selectedGasFeeToken:l,status:Ct.TransactionStatus.unapproved,time:Date.now(),txParams:e,type:F,userEditedGasLimit:!1,verifiedOnBlockchain:!1};const{updateTransaction:H}=await st(this,a,"f").call(this,{transactionMeta:G});if(H&&((0,vt.projectLogger)("Updating transaction using afterAdd hook"),G.txParamsOriginal=(0,ut.cloneDeep)(G.txParams),H(G)),S){const e=(0,ut.cloneDeep)(G);st(this,n,"m",V).call(this,e).then(()=>(st(this,n,"m",Le).call(this,{transactionId:e.id,skipResimulateCheck:!0,skipValidation:!0},t=>{t.txParams.gas=e.txParams.gas,t.txParams.gasPrice=e.txParams.gasPrice,t.txParams.maxFeePerGas=e.txParams.maxFeePerGas,t.txParams.maxPriorityFeePerGas=e.txParams.maxPriorityFeePerGas}),undefined)).catch(ut.noop)}else await st(this,U,"f").call(this,{name:"Estimate Gas Properties",parentContext:A},e=>st(this,n,"m",V).call(this,G,{traceContext:e}));if(!B){if(h&&st(this,L,"f")){const e=await st(this,L,"f").call(this,G,h);G.securityProviderResponse=e}G=(0,Wt.updateSwapsTransaction)(G,F,I,{isSwapsDisabled:st(this,v,"f"),cancelTransaction:st(this,n,"m",X).bind(this),messenger:this.messenger}),st(this,n,"m",$).call(this,G),R.then(e=>(st(this,n,"m",Le).call(this,{transactionId:G.id,skipResimulateCheck:!0,skipValidation:!0},t=>{t.delegationAddress=e}),undefined)).catch(ut.noop),!1===T||u?(0,vt.projectLogger)("Skipping simulation & first interaction update as approval not required"):(st(this,n,"m",Fe).call(this,G,{traceContext:A}).catch(e=>{throw(0,vt.projectLogger)("Error while updating simulation data",e),e}),(0,Ot.updateFirstTimeInteraction)({existingTransactions:this.state.transactions,getTransaction:e=>st(this,n,"m",ne).call(this,e),isFirstTimeInteractionEnabled:st(this,y,"f"),trace:st(this,U,"f"),traceContext:A,transactionMeta:G,updateTransaction:st(this,n,"m",Le).bind(this)}).catch(e=>{(0,vt.projectLogger)("Error while updating first interaction properties",e)})),this.messenger.publish(`${Qt}:unapprovedTransactionAdded`,G)}return{result:st(this,n,"m",Q).call(this,G,{actionId:s,isExisting:Boolean(B),publishHook:b,requireApproval:T,traceContext:A}),transactionMeta:G}}startIncomingTransactionPolling(){st(this,T,"f").start()}stopIncomingTransactionPolling(){st(this,T,"f").stop()}async updateIncomingTransactions({tags:e}={}){await st(this,T,"f").update({tags:e})}async stopTransaction(e,t,{estimatedBaseFee:a,actionId:i}={}){await st(this,n,"m",q).call(this,{actionId:i,estimatedBaseFee:a,gasValues:t,label:"cancel",rate:s.CANCEL_RATE,transactionId:e,transactionType:Ct.TransactionType.cancel,prepareTransactionParams:e=>{delete e.data,e.to=e.from,e.value="0x0"},afterSubmit:e=>{this.messenger.publish(`${Qt}:transactionFinished`,e),st(this,S,"f").emit(`${e.id}:finished`,e)}})}async speedUpTransaction(e,t,{actionId:a,estimatedBaseFee:i}={}){await st(this,n,"m",q).call(this,{actionId:a,estimatedBaseFee:i,gasValues:t,label:"speed up",rate:s.SPEED_UP_RATE,transactionId:e,transactionType:Ct.TransactionType.retry,afterSubmit:e=>{this.messenger.publish(`${Qt}:speedupTransactionAdded`,e)}})}async estimateGas(e,t,{ignoreDelegationSignatures:s}={}){const a=st(this,n,"m",le).call(this,{networkClientId:t}),{estimatedGas:i,simulationFails:r}=await(0,Mt.estimateGas)({chainId:st(this,n,"m",oe).call(this,t),ethQuery:a,ignoreDelegationSignatures:s,isSimulationEnabled:st(this,x,"f").call(this),getSimulationConfig:st(this,_,"f"),messenger:this.messenger,txParams:e});return{gas:i,simulationFails:r}}async estimateGasBatch({chainId:e,from:t,transactions:s}){const a=st(this,n,"m",le).call(this,{chainId:e});return(0,Mt.estimateGasBatch)({chainId:e,ethQuery:a,from:t,getSimulationConfig:st(this,_,"f"),isAtomicBatchSupported:this.isAtomicBatchSupported.bind(this),messenger:this.messenger,transactions:s})}async estimateGasBuffered(e,t,s){const a=st(this,n,"m",le).call(this,{networkClientId:s}),{blockGasLimit:i,estimatedGas:r,simulationFails:o}=await(0,Mt.estimateGas)({chainId:st(this,n,"m",oe).call(this,s),ethQuery:a,isSimulationEnabled:st(this,x,"f").call(this),getSimulationConfig:st(this,_,"f"),messenger:this.messenger,txParams:e});return{gas:(0,Mt.addGasBuffer)(r,i,t),simulationFails:o}}updateTransaction(e,t){const{id:s}=e;st(this,n,"m",Le).call(this,{transactionId:s},()=>({...e})),(0,vt.projectLogger)("Transaction updated",{transactionId:s,note:t})}updateSecurityAlertResponse(e,t){if(!t)throw new Error("updateSecurityAlertResponse: securityAlertResponse should not be null");const s=st(this,n,"m",ne).call(this,e);if(!s)throw new Error("Cannot update security alert response as no transaction metadata found");const a={...s,securityAlertResponse:t};this.updateTransaction(a,`${Qt}:updatesecurityAlertResponse - securityAlertResponse updated`)}wipeTransactions({address:e,chainId:t}={}){if(!t&&!e)return void this.update(e=>{e.transactions=[]});const s=this.state.transactions.filter(({chainId:s,txParams:n,type:a})=>{if(!(!t||t===s))return!0;return!(!e||n.from?.toLowerCase()===e.toLowerCase()||a===Ct.TransactionType.incoming&&n.to?.toLowerCase()===e.toLowerCase())});this.update(e=>{e.transactions=st(this,n,"m",Z).call(this,s)})}updateTransactionSendFlowHistory(e,t,s){return st(this,n,"m",ae).call(this,e)}async confirmExternalTransaction(e,t,s){const a=st(this,n,"m",he).call(this,e);try{const e=a.id,i={...a,status:Ct.TransactionStatus.confirmed,txReceipt:t};s&&(i.baseFeePerGas=s),st(this,n,"m",fe).call(this,e),this.updateTransaction(i,`${Qt}:confirmExternalTransaction - Add external transaction`),st(this,n,"m",Te).call(this,i),st(this,n,"m",Ie).call(this,i).catch(e=>{throw(0,vt.projectLogger)("Error while updating post balance",e),e}),this.messenger.publish(`${Qt}:transactionConfirmed`,i)}catch(e){console.error("Failed to confirm external transaction",e)}}updateTransactionGasFees(e,{defaultGasEstimates:t,estimateUsed:s,estimateSuggested:a,gas:i,gasLimit:r,gasPrice:o,maxPriorityFeePerGas:c,maxFeePerGas:l,originalGasEstimate:d,userEditedGasLimit:m,userFeeLevel:u}){const h=st(this,n,"m",ne).call(this,e);if(!h)throw new Error("Cannot update transaction as no transaction metadata found");(0,Vt.validateIfTransactionUnapprovedOrSubmitted)(h,"updateTransactionGasFees");const f=(0,ut.cloneDeep)(h),p=h.gasFeeEstimates,g=st(this,I,"f").call(this,h),b=u,k=Object.values(Ct.GasFeeEstimateLevel).includes(b),w=p&&g&&k;w&&(0,Tt.updateTransactionGasEstimates)({txMeta:f,userFeeLevel:b});const _={gas:i,gasLimit:r};w?Object.assign(_,{gasPrice:f.txParams.gasPrice,maxPriorityFeePerGas:f.txParams.maxPriorityFeePerGas,maxFeePerGas:f.txParams.maxFeePerGas}):Object.assign(_,{gasPrice:o,maxPriorityFeePerGas:c,maxFeePerGas:l});const T={txParams:(0,ut.pickBy)(_),defaultGasEstimates:t,estimateUsed:s,estimateSuggested:a,originalGasEstimate:d,userEditedGasLimit:m,userFeeLevel:b},E=(0,ut.pickBy)(T);return st(this,n,"m",Le).call(this,{transactionId:e,skipResimulateCheck:!0},e=>{const{txParams:t,...s}=E;Object.assign(e,s),t&&Object.assign(e.txParams,t)}),st(this,n,"m",ne).call(this,e)}updatePreviousGasParams(e,{gasLimit:t,maxFeePerGas:s,maxPriorityFeePerGas:a}){const i=st(this,n,"m",ne).call(this,e);if(!i)throw new Error("Cannot update transaction as no transaction metadata found");(0,Vt.validateIfTransactionUnapprovedOrSubmitted)(i,"updatePreviousGasParams");const r={previousGas:{gasLimit:t,maxFeePerGas:s,maxPriorityFeePerGas:a}};r.previousGas=(0,ut.pickBy)(r.previousGas);const o=(0,ut.merge)({},i,r);return this.updateTransaction(o,`${Qt}:updatePreviousGasParams - Previous gas values updated`),st(this,n,"m",ne).call(this,e)}async getNonceLock(e,t){return st(this,D,"f").getNonceLock(e,t)}async updateEditableParams(e,{containerTypes:t,data:s,from:a,gas:i,gasPrice:r,maxFeePerGas:o,maxPriorityFeePerGas:c,to:l,updateType:d,value:m}){const u=st(this,n,"m",ne).call(this,e);if(!u)throw new Error("Cannot update editable params as no transaction metadata found");(0,Vt.validateIfTransactionUnapproved)(u,"updateEditableParams");const h={txParams:{data:s,from:a,to: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=st(this,n,"m",de).call(this,{networkClientId:p}),b=new rt.default(g);if(!1!==d){const{type:e}=await(0,$t.determineTransactionType)(f.txParams,b);f.type=e}return t&&(f.containerTypes=t),await(0,Gt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,provider:g,transactionMeta:f}),this.updateTransaction(f,`Update Editable Params for ${e}`),st(this,n,"m",ne).call(this,e)}setTransactionActive(e,t){if(!st(this,n,"m",ne).call(this,e))throw new Error(`Transaction with id ${e} not found`);st(this,n,"m",Le).call(this,{transactionId:e,skipValidation:!0,skipResimulateCheck:!0},e=>{e.isActive=t})}async approveTransactionsWithSameNonce(e=[],{hasNonce:t}={}){if((0,vt.projectLogger)("Approving transactions with same nonce",{transactions:e}),0===e.length)return"";const s=e[0],{chainId:a}=s,i=st(this,n,"m",ce).call(this,{chainId:a}),r=(0,Ut.prepareTransaction)(a,s),c=(0,Ut.serializeTransaction)(r);if(st(this,o,"f").has(c))return"";let l,d;st(this,o,"f").add(c);try{const a=s.from;d=!0!==t?await this.getNonceLock(a,i):undefined;const r=d?(0,dt.add0x)(d.nextNonce.toString(16)):s.nonce;d&&(0,vt.projectLogger)("Using nonce from nonce tracker",r,d.nonceDetails),l=await Promise.all(e.map(e=>(e.nonce=r,st(this,n,"m",W).call(this,e.chainId,e))))}catch(e){throw(0,vt.projectLogger)("Error while signing transactions with same nonce",e),e}finally{d?.releaseLock(),st(this,o,"f").delete(c)}return l}updateCustodialTransaction(e){const{transactionId:t,errorMessage:s,hash:a,status:i,gasLimit:r,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,type:m}=e,u=st(this,n,"m",ne).call(this,t);if(!u)throw new Error("Cannot update custodial transaction as no transaction metadata found");if(i&&![Ct.TransactionStatus.submitted,Ct.TransactionStatus.signed,Ct.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===Ct.TransactionStatus.submitted&&(h.submittedTime=(new Date).getTime()),h.status===Ct.TransactionStatus.failed&&(h.error=(0,Vt.normalizeTxError)(new Error(s))),h.txParams=(0,ut.merge)({},h.txParams,(0,ut.pickBy)({gasLimit:r,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,type:m})),m===Ct.TransactionEnvelopeType.legacy&&(delete h.txParams.maxFeePerGas,delete h.txParams.maxPriorityFeePerGas),this.updateTransaction(h,`${Qt}:updateCustodialTransaction - Custodial transaction updated`),i&&[Ct.TransactionStatus.submitted,Ct.TransactionStatus.failed].includes(i)&&(this.messenger.publish(`${Qt}:transactionFinished`,h),st(this,S,"f").emit(`${h.id}:finished`,h)),h}getTransactions({initialList:e,limit:t,searchCriteria:s={}}={}){const n=(0,ut.mapValues)(s,e=>"function"==typeof e?e:t=>t===e),a=e??this.state.transactions,i=(0,ut.sortBy)((0,ut.pickBy)(a,e=>{for(const[t,s]of Object.entries(n))if(t in e.txParams){if(!1===s(e.txParams[t]))return!1}else if(!1===s(e[t]))return!1;return!0}),"time");if(t!==undefined){const e=new Set,s=[];for(let n=i.length-1;n>-1;n--){const a=i[n],{nonce:r}=a.txParams;if(!e.has(r)){if(!(e.size<t))continue;e.add(r)}s.unshift(a)}return s}return i}async estimateGasFee({transactionParams:e,chainId:t,networkClientId:s}){const{id:n,provider:a}=st(this,D,"f").getNetworkClient({chainId:t,networkClientId:s}),i={txParams:e,chainId:t,networkClientId:n},r=(0,Bt.getGasFeeFlow)(i,st(this,m,"f"),this.messenger),o=new rt.default(a),c=await st(this,g,"f").call(this,{networkClientId:n});return r.getGasFees({ethQuery:o,gasFeeControllerData:c,messenger:this.messenger,transactionMeta:i})}async getLayer1GasFee({transactionParams:e,chainId:t,networkClientId:s}){const a=st(this,n,"m",de).call(this,{chainId:t,networkClientId:s});return await(0,Gt.getTransactionLayer1GasFee)({layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,provider:a,transactionMeta:{txParams:e,chainId:t}})}clearUnapprovedTransactions(){const e=this.state.transactions.filter(({status:e})=>e!==Ct.TransactionStatus.unapproved);this.update(t=>{t.transactions=st(this,n,"m",Z).call(this,e)})}abortTransactionSigning(e){if(!st(this,n,"m",ne).call(this,e))throw new Error("Cannot abort signing as no transaction metadata found");const t=st(this,B,"f").get(e);if(!t)throw new Error("Cannot abort signing as transaction is not waiting for signing");t(),st(this,B,"f").delete(e)}async updateAtomicBatchData({transactionId:e,transactionIndex:t,transactionData:s}){(0,vt.projectLogger)("Updating atomic batch data",{transactionId:e,transactionIndex:t,transactionData:s});const a=st(this,n,"m",Le).call(this,{transactionId:e},e=>{const{nestedTransactions:n,txParams:a}=e,i=a.from,r=n?.[t];if(!r)throw new Error(`Nested transaction not found with index - ${t}`);r.data=s;const o=(0,Dt.generateEIP7702BatchTransaction)(i,n);e.txParams.data=o.data}),i=(0,ut.cloneDeep)({...a,txParams:{...a.txParams,gas:undefined}});return await st(this,n,"m",$e).call(this,i),st(this,n,"m",Le).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,vt.projectLogger)("Updating batch transactions",{transactionId:e,batchTransactions:t}),st(this,n,"m",Le).call(this,{transactionId:e},e=>{e.batchTransactions=t})}updateSelectedGasFeeToken(e,t){st(this,n,"m",Le).call(this,{transactionId:e},e=>{const s=e.gasFeeTokens?.some(e=>e.tokenAddress.toLowerCase()===t?.toLowerCase());if(t&&!s)throw new Error(`No matching gas fee token found with address - ${t}`);e.selectedGasFeeToken=t})}updateRequiredTransactionIds({transactionId:e,requiredTransactionIds:t,append:s}){st(this,n,"m",Le).call(this,{transactionId:e},e=>{const{requiredTransactionIds:n}=e;e.requiredTransactionIds=[...n&&!1!==s?n:[],...t]})}emulateNewTransaction(e){const t=this.state.transactions.find(t=>t.id===e);t&&(t.type===Ct.TransactionType.swap?this.messenger.publish("TransactionController:transactionNewSwap",{transactionMeta:t}):t.type===Ct.TransactionType.swapApproval&&this.messenger.publish("TransactionController:transactionNewSwapApproval",{transactionMeta:t}))}emulateTransactionUpdate(e){const t={...e,txParams:{...e.txParams,from:this.messenger.call("AccountsController:getSelectedAccount").address}};this.state.transactions.some(e=>e.id===t.id)||this.update(e=>{e.transactions.push(t)}),this.updateTransaction(t,"Generated from user operation"),this.messenger.publish("TransactionController:transactionStatusUpdated",{transactionMeta:t})}}s.TransactionController=Jt,a=new WeakMap,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,b=new WeakMap,k=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,E=new WeakMap,S=new WeakMap,I=new WeakMap,A=new WeakMap,y=new WeakMap,x=new WeakMap,v=new WeakMap,C=new WeakMap,j=new WeakMap,P=new WeakMap,D=new WeakMap,N=new WeakMap,R=new WeakMap,O=new WeakMap,M=new WeakMap,L=new WeakMap,F=new WeakMap,B=new WeakMap,G=new WeakMap,H=new WeakMap,U=new WeakMap,xe=new WeakMap,n=new WeakSet,q=async function({actionId:e,afterSubmit:t,estimatedBaseFee:s,gasValues:a,label:i,prepareTransactionParams:r,rate:o,transactionId:c,transactionType:l}){if(st(this,n,"m",ge).call(this,e))return;a&&(a=(0,Vt.normalizeGasFeeValues)(a),(0,Vt.validateGasValues)(a)),(0,vt.projectLogger)(`Creating ${i} transaction`,c,a);const d=st(this,n,"m",ne).call(this,c);if(!d)return;if(!st(this,F,"f"))throw new Error("No sign method defined.");const m=(0,qt.getTransactionParamsWithIncreasedGasFee)(d.txParams,o,a);r?.(m);const u=(0,Ut.prepareTransaction)(d.chainId,m),h=await st(this,F,"f").call(this,u,d.txParams.from),f=st(this,n,"m",ke).call(this,d,h),p=(0,Ut.serializeTransaction)(h),g=m.maxFeePerGas??m.gasPrice,b=m.maxFeePerGas?f.txParams.maxFeePerGas:f.txParams.gasPrice;(0,vt.projectLogger)(`Submitting ${i} transaction`,{oldFee:b,newFee:g,txParams:m});const{networkClientId:k}=d,w=st(this,n,"m",le).call(this,{networkClientId:k}),_={...f,actionId:e,estimatedBaseFee:s,id:(0,ht.v1)(),originalGasEstimate:d.txParams.gas,originalType:d.type,rawTx:p,time:Date.now(),txParams:m,type:l},T=await st(this,n,"m",Ne).call(this,w,{..._,origin:i});_.hash=T,st(this,n,"m",$).call(this,_),this.messenger.publish(`${Qt}:transactionApproved`,{transactionMeta:_,actionId:e}),this.messenger.publish(`${Qt}:transactionSubmitted`,{transactionMeta:_,actionId:e}),t?.(_)},W=async function(e,t){if(!st(this,F,"f"))throw new Error("No sign method defined.");const s=(0,Vt.normalizeTransactionParams)(t),n=(0,Vt.isEIP1559Transaction)(s)?Ct.TransactionEnvelopeType.feeMarket:Ct.TransactionEnvelopeType.legacy,a={...s,type:n,gasLimit:s.gas,chainId:e},{from:i}=a,r=(0,Ut.prepareTransaction)(e,a),o=await st(this,F,"f").call(this,r,i);return(0,Ut.serializeTransaction)(o)},$=function(e){(0,Kt.validateTxParams)(e.txParams),this.update(t=>{t.transactions=st(this,n,"m",Z).call(this,[...t.transactions,e])})},V=async function(e,{traceContext:t}={}){const s=e.txParams.type!==Ct.TransactionEnvelopeType.legacy&&await st(this,n,"m",we).call(this,e.networkClientId),{networkClientId:a}=e,i=st(this,n,"m",le).call(this,{networkClientId:a}),r=st(this,n,"m",de).call(this,{networkClientId:a});await st(this,U,"f").call(this,{name:"Update Gas",parentContext:t},async()=>{await st(this,n,"m",$e).call(this,e)}),await st(this,U,"f").call(this,{name:"Update Gas Fees",parentContext:t},async()=>await(0,Ft.updateGasFees)({eip1559:s,ethQuery:i,gasFeeFlows:st(this,m,"f"),getGasFeeEstimates:st(this,g,"f"),getSavedGasFees:st(this,w,"f").bind(this),messenger:this.messenger,txMeta:e})),await st(this,U,"f").call(this,{name:"Update Layer 1 Gas Fees",parentContext:t},async()=>await(0,Gt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,provider:r,transactionMeta:e}))},K=function(){this.clearUnapprovedTransactions(),st(this,n,"m",Y).call(this)},Y=function(){const e=this.state.transactions.filter(e=>[Ct.TransactionStatus.approved,Ct.TransactionStatus.signed].includes(e.status));for(const t of e){const e=t.requiredTransactionIds??[],s=e.length>0&&e.every(e=>{const t=st(this,n,"m",ne).call(this,e);return t?.status===Ct.TransactionStatus.confirmed})?"Transaction incomplete at startup with all required transactions confirmed":"Transaction incomplete at startup";st(this,n,"m",ze).call(this,t,new Error(s));for(const t of e){const e=st(this,n,"m",ne).call(this,t);e&&!st(this,n,"m",ee).call(this,e.status)&&st(this,n,"m",ze).call(this,e,new Error("Parent transaction incomplete at startup"))}}},Q=async function(e,{actionId:t,isExisting:s=!1,publishHook:a,requireApproval:i,shouldShowRequest:r=!0,traceContext:o}){const{id:c,isStateOnly:l}=e;if(l)return st(this,n,"m",Le).call(this,{transactionId:c,skipValidation:!0},e=>{e.status=Ct.TransactionStatus.submitted,e.submittedTime=(new Date).getTime()}),"";let d;const{meta:m,isCompleted:u}=st(this,n,"m",re).call(this,c),h=u?Promise.resolve(m):st(this,n,"m",be).call(this,c);if(m&&!s&&!u)try{if(!1!==i){const t=await st(this,U,"f").call(this,{name:"Await Approval",parentContext:o},t=>st(this,n,"m",se).call(this,e,{shouldShowRequest:r,traceContext:t}));d=t.resultCallbacks;const s=t.value,a=s?.txMeta;a&&((0,vt.projectLogger)("Updating transaction with approval data",{customNonce:a.customNonceValue,params:a.txParams}),this.updateTransaction(a,"TransactionController#processApproval - Updated with approval data"))}const{isCompleted:s}=st(this,n,"m",re).call(this,c);if(!s){const e=await st(this,n,"m",z).call(this,c,o,a);e===zt.SkippedViaBeforePublishHook&&d&&d.success();const s=st(this,n,"m",ne).call(this,c);e===zt.Approved&&this.messenger.publish(`${Qt}:transactionApproved`,{transactionMeta:s,actionId:t})}}catch(e){const s=e,{isCompleted:a}=st(this,n,"m",re).call(this,c);a||(st(this,n,"m",Ye).call(this,s)?st(this,n,"m",Qe).call(this,c,t,s):st(this,n,"m",ze).call(this,m,s,t))}finally{st(this,G,"f").delete(c)}const f=await h;switch(f?.status){case Ct.TransactionStatus.failed:{const e=f.error;throw d?.error(e),lt.rpcErrors.internal(e.message)}case Ct.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}}},z=async function(e,t,s){let a,i,r=st(this,n,"m",ae).call(this,e);(0,vt.projectLogger)("Approving transaction",r);try{if(!st(this,F,"f"))return st(this,n,"m",ze).call(this,r,new Error("No sign method defined.")),zt.NotApproved;if(!r.chainId)return st(this,n,"m",ze).call(this,r,new Error("No chainId defined.")),zt.NotApproved;if(st(this,o,"f").has(e))return(0,vt.projectLogger)("Skipping approval as signing in progress",e),zt.NotApproved;st(this,o,"f").add(e),a=()=>st(this,o,"f").delete(e);const{networkClientId:c}=r,d=st(this,n,"m",le).call(this,{networkClientId:c}),[m,u]=await(0,Ht.getNextNonce)(r,e=>st(this,D,"f").getNonceLock(e,r.networkClientId));i=u,r=st(this,n,"m",Le).call(this,{transactionId:e},e=>{const{chainId:t,txParams:s}=e,{gas:n,type:a}=s;e.status=Ct.TransactionStatus.approved,e.txParams.chainId=t,e.txParams.gasLimit=n,e.txParams.nonce=m,!a&&(0,Vt.isEIP1559Transaction)(s)&&(e.txParams.type=Ct.TransactionEnvelopeType.feeMarket)}),st(this,n,"m",Te).call(this,r);const h=await st(this,U,"f").call(this,{name:"Sign",parentContext:t},()=>st(this,n,"m",_e).call(this,r));if(r=st(this,n,"m",ae).call(this,e),!await st(this,l,"f").call(this,r))return(0,vt.projectLogger)("Skipping publishing transaction based on hook"),this.messenger.publish(`${Qt}:transactionPublishingSkipped`,r),zt.SkippedViaBeforePublishHook;if(!h&&!r.isExternalSign)return zt.NotApproved;let f;const p=r.type===Ct.TransactionType.swap;p&&((0,vt.projectLogger)("Determining pre-transaction balance"),f=await(0,it.query)(d,"getBalance",[r.txParams.from])),(0,vt.projectLogger)("Publishing transaction",r.txParams),i?.(),i=undefined;let g=st(this,n,"m",Xe).bind(this,{ethQuery:d,publishHookOverride:s,traceContext:t});if(r.batchTransactions?.length){(0,vt.projectLogger)("Found batch transactions",r.batchTransactions);g=new xt.ExtraTransactionsPublishHook({addTransactionBatch:this.addTransactionBatch.bind(this),getTransaction:st(this,n,"m",ae).bind(this),originalPublishHook:g}).getHook()}const{transactionHash:b}=await g(r,h??"0x");return r=st(this,n,"m",Le).call(this,{transactionId:e},e=>{e.hash=b,e.status=Ct.TransactionStatus.submitted,e.submittedTime=(new Date).getTime(),p&&(e.preTxBalance=f,(0,vt.projectLogger)("Updated pre-transaction balance",f))}),this.messenger.publish(`${Qt}:transactionSubmitted`,{transactionMeta:r}),this.messenger.publish(`${Qt}:transactionFinished`,r),st(this,S,"f").emit(`${e}:finished`,r),st(this,n,"m",Te).call(this,r),zt.Approved}catch(e){return st(this,n,"m",ze).call(this,r,e),zt.NotApproved}finally{a?.(),i?.()}},J=async function(e,t,{skipSubmitHistory:s}={}){try{const a=await(0,it.query)(e,"sendRawTransaction",[t.rawTx]);return!0!==s&&st(this,n,"m",We).call(this,t,a),a}catch(e){const t=e,s=t?.data?.message??t?.message??String(e);throw new Error(s)}},X=function(e,t,s){const a=st(this,n,"m",ne).call(this,e);if(!a)return;st(this,n,"m",Ke).call(this,e);const i={...a,status:Ct.TransactionStatus.rejected,error:(0,Vt.normalizeTxError)(s??lt.providerErrors.userRejectedRequest())};this.messenger.publish(`${Qt}:transactionFinished`,i),st(this,S,"f").emit(`${a.id}:finished`,i),this.messenger.publish(`${Qt}:transactionRejected`,{transactionMeta:i,actionId:t}),st(this,n,"m",Te).call(this,i)},Z=function(e){const t=new Set,s=(0,Rt.getTransactionHistoryLimit)(this.messenger),a=[...e].sort((e,t)=>e.time>t.time?-1:1).filter(e=>{const{chainId:a,status: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<s||!st(this,n,"m",ee).call(this,i))return t.add(e),!0}return!1});return a.reverse(),a},ee=function(e){return e===Ct.TransactionStatus.rejected||e===Ct.TransactionStatus.confirmed||e===Ct.TransactionStatus.failed||e===Ct.TransactionStatus.dropped},te=function(e){return[Ct.TransactionStatus.confirmed,Ct.TransactionStatus.failed,Ct.TransactionStatus.rejected,Ct.TransactionStatus.submitted].includes(e)},se=async function(e,{shouldShowRequest:t,traceContext:s}){const a=st(this,n,"m",ie).call(this,e),{origin:i}=e,r=it.ApprovalType.Transaction,o={txId:e.id};return await st(this,U,"f").call(this,{name:"Notification Display",id:a,parentContext:s}),await this.messenger.call("ApprovalController:addRequest",{id:a,origin:i??it.ORIGIN_METAMASK,type:r,requestData:o,expectsResult:!0},t)},ne=function(e){const{transactions:t}=this.state;return t.find(({id:t})=>t===e)},ae=function(e,t="TransactionController"){const s=st(this,n,"m",ne).call(this,e);if(!s)throw new Error(`${t}: No transaction found with id ${e}`);return s},ie=function(e){return String(e.id)},re=function(e){const t=st(this,n,"m",ne).call(this,e);if(!t)return{meta:undefined,isCompleted:!1};return{meta:t,isCompleted:st(this,n,"m",te).call(this,t.status)}},oe=function(e){return st(this,D,"f").getNetworkClient({networkClientId:e}).configuration.chainId},ce=function({chainId:e,networkClientId:t}){return t||st(this,D,"f").getNetworkClient({chainId:e}).id},le=function({chainId:e,networkClientId:t}){return new rt.default(st(this,n,"m",de).call(this,{chainId:e,networkClientId:t}))},de=function({chainId:e,networkClientId:t}){return st(this,D,"f").getNetworkClient({chainId:e,networkClientId:t}).provider},me=function(e){if(!e.length)return;const t=[];for(const s of e){const{chainId:e}=s;try{const a=st(this,n,"m",ce).call(this,{chainId:e});t.push({...s,networkClientId:a})}catch(t){(0,vt.projectLogger)("Failed to get network client ID for incoming transaction",{chainId:e,error:t})}}this.update(e=>{const{transactions:s}=e;e.transactions=st(this,n,"m",Z).call(this,[...t,...s]),(0,vt.projectLogger)("Added incoming transactions to state",t.length,t)}),this.messenger.publish(`${Qt}:incomingTransactionsReceived`,t)},ue=function(e,t){if(!t||t===it.ORIGIN_METAMASK)return undefined;const{gasPrice:s,maxFeePerGas:n,maxPriorityFeePerGas:a,gas:i}=e;if(s===undefined&&n===undefined&&a===undefined&&i===undefined)return undefined;const r={};return s!==undefined?r.gasPrice=s:n===undefined&&a===undefined||(r.maxFeePerGas=n,r.maxPriorityFeePerGas=a),i!==undefined&&(r.gas=i),r},he=function(e){const{chainId:t}=e,{transactions:s}=this.state,a=e?.txParams?.from,i=s.filter(e=>e.txParams.from===a&&e.chainId===t),r=i.filter(e=>e.status===Ct.TransactionStatus.confirmed),o=i.filter(e=>e.status===Ct.TransactionStatus.submitted);return(0,Nt.validateConfirmedExternalTransaction)(e,r,o),this.update(t=>{t.transactions=st(this,n,"m",Z).call(this,[...t.transactions,e])}),e},fe=function(e){const t=st(this,n,"m",ne).call(this,e);if(!t)return;const s=t.txParams?.nonce,a=t.txParams?.from,{chainId:i}=t,r=this.state.transactions.filter(t=>t.id!==e&&t.txParams.from===a&&s&&t.txParams.nonce===s&&t.chainId===i&&t.type!==Ct.TransactionType.incoming&&t.isTransfer===undefined),o=r.map(e=>e.id);if(0!==r.length){this.update(e=>{for(const s of e.transactions)o.includes(s.id)&&(s.replacedBy=t?.hash,s.replacedById=t?.id)});for(const e of this.state.transactions)o.includes(e.id)&&e.status!==Ct.TransactionStatus.failed&&st(this,n,"m",pe).call(this,e)}},pe=function(e){const t={...e,status:Ct.TransactionStatus.dropped};this.messenger.publish(`${Qt}:transactionDropped`,{transactionMeta:t}),this.updateTransaction(t,"TransactionController#setTransactionStatusDropped - Transaction dropped"),st(this,n,"m",Te).call(this,t)},ge=function(e){return this.state.transactions.find(t=>e&&t.actionId===e)},be=async function(e){return new Promise(t=>{st(this,S,"f").once(`${e}:finished`,e=>{t(e)})})},ke=function(e,t){const s=(0,ut.cloneDeep)(e);for(const e of["r","s","v"]){const n=t[e];n!==undefined&&null!==n&&(s[e]=(0,dt.add0x)(n.toString(16)))}return s},we=async function(e){const t=await st(this,f,"f").call(this,e),s=await st(this,h,"f").call(this);return t&&s},_e=async function(e){let t=e;const{id:s}=t;(0,vt.projectLogger)("Calling before sign hook",t);const{updateTransaction:a}=await st(this,d,"f").call(this,{transactionMeta:t})??{};a&&(st(this,n,"m",Le).call(this,{transactionId:s,skipResimulateCheck:!0},a),(0,vt.projectLogger)("Updated transaction after before sign hook")),t=st(this,n,"m",ae).call(this,s);const{networkClientId:r}=t,c=st(this,n,"m",le).call(this,{networkClientId:r});await(0,Lt.checkGasFeeTokenBeforePublish)({ethQuery:c,fetchGasFeeTokens:async e=>(await st(this,n,"m",Ze).call(this,e)).gasFeeTokens,transaction:t,updateTransaction:(e,t)=>st(this,n,"m",Le).call(this,{transactionId:e},t)}),t=st(this,n,"m",ae).call(this,s);const{chainId:l,isExternalSign:m,txParams:h}=t;if(m)return(0,vt.projectLogger)("Skipping sign as signed externally"),undefined;const{authorizationList:f,from:p}=h,g=await(0,Dt.signAuthorizationList)({authorizationList:f,messenger:this.messenger,transactionMeta:t});g&&st(this,n,"m",Le).call(this,{transactionId:s},e=>{e.txParams.authorizationList=g}),t=st(this,n,"m",ae).call(this,s);const b=st(this,n,"m",ae).call(this,s),{txParams:k}=b,w=(0,Ut.prepareTransaction)(l,k);st(this,o,"f").add(s),(0,vt.projectLogger)("Signing transaction",k);const _=await new Promise((e,t)=>{st(this,F,"f")?.call(this,w,p,...st(this,u,"f").call(this,b)).then(e,t),st(this,B,"f").set(s,()=>t(new Error("Signing aborted by user")))});if(st(this,B,"f").delete(s),!_)return(0,vt.projectLogger)("Skipping signed status as no signed transaction"),undefined;const T=(0,ut.cloneDeep)(b);if(!st(this,i,"f").call(this,T,_))return this.updateTransaction(T,"TransactionController#signTransaction - Update after sign"),(0,vt.projectLogger)("Skipping signed status based on hook"),undefined;const E={...st(this,n,"m",ke).call(this,T,_),status:Ct.TransactionStatus.signed,txParams:k};this.updateTransaction(E,"TransactionController#approveTransaction - Transaction signed"),st(this,n,"m",Te).call(this,E);const S=(0,Ut.serializeTransaction)(_),I=(0,ut.merge)({},E,{rawTx:S});return this.updateTransaction(I,"TransactionController#approveTransaction - RawTransaction added"),S},Te=function(e){this.messenger.publish(`${Qt}:transactionStatusUpdated`,{transactionMeta:e})},Ee=function(e,t,s){return(0,Ht.getAndFormatTransactionsForNonceTracker)(s,t,e,this.state.transactions)},Se=function(e){(0,vt.projectLogger)("Processing confirmed transaction",e.id),st(this,n,"m",fe).call(this,e.id),this.messenger.publish(`${Qt}:transactionConfirmed`,e),st(this,n,"m",Te).call(this,e),st(this,n,"m",Ie).call(this,e).catch(e=>{throw(0,vt.projectLogger)("Error while updating post balance",e),e})},Ie=async function(e){try{const{networkClientId:t,type:s}=e;if(s!==Ct.TransactionType.swap)return;const a=st(this,n,"m",le).call(this,{networkClientId:t}),{updatedTransactionMeta:i,approvalTransactionMeta:r}=await(0,Wt.updatePostTransactionBalance)(e,{ethQuery:a,getTransaction:st(this,n,"m",ne).bind(this),updateTransaction:this.updateTransaction.bind(this)});this.messenger.publish(`${Qt}:postTransactionBalanceUpdated`,{transactionMeta:i,approvalTransactionMeta:r})}catch(e){(0,vt.projectLogger)("Error while updating post transaction balance",e)}},Ae=function({provider:e,blockTracker:t,chainId:s}){return new ct.NonceTracker({provider:e,blockTracker:t,getPendingTransactions:st(this,n,"m",De).bind(this,s),getConfirmedTransactions:st(this,n,"m",Ee).bind(this,[Ct.TransactionStatus.confirmed],s)})},ye=function({provider:e,blockTracker:t,chainId:s,networkClientId:a}){const i=new rt.default(e),r=new At.PendingTransactionTracker({blockTracker:t,getChainId:()=>s,getEthQuery:()=>i,getGlobalLock:()=>st(this,D,"f").acquireNonceLockForChainIdKey({chainId:s}),getNetworkClientId:()=>a,getTransactions:()=>this.state.transactions,hooks:{beforeCheckPendingTransaction:st(this,c,"f").bind(this)},isResubmitEnabled:st(this,N,"f").isResubmitEnabled,isTimeoutEnabled:st(this,C,"f"),messenger:this.messenger,publishTransaction:(e,t)=>st(this,n,"m",J).call(this,e,t,{skipSubmitHistory:!0})});return st(this,n,"m",Pe).call(this,r),r},ve=function(){st(this,D,"f").stopAllTracking()},Ce=function(e){e.hub.on("transactions",st(this,n,"m",me).bind(this))},je=function(e){e.hub.removeAllListeners("transaction-confirmed"),e.hub.removeAllListeners("transaction-dropped"),e.hub.removeAllListeners("transaction-failed"),e.hub.removeAllListeners("transaction-updated")},Pe=function(e){e.hub.on("transaction-confirmed",st(this,n,"m",Se).bind(this)),e.hub.on("transaction-dropped",st(this,n,"m",pe).bind(this)),e.hub.on("transaction-failed",st(this,n,"m",ze).bind(this)),e.hub.on("transaction-updated",this.updateTransaction.bind(this))},De=function(e,t){return[...st(this,n,"m",Ee).call(this,[Ct.TransactionStatus.approved,Ct.TransactionStatus.signed,Ct.TransactionStatus.submitted],t,e),...st(this,p,"f").call(this,t,e)]},Ne=async function(e,t){try{return await st(this,n,"m",J).call(this,e,t)}catch(e){if(st(this,n,"m",Re).call(this,e))throw new Error("Previous transaction is already confirmed");throw e}},Re=function(e){return Boolean(e?.message?.includes("nonce too low"))||Boolean(e?.data?.message?.includes("nonce too low"))},Oe=function(){return st(this,H,"f")?[new wt.TestGasFeeFlow]:[new bt.RandomisedEstimationsGasFeeFlow,new pt.LineaGasFeeFlow,new ft.DefaultGasFeeFlow]},Me=function(){return[new gt.OptimismLayer1GasFeeFlow,new kt.ScrollLayer1GasFeeFlow]},Le=function({transactionId:e,skipValidation:t,skipResimulateCheck:s},a){let i;this.update(n=>{const r=n.transactions.findIndex(({id:t})=>t===e);if(-1===r)throw new Error(`Cannot update transaction as ID not found - ${e}`);let o=n.transactions[r];const c=(0,ut.cloneDeep)(o);o=a(o)??o,!0!==t&&(o.txParams=(0,Vt.normalizeTransactionParams)(o.txParams),(0,Kt.validateTxParams)(o.txParams)),!s&&st(this,x,"f").call(this)&&(i=(0,yt.shouldResimulate)(c,o)),n.transactions[r]=o});const r=st(this,n,"m",ne).call(this,e);return i?.resimulate&&st(this,n,"m",Fe).call(this,r,{blockTime:i.blockTime}).catch(e=>{throw(0,vt.projectLogger)("Error during re-simulation",e),e}),r},Fe=async function(e,{blockTime:t,traceContext:s}={}){const{chainId:a,id:i,nestedTransactions:r,networkClientId:o,simulationData:c,txParams:l}=e;let d,m={error:{code:Ct.SimulationErrorCode.Disabled,message:"Simulation disabled"},tokenBalanceChanges:[]},u=[],h=!1;const f=st(this,G,"f").has(i);if(st(this,x,"f").call(this)&&!f){const i=await st(this,U,"f").call(this,{name:"Simulate",parentContext:s},()=>(0,jt.getBalanceChanges)({blockTime:t,chainId:a,ethQuery:st(this,n,"m",le).call(this,{networkClientId:o}),getSimulationConfig:(t,s)=>st(this,_,"f").call(this,t,{txMeta:e,...s}),nestedTransactions:r,txParams:l}));m=i.simulationData,d=i.gasUsed,t&&c&&(0,yt.hasSimulationDataChanged)(c,m)&&(m={...m,isUpdatedAfterSecurityCheck:!0});const f=await st(this,n,"m",Ze).call(this,e);u=f?.gasFeeTokens??[],h=f?.isGasFeeSponsored??!1}if(!st(this,n,"m",ne).call(this,i))return void(0,vt.projectLogger)("Cannot update simulation data as transaction not found",i,m);const p=st(this,n,"m",Le).call(this,{transactionId:i,skipResimulateCheck:Boolean(t)},e=>{e.gasFeeTokens=u,e.isGasFeeSponsored=h,e.gasUsed=d,f||(e.simulationData=m)});(0,vt.projectLogger)("Updated simulation data",i,p),await st(this,n,"m",Je).call(this,p)},Be=function({transactionId:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:s,layer1GasFee:a}){st(this,n,"m",Le).call(this,{transactionId:e},e=>{(0,Tt.updateTransactionGasProperties)({txMeta:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:s,isTxParamsGasFeeUpdatesEnabled:st(this,I,"f"),layer1GasFee:a})})},Ge=function({transactionBatchId:e,gasFeeEstimates:t}){st(this,n,"m",He).call(this,e,e=>({...e,gasFeeEstimates:t}))},He=function(e,t){this.update(s=>{const n=s.transactionBatches.findIndex(t=>t.id===e);if(-1===n)throw new Error(`Cannot update batch, ID not found - ${e}`);const a=s.transactionBatches[n],i=t(a);s.transactionBatches[n]=i??a})},Ue=function(){return this.messenger.call("AccountsController:getSelectedAccount")},qe=function(){const e=this.messenger.call("AccountsController:getState");return Object.values(e.internalAccounts?.accounts??{}).filter(e=>"eip155:eoa"===e.type).map(e=>e.address)},We=function(e,t){const{chainId:s,networkClientId:n,origin:a,rawTx:i,txParams:r}=e,{networkConfigurationsByChainId:o}=st(this,b,"f").call(this),c=o[s],l=c?.rpcEndpoints.find(e=>e.networkClientId===n),d=l?.url,m={chainId:s,hash:t,networkType:l?.name??n,networkUrl:d,origin:a,rawTransaction:i,time:Date.now(),transaction:r};(0,vt.projectLogger)("Updating submit history",m);const u=(0,Rt.getSubmitHistoryLimit)(this.messenger);this.update(e=>{const{submitHistory:t}=e;t.length>=u&&t.pop(),t.unshift(m)})},$e=async function(e){const{chainId:t,networkClientId:s}=e,a=st(this,D,"f").getNetworkClient({networkClientId:s}).configuration.type===ot.NetworkClientType.Custom,i=st(this,n,"m",le).call(this,{networkClientId:s});await(0,Mt.updateGas)({chainId:t,ethQuery:i,isCustomNetwork:a,isSimulationEnabled:st(this,x,"f").call(this),getSimulationConfig:st(this,_,"f"),messenger:this.messenger,txMeta:e})},Ve=function(){this.messenger.registerActionHandler(`${Qt}:addTransaction`,this.addTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:addTransactionBatch`,this.addTransactionBatch.bind(this)),this.messenger.registerActionHandler(`${Qt}:confirmExternalTransaction`,this.confirmExternalTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:emulateNewTransaction`,this.emulateNewTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:emulateTransactionUpdate`,this.emulateTransactionUpdate.bind(this)),this.messenger.registerActionHandler(`${Qt}:estimateGas`,this.estimateGas.bind(this)),this.messenger.registerActionHandler(`${Qt}:estimateGasBatch`,this.estimateGasBatch.bind(this)),this.messenger.registerActionHandler(`${Qt}:getGasFeeTokens`,st(this,n,"m",et).bind(this)),this.messenger.registerActionHandler(`${Qt}:getNonceLock`,this.getNonceLock.bind(this)),this.messenger.registerActionHandler(`${Qt}:getTransactions`,this.getTransactions.bind(this)),this.messenger.registerActionHandler(`${Qt}:updateCustodialTransaction`,this.updateCustodialTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:updateTransaction`,this.updateTransaction.bind(this))},Ke=function(e){this.update(t=>{const s=t.transactions.filter(({id:t})=>t!==e);t.transactions=st(this,n,"m",Z).call(this,s)})},Ye=function(e){return[lt.errorCodes.provider.userRejectedRequest,Kt.ErrorCode.RejectedUpgrade].includes(e.code)},Qe=function(e,t,s){if(st(this,n,"m",X).call(this,e,t,s),s.code===lt.errorCodes.provider.userRejectedRequest)throw lt.providerErrors.userRejectedRequest({message:"MetaMask Tx Signature: User denied transaction signature.",data:s?.data});throw s},ze=function(e,t,s){let a;try{a=st(this,n,"m",Le).call(this,{transactionId:e.id,skipValidation:!0},e=>{e.status=Ct.TransactionStatus.failed,e.error=(0,Vt.normalizeTxError)(t)})}catch(s){(0,vt.projectLogger)("Failed to mark transaction as failed",s),a={...e,status:Ct.TransactionStatus.failed,error:(0,Vt.normalizeTxError)(t)}}this.messenger.publish(`${Qt}:transactionFailed`,{actionId:s,error:t.message,transactionMeta:a}),st(this,n,"m",Te).call(this,a),this.messenger.publish(`${Qt}:transactionFinished`,a),st(this,S,"f").emit(`${e.id}:finished`,a)},Je=async function(e){(0,vt.projectLogger)("Calling afterSimulate hook",e);const{id:t}=e,s=await st(this,r,"f").call(this,{transactionMeta:e}),{skipSimulation:a,updateTransaction:i}=s??{};if(a?st(this,G,"f").add(t):!1===a&&st(this,G,"f").delete(t),!i)return;const o=st(this,n,"m",Le).call(this,{transactionId:t,skipResimulateCheck:!0},e=>{e.txParamsOriginal=(0,ut.cloneDeep)(e.txParams),i(e)});(0,vt.projectLogger)("Updated transaction with afterSimulate data",o)},Xe=async function({ethQuery:e,publishHookOverride:t,traceContext:s},a,i){let r;return await st(this,U,"f").call(this,{name:"Publish",parentContext:s},async()=>{const s=t??st(this,O,"f");({transactionHash:r}=await s(a,i)),r??(r=await st(this,n,"m",J).call(this,e,{...a,rawTx:i}))}),(0,vt.projectLogger)("Publish successful",r),{transactionHash:r}},Ze=async function(e){const{chainId:t}=e;return await(0,Lt.getGasFeeTokens)({chainId:t,getSimulationConfig:st(this,_,"f"),isEIP7702GasFeeTokensEnabled:st(this,A,"f"),messenger:this.messenger,publicKeyEIP7702:st(this,R,"f"),transactionMeta:e})},et=async function(e){const{chainId:t,data:s,from:a,to:i,value:r}=e,o=st(this,n,"m",le).call(this,{chainId:t}),c={chainId:t,delegationAddress:await(0,Dt.getDelegationAddress)(a,o),isExternalSign:!0,txParams:{data:s,from:a,to:i,value:r}};return(await st(this,n,"m",Ze).call(this,c)).gasFeeTokens}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs",{"../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getAccountTransactions=s.getAccountAddressRelationship=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils"),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");s.getAccountAddressRelationship=async function(e){const{chainId:t,from:s,to:a}=e;if(!m.includes(t))throw u("Unsupported chain ID for account relationship API",t),new i.FirstTimeInteractionError("Unsupported chain ID");const r=`${o}/v1/networks/${t}/accounts/${s}/relationships/${a}`;u("Getting account address relationship",{request:e,url:r});const c={[l]:d},h=await(0,n.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},s.getAccountTransactions=async function(e){const{address:t,chainIds:s,cursor:a,endTimestamp:i,sortDirection:r,startTimestamp:o,tags:m}=e;let h=`${c}${t}/transactions`;const f=[];if(s){const e=s.join(",");f.push(`networks=${e}`)}o&&f.push(`startTimestamp=${o}`),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},b=await(0,n.successfulFetch)(h,{headers:g}),k=await b.json();return u("Retrieved account transactions",k),k}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.simulateTransactions=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils"),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)}s.simulateTransactions=async function(e,t){let s=await async function(e){const t=await async function(){const e=`${u("ethereum-mainnet")}${d}`,t=await fetch(e);return t.json()}(),s=(0,n.convertHexToDecimal)(e),a=t[s];if(!a?.confirmations)throw l("Chain is not supported",e),new o.SimulationChainNotSupportedError(e);return u(a.network)}(e);const{newUrl:a,authorization:c}=await t.getSimulationConfig(s)||{};a&&(s=a);const h=m;m+=1;const f=function(e){const t=(0,i.cloneDeep)(e);for(const e of t.transactions){const s=e.to?.toLowerCase();r.DELEGATION_MANAGER_ADDRESSES.includes(s)&&(t.overrides=t.overrides??{},t.overrides[s]={code:r.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS})}return t}(t);l("Sending request",s,t);const p={"Content-Type":"application/json"};c&&(p.Authorization=c);const g=await fetch(s,{method:"POST",headers:p,body:JSON.stringify({id:String(h),jsonrpc:"2.0",method:"infura_simulateTransactions",params:[f]})}),b=await g.json();if(l("Received response",b),b.error){const{code:e,message:t}=b.error;throw new o.SimulationError(t,e)}return b?.result}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS=s.DELEGATION_MANAGER_ADDRESSES=s.ABI_IERC7821=s.ABI_SIMULATION_ERC721_LEGACY=s.ABI_SIMULATION_ERC20_WRAPPED=s.CHAIN_IDS=void 0,s.CHAIN_IDS={MAINNET:"0x1",GOERLI:"0x5",BASE:"0x2105",BASE_TESTNET:"0x14a33",BSC:"0x38",BSC_TESTNET:"0x61",HYPEREVM:"0x3e7",OPTIMISM:"0xa",OPTIMISM_TESTNET:"0x1a4",OPBNB:"0xcc",OPBNB_TESTNET:"0x15eb",OPTIMISM_SEPOLIA:"0xaa37dc",POLYGON:"0x89",POLYGON_TESTNET:"0x13881",AVALANCHE:"0xa86a",AVALANCHE_TESTNET:"0xa869",FANTOM:"0xfa",FANTOM_TESTNET:"0xfa2",SEPOLIA:"0xaa36a7",LINEA_GOERLI:"0xe704",LINEA_SEPOLIA:"0xe705",LINEA_MAINNET:"0xe708",MOONBEAM:"0x504",MOONBEAM_TESTNET:"0x507",MOONRIVER:"0x505",MONAD:"0x8f",GNOSIS:"0x64",ARBITRUM:"0xa4b1",ZKSYNC_ERA:"0x144",ZORA:"0x76adf1",SCROLL:"0x82750",SCROLL_SEPOLIA:"0x8274f",MEGAETH_TESTNET:"0x18c6",SEI:"0x531"},s.ABI_SIMULATION_ERC20_WRAPPED=[{anonymous:!1,inputs:[{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"}],s.ABI_SIMULATION_ERC721_LEGACY=[{anonymous:!1,inputs:[{indexed:!1,name:"_from",type:"address"},{indexed:!1,name:"_to",type:"address"},{indexed:!1,name:"_tokenId",type:"uint256"}],name:"Transfer",type:"event"}],s.ABI_IERC7821=[{type:"function",name:"execute",inputs:[{name:"mode",type:"bytes32",internalType:"ModeCode"},{name:"executionData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"supportsExecutionMode",inputs:[{name:"mode",type:"bytes32",internalType:"ModeCode"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"}],s.DELEGATION_MANAGER_ADDRESSES=["0xdb9b1e94b5b69df7e401ddbede43491141047db3"],s.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS=" "}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SimulationRevertedError=s.SimulationInvalidResponseError=s.SimulationChainNotSupportedError=s.FirstTimeInteractionError=s.SimulationError=void 0;const n=e("./types.cjs");class a extends Error{constructor(e,t){super(e??"Simulation failed"),this.code=t}}s.SimulationError=a;class i extends Error{constructor(e,t){super(e??"Error checking first time interaction"),this.code=t}}s.FirstTimeInteractionError=i;s.SimulationChainNotSupportedError=class extends a{constructor(e){super(`Chain is not supported: ${e}`,n.SimulationErrorCode.ChainNotSupported)}};s.SimulationInvalidResponseError=class extends a{constructor(){super("Invalid response from simulation API",n.SimulationErrorCode.InvalidResponse)}};s.SimulationRevertedError=class extends a{constructor(){super("Transaction was reverted",n.SimulationErrorCode.Reverted)}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","@metamask/gas-fee-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.DefaultGasFeeFlow=void 0;const d=e("@metamask/gas-fee-controller"),m=e("@metamask/utils"),u=e("../logger.cjs"),h=e("../types.cjs"),f=e("../utils/gas-fees.cjs"),p=(0,m.createModuleLogger)(u.projectLogger,"default-gas-fee-flow");s.DefaultGasFeeFlow=class{constructor(){n.add(this)}matchesTransaction(){return!0}async getGasFees(e){const{gasFeeControllerData:t}=e,{gasEstimateType:s,gasFeeEstimates:o}=t;let c;switch(s){case d.GAS_ESTIMATE_TYPES.FEE_MARKET:p("Using fee market estimates",o),c=l(this,n,"m",a).call(this,o);break;case d.GAS_ESTIMATE_TYPES.LEGACY:p("Using legacy estimates",o),c=l(this,n,"m",i).call(this,o);break;case d.GAS_ESTIMATE_TYPES.ETH_GASPRICE:p("Using eth_gasPrice estimates",o),c=l(this,n,"m",r).call(this,o);break;default:throw new Error(`Unsupported gas estimate type: ${s}`)}return{estimates:c}}},n=new WeakSet,a=function(e){const t=Object.values(h.GasFeeEstimateLevel).reduce((t,s)=>({...t,[s]:l(this,n,"m",o).call(this,e,s)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...t}},i=function(e){const t=Object.values(h.GasFeeEstimateLevel).reduce((t,s)=>({...t,[s]:l(this,n,"m",c).call(this,e,s)}),{});return{type:h.GasFeeEstimateType.Legacy,...t}},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,s){var n,a,i,r,o,c,l=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.LineaGasFeeFlow=void 0;const d=e("@metamask/controller-utils"),m=e("@metamask/utils"),u=e("./DefaultGasFeeFlow.cjs"),h=e("../logger.cjs"),f=e("../types.cjs"),p=(0,m.createModuleLogger)(h.projectLogger,"linea-gas-fee-flow"),g=[d.ChainId["linea-mainnet"],d.ChainId["linea-goerli"],d.ChainId["linea-sepolia"]],b={low:1,medium:1.35,high:1.7},k={low:1,medium:1.05,high:1.1};s.LineaGasFeeFlow=class{constructor(){n.add(this)}matchesTransaction({transactionMeta:e}){return g.includes(e.chainId)}async getGasFees(e){try{return await l(this,n,"m",a).call(this,e)}catch(t){return p("Using default flow as fallback due to error",t),(new u.DefaultGasFeeFlow).getGasFees(e)}}},n=new WeakSet,a=async function(e){const{ethQuery:t,transactionMeta:s}=e,a=await l(this,n,"m",i).call(this,s,t);p("Received Linea response",a);const m=l(this,n,"m",r).call(this,a.baseFeePerGas,b);p("Generated base fees",l(this,n,"m",c).call(this,m));const u=l(this,n,"m",r).call(this,a.priorityFeePerGas,k);p("Generated priority fees",l(this,n,"m",c).call(this,u));const h=l(this,n,"m",o).call(this,m,u);p("Generated max fees",l(this,n,"m",c).call(this,h));return{estimates:Object.values(f.GasFeeEstimateLevel).reduce((e,t)=>({...e,[t]:{maxFeePerGas:(0,d.toHex)(h[t]),maxPriorityFeePerGas:(0,d.toHex)(u[t])}}),{type:f.GasFeeEstimateType.FeeMarket})}},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 s=(0,d.hexToBN)(e);return{low:s.muln(t.low),medium:s.muln(t.medium),high:s.muln(t.high)}},o=function(e,t){return{low:e.low.add(t.low),medium:e.medium.add(t.medium),high:e.high.add(t.high)}},c=function(e){return Object.values(f.GasFeeEstimateLevel).map(t=>e[t].toString(10))}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.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),n.add(this)}async matchesTransaction({transactionMeta:e}){const t=(0,o.hexToNumber)(e.chainId),s=await i(this,n,"m",a).call(this);return!!s?.has(t)||d.includes(e.chainId)}}s.OptimismLayer1GasFeeFlow=m,n=new WeakSet,a=async function(){try{const e=await(0,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,s){(function(t){(function(){var n,a,i,r,o,c,l=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.OracleLayer1GasFeeFlow=void 0;const m=e("@ethersproject/contracts"),u=e("@ethersproject/providers"),h=e("@metamask/utils"),f=d(e("bn.js")),p=e("../logger.cjs"),g=e("../utils/prepare.cjs"),b=e("../utils/utils.cjs"),k=(0,h.createModuleLogger)(p.projectLogger,"oracle-layer1-gas-fee-flow"),w=new f.default(0),_=[{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_gasUsed",type:"uint256"}],name:"getOperatorFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}];s.OracleLayer1GasFeeFlow=class{constructor(){n.add(this)}getOracleAddressForChain(e){return"0x420000000000000000000000000000000000000F"}shouldSignTransaction(){return!1}async getLayer1Fee(e){try{const{provider:t,transactionMeta:s}=e,r=l(this,n,"m",c).call(this,t,s.chainId),o=await l(this,n,"m",a).call(this,r,s),d=await l(this,n,"m",i).call(this,r,s);return{layer1Fee:(0,h.add0x)((0,b.padHexToEvenLength)(o.add(d).toString(16)))}}catch(e){throw k("Failed to get oracle layer 1 gas fee",e),new Error("Failed to get oracle layer 1 gas fee")}}},n=new WeakSet,a=async function(e,t){const s=l(this,n,"m",r).call(this,t,this.shouldSignTransaction()).serialize(),a=await e.getL1Fee(s);if(a===undefined)throw new Error("No value returned from oracle contract");return(0,b.toBN)(a)},i=async function(e,t){const{gasUsed:s}=t;if(!s)return w;try{const t=await e.getOperatorFee(s);return t===undefined?w:(0,b.toBN)(t)}catch(e){return k("Failed to get operator layer 1 gas fee",e),w}},r=function(e,s){const a=l(this,n,"m",o).call(this,e),{chainId:i}=e;let r=(0,g.prepareTransaction)(i,a);if(s){const e=t.from("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789","hex"),s=Uint8Array.from(e);r=r.sign(s)}return r},o=function(e){return{...e.txParams,gasLimit:e.txParams.gas}},c=function(e,t){return new m.Contract(this.getOracleAddressForChain(t),_,new u.Web3Provider(e))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","./DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","@metamask/gas-fee-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.randomiseDecimalGWEIAndConvertToHex=s.RandomisedEstimationsGasFeeFlow=void 0;const 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 b(e,t,s){const n=(0,p.gweiDecimalToWeiDecimal)(e),a=n.length,i=Math.min(t,a-s);if(0===Number(n)||i<=0)return`0x${Number(n).toString(16)}`;const r=a-i,o=n.slice(0,r),c=n.slice(-i),l=function(e,t){const s=10**e;return t+Math.floor(Math.random()*(s-t))}(i,Number(c)),m=`0x${(BigInt(o+"0".repeat(i))+BigInt(l)).toString(16)}`;return(0,d.add0x)(m)}s.RandomisedEstimationsGasFeeFlow=class{constructor(){n.add(this)}matchesTransaction({transactionMeta:e,messenger:t}){const{chainId:s}=e;return(0,f.getGasFeeRandomisation)(t).randomisedGasFeeDigits[s]!==undefined}async getGasFees(e){try{return await c(this,n,"m",i).call(this,e)}catch(t){return g("Using default flow as fallback due to error",t),await c(this,n,"m",a).call(this,e)}}},n=new WeakSet,a=async function(e){return(new m.DefaultGasFeeFlow).getGasFees(e)},i=async function(e){const{messenger:t,gasFeeControllerData:s,transactionMeta:i}=e,{gasEstimateType:o,gasFeeEstimates:d}=s,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,n,"m",r).call(this,d,u,h);return g("Added randomised fee market estimates",e),{estimates:e}}return await c(this,n,"m",a).call(this,e)},r=function(e,t,s){const a=Object.values(h.GasFeeEstimateLevel).reduce((a,i)=>({...a,[i]:c(this,n,"m",o).call(this,e,i,t,s)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...a}},o=function(e,t,s,n){return{maxFeePerGas:(0,p.gweiDecimalToWeiHex)(e[t].suggestedMaxFeePerGas),maxPriorityFeePerGas:b(e[t].suggestedMaxPriorityFeePerGas,s,n)}},s.randomiseDecimalGWEIAndConvertToHex=b}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ScrollLayer1GasFeeFlow=void 0;const n=e("./OracleLayer1GasFeeFlow.cjs"),a=e("../constants.cjs"),i=[a.CHAIN_IDS.SCROLL,a.CHAIN_IDS.SCROLL_SEPOLIA];class r extends n.OracleLayer1GasFeeFlow{getOracleAddressForChain(e){return"0x5300000000000000000000000000000000000002"}shouldSignTransaction(){return!0}async matchesTransaction({transactionMeta:e}){return i.includes(e.chainId)}}s.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,s){var n,a,i,r=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},o=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s};Object.defineProperty(s,"__esModule",{value:!0}),s.TestGasFeeFlow=void 0;const c=e("@metamask/controller-utils"),l=e("../types.cjs"),d=1e15;s.TestGasFeeFlow=class{constructor(){n.add(this),a.set(this,1)}matchesTransaction(){return!0}async getGasFees(e){const{transactionMeta:t}=e,{txParams:s}=t,{gas:c}=s;if(!c)throw new Error("Cannot estimate fee without gas value");const m=parseInt(c,16),u=.5*d,h=(r(this,a,"f")+1)*d,f=r(this,a,"f")*d,p=h-u,g=f-u,b=h+u,k=f+u;return o(this,a,r(this,a,"f")+1,"f"),{estimates:{type:l.GasFeeEstimateType.FeeMarket,low:{maxFeePerGas:r(this,n,"m",i).call(this,p,m),maxPriorityFeePerGas:r(this,n,"m",i).call(this,g,m)},medium:{maxFeePerGas:r(this,n,"m",i).call(this,h,m),maxPriorityFeePerGas:r(this,n,"m",i).call(this,f,m)},high:{maxFeePerGas:r(this,n,"m",i).call(this,b,m),maxPriorityFeePerGas:r(this,n,"m",i).call(this,k,m)}}}}},a=new WeakMap,n=new WeakSet,i=function(e,t){const s=Math.ceil(e/t);return(0,c.toHex)(s)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccountsApiRemoteTransactionSource=s.SUPPORTED_CHAIN_IDS=void 0;const l=e("@metamask/controller-utils"),d=c(e("bn.js")),m=e("uuid"),u=e("../index.cjs"),h=e("../api/accounts-api.cjs"),f=e("../constants.cjs"),p=e("../logger.cjs"),g=e("../types.cjs");s.SUPPORTED_CHAIN_IDS=[f.CHAIN_IDS.MAINNET,f.CHAIN_IDS.POLYGON,f.CHAIN_IDS.BSC,f.CHAIN_IDS.LINEA_MAINNET,f.CHAIN_IDS.BASE,f.CHAIN_IDS.OPTIMISM,f.CHAIN_IDS.ARBITRUM,f.CHAIN_IDS.SCROLL,f.CHAIN_IDS.SEI,f.CHAIN_IDS.MONAD,f.CHAIN_IDS.HYPEREVM];const b=(0,p.createModuleLogger)(p.incomingTransactionsLogger,"accounts-api-source");s.AccountsApiRemoteTransactionSource=class{constructor(){n.add(this)}getSupportedChains(){return s.SUPPORTED_CHAIN_IDS}async fetchTransactions(e){const{address:t,chainIds:c}=e,l=await o(this,n,"m",a).call(this,e,c??s.SUPPORTED_CHAIN_IDS);b("Fetched transactions",l.length,l);const d=await Promise.all(l.map(e=>o(this,n,"m",r).call(this,t,e)));b("Normalized transactions",d);const m=o(this,n,"m",i).call(this,e,d);return b("Filtered transactions",m.length,m),m}},n=new WeakSet,a=async function(e,t){const{address:s,tags:n}=e,a=[];try{const e=await(0,h.getAccountTransactions)({address:s,chainIds:t,sortDirection:"DESC",tags:n});e?.data&&a.push(...e.data)}catch(e){b("Error while fetching transactions",e)}return a},i=function(e,t){const{address:s,includeTokenTransfers:n,updateTransactions:a}=e;let i=t;return a||(i=i.filter(e=>e.txParams.to===s)),n||(i=i.filter(e=>!e.isTransfer)),i},r=async function(e,t){const s=String(t.blockNumber),n=`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)),b=t.methodId,k=g.TransactionType.incoming,w=t.isError?g.TransactionStatus.failed:g.TransactionStatus.confirmed,_=t.valueTransfers.find(t=>(t.to.toLowerCase()===e.toLowerCase()||t.from.toLowerCase()===e.toLowerCase())&&t.contractAddress),T=_?.to.toLowerCase()===e.toLowerCase()&&o.toLowerCase()!==e.toLowerCase(),E=o.toLowerCase()===e.toLowerCase(),S=_?.amount,I=_?.contractAddress,A=_?.decimal,y=_?.symbol,x=(0,l.BNToHex)(new d.default(T?_?.amount??t.value:t.value)),v=T?e:t.to,C={blockNumber:s,chainId:n,error:w===g.TransactionStatus.failed?new Error("Transaction failed"):undefined,hash:a,id:r,isTransfer:T,networkClientId:"",status:w,time:i,toSmartContract:!1,transferInformation:_?{amount:S,contractAddress:I,decimals:A,symbol:y}:undefined,txParams:{chainId:n,data:b,from:o,gas:c,gasPrice:h,gasUsed:f,nonce:p,to:v,value:x},type:k,verifiedOnBlockchain:!1};return E&&(C.type=(await(0,u.determineTransactionType)(C.txParams)).type),C}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs",{"../gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","../utils/layer1-gas-fee-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/layer1-gas-fee-flow.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u,h,f,p,g,b,k,w,_,T,E,S,I,A,y=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},x=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},v=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.updateTransactionGasEstimates=s.updateTransactionGasProperties=s.GasFeePoller=void 0;const C=v(e("@metamask/eth-query")),j=e("@metamask/utils"),P=v(e("events")),D=e("../gas-flows/DefaultGasFeeFlow.cjs"),N=e("../logger.cjs"),R=e("../types.cjs"),O=e("../utils/gas-flow.cjs"),M=e("../utils/layer1-gas-fee-flow.cjs"),L=(0,j.createModuleLogger)(N.projectLogger,"gas-fee-poller");function F(e,t,s,n){const{type:a}=t;if(n){if(a===R.GasFeeEstimateType.FeeMarket){const n=t;e.maxFeePerGas=n[s]?.maxFeePerGas,e.maxPriorityFeePerGas=n[s]?.maxPriorityFeePerGas}if(a===R.GasFeeEstimateType.GasPrice){const s=t;e.maxFeePerGas=s.gasPrice,e.maxPriorityFeePerGas=s.gasPrice}if(a===R.GasFeeEstimateType.Legacy){const n=t[s];e.maxFeePerGas=n,e.maxPriorityFeePerGas=n}delete e.gasPrice}else{if(a===R.GasFeeEstimateType.FeeMarket){const n=t;e.gasPrice=n[s]?.maxFeePerGas}if(a===R.GasFeeEstimateType.GasPrice){const s=t;e.gasPrice=s.gasPrice}if(a===R.GasFeeEstimateType.Legacy){const n=t;e.gasPrice=n[s]}delete e.maxFeePerGas,delete e.maxPriorityFeePerGas}}s.GasFeePoller=class{constructor({findNetworkClientIdByChainId:e,gasFeeFlows:t,getGasFeeControllerEstimates:s,getProvider:g,getTransactions:b,getTransactionBatches:k,layer1GasFeeFlows:w,messenger:_,onStateChange:T}){n.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),y(this,a,e,"f"),y(this,i,t,"f"),y(this,d,w,"f"),y(this,r,s,"f"),y(this,o,g,"f"),y(this,c,b,"f"),y(this,l,k,"f"),y(this,m,_,"f"),T(()=>{const e=x(this,n,"m",S).call(this),t=x(this,n,"m",I).call(this);e.length||t.length?x(this,n,"m",f).call(this):x(this,n,"m",p).call(this)})}},a=new WeakMap,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,n=new WeakSet,f=function(){x(this,h,"f")||(x(this,n,"m",g).call(this),y(this,h,!0,"f"),L("Started polling"))},p=function(){x(this,h,"f")&&(clearTimeout(x(this,u,"f")),y(this,u,undefined,"f"),y(this,h,!1,"f"),L("Stopped polling"))},g=async function e(){await x(this,n,"m",b).call(this),await x(this,n,"m",k).call(this),y(this,u,setTimeout(()=>x(this,n,"m",e).call(this),1e4),"f")},b=async function(){const e=x(this,n,"m",S).call(this);if(!e.length)return;L("Found unapproved transactions",e.length);const t=await x(this,n,"m",A).call(this,e);L("Retrieved gas fee controller data",t),await Promise.all(e.flatMap(e=>{const{chainId:s}=e,a=t.get(s);return x(this,n,"m",w).call(this,e,a)}))},k=async function(){const e=x(this,n,"m",I).call(this);if(!e.length)return;L("Found unapproved transaction batches",e.length);const t=await x(this,n,"m",A).call(this,e);L("Retrieved gas fee controller data",t),await Promise.all(e.flatMap(e=>{const{chainId:s}=e,a=t.get(s);return x(this,n,"m",_).call(this,e,a)}))},w=async function(e,t){const{id:s}=e,[a,i]=await Promise.all([x(this,n,"m",T).call(this,e,t),x(this,n,"m",E).call(this,e)]);(a||i)&&this.hub.emit("transaction-updated",{transactionId:s,gasFeeEstimates:a?.gasFeeEstimates,gasFeeEstimatesLoaded:a?.gasFeeEstimatesLoaded,layer1GasFee:i})},_=async function(e,t){const{id:s}=e,n=new C.default(x(this,o,"f").call(this,e.networkClientId)),a=new D.DefaultGasFeeFlow,i={ethQuery:n,gasFeeControllerData:t,messenger:x(this,m,"f"),transactionMeta:{...e,txParams:{...e.transactions?.[0],from:e.from,gas:e.gas},time:Date.now()}};let r;try{r=(await a.getGasFees(i)).estimates}catch(t){L("Failed to get gas fees for batch",e.id,t)}r&&this.hub.emit("transaction-batch-updated",{transactionBatchId:s,gasFeeEstimates:r,gasFeeEstimatesLoaded:!0})},T=async function(e,t){const{networkClientId:s}=e,n=new C.default(x(this,o,"f").call(this,s)),a=(0,O.getGasFeeFlow)(e,x(this,i,"f"),x(this,m,"f"));a&&L("Found gas fee flow",a.constructor.name,e.id);const r={ethQuery:n,gasFeeControllerData:t,messenger:x(this,m,"f"),transactionMeta:e};let c;if(a)try{c=(await a.getGasFees(r)).estimates}catch(t){L("Failed to get suggested gas fees",e.id,t)}return!c&&e.gasFeeEstimatesLoaded?undefined:(L("Updated gas fee estimates",{gasFeeEstimates:c,transaction:e.id}),{gasFeeEstimates:c,gasFeeEstimatesLoaded:!0})},E=async function(e){const{networkClientId:t}=e,s=x(this,o,"f").call(this,t),n=await(0,M.getTransactionLayer1GasFee)({layer1GasFeeFlows:x(this,d,"f"),messenger:x(this,m,"f"),provider:s,transactionMeta:e});return n&&L("Updated layer 1 gas fee",n,e.id),n},S=function(){return x(this,c,"f").call(this).filter(e=>e.status===R.TransactionStatus.unapproved)},I=function(){return x(this,l,"f").call(this).filter(e=>e.status===R.TransactionStatus.unapproved)},A=async function(e){const t=new Map;for(const s of e){const{chainId:e,networkClientId:n}=s;if(t.has(e))continue;const i=n??x(this,a,"f").call(this,e);t.set(e,i)}L("Extracted network client IDs by chain ID",t);const s=Array.from(t.entries()).map(async([e,t])=>[e,await x(this,r,"f").call(this,{networkClientId:t})]);return new Map(await Promise.all(s))},s.updateTransactionGasProperties=function({gasFeeEstimates:e,gasFeeEstimatesLoaded:t,isTxParamsGasFeeUpdatesEnabled:s,layer1GasFee:n,txMeta:a}){const i=a.userFeeLevel,r=Object.values(R.GasFeeEstimateLevel).includes(i);if(s(a)&&r&&e){const t=a.txParams.type!==R.TransactionEnvelopeType.legacy;F(a.txParams,e,i,t)}e&&(a.gasFeeEstimates=e),t!==undefined&&(a.gasFeeEstimatesLoaded=t),n&&(a.layer1GasFee=n)},s.updateTransactionGasEstimates=function({txMeta:e,userFeeLevel:t}){const{txParams:s,gasFeeEstimates:n}=e;if(!n)return;F(s,n,t,e.txParams.type!==R.TransactionEnvelopeType.legacy)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","./AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u,h,f,p,g,b,k,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},O=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},M=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.IncomingTransactionHelper=s.WebSocketState=void 0;const L=M(e("events")),F=e("./AccountsApiRemoteTransactionSource.cjs"),B=e("../logger.cjs"),G=e("../utils/feature-flags.cjs"),H=e("../utils/utils.cjs");var U;!function(e){e.CONNECTED="connected",e.DISCONNECTED="disconnected"}(U||(s.WebSocketState=U={}));s.IncomingTransactionHelper=class{constructor({client:e,getCurrentAccount:t,getLocalTransactions:s,includeTokenTransfers:E,isEnabled:I,messenger:A,remoteTransactionSource:v,trimTransactions:C,updateTransactions:j}){n.add(this),a.set(this,void 0),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),b.set(this,[...F.SUPPORTED_CHAIN_IDS]),k.set(this,e=>{O(this,n,"m",S).call(this,e)}),w.set(this,e=>{O(this,n,"m",y).call(this,e)}),_.set(this,()=>{O(this,n,"m",x).call(this)}),T.set(this,({chainIds:e,status:t})=>{O(this,n,"m",N).call(this,e,t)}),this.hub=new L.default,R(this,a,e,"f"),R(this,i,t,"f"),R(this,r,s,"f"),R(this,o,E,"f"),R(this,c,I??(()=>!0),"f"),R(this,l,!1,"f"),R(this,d,!1,"f"),R(this,m,A,"f"),R(this,u,v,"f"),R(this,f,C,"f"),R(this,p,j,"f"),R(this,g,(0,G.isIncomingTransactionsUseBackendWebSocketServiceEnabled)(A),"f"),O(this,g,"f")&&(O(this,m,"f").subscribe("BackendWebSocketService:connectionStateChanged",O(this,k,"f")),O(this,m,"f").subscribe("AccountActivityService:statusChanged",O(this,T,"f")))}start(){O(this,g,"f")||O(this,n,"m",E).call(this,!0)}stop(){O(this,h,"f")&&clearTimeout(O(this,h,"f")),O(this,l,"f")&&(R(this,l,!1,"f"),(0,B.incomingTransactionsLogger)("Stopped polling"))}async update({chainIds:e,isInterval:t,tags:s}={}){const a=O(this,n,"m",D).call(this,s,t);if((0,B.incomingTransactionsLogger)("Checking for incoming transactions",{isInterval:Boolean(t),tags:a}),!O(this,n,"m",j).call(this))return;const c=O(this,i,"f").call(this),l=O(this,o,"f")??!0,d=O(this,p,"f")??!1;let m=[];try{m=await O(this,u,"f").fetchTransactions({address:c.address,chainIds:e,includeTokenTransfers:l,tags:a,updateTransactions:d})}catch(e){return void(0,B.incomingTransactionsLogger)("Error while fetching remote transactions",e)}if(!m.length)return;O(this,n,"m",C).call(this,m),(0,B.incomingTransactionsLogger)("Found potential transactions",m.length,m);const h=O(this,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,B.incomingTransactionsLogger)("All transactions are already known");(0,B.incomingTransactionsLogger)("Found unique transactions",g.length,g);const b=O(this,f,"f").call(this,[...g,...h]),k=g.map(e=>e.id),w=b.filter(e=>k.includes(e.id));w.length?((0,B.incomingTransactionsLogger)("Adding new transactions",w.length,w),this.hub.emit("transactions",w)):(0,B.incomingTransactionsLogger)("All unique transactions truncated due to limit")}},a=new WeakMap,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,b=new WeakMap,k=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,n=new WeakSet,E=function(e=!1){if(O(this,l,"f"))return;if(!O(this,n,"m",j).call(this))return;const t=O(this,n,"m",P).call(this);(0,B.incomingTransactionsLogger)("Started polling",{interval:t}),R(this,l,!0,"f"),O(this,d,"f")||O(this,n,"m",v).call(this).catch(t=>{(0,B.incomingTransactionsLogger)(e?"Initial polling failed":"Polling failed",t)})},S=function(e){e.state===U.CONNECTED?((0,B.incomingTransactionsLogger)("WebSocket connected, starting enhanced mode"),O(this,n,"m",I).call(this)):e.state===U.DISCONNECTED&&((0,B.incomingTransactionsLogger)("WebSocket disconnected, stopping enhanced mode"),O(this,n,"m",A).call(this))},I=function(){O(this,n,"m",j).call(this)&&((0,B.incomingTransactionsLogger)("Started transaction history retrieval (event-driven)"),this.update().catch(e=>{(0,B.incomingTransactionsLogger)("Initial update in transaction history retrieval failed",e)}),O(this,m,"f").subscribe("AccountActivityService:transactionUpdated",O(this,w,"f")),O(this,m,"f").subscribe("AccountsController:selectedAccountChange",O(this,_,"f")))},A=function(){(0,B.incomingTransactionsLogger)("Stopped transaction history retrieval"),O(this,m,"f").unsubscribe("AccountActivityService:transactionUpdated",O(this,w,"f")),O(this,m,"f").unsubscribe("AccountsController:selectedAccountChange",O(this,_,"f"))},y=function(e){(0,B.incomingTransactionsLogger)("Received relevant transaction update, triggering update",{txId:e.id,chain:e.chain}),this.update().catch(e=>{(0,B.incomingTransactionsLogger)("Update after transaction event failed",e)})},x=function(){(0,B.incomingTransactionsLogger)("Selected account changed, triggering update"),this.update().catch(e=>{(0,B.incomingTransactionsLogger)("Update after account change failed",e)})},v=async function e(){R(this,d,!0,"f");try{const e=O(this,g,"f")?O(this,b,"f"):undefined;await this.update({chainIds:e,isInterval:!0})}catch(e){console.error("Error while checking incoming transactions",e)}R(this,d,!1,"f"),O(this,l,"f")&&(O(this,h,"f")&&clearTimeout(O(this,h,"f")),R(this,h,setTimeout(()=>O(this,n,"m",e).call(this),O(this,n,"m",P).call(this)),"f"))},C=function(e){e.sort((e,t)=>e.time<t.time?-1:1)},j=function(){return O(this,c,"f").call(this)},P=function(){return(0,G.getIncomingTransactionsPollingInterval)(O(this,m,"f"))},D=function(e,t){const s=[];return O(this,a,"f")&&s.push(O(this,a,"f")),e?.length?s.push(...e):t&&s.push("automatic-polling"),s?.length?s:undefined},N=function(e,t){if(!O(this,g,"f"))return;let s=!1;for(const n of e){const e=(0,H.caip2ToHex)(n);if(e&&F.SUPPORTED_CHAIN_IDS.includes(e))if("up"===t){const t=O(this,b,"f").indexOf(e);-1!==t&&(O(this,b,"f").splice(t,1),s=!0,(0,B.incomingTransactionsLogger)("Supported network came up, removed from polling list",{chainId:e}))}else"down"!==t||O(this,b,"f").includes(e)||(O(this,b,"f").push(e),s=!0,(0,B.incomingTransactionsLogger)("Supported network went down, added to polling list",{chainId:e}));else(0,B.incomingTransactionsLogger)("Chain ID not recognized or not supported",{caip2ChainId:n,hexChainId:e})}s?0===O(this,b,"f").length?((0,B.incomingTransactionsLogger)("Stopping fallback polling - all networks up"),this.stop()):((0,B.incomingTransactionsLogger)("Starting fallback polling - some networks need polling",{chainsToPoll:O(this,b,"f")}),O(this,n,"m",E).call(this)):(0,B.incomingTransactionsLogger)("No changes to polling list",{chainsToPoll:O(this,b,"f")})}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js","eth-method-registry":"/home/runner/work/metamask-extension/metamask-extension/node_modules/eth-method-registry/dist/index.js",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},m=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.MethodDataHelper=void 0;const u=e("@metamask/utils"),h=e("async-mutex"),f=e("eth-method-registry"),p=m(e("events")),g=e("../logger.cjs"),b=(0,u.createModuleLogger)(g.projectLogger,"method-data");s.MethodDataHelper=class{constructor({getProvider:e,getState:t}){n.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){b("lookup",e,t);const s=await d(this,o,"f").acquire();try{const s=d(this,i,"f").call(this)[e];if(s)return b("Cached",s),s;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),b("Created registry",t)}const l=await d(this,n,"m",c).call(this,e,o);return b("Result",l),this.hub.emit("update",{fourBytePrefix:e,methodData:l}),l}finally{s()}}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,n=new WeakSet,c=async function(e,t){const s=await t.lookup(e);if(!s)return b("No method found",e),{registryMethod:"",parsedRegistryMethod:{name:undefined,args:undefined}};b("Parsing",s);return{registryMethod:s,parsedRegistryMethod:t.parse(s)}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u,h,f,p=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},g=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.MultichainTrackingHelper=void 0;const b=e("async-mutex"),k=e("../logger.cjs"),w=(0,k.createModuleLogger)(k.projectLogger,"multichain-tracking");s.MultichainTrackingHelper=class{constructor({findNetworkClientIdByChainId:e,getNetworkClientById:t,getNetworkClientRegistry:s,removePendingTransactionTrackerListeners:b,createNonceTracker:k,createPendingTransactionTracker:_,onNetworkStateChange:T}){n.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),s=Array.from(g(this,m,"f").keys()),a=s.filter(e=>!t.includes(e));a.forEach(e=>{g(this,n,"m",h).call(this,e)});const i=t.filter(e=>!s.includes(e));i.forEach(e=>{g(this,n,"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,s,"f"),p(this,o,b,"f"),p(this,c,k,"f"),p(this,l,_,"f"),T((e,t)=>{const s=g(this,r,"f").call(this);t.forEach(({op:e,path:t})=>{if("remove"===e&&"networkConfigurations"===t[0]){const e=t[1];delete s[e]}}),g(this,u,"f").call(this,s)})}initialize(){const e=g(this,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 s=g(this,d,"f").get(e);s||(s=new Map,g(this,d,"f").set(e,s));let n=s.get(t);return n||(n=new b.Mutex,s.set(t,n)),await n.acquire()}async getNonceLock(e,t){const s=g(this,i,"f").call(this,t),n=await this.acquireNonceLockForChainIdKey({chainId:s.configuration.chainId,key:e}),a=g(this,m,"f").get(t)?.nonceTracker;if(!a)throw new Error(`Missing nonce tracker for network client ID - ${t}`);try{const t=await a.getNonceLock(e),s=()=>{t.releaseLock(),n?.()};return{...t,releaseLock:s}}catch(e){throw n?.(),e}}stopAllTracking(){for(const[e]of g(this,m,"f"))g(this,n,"m",h).call(this,e)}getNetworkClient({chainId:e,networkClientId:t}){if(!t&&!e)throw new Error("Cannot locate network client without networkClientId or chainId");let s,n=t;try{t&&(s=g(this,i,"f").call(this,t))}catch(s){if(w("No network client found with ID",t),!e)throw s}return!s&&e&&(n=g(this,a,"f").call(this,e),s=g(this,i,"f").call(this,n)),{...s,id:n}}},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,n=new WeakSet,h=function(e){const t=g(this,m,"f").get(e);t&&(t.pendingTransactionTracker.stop(),g(this,o,"f").call(this,t.pendingTransactionTracker),g(this,m,"f").delete(e))},f=function(e){if(g(this,m,"f").get(e))return;const{provider:t,blockTracker:s,configuration:{chainId:n}}=g(this,i,"f").call(this,e),a=g(this,c,"f").call(this,{provider:t,blockTracker:s,chainId:n}),r=g(this,l,"f").call(this,{provider:t,blockTracker:s,chainId:n,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,s){var n,a,i,r,o,c,l,d,m,u,h,f,p,g,b,k,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R,O,M,L,F,B,G,H,U,q,W,$=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},V=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},K=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.PendingTransactionTracker=void 0;const Y=e("@metamask/controller-utils"),Q=K(e("events")),z=e("lodash"),J=e("./TransactionPoller.cjs"),X=e("../logger.cjs"),Z=e("../types.cjs"),ee=e("../utils/feature-flags.cjs"),te=["replacement transaction underpriced","known transaction","gas price too low to replace","transaction with the same hash was already imported","gateway timeout","nonce too low"],se=(0,X.createModuleLogger)(X.projectLogger,"pending-transactions");s.PendingTransactionTracker=class{constructor({blockTracker:e,getChainId:t,getEthQuery:s,getGlobalLock:S,getNetworkClientId:I,getTransactions:A,isTimeoutEnabled:y,hooks:x,isResubmitEnabled:v,messenger:C,publishTransaction:j}){n.add(this),a.set(this,void 0),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),b.set(this,void 0),k.set(this,void 0),w.set(this,void 0),_.set(this,void 0),this.startIfPendingTransactions=()=>{const e=V(this,n,"m",R).call(this);e.length?V(this,n,"m",T).call(this,e):this.stop()},this.hub=new Q.default,$(this,i,new Map,"f"),$(this,o,t,"f"),$(this,c,s,"f"),$(this,l,S,"f"),$(this,d,I,"f"),$(this,m,A,"f"),$(this,u,v??(()=>!0),"f"),$(this,h,new Map,"f"),$(this,f,V(this,n,"m",E).bind(this),"f"),$(this,g,C,"f"),$(this,b,j,"f"),$(this,k,!1,"f"),$(this,_,undefined,"f"),$(this,w,new J.TransactionPoller({blockTracker:e,chainId:t(),messenger:C}),"f"),$(this,a,x?.beforeCheckPendingTransaction??(()=>Promise.resolve(!0)),"f"),$(this,r,y,"f"),$(this,p,(0,X.createModuleLogger)(se,`${t()}:${I()}`),"f")}addTransactionToPoll(e){V(this,n,"m",T).call(this,[e]),$(this,_,e,"f")}async forceCheckTransaction(e){const t=await V(this,l,"f").call(this);try{await V(this,n,"m",C).call(this,e)}catch(e){V(this,p,"f").call(this,"Failed to check transaction",e)}finally{t()}}stop(){V(this,k,"f")&&(V(this,w,"f").stop(),$(this,k,!1,"f"),V(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,b=new WeakMap,k=new WeakMap,w=new WeakMap,_=new WeakMap,n=new WeakSet,T=function(e){V(this,w,"f").setPendingTransactions(e),V(this,k,"f")||(V(this,w,"f").start(V(this,f,"f")),$(this,k,!0,"f"),V(this,p,"f").call(this,"Started polling"))},E=async function(e){const t=await V(this,l,"f").call(this);try{await V(this,n,"m",S).call(this)}catch(e){V(this,p,"f").call(this,"Failed to check transactions",e)}finally{t()}try{await V(this,n,"m",I).call(this,e)}catch(e){V(this,p,"f").call(this,"Failed to resubmit transactions",e)}},S=async function(){V(this,p,"f").call(this,"Checking transactions");const e=[...V(this,n,"m",R).call(this),...V(this,_,"f")?[V(this,_,"f")]:[]];e.length?(V(this,p,"f").call(this,"Found pending transactions to check",{count:e.length,ids:e.map(e=>e.id)}),await Promise.all(e.map(e=>V(this,n,"m",C).call(this,e)))):V(this,p,"f").call(this,"No pending transactions to check")},I=async function(e){if(!V(this,u,"f").call(this)||!V(this,k,"f"))return;V(this,p,"f").call(this,"Resubmitting transactions");const t=V(this,n,"m",R).call(this);if(t.length){V(this,p,"f").call(this,"Found pending transactions to resubmit",{count:t.length,ids:t.map(e=>e.id)});for(const s of t)try{await V(this,n,"m",y).call(this,s,e)}catch(e){const t=e.value?.message?.toLowerCase()??e.message?.toLowerCase()??String(e);if(V(this,n,"m",A).call(this,t)){V(this,p,"f").call(this,"Ignoring known transaction error",t);continue}V(this,n,"m",O).call(this,s,e.message,"There was an error when resubmitting this transaction.")}}else V(this,p,"f").call(this,"No pending transactions to resubmit")},A=function(e){return te.some(t=>e.includes(t))},y=async function(e,t){if(!V(this,n,"m",x).call(this,e,t))return;if(!await V(this,a,"f").call(this,e))return;const s=V(this,c,"f").call(this,e.networkClientId);await V(this,b,"f").call(this,s,e);const i=(e.retryCount??0)+1;V(this,n,"m",F).call(this,(0,z.merge)({},e,{retryCount:i}),"PendingTransactionTracker:transaction-retry - Retry count increased")},x=function(e,t){const s=(0,z.cloneDeep)(e);s.firstRetryBlockNumber||(s.firstRetryBlockNumber=t,V(this,n,"m",F).call(this,s,"PendingTransactionTracker:#isResubmitDue - First retry block number set"));const{firstRetryBlockNumber:a}=s,i=Number.parseInt(t,16)-Number.parseInt(a,16),r=e.retryCount??0;return i>=Math.min(50,Math.pow(2,r))},v=function(e){const{hash:t,id:s}=e;V(this,_,"f")?.id===s&&$(this,_,undefined,"f"),t&&V(this,h,"f").delete(t)},C=async function(e){const{hash:t,id:s,isIntentComplete:i,txParams:{from:r}}=e;if(i)await V(this,n,"m",j).call(this,e);else{if(!t&&await V(this,a,"f").call(this,e)){const t=new Error("We had an error while submitting this transaction, please try again.");return t.name="NoTxHashError",void V(this,n,"m",M).call(this,e,t)}if(V(this,n,"m",N).call(this,e))return V(this,p,"f").call(this,"Nonce already taken",s),void V(this,n,"m",L).call(this,e);try{const s=await V(this,n,"m",B).call(this,t),a="0x1"===s?.status;if("0x0"===s?.status)return V(this,p,"f").call(this,"Transaction receipt has failed status"),void V(this,n,"m",M).call(this,e,new Error("Transaction failed on-chain"));const{blockNumber:i,blockHash:o}=s??{};if(a&&i&&o)return void await V(this,n,"m",j).call(this,e,{...s,blockNumber:i,blockHash:o});V(this,p,"f").call(this,"No receipt status",{hash:t,receipt:s});const c=await V(this,n,"m",U).call(this,r),l=parseInt(c,16);if(!s&&await V(this,n,"m",P).call(this,e,l))return;await V(this,n,"m",D).call(this,e,l)&&V(this,n,"m",L).call(this,e)}catch(t){V(this,p,"f").call(this,"Failed to check transaction",s,t),V(this,n,"m",O).call(this,e,t.message,"There was a problem loading this transaction.")}}},j=async function(e,t){const{id:s}=e,{blockHash:a}=t??{};V(this,p,"f").call(this,"Transaction confirmed",s);const i=V(this,_,"f")?.id===s;if(V(this,n,"m",v).call(this,e),i)return void this.hub.emit("transaction-confirmed",e);const r=(0,z.cloneDeep)(e);if(t&&a){const{baseFeePerGas:e,timestamp:s}=await V(this,n,"m",H).call(this,a,!1);r.baseFeePerGas=e,r.blockTimestamp=s,r.txParams={...r.txParams,gasUsed:t.gasUsed},r.txReceipt=t,r.verifiedOnBlockchain=!0}r.status=Z.TransactionStatus.confirmed,V(this,n,"m",F).call(this,r,"PendingTransactionTracker:#onTransactionConfirmed - Transaction confirmed"),this.hub.emit("transaction-confirmed",r)},P=async function(e,t){const{chainId:s,hash:a,id:i,submittedTime:o,txParams:{nonce:c}}=e;if(!a||!c)return!1;if(!V(this,r,"f").call(this,e))return V(this,p,"f").call(this,"Timeout disabled for transaction",e),!1;const l=(0,ee.getTimeoutAttempts)(s,V(this,g,"f"));if(l===undefined||0===l)return V(this,p,"f").call(this,"Timeout disabled due to threshold",{chainId:s,threshold:l}),!1;const d=parseInt(c,16);if(d>t)return V(this,p,"f").call(this,"Skipping timeout as queued transaction",{transactionNonce:d,nextNonce:t}),!1;try{if(null!==await V(this,n,"m",G).call(this,a)){const e=Date.now();return V(this,p,"f").call(this,"Transaction found on network, recording timestamp",i),V(this,h,"f").set(a,e),!1}const t=V(this,h,"f").get(a)??o;if(t===undefined)return V(this,p,"f").call(this,"Transaction not yet seen on network and has no submitted time, skipping timeout check",i),!1;const{blockTime:r}=(0,ee.getAcceleratedPollingParams)(s,V(this,g,"f")),c=Date.now()-t,d=r*l;return V(this,p,"f").call(this,"Checking timeout duration",{transactionId:i,durationSinceLastSeen:c,timeoutDuration:d,threshold:l,blockTime:r}),c<d?!1:(V(this,p,"f").call(this,"Hit timeout duration threshold",i),V(this,h,"f").delete(a),V(this,n,"m",M).call(this,e,new Error("Transaction not found on network after timeout")),!0)}catch(e){return V(this,p,"f").call(this,"Failed to check transaction by hash",i,e),!1}},D=async function(e,t){const{hash:s,id:n,txParams:{nonce:a}}=e;if(!a||!s)return!1;if(parseInt(a,16)>=t)return!1;let r=V(this,i,"f").get(s);return r===undefined&&(r=0,V(this,i,"f").set(s,r)),r<3?(V(this,p,"f").call(this,"Incrementing dropped block count",{id:n,droppedBlockCount:r}),V(this,i,"f").set(s,r+1),!1):(V(this,p,"f").call(this,"Hit dropped block count",n),V(this,i,"f").delete(s),!0)},N=function(e){const{id:t,txParams:s}=e;return V(this,n,"m",q).call(this).some(e=>e.id!==t&&e.txParams.from===s.from&&e.status===Z.TransactionStatus.confirmed&&e.txParams.nonce&&e.txParams.nonce===s.nonce&&e.type!==Z.TransactionType.incoming&&e.isTransfer===undefined)},R=function(){return V(this,n,"m",W).call(this).filter(e=>e.status===Z.TransactionStatus.submitted&&!e.verifiedOnBlockchain&&!e.isUserOperation&&!e.isStateOnly)},O=function(e,t,s){V(this,n,"m",F).call(this,{...e,warning:{error:t,message:s}},"PendingTransactionTracker:#warnTransaction - Warning added")},M=function(e,t){V(this,p,"f").call(this,"Transaction failed",e.id,t),V(this,n,"m",v).call(this,e),this.hub.emit("transaction-failed",e,t)},L=function(e){V(this,p,"f").call(this,"Transaction dropped",e.id),V(this,n,"m",v).call(this,e),this.hub.emit("transaction-dropped",e)},F=function(e,t){this.hub.emit("transaction-updated",e,t)},B=async function(e){return await(0,Y.query)(V(this,c,"f").call(this),"getTransactionReceipt",[e])},G=async function(e){return await(0,Y.query)(V(this,c,"f").call(this),"getTransactionByHash",[e])},H=async function(e,t){return await(0,Y.query)(V(this,c,"f").call(this),"getBlockByHash",[e,t])},U=async function(e){return await(0,Y.query)(V(this,c,"f").call(this),"getTransactionCount",[e])},q=function(){const e=V(this,o,"f").call(this);return V(this,m,"f").call(this).filter(t=>t.chainId===e)},W=function(){const e=V(this,d,"f").call(this);return V(this,m,"f").call(this).filter(t=>t.networkClientId===e)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},h=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.hasSimulationDataChanged=s.shouldResimulate=s.ResimulateHelper=s.RESIMULATE_INTERVAL_MS=s.BLOCK_TIME_ADDITIONAL_SECONDS=s.VALUE_COMPARISON_PERCENT_THRESHOLD=s.BLOCKAID_RESULT_TYPE_MALICIOUS=s.RESIMULATE_PARAMS=void 0;const f=e("@metamask/utils"),p=e("bn.js"),g=e("lodash"),b=e("../logger.cjs"),k=e("../types.cjs"),w=e("../utils/utils.cjs"),_=(0,b.createModuleLogger)(b.projectLogger,"resimulate-helper");s.RESIMULATE_PARAMS=["to","value","data"],s.BLOCKAID_RESULT_TYPE_MALICIOUS="Malicious",s.VALUE_COMPARISON_PERCENT_THRESHOLD=5,s.BLOCK_TIME_ADDITIONAL_SECONDS=60,s.RESIMULATE_INTERVAL_MS=3e3;function T(e,t){return!E(e?.difference??"0x0",t?.difference??"0x0",!1===e?.isDecrease,!1===t?.isDecrease)}function E(e,t,n,a){let i=new p.BN((0,f.remove0x)(e),"hex"),r=new p.BN((0,f.remove0x)(t),"hex");return n&&(i=i.neg()),a&&(r=r.neg()),(0,w.getPercentageChange)(i,r)<=s.VALUE_COMPARISON_PERCENT_THRESHOLD}s.ResimulateHelper=class{constructor({getTransactions:e,simulateTransaction:t,onTransactionsUpdate:s}){n.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"),s(h(this,n,"m",o).bind(this))}},a=new WeakMap,i=new WeakMap,r=new WeakMap,n=new WeakSet,o=function(){const e=h(this,i,"f").call(this).filter(e=>e.status===k.TransactionStatus.unapproved),t=new Set(e.map(e=>e.id));new Set([...t,...h(this,a,"f").keys()]).forEach(t=>{const s=e.find(e=>e.id===t);s?.isActive?h(this,n,"m",c).call(this,s):h(this,n,"m",d).call(this,t)})},c=function(e){const{id:t}=e;if(h(this,a,"f").has(t))return;const i=()=>{h(this,r,"f").call(this,e).catch(e=>{_("Error during transaction resimulation",e)}).finally(()=>{h(this,a,"f").has(t)&&h(this,n,"m",l).call(this,t,i)})};h(this,n,"m",l).call(this,t,i),_(`Started resimulating transaction ${t} every ${s.RESIMULATE_INTERVAL_MS} milliseconds`)},l=function(e,t){const n=setTimeout(t,s.RESIMULATE_INTERVAL_MS);h(this,a,"f").set(e,n)},d=function(e){h(this,a,"f").has(e)&&(h(this,n,"m",m).call(this,e),_(`Stopped resimulating transaction ${e} every ${s.RESIMULATE_INTERVAL_MS} milliseconds`))},m=function(e){const t=h(this,a,"f").get(e);t&&(clearTimeout(t),h(this,a,"f").delete(e))},s.shouldResimulate=function(e,t){const{id:n}=t,a=function(e,t){const{id:n,txParams:a}=t,{txParams:i}=e;if(!i||(0,g.isEqual)(i,a))return!1;const r=Object.keys(a).filter(e=>a[e]!==i[e]);return _("Transaction parameters updated",{transactionId:n,updatedProperties:r,originalParams:i,newParams:a}),s.RESIMULATE_PARAMS.some(e=>r.includes(e))}(e,t),i=function(e,t){const{securityAlertResponse:n}=e,{id:a,securityAlertResponse:i}=t;if((0,g.isEqual)(n,i))return!1;return _("Security alert updated",{transactionId:a,originalSecurityAlertResponse:n,newSecurityAlertResponse:i}),i?.result_type===s.BLOCKAID_RESULT_TYPE_MALICIOUS}(e,t),r=function(e,t){const{simulationData:s}=e,{simulationData:n,txParams:a}=t;if(!n||(0,g.isEqual)(s,n))return!1;return!E(a?.value??"0x0",n?.nativeBalanceChange?.difference??"0x0",!1,!1===n?.nativeBalanceChange?.isDecrease)}(e,t),o=a||i||r;let c;if(i||r){c=Math.floor(Date.now()/1e3)+s.BLOCK_TIME_ADDITIONAL_SECONDS}return o&&_("Transaction should be resimulated",{transactionId:n,blockTime:c,parametersUpdated:a,securityAlert:i,valueAndNativeBalanceMismatch:r}),{blockTime:c,resimulate:o}},s.hasSimulationDataChanged=function(e,t){if((0,g.isEqual)(e,t))return!1;if(T(e?.nativeBalanceChange,t?.nativeBalanceChange))return _("Simulation data native balance changed"),!0;if(e.tokenBalanceChanges.length!==t.tokenBalanceChanges.length)return!0;for(const s of e.tokenBalanceChanges){const e=t.tokenBalanceChanges.find(({address:e,id:t})=>e===s.address&&t===s.id);if(!e)return _("Missing new token balance",{address:s.address,id:s.id}),!0;if(T(s,e))return _("Simulation data token balance changed",{originalTokenBalanceChange:s,newTokenBalanceChange:e}),!0}return!1}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u,h,f,p,g,b,k,w,_=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},T=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.TransactionPoller=void 0;const E=e("@metamask/utils"),S=e("lodash"),I=e("../logger.cjs"),A=e("../utils/feature-flags.cjs"),y=(0,E.createModuleLogger)(I.projectLogger,"transaction-poller");var x;!function(e){e.Accelerated="Accelerated",e.BlockTracker="BlockTracker",e.Websocket="Websocket"}(x||(x={}));s.TransactionPoller=class{constructor({blockTracker:e,chainId:t,messenger:s}){n.add(this),a.set(this,0),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),b.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,n,"m",f).call(this,x.Websocket).catch(()=>{})}),_(this,i,e,"f"),_(this,r,t,"f"),_(this,o,s,"f")}start(e){T(this,m,"f")||(_(this,l,e,"f"),_(this,m,!0,"f"),T(this,n,"m",k).call(this),T(this,n,"m",h).call(this),y("Started"))}stop(){T(this,m,"f")&&(_(this,m,!1,"f"),_(this,l,undefined,"f"),_(this,a,0,"f"),_(this,d,undefined,"f"),T(this,n,"m",p).call(this),T(this,n,"m",g).call(this),T(this,n,"m",w).call(this),y("Stopped"))}setPendingTransactions(e){const t=(T(this,d,"f")??[]).map(e=>e.id);_(this,d,e,"f");const s=e.map(e=>e.id),i=!(0,S.isEqual)(t,s);T(this,m,"f")&&i&&(y("Detected new pending transactions",s),_(this,a,0,"f"),T(this,c,"f")&&(T(this,n,"m",g).call(this),T(this,n,"m",h).call(this)))}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,u=new WeakMap,b=new WeakMap,n=new WeakSet,h=function e(){if(!T(this,m,"f"))return;const{countMax:t,intervalMs:s}=(0,A.getAcceleratedPollingParams)(T(this,r,"f"),T(this,o,"f"));if(T(this,a,"f")>=t)return _(this,c,e=>T(this,n,"m",f).call(this,x.BlockTracker,e),"f"),T(this,i,"f").on("latest",T(this,c,"f")),void y("Added block tracker listener");T(this,n,"m",p).call(this),_(this,u,setTimeout(async()=>{await T(this,n,"m",f).call(this,x.Accelerated),T(this,n,"m",e).call(this)},s),"f")},f=async function(e,t){switch(e){case x.Websocket:y("AccountActivityService:transactionUpdated received");break;case x.Accelerated:y("Accelerated interval",T(this,a,"f")+1);break;case x.BlockTracker:y("Block tracker interval",t)}const s=t??await T(this,i,"f").getLatestBlock();await(T(this,l,"f")?.call(this,s)),e===x.Accelerated&&T(this,m,"f")&&_(this,a,T(this,a,"f")+1,"f")},p=function(){T(this,u,"f")&&(clearTimeout(T(this,u,"f")),_(this,u,undefined,"f"))},g=function(){T(this,c,"f")&&(T(this,i,"f").removeListener("latest",T(this,c,"f")),_(this,c,undefined,"f"))},k=function(){T(this,o,"f").subscribe("AccountActivityService:transactionUpdated",T(this,b,"f"))},w=function(){T(this,o,"f").unsubscribe("AccountActivityService:transactionUpdated",T(this,b,"f"))}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.CollectPublishHook=void 0;const d=e("@metamask/utils"),m=e("lodash"),u=e("../logger.cjs"),h=(0,d.createModuleLogger)(u.projectLogger,"collect-publish-hook");s.CollectPublishHook=class{constructor(e){n.add(this),a.set(this,void 0),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,n,"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 s=l(this,a,"f")[t],n=e[t];s.promise.resolve({transactionHash:n})}}error(e){h("Error",{error:e});for(const t of l(this,a,"f"))t.promise.reject(e)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,n=new WeakSet,o=function(e,t){const s=e.txParams.nonce??"0x0",n=parseInt(s,16);h("Processing transaction",{nonce:n,signedTx:t,transactionMeta:e});const o=(0,d.createDeferredPromise)();if(l(this,a,"f").push({nonce:n,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,s){var n,a,i,r,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.ExtraTransactionsPublishHook=void 0;const d=e("@metamask/utils"),m=e("../logger.cjs"),u=(0,d.createModuleLogger)(m.projectLogger,"extra-transactions-publish-hook");s.ExtraTransactionsPublishHook=class{constructor({addTransactionBatch:e,getTransaction:t,originalPublishHook:s}){n.add(this),a.set(this,void 0),i.set(this,void 0),r.set(this,void 0),c(this,a,e,"f"),c(this,i,t,"f"),c(this,r,s,"f")}getHook(){return l(this,n,"m",o).bind(this)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,n=new WeakSet,o=async function(e,t){u("Publishing transaction as batch",{transactionMeta:e,signedTx:t});const{batchTransactions:s,batchTransactionsOptions:n,id:o,networkClientId:c,txParams:m}=e,h=m.from,f=m.to,p=m.data,g=m.value,b=m.gas,k=m.maxFeePerGas,w=m.maxPriorityFeePerGas,_=t,T=(0,d.createDeferredPromise)(),E={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:_},params:{data:p,gas:b,maxFeePerGas:k,maxPriorityFeePerGas:w,to:f,value:g}},S=(s??[]).map(e=>{const{isAfter:t,type:s,...n}=e;return{isAfter:t,params:n,type:s}}),I=[...S.filter(e=>!1===e.isAfter).map(({isAfter:e,...t})=>({...t})),E,...S.filter(e=>e.isAfter===undefined||e.isAfter).map(({isAfter:e,...t})=>({...t}))];u("Adding transaction batch",{from:h,networkClientId:c,transactions:I});const A=n??{disable7702:!0,disableHook:!1,disableSequential:!0};return await l(this,a,"f").call(this,{from:h,networkClientId:c,requireApproval:!1,transactions:I,...A}),T.promise}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u,h,f=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},p=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.SequentialPublishBatchHook=void 0;const g=e("@metamask/rpc-errors"),b=e("@metamask/utils"),k=e("../logger.cjs"),w=(0,b.createModuleLogger)(k.projectLogger,"sequential-publish-batch-hook");s.SequentialPublishBatchHook=class{constructor({publishTransaction:e,getTransaction:t,getPendingTransactionTracker:s,getEthQuery:l}){n.add(this),a.set(this,void 0),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,s,"f")}getHook(){return p(this,n,"m",l).bind(this)}},a=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,c=new WeakMap,n=new WeakSet,l=async function({from:e,networkClientId:t,transactions:s}){w("Starting sequential publish batch hook",{from:e,networkClientId:t});const c=p(this,o,"f").call(this,t),l=[];for(const e of s)try{const s=p(this,i,"f").call(this,String(e.id)),o=await p(this,a,"f").call(this,p(this,r,"f").call(this,t),s);w("Transaction published",{transactionHash:o});const m={...s,hash:o},u=p(this,n,"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,s){return new Promise((a,i)=>{const r=p(this,n,"m",m).bind(this,t,s,a,e),o=p(this,n,"m",u).bind(this,t,s,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,s,a,i){i.id===e&&(w("Transaction confirmed",{transactionHash:t}),p(this,n,"m",h).call(this,a,e),s(i))},u=function(e,t,s,a,i,r){i.id===e&&(w("Transaction failed or dropped",{transactionHash:t,error:r}),p(this,n,"m",h).call(this,a,e),s(new Error(`Transaction ${t} failed or dropped.`)))},h=function(e,t){const s=p(this,c,"f")[t];e.hub.off("transaction-confirmed",s.onConfirmed),e.hub.off("transaction-failed",s.onFailedOrDropped),e.hub.off("transaction-dropped",s.onFailedOrDropped),delete p(this,c,"f")[t]}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs",{"./TransactionController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./helpers/AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","./utils/transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.HARDFORK=s.INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS=s.CHAIN_IDS=s.normalizeTransactionParams=s.isEIP1559Transaction=s.mergeGasFeeEstimates=s.determineTransactionType=s.WalletDevice=s.UserFeeLevel=s.TransactionType=s.TransactionStatus=s.TransactionEnvelopeType=s.TransactionContainerType=s.SimulationTokenStandard=s.SimulationErrorCode=s.GasFeeEstimateType=s.GasFeeEstimateLevel=s.TransactionController=s.SPEED_UP_RATE=s.CANCEL_RATE=void 0;var n=e("./TransactionController.cjs");Object.defineProperty(s,"CANCEL_RATE",{enumerable:!0,get:function(){return n.CANCEL_RATE}}),Object.defineProperty(s,"SPEED_UP_RATE",{enumerable:!0,get:function(){return n.SPEED_UP_RATE}}),Object.defineProperty(s,"TransactionController",{enumerable:!0,get:function(){return n.TransactionController}});var a=e("./types.cjs");Object.defineProperty(s,"GasFeeEstimateLevel",{enumerable:!0,get:function(){return a.GasFeeEstimateLevel}}),Object.defineProperty(s,"GasFeeEstimateType",{enumerable:!0,get:function(){return a.GasFeeEstimateType}}),Object.defineProperty(s,"SimulationErrorCode",{enumerable:!0,get:function(){return a.SimulationErrorCode}}),Object.defineProperty(s,"SimulationTokenStandard",{enumerable:!0,get:function(){return a.SimulationTokenStandard}}),Object.defineProperty(s,"TransactionContainerType",{enumerable:!0,get:function(){return a.TransactionContainerType}}),Object.defineProperty(s,"TransactionEnvelopeType",{enumerable:!0,get:function(){return a.TransactionEnvelopeType}}),Object.defineProperty(s,"TransactionStatus",{enumerable:!0,get:function(){return a.TransactionStatus}}),Object.defineProperty(s,"TransactionType",{enumerable:!0,get:function(){return a.TransactionType}}),Object.defineProperty(s,"UserFeeLevel",{enumerable:!0,get:function(){return a.UserFeeLevel}}),Object.defineProperty(s,"WalletDevice",{enumerable:!0,get:function(){return a.WalletDevice}});var i=e("./utils/transaction-type.cjs");Object.defineProperty(s,"determineTransactionType",{enumerable:!0,get:function(){return i.determineTransactionType}});var r=e("./utils/gas-flow.cjs");Object.defineProperty(s,"mergeGasFeeEstimates",{enumerable:!0,get:function(){return r.mergeGasFeeEstimates}});var o=e("./utils/utils.cjs");Object.defineProperty(s,"isEIP1559Transaction",{enumerable:!0,get:function(){return o.isEIP1559Transaction}}),Object.defineProperty(s,"normalizeTransactionParams",{enumerable:!0,get:function(){return o.normalizeTransactionParams}});var c=e("./constants.cjs");Object.defineProperty(s,"CHAIN_IDS",{enumerable:!0,get:function(){return c.CHAIN_IDS}});var l=e("./helpers/AccountsApiRemoteTransactionSource.cjs");Object.defineProperty(s,"INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS",{enumerable:!0,get:function(){return l.SUPPORTED_CHAIN_IDS}});var d=e("./utils/prepare.cjs");Object.defineProperty(s,"HARDFORK",{enumerable:!0,get:function(){return d.HARDFORK}})}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createModuleLogger=s.incomingTransactionsLogger=s.projectLogger=void 0;const n=e("@metamask/utils");Object.defineProperty(s,"createModuleLogger",{enumerable:!0,get:function(){return n.createModuleLogger}}),s.projectLogger=(0,n.createProjectLogger)("transaction-controller"),s.incomingTransactionsLogger=(0,n.createModuleLogger)(s.projectLogger,"incoming-transactions")}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,i,r,o,c,l,d,m,u;Object.defineProperty(s,"__esModule",{value:!0}),s.SimulationErrorCode=s.SimulationTokenStandard=s.GasFeeEstimateType=s.GasFeeEstimateLevel=s.UserFeeLevel=s.TransactionEnvelopeType=s.TransactionContainerType=s.TransactionType=s.WalletDevice=s.TransactionStatus=void 0,function(e){e.unapproved="unapproved",e.approved="approved",e.signed="signed",e.submitted="submitted",e.confirmed="confirmed",e.failed="failed",e.dropped="dropped",e.rejected="rejected",e.cancelled="cancelled"}(n||(s.TransactionStatus=n={})),function(e){e.MM_MOBILE="metamask_mobile",e.MM_EXTENSION="metamask_extension",e.OTHER="other_device"}(a||(s.WalletDevice=a={})),function(e){e.batch="batch",e.bridge="bridge",e.bridgeApproval="bridgeApproval",e.cancel="cancel",e.contractInteraction="contractInteraction",e.deployContract="contractDeployment",e.ethDecrypt="eth_decrypt",e.ethGetEncryptionPublicKey="eth_getEncryptionPublicKey",e.gasPayment="gas_payment",e.incoming="incoming",e.lendingDeposit="lendingDeposit",e.lendingWithdraw="lendingWithdraw",e.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||(s.TransactionType=i={})),function(e){e.EnforcedSimulations="enforcedSimulations"}(r||(s.TransactionContainerType=r={})),function(e){e.legacy="0x0",e.accessList="0x1",e.feeMarket="0x2",e.setCode="0x4"}(o||(s.TransactionEnvelopeType=o={})),function(e){e.CUSTOM="custom",e.DAPP_SUGGESTED="dappSuggested",e.MEDIUM="medium"}(c||(s.UserFeeLevel=c={})),function(e){e.Low="low",e.Medium="medium",e.High="high"}(l||(s.GasFeeEstimateLevel=l={})),function(e){e.FeeMarket="fee-market",e.Legacy="legacy",e.GasPrice="eth_gasPrice"}(d||(s.GasFeeEstimateType=d={})),function(e){e.erc20="erc20",e.erc721="erc721",e.erc1155="erc1155"}(m||(s.SimulationTokenStandard=m={})),function(e){e.ChainNotSupported="chain-not-supported",e.Disabled="disabled",e.InvalidResponse="invalid-response",e.Reverted="reverted"}(u||(s.SimulationErrorCode=u={}))}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs"}]],[],{});