LavaPack.loadBundle([["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js",{"@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/logger":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"FirebaseError",{enumerable:!0,get:function(){return o.FirebaseError}}),s._DEFAULT_ENTRY_NAME=s.SDK_VERSION=void 0,s._addComponent=H,s._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},s._apps=void 0,s._clearComponents=function(){W.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=q,s._isFirebaseApp=K,s._isFirebaseServerApp=function(e){return e.settings!==undefined},s._registerComponent=$,s._removeServiceInstance=function(e,t,s=B){q(e,t).clearInstance(s)},s._serverApps=void 0,s.deleteApp=Y,s.getApp=function(e=B){const t=F.get(e);if(!t&&e===B&&(0,o.getDefaultAppConfig)())return Q();if(!t)throw G.create("no-app",{appName:e});return t},s.getApps=function(){return Array.from(F.values())},s.initializeApp=Q,s.initializeServerApp=function(e,t){if((0,o.isBrowser)()&&!(0,o.isWebWorker)())throw G.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let s;s=K(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 G.create("finalization-registry-not-supported",{});const r=""+(c=JSON.stringify(a),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),i=U.get(r);var c;if(i)return i.incRefCount(t.releaseOnDeref),i;const l=new n.ComponentContainer(r);for(const e of W.values())l.addComponent(e);const u=new J(s,t,r,l);return U.set(r,u),u},s.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw G.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"),o=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 i{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const c="@firebase/app",l="0.10.18",u=new a.Logger("@firebase/app"),d="@firebase/app-compat",m="@firebase/analytics-compat",h="@firebase/analytics",f="@firebase/app-check-compat",p="@firebase/app-check",k="@firebase/auth",b="@firebase/auth-compat",g="@firebase/database",y="@firebase/data-connect",w="@firebase/database-compat",S="@firebase/functions",A="@firebase/functions-compat",v="@firebase/installations",x="@firebase/installations-compat",_="@firebase/messaging",C="@firebase/messaging-compat",T="@firebase/performance",j="@firebase/performance-compat",E="@firebase/remote-config",I="@firebase/remote-config-compat",O="@firebase/storage",P="@firebase/storage-compat",M="@firebase/firestore",D="@firebase/vertexai",N="@firebase/firestore-compat",R="firebase",B=s._DEFAULT_ENTRY_NAME="[DEFAULT]",L={[c]:"fire-core",[d]:"fire-core-compat",[h]:"fire-analytics",[m]:"fire-analytics-compat",[p]:"fire-app-check",[f]:"fire-app-check-compat",[k]:"fire-auth",[b]:"fire-auth-compat",[g]:"fire-rtdb",[y]:"fire-data-connect",[w]:"fire-rtdb-compat",[S]:"fire-fn",[A]:"fire-fn-compat",[v]:"fire-iid",[x]:"fire-iid-compat",[_]:"fire-fcm",[C]:"fire-fcm-compat",[T]:"fire-perf",[j]:"fire-perf-compat",[E]:"fire-rc",[I]:"fire-rc-compat",[O]:"fire-gcs",[P]:"fire-gcs-compat",[M]:"fire-fst",[N]:"fire-fst-compat",[D]:"fire-vertex","fire-js":"fire-js",[R]:"fire-js-all"},F=s._apps=new Map,U=s._serverApps=new Map,W=s._components=new Map;function H(e,t){try{e.container.addComponent(t)}catch(s){u.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function $(e){const t=e.name;if(W.has(t))return u.debug(`There were multiple attempts to register component ${t}.`),!1;W.set(t,e);for(const t of F.values())H(t,e);for(const t of U.values())H(t,e);return!0}function q(e,t){const s=e.container.getProvider("heartbeat").getImmediate({optional:!0});return s&&s.triggerHeartbeat(),e.container.getProvider(t)}function K(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."},G=new o.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 z{constructor(e,t,s){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=s,this.container.addComponent(new n.Component("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw G.create("app-deleted",{appName:this._name})}}
/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class J extends z{constructor(e,t,s,n){const a=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,o={name:s,automaticDataCollectionEnabled:a};if(e.apiKey!==undefined)super(e,o,n);else{super(e.options,o,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(){Y(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw G.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 Q(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:B,automaticDataCollectionEnabled:!1},t),r=a.name;if("string"!=typeof r||!r)throw G.create("bad-app-name",{appName:String(r)});if(s||(s=(0,o.getDefaultAppConfig)()),!s)throw G.create("no-options");const i=F.get(r);if(i){if((0,o.deepEqual)(s,i.options)&&(0,o.deepEqual)(a,i.config))return i;throw G.create("duplicate-app",{appName:r})}const c=new n.ComponentContainer(r);for(const e of W.values())c.addComponent(e);const l=new z(s,a,c);return F.set(r,l),l}async function Y(e){let t=!1;const s=e.name;if(F.has(s))t=!0,F.delete(s);else if(U.has(s)){e.decRefCount()<=0&&(U.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 o=null!==(a=L[e])&&void 0!==a?a:e;s&&(o+=`-${s}`);const r=o.match(/\s|\//),i=t.match(/\s|\//);if(r||i){const e=[`Unable to register library "${o}" with version "${t}":`];return r&&e.push(`library name "${o}" contains illegal characters (whitespace or "/")`),r&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void u.warn(e.join(" "))}$(new n.Component(`${o}-version`,()=>({library:o,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 G.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 o.FirebaseError)u.warn(e.message);else{const t=G.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});u.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=oe();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===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){u.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=oe(),{heartbeatsToSend:s,unsentEntries:n}=function(e,t=1024){const s=[];let n=e.slice();for(const a of e){const e=s.find(e=>e.agent===a.agent);if(e){if(e.dates.push(a.date),ie(s)>t){e.dates.pop();break}}else if(s.push({agent:a.agent,dates:[a.date]}),ie(s)>t){s.pop();break}n=n.slice(1)}return{heartbeatsToSend:s,unsentEntries:n}}(this._heartbeatsCache.heartbeats),a=(0,o.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 u.warn(e),""}}}function oe(){return(new Date).toISOString().substring(0,10)}class re{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,o.isIndexedDBAvailable)()&&(0,o.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),s=await t.objectStore(Z).get(ne(e));return await t.done,s}catch(e){if(e instanceof o.FirebaseError)u.warn(e.message);else{const t=G.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});u.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}}}function ie(e){return(0,o.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:e})).length}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ce;ce="",$(new n.Component("platform-logger",e=>new i(e),"PRIVATE")),$(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 o{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new 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 o=this.instances.get(n);return o&&e(o,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=o;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 o(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/component",file:"node_modules/@firebase/component/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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 W(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=S(e,t),a={method:"DELETE",headers:n},o=await A(()=>fetch(s,a));if(!o.ok)throw await y("Delete Installation",o)}(t,s),await U(t)}}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.getId=Q,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=Y,s.onIdChange=function(e,t){const{appConfig:s}=e;return function(e,t){P();const s=T(e);let n=j.get(s);n||(n=new Set,j.set(s,n));n.add(t)}(s,t),()=>{!function(e,t){const s=T(e),n=j.get(s);if(!n)return;n.delete(t),0===n.size&&j.delete(s);M()}(s,t)}};var n=e("@firebase/app"),a=e("@firebase/component"),o=e("@firebase/util"),r=e("idb");const i="@firebase/installations",c="0.6.12",l=1e4,u=`w:${c}`,d="FIS_v2",m="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 o.ErrorFactory("installations","Installations",f);function k(e){return e instanceof o.FirebaseError&&e.code.includes("request-failed")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function b({projectId:e}){return`${m}/projects/${e}/installations`}function g(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function y(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 w({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function S(e,{refreshToken:t}){const s=w(e);return s.append("Authorization",function(e){return`${d} ${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 A(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 v(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 x=/^[cdef][\w-]{21}$/,_="";function C(){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 x.test(t)?t:_}catch(e){return _}}function T(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 j=new Map;function E(e,t){const s=T(e);I(s,t),function(e,t){const s=P();s&&s.postMessage({key:e,fid:t});M()}(s,t)}function I(e,t){const s=j.get(e);if(s)for(const e of s)e(t)}let O=null;function P(){return!O&&"BroadcastChannel"in self&&(O=new BroadcastChannel("[Firebase] FID Change"),O.onmessage=e=>{I(e.data.key,e.data.fid)}),O}function M(){0===j.size&&O&&(O.close(),O=null)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const D="firebase-installations-database",N=1,R="firebase-installations-store";let B=null;function L(){return B||(B=(0,r.openDB)(D,N,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(R)}})),B}async function F(e,t){const s=T(e),n=(await L()).transaction(R,"readwrite"),a=n.objectStore(R),o=await a.get(s);return await a.put(t,s),await n.done,o&&o.fid===t.fid||E(e,t.fid),t}async function U(e){const t=T(e),s=(await L()).transaction(R,"readwrite");await s.objectStore(R).delete(t),await s.done}async function W(e,t){const s=T(e),n=(await L()).transaction(R,"readwrite"),a=n.objectStore(R),o=await a.get(s),r=t(o);return r===undefined?await a.delete(s):await a.put(r,s),await n.done,!r||o&&o.fid===r.fid||E(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 H(e){let t;const s=await W(e.appConfig,s=>{const n=function(e){const t=e||{fid:C(),registrationStatus:0};return K(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=w(e),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const r={fid:s,authVersion:d,appId:e.appId,sdkVersion:u},i={method:"POST",headers:a,body:JSON.stringify(r)},c=await A(()=>fetch(n,i));if(c.ok){const e=await c.json();return{fid:e.fid||s,registrationStatus:2,refreshToken:e.refreshToken,authToken:g(e.authToken)}}throw await y("Create Installation",c)}(e,t);return F(e.appConfig,s)}catch(s){throw k(s)&&409===s.customData.serverCode?await U(e.appConfig):await F(e.appConfig,{fid:t.fid,registrationStatus:0}),s}}(e,s);return{installationEntry:s,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:$(e)}:{installationEntry:t}}(e,n);return t=a.registrationPromise,a.installationEntry});return s.fid===_?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function $(e){let t=await q(e.appConfig);for(;1===t.registrationStatus;)await v(100),t=await q(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:s}=await H(e);return s||t}return t}function q(e){return W(e,e=>{if(!e)throw p.create("installation-not-found");return K(e)})}function K(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=S(e,s),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const r={installation:{sdkVersion:u,appId:e.appId}},i={method:"POST",headers:a,body:JSON.stringify(r)},c=await A(()=>fetch(n,i));if(c.ok){return g(await c.json())}throw await y("Generate Auth Token",c)}async function G(e,t=!1){let s;const n=await W(e.appConfig,n=>{if(!J(n))throw p.create("not-registered");const a=n.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+h}(e)}(a))return n;if(1===a.requestStatus)return s=async function(e,t){let s=await z(e.appConfig);for(;1===s.authToken.requestStatus;)await v(100),s=await z(e.appConfig);const n=s.authToken;return 0===n.requestStatus?G(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 F(e.appConfig,n),s}catch(s){if(!k(s)||401!==s.customData.serverCode&&404!==s.customData.serverCode){const s=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await F(e.appConfig,s)}else await U(e.appConfig);throw s}}(e,t),t}});return s?await s:n.authToken}function z(e){return W(e,e=>{if(!J(e))throw p.create("not-registered");const t=e.authToken;return 1===(s=t).requestStatus&&s.requestTime+l<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var s;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */})}function J(e){return e!==undefined&&2===e.registrationStatus}async function Q(e){const t=e,{installationEntry:s,registrationPromise:n}=await H(t);return n?n.catch(console.error):G(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 Y(e,t=!1){const s=e;await async function(e){const{registrationPromise:t}=await H(e);t&&await t}(s);return(await G(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:()=>Q(s),getToken:e=>Y(s,e)}};(0,n._registerComponent)(new a.Component(Z,ee,"PUBLIC")),(0,n._registerComponent)(new a.Component("installations-internal",te,"PRIVATE")),(0,n.registerVersion)(i,c),(0,n.registerVersion)(i,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0});
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const n=[];var a;s.LogLevel=void 0,(a=s.LogLevel||(s.LogLevel={}))[a.DEBUG=0]="DEBUG",a[a.VERBOSE=1]="VERBOSE",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.SILENT=5]="SILENT";const o={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,i={[s.LogLevel.DEBUG]:"log",[s.LogLevel.VERBOSE]:"log",[s.LogLevel.INFO]:"info",[s.LogLevel.WARN]:"warn",[s.LogLevel.ERROR]:"error"},c=(e,t,...s)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),a=i[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${n}]  ${e.name}:`,...s)};s.Logger=class{constructor(e){this.name=e,this._logLevel=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?o[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,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=o[t.level]),a.userLogHandler=null===e?null:(t,a,...o)=>{const r=o.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");a>=(null!=n?n:t.logLevel)&&e({level:s.LogLevel[a].toLowerCase(),message:r,args:o,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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 E.create("only-available-in-window");e.swRegistration||await U(e);return async function(e){const t=await _(e.firebaseDependencies);t&&(await I(e.firebaseDependencies,t.token),await async function(e){const t=T(e),s=(await x()).transaction(A,"readwrite");await s.objectStore(A).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,o.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 z().then(e=>{if(!e)throw E.create("unsupported-browser")},e=>{throw E.create("indexed-db-unsupported")}),(0,r._getProvider)((0,o.getModularInstance)(e),"messaging").getImmediate()},s.getToken=async function(e,t){return W(e=(0,o.getModularInstance)(e),t)},s.isSupported=z,s.onMessage=function(e,t){return function(e,t){if(!navigator)throw E.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,o.getModularInstance)(e),t)},e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),o=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 i="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",l="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",u="https://fcmregistrations.googleapis.com/v1",d="google.c.a.c_id",m=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 k(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",g=5,y="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 w="firebase-messaging-database",S=1,A="firebase-messaging-store";let v=null;function x(){return v||(v=(0,a.openDB)(w,S,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(A)}})),v}async function _(e){const t=T(e),s=await x(),n=await s.transaction(A).objectStore(A).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,g,{upgrade:async(s,n,a,o)=>{var r;if(n<2)return;if(!s.objectStoreNames.contains(y))return;const i=o.objectStore(y),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(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 C(e,t),t}}async function C(e,t){const s=T(e),n=(await x()).transaction(A,"readwrite");return await n.objectStore(A).put(t,s),await n.done,t}function T({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 j={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},E=new o.ErrorFactory("messaging","Messaging",j);async function I(e,t){const s={method:"DELETE",headers:await P(e)};try{const n=await fetch(`${O(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 O({projectId:e}){return`${u}/projects/${e}/registrations`}async function P({appConfig:e,installations:t}){const s=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${s}`})}function M({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==l&&(a.web.applicationPubKey=n),a}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const D=6048e5;async function N(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:k(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:p(t.getKey("auth")),p256dh:p(t.getKey("p256dh"))},n=await _(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,o=t.p256dh===e.p256dh;return s&&n&&a&&o}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+D?async function(e,t){try{const s=await async function(e,t){const s=await P(e),n=M(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let o;try{const s=await fetch(`${O(e.appConfig)}/${t.token}`,a);o=await s.json()}catch(e){throw E.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw E.create("token-update-failed",{errorInfo:e})}if(!o.token)throw E.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await C(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await I(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return R(e.firebaseDependencies,s)}return R(e.firebaseDependencies,s)}async function R(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 P(e),n=M(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let o;try{const t=await fetch(O(e.appConfig),a);o=await t.json()}catch(e){throw E.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw E.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw E.create("token-subscribe-no-token");return o.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await C(e,n),n.token}function B(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const 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 o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var s,n,a,o,r;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const i=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);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 L(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.
 */
/**
 * @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 F{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 L("App Configuration Object");if(!e.name)throw L("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw L(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 U(e){try{e.swRegistration=await navigator.serviceWorker.register(i,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,s)=>{const n=setTimeout(()=>s(new Error(`Service worker not registered after ${m} ms`)),m),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 E.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 W(e,t){if(!navigator)throw E.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw E.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 U(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw E.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),N(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 H(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[d],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 $(e,t){const s=t.data;if(!s.isFirebaseMessaging)return;e.onMessageHandler&&s.messageType===f.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(B(s)):e.onMessageHandler.next(B(s)));const n=s.data;var a;"object"==typeof(a=n)&&a&&d in a&&"1"===n["google.c.a.e"]&&await H(e,s.messageType,n)}const q="@firebase/messaging",K="0.12.16",V=e=>{const t=new F(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>$(t,e)),t},G=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>W(t,e)}};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function z(){try{await(0,o.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,o.isIndexedDBAvailable)()&&(0,o.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,r._registerComponent)(new n.Component("messaging",V,"PUBLIC")),(0,r._registerComponent)(new n.Component("messaging-internal",G,"PRIVATE")),(0,r.registerVersion)(q,K),(0,r.registerVersion)(q,K,"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"),o=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 i="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var l,u;
/**
 * @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 d(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function m(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),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"}(u||(u={}));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 k=null;function b(){return k||(k=a.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(p)}})),k}async function g(e){const t=w(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,o)=>{var r;if(n<2)return;if(!s.objectStoreNames.contains(f))return;const i=o.objectStore(f),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(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:d(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(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 y(e,t),t}}async function y(e,t){const s=w(e),n=(await b()).transaction(p,"readwrite");return await n.objectStore(p).put(t,s),await n.done,t}function w({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 S={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},A=new o.ErrorFactory("messaging","Messaging",S);async function v(e,t){const s={method:"DELETE",headers:await _(e)};try{const n=await fetch(`${x(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw A.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw A.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function x({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function _({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 C({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==i&&(a.web.applicationPubKey=n),a}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function T(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:m(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:d(t.getKey("auth")),p256dh:d(t.getKey("p256dh"))},n=await g(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,o=t.p256dh===e.p256dh;return s&&n&&a&&o}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+6048e5?async function(e,t){try{const s=await async function(e,t){const s=await _(e),n=C(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let o;try{const s=await fetch(`${x(e.appConfig)}/${t.token}`,a);o=await s.json()}catch(e){throw A.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw A.create("token-update-failed",{errorInfo:e})}if(!o.token)throw A.create("token-update-no-token");return o.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 v(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return E(e.firebaseDependencies,s)}return E(e.firebaseDependencies,s)}async function j(e){const t=await g(e.firebaseDependencies);t&&(await v(e.firebaseDependencies,t.token),await async function(e){const t=w(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 E(e,t){const s=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const s=await _(e),n=C(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let o;try{const t=await fetch(x(e.appConfig),a);o=await t.json()}catch(e){throw A.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw A.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw A.create("token-subscribe-no-token");return o.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await y(e,n),n.token}async function I(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 O(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 I(t,s);const n=await M();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(n))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=u.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 o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var s,n,a,o,r;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const i=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);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 P(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 o=e.data,"object"==typeof o&&o&&"google.c.a.c_id"in o?self.location.origin:null;var o;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(n);if(!a)return;const o=new URL(a,self.location.href),r=new URL(self.location.origin);if(o.host!==r.host)return;let i=await async function(e){const t=await M();for(const s of t){const t=new URL(s.url,self.location.href);if(e.host===t.host)return s}return null}(o);var l;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */return i?i=await i.focus():(i=await self.clients.openWindow(a),await(l=3e3,new Promise(e=>{setTimeout(e,l)}))),i?(n.messageType=u.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,i.postMessage(n)):void 0}function M(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function D(e){return A.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!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 N{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw D("App Configuration Object");if(!e.name)throw D("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw D(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:s}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R=e=>{const t=new N(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(O(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var s,n;const{newSubscription:a}=e;if(!a)return void await j(t);const o=await g(t.firebaseDependencies);await j(t),t.vapidKey=null!==(n=null===(s=null==o?void 0:o.subscriptionOptions)||void 0===s?void 0:s.vapidKey)&&void 0!==n?n:i,await T(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(P(e))}),t};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function B(){return o.isIndexedDBAvailable()&&await o.validateIndexedDBOpenable()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */r._registerComponent(new n.Component("messaging-sw",R,"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=o.getModularInstance(e),t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.getMessaging=function(e=r.getApp()){return B().then(e=>{if(!e)throw A.create("unsupported-browser")},e=>{throw A.create("indexed-db-unsupported")}),r._getProvider(o.getModularInstance(e),"messaging-sw").getImmediate()},s.isSupported=B,s.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw A.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=o.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",{_process:"/home/runner/work/metamask-extension/metamask-extension/node_modules/process/browser.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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=E,s=I){const n=t*Math.pow(s,e),a=Math.round(P*n*(Math.random()-.5)*2);return Math.min(O,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 o=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(o)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.createSubscribe=function(e,t){const s=new C(e,t);return s.subscribe.bind(s)},s.decode=void 0,s.deepCopy=function(e){return d(undefined,e)},s.deepEqual=function e(t,s){if(t===s)return!0;const n=Object.keys(t),a=Object.keys(s);for(const o of n){if(!a.includes(o))return!1;const n=t[o],r=s[o];if(_(n)&&_(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=d,s.errorPrefix=j,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||y()},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=g,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!g()&&!!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=y,s.issuedAtTime=void 0,s.jsonEval=v,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 k;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(j(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(j(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(j(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 o=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],o=t+1<e.length,r=o?e[t+1]:0,i=t+2<e.length,c=i?e[t+2]:0,l=a>>2,u=(3&a)<<4|r>>4;let d=(15&r)<<2|c>>6,m=63&c;i||(m=64,o||(d=64)),n.push(s[l],s[u],s[d],s[m])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(o(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let 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 o=e[s++];t[n++]=String.fromCharCode((31&a)<<6|63&o)}else if(a>239&&a<365){const o=((7&a)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536;t[n++]=String.fromCharCode(55296+(o>>10)),t[n++]=String.fromCharCode(56320+(1023&o))}else{const o=e[s++],r=e[s++];t[n++]=String.fromCharCode((15&a)<<12|(63&o)<<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++)],o=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==o||null==r||null==c)throw new i;const l=a<<2|o>>4;if(n.push(l),64!==r){const e=o<<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 i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}s.DecodeBase64StringError=i;const c=function(e){const t=o(e);return r.encodeByteArray(t,!0)};s.base64Encode=c;const l=function(e){return c(e).replace(/\./g,"")};s.base64urlEncodeWithoutPadding=l;const u=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 d(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)&&m(s)&&(e[s]=d(e[s],t[s]));return e}function m(e){return"__proto__"!==e}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function h(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.base64Decode=u;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&&u(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 k{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 g(){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 y(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}s.Deferred=k;class w extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,w.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,S.prototype.create)}}s.FirebaseError=w;class S{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],o=a?function(e,t){return e.replace(A,(e,s)=>{const n=t[s];return null!=n?String(n):`<${s}?>`})}(a,s):"Error",r=`${this.serviceName}: ${o} (${n}).`;return new w(n,r,s)}}s.ErrorFactory=S;const A=/\{\$([^}]+)}/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 v(e){return JSON.parse(e)}const x=function(e){let t={},s={},n={},a="";try{const o=e.split(".");t=v(u(o[0])||""),s=v(u(o[1])||""),a=o[2],n=s.d||{},delete s.d}catch(e){}return{header:t,claims:s,data:n,signature:a}};s.decode=x;s.isValidTimestamp=function(e){const t=x(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=x(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};s.isValidFormat=function(e){const t=x(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function _(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=x(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,o=this.chain_[0],r=this.chain_[1],i=this.chain_[2],c=this.chain_[3],l=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=c^r&(i^c),a=1518500249):(n=r^i^c,a=1859775393):e<60?(n=r&i|c&(r|i),a=2400959708):(n=r^i^c,a=3395469782);const t=(o<<5|o>>>27)+n+l+a+s[e]&4294967295;l=c,c=i,i=4294967295&(r<<30|r>>>2),r=o,o=t}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+r&4294967295,this.chain_[2]=this.chain_[2]+i&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const s=t-this.blockSize;let n=0;const a=this.buf_;let o=this.inbuf_;for(;n<t;){if(0===o)for(;n<=s;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(a[o]=e.charCodeAt(n),++o,++n,o===this.blockSize){this.compress_(a),o=0;break}}else for(;n<t;)if(a[o]=e[n],++o,++n,o===this.blockSize){this.compress_(a),o=0;break}}this.inbuf_=o,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let 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 C{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=T),n.error===undefined&&(n.error=T),n.complete===undefined&&(n.complete=T);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 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.
 */function j(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 o=e.charCodeAt(a);if(o>=55296&&o<=56319){const t=o-55296;a++,n(a<e.length,"Surrogate pair missing trail surrogate.");o=65536+(t<<10)+(e.charCodeAt(a)-56320)}o<128?t[s++]=o:o<2048?(t[s++]=o>>6|192,t[s++]=63&o|128):o<65536?(t[s++]=o>>12|224,t[s++]=o>>6&63|128,t[s++]=63&o|128):(t[s++]=o>>18|240,t[s++]=o>>12&63|128,t[s++]=o>>6&63|128,t[s++]=63&o|128)}return t};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
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 E=1e3,I=2,O=s.MAX_VALUE_MILLIS=144e5,P=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 o(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 o extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}s.EvalError=o}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver>@json-schema-spec/json-pointer",file:"node_modules/@json-schema-spec/json-pointer/lib/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js",{"@json-schema-tools/reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js","@json-schema-tools/traverse":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js","fast-safe-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-safe-stringify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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,i)}c((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var i=r(e("@json-schema-tools/traverse")),c=r(e("@json-schema-tools/reference-resolver")),l=r(e("fast-safe-stringify")),u=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=u;var d=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},m=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,o=Object.keys(this.options.protocolHandlerMap);a<o.length;a++){var r=o[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 o(this,function(e){switch(e.label){case 0:return[4,this._resolve()];case 1:return e.sent(),delete this.schema.definitions,delete this.schema.components,[2,this.schema]}})})},e.prototype._resolve=function(){return a(this,void 0,void 0,function(){var t,s,a,r,l,u,m,h,f,p,k,b=this;return o(this,function(o){switch(o.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return b.refCache[e]===undefined}),s=[],a=0,r=t,o.label=1;case 1:return a<r.length?(l=r[a],u=void 0,this.refCache[l]===undefined?[3,2]:(u=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 u=this.options.rootSchema,[3,5];case 3:return m=c.default.resolve(l,this.options.rootSchema),s.push(m),[4,m];case 4:u=o.sent(),o.label=5;case 5:return!0!==this.options.recursive||!0===u||!1===u||"#"===l?[3,9]:(h=n(n({},this.options),{refCache:this.refCache}),0===(f=new e(u,h)).refs.length?[3,7]:(p=f._resolve(),s.push(p),[4,p]));case 6:return k=o.sent(),this.refCache[l]=d(u,k),[3,8];case 7:this.refCache[l]=u,o.label=8;case 8:return[3,10];case 9:this.refCache[l]=u,o.label=10;case 10:return a++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=d(this.schema,this.refCache[this.schema.$ref]):(0,i.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=b.refCache[e.$ref];return d(e,t)}return e},{mutable:!0}),[4,Promise.all(s)];case 12:return o.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,i.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new u(t);e.push(t.$ref)}return t}),e},e}();s.default=m}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/index.js",{"./dereferencer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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")),o=e("./dereferencer");Object.defineProperty(s,"NonStringRefError",{enumerable:!0,get:function(){return o.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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var r=e("./errors"),i=o(e("isomorphic-fetch")),c=function(e){return n(void 0,void 0,void 0,function(){var t,s;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,(0,i.default)(e)];case 1:return t=n.sent(),[3,3];case 2:throw n.sent(),new 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 o=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};s.InvalidRemoteURLError=o;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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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,i)}c((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var i=r(e("./default-protocol-handler-map")),c=r(e("./reference-resolver")),l=n(n({},i.default),{file:function(){return a(void 0,void 0,void 0,function(){return o(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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var r=e("./errors"),i=o(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,o,c,l,u,d,m,h,f;return void 0===t&&(t={}),a(this,function(a){switch(a.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,i.default)(e,t))];(s=e.split("#")).length>1&&(n=s[s.length-1]),o=s[0],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(o,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,i.default)(n,f)),[2,f];if(!1===e.includes("://"))throw new r.InvalidFileSystemPathError(e);u=0,d=Object.keys(this.protocolHandlerMap),a.label=5;case 5:return u<d.length?(m=d[u],o.startsWith(m)?[4,this.protocolHandlerMap[m](o,t)]:[3,7]):[3,8];case 6:if((h=a.sent())!==undefined)return f=h,n&&(f=(0,i.default)(n,f)),[2,f];a.label=7;case 7:return u++,[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")),o=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=o,s.default=function(e,t){try{var s=e.replace("#","");return a.default.parse(s).shmeval(t)}catch(t){throw new o(e,t.message)}}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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,o=t.length;a<o;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 o=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},i=function(e,t){return void 0===t&&(t=1),e[e.length-t]};s.default=function e(t,c,l,u,d,m,h,f,p){void 0===l&&(l=s.defaultOptions),void 0===u&&(u=0),void 0===d&&(d=[]),void 0===m&&(m=[]),void 0===h&&(h=[]),void 0===f&&(f=[]),void 0===p&&(p=[]);var k=n(n({},s.defaultOptions),l);if(0===u&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===k.skipFirstMutation&&0===u?t:c(t,!1,o(h),i(m));var b=t;!1===k.mutable&&(b=n({},t)),m.push(b),!0===k.bfs&&(!1!==k.skipFirstMutation&&0===u||(b=c(b,!1,o(h),i(m,2)))),d.push(t),f.push([t,b]);var g=function(t,s){var n=r(t,d);return n?(p.push(n),!0===k.skipFirstMutation&&n===d[0]?c(t,!0,o(s),i(m)):f.find(function(e){var t=e[0];return n===t})[1]):e(t,c,l,u+1,d,m,s,f,p)};if(t.anyOf)b.anyOf=t.anyOf.map(function(e,t){return g(e,a(a([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)b.allOf=t.allOf.map(function(e,t){return g(e,a(a([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)b.oneOf=t.oneOf.map(function(e,t){return g(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 g(e,a(a([],h,!0),["items[".concat(t,"]")],!1))});else{var y=r(t.items,d);if(y)if(p.push(y),!0===k.skipFirstMutation&&y===d[0])b.items=c(t.items,!0,o(h),i(m));else{var w=f.find(function(e){var t=e[0];return y===t})[1];b.items=w}else b.items=e(t.items,c,l,u+1,d,m,a(a([],h,!0),["items"],!1),f,p)}if(t.additionalItems!==undefined&&(b.additionalItems=g(t.additionalItems,a(a([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var S=t.properties,A={};Object.keys(t.properties).forEach(function(e){A[e]=g(S[e],a(a([],h,!0),["properties",e.toString()],!1))}),b.properties=A}if(t.patternProperties!==undefined){var v=t.patternProperties,x={};Object.keys(t.patternProperties).forEach(function(e){x[e]=g(v[e],a(a([],h,!0),["patternProperties",e.toString()],!1))}),b.patternProperties=x}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(b.additionalProperties=g(t.additionalProperties,a(a([],h,!0),["additionalProperties"],!1)))}if(!0===k.skipFirstMutation&&0===u)return b;if(!0===k.bfs)return m.pop(),b;var _=-1!==p.indexOf(t);return m.pop(),c(b,_,o(h),i(m))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/AccountsController.cjs",{"./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/eth-snap-keyring":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/keyring-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,o,r,i,c,l,u,d,m,h,f,p,k,b,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.AccountsController=s.EMPTY_ACCOUNT=void 0;const y=e("@metamask/base-controller"),w=e("@metamask/eth-snap-keyring"),S=e("@metamask/keyring-api"),A=e("@metamask/keyring-controller"),v=e("@metamask/keyring-utils"),x=e("@metamask/utils"),_=e("lodash"),C=e("./utils.cjs"),T="AccountsController",j={internalAccounts:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},E={internalAccounts:{accounts:{},selectedAccount:""}};s.EMPTY_ACCOUNT={id:"",address:"",options:{},methods:[],type:S.EthAccountType.Eoa,scopes:[S.EthScope.Eoa],metadata:{name:"",keyring:{type:""},importTime:0}};class I extends y.BaseController{constructor({messenger:e,state:t}){super({messenger:e,name:T,metadata:j,state:{...E,...t}}),n.add(this),g(this,n,"m",k).call(this),g(this,n,"m",b).call(this)}getAccount(e){return this.state.internalAccounts.accounts[e]}getAccounts(e){return e.map(e=>this.getAccount(e))}listAccounts(){return Object.values(this.state.internalAccounts.accounts).filter(e=>(0,S.isEvmAccountType)(e.type))}listMultichainAccounts(e){const t=Object.values(this.state.internalAccounts.accounts);if(!e)return t;if(!(0,x.isCaipChainId)(e))throw new Error(`Invalid CAIP-2 chain ID: ${String(e)}`);return t.filter(t=>(0,v.isScopeEqualToAny)(e,t.scopes))}getAccountExpect(e){const t=this.getAccount(e);if(t===undefined)throw new Error(`Account Id "${e}" not found`);return t}getSelectedAccount(){const{internalAccounts:{selectedAccount:e}}=this.state;if(""===e)return s.EMPTY_ACCOUNT;const t=this.getAccountExpect(e);if((0,S.isEvmAccountType)(t.type))return t;const a=this.listAccounts();if(!a.length)throw new Error("No EVM accounts");return g(this,n,"m",m).call(this,a)}getSelectedMultichainAccount(e){const{internalAccounts:{selectedAccount:t}}=this.state;if(""===t)return s.EMPTY_ACCOUNT;if(!e)return this.getAccountExpect(t);const a=this.listMultichainAccounts(e);return g(this,n,"m",m).call(this,a)}getAccountByAddress(e){return this.listMultichainAccounts().find(t=>t.address.toLowerCase()===e.toLowerCase())}setSelectedAccount(e){const t=this.getAccountExpect(e);this.state.internalAccounts.selectedAccount!==t.id&&g(this,n,"m",l).call(this,e=>{const{internalAccounts:s}=e;s.accounts[t.id].metadata.lastSelected=Date.now(),s.selectedAccount=t.id})}setAccountName(e,t){this.updateAccountMetadata(e,{name:t,nameLastUpdatedAt:Date.now()})}setAccountNameAndSelectAccount(e,t){const s=this.getAccountExpect(e);g(this,n,"m",a).call(this,s,t);const o={...s,metadata:{...s.metadata,name:t,nameLastUpdatedAt:Date.now(),lastSelected:g(this,n,"m",h).call(this)}};g(this,n,"m",l).call(this,e=>{e.internalAccounts.accounts[s.id]=o,e.internalAccounts.selectedAccount=s.id}),this.messenger.publish("AccountsController:accountRenamed",o)}updateAccountMetadata(e,t){const s=this.getAccountExpect(e);t.name&&g(this,n,"m",a).call(this,s,t.name);const o={...s,metadata:{...s.metadata,...t}};g(this,n,"m",l).call(this,t=>{t.internalAccounts.accounts[e]=o}),t.name&&this.messenger.publish("AccountsController:accountRenamed",o)}async updateAccounts(){const e=new Map,t=this.state.internalAccounts.accounts,s={},{keyrings:a}=this.messenger.call("KeyringController:getState");for(const o of a){const a=(0,C.keyringTypeToName)(o.type);for(const r of o.accounts){const i=g(this,n,"m",f).call(this,r,o);if(!i)continue;const c=e.get(a)??1,l=t[i.id];s[i.id]={...i,metadata:{...i.metadata,name:l?.metadata.name??`${a} ${c}`,importTime:l?.metadata.importTime??Date.now(),lastSelected:l?.metadata.lastSelected??0}},e.set(a,c+1)}}g(this,n,"m",l).call(this,e=>{e.internalAccounts.accounts=s})}loadBackup(e){e.internalAccounts&&this.update(t=>{t.internalAccounts=e.internalAccounts})}getNextAvailableAccountName(e=A.KeyringTypes.hd,t){const s=(0,C.keyringTypeToName)(e),a=g(this,n,"m",d).call(this,e,t),o=a.reduce((e,t)=>{const n=new RegExp(`${s} ([0-9]+)$`,"u").exec(t.metadata.name);if(n){const t=parseInt(n[1],10);return Math.max(e,t)}return e},0),r=Math.max(a.length+1,o+1);return`${s} ${r}`}}s.AccountsController=I,n=new WeakSet,a=function(e,t){if(this.listMultichainAccounts().find(s=>s.metadata.name===t&&s.id!==e.id))throw new Error("Account name already exists")},o=function(e,t){const s=(0,C.getUUIDFromAddressOfNormalAccount)(e),n=this.getAccount(s),a={name:n?.metadata.name??"",...n?.metadata.nameLastUpdatedAt?{nameLastUpdatedAt:n?.metadata.nameLastUpdatedAt}:{},importTime:n?.metadata.importTime??Date.now(),lastSelected:n?.metadata.lastSelected??0,keyring:{type:t.type}};let o={};if((0,C.isHdKeyringType)(t.type)){const s=(0,C.getEvmGroupIndexFromAddressIndex)(t,e);if(s!==undefined){const e=(0,C.getEvmDerivationPathForIndex)(s);o={...{entropySource:t.metadata.id,derivationPath:e,groupIndex:s},...{entropy:{type:S.KeyringAccountEntropyTypeOption.Mnemonic,id:t.metadata.id,derivationPath:e,groupIndex:s}}}}}return{id:s,address:e,options:o,methods:[S.EthMethod.PersonalSign,S.EthMethod.Sign,S.EthMethod.SignTransaction,S.EthMethod.SignTypedDataV1,S.EthMethod.SignTypedDataV3,S.EthMethod.SignTypedDataV4],scopes:[S.EthScope.Eoa],type:S.EthAccountType.Eoa,metadata:a}},r=function(){const[e]=this.messenger.call("KeyringController:getKeyringsByType",w.SnapKeyring.type);return e},i=function(e,...t){this.messenger.publish(e,...t)},c=function({isUnlocked:e,keyrings:t}){if(!e||0===t.length)return;const s={snap:{previous:{},added:[],updated:[],removed:[]},normal:{previous:{},added:[],updated:[],removed:[]}},a=e=>(0,C.isSnapKeyringType)(e)?s.snap:s.normal;for(const e of this.listMultichainAccounts()){const t=e.address.toLowerCase();a(e.metadata.keyring.type).previous[t]=e}const o=new Set;for(const e of t){const t=a(e.type);for(const s of e.accounts){const n=s.toLowerCase(),a=t.previous[n];a?t.updated.push(a):t.added.push({address:n,keyring:e}),o.add(n)}}for(const e of[s.snap,s.normal])for(const[t,s]of Object.entries(e.previous))o.has(t)||e.removed.push(s);const r={removed:[],added:[]};g(this,n,"m",l).call(this,e=>{const{internalAccounts:t}=e;for(const e of[s.snap,s.normal]){for(const s of e.removed)delete t.accounts[s.id],r.removed.push(s.id);for(const s of e.added){const e=g(this,n,"m",f).call(this,s.address,s.keyring);if(e){const s=Object.values(t.accounts),a=this.getNextAvailableAccountName(e.metadata.keyring.type,s),o=0===s.length?g(this,n,"m",h).call(this):0;t.accounts[e.id]={...e,metadata:{...e.metadata,name:a,importTime:Date.now(),lastSelected:o}},r.added.push(t.accounts[e.id])}}}},()=>{for(const e of r.removed)this.messenger.publish("AccountsController:accountRemoved",e);for(const e of r.added)this.messenger.publish("AccountsController:accountAdded",e)})},l=function(e,t){const s=this.state.internalAccounts.selectedAccount;this.update(t=>{e(t);const{internalAccounts:a}=t;if(!a.accounts[s]){const e=Object.values(a.accounts),t=g(this,n,"m",m).call(this,e);t?(a.selectedAccount=t.id,a.accounts[t.id].metadata.lastSelected=g(this,n,"m",h).call(this)):a.selectedAccount=""}}),t?.();const{selectedAccount:a}=this.state.internalAccounts;if(a&&a!==s){const e=this.getSelectedMultichainAccount();e&&((0,S.isEvmAccountType)(e.type)&&this.messenger.publish("AccountsController:selectedEvmAccountChange",e),this.messenger.publish("AccountsController:selectedAccountChange",e))}},u=function(e){const{snaps:t}=e,s=[];for(const e of this.listMultichainAccounts())if(e.metadata.snap){const n=t[e.metadata.snap.id];if(n){const t=n.enabled&&!n.blocked;e.metadata.snap.enabled!==t&&s.push({id:e.id,enabled:t})}else s.push({id:e.id,enabled:!1})}s.length>0&&this.update(e=>{for(const{id:t,enabled:n}of s){const s=e.internalAccounts.accounts[t];s.metadata.snap&&(s.metadata.snap.enabled=n)}})},d=function(e,t){return(t??this.listMultichainAccounts()).filter(t=>(0,C.isHdKeyringType)(e)||(0,C.isSimpleKeyringType)(e)?(0,C.isHdKeyringType)(t.metadata.keyring.type)||(0,C.isSimpleKeyringType)(t.metadata.keyring.type):t.metadata.keyring.type===e)},m=function(e){const[t]=e.sort((e,t)=>(t.metadata.lastSelected??0)-(e.metadata.lastSelected??0));return t},h=function(){return Date.now()},f=function(e,t){if((0,C.isSnapKeyringType)(t.type)){const t=g(this,n,"m",r).call(this);if(!t)return undefined;let s=t.getAccountByAddress(e);if(s&&(s=(0,_.cloneDeep)(s),(0,C.isHdSnapKeyringAccount)(s))){const e={...s.options,entropy:{type:S.KeyringAccountEntropyTypeOption.Mnemonic,id:s.options.entropySource,groupIndex:s.options.index,derivationPath:s.options.derivationPath}};s.options=e}return s}return g(this,n,"m",o).call(this,e,t)},p=function(e){let t;if((0,x.isCaipChainId)(e)){const s=this.getSelectedMultichainAccount(e);t=s.id}else{const e=this.getSelectedAccount();t=e.id}this.state.internalAccounts.selectedAccount!==t&&this.update(e=>{e.internalAccounts.accounts[t].metadata.lastSelected=Date.now(),e.internalAccounts.selectedAccount=t})},k=function(){this.messenger.subscribe("SnapController:stateChange",e=>g(this,n,"m",u).call(this,e)),this.messenger.subscribe("KeyringController:stateChange",e=>g(this,n,"m",c).call(this,e)),this.messenger.subscribe("SnapKeyring:accountAssetListUpdated",e=>g(this,n,"m",i).call(this,"AccountsController:accountAssetListUpdated",e)),this.messenger.subscribe("SnapKeyring:accountBalancesUpdated",e=>g(this,n,"m",i).call(this,"AccountsController:accountBalancesUpdated",e)),this.messenger.subscribe("SnapKeyring:accountTransactionsUpdated",e=>g(this,n,"m",i).call(this,"AccountsController:accountTransactionsUpdated",e)),this.messenger.subscribe("MultichainNetworkController:networkDidChange",e=>g(this,n,"m",p).call(this,e))},b=function(){this.messenger.registerActionHandler(`${T}:setSelectedAccount`,this.setSelectedAccount.bind(this)),this.messenger.registerActionHandler(`${T}:listAccounts`,this.listAccounts.bind(this)),this.messenger.registerActionHandler(`${T}:listMultichainAccounts`,this.listMultichainAccounts.bind(this)),this.messenger.registerActionHandler(`${T}:setAccountName`,this.setAccountName.bind(this)),this.messenger.registerActionHandler(`${T}:setAccountNameAndSelectAccount`,this.setAccountNameAndSelectAccount.bind(this)),this.messenger.registerActionHandler(`${T}:updateAccounts`,this.updateAccounts.bind(this)),this.messenger.registerActionHandler(`${T}:getSelectedAccount`,this.getSelectedAccount.bind(this)),this.messenger.registerActionHandler(`${T}:getSelectedMultichainAccount`,this.getSelectedMultichainAccount.bind(this)),this.messenger.registerActionHandler(`${T}:getAccountByAddress`,this.getAccountByAddress.bind(this)),this.messenger.registerActionHandler(`${T}:getNextAvailableAccountName`,this.getNextAvailableAccountName.bind(this)),this.messenger.registerActionHandler("AccountsController:getAccount",this.getAccount.bind(this)),this.messenger.registerActionHandler("AccountsController:getAccounts",this.getAccounts.bind(this)),this.messenger.registerActionHandler("AccountsController:updateAccountMetadata",this.updateAccountMetadata.bind(this))}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/AccountsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/index.cjs",{"./AccountsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/AccountsController.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isNormalKeyringType=s.getUUIDFromAddressOfNormalAccount=s.getUUIDOptionsFromAddressOfNormalAccount=s.keyringTypeToName=s.AccountsController=s.EMPTY_ACCOUNT=void 0;var n=e("./AccountsController.cjs");Object.defineProperty(s,"EMPTY_ACCOUNT",{enumerable:!0,get:function(){return n.EMPTY_ACCOUNT}}),Object.defineProperty(s,"AccountsController",{enumerable:!0,get:function(){return n.AccountsController}});var a=e("./utils.cjs");Object.defineProperty(s,"keyringTypeToName",{enumerable:!0,get:function(){return a.keyringTypeToName}}),Object.defineProperty(s,"getUUIDOptionsFromAddressOfNormalAccount",{enumerable:!0,get:function(){return a.getUUIDOptionsFromAddressOfNormalAccount}}),Object.defineProperty(s,"getUUIDFromAddressOfNormalAccount",{enumerable:!0,get:function(){return a.getUUIDFromAddressOfNormalAccount}}),Object.defineProperty(s,"isNormalKeyringType",{enumerable:!0,get:function(){return a.isNormalKeyringType}})}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","ethereum-cryptography/sha256":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isHdSnapKeyringAccount=s.HdSnapKeyringAccountOptionsStruct=s.getEvmGroupIndexFromAddressIndex=s.getEvmDerivationPathForIndex=s.isHdKeyringType=s.isSimpleKeyringType=s.isSnapKeyringType=s.isNormalKeyringType=s.getUUIDFromAddressOfNormalAccount=s.getUUIDOptionsFromAddressOfNormalAccount=s.keyringTypeToName=void 0;const n=e("@metamask/keyring-controller"),a=e("@metamask/superstruct"),o=e("@metamask/utils"),r=e("ethereum-cryptography/sha256"),i=e("uuid");function c(e){return{random:(0,r.sha256)((0,o.hexToBytes)(e)).slice(0,16)}}function l(e){return e===n.KeyringTypes.hd}s.keyringTypeToName=function(e){switch(e){case n.KeyringTypes.simple:case n.KeyringTypes.hd:return"Account";case n.KeyringTypes.trezor:return"Trezor";case n.KeyringTypes.oneKey:return"OneKey";case n.KeyringTypes.ledger:return"Ledger";case n.KeyringTypes.lattice:return"Lattice";case n.KeyringTypes.qr:return"QR";case n.KeyringTypes.snap:return"Snap Account";default:throw new Error(`Unknown keyring ${e}`)}},s.getUUIDOptionsFromAddressOfNormalAccount=c,s.getUUIDFromAddressOfNormalAccount=function(e){return(0,i.v4)(c(e))},s.isNormalKeyringType=function(e){return e!==n.KeyringTypes.snap},s.isSnapKeyringType=function(e){return e===n.KeyringTypes.snap},s.isSimpleKeyringType=function(e){return e===n.KeyringTypes.simple},s.isHdKeyringType=l,s.getEvmDerivationPathForIndex=function(e){return`m/44'/60'/0'/0/${e}`},s.getEvmGroupIndexFromAddressIndex=function(e,t){if(!l(e.type))return undefined;const s=e.accounts.findIndex(e=>e.toLowerCase()===t.toLowerCase());return-1===s?(console.warn(`! Unable to get group index for HD account: "${t}"`),undefined):s},s.HdSnapKeyringAccountOptionsStruct=(0,a.type)({entropySource:(0,a.string)(),index:(0,a.number)(),derivationPath:(0,a.string)()}),s.isHdSnapKeyringAccount=function(e){return(0,a.is)(e.options,s.HdSnapKeyringAccountOptionsStruct)}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function a(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function o(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function r(e,...t){if(!o(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(e.outputLen),n(e.blockLen)}function c(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function l(e,t){r(e);const s=t.outputLen;if(e.length<s)throw new Error(`digestInto() expects output buffer of length at least ${s}`)}Object.defineProperty(s,"__esModule",{value:!0}),s.output=s.exists=s.hash=s.bytes=s.bool=s.number=s.isBytes=void 0,s.number=n,s.bool=a,s.isBytes=o,s.bytes=r,s.hash=i,s.exists=c,s.output=l;const u={number:n,bool:a,bytes:r,hash:i,exists:c,output:l};s.default=u}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js",{"./_assert.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.HashMD=s.Maj=s.Chi=void 0;const n=e("./_assert.js"),a=e("./utils.js");s.Chi=(e,t,s)=>e&t^~e&s;s.Maj=(e,t,s)=>e&t^e&s^t&s;class o extends a.Hash{constructor(e,t,s,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=s,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,a.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:s,blockLen:o}=this,r=(e=(0,a.toBytes)(e)).length;for(let n=0;n<r;){const i=Math.min(o-this.pos,r-n);if(i===o){const t=(0,a.createView)(e);for(;o<=r-n;n+=o)this.process(t,n);continue}s.set(e.subarray(n,n+i),this.pos),this.pos+=i,n+=i,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.exists)(this),(0,n.output)(e,this),this.finished=!0;const{buffer:t,view:s,blockLen:o,isLE:r}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(s,0),i=0);for(let e=i;e<o;e++)t[e]=0;!function(e,t,s,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,s,n);const a=BigInt(32),o=BigInt(4294967295),r=Number(s>>a&o),i=Number(s&o),c=n?4:0,l=n?0:4;e.setUint32(t+c,r,n),e.setUint32(t+l,i,n)}(s,o-8,BigInt(8*this.length),r),this.process(s,0);const c=(0,a.createView)(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)c.setUint32(4*e,d[e],r)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const s=e.slice(0,t);return this.destroy(),s}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:s,length:n,finished:a,destroyed:o,pos:r}=this;return e.length=n,e.pos=r,e.finished=a,e.destroyed=o,n%t&&e.buffer.set(s),e}}s.HashMD=o}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.crypto=void 0,s.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:undefined}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js",{"./_md.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js","./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sha224=s.sha256=void 0;const n=e("./_md.js"),a=e("./utils.js"),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint32Array(64);class c extends n.HashMD{constructor(){super(64,32,8,!1),this.A=0|r[0],this.B=0|r[1],this.C=0|r[2],this.D=0|r[3],this.E=0|r[4],this.F=0|r[5],this.G=0|r[6],this.H=0|r[7]}get(){const{A:e,B:t,C:s,D:n,E:a,F:o,G:r,H:i}=this;return[e,t,s,n,a,o,r,i]}set(e,t,s,n,a,o,r,i){this.A=0|e,this.B=0|t,this.C=0|s,this.D=0|n,this.E=0|a,this.F=0|o,this.G=0|r,this.H=0|i}process(e,t){for(let s=0;s<16;s++,t+=4)i[s]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=i[e-15],s=i[e-2],n=(0,a.rotr)(t,7)^(0,a.rotr)(t,18)^t>>>3,o=(0,a.rotr)(s,17)^(0,a.rotr)(s,19)^s>>>10;i[e]=o+i[e-7]+n+i[e-16]|0}let{A:s,B:r,C:c,D:l,E:u,F:d,G:m,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,a.rotr)(u,6)^(0,a.rotr)(u,11)^(0,a.rotr)(u,25))+(0,n.Chi)(u,d,m)+o[e]+i[e]|0,f=((0,a.rotr)(s,2)^(0,a.rotr)(s,13)^(0,a.rotr)(s,22))+(0,n.Maj)(s,r,c)|0;h=m,m=d,d=u,u=l+t|0,l=c,c=r,r=s,s=t+f|0}s=s+this.A|0,r=r+this.B|0,c=c+this.C|0,l=l+this.D|0,u=u+this.E|0,d=d+this.F|0,m=m+this.G|0,h=h+this.H|0,this.set(s,r,c,l,u,d,m,h)}roundClean(){i.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends c{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}s.sha256=(0,a.wrapConstructor)(()=>new c),s.sha224=(0,a.wrapConstructor)(()=>new l)}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js",{"./_assert.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","@noble/hashes/crypto":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
Object.defineProperty(s,"__esModule",{value:!0}),s.randomBytes=s.wrapXOFConstructorWithOpts=s.wrapConstructorWithOpts=s.wrapConstructor=s.checkOpts=s.Hash=s.concatBytes=s.toBytes=s.utf8ToBytes=s.asyncLoop=s.nextTick=s.hexToBytes=s.bytesToHex=s.byteSwap32=s.byteSwapIfBE=s.byteSwap=s.isLE=s.rotl=s.rotr=s.createView=s.u32=s.u8=s.isBytes=void 0;const n=e("@noble/hashes/crypto"),a=e("./_assert.js");s.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name};s.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);s.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));s.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);s.rotr=(e,t)=>e<<32-t|e>>>t;s.rotl=(e,t)=>e<<t|e>>>32-t>>>0,s.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];s.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,s.byteSwapIfBE=s.isLE?e=>e:e=>(0,s.byteSwap)(e),s.byteSwap32=function(e){for(let t=0;t<e.length;t++)e[t]=(0,s.byteSwap)(e[t])};const o=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));s.bytesToHex=function(e){(0,a.bytes)(e);let t="";for(let s=0;s<e.length;s++)t+=o[e[s]];return t};const r=48,i=57,c=65,l=70,u=97,d=102;function m(e){return e>=r&&e<=i?e-r:e>=c&&e<=l?e-(c-10):e>=u&&e<=d?e-(u-10):void 0}s.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,s=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(s);for(let t=0,a=0;t<s;t++,a+=2){const s=m(e.charCodeAt(a)),o=m(e.charCodeAt(a+1));if(s===undefined||o===undefined){const t=e[a]+e[a+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+a)}n[t]=16*s+o}return n};function h(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function f(e){return"string"==typeof e&&(e=h(e)),(0,a.bytes)(e),e}s.nextTick=async()=>{},s.asyncLoop=async function(e,t,n){let a=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-a;e>=0&&e<t||(await(0,s.nextTick)(),a+=e)}},s.utf8ToBytes=h,s.toBytes=f,s.concatBytes=function(...e){let t=0;for(let s=0;s<e.length;s++){const n=e[s];(0,a.bytes)(n),t+=n.length}const s=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const a=e[t];s.set(a,n),n+=a.length}return s};s.Hash=class{clone(){return this._cloneInto()}};const p={}.toString;s.checkOpts=function(e,t){if(t!==undefined&&"[object Object]"!==p.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},s.wrapConstructor=function(e){const t=t=>e().update(f(t)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t},s.wrapConstructorWithOpts=function(e){const t=(t,s)=>e(s).update(f(t)).digest(),s=e({});return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=t=>e(t),t},s.wrapXOFConstructorWithOpts=function(e){const t=(t,s)=>e(s).update(f(t)).digest(),s=e({});return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=t=>e(t),t},s.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js",{"./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js","@noble/hashes/sha256":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sha256=void 0;const n=e("@noble/hashes/sha256"),a=e("./utils.js");s.sha256=(0,a.wrapHash)(n.sha256)}}},{package:"@metamask/accounts-controller>ethereum-cryptography",file:"node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js",{"@noble/hashes/_assert":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","@noble/hashes/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.crypto=s.utf8ToBytes=s.createView=s.concatBytes=s.toHex=s.bytesToHex=s.assertBytes=s.assertBool=void 0,s.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},s.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,o.hexToBytes)(t)},s.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0},s.wrapHash=function(e){return t=>(a.default.bytes(t),e(t))};const a=n(e("@noble/hashes/_assert")),o=e("@noble/hashes/utils"),r=a.default.bool;s.assertBool=r;const i=a.default.bytes;s.assertBytes=i;var c=e("@noble/hashes/utils");Object.defineProperty(s,"bytesToHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(s,"toHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(s,"concatBytes",{enumerable:!0,get:function(){return c.concatBytes}}),Object.defineProperty(s,"createView",{enumerable:!0,get:function(){return c.createView}}),Object.defineProperty(s,"utf8ToBytes",{enumerable:!0,get:function(){return c.utf8ToBytes}}),s.crypto=(()=>{const e="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:undefined,s=void 0!==t&&"function"==typeof t.require&&t.require.bind(t);return{node:s&&!e?s("crypto"):undefined,web:e}})()}}},{package:"@metamask/accounts-controller>ethereum-cryptography",file:"node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,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.AddressBookController=s.getDefaultAddressBookControllerState=s.controllerName=s.AddressType=void 0;const r=e("@metamask/base-controller"),i=e("@metamask/controller-utils");var c;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(c||(s.AddressType=c={})),s.controllerName="AddressBookController";const l={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};s.getDefaultAddressBookControllerState=()=>({addressBook:{}});class u extends r.BaseController{constructor({messenger:e,state:t}){const r={...(0,s.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:l,name:s.controllerName,state:r}),n.add(this),o(this,n,"m",a).call(this)}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,i.toChecksumHexAddress)(t),!([e,t].every(e=>(0,i.isSafeDynamicKey)(e))&&(0,i.isValidHexAddress)(t)&&this.state.addressBook[e]&&this.state.addressBook[e][t]))return!1;const 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,i.toHex)(1),n="",a){if(e=(0,i.toChecksumHexAddress)(e),!(0,i.isValidHexAddress)(e))return!1;const o={address:e,chainId:s,isEns:!1,memo:n,name:t,addressType:a,lastUpdatedAt:Date.now()},r=(0,i.normalizeEnsName)(t);return r&&(o.name=r,o.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[s]:{...this.state.addressBook[s],[e]:o}}}),"*"!==String(s)&&this.messenger.publish("AddressBookController:contactUpdated",o),!0}}s.AddressBookController=u,n=new WeakSet,a=function(){this.messenger.registerActionHandler(`${s.controllerName}:list`,this.list.bind(this)),this.messenger.registerActionHandler(`${s.controllerName}:set`,this.set.bind(this)),this.messenger.registerActionHandler(`${s.controllerName}:delete`,this.delete.bind(this))},s.default=u}}},{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,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.AnnouncementController=void 0;const r=e("@metamask/base-controller"),i={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={...i,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:r}),n.add(this),o(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/assets-controller/dist/AssetsController.cjs",{"./data-sources/AccountsApiDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs","./data-sources/BackendWebsocketDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs","./data-sources/PriceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs","./data-sources/RpcDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs","./data-sources/SnapDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs","./data-sources/StakedBalanceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/StakedBalanceDataSource.cjs","./data-sources/TokenDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./middlewares/DetectionMiddleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.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","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.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,o,r,i,c,l,u,d,m,h,f,p,k,b,g,y,w,S,A,v,x,_,C,T,j,E,I,O,P,M,D,N,R,B,L,F,U,W,H,$,q=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.__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.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.AssetsController=s.getDefaultAssetsControllerState=void 0;const G=e("@metamask/base-controller"),z=e("@metamask/utils"),J=e("async-mutex"),Q=V(e("bignumber.js")),Y=e("lodash"),X=e("./data-sources/AccountsApiDataSource.cjs"),Z=e("./data-sources/BackendWebsocketDataSource.cjs"),ee=e("./data-sources/PriceDataSource.cjs"),te=e("./data-sources/RpcDataSource.cjs"),se=e("./data-sources/SnapDataSource.cjs"),ne=e("./data-sources/StakedBalanceDataSource.cjs"),ae=e("./data-sources/TokenDataSource.cjs"),oe=e("./logger.cjs"),re=e("./middlewares/DetectionMiddleware.cjs"),ie=e("./utils.cjs"),ce="AssetsController",le=["getAssets","getAssetsBalance","getAssetMetadata","getAssetsPrice","addCustomAsset","removeCustomAsset","getCustomAssets","hideAsset","unhideAsset"],ue=(0,oe.createModuleLogger)(oe.projectLogger,ce);function de(){return{assetsInfo:{},assetsBalance:{},assetsPrice:{},customAssets:{},assetPreferences:{}}}s.getDefaultAssetsControllerState=de;const me={assetsInfo:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetsBalance:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetsPrice:{persist:!1,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},customAssets:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetPreferences:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0}};function he(e){return(0,z.parseCaipAssetType)(e).chainId}class fe extends G.BaseController{constructor({messenger:e,state:t={},defaultUpdateInterval:s=3e4,isEnabled:m=()=>!0,isBasicFunctionality:g,subscribeToBasicFunctionalityChange:x,queryApiClient:_,rpcDataSourceConfig:j,trackMetaMetricsEvent:E,accountsApiDataSourceConfig:I,priceDataSourceConfig:O,stakedBalanceDataSourceConfig:P}){super({name:ce,messenger:e,metadata:me,state:{assetsInfo:{},assetsBalance:{},assetsPrice:{},customAssets:{},assetPreferences:{},...t}}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,!1),l.set(this,new J.Mutex),u.set(this,new Map),d.set(this,new Set),h.set(this,void 0),f.set(this,void 0),p.set(this,void 0),k.set(this,void 0),b.set(this,void 0),y.set(this,void 0),w.set(this,void 0),S.set(this,void 0),A.set(this,null),K(this,a,m(),"f"),K(this,o,g??(()=>!0),"f"),K(this,r,s,"f"),K(this,i,E,"f");const M=j??{},D=(e,t,s)=>{this.handleActiveChainsUpdate(e,t,s)};if(K(this,h,new Z.BackendWebsocketDataSource({messenger:this.messenger,queryApiClient:_,onActiveChainsUpdated:D}),"f"),K(this,f,new X.AccountsApiDataSource({queryApiClient:_,onActiveChainsUpdated:D,...I}),"f"),K(this,p,new se.SnapDataSource({messenger:this.messenger,onActiveChainsUpdated:D}),"f"),K(this,k,new te.RpcDataSource({messenger:this.messenger,onActiveChainsUpdated:D,...M}),"f"),K(this,b,new ne.StakedBalanceDataSource({messenger:this.messenger,onActiveChainsUpdated:D,...P}),"f"),K(this,S,new ae.TokenDataSource({queryApiClient:_}),"f"),K(this,y,new ee.PriceDataSource({queryApiClient:_,...O}),"f"),K(this,w,new re.DetectionMiddleware,"f"),q(this,a,"f")){if(ue("Initializing AssetsController",{defaultUpdateInterval:q(this,r,"f")}),q(this,n,"m",v).call(this),q(this,n,"m",C).call(this),q(this,n,"m",T).call(this),x){const e=x(e=>this.handleBasicFunctionalityChange(e));"function"==typeof e&&K(this,A,e,"f")}}else ue("AssetsController is disabled, skipping initialization")}handleActiveChainsUpdate(e,t,s){if(!q(this,a,"f"))return;ue("Data source active chains changed",{dataSourceId:e,chainCount:t.length,chains:t});const o=s,r=new Set(o),i=t.filter(e=>!r.has(e)),c=o.filter(e=>!t.includes(e));if((i.length>0||c.length>0)&&q(this,n,"m",D).call(this),i.length>0&&q(this,n,"a",m).length>0){const e=i.filter(e=>q(this,d,"f").has(e));e.length>0&&(ue("Fetching balances for newly added chains",{addedEnabledChains:e}),this.getAssets(q(this,n,"a",m),{chainIds:e,forceUpdate:!0}).catch(e=>{ue("Failed to fetch balance for added chains",{error:e})}))}}async getAssets(e,t){const s=t?.chainIds??[...q(this,d,"f")],a=t?.assetTypes??["fungible"],r=t?.dataTypes??["balance","metadata","price"],l=[];for(const t of e){const e=this.getCustomAssets(t.id);l.push(...e)}if(t?.forceUpdate){const t=Date.now(),u=q(this,n,"m",U).call(this,e,s,{assetTypes:a,dataTypes:r,customAssets:l.length>0?l:undefined,forceUpdate:!0}),d=q(this,o,"f").call(this)?[q(this,f,"f"),q(this,p,"f"),q(this,k,"f"),q(this,b,"f"),q(this,w,"f"),q(this,S,"f"),q(this,y,"f")]:[q(this,k,"f"),q(this,b,"f"),q(this,w,"f")],{response:m,durationByDataSource:h}=await q(this,n,"m",j).call(this,d,u);if(await q(this,n,"m",E).call(this,m),q(this,i,"f")&&!q(this,c,"f")){K(this,c,!0,"f");const e=Date.now()-t;q(this,i,"f").call(this,{durationMs:e,chainIds:s,durationByDataSource:h})}}return q(this,n,"m",I).call(this,e,s,a)}async getAssetsBalance(e,t){const s=await this.getAssets(e,{chainIds:t?.chainIds,assetTypes:t?.assetTypes,forceUpdate:t?.forceUpdate,dataTypes:["balance","metadata"]}),n={};for(const[e,t]of Object.entries(s)){n[e]={};for(const[s,a]of Object.entries(t))a.balance&&(n[e][s]=a.balance)}return n}getAssetMetadata(e){return this.state.assetsInfo[e]}async getAssetsPrice(e,t){const s=await this.getAssets(e,{chainIds:t?.chainIds,assetTypes:t?.assetTypes,forceUpdate:t?.forceUpdate,dataTypes:["price"]}),n={};for(const e of Object.values(s))for(const[t,s]of Object.entries(e))s.price&&(n[t]=s.price);return n}async addCustomAsset(e,t){const s=(0,ie.normalizeAssetId)(t);ue("Adding custom asset",{accountId:e,assetId:s}),this.update(t=>{const n=t.customAssets;n[e]||(n[e]=[]),n[e].includes(s)||n[e].push(s);const a=t.assetPreferences[s];a?.hidden&&(delete a.hidden,0===Object.keys(a).length&&delete t.assetPreferences[s])});const a=q(this,n,"a",m).find(t=>t.id===e);if(a){const e=he(s);await this.getAssets([a],{chainIds:[e],forceUpdate:!0})}}removeCustomAsset(e,t){const s=(0,ie.normalizeAssetId)(t);ue("Removing custom asset",{accountId:e,assetId:s}),this.update(t=>{t.customAssets[e]&&(t.customAssets[e]=t.customAssets[e].filter(e=>e!==s),0===t.customAssets[e].length&&delete t.customAssets[e])})}getCustomAssets(e){return this.state.customAssets[e]??[]}hideAsset(e){const t=(0,ie.normalizeAssetId)(e);ue("Hiding asset",{assetId:t}),this.update(e=>{e.assetPreferences[t]||(e.assetPreferences[t]={}),e.assetPreferences[t].hidden=!0})}unhideAsset(e){const t=(0,ie.normalizeAssetId)(e);ue("Unhiding asset",{assetId:t}),this.update(e=>{const s=e.assetPreferences[t];s&&(delete s.hidden,0===Object.keys(s).length&&delete e.assetPreferences[t])})}subscribeAssetsPrice(e,t){if(!q(this,o,"f").call(this))return;const s="ds:PriceDataSource",a=q(this,u,"f").get(s)!==undefined,r={request:q(this,n,"m",U).call(this,e,t,{dataTypes:["price"]}),subscriptionId:s,isUpdate:a,onAssetsUpdate:e=>this.handleAssetsUpdate(e,"PriceDataSource"),getAssetsState:()=>this.state};q(this,y,"f").subscribe(r).catch(console.error);const i={chains:t,accountId:s,assetTypes:["fungible"],dataTypes:["price"],unsubscribe:()=>{q(this,u,"f").delete(s)}};q(this,u,"f").set(s,i)}unsubscribeAssetsPrice(){const e="ds:PriceDataSource",t=q(this,u,"f").get(e);t&&(q(this,y,"f").unsubscribe(e).catch(console.error),t.unsubscribe())}handleBasicFunctionalityChange(e){q(this,n,"m",M).call(this),q(this,n,"m",D).call(this)}async handleAssetsUpdate(e,t,s){ue("Assets updated from data source",{sourceId:t,hasBalance:Boolean(e.assetsBalance),hasPrice:Boolean(e.assetsPrice)});const{response:a}=await q(this,n,"m",j).call(this,[q(this,w,"f"),q(this,S,"f"),q(this,y,"f")],s??{accountsWithSupportedChains:[],chainIds:[],dataTypes:["balance","metadata","price"]},e);await q(this,n,"m",E).call(this,a)}destroy(){ue("Destroying AssetsController",{dataSourceCount:q(this,n,"a",g).length,subscriptionCount:q(this,u,"f").size}),q(this,h,"f")?.destroy?.(),q(this,f,"f")?.destroy?.(),q(this,p,"f")?.destroy?.(),q(this,k,"f")?.destroy?.(),q(this,b,"f")?.destroy?.(),q(this,n,"m",M).call(this),q(this,A,"f")&&(q(this,A,"f").call(this),K(this,A,null,"f")),this.messenger.unregisterActionHandler("AssetsController:getAssets"),this.messenger.unregisterActionHandler("AssetsController:getAssetsBalance"),this.messenger.unregisterActionHandler("AssetsController:getAssetMetadata"),this.messenger.unregisterActionHandler("AssetsController:getAssetsPrice"),this.messenger.unregisterActionHandler("AssetsController:addCustomAsset"),this.messenger.unregisterActionHandler("AssetsController:removeCustomAsset"),this.messenger.unregisterActionHandler("AssetsController:getCustomAssets"),this.messenger.unregisterActionHandler("AssetsController:hideAsset"),this.messenger.unregisterActionHandler("AssetsController:unhideAsset")}}s.AssetsController=fe,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,k=new WeakMap,b=new WeakMap,y=new WeakMap,w=new WeakMap,S=new WeakMap,A=new WeakMap,n=new WeakSet,m=function(){return this.messenger.call("AccountTreeController:getAccountsFromSelectedAccountGroup")},g=function(){return[q(this,h,"f"),q(this,f,"f"),q(this,p,"f"),q(this,k,"f")]},v=function(){const{enabledNetworkMap:e}=this.messenger.call("NetworkEnablementController:getState");K(this,d,q(this,n,"m",x).call(this,e),"f"),ue("Initialized state",{enabledNetworkMap:e,enabledChains:q(this,d,"f")})},x=function(e){const t=new Set;for(const[s,a]of Object.entries(e))for(const[e,o]of Object.entries(a))if(o)if(e.includes(":"))t.add(e);else{const a=q(this,n,"m",_).call(this,s,e);t.add(`${s}:${a}`)}return t},_=function(e,t){return"eip155"===e&&(0,z.isStrictHexString)(t)?parseInt(t,16).toString():t},C=function(){this.messenger.subscribe("AccountTreeController:selectedAccountGroupChange",()=>{q(this,n,"m",H).call(this).catch(console.error)}),this.messenger.subscribe("NetworkEnablementController:stateChange",({enabledNetworkMap:e})=>{q(this,n,"m",$).call(this,e).catch(console.error)}),this.messenger.subscribe("KeyringController:unlock",()=>q(this,n,"m",P).call(this)),this.messenger.subscribe("KeyringController:lock",()=>q(this,n,"m",M).call(this))},T=function(){this.messenger.registerMethodActionHandlers(this,le)},j=async function(e,t,s={}){const n=e.map(e=>e.getName()),a=e.map(e=>e.assetsMiddleware),o=[],r=a.map((e,t)=>async(s,n)=>{const a=Date.now();try{return await e(s,n)}finally{o[t]=Date.now()-a}}).reduceRight((e,t)=>async s=>{try{return await t(s,e)}catch(t){return console.error("[AssetsController] Middleware failed:",t),e(s)}},async e=>e),i=await r({request:t,response:s,getAssetsState:()=>this.state}),c={};for(let e=0;e<o.length;e++){const t=e+1<o.length?o[e+1]??0:0,s=Math.max(0,(o[e]??0)-t),a=n[e];a!==undefined&&(c[a]=s)}return{response:i.response,durationByDataSource:c}},E=async function(e){const t=function(e){const t={};if(e.assetsInfo){t.assetsInfo={};for(const[s,n]of Object.entries(e.assetsInfo)){const e=(0,ie.normalizeAssetId)(s);t.assetsInfo[e]=n}}if(e.assetsPrice){t.assetsPrice={};for(const[s,n]of Object.entries(e.assetsPrice)){const e=(0,ie.normalizeAssetId)(s);t.assetsPrice[e]=n}}if(e.assetsBalance){t.assetsBalance={};for(const[s,n]of Object.entries(e.assetsBalance)){t.assetsBalance[s]={};for(const[e,a]of Object.entries(n)){const n=(0,ie.normalizeAssetId)(e);t.assetsBalance[s][n]=a}}}if(e.detectedAssets){t.detectedAssets={};for(const[s,n]of Object.entries(e.detectedAssets))t.detectedAssets[s]=n.map(e=>(0,ie.normalizeAssetId)(e))}return e.errors&&(t.errors={...e.errors}),t}(e),s=await q(this,l,"f").acquire();try{const e=this.state,s={...this.state.assetsPrice},n=t.detectedAssets??{},a=[],o=[];this.update(s=>{const n=s.assetsInfo,r=s.assetsBalance,i=s.assetsPrice;if(t.assetsInfo)for(const[s,a]of Object.entries(t.assetsInfo))(0,Y.isEqual)(e.assetsInfo[s],a)||o.push(s),n[s]=a;if(t.assetsBalance)for(const[s,n]of Object.entries(t.assetsBalance)){const t=e.assetsBalance[s]??{};r[s]||(r[s]={});for(const[e,o]of Object.entries(n)){const n=t[e],r=o.amount,i=n?.amount;i!==r&&a.push({accountId:s,assetId:e,oldAmount:i,newAmount:r})}Object.assign(r[s],n)}if(t.assetsPrice)for(const[e,s]of Object.entries(t.assetsPrice))i[e]=s});const r=t.assetsPrice?Object.keys(t.assetsPrice).filter(e=>!(0,Y.isEqual)(s[e],t.assetsPrice?.[e])):[];(a.length>0||o.length>0||r.length>0)&&ue("State updated",{changedBalances:a.length>0?a:undefined,changedMetadataCount:o.length>0?o.length:undefined,changedPricesCount:r.length>0?r.length:undefined,newAssets:Object.keys(n).length>0?Object.entries(n).map(([e,t])=>({accountId:e,assets:t})):undefined});for(const e of a)this.messenger.publish("AssetsController:balanceChanged",{accountId:e.accountId,assetId:e.assetId,previousAmount:e.oldAmount??"0",newAmount:e.newAmount});if(r.length>0&&t.assetsPrice){const e={};for(const s of r){const n=t.assetsPrice[s];n&&(e[s]=n)}this.messenger.publish("AssetsController:priceChanged",{prices:e})}for(const[e,t]of Object.entries(n))t.length>0&&this.messenger.publish("AssetsController:assetsDetected",{accountId:e,assetIds:t})}finally{s()}},I=function(e,t,s){const a={},o=new Set(t),r=new Set(s);for(const t of e){a[t.id]={};const e=this.state.assetsBalance[t.id]??{};for(const[s,i]of Object.entries(e)){const e=s,c=this.state.assetsInfo[e];if(!c)continue;const l=c,u=this.state.assetPreferences[e];if(u?.hidden)continue;const d=he(e);if(!o.has(d))continue;const m=q(this,n,"m",O).call(this,l.type);if(!r.has(m))continue;const h=i,f=this.state.assetsPrice[e]??{price:0,lastUpdated:0},p={id:e,chainId:d,balance:h,metadata:l,price:f,fiatValue:new Q.default(h.amount||"0").multipliedBy(f.price||0).toNumber()};a[t.id][e]=p}}return a},O=function(e){switch(e){case"native":case"erc20":case"spl":default:return"fungible";case"erc721":return"nft";case"erc1155":return"collectible"}},P=function(){ue("Starting asset tracking",{selectedAccountCount:q(this,n,"a",m).length,enabledChainCount:q(this,d,"f").size}),q(this,n,"m",D).call(this),this.getAssets(q(this,n,"a",m),{chainIds:[...q(this,d,"f")],forceUpdate:!0}).catch(e=>{ue("Failed to fetch assets",e)})},M=function(){ue("Stopping asset tracking",{activeSubscriptionCount:q(this,u,"f").size,hasPriceSubscription:q(this,u,"f").has("ds:PriceDataSource")}),K(this,c,!1,"f"),this.unsubscribeAssetsPrice();const e=[...q(this,n,"a",g),q(this,b,"f")],t=[...q(this,u,"f").keys()];for(const s of t)if(s.startsWith("ds:")){const t=s.slice(3),a=e.find(e=>e.getName()===t);a&&q(this,n,"m",F).call(this,a)}q(this,u,"f").clear()},D=function(){0!==q(this,n,"a",m).length&&(q(this,n,"m",N).call(this,q(this,n,"a",m),[...q(this,d,"f")]),q(this,n,"m",R).call(this,q(this,n,"a",m),[...q(this,d,"f")]),this.subscribeAssetsPrice(q(this,n,"a",m),[...q(this,d,"f")]))},N=function(e,t){const s=q(this,n,"m",B).call(this,e,new Set(t)),a=new Set(s.keys()),r=q(this,o,"f").call(this)?q(this,n,"a",g):[q(this,k,"f")];for(const e of r){const t=new Set(e.getActiveChainsSync()),o=[];for(const e of a)t.has(e)&&(o.push(e),a.delete(e));if(0===o.length){q(this,n,"m",F).call(this,e);continue}const r=new Set,i=o.flatMap(e=>s.get(e)??[]).filter(e=>!r.has(e.id)&&(r.add(e.id),!0));i.length>0&&q(this,n,"m",L).call(this,e,i,o)}},R=function(e,t){const s=q(this,b,"f");if(!s)return;const a=new Set(s.getActiveChainsSync()),o=t.filter(e=>a.has(e));0!==o.length?q(this,n,"m",L).call(this,s,e,o):q(this,n,"m",F).call(this,s)},B=function(e,t){const s=new Map;for(const a of e)for(const e of q(this,n,"m",W).call(this,a)){if(!t.has(e))continue;let n=s.get(e);n||(n=[],s.set(e,n)),n.push(a)}return s},L=function(e,t,s){const a=e.getName(),o=`ds:${a}`,i=q(this,u,"f").get(o)!==undefined;ue("Subscribe to data source",{sourceId:a,subscriptionKey:o,isUpdate:i,accountCount:t.length,chainCount:s.length});const c={request:q(this,n,"m",U).call(this,t,s,{assetTypes:["fungible"],dataTypes:["balance"],updateInterval:q(this,r,"f")}),subscriptionId:o,isUpdate:i,onAssetsUpdate:e=>this.handleAssetsUpdate(e,a),getAssetsState:()=>this.state};e.subscribe(c).catch(e=>{console.error(`[AssetsController] Failed to subscribe to '${a}':`,e)});const l={chains:s,accountId:o,assetTypes:["fungible"],dataTypes:["balance"],unsubscribe:()=>{q(this,u,"f").delete(o)}};q(this,u,"f").set(o,l)},F=function(e){const t=`ds:${e.getName()}`,s=q(this,u,"f").get(t);s&&(e.unsubscribe(t).catch(()=>undefined),s.unsubscribe())},U=function(e,t,s={}){const a=new Set(t);return{accountsWithSupportedChains:e.map(e=>({account:e,supportedChains:q(this,n,"m",W).call(this,e).filter(e=>a.has(e))})),chainIds:t,...s}},W=function(e){const t=e.scopes??[],s=[];for(const e of t){const t=e;if(!(0,z.isCaipChainId)(t)){s.push(e);continue}const{namespace:n,reference:a}=(0,z.parseCaipChainId)(t);if("0"===a){for(const e of q(this,d,"f"))if((0,z.isCaipChainId)(e)){(0,z.parseCaipChainId)(e).namespace===n&&s.push(e)}}else"eip155"===n&&(0,z.isStrictHexString)(a)?s.push(`eip155:${parseInt(a,16)}`):s.push(e)}return s},H=async function(){const e=q(this,n,"a",m);ue("Account group changed",{accountCount:e.length,accountIds:e.map(e=>e.id)}),q(this,n,"m",D).call(this),e.length>0&&await this.getAssets(e,{chainIds:[...q(this,d,"f")],forceUpdate:!0})},$=async function(e){const t=q(this,d,"f");K(this,d,q(this,n,"m",x).call(this,e),"f");const s=[];for(const e of q(this,d,"f"))t.has(e)||s.push(e);const a=[];for(const e of t)q(this,d,"f").has(e)||a.push(e);ue("Enabled networks changed",{previousCount:t.size,newCount:q(this,d,"f").size,addedChains:s,removedChains:a}),q(this,n,"m",D).call(this),s.length>0&&q(this,n,"a",m).length>0&&await this.getAssets(q(this,n,"a",m),{chainIds:s,forceUpdate:!0})}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/AssetsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AbstractDataSource=void 0;s.AbstractDataSource=class{constructor(e,t){this.activeSubscriptions=new Map,this.name=e,this.state=t}getName(){return this.name}async getActiveChains(){return this.state.activeChains}getActiveChainsSync(){return this.state.activeChains}async unsubscribe(e){const t=this.activeSubscriptions.get(e);t&&(t.cleanup(),this.activeSubscriptions.delete(e))}updateActiveChains(e,t){const s=new Set(this.state.activeChains),n=new Set(e),a=s.size!==n.size||e.some(e=>!s.has(e));this.state.activeChains=e,a&&t(e)}addActiveChain(e,t){this.state.activeChains.includes(e)||(this.state.activeChains=[...this.state.activeChains,e],t(this.state.activeChains))}removeActiveChain(e,t){this.state.activeChains.includes(e)&&(this.state.activeChains=this.state.activeChains.filter(t=>t!==e),t(this.state.activeChains))}destroy(){for(const e of this.activeSubscriptions.values())e.cleanup();this.activeSubscriptions.clear()}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/utils.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","@metamask/core-backend":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/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,o,r,i,c,l,u,d,m,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.AccountsApiDataSource=s.filterResponseToKnownAssets=void 0;e("@metamask/core-backend");const k=e("@metamask/utils"),b=e("./AbstractDataSource.cjs"),g=e("../logger.cjs"),y=e("../utils.cjs"),w="AccountsApiDataSource",S=(0,g.createModuleLogger)(g.projectLogger,w),A={activeChains:[]};function v(e){return"string"==typeof e?(0,k.isCaipChainId)(e)?e:(0,k.toCaipChainId)(k.KnownCaipNamespace.Eip155,e):(0,k.toCaipChainId)(k.KnownCaipNamespace.Eip155,String(e))}function x(e){return(0,k.isCaipChainId)(e)?e:(0,k.toCaipChainId)(k.KnownCaipNamespace.Eip155,e)}function _(e,t){if(!e.assetsBalance)return e;const s={};for(const[n,a]of Object.entries(e.assetsBalance)){const e=t.assetsBalance[n];if(!e)continue;const o={};for(const[t,s]of Object.entries(a))t in e&&(o[t]=s);Object.keys(o).length>0&&(s[n]=o)}return{...e,assetsBalance:Object.keys(s).length>0?s:undefined}}s.filterResponseToKnownAssets=_;class C extends b.AbstractDataSource{constructor(e){super(w,{...A,...e.state}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,null),l.set(this,void 0),f(this,a,e.onActiveChainsUpdated,"f"),f(this,o,e.pollInterval??3e4,"f"),f(this,r,e.tokenDetectionEnabled??(()=>!0),"f"),f(this,i,e.queryApiClient,"f"),p(this,n,"m",u).call(this).catch(console.error)}async fetch(e){let t={};const s=new Set(this.state.activeChains),a=e.chainIds.filter(e=>s.has(e));if(0===a.length){for(const n of e.chainIds)s.has(n)||(t.errors=t.errors??{},t.errors[n]="Chain not supported by Accounts API");return t}try{const s=e.accountsWithSupportedChains.flatMap(({account:e,supportedChains:t})=>a.filter(e=>t.includes(e)).map(t=>`${t}:${e.address}`));if(0===s.length)return t;const o=await p(this,i,"f").accounts.fetchV5MultiAccountBalances(s);if(o.unprocessedNetworks.length>0){const e=o.unprocessedNetworks.map(x);t.errors=t.errors??{};for(const s of e)t.errors[s]="Unprocessed by Accounts API"}const{assetsBalance:r}=p(this,n,"m",h).call(this,o.balances,e);t.assetsBalance=r}catch(e){S("Fetch FAILED",{error:e,chains:a}),t.errors=t.errors??{};for(const s of a)t.errors[s]=`Fetch failed: ${e instanceof Error?e.message:String(e)}`}for(const n of e.chainIds)s.has(n)||(t.errors=t.errors??{},t.errors[n]="Chain not supported by Accounts API");return!p(this,r,"f").call(this)&&p(this,l,"f")&&(t=_(t,p(this,l,"f").call(this))),t}get assetsMiddleware(){return async(e,t)=>{var s;const{request:n}=e;if(0===n.chainIds.length)return t(e);let a=[];try{const t=await this.fetch(n);if(t.assetsBalance){(s=e.response).assetsBalance??(s.assetsBalance={});for(const[s,n]of Object.entries(t.assetsBalance))e.response.assetsBalance[s]={...e.response.assetsBalance[s],...n}}const o=new Set(Object.keys(t.errors??{}));a=n.chainIds.filter(e=>!o.has(e)),p(this,r,"f").call(this)||t.assetsBalance&&0!==Object.keys(t.assetsBalance).length||(a=[])}catch(e){S("Middleware fetch failed",{error:e}),a=[]}if(a.length>0){const s=n.chainIds.filter(e=>!a.includes(e));return t({...e,request:{...n,chainIds:s}})}return t(e)}}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:n}=e;e.getAssetsState&&f(this,l,e.getAssetsState,"f");const a=t.chainIds;if(0===a.length)return;if(n){const e=this.activeSubscriptions.get(s);if(e)return e.chains=a,void(e.request=t)}await this.unsubscribe(s);const r=t.updateInterval??p(this,o,"f"),i=async()=>{try{const e=this.activeSubscriptions.get(s);if(!e?.request)return;const t=await this.fetch({...e.request,chainIds:e.chains});await e.onAssetsUpdate(t)}catch(e){S("Subscription poll failed",{subscriptionId:s,error:e})}},c=setInterval(()=>{i().catch(console.error)},r);this.activeSubscriptions.set(s,{cleanup:()=>{clearInterval(c)},chains:a,request:t,onAssetsUpdate:e.onAssetsUpdate}),await i()}destroy(){p(this,c,"f")&&clearInterval(p(this,c,"f")),super.destroy()}}s.AccountsApiDataSource=C,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,n=new WeakSet,u=async function(){try{const e=await p(this,n,"m",m).call(this),t=[...this.state.activeChains];this.updateActiveChains(e,e=>p(this,a,"f").call(this,this.getName(),e,t)),f(this,c,setInterval(()=>{p(this,n,"m",d).call(this).catch(console.error)},12e5),"f")}catch(e){S("Failed to fetch active chains",e)}},d=async function(){try{const e=await p(this,n,"m",m).call(this),t=new Set(this.state.activeChains),s=new Set(e),o=e.filter(e=>!t.has(e)),r=Array.from(t).filter(e=>!s.has(e));if(o.length>0||r.length>0){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>p(this,a,"f").call(this,this.getName(),e,t))}}catch(e){S("Failed to refresh active chains",e)}},m=async function(){return(await p(this,i,"f").accounts.fetchV2SupportedNetworks()).fullSupport.map(v)},h=function(e,t){const s={},n=new Map;for(const{account:e}of t.accountsWithSupportedChains)e.address&&n.set(e.address.toLowerCase(),e.id);for(const t of e){const e=t.accountId.split(":");if(e.length<3)continue;const a=e[2].toLowerCase(),o=n.get(a);if(!o)continue;s[o]||(s[o]={});const r=(0,y.normalizeAssetId)(t.assetId);s[o][r]={amount:t.balance}}return{assetsBalance:s}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.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,o,r,i,c,l,u,d,m,h,f,p,k,b,g,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},w=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.createBackendWebsocketDataSource=s.BackendWebsocketDataSource=void 0;const S=e("@metamask/utils"),A=e("./AbstractDataSource.cjs"),v=e("../logger.cjs"),x="BackendWebsocketDataSource",_="account-activity.v1",C=(0,v.createModuleLogger)(v.projectLogger,x),T={activeChains:[]};function j(e){const[t]=e.split(":");return t}const E=["eip155","solana"];function I(e,t){if("eip155"===t)return e.type.startsWith("eip155")?e.address:null;if("solana"===t)return e.type.startsWith("solana")?e.address:null;const s=`${t}:`;return e.type.startsWith(s)?e.address:null}function O(e,t){const s="eip155"===e?t.toLowerCase():t;return`${_}.${e}:0:${s}`}function P(e){return"string"==typeof e?(0,S.isCaipChainId)(e)?e:(0,S.toCaipChainId)(S.KnownCaipNamespace.Eip155,e):(0,S.toCaipChainId)(S.KnownCaipNamespace.Eip155,String(e))}class M extends A.AbstractDataSource{constructor(e){super(x,{...T,...e.state}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,null),c.set(this,new Map),l.set(this,new Map),u.set(this,new Map),y(this,a,e.messenger,"f"),y(this,o,e.queryApiClient,"f"),y(this,r,e.onActiveChainsUpdated,"f"),w(this,n,"m",f).call(this),w(this,n,"m",d).call(this).catch(console.error)}setActiveChainsFromAccountsApi(e){this.updateActiveChains(e,()=>undefined)}updateSupportedChains(e){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>w(this,r,"f").call(this,this.getName(),e,t))}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:o}=e,r=t.chainIds.filter(e=>this.state.activeChains.includes(e)),i=t.accountsWithSupportedChains.map(e=>e.account.address);if(0===i.length)return;try{if("connected"!==w(this,a,"f").call("BackendWebSocketService:getConnectionInfo").state)return void w(this,l,"f").set(s,e)}catch{return void w(this,l,"f").set(s,e)}if(w(this,l,"f").delete(s),o){const e=this.activeSubscriptions.get(s);if(e){const t=e.addresses??[];if(!(i.length!==t.length||i.some(e=>!t.includes(e))))return void(e.chains=r)}}await this.unsubscribe(s);const d=function(e){const t=new Set(E);for(const s of e)t.add(j(s));return Array.from(t)}(r),m=[];for(const e of d)for(const{account:s}of t.accountsWithSupportedChains){const t=I(s,e);t&&m.push(O(e,t))}try{const t=await w(this,a,"f").call("BackendWebSocketService:subscribe",{channels:m,channelType:_,callback:e=>{w(this,n,"m",b).call(this,e,s)}});w(this,c,"f").set(s,t),this.activeSubscriptions.set(s,{cleanup:()=>{const e=w(this,c,"f").get(s);e&&(e.unsubscribe().catch(e=>{C("Error unsubscribing",{subscriptionId:s,error:e})}),w(this,c,"f").delete(s)),w(this,u,"f").delete(s)},chains:r,addresses:i,onAssetsUpdate:e.onAssetsUpdate}),w(this,u,"f").set(s,e)}catch(e){C("WebSocket subscription FAILED",{subscriptionId:s,error:e,chains:r})}}destroy(){w(this,i,"f")&&(clearInterval(w(this,i,"f")),y(this,i,null,"f"));const e=[...w(this,c,"f").values()];for(const t of e)try{t.unsubscribe().catch(()=>{})}catch{}w(this,c,"f").clear(),super.destroy()}}s.BackendWebsocketDataSource=M,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,n=new WeakSet,d=async function(){try{const e=await w(this,n,"m",h).call(this),t=[...this.state.activeChains];this.updateActiveChains(e,e=>w(this,r,"f").call(this,this.getName(),e,t)),y(this,i,setInterval(()=>{w(this,n,"m",m).call(this).catch(console.error)},12e5),"f")}catch(e){C("Failed to fetch active chains",e)}},m=async function(){try{const e=await w(this,n,"m",h).call(this),t=new Set(this.state.activeChains),s=new Set(e),a=e.filter(e=>!t.has(e)),o=Array.from(t).filter(e=>!s.has(e));if(a.length>0||o.length>0){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>w(this,r,"f").call(this,this.getName(),e,t))}}catch(e){C("Failed to refresh active chains",e)}},h=async function(){return(await w(this,o,"f").accounts.fetchV2SupportedNetworks()).fullSupport.map(P)},f=function(){w(this,a,"f").subscribe("BackendWebSocketService:connectionStateChanged",e=>{"connected"===e.state?w(this,n,"m",k).call(this).catch(console.error):"disconnected"===e.state&&w(this,n,"m",p).call(this)})},p=function(){C("WebSocket disconnected, preserving subscriptions for reconnect",{activeSubscriptionCount:this.activeSubscriptions.size,wsSubscriptionCount:w(this,c,"f").size});for(const[e]of this.activeSubscriptions){const t=w(this,u,"f").get(e);t&&w(this,l,"f").set(e,{...t,isUpdate:!1})}w(this,c,"f").clear(),this.activeSubscriptions.clear()},k=async function(){if(0===w(this,l,"f").size)return;const e=Array.from(w(this,l,"f").entries());for(const[t,s]of e)try{w(this,l,"f").delete(t),await this.subscribe(s)}catch(e){C("Failed to process pending subscription",{subscriptionId:t,error:e})}},b=function(e,t){try{const s=this.activeSubscriptions.get(t),a=w(this,u,"f").get(t)?.request;if(!a)return;const o=e.data,{address:r,tx:i,updates:c}=o;if(!r||!i||!c)return;const l=i.chain,d=a.accountsWithSupportedChains.map(e=>e.account).find(e=>e.address.startsWith("0x")?e.address.toLowerCase()===r.toLowerCase():e.address===r);if(!d)return;const m=d.id,h=w(this,n,"m",g).call(this,c,l,m);Object.keys(h).length>0&&s&&Promise.resolve(s.onAssetsUpdate(h)).catch(console.error)}catch(e){C("Error handling notification",e)}},g=function(e,t,s){const n={[s]:{}},a={};for(const t of e){const{asset:e,postBalance:o}=t;if(!e||!o)continue;const r=e.type,i=e.type.includes("/slip44:")?"native":"erc20",c=o.amount.startsWith("0x")?BigInt(o.amount).toString():o.amount;n[s][r]={amount:c},a[r]={type:i,symbol:e.unit,name:e.unit,decimals:e.decimals}}const o={};return Object.keys(n[s]).length>0&&(o.assetsBalance=n,o.assetsInfo=a),o},s.createBackendWebsocketDataSource=function(e){return new M(e)}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/types.cjs","@metamask/core-backend":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/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,o,r,i,c,l,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},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.PriceDataSource=void 0;e("@metamask/core-backend");const m=e("@metamask/utils"),h=e("../logger.cjs"),f=e("../types.cjs"),p="PriceDataSource",k=(0,h.createModuleLogger)(h.projectLogger,p),b=[/\/slip44:\d+-staked-for-/u,/\/slip44:bandwidth$/u,/\/slip44:energy$/u,/\/slip44:maximum-bandwidth$/u,/\/slip44:maximum-energy$/u];function g(e){return!b.some(t=>t.test(e))}function y(e){return"object"==typeof e&&null!==e&&"price"in e&&"number"==typeof e.price}class w{getName(){return w.controllerName}constructor(e){n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,new Map),u(this,a,e.currency??"usd","f"),u(this,o,e.pollInterval??6e4,"f"),u(this,r,e.queryApiClient,"f")}get assetsMiddleware(){return(0,f.forDataTypes)(["price"],async(e,t)=>{const{response:s}=e;if(!s.detectedAssets)return t(e);const a=new Set;for(const e of Object.values(s.detectedAssets))for(const t of e)a.add(t);if(0===a.size)return t(e);const o=[...a].filter(g);if(0===o.length)return t(e);try{const e=await d(this,n,"m",c).call(this,o);s.assetsPrice??(s.assetsPrice={});for(const[t,n]of Object.entries(e)){if(!y(n))continue;const e=t;s.assetsPrice[e]={...n,lastUpdated:Date.now()}}}catch(e){k("Failed to fetch prices via middleware",{error:e})}return t(e)})}async fetch(e,t){const s={},a=d(this,n,"m",l).call(this,e,t).filter(g);if(0===a.length)return s;try{const e=await d(this,n,"m",c).call(this,[...a]);s.assetsPrice={};for(const[t,n]of Object.entries(e)){if(!y(n))continue;const e=t;s.assetsPrice[e]={...n,lastUpdated:Date.now()}}}catch(e){k("Failed to fetch prices",{error:e})}return s}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:n}=e;if(n){const e=d(this,i,"f").get(s);if(e)return void(e.request=t)}await this.unsubscribe(s);const a=t.updateInterval??d(this,o,"f"),r=async()=>{try{const e=d(this,i,"f").get(s);if(!e)return;const t=await this.fetch(e.request,e.getAssetsState);t.assetsPrice&&Object.keys(t.assetsPrice).length>0&&await e.onAssetsUpdate(t)}catch(e){k("Subscription poll failed",{subscriptionId:s,error:e})}},c=setInterval(()=>{r().catch(console.error)},a);d(this,i,"f").set(s,{cleanup:()=>{clearInterval(c)},request:t,onAssetsUpdate:e.onAssetsUpdate,getAssetsState:e.getAssetsState}),await r()}async unsubscribe(e){const t=d(this,i,"f").get(e);t&&(t.cleanup(),d(this,i,"f").delete(e))}destroy(){for(const e of d(this,i,"f").values())e.cleanup();d(this,i,"f").clear()}}s.PriceDataSource=w,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,c=async function(e){return d(this,r,"f").prices.fetchV3SpotPrices(e,{currency:d(this,a,"f"),includeMarketData:!0})},l=function(e,t){if(!t)return[];try{const s=t(),n=new Set,a=e.accountsWithSupportedChains.map(e=>e.account.id),o=a.length>0?new Set(a):undefined,r=e.chainIds.length>0?new Set(e.chainIds):undefined;if(s?.assetsBalance)for(const[e,t]of Object.entries(s.assetsBalance))if(!o||o.has(e))for(const e of Object.keys(t)){if(r)try{const{chainId:t}=(0,m.parseCaipAssetType)(e);if(!r.has(t))continue}catch(t){k("Skipping malformed asset ID in balance state",{assetId:e,error:t});continue}n.add(e)}return[...n]}catch(e){return k("Failed to get asset IDs from balance state",{error:e}),[]}},w.controllerName=p}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","./evm-rpc-services/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,o,r,i,c,l,u,d,m,h,f,p,k,b,g,y,w,S,A,v,x,_,C,T,j,E,I,O,P,M,D,N=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)},B=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.createRpcDataSource=s.RpcDataSource=s.caipChainIdToHex=void 0;const L=e("@ethersproject/providers"),F=e("@metamask/controller-utils"),U=e("@metamask/utils"),W=B(e("bignumber.js")),H=e("./AbstractDataSource.cjs"),$=e("./evm-rpc-services/index.cjs"),q=e("../logger.cjs"),K="RpcDataSource",V=(0,q.createModuleLogger)(q.projectLogger,K);s.caipChainIdToHex=e=>{if((0,U.isStrictHexString)(e))return e;if((0,U.isCaipChainId)(e))return(0,F.toHex)((0,U.parseCaipChainId)(e).reference);throw new Error("caipChainIdToHex - Failed to provide CAIP-2 or Hex chainId")};class G extends H.AbstractDataSource{constructor(e){super(K,{activeChains:[]}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,[]),u.set(this,{}),d.set(this,new Map),m.set(this,new Map),h.set(this,undefined),f.set(this,undefined),p.set(this,void 0),k.set(this,void 0),b.set(this,void 0),N(this,a,e.messenger,"f"),N(this,o,e.onActiveChainsUpdated,"f"),N(this,r,e.timeout??1e4,"f"),N(this,i,e.tokenDetectionEnabled??(()=>!0),"f"),N(this,c,e.useExternalService??(()=>!0),"f");const t=e.balanceInterval??3e4,s=e.detectionInterval??18e4;V("Initializing RpcDataSource",{timeout:R(this,r,"f"),balanceInterval:t,detectionInterval:s,tokenDetectionEnabled:R(this,i,"f").call(this),useExternalService:R(this,c,"f").call(this)}),N(this,p,new $.MulticallClient(e=>R(this,n,"m",I).call(this,e)),"f");const g={call:e=>({assetsBalance:R(this,a,"f").call("AssetsController:getState").assetsBalance??{}})},y={call:e=>R(this,a,"f").call("TokenListController:getState")};N(this,k,new $.BalanceFetcher(R(this,p,"f"),g,{pollingInterval:t}),"f"),R(this,k,"f").setOnBalanceUpdate(R(this,n,"m",w).bind(this)),N(this,b,new $.TokenDetector(R(this,p,"f"),y,{pollingInterval:s,tokenDetectionEnabled:R(this,i,"f"),useExternalService:R(this,c,"f")}),"f"),R(this,b,"f").setOnDetectionUpdate(R(this,n,"m",S).bind(this)),R(this,n,"m",A).call(this),R(this,n,"m",v).call(this),R(this,n,"m",T).call(this)}getChainStatuses(){return{...R(this,u,"f")}}getChainStatus(e){return R(this,u,"f")[e]}setBalancePollingInterval(e){V("Setting balance polling interval",{interval:e}),R(this,k,"f").setIntervalLength(e)}getBalancePollingInterval(){return R(this,k,"f").getIntervalLength()}setDetectionPollingInterval(e){V("Setting detection polling interval",{interval:e}),R(this,b,"f").setIntervalLength(e)}getDetectionPollingInterval(){return R(this,b,"f").getIntervalLength()}async fetch(e){const t={},a=e.chainIds.filter(e=>R(this,l,"f").includes(e));if(V("Fetch requested",{accounts:e.accountsWithSupportedChains.map(e=>e.account.id),requestedChains:e.chainIds,chainsToFetch:a}),0===a.length)return V("No active chains to fetch"),t;const o={},r={},i=[];for(const{account:t,supportedChains:c}of e.accountsWithSupportedChains){const e=a.filter(e=>c.includes(e));if(0===e.length)continue;const{address:l,id:d}=t;for(const t of e){const e=(0,s.caipChainIdToHex)(t);try{const s=await R(this,k,"f").fetchBalancesForTokens(e,d,l,[],{includeNative:!0});o[d]||(o[d]={});const a=R(this,n,"m",y).call(this,s.balances,t);Object.assign(r,a);for(const e of s.balances){const t=r[e.assetId],s=t?.decimals??18,a=R(this,n,"m",g).call(this,e.balance,s);o[d][e.assetId]={amount:a}}}catch(e){V("Failed to fetch balance",{address:l,chainId:t,error:e}),o[d]||(o[d]={});const s=R(this,n,"m",P).call(this,t);o[d][s]={amount:"0"};const a=R(this,u,"f")[t];a&&(r[s]={type:"native",symbol:a.nativeCurrency,name:a.nativeCurrency,decimals:18}),i.includes(t)||i.push(t)}}}if(i.length>0){V("Fetch PARTIAL - some chains failed",{successChains:a.filter(e=>!i.includes(e)),failedChains:i}),t.errors={};for(const e of i)t.errors[e]="RPC fetch failed"}else V("Fetch SUCCESS",{chains:a,accountCount:Object.keys(o).length});return t.assetsBalance=o,Object.keys(r).length>0&&(t.assetsInfo=r),t}async detectTokens(e,t){if(!R(this,i,"f").call(this)||!R(this,c,"f").call(this))return{};const a=(0,s.caipChainIdToHex)(e),{address:o,id:r}=t;V("Running token detection",{chainId:e,accountId:r});try{const t=await R(this,b,"f").detectTokens(a,r,o,{tokenDetectionEnabled:R(this,i,"f").call(this),useExternalService:R(this,c,"f").call(this)});if(0===t.detectedAssets.length)return V("No new tokens detected"),{};V("Detected new tokens",{count:t.detectedAssets.length,chainId:e,accountId:r});const s={},l={};for(const e of t.detectedAssets)e.symbol&&e.decimals!==undefined&&(l[e.assetId]={type:"erc20",symbol:e.symbol,name:e.name??e.symbol,decimals:e.decimals,image:e.image});for(const e of t.detectedBalances){const a=t.detectedAssets.find(t=>t.assetId===e.assetId),o=a?.decimals??18,r=R(this,n,"m",g).call(this,e.balance,o);s[e.assetId]={amount:r}}const u={detectedAssets:{[r]:t.detectedAssets.map(e=>e.assetId)},assetsBalance:{[r]:s}};return Object.keys(l).length>0&&(u.assetsInfo=l),u}catch(t){return V("Token detection failed",{chainId:e,accountId:r,error:t}),{}}}get assetsMiddleware(){return async(e,t)=>{var s,n,a;const{request:o}=e,r=o.chainIds.filter(e=>R(this,l,"f").includes(e));if(0===r.length)return t(e);let i=[];V("Middleware fetching",{chains:r,accounts:o.accountsWithSupportedChains.map(e=>e.account.id)});const c=await this.fetch({...o,chainIds:r});if(c.assetsBalance){(s=e.response).assetsBalance??(s.assetsBalance={});for(const[t,s]of Object.entries(c.assetsBalance))(n=e.response.assetsBalance)[t]??(n[t]={}),e.response.assetsBalance[t]={...e.response.assetsBalance[t],...s}}c.assetsInfo&&((a=e.response).assetsInfo??(a.assetsInfo={}),e.response.assetsInfo={...e.response.assetsInfo,...c.assetsInfo});const u=new Set(Object.keys(c.errors??{}));if(i=r.filter(e=>!u.has(e)),i.length>0){const s=o.chainIds.filter(e=>!i.includes(e));return t({...e,request:{...o,chainIds:s}})}return t(e)}}async subscribe(e){const{request:t,subscriptionId:n,isUpdate:a}=e,o=t.chainIds.filter(e=>R(this,l,"f").includes(e));if(V("Subscribe requested",{subscriptionId:n,isUpdate:a,accounts:t.accountsWithSupportedChains.map(e=>e.account.id),chainsToSubscribe:o}),0===o.length)return void V("No active chains to subscribe");if(a){const e=R(this,m,"f").get(n);e&&V("Updating existing subscription - restarting polling",{subscriptionId:n,existingChains:e.chains,newChains:o})}await this.unsubscribe(n);const r=[],u=[];for(const{account:e,supportedChains:n}of t.accountsWithSupportedChains){const t=o.filter(e=>n.includes(e));if(0===t.length)continue;const{address:a,id:l}=e;for(const e of t){const t=(0,s.caipChainIdToHex)(e),n={chainId:t,accountId:l,accountAddress:a},o=R(this,k,"f").startPolling(n);if(r.push(o),R(this,i,"f").call(this)&&R(this,c,"f").call(this)){const e={chainId:t,accountId:l,accountAddress:a},s=R(this,b,"f").startPolling(e);u.push(s)}}}const d=t.accountsWithSupportedChains.map(e=>e.account);R(this,m,"f").set(n,{balancePollingTokens:r,detectionPollingTokens:u,chains:o,accounts:d,onAssetsUpdate:e.onAssetsUpdate}),V("Subscription SUCCESS",{subscriptionId:n,chains:o,balancePollingCount:r.length,detectionPollingCount:u.length})}async unsubscribe(e){const t=R(this,m,"f").get(e);if(t){for(const e of t.balancePollingTokens)R(this,k,"f").stopPollingByPollingToken(e);for(const e of t.detectionPollingTokens)R(this,b,"f").stopPollingByPollingToken(e);R(this,m,"f").delete(e),V("Unsubscribed and stopped polling",{subscriptionId:e})}}destroy(){V("Destroying RpcDataSource"),R(this,h,"f")?.call(this),R(this,f,"f")?.call(this),R(this,k,"f").stopAllPolling(),R(this,b,"f").stopAllPolling(),R(this,m,"f").clear(),R(this,d,"f").clear()}}s.RpcDataSource=G,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,k=new WeakMap,b=new WeakMap,n=new WeakSet,g=function(e,t){const s=new W.default(e),n=new W.default(10).pow(t);return s.dividedBy(n).toString()},y=function(e,t){const s={},a=R(this,n,"m",M).call(this);for(const o of e){if(o.assetId.includes("/slip44:")){const e=R(this,u,"f")[t];e&&(s[o.assetId]={type:"native",symbol:e.nativeCurrency,name:e.nativeCurrency,decimals:18})}else{const e=a[o.assetId];if(e)s[o.assetId]=e;else{const e=R(this,n,"m",D).call(this,o.assetId);s[o.assetId]=e||{type:"erc20",symbol:"",name:"",decimals:18}}}}return s},w=function(e){const t={},s=`eip155:${parseInt(e.chainId,16)}`,a=R(this,n,"m",y).call(this,e.balances,s);for(const s of e.balances){const e=a[s.assetId],o=e?.decimals??18,r=R(this,n,"m",g).call(this,s.balance,o);t[s.assetId]={amount:r}}const o={assetsBalance:{[e.accountId]:t},assetsInfo:a};V("Balance update response",{accountId:e.accountId,newBalanceCount:Object.keys(t).length});for(const e of R(this,m,"f").values())e.onAssetsUpdate(o)?.catch(e=>{V("Failed to update assets",{error:e})})},S=function(e){V("Detected new tokens",{count:e.detectedAssets.length});const t={};if(e.detectedAssets.length>0)for(const s of e.detectedAssets)s.symbol&&s.decimals!==undefined&&(t[s.assetId]={type:"erc20",symbol:s.symbol,name:s.name??s.symbol,decimals:s.decimals,image:s.image});const s={};if(e.detectedBalances.length>0)for(const t of e.detectedBalances){const a=e.detectedAssets.find(e=>e.assetId===t.assetId),o=a?.decimals??18,r=R(this,n,"m",g).call(this,t.balance,o);s[t.assetId]={amount:r}}const a={detectedAssets:{[e.accountId]:e.detectedAssets.map(e=>e.assetId)},assetsInfo:t,assetsBalance:{[e.accountId]:s}};for(const e of R(this,m,"f").values())e.onAssetsUpdate(a)?.catch(e=>{V("Failed to update detected assets",{error:e})})},A=function(){R(this,a,"f").subscribe("NetworkController:stateChange",e=>{V("NetworkController state changed"),R(this,n,"m",O).call(this),R(this,n,"m",j).call(this,e)})},v=function(){const e=R(this,a,"f").subscribe("TransactionController:transactionConfirmed",R(this,n,"m",x).bind(this));N(this,h,"function"==typeof e?e:undefined,"f");const t=R(this,a,"f").subscribe("TransactionController:incomingTransactionsReceived",R(this,n,"m",_).bind(this));N(this,f,"function"==typeof t?t:undefined,"f")},x=function(e){const t=e?.chainId;if(!t)return;const s=`eip155:${parseInt(t,16)}`;R(this,n,"m",C).call(this,[s]).catch(e=>{V("Failed to refresh balance after transaction confirmed",{error:e})})},_=function(e){const t=Array.from(new Set((e??[]).map(e=>e?.chainId).filter(e=>Boolean(e)))).map(e=>`eip155:${parseInt(e,16)}`),s=t.length>0?t:[...R(this,l,"f")];R(this,n,"m",C).call(this,s).catch(e=>{V("Failed to refresh balance after incoming transactions",{error:e})})},C=async function(e){const t=new Set(e);if(0!==e.filter(e=>R(this,l,"f").includes(e)).length)for(const e of R(this,m,"f").values()){const s=e.chains.filter(e=>t.has(e));if(0===s.length)continue;const n={accountsWithSupportedChains:e.accounts.map(e=>({account:e,supportedChains:s})),chainIds:s,dataTypes:["balance"]};try{const t=await this.fetch(n);t.assetsBalance&&Object.keys(t.assetsBalance).length>0&&e.onAssetsUpdate(t)?.catch(e=>{V("Failed to report balance update after transaction",{error:e})})}catch(e){V("Failed to fetch balance after transaction",{chains:s,error:e})}}},T=function(){V("Initializing from NetworkController");try{const e=R(this,a,"f").call("NetworkController:getState");R(this,n,"m",j).call(this,e)}catch(e){V("Failed to initialize from NetworkController",e)}},j=function(e){const{networkConfigurationsByChainId:t,networksMetadata:s}=e,n={},a=[];for(const[e,o]of Object.entries(t)){const t=`eip155:${parseInt(e,16)}`,r=o.rpcEndpoints[o.defaultRpcEndpointIndex];if(!r)continue;const{networkClientId:i}=r,c=s[i],l=c?.status??"unknown";n[t]={chainId:t,status:l,name:o.name,nativeCurrency:o.nativeCurrency,networkClientId:i},"available"!==l&&"unknown"!==l||a.push(t)}V("Network state updated",{configuredChains:Object.keys(n),activeChains:a});const r=[...R(this,l,"f")],i=new Set(r),c=r.length!==a.length||a.some(e=>!i.has(e));N(this,u,n,"f"),N(this,l,a,"f"),this.state.activeChains=a,c&&R(this,o,"f").call(this,this.getName(),a,r)},E=function(e){const t=R(this,d,"f").get(e);if(t)return t;const s=R(this,u,"f")[e];if(!s)return undefined;try{const t=R(this,a,"f").call("NetworkController:getNetworkClientById",s.networkClientId);if(!t?.provider)return undefined;const n=new L.Web3Provider(t.provider);return R(this,d,"f").set(e,n),n}catch(t){return V("Failed to get provider for chain",{chainId:e,error:t}),undefined}},I=function(e){const t=`eip155:${parseInt(e,16)}`,s=R(this,n,"m",E).call(this,t);if(!s)throw new Error(`No provider available for chain ${e}`);return{call:async e=>s.call({to:e.to,data:e.data}),getBalance:async e=>await s.getBalance(e)}},O=function(){R(this,d,"f").clear()},P=function(e){const{nativeAssetIdentifiers:t}=R(this,a,"f").call("NetworkEnablementController:getState");return t[e]??`${e}/slip44:60`},M=function(){try{return R(this,a,"f").call("AssetsController:getState").assetsInfo??{}}catch{return{}}},D=function(e){try{const t=(0,U.parseCaipAssetType)(e);if("erc20"!==t.assetNamespace)return undefined;const s=t.assetReference,{reference:n}=(0,U.parseCaipChainId)(t.chainId),o=(0,U.numberToHex)(parseInt(n,10)),r=R(this,a,"f").call("TokenListController:getState"),i=r?.tokensChainsCache?.[o],c=i?.data;if(!c)return undefined;const l=s.toLowerCase();for(const[e,t]of Object.entries(c))if(e.toLowerCase()===l){const e=t;if(e.symbol&&e.decimals!==undefined)return{type:"erc20",symbol:e.symbol,name:e.name??e.symbol,decimals:e.decimals,image:e.iconUrl}}return undefined}catch{return undefined}},s.createRpcDataSource=function(e){return new G(e)}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","@metamask/keyring-snap-client":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-snap-client/dist/index.cjs","@metamask/snaps-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-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,o,r,i,c,l,u,d,m,h,f,p,k=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},b=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.createSnapDataSource=s.SnapDataSource=s.extractChainFromAssetId=s.getChainIdsCaveat=s.ASSETS_PERMISSION=s.KEYRING_PERMISSION=s.SNAP_DATA_SOURCE_NAME=void 0;const g=e("@metamask/keyring-snap-client"),y=e("@metamask/snaps-utils"),w=e("@metamask/utils"),S=e("./AbstractDataSource.cjs"),A=e("../logger.cjs"),v=(0,A.createModuleLogger)(A.projectLogger,"SnapDataSource");function x(e){if(!e?.caveats)return null;const t=e.caveats.find(e=>e.type===y.SnapCaveatType.ChainIds);return t?t.value:null}function _(e){return(0,w.parseCaipAssetType)(e).chainId}s.SNAP_DATA_SOURCE_NAME="SnapDataSource",s.KEYRING_PERMISSION="endowment:keyring",s.ASSETS_PERMISSION="endowment:assets",s.getChainIdsCaveat=x,s.extractChainFromAssetId=_;const C={activeChains:[],chainToSnap:{}};class T extends S.AbstractDataSource{constructor(e){super(s.SNAP_DATA_SOURCE_NAME,{...C,...e.state}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,new Map),k(this,a,e.messenger,"f"),k(this,o,e.onActiveChainsUpdated,"f"),k(this,r,b(this,n,"m",u).bind(this),"f"),k(this,i,b(this,n,"m",f).bind(this),"f"),b(this,n,"m",l).call(this),b(this,n,"m",f).call(this)}async fetch(e){var t;if(!e?.chainIds?.length)return{};if(!e?.accountsWithSupportedChains?.length)return{assetsBalance:{},assetsInfo:{}};const s={assetsBalance:{},assetsInfo:{}};for(const{account:a}of e.accountsWithSupportedChains){const o=a.metadata.snap?.id;if(!o)continue;if(!e.chainIds.some(e=>this.state.chainToSnap[e]===o))continue;const r=a.id;try{const e=b(this,n,"m",p).call(this,o),a=await e.listAccountAssets(r);if(!a||0===a.length)continue;const i=await e.getAccountBalances(r,a);if(i&&"object"==typeof i&&s.assetsBalance)for(const[e,n]of Object.entries(i)){(t=s.assetsBalance)[r]??(t[r]={});const a=s.assetsBalance[r];a&&(a[e]={amount:n.amount})}}catch{}}return s}get assetsMiddleware(){return async(e,t)=>{var s;const{request:n}=e,a=n.chainIds.filter(e=>this.state.activeChains.includes(e));if(0===a.length)return t(e);let o=[];try{const t=await this.fetch({...n,chainIds:a});if(t.assetsBalance){(s=e.response).assetsBalance??(s.assetsBalance={});for(const[s,n]of Object.entries(t.assetsBalance))e.response.assetsBalance[s]={...e.response.assetsBalance[s],...n}}t.assetsInfo&&(e.response.assetsInfo={...e.response.assetsInfo,...t.assetsInfo}),t.assetsPrice&&(e.response.assetsPrice={...e.response.assetsPrice,...t.assetsPrice});const r=new Set(Object.keys(t.errors??{}));o=a.filter(e=>!r.has(e))}catch(e){v("Middleware fetch failed",{error:e}),o=[]}let r=e;if(o.length>0){const t=n.chainIds.filter(e=>!o.includes(e));r={...e,request:{...n,chainIds:t}}}return t(r)}}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:a}=e;if(!t?.chainIds)return;const o=t.chainIds.filter(e=>b(this,n,"m",d).call(this,e));if(0!==o.length){if(a){const e=this.activeSubscriptions.get(s);if(e)return e.chains=o,void this.fetch({...t,chainIds:o}).then(async t=>(Object.keys(t.assetsBalance??{}).length>0&&await e.onAssetsUpdate(t),t)).catch(e=>{v("Subscription update fetch failed",{subscriptionId:s,error:e})})}await this.unsubscribe(s),this.activeSubscriptions.set(s,{cleanup:()=>{},chains:o,onAssetsUpdate:e.onAssetsUpdate});try{const e=await this.fetch({...t,chainIds:o}),n=this.activeSubscriptions.get(s);Object.keys(e.assetsBalance??{}).length>0&&n&&await n.onAssetsUpdate(e)}catch(e){v("Initial fetch failed",{subscriptionId:s,error:e})}}}destroy(){const e=b(this,a,"f");try{e.unsubscribe("AccountsController:accountBalancesUpdated",b(this,r,"f"))}catch(e){v("Failed to unsubscribe from snap keyring events",{error:e})}try{e.unsubscribe("PermissionController:stateChange",b(this,i,"f"))}catch(e){v("Failed to unsubscribe from permission changes",{error:e})}for(const[e]of this.activeSubscriptions)this.unsubscribe(e).catch(()=>{});b(this,c,"f").clear()}}s.SnapDataSource=T,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,n=new WeakSet,l=function(){const e=b(this,a,"f");e.subscribe("AccountsController:accountBalancesUpdated",b(this,r,"f")),e.subscribe("PermissionController:stateChange",b(this,i,"f"))},u=function(e){let t;for(const[s,a]of Object.entries(e.balances)){let e;for(const[t,s]of Object.entries(a)){let a;try{a=_(t)}catch(e){v("Skipping snap balance for malformed asset ID",{assetId:t,error:e});continue}b(this,n,"m",d).call(this,a)&&(e??(e={}),e[t]={amount:s.amount})}e&&(t??(t={}),t[s]=e)}if(t){const e={assetsBalance:t};for(const t of this.activeSubscriptions.values())t.onAssetsUpdate(e)?.catch(console.error)}},d=function(e){return this.state.activeChains.includes(e)},m=function(){try{return b(this,a,"f").call("SnapController:getRunnableSnaps")}catch(e){return v("Failed to get runnable snaps",e),[]}},h=function(e){try{return b(this,a,"f").call("PermissionController:getPermissions",e)}catch(t){return v("Failed to get permissions for snap",{snapId:e,error:t}),undefined}},f=function(){try{const e=b(this,n,"m",m).call(this),t={},a=[];for(const o of e){const e=b(this,n,"m",h).call(this,o.id);if(!e?.[s.KEYRING_PERMISSION])continue;const r=x(e[s.ASSETS_PERMISSION]);if(r)for(const e of r)e in t||(t[e]=o.id,a.push(e))}this.state.chainToSnap=t;try{const e=[...this.state.activeChains];this.updateActiveChains(a,t=>{b(this,o,"f").call(this,this.getName(),t,e)})}catch{}}catch(e){v("Keyring snap discovery failed",{error:e}),this.state.chainToSnap={};try{const e=[...this.state.activeChains];this.updateActiveChains([],t=>{b(this,o,"f").call(this,this.getName(),t,e)})}catch{}}},p=function(e){const t=b(this,c,"f").get(e);if(t)return t;const s=new g.KeyringClient({send:async t=>await b(this,a,"f").call("SnapController:handleRequest",{snapId:e,origin:"metamask",handler:y.HandlerType.OnKeyringRequest,request:t})});return b(this,c,"f").set(e,s),s},s.createSnapDataSource=function(e){return new T(e)}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/StakedBalanceDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","./evm-rpc-services/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,o,r,i,c,l,u,d,m,h,f,p,k,b,g,y,w,S,A,v,x,_,C,T,j=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},E=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.StakedBalanceDataSource=void 0;const I=e("@ethereumjs/util"),O=e("@ethersproject/providers"),P=e("@metamask/utils"),M=e("./AbstractDataSource.cjs"),D=e("./evm-rpc-services/index.cjs"),N=e("../logger.cjs"),R="StakedBalanceDataSource",B={type:"erc20",name:"staked ethereum",symbol:"ETH",decimals:18},L=(0,N.createModuleLogger)(N.projectLogger,R);function F(e){if((0,P.isStrictHexString)(e))return e;if((0,P.isCaipChainId)(e)){const t=(0,P.parseCaipChainId)(e).reference;return(0,P.numberToHex)(parseInt(t,10))}throw new Error("caipChainIdToHex - Failed to provide CAIP-2 or Hex chainId")}function U(e,t){return`${e}/erc20:${(0,I.toChecksumAddress)(t)}`}class W extends M.AbstractDataSource{constructor(e){super(R,{activeChains:[]}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,new Map),u.set(this,new Map),d.set(this,void 0),m.set(this,undefined),h.set(this,undefined),f.set(this,undefined),p.set(this,undefined),j(this,a,e.messenger,"f"),j(this,o,e.onActiveChainsUpdated,"f"),j(this,r,e.pollInterval??18e4,"f"),j(this,i,!1!==e.enabled,"f"),j(this,d,(0,D.getSupportedStakingChainIds)(),"f"),L("Initializing StakedBalanceDataSource",{enabled:E(this,i,"f"),pollInterval:E(this,r,"f")}),j(this,c,new D.StakedBalanceFetcher({pollingInterval:E(this,r,"f"),getNetworkProvider:e=>E(this,n,"m",C).call(this,e)}),"f"),E(this,c,"f").setOnStakedBalanceUpdate(E(this,n,"m",T).bind(this));const t=E(this,a,"f").subscribe("TransactionController:transactionConfirmed",E(this,n,"m",y).bind(this));j(this,m,"function"==typeof t?t:undefined,"f");const s=E(this,a,"f").subscribe("TransactionController:incomingTransactionsReceived",E(this,n,"m",w).bind(this));j(this,h,"function"==typeof s?s:undefined,"f");const g=E(this,a,"f").subscribe("NetworkController:stateChange",E(this,n,"m",k).bind(this));j(this,f,"function"==typeof g?g:undefined,"f");const S=E(this,a,"f").subscribe("NetworkEnablementController:stateChange",E(this,n,"m",b).bind(this));j(this,p,"function"==typeof S?S:undefined,"f"),E(this,n,"m",x).call(this)}async refreshStakedBalance(){if(!E(this,i,"f"))return;const e=E(this,n,"m",A).call(this);e.length>0&&await E(this,n,"m",v).call(this,e)}async fetch(e){var t;if(!E(this,i,"f"))return{};const s={},n=new Set(this.state.activeChains),a=e.chainIds.filter(e=>n.has(e));if(0===a.length)return s;const o={};for(const{account:s,supportedChains:n}of e.accountsWithSupportedChains){const e=a.filter(e=>n.includes(e));for(const n of e)try{const e=F(n),a=(0,D.getStakingContractAddress)(e);if(!a)continue;const r={chainId:e,accountId:s.id,accountAddress:s.address},i=await E(this,c,"f").fetchStakedBalance(r);o[t=s.id]??(o[t]={});const l=U(n,a);o[s.id][l]={amount:i.amount}}catch(e){L("Failed to fetch staked balance",{chainId:n,accountId:s.id,error:e})}}if(Object.keys(o).length>0){s.assetsBalance=o;const e=new Set;for(const t of Object.values(o))for(const s of Object.keys(t))e.add(s);s.assetsInfo={};for(const t of e)s.assetsInfo[t]=B}return s}get assetsMiddleware(){return async(e,t)=>{var s,n;if(!E(this,i,"f"))return t(e);const{request:a}=e;if(!a.dataTypes.includes("balance"))return t(e);if(0===a.chainIds.length)return t(e);try{const t=await this.fetch(a);if(t.assetsInfo&&((s=e.response).assetsInfo??(s.assetsInfo={}),Object.assign(e.response.assetsInfo,t.assetsInfo)),t.assetsBalance){(n=e.response).assetsBalance??(n.assetsBalance={});for(const[s,n]of Object.entries(t.assetsBalance))e.response.assetsBalance[s]={...e.response.assetsBalance[s],...n}}}catch(e){L("Middleware fetch failed",{error:e})}return t(e)}}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:n}=e,a=new Set(this.state.activeChains),o=t.chainIds.filter(e=>a.has(e));if(L("Subscribe requested",{subscriptionId:s,isUpdate:n,chainsToSubscribe:o}),0===o.length)return void L("No staking chains to subscribe");if(n){E(this,l,"f").get(s)&&L("Updating existing subscription - restarting polling",{subscriptionId:s})}await this.unsubscribe(s);const r=t.accountsWithSupportedChains.map(({account:e,supportedChains:t})=>({account:e,supportedChains:o.filter(e=>t.includes(e))})).filter(({supportedChains:e})=>e.length>0),i=r.map(e=>e.account),u=[];E(this,l,"f").set(s,{pollingTokens:u,chains:o,accounts:i,accountsWithSupportedChains:r,onAssetsUpdate:e.onAssetsUpdate}),this.activeSubscriptions.set(s,{cleanup:()=>{for(const e of u)E(this,c,"f").stopPollingByPollingToken(e);E(this,l,"f").delete(s)},chains:o,request:t,onAssetsUpdate:e.onAssetsUpdate});for(const{account:e,supportedChains:s}of t.accountsWithSupportedChains){const t=o.filter(e=>s.includes(e));for(const s of t){const t={chainId:F(s),accountId:e.id,accountAddress:e.address},n=E(this,c,"f").startPolling(t);u.push(n)}}try{const t={accountsWithSupportedChains:r,chainIds:o,dataTypes:["balance"]},s=await this.fetch(t);s.assetsBalance&&Object.keys(s.assetsBalance).length>0&&e.onAssetsUpdate?.(s)?.catch(e=>{L("Initial staked balance update failed",{error:e})})}catch(e){L("Initial staked balance fetch failed",{error:e})}L("Subscription SUCCESS",{subscriptionId:s,chains:o,pollingCount:u.length})}async unsubscribe(e){const t=E(this,l,"f").get(e);if(t){for(const e of t.pollingTokens)E(this,c,"f").stopPollingByPollingToken(e);E(this,l,"f").delete(e)}await super.unsubscribe(e)}destroy(){E(this,m,"f")?.call(this),E(this,h,"f")?.call(this),E(this,f,"f")?.call(this),E(this,p,"f")?.call(this);for(const e of E(this,l,"f").values())for(const t of e.pollingTokens)E(this,c,"f").stopPollingByPollingToken(t);E(this,l,"f").clear(),E(this,u,"f").clear(),super.destroy()}}s.StakedBalanceDataSource=W,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,n=new WeakSet,k=function(){E(this,u,"f").clear(),L("Provider cache cleared after network state change")},b=function(e){const{enabledNetworkMap:t}=e??{};t&&E(this,n,"m",_).call(this,t)},g=function(e){const t=e?.chainId;if(!t)return!1;const s=(0,D.getStakingContractAddress)(t);if(!s)return!1;const n=s.toLowerCase(),a=e.txParams?.from?.toLowerCase(),o=e.txParams?.to?.toLowerCase();return a===n||o===n},y=function(e){if(!E(this,i,"f"))return;if(!E(this,n,"m",g).call(this,e))return;const t=e?.chainId;if(!t)return;const s=`eip155:${parseInt(t,16)}`,a=E(this,n,"m",S).call(this,[s]);a.length>0&&E(this,n,"m",v).call(this,a).catch(e=>{L("Failed to refresh staked balance after transaction",{error:e})})},w=function(e){if(!E(this,i,"f"))return;const t=new Set;for(const s of e??[])s?.chainId&&E(this,n,"m",g).call(this,s)&&t.add(s.chainId);const s=[...t].map(e=>`eip155:${parseInt(e,16)}`);if(0===s.length)return;const a=E(this,n,"m",S).call(this,s);a.length>0&&E(this,n,"m",v).call(this,a).catch(e=>{L("Failed to refresh staked balance after incoming transactions",{error:e})})},S=function(e){const t=[],s=new Set(e);for(const e of E(this,l,"f").values())for(const{account:n,supportedChains:a}of e.accountsWithSupportedChains)for(const e of a)s.has(e)&&t.push({account:n,chainId:e});return t},A=function(){const e=[];for(const t of E(this,l,"f").values())for(const{account:s,supportedChains:n}of t.accountsWithSupportedChains)for(const t of n)e.push({account:s,chainId:t});return e},v=async function(e){const t={},s={};for(const{account:n,chainId:a}of e)try{const e=F(a),o=(0,D.getStakingContractAddress)(e);if(!o)continue;const r={chainId:e,accountId:n.id,accountAddress:n.address},i=await E(this,c,"f").fetchStakedBalance(r),l=U(a,o);t[l]=B;const u=s[n.id];s[n.id]={...u,[l]:{amount:i.amount}}}catch(e){L("Failed to fetch staked balance in transaction refresh",{chainId:a,accountId:n.id,error:e})}if(Object.keys(s).length>0){const e={assetsInfo:t,assetsBalance:s};for(const t of E(this,l,"f").values())t.onAssetsUpdate(e)?.catch(e=>{L("Failed to report staked balance update after transaction",{error:e})})}},x=function(){try{const e=E(this,a,"f").call("NetworkEnablementController:getState");E(this,n,"m",_).call(this,e?.enabledNetworkMap??{})}catch(e){L("Failed to get NetworkEnablementController state",{error:e}),E(this,n,"m",_).call(this,{})}},_=function(e){if(!E(this,i,"f")){const e=[...this.state.activeChains];return void this.updateActiveChains([],t=>E(this,o,"f").call(this,this.getName(),t,e))}const t=[],s=e.eip155;if(s)for(const e of E(this,d,"f")){if(!(0,P.isCaipChainId)(e))continue;const{reference:n}=(0,P.parseCaipChainId)(e);s[(0,P.numberToHex)(parseInt(n,10))]&&t.push(e)}const n=[...this.state.activeChains];this.updateActiveChains(t,e=>E(this,o,"f").call(this,this.getName(),e,n))},C=function(e){const t=E(this,u,"f").get(e);if(t)return t;try{const t=E(this,a,"f").call("NetworkController:getState"),{networkConfigurationsByChainId:s}=t;if(!s)return undefined;const n=s[e];if(!n)return undefined;const{rpcEndpoints:o,defaultRpcEndpointIndex:r}=n;if(!o||0===o.length)return undefined;const i=o["number"==typeof r&&r>=0&&r<o.length?r:0],c=i?.networkClientId;if(!c)return undefined;const l=E(this,a,"f").call("NetworkController:getNetworkClientById",c);if(!l?.provider)return undefined;const d=new O.Web3Provider(l.provider);return E(this,u,"f").set(e,d),d}catch(t){return L("Failed to get provider for chain",{hexChainId:e,error:t}),undefined}},T=function(e){const t=(0,D.getStakingContractAddress)(e.chainId);if(!t)return;const s=`eip155:${parseInt(e.chainId,16)}`,n=U(s,t),a={assetsInfo:{[n]:B},assetsBalance:{[e.accountId]:{[n]:{amount:e.balance.amount}}}};L("Staked balance update",{accountId:e.accountId,chainId:s,amount:e.balance.amount});for(const e of E(this,l,"f").values())e.onAssetsUpdate(a)?.catch(e=>{L("Failed to report staked balance update",{error:e})})}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/StakedBalanceDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/types.cjs","./evm-rpc-services/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs","@metamask/core-backend":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/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,o,r,i=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},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.TokenDataSource=void 0;e("@metamask/core-backend");const l=e("@metamask/utils"),u=e("./evm-rpc-services/index.cjs"),d=e("../logger.cjs"),m=e("../types.cjs"),h="TokenDataSource",f=(0,d.createModuleLogger)(d.projectLogger,h);function p(e,t){const s=(0,l.parseCaipAssetType)(e);let n="erc20";"slip44"===s.assetNamespace?n="native":"spl"===s.assetNamespace&&(n="spl");return{type:n,name:t.name,symbol:t.symbol,decimals:t.decimals,image:t.iconUrl,coingeckoId:t.coingeckoId,occurrences:t.occurrences,aggregators:t.aggregators,labels:t.labels,erc20Permit:t.erc20Permit,fees:t.fees,honeypotStatus:t.honeypotStatus,storage:t.storage,isContractVerified:t.isContractVerified,description:t.description}}s.TokenDataSource=class{getName(){return this.name}constructor(e){n.add(this),this.name=h,a.set(this,void 0),i(this,a,e.queryApiClient,"f")}get assetsMiddleware(){return(0,m.forDataTypes)(["metadata"],async(e,t)=>{const{response:s}=e;if(!s.detectedAssets)return t(e);const{assetsInfo:i}=e.getAssetsState(),l=new Set;for(const e of Object.values(s.detectedAssets))for(const t of e){const e=s.assetsInfo?.[t];if(e?.image)continue;const n=i[t];n?.image||((0,u.isStakingContractAssetId)(t)||l.add(t))}if(0===l.size)return t(e);const d=await c(this,n,"m",o).call(this),m=c(this,n,"m",r).call(this,[...l],d);if(0===m.length)return t(e);try{const e=await c(this,a,"f").tokens.fetchV3Assets(m,{includeIconUrl:!0,includeMarketData:!0,includeMetadata:!0,includeLabels:!0,includeRwaData:!0});s.assetsInfo??(s.assetsInfo={});for(const t of e){const e=t.assetId;s.assetsInfo[e]=p(t.assetId,t)}}catch(e){f("Failed to fetch metadata",{error:e})}return t(e)})}},a=new WeakMap,n=new WeakSet,o=async function(){try{const e=await c(this,a,"f").tokens.fetchTokenV2SupportedNetworks(),t=[...e.fullSupport,...e.partialSupport];return new Set(t)}catch(e){return f("Failed to fetch supported networks",{error:e}),new Set}},r=function(e,t){return e.filter(e=>{try{const s=(0,l.parseCaipAssetType)(e),n=`${s.chain.namespace}:${s.chain.reference}`;return t.has(n)}catch{return!1}})}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs",{"../utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs","@ethersproject/abi":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/abi/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,o,r,i,c,l=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},u=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.MulticallClient=s.decodeAggregate3Response=s.encodeAggregate3=void 0;const d=e("@ethersproject/abi"),m=e("../utils/index.cjs"),h=new d.Interface([{name:"aggregate3",type:"function",stateMutability:"payable",inputs:[{name:"calls",type:"tuple[]",components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}]}],outputs:[{name:"returnData",type:"tuple[]",components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}]}]},{name:"getEthBalance",type:"function",stateMutability:"view",inputs:[{name:"addr",type:"address"}],outputs:[{name:"balance",type:"uint256"}]}]),f=new d.Interface([{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"balance",type:"uint256"}]}]),p="0x0000000000000000000000000000000000000000",k={"0x1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3":"0xcA11bde05977b3631167028862bE2a173976CA11","0xaa36a7":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4268":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5e9":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b6e6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18fc4a":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa":"0xcA11bde05977b3631167028862bE2a173976CA11","0x45":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1a4":"0xcA11bde05977b3631167028862bE2a173976CA11","0xaa37dc":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa4b1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa4ba":"0xcA11bde05977b3631167028862bE2a173976CA11","0x66eed":"0xcA11bde05977b3631167028862bE2a173976CA11","0x66eee":"0xcA11bde05977b3631167028862bE2a173976CA11","0x66eeb":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15f2249":"0xcA11bde05977b3631167028862bE2a173976CA11","0x89":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13881":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13882":"0xcA11bde05977b3631167028862bE2a173976CA11","0x44d":"0xca11bde05977b3631167028862be2a173976ca11","0x5a2":"0xca11bde05977b3631167028862be2a173976ca11","0x98a":"0xca11bde05977b3631167028862be2a173976ca11","0x64":"0xcA11bde05977b3631167028862bE2a173976CA11","0x27d8":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa86a":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa869":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfa2":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfa":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfaf0":"0xca11bde05977b3631167028862be2a173976ca11","0x38":"0xcA11bde05977b3631167028862bE2a173976CA11","0x61":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15eb":"0xcA11bde05977b3631167028862bE2a173976CA11","0xcc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x504":"0xcA11bde05977b3631167028862bE2a173976CA11","0x505":"0xcA11bde05977b3631167028862bE2a173976CA11","0x507":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2a15c308d":"0xca11bde05977b3631167028862be2a173976ca11","0x2a15c3083":"0xca11bde05977b3631167028862be2a173976ca11","0x63564c40":"0xcA11bde05977b3631167028862bE2a173976CA11","0x19":"0xcA11bde05977b3631167028862bE2a173976CA11","0x152":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5535072":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6c1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7a":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13":"0xcA11bde05977b3631167028862bE2a173976CA11","0x10":"0xcA11bde05977b3631167028862bE2a173976CA11","0x72":"0xcA11bde05977b3631167028862bE2a173976CA11","0x120":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4e454152":"0xcA11bde05977b3631167028862bE2a173976CA11","0x250":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5c2359":"0xcA11bde05977b3631167028862bE2a173976CA11","0xec0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x42":"0xcA11bde05977b3631167028862bE2a173976CA11","0x80":"0xcA11bde05977b3631167028862bE2a173976CA11","0x440":"0xcA11bde05977b3631167028862bE2a173976CA11","0x257":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe9fe":"0xcA11bde05977b3631167028862bE2a173976CA11","0xd3a0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x84444":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2329":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2328":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6c":"0xcA11bde05977b3631167028862bE2a173976CA11","0x12":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa516":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5afe":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa4ec":"0xcA11bde05977b3631167028862bE2a173976CA11","0xaef3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x116ea":"0xcA11bde05977b3631167028862bE2a173976CA11","0x116e9":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2019":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3e9":"0xca11bde05977b3631167028862be2a173976ca11","0x7d1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x141":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4d2":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1e14":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1e15":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1251":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7f08":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8ae":"0xcA11bde05977b3631167028862bE2a173976CA11","0x138b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1389":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1388":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f92":"0xcA11bde05977b3631167028862bE2a173976CA11","0x14a33":"0xca11bde05977b3631167028862be2a173976ca11","0x14a34":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2105":"0xca11bde05977b3631167028862be2a173976ca11","0x936":"0xcA11bde05977b3631167028862bE2a173976CA11","0xff":"0xcA11bde05977b3631167028862bE2a173976CA11","0x46a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x46b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x14f":"0xcA11bde05977b3631167028862bE2a173976CA11","0xd2af":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe9ac0ce":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe705":"0xca11bde05977b3631167028862be2a173976ca11","0xe704":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe708":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2b6f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x39":"0xcA11bde05977b3631167028862bE2a173976CA11","0x23a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1644":"0xcA11bde05977b3631167028862bE2a173976CA11","0xdea8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3af":"0xcA11bde05977b3631167028862bE2a173976CA11","0x171":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3e7":"0xcA11bde05977b3631167028862bE2a173976CA11","0x76adf1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3b9ac9ff":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2c":"0xca11bde05977b3631167028862be2a173976ca11","0x2e":"0xca11bde05977b3631167028862be2a173976ca11","0x15b3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x82751":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8274f":"0xca11bde05977b3631167028862be2a173976ca11","0x82750":"0xcA11bde05977b3631167028862bE2a173976CA11","0x96f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3cc5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4571":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe99":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7d0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1297":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1d5e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3a14269b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x561bf78b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x235ddd0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3cd156dc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5d456c62":"0xcA11bde05977b3631167028862bE2a173976CA11","0x79f99296":"0xcA11bde05977b3631167028862bE2a173976CA11","0x585eb4b1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x507aaa2a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1fc3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x32d":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a73":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a72":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a71":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe9ac0d6":"0xca11bde05977b3631167028862be2a173976ca11","0x1069":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7e5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x53":"0xca11bde05977b3631167028862be2a173976ca11","0x52":"0xca11bde05977b3631167028862be2a173976ca11","0xe298":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1a8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x94":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2c6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2803":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2802":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa9":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c5f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c60":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4cb2f":"0xdbfa261cd7d17bb40479a0493ad6c0fee435859e","0x7f93":"0xcA11bde05977b3631167028862bE2a173976CA11","0xb660":"0xcA11bde05977b3631167028862bE2a173976CA11","0xb02113d3f":"0xcA11bde05977b3631167028862bE2a173976CA11","0xdad":"0xcA11bde05977b3631167028862bE2a173976CA11","0xdae":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15b38":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15b32":"0xcA11bde05977b3631167028862bE2a173976CA11","0x45c":"0xcA11bde05977b3631167028862bE2a173976CA11","0x45b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3d":"0xcA11bde05977b3631167028862bE2a173976CA11","0x41a6ace":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa729":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f47b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b59":"0xca11bde05977b3631167028862be2a173976ca11","0x1b58":"0xcA11bde05977b3631167028862bE2a173976CA11","0xc3":"0xca11bde05977b3631167028862be2a173976ca11","0x16fd8":"0xcA11bde05977b3631167028862bE2a173976CA11","0xc7":"0xca11bde05977b3631167028862be2a173976ca11","0x405":"0xca11bde05977b3631167028862be2a173976ca11","0x334":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1ce":"0xca11bde05977b3631167028862be2a173976ca11","0x1cf":"0xca11bde05977b3631167028862be2a173976ca11","0xa70e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x868b":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa0c71fd":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13e31":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa1337":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f2b":"0xcA11bde05977b3631167028862bE2a173976CA11","0xf63":"0xcA11bde05977b3631167028862bE2a173976CA11","0x144":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x118":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x12c":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x18995f":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x2b74":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0xfc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x9da":"0xcA11bde05977b3631167028862bE2a173976CA11","0x137":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13ed":"0xcA11bde05977b3631167028862bE2a173976CA11","0x24b1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xba9302":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7c8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x138d5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6d":"0xcA11bde05977b3631167028862bE2a173976CA11","0x343b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x34a1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3109":"0xcA11bde05977b3631167028862bE2a173976CA11","0x91b":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa96":"0xcA11bde05977b3631167028862bE2a173976CA11","0x22c3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2be3":"0xcA11bde05977b3631167028862bE2a173976CA11","0xbf03":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b254":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa7b14":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2276":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b9e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6a63bb8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15af3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15af1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xae3f3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x531":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c61":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c58":"0xca11bde05977b3631167028862be2a173976ca11","0x1d88":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5b9b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4c7e1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa53b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1a2b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x406":"0xca11bde05977b3631167028862be2a173976ca11","0x2cef":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18b2":"0xca11bde05977b3631167028862be2a173976ca11","0x182a9":"0xcA11bde05977b3631167028862bE2a173976CA11","0xc4":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfdd":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfde":"0xcA11bde05977b3631167028862bE2a173976CA11","0x99c0a0f":"0xca11bde05977b3631167028862be2a173976ca11","0x22cf":"0xcA11bde05977b3631167028862bE2a173976CA11","0x310c5":"0xca11bde05977b3631167028862be2a173976ca11","0x46f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x659":"0xca11bde05977b3631167028862be2a173976ca11","0x139c968f9":"0xcA11bde05977b3631167028862bE2a173976CA11","0xed88":"0xcA11bde05977b3631167028862bE2a173976CA11","0xd036":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x31bf8c3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1cbc67bfdc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x98967f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4f588":"0xcA11bde05977b3631167028862bE2a173976CA11","0x16db":"0xca11bde05977b3631167028862be2a173976ca11","0x3a":"0xca11bde05977b3631167028862be2a173976ca11","0x59":"0xca11bde05977b3631167028862be2a173976ca11","0x1e0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2eb":"0xcA11bde05977b3631167028862bE2a173976CA11","0x221":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6f0":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa867":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2611":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15f900":"0x6B5eFbC0C82eBb26CA13a4F11836f36Fc6fdBC5D","0x74c":"0xcA11bde05977b3631167028862bE2a173976CA11","0x407b":"0x90a2377F233E3461BACa6080d4837837d8762927","0xa3c3":"0xcA11bde05977b3631167028862bE2a173976CA11","0xab5":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x138de":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18c6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8173":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2ba":"0xcA11bde05977b3631167028862bE2a173976CA11","0x279f":"0xcA11bde05977b3631167028862bE2a173976CA11","0xb67d2":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18232":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x32":"0x0B1795ccA8E4eC4df02346a082df54D437F8D9aF","0x18c7":"0xcA11bde05977b3631167028862bE2a173976CA11","0x10e6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x10b3e":"0x99423C88EB5723A590b4C644426069042f137B9e"};function b(e){return f.encodeFunctionData("balanceOf",[e])}function g(e){return h.encodeFunctionData("aggregate3",[e.map(e=>({target:e.target,allowFailure:e.allowFailure,callData:e.callData}))])}function y(e,t){const s=h.decodeFunctionResult("aggregate3",e)[0];if(s.length!==t)throw new Error(`Expected ${t} results, got ${s.length}`);return s.map(e=>({success:e.success,returnData:e.returnData}))}function w(e){if("0x"===e||e.length<66)return"0";return f.decodeFunctionResult("balanceOf",e)[0].toString()}s.encodeAggregate3=g,s.decodeAggregate3Response=y;s.MulticallClient=class{constructor(e,t){n.add(this),a.set(this,void 0),o.set(this,void 0),l(this,a,e,"f");const s=t?.maxCallsPerBatch!==undefined&&t.maxCallsPerBatch>0?t.maxCallsPerBatch:300,r=t?.timeoutMs!==undefined&&t.timeoutMs>0?t.timeoutMs:3e4;l(this,o,{maxCallsPerBatch:s,timeoutMs:r},"f")}async batchBalanceOf(e,t){if(0===t.length)return[];const s=k[e],o=u(this,a,"f").call(this,e);return s?u(this,n,"m",r).call(this,o,s,t):u(this,n,"m",i).call(this,o,t)}},a=new WeakMap,o=new WeakMap,n=new WeakSet,r=async function(e,t,s){const a=u(this,o,"f").maxCallsPerBatch;return await(0,m.reduceInBatchesSerially)({values:s,batchSize:a,initialResult:[],eachBatch:async(s,a)=>{try{const n=g(a.map(e=>{const s=e.tokenAddress===p;return{target:s?t:e.tokenAddress,allowFailure:!0,callData:s?(n=e.accountAddress,h.encodeFunctionData("getEthBalance",[n])):b(e.accountAddress)};var n})),o=y(await e.call({to:t,data:n}),a.length);for(let e=0;e<a.length;e++){const{tokenAddress:t,accountAddress:n}=a[e],{success:r,returnData:i}=o[e];r&&i&&i.length>2?s.push({tokenAddress:t,accountAddress:n,success:!0,balance:w(i)}):s.push({tokenAddress:t,accountAddress:n,success:!1})}}catch{const t=await Promise.all(a.map(t=>u(this,n,"m",c).call(this,e,t)));for(const e of t)s.push(e)}return s}})},i=async function(e,t){const s=Math.min(u(this,o,"f").maxCallsPerBatch,50);return await(0,m.reduceInBatchesSerially)({values:t,batchSize:s,initialResult:[],eachBatch:async(t,s)=>{const a=await Promise.all(s.map(t=>u(this,n,"m",c).call(this,e,t)));for(const e of a)t.push(e);return t}})},c=async function(e,t){try{const{tokenAddress:s,accountAddress:n}=t;if(s===p){return{tokenAddress:s,accountAddress:n,success:!0,balance:(await e.getBalance(n)).toString()}}const a=b(n),o=await e.call({to:s,data:a});return{tokenAddress:s,accountAddress:n,success:!0,balance:w(o)}}catch{return{tokenAddress:t.tokenAddress,accountAddress:t.accountAddress,success:!1}}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/index.cjs",{"./MulticallClient.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.MulticallClient=s.encodeAggregate3=s.decodeAggregate3Response=void 0;var n=e("./MulticallClient.cjs");Object.defineProperty(s,"decodeAggregate3Response",{enumerable:!0,get:function(){return n.decodeAggregate3Response}}),Object.defineProperty(s,"encodeAggregate3",{enumerable:!0,get:function(){return n.encodeAggregate3}}),Object.defineProperty(s,"MulticallClient",{enumerable:!0,get:function(){return n.MulticallClient}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs",{"./clients/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/index.cjs","./services/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/index.cjs","./utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/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.reduceInBatchesSerially=s.divideIntoBatches=s.isStakingContractAssetId=s.getStakingContractAddress=s.getSupportedStakingChainIds=s.StakedBalanceFetcher=s.TokenDetector=s.BalanceFetcher=s.MulticallClient=void 0;var n=e("./clients/index.cjs");Object.defineProperty(s,"MulticallClient",{enumerable:!0,get:function(){return n.MulticallClient}});var a=e("./services/index.cjs");Object.defineProperty(s,"BalanceFetcher",{enumerable:!0,get:function(){return a.BalanceFetcher}}),Object.defineProperty(s,"TokenDetector",{enumerable:!0,get:function(){return a.TokenDetector}}),Object.defineProperty(s,"StakedBalanceFetcher",{enumerable:!0,get:function(){return a.StakedBalanceFetcher}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return a.getSupportedStakingChainIds}}),Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return a.getStakingContractAddress}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return a.isStakingContractAssetId}});var o=e("./utils/index.cjs");Object.defineProperty(s,"divideIntoBatches",{enumerable:!0,get:function(){return o.divideIntoBatches}}),Object.defineProperty(s,"reduceInBatchesSerially",{enumerable:!0,get:function(){return o.reduceInBatchesSerially}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs",{"../utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs","@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,o,r,i,c,l,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},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.BalanceFetcher=void 0;const m=e("@metamask/polling-controller"),h=e("../utils/index.cjs"),f="0x0000000000000000000000000000000000000000";class p extends((0,m.StaticIntervalPollingControllerOnly)()){constructor(e,t,s){super(),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),u(this,a,e,"f"),u(this,o,t,"f"),u(this,r,{defaultBatchSize:s?.defaultBatchSize??300,defaultTimeoutMs:s?.defaultTimeoutMs??3e4,includeNativeByDefault:s?.includeNativeByDefault??!0},"f"),this.setIntervalLength(s?.pollingInterval??3e4)}setOnBalanceUpdate(e){u(this,i,e,"f")}async _executePoll(e){const t=await this.fetchBalances(e.chainId,e.accountId,e.accountAddress);d(this,i,"f")&&t.balances.length>0&&d(this,i,"f").call(this,t)}getTokensToFetch(e,t){const s=d(this,o,"f").call("AssetsController:getState");if(!s?.assetsBalance)return[];const n=s.assetsBalance[t];if(!n)return[];const a=`eip155:${parseInt(e,16)}/`,r=new Map;for(const e of Object.keys(n))if(e.startsWith(a)&&e.includes("/erc20:")){const t=e.split("/erc20:")[1];if(t){const e=t.toLowerCase();r.has(e)||r.set(e,{address:t,decimals:18,symbol:""})}}return Array.from(r.values())}async fetchBalances(e,t,s,n){const a=this.getTokensToFetch(e,t),o=a.map(e=>e.address);return this.fetchBalancesForTokens(e,t,s,o,n,a)}async fetchBalancesForTokens(e,t,s,o,i,l){const u=i?.batchSize??d(this,r,"f").defaultBatchSize,m=i?.includeNative??d(this,r,"f").includeNativeByDefault,p=Date.now(),k=new Map;if(l)for(const e of l)k.set(e.address.toLowerCase(),e);const b=[];m&&b.push({tokenAddress:f,accountAddress:s});for(const e of o)b.push({tokenAddress:e,accountAddress:s});if(0===b.length)return{chainId:e,accountId:t,accountAddress:s,balances:[],failedAddresses:[],timestamp:p};const g=await(0,h.reduceInBatchesSerially)({values:b,batchSize:u,initialResult:{balances:[],failedAddresses:[]},eachBatch:async(s,o)=>{const r=await d(this,a,"f").batchBalanceOf(e,o);return d(this,n,"m",c).call(this,r,s,e,t,p,k)}});return{chainId:e,accountId:t,accountAddress:s,...g,timestamp:p}}}s.BalanceFetcher=p,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,c=function(e,t,s,a,o,r){const{balances:i,failedAddresses:c}=t;for(const t of e){if(!t.success){c.push(t.tokenAddress);continue}const e=t.balance??"0",u=r.get(t.tokenAddress.toLowerCase()),m=u?.decimals??18,h=d(this,n,"m",l).call(this,e,m),p=parseInt(s,16),k=t.tokenAddress.toLowerCase()===f.toLowerCase()?`eip155:${p}/slip44:60`:`eip155:${p}/erc20:${t.tokenAddress.toLowerCase()}`;i.push({assetId:k,accountId:a,chainId:s,balance:e,formattedBalance:h,decimals:m,timestamp:o})}return{balances:i,failedAddresses:c}},l=function(e,t){if("0"===e)return"0";try{const s=BigInt(e),n=BigInt(10**t),a=s/n,o=(s%n).toString().padStart(t,"0").replace(/0+$/u,"");return""===o?a.toString():`${a}.${o}`}catch{return e}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.cjs",{"../utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs","@ethersproject/abi":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/abi/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/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,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},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.StakedBalanceFetcher=s.isStakingContractAssetId=s.getSupportedStakingChainIds=s.getStakingContractAddress=void 0;const i=e("@ethersproject/abi"),c=(e("@ethersproject/providers"),e("@metamask/polling-controller")),l=e("../utils/index.cjs");Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return l.getStakingContractAddress}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return l.getSupportedStakingChainIds}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return l.isStakingContractAssetId}});const u=new i.Interface([{inputs:[{internalType:"address",name:"account",type:"address"}],name:"getShares",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"view",type:"function"}]);class d extends((0,c.StaticIntervalPollingControllerOnly)()){constructor(e){super(),n.set(this,void 0),a.set(this,void 0),o(this,n,e?.getNetworkProvider,"f"),this.setIntervalLength(e?.pollingInterval??18e4)}setOnStakedBalanceUpdate(e){o(this,a,e,"f")}async _executePoll(e){let t;try{t=await this.fetchStakedBalance(e)}catch{return}r(this,a,"f")&&r(this,a,"f").call(this,{accountId:e.accountId,chainId:e.chainId,balance:t})}async fetchStakedBalance(e){const{chainId:t,accountAddress:s}=e,a=r(this,n,"f")?.call(this,t);if(!a)throw new Error("StakedBalanceFetcher: no provider available for chain");const o=(0,l.getStakingContractAddress)(t);if(!o)return{amount:"0"};try{const e=u.encodeFunctionData("getShares",[s]),t=await a.call({to:o,data:e}),n=u.decodeFunctionResult("getShares",t)[0],r=BigInt(n.toString());if(0n===r)return{amount:"0"};const i=u.encodeFunctionData("convertToAssets",[r]),c=await a.call({to:o,data:i}),d=u.decodeFunctionResult("convertToAssets",c)[0],m=BigInt(d.toString());return{amount:(0,l.weiToHumanReadable)(m,18)}}catch(e){throw e instanceof Error?e:new Error("StakedBalanceFetcher: failed to fetch staked balance")}}}s.StakedBalanceFetcher=d,n=new WeakMap,a=new WeakMap}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs",{"../utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs","@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,o,r,i,c,l,u,d,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},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.TokenDetector=void 0;const f=e("@metamask/polling-controller"),p=e("../utils/index.cjs");class k extends((0,f.StaticIntervalPollingControllerOnly)()){constructor(e,t,s){super(),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),m(this,a,e,"f"),m(this,o,t,"f"),m(this,r,{tokenDetectionEnabled:s?.tokenDetectionEnabled??(()=>!0),useExternalService:s?.useExternalService??(()=>!0),defaultBatchSize:s?.defaultBatchSize??300,defaultTimeoutMs:s?.defaultTimeoutMs??3e4},"f"),this.setIntervalLength(s?.pollingInterval??18e4)}setOnDetectionUpdate(e){m(this,i,e,"f")}async _executePoll(e){if(0===this.getTokensToCheck(e.chainId).length)return;const t=await this.detectTokens(e.chainId,e.accountId,e.accountAddress);h(this,i,"f")&&t.detectedAssets.length>0&&h(this,i,"f").call(this,t)}getTokensToCheck(e){const t=h(this,o,"f").call("TokenListController:getState");if(!t?.tokensChainsCache)return[];let s=t.tokensChainsCache[e];if(!s){const n=`0x${parseInt(e,16).toString(16)}`;s=t.tokensChainsCache[n]}const n=s?.data;return n?Object.keys(n):[]}async detectTokens(e,t,s,o){const i=o?.tokenDetectionEnabled??h(this,r,"f").tokenDetectionEnabled(),l=o?.useExternalService??h(this,r,"f").useExternalService();if(!i||!l)return{chainId:e,accountId:t,accountAddress:s,detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[],timestamp:Date.now()};const u=o?.batchSize??h(this,r,"f").defaultBatchSize,d=Date.now(),m=this.getTokensToCheck(e);if(0===m.length)return{chainId:e,accountId:t,accountAddress:s,detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[],timestamp:d};const f=m.map(e=>({tokenAddress:e,accountAddress:s})),k=await(0,p.reduceInBatchesSerially)({values:f,batchSize:u,initialResult:{detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[]},eachBatch:async(s,o)=>{const r=await h(this,a,"f").batchBalanceOf(e,o);return h(this,n,"m",c).call(this,r,s,e,t,d)}});return{chainId:e,accountId:t,accountAddress:s,...k,timestamp:d}}}s.TokenDetector=k,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,c=function(e,t,s,a,o){const{detectedAssets:r,detectedBalances:i,zeroBalanceAddresses:c,failedAddresses:m}=t;for(const t of e){if(!t.success){m.push(t.tokenAddress);continue}const e=t.balance??"0";if("0"===e||""===e){c.push(t.tokenAddress);continue}const f=h(this,n,"m",u).call(this,s,t.tokenAddress),p=h(this,n,"m",d).call(this,s,t.tokenAddress,f);r.push(p);const k=f?.decimals??18,b=h(this,n,"m",l).call(this,e,k);i.push({assetId:p.assetId,accountId:a,chainId:s,balance:e,formattedBalance:b,decimals:k,timestamp:o})}return{detectedAssets:r,detectedBalances:i,zeroBalanceAddresses:c,failedAddresses:m}},l=function(e,t){try{const s=BigInt(e),n=BigInt(10**t),a=s/n,o=(s%n).toString().padStart(t,"0").replace(/0+$/u,"");return""===o?a.toString():`${a}.${o}`}catch{return e}},u=function(e,t){const s=h(this,o,"f").call("TokenListController:getState");if(!s?.tokensChainsCache)return undefined;const n=s.tokensChainsCache[e],a=n?.data;if(!a)return undefined;if(a[t])return a[t];const r=t.toLowerCase();for(const[e,t]of Object.entries(a))if(e.toLowerCase()===r)return t;return undefined},d=function(e,t,s){return{assetId:`eip155:${parseInt(e,16)}/erc20:${t.toLowerCase()}`,chainId:e,address:t,type:"erc20",symbol:s?.symbol,name:s?.name,decimals:s?.decimals,image:s?.iconUrl,isNative:!1,aggregators:s?.aggregators}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/index.cjs",{"./BalanceFetcher.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs","./StakedBalanceFetcher.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.cjs","./TokenDetector.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isStakingContractAssetId=s.getStakingContractAddress=s.getSupportedStakingChainIds=s.StakedBalanceFetcher=s.BalanceFetcher=s.TokenDetector=void 0;var n=e("./TokenDetector.cjs");Object.defineProperty(s,"TokenDetector",{enumerable:!0,get:function(){return n.TokenDetector}});var a=e("./BalanceFetcher.cjs");Object.defineProperty(s,"BalanceFetcher",{enumerable:!0,get:function(){return a.BalanceFetcher}});var o=e("./StakedBalanceFetcher.cjs");Object.defineProperty(s,"StakedBalanceFetcher",{enumerable:!0,get:function(){return o.StakedBalanceFetcher}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return o.getSupportedStakingChainIds}}),Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return o.getStakingContractAddress}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return o.isStakingContractAssetId}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/batch.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e,{batchSize:t}){if(t<=0)throw new Error("batchSize must be greater than 0");const s=[];for(let n=0;n<e.length;n+=t)s.push(e.slice(n,n+t));return s}Object.defineProperty(s,"__esModule",{value:!0}),s.reduceInBatchesSerially=s.divideIntoBatches=void 0,s.divideIntoBatches=n,s.reduceInBatchesSerially=async function({values:e,batchSize:t,eachBatch:s,initialResult:a}){const o=n(e,{batchSize:t});let r=a;for(const[e,t]of o.entries())r=await s(r,t,e);return r}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/batch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs",{"./batch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/batch.cjs","./parsing.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/parsing.cjs","./staking-contracts.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/staking-contracts.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.STAKING_CONTRACT_ADDRESS_BY_CHAINID=s.isStakingContractAssetId=s.getSupportedStakingChainIds=s.getStakingContractAddress=s.weiToHumanReadable=s.chainIdToHex=s.reduceInBatchesSerially=s.divideIntoBatches=void 0;var n=e("./batch.cjs");Object.defineProperty(s,"divideIntoBatches",{enumerable:!0,get:function(){return n.divideIntoBatches}}),Object.defineProperty(s,"reduceInBatchesSerially",{enumerable:!0,get:function(){return n.reduceInBatchesSerially}});var a=e("./parsing.cjs");Object.defineProperty(s,"chainIdToHex",{enumerable:!0,get:function(){return a.chainIdToHex}}),Object.defineProperty(s,"weiToHumanReadable",{enumerable:!0,get:function(){return a.weiToHumanReadable}});var o=e("./staking-contracts.cjs");Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return o.getStakingContractAddress}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return o.getSupportedStakingChainIds}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return o.isStakingContractAssetId}}),Object.defineProperty(s,"STAKING_CONTRACT_ADDRESS_BY_CHAINID",{enumerable:!0,get:function(){return o.STAKING_CONTRACT_ADDRESS_BY_CHAINID}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/parsing.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.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.chainIdToHex=s.weiToHumanReadable=void 0;const a=e("@metamask/utils"),o=n(e("bignumber.js"));s.weiToHumanReadable=function(e,t){const s="bigint"==typeof e?e.toString():e,n=new o.default(s).shiftedBy(-t).toFixed(t).replace(/\.?0+$/u,"");return""===n?"0":n},s.chainIdToHex=function(e){if((0,a.isStrictHexString)(e))return e;if((0,a.isCaipChainId)(e)){const{reference:t}=(0,a.parseCaipChainId)(e);return(0,a.numberToHex)(parseInt(t,10))}return e}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/parsing.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/staking-contracts.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.isStakingContractAssetId=s.getStakingContractAddress=s.getSupportedStakingChainIds=s.STAKING_CONTRACT_ADDRESS_BY_CHAINID=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils");function o(e){const t=function(e){if((0,a.isCaipChainId)(e))return e;const t=(0,a.isStrictHexString)(e)?(0,n.convertHexToDecimal)(e).toString():e;return(0,a.toCaipChainId)(a.KnownCaipNamespace.Eip155,t)}(e);return s.STAKING_CONTRACT_ADDRESS_BY_CHAINID[t]}s.STAKING_CONTRACT_ADDRESS_BY_CHAINID={"eip155:1":"0x4fef9d741011476750a243ac70b9789a63dd47df","eip155:560048":"0xe96ac18cfe5a7af8fe1fe7bc37ff110d88bc67ff"},s.getSupportedStakingChainIds=function(){return Object.keys(s.STAKING_CONTRACT_ADDRESS_BY_CHAINID)},s.getStakingContractAddress=o,s.isStakingContractAssetId=function(e){if(!(0,a.isCaipAssetType)(e))return!1;const t=(0,a.parseCaipAssetType)(e);if("erc20"!==t.assetNamespace)return!1;const s=t.assetReference.toLowerCase(),n=o(t.chainId)?.toLowerCase();return n!==undefined&&s===n}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/staking-contracts.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/index.cjs",{"./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","./AccountsApiDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs","./BackendWebsocketDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs","./PriceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs","./RpcDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs","./SnapDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs","./StakedBalanceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/StakedBalanceDataSource.cjs","./TokenDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.StakedBalanceDataSource=s.extractChainFromAssetId=s.getChainIdsCaveat=s.KEYRING_PERMISSION=s.SNAP_DATA_SOURCE_NAME=s.createSnapDataSource=s.SnapDataSource=s.PriceDataSource=s.TokenDataSource=s.createRpcDataSource=s.RpcDataSource=s.createBackendWebsocketDataSource=s.BackendWebsocketDataSource=s.AccountsApiDataSource=s.AbstractDataSource=void 0;var n=e("./AbstractDataSource.cjs");Object.defineProperty(s,"AbstractDataSource",{enumerable:!0,get:function(){return n.AbstractDataSource}});var a=e("./AccountsApiDataSource.cjs");Object.defineProperty(s,"AccountsApiDataSource",{enumerable:!0,get:function(){return a.AccountsApiDataSource}});var o=e("./BackendWebsocketDataSource.cjs");Object.defineProperty(s,"BackendWebsocketDataSource",{enumerable:!0,get:function(){return o.BackendWebsocketDataSource}}),Object.defineProperty(s,"createBackendWebsocketDataSource",{enumerable:!0,get:function(){return o.createBackendWebsocketDataSource}});var r=e("./RpcDataSource.cjs");Object.defineProperty(s,"RpcDataSource",{enumerable:!0,get:function(){return r.RpcDataSource}}),Object.defineProperty(s,"createRpcDataSource",{enumerable:!0,get:function(){return r.createRpcDataSource}});var i=e("./TokenDataSource.cjs");Object.defineProperty(s,"TokenDataSource",{enumerable:!0,get:function(){return i.TokenDataSource}});var c=e("./PriceDataSource.cjs");Object.defineProperty(s,"PriceDataSource",{enumerable:!0,get:function(){return c.PriceDataSource}});var l=e("./SnapDataSource.cjs");Object.defineProperty(s,"SnapDataSource",{enumerable:!0,get:function(){return l.SnapDataSource}}),Object.defineProperty(s,"createSnapDataSource",{enumerable:!0,get:function(){return l.createSnapDataSource}}),Object.defineProperty(s,"SNAP_DATA_SOURCE_NAME",{enumerable:!0,get:function(){return l.SNAP_DATA_SOURCE_NAME}}),Object.defineProperty(s,"KEYRING_PERMISSION",{enumerable:!0,get:function(){return l.KEYRING_PERMISSION}}),Object.defineProperty(s,"getChainIdsCaveat",{enumerable:!0,get:function(){return l.getChainIdsCaveat}}),Object.defineProperty(s,"extractChainFromAssetId",{enumerable:!0,get:function(){return l.extractChainFromAssetId}});var u=e("./StakedBalanceDataSource.cjs");Object.defineProperty(s,"StakedBalanceDataSource",{enumerable:!0,get:function(){return u.StakedBalanceDataSource}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/index.cjs",{"./AssetsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/AssetsController.cjs","./data-sources/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/index.cjs","./middlewares/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/index.cjs","./selectors/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/selectors/balance.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/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.getInternalAccountsForGroup=s.getGroupIdForAccount=s.getAggregatedBalanceForAccount=s.normalizeAssetId=s.DetectionMiddleware=s.PriceDataSource=s.TokenDataSource=s.extractChainFromAssetId=s.getChainIdsCaveat=s.KEYRING_PERMISSION=s.SNAP_DATA_SOURCE_NAME=s.createSnapDataSource=s.SnapDataSource=s.createRpcDataSource=s.RpcDataSource=s.createBackendWebsocketDataSource=s.BackendWebsocketDataSource=s.AccountsApiDataSource=s.AbstractDataSource=s.getDefaultAssetsControllerState=s.AssetsController=void 0;var n=e("./AssetsController.cjs");Object.defineProperty(s,"AssetsController",{enumerable:!0,get:function(){return n.AssetsController}}),Object.defineProperty(s,"getDefaultAssetsControllerState",{enumerable:!0,get:function(){return n.getDefaultAssetsControllerState}});var a=e("./data-sources/index.cjs");Object.defineProperty(s,"AbstractDataSource",{enumerable:!0,get:function(){return a.AbstractDataSource}});var o=e("./data-sources/index.cjs");Object.defineProperty(s,"AccountsApiDataSource",{enumerable:!0,get:function(){return o.AccountsApiDataSource}});var r=e("./data-sources/index.cjs");Object.defineProperty(s,"BackendWebsocketDataSource",{enumerable:!0,get:function(){return r.BackendWebsocketDataSource}}),Object.defineProperty(s,"createBackendWebsocketDataSource",{enumerable:!0,get:function(){return r.createBackendWebsocketDataSource}});var i=e("./data-sources/index.cjs");Object.defineProperty(s,"RpcDataSource",{enumerable:!0,get:function(){return i.RpcDataSource}}),Object.defineProperty(s,"createRpcDataSource",{enumerable:!0,get:function(){return i.createRpcDataSource}});var c=e("./data-sources/index.cjs");Object.defineProperty(s,"SnapDataSource",{enumerable:!0,get:function(){return c.SnapDataSource}}),Object.defineProperty(s,"createSnapDataSource",{enumerable:!0,get:function(){return c.createSnapDataSource}}),Object.defineProperty(s,"SNAP_DATA_SOURCE_NAME",{enumerable:!0,get:function(){return c.SNAP_DATA_SOURCE_NAME}}),Object.defineProperty(s,"KEYRING_PERMISSION",{enumerable:!0,get:function(){return c.KEYRING_PERMISSION}}),Object.defineProperty(s,"getChainIdsCaveat",{enumerable:!0,get:function(){return c.getChainIdsCaveat}}),Object.defineProperty(s,"extractChainFromAssetId",{enumerable:!0,get:function(){return c.extractChainFromAssetId}});var l=e("./data-sources/index.cjs");Object.defineProperty(s,"TokenDataSource",{enumerable:!0,get:function(){return l.TokenDataSource}}),Object.defineProperty(s,"PriceDataSource",{enumerable:!0,get:function(){return l.PriceDataSource}});var u=e("./middlewares/index.cjs");Object.defineProperty(s,"DetectionMiddleware",{enumerable:!0,get:function(){return u.DetectionMiddleware}});var d=e("./utils.cjs");Object.defineProperty(s,"normalizeAssetId",{enumerable:!0,get:function(){return d.normalizeAssetId}});var m=e("./selectors/balance.cjs");Object.defineProperty(s,"getAggregatedBalanceForAccount",{enumerable:!0,get:function(){return m.getAggregatedBalanceForAccount}}),Object.defineProperty(s,"getGroupIdForAccount",{enumerable:!0,get:function(){return m.getGroupIdForAccount}}),Object.defineProperty(s,"getInternalAccountsForGroup",{enumerable:!0,get:function(){return m.getInternalAccountsForGroup}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-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.projectLogger=void 0;const n=e("@metamask/utils");Object.defineProperty(s,"createModuleLogger",{enumerable:!0,get:function(){return n.createModuleLogger}}),s.projectLogger=(0,n.createProjectLogger)("assets-controller")}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-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.DetectionMiddleware=void 0;const n=e("../logger.cjs"),a=e("../types.cjs"),o="DetectionMiddleware";(0,n.createModuleLogger)(n.projectLogger,o);s.DetectionMiddleware=class{constructor(){this.name=o}getName(){return this.name}get assetsMiddleware(){return(0,a.forDataTypes)(["balance"],async(e,t)=>{const{response:s}=e;if(!s.assetsBalance)return t(e);const{assetsInfo:n}=e.getAssetsState(),a={};for(const[e,t]of Object.entries(s.assetsBalance)){const s=[];for(const e of Object.keys(t))n[e]||s.push(e);s.length>0&&(a[e]=s)}return Object.keys(a).length>0&&(s.detectedAssets=a),t(e)})}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/index.cjs",{"./DetectionMiddleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DetectionMiddleware=void 0;var n=e("./DetectionMiddleware.cjs");Object.defineProperty(s,"DetectionMiddleware",{enumerable:!0,get:function(){return n.DetectionMiddleware}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/middlewares/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/selectors/balance.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.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.getAggregatedBalanceForAccount=s.getInternalAccountsForGroup=s.getGroupIdForAccount=void 0;const a=e("@metamask/controller-utils"),o=e("@metamask/utils"),r=n(e("bignumber.js")),i={price:0,pricePercentChange1d:0},c=e=>{if("object"==typeof e&&null!==e&&"amount"in e){const{amount:t}=e;return"string"==typeof t?t:"0"}return"0"},l=e=>{const t=new r.default(e);return t.isNaN()||!t.isFinite()?new r.default(0):t},u=(e,t)=>{if(t<=0)return e;const s=new r.default(10).pow(t);return e.lt(s)?e:e.dividedBy(s)},d=(e,t)=>{const s=e?.[t];if(!s||"object"!=typeof s)return i;const{price:n,pricePercentChange1d:a}=s;return{price:"number"==typeof n&&Number.isFinite(n)?n:0,pricePercentChange1d:"number"==typeof a&&Number.isFinite(a)?a:0}},m=(e,t)=>{if(!e)return!0;if((0,o.isStrictHexString)(t))return Boolean(e[o.KnownCaipNamespace.Eip155]?.[t]);const{namespace:s,reference:n}=(0,o.parseCaipChainId)(t),r=e[s];if(!r)return!1;if(r[t]||r[n])return!0;if(s===o.KnownCaipNamespace.Eip155)try{const e=(0,a.toHex)(n);return Boolean(r[e])}catch{const e=Number.parseInt(n,10);if(Number.isFinite(e))return Boolean(r[`0x${e.toString(16)}`])}return!1},h=(e,t)=>{const s=e.get(t);if(s)return s;const{chainId:n}=(0,o.parseCaipAssetType)(t),{namespace:a}=(0,o.parseCaipChainId)(n),r={chainId:n,isEvm:a===o.KnownCaipNamespace.Eip155};return e.set(t,r),r};function f(e){const{out:t,accountBalances:s,metadata:n,assetPreferences:a,enabledNetworkMap:o,assetInfoCache:r}=e;for(const e in s){if(!Object.prototype.hasOwnProperty.call(s,e))continue;const i=e;if(a?.[i]?.hidden)continue;const d=h(r,i);if(!m(o,d.chainId))continue;const f=c(s[i]);let p=l(f);const k=n[i];if(k?.decimals!==undefined&&(p=u(p,k.decimals)),p.isZero())continue;const b=t.get(i);b?b.amount=b.amount.plus(p):t.set(i,{amount:p,decimals:k?.decimals,symbol:k?.symbol,name:k?.name})}}function p(e,t){const s=e.accountTree?.wallets;if(!s)return undefined;for(const e of Object.values(s))for(const[s,n]of Object.entries(e?.groups??{})){const e=n?.accounts;if(Array.isArray(e)&&e.includes(t))return s}return undefined}function k(e,t,s){const n=e.accountTree?.wallets;if(!n)return[];const a=e=>e?.groups??{};for(const e of Object.values(n)){const n=a(e)[s];if(!n?.accounts)continue;const o=[];for(const e of n.accounts){const s=t[e];s&&o.push(s)}return o}return[]}function b(e){const{selectedInternalAccount:t,accountTreeState:s,internalAccountsOrAccountIds:n,accountsById:a}=e;if(n&&n.length>0){if("string"==typeof n[0]){const e=n,t=new Array(e.length);for(let s=0;s<e.length;s++)t[s]={id:e[s]};return t}return n}if(s&&a&&Object.keys(a).length>0){const e=p(s,t.id);if(e){const t=k(s,a,e);if(t.length>0)return t}}if(s){const e=function(e,t){const s=p(e,t);if(!s)return undefined;const n=e.accountTree?.wallets;if(!n)return undefined;const a=e=>e?.groups??{};for(const e of Object.values(n)){const t=a(e)[s];if(t?.accounts)return[...t.accounts]}return undefined}(s,t.id);if(e&&e.length>0){const t=new Array(e.length);for(let s=0;s<e.length;s++)t[s]={id:e[s]};return t}}return[t]}s.getGroupIdForAccount=p,s.getInternalAccountsForGroup=k,s.getAggregatedBalanceForAccount=function(e,t,s,n,a,o){const{assetsBalance:r,assetsInfo:i,assetPreferences:c,assetsPrice:l}=e,u=i??{},m=Boolean(l)&&(()=>{for(const e in l)if(Object.prototype.hasOwnProperty.call(l,e))return!0;return!1})(),h=b({selectedInternalAccount:t,accountTreeState:n,internalAccountsOrAccountIds:a,accountsById:o}),p=new Map,k=new Map;for(const e of h){const t=e.id;f({out:k,accountBalances:r?.[t]??{},metadata:u,assetPreferences:c,enabledNetworkMap:s,assetInfoCache:p})}const g=new Array(k.size);let y=0,w=0,S=0;for(const[e,t]of k.entries()){const{amount:s}=t,n={assetId:e,amount:s.toString(),...t.decimals===undefined?{}:{decimals:t.decimals},...t.symbol===undefined?{}:{symbol:t.symbol},...t.name===undefined?{}:{name:t.name}};if(g[y]=n,y+=1,m){const{price:t,pricePercentChange1d:n}=d(l,e),a=s.multipliedBy(t).toNumber();a>0&&(w+=a,S+=a*n)}}if(m){return{entries:g,totalBalanceInFiat:w,pricePercentChange1d:w>0?S/w:0}}return{entries:g}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/selectors/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-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.forDataTypes=void 0,s.forDataTypes=function(e,t){return async(s,n)=>{const a=s.request.dataTypes;return e.some(e=>a.includes(e))?t(s,n):n(s)}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/utils.cjs",{"@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/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.normalizeAssetId=void 0;const n=e("@ethereumjs/util"),a=e("@metamask/utils");s.normalizeAssetId=function(e){const t=(0,a.parseCaipAssetType)(e);if("eip155"===(0,a.parseCaipChainId)(t.chainId).namespace&&"erc20"===t.assetNamespace){const e=(0,n.toChecksumAddress)(t.assetReference);return`${t.chainId}/${t.assetNamespace}:${e}`}return e}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/AccountActivityService.cjs",{"./BackendWebSocketService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/logger.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,o,r,i,c,l,u,d,m,h,f,p,k=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},b=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.AccountActivityService=s.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS=s.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS=void 0;const g=e("./BackendWebSocketService.cjs"),y=e("./logger.cjs"),w="AccountActivityService",S=(0,y.createModuleLogger)(y.projectLogger,w),A=["subscribe","unsubscribe"];s.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS=["AccountsController:getSelectedAccount","BackendWebSocketService:connect","BackendWebSocketService:forceReconnection","BackendWebSocketService:subscribe","BackendWebSocketService:getConnectionInfo","BackendWebSocketService:channelHasSubscription","BackendWebSocketService:getSubscriptionsByChannel","BackendWebSocketService:findSubscriptionsByChannelPrefix","BackendWebSocketService:addChannelCallback","BackendWebSocketService:removeChannelCallback"],s.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS=["AccountsController:selectedAccountChange","BackendWebSocketService:connectionStateChanged"];s.AccountActivityService=class{constructor(e){n.add(this),this.name=w,a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,new Set),k(this,a,e.messenger,"f"),k(this,o,{subscriptionNamespace:e.subscriptionNamespace??"account-activity.v1"},"f"),k(this,r,e.traceFn??((e,t)=>t?.()),"f"),b(this,a,"f").registerMethodActionHandlers(this,A),b(this,a,"f").subscribe("AccountsController:selectedAccountChange",async e=>await b(this,n,"m",l).call(this,e)),b(this,a,"f").subscribe("BackendWebSocketService:connectionStateChanged",e=>b(this,n,"m",d).call(this,e)),b(this,a,"f").call("BackendWebSocketService:addChannelCallback",{channelName:`system-notifications.v1.${b(this,o,"f").subscriptionNamespace}`,callback:e=>b(this,n,"m",u).call(this,e)})}async subscribe(e){try{await b(this,a,"f").call("BackendWebSocketService:connect");const t=`${b(this,o,"f").subscriptionNamespace}.${e.address}`;if(b(this,a,"f").call("BackendWebSocketService:channelHasSubscription",t))return;await b(this,a,"f").call("BackendWebSocketService:subscribe",{channels:[t],channelType:b(this,o,"f").subscriptionNamespace,callback:e=>{b(this,n,"m",c).call(this,e.data)}})}catch(e){S("Subscription failed, forcing reconnection",{error:e}),await b(this,n,"m",p).call(this)}}async unsubscribe(e){const{address:t}=e;try{const e=`${b(this,o,"f").subscriptionNamespace}.${t}`,s=b(this,a,"f").call("BackendWebSocketService:getSubscriptionsByChannel",e);if(0===s.length)return;for(const e of s)await e.unsubscribe()}catch(e){S("Unsubscription failed, forcing reconnection",{error:e}),await b(this,n,"m",p).call(this)}}destroy(){b(this,a,"f").call("BackendWebSocketService:removeChannelCallback",`system-notifications.v1.${b(this,o,"f").subscriptionNamespace}`)}},a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,c=function(e){const{address:t,tx:s,updates:n}=e,i=1e3*s.timestamp,c=Date.now()-i;S("Handling account activity update",{address:t,updateCount:n.length,elapsedMs:c}),b(this,r,"f").call(this,{name:`${w} Transaction Message`,data:{chain:s.chain,status:s.status,elapsed_ms:c},tags:{service:w,notification_type:b(this,o,"f").subscriptionNamespace}},()=>{b(this,a,"f").publish("AccountActivityService:transactionUpdated",s),b(this,a,"f").publish("AccountActivityService:balanceUpdated",{address:t,chain:s.chain,updates:n})})},l=async function(e){if(e?.address)try{const t=b(this,n,"m",f).call(this,e);await b(this,n,"m",h).call(this),await this.subscribe({address:t})}catch(e){S("Account change failed",{error:e})}},u=function(e){const t=e.data,{timestamp:s}=e;if(!t.chainIds||!Array.isArray(t.chainIds)||!t.status)throw new Error("Invalid system notification data: missing chainIds or status");if("up"===t.status)for(const e of t.chainIds)b(this,i,"f").add(e);else for(const e of t.chainIds)b(this,i,"f").delete(e);b(this,a,"f").publish("AccountActivityService:statusChanged",{chainIds:t.chainIds,status:t.status,timestamp:s}),S(`WebSocket status change - Published tracked chains as ${t.status}`,{count:t.chainIds.length,chains:t.chainIds,status:t.status})},d=async function(e){const{state:t}=e;if(t===g.WebSocketState.CONNECTED)await b(this,n,"m",m).call(this);else if(t===g.WebSocketState.DISCONNECTED){const e=Array.from(b(this,i,"f"));e.length>0&&(b(this,a,"f").publish("AccountActivityService:statusChanged",{chainIds:e,status:"down",timestamp:Date.now()}),S("WebSocket disconnection - Published tracked chains as down",{count:e.length,chains:e}),b(this,i,"f").clear())}},m=async function(){const e=b(this,a,"f").call("AccountsController:getSelectedAccount");if(!e?.address)return;const t=b(this,n,"m",f).call(this,e);await this.subscribe({address:t})},h=async function(){const e=b(this,a,"f").call("BackendWebSocketService:findSubscriptionsByChannelPrefix",b(this,o,"f").subscriptionNamespace);for(const t of e)await t.unsubscribe()},f=function(e){return e.scopes.some(e=>e.startsWith("eip155:"))?`eip155:0:${e.address}`:e.scopes.some(e=>e.startsWith("solana:"))?`solana:0:${e.address}`:e.address},p=async function(){S("Forcing WebSocket reconnection to clean up subscription state"),await b(this,a,"f").call("BackendWebSocketService:forceReconnection")}}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/AccountActivityService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs",{"./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/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",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,o,r,i,c,l,u,d,m,h,f,p,k,b,g,y,w,S,A,v,x,_,C,T,j,E,I,O,P,M,D,N,R,B,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},F=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.BackendWebSocketService=s.WebSocketEventType=s.WebSocketState=s.getCloseReason=void 0;const U=e("@metamask/controller-utils"),W=e("@metamask/utils"),H=e("uuid"),$=e("./logger.cjs"),q="BackendWebSocketService",K=(0,$.createModuleLogger)($.projectLogger,q),V="Internal: Manual disconnect",G=["connect","disconnect","forceReconnection","sendMessage","sendRequest","subscribe","getConnectionInfo","getSubscriptionsByChannel","channelHasSubscription","findSubscriptionsByChannelPrefix","addChannelCallback","removeChannelCallback","getChannelCallbacks"];function z(e){switch(e){case 1e3:return"Normal Closure";case 1001:return"Going Away";case 1002:return"Protocol Error";case 1003:return"Unsupported Data";case 1004:return"Reserved";case 1005:return"No Status Received";case 1006:return"Abnormal Closure";case 1007:return"Invalid frame payload data";case 1008:return"Policy Violation";case 1009:return"Message Too Big";case 1010:return"Mandatory Extension";case 1011:return"Internal Server Error";case 1012:return"Service Restart";case 1013:return"Try Again Later";case 1014:return"Bad Gateway";case 1015:return"TLS Handshake";default:return e>=3e3&&e<=3999?"Library/Framework Error":e>=4e3&&e<=4999?"Application Error":"Unknown"}}var J,Q;s.getCloseReason=z,function(e){e.CONNECTING="connecting",e.CONNECTED="connected",e.DISCONNECTING="disconnecting",e.DISCONNECTED="disconnected",e.ERROR="error"}(J||(s.WebSocketState=J={})),function(e){e.CONNECTED="connected",e.DISCONNECTED="disconnected",e.MESSAGE="message",e.ERROR="error",e.RECONNECTING="reconnecting",e.RECONNECTED="reconnected"}(Q||(s.WebSocketEventType=Q={}));s.BackendWebSocketService=class{constructor(e){n.add(this),this.name=q,a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,J.DISCONNECTED),u.set(this,0),d.set(this,null),m.set(this,null),h.set(this,null),f.set(this,null),p.set(this,new Map),k.set(this,0),b.set(this,new Map),g.set(this,new Map),y.set(this,void 0),L(this,a,e.messenger,"f"),L(this,r,e.isEnabled,"f"),L(this,i,e.traceFn??((e,t)=>t?.()),"f"),L(this,o,{url:e.url,timeout:e.timeout??1e4,reconnectDelay:e.reconnectDelay??1e4,maxReconnectDelay:e.maxReconnectDelay??6e4,requestTimeout:e.requestTimeout??3e4},"f"),F(this,n,"m",M).call(this),F(this,n,"m",w).call(this),F(this,a,"f").registerMethodActionHandlers(this,G)}async connect(){if(F(this,r,"f")&&!F(this,r,"f").call(this))return F(this,n,"m",D).call(this),void L(this,u,0,"f");if(F(this,l,"f")!==J.CONNECTED)if(F(this,f,"f"))await F(this,f,"f");else if(!F(this,d,"f")){L(this,f,(async()=>{let e;try{const t=await F(this,a,"f").call("AuthenticationController:getBearerToken");if(!t)throw new Error("Authentication required: user not signed in");e=t}catch(e){throw K("Failed to check authentication requirements",{error:e}),e}await F(this,n,"m",A).call(this,e)})(),"f");try{await F(this,f,"f")}catch{F(this,n,"m",P).call(this)}finally{L(this,f,null,"f")}}}disconnect(){F(this,l,"f")!==J.DISCONNECTED&&F(this,c,"f")&&(F(this,c,"f").close(4999,V),K("WebSocket manually disconnected"))}async forceReconnection(){if(F(this,l,"f")===J.DISCONNECTED||!F(this,c,"f"))return K("WebSocket already disconnected, scheduling reconnect"),void F(this,n,"m",P).call(this);K("Forcing WebSocket reconnection to clean up subscription state"),F(this,c,"f").close(4998,"Internal: Force reconnect")}sendMessage(e){if(F(this,l,"f")!==J.CONNECTED||!F(this,c,"f"))throw new Error(`Cannot send message: WebSocket is ${F(this,l,"f")}`);try{F(this,c,"f").send(JSON.stringify(e))}catch(e){const t=(0,W.getErrorMessage)(e);throw F(this,n,"m",O).call(this,new Error(t)),new Error(t)}}async sendRequest(e){if(F(this,l,"f")!==J.CONNECTED)throw new Error(`Cannot send request: WebSocket is ${F(this,l,"f")}`);const t=e.data?.requestId??(0,H.v4)(),s={event:e.event,data:{...e.data,requestId:t}};return new Promise((e,n)=>{const a=setTimeout(()=>{F(this,p,"f").delete(t),K("Request timeout - triggering reconnection",{timeout:F(this,o,"f").requestTimeout}),F(this,l,"f")===J.CONNECTED&&F(this,c,"f")&&F(this,c,"f").close(3e3,"Request timeout - forcing reconnect"),n(new Error(`Request timeout after ${F(this,o,"f").requestTimeout}ms`))},F(this,o,"f").requestTimeout);F(this,p,"f").set(t,{resolve:e,reject:n,timeout:a});try{this.sendMessage(s)}catch(e){F(this,p,"f").delete(t),clearTimeout(a),n(e instanceof Error?e:new Error(String(e)))}})}getConnectionInfo(){return{state:F(this,l,"f"),url:F(this,o,"f").url,timeout:F(this,o,"f").timeout,reconnectDelay:F(this,o,"f").reconnectDelay,maxReconnectDelay:F(this,o,"f").maxReconnectDelay,requestTimeout:F(this,o,"f").requestTimeout,reconnectAttempts:F(this,u,"f"),connectedAt:F(this,k,"f")}}getSubscriptionsByChannel(e){const t=[];for(const[s,n]of F(this,b,"f"))n.channels.includes(e)&&t.push({subscriptionId:s,channels:n.channels,channelType:n.channelType,unsubscribe:n.unsubscribe});return t}channelHasSubscription(e){for(const t of F(this,b,"f").values())if(t.channels.includes(e))return!0;return!1}findSubscriptionsByChannelPrefix(e){const t=[];for(const[s,n]of F(this,b,"f")){n.channels.some(t=>t.startsWith(e))&&t.push({subscriptionId:s,channels:n.channels,channelType:n.channelType,unsubscribe:n.unsubscribe})}return t}addChannelCallback(e){const t={channelName:e.channelName,callback:e.callback};F(this,g,"f").has(e.channelName)||F(this,g,"f").set(e.channelName,t)}removeChannelCallback(e){return F(this,g,"f").delete(e)}getChannelCallbacks(){return Array.from(F(this,g,"f").values())}destroy(){F(this,n,"m",D).call(this),L(this,u,0,"f"),this.disconnect()}async subscribe(e){const{channels:t,channelType:s,callback:n,requestId:a}=e;if(F(this,l,"f")!==J.CONNECTED)throw new Error(`Cannot create subscription(s) ${t.join(", ")}: WebSocket is ${F(this,l,"f")}`);const o=await this.sendRequest({event:"subscribe",data:{channels:t,requestId:a}});if(!o?.subscriptionId)throw new Error("Invalid subscription response: missing subscription ID");const{subscriptionId:r}=o,i=async e=>{await this.sendRequest({event:"unsubscribe",data:{subscription:r,channels:t,requestId:e}}),F(this,b,"f").delete(r)},c={subscriptionId:r,channels:[...t],channelType:s,unsubscribe:i};return F(this,b,"f").set(r,{subscriptionId:r,channels:[...t],channelType:s,callback:n,unsubscribe:i}),c}},a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,k=new WeakMap,b=new WeakMap,g=new WeakMap,y=new WeakMap,n=new WeakSet,w=function(){F(this,a,"f").subscribe("AuthenticationController:stateChange",e=>{e.isSignedIn?this.connect():this.disconnect()},e=>({isSignedIn:e.isSignedIn})),F(this,a,"f").subscribe("KeyringController:unlock",()=>{this.connect()}),F(this,a,"f").subscribe("KeyringController:lock",()=>{this.disconnect()})},S=function(e){const t=F(this,o,"f").url,s=new URL(t);return s.searchParams.set("token",e),s.toString()},A=async function(e){const t=F(this,n,"m",S).call(this,e);return F(this,n,"m",B).call(this,J.CONNECTING),F(this,i,"f").call(this,{name:`${q} Connection`,data:{reconnectAttempt:F(this,u,"f")},tags:{service:q}},()=>new Promise((e,s)=>{const a=new WebSocket(t);L(this,m,setTimeout(()=>{K("WebSocket connection timeout - forcing close",{timeout:F(this,o,"f").timeout}),a.close()},F(this,o,"f").timeout),"f"),a.onopen=()=>{F(this,m,"f")&&(clearTimeout(F(this,m,"f")),L(this,m,null,"f")),L(this,c,a,"f"),F(this,n,"m",B).call(this,J.CONNECTED),L(this,k,Date.now(),"f"),L(this,h,setTimeout(()=>{L(this,h,null,"f"),L(this,u,0,"f"),F(this,n,"m",M).call(this),K("Connection stable - reset reconnect attempts and backoff")},1e4),"f"),e()},a.onclose=t=>{if(K("WebSocket onclose event triggered",{code:t.code,reason:t.reason||z(t.code),wasClean:t.wasClean}),F(this,l,"f")===J.DISCONNECTED)return;const a=4999===t.code&&t.reason===V;F(this,l,"f")===J.CONNECTING&&(a?e():s(new Error(`WebSocket connection closed during connection: ${t.code} ${t.reason}`)));const o=F(this,k,"f")>0?Date.now()-F(this,k,"f"):0;F(this,n,"m",D).call(this),L(this,c,undefined,"f"),L(this,f,null,"f"),L(this,k,0,"f"),F(this,n,"m",N).call(this,new Error(`WebSocket connection closed: ${t.code} ${t.reason||z(t.code)}`)),F(this,n,"m",R).call(this),F(this,n,"m",B).call(this,J.DISCONNECTED),a?L(this,u,0,"f"):F(this,n,"m",P).call(this),F(this,i,"f").call(this,{name:`${q} Disconnection`,data:{code:t.code,reason:t.reason||z(t.code),wasClean:t.wasClean,reconnectAttempts:F(this,u,"f"),...o>0&&{connectionDuration_ms:o}},tags:{service:q}})},a.onmessage=e=>{try{const t=F(this,n,"m",I).call(this,e.data);F(this,n,"m",v).call(this,t)}catch{}}}))},v=function(e){if(F(this,n,"m",x).call(this,e))F(this,n,"m",T).call(this,e);else{if(F(this,n,"m",_).call(this,e)){const t=e;if(F(this,n,"m",E).call(this,t))return}if(F(this,n,"m",C).call(this,e)){const t=e;F(this,n,"m",j).call(this,t)}}},x=function(e){return"data"in e&&e.data&&"object"==typeof e.data&&"requestId"in e.data},_=function(e){return"subscriptionId"in e&&!F(this,n,"m",x).call(this,e)},C=function(e){return"channel"in e},T=function(e){const{requestId:t}=e.data,s=F(this,p,"f").get(t);s&&(F(this,p,"f").delete(t),clearTimeout(s.timeout),e.data.failed&&e.data.failed.length>0?s.reject(new Error(`Request failed: ${e.data.failed.join(", ")}`)):s.resolve(e.data))},j=function(e){0!==F(this,g,"f").size&&F(this,g,"f").get(e.channel)?.callback(e)},E=function(e){const{subscriptionId:t,timestamp:s,channel:n}=e;if(null!==t&&t!==undefined){const a=F(this,b,"f").get(t);if(!a)return!1;const o=Date.now()-s;return F(this,i,"f").call(this,{name:`${q} Notification`,data:{channel:n,latency_ms:o,subscriptionId:t},tags:{service:q,notification_type:a.channelType}},()=>{a.callback?.(e)}),!0}return!1},I=function(e){return JSON.parse(e)},O=function(e){},P=function(){if(F(this,d,"f"))return;L(this,u,F(this,u,"f")+1,"f");const e=F(this,y,"f").duration;L(this,y,F(this,y,"f").next({attempt:F(this,u,"f")}),"f"),K("Scheduling reconnect",{attempt:F(this,u,"f"),delay_ms:e}),L(this,d,setTimeout(()=>{if(L(this,d,null,"f"),F(this,r,"f")&&!F(this,r,"f").call(this))return L(this,u,0,"f"),void F(this,n,"m",M).call(this);this.connect()},e),"f")},M=function(){L(this,y,new U.ExponentialBackoff({initialDelay:F(this,o,"f").reconnectDelay,maxDelay:F(this,o,"f").maxReconnectDelay}).next(),"f")},D=function(){F(this,d,"f")&&(clearTimeout(F(this,d,"f")),L(this,d,null,"f")),F(this,m,"f")&&(clearTimeout(F(this,m,"f")),L(this,m,null,"f")),F(this,h,"f")&&(clearTimeout(F(this,h,"f")),L(this,h,null,"f"))},N=function(e){for(const[,t]of F(this,p,"f"))clearTimeout(t.timeout),t.reject(e);F(this,p,"f").clear()},R=function(){F(this,b,"f").clear()},B=function(e){const t=F(this,l,"f");L(this,l,e,"f"),t!==e&&F(this,a,"f").publish("BackendWebSocketService:connectionStateChanged",this.getConnectionInfo())}}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/ApiPlatformClient.cjs",{"./accounts/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/accounts/index.cjs","./base-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs","./prices/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/prices/index.cjs","./shared-types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/shared-types.cjs","./token/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/token/index.cjs","./tokens/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/tokens/index.cjs","@tanstack/query-core":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@tanstack/query-core/build/legacy/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a=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.createApiPlatformClient=s.ApiPlatformClient=void 0;const r=e("@tanstack/query-core"),i=e("./accounts/index.cjs"),c=e("./base-client.cjs"),l=e("./prices/index.cjs"),u=e("./shared-types.cjs"),d=e("./token/index.cjs"),m=e("./tokens/index.cjs");class h{constructor(e){n.set(this,void 0),a(this,n,e.queryClient??new r.QueryClient({defaultOptions:{queries:{staleTime:u.STALE_TIMES.DEFAULT,gcTime:u.GC_TIMES.DEFAULT,retry:u.shouldRetry,retryDelay:u.calculateRetryDelay,refetchOnWindowFocus:!1,networkMode:"always"}}}),"f");const t={...e,queryClient:o(this,n,"f")};this.accounts=new i.AccountsApiClient(t),this.prices=new l.PricesApiClient(t),this.token=new d.TokenApiClient(t),this.tokens=new m.TokensApiClient(t)}get queryClient(){return o(this,n,"f")}getCachedData(e){return o(this,n,"f").getQueryData(e)}setCachedData(e,t){o(this,n,"f").setQueryData(e,t)}isFetching(e){return o(this,n,"f").isFetching({queryKey:e})>0}clear(){o(this,n,"f").clear()}async invalidateAll(){await o(this,n,"f").invalidateQueries()}async invalidateAuthToken(){await o(this,n,"f").resetQueries({queryKey:c.authQueryKeys.bearerToken()})}}s.ApiPlatformClient=h,n=new WeakMap,s.createApiPlatformClient=function(e){return new h(e)}}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/ApiPlatformClient.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/accounts/client.cjs",{"../base-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AccountsApiClient=void 0;const n=e("../base-client.cjs");class a extends n.BaseApiClient{async invalidateBalances(){await this.queryClient.invalidateQueries({queryKey:["accounts","balances"]})}async invalidateAccounts(){await this.queryClient.invalidateQueries({queryKey:["accounts"]})}async fetchV1SupportedNetworks(e){return this.queryClient.fetchQuery({queryKey:["accounts","v1SupportedNetworks"],queryFn:({signal:e})=>this.fetch(n.API_URLS.ACCOUNTS,"/v1/supportedNetworks",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}async fetchV2SupportedNetworks(e){return this.queryClient.fetchQuery({queryKey:["accounts","v2SupportedNetworks"],queryFn:({signal:e})=>this.fetch(n.API_URLS.ACCOUNTS,"/v2/supportedNetworks",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}async fetchV2ActiveNetworks(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","v2ActiveNetworks",{accountIds:[...e].sort(),options:t&&{...t,networks:t.networks&&[...t.networks].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,"/v2/activeNetworks",{signal:s,params:{accountIds:e,filterMMListTokens:t?.filterMMListTokens,networks:t?.networks}}),staleTime:s?.staleTime??n.STALE_TIMES.NETWORKS,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV2Balances(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","balances","v2",{address:e,options:t&&{...t,networks:t.networks&&[...t.networks].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,`/v2/accounts/${e}/balances`,{signal:s,params:{networks:t?.networks}}),staleTime:s?.staleTime??n.STALE_TIMES.BALANCES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV2BalancesWithOptions(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","balances","v2",{address:e,options:t&&{...t,networks:t.networks&&[...t.networks].sort(),includeTokenAddresses:t.includeTokenAddresses&&[...t.includeTokenAddresses].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,`/v2/accounts/${e}/balances`,{signal:s,params:{networks:t?.networks,filterSupportedTokens:t?.filterSupportedTokens,includeTokenAddresses:t?.includeTokenAddresses,includeStakedAssets:t?.includeStakedAssets}}),staleTime:s?.staleTime??n.STALE_TIMES.BALANCES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV4MultiAccountBalances(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","balances","v4",{accountAddresses:[...e].sort(),options:t&&{...t,networks:t.networks&&[...t.networks].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,"/v4/multiaccount/balances",{signal:s,params:{accountAddresses:e,networks:t?.networks}}),staleTime:s?.staleTime??n.STALE_TIMES.BALANCES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV5MultiAccountBalances(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","balances","v5",{accountIds:[...e].sort(),options:t&&{...t,networks:t.networks&&[...t.networks].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,"/v5/multiaccount/balances",{signal:s,params:{accountIds:e,networks:t?.networks,filterMMListTokens:t?.filterMMListTokens,includeStakedAssets:t?.includeStakedAssets}}),staleTime:s?.staleTime??n.STALE_TIMES.BALANCES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1TransactionByHash(e,t,s,a){return this.queryClient.fetchQuery({queryKey:["accounts","transactions","v1ByHash",{chainId:e,txHash:t,options:s}],queryFn:({signal:a})=>this.fetch(n.API_URLS.ACCOUNTS,`/v1/networks/${e}/transactions/${t}`,{signal:a,params:{includeLogs:s?.includeLogs,includeValueTransfers:s?.includeValueTransfers,includeTxMetadata:s?.includeTxMetadata,lang:s?.lang}}),staleTime:a?.staleTime??n.STALE_TIMES.TRANSACTIONS,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1AccountTransactions(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","transactions","v1Account",{address:e,options:t&&{...t,chainIds:t.chainIds&&[...t.chainIds].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,`/v1/accounts/${e}/transactions`,{signal:s,params:{networks:t?.chainIds,cursor:t?.cursor,startTimestamp:t?.startTimestamp,endTimestamp:t?.endTimestamp,sortDirection:t?.sortDirection}}),staleTime:s?.staleTime??n.STALE_TIMES.TRANSACTIONS,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV4MultiAccountTransactions(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","transactions","v4MultiAccount",{accountIds:[...e].sort(),options:t&&{...t,networks:t.networks&&[...t.networks].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,"/v4/multiaccount/transactions",{signal:s,params:{accountIds:e,networks:t?.networks,cursor:t?.cursor,sortDirection:t?.sortDirection,includeLogs:t?.includeLogs,includeValueTransfers:t?.includeValueTransfers,includeTxMetadata:t?.includeTxMetadata}}),staleTime:s?.staleTime??n.STALE_TIMES.TRANSACTIONS,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1AccountRelationship(e,t,s,a){return this.queryClient.fetchQuery({queryKey:["accounts","v1Relationship",e,t,s],queryFn:async({signal:a})=>{try{return await this.fetch(n.API_URLS.ACCOUNTS,`/v1/networks/${e}/accounts/${t}/relationships/${s}`,{signal:a})}catch(e){if(e instanceof n.HttpError&&"object"==typeof e.body){const t=e.body;if(t?.error&&"object"==typeof t.error&&"string"==typeof t.error.code&&"string"==typeof t.error.message)return{error:{code:t.error.code,message:t.error.message}}}throw e}},staleTime:a?.staleTime??n.STALE_TIMES.DEFAULT,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV2AccountNfts(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","v2Nfts",{address:e,options:t&&{...t,networks:t.networks&&[...t.networks].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,`/v2/accounts/${e}/nfts`,{signal:s,params:{networks:t?.networks,cursor:t?.cursor}}),staleTime:s?.staleTime??n.STALE_TIMES.DEFAULT,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV2AccountTokens(e,t,s){return this.queryClient.fetchQuery({queryKey:["accounts","v2Tokens",{address:e,options:t&&{...t,networks:t.networks&&[...t.networks].sort()}}],queryFn:({signal:s})=>this.fetch(n.API_URLS.ACCOUNTS,`/v2/accounts/${e}/tokens`,{signal:s,params:{networks:t?.networks}}),staleTime:s?.staleTime??n.STALE_TIMES.DEFAULT,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}}s.AccountsApiClient=a}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/accounts/client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/accounts/index.cjs",{"./client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/accounts/client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AccountsApiClient=void 0;var n=e("./client.cjs");Object.defineProperty(s,"AccountsApiClient",{enumerable:!0,get:function(){return n.AccountsApiClient}})}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/accounts/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs",{"./shared-types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/shared-types.cjs","@tanstack/query-core":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@tanstack/query-core/build/legacy/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a=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.HttpError=s.GC_TIMES=s.STALE_TIMES=s.API_URLS=s.BaseApiClient=s.authQueryKeys=void 0;const r=e("@tanstack/query-core"),i=e("./shared-types.cjs");Object.defineProperty(s,"API_URLS",{enumerable:!0,get:function(){return i.API_URLS}}),Object.defineProperty(s,"STALE_TIMES",{enumerable:!0,get:function(){return i.STALE_TIMES}}),Object.defineProperty(s,"GC_TIMES",{enumerable:!0,get:function(){return i.GC_TIMES}}),Object.defineProperty(s,"HttpError",{enumerable:!0,get:function(){return i.HttpError}}),s.authQueryKeys={bearerToken:()=>["auth","bearerToken"]};s.BaseApiClient=class{get queryClient(){return a(this,n,"f")}async invalidateAuthToken(){await a(this,n,"f").resetQueries({queryKey:s.authQueryKeys.bearerToken()})}constructor(e){n.set(this,void 0),this.clientProduct=e.clientProduct,this.clientVersion=e.clientVersion??"1.0.0",this.getBearerToken=e.getBearerToken,o(this,n,e.queryClient??new r.QueryClient({defaultOptions:{queries:{staleTime:i.STALE_TIMES.DEFAULT,gcTime:i.GC_TIMES.DEFAULT,retry:i.shouldRetry,retryDelay:i.calculateRetryDelay,refetchOnWindowFocus:!1,networkMode:"always"}}}),"f")}async fetch(e,t,o){const r=new URL(t,e);if(o?.params)for(const[e,t]of Object.entries(o.params))t!==undefined&&(Array.isArray(t)?r.searchParams.set(e,t.map(String).join(",")):r.searchParams.set(e,String(t)));const c={"Content-Type":"application/json","X-Client-Product":this.clientProduct,"X-Client-Version":this.clientVersion};if(this.getBearerToken){const e=s.authQueryKeys.bearerToken(),{getBearerToken:t}=this;try{const s=await a(this,n,"f").fetchQuery({queryKey:e,queryFn:async()=>{const e=await t();if(!e)throw new Error("No bearer token available");return e},staleTime:i.STALE_TIMES.AUTH_TOKEN,retry:!1});c.Authorization=`Bearer ${s}`}catch{}}const l=await fetch(r.toString(),{method:"GET",headers:c,signal:o?.signal});if(!l.ok){let e;try{e=await l.json()}catch{}throw new i.HttpError(`HTTP ${l.status}: ${l.statusText}`,l.status,l.statusText,r.toString(),e)}return l.json()}},n=new WeakMap}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/index.cjs",{"./ApiPlatformClient.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/ApiPlatformClient.cjs","./accounts/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/accounts/index.cjs","./base-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs","./prices/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/prices/index.cjs","./shared-types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/shared-types.cjs","./token/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/token/index.cjs","./tokens/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/tokens/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.createApiPlatformClient=s.ApiPlatformClient=s.BaseApiClient=s.TokensApiClient=s.TokenApiClient=s.PricesApiClient=s.AccountsApiClient=s.HttpError=s.shouldRetry=s.calculateRetryDelay=s.RETRY_CONFIG=s.GC_TIMES=s.STALE_TIMES=s.API_URLS=void 0;var n=e("./shared-types.cjs");Object.defineProperty(s,"API_URLS",{enumerable:!0,get:function(){return n.API_URLS}}),Object.defineProperty(s,"STALE_TIMES",{enumerable:!0,get:function(){return n.STALE_TIMES}}),Object.defineProperty(s,"GC_TIMES",{enumerable:!0,get:function(){return n.GC_TIMES}}),Object.defineProperty(s,"RETRY_CONFIG",{enumerable:!0,get:function(){return n.RETRY_CONFIG}}),Object.defineProperty(s,"calculateRetryDelay",{enumerable:!0,get:function(){return n.calculateRetryDelay}}),Object.defineProperty(s,"shouldRetry",{enumerable:!0,get:function(){return n.shouldRetry}}),Object.defineProperty(s,"HttpError",{enumerable:!0,get:function(){return n.HttpError}});var a=e("./accounts/index.cjs");Object.defineProperty(s,"AccountsApiClient",{enumerable:!0,get:function(){return a.AccountsApiClient}});var o=e("./prices/index.cjs");Object.defineProperty(s,"PricesApiClient",{enumerable:!0,get:function(){return o.PricesApiClient}});var r=e("./token/index.cjs");Object.defineProperty(s,"TokenApiClient",{enumerable:!0,get:function(){return r.TokenApiClient}});var i=e("./tokens/index.cjs");Object.defineProperty(s,"TokensApiClient",{enumerable:!0,get:function(){return i.TokensApiClient}});var c=e("./base-client.cjs");Object.defineProperty(s,"BaseApiClient",{enumerable:!0,get:function(){return c.BaseApiClient}});var l=e("./ApiPlatformClient.cjs");Object.defineProperty(s,"ApiPlatformClient",{enumerable:!0,get:function(){return l.ApiPlatformClient}}),Object.defineProperty(s,"createApiPlatformClient",{enumerable:!0,get:function(){return l.createApiPlatformClient}})}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/prices/client.cjs",{"../base-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.PricesApiClient=void 0;const n=e("../base-client.cjs");class a extends n.BaseApiClient{async invalidatePrices(){await this.queryClient.invalidateQueries({queryKey:["prices"]})}async fetchPriceV1SupportedNetworks(e){return this.queryClient.fetchQuery({queryKey:["prices","v1SupportedNetworks"],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,"/v1/supportedNetworks",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}async fetchPriceV2SupportedNetworks(e){return this.queryClient.fetchQuery({queryKey:["prices","v2SupportedNetworks"],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,"/v2/supportedNetworks",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}async fetchV1ExchangeRates(e,t){return this.queryClient.fetchQuery({queryKey:["prices","v1ExchangeRates",e],queryFn:({signal:t})=>this.fetch(n.API_URLS.PRICES,"/v1/exchange-rates",{signal:t,params:{baseCurrency:e}}),staleTime:t?.staleTime??n.STALE_TIMES.EXCHANGE_RATES,gcTime:t?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1FiatExchangeRates(e){return this.queryClient.fetchQuery({queryKey:["prices","v1FiatExchangeRates"],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,"/v1/exchange-rates/fiat",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.EXCHANGE_RATES,gcTime:e?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1CryptoExchangeRates(e){return this.queryClient.fetchQuery({queryKey:["prices","v1CryptoExchangeRates"],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,"/v1/exchange-rates/crypto",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.EXCHANGE_RATES,gcTime:e?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1SpotPricesByCoinIds(e,t){return 0===e.length?{}:this.queryClient.fetchQuery({queryKey:["prices","v1SpotPricesByCoinIds",{coinIds:[...e].sort()}],queryFn:({signal:t})=>this.fetch(n.API_URLS.PRICES,"/v1/spot-prices",{signal:t,params:{coinIds:e}}),staleTime:t?.staleTime??n.STALE_TIMES.PRICES,gcTime:t?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1SpotPriceByCoinId(e,t="usd",s){return this.queryClient.fetchQuery({queryKey:["prices","v1SpotPriceByCoinId",e,t],queryFn:({signal:s})=>this.fetch(n.API_URLS.PRICES,`/v1/spot-prices/${e}`,{signal:s,params:{vsCurrency:t}}),staleTime:s?.staleTime??n.STALE_TIMES.PRICES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1TokenPrices(e,t,s,a){if(0===t.length)return{};const o=parseInt(e,16),r=s?.currency??"usd";return this.queryClient.fetchQuery({queryKey:["prices","v1TokenPrices",{chainId:e,tokenAddresses:[...t].sort(),currency:r,includeMarketData:s?.includeMarketData}],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,`/v1/chains/${o}/spot-prices`,{signal:e,params:{tokenAddresses:t,vsCurrency:r,includeMarketData:s?.includeMarketData}}),staleTime:a?.staleTime??n.STALE_TIMES.PRICES,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1TokenPrice(e,t,s="usd",a){const o=parseInt(e,16);try{return await this.queryClient.fetchQuery({queryKey:["prices","v1TokenPrice",e,t,s],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,`/v1/chains/${o}/spot-prices/${t}`,{signal:e,params:{vsCurrency:s}}),staleTime:a?.staleTime??n.STALE_TIMES.PRICES,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}catch{return undefined}}async fetchV2SpotPrices(e,t,s,a){if(0===t.length)return{};const o=parseInt(e,16),r=s?.currency??"usd",i=s?.includeMarketData??!0;return this.queryClient.fetchQuery({queryKey:["prices","v2SpotPrices",{chainId:e,tokenAddresses:[...t].sort(),currency:r,includeMarketData:i}],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,`/v2/chains/${o}/spot-prices`,{signal:e,params:{tokenAddresses:t,vsCurrency:r,includeMarketData:s?.includeMarketData??!0}}),staleTime:a?.staleTime??n.STALE_TIMES.PRICES,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV3SpotPrices(e,t,s){if(0===e.length)return{};const a=t?.currency??"usd",o=t?.includeMarketData??!0,r=t?.cacheOnly??!1;return this.queryClient.fetchQuery({queryKey:["prices","v3SpotPrices",{assetIds:[...e].sort(),currency:a,includeMarketData:o,cacheOnly:r}],queryFn:({signal:t})=>this.fetch(n.API_URLS.PRICES,"/v3/spot-prices",{signal:t,params:{assetIds:e,vsCurrency:a,includeMarketData:o,cacheOnly:r}}),staleTime:s?.staleTime??n.STALE_TIMES.PRICES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1HistoricalPricesByCoinId(e,t,s){return this.queryClient.fetchQuery({queryKey:["prices","v1HistoricalByCoinId",e,t],queryFn:({signal:s})=>this.fetch(n.API_URLS.PRICES,`/v1/historical-prices/${e}`,{signal:s,params:{vsCurrency:t?.currency,timePeriod:t?.timePeriod,from:t?.from,to:t?.to}}),staleTime:s?.staleTime??n.STALE_TIMES.PRICES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1HistoricalPricesByTokenAddresses(e,t,s,a){const o=parseInt(e,16);return this.queryClient.fetchQuery({queryKey:["prices","v1HistoricalByTokenAddresses",{chainId:e,tokenAddresses:[...t].sort(),options:s}],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,`/v1/chains/${o}/historical-prices`,{signal:e,params:{tokenAddresses:t,vsCurrency:s?.currency,timePeriod:s?.timePeriod,from:s?.from,to:s?.to}}),staleTime:a?.staleTime??n.STALE_TIMES.PRICES,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1HistoricalPrices(e,t,s,a){const o=parseInt(e,16),r=s?.currency??"usd",i=s?.timeRange??"7d";return this.queryClient.fetchQuery({queryKey:["prices","v1Historical",e,t,r,i],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,`/v1/chains/${o}/historical-prices/${t}`,{signal:e,params:{vsCurrency:r,timePeriod:i}}),staleTime:a?.staleTime??n.STALE_TIMES.PRICES,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV3HistoricalPrices(e,t,s,a){return this.queryClient.fetchQuery({queryKey:["prices","v3Historical",e,t,s],queryFn:({signal:a})=>this.fetch(n.API_URLS.PRICES,`/v3/historical-prices/${e}/${t}`,{signal:a,params:{vsCurrency:s?.currency,timePeriod:s?.timePeriod,from:s?.from,to:s?.to,interval:s?.interval}}),staleTime:a?.staleTime??n.STALE_TIMES.PRICES,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1HistoricalPriceGraphByCoinId(e,t,s){const a=t?.currency??"usd",o=t?.includeOHLC??!1;return this.queryClient.fetchQuery({queryKey:["prices","v1GraphByCoinId",e,a,o],queryFn:({signal:t})=>this.fetch(n.API_URLS.PRICES,`/v1/historical-prices-graph/${e}`,{signal:t,params:{vsCurrency:a,includeOHLC:o}}),staleTime:s?.staleTime??n.STALE_TIMES.PRICES,gcTime:s?.gcTime??n.GC_TIMES.DEFAULT})}async fetchV1HistoricalPriceGraphByTokenAddress(e,t,s,a){const o=parseInt(e,16),r=s?.currency??"usd",i=s?.includeOHLC??!1;return this.queryClient.fetchQuery({queryKey:["prices","v1GraphByTokenAddress",e,t,r,i],queryFn:({signal:e})=>this.fetch(n.API_URLS.PRICES,`/v1/chains/${o}/historical-prices-graph/${t}`,{signal:e,params:{vsCurrency:r,includeOHLC:i}}),staleTime:a?.staleTime??n.STALE_TIMES.PRICES,gcTime:a?.gcTime??n.GC_TIMES.DEFAULT})}}s.PricesApiClient=a}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/prices/client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/prices/index.cjs",{"./client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/prices/client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.PricesApiClient=void 0;var n=e("./client.cjs");Object.defineProperty(s,"PricesApiClient",{enumerable:!0,get:function(){return n.PricesApiClient}})}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/prices/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/shared-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.HttpError=s.shouldRetry=s.calculateRetryDelay=s.RETRY_CONFIG=s.GC_TIMES=s.STALE_TIMES=s.API_URLS=void 0,s.API_URLS={ACCOUNTS:"https://accounts.api.cx.metamask.io",PRICES:"https://price.api.cx.metamask.io",TOKEN:"https://token.api.cx.metamask.io",TOKENS:"https://tokens.api.cx.metamask.io"},s.STALE_TIMES={AUTH_TOKEN:3e5,PRICES:3e4,BALANCES:6e4,NETWORKS:6e5,SUPPORTED_NETWORKS:18e5,TOKEN_METADATA:3e5,TOKEN_LIST:6e5,EXCHANGE_RATES:3e5,TRENDING:12e4,TRANSACTIONS:3e4,DEFAULT:3e4},s.GC_TIMES={DEFAULT:3e5,EXTENDED:18e5,SHORT:12e4},s.RETRY_CONFIG={MAX_RETRIES:3,BASE_DELAY:1e3,MAX_DELAY:5e3},s.calculateRetryDelay=function(e){const t=Math.min(s.RETRY_CONFIG.BASE_DELAY*2**e,s.RETRY_CONFIG.MAX_DELAY);return t/2+Math.random()*(t/2)},s.shouldRetry=function(e,t){if(e>s.RETRY_CONFIG.MAX_RETRIES)return!1;if(t instanceof Error&&"status"in t){const{status:e}=t;if(e>=400&&e<500&&429!==e&&408!==e)return!1}return!0};class n extends Error{constructor(e,t,s,n,a){super(e),this.name="HttpError",this.status=t,this.statusText=s,this.url=n,this.body=a}}s.HttpError=n}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/shared-types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/token/client.cjs",{"../base-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.TokenApiClient=void 0;const n=e("../base-client.cjs");class a extends n.BaseApiClient{async invalidateToken(){await this.queryClient.invalidateQueries({queryKey:["token"]})}async fetchNetworks(e){return this.queryClient.fetchQuery({queryKey:["token","networks"],queryFn:({signal:e})=>this.fetch(n.API_URLS.TOKEN,"/networks",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}async fetchNetworkByChainId(e,t){return this.queryClient.fetchQuery({queryKey:["token","networkByChainId",e],queryFn:({signal:t})=>this.fetch(n.API_URLS.TOKEN,`/networks/${e}`,{signal:t}),staleTime:t?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:t?.gcTime??n.GC_TIMES.EXTENDED})}async fetchTokenList(e,t,s){return this.queryClient.fetchQuery({queryKey:["token","tokenList",{chainId:e,options:t}],queryFn:({signal:s})=>this.fetch(n.API_URLS.TOKEN,`/tokens/${e}`,{signal:s,params:{includeTokenFees:t?.includeTokenFees,includeAssetType:t?.includeAssetType,includeAggregators:t?.includeAggregators,includeERC20Permit:t?.includeERC20Permit,includeOccurrences:t?.includeOccurrences,includeStorage:t?.includeStorage,includeIconUrl:t?.includeIconUrl,includeAddress:t?.includeAddress,includeName:t?.includeName}}),staleTime:s?.staleTime??n.STALE_TIMES.TOKEN_LIST,gcTime:s?.gcTime??n.GC_TIMES.EXTENDED})}async fetchV1TokenMetadata(e,t,s,a){try{return await this.queryClient.fetchQuery({queryKey:["token","v1Metadata",{chainId:e,tokenAddress:t,options:s}],queryFn:({signal:a})=>this.fetch(n.API_URLS.TOKEN,`/token/${e}`,{signal:a,params:{address:t,includeTokenFees:s?.includeTokenFees,includeAssetType:s?.includeAssetType,includeAggregators:s?.includeAggregators,includeERC20Permit:s?.includeERC20Permit,includeOccurrences:s?.includeOccurrences,includeStorage:s?.includeStorage,includeIconUrl:s?.includeIconUrl,includeAddress:s?.includeAddress,includeName:s?.includeName}}),staleTime:a?.staleTime??n.STALE_TIMES.TOKEN_METADATA,gcTime:a?.gcTime??n.GC_TIMES.EXTENDED})}catch{return undefined}}async fetchTokenDescription(e,t,s){try{return await this.queryClient.fetchQuery({queryKey:["token","tokenDescription",e,t],queryFn:({signal:s})=>this.fetch(n.API_URLS.TOKEN,`/token/${e}/description`,{signal:s,params:{address:t}}),staleTime:s?.staleTime??n.STALE_TIMES.TOKEN_METADATA,gcTime:s?.gcTime??n.GC_TIMES.EXTENDED})}catch{return undefined}}async fetchV3TrendingTokens(e,t,s){return this.queryClient.fetchQuery({queryKey:["token","v3Trending",{chainIds:[...e].sort(),options:t}],queryFn:({signal:s})=>this.fetch(n.API_URLS.TOKEN,"/v3/tokens/trending",{signal:s,params:{chainIds:e,sort:t?.sortBy,minLiquidity:t?.minLiquidity,minVolume24hUsd:t?.minVolume24hUsd,maxVolume24hUsd:t?.maxVolume24hUsd,minMarketCap:t?.minMarketCap,maxMarketCap:t?.maxMarketCap}}),staleTime:s?.staleTime??n.STALE_TIMES.TRENDING,gcTime:s?.gcTime??n.GC_TIMES.SHORT})}async fetchV3TopGainers(e,t,s){return this.queryClient.fetchQuery({queryKey:["token","v3TopGainers",{chainIds:[...e].sort(),options:t}],queryFn:({signal:s})=>this.fetch(n.API_URLS.TOKEN,"/v3/tokens/top-gainers",{signal:s,params:{chainIds:e,sort:t?.sort,blockRegion:t?.blockRegion,minLiquidity:t?.minLiquidity,minVolume24hUsd:t?.minVolume24hUsd,maxVolume24hUsd:t?.maxVolume24hUsd,minMarketCap:t?.minMarketCap,maxMarketCap:t?.maxMarketCap}}),staleTime:s?.staleTime??n.STALE_TIMES.TRENDING,gcTime:s?.gcTime??n.GC_TIMES.SHORT})}async fetchV3PopularTokens(e,t,s){return this.queryClient.fetchQuery({queryKey:["token","v3Popular",{chainIds:[...e].sort(),options:t}],queryFn:({signal:s})=>this.fetch(n.API_URLS.TOKEN,"/v3/tokens/popular",{signal:s,params:{chainIds:e,blockRegion:t?.blockRegion,minLiquidity:t?.minLiquidity,minVolume24hUsd:t?.minVolume24hUsd,maxVolume24hUsd:t?.maxVolume24hUsd,minMarketCap:t?.minMarketCap,maxMarketCap:t?.maxMarketCap}}),staleTime:s?.staleTime??n.STALE_TIMES.TRENDING,gcTime:s?.gcTime??n.GC_TIMES.SHORT})}async fetchTopAssets(e,t){return this.queryClient.fetchQuery({queryKey:["token","topAssets",e],queryFn:({signal:t})=>this.fetch(n.API_URLS.TOKEN,`/topAssets/${e}`,{signal:t}),staleTime:t?.staleTime??n.STALE_TIMES.TRENDING,gcTime:t?.gcTime??n.GC_TIMES.SHORT})}async fetchV1SuggestedOccurrenceFloors(e){return this.queryClient.fetchQuery({queryKey:["token","v1SuggestedOccurrenceFloors"],queryFn:({signal:e})=>this.fetch(n.API_URLS.TOKEN,"/v1/suggestedOccurrenceFloors",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}}s.TokenApiClient=a}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/token/client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/token/index.cjs",{"./client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/token/client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.TokenApiClient=void 0;var n=e("./client.cjs");Object.defineProperty(s,"TokenApiClient",{enumerable:!0,get:function(){return n.TokenApiClient}})}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/token/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/tokens/client.cjs",{"../base-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/base-client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.TokensApiClient=void 0;const n=e("../base-client.cjs");class a extends n.BaseApiClient{async invalidateTokens(){await this.queryClient.invalidateQueries({queryKey:["tokens"]})}async fetchTokenV1SupportedNetworks(e){return this.queryClient.fetchQuery({queryKey:["tokens","v1SupportedNetworks"],queryFn:({signal:e})=>this.fetch(n.API_URLS.TOKENS,"/v1/supportedNetworks",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}async fetchTokenV2SupportedNetworks(e){return this.queryClient.fetchQuery({queryKey:["tokens","v2SupportedNetworks"],queryFn:({signal:e})=>this.fetch(n.API_URLS.TOKENS,"/v2/supportedNetworks",{signal:e}),staleTime:e?.staleTime??n.STALE_TIMES.SUPPORTED_NETWORKS,gcTime:e?.gcTime??n.GC_TIMES.EXTENDED})}async fetchV3Assets(e,t,s){return this.queryClient.fetchQuery({queryKey:["tokens","v3Assets",{assetIds:[...e].sort(),...t}],queryFn:({signal:s})=>this.fetch(n.API_URLS.TOKENS,"/v3/assets",{signal:s,params:{assetIds:e,...t}}),staleTime:s?.staleTime??n.STALE_TIMES.TOKEN_METADATA,gcTime:s?.gcTime??n.GC_TIMES.EXTENDED})}}s.TokensApiClient=a}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/tokens/client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/tokens/index.cjs",{"./client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/tokens/client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.TokensApiClient=void 0;var n=e("./client.cjs");Object.defineProperty(s,"TokensApiClient",{enumerable:!0,get:function(){return n.TokensApiClient}})}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/tokens/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/index.cjs",{"./AccountActivityService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/AccountActivityService.cjs","./BackendWebSocketService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs","./api/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/api/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.HttpError=s.shouldRetry=s.calculateRetryDelay=s.GC_TIMES=s.STALE_TIMES=s.API_URLS=s.TokensApiClient=s.TokenApiClient=s.PricesApiClient=s.AccountsApiClient=s.createApiPlatformClient=s.ApiPlatformClient=s.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS=s.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS=s.AccountActivityService=s.WebSocketEventType=s.WebSocketState=s.getCloseReason=s.BackendWebSocketService=void 0;var n=e("./BackendWebSocketService.cjs");Object.defineProperty(s,"BackendWebSocketService",{enumerable:!0,get:function(){return n.BackendWebSocketService}}),Object.defineProperty(s,"getCloseReason",{enumerable:!0,get:function(){return n.getCloseReason}}),Object.defineProperty(s,"WebSocketState",{enumerable:!0,get:function(){return n.WebSocketState}}),Object.defineProperty(s,"WebSocketEventType",{enumerable:!0,get:function(){return n.WebSocketEventType}});var a=e("./AccountActivityService.cjs");Object.defineProperty(s,"AccountActivityService",{enumerable:!0,get:function(){return a.AccountActivityService}}),Object.defineProperty(s,"ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS",{enumerable:!0,get:function(){return a.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS}}),Object.defineProperty(s,"ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS",{enumerable:!0,get:function(){return a.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS}});var o=e("./api/index.cjs");Object.defineProperty(s,"ApiPlatformClient",{enumerable:!0,get:function(){return o.ApiPlatformClient}}),Object.defineProperty(s,"createApiPlatformClient",{enumerable:!0,get:function(){return o.createApiPlatformClient}}),Object.defineProperty(s,"AccountsApiClient",{enumerable:!0,get:function(){return o.AccountsApiClient}}),Object.defineProperty(s,"PricesApiClient",{enumerable:!0,get:function(){return o.PricesApiClient}}),Object.defineProperty(s,"TokenApiClient",{enumerable:!0,get:function(){return o.TokenApiClient}}),Object.defineProperty(s,"TokensApiClient",{enumerable:!0,get:function(){return o.TokensApiClient}}),Object.defineProperty(s,"API_URLS",{enumerable:!0,get:function(){return o.API_URLS}}),Object.defineProperty(s,"STALE_TIMES",{enumerable:!0,get:function(){return o.STALE_TIMES}}),Object.defineProperty(s,"GC_TIMES",{enumerable:!0,get:function(){return o.GC_TIMES}}),Object.defineProperty(s,"calculateRetryDelay",{enumerable:!0,get:function(){return o.calculateRetryDelay}}),Object.defineProperty(s,"shouldRetry",{enumerable:!0,get:function(){return o.shouldRetry}}),Object.defineProperty(s,"HttpError",{enumerable:!0,get:function(){return o.HttpError}})}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/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.projectLogger=void 0;const n=e("@metamask/utils");Object.defineProperty(s,"createModuleLogger",{enumerable:!0,get:function(){return n.createModuleLogger}}),s.projectLogger=(0,n.createProjectLogger)("core-backend")}}},{package:"@metamask/assets-controller>@metamask/core-backend",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/core-backend/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/account.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.snapOwnsAccount=s.createChainIdList=s.createAccountList=void 0;const n=e("@metamask/utils");s.createAccountList=function(e,t){return t.map(t=>`${t}:${e}`)},s.createChainIdList=function(e,t){return t&&0!==t.length?e.reduce((e,s)=>{if("eip155:0"===s){const s=t.filter(e=>{const{namespace:t}=(0,n.parseCaipChainId)(e);return t===n.KnownCaipNamespace.Eip155});e.push(...s)}else t.includes(s)&&e.push(s);return e},[]):e},s.snapOwnsAccount=function(e,t){var s;return(null===(s=t.metadata.snap)||void 0===s?void 0:s.id)===e}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/account.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isEqual=void 0,s.isEqual=function(e,t){return e.length===t.length&&e.every((e,s)=>e===t[s])}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs",{"./base64.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/constants.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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.validateAuxiliaryFiles=s.encodeAuxiliaryFile=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/utils"),o=e("./base64.cjs"),r=e("./constants.cjs");s.encodeAuxiliaryFile=async function(e,t){if(t===n.AuxiliaryFileEncoding.Base64)return e;const s=await(0,o.decodeBase64)(e);return t===n.AuxiliaryFileEncoding.Utf8?(0,a.bytesToString)(s):(0,a.bytesToHex)(s)},s.validateAuxiliaryFiles=function(e){for(const t of e)(0,a.assert)(t.size<r.MAX_FILE_SIZE,"Static files required by the Snap must be smaller than 64 MB.")}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs",{"./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.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.decodeBase64=s.encodeBase64=void 0;const n=e("@metamask/utils"),a=e("./bytes.cjs");s.encodeBase64=async function(e){const t=(0,a.getBytes)(e),s="undefined"!=typeof navigator&&"ReactNative"===navigator.product;return"FileReader"in globalThis&&!s?await new Promise((e,s)=>{const n=Object.assign(new FileReader,{onload:()=>e(n.result.replace("data:application/octet-stream;base64,","")),onerror:()=>s(n.error)});n.readAsDataURL(new File([t],"",{type:"application/octet-stream"}))}):(0,n.bytesToBase64)(t)},s.decodeBase64=async function(e){const t=await fetch(`data:application/octet-stream;base64,${e}`);return new Uint8Array(await t.arrayBuffer())}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.cjs",{"./virtual-file/VirtualFile.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/VirtualFile.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.getBytes=void 0;const n=e("@metamask/utils"),a=e("./virtual-file/VirtualFile.cjs");s.getBytes=function(e){const t=e instanceof a.VirtualFile?e.value:e;return"string"==typeof t?(0,n.stringToBytes)(t):t}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.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.SnapCaveatType=void 0,function(e){e.PermittedDerivationPaths="permittedDerivationPaths",e.PermittedCoinTypes="permittedCoinTypes",e.SnapCronjob="snapCronjob",e.TransactionOrigin="transactionOrigin",e.SignatureOrigin="signatureOrigin",e.RpcOrigin="rpcOrigin",e.KeyringOrigin="keyringOrigin",e.SnapIds="snapIds",e.ChainIds="chainIds",e.LookupMatchers="lookupMatchers",e.MaxRequestTime="maxRequestTime",e.ProtocolSnapScopes="protocolSnapScopes"}(n||(s.SnapCaveatType=n={}))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs",{"./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.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.checksumFiles=s.checksum=void 0;const n=e("@metamask/utils"),a=e("./bytes.cjs");async function o(e){return await(0,n.sha256)((0,a.getBytes)(e))}s.checksum=o,s.checksumFiles=async function(e){const t=await Promise.all([...e].sort((e,t)=>((0,n.assert)(e.path!==t.path,"Tried to sort files with non-unique paths."),e.path<t.path?-1:1)).map(async e=>o(e)));return o((0,n.concatBytes)(t))}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/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.MAX_FILE_SIZE=void 0,s.MAX_FILE_SIZE=64e6}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs",{"./time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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","cron-parser":"/home/runner/work/metamask-extension/metamask-extension/node_modules/cron-parser/lib/parser.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isCronjobSpecificationArray=s.CronjobSpecificationArrayStruct=s.isCronjobSpecification=s.CronjobSpecificationStruct=s.CronExpressionStruct=s.CronjobRpcRequestStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),o=e("@metamask/utils"),r=e("cron-parser"),i=e("./time.cjs");s.CronjobRpcRequestStruct=(0,a.object)({jsonrpc:(0,a.optional)(o.JsonRpcVersionStruct),id:(0,a.optional)(o.JsonRpcIdStruct),method:(0,a.string)(),params:(0,a.optional)(o.JsonRpcParamsStruct)}),s.CronExpressionStruct=(0,a.refine)((0,a.string)(),"cronjob expression",e=>{try{return(0,r.parseExpression)(e),!0}catch{return`Expected a cronjob expression, but received: "${e}"`}});const c=(0,a.object)({expression:s.CronExpressionStruct,request:s.CronjobRpcRequestStruct}),l=(0,a.object)({duration:i.ISO8601DurationStruct,request:s.CronjobRpcRequestStruct});s.CronjobSpecificationStruct=(0,n.selectiveUnion)(e=>(0,o.isObject)(e)&&(0,o.hasProperty)(e,"duration")?l:c),s.isCronjobSpecification=function(e){try{return(0,a.create)(e,s.CronjobSpecificationStruct),!0}catch{return!1}},s.CronjobSpecificationArrayStruct=(0,a.array)(s.CronjobSpecificationStruct),s.isCronjobSpecificationArray=function(e){try{return(0,a.create)(e,s.CronjobSpecificationArrayStruct),!0}catch{return!1}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/currency.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.currency=void 0;const n=e("@metamask/superstruct");s.currency=function(e){const t=e.toLowerCase();return(0,n.coerce)((0,n.literal)(t),(0,n.literal)(e.toUpperCase()),e=>(0,n.create)(e.toLowerCase(),(0,n.literal)(t)))}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/currency.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs",{rfdc:"/home/runner/work/metamask-extension/metamask-extension/node_modules/rfdc/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.deepClone=void 0;const a=n(e("rfdc"));s.deepClone=(0,a.default)({proto:!1,circles:!1})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/default-endowments.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_ENDOWMENTS=void 0,s.DEFAULT_ENDOWMENTS=Object.freeze(["atob","btoa","BigInt","console","crypto","Date","Math","setTimeout","clearTimeout","SubtleCrypto","TextDecoder","TextEncoder","URL","URLSearchParams","setInterval","clearInterval","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","isSecureContext","Intl","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","DataView","ArrayBuffer","AbortController","AbortSignal"])}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/default-endowments.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs",{"./array.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs","@metamask/slip44":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/slip44/slip44.json"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.getSlip44ProtocolName=s.getSnapDerivationPathName=s.SNAPS_DERIVATION_PATHS=void 0;const a=n(e("@metamask/slip44")),o=e("./array.cjs");function r(e){var t;return"1"===String(e)?"Test Networks":(null===(t=a.default[e])||void 0===t?void 0:t.name)??null}s.SNAPS_DERIVATION_PATHS=[{path:["m","44'","0'"],curve:"ed25519",name:"Test BIP-32 Path (ed25519)"},{path:["m","44'","1'"],curve:"secp256k1",name:"Testnet"},{path:["m","44'","0'"],curve:"secp256k1",name:"Bitcoin Legacy"},{path:["m","49'","0'"],curve:"secp256k1",name:"Bitcoin Nested SegWit"},{path:["m","49'","1'"],curve:"secp256k1",name:"Bitcoin Testnet Nested SegWit"},{path:["m","84'","0'"],curve:"secp256k1",name:"Bitcoin Native SegWit"},{path:["m","84'","1'"],curve:"secp256k1",name:"Bitcoin Testnet Native SegWit"},{path:["m","86'","0'"],curve:"secp256k1",name:"Bitcoin Taproot"},{path:["m","86'","1'"],curve:"secp256k1",name:"Bitcoin Testnet Taproot"},{path:["m","44'","501'"],curve:"ed25519",name:"Solana"},{path:["m","44'","501'","0'","0'"],curve:"ed25519",name:"Solana"},{path:["m","44'","2'"],curve:"secp256k1",name:"Litecoin"},{path:["m","44'","3'"],curve:"secp256k1",name:"Dogecoin"},{path:["m","44'","60'"],curve:"secp256k1",name:"Ethereum"},{path:["m","44'","118'"],curve:"secp256k1",name:"Atom"},{path:["m","44'","145'"],curve:"secp256k1",name:"Bitcoin Cash"},{path:["m","44'","637'"],curve:"ed25519",name:"Aptos"},{path:["m","44'","714'"],curve:"secp256k1",name:"Binance (BNB)"},{path:["m","44'","784'"],curve:"ed25519",name:"Sui"},{path:["m","44'","931'"],curve:"secp256k1",name:"THORChain (RUNE)"},{path:["m","44'","330'"],curve:"secp256k1",name:"Terra (LUNA)"},{path:["m","44'","459'"],curve:"secp256k1",name:"Kava"},{path:["m","44'","529'"],curve:"secp256k1",name:"Secret Network"},{path:["m","44'","397'","0'"],curve:"ed25519",name:"NEAR Protocol"},{path:["m","44'","1'","0'"],curve:"ed25519",name:"Testnet"},{path:["m","44'","472'"],curve:"ed25519",name:"Arweave"},{path:["m","44'","12586'"],curve:"secp256k1",name:"Mina"},{path:["m","44'","242'"],curve:"ed25519",name:"Nimiq"},{path:["m","44'","1729'","0'","0'"],curve:"ed25519",name:"Tezos"},{path:["m","1789'","0'"],curve:"ed25519",name:"Vega"},{path:["m","1852'","1815'"],curve:"ed25519Bip32",name:"Cardano"},{path:["m","44'","508'","0'","0'","0'"],curve:"ed25519",name:"MultiversX"},{path:["m","44'","709'"],curve:"secp256k1",name:"Avail"},{path:["m","44'","626'"],curve:"ed25519",name:"Kadena"},{path:["m","44'","632'"],curve:"ed25519",name:"Massa"},{path:["m","44'","4218'"],curve:"ed25519",name:"IOTA"}],s.getSnapDerivationPathName=function(e,t){const n=s.SNAPS_DERIVATION_PATHS.find(s=>s.curve===t&&(0,o.isEqual)(s.path,e));if(n)return n.name;if("secp256k1"===t&&"m"===e[0]&&"44'"===e[1]&&e[2].endsWith("'")){return r(e[2].slice(0,-1))??null}return null},s.getSlip44ProtocolName=r}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.STATE_ENCRYPTION_MAGIC_VALUE=s.SIP_6_MAGIC_VALUE=void 0,s.SIP_6_MAGIC_VALUE="1399742832'",s.STATE_ENCRYPTION_MAGIC_VALUE="572232532'"}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/errors.cjs",{"@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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){function n(e,t,s){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,s)}function a(e,t){return e.get(r(e,t))}function o(e,t,s){return e.set(r(e,t),s),s}function r(e,t,s){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:s;throw new TypeError("Private element is not present on this object")}Object.defineProperty(s,"__esModule",{value:!0}),s.TrackableErrorStruct=s.unwrapError=s.isWrappedSnapError=s.isSerializedSnapError=s.isSnapError=s.WrappedSnapError=s.SNAP_ERROR_WRAPPER_MESSAGE=s.SNAP_ERROR_WRAPPER_CODE=void 0;const i=e("@metamask/rpc-errors"),c=e("@metamask/snaps-sdk"),l=e("@metamask/superstruct"),u=e("@metamask/utils");s.SNAP_ERROR_WRAPPER_CODE=-31001,s.SNAP_ERROR_WRAPPER_MESSAGE="Wrapped Snap Error";var d=new WeakMap,m=new WeakMap,h=new WeakMap;class f extends Error{constructor(e){const t=(0,c.getErrorMessage)(e);super(t),n(this,d,void 0),n(this,m,void 0),n(this,h,void 0),o(d,this,e),o(m,this,t),o(h,this,(0,c.getErrorStack)(e)??undefined)}get name(){return"WrappedSnapError"}get message(){return a(m,this)}get stack(){return a(h,this)}toJSON(){const e=p(a(d,this))?a(d,this).serialize():(0,i.serializeCause)(a(d,this));return{code:s.SNAP_ERROR_WRAPPER_CODE,message:s.SNAP_ERROR_WRAPPER_MESSAGE,data:{cause:e}}}serialize(){return this.toJSON()}}function p(e){if((0,u.isObject)(e)&&"serialize"in e&&"function"==typeof e.serialize){const t=e.serialize();return(0,u.isJsonRpcError)(t)&&k(t)}return!1}function k(e){return e.code===c.SNAP_ERROR_CODE&&e.message===c.SNAP_ERROR_MESSAGE}function b(e){return(0,u.isJsonRpcError)(e)&&e.code===s.SNAP_ERROR_WRAPPER_CODE&&e.message===s.SNAP_ERROR_WRAPPER_MESSAGE}function g(e,t,s,n){const a=new i.JsonRpcError(e,t,n);return a.stack=s??undefined,a}s.WrappedSnapError=f,s.isSnapError=p,s.isSerializedSnapError=k,s.isWrappedSnapError=b,s.unwrapError=function(e){if(b(e)){if((0,u.isJsonRpcError)(e.data.cause)){if(k(e.data.cause)){const{code:t,message:s,stack:n,data:a}=e.data.cause.data.cause;return[g(t,s,n,a),!0]}if((0,u.isObject)(e.data.cause.data)&&(0,u.isObject)(e.data.cause.data.cause)&&e.data.cause.message===e.data.cause.data.cause.message){const t=e.data.cause.data.cause,{code:s,message:n}=e.data.cause;return[g(s,n,(0,c.getErrorStack)(t)),!1]}const{code:t,message:s,stack:n,data:a}=e.data.cause;return[g(t,s,n,a),!1]}return[g(i.errorCodes.rpc.internal,(0,c.getErrorMessage)(e.data.cause),(0,c.getErrorStack)(e.data.cause)),!1]}if((0,u.isJsonRpcError)(e)){const{code:t,message:s,stack:n,data:a}=e;return[g(t,s,n,a),!1]}return[g(i.errorCodes.rpc.internal,(0,c.getErrorMessage)(e),(0,c.getErrorStack)(e)),!1]},s.TrackableErrorStruct=(0,l.object)({name:(0,l.string)(),message:(0,l.string)(),stack:(0,l.nullable)((0,l.string)()),cause:(0,l.nullable)((0,l.lazy)(()=>s.TrackableErrorStruct))})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/asset-historical-price.cjs",{"../time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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.OnAssetHistoricalPriceResponseStruct=s.AssetHistoricalPriceStruct=s.HistoricalPriceStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),o=e("../time.cjs");s.HistoricalPriceStruct=(0,n.nonEmptyRecord)((0,a.union)([(0,a.literal)("all"),o.ISO8601DurationStruct]),(0,a.array)((0,a.tuple)([(0,a.number)(),(0,a.string)()]))),s.AssetHistoricalPriceStruct=(0,a.nullable)((0,a.object)({intervals:s.HistoricalPriceStruct,updateTime:(0,a.number)(),expirationTime:(0,a.optional)((0,a.number)())})),s.OnAssetHistoricalPriceResponseStruct=(0,a.object)({historicalPrice:s.AssetHistoricalPriceStruct})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/asset-historical-price.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-conversion.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.OnAssetsConversionResponseStruct=s.AssetConversionStruct=void 0;const n=e("@metamask/superstruct"),a=e("@metamask/utils");s.AssetConversionStruct=(0,n.object)({rate:(0,n.string)(),conversionTime:(0,n.number)(),expirationTime:(0,n.optional)((0,n.number)())}),s.OnAssetsConversionResponseStruct=(0,n.object)({conversionRates:(0,n.record)(a.CaipAssetTypeStruct,(0,n.record)(a.CaipAssetTypeStruct,(0,n.nullable)(s.AssetConversionStruct)))})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-conversion.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-market-data.cjs",{"../time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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.OnAssetsMarketDataResponseStruct=s.AssetMarketDataStruct=s.NonFungibleAssetMarketDataStruct=s.AssetValueStruct=s.FungibleAssetMarketDataStruct=s.PricePercentChangeStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),o=e("@metamask/utils"),r=e("../time.cjs");s.PricePercentChangeStruct=(0,n.nonEmptyRecord)((0,a.union)([(0,a.literal)("all"),r.ISO8601DurationStruct]),(0,a.number)()),s.FungibleAssetMarketDataStruct=(0,a.object)({fungible:(0,a.literal)(!0),marketCap:(0,a.optional)((0,a.string)()),totalVolume:(0,a.optional)((0,a.string)()),circulatingSupply:(0,a.optional)((0,a.string)()),allTimeHigh:(0,a.optional)((0,a.string)()),allTimeLow:(0,a.optional)((0,a.string)()),pricePercentChange:(0,a.optional)(s.PricePercentChangeStruct)}),s.AssetValueStruct=(0,a.object)({asset:o.CaipAssetTypeOrIdStruct,amount:(0,a.string)()}),s.NonFungibleAssetMarketDataStruct=(0,a.object)({fungible:(0,a.literal)(!1),lastSale:(0,a.optional)(s.AssetValueStruct),topBid:(0,a.optional)(s.AssetValueStruct),floorPrice:(0,a.optional)(s.AssetValueStruct),rarity:(0,a.optional)((0,a.object)({ranking:(0,a.optional)((0,a.object)({source:(0,a.string)(),rank:(0,a.number)()})),metadata:(0,a.optional)((0,a.record)((0,a.string)(),(0,a.number)()))}))}),s.AssetMarketDataStruct=(0,n.selectiveUnion)(e=>(0,o.isObject)(e)&&e.fungible?s.FungibleAssetMarketDataStruct:s.NonFungibleAssetMarketDataStruct),s.OnAssetsMarketDataResponseStruct=(0,a.object)({marketData:(0,a.record)(o.CaipAssetTypeOrIdStruct,(0,a.record)(o.CaipAssetTypeStruct,(0,a.nullable)(s.AssetMarketDataStruct)))})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-market-data.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/exports.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/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.SNAP_EXPORT_NAMES=s.SNAP_EXPORTS=void 0;const n=e("./types.cjs");s.SNAP_EXPORTS={[n.HandlerType.OnRpcRequest]:{type:n.HandlerType.OnRpcRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnTransaction]:{type:n.HandlerType.OnTransaction,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnCronjob]:{type:n.HandlerType.OnCronjob,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnNameLookup]:{type:n.HandlerType.OnNameLookup,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnInstall]:{type:n.HandlerType.OnInstall,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnUpdate]:{type:n.HandlerType.OnUpdate,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnStart]:{type:n.HandlerType.OnStart,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnActive]:{type:n.HandlerType.OnActive,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnInactive]:{type:n.HandlerType.OnInactive,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnKeyringRequest]:{type:n.HandlerType.OnKeyringRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnHomePage]:{type:n.HandlerType.OnHomePage,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnSettingsPage]:{type:n.HandlerType.OnSettingsPage,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnSignature]:{type:n.HandlerType.OnSignature,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnUserInput]:{type:n.HandlerType.OnUserInput,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetHistoricalPrice]:{type:n.HandlerType.OnAssetHistoricalPrice,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetsLookup]:{type:n.HandlerType.OnAssetsLookup,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetsConversion]:{type:n.HandlerType.OnAssetsConversion,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetsMarketData]:{type:n.HandlerType.OnAssetsMarketData,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnProtocolRequest]:{type:n.HandlerType.OnProtocolRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnClientRequest]:{type:n.HandlerType.OnClientRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnWebSocketEvent]:{type:n.HandlerType.OnWebSocketEvent,required:!0,validator:e=>"function"==typeof e}},s.SNAP_EXPORT_NAMES=Object.values(n.HandlerType)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/exports.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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.OnHomePageResponseStruct=s.OnHomePageResponseWithIdStruct=s.OnHomePageResponseWithContentStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct");s.OnHomePageResponseWithContentStruct=(0,a.object)({content:n.ComponentOrElementStruct}),s.OnHomePageResponseWithIdStruct=(0,a.object)({id:(0,a.string)()}),s.OnHomePageResponseStruct=(0,a.union)([s.OnHomePageResponseWithContentStruct,s.OnHomePageResponseWithIdStruct])}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/index.cjs",{"./asset-historical-price.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/asset-historical-price.cjs","./assets-conversion.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-conversion.cjs","./assets-market-data.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-market-data.cjs","./exports.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/exports.cjs","./home-page.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs","./name-lookup.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/name-lookup.cjs","./settings-page.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/settings-page.cjs","./signature.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/signature.cjs","./transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/transaction.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]},a=function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./asset-historical-price.cjs"),s),a(e("./assets-conversion.cjs"),s),a(e("./assets-market-data.cjs"),s),a(e("./exports.cjs"),s),a(e("./home-page.cjs"),s),a(e("./name-lookup.cjs"),s),a(e("./settings-page.cjs"),s),a(e("./signature.cjs"),s),a(e("./transaction.cjs"),s),a(e("./types.cjs"),s)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/name-lookup.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.OnNameLookupResponseStruct=s.DomainResolutionResponseStruct=s.AddressResolutionResponseStruct=s.DomainResolutionStruct=s.AddressResolutionStruct=void 0;const n=e("@metamask/superstruct");s.AddressResolutionStruct=(0,n.object)({protocol:(0,n.string)(),resolvedDomain:(0,n.string)()}),s.DomainResolutionStruct=(0,n.object)({protocol:(0,n.string)(),resolvedAddress:(0,n.string)(),domainName:(0,n.string)()}),s.AddressResolutionResponseStruct=(0,n.object)({resolvedDomains:(0,n.size)((0,n.array)(s.AddressResolutionStruct),1,Infinity)}),s.DomainResolutionResponseStruct=(0,n.object)({resolvedAddresses:(0,n.size)((0,n.array)(s.DomainResolutionStruct),1,Infinity)}),s.OnNameLookupResponseStruct=(0,n.nullable)((0,n.union)([s.AddressResolutionResponseStruct,s.DomainResolutionResponseStruct]))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/name-lookup.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/settings-page.cjs",{"./home-page.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnSettingsPageResponseStruct=void 0;const n=e("./home-page.cjs");s.OnSettingsPageResponseStruct=n.OnHomePageResponseStruct}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/settings-page.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/signature.cjs",{"./transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/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.OnSignatureResponseStruct=void 0;const n=e("./transaction.cjs");s.OnSignatureResponseStruct=n.OnTransactionResponseStruct}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/signature.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/transaction.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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.OnTransactionResponseStruct=s.OnTransactionResponseWithContentStruct=s.OnTransactionResponseWithIdStruct=s.OnTransactionSeverityResponseStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct");s.OnTransactionSeverityResponseStruct=(0,a.object)({severity:(0,a.optional)((0,a.literal)(n.SeverityLevel.Critical))}),s.OnTransactionResponseWithIdStruct=(0,a.assign)(s.OnTransactionSeverityResponseStruct,(0,a.object)({id:(0,a.string)()})),s.OnTransactionResponseWithContentStruct=(0,a.assign)(s.OnTransactionSeverityResponseStruct,(0,a.object)({content:n.ComponentOrElementStruct})),s.OnTransactionResponseStruct=(0,a.nullable)((0,a.union)([s.OnTransactionResponseWithContentStruct,s.OnTransactionResponseWithIdStruct]))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/transaction.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/types.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.HandlerType=void 0,function(e){e.OnRpcRequest="onRpcRequest",e.OnSignature="onSignature",e.OnTransaction="onTransaction",e.OnCronjob="onCronjob",e.OnInstall="onInstall",e.OnUpdate="onUpdate",e.OnStart="onStart",e.OnActive="onActive",e.OnInactive="onInactive",e.OnNameLookup="onNameLookup",e.OnKeyringRequest="onKeyringRequest",e.OnHomePage="onHomePage",e.OnSettingsPage="onSettingsPage",e.OnUserInput="onUserInput",e.OnAssetsLookup="onAssetsLookup",e.OnAssetsConversion="onAssetsConversion",e.OnAssetHistoricalPrice="onAssetHistoricalPrice",e.OnAssetsMarketData="onAssetsMarketData",e.OnProtocolRequest="onProtocolRequest",e.OnClientRequest="onClientRequest",e.OnWebSocketEvent="onWebSocketEvent"}(n||(s.HandlerType=n={}))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/icon.cjs",{"./svg.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/svg.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.getSvgDimensions=s.assertIsSnapIcon=s.SVG_MAX_BYTE_SIZE_TEXT=s.SVG_MAX_BYTE_SIZE=void 0;const n=e("@metamask/utils"),a=e("./svg.cjs");s.SVG_MAX_BYTE_SIZE=1e5,s.SVG_MAX_BYTE_SIZE_TEXT=`${Math.floor(s.SVG_MAX_BYTE_SIZE/1e3)}kb`,s.assertIsSnapIcon=function(e){(0,n.assert)(e.path.endsWith(".svg"),'Expected snap icon to end in ".svg".');const t="string"==typeof e.value?(0,n.stringToBytes)(e.value).byteLength:e.value.byteLength;(0,n.assert)(t<=s.SVG_MAX_BYTE_SIZE,`The specified SVG icon exceeds the maximum size of ${s.SVG_MAX_BYTE_SIZE_TEXT}.`),(0,n.assert)((0,a.isSvg)(e.toString()),"Snap icon must be a valid SVG.")},s.getSvgDimensions=function(e){try{const t=(0,a.parseSvg)(e),s=t["@_height"],o=t["@_width"];if(s&&o)return{height:s,width:o};const r=t["@_viewBox"];if(r){const[e,t,s,a]=r.split(" ");if(s&&a){const e=parseInt(s,10),t=parseInt(a,10);return(0,n.assert)(Number.isInteger(e)&&e>0),(0,n.assert)(Number.isInteger(t)&&t>0),{width:e,height:t}}}}catch{throw new Error("Snap icon must be a valid SVG.")}return null}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/icon.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/iframe.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createWindow=void 0,s.createWindow=async function({uri:e,id:t,sandbox:s=!0,testId:n="snaps-iframe"}){return await new Promise((a,o)=>{const r=document.createElement("iframe");r.setAttribute("id",t),r.setAttribute("data-testid",n),s&&r.setAttribute("sandbox","allow-scripts"),r.setAttribute("src",e),document.body.appendChild(r),r.addEventListener("load",()=>{r.contentWindow?a(r.contentWindow):o(new Error(`iframe.contentWindow not present on load for job "${t}".`))},{once:!0})})}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/iframe.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/index.cjs",{"./account.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/account.cjs","./array.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs","./auxiliary-files.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs","./base64.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs","./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.cjs","./caveats.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.cjs","./checksum.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/constants.cjs","./cronjob.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs","./currency.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/currency.cjs","./deep-clone.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs","./default-endowments.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/default-endowments.cjs","./derivation-paths.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs","./entropy.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs","./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/errors.cjs","./handlers/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/index.cjs","./iframe.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/iframe.cjs","./json-rpc.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs","./json.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.cjs","./localization.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/localization.cjs","./logging.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/logging.cjs","./manifest/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/index.cjs","./path.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/path.cjs","./platform-version.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/platform-version.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs","./strings.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs","./structs.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs","./time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs","./ui.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/ui.cjs","./url.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/url.cjs","./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/validation.cjs","./versions.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/versions.cjs","./virtual-file/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]},a=function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./account.cjs"),s),a(e("./array.cjs"),s),a(e("./auxiliary-files.cjs"),s),a(e("./base64.cjs"),s),a(e("./bytes.cjs"),s),a(e("./caveats.cjs"),s),a(e("./checksum.cjs"),s),a(e("./constants.cjs"),s),a(e("./cronjob.cjs"),s),a(e("./currency.cjs"),s),a(e("./deep-clone.cjs"),s),a(e("./default-endowments.cjs"),s),a(e("./derivation-paths.cjs"),s),a(e("./entropy.cjs"),s),a(e("./errors.cjs"),s),a(e("./handlers/index.cjs"),s),a(e("./iframe.cjs"),s),a(e("./json.cjs"),s),a(e("./json-rpc.cjs"),s),a(e("./localization.cjs"),s),a(e("./logging.cjs"),s),a(e("./manifest/index.cjs"),s),a(e("./path.cjs"),s),a(e("./platform-version.cjs"),s),a(e("./snaps.cjs"),s),a(e("./strings.cjs"),s),a(e("./structs.cjs"),s),a(e("./time.cjs"),s),a(e("./types.cjs"),s),a(e("./ui.cjs"),s),a(e("./url.cjs"),s),a(e("./validation.cjs"),s),a(e("./versions.cjs"),s),a(e("./virtual-file/index.cjs"),s)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs",{"@metamask/permission-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/permission-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.assertIsJsonRpcSuccess=s.isOriginAllowed=s.assertIsKeyringOrigins=s.KeyringOriginsStruct=s.assertIsRpcOrigins=s.RpcOriginsStruct=void 0;const n=e("@metamask/permission-controller"),a=e("@metamask/superstruct"),o=e("@metamask/utils"),r=(0,a.array)((0,a.refine)((0,a.string)(),"Allowed origin",e=>!(e.split("*").length-1>2)||'No more than two wildcards ("*") are allowed in an origin specifier.'));function i(e,t){if("*"===e||e===t)return!0;const s=function(e){const t=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&").replace(/\\\*/gu,".*");return RegExp(`^${t}$`,"u")}(e);return s.test(t)}s.RpcOriginsStruct=(0,a.refine)((0,a.object)({dapps:(0,a.optional)((0,a.boolean)()),snaps:(0,a.optional)((0,a.boolean)()),allowedOrigins:(0,a.optional)(r)}),"RPC origins",e=>!!Boolean(!0===e.snaps||!0===e.dapps||e.allowedOrigins&&e.allowedOrigins.length>0)||"Must specify at least one JSON-RPC origin."),s.assertIsRpcOrigins=function(e,t){(0,o.assertStruct)(e,s.RpcOriginsStruct,"Invalid JSON-RPC origins",t)},s.KeyringOriginsStruct=(0,a.object)({allowedOrigins:(0,a.optional)(r)}),s.assertIsKeyringOrigins=function(e,t){(0,o.assertStruct)(e,s.KeyringOriginsStruct,"Invalid keyring origins",t)},s.isOriginAllowed=function(e,t,s){var a;return"metamask"===s||(!(null===(a=e.allowedOrigins)||void 0===a||!a.some(e=>i(e,s)))||(!(t!==n.SubjectType.Website||!e.dapps)||Boolean(t===n.SubjectType.Snap&&e.snaps)))},s.assertIsJsonRpcSuccess=function(e){if(!(0,o.isJsonRpcSuccess)(e)){if((0,o.isJsonRpcFailure)(e))throw new Error(`JSON-RPC request failed: ${e.error.message}`);throw new Error("Invalid JSON-RPC response.")}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.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.getJsonSizeUnsafe=s.parseJson=void 0;const n=e("@metamask/utils");s.parseJson=function(e){return(0,n.getSafeJson)(JSON.parse(e))},s.getJsonSizeUnsafe=function(e,t=!1){const s=JSON.stringify(e);return t?(new TextEncoder).encode(s).byteLength:s.length}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/localization.cjs",{"./json.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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.validateSnapManifestLocalizations=s.getLocalizedSnapManifest=s.translate=s.TRANSLATION_REGEX=s.getLocalizationFile=s.getValidatedLocalizationFiles=s.LocalizationFileStruct=s.LOCALIZABLE_FIELDS=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),o=e("./json.cjs");function r(e,t){const s=t.find(t=>t.locale===e);return s||t.find(e=>"en"===e.locale)}function i(e,t){const n=e.matchAll(s.TRANSLATION_REGEX);return Array.from(n).reduce((s,[n,a])=>{if(!t)throw new Error(`Failed to translate "${e}": No localization file found.`);const o=t.messages[a.trim()];if(!o)throw new Error(`Failed to translate "${e}": No translation found for "${a.trim()}" in "${t.locale}" file.`);return s.replace(n,o.message)},e)}function c(e,t,n){const a=r(t,n);return s.LOCALIZABLE_FIELDS.reduce((e,t)=>{const s=i(e[t],a);return{...e,[t]:s}},e)}s.LOCALIZABLE_FIELDS=["description","proposedName"],s.LocalizationFileStruct=(0,a.object)({locale:(0,a.string)(),messages:(0,a.record)((0,a.string)(),(0,a.object)({message:(0,a.string)(),description:(0,a.optional)((0,a.string)())}))}),s.getValidatedLocalizationFiles=function(e){for(const t of e)try{t.result=(0,a.create)((0,o.parseJson)(t.toString()),s.LocalizationFileStruct)}catch(e){if(e instanceof a.StructError)throw new Error(`Failed to validate localization file "${t.path}": ${e.message}.`);if(e instanceof SyntaxError)throw new Error(`Failed to parse localization file "${t.path}" as JSON.`);throw e}return e},s.getLocalizationFile=r,s.TRANSLATION_REGEX=/\{\{\s?([a-zA-Z0-9-_\s]+)\s?\}\}/gu,s.translate=i,s.getLocalizedSnapManifest=c,s.validateSnapManifestLocalizations=function(e,t){try{t.filter(e=>"en"!==e.locale).forEach(s=>{c(e,s.locale,t)}),c(e,"en",t)}catch(e){throw new Error(`Failed to localize Snap manifest: ${(0,n.getErrorMessage)(e)}`)}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/localization.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/logging.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.logWarning=s.logError=s.logInfo=s.snapsLogger=void 0;const n=e("@metamask/utils");s.snapsLogger=(0,n.createProjectLogger)("snaps"),s.logInfo=function(e,...t){console.log(e,...t)},s.logError=function(e,...t){console.error(e,...t)},s.logWarning=function(e,...t){console.warn(e,...t)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/logging.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/index.cjs",{"./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/validation.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]},a=function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./validation.cjs"),s)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/validation.cjs",{"../array.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs","../cronjob.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs","../entropy.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs","../json-rpc.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs","../snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs","../structs.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs","@metamask/key-tree":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/key-tree/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.createSnapManifest=s.assertIsSnapManifest=s.isSnapManifest=s.SnapManifestStruct=s.InitialConnectionsStruct=s.SnapAuxilaryFilesStruct=s.SnapAuxiliaryFilesStruct=s.PermissionsStruct=s.EmptyObjectStruct=s.HandlerCaveatsStruct=s.ProtocolScopesStruct=s.MaxRequestTimeStruct=s.MAXIMUM_REQUEST_TIMEOUT=s.MINIMUM_REQUEST_TIMEOUT=s.LookupMatchersStruct=s.ChainIdsStruct=s.SnapIdsStruct=s.SemVerRangeStruct=s.SnapGetBip32EntropyPermissionsStruct=s.Bip32EntropyStruct=s.CurveStruct=s.bip32entropy=s.Bip32PathStruct=s.FORBIDDEN_COIN_TYPES=void 0;const n=e("@metamask/key-tree"),a=e("@metamask/superstruct"),o=e("@metamask/utils"),r=e("../array.cjs"),i=e("../cronjob.cjs"),c=e("../entropy.cjs"),l=e("../json-rpc.cjs"),u=e("../snaps.cjs"),d=e("../structs.cjs"),m=e("../types.cjs"),h=[c.SIP_6_MAGIC_VALUE,c.STATE_ENCRYPTION_MAGIC_VALUE];s.FORBIDDEN_COIN_TYPES=[60];const f=s.FORBIDDEN_COIN_TYPES.map(e=>["m","44'",`${e}'`]);s.Bip32PathStruct=(0,a.refine)((0,a.array)((0,a.string)()),"BIP-32 path",e=>0===e.length?"Path must be a non-empty BIP-32 derivation path array":"m"!==e[0]?'Path must start with "m".':e.length<3?"Paths must have a length of at least three.":e.slice(1).some(e=>!(0,n.isValidBIP32PathSegment)(e))?"Path must be a valid BIP-32 derivation path array.":h.includes(e[1])?`The purpose "${e[1]}" is not allowed for entropy derivation.`:!f.some(t=>(0,r.isEqual)(e.slice(0,t.length),t))||`The path "${e.join("/")}" is not allowed for entropy derivation.`);s.bip32entropy=e=>(0,a.refine)(e,"BIP-32 entropy",e=>"ed25519"!==e.curve||!e.path.slice(1).some(e=>!e.endsWith("'"))||"Ed25519 does not support unhardened paths."),s.CurveStruct=(0,a.enums)(["ed25519","secp256k1","ed25519Bip32"]),s.Bip32EntropyStruct=(0,s.bip32entropy)((0,a.type)({path:s.Bip32PathStruct,curve:s.CurveStruct})),s.SnapGetBip32EntropyPermissionsStruct=(0,a.size)((0,a.array)(s.Bip32EntropyStruct),1,Infinity),s.SemVerRangeStruct=(0,a.refine)((0,a.string)(),"SemVer range",e=>!!(0,o.isValidSemVerRange)(e)||"Expected a valid SemVer range."),s.SnapIdsStruct=(0,a.refine)((0,a.record)(u.SnapIdStruct,(0,a.object)({version:(0,a.optional)(s.SemVerRangeStruct)})),"SnapIds",e=>0!==Object.keys(e).length),s.ChainIdsStruct=(0,a.size)((0,a.array)(o.CaipChainIdStruct),1,Infinity),s.LookupMatchersStruct=(0,a.union)([(0,a.object)({tlds:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity)}),(0,a.object)({schemes:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity)}),(0,a.object)({tlds:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity),schemes:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity)})]),s.MINIMUM_REQUEST_TIMEOUT=(0,o.inMilliseconds)(5,o.Duration.Second),s.MAXIMUM_REQUEST_TIMEOUT=(0,o.inMilliseconds)(3,o.Duration.Minute),s.MaxRequestTimeStruct=(0,a.size)((0,a.integer)(),s.MINIMUM_REQUEST_TIMEOUT,s.MAXIMUM_REQUEST_TIMEOUT),s.ProtocolScopesStruct=(0,a.record)(o.CaipChainIdStruct,(0,a.object)({methods:(0,a.array)((0,a.string)())})),s.HandlerCaveatsStruct=(0,a.object)({maxRequestTime:(0,a.optional)(s.MaxRequestTimeStruct)}),s.EmptyObjectStruct=(0,a.object)({}),s.PermissionsStruct=(0,a.type)({"endowment:assets":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({scopes:s.ChainIdsStruct}))),"endowment:cronjob":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({jobs:(0,a.optional)(i.CronjobSpecificationArrayStruct)}))),"endowment:ethereum-provider":(0,a.optional)(s.EmptyObjectStruct),"endowment:keyring":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,l.KeyringOriginsStruct)),"endowment:protocol":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({scopes:s.ProtocolScopesStruct}))),"endowment:lifecycle-hooks":(0,a.optional)(s.HandlerCaveatsStruct),"endowment:name-lookup":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({chains:(0,a.optional)(s.ChainIdsStruct),matchers:(0,a.optional)(s.LookupMatchersStruct)}))),"endowment:network-access":(0,a.optional)(s.EmptyObjectStruct),"endowment:page-home":(0,a.optional)(s.HandlerCaveatsStruct),"endowment:rpc":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,l.RpcOriginsStruct)),"endowment:signature-insight":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({allowSignatureOrigin:(0,a.optional)((0,a.boolean)())}))),"endowment:transaction-insight":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({allowTransactionOrigin:(0,a.optional)((0,a.boolean)())}))),"endowment:webassembly":(0,a.optional)(s.EmptyObjectStruct),snap_dialog:(0,a.optional)(s.EmptyObjectStruct),snap_manageState:(0,a.optional)(s.EmptyObjectStruct),snap_manageAccounts:(0,a.optional)(s.EmptyObjectStruct),snap_notify:(0,a.optional)(s.EmptyObjectStruct),snap_getBip32Entropy:(0,a.optional)(s.SnapGetBip32EntropyPermissionsStruct),snap_getBip32PublicKey:(0,a.optional)(s.SnapGetBip32EntropyPermissionsStruct),snap_getBip44Entropy:(0,a.optional)((0,a.size)((0,a.array)((0,a.object)({coinType:(0,a.size)((0,a.integer)(),0,2**32-1)})),1,Infinity)),snap_getEntropy:(0,a.optional)(s.EmptyObjectStruct),snap_getLocale:(0,a.optional)(s.EmptyObjectStruct),wallet_snap:(0,a.optional)(s.SnapIdsStruct)}),s.SnapAuxiliaryFilesStruct=(0,a.array)((0,a.string)()),s.SnapAuxilaryFilesStruct=s.SnapAuxiliaryFilesStruct,s.InitialConnectionsStruct=(0,a.record)((0,a.intersection)([(0,a.string)(),(0,m.uri)()]),(0,a.object)({})),s.SnapManifestStruct=(0,a.object)({version:o.VersionStruct,description:(0,a.size)((0,a.string)(),1,280),proposedName:(0,a.size)((0,a.string)(),1,214),repository:(0,a.optional)((0,a.type)({type:(0,a.size)((0,a.string)(),1,Infinity),url:(0,a.size)((0,a.string)(),1,Infinity)})),source:(0,a.object)({shasum:o.ChecksumStruct,location:(0,a.object)({npm:(0,a.object)({filePath:(0,a.size)((0,a.string)(),1,Infinity),iconPath:(0,a.optional)((0,a.size)((0,a.string)(),1,Infinity)),packageName:m.NameStruct,registry:(0,a.union)([(0,a.literal)("https://registry.npmjs.org"),(0,a.literal)("https://registry.npmjs.org/")])})}),files:(0,a.optional)(s.SnapAuxiliaryFilesStruct),locales:(0,a.optional)(s.SnapAuxiliaryFilesStruct)}),initialConnections:(0,a.optional)(s.InitialConnectionsStruct),initialPermissions:s.PermissionsStruct,manifestVersion:(0,a.literal)("0.1"),platformVersion:(0,a.optional)(o.VersionStruct),$schema:(0,a.optional)((0,a.string)())}),s.isSnapManifest=function(e){return(0,a.is)(e,s.SnapManifestStruct)},s.assertIsSnapManifest=function(e){(0,o.assertStruct)(e,s.SnapManifestStruct,`"${m.NpmSnapFileNames.Manifest}" is invalid`)},s.createSnapManifest=function(e){return(0,a.create)(e,s.SnapManifestStruct)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/validation.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/path.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.normalizeRelative=void 0;const n=e("@metamask/utils");s.normalizeRelative=function(e){return(0,n.assert)(!e.startsWith("/")),(0,n.assert)(-1===e.search(/:|\/\//u),`Path "${e}" potentially an URI instead of local relative`),e.startsWith("./")?e.slice(2):e}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/path.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/platform-version.cjs",{"@metamask/snaps-sdk/package.json":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/package.json"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.getPlatformVersion=void 0;const a=n(e("@metamask/snaps-sdk/package.json"));s.getPlatformVersion=function(){return a.default.version}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/platform-version.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs",{"./caveats.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.cjs","./checksum.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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","@scure/base":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@scure/base/lib/index.js","fast-json-stable-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-json-stable-stringify/index.js","validate-npm-package-name":"/home/runner/work/metamask-extension/metamask-extension/node_modules/validate-npm-package-name/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.verifyRequestedSnapPermissions=s.isSnapPermitted=s.assertIsValidSnapId=s.isSnapId=s.stripSnapPrefix=s.getSnapPrefix=s.SnapIdStruct=s.SnapIdPrefixStruct=s.HttpSnapIdStruct=s.NpmSnapIdStruct=s.LocalSnapIdStruct=s.BaseSnapIdStruct=s.LOCALHOST_HOSTNAMES=s.validateSnapShasum=s.getSnapChecksum=s.SnapStatusEvents=s.SnapStatus=s.PROPOSED_NAME_REGEX=void 0;const a=e("@metamask/snaps-sdk"),o=e("@metamask/superstruct"),r=e("@metamask/utils"),i=e("@scure/base"),c=n(e("fast-json-stable-stringify")),l=n(e("validate-npm-package-name")),u=e("./caveats.cjs"),d=e("./checksum.cjs"),m=e("./types.cjs");var h,f;function p(e){const t=e.clone();return delete t.result.source.shasum,t.value=(0,c.default)(t.result),t}async function k(e){const{manifest:t,sourceCode:s,svgIcon:n,auxiliaryFiles:a,localizationFiles:o}=e,r=[p(t),s,n,...a,...o].filter(e=>e!==undefined);return i.base64.encode(await(0,d.checksumFiles)(r))}s.PROPOSED_NAME_REGEX=/^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u,function(e){e.Installing="installing",e.Updating="updating",e.Running="running",e.Stopped="stopped",e.Crashed="crashed"}(h||(s.SnapStatus=h={})),function(e){e.Start="START",e.Stop="STOP",e.Crash="CRASH",e.Update="UPDATE"}(f||(s.SnapStatusEvents=f={})),s.getSnapChecksum=k,s.validateSnapShasum=async function(e,t="Invalid Snap manifest: manifest shasum does not match computed shasum."){if(e.manifest.result.source.shasum!==await k(e))throw new Error(t)},s.LOCALHOST_HOSTNAMES=["localhost","127.0.0.1","[::1]"],s.BaseSnapIdStruct=(0,r.definePattern)("Base Snap Id",/^[\x21-\x7E]*$/u);const b=(0,m.uri)({protocol:(0,o.enums)(["http:","https:"]),hostname:(0,o.enums)(s.LOCALHOST_HOSTNAMES),hash:(0,o.empty)((0,o.string)()),search:(0,o.empty)((0,o.string)())});function g(e){const t=Object.values(m.SnapIdPrefixes).find(t=>e.startsWith(t));if(t!==undefined)return t;throw new Error(`Invalid or no prefix found for "${e}"`)}s.LocalSnapIdStruct=(0,o.refine)(s.BaseSnapIdStruct,"local Snap Id",e=>{if(!e.startsWith(m.SnapIdPrefixes.local))return`Expected local snap ID, got "${e}".`;const[t]=(0,o.validate)(e.slice(m.SnapIdPrefixes.local.length),b);return t??!0}),s.NpmSnapIdStruct=(0,o.intersection)([s.BaseSnapIdStruct,(0,m.uri)({protocol:(0,o.literal)(m.SnapIdPrefixes.npm),pathname:(0,o.refine)((0,o.string)(),"package name",function*(e){const t=e.startsWith("/")?e.slice(1):e,{errors:s,validForNewPackages:n,warnings:a}=(0,l.default)(t);return n||(s===undefined?((0,r.assert)(a!==undefined),yield*a):yield*s),!0}),search:(0,o.empty)((0,o.string)()),hash:(0,o.empty)((0,o.string)())})]),s.HttpSnapIdStruct=(0,o.intersection)([s.BaseSnapIdStruct,(0,m.uri)({protocol:(0,o.enums)(["http:","https:"]),search:(0,o.empty)((0,o.string)()),hash:(0,o.empty)((0,o.string)())})]),s.SnapIdPrefixStruct=(0,o.refine)((0,o.string)(),"Snap ID prefix",e=>{if(Object.values(m.SnapIdPrefixes).some(t=>e.startsWith(t)))return!0;return`Invalid or no prefix found. Expected Snap ID to start with one of: ${Object.values(m.SnapIdPrefixes).map(e=>`"${e}"`).join(", ")}, but received: "${e}"`}),s.SnapIdStruct=(0,a.selectiveUnion)(e=>"string"==typeof e&&e.startsWith(m.SnapIdPrefixes.npm)?s.NpmSnapIdStruct:"string"==typeof e&&e.startsWith(m.SnapIdPrefixes.local)?s.LocalSnapIdStruct:s.SnapIdPrefixStruct),s.getSnapPrefix=g,s.stripSnapPrefix=function(e){return e.replace(g(e),"")},s.isSnapId=function(e){return(0,o.is)(e,s.SnapIdStruct)},s.assertIsValidSnapId=function(e){(0,r.assertStruct)(e,s.SnapIdStruct,"Invalid snap ID")},s.isSnapPermitted=function(e,t){var s,n;return Boolean(null===(s=((null==e||null===(n=e.wallet_snap)||void 0===n||null===(n=n.caveats)||void 0===n?void 0:n.find(e=>e.type===u.SnapCaveatType.SnapIds))??{}).value)||void 0===s?void 0:s[t])},s.verifyRequestedSnapPermissions=function(e){(0,r.assert)((0,r.isObject)(e),"Requested permissions must be an object.");const{wallet_snap:t}=e;(0,r.assert)((0,r.isObject)(t),"wallet_snap is missing from the requested permissions.");const{caveats:s}=t;(0,r.assert)(Array.isArray(s)&&1===s.length,"wallet_snap must have a caveat property with a single-item array value.");const[n]=s;(0,r.assert)((0,r.isObject)(n)&&n.type===u.SnapCaveatType.SnapIds&&(0,r.isObject)(n.value),`The requested permissions do not have a valid ${u.SnapCaveatType.SnapIds} caveat.`)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.indent=void 0,s.indent=function(e,t=2){return e.replace(/^/gmu," ".repeat(t))}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs",{"./strings.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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",chalk:"/home/runner/work/metamask-extension/metamask-extension/node_modules/chalk/source/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.mergeStructs=s.createUnion=s.validateUnion=s.getStructErrorMessage=s.getStructFailureMessage=s.getStructErrorPrefix=s.getUnionStructNames=s.getStructFromPath=s.createFromStruct=s.getError=s.arrayToGenerator=s.SnapsStructError=s.named=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),o=e("@metamask/utils"),r=e("chalk"),i=e("./strings.cjs");function c(e,t,s){return s?t(e):e}s.named=function(e,t){return new a.Struct({...t,type:e})};class l extends a.StructError{constructor(e,t,s,n,a,o=!0){super(n,a),this.name="SnapsStructError",this.message=`${t}.\n\n${k(e,[...a()],o)}${s?`\n\n${s}`:""}`}}function*u(e){for(const t of e)yield t}function d({struct:e,prefix:t,suffix:s="",error:n,colorize:a}){return new l(e,t,s,n,()=>u(n.failures()),a)}function m(e,t){return t.reduce((t,s)=>(0,o.isObject)(e.schema)&&e.schema[s]?e.schema[s]:t,e)}function h(e,t=!0){return Array.isArray(e.schema)?e.schema.map(({type:e})=>c(e,r.green,t)):null}function f(e,t=!0){return"never"===e.type||0===e.path.length?"":`At path: ${c(e.path.join("."),r.bold,t)} — `}function p(e,t,s=!0){const n=c(JSON.stringify(t.value),r.red,s),a=f(t,s);if("union"===t.type){const o=h(m(e,t.path),s);return o?`${a}Expected the value to be one of: ${o.join(", ")}, but received: ${n}.`:`${a}${t.message}.`}if("literal"===t.type){return`${a}${t.message.replace(/the literal `(.+)`,/u,`the value to be \`${c("$1",r.green,s)}\`,`).replace(/, but received: (.+)/u,`, but received: ${c("$1",r.red,s)}`)}.`}if("never"===t.type)return`Unknown key: ${c(t.path.join("."),r.bold,s)}, received: ${n}.`;if("size"===t.refinement){return`${a}${t.message.replace(/length between `(\d+)` and `(\d+)`/u,`length between ${c("$1",r.green,s)} and ${c("$2",r.green,s)},`).replace(/length of `(\d+)`/u,`length of ${c("$1",r.red,s)}`).replace(/a array/u,"an array")}.`}return t.refinement!==undefined?`${a}${t.message}.`:`${a}Expected a value of type ${c(t.type,r.green,s)}, but received: ${n}.`}function k(e,t,s=!0){return t.map(t=>(0,i.indent)(`• ${p(e,t,s)}`)).join("\n")}function b(e,t,s,r=!1){(0,o.assert)(t.schema,"Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`."),(0,o.assert)(t.schema.length>0,"Expected a non-empty array of structs.");const i=t.schema.map(e=>e.schema[s]),c=(0,a.type)({[s]:(0,n.union)(i)}),[l]=(0,a.validate)(e,c,{coerce:r});if(l)throw new Error(p(c,l.failures()[0],!1));const u=e,d=t.schema.filter(e=>(0,a.is)(u[s],e.schema[s]));(0,o.assert)(d.length>0,"Expected a struct to match the value.");const m=d.map(e=>(0,a.validate)(u,e,{coerce:r})),h=m.find(([e])=>!e);if(h)return h[1];(0,o.assert)(m[0][0],"Expected at least one error.");const f=m.reduce((e,[t])=>((0,o.assert)(t,"Expected an error."),t.failures().length<e.failures().length?t:e),m[0][0]);throw new Error(p(t,f.failures()[0],!1))}s.SnapsStructError=l,s.arrayToGenerator=u,s.getError=d,s.createFromStruct=function(e,t,s,n=""){try{return(0,a.create)(e,t)}catch(e){if(e instanceof a.StructError)throw d({struct:t,prefix:s,suffix:n,error:e});throw e}},s.getStructFromPath=m,s.getUnionStructNames=h,s.getStructErrorPrefix=f,s.getStructFailureMessage=p,s.getStructErrorMessage=k,s.validateUnion=b,s.createUnion=function(e,t,s){return b(e,t,s,!0)},s.mergeStructs=function(...e){const t=a.assign(...e);return new a.Struct({...t,*refiner(t,s){for(const n of e)yield*n.refiner(t,s)}})}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/svg.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","fast-xml-parser":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-xml-parser/lib/fxp.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isSvg=s.parseSvg=void 0;const n=e("@metamask/utils"),a=e("fast-xml-parser");function o(e){try{const t=e.trim();(0,n.assert)(t.length>0);const s=new a.XMLParser({ignoreAttributes:!1,parseAttributeValue:!0}).parse(t,!0);return(0,n.assert)((0,n.hasProperty)(s,"svg")),(0,n.isObject)(s.svg)?s.svg:{}}catch{throw new Error("Snap icon must be a valid SVG.")}}s.parseSvg=o,s.isSvg=function(e){try{return o(e),!0}catch{return!1}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/svg.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs",luxon:"/home/runner/work/metamask-extension/metamask-extension/node_modules/luxon/build/cjs-browser/luxon.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ISO8601DateStruct=s.toCensoredISO8601String=s.ISO8601DurationStruct=void 0;const n=e("@metamask/superstruct"),a=e("luxon");s.ISO8601DurationStruct=(0,n.refine)((0,n.string)(),"ISO 8601 duration",e=>!!a.Duration.fromISO(e).isValid||"Not a valid ISO 8601 duration"),s.toCensoredISO8601String=function(e){return a.DateTime.fromISO(e,{setZone:!0}).startOf("second").toISO({suppressMilliseconds:!0})};var o=e("@metamask/snaps-sdk");Object.defineProperty(s,"ISO8601DateStruct",{enumerable:!0,get:function(){return o.ISO8601DateStruct}})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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.WALLET_SNAP_PERMISSION_KEY=s.isValidUrl=s.uri=s.SNAP_STREAM_NAMES=s.SnapIdPrefixes=s.NpmSnapPackageJsonStruct=s.NameStruct=s.NpmSnapFileNames=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),o=e("@metamask/utils");var r,i,c;!function(e){e.PackageJson="package.json",e.Manifest="snap.manifest.json"}(r||(s.NpmSnapFileNames=r={})),s.NameStruct=(0,a.size)((0,o.definePattern)("Snap Name",/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u),1,214),s.NpmSnapPackageJsonStruct=(0,a.type)({version:o.VersionStruct,name:s.NameStruct,main:(0,a.optional)((0,a.size)((0,a.string)(),1,Infinity)),repository:(0,a.optional)((0,a.type)({type:(0,a.size)((0,a.string)(),1,Infinity),url:(0,a.size)((0,a.string)(),1,Infinity)}))}),function(e){e.npm="npm:",e.local="local:"}(i||(s.SnapIdPrefixes=i={})),function(e){e.JSON_RPC="jsonRpc",e.COMMAND="command"}(c||(s.SNAP_STREAM_NAMES=c={}));var l=e("@metamask/snaps-sdk");Object.defineProperty(s,"uri",{enumerable:!0,get:function(){return l.uri}}),s.isValidUrl=function(e,t={}){return(0,a.is)(e,(0,n.uri)(t))},s.WALLET_SNAP_PERMISSION_KEY="wallet_snap"}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs"}]],[],{});