LavaPack.loadBundle([[100,{"../../../../shared/constants/defi-referrals":8512,"../../../../shared/constants/network":8528,"../../../../shared/lib/delegation/utils":8632},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.checkGmxHasReferralCode=async function(e,t){try{const n=e.findNetworkClientIdByChainId(r.CHAIN_IDS.ARBITRUM),{provider:a}=e.getNetworkClientById(n),o=(0,i.toFunctionSelector)("traderReferralCodes(address)"),c=`${o}${t.toLowerCase().replace("0x","").padStart(64,"0")}`,u=await a.request({method:"eth_call",params:[{to:s.GMX_REFERRAL_STORAGE_ADDRESS,data:c},"latest"]});return"string"==typeof u&&0n!==BigInt(u)}catch{return!1}};var r=e("../../../../shared/constants/network"),s=e("../../../../shared/constants/defi-referrals"),i=e("../../../../shared/lib/delegation/utils")}}},{package:"$root$",file:"app/scripts/lib/defi-referrals/referral-onchain-check.ts"}],[1e3,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const r=[];var s;n.LogLevel=void 0,(s=n.LogLevel||(n.LogLevel={}))[s.DEBUG=0]="DEBUG",s[s.VERBOSE=1]="VERBOSE",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.SILENT=5]="SILENT";const i={debug:n.LogLevel.DEBUG,verbose:n.LogLevel.VERBOSE,info:n.LogLevel.INFO,warn:n.LogLevel.WARN,error:n.LogLevel.ERROR,silent:n.LogLevel.SILENT},a=n.LogLevel.INFO,o={[n.LogLevel.DEBUG]:"log",[n.LogLevel.VERBOSE]:"log",[n.LogLevel.INFO]:"info",[n.LogLevel.WARN]:"warn",[n.LogLevel.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),s=o[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${r}]  ${e.name}:`,...n)};n.Logger=class{constructor(e){this.name=e,this._logLevel=a,this._logHandler=c,this._userLogHandler=null,r.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?i[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.DEBUG,...e),this._logHandler(this,n.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.VERBOSE,...e),this._logHandler(this,n.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.INFO,...e),this._logHandler(this,n.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.WARN,...e),this._logHandler(this,n.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.ERROR,...e),this._logHandler(this,n.LogLevel.ERROR,...e)}},n.setLogLevel=function(e){r.forEach(t=>{t.setLogLevel(e)})},n.setUserLogHandler=function(e,t){for(const s of r){let r=null;t&&t.level&&(r=i[t.level]),s.userLogHandler=null===e?null:(t,s,...i)=>{const a=i.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");s>=(null!=r?r:t.logLevel)&&e({level:n.LogLevel[s].toLowerCase(),message:a,args:i,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],[1001,{"@firebase/app":997,"@firebase/component":998,"@firebase/installations":999,"@firebase/util":1003,idb:6871},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deleteToken=function(e){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return async function(e){if(!navigator)throw M.create("only-available-in-window");e.swRegistration||await U(e);return async function(e){const t=await E(e.firebaseDependencies);t&&(await P(e.firebaseDependencies,t.token),await async function(e){const t=A(e),n=(await k()).transaction(S,"readwrite");await n.objectStore(S).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();if(n)return n.unsubscribe();return!0}(e)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=(0,i.getModularInstance)(e))},n.getMessaging=
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,a.getApp)()){return V().then(e=>{if(!e)throw M.create("unsupported-browser")},e=>{throw M.create("indexed-db-unsupported")}),(0,a._getProvider)((0,i.getModularInstance)(e),"messaging").getImmediate()},n.getToken=async function(e,t){return q(e=(0,i.getModularInstance)(e),t)},n.isSupported=V,n.onMessage=function(e,t){return function(e,t){if(!navigator)throw M.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,i.getModularInstance)(e),t)},e("@firebase/installations");var r=e("@firebase/component"),s=e("idb"),i=e("@firebase/util"),a=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",u="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",l="https://fcmregistrations.googleapis.com/v1",d="google.c.a.c_id",p=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 m(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function g(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;++e)r[e]=n.charCodeAt(e);return 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.
 */!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 y="fcm_token_details_db",w=5,b="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 v="firebase-messaging-database",T=1,S="firebase-messaging-store";let _=null;function k(){return _||(_=(0,s.openDB)(v,T,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(S)}})),_}async function E(e){const t=A(e),n=await k(),r=await n.transaction(S).objectStore(S).get(t);if(r)return r;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(y))return null}let t=null;return(await(0,s.openDB)(y,w,{upgrade:async(n,r,s,i)=>{var a;if(r<2)return;if(!n.objectStoreNames.contains(b))return;const o=i.objectStore(b),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===r){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:m(e.vapidKey)}}}else if(3===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}else if(4===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}}})).close(),await(0,s.deleteDB)(y),await(0,s.deleteDB)("fcm_vapid_details_db"),await(0,s.deleteDB)("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await I(e,t),t}}async function I(e,t){const n=A(e),r=(await k()).transaction(S,"readwrite");return await r.objectStore(S).put(t,n),await r.done,t}function A({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const C={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},M=new i.ErrorFactory("messaging","Messaging",C);async function P(e,t){const n={method:"DELETE",headers:await j(e)};try{const r=await fetch(`${O(e.appConfig)}/${t}`,n),s=await r.json();if(s.error){const e=s.error.message;throw M.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw M.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function O({projectId:e}){return`${l}/projects/${e}/registrations`}async function j({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function x({p256dh:e,auth:t,endpoint:n,vapidKey:r}){const s={web:{endpoint:n,auth:t,p256dh:e}};return r!==u&&(s.web.applicationPubKey=r),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.
 */const N=6048e5;async function R(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:g(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:m(t.getKey("auth")),p256dh:m(t.getKey("p256dh"))},r=await E(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,s=t.auth===e.auth,i=t.p256dh===e.p256dh;return n&&r&&s&&i}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(r.subscriptionOptions,n))return Date.now()>=r.createTime+N?async function(e,t){try{const n=await async function(e,t){const n=await j(e),r=x(t.subscriptionOptions),s={method:"PATCH",headers:n,body:JSON.stringify(r)};let i;try{const n=await fetch(`${O(e.appConfig)}/${t.token}`,s);i=await n.json()}catch(e){throw M.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw M.create("token-update-failed",{errorInfo:e})}if(!i.token)throw M.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),r=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await I(e.firebaseDependencies,r),n}catch(e){throw e}}(e,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await P(e.firebaseDependencies,r.token)}catch(e){console.warn(e)}return D(e.firebaseDependencies,n)}return D(e.firebaseDependencies,n)}async function D(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await j(e),r=x(t),s={method:"POST",headers:n,body:JSON.stringify(r)};let i;try{const t=await fetch(O(e.appConfig),s);i=await t.json()}catch(e){throw M.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw M.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw M.create("token-subscribe-no-token");return i.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await I(e,r),r.token}function F(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const r=t.notification.body;r&&(e.notification.body=r);const s=t.notification.image;s&&(e.notification.image=s);const i=t.notification.icon;i&&(e.notification.icon=i)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,r,s,i,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const o=null!==(s=null===(r=t.fcmOptions)||void 0===r?void 0:r.link)&&void 0!==s?s:null===(i=t.notification)||void 0===i?void 0:i.click_action;o&&(e.fcmOptions.link=o);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}function B(e){return M.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
!function(e,t){const n=[];for(let r=0;r<e.length;r++)n.push(e.charAt(r)),r<t.length&&n.push(t.charAt(r));n.join("")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class L{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const r=function(e){if(!e||!e.options)throw B("App Configuration Object");if(!e.name)throw B("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw B(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:r,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e){try{e.swRegistration=await navigator.serviceWorker.register(o,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,n)=>{const r=setTimeout(()=>n(new Error(`Service worker not registered after ${p} ms`)),p),s=e.installing||e.waiting;e.active?(clearTimeout(r),t()):s?s.onstatechange=e=>{var n;"activated"===(null===(n=e.target)||void 0===n?void 0:n.state)&&(s.onstatechange=null,clearTimeout(r),t())}:(clearTimeout(r),n(new Error("No incoming service worker found.")))})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e.swRegistration)}catch(e){throw M.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 q(e,t){if(!navigator)throw M.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw M.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=u)}(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 M.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),R(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,n){const r=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(r,{message_id:n[d],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function $(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===f.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(F(n)):e.onMessageHandler.next(F(n)));const r=n.data;var s;"object"==typeof(s=r)&&s&&d in s&&"1"===r["google.c.a.e"]&&await H(e,n.messageType,r)}const W="@firebase/messaging",K="0.12.16",G=e=>{const t=new L(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>$(t,e)),t},Q=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>q(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 V(){try{await(0,i.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,i.isIndexedDBAvailable)()&&(0,i.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,a._registerComponent)(new r.Component("messaging",G,"PUBLIC")),(0,a._registerComponent)(new r.Component("messaging-internal",Q,"PRIVATE")),(0,a.registerVersion)(W,K),(0,a.registerVersion)(W,K,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],[1002,{"@firebase/app":997,"@firebase/component":998,"@firebase/installations":999,"@firebase/util":1003,idb:6871},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),e("@firebase/installations");var r=e("@firebase/component"),s=e("idb"),i=e("@firebase/util"),a=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var u,l;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function d(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;++e)r[e]=n.charCodeAt(e);return 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.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(u||(u={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(l||(l={}));const h="fcm_token_details_db",f="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const m="firebase-messaging-store";let g=null;function y(){return g||(g=s.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(m)}})),g}async function w(e){const t=v(e),n=await y(),r=await n.transaction(m).objectStore(m).get(t);if(r)return r;{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 s.openDB(h,5,{upgrade:async(n,r,s,i)=>{var a;if(r<2)return;if(!n.objectStoreNames.contains(f))return;const o=i.objectStore(f),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===r){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a: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===r){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===r){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 s.deleteDB(h),await s.deleteDB("fcm_vapid_details_db"),await s.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 b(e,t),t}}async function b(e,t){const n=v(e),r=(await y()).transaction(m,"readwrite");return await r.objectStore(m).put(t,n),await r.done,t}function v({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const T={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},S=new i.ErrorFactory("messaging","Messaging",T);async function _(e,t){const n={method:"DELETE",headers:await E(e)};try{const r=await fetch(`${k(e.appConfig)}/${t}`,n),s=await r.json();if(s.error){const e=s.error.message;throw S.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw S.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function k({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function E({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function I({p256dh:e,auth:t,endpoint:n,vapidKey:r}){const s={web:{endpoint:n,auth:t,p256dh:e}};return r!==o&&(s.web.applicationPubKey=r),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.
 */async function A(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:p(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:d(t.getKey("auth")),p256dh:d(t.getKey("p256dh"))},r=await w(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,s=t.auth===e.auth,i=t.p256dh===e.p256dh;return n&&r&&s&&i}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(r.subscriptionOptions,n))return Date.now()>=r.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await E(e),r=I(t.subscriptionOptions),s={method:"PATCH",headers:n,body:JSON.stringify(r)};let i;try{const n=await fetch(`${k(e.appConfig)}/${t.token}`,s);i=await n.json()}catch(e){throw S.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw S.create("token-update-failed",{errorInfo:e})}if(!i.token)throw S.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),r=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await b(e.firebaseDependencies,r),n}catch(e){throw e}}(e,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await _(e.firebaseDependencies,r.token)}catch(e){console.warn(e)}return M(e.firebaseDependencies,n)}return M(e.firebaseDependencies,n)}async function C(e){const t=await w(e.firebaseDependencies);t&&(await _(e.firebaseDependencies,t.token),await async function(e){const t=v(e),n=(await y()).transaction(m,"readwrite");await n.objectStore(m).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function M(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await E(e),r=I(t),s={method:"POST",headers:n,body:JSON.stringify(r)};let i;try{const t=await fetch(k(e.appConfig),s);i=await t.json()}catch(e){throw S.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw S.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw S.create("token-subscribe-no-token");return i.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await b(e,r),r.token}async function P(e,t){const n=function(e,t){var n,r;const s={};e.from&&(s.project_number=e.from);e.fcmMessageId&&(s.message_id=e.fcmMessageId);s.instance_id=t,e.notification?s.message_type=u.DISPLAY_NOTIFICATION.toString():s.message_type=u.DATA_MESSAGE.toString();s.sdk_platform=3..toString(),s.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(s.collapse_key=e.collapse_key);s.event=1..toString(),!(null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label)||(s.analytics_label=null===(r=e.fcmOptions)||void 0===r?void 0:r.analytics_label);return s}(t,await e.firebaseDependencies.installations.getId());!function(e,t,n){const r={};r.event_time_ms=Math.floor(Date.now()).toString(),r.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!n||(r.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(n));e.logEvents.push(r)}(e,n,t.productId)}async function O(e,t){const n=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!n)return;t.deliveryMetricsExportedToBigQueryEnabled&&await P(t,n);const r=await x();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(r))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=l.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(r,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:r}=Notification;n&&r&&n.length>r&&console.warn(`This browser only supports ${r} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={[c]:e},t}(n)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const r=t.notification.body;r&&(e.notification.body=r);const s=t.notification.image;s&&(e.notification.image=s);const i=t.notification.icon;i&&(e.notification.icon=i)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,r,s,i,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const o=null!==(s=null===(r=t.fcmOptions)||void 0===r?void 0:r.link)&&void 0!==s?s:null===(i=t.notification)||void 0===i?void 0:i.click_action;o&&(e.fcmOptions.link=o);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function j(e){var t,n;const r=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n[c];if(!r)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const s=function(e){var t,n,r;const s=null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(r=e.notification)||void 0===r?void 0:r.click_action;if(s)return s;return i=e.data,"object"==typeof i&&i&&"google.c.a.c_id"in i?self.location.origin:null;var i;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(r);if(!s)return;const i=new URL(s,self.location.href),a=new URL(self.location.origin);if(i.host!==a.host)return;let o=await async function(e){const t=await x();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(i);var u;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */return o?o=await o.focus():(o=await self.clients.openWindow(s),await(u=3e3,new Promise(e=>{setTimeout(e,u)}))),o?(r.messageType=l.NOTIFICATION_CLICKED,r.isFirebaseMessaging=!0,o.postMessage(r)):void 0}function x(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function N(e){return S.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e,t){const n=[];for(let r=0;r<e.length;r++)n.push(e.charAt(r)),r<t.length&&n.push(t.charAt(r));n.join("")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class R{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const r=function(e){if(!e||!e.options)throw N("App Configuration Object");if(!e.name)throw N("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw N(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:r,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const D=e=>{const t=new R(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 n,r;const{newSubscription:s}=e;if(!s)return void await C(t);const i=await w(t.firebaseDependencies);await C(t),t.vapidKey=null!==(r=null===(n=null==i?void 0:i.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==r?r:o,await A(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(j(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 F(){return i.isIndexedDBAvailable()&&await i.validateIndexedDBOpenable()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */a._registerComponent(new r.Component("messaging-sw",D,"PUBLIC")),n.experimentalSetDeliveryMetricsExportedToBigQueryEnabled=function(e,t){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=i.getModularInstance(e),t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getMessaging=function(e=a.getApp()){return F().then(e=>{if(!e)throw S.create("unsupported-browser")},e=>{throw S.create("indexed-db-unsupported")}),a._getProvider(i.getModularInstance(e),"messaging-sw").getImmediate()},n.isSupported=F,n.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw S.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=i.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],[1003,{_process:7475},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.Sha1=n.RANDOM_FACTOR=n.MAX_VALUE_MILLIS=n.FirebaseError=n.ErrorFactory=n.Deferred=n.DecodeBase64StringError=n.CONSTANTS=void 0,n.areCookiesEnabled=function(){if("undefined"==typeof navigator||!navigator.cookieEnabled)return!1;return!0}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.assertionError=n.assert=void 0,n.async=function(e,t){return(...n)=>{Promise.resolve(!0).then(()=>{e(...n)}).catch(e=>{t&&t(e)})}},n.base64urlEncodeWithoutPadding=n.base64Encode=n.base64Decode=n.base64=void 0,n.calculateBackoffMillis=function(e,t=M,n=P){const r=t*Math.pow(n,e),s=Math.round(j*r*(Math.random()-.5)*2);return Math.min(O,r+s)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.createMockUserToken=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},e);return[u(JSON.stringify({alg:"none",type:"JWT"})),u(JSON.stringify(i)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.createSubscribe=function(e,t){const n=new I(e,t);return n.subscribe.bind(n)},n.decode=void 0,n.deepCopy=function(e){return d(undefined,e)},n.deepEqual=function e(t,n){if(t===n)return!0;const r=Object.keys(t),s=Object.keys(n);for(const i of r){if(!s.includes(i))return!1;const r=t[i],a=n[i];if(E(r)&&E(a)){if(!e(r,a))return!1}else if(r!==a)return!1}for(const e of s)if(!r.includes(e))return!1;return!0},n.deepExtend=d,n.errorPrefix=C,n.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:undefined)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getExperimentalSetting=n.getDefaults=n.getDefaultEmulatorHostnameAndPort=n.getDefaultEmulatorHost=n.getDefaultAppConfig=void 0,n.getGlobal=h,n.getModularInstance=
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e){return e&&e._delegate?e._delegate:e},n.getUA=y,n.isAdmin=void 0,n.isBrowser=function(){return"undefined"!=typeof window||b()},n.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},n.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},n.isElectron=function(){return y().indexOf("Electron/")>=0},n.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},n.isIE=function(){const e=y();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},n.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},n.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(y())},n.isNode=w,n.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},n.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},n.isSafari=function(){return!w()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},n.isUWP=function(){return y().indexOf("MSAppHost/")>=0},n.isValidTimestamp=n.isValidFormat=void 0,n.isWebWorker=b,n.issuedAtTime=void 0,n.jsonEval=_,n.map=function(e,t,n){const r={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=t.call(n,e[s],s,e));return r},n.ordinal=function(e){if(!Number.isFinite(e))return`${e}`;return e+function(e){e=Math.abs(e);const t=e%100;if(t>=10&&t<=20)return"th";const n=e%10;if(1===n)return"st";if(2===n)return"nd";if(3===n)return"rd";return"th"}(e)},n.promiseWithTimeout=
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e,t=2e3){const n=new g;return setTimeout(()=>n.reject("timeout!"),t),e.then(n.resolve,n.reject),n.promise}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.querystring=function(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""},n.querystringDecode=function(e){const t={},n=e.replace(/^\?/,"").split("&");return n.forEach(e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t},n.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},n.stringToByteArray=n.stringLength=void 0,n.stringify=function(e){return JSON.stringify(e)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateArgCount=void 0,n.validateCallback=function(e,t,n,r){if(r&&!n)return;if("function"!=typeof n)throw new Error(C(e,t)+"must be a valid function.")},n.validateContextObject=function(e,t,n,r){if(r&&!n)return;if("object"!=typeof n||null===n)throw new Error(C(e,t)+"must be a valid context object.")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},n.validateNamespace=function(e,t,n){if(n&&!t)return;if("string"!=typeof t)throw new Error(C(e,"namespace")+"must be a valid firebase namespace.")};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const t=n.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},r=function(e,t){if(!e)throw s(t)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.assert=r;const s=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.assertionError=s;const i=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t},a=n.base64={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const s=e[t],i=t+1<e.length,a=i?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,u=s>>2,l=(3&s)<<4|a>>4;let d=(15&a)<<2|c>>6,p=63&c;o||(p=64,i||(d=64)),r.push(n[u],n[l],n[d],n[p])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const s=n[e.charAt(t++)],i=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==s||null==i||null==a||null==c)throw new o;const u=s<<2|i>>4;if(r.push(u),64!==a){const e=i<<4&240|a>>2;if(r.push(e),64!==c){const e=a<<6&192|c;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class o extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}n.DecodeBase64StringError=o;const c=function(e){const t=i(e);return a.encodeByteArray(t,!0)};n.base64Encode=c;const u=function(e){return c(e).replace(/\./g,"")};n.base64urlEncodeWithoutPadding=u;const l=function(e){try{return a.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 n in t)t.hasOwnProperty(n)&&p(n)&&(e[n]=d(e[n],t[n]));return e}function p(e){return"__proto__"!==e}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function h(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.base64Decode=l;const f=()=>{try{return h().__FIREBASE_DEFAULTS__||(()=>{if(void 0===e||void 0===e.env)return})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&l(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};n.getDefaults=f;const m=e=>{var t,n;return null===(n=null===(t=f())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]};n.getDefaultEmulatorHost=m;n.getDefaultEmulatorHostnameAndPort=e=>{const t=m(e);if(!t)return undefined;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]};n.getDefaultAppConfig=()=>{var e;return null===(e=f())||void 0===e?void 0:e.config};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.getExperimentalSetting=e=>{var t;return null===(t=f())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function y(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function w(){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 b(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}n.Deferred=g;class v extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,v.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,T.prototype.create)}}n.FirebaseError=v;class T{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],i=s?function(e,t){return e.replace(S,(e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`})}(s,n):"Error",a=`${this.serviceName}: ${i} (${r}).`;return new v(r,a,n)}}n.ErrorFactory=T;const S=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function _(e){return JSON.parse(e)}const k=function(e){let t={},n={},r={},s="";try{const i=e.split(".");t=_(l(i[0])||""),n=_(l(i[1])||""),s=i[2],r=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:r,signature:s}};n.decode=k;n.isValidTimestamp=function(e){const t=k(e).claims,n=Math.floor((new Date).getTime()/1e3);let r=0,s=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?r=t.nbf:t.hasOwnProperty("iat")&&(r=t.iat),s=t.hasOwnProperty("exp")?t.exp:r+86400),!!n&&!!r&&!!s&&n>=r&&n<=s};n.issuedAtTime=function(e){const t=k(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};n.isValidFormat=function(e){const t=k(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function E(e){return null!==e&&"object"==typeof e}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.isAdmin=function(e){const t=k(e).claims;return"object"==typeof t&&!0===t.admin};n.Sha1=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const n=this.W_;if("string"==typeof e)for(let r=0;r<16;r++)n[r]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let r=0;r<16;r++)n[r]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=n[e-3]^n[e-8]^n[e-14]^n[e-16];n[e]=4294967295&(t<<1|t>>>31)}let r,s,i=this.chain_[0],a=this.chain_[1],o=this.chain_[2],c=this.chain_[3],u=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(r=c^a&(o^c),s=1518500249):(r=a^o^c,s=1859775393):e<60?(r=a&o|c&(a|o),s=2400959708):(r=a^o^c,s=3395469782);const t=(i<<5|i>>>27)+r+u+s+n[e]&4294967295;u=c,c=o,o=4294967295&(a<<30|a>>>2),a=i,i=t}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+u&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const n=t-this.blockSize;let r=0;const s=this.buf_;let i=this.inbuf_;for(;r<t;){if(0===i)for(;r<=n;)this.compress_(e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(s[i]=e.charCodeAt(r),++i,++r,i===this.blockSize){this.compress_(s),i=0;break}}else for(;r<t;)if(s[i]=e[r],++i,++r,i===this.blockSize){this.compress_(s),i=0;break}}this.inbuf_=i,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let n=0;for(let t=0;t<5;t++)for(let r=24;r>=0;r-=8)e[n]=this.chain_[t]>>r&255,++n;return e}};class I{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(e===undefined&&t===undefined&&n===undefined)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},r.next===undefined&&(r.next=A),r.error===undefined&&(r.error=A),r.complete===undefined&&(r.complete=A);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),s}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 A(){}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function C(e,t){return`${e} failed: ${t} argument `}n.validateArgCount=function(e,t,n,r){let s;if(r<t?s="at least "+t:r>n&&(s=0===n?"none":"no more than "+n),s){throw new Error(e+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+s+".")}};n.stringToByteArray=function(e){const t=[];let n=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);if(i>=55296&&i<=56319){const t=i-55296;s++,r(s<e.length,"Surrogate pair missing trail surrogate.");i=65536+(t<<10)+(e.charCodeAt(s)-56320)}i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):i<65536?(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.stringLength=function(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);r<128?t++:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3}return t};const M=1e3,P=2,O=n.MAX_VALUE_MILLIS=144e5,j=n.RANDOM_FACTOR=.5}).call(this)}).call(this,e("_process"))}}},{package:"@metamask/notification-services-controller>firebase>@firebase/util",file:"node_modules/@firebase/util/dist/index.esm2017.js"}],[101,{"@metamask/browser-passworder":1548},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.encryptorFactory=void 0;var r=e("@metamask/browser-passworder");const s=e=>async(t,n,s,i)=>(0,r.encrypt)(t,n,s,i,{algorithm:"PBKDF2",params:{iterations:e}}),i=e=>async(t,n,s)=>(0,r.encryptWithDetail)(t,n,s,{algorithm:"PBKDF2",params:{iterations:e}}),a=e=>async(t,n,s,i)=>(0,r.keyFromPassword)(t,n,s,i??{algorithm:"PBKDF2",params:{iterations:e}}),o=e=>t=>(0,r.isVaultUpdated)(t,{algorithm:"PBKDF2",params:{iterations:e}});n.encryptorFactory=e=>({encrypt:s(e),encryptWithKey:r.encryptWithKey,encryptWithDetail:i(e),decrypt:r.decrypt,decryptWithKey:r.decryptWithKey,decryptWithDetail:r.decryptWithDetail,keyFromPassword:a(e),isVaultUpdated:o(e),importKey:r.importKey,exportKey:r.exportKey,generateSalt:r.generateSalt})}}},{package:"$root$",file:"app/scripts/lib/encryptor-factory.ts"}],[102,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){t.exports=[{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"resolver",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"ttl",outputs:[{name:"",type:"uint64"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"}],name:"setOwner",outputs:[],payable:!1,type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"label",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"}]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/ens-registry.json"}],[103,{"./ens-registry.json":102},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,s=(r=e("./ens-registry.json"))&&r.__esModule?r:{default:r};n.default=s.default}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/registry.ts"}],[1035,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});class r{static parse(e){if(""===e)return new r([]);if(!e.startsWith("/"))throw new s(e);const[,...t]=e.split("/");return new r(t.map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~")))}constructor(e){this.tokens=e}toString(){if(0===this.tokens.length)return"";return`/${this.tokens.map(e=>e.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`}shmeval(e){for(const t of this.tokens){if(!e.hasOwnProperty(t))throw new i(e,t);e=e[t]}return e}}n.default=r;class s extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}n.InvalidPtrError=s;class i extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}n.EvalError=i}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver>@json-schema-spec/json-pointer",file:"node_modules/@json-schema-spec/json-pointer/lib/index.js"}],[1036,{"@json-schema-tools/reference-resolver":1041,"@json-schema-tools/traverse":1044,"fast-safe-stringify":6605},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var o=a(e("@json-schema-tools/traverse")),c=a(e("@json-schema-tools/reference-resolver")),u=a(e("fast-safe-stringify")),l=function(e){this.name="NonStringRefError",this.message=["NonStringRefError","Found an improperly formatted $ref in schema. $ref must be a string","schema in question: ".concat((0,u.default)(e))].join("\n")};n.NonStringRefError=l;var d=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var n=r(r({},t),e);return delete n.$ref,n}return t},p=function(){function e(e,t){var n;if(void 0===t&&(t={}),this.options=t,this.refCache={},n=!0===this.options.mutate||!0===e||!1===e?e:r({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=n),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=n),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var s=0,i=Object.keys(this.options.protocolHandlerMap);s<i.length;s++){var a=i[s];c.default.protocolHandlerMap[a]=this.options.protocolHandlerMap[a]}this.schema=n,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return s(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this._resolve()];case 1:return e.sent(),delete this.schema.definitions,delete this.schema.components,[2,this.schema]}})})},e.prototype._resolve=function(){return s(this,void 0,void 0,function(){var t,n,s,a,u,l,p,h,f,m,g,y=this;return i(this,function(i){switch(i.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return y.refCache[e]===undefined}),n=[],s=0,a=t,i.label=1;case 1:return s<a.length?(u=a[s],l=void 0,this.refCache[u]===undefined?[3,2]:(l=this.refCache[u],[3,5])):[3,11];case 2:if("#"!==u)return[3,3];if(this.options.rootSchema===undefined)throw new Error("options.rootSchema was not provided, but one of the schemas references '#'");return l=this.options.rootSchema,[3,5];case 3:return p=c.default.resolve(u,this.options.rootSchema),n.push(p),[4,p];case 4:l=i.sent(),i.label=5;case 5:return!0!==this.options.recursive||!0===l||!1===l||"#"===u?[3,9]:(h=r(r({},this.options),{refCache:this.refCache}),0===(f=new e(l,h)).refs.length?[3,7]:(m=f._resolve(),n.push(m),[4,m]));case 6:return g=i.sent(),this.refCache[u]=d(l,g),[3,8];case 7:this.refCache[u]=l,i.label=8;case 8:return[3,10];case 9:this.refCache[u]=l,i.label=10;case 10:return s++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=d(this.schema,this.refCache[this.schema.$ref]):(0,o.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=y.refCache[e.$ref];return d(e,t)}return e},{mutable:!0}),[4,Promise.all(n)];case 12:return i.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,o.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new l(t);e.push(t.$ref)}return t}),e},e}();n.default=p}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],[1037,{"./dereferencer":1036},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var s=r(e("./dereferencer")),i=e("./dereferencer");Object.defineProperty(n,"NonStringRefError",{enumerable:!0,get:function(){return i.NonStringRefError}}),n.default=s.default}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/index.js"}],[1038,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.jsonSchema=void 0,n.jsonSchema={$schema:"https://meta.json-schema.tools/",$id:"https://meta.json-schema.tools/",title:"JSONSchema",default:{},oneOf:[{$ref:"#/definitions/JSONSchemaObject"},{$ref:"#/definitions/JSONSchemaBoolean"}],definitions:{JSONSchemaBoolean:{title:"JSONSchemaBoolean",description:"Always valid if true. Never valid if false. Is constant.",type:"boolean"},JSONSchemaObject:{title:"JSONSchemaObject",type:"object",properties:{$id:{title:"$id",type:"string",format:"uri-reference"},$schema:{title:"$schema",type:"string",format:"uri"},$ref:{title:"$ref",type:"string",format:"uri-reference"},$comment:{title:"$comment",type:"string"},title:{title:"title",type:"string"},description:{title:"description",type:"string"},default:!0,readOnly:{title:"readOnly",type:"boolean",default:!1},examples:{title:"examples",type:"array",items:!0},multipleOf:{title:"multipleOf",type:"number",exclusiveMinimum:0},maximum:{title:"maximum",type:"number"},exclusiveMaximum:{title:"exclusiveMaximum",type:"number"},minimum:{title:"minimum",type:"number"},exclusiveMinimum:{title:"exclusiveMinimum",type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{title:"pattern",type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{title:"items",anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{title:"uniqueItems",type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{title:"definitions",type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{title:"properties",type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{title:"patternProperties",type:"object",additionalProperties:{$ref:"#"},propertyNames:{title:"propertyNames",format:"regex"},default:{}},dependencies:{title:"dependencies",type:"object",additionalProperties:{title:"dependenciesSet",anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{title:"enum",type:"array",items:!0,minItems:1,uniqueItems:!0},type:{title:"type",anyOf:[{$ref:"#/definitions/simpleTypes"},{title:"arrayOfSimpleTypes",type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{title:"format",type:"string"},contentMediaType:{title:"contentMediaType",type:"string"},contentEncoding:{title:"contentEncoding",type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}}},schemaArray:{title:"schemaArray",type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{title:"nonNegativeInteger",type:"integer",minimum:0},nonNegativeIntegerDefault0:{title:"nonNegativeIntegerDefaultZero",type:"integer",minimum:0,default:0},simpleTypes:{title:"simpleTypes",type:"string",enum:["array","boolean","integer","null","number","object","string"]},stringArray:{title:"stringArray",type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}},n.default=n.jsonSchema}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/meta-schema",file:"node_modules/@json-schema-tools/meta-schema/index.js"}],[1039,{"./errors":1040,"isomorphic-fetch":6907},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var a=e("./errors"),o=i(e("isomorphic-fetch")),c=function(e){return r(void 0,void 0,void 0,function(){var t,n;return s(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,(0,o.default)(e)];case 1:return t=r.sent(),[3,3];case 2:throw r.sent(),new a.InvalidRemoteURLError(e);case 3:return r.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,r.sent()];case 5:throw n=r.sent(),new a.NonJsonRefError({$ref:e},n.message);case 6:return[2]}})})};n.default={https:c,http:c}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js"}],[104,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t,n,r){return{constant:"view"===r||"pure"===r,inputs:[...t],name:e,outputs:n.length?[...n]:[],payable:!1,stateMutability:r,type:"function"}}function s(e,t){return{anonymous:!1,inputs:[...t],name:e,type:"event"}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;const i=e=>({name:e,type:"bytes32"}),a=[r("setContent",[i("node"),i("hash")],[],"nonpayable"),r("content",[i("node")],[{name:"",type:"bytes32"}],"view"),r("supportsInterface",[{name:"interfaceID",type:"bytes4"}],[{name:"",type:"bool"}],"pure"),r("setText",[i("node"),{name:"key",type:"string"},{name:"value",type:"string"}],[],"nonpayable"),r("ABI",[i("node"),{name:"contentTypes",type:"uint256"}],[{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],"view"),r("setPubkey",[i("node"),i("x"),i("y")],[],"nonpayable"),r("setContenthash",[i("node"),{name:"hash",type:"bytes"}],[],"nonpayable"),r("addr",[i("node")],[{name:"",type:"address"}],"view"),r("text",[i("node"),{name:"key",type:"string"}],[{name:"",type:"string"}],"view"),r("setABI",[i("node"),{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],[],"nonpayable"),r("name",[i("node")],[{name:"",type:"string"}],"view"),r("setName",[i("node"),{name:"name",type:"string"}],[],"nonpayable"),r("contenthash",[i("node")],[{name:"",type:"bytes"}],"view"),r("pubkey",[i("node")],[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],"view"),r("setAddr",[i("node"),{name:"addr",type:"address"}],[],"nonpayable"),{inputs:[{name:"ensAddr",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},s("AddrChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"a",type:"address"}]),s("NameChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"name",type:"string"}]),s("ABIChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"contentType",type:"uint256"}]),s("PubkeyChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"x",type:"bytes32"},{indexed:!1,name:"y",type:"bytes32"}]),s("TextChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"indexedKey",type:"string"},{indexed:!1,name:"key",type:"string"}]),s("ContenthashChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"hash",type:"bytes"}])];n.default=a}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/resolver.ts"}],[1040,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidFileSystemPathError=n.InvalidRemoteURLError=n.NotResolvableError=n.NonJsonRefError=void 0;var r=function(e,t){this.name="NonJsonRefError",this.message=["NonJsonRefError","The resolved value at the reference: ".concat(e.$ref," was not JSON.parse 'able"),"The non-json content in question: ".concat(t)].join("\n")};n.NonJsonRefError=r;var s=function(e){this.name="NotResolvableError",this.message=["NotResolvableError","Could not resolve the reference: ".concat(e),"No protocol handler was found, and it was not found to be an internal reference"].join("\n")};n.NotResolvableError=s;var i=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};n.InvalidRemoteURLError=i;var a=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};n.InvalidFileSystemPathError=a}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/errors.js"}],[1041,{"./default-protocol-handler-map":1039,"./reference-resolver":1042},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var o=a(e("./default-protocol-handler-map")),c=a(e("./reference-resolver")),u=r(r({},o.default),{file:function(){return s(void 0,void 0,void 0,function(){return i(this,function(e){return[2,undefined]})})}});n.default=new c.default(u)}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/index-web.js"}],[1042,{"./errors":1040,"./resolve-pointer":1043},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var a=e("./errors"),o=i(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return r(this,arguments,void 0,function(e,t){var n,r,i,c,u,l,d,p,h,f;return void 0===t&&(t={}),s(this,function(s){switch(s.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,o.default)(e,t))];(n=e.split("#")).length>1&&(r=n[n.length-1]),i=n[0],s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(i,t)];case 2:return c=s.sent(),[3,4];case 3:throw u=s.sent(),new a.NonJsonRefError({$ref:e},u.message);case 4:if(c!==undefined)return f=c,r&&(f=(0,o.default)(r,f)),[2,f];if(!1===e.includes("://"))throw new a.InvalidFileSystemPathError(e);l=0,d=Object.keys(this.protocolHandlerMap),s.label=5;case 5:return l<d.length?(p=d[l],i.startsWith(p)?[4,this.protocolHandlerMap[p](i,t)]:[3,7]):[3,8];case 6:if((h=s.sent())!==undefined)return f=h,r&&(f=(0,o.default)(r,f)),[2,f];s.label=7;case 7:return l++,[3,5];case 8:throw new a.NotResolvableError(e)}})})},e}();n.default=c}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"}],[1043,{"@json-schema-spec/json-pointer":1035},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidJsonPointerRefError=void 0;var s=r(e("@json-schema-spec/json-pointer")),i=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};n.InvalidJsonPointerRefError=i,n.default=function(e,t){try{var n=e.replace("#","");return s.default.parse(n).shmeval(t)}catch(t){throw new i(e,t.message)}}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"}],[1044,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)},s=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,s=0,i=t.length;s<i;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(n,"__esModule",{value:!0}),n.defaultOptions=void 0,n.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var i=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},a=function(e,t){var n=t.find(function(t){return t===e});return n||!1},o=function(e,t){return void 0===t&&(t=1),e[e.length-t]};n.default=function e(t,c,u,l,d,p,h,f,m){void 0===u&&(u=n.defaultOptions),void 0===l&&(l=0),void 0===d&&(d=[]),void 0===p&&(p=[]),void 0===h&&(h=[]),void 0===f&&(f=[]),void 0===m&&(m=[]);var g=r(r({},n.defaultOptions),u);if(0===l&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===l?t:c(t,!1,i(h),o(p));var y=t;!1===g.mutable&&(y=r({},t)),p.push(y),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===l||(y=c(y,!1,i(h),o(p,2)))),d.push(t),f.push([t,y]);var w=function(t,n){var r=a(t,d);return r?(m.push(r),!0===g.skipFirstMutation&&r===d[0]?c(t,!0,i(n),o(p)):f.find(function(e){var t=e[0];return r===t})[1]):e(t,c,u,l+1,d,p,n,f,m)};if(t.anyOf)y.anyOf=t.anyOf.map(function(e,t){return w(e,s(s([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)y.allOf=t.allOf.map(function(e,t){return w(e,s(s([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)y.oneOf=t.oneOf.map(function(e,t){return w(e,s(s([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)y.items=t.items.map(function(e,t){return w(e,s(s([],h,!0),["items[".concat(t,"]")],!1))});else{var b=a(t.items,d);if(b)if(m.push(b),!0===g.skipFirstMutation&&b===d[0])y.items=c(t.items,!0,i(h),o(p));else{var v=f.find(function(e){var t=e[0];return b===t})[1];y.items=v}else y.items=e(t.items,c,u,l+1,d,p,s(s([],h,!0),["items"],!1),f,m)}if(t.additionalItems!==undefined&&(y.additionalItems=w(t.additionalItems,s(s([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var T=t.properties,S={};Object.keys(t.properties).forEach(function(e){S[e]=w(T[e],s(s([],h,!0),["properties",e.toString()],!1))}),y.properties=S}if(t.patternProperties!==undefined){var _=t.patternProperties,k={};Object.keys(t.patternProperties).forEach(function(e){k[e]=w(_[e],s(s([],h,!0),["patternProperties",e.toString()],!1))}),y.patternProperties=k}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(y.additionalProperties=w(t.additionalProperties,s(s([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===l)return y;if(!0===g.bfs)return p.pop(),y;var E=-1!==m.indexOf(t);return p.pop(),c(y,E,i(h),o(p))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],[105,{"./contracts/registry":103,"./contracts/resolver":104,"@ensdomains/content-hash":792,"@ethersproject/contracts":907,"@ethersproject/providers":945,"eth-ens-namehash":6492},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=async function({provider:e,name:t}){const n=r.default.hash(t),u=Number.parseInt(await e.request({method:"net_version"}),10),d=function(e){switch(e){case 1:case 3:case 4:case 5:case 6:return"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";default:return null}}(u);if(!d)throw new Error(`EnsIpfsResolver - no known ens-ipfs registry for chainId "${u}"`);const p=new i.Web3Provider(e),h=new a.Contract(d,o.default,p),f=await h.resolver(n);if(l(f))throw new Error(`EnsIpfsResolver - no resolver found for name "${t}"`);const m=new a.Contract(f,c.default,p),g=await m.supportsInterface("0xbc1c58d1"),y=await m.supportsInterface("0xd8389dc5");if(g){const e=await m.contenthash(n);let t=s.default.decode(e);const r=s.default.getCodec(e);return"ipfs-ns"!==r&&"ipns-ns"!==r||(t=s.default.helpers.cidV0ToV1Base32(t)),{type:r,hash:t}}if(y){const e=await m.content(n);if(l(e))throw new Error(`EnsIpfsResolver - no content ID found for name "${t}"`);return{type:"swarm-ns",hash:e.slice(2)}}throw new Error(`EnsIpfsResolver - the resolver for name "${t}" is not standard, it should either supports contenthash() or content()`)};var r=u(e("eth-ens-namehash")),s=u(e("@ensdomains/content-hash")),i=e("@ethersproject/providers"),a=e("@ethersproject/contracts"),o=u(e("./contracts/registry")),c=u(e("./contracts/resolver"));function u(e){return e&&e.__esModule?e:{default:e}}function l(e){return[undefined,null,"0x","0x0","0x0000000000000000000000000000000000000000000000000000000000000000"].includes(e)}}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/resolver.js"}],[106,{"../../../../shared/lib/fetch-with-timeout":8642,"./resolver":105,"base32-encode":6205,"base64-js":6206,"webextension-polyfill":8489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function({provider:e,getCurrentChainId:t,getIpfsGateway:n,getUseAddressBarEnsResolution:a}){const c=l.map(e=>`*://*.${e}/*`);return i.default.webRequest.onErrorOccurred.addListener(d,{urls:c,types:["main_frame"]}),{remove(){i.default.webRequest.onErrorOccurred.removeListener(d)}};async function d(c){const{tabId:d,url:p}=c;if(-1===d||"0x1"!==t())return;const{hostname:h,pathname:f,search:m,hash:g}=new URL(p),y=h.split("."),w=y[y.length-1];l.includes(w)&&async function({tabId:t,name:c,pathname:l,search:d,fragment:p}){const h=n(),f=a(),m=`https://app.ens.domains/name/${c}`;f&&h&&await i.default.tabs.update(t,{url:"loading.html"});let g=m;0;try{const{type:t,hash:n}=await(0,o.default)({provider:e,name:c});if("ipfs-ns"===t||"ipns-ns"===t){if(""===h)return void(g=null);const e=`https://${n}.${t.slice(0,4)}.${h}${l}${d||""}${p||""}`;try{200===(await u(e,{method:"HEAD"})).status&&(g=e)}catch(e){console.warn(e)}}else if("swarm-ns"===t)g=`https://swarm-gateways.net/bzz:/${n}${l}${d||""}${p||""}`;else if("onion"===t||"onion3"===t)g=`http://${n}.onion${l}${d||""}${p||""}`;else if("zeronet"===t)g=`http://127.0.0.1:43110/${n}${l}${d||""}${p||""}`;else if("skynet-ns"===t){const e=n.padEnd(n.length+4-n.length%4,"="),t=s.default.toByteArray(e),i={padding:!1};g=`https://${(0,r.default)(t,"RFC4648-HEX",i).toLowerCase()}.siasky.net${l}${d||""}${p||""}`}}catch(e){console.warn(e)}finally{g&&(f||!f&&g!==m)&&await i.default.tabs.update(t,{url:g})}}({tabId:d,name:h,pathname:f,search:m,fragment:g})}};var r=c(e("base32-encode")),s=c(e("base64-js")),i=c(e("webextension-polyfill")),a=c(e("../../../../shared/lib/fetch-with-timeout")),o=c(e("./resolver"));function c(e){return e&&e.__esModule?e:{default:e}}const u=(0,a.default)(),l=["eth"]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/setup.js"}],[107,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t,n){s(e,t),t.set(e,n)}function s(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(e,t){return e.get(a(e,t))}function a(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}Object.defineProperty(n,"__esModule",{value:!0}),n.ExtensionLazyListener=void 0;var o=new WeakMap,c=new WeakMap,u=new WeakSet;function l(e){setTimeout(()=>{for(const[t,n]of i(c,this))for(const[r,{args:s}]of n){const n=`ExtensionLazyListener: Possible memory leak detected. The event "${t}.${r}" has been listened to, but no application code has added a listener after ${e}ms. There are currently ${s.length} buffered calls. If you are a developer of this extension, please ensure that you have added a listener for this event. If you are a user of this extension, please report this warning to the developers of the extension.`;console.warn(n)}},e)}function d(e,t){return i(o,this)[e][t]}n.ExtensionLazyListener=class{constructor(e,t={},n=2e4){var p,h;s(p=this,h=u),h.add(p),r(this,o,void 0),r(this,c,new Map),function(e,t,n){e.set(a(e,t),n)}(o,this,e);for(const[e,n]of Object.entries(t)){const t=new Map;for(const r of n){const n=[],s=(...e)=>{n.push(e)};a(u,this,d).call(this,e,r).addListener(s),t.set(r,{listener:s,args:n})}i(c,this).set(e,t)}a(u,this,l).call(this,n)}addListener(e,t,n){const r=a(u,this,d).call(this,e,t);r.addListener(n);const s=i(c,this).get(e);if(s){const a=s.get(t);if(a){r.removeListener(a.listener),s.delete(t),0===s.size&&i(c,this).delete(e);const{args:o}=a;for(let u=0,{length:l}=o;u<l;u++)try{if(n(...o[u]),!r.hasListener(n)){const n=u+1;n!==l&&(o.splice(0,n),s.set(t,a),i(c,this).set(e,s),r.addListener(a.listener));break}}catch(n){const d=u+1;throw d!==l&&(o.splice(0,d),s.set(t,a),i(c,this).set(e,s),r.addListener(a.listener)),n}}}}once(e,t){return new Promise(n=>{const r=a(u,this,d).call(this,e,t),s=i(c,this).get(e);if(s){const a=s.get(t),o=a?.args.length;if(o)return n(a.args.shift()),r.removeListener(a.listener),void(1===o&&(s.delete(t),0===s.size&&i(c,this).delete(e)))}const o=(...e)=>{r.removeListener(o),n(e)};r.addListener(o)})}}}}},{package:"$root$",file:"app/scripts/lib/extension-lazy-listener/extension-lazy-listener.ts"}],[108,{"@metamask/snaps-sdk":3705,"@metamask/snaps-utils":3822},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.forwardRequestToSnap=async function(e,t,n,i){const{method:a,params:o}=n,{handleRequest:c,snapId:u,onBeforeRequest:l,onAfterRequest:d}=e;if(!u)throw new s.InternalError(`No snapId configured for method ${a}`);const p=i.get("origin");if(!p)throw new s.InternalError(`No origin specified for method ${a}`);try{l?.()}catch(e){try{d?.()}catch(e){console.error("Error from onAfterRequest hook:",e)}throw e}let h;try{h=await c({snapId:u,origin:p,handler:r.HandlerType.OnRpcRequest,request:{jsonrpc:"2.0",method:a,params:o}})}catch(e){try{d?.()}catch(e){console.error("Error from onAfterRequest hook:",e)}throw e}return d?.(),h};var r=e("@metamask/snaps-utils"),s=e("@metamask/snaps-sdk")}}},{package:"$root$",file:"app/scripts/lib/forwardRequestToSnap.ts"}],[109,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getIframeProperties=function({frameId:e,origin:t,mainFrameOrigin:n}){const r="number"==typeof e&&0!==e,s=r&&"string"==typeof n&&t!==n;return{is_iframe:r,is_cross_origin_iframe:s,iframe_origin:s?t:null,top_level_origin:s?n:null}}}}},{package:"$root$",file:"app/scripts/lib/getIframeProperties.ts"}],[110,{lodash:7181},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){return s((0,r.cloneDeep)(e),e=>null===e?"null":typeof e)};var r=e("lodash");function s(e={},t){return Object.entries(e).forEach(([n,r])=>{e[n]="object"==typeof r&&null!==r?s(r,t):t(r)}),e}}}},{package:"$root$",file:"app/scripts/lib/getObjStructure.js"}],[111,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hardwareKeyringBuilderFactory=function(e,t){const n=()=>new e({bridge:new t});return n.type=e.type,n}}}},{package:"$root$",file:"app/scripts/lib/hardware-keyring-builder-factory.ts"}],[113,{"../../../shared/lib/messenger-tracing":8669,"../../../shared/lib/sentry":8709,"@metamask/messenger":2871},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ROOT_MESSENGER_NAMESPACE=void 0,n.getRootMessenger=function(){const e=new r.Messenger({namespace:a,captureException:s.captureException});return(0,i.wrapMessengerWithTracing)(e)};var r=e("@metamask/messenger"),s=e("../../../shared/lib/sentry"),i=e("../../../shared/lib/messenger-tracing");const a=n.ROOT_MESSENGER_NAMESPACE="Root"}}},{package:"$root$",file:"app/scripts/lib/messenger.ts"}],[115,{"../util":210},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createPendingNonceMiddleware=function({getPendingNonce:e}){return async({request:t,context:n,next:r})=>{const{method:s,params:i}=t;if("eth_getTransactionCount"!==s)return r();const[a,o]=i;return"pending"!==o?r():await e(a,n.get("networkClientId"))}},n.createPendingTxMiddleware=function({getPendingTransactionByHash:e}){return async({request:t,next:n})=>{const{method:s,params:i}=t;if("eth_getTransactionByHash"!==s)return n();const[a]=i,o=e(a);return o?(0,r.formatTxMetaForRpcResult)(o):n()}};var r=e("../util")}}},{package:"$root$",file:"app/scripts/lib/middleware/pending.ts"}],[116,{"../../../../shared/lib/stores/persistence-manager":8723,"@metamask/utils":4030,events:6585,loglevel:7191},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("events")),s=o(e("loglevel")),i=e("@metamask/utils"),a=e("../../../../shared/lib/stores/persistence-manager");function o(e){return e&&e.__esModule?e:{default:e}}class c extends r.default{constructor(e={}){super();const t=e.migrations||[];this.migrations=t.sort((e,t)=>e.version-t.version);const n=this.migrations.slice(-1)[0];this.defaultVersion=e.defaultVersion||n&&n.version||0}async migrateData(e=this.generateInitialState()){const t=(0,i.isObject)(e.data)&&e.meta.version<186?new Set(Object.keys(e.data)):new Set;let n=e;for(const e of this.migrations)if(a(e))try{let r;if(s.default.info(`Running migration ${e.version}...`),e.version<186)r=await e.migrate(n),o(r,e);else{r=structuredClone(n);const i=new Set,a=await e.migrate(r,i);if(o(r,e),void 0!==a)throw new Error("Migrator - migration returned value when none expected");if(0===i.size)s.default.debug(`Migrator - migration ${e.version} did not report any changes`);else for(const e of i)t.add(e)}n=r,s.default.info(`Migration ${e.version} complete`)}catch(t){const n=new AggregateError([t],`MetaMask Migration Error #${e.version}`);this.emit("error",n);break}const r=e.meta.version<186&&(0,i.isObject)(n.data)?new Set(Object.keys(n.data)):new Set;for(const e of t)r.add(e);return{state:n,changedKeys:r};function a(e){return e.version>n.meta.version}function o(e,t){if(!e.data)throw new Error("Migrator - migration returned empty data");if(e.version!==undefined&&e.meta.version!==t.version)throw new Error("Migrator - Migration did not update version number correctly")}}generateInitialState(e){return{data:e,meta:{storageKind:a.PersistenceManager.defaultStorageKind,version:this.defaultVersion}}}}n.default=c}}},{package:"$root$",file:"app/scripts/lib/migrator/index.js"}],[117,{"../../../../shared/constants/metametrics":8524,"../../../../shared/lib/only-keep-host":8684,"../../controllers/analytics":21,"../util":210,"./utils":118,"@metamask/utils":4030,loglevel:7191},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.onRpcEndpointDegraded=function({chainId:e,duration:t,endpointUrl:n,error:r,infuraProjectId:s,analyticsId:i,retryReason:o,rpcMethodName:c,traceId:u,type:l}){d(a.MetaMetricsEventName.RpcServiceDegraded,{chainId:e,duration:t,endpointUrl:n,error:r,infuraProjectId:s,analyticsId:i,retryReason:o,rpcMethodName:c,traceId:u,type:l})},n.onRpcEndpointUnavailable=function({chainId:e,endpointUrl:t,error:n,infuraProjectId:r,analyticsId:s}){d(a.MetaMetricsEventName.RpcServiceUnavailable,{chainId:e,endpointUrl:t,error:n,infuraProjectId:r,analyticsId:s})},n.trackRpcEndpointEvent=d;var r,s=(r=e("loglevel"))&&r.__esModule?r:{default:r},i=e("@metamask/utils"),a=e("../../../../shared/constants/metametrics"),o=e("../../../../shared/lib/only-keep-host"),c=e("../util"),u=e("../../controllers/analytics"),l=e("./utils");function d(e,{chainId:t,duration:n,endpointUrl:r,error:d,infuraProjectId:p,retryReason:h,rpcMethodName:f,traceId:m,type:g,analyticsId:y}){if(!(0,l.shouldCreateRpcServiceEvents)({error:d,analyticsId:y}))return;const w=(0,c.isPublicEndpointUrl)(r,p)?(0,o.onlyKeepHost)(r):"custom",b={chain_id_caip:`eip155:${(0,i.hexToNumber)(t)}`,rpc_domain:w,rpc_endpoint_url:w,...f?{rpc_method_name:f}:{},...g?{type:g}:{},...h?{retry_reason:h}:{},...n===undefined?{}:{duration_ms:n},...m===undefined?{}:{trace_id:m},...(0,i.isObject)(d)&&"httpStatus"in d&&(0,i.isValidJson)(d.httpStatus)?{http_status:d.httpStatus}:{}};s.default.debug(`Creating Segment event "${e}" with ${JSON.stringify(b)}`),(0,u.trackEvent)((0,u.createEventBuilder)(e).addCategory(a.MetaMetricsEventCategory.Network).addProperties(b).build())}}}},{package:"$root$",file:"app/scripts/lib/network-controller/messenger-action-handlers.ts"}],[118,{"../../../../shared/constants/build":8506,"@metamask/network-controller":3007,"@metamask/remote-feature-flag-controller":3455},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.PRODUCTION_LIKE_ENVIRONMENTS=void 0,n.shouldCreateRpcServiceEvents=function({error:e,analyticsId:t}){return(!e||!(0,r.isConnectionError)(e))&&t!==undefined&&null!==t&&function(e){if("pull-request"===undefined)return!1;if(o.includes("pull-request"))return(0,s.generateDeterministicRandomNumber)(e)<a;return!0}(t)};var r=e("@metamask/network-controller"),s=e("@metamask/remote-feature-flag-controller"),i=e("../../../../shared/constants/build");const a=.01,o=n.PRODUCTION_LIKE_ENVIRONMENTS=[i.ENVIRONMENT.PRODUCTION,i.ENVIRONMENT.RELEASE_CANDIDATE]}}},{package:"$root$",file:"app/scripts/lib/network-controller/utils.ts"}],[119,{"../../../shared/constants/notifications":8529,"../platforms/extension":685,"@metamask/safe-event-emitter":3465},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.NOTIFICATION_MANAGER_EVENTS=void 0;var r=a(e("@metamask/safe-event-emitter")),s=a(e("../platforms/extension")),i=e("../../../shared/constants/notifications");function a(e){return e&&e.__esModule?e:{default:e}}const o=n.NOTIFICATION_MANAGER_EVENTS={POPUP_CLOSED:"onPopupClosed"};class c extends r.default{constructor(){super(),this.platform=new s.default,this.platform.addOnRemovedListener(this._onWindowClosed.bind(this))}markAsAutomaticallyClosed(){this._popupAutomaticallyClosed=!0}async showPopup(e,t){this._popupId=t,this._setCurrentPopupId=e;const n=await this._getPopup(t);if(n)await this.platform.focusWindow(n.id);else{let e=0,t=0;try{const n=await this.platform.getLastFocusedWindow();t=n.top,e=Math.max(n.left+(n.width-i.NOTIFICATION_WIDTH),0)}catch(n){const{screenX:r,screenY:s,outerWidth:a}=window;t=Math.max(s,0),e=Math.max(r+(a-i.NOTIFICATION_WIDTH),0)}const n=await this.platform.openWindow({url:"notification.html",type:"popup",width:i.NOTIFICATION_WIDTH,height:i.NOTIFICATION_HEIGHT,left:e,top:t});n.left!==e&&"fullscreen"!==n.state&&await this.platform.updateWindowPosition(n.id,e,t),this._setCurrentPopupId(n.id),this._popupId=n.id}}_onWindowClosed(e){e===this._popupId&&(this._setCurrentPopupId(undefined),this._popupId=undefined,this.emit(o.POPUP_CLOSED,{automaticallyClosed:this._popupAutomaticallyClosed}),this._popupAutomaticallyClosed=undefined)}async _getPopup(){const e=await this.platform.getAllWindows();return this._getPopupIn(e)}_getPopupIn(e){return e?e.find(e=>e&&"popup"===e.type&&e.id===this._popupId):null}}n.default=c}}},{package:"$root$",file:"app/scripts/lib/notification-manager.js"}],[120,{"@metamask/keyring-api":2747,"@metamask/keyring-api/v2":2770,"@metamask/keyring-sdk/v2":2815,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.LatticeKeyringV2=void 0;var r=e("@metamask/keyring-api"),s=e("@metamask/keyring-api/v2"),i=e("@metamask/keyring-sdk/v2"),a=e("@metamask/utils");function o(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}const l=[r.EthMethod.SignTransaction,r.EthMethod.PersonalSign,r.EthMethod.SignTypedDataV1,r.EthMethod.SignTypedDataV3,r.EthMethod.SignTypedDataV4],d={scopes:[r.EthScope.Eoa],custom:{createAccounts:!0}};var p=new WeakSet;class h extends i.EthKeyringWrapper{constructor(e){super({type:s.KeyringType.Lattice,inner:e.legacyKeyring,capabilities:d}),o(this,p),c(this,"entropySource",void 0),this.entropySource=e.entropySource,this.inner.appName="MetaMask"}async getAccounts(){return(await this.inner.getAccounts()).map(e=>{const t=(0,a.add0x)(e),n=this.registry.getAccountId(t);if(n){const e=this.registry.get(n);if(e)return e}return u(p,this,f).call(this,t)})}async createAccounts(e){return this.withLock(async()=>{if("custom"!==e.type)throw new Error(`Unsupported account creation type for LatticeKeyring: ${String(e.type)}. Supported type: 'custom'.`);const{entropySource:t,addressIndex:n}=e;if(t!==this.entropySource)throw new Error(`Entropy source mismatch: expected '${this.entropySource}', got '${String(t)}'`);if("number"!=typeof n||!Number.isInteger(n)||n<0)throw new Error(`Invalid addressIndex: ${String(n)}. Must be a non-negative integer.`);this.inner.setAccountToUnlock(n);const[r]=await this.inner.addAccounts(1);if(!r)throw new Error("Failed to create new account");return[u(p,this,f).call(this,(0,a.add0x)(r))]})}async deleteAccount(e){await this.withLock(async()=>{const{address:t}=await this.getAccount(e);this.inner.removeAccount((0,a.add0x)(t)),this.registry.delete(e)})}get hdPath(){return this.inner.hdPath}get appName(){return this.inner.appName}set appName(e){this.inner.appName=e}get network(){return this.inner.network}set network(e){this.inner.network=e}setHdPath(e){this.inner.setHdPath(e)}setAccountToUnlock(e){this.inner.setAccountToUnlock(e)}async addAccounts(e=1){return this.inner.addAccounts(e)}async getFirstPage(){return this.inner.getFirstPage()}async getNextPage(){return this.inner.getNextPage()}async getPreviousPage(){return this.inner.getPreviousPage()}isUnlocked(){return this.inner.isUnlocked()}async forgetDevice(){await this.withLock(async()=>{this.inner.forgetDevice(),this.registry.clear()})}}function f(e){const t={id:this.registry.register(e),type:r.EthAccountType.Eoa,address:e,scopes:[...this.capabilities.scopes],methods:[...l],options:{entropy:{type:r.KeyringAccountEntropyTypeOption.Custom}}};return this.registry.set(t),t}n.LatticeKeyringV2=h}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/lattice-keyring-v2.ts"}],[121,{"../../../../shared/constants/offscreen-communication":8530,"eth-lattice-keyring":6493},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.LatticeKeyringOffscreen=void 0;var r,s=(r=e("eth-lattice-keyring"))&&r.__esModule?r:{default:r},i=e("../../../../shared/constants/offscreen-communication");class a extends s.default{constructor(e={}){super(e)}async _getCreds(){try{if(this._hasCreds())return undefined;const e=this.appName?this.appName:"Unknown",t=`${i.KnownOrigins.lattice}?keyring=${e}&forceLogin=true`,n=await new Promise((e,n)=>{chrome.runtime.sendMessage({target:i.OffscreenCommunicationTarget.latticeOffscreen,params:{url:t}},t=>{chrome.runtime.lastError?n(chrome.runtime.lastError):t?.error?n(t.error):e(t?.result)})});if(!n?.deviceID||!n?.password)throw new Error("Invalid credentials returned from Lattice.");return n}catch(e){throw new Error(e)}}}n.LatticeKeyringOffscreen=a,function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(a,"type",void 0),a.type=s.default.type}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/lattice-offscreen-keyring.ts"}],[122,{"../../../../shared/constants/offscreen-communication":8530,"@ledgerhq/errors":1192,"@metamask/eth-ledger-bridge-keyring":2332,"@metamask/hw-wallet-sdk":2650},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerOffscreenBridge=void 0;var r=e("@metamask/eth-ledger-bridge-keyring"),s=e("@ledgerhq/errors"),i=e("@metamask/hw-wallet-sdk"),a=e("../../../../shared/constants/offscreen-communication");function o(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function c(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}const u=4e3;var l=new WeakSet;async function d(e,{timeout:t}={}){return new Promise((n,o)=>{let c;t&&(c=setTimeout(()=>{o(new Error("Ledger iframe timeout"))},t)),chrome.runtime.sendMessage({...e,target:a.OffscreenCommunicationTarget.ledgerOffscreen},e=>{if(clearTimeout(c),chrome.runtime.lastError){const e=chrome.runtime.lastError.message;return void o(new Error(e))}if(e?.success)n(e.payload||e.success);else{const t=e?.payload?.error;if("HardwareWalletError"===t?.name&&"number"==typeof t?.code)o(new i.HardwareWalletError(t.message,{code:t.code,severity:t.severity,category:t.category,userMessage:t.userMessage}));else if(t&&"number"==typeof t.statusCode&&t.statusCode>0){const e=`0x${t.statusCode.toString(16)}`;(0,r.isKnownLedgerError)(e)?o((0,r.createLedgerError)(e)):o(new s.TransportStatusError(t.statusCode))}else o(t?.message?new Error(t.message,{cause:t}):new Error("Unknown Ledger error occurred"))}})})}n.LedgerOffscreenBridge=class{constructor(){o(this,l)}init(){return Promise.resolve()}destroy(){return Promise.resolve()}getOptions(){return Promise.resolve({})}setOptions(){return Promise.resolve()}attemptMakeApp(){return c(l,this,d).call(this,{action:a.LedgerAction.makeApp},{timeout:u})}updateTransportMethod(e){return c(l,this,d).call(this,{action:a.LedgerAction.updateTransport,params:{transportType:e}},{timeout:u})}getAppNameAndVersion(){return c(l,this,d).call(this,{action:a.LedgerAction.getAppNameAndVersion},{timeout:u})}getAppConfiguration(){return c(l,this,d).call(this,{action:a.LedgerAction.getAppConfiguration},{timeout:u})}getPublicKey(e){return c(l,this,d).call(this,{action:a.LedgerAction.getPublicKey,params:e})}deviceSignTransaction(e){return c(l,this,d).call(this,{action:a.LedgerAction.signTransaction,params:e})}deviceSignMessage(e){return c(l,this,d).call(this,{action:a.LedgerAction.signPersonalMessage,params:e})}deviceSignTypedData(e){return c(l,this,d).call(this,{action:a.LedgerAction.signTypedData,params:e})}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts"}],[123,{"../../../../shared/constants/hardware-wallets":8517,"@trezor/connect-web":5503,"@trezor/connect-web/lib/impl/core-in-suite-desktop":5502},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.TrezorMv2Bridge=void 0;var r=e("@trezor/connect-web/lib/impl/core-in-suite-desktop"),s=e("@trezor/connect-web"),i=e("../../../../shared/constants/hardware-wallets");function a(e,t,n){(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,n)}function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t,n){return e.set(l(e,t),n),n}function u(e,t){return e.get(l(e,t))}function l(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function d(e){return e.success||e.payload.code!==i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE?e:{success:!1,payload:{error:i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE,code:i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE}}}var p=new WeakMap,h=new WeakMap;n.TrezorMv2Bridge=class{constructor(){o(this,"model",void 0),a(this,p,!1),a(this,h,!1)}async init(e){if(u(h,this)||(r.TrezorConnect.on(s.DEVICE_EVENT,e=>{e?.type===s.DEVICE.CONNECT&&(this.model=e?.payload?.features?.model)}),c(h,this,!0)),!u(p,this))try{await r.TrezorConnect.init(e),c(p,this,!0)}catch(e){if("object"==typeof e&&null!==e&&e.code===i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE)throw Object.assign(new Error(i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE),{code:i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE});if(e instanceof Error)throw e;throw new Error(String(e))}}async dispose(){return c(p,this,!1),r.TrezorConnect.dispose()}getPublicKey(e){return r.TrezorConnect.getPublicKey(e).then(e=>d(e))}ethereumSignTransaction(e){return r.TrezorConnect.ethereumSignTransaction(e).then(e=>d(e))}ethereumSignMessage(e){return r.TrezorConnect.ethereumSignMessage(e).then(e=>d(e))}ethereumSignTypedData(e){return r.TrezorConnect.ethereumSignTypedData(e).then(e=>d(e))}getFeatures(){return r.TrezorConnect.getFeatures().then(e=>d(e))}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/trezor-mv2-bridge.ts"}],[124,{"../../../../shared/constants/offscreen-communication":8530},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.TrezorOffscreenBridge=void 0;var r=e("../../../../shared/constants/offscreen-communication");function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.TrezorOffscreenBridge=class{constructor(){s(this,"model",void 0),s(this,"minorVersion",void 0)}init(e){return chrome.runtime.onMessage.addListener(e=>{e.target===r.OffscreenCommunicationTarget.extension&&e.event===r.OffscreenCommunicationEvents.trezorDeviceConnect&&(this.model=e.payload.model,this.minorVersion=e.payload.minorVersion)}),new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.init,params:e},()=>{t()})})}dispose(){return new Promise(e=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.dispose},()=>{e()})})}getPublicKey(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.getPublicKey,params:e},e=>{t(e)})})}ethereumSignTransaction(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.signTransaction,params:e},e=>{t(e)})})}ethereumSignMessage(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.signMessage,params:e},e=>{t(e)})})}ethereumSignTypedData(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.signTypedData,params:e},e=>{t(e)})})}getFeatures(){return new Promise(e=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.getFeatures},t=>{e(t)})})}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/trezor-offscreen-bridge.ts"}],[125,{"webextension-polyfill":8489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.openUpdateTabAndReload=async function(e){try{await s.default.tabs.create({url:"https://metamask.io/updating",active:!0})}catch(e){console.error(e)}await e()};var r,s=(r=e("webextension-polyfill"))&&r.__esModule?r:{default:r}}}},{package:"$root$",file:"app/scripts/lib/open-update-tab-and-reload.ts"}],[126,{"../../../shared/lib/promise-with-resolvers":8693,lodash:7181,loglevel:7191},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.OperationSafener=void 0;var r,s=e("lodash"),i=(r=e("loglevel"))&&r.__esModule?r:{default:r},a=e("../../../shared/lib/promise-with-resolvers");function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t,n){(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,n)}function u(e,t){return e.get(d(e,t))}function l(e,t,n){return e.set(d(e,t),n),n}function d(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var p=new WeakMap,h=new WeakMap;n.OperationSafener=class{constructor({op:e,wait:t,options:n}){c(this,p,void 0),c(this,h,null),o(this,"evacuate",()=>{if(u(h,this))return i.default.warn("already evacuating"),u(h,this);const e=u(p,this).flush();if(e){const{promise:t,resolve:n}=(0,a.withResolvers)();e.finally(n),l(h,this,t)}else l(h,this,Promise.resolve());return u(h,this)}),o(this,"execute",(...e)=>u(h,this)?(i.default.warn("evacuating, ignoring call to `execute`"),!1):(u(p,this).call(this,...e),!0));const r={mode:"exclusive"};l(p,this,(0,s.debounce)((...t)=>navigator.locks.request("operation-safener-lock",r,()=>e(...t)),t,n))}}}}},{package:"$root$",file:"app/scripts/lib/operation-safener.ts"}],[127,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(n,"__esModule",{value:!0}),n.IndexedDBPPOMStorage=void 0;const i=async(e,t,n)=>{const r=await crypto.subtle.digest("SHA-256",t);if(Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("")!==n)throw new Error(`Checksum mismatch for key ${e}`)};var a=new WeakSet;function o(e){return new Promise((t,n)=>{const r=indexedDB.open(this.storeName,this.dbVersion);r.onerror=e=>{n(new Error(`Failed to open database ${this.storeName}: ${e.target?.error}`))},r.onupgradeneeded=e=>{const t=e.target.result;t.objectStoreNames.contains(this.storeName)||t.createObjectStore(this.storeName,{keyPath:["name","chainId"]})},r.onsuccess=n=>{const r=n.target.result.transaction([this.storeName],e).objectStore(this.storeName);t(r)}})}n.IndexedDBPPOMStorage=class{constructor(e,t){r(this,a),s(this,"storeName",void 0),s(this,"dbVersion",void 0),this.storeName=e,this.dbVersion=t}async objectStoreAction(e,t,n="readonly"){return new Promise((r,s)=>{(function(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")})(a,this,o).call(this,n).then(n=>{const i=n[e](t);i.onsuccess=async e=>{r(e)},i.onerror=t=>{s(new Error(`Error in indexDB operation ${e}: ${t.target?.error}`))}}).catch(e=>{s(e)})})}async read(e,t){const n=await this.objectStoreAction("get",[e.name,e.chainId]),r=n.target?.result?.data;return await i(e,r,t),r}async write(e,t,n){await i(e,t,n),await this.objectStoreAction("put",{...e,data:t},"readwrite")}async delete(e){await this.objectStoreAction("delete",[e.name,e.chainId],"readwrite")}async dir(){const e=await this.objectStoreAction("getAllKeys");return e.target?.result.map(([e,t])=>({name:e,chainId:t}))}}}}},{package:"$root$",file:"app/scripts/lib/ppom/indexed-db-backend.ts"}],[128,{"../../../../shared/constants/app":8502,"../../../../shared/constants/security-provider":8540,"../../../../shared/constants/transaction":8551,"../../../../shared/lib/trace":8732,"./ppom-util":129,"@metamask/controller-utils":1602},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createPPOMMiddleware=function(e,t,n,l,d,p,h){return async(f,m,g)=>{try{const{securityAlertsEnabled:m}=t.state,{chainId:g}=n.getNetworkConfigurationByNetworkClientId(f.networkClientId)??{};if(!g)throw Error("ChainID not found for networkClientId");if(!m||!u.includes(f.method))return;const y=f.params[0];if("string"==typeof y){const{isSIWEMessage:e}=(0,r.detectSIWE)({data:y});if(e)return}else if(f.method===s.MESSAGE_TYPE.ETH_SEND_TRANSACTION){const{to:e}=y??{},t=d.listAccounts();if(t.some(({address:t})=>t?.toLowerCase()===e?.toLowerCase()))return}const w=(0,c.generateSecurityAlertId)();(0,a.trace)({name:a.TraceName.PPOMValidation,parentContext:f.traceContext},()=>(0,c.validateRequestWithPPOM)({ppomController:e,request:f,securityAlertId:w,chainId:g,updateSecurityAlertResponse:p,getSecurityAlertsConfig:h}));const b={...o.LOADING_SECURITY_ALERT_RESPONSE,securityAlertId:w};i.SIGNING_METHODS.includes(f.method)&&l.addSignatureSecurityAlertResponse(b),f.securityAlertResponse=b}catch(e){f.securityAlertResponse=(0,c.handlePPOMError)(e,"Error createPPOMMiddleware: ")}finally{g()}}};var r=e("@metamask/controller-utils"),s=e("../../../../shared/constants/app"),i=e("../../../../shared/constants/transaction"),a=e("../../../../shared/lib/trace"),o=e("../../../../shared/constants/security-provider"),c=e("./ppom-util");const u=Object.freeze(["eth_sendRawTransaction","eth_sendTransaction",...i.SIGNING_METHODS])}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom-middleware.ts"}],[129,{"../../../../shared/constants/app":8502,"../../../../shared/constants/security-provider":8540,"../../../../shared/constants/transaction":8551,"../../../../shared/lib/snaps/snaps":8717,"../../../../shared/lib/transaction.utils":8734,"../../../../shared/lib/typed-signature":8742,"./security-alerts-api":131,"@metamask/snaps-utils":3822,"@metamask/transaction-controller":3915,"@metamask/utils":4030,lodash:7181,uuid:8131},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.generateSecurityAlertId=function(){return(0,i.v4)()},n.handlePPOMError=w,n.normalizeSignatureRequest=b,n.updateSecurityAlertResponse=async function({appStateController:e,messenger:t,method:n,securityAlertId:r,securityAlertResponse:s,signatureController:i,transactionController:a}){if(l.SIGNING_METHODS.includes(n)){const n=await async function(e,t,n){const r=e=>Object.values(e.signatureRequests).find(e=>e.securityAlertResponse?.securityAlertId===t);return new Promise(s=>{const i=r(e.state);if(i)return void s(i);const a=e=>{const t=r(e);t&&(m("Found signature request",t),n.unsubscribe("SignatureController:stateChange",a),s(t))};m("Waiting for signature request",t),n.subscribe("SignatureController:stateChange",a)})}(i,r,t);return e.addSignatureSecurityAlertResponse({...s,securityAlertId:r}),n}const o=await async function(e,t,n){const r=e=>e.securityAlertResponse?.securityAlertId===t;return new Promise(s=>{const i=e.state.transactions.find(r);if(i)return void s(i);const a=e=>{r(e)&&(m("Found transaction metadata",e),n.unsubscribe("TransactionController:unapprovedTransactionAdded",a),s(e))};m("Waiting for transaction metadata",t),n.subscribe("TransactionController:unapprovedTransactionAdded",a)})}(a,r,t);return a.updateSecurityAlertResponse(o.id,{...s,securityAlertId:r}),o},n.validateRequestWithPPOM=async function({ppomController:e,request:t,securityAlertId:n,chainId:s,updateSecurityAlertResponse:i,getSecurityAlertsConfig:o}){try{const u=function(e,t){let n=(0,a.cloneDeep)(e);n=b(n,t),n=function(e,t){if(e.method!==h.MESSAGE_TYPE.ETH_SEND_TRANSACTION)return e;if(!Array.isArray(e.params)||!e.params[0])return e;const n=e.params[0];n.gas=t.txParams.gas,n.gasPrice=t.txParams.maxFeePerGas??t.txParams.gasPrice,delete n.gasLimit,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.type;const s=(0,r.normalizeTransactionParams)(n);return m("Normalized transaction params",s),{...e,params:[s]}}(n,t);const{delegationMock:s,id:i,jsonrpc:o,method:c,origin:u,params:l}=n;return{delegationMock:s,id:i,jsonrpc:o,method:c,origin:u,params:l}}(t,await i(t.method,n,c.LOADING_SECURITY_ALERT_RESPONSE));m("Normalized request",u);const l=(0,f.isSecurityAlertsAPIEnabled)()?await async function(e,t,n,r){try{return{...await(0,f.validateWithSecurityAlertsAPI)(t,n,r),source:c.SecurityAlertSource.API}}catch(r){return w(r,"Error validating request with security alerts API"),await v(e,n,t)}}(e,s,u,o):await v(e,u,s);await i(t.method,n,l)}catch(e){m("Error",e),await i(t.method,n,w(e,"Error validating JSON RPC using PPOM: "))}};var r=e("@metamask/transaction-controller"),s=e("@metamask/utils"),i=e("uuid"),a=e("lodash"),o=e("@metamask/snaps-utils"),c=e("../../../../shared/constants/security-provider"),u=e("../../../../shared/lib/snaps/snaps"),l=e("../../../../shared/constants/transaction"),d=e("../../../../shared/lib/typed-signature"),p=e("../../../../shared/lib/transaction.utils"),h=e("../../../../shared/constants/app"),f=e("./security-alerts-api");const m=(0,s.createProjectLogger)("ppom-util"),{sentry:g}=global,y={result_type:c.BlockaidResultType.Errored,reason:c.BlockaidReason.errored};function w(e,t,n=c.SecurityAlertSource.API){const r=function(e){if("object"==typeof e||"string"==typeof e)return e;return JSON.stringify(e)}(e),s=function(e){if(e instanceof Error)return`${e.name}: ${e.message}`;return JSON.stringify(e)}(e);return n===c.SecurityAlertSource.Local&&g?.captureException(e),console.error(t,r),{...y,description:s,source:n}}function b(e,t){if(e.method!==h.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3&&e.method!==h.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4)return e;if(!Array.isArray(e.params)||!e.params[1])return e;const n=(0,p.parseTypedDataMessage)(e.params[1]),r=(0,d.sanitizeMessageRecursively)(n.message,n.types,n.primaryType);let s=e.origin;if(t&&"decodedPermission"in t&&t.decodedPermission?.origin){const n=(0,o.isSnapId)(e.origin),r=n&&(0,u.isSnapPreinstalled)(e.origin);n&&r&&(s=t.decodedPermission.origin)}return{...e,origin:s,params:[e.params[0],JSON.stringify({...n,message:r})]}}async function v(e,t,n){try{return{...await e.usePPOM(e=>e.validateJsonRpc(t),n),source:c.SecurityAlertSource.Local}}catch(e){return w(e,"Error validating request with PPOM controller",c.SecurityAlertSource.Local)}}}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom-util.ts"}],[1293,{"@metamask/base-controller":1480,"@metamask/controller-utils":1602},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=n.controllerName=n.AddressType=void 0;const r=e("@metamask/base-controller"),s=e("@metamask/controller-utils");var i;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(i||(n.AddressType=i={})),n.controllerName="AddressBookController";const a=["list","set","delete","clear"],o={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};n.getDefaultAddressBookControllerState=()=>({addressBook:{}});class c extends r.BaseController{constructor({messenger:e,state:t}){const r={...(0,n.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:o,name:n.controllerName,state:r}),this.messenger.registerMethodActionHandlers(this,a)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,n)=>{const r=n;return[...t,...Object.values(e[r])]},[])}clear(){this.update(e=>{e.addressBook={}})}delete(e,t){if(t=(0,s.toChecksumHexAddress)(t),![e,t].every(e=>(0,s.isSafeDynamicKey)(e))||!(0,s.isValidHexAddress)(t)||!this.state.addressBook[e]?.[t])return!1;const n={...this.state.addressBook[e][t]};return this.update(n=>{const r=n.addressBook[e];r?.[t]&&(delete r[t],0===Object.keys(r).length&&delete n.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",n),!0}set(e,t,n=(0,s.toHex)(1),r="",i){if(e=(0,s.toChecksumHexAddress)(e),!(0,s.isValidHexAddress)(e))return!1;const a={address:e,chainId:n,isEns:!1,memo:r,name:t,addressType:i,lastUpdatedAt:Date.now()},o=(0,s.normalizeEnsName)(t);return o&&(a.name=o,a.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[n]:{...this.state.addressBook[n],[e]:a}}}),"*"!==String(n)&&this.messenger.publish("AddressBookController:contactUpdated",a),!0}}n.AddressBookController=c,n.default=c}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"}],[1294,{"./AddressBookController.cjs":1293},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=void 0;var r=e("./AddressBookController.cjs");Object.defineProperty(n,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return r.getDefaultAddressBookControllerState}}),Object.defineProperty(n,"AddressBookController",{enumerable:!0,get:function(){return r.AddressBookController}})}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.cjs"}],[1295,{"./AnalyticsLogger.cjs":1296,"./analyticsControllerStateValidator.cjs":1298,"./selectors.cjs":1300,"@metamask/base-controller":1480,lodash:7181,uuid:8131},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u,l,d,p,h,f,m,g=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},y=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AnalyticsController=n.getDefaultAnalyticsControllerState=n.controllerName=void 0;const w=e("@metamask/base-controller"),b=e("lodash"),v=e("uuid"),T=e("./analyticsControllerStateValidator.cjs"),S=e("./AnalyticsLogger.cjs"),_=e("./selectors.cjs");function k(){return{optedIn:!1}}n.controllerName="AnalyticsController",n.getDefaultAnalyticsControllerState=k;const E={optedIn:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},analyticsId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!1},eventQueue:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}},I=["trackEvent","identify","trackView","optIn","optOut"];function A(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function C(e){return!!A(e)&&("string"==typeof e.messageId&&"string"==typeof e.timestamp&&("track"===e.type?"string"==typeof e.eventName&&(e.properties===undefined||A(e.properties))&&(e.context===undefined||A(e.context)):"identify"===e.type?"string"==typeof e.userId&&(e.traits===undefined||A(e.traits))&&(e.context===undefined||A(e.context)):"view"===e.type&&("string"==typeof e.name&&(e.properties===undefined||A(e.properties))&&(e.context===undefined||A(e.context)))))}class M extends w.BaseController{constructor({state:e,messenger:t,platformAdapter:c,isAnonymousEventsFeatureEnabled:u=!1,isEventQueuePersistenceEnabled:l=!1}){const d={optedIn:!1,...e};(0,T.validateAnalyticsControllerState)(d,!0===c.skipUUIDv4Check),super({name:n.controllerName,metadata:E,state:d,messenger:t}),r.add(this),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),g(this,i,u,"f"),g(this,a,l,"f"),g(this,s,c,"f"),g(this,o,!1,"f"),this.messenger.registerMethodActionHandlers(this,I),(0,S.projectLogger)("AnalyticsController initialized and ready",{enabled:_.analyticsControllerSelectors.selectEnabled(this.state),optedIn:this.state.optedIn,analyticsId:this.state.analyticsId,eventQueuePersistenceEnabled:y(this,a,"f")})}init(){if(y(this,o,"f"))(0,S.projectLogger)("AnalyticsController already initialized.");else{g(this,o,!0,"f");try{y(this,s,"f").onSetupCompleted(this.state.analyticsId)}catch(e){(0,S.projectLogger)("Error calling platformAdapter.onSetupCompleted",e)}y(this,r,"m",h).call(this)}}trackEvent(e,t){if(!_.analyticsControllerSelectors.selectEnabled(this.state))return;if(!e.hasProperties)return void y(this,r,"m",c).call(this,e.name,undefined,t);y(this,i,"f")&&y(this,r,"m",c).call(this,e.name,{...e.properties},t);const n=Object.keys(e.sensitiveProperties).length>0;y(this,i,"f")&&!n||y(this,r,"m",c).call(this,e.name,{...e.properties,...e.sensitiveProperties,...n&&{anonymous:!0}},t)}identify(e,t){_.analyticsControllerSelectors.selectEnabled(this.state)&&y(this,r,"m",u).call(this,this.state.analyticsId,e,t)}trackView(e,t,n){_.analyticsControllerSelectors.selectEnabled(this.state)&&y(this,r,"m",l).call(this,e,t,n)}optIn(){this.update(e=>{e.optedIn=!0})}optOut(){this.update(e=>{e.optedIn=!1}),y(this,r,"m",m).call(this)}}n.AnalyticsController=M,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,r=new WeakSet,c=function(e,t,n){if(!y(this,a,"f"))return void y(this,s,"f").track(e,t,n);const i={type:"track",eventName:e,messageId:(0,v.v4)(),timestamp:(new Date).toISOString(),...t===undefined?{}:{properties:t},...n===undefined?{}:{context:n}};y(this,r,"m",d).call(this,i)},u=function(e,t,n){if(!y(this,a,"f"))return void y(this,s,"f").identify(e,t,n);const i={type:"identify",userId:e,messageId:(0,v.v4)(),timestamp:(new Date).toISOString(),...t===undefined?{}:{traits:t},...n===undefined?{}:{context:n}};y(this,r,"m",d).call(this,i)},l=function(e,t,n){if(!y(this,a,"f"))return void y(this,s,"f").view(e,t,n);const i={type:"view",name:e,messageId:(0,v.v4)(),timestamp:(new Date).toISOString(),...t===undefined?{}:{properties:t},...n===undefined?{}:{context:n}};y(this,r,"m",d).call(this,i)},d=function(e){const t={...this.state.eventQueue??{},[e.messageId]:e};this.update(e=>{e.eventQueue=t}),y(this,r,"m",p).call(this,e)},p=function(e){const t=new Date(e.timestamp);if(Number.isNaN(t.getTime()))return(0,S.projectLogger)("Dropping queued analytics event with invalid timestamp",{messageId:e.messageId}),void y(this,r,"m",f).call(this,e.messageId);const n={messageId:e.messageId,timestamp:t,callback:t=>{t&&(0,S.projectLogger)("Queued analytics event delivery failed",{messageId:e.messageId,error:t}),y(this,r,"m",f).call(this,e.messageId)}};try{"track"===e.type?y(this,s,"f").track(e.eventName,(0,b.cloneDeep)(e.properties),(0,b.cloneDeep)(e.context),n):"identify"===e.type?y(this,s,"f").identify(e.userId,(0,b.cloneDeep)(e.traits),(0,b.cloneDeep)(e.context),n):y(this,s,"f").view(e.name,(0,b.cloneDeep)(e.properties),(0,b.cloneDeep)(e.context),n)}catch(t){(0,S.projectLogger)("Error sending queued analytics event",{messageId:e.messageId,error:t})}},h=function(){if(y(this,a,"f")&&this.state.eventQueue)if(_.analyticsControllerSelectors.selectEnabled(this.state))for(const[e,t]of Object.entries(this.state.eventQueue))C(t)&&t.messageId===e?y(this,r,"m",p).call(this,t):((0,S.projectLogger)("Dropping invalid queued analytics event",{messageId:e}),y(this,r,"m",f).call(this,e));else y(this,r,"m",m).call(this)},f=function(e){const t=this.state.eventQueue;if(!t||!Object.prototype.hasOwnProperty.call(t,e))return;const{[e]:n,...r}=t;this.update(e=>{e.eventQueue=r})},m=function(){this.state.eventQueue&&0!==Object.keys(this.state.eventQueue).length&&this.update(e=>{e.eventQueue={}})}}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/AnalyticsController.cjs"}],[1296,{"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const r=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return r.createModuleLogger}}),n.projectLogger=(0,r.createProjectLogger)("analytics-controller")}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/AnalyticsLogger.cjs"}],[1297,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AnalyticsPlatformAdapterSetupError=void 0;class r extends Error{constructor(e,t){super(e),this.name=this.constructor.name,t&&(this.cause=t)}}n.AnalyticsPlatformAdapterSetupError=r}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/AnalyticsPlatformAdapterSetupError.cjs"}],[1298,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateAnalyticsControllerState=n.isValidUUIDv4=void 0;const r=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;function s(e){return"string"==typeof e&&r.test(e)}n.isValidUUIDv4=s,n.validateAnalyticsControllerState=function(e,t){if(!e.analyticsId||!0!==t&&!s(e.analyticsId))throw new Error("Invalid analyticsId")}}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/analyticsControllerStateValidator.cjs"}],[1299,{"./AnalyticsController.cjs":1295,"./AnalyticsPlatformAdapterSetupError.cjs":1297,"./selectors.cjs":1300},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.analyticsControllerSelectors=n.AnalyticsPlatformAdapterSetupError=n.getDefaultAnalyticsControllerState=n.AnalyticsController=void 0;var r=e("./AnalyticsController.cjs");Object.defineProperty(n,"AnalyticsController",{enumerable:!0,get:function(){return r.AnalyticsController}}),Object.defineProperty(n,"getDefaultAnalyticsControllerState",{enumerable:!0,get:function(){return r.getDefaultAnalyticsControllerState}});var s=e("./AnalyticsPlatformAdapterSetupError.cjs");Object.defineProperty(n,"AnalyticsPlatformAdapterSetupError",{enumerable:!0,get:function(){return s.AnalyticsPlatformAdapterSetupError}});var i=e("./selectors.cjs");Object.defineProperty(n,"analyticsControllerSelectors",{enumerable:!0,get:function(){return i.analyticsControllerSelectors}})}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/index.cjs"}],[13,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BLOCKED_PORTS=n.BLOCKED_HOSTNAMES=void 0;n.BLOCKED_PORTS=["trezor-connect"],n.BLOCKED_HOSTNAMES=["execution.metamask.io","execution.consensys.io"]}}},{package:"$root$",file:"app/scripts/constants/background.ts"}],[130,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){let r;Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.PPOM=void 0,n.initSync=function(e){if(r!==undefined)return r;const t=I();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));const n=new WebAssembly.Instance(e,t);return A(n,e)},n.main=function(){r.main()};const s="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&s.decode();let i=null;function a(){return null!==i&&0!==i.byteLength||(i=new Uint8Array(r.memory.buffer)),i}function o(e,t){return e>>>=0,s.decode(a().subarray(e,e+t))}const c=new Array(128).fill(undefined);c.push(undefined,null,!0,!1);let u=c.length;function l(e){u===c.length&&c.push(c.length+1);const t=u;return u=c[t],c[t]=e,t}function d(e){return c[e]}function p(e){const t=d(e);return function(e){e<132||(c[e]=u,u=e)}(e),t}let h=0;const f="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},m="function"==typeof f.encodeInto?function(e,t){return f.encodeInto(e,t)}:function(e,t){const n=f.encode(e);return t.set(n),{read:e.length,written:n.length}};function g(e,t,n){if(n===undefined){const n=f.encode(e),r=t(n.length,1)>>>0;return a().subarray(r,r+n.length).set(n),h=n.length,r}let r=e.length,s=t(r,1)>>>0;const i=a();let o=0;for(;o<r;o++){const t=e.charCodeAt(o);if(t>127)break;i[s+o]=t}if(o!==r){0!==o&&(e=e.slice(o)),s=n(s,r,r=o+3*e.length,1)>>>0;const t=a().subarray(s+o,s+r);o+=m(e,t).written}return h=o,s}let y=null;function w(){return null!==y&&0!==y.byteLength||(y=new Int32Array(r.memory.buffer)),y}function b(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let n="[";t>0&&(n+=b(e[0]));for(let r=1;r<t;r++)n+=", "+b(e[r]);return n+="]",n}const n=/\[object ([^\]]+)\]/.exec(toString.call(e));let r;if(!(n.length>1))return toString.call(e);if(r=n[1],"Object"==r)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function v(e,t,n){r.wasm_bindgen__convert__closures__invoke1_mut(e,t,l(n))}function T(e,t){r._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__destroy(e,t)}let S=null;function _(e,t){const n=t(4*e.length,4)>>>0,s=(null!==S&&0!==S.byteLength||(S=new Uint32Array(r.memory.buffer)),S);for(let t=0;t<e.length;t++)s[n/4+t]=l(e[t]);return h=e.length,n}function k(e,t){try{return e.apply(this,t)}catch(e){r.__wbindgen_exn_store(l(e))}}class E{static __wrap(e){e>>>=0;const t=Object.create(E.prototype);return t.__wbg_ptr=e,t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();r.__wbg_ppom_free(e)}static new(e,t){const n=_(t,r.__wbindgen_malloc),s=h;return p(r.ppom_new(l(e),n,s))}validateJsonRpc(e){return p(r.ppom_validateJsonRpc(this.__wbg_ptr,l(e)))}static version(){return p(r.ppom_version())}}function I(){const e={wbg:{}};return e.wbg.__wbg_buffer_085ec1f694018c4f=function(e){return l(d(e).buffer)},e.wbg.__wbg_call_01734de55d61e11d=function(){return k(function(e,t,n){return l(d(e).call(d(t),d(n)))},arguments)},e.wbg.__wbg_call_4c92f6aec1e1d6e6=function(){return k(function(e,t,n,r){return l(d(e).call(d(t),d(n),d(r)))},arguments)},e.wbg.__wbg_from_d7c216d4616bb368=function(e){return l(Array.from(d(e)))},e.wbg.__wbg_get_44be0491f933a435=function(e,t){return l(d(e)[t>>>0])},e.wbg.__wbg_length_72e2208bbc0efc61=function(e){return d(e).length},e.wbg.__wbg_length_d813e535247d427e=function(e){return d(e).length},e.wbg.__wbg_length_fff51ee6522a1a18=function(e){return d(e).length},e.wbg.__wbg_new_43f1b47c28813cbd=function(e,t){try{var n={a:e,b:t};const s=new Promise((e,t)=>{const s=n.a;n.a=0;try{return function(e,t,n,s){r.wasm_bindgen__convert__closures__invoke2_mut(e,t,l(n),l(s))}(s,n.b,e,t)}finally{n.a=s}});return l(s)}finally{n.a=n.b=0}},e.wbg.__wbg_new_8125e318e6245eed=function(e){return l(new Uint8Array(d(e)))},e.wbg.__wbg_parse_670c19d4e984792e=function(){return k(function(e,t){return l(JSON.parse(o(e,t)))},arguments)},e.wbg.__wbg_ppom_new=function(e){return l(E.__wrap(e))},e.wbg.__wbg_resolve_53698b95aaf7fcf8=function(e){return l(Promise.resolve(d(e)))},e.wbg.__wbg_set_5cf90238115182c3=function(e,t,n){d(e).set(d(t),n>>>0)},e.wbg.__wbg_stringify_e25465938f3f611f=function(){return k(function(e){return l(JSON.stringify(d(e)))},arguments)},e.wbg.__wbg_then_b2267541e2a73865=function(e,t,n){return l(d(e).then(d(t),d(n)))},e.wbg.__wbg_then_f7e06ee3c11698eb=function(e,t){return l(d(e).then(d(t)))},e.wbg.__wbindgen_cb_drop=function(e){const t=p(e).original;if(1==t.cnt--)return t.a=0,!0;return!1},e.wbg.__wbindgen_closure_wrapper_wasm_bindgen__closure__Closure_T___wrap__breaks_if_inlined=function(e,t,n){const r=function(e,t,n,r){const s={a:e,b:t,cnt:1},i=(...e)=>{s.cnt++;const t=s.a;s.a=0;try{return r(t,s.b,...e)}finally{0===--s.cnt?n(t,s.b):s.a=t}};return i.original=s,i}(e,t,T,v);return l(r)},e.wbg.__wbindgen_debug_string=function(e,t){const n=g(b(d(t)),r.__wbindgen_malloc,r.__wbindgen_realloc),s=h;w()[e/4+1]=s,w()[e/4+0]=n},e.wbg.__wbindgen_error_new=function(e,t){return l(new Error(o(e,t)))},e.wbg.__wbindgen_is_undefined=function(e){return d(e)===undefined},e.wbg.__wbindgen_memory=function(){return l(r.memory)},e.wbg.__wbindgen_object_drop_ref=function(e){p(e)},e.wbg.__wbindgen_string_get=function(e,t){const n=d(t),s="string"==typeof n?n:undefined;var i,a=(i=s)===undefined||null===i?0:g(s,r.__wbindgen_malloc,r.__wbindgen_realloc),o=h;w()[e/4+1]=o,w()[e/4+0]=a},e.wbg.__wbindgen_string_new=function(e,t){return l(o(e,t))},e.wbg.__wbindgen_throw=function(e,t){throw new Error(o(e,t))},e}function A(e,t){return r=e.exports,C.__wbindgen_wasm_module=t,y=null,S=null,i=null,r.__wbindgen_start(),r}async function C(e){if(r!==undefined)return r;const t=I();("string"==typeof e||"function"==typeof Request&&e instanceof Request||"function"==typeof URL&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:s}=await async function(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}(await e,t);return A(n,s)}n.PPOM=E;n.default=C}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom.js"}],[1300,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.analyticsControllerSelectors=void 0;n.analyticsControllerSelectors={selectAnalyticsId:e=>e.analyticsId,selectOptedIn:e=>e.optedIn,selectEnabled:e=>e.optedIn}}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/selectors.cjs"}],[1301,{"@metamask/base-controller":1480},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;const a=e("@metamask/base-controller"),o={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class u extends a.BaseController{constructor({messenger:e,state:t,allAnnouncements:n}){const a={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:a}),r.add(this),i(this,r,"m",s).call(this,n)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const n of Object.keys(e).map(Number))t[n].isShown=e[n]})}}n.AnnouncementController=u,r=new WeakSet,s=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"}],[1302,{"./AnnouncementController.cjs":1301},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;var r=e("./AnnouncementController.cjs");Object.defineProperty(n,"AnnouncementController",{enumerable:!0,get:function(){return r.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],[132,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.qrKeyringBuilderFactory=function(e,t,n){const r=()=>new e({bridge:new t(n)});return r.type=e.type,r}}}},{package:"$root$",file:"app/scripts/lib/qr-keyring-builder-factory.ts"}],[133,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.requestRepair=async function(e){return await navigator.locks.request(r,{ifAvailable:!0},async function(t){return null!==t&&(await e(),!0)})};const r="repairDatabase"}}},{package:"$root$",file:"app/scripts/lib/repair.ts"}],[134,{"../../../../shared/constants/network":8528,"@metamask/rpc-errors":3463},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createUnsupportedMethodMiddleware=function(e=s.UNSUPPORTED_RPC_METHODS){return async function(t,n,s,i){return e.has(t.method)?i(r.rpcErrors.methodNotSupported()):s()}};var r=e("@metamask/rpc-errors"),s=e("../../../../shared/constants/network")}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.ts"}],[135,{"../../../../../shared/constants/app":8502,"../../../../../shared/constants/network":8528,"./ethereum-chain-utils":137,"@metamask/controller-utils":1602,"@metamask/network-controller":3007,"@metamask/rpc-errors":3463,lodash:7181,"uri-js":8099},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.addEthereumChainHandler=void 0;var r=function(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var s,i,a={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return a;if(s=t?r:n){if(s.has(e))return s.get(e);s.set(e,a)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?s(a,t,i):a[t]=e[t]);return a}(e,t)}(e("uri-js")),s=e("@metamask/controller-utils"),i=e("@metamask/network-controller"),a=e("@metamask/rpc-errors"),o=e("lodash"),c=e("../../../../../shared/constants/app"),u=e("../../../../../shared/constants/network"),l=e("./ethereum-chain-utils");const d=n.addEthereumChainHandler={implementation:async function(e,t,n,c,{addNetwork:d,updateNetwork:p,getNetworkConfigurationByChainId:h,setActiveNetwork:f,requestUserApproval:m,getCurrentChainIdForDomain:g,getCaveat:y,requestPermittedChainsPermissionIncrementalForOrigin:w,rejectApprovalRequestsForOrigin:b,setTokenNetworkFilter:v,setEnabledNetworks:T,getEnabledNetworks:S}){let _;try{_=(0,l.validateAddEthereumChainParams)(e.params[0])}catch(e){return c(e)}const{chainId:k,chainName:E,firstValidBlockExplorerUrl:I,firstValidRPCUrl:A,ticker:C}=_,{origin:M}=e,P=g(M),O=h(k);if(O&&O.chainId===k&&O.nativeCurrency!==C)return c(a.rpcErrors.invalidParams({message:`nativeCurrency.symbol does not match currency symbol for a network the user already has added with the same chainId. Received:\n${C}`}));let j=O,x=O?.rpcEndpoints.findIndex(({url:e})=>r.equal(e,A)),N=I?O?.blockExplorerUrls.findIndex(e=>r.equal(e,I)):undefined;const R=!O||x!==O.defaultRpcEndpointIndex||I&&N!==O.defaultBlockExplorerUrlIndex;if(R)try{if(await m({origin:M,type:s.ApprovalType.AddEthereumChain,requestData:{chainId:k,rpcPrefs:{blockExplorerUrl:I},chainName:E,rpcUrl:A,ticker:C}}),O){const e=(0,o.cloneDeep)(O);-1===x&&(e.rpcEndpoints=[...e.rpcEndpoints,{url:A,type:i.RpcEndpointType.Custom,name:E}],x=e.rpcEndpoints.length-1),I&&(-1===N&&(e.blockExplorerUrls=[...e.blockExplorerUrls,I],N=e.blockExplorerUrls.length-1),e.defaultBlockExplorerUrlIndex=N),j=await p(e.chainId,e,P===k?{replacementSelectedRpcEndpointIndex:e.defaultRpcEndpointIndex}:undefined)}else{const e=u.FEATURED_RPCS.find(e=>e.chainId===k),t=e?e.rpcEndpoints[e.defaultRpcEndpointIndex]:undefined;j=await d({blockExplorerUrls:I?[I]:[],defaultBlockExplorerUrlIndex:I?0:undefined,chainId:k,defaultRpcEndpointIndex:0,name:E,nativeCurrency:C,rpcEndpoints:[...t&&!r.equal(A,t.url)?[t]:[],{url:A,name:E,type:i.RpcEndpointType.Custom}]})}}catch(e){return c(e)}const D=O?.rpcEndpoints?.[O.defaultRpcEndpointIndex]?.networkClientId,F=j?.rpcEndpoints?.[j.defaultRpcEndpointIndex]?.networkClientId,B=D??F;return(0,l.switchChain)(t,c,k,B,{isAddFlow:!0,autoApprove:R,setActiveNetwork:f,getCaveat:y,requestPermittedChainsPermissionIncrementalForOrigin:w,rejectApprovalRequestsForOrigin:b,setTokenNetworkFilter:v,setEnabledNetworks:T,getEnabledNetworks:S})},hookNames:{addNetwork:!0,updateNetwork:!0,getNetworkConfigurationByChainId:!0,setActiveNetwork:!0,requestUserApproval:!0,getCurrentChainIdForDomain:!0,getCaveat:!0,requestPermittedChainsPermissionIncrementalForOrigin:!0,rejectApprovalRequestsForOrigin:!0,setTokenNetworkFilter:!0,setEnabledNetworks:!0,getEnabledNetworks:!0}},p={[c.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN]:d};n.default=p}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js"}],[136,{"../../../../../shared/constants/app":8502},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ethAccountsHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.ethAccountsHandler={implementation:async function(e,t,n,r,{getAccounts:s}){return t.result=s(),r()},hookNames:{getAccounts:!0}},i={[r.MESSAGE_TYPE.ETH_ACCOUNTS]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.ts"}],[137,{"../../../../../shared/constants/app":8502,"../../../../../shared/lib/network.utils":8682,"../../util":210,"@metamask/chain-agnostic-permission":1551,"@metamask/controller-utils":1602,"@metamask/rpc-errors":3463,"@metamask/snaps-utils":3822,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.switchChain=async function(e,t,n,s,{origin:u,isAddFlow:l,isSwitchFlow:d,autoApprove:p,setActiveNetwork:h,getCaveat:f,requestPermittedChainsPermissionIncrementalForOrigin:m,setTokenNetworkFilter:g,setEnabledNetworks:y,getEnabledNetworks:w,rejectApprovalRequestsForOrigin:b,requestUserApproval:v,hasApprovalRequestsForOrigin:T,toNetworkConfiguration:S,fromNetworkConfiguration:_}){try{const k=f({target:i.Caip25EndowmentPermissionName,caveatType:i.Caip25CaveatType});if(k){if((0,i.getPermittedEthChainIds)(k.value).includes(n))!T?.()||l||p||await v({origin:u,type:r.ApprovalType.SwitchEthereumChain,requestData:{toNetworkConfiguration:S,fromNetworkConfiguration:_}});else{let e;d&&(e={isSwitchEthereumChain:!0}),await m({chainId:n,autoApprove:p,metadata:e})}}else await m({chainId:n,autoApprove:p});if((0,o.isSnapId)(u)||b?.(),await h(s),!(0,o.isSnapId)(u))if(g(n),(0,c.isPrefixedFormattedHexString)(n)){const e=w(a.KnownCaipNamespace.Eip155);Object.keys(e).includes(n)||y(n)}else{const{namespace:e}=(0,a.parseCaipChainId)(n),t=w(e);Object.keys(t).includes(n)||y(n)}return e.result=null,t()}catch(e){return t(e)}},n.validateAddEthereumChainParams=function(e){if(!e||"object"!=typeof e)throw s.rpcErrors.invalidParams({message:`Expected single, object parameter. Received:\n${JSON.stringify(e)}`});const{chainId:t,chainName:n,blockExplorerUrls:r,nativeCurrency:i,rpcUrls:a,...o}=e,c=Object.keys(o).filter(e=>!["iconUrls"].includes(e));if(c.length>0)throw s.rpcErrors.invalidParams({message:`Received unexpected keys on object parameter. Unsupported keys:\n${c}`});const p=d(t);if(!a||!Array.isArray(a)||0===a.length)throw s.rpcErrors.invalidParams({message:`Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${a}`});const h=e=>{const t=(0,l.getValidUrl)(e);return null!==t&&("localhost"===t.hostname||"127.0.0.1"===t.hostname||"https:"===t.protocol)},f=a.find(e=>h(e)),m=Array.isArray(r)?r.find(e=>h(e)):null;if(!f)throw s.rpcErrors.invalidParams({message:`Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${a}`});if("string"!=typeof n||!n)throw s.rpcErrors.invalidParams({message:`Expected non-empty string 'chainName'. Received:\n${n}`});const g=n.length>100?n.substring(0,100):n;if(null!==i){if("object"!=typeof i||Array.isArray(i))throw s.rpcErrors.invalidParams({message:`Expected null or object 'nativeCurrency'. Received:\n${i}`});if(18!==i.decimals)throw s.rpcErrors.invalidParams({message:`Expected the number 18 for 'nativeCurrency.decimals' when 'nativeCurrency' is provided. Received: ${i.decimals}`});if(!i.symbol||"string"!=typeof i.symbol)throw s.rpcErrors.invalidParams({message:`Expected a string 'nativeCurrency.symbol'. Received: ${i.symbol}`})}const y=i?.symbol||u.UNKNOWN_TICKER_SYMBOL;if(y!==u.UNKNOWN_TICKER_SYMBOL&&("string"!=typeof y||y.length<1||y.length>6))throw s.rpcErrors.invalidParams({message:`Expected 1-6 character string 'nativeCurrency.symbol'. Received:\n${y}`});return{chainId:p,chainName:g,firstValidBlockExplorerUrl:m,firstValidRPCUrl:f,ticker:y}},n.validateChainId=d,n.validateSwitchEthereumChainParams=function(e){if(!e.params?.[0]||"object"!=typeof e.params[0])throw s.rpcErrors.invalidParams({message:`Expected single, object parameter. Received:\n${JSON.stringify(e.params)}`});const{chainId:t,...n}=e.params[0];if(Object.keys(n).length>0)throw s.rpcErrors.invalidParams({message:`Received unexpected keys on object parameter. Unsupported keys:\n${Object.keys(n)}`});return d(t)};var r=e("@metamask/controller-utils"),s=e("@metamask/rpc-errors"),i=e("@metamask/chain-agnostic-permission"),a=e("@metamask/utils"),o=e("@metamask/snaps-utils"),c=e("../../../../../shared/lib/network.utils"),u=e("../../../../../shared/constants/app"),l=e("../../util");function d(e){const t="string"==typeof e?e.toLowerCase():null;if(!(0,c.isPrefixedFormattedHexString)(t))throw s.rpcErrors.invalidParams({message:`Expected 0x-prefixed, unpadded, non-zero hexadecimal string 'chainId'. Received:\n${e}`});if(!(0,c.isSafeChainId)(parseInt(e,16)))throw s.rpcErrors.invalidParams({message:`Invalid chain ID "${t}": numerical value greater than max safe value. Received:\n${e}`});return t}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.js"}],[138,{"../../../../../shared/constants/app":8502},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getProviderStateHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.getProviderStateHandler={implementation:async function(e,t,n,r,{getProviderState:s}){const i=e.params?.isInitializingStreamProvider;return t.result={...await s(e.origin,{isInitializingStreamProvider:i})},r()},hookNames:{getProviderState:!0}},i={[r.MESSAGE_TYPE.GET_PROVIDER_STATE]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.ts"}],[139,{"./add-ethereum-chain":135,"./eth-accounts":136,"./get-provider-state":138,"./log-web3-shim-usage":140,"./request-accounts":141,"./send-metadata":142,"./switch-ethereum-chain":143,"./wallet-getPermissions":144,"./wallet-requestPermissions":145,"./wallet-revokePermissions":146,"./watch-asset":147},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handlers=n.ethAccountsHandler=n.eip1193OnlyHandlers=void 0;var r=f(e("./add-ethereum-chain")),s=f(e("./eth-accounts")),i=f(e("./get-provider-state")),a=f(e("./log-web3-shim-usage")),o=f(e("./request-accounts")),c=f(e("./send-metadata")),u=f(e("./switch-ethereum-chain")),l=f(e("./watch-asset")),d=f(e("./wallet-getPermissions")),p=f(e("./wallet-requestPermissions")),h=f(e("./wallet-revokePermissions"));function f(e){return e&&e.__esModule?e:{default:e}}n.handlers={...r.default,...i.default,...a.default,...c.default,...l.default},n.eip1193OnlyHandlers={...u.default,...s.default,...o.default,...d.default,...p.default,...h.default},n.ethAccountsHandler=s.default}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/index.ts"}],[14,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.COOKIE_ID_MARKETING_WHITELIST_ORIGINS=n.COOKIE_ID_MARKETING_WHITELIST=void 0;const r=n.COOKIE_ID_MARKETING_WHITELIST=["https://metamask.io","https://learn.metamask.io","https://mmi-support.zendesk.com","https://community.metamask.io","https://support.metamask.io"];n.COOKIE_ID_MARKETING_WHITELIST_ORIGINS=r.map(e=>new URL(e).origin)}}},{package:"$root$",file:"app/scripts/constants/marketing-site-whitelist.ts"}],[140,{"../../../../../shared/constants/app":8502},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.logWeb3ShimUsageHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.logWeb3ShimUsageHandler={implementation:function(e,t,n,r,{getWeb3ShimUsageState:s,setWeb3ShimUsageRecorded:i}){const{origin:a}=e;s(a)===undefined&&i(a);return t.result=!0,r()},hookNames:{getWeb3ShimUsageState:!0,setWeb3ShimUsageRecorded:!0}},i={[r.MESSAGE_TYPE.LOG_WEB3_SHIM_USAGE]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.ts"}],[141,{"../../../../../shared/constants/app":8502,"../../../../../shared/constants/metametrics":8524,"../../getIframeProperties":109,"../../util":210,"@metamask/rpc-errors":3463},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.requestEthereumAccountsHandler=n.default=void 0;var r=e("@metamask/rpc-errors"),s=e("../../../../../shared/constants/app"),i=e("../../../../../shared/constants/metametrics"),a=e("../../util"),o=e("../../getIframeProperties");const c=n.requestEthereumAccountsHandler={implementation:async function(e,t,n,c,{getAccounts:u,sendMetrics:d,metamaskState:p,getCaip25PermissionFromLegacyPermissionsForOrigin:h,requestPermissionsForOrigin:f}){const{origin:m}=e??{};if(l.has(m))return t.error=r.rpcErrors.resourceUnavailable(`Already processing ${s.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS}. Please wait.`),c();let g=u(m);if(g.length>0){try{l.add(m),t.result=g,c()}catch(e){c(e)}finally{l.delete(m)}return undefined}try{const e=h();await f(e)}catch(e){return c(e)}if(g=u(m),(0,a.shouldEmitDappViewedEvent)(p.analyticsId)){const t=!Object.keys(p.permissionHistory).includes(m),{mainFrameOrigin:n,frameId:r}=e,s=(0,o.getIframeProperties)({frameId:r,origin:m,mainFrameOrigin:n});d({event:i.MetaMetricsEventName.DappViewed,category:i.MetaMetricsEventCategory.InpageProvider,referrer:{url:m},properties:{is_first_visit:t,number_of_accounts:Object.keys(p.internalAccounts.accounts).length,number_of_accounts_connected:g.length,...s}},{excludeMetaMetricsId:!0})}return t.result=g,c()},hookNames:{getAccounts:!0,sendMetrics:!0,metamaskState:!0,getCaip25PermissionFromLegacyPermissionsForOrigin:!0,requestPermissionsForOrigin:!0}},u={[s.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS]:c};n.default=u;const l=new Set}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/request-accounts.ts"}],[142,{"../../../../../shared/constants/app":8502},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sendMetadataHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.sendMetadataHandler={implementation:function(e,t,n,r){return t.result=!0,r()}},i={[r.MESSAGE_TYPE.SEND_METADATA]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/send-metadata.ts"}],[143,{"../../../../../shared/constants/app":8502,"./ethereum-chain-utils":137,"@metamask/rpc-errors":3463,"@metamask/snaps-utils":3822},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.switchEthereumChainHandler=n.default=void 0;var r=e("@metamask/rpc-errors"),s=e("@metamask/snaps-utils"),i=e("../../../../../shared/constants/app"),a=e("./ethereum-chain-utils");const o=n.switchEthereumChainHandler={implementation:async function(e,t,n,o,{getNetworkConfigurationByChainId:c,setActiveNetwork:u,requestUserApproval:l,getCaveat:d,getCurrentChainIdForDomain:p,requestPermittedChainsPermissionIncrementalForOrigin:h,rejectApprovalRequestsForOrigin:f,setTokenNetworkFilter:m,setEnabledNetworks:g,getEnabledNetworks:y,hasApprovalRequestsForOrigin:w}){let b;try{b=(0,a.validateSwitchEthereumChainParams)(e)}catch(e){return o(e)}const{origin:v}=e,T=p(v);if(T===b)return t.result=null,o();const S=c(b),_=S?.rpcEndpoints[S.defaultRpcEndpointIndex].networkClientId;if(!_)return o(r.providerErrors.custom({code:4902,message:`Unrecognized chain ID "${b}". Try adding the chain using ${i.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN} first.`}));const k=c(T),E=c(b);return(0,a.switchChain)(t,o,b,_,{origin:v,isSwitchFlow:!0,autoApprove:(0,s.isSnapId)(v),setActiveNetwork:u,getCaveat:d,requestPermittedChainsPermissionIncrementalForOrigin:h,rejectApprovalRequestsForOrigin:f,setTokenNetworkFilter:m,setEnabledNetworks:g,getEnabledNetworks:y,requestUserApproval:l,hasApprovalRequestsForOrigin:w,toNetworkConfiguration:E,fromNetworkConfiguration:k})},hookNames:{getNetworkConfigurationByChainId:!0,setActiveNetwork:!0,requestUserApproval:!0,getCaveat:!0,getCurrentChainIdForDomain:!0,requestPermittedChainsPermissionIncrementalForOrigin:!0,rejectApprovalRequestsForOrigin:!0,setTokenNetworkFilter:!0,setEnabledNetworks:!0,getEnabledNetworks:!0,hasApprovalRequestsForOrigin:!0}},c={[i.MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN]:o};n.default=c}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js"}],[144,{"../../../../../shared/constants/permissions":8533,"../../../controllers/permissions":37,"@metamask/chain-agnostic-permission":1551,"@metamask/permission-controller":3129},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPermissionsHandler=n.default=void 0;var r=e("@metamask/permission-controller"),s=e("@metamask/chain-agnostic-permission"),i=e("../../../controllers/permissions"),a=e("../../../../../shared/constants/permissions");const o=n.getPermissionsHandler={implementation:async function(e,t,n,r,{getPermissionsForOrigin:o,getAccounts:c}){const u={...o()},l=u[s.Caip25EndowmentPermissionName],d=l?.caveats?.find(({type:e})=>e===s.Caip25CaveatType)?.value;if(delete u[s.Caip25EndowmentPermissionName],d){const e=c();e.length>0&&(u[a.RestrictedMethods.eth_accounts]={...l,parentCapability:a.RestrictedMethods.eth_accounts,caveats:[{type:a.CaveatTypes.restrictReturnedAccounts,value:e}]});const t=(0,s.getPermittedEthChainIds)(d);t.length>0&&(u[i.PermissionNames.permittedChains]={...l,parentCapability:i.PermissionNames.permittedChains,caveats:[{type:a.CaveatTypes.restrictNetworkSwitching,value:t}]})}return t.result=Object.values(u),r()},hookNames:{getPermissionsForOrigin:!0,getAccounts:!0}},c={[r.MethodNames.GetPermissions]:o};n.default=c}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-getPermissions.ts"}],[145,{"../../../../../shared/constants/permissions":8533,"../../../controllers/permissions":37,"@metamask/chain-agnostic-permission":1551,"@metamask/controller-utils":1602,"@metamask/permission-controller":3129,lodash:7181},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.requestPermissionsHandler=n.default=void 0;var r=e("lodash"),s=e("@metamask/controller-utils"),i=e("@metamask/permission-controller"),a=e("@metamask/chain-agnostic-permission"),o=e("../../../../../shared/constants/permissions"),c=e("../../../controllers/permissions");const u=n.requestPermissionsHandler={implementation:async function(e,t,n,u,{getAccounts:l,requestPermissionsForOrigin:d,getCaip25PermissionFromLegacyPermissionsForOrigin:p}){const{params:h}=e;if(!Array.isArray(h)||!(0,s.isPlainObject)(h[0]))return u((0,i.invalidParams)({data:{request:e}}));let[f]=h;delete f[a.Caip25EndowmentPermissionName];const m=(0,r.pick)(f,[o.RestrictedMethods.eth_accounts,c.PermissionNames.permittedChains]);delete f[o.RestrictedMethods.eth_accounts],delete f[c.PermissionNames.permittedChains];const g=Object.keys(m).length>0;if(g){const e=p(m);f={...f,...e}}let y={};const[w]=await d(f);if(y={...w},g){const e=y[a.Caip25EndowmentPermissionName];if(!e)throw new Error(`could not find ${a.Caip25EndowmentPermissionName} permission.`);const t=e.caveats?.find(({type:e})=>e===a.Caip25CaveatType)?.value;if(!t)throw new Error(`could not find ${a.Caip25CaveatType} in granted ${a.Caip25EndowmentPermissionName} permission.`);delete y[a.Caip25EndowmentPermissionName];const n=l(origin);y[o.RestrictedMethods.eth_accounts]={...e,parentCapability:o.RestrictedMethods.eth_accounts,caveats:[{type:o.CaveatTypes.restrictReturnedAccounts,value:n}]};const r=(0,a.getPermittedEthChainIds)(t);r.length>0&&(y[c.PermissionNames.permittedChains]={...e,parentCapability:c.PermissionNames.permittedChains,caveats:[{type:o.CaveatTypes.restrictNetworkSwitching,value:r}]})}return t.result=Object.values(y).filter(e=>e!==undefined),u()},hookNames:{getAccounts:!0,requestPermissionsForOrigin:!0,getCaip25PermissionFromLegacyPermissionsForOrigin:!0}},l={[i.MethodNames.RequestPermissions]:u};n.default=l}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-requestPermissions.ts"}],[146,{"../../../../../shared/constants/permissions":8533,"../../../controllers/permissions":37,"@metamask/chain-agnostic-permission":1551,"@metamask/permission-controller":3129,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.revokePermissionsHandler=n.default=void 0;var r=e("@metamask/permission-controller"),s=e("@metamask/utils"),i=e("@metamask/chain-agnostic-permission"),a=e("../../../../../shared/constants/permissions"),o=e("../../../controllers/permissions");const c=n.revokePermissionsHandler={implementation:function(e,t,n,c,{revokePermissionsForOrigin:u,rejectApprovalRequestsForOrigin:l}){const{params:d}=e,p=d?.[0];if(!p)return c((0,r.invalidParams)({data:{request:e}}));const h=Object.keys(p).filter(e=>e!==i.Caip25EndowmentPermissionName);if(!(0,s.isNonEmptyArray)(h))return c((0,r.invalidParams)({data:{request:e}}));const f=[a.RestrictedMethods.eth_accounts,o.PermissionNames.permittedChains],m=h.filter(e=>!f.includes(e));m.length!==h.length&&m.push(i.Caip25EndowmentPermissionName);u(m),m.includes(i.Caip25EndowmentPermissionName)&&l();return t.result=null,c()},hookNames:{revokePermissionsForOrigin:!0,rejectApprovalRequestsForOrigin:!0}},u={[r.MethodNames.RevokePermissions]:c};n.default=u}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-revokePermissions.ts"}],[147,{"../../../../../shared/constants/app":8502,"@metamask/controller-utils":1602,"@metamask/rpc-errors":3463},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.watchAssetHandler=n.default=void 0;var r=e("@metamask/rpc-errors"),s=e("@metamask/controller-utils"),i=e("../../../../../shared/constants/app");const a=n.watchAssetHandler={implementation:async function(e,t,n,i,{handleWatchAssetRequest:a}){try{const{params:n,origin:o,networkClientId:c}=e;if(!n)return i(r.rpcErrors.invalidParams());const{options:u,type:l}=n,{tokenId:d}=u;return[s.ERC721,s.ERC1155].includes(l)&&d!==undefined&&"string"!=typeof d?i(r.rpcErrors.invalidParams({message:`Expected parameter 'tokenId' to be type 'string'. Received type '${typeof d}'`})):(await a({asset:u,type:l,origin:o??"",networkClientId:c??""}),t.result=!0,i())}catch(e){return i(e)}},hookNames:{handleWatchAssetRequest:!0}},o={[i.MESSAGE_TYPE.WATCH_ASSET]:a,[i.MESSAGE_TYPE.WATCH_ASSET_LEGACY]:a};n.default=o}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/watch-asset.ts"}],[148,{"./createUnsupportedMethodMiddleware":134,"./handlers":139,"@metamask/json-rpc-engine":2668,"@metamask/multichain-api-middleware":2969},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var r={createEip1193MethodMiddleware:!0,createEthAccountsMethodMiddleware:!0,createMultichainApiMethodMiddleware:!0,createMultichainInvokedMethodMiddleware:!0};n.createMultichainInvokedMethodMiddleware=n.createMultichainApiMethodMiddleware=n.createEthAccountsMethodMiddleware=n.createEip1193MethodMiddleware=void 0;var s=e("@metamask/json-rpc-engine"),i=e("@metamask/multichain-api-middleware"),a=e("./handlers"),o=e("./createUnsupportedMethodMiddleware");Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in n&&n[e]===o[e]||Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}}))});const c=e=>{0};n.createEip1193MethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:{...a.handlers,...a.eip1193OnlyHandlers},hooks:e,onError:c});n.createEthAccountsMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:a.ethAccountsHandler,hooks:e,onError:c});n.createMultichainApiMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:i.methodHandlers,hooks:e,onError:c});n.createMultichainInvokedMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:a.handlers,hooks:e,onError:c})}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/index.ts"}],[149,{"../../../shared/lib/snaps/snaps":8717,"@metamask/rpc-errors":3463},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createRpcBlockingCallbacks=function(e){const t=Symbol("rpc-blocking");return{onBeforeRequest:()=>e.blockingSymbols.add(t),onAfterRequest:()=>e.blockingSymbols.delete(t)}},n.default=function({allowedOrigins:e,errorMessage:t="Cannot process requests at this time",state:n}){return function(i,a,o,c){if(0===n.blockingSymbols.size)return o();const{origin:u}=i;if(!u)return c(r.rpcErrors.internal(`No origin specified for request with method ${i.method}`));return e.includes(u)||(0,s.isSnapPreinstalled)(u)?o():c(r.rpcErrors.resourceUnavailable(t))}};var r=e("@metamask/rpc-errors"),s=e("../../../shared/lib/snaps/snaps")}}},{package:"$root$",file:"app/scripts/lib/rpcBlockingMiddleware.ts"}],[150,{"../../../shared/lib/error":8638,"../../../shared/lib/sentry":8709,"./operation-safener":126,"webextension-polyfill":8489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getRequestSafeReload=function(e){const t=new o.OperationSafener({op:async t=>{try{if("data"===e.storageKind){if(!t)throw new Error("State must be provided for 'data' storageKind");await e.set(t)}else await e.persist()}catch(e){(0,i.captureException)((0,a.createSentryError)("MetaMask - Persistence failed",e))}},wait:1e3});return{safePersist:async(...e)=>t.execute(...e),requestSafeReload:async()=>{await t.evacuate(),globalThis.setTimeout(()=>{s.default.runtime.reload()},c)},evacuate:()=>t.evacuate()}};var r,s=(r=e("webextension-polyfill"))&&r.__esModule?r:{default:r},i=e("../../../shared/lib/sentry"),a=e("../../../shared/lib/error"),o=e("./operation-safener");const c=150}}},{package:"$root$",file:"app/scripts/lib/safe-reload.ts"}],[1509,{"./bridge-status-controller.intent.cjs":1510,"./constants.cjs":1511,"./quote-status-manager/constants.cjs":1513,"./quote-status-manager/errors.cjs":1514,"./quote-status-manager/quotes-status-manager.cjs":1520,"./strategy/index.cjs":1526,"./strategy/types.cjs":1529,"./types.cjs":1530,"./utils/accounts.cjs":1531,"./utils/authentication.cjs":1532,"./utils/bridge-status.cjs":1533,"./utils/bridge.cjs":1534,"./utils/history.cjs":1537,"./utils/metrics.cjs":1540,"./utils/network.cjs":1541,"./utils/trace.cjs":1544,"./utils/transaction.cjs":1545,"@metamask/bridge-controller":1489,"@metamask/polling-controller":3302,"@metamask/transaction-controller":3915,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u,l,d,p,h,f,m,g,y,w,b,v,T,S,_,k,E,I,A,C,M,P=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},O=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},j=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusController=void 0;const x=e("@metamask/bridge-controller"),N=e("@metamask/bridge-controller"),R=e("@metamask/polling-controller"),D=e("@metamask/transaction-controller"),F=e("@metamask/utils"),B=e("./bridge-status-controller.intent.cjs"),L=e("./constants.cjs"),U=e("./quote-status-manager/constants.cjs"),q=(e("./quote-status-manager/errors.cjs"),e("./quote-status-manager/quotes-status-manager.cjs")),H=j(e("./strategy/index.cjs")),$=e("./strategy/types.cjs"),W=e("./types.cjs"),K=e("./utils/accounts.cjs"),G=e("./utils/authentication.cjs"),Q=e("./utils/bridge.cjs"),V=e("./utils/bridge-status.cjs"),z=e("./utils/history.cjs"),J=e("./utils/metrics.cjs"),Y=e("./utils/network.cjs"),X=e("./utils/trace.cjs"),Z=e("./utils/transaction.cjs"),ee={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},quoteUpdateStatusStore:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}},te=["startPollingForBridgeTxStatus","wipeBridgeStatus","resetState","submitTx","submitIntent","submitBatchSell","restartPollingForFailedAttempts","getBridgeHistoryItemByTxMetaId"];class ne extends((0,R.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:n,clientProduct:j,clientVersion:R,fetchFn:ne,addTransactionBatchFn:re,config:se,traceFn:ie,onQuoteStatusManagerError:ae,isQuoteStatusManagerEnabled:oe}){super({name:L.BRIDGE_STATUS_CONTROLLER_NAME,metadata:ee,messenger:e,state:{...L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),r.set(this,{}),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),c.set(this,void 0),u.set(this,void 0),l.set(this,void 0),d.set(this,({txMeta:e,historyKey:t,isApprovalTxMeta:n})=>{const r=!!t&&this.state.txHistory[t]?.status.status===N.StatusTypes.FAILED;O(this,k,"f").call(this,{historyKey:t,status:N.StatusTypes.FAILED,txHash:n?undefined:e.hash,completionTime:Date.now()}),e.status!==D.TransactionStatus.rejected&&(r||((e.type&&(0,Z.isCrossChainTx)(e.type)||(0,Z.hasNestedSwapTransactions)(e))&&O(this,i,"f").reportFinalised(e.id,!1),O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.Failed,t,(0,J.getEVMTxPropertiesFromTransactionMeta)(e))))}),p.set(this,({txMeta:e,historyKey:t,isApprovalTxMeta:n})=>{if(n)return;O(this,k,"f").call(this,{historyKey:t,txHash:e.hash});if(e.type===D.TransactionType.swap||(0,Z.hasNestedSwapTransactions)(e)){O(this,k,"f").call(this,{historyKey:t,status:N.StatusTypes.COMPLETE,completionTime:Date.now()});const n=t?this.state.txHistory[t]:undefined;t&&n&&e.hash&&!(0,N.isNonEvmChainId)(n.quote.srcChainId)&&O(this,f,"f").call(this,t,e.hash,e.id),O(this,i,"f").reportFinalised(e.id,!0),O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,t)}else t&&O(this,b,"f").call(this,t)}),h.set(this,(e,t)=>{if(!t?.id||!t.hash)return;const n=this.state.txHistory[e];n&&(0,N.isNonEvmChainId)(n.quote.srcChainId)&&O(this,f,"f").call(this,e,t.hash,t.id)}),f.set(this,(e,t,n)=>{const r=this.state.txHistory[e];r?.quoteId&&r.reportedSubmittedTxHash!==t&&(O(this,i,"f").reportSubmitted(r.quoteId,t,n),this.update(n=>{const r=n.txHistory[e];r&&(r.reportedSubmittedTxHash=t)}))}),this.resetState=()=>{O(this,i,"f").destroy(),this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory,e.quoteUpdateStatusStore=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.quoteUpdateStatusStore})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const t=(0,Y.getSelectedChainId)(this.messenger);O(this,I,"f").call(this,e,t)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:n}=e;if(!t&&!n)throw new Error("Either txMetaId or txHash must be provided");let s;if(t?this.state.txHistory[t]&&(s=t):n&&(s=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===n)),!s)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${n}`));const i=this.state.txHistory[s],a=i.attempts?.counter??0;if(this.update(e=>{s&&(e.txHistory[s].attempts=undefined)}),(0,z.shouldPollHistoryItem)(i)){O(this,r,"f")[s]||(O(this,b,"f").call(this,s),O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.PollingStatusUpdated,s,{polling_status:N.PollingStatus.ManuallyRestarted,retry_attempts:a}))}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],m.set(this,()=>{if(O(this,i,"f").enabled)for(const[e,t]of Object.entries(this.state.txHistory)){const{quoteId:n,txMetaId:r}=t;if(!n||!r)continue;if(Date.now()-t.startTime>U.QUOTE_STATUS_BACKFILL_WINDOW_MS)continue;const s=t.status.srcChain.txHash??(0,Z.getTransactionMetaById)(this.messenger,r)?.hash;s&&O(this,f,"f").call(this,e,s,r)}}),g.set(this,()=>{const{txHistory:e}=this.state;Object.entries(e).filter(([e,t])=>t.status.status===N.StatusTypes.PENDING||t.status.status===N.StatusTypes.UNKNOWN).filter(([e,t])=>{if(!t.txMetaId)return!1;return!O(this,r,"f")[t.txMetaId]}).filter(([e,t])=>(0,z.shouldPollHistoryItem)(t)).forEach(([e,t])=>{(0,V.shouldSkipFetchDueToFetchFailures)(t.attempts)||O(this,b,"f").call(this,e)})}),y.set(this,(e,...t)=>{const n=(0,z.getInitialHistoryItem)(...t);return this.update(t=>{t.txHistory[e]=n}),e}),w.set(this,(e,t,n)=>{this.update(r=>{(0,z.rekeyHistoryItemInState)(r,e,t,n)})}),b.set(this,e=>{const t=O(this,r,"f")[e];t&&this.stopPollingByPollingToken(t);const n=this.state.txHistory[e];n&&(0,z.shouldPollHistoryItem)(n)&&(O(this,r,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;if(!t?.id)throw new Error("Cannot start polling: bridgeTxMeta.id is required for polling");const n=O(this,y,"f").call(this,t.id,e);O(this,b,"f").call(this,n)},this._executePoll=async e=>{await O(this,S,"f").call(this,e)},v.set(this,e=>{const{attempts:t}=this.state.txHistory[e],n=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},s=O(this,r,"f")[e];if(n.counter>=L.MAX_ATTEMPTS&&s){this.stopPollingByPollingToken(s),delete O(this,r,"f")[e];this.state.txHistory[e]&&O(this,C,"f").call(this,e,N.PollingStatus.MaxPollingReached)}O(this,k,"f").call(this,{historyKey:e,attempts:n})}),T.set(this,async e=>{if(this.state.txHistory[e]&&await(0,V.shouldWaitForFinalBridgeStatus)(this.messenger,this.state.txHistory[e]))return;const t=O(this,r,"f")[e];O(this,C,"f").call(this,e,N.PollingStatus.InvalidTransactionHash),t&&(this.stopPollingByPollingToken(t),delete O(this,r,"f")[e]),O(this,i,"f").reportFinalised(e,!1),O(this,E,"f").call(this,e)}),S.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state,n=t[e];if(n&&!(0,V.shouldSkipFetchDueToFetchFailures)(n.attempts))try{let t,u=[];if(n.quote.intent){const r=await O(this,s,"f").getIntentTransactionStatus(e,n.quote.srcChainId,n.quote.intent.protocol,O(this,a,"f"),n.status.srcChain.txHash);if(null===r?.bridgeStatus||r?.bridgeStatus===undefined)return;t=r.bridgeStatus.status;const i=t.srcChain.txHash;i&&O(this,f,"f").call(this,e,i,e)}else{const r=O(this,_,"f").call(this,e);if(!r)return;O(this,f,"f").call(this,e,r,e);const s=(0,V.getStatusRequestWithSrcTxHash)(n.quote,r),l=(n.quoteId?await(0,V.fetchBridgeQuoteStatus)(O(this,i,"f"),n.quoteId):null)??await(0,V.fetchBridgeTxStatus)(s,O(this,a,"f"),await(0,G.getJwt)(this.messenger),O(this,o,"f"),O(this,c,"f").customBridgeApiBaseUrl);t=l.status,u=l.validationFailures}if(u.length>0)throw O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:u,refresh_count:n.attempts?.counter??0}),new Error(`Bridge status validation failed: ${u.join(", ")}`);const l={...n,status:t,completionTime:t.status===N.StatusTypes.COMPLETE||t.status===N.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=l}),n.quote.intent&&O(this,s,"f").syncTransactionFromIntentStatus(e,n);const d=O(this,r,"f")[e];if(t.status===N.StatusTypes.COMPLETE||t.status===N.StatusTypes.FAILED){d&&(this.stopPollingByPollingToken(d),delete O(this,r,"f")[e]);const s=l.status.srcChain.txHash;s&&O(this,f,"f").call(this,e,s,e),O(this,i,"f").reportFinalised(e,t.status===N.StatusTypes.COMPLETE),t.status===N.StatusTypes.COMPLETE&&(O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",n.quote.destAsset.assetId)),t.status===N.StatusTypes.FAILED&&O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),O(this,v,"f").call(this,e)}finally{await O(this,T,"f").call(this,e)}}),_.set(this,e=>{const{txHistory:t}=this.state,n=t[e].status.srcChain.txHash;if(n||(0,N.isNonEvmChainId)(t[e].quote.srcChainId))return n;const r=(0,Z.getTransactionMetaById)(this.messenger,e);if(!r)return undefined;const s=[D.TransactionStatus.confirmed,D.TransactionStatus.dropped,D.TransactionStatus.rejected,D.TransactionStatus.failed].includes(r.status)?r.hash:undefined;return O(this,k,"f").call(this,{historyKey:e,txHash:s}),s}),k.set(this,({historyKey:e,status:t,txHash:n,attempts:r,completionTime:s})=>{e&&this.update(i=>{t&&(i.txHistory[e].status.status=t),n&&(i.txHistory[e].status.srcChain.txHash=n),r&&(i.txHistory[e].attempts=r),s&&(i.txHistory[e].completionTime=s)})}),E.set(this,e=>{this.update(t=>{delete t.txHistory[e]})}),I.set(this,(e,t)=>{const n=Object.keys(this.state.txHistory).filter(n=>{const r=this.state.txHistory[n],s=(0,F.numberToHex)(r.quote.srcChainId);return r.account===e&&s===t});n.forEach(e=>{O(this,r,"f")[e]&&(this.stopPollingByPollingToken(O(this,r,"f")[e]),delete O(this,r,"f")[e])}),this.update(e=>{e.txHistory=n.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),A.set(this,async(e,t)=>{let n;const r=(0,H.default)(e);for await(const{type:s,payload:a}of r)try{switch(s){case $.SubmitStep.RekeyHistoryItem:O(this,w,"f").call(this,a.oldHistoryKey,a.newHistoryKey,a.tradeMeta),a.tradeMeta.hash&&O(this,f,"f").call(this,a.newHistoryKey,a.tradeMeta.hash,a.tradeMeta.id);break;case $.SubmitStep.UpdateBatchTransactions:(0,Z.updateTransactionsInBatch)({messenger:this.messenger,allTradesWithMetadata:a.quoteAndTxMetas});break;case $.SubmitStep.SetTradeMeta:n=a.tradeMeta;break;case $.SubmitStep.AddHistoryItem:O(this,y,"f").call(this,a.historyKey,{...a,...t,quoteResponse:a.quoteResponse,accountAddress:e.selectedAccount.address,isStxEnabled:e.isStxEnabled,slippagePercentage:0}),O(this,h,"f").call(this,a.historyKey,a.bridgeTxMeta);break;case $.SubmitStep.StartPolling:O(this,b,"f").call(this,a.historyKey);break;case $.SubmitStep.PublishCompletedEvent:O(this,i,"f").reportFinalised(a.historyKey,!0),O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,a.historyKey);break;default:throw new Error(`Unknown submit step type: ${String(s)}`)}}catch(e){console.error("Failed to add to bridge history and start polling.",e)}return n}),this.submitTx=async(e,t,n,r,s=N.MetaMetricsSwapsEventSource.Unknown,i,d,p,h,f)=>{const m=Array.isArray(t)?t:[t],g=m[0],{quote:y}=g,w=Date.now();(0,Q.stopPollingForQuotes)(this.messenger,r);const b=(0,K.getAccountByAddress)(this.messenger,e);if(!b)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const v=(0,N.getAccountHardwareType)(b),T=O(this,a,"f")===W.BridgeClientId.MOBILE&&null!==v,S=(0,N.isCrossChain)(y.srcChainId,y.destChainId),_=m.some(({featureId:e})=>e===x.FeatureId.BATCH_SELL)?(0,D.generateBatchId)():undefined,k=(0,J.getPreConfirmationPropertiesFromQuote)(g,n,v,s,i,d,p,h,_);try{O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.Submitted,undefined,{...k,...f&&{input_primary_denomination:f}});const e=!(0,N.isNonEvmChainId)(y.srcChainId)&&await(0,Z.checkIsDelegatedAccount)(this.messenger,b.address,[(0,N.formatChainIdToHex)(y.srcChainId)]),t={messenger:this.messenger,quoteResponses:m,batchSellTrades:h,isStxEnabled:n,isBridgeTx:S,isDelegatedAccount:e,selectedAccount:b,requireApproval:T,clientId:O(this,a,"f"),bridgeApiBaseUrl:O(this,c,"f").customBridgeApiBaseUrl,addTransactionBatchFn:O(this,u,"f"),fetchFn:O(this,o,"f"),traceFn:O(this,l,"f"),batchId:_};return await O(this,l,"f").call(this,(0,X.getTraceParams)(g,n),async()=>await O(this,A,"f").call(this,t,{startTime:w,location:s,abTests:i,activeAbTests:d,tokenSecurityTypeDestination:p,inputPrimaryDenomination:f}))}catch(e){throw O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...k}),e}},this.submitIntent=async e=>{const{quoteResponse:t,accountAddress:n,location:r,abTests:s,activeAbTests:i,tokenSecurityTypeDestination:a,inputPrimaryDenomination:o,isStxEnabled:c=!1,quotesReceivedContext:u}=e;return await this.submitTx(n,t,c,u,r,s,i,a,undefined,o)},this.submitBatchSell=async e=>{const t=(0,Q.getBatchSellTrades)(this.messenger);return await this.submitTx(e.accountAddress,e.quoteResponses.filter(e=>null!==e),e.isStxEnabled??!1,e.quotesReceivedContext,e.location,e.abTests,e.activeAbTests,e.tokenSecurityTypeDestination,t)},C.set(this,(e,t)=>{const n=this.state.txHistory[e];O(this,M,"f").call(this,N.UnifiedSwapBridgeEventName.PollingStatusUpdated,e,{polling_status:t,retry_attempts:n.attempts?.counter??0})}),M.set(this,(e,t,n)=>{const r=t?this.state.txHistory[t]:undefined,s=n?.feature_id??r?.featureId??x.FeatureId.UNIFIED_SWAP_BRIDGE;if(!L.ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS.includes(s)&&e!==N.UnifiedSwapBridgeEventName.StatusValidationFailed)return;const i=t?this.state.txHistory?.[t]?.abTests:undefined,a=t?this.state.txHistory?.[t]?.activeAbTests:undefined,o=n?.ab_tests??i,c=n?.active_ab_tests??a,u=r?.location??n?.location??N.MetaMetricsSwapsEventSource.Unknown,l={action_type:N.MetricsActionType.SWAPBRIDGE_V1,feature_id:s??x.FeatureId.UNIFIED_SWAP_BRIDGE,...r?.batchId?{batch_id:r.batchId}:{},...n??{},location:u,...o&&Object.keys(o).length>0&&{ab_tests:o},...c&&c.length>0&&{active_ab_tests:c}};if(!r)return void(0,Q.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:l});const{approvalTxId:d,quote:p}=r,h=(0,J.getRequestParamFromHistory)(r);if(e===N.UnifiedSwapBridgeEventName.StatusValidationFailed)return void(0,Q.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:{...l,chain_id_source:h.chain_id_source,chain_id_destination:h.chain_id_destination,token_address_source:h.token_address_source,token_address_destination:h.token_address_destination,token_security_type_destination:h.token_security_type_destination,refresh_count:r.attempts?.counter??0}});const f=(0,K.getAccountByAddress)(this.messenger,r.account),m=(0,Z.getTransactions)(this.messenger),g=m.find(e=>e.id===t),y=m.find(e=>e.id===d),w={...l,...h,...(0,J.getRequestMetadataFromHistory)(r,f),...(0,J.getTradeDataFromHistory)(r),...(0,J.getTxStatusesFromHistory)(r),...(0,J.getFinalizedTxProperties)(r,g,y),...(0,J.getPriceImpactFromQuote)(p),...e===N.UnifiedSwapBridgeEventName.Completed&&r.inputPrimaryDenomination&&{input_primary_denomination:r.inputPrimaryDenomination}};(0,Q.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:w})}),P(this,a,n,"f"),P(this,o,ne,"f"),P(this,u,re,"f"),P(this,c,{customBridgeApiBaseUrl:se?.customBridgeApiBaseUrl??L.BRIDGE_PROD_API_BASE_URL},"f"),P(this,l,ie??((e,t)=>t?.()),"f"),P(this,s,new B.IntentManager({messenger:this.messenger,customBridgeApiBaseUrl:O(this,c,"f").customBridgeApiBaseUrl,fetchFn:O(this,o,"f")}),"f"),P(this,i,new q.QuoteStatusManager({messenger:this.messenger,clientId:O(this,a,"f"),clientProduct:j,clientVersion:R,apiBaseUrl:O(this,c,"f").customBridgeApiBaseUrl,initialData:this.state.quoteUpdateStatusStore,onPersistUpdates:e=>{this.update(t=>{t.quoteUpdateStatusStore=e})},entryTtlMs:U.QUOTE_STATUS_UPDATE_ENTRY_TTL,updateIntervalMs:U.QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS,onError:ae,isEnabled:oe}),"f"),this.messenger.registerMethodActionHandlers(this,te),this.setIntervalLength(L.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionStatusUpdated",({txMeta:e,historyKey:t,historyItem:n,isApprovalTxMeta:r})=>{if(!e)return;const{type:s,status:i}=e;if(s&&(0,Z.isCrossChainTx)(s)||t||n)switch(i){case D.TransactionStatus.submitted:e.hash&&e.type&&(0,Z.isCrossChainTx)(e.type)&&!r&&t&&O(this,f,"f").call(this,t,e.hash,e.id);break;case D.TransactionStatus.confirmed:O(this,p,"f").call(this,{txMeta:e,historyKey:t,isApprovalTxMeta:r});break;case D.TransactionStatus.failed:case D.TransactionStatus.dropped:case D.TransactionStatus.rejected:O(this,d,"f").call(this,{txMeta:e,historyKey:t,isApprovalTxMeta:r})}},({transactionMeta:e})=>{const t=(0,z.getMatchingHistoryEntryForTxMeta)(this.state.txHistory,e),n=(0,z.getMatchingHistoryEntryForApprovalTxMeta)(this.state.txHistory,e),r=t??n;return{historyKey:r?.[0],historyItem:r?.[1],txMeta:e,isApprovalTxMeta:r?.[1]?.approvalTxId===e.id}}),O(this,m,"f").call(this),O(this,i,"f").init(),O(this,g,"f").call(this)}}n.BridgeStatusController=ne,r=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,d=new WeakMap,p=new WeakMap,h=new WeakMap,f=new WeakMap,m=new WeakMap,g=new WeakMap,y=new WeakMap,w=new WeakMap,b=new WeakMap,v=new WeakMap,T=new WeakMap,S=new WeakMap,_=new WeakMap,k=new WeakMap,E=new WeakMap,I=new WeakMap,A=new WeakMap,C=new WeakMap,M=new WeakMap}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs"}],[151,{"../../../../shared/constants/metametrics":8524,"../../../../shared/lib/sentry":8709,"../../controllers/analytics":21,loglevel:7191},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.runSeedlessOnboardingMigrations=async function(e){const{completedOnboarding:t}=e.call("OnboardingController:getState");if(!t)return;try{await e.call("SeedlessOnboardingController:runMigrations")&&(0,i.trackEvent)((0,i.createEventBuilder)(a.MetaMetricsEventName.SeedlessOnboardingMigrationCompleted).addCategory(a.MetaMetricsEventCategory.Background).addProperties({migration_version:e.call("SeedlessOnboardingController:getState").migrationVersion}).build())}catch(t){const n=t instanceof Error,r=n?t.message:"Unknown error",c=n?t:new Error(r);try{(0,i.trackEvent)((0,i.createEventBuilder)(a.MetaMetricsEventName.SeedlessOnboardingMigrationFailed).addCategory(a.MetaMetricsEventCategory.Background).addProperties({migration_version:e.call("SeedlessOnboardingController:getState").migrationVersion,error:r}).build())}catch(e){s.default.warn("Failed to track seedless onboarding migration failure",e)}try{(0,o.captureException)(c)}catch(e){s.default.warn("Failed to capture seedless onboarding migration failure",e)}throw c}};var r,s=(r=e("loglevel"))&&r.__esModule?r:{default:r},i=e("../../controllers/analytics"),a=e("../../../../shared/constants/metametrics"),o=e("../../../../shared/lib/sentry")}}},{package:"$root$",file:"app/scripts/lib/seedless-onboarding/run-migrations.ts"}],[1510,{"./utils/authentication.cjs":1532,"./utils/intent-api.cjs":1538,"./utils/transaction.cjs":1545,"./utils/validators.cjs":1546,"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},c=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.IntentManager=void 0;const u=e("@metamask/bridge-controller"),l=e("./utils/authentication.cjs"),d=e("./utils/intent-api.cjs"),p=e("./utils/transaction.cjs");e("./utils/validators.cjs");n.IntentManager=class{constructor({messenger:e,customBridgeApiBaseUrl:t,fetchFn:n}){r.add(this),s.set(this,void 0),i.set(this,new Map),this.getIntentTransactionStatus=async(e,t,n,s,i)=>{try{const o=await this.intentApi.getOrderStatus(e,n,t,s);return c(this,r,"m",a).call(this,e,o,t,i)}catch(e){if(e instanceof Error)throw new Error(`[Intent polling] Failed to get intent order status from API: ${e.message}`);return undefined}},this.syncTransactionFromIntentStatus=(e,t)=>{const n=t.originalTransactionId??t.txMetaId;if(!n)return;const r=c(this,i,"f").get(e);if(r)try{const t=(0,p.getTransactionMetaById)(c(this,s,"f"),n);if(!t)return void console.warn("[Intent polling] Skipping update, transaction not found",{originalTxId:n,bridgeHistoryKey:e});const{bridgeStatus:a,orderStatus:o}=r,l=a?.txHash,d=a?.status.status===u.StatusTypes.COMPLETE,h=a?.status.status===u.StatusTypes.COMPLETE||a?.status.status===u.StatusTypes.FAILED,f=t.txReceipt,m=l?{txReceipt:{...f,transactionHash:l,status:d?"0x1":"0x0"}}:{};(0,p.updateTransaction)(c(this,s,"f"),t,{status:a?.transactionStatus,...l?{hash:l}:{},...m},`BridgeStatusController - Intent order status updated: ${o}`),h&&c(this,i,"f").delete(e)}catch(t){console.error("[Intent polling] Failed to update transaction status",{originalTxId:n,bridgeHistoryKey:e,error:t})}},o(this,s,e,"f"),this.intentApi=new d.IntentApiImpl(t,n,async()=>await(0,l.getJwt)(e))}},s=new WeakMap,i=new WeakMap,r=new WeakSet,a=function(e,t,n,r){const s=(0,d.translateIntentOrderToBridgeStatus)(t,n,r),a={orderStatus:t.status,bridgeStatus:s};return c(this,i,"f").set(e,a),a}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.cjs"}],[1511,{"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS=n.TraceName=n.APPROVAL_DELAY_MS=n.BRIDGE_PROD_API_BASE_URL=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.BRIDGE_STATUS_CONTROLLER_NAME=n.DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS=n.MAX_ATTEMPTS=n.REFRESH_INTERVAL_MS=void 0;const r=e("@metamask/bridge-controller");var s;n.REFRESH_INTERVAL_MS=1e4,n.MAX_ATTEMPTS=7,n.DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS=1728e5,n.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{},quoteUpdateStatusStore:{}},n.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",n.APPROVAL_DELAY_MS=5e3,function(e){e.BridgeTransactionApprovalCompleted="Bridge Transaction Approval Completed",e.BridgeTransactionCompleted="Bridge Transaction Completed",e.SwapTransactionApprovalCompleted="Swap Transaction Approval Completed",e.SwapTransactionCompleted="Swap Transaction Completed"}(s||(n.TraceName=s={})),n.ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS=[r.FeatureId.QUICK_BUY_FOLLOW_TRADING,r.FeatureId.QUICK_BUY_TOKEN_DETAILS,r.FeatureId.QUICK_BUY_EXPLORE,r.FeatureId.UNIFIED_SWAP_BRIDGE,r.FeatureId.BATCH_SELL]}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/constants.cjs"}],[1512,{"./bridge-status-controller.cjs":1509,"./constants.cjs":1511,"./quote-status-manager/constants.cjs":1513,"./quote-status-manager/errors.cjs":1514,"./types.cjs":1530,"./utils/history.cjs":1537},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isBatchSellHistoryItem=n.getBatchSellHistoryItemsForTxHash=n.BridgeStatusController=n.BridgeStatusAction=n.BridgeId=n.MAX_ATTEMPTS=n.BRIDGE_STATUS_CONTROLLER_NAME=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.REFRESH_INTERVAL_MS=n.BaseQuoteStatusUpdateErrorTypes=n.QuoteStatusGetError=n.QuoteStatusUpdateError=void 0;var r=e("./quote-status-manager/errors.cjs");Object.defineProperty(n,"QuoteStatusUpdateError",{enumerable:!0,get:function(){return r.QuoteStatusUpdateError}}),Object.defineProperty(n,"QuoteStatusGetError",{enumerable:!0,get:function(){return r.QuoteStatusGetError}});var s=e("./quote-status-manager/constants.cjs");Object.defineProperty(n,"BaseQuoteStatusUpdateErrorTypes",{enumerable:!0,get:function(){return s.BaseQuoteStatusUpdateErrorTypes}});var i=e("./constants.cjs");Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return i.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return i.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(n,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return i.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(n,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return i.MAX_ATTEMPTS}});var a=e("./types.cjs");Object.defineProperty(n,"BridgeId",{enumerable:!0,get:function(){return a.BridgeId}}),Object.defineProperty(n,"BridgeStatusAction",{enumerable:!0,get:function(){return a.BridgeStatusAction}});var o=e("./bridge-status-controller.cjs");Object.defineProperty(n,"BridgeStatusController",{enumerable:!0,get:function(){return o.BridgeStatusController}});var c=e("./utils/history.cjs");Object.defineProperty(n,"getBatchSellHistoryItemsForTxHash",{enumerable:!0,get:function(){return c.getBatchSellHistoryItemsForTxHash}}),Object.defineProperty(n,"isBatchSellHistoryItem",{enumerable:!0,get:function(){return c.isBatchSellHistoryItem}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/index.cjs"}],[1513,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a;Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusFetchWithRetryOutcomeType=n.AllowedQuoteStatusStateTransitions=n.QuoteStatusStateToBackendStatus=n.QuoteStatusState=n.QuoteStatusUpdateRetryableBackendTypes=n.QuoteStatusUpdateBackendOnChainMismatchTypes=n.QuoteStatusBackendValues=n.BaseQuoteStatusUpdateErrorTypes=n.QuoteStatusUpdateBackendErrorType=n.QuoteStatusBackendStatus=n.QUOTE_STATUS_BACKFILL_WINDOW_MS=n.QUOTE_STATUS_UPDATE_ENTRY_TTL=n.QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS=void 0,n.QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS=18e5,n.QUOTE_STATUS_UPDATE_ENTRY_TTL=108e5,n.QUOTE_STATUS_BACKFILL_WINDOW_MS=432e5,function(e){e.Served="SERVED",e.Submitted="SUBMITTED",e.FinalizedSuccess="FINALIZED_SUCCESS",e.FinalizedFailed="FINALIZED_FAILED"}(r||(n.QuoteStatusBackendStatus=r={})),function(e){e.QuoteNotFound="QUOTE_NOT_FOUND",e.ConcurrentUpdate="CONCURRENT_UPDATE",e.InvalidStatusTransaction="INVALID_STATUS_TRANSITION",e.SrcTxHashRequiredForFinalized="SRC_TX_HASH_REQUIRED_FOR_FINALIZED",e.PersistQuoteStatusFailed="PERSIST_QUOTE_STATUS_FAILED",e.TransactionNotIndexed="TRANSACTION_NOT_INDEXED",e.TxDataMissingHash="TX_DATA_MISSING_HASH",e.TxDataMissingTrade="TX_DATA_MISSING_TRADE",e.TxDataMismatch="TX_DATA_MISMATCH",e.SvmTradeDeserializeFailed="SVM_TRADE_DESERIALIZE_FAILED",e.QuoteStatusOnChainMismatch="QUOTE_STATUS_ONCHAIN_MISMATCH"}(s||(n.QuoteStatusUpdateBackendErrorType=s={})),n.BaseQuoteStatusUpdateErrorTypes=[s.QuoteNotFound,s.ConcurrentUpdate,s.SrcTxHashRequiredForFinalized,s.PersistQuoteStatusFailed,s.TransactionNotIndexed,s.TxDataMissingHash,s.TxDataMissingTrade,s.TxDataMismatch,s.SvmTradeDeserializeFailed],n.QuoteStatusBackendValues=[r.Served,r.Submitted,r.FinalizedSuccess,r.FinalizedFailed],n.QuoteStatusUpdateBackendOnChainMismatchTypes=[s.InvalidStatusTransaction,s.QuoteStatusOnChainMismatch],n.QuoteStatusUpdateRetryableBackendTypes=[s.ConcurrentUpdate,s.TransactionNotIndexed],function(e){e.Submitted="Submitted",e.FinalizedSuccess="FinalizedSuccess",e.FinalizedFailed="FinalizedFailed",e.Completed="Completed",e.Expired="Expired"}(i||(n.QuoteStatusState=i={})),n.QuoteStatusStateToBackendStatus={[i.Submitted]:r.Submitted,[i.FinalizedSuccess]:r.FinalizedSuccess,[i.FinalizedFailed]:r.FinalizedFailed,[i.Completed]:null,[i.Expired]:null},n.AllowedQuoteStatusStateTransitions={[i.Submitted]:[i.FinalizedFailed,i.FinalizedSuccess,i.Expired],[i.FinalizedFailed]:[i.Completed,i.Expired],[i.FinalizedSuccess]:[i.Completed,i.Expired],[i.Completed]:[],[i.Expired]:[]},function(e){e.Accepted="accepted",e.RetryableExhausted="retryableExhausted",e.NonRetryable="nonRetryable",e.Interrupted="interrupted"}(a||(n.QuoteStatusFetchWithRetryOutcomeType=a={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/constants.cjs"}],[1514,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusGetError=n.QuoteStatusUpdateError=void 0;class r extends Error{constructor(e,t){super(`${t.errorType?`[${t.errorType}] `:""}${e}`),this.details=t,this.name=r.name,Object.setPrototypeOf(this,r.prototype)}}n.QuoteStatusUpdateError=r;class s extends Error{constructor(e,t,n=!1){super(e),this.details=t,this.retryable=n,this.name=s.name,Object.setPrototypeOf(this,s.prototype)}}n.QuoteStatusGetError=s}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/errors.cjs"}],[1515,{"../types.cjs":1530,"../utils/authentication.cjs":1532,"./constants.cjs":1513,"./errors.cjs":1514,"./quote-status-get-with-retry-outcome.cjs":1517,"./quote-status-update-with-retry-outcome.cjs":1519,"./utils.cjs":1521,"./validators.cjs":1522,"@metamask/bridge-controller":1489,"@metamask/superstruct":3858},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusApiService=void 0;const d=e("@metamask/bridge-controller"),p=e("@metamask/superstruct"),h=(e("../types.cjs"),e("../utils/authentication.cjs")),f=e("./constants.cjs"),m=e("./errors.cjs"),g=e("./quote-status-get-with-retry-outcome.cjs"),y=e("./quote-status-update-with-retry-outcome.cjs"),w=e("./utils.cjs"),b=e("./validators.cjs");n.QuoteStatusApiService=class{constructor({messenger:e,clientId:t,clientProduct:n,clientVersion:l,apiBaseUrl:d,onError:p}){r.set(this,void 0),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),c.set(this,void 0),u(this,r,e,"f"),u(this,s,t,"f"),u(this,i,n,"f"),u(this,a,l,"f"),u(this,o,d,"f"),u(this,c,p,"f")}async updateQuoteStatus(e,t){const n=await(0,h.getJwt)(l(this,r,"f")),u=await globalThis.fetch(`${l(this,o,"f")}/quote/updateStatus`,{method:"POST",headers:{"Content-Type":"application/json","x-metamask-clientproduct":l(this,i,"f"),...l(this,a,"f")?{"x-metamask-clientversion":l(this,a,"f")}:{},...(0,d.getClientHeaders)({clientId:l(this,s,"f"),jwt:n})},body:JSON.stringify(e),signal:t});if(u.ok)return null;const p=await u.json();try{return(0,b.validateQuoteStatusUpdateResponse)(p),p}catch(t){throw l(this,c,"f")?.call(this,new m.QuoteStatusUpdateError("unexpected response shape from quote/updateStatus",{quoteId:e.quoteId})),t}}async getQuoteStatus(e,t){const n=await(0,h.getJwt)(l(this,r,"f")),u=await globalThis.fetch(`${l(this,o,"f")}/getQuoteStatus?quoteId=${e.quoteId}`,{method:"GET",headers:{"Content-Type":"application/json","x-metamask-clientproduct":l(this,i,"f"),...l(this,a,"f")?{"x-metamask-clientversion":l(this,a,"f")}:{},...(0,d.getClientHeaders)({clientId:l(this,s,"f"),jwt:n})},signal:t});if(!u.ok){const t=u.status>=500,n=new m.QuoteStatusGetError(`request error to getQuoteStatus [${u.status}: ${u.statusText}]`,{quoteId:e.quoteId},t);throw l(this,c,"f")?.call(this,n),n}const f=await u.json();try{return(0,b.validateQuoteStatusGetResponse)(f),f}catch(t){if(t instanceof p.StructError){const n=[];for(const{path:e}of t.failures()){const t=f?.submittedTx?.bridge??"unknown",r=e?.join(".")||"unknown";n.push([t,r].join("|"))}const r=new m.QuoteStatusGetError("unexpected response shape from getQuoteStatus",{quoteId:e.quoteId,validationFailures:n});throw l(this,c,"f")?.call(this,r),r}throw t}}async updateQuoteStatusWithRetry(e,t,n){for(let r=0;r<=t.maxRetries;r+=1){if(r>0&&await(0,w.sleep)(t.delayMsBetweenRetries),n?.aborted||!1===t.retry?.())return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);try{const t=await this.updateQuoteStatus(e,n);if(null===t)return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Accepted);if(!f.QuoteStatusUpdateRetryableBackendTypes.includes(t.type))return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.NonRetryable,t)}catch(e){if(n?.aborted)return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);throw e}}return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted)}async getQuoteStatusWithRetry(e,t,n){for(let r=0;r<=t.maxRetries;r+=1){if(r>0&&await(0,w.sleep)(t.delayMsBetweenRetries),n?.aborted)return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);try{const t=await this.getQuoteStatus(e,n);return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Accepted,t)}catch(e){if(n?.aborted)return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);if(e instanceof m.QuoteStatusGetError&&!e.retryable)return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.NonRetryable,undefined,e)}}return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted)}},r=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,c=new WeakMap}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-api-service.cjs"}],[1516,{"./constants.cjs":1513,"./quote-status-state-fsm.cjs":1518},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusEntryStore=void 0;const d=e("./constants.cjs"),p=e("./quote-status-state-fsm.cjs");class h{static hash(e){return`${e.quoteId}:${e.srcTxHash}`}constructor({onPersistUpdates:e,entryTtlMs:t,initial:n}){r.add(this),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),u(this,a,e,"f"),u(this,i,t,"f"),u(this,s,new Map(Object.entries(n??{}).map(([e,t])=>{const n=new p.QuoteStatusStateFsm(t.status);return[e,{...t,status:n}]})),"f");for(const e of l(this,s,"f").values())l(this,r,"m",o).call(this,e)}put(e,t){const n=l(this,s,"f").get(e);if(n)return!n.txMetaId&&t.txMetaId&&(n.txMetaId=t.txMetaId,l(this,r,"m",c).call(this)),n;const i=Date.now(),a={...t,createdAt:i,lastAttemptAt:i};return l(this,s,"f").set(e,a),l(this,r,"m",o).call(this,a),l(this,r,"m",c).call(this),a}values(){return this.expireStaleEntries(),l(this,s,"f").values()}getByQuoteId(e){this.expireStaleEntries();const t=[];for(const n of l(this,s,"f").values())n.quoteId===e&&t.push(n);return t}get size(){return l(this,s,"f").size}getByTxMetaId(e){for(const t of l(this,s,"f").values())if(t.txMetaId===e)return this.expireEntryIfStale(t),t;return null}get(e){const t=l(this,s,"f").get(e);return t?(this.expireEntryIfStale(t),t):null}update(e){l(this,s,"f").has(h.hash(e))&&l(this,r,"m",c).call(this)}expireStaleEntries(){for(const e of l(this,s,"f").values())this.entryHasExpired(e)&&e.status.transitionTo(d.QuoteStatusState.Expired)}entryHasExpired(e){return Date.now()-e.createdAt>l(this,i,"f")}expireEntryIfStale(e){return!!this.entryHasExpired(e)&&(e.status.transitionTo(d.QuoteStatusState.Expired),!0)}clear(){for(const e of l(this,s,"f").values())e.status.removeAllListeners();l(this,s,"f").clear()}}n.QuoteStatusEntryStore=h,s=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakSet,o=function(e){e.status.onStateUpdate(()=>l(this,r,"m",c).call(this))},c=function(){const e={};for(const[t,n]of l(this,s,"f"))e[t]={...n,status:n.status.state};l(this,a,"f").call(this,e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-entry-store.cjs"}],[1517,{"./constants.cjs":1513,"./errors.cjs":1514},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusGetWithRetryOutcome=void 0;e("./constants.cjs"),e("./errors.cjs");n.QuoteStatusGetWithRetryOutcome=class{constructor(e,t,n){this.type=e,this.response=t,this.error=n}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs"}],[1518,{"./constants.cjs":1513},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},c=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusStateFsm=void 0;const u=e("./constants.cjs");n.QuoteStatusStateFsm=class{constructor(e=u.QuoteStatusState.Submitted){r.add(this),s.set(this,void 0),i.set(this,new Set),o(this,s,e,"f")}get state(){return c(this,s,"f")}canTransitionTo(e){return u.AllowedQuoteStatusStateTransitions[c(this,s,"f")]?.includes(e)??!1}transitionTo(e){if(!this.canTransitionTo(e))return!1;const t=c(this,s,"f");return o(this,s,e,"f"),c(this,r,"m",a).call(this,{previousState:t,nextState:e}),!0}onStateUpdate(e){return c(this,i,"f").add(e),()=>c(this,i,"f").delete(e)}removeAllListeners(){c(this,i,"f").clear()}toJson(){return{state:this.state}}},s=new WeakMap,i=new WeakMap,r=new WeakSet,a=function(e){for(const t of[...c(this,i,"f")])t(e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-state-fsm.cjs"}],[1519,{"./constants.cjs":1513},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusUpdateWithRetryOutcome=void 0;e("./constants.cjs");n.QuoteStatusUpdateWithRetryOutcome=class{constructor(e,t){this.type=e,this.response=t}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs"}],[1520,{"../types.cjs":1530,"../utils/transaction.cjs":1545,"./constants.cjs":1513,"./errors.cjs":1514,"./quote-status-api-service.cjs":1515,"./quote-status-entry-store.cjs":1516,"./quote-status-get-with-retry-outcome.cjs":1517,"./quote-status-state-fsm.cjs":1518,"./quote-status-update-with-retry-outcome.cjs":1519,"@metamask/transaction-controller":3915},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u,l,d,p,h,f,m,g,y,w,b,v,T=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},S=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusManager=void 0;const _=e("@metamask/transaction-controller"),k=(e("../types.cjs"),e("../utils/transaction.cjs")),E=e("./constants.cjs"),I=e("./errors.cjs"),A=e("./quote-status-api-service.cjs"),C=e("./quote-status-entry-store.cjs"),M=(e("./quote-status-get-with-retry-outcome.cjs"),e("./quote-status-state-fsm.cjs"));e("./quote-status-update-with-retry-outcome.cjs");n.QuoteStatusManager=class{constructor({messenger:e,clientId:t,clientProduct:n,clientVersion:d,apiBaseUrl:p,onError:h,isEnabled:f,onPersistUpdates:m,entryTtlMs:g,updateIntervalMs:y,initialData:w}){r.add(this),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),c.set(this,void 0),u.set(this,void 0),l.set(this,null),T(this,o,f,"f"),T(this,c,h,"f"),T(this,u,y,"f"),T(this,s,e,"f"),T(this,i,new A.QuoteStatusApiService({messenger:e,clientId:t,clientProduct:n,clientVersion:d,apiBaseUrl:p,onError:h}),"f"),T(this,a,new C.QuoteStatusEntryStore({onPersistUpdates:m,entryTtlMs:g,initial:w}),"f")}get enabled(){return Boolean(S(this,o,"f")?.call(this))}reportFinalised(e,t){if(!S(this,o,"f")?.call(this))return;const n=S(this,a,"f").getByTxMetaId(e);if(!n)return void S(this,c,"f")?.call(this,new I.QuoteStatusUpdateError("reporting finalization status but entry was not found",{quoteId:""}));const s=t?E.QuoteStatusState.FinalizedSuccess:E.QuoteStatusState.FinalizedFailed;n.status.canTransitionTo(s)&&(n.status.transitionTo(s),S(this,r,"m",p).call(this),S(this,r,"m",y).call(this,n))}reportSubmitted(e,t,n){if(!S(this,o,"f")?.call(this))return;const s=S(this,a,"f").getByQuoteId(e).some(e=>e.status.state!==E.QuoteStatusState.Submitted);if(s)return;const i=C.QuoteStatusEntryStore.hash({quoteId:e,srcTxHash:t}),c=S(this,a,"f").put(i,{quoteId:e,srcTxHash:t,txMetaId:n,status:new M.QuoteStatusStateFsm(E.QuoteStatusState.Submitted)});S(this,r,"m",p).call(this),S(this,r,"m",y).call(this,c)}destroy(){S(this,r,"m",h).call(this),S(this,a,"f").clear()}init(){S(this,r,"m",d).call(this);for(const e of S(this,a,"f").values()){if(e.status.state!==E.QuoteStatusState.Submitted||!e.txMetaId)continue;const t=(0,k.getTransactionMetaById)(S(this,s,"f"),e.txMetaId);if(!t)continue;(t.type!==undefined&&(0,k.isCrossChainTx)(t.type)||(0,k.hasNestedSwapTransactions)(t))&&(t.status===_.TransactionStatus.confirmed?this.reportFinalised(e.txMetaId,!0):t.status!==_.TransactionStatus.failed&&t.status!==_.TransactionStatus.dropped||this.reportFinalised(e.txMetaId,!1))}}async getStatus(e,t={maxRetries:0,delayMsBetweenRetries:1e3}){if(!S(this,o,"f")?.call(this))return undefined;return S(this,i,"f").getQuoteStatusWithRetry({quoteId:e},{maxRetries:t.maxRetries??0,delayMsBetweenRetries:t.delayMsBetweenRetries??1e3}).catch(()=>undefined)}},s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,r=new WeakSet,d=function(){for(const e of S(this,a,"f").values())S(this,r,"m",y).call(this,e);S(this,r,"m",m).call(this)&&S(this,r,"m",p).call(this)},p=function(){null===S(this,l,"f")&&T(this,l,setInterval(()=>S(this,r,"m",f).call(this),S(this,u,"f")),"f")},h=function(){null!==S(this,l,"f")&&(clearInterval(S(this,l,"f")),T(this,l,null,"f"))},f=function(){if(!S(this,o,"f")?.call(this))return;const e=[...S(this,a,"f").values()];if(S(this,r,"m",m).call(this))for(const t of e)S(this,r,"m",y).call(this,t);else S(this,r,"m",h).call(this)},m=function(){for(const e of S(this,a,"f").values()){const{state:t}=e.status;if(!(t===E.QuoteStatusState.Completed||t===E.QuoteStatusState.Expired)&&e.acknowledgedState!==t)return!0}return!1},g=function(){S(this,r,"m",m).call(this)||S(this,r,"m",h).call(this)},y=function e(t){if(t.acknowledgedState===t.status.state)return;const n=t.status.state,s=E.QuoteStatusStateToBackendStatus[n];if(null===s)return void S(this,r,"m",g).call(this);S(this,i,"f").updateQuoteStatusWithRetry({quoteId:t.quoteId,srcTxHash:t.srcTxHash,newStatus:s},{maxRetries:5,delayMsBetweenRetries:3e3,retry:()=>{const e=S(this,a,"f").get(C.QuoteStatusEntryStore.hash(t));return Boolean(e&&e.status.state===n&&e.acknowledgedState!==n)}}).then(s=>{switch(s.type){case E.QuoteStatusFetchWithRetryOutcomeType.Accepted:{const s=S(this,a,"f").get(C.QuoteStatusEntryStore.hash(t));return s?s.status.state!==n?(S(this,r,"m",e).call(this,s),undefined):n===E.QuoteStatusState.FinalizedSuccess||n===E.QuoteStatusState.FinalizedFailed?(S(this,r,"m",w).call(this,s),undefined):(s.acknowledgedState=n,S(this,a,"f").update(s),S(this,r,"m",g).call(this),undefined):undefined}case E.QuoteStatusFetchWithRetryOutcomeType.NonRetryable:return S(this,r,"m",v).call(this,t,s),undefined;case E.QuoteStatusFetchWithRetryOutcomeType.Interrupted:return S(this,r,"m",e).call(this,t),undefined;case E.QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted:return t.lastAttemptAt=Date.now(),S(this,a,"f").update(t),undefined;default:return undefined}}).catch(()=>{t.lastAttemptAt=Date.now(),S(this,a,"f").update(t)})},w=function(e,t){t&&e.status.canTransitionTo(t)&&e.status.transitionTo(t),e.status.canTransitionTo(E.QuoteStatusState.Completed)&&e.status.transitionTo(E.QuoteStatusState.Completed),S(this,r,"m",g).call(this)},b=function(e){e.status.canTransitionTo(E.QuoteStatusState.Expired)&&e.status.transitionTo(E.QuoteStatusState.Expired),S(this,r,"m",g).call(this)},v=function(e,t){const{response:n}=t,s={[E.QuoteStatusBackendStatus.FinalizedSuccess]:E.QuoteStatusState.FinalizedSuccess,[E.QuoteStatusBackendStatus.FinalizedFailed]:E.QuoteStatusState.FinalizedFailed};if(n?.type!==E.QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction||n.currentStatus!==E.QuoteStatusBackendStatus.FinalizedSuccess&&n.currentStatus!==E.QuoteStatusBackendStatus.FinalizedFailed){if(n?.type===E.QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction||n?.type===E.QuoteStatusUpdateBackendErrorType.QuoteStatusOnChainMismatch){const t=s[n.currentStatus];if(t){if(e.status.canTransitionTo(t))return e.status.transitionTo(t),void S(this,r,"m",y).call(this,e);if(e.status.state===t)return;return e.status.state!==E.QuoteStatusState.Completed&&e.status.state!==E.QuoteStatusState.Expired&&S(this,c,"f")?.call(this,new I.QuoteStatusUpdateError(`reporting finalization status but entry cannot transition from "${e.status.state}" to "${t}"`,{quoteId:e.quoteId})),void S(this,r,"m",w).call(this,e)}}S(this,r,"m",b).call(this,e),S(this,c,"f")?.call(this,new I.QuoteStatusUpdateError("abandoning entry due to non-retryable error",{quoteId:e.quoteId,errorType:n?.type}))}else S(this,r,"m",w).call(this,e,s[n.currentStatus])}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quotes-status-manager.cjs"}],[1521,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sleep=void 0;n.sleep=e=>new Promise(t=>setTimeout(t,e))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/utils.cjs"}],[1522,{"../utils/validators.cjs":1546,"./constants.cjs":1513,"@metamask/superstruct":3858},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateQuoteStatusGetResponse=n.QuoteStatusGetResponseSchema=n.validateQuoteStatusUpdateResponse=n.QuoteStatusUpdateResponseSchema=void 0;const r=e("@metamask/superstruct"),s=e("../utils/validators.cjs"),i=e("./constants.cjs"),a=(0,r.type)({statusCode:(0,r.number)(),message:(0,r.string)(),type:(0,r.enums)(i.QuoteStatusUpdateBackendOnChainMismatchTypes),currentStatus:(0,r.enums)(i.QuoteStatusBackendValues),newStatus:(0,r.enums)(i.QuoteStatusBackendValues)}),o=(0,r.type)({statusCode:(0,r.number)(),message:(0,r.string)(),type:(0,r.enums)(i.BaseQuoteStatusUpdateErrorTypes)});n.QuoteStatusUpdateResponseSchema=(0,r.union)([a,o]),n.validateQuoteStatusUpdateResponse=function(e){(0,r.assert)(e,n.QuoteStatusUpdateResponseSchema)},n.QuoteStatusGetResponseSchema=(0,r.type)({submittedTx:(0,r.optional)(s.StatusResponseSchema)}),n.validateQuoteStatusGetResponse=function(e){(0,r.assert)(e,n.QuoteStatusGetResponseSchema)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/validators.cjs"}],[1523,{"../utils/transaction.cjs":1545,"./types.cjs":1529,"@metamask/transaction-controller":3915},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitBatchSellHandler=void 0;const r=e("@metamask/transaction-controller"),s=e("../utils/transaction.cjs"),i=e("./types.cjs"),a=({quoteResponse:{quoteId:e,quote:t}})=>e??t.requestId;n.submitBatchSellHandler=async function*(e){const{requireApproval:t,quoteResponses:n,messenger:o,addTransactionBatchFn:c,isDelegatedAccount:u,batchSellTrades:l,batchId:d}=e,p=(0,s.toQuoteAndTxMetadataBatch)({quoteResponses:n,batchSellTrades:l}),{gasIncluded7702:h,gasIncluded:f,gasSponsored:m}=l,g=p.find(({type:e})=>e===r.TransactionType.tokenMethodTransfer)?.tx.to,y=await(0,s.getAddTransactionBatchParams)({messenger:o,tradeData:p,requireApproval:t,isDelegatedAccount:u,atomic:!1,disable7702:(0,s.shouldDisable7702)(h,f,u),isGasFeeSponsored:m,isGasFeeIncluded:Boolean(h),batchId:d,skipInitialGasEstimate:h?u:Boolean(g),excludeNativeTokenForFee:!g}),{batchId:w}=await c(y),b=(0,s.findAllTransactionsInBatch)({messenger:o,batchId:w,tradeData:p}).filter(e=>(0,s.isTradeTx)(e.type)&&e.txMeta!==undefined),v=b.find(({txMeta:e})=>e?.type&&((0,s.isTradeTx)(e.type)||(0,s.hasNestedSwapTransactions)(e))),T=v?.txMeta;if(!T)throw new Error("Failed to add BatchSell trade to history: txMeta not found");if(yield{type:i.SubmitStep.SetTradeMeta,payload:{tradeMeta:T}},(0,s.is7702Tx)(T)||(0,s.hasNestedSwapTransactions)(T)){const e=Array.from(new Set(b.map(a)));yield{type:i.SubmitStep.AddHistoryItem,payload:{historyKey:T.id,quoteResponse:v.quoteResponse,batchSellData:l,quoteIds:e,bridgeTxMeta:T}};for(const e of b){const{quoteResponse:t}=e;yield{type:i.SubmitStep.AddHistoryItem,payload:{historyKey:a(e),quoteResponse:t,batchSellData:l}}}}else for(const{txMeta:e,quoteResponse:t}of b)yield{type:i.SubmitStep.AddHistoryItem,payload:{historyKey:e.id,quoteResponse:t,batchSellData:l,bridgeTxMeta:e}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/batch-sell-strategy.cjs"}],[1524,{"../utils/transaction.cjs":1545,"./types.cjs":1529},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitBatchHandler=void 0;const r=e("../utils/transaction.cjs"),s=e("./types.cjs");n.submitBatchHandler=async function*(e){const{requireApproval:t,quoteResponses:[n],messenger:i,isBridgeTx:a,addTransactionBatchFn:o,isDelegatedAccount:c}=e,u=(0,r.toQuoteAndTxMetadata)({quoteResponse:n,isBridgeTx:a}),l=await(0,r.getAddTransactionBatchParams)({tradeData:u,requireApproval:t,isDelegatedAccount:c,messenger:i,atomic:!0,disable7702:(0,r.shouldDisable7702)(n.quote.gasIncluded7702,n.quote.gasIncluded,c),isGasFeeSponsored:Boolean(n.quote.gasSponsored),isGasFeeIncluded:Boolean(n.quote.gasIncluded7702)}),{batchId:d}=await o(l),p=(0,r.findAllTransactionsInBatch)({messenger:i,batchId:d,tradeData:u});yield{type:s.SubmitStep.UpdateBatchTransactions,payload:{quoteAndTxMetas:p}};const h=p.find(({type:e,txMeta:t})=>(0,r.isTradeTx)(e)&&t)?.txMeta,f=p.find(({type:e,txMeta:t})=>(0,r.isApprovalTx)(e)&&t)?.txMeta;if(!h)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");yield{type:s.SubmitStep.SetTradeMeta,payload:{tradeMeta:h}},yield{type:s.SubmitStep.AddHistoryItem,payload:{historyKey:h.id,approvalTxId:f?.id,bridgeTxMeta:{id:h.id,hash:h.hash,batchId:h.batchId},quoteResponse:n}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/batch-strategy.cjs"}],[1525,{"../utils/accounts.cjs":1531,"../utils/network.cjs":1541,"../utils/trace.cjs":1544,"../utils/transaction.cjs":1545,"./types.cjs":1529,"@metamask/bridge-controller":1489,"@metamask/transaction-controller":3915},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitEvmHandler=n.handleEvmApprovals=n.handleSingleTx=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/transaction-controller"),i=e("../utils/accounts.cjs"),a=e("../utils/network.cjs"),o=e("../utils/trace.cjs"),c=e("../utils/transaction.cjs"),u=e("./types.cjs");n.handleSingleTx=async({messenger:e,trade:t,transactionType:n,requireApproval:s=!1,txFee:o,actionId:u=(0,c.generateActionId)()})=>{if(!(0,i.getAccountByAddress)(e,t.from))throw new Error("Failed to submit cross-chain swap transaction: unknown account in trade data");const l=(0,r.formatChainIdToHex)(t.chainId),d=(0,a.getNetworkClientIdByChainId)(e,l),p={actionId:u,networkClientId:d,requireApproval:s,type:n,origin:"metamask",isInternal:!0},h=await(0,c.toTransactionParams)(e,t,d,l,o);return await(0,c.addTransaction)(e,{...h,from:t.from},p)};n.handleEvmApprovals=async e=>await e.traceFn((0,o.getApprovalTraceParams)(e.quoteResponses[0],e.isStxEnabled),async()=>await(async e=>{const{quoteResponses:[t],isBridgeTx:i}=e,{approval:a,resetApproval:o}=t;if(!a||!(0,r.isEvmTxData)(a))return undefined;const c=i?s.TransactionType.bridgeApproval:s.TransactionType.swapApproval;if(o&&await(0,n.handleSingleTx)({...e,transactionType:c,trade:o}),a){const t=await(0,n.handleSingleTx)({...e,transactionType:c,trade:a});return t?.id}})(e)),n.submitEvmHandler=async function*(e){const{quoteResponses:[t],requireApproval:r,isBridgeTx:i}=e,a=await(0,n.handleEvmApprovals)(e);a&&await(0,c.handleApprovalDelay)(t.quote.srcChainId),await(0,c.handleMobileHardwareWalletDelay)(r),r&&a&&await(0,c.waitForTxConfirmation)(e.messenger,a);const o=(0,c.generateActionId)();yield{type:u.SubmitStep.AddHistoryItem,payload:{historyKey:o,approvalTxId:a,actionId:o,quoteResponse:t}};const l=i?s.TransactionType.bridge:s.TransactionType.swap,d=await(0,n.handleSingleTx)({...e,transactionType:l,trade:t.trade,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined,actionId:o});yield{type:u.SubmitStep.RekeyHistoryItem,payload:{oldHistoryKey:o,newHistoryKey:d.id,tradeMeta:d}},yield{type:u.SubmitStep.SetTradeMeta,payload:{tradeMeta:d}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/evm-strategy.cjs"}],[1526,{"./batch-sell-strategy.cjs":1523,"./batch-strategy.cjs":1524,"./evm-strategy.cjs":1525,"./intent-strategy.cjs":1527,"./non-evm-strategy.cjs":1528,"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});const r=e("@metamask/bridge-controller"),s=e("./batch-sell-strategy.cjs"),i=e("./batch-strategy.cjs"),a=e("./evm-strategy.cjs"),o=e("./intent-strategy.cjs"),c=e("./non-evm-strategy.cjs"),u=e=>{const t=e.quoteResponses.flatMap(e=>[e.trade,e.approval,e.resetApproval]).filter(e=>e!==undefined);switch(e.quoteResponses[0].quote.srcChainId){case r.ChainId.SOLANA:return t.every(e=>"string"==typeof e);case r.ChainId.BTC:return t.every(r.isBitcoinTrade);case r.ChainId.STELLAR:return t.every(e=>"string"==typeof e||(0,r.isStellarTrade)(e));case r.ChainId.TRON:return t.every(r.isTronTrade);default:return t.every(r.isEvmTxData)}};n.default=e=>{const{quoteResponses:[t],isStxEnabled:n,isDelegatedAccount:l}=e;if((0,r.isNonEvmChainId)(t.quote.srcChainId)){if(!u(e))throw new Error("Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction");return(0,c.submitNonEvmHandler)(e)}if(!u(e))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");if(t.quote.intent)return(0,o.submitIntentHandler)(e);if((e=>Boolean(e.batchSellTrades)&&e.quoteResponses.length>=1)(e))return(0,s.submitBatchSellHandler)(e);return n||t.quote.gasIncluded7702||l?(0,i.submitBatchHandler)(e):(0,a.submitEvmHandler)(e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/index.cjs"}],[1527,{"../utils/authentication.cjs":1532,"../utils/intent-api.cjs":1538,"../utils/keyring.cjs":1539,"../utils/network.cjs":1541,"../utils/transaction.cjs":1545,"./evm-strategy.cjs":1525,"./types.cjs":1529,"@metamask/bridge-controller":1489,"@metamask/transaction-controller":3915},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitIntentHandler=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/transaction-controller"),i=e("../utils/authentication.cjs"),a=e("../utils/intent-api.cjs"),o=e("../utils/keyring.cjs"),c=e("../utils/network.cjs"),u=e("../utils/transaction.cjs"),l=e("./evm-strategy.cjs"),d=e("./types.cjs");n.submitIntentHandler=async function*(e){const t=await(0,l.handleEvmApprovals)(e);t&&await(0,u.waitForTxConfirmation)(e.messenger,t);const{orderUid:n,orderStatus:p}=await(async e=>{const{quoteResponses:[t],messenger:n,selectedAccount:r,clientId:s,fetchFn:c,bridgeApiBaseUrl:u}=e,{srcChainId:l,requestId:d}=t.quote,p=(0,a.getIntentFromQuote)(t),h=await(0,o.signTypedMessage)({messenger:n,accountAddress:r.address,typedData:p.typedData}),{id:f,status:m}=await(0,a.postSubmitOrder)({params:{srcChainId:l,quoteId:d,signature:h,order:p.order,userAddress:r.address,aggregatorId:p.protocol},clientId:s,jwt:await(0,i.getJwt)(n),fetchFn:c,bridgeApiBaseUrl:u});return{orderUid:f,orderStatus:m}})(e),h=await(async(e,t)=>{const{quoteResponses:[n],messenger:i,isBridgeTx:o,selectedAccount:l}=t,{quote:{srcChainId:d}}=n,p=o?s.TransactionType.bridge:s.TransactionType.swap,h=(0,c.getNetworkClientIdByChainId)(i,d);if(!(0,r.isEvmTxData)(n.trade))throw new Error("Failed to submit intent: trade is not an EVM transaction");const f=(0,a.getIntentFromQuote)(n),m={chainId:(0,r.formatChainIdToHex)(d),from:l.address,to:f.settlementContract??"0x9008D19f58AAbd9eD0D60971565AA8510560ab41",data:`0x${e?.slice(-8)}`,value:"0x0",gas:"0x5208",gasPrice:"0x3b9aca00"};return await(0,u.addSyntheticTransaction)(i,m,{requireApproval:!1,networkClientId:h,type:p})})(n,{...e,requireApproval:!1,isStxEnabled:!1});yield{type:d.SubmitStep.SetTradeMeta,payload:{tradeMeta:{...h,status:(0,a.mapIntentOrderStatusToTransactionStatus)(p)}}},yield{type:d.SubmitStep.AddHistoryItem,payload:{historyKey:n,bridgeTxMeta:{id:h?.id},approvalTxId:t,originalTransactionId:h?.id,quoteResponse:e.quoteResponses[0]}},yield{type:d.SubmitStep.StartPolling,payload:{historyKey:n}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/intent-strategy.cjs"}],[1528,{"../utils/snaps.cjs":1542,"../utils/trace.cjs":1544,"../utils/transaction.cjs":1545,"./types.cjs":1529,"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitNonEvmHandler=void 0;const r=e("@metamask/bridge-controller"),s=e("../utils/snaps.cjs"),i=e("../utils/trace.cjs"),a=e("../utils/transaction.cjs"),o=e("./types.cjs");n.submitNonEvmHandler=async function*(e){const{quoteResponses:[t],isBridgeTx:n}=e,c=await(async e=>{const{quoteResponses:[t],traceFn:n}=e,r=await n((0,i.getApprovalTraceParams)(t,!1),async()=>t.approval?(await(0,s.handleNonEvmTx)(e.messenger,t.approval,t,e.selectedAccount)).id:undefined);return r?(await(0,a.handleApprovalDelay)(t.quote.srcChainId),r):undefined})(e),u=await(0,s.handleNonEvmTx)(e.messenger,t.trade,t,e.selectedAccount);yield{type:o.SubmitStep.SetTradeMeta,payload:{tradeMeta:u}},yield{type:o.SubmitStep.AddHistoryItem,payload:{historyKey:u.id,approvalTxId:c,bridgeTxMeta:{id:u.id,hash:u.hash},quoteResponse:t}},yield{type:o.SubmitStep.StartPolling,payload:{historyKey:u.id}},(0,r.isTronChainId)(t.quote.srcChainId)||n||(yield{type:o.SubmitStep.PublishCompletedEvent,payload:{historyKey:u.id}})}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/non-evm-strategy.cjs"}],[1529,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r;Object.defineProperty(n,"__esModule",{value:!0}),n.SubmitStep=void 0,function(e){e.AddHistoryItem="addHistoryItem",e.RekeyHistoryItem="rekeyHistoryItem",e.StartPolling="startPolling",e.PublishCompletedEvent="publishCompletedEvent",e.SetTradeMeta="setTradeMeta",e.UpdateBatchTransactions="updateBatchTransactions"}(r||(n.SubmitStep=r={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/types.cjs"}],[1530,{"./constants.cjs":1511,"./quote-status-manager/constants.cjs":1513,"./utils/validators.cjs":1546},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusAction=n.BridgeId=n.BridgeClientId=void 0;e("./constants.cjs"),e("./quote-status-manager/constants.cjs"),e("./utils/validators.cjs");var r,s,i;!function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(r||(n.BridgeClientId=r={})),function(e){e.HOP="hop",e.CELER="celer",e.CELERCIRCLE="celercircle",e.CONNEXT="connext",e.POLYGON="polygon",e.AVALANCHE="avalanche",e.MULTICHAIN="multichain",e.AXELAR="axelar",e.ACROSS="across",e.STARGATE="stargate",e.RELAY="relay",e.MAYAN="mayan"}(s||(n.BridgeId=s={})),function(e){e.StartPollingForBridgeTxStatus="StartPollingForBridgeTxStatus",e.WipeBridgeStatus="WipeBridgeStatus",e.GetState="GetState",e.ResetState="ResetState",e.SubmitTx="SubmitTx",e.SubmitIntent="SubmitIntent",e.RestartPollingForFailedAttempts="RestartPollingForFailedAttempts",e.GetBridgeHistoryItemByTxMetaId="GetBridgeHistoryItemByTxMetaId"}(i||(n.BridgeStatusAction=i={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/types.cjs"}],[1531,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getAccountByAddress=void 0;n.getAccountByAddress=(e,t)=>e.call("AccountsController:getAccountByAddress",t)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/accounts.cjs"}],[1532,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getJwt=void 0;n.getJwt=async e=>{try{return await e.call("AuthenticationController:getBearerToken")}catch(e){return console.error("Error getting JWT token for bridge-api request",e),undefined}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/authentication.cjs"}],[1533,{"../constants.cjs":1511,"../quote-status-manager/quotes-status-manager.cjs":1520,"./history.cjs":1537,"./network.cjs":1541,"./validators.cjs":1546,"@metamask/bridge-controller":1489,"@metamask/superstruct":3858},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getStatusRequestParams=n.shouldWaitForFinalBridgeStatus=n.shouldSkipFetchDueToFetchFailures=n.getStatusRequestWithSrcTxHash=n.fetchBridgeTxStatus=n.fetchBridgeQuoteStatus=n.getStatusRequestDto=n.getBridgeStatusUrl=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/superstruct"),i=e("../constants.cjs"),a=(e("../quote-status-manager/quotes-status-manager.cjs"),e("./history.cjs")),o=e("./network.cjs"),c=e("./validators.cjs");n.getBridgeStatusUrl=e=>`${e}/getTxStatus`;n.getStatusRequestDto=e=>{const{quote:t,...n}=e;return{...Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};n.fetchBridgeQuoteStatus=async(e,t)=>{const n=await e.getStatus(t),r=n?.response?.submittedTx;return r?{status:r,validationFailures:n.error?.details?.validationFailures??[]}:null};n.fetchBridgeTxStatus=async(e,t,i,a,o)=>{const u=(0,n.getStatusRequestDto)(e),l=new URLSearchParams(u),d=`${(0,n.getBridgeStatusUrl)(o)}?${l.toString()}`,p=await a(d,{headers:(0,r.getClientHeaders)({clientId:t,jwt:i})}),h=[];try{(0,c.validateBridgeStatusResponse)(p)}catch(t){t instanceof s.StructError&&t.failures().forEach(({path:t})=>{const n=p?.bridge??(e.bridge||e.bridgeId)??"unknown",r=t?.join(".")||"unknown";h.push([n,r].join("|"))})}return{status:p,validationFailures:h}};n.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:n,bridges:r,srcChainId:s,destChainId:i,refuel:a}=e;return{bridgeId:n,srcTxHash:t,bridge:r[0],srcChainId:s,destChainId:i,quote:e,refuel:Boolean(a)}};n.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=i.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1};n.shouldWaitForFinalBridgeStatus=async(e,t)=>{if(!(0,a.isHistoryItemTooOld)(e,t)||![r.StatusTypes.PENDING,r.StatusTypes.UNKNOWN].includes(t.status.status))return!0;if((0,r.isNonEvmChainId)(t.quote.srcChainId))return!1;let n;try{n=(0,o.getNetworkClientByChainId)(e,t.quote.srcChainId)}catch{return!0}return!!t.status.srcChain.txHash&&n.request({method:"eth_getTransactionReceipt",params:[t.status.srcChain.txHash]}).then(e=>!!e).catch(()=>!1)};n.getStatusRequestParams=e=>({bridgeId:e.quote.bridgeId,bridge:e.quote.bridges[0],srcChainId:e.quote.srcChainId,destChainId:e.quote.destChainId,quote:e.quote,refuel:Boolean(e.quote.refuel)})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs"}],[1534,{"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.trackMetricsEvent=n.getBatchSellTrades=n.stopPollingForQuotes=void 0;const r=e("@metamask/bridge-controller");n.stopPollingForQuotes=(e,t)=>{e.call("BridgeController:stopPollingForQuotes",r.AbortReason.TransactionSubmitted,t)};n.getBatchSellTrades=e=>e.call("BridgeController:getState").batchSellTrades;n.trackMetricsEvent=({messenger:e,eventName:t,properties:n})=>{e.call("BridgeController:trackUnifiedSwapBridgeEvent",t,n)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge.cjs"}],[1535,{"../constants.cjs":1511,"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getMaxPendingHistoryItemAgeMs=void 0;const r=e("@metamask/bridge-controller"),s=e("../constants.cjs");n.getMaxPendingHistoryItemAgeMs=e=>(0,r.getBridgeFeatureFlags)(e).maxPendingHistoryItemAgeMs??s.DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/feature-flags.cjs"}],[1536,{"bignumber.js":1547},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calcActualGasUsed=void 0;const r=e("bignumber.js"),s=(e,t)=>e&&t?new r.BigNumber(e,16).times(new r.BigNumber(t,16)):null;n.calcActualGasUsed=({pricingData:e},t,n)=>{const i=e?.quotedGasInUsd&&e?.quotedGasAmount?new r.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,a=s(t?.gasUsed,t?.effectiveGasPrice)?.plus(s(n?.gasUsed,n?.effectiveGasPrice)??0),o=a?.div(new r.BigNumber(10).pow(18)).toString(10);return a&&o?{amount:a.toString(10),usd:i?.multipliedBy(o).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],[1537,{"./feature-flags.cjs":1535,"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isHistoryItemTooOld=n.shouldPollHistoryItem=n.getInitialHistoryItem=n.getHistoryKey=n.getBatchSellHistoryItemsForTxHash=n.getMatchingHistoryEntryForApprovalTxMeta=n.getMatchingHistoryEntryForTxMeta=n.isBatchSellHistoryItem=n.rekeyHistoryItemInState=void 0;const r=e("@metamask/bridge-controller"),s=e("./feature-flags.cjs"),i=(e,t)=>({...e,txMetaId:t.id,originalTransactionId:e.originalTransactionId??t.id,status:{...e.status,srcChain:{...e.status.srcChain,txHash:t.hash??e.status.srcChain?.txHash}}});n.rekeyHistoryItemInState=(e,t,n,r)=>{const s=e.txHistory[t];return!!s&&(e.txHistory[n]={...s,...i(s,r)},delete e.txHistory[t],!0)};n.isBatchSellHistoryItem=e=>Boolean(e?.batchSellData);n.getMatchingHistoryEntryForTxMeta=(e,t)=>Object.entries(e).find(([e,r])=>{const{txMetaId:s,actionId:i,batchId:a,status:{srcChain:{txHash:o}}}=r;return e===t.id||e===t.actionId||s===t.id||!!i&&i===t.actionId||Boolean(a)&&!(0,n.isBatchSellHistoryItem)(r)&&a===t.batchId||!!o&&o.toLowerCase()===t.hash?.toLowerCase()});n.getMatchingHistoryEntryForApprovalTxMeta=(e,t)=>Object.entries(e).find(([e,n])=>!!n.approvalTxId&&n.approvalTxId===t.id);n.getBatchSellHistoryItemsForTxHash=(e,t)=>{const n=Object.values(e);if(!t)return{historyItems:[],is7702Batch:!1};const r=n.find(({status:e,txMetaId:n})=>e.srcChain.txHash?.toLowerCase()===t.toLowerCase()||n===t);return{historyItems:(r?.quoteIds?.map(t=>e[t])??n.filter(({batchId:e})=>e&&r?.batchId&&e===r.batchId)).filter(e=>e!==undefined),is7702Batch:Boolean(r)&&Boolean(r?.quoteIds?.length)}},n.getHistoryKey=function(e,t,n){const r=e??t??n;if(!r)throw new Error("Cannot add tx to history: either actionId, bridgeTxMeta.id, or syntheticTransactionId must be provided");return r};n.getInitialHistoryItem=e=>{const{bridgeTxMeta:t,quoteResponse:n,startTime:s,slippagePercentage:i,initialDestAssetBalance:a,targetContractAddress:o,approvalTxId:c,isStxEnabled:u,location:l,abTests:d,activeAbTests:p,accountAddress:h,originalTransactionId:f,actionId:m,tokenSecurityTypeDestination:g,inputPrimaryDenomination:y,batchSellData:w,quoteIds:b}=e,v={txMetaId:t?.id,actionId:m,originalTransactionId:f??t?.id,batchId:t?.batchId,quote:n.quote,quoteId:n.quoteId,startTime:s,estimatedProcessingTimeInSeconds:n.estimatedProcessingTimeInSeconds,slippagePercentage:i,pricingData:{amountSent:n.sentAmount?.amount??"0",amountSentInUsd:n.sentAmount?.usd??undefined,quotedGasInUsd:n.gasFee?.effective?.usd??undefined,quotedReturnInUsd:n.toTokenAmount?.usd??undefined,quotedGasAmount:n.gasFee?.effective?.amount??undefined},initialDestAssetBalance:a,targetContractAddress:o,account:h,status:{status:r.StatusTypes.PENDING,srcChain:{chainId:n.quote.srcChainId,txHash:(0,r.isNonEvmChainId)(n.quote.srcChainId)||!u?t?.hash:undefined}},hasApprovalTx:Boolean(n.approval),approvalTxId:c,isStxEnabled:Boolean(u),featureId:n.featureId,location:l,...d&&{abTests:d},...p&&{activeAbTests:p},...g!==undefined&&{tokenSecurityTypeDestination:g},...y!==undefined&&{inputPrimaryDenomination:y}};return w&&(v.batchSellData=w),b&&(v.quoteIds=b),v};n.shouldPollHistoryItem=e=>{const t=Boolean(e?.quote?.intent);return[(0,r.isCrossChain)(e.quote.srcChainId,e.quote.destChainId),t,(0,r.isTronChainId)(e.quote.srcChainId)].some(Boolean)};n.isHistoryItemTooOld=(e,t)=>{const n=(0,s.getMaxPendingHistoryItemAgeMs)(e);return Date.now()-t.startTime>n}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/history.cjs"}],[1538,{"./validators.cjs":1546,"@metamask/bridge-controller":1489,"@metamask/transaction-controller":3915},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.postSubmitOrder=n.getIntentFromQuote=n.mapIntentOrderStatusToTransactionStatus=n.translateIntentOrderToBridgeStatus=n.IntentApiImpl=void 0;const c=e("@metamask/bridge-controller"),u=e("@metamask/transaction-controller"),l=e("./validators.cjs");n.IntentApiImpl=class{constructor(e,t,n){r.set(this,void 0),s.set(this,void 0),i.set(this,void 0),a(this,r,e,"f"),a(this,s,t,"f"),a(this,i,n,"f")}async getOrderStatus(e,t,n,a){const u=`${o(this,r,"f")}/getOrderStatus?orderId=${e}&aggregatorId=${encodeURIComponent(t)}&srcChainId=${n}`;try{const e=await o(this,i,"f").call(this),t=await o(this,s,"f").call(this,u,{method:"GET",headers:(0,c.getClientHeaders)({clientId:a,jwt:e})});if(!(0,l.validateIntentStatusResponse)(t))throw new Error("Invalid getOrderStatus response");return t}catch(e){if(e instanceof Error)throw new Error(`Failed to get order status: ${e.message}`);throw new Error("Failed to get order status")}}},r=new WeakMap,s=new WeakMap,i=new WeakMap;function d(e){switch(e){case l.IntentOrderStatus.PENDING:case l.IntentOrderStatus.SUBMITTED:return u.TransactionStatus.submitted;case l.IntentOrderStatus.CONFIRMED:case l.IntentOrderStatus.COMPLETED:return u.TransactionStatus.confirmed;case l.IntentOrderStatus.FAILED:case l.IntentOrderStatus.EXPIRED:case l.IntentOrderStatus.CANCELLED:return u.TransactionStatus.failed;default:return u.TransactionStatus.submitted}}n.translateIntentOrderToBridgeStatus=(e,t,n)=>{let r;switch(e.status){case l.IntentOrderStatus.CONFIRMED:case l.IntentOrderStatus.COMPLETED:r=c.StatusTypes.COMPLETE;break;case l.IntentOrderStatus.FAILED:case l.IntentOrderStatus.EXPIRED:case l.IntentOrderStatus.CANCELLED:r=c.StatusTypes.FAILED;break;case l.IntentOrderStatus.PENDING:r=c.StatusTypes.PENDING;break;case l.IntentOrderStatus.SUBMITTED:r=c.StatusTypes.SUBMITTED;break;default:r=c.StatusTypes.UNKNOWN}const s=e.txHash??n;return{status:{status:r,srcChain:{chainId:t,txHash:s}},txHash:s,transactionStatus:d(e.status)}},n.mapIntentOrderStatusToTransactionStatus=d,n.getIntentFromQuote=function(e){const{intent:t}=e.quote;if(!t)throw new Error("submitIntent: missing intent data");return t};n.postSubmitOrder=async({params:e,clientId:t,jwt:n,fetchFn:r,bridgeApiBaseUrl:s})=>{const i=`${s}/submitOrder`;try{const s=await r(i,{method:"POST",headers:{"Content-Type":"application/json",...(0,c.getClientHeaders)({clientId:t,jwt:n})},body:JSON.stringify(e)});if(!(0,l.validateIntentStatusResponse)(s))throw new Error("Invalid submitOrder response");return s}catch(e){if(e instanceof Error)throw new Error(`Failed to submit intent: ${e.message}`);throw new Error("Failed to submit intent")}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs"}],[1539,{"@metamask/keyring-controller":2774},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.signTypedMessage=void 0;const r=e("@metamask/keyring-controller");n.signTypedMessage=async({messenger:e,accountAddress:t,typedData:n})=>await e.call("KeyringController:signTypedMessage",{from:t,data:n},r.SignTypedDataVersion.V4)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/keyring.cjs"}],[1540,{"./gas.cjs":1536,"./swap-received-amount.cjs":1543,"@metamask/bridge-controller":1489,"@metamask/transaction-controller":3915,"bignumber.js":1547},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getEVMTxPropertiesFromTransactionMeta=n.getRequestMetadataFromHistory=n.getTradeDataFromHistory=n.getPreConfirmationPropertiesFromQuote=n.getPriceImpactFromQuote=n.getTradeDataFromQuote=n.getRequestParamFromHistory=n.getFinalizedTxProperties=n.getTxStatusesFromHistory=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/transaction-controller"),i=e("bignumber.js"),a=e("./gas.cjs"),o=e("./swap-received-amount.cjs");n.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:n,quote:s})=>{const i=e.srcChain.txHash?r.StatusTypes.COMPLETE:r.StatusTypes.PENDING,a=e.destChain?.txHash?e.status:r.StatusTypes.PENDING,o=(0,r.formatChainIdToHex)(s.srcChainId),c=(0,r.isEthUsdt)(o,s.srcAsset.address),u=e.srcChain.txHash?r.StatusTypes.COMPLETE:undefined,l=e.srcChain.txHash?r.StatusTypes.COMPLETE:r.StatusTypes.PENDING;return{allowance_reset_transaction:c?u:undefined,approval_transaction:t||n?l:undefined,source_transaction:i,destination_transaction:e.status===r.StatusTypes.FAILED?r.StatusTypes.FAILED:a}};n.getFinalizedTxProperties=(e,t,n)=>{const r=n?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===s.TransactionType.swap?t?.time:e.completionTime,u=(0,a.calcActualGasUsed)(e,t?.txReceipt,n?.txReceipt),l=t?.type===s.TransactionType.swap?(0,o.getActualSwapReceivedAmount)(e,u,t):(0,o.getActualBridgeReceivedAmount)(e),d=e.pricingData?.quotedGasAmount&&u?.amount?new i.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new i.BigNumber(10).pow(18)).div(u.amount).toNumber():0,p=e.pricingData?.quotedReturnInUsd&&l?.usd?new i.BigNumber(e.pricingData.quotedReturnInUsd).div(l.usd).toNumber():0;return{actual_time_minutes:c&&r?(c-r)/6e4:0,usd_actual_return:Number(l?.usd??0),usd_actual_gas:u?.usd??0,quote_vs_execution_ratio:p,quoted_vs_used_gas_ratio:d}};n.getRequestParamFromHistory=e=>({chain_id_source:(0,r.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,r.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId,token_security_type_destination:e.tokenSecurityTypeDestination??null});n.getTradeDataFromQuote=(e,t)=>({usd_quoted_gas:Number(e.gasFee?.effective?.usd??0),gas_included:e.quote.gasIncluded??t?.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??t?.gasIncluded7702??!1,provider:(0,r.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});n.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});n.getPreConfirmationPropertiesFromQuote=(e,t,s,i,a,o,c,u,l)=>{const{quote:d}=e;return{...(0,n.getPriceImpactFromQuote)(d),...(0,n.getTradeDataFromQuote)(e,u),chain_id_source:(0,r.formatChainIdToCaip)(d.srcChainId),token_symbol_source:d.srcAsset.symbol,token_address_source:d.srcAsset.assetId,chain_id_destination:(0,r.formatChainIdToCaip)(d.destChainId),token_symbol_destination:d.destAsset.symbol,token_address_destination:d.destAsset.assetId,token_security_type_destination:c??null,account_hardware_type:s,is_hardware_wallet:null!==s,swap_type:(0,r.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:r.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1,location:i,...a&&Object.keys(a).length>0&&{ab_tests:a},...o&&o.length>0&&{active_ab_tests:o},...l?{batch_id:l}:{},feature_id:e.featureId??r.FeatureId.UNIFIED_SWAP_BRIDGE}};n.getTradeDataFromHistory=e=>({usd_quoted_gas:Number(e.pricingData?.quotedGasInUsd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,r.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});n.getRequestMetadataFromHistory=(e,t)=>{const{quote:n,slippagePercentage:s,isStxEnabled:i}=e,a=(0,r.getAccountHardwareType)(t);return{slippage_limit:s,custom_slippage:(0,r.isCustomSlippage)(s),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,r.getSwapType)(n.srcChainId,n.destChainId),account_hardware_type:a,is_hardware_wallet:null!==a,stx_enabled:i??!1,security_warnings:[]}};n.getEVMTxPropertiesFromTransactionMeta=(e,t)=>{const n=(0,r.getAccountHardwareType)(t);return{source_transaction:[s.TransactionStatus.failed,s.TransactionStatus.dropped,s.TransactionStatus.rejected].includes(e.status)?r.StatusTypes.FAILED:r.StatusTypes.COMPLETE,error_message:[`Transaction ${e.status}`,e.error?.message].filter(Boolean).join(". "),chain_id_source:(0,r.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,r.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:0,stx_enabled:!1,token_address_source:(0,r.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,r.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",token_security_type_destination:null,custom_slippage:!1,account_hardware_type:n,is_hardware_wallet:null!==n,swap_type:e.type&&[s.TransactionType.swap,s.TransactionType.swapApproval].includes(e.type)?r.MetricsSwapType.SINGLE:r.MetricsSwapType.CROSSCHAIN,security_warnings:[],price_impact:0,usd_quoted_gas:0,gas_included:!1,gas_included_7702:!1,quoted_time_minutes:0,usd_quoted_return:0,provider:"",actual_time_minutes:0,quote_vs_execution_ratio:0,quoted_vs_used_gas_ratio:0,usd_actual_return:0,usd_actual_gas:0,action_type:r.MetricsActionType.SWAPBRIDGE_V1,...e.batchId?{batch_id:e.batchId}:{}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs"}],[1541,{"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getNetworkClientByChainId=n.getNetworkClientIdByChainId=n.getSelectedChainId=void 0;const r=e("@metamask/bridge-controller");n.getSelectedChainId=e=>{const{selectedNetworkClientId:t}=e.call("NetworkController:getState");return e.call("NetworkController:getNetworkClientById",t).configuration.chainId};n.getNetworkClientIdByChainId=(e,t)=>{const n=(0,r.formatChainIdToHex)(t);return e.call("NetworkController:findNetworkClientIdByChainId",n)};n.getNetworkClientByChainId=(e,t)=>{const r=(0,n.getNetworkClientIdByChainId)(e,t);return e.call("NetworkController:getNetworkClientById",r).provider}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/network.cjs"}],[1542,{"@metamask/bridge-controller":1489,"@metamask/snaps-controllers":3573,"@metamask/transaction-controller":3915,uuid:8131},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handleNonEvmTx=n.handleNonEvmTxResponse=n.getTxMetaFields=n.getClientRequest=n.createClientTransactionRequest=void 0;const r=e("@metamask/bridge-controller"),s=(e("@metamask/snaps-controllers"),e("@metamask/transaction-controller")),i=e("uuid");n.createClientTransactionRequest=(e,t,n,r,s)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,i.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:n,accountId:r,...s&&{options:s}}}});n.getClientRequest=(e,t,s,i,a,o)=>{const c=(0,r.formatChainIdToCaip)(t),u=(0,r.extractTradeData)(e);let l;return(0,r.isStellarTrade)(e)&&(a===undefined&&o===undefined||(l={...a!==undefined&&{sourceAssetId:a},...o!==undefined&&{destAssetId:o}})),(0,r.isTronTrade)(e)&&(l={visible:e.visible,type:e.raw_data?.contract?.[0]?.type}),(0,n.createClientTransactionRequest)(i,u,c,s,l)};n.getTxMetaFields=(e,t)=>{let n;try{n=(0,r.formatChainIdToHex)(e.quote.destChainId)}catch{n=s.CHAIN_IDS.MAINNET}return{destinationChainId:n,sourceTokenAmount:e.quote.srcTokenAmount,sourceTokenSymbol:e.quote.srcAsset.symbol,sourceTokenDecimals:e.quote.srcAsset.decimals,sourceTokenAddress:e.quote.srcAsset.address,destinationTokenAmount:e.quote.destTokenAmount,destinationTokenSymbol:e.quote.destAsset.symbol,destinationTokenDecimals:e.quote.destAsset.decimals,destinationTokenAddress:e.quote.destAsset.address,approvalTxId:t,swapTokenValue:e.sentAmount.amount}};n.handleNonEvmTxResponse=(e,t,a,o)=>{const c=o.address,u=o.metadata.snap?.id;let l;"string"==typeof e?l=e:e&&"object"==typeof e&&("transactionId"in e&&e.transactionId?l=e.transactionId:"result"in e&&e.result&&"object"==typeof e.result?l=e.result.signature||e.result.txid||e.result.hash||e.result.txHash:"signature"in e&&e.signature&&"string"==typeof e.signature&&(l=e.signature));const d=(0,r.isCrossChain)(a.quote.srcChainId,a.quote.destChainId);let p;try{p=(0,r.formatChainIdToHex)(a.quote.srcChainId)}catch{p="0x1"}const h=(0,r.extractTradeData)(t);return{...(0,n.getTxMetaFields)(a),time:Date.now(),id:l??(0,i.v4)(),chainId:p,networkClientId:u??"mainnet",txParams:{from:c,data:h},type:d?s.TransactionType.bridge:s.TransactionType.swap,status:s.TransactionStatus.submitted,hash:l,origin:u,isSolana:!0,isBridgeTx:d}};n.handleNonEvmTx=async(e,t,r,s)=>{if(!s.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const i=(0,n.getClientRequest)(t,r.quote.srcChainId,s.id,s.metadata?.snap?.id,r.quote.srcAsset.assetId,r.quote.destAsset.assetId),a=await e.call("SnapController:handleRequest",i);return(0,n.handleNonEvmTxResponse)(a,t,r,s)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs"}],[1543,{"@metamask/bridge-controller":1489,"bignumber.js":1547},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getActualBridgeReceivedAmount=n.getActualSwapReceivedAmount=void 0;const r=e("@metamask/bridge-controller"),s=e("bignumber.js");n.getActualSwapReceivedAmount=(e,t,n)=>{const{pricingData:i}=e,a=e.quote.destTokenAmount;if(!n?.txReceipt)return null;const o=(0,r.isNativeAddress)(e.quote.destAsset.address)?((e,t,n)=>{const{preTxBalance:r,postTxBalance:i}=n;return r&&i&&r!==i?t&&i&&r?new s.BigNumber(i,16).minus(r,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new s.BigNumber(e.quote.destTokenAmount).div(new s.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,n):((e,t)=>{const{txReceipt:n}=t;if(!n?.logs||"0x0"===n.status)return null;const{account:r,quote:i}=e,a=n.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),n=e.address?.toLowerCase()===i.destAsset.address?.toLowerCase(),s=e.topics?.[2]&&(e.topics[2]===r||e.topics[2].match(r?.slice(2)));return t&&n&&s});return a?.data?new s.BigNumber(a.data,16).div(new s.BigNumber(10).pow(i.destAsset.decimals)):null})(e,n),c=i?.quotedReturnInUsd&&a?new s.BigNumber(i.quotedReturnInUsd).div(a).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:o,usd:o&&c?c.multipliedBy(o):null}};n.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:n,status:r}=e,i=n?.quotedReturnInUsd?new s.BigNumber(n.quotedReturnInUsd).div(t.destTokenAmount):null,a=r.destChain?.amount;return a&&i?{amount:a,usd:i.multipliedBy(a).toString(10)}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs"}],[1544,{"../constants.cjs":1511,"@metamask/bridge-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getApprovalTraceParams=n.getTraceParams=void 0;const r=e("@metamask/bridge-controller"),s=e("../constants.cjs");n.getTraceParams=(e,t)=>({name:(0,r.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?s.TraceName.BridgeTransactionCompleted:s.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,r.formatChainIdToCaip)(e.quote.srcChainId),stxEnabled:t}});n.getApprovalTraceParams=(e,t)=>({name:(0,r.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?s.TraceName.BridgeTransactionApprovalCompleted:s.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,r.formatChainIdToCaip)(e.quote.srcChainId),stxEnabled:t}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/trace.cjs"}],[1545,{"../constants.cjs":1511,"./accounts.cjs":1531,"./network.cjs":1541,"@metamask/bridge-controller":1489,"@metamask/controller-utils":1602,"@metamask/transaction-controller":3915,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.updateTransactionsInBatch=n.findAllTransactionsInBatch=n.getAddTransactionBatchParams=n.toTransactionParams=n.toQuoteAndTxMetadataBatch=n.toQuoteAndTxMetadata=n.waitForTxConfirmation=n.handleMobileHardwareWalletDelay=n.handleApprovalDelay=n.addSyntheticTransaction=n.generateActionId=n.addTransaction=n.checkIsDelegatedAccount=n.updateTransaction=n.getTransactionMetaByHash=n.getTransactionMetaById=n.getTransactions=n.getGasFeeEstimates=n.hasNestedSwapTransactions=n.shouldDisable7702=n.is7702Tx=n.isCrossChainTx=n.isTradeTx=n.isApprovalTx=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/controller-utils"),i=e("@metamask/transaction-controller"),a=e("@metamask/utils"),o=e("../constants.cjs"),c=e("./accounts.cjs"),u=e("./network.cjs");n.isApprovalTx=e=>e===i.TransactionType.bridgeApproval||e===i.TransactionType.swapApproval;n.isTradeTx=e=>e===i.TransactionType.bridge||e===i.TransactionType.swap;n.isCrossChainTx=e=>(0,n.isTradeTx)(e)||(0,n.isApprovalTx)(e);n.is7702Tx=e=>Array.isArray(e.txParams.authorizationList)&&e.txParams.authorizationList.length>0||Boolean(e.delegationAddress);n.shouldDisable7702=(e=!1,t=!1,n=!1)=>!e&&!(n&&!t);n.hasNestedSwapTransactions=e=>Boolean(e?.nestedTransactions?.some(e=>e.type===i.TransactionType.swap));n.getGasFeeEstimates=async(e,t)=>{const{estimates:n}=await e.call("TransactionController:estimateGasFee",t);return n?.type===i.GasFeeEstimateType.FeeMarket?n[r.BRIDGE_PREFERRED_GAS_ESTIMATE]:undefined};n.getTransactions=e=>e.call("TransactionController:getState").transactions??[];n.getTransactionMetaById=(e,t)=>(0,n.getTransactions)(e).find(e=>e.id===t);n.getTransactionMetaByHash=(e,t)=>(0,n.getTransactions)(e).find(e=>e.hash?.toLowerCase()===t?.toLowerCase());n.updateTransaction=(e,t,n,r)=>e.call("TransactionController:updateTransaction",{...t,...n},r);n.checkIsDelegatedAccount=async(e,t,n)=>{try{return(await e.call("TransactionController:isAtomicBatchSupported",{address:t,chainIds:n})).some(e=>e.isSupported&&e.delegationAddress)}catch{return!1}};n.addTransaction=async(e,...t)=>{const{result:r}=await e.call("TransactionController:addTransaction",...t);return await(async(e,t)=>{const r=await t,s=(0,n.getTransactionMetaByHash)(e,r);if(!s)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return s})(e,r)};n.generateActionId=()=>(Date.now()+Math.random()).toString();n.addSyntheticTransaction=async(e,...t)=>{const{transactionMeta:r}=await e.call("TransactionController:addTransaction",t[0],{origin:"metamask",actionId:(0,n.generateActionId)(),isStateOnly:!0,isInternal:!0,...t[1]});return r};n.handleApprovalDelay=async e=>{if([r.ChainId.LINEA,r.ChainId.BASE].includes(e)){(0,a.createProjectLogger)("bridge")("Delaying submitting bridge tx to make Linea and Base confirmation more likely");const e=new Promise(e=>setTimeout(e,o.APPROVAL_DELAY_MS));await e}};n.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};n.waitForTxConfirmation=async(e,t,{timeoutMs:r=3e5,pollMs:s=3e3}={})=>{const a=Date.now();for(;;){const o=(0,n.getTransactionMetaById)(e,t);if(o){if(o.status===i.TransactionStatus.confirmed)return o;if(o.status===i.TransactionStatus.failed||o.status===i.TransactionStatus.dropped||o.status===i.TransactionStatus.rejected)throw new Error("Approval transaction did not confirm")}if(Date.now()-a>r)throw new Error("Timed out waiting for approval confirmation");await new Promise(e=>setTimeout(e,s))}};n.toQuoteAndTxMetadata=({quoteResponse:e,isBridgeTx:t})=>{const n=[],s=t?i.TransactionType.bridgeApproval:i.TransactionType.swapApproval;return e.resetApproval&&n.push({quoteResponse:e,tx:e.resetApproval,type:s,txFee:e.quote.feeData[r.FeeType.TX_FEE]}),e.approval&&(0,r.isEvmTxData)(e.approval)&&n.push({quoteResponse:e,tx:e.approval,type:s,txFee:e.quote.feeData[r.FeeType.TX_FEE]}),n.push({quoteResponse:e,tx:e.trade,type:t?i.TransactionType.bridge:i.TransactionType.swap,assetsFiatValues:{sending:e.sentAmount?.valueInCurrency?.toString(),receiving:e.toTokenAmount?.valueInCurrency?.toString()},txFee:e.quote.feeData[r.FeeType.TX_FEE]}),n};n.toQuoteAndTxMetadataBatch=({quoteResponses:e,batchSellTrades:t})=>{const n=[],{transactions:s,gasIncluded7702:a,gasIncluded:o,gasSponsored:c=!1}=t;for(const t of s){const{type:s,maxFeePerGas:u,maxPriorityFeePerGas:l,...d}=t,p=e.find(({approval:e,trade:t})=>t?.data.toLowerCase()===d.data.toLowerCase()||e?.data.toLowerCase()===d.data.toLowerCase())??e[0],h={...p,quote:{...p.quote,gasIncluded:o,gasIncluded7702:a,gasSponsored:c}},f={tx:d,quoteResponse:h,txFee:{maxFeePerGas:u,maxPriorityFeePerGas:l}};s===r.BatchSellTransactionType.TRADE?n.push({...f,type:i.TransactionType.swap,assetsFiatValues:{sending:p.sentAmount?.valueInCurrency?.toString(),receiving:p.toTokenAmount?.valueInCurrency?.toString()}}):n.push({...f,type:s===r.BatchSellTransactionType.APPROVAL?i.TransactionType.swapApproval:i.TransactionType.tokenMethodTransfer})}return n};n.toTransactionParams=async(e,{chainId:t,gasLimit:r,...i},o,c,u)=>{const l={data:i.data,to:i.to,from:i.from,value:i.value,gas:r?(0,s.toHex)(r):undefined};if(u)return{...l,maxFeePerGas:(0,a.isStrictHexString)(u.maxFeePerGas)?u.maxFeePerGas:(0,s.toHex)(u.maxFeePerGas),maxPriorityFeePerGas:(0,a.isStrictHexString)(u.maxPriorityFeePerGas)?u.maxPriorityFeePerGas:(0,s.toHex)(u.maxPriorityFeePerGas)};const d=await(0,n.getGasFeeEstimates)(e,{transactionParams:l,networkClientId:o,chainId:c});return{...l,maxFeePerGas:d?.maxFeePerGas,maxPriorityFeePerGas:d?.maxPriorityFeePerGas}};n.getAddTransactionBatchParams=async({messenger:e,tradeData:t,requireApproval:s=!1,isDelegatedAccount:i,...a})=>{const o=t[0].tx,l=(0,c.getAccountByAddress)(e,o.from);if(!l)throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const d=(0,r.formatChainIdToHex)(o.chainId),p=(0,u.getNetworkClientIdByChainId)(e,d),h=await Promise.all(t.map(async({tx:t,txFee:r,assetsFiatValues:s,type:i})=>({params:await(0,n.toTransactionParams)(e,t,p,d,r),assetsFiatValues:s,type:i})));return{networkClientId:p,requireApproval:s,origin:"metamask",from:l.address,isInternal:!0,transactions:h,...a}};n.findAllTransactionsInBatch=({messenger:e,batchId:t,tradeData:r})=>{const s=(0,n.getTransactions)(e).filter(e=>e.batchId===t);return r.map(e=>{const{tx:t,type:r}=e;return{...e,txMeta:s.find(e=>{if((0,n.is7702Tx)(e)){if((0,n.isTradeTx)(r)&&e.type===i.TransactionType.batch)return!0;if((0,n.isApprovalTx)(r)&&e.txParams.data===t.data)return!0}return e.txParams.data===t.data})}})};n.updateTransactionsInBatch=({messenger:e,allTradesWithMetadata:t})=>t.map(t=>{const{txMeta:r,type:s}=t;if(r){(0,n.updateTransaction)(e,r,{type:s},`Update tx type to ${s}`);const i={...r,type:s};return{...t,txMeta:i,type:s}}return t})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"}],[1546,{"@metamask/bridge-controller":1489,"@metamask/superstruct":3858},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateIntentStatusResponse=n.IntentOrderStatus=n.validateBridgeStatusResponse=n.StatusResponseSchema=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/superstruct"),i=(0,s.number)(),a=(0,s.type)({}),o=(0,s.type)({chainId:i,txHash:(0,s.optional)((0,s.string)()),amount:(0,s.optional)((0,s.string)()),token:(0,s.optional)((0,s.union)([a,r.BridgeAssetSchema]))}),c=(0,s.type)({chainId:i,txHash:(0,s.optional)((0,s.string)()),amount:(0,s.optional)((0,s.string)()),token:(0,s.optional)((0,s.union)([a,r.BridgeAssetSchema]))}),u=(0,s.type)({});n.StatusResponseSchema=(0,s.type)({status:(0,s.enums)(Object.values(r.StatusTypes)),srcChain:o,destChain:(0,s.optional)(c),bridge:(0,s.optional)((0,s.string)()),isExpectedToken:(0,s.optional)((0,s.boolean)()),isUnrecognizedRouterAddress:(0,s.optional)((0,s.boolean)()),refuel:(0,s.optional)(u)});var l;n.validateBridgeStatusResponse=e=>((0,s.assert)(e,n.StatusResponseSchema),!0),function(e){e.PENDING="pending",e.SUBMITTED="submitted",e.CONFIRMED="confirmed",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.EXPIRED="expired"}(l||(n.IntentOrderStatus=l={}));const d=(0,s.type)({id:(0,s.string)(),status:(0,s.enums)(Object.values(l)),txHash:(0,s.optional)((0,s.string)()),metadata:(0,s.type)({txHashes:(0,s.optional)((0,s.union)([(0,s.array)((0,s.string)()),(0,s.string)()]))})});n.validateIntentStatusResponse=e=>(0,s.is)(e,d)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs"}],[1547,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){!function(e){var n,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,i=Math.floor,a="[BigNumber Error] ",o=a+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,l=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,h=1e9;function f(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,n,r=1,s=e.length,i=e[0]+"";r<s;){for(t=e[r++]+"",n=u-t.length;n--;t="0"+t);i+=t}for(s=i.length;48===i.charCodeAt(--s););return i.slice(0,s+1||1)}function g(e,t){var n,r,s=e.c,i=t.c,a=e.s,o=t.s,c=e.e,u=t.e;if(!a||!o)return null;if(n=s&&!s[0],r=i&&!i[0],n||r)return n?r?0:-o:a;if(a!=o)return a;if(n=a<0,r=c==u,!s||!i)return r?0:!s^n?1:-1;if(!r)return c>u^n?1:-1;for(o=(c=s.length)<(u=i.length)?c:u,a=0;a<o;a++)if(s[a]!=i[a])return s[a]>i[a]^n?1:-1;return c==u?0:c>u^n?1:-1}function y(e,t,n,r){if(e<t||e>n||e!==i(e))throw Error(a+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return f(e.e/u)==t&&e.c[t]%2!=0}function b(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function v(e,t,n){var r,s;if(t<0){for(s=n+".";++t;s+=n);e=s+e}else if(++t>(r=e.length)){for(s=n,t-=r;--t;s+=n);e+=s}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}n=function e(t){var n,T,S,_,k,E,I,A,C,M,P=W.prototype={constructor:W,toString:null,valueOf:null},O=new W(1),j=20,x=4,N=-7,R=21,D=-1e7,F=1e7,B=!1,L=1,U=0,q={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},H="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function W(e,t){var n,s,a,c,d,p,h,f,m=this;if(!(m instanceof W))return new W(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>F?m.c=m.e=null:e.e<D?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((p="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,d=e;d>=10;d/=10,c++);return void(c>F?m.c=m.e=null:(m.e=c,m.c=[e]))}f=String(e)}else{if(!r.test(f=String(e)))return S(m,f,p);m.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(c=f.indexOf("."))>-1&&(f=f.replace(".","")),(d=f.search(/e/i))>0?(c<0&&(c=d),c+=+f.slice(d+1),f=f.substring(0,d)):c<0&&(c=f.length)}else{if(y(t,2,H.length,"Base"),10==t&&$)return V(m=new W(e),j+m.e+1,x);if(f=String(e),p="number"==typeof e){if(0*e!=0)return S(m,f,p,t);if(m.s=1/e<0?(f=f.slice(1),-1):1,W.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else m.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(n=H.slice(0,t),c=d=0,h=f.length;d<h;d++)if(n.indexOf(s=f.charAt(d))<0){if("."==s){if(d>c){c=h;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,d=-1,c=0;continue}return S(m,String(e),p,t)}p=!1,(c=(f=T(f,t,10,m.s)).indexOf("."))>-1?f=f.replace(".",""):c=f.length}for(d=0;48===f.charCodeAt(d);d++);for(h=f.length;48===f.charCodeAt(--h););if(f=f.slice(d,++h)){if(h-=d,p&&W.DEBUG&&h>15&&(e>l||e!==i(e)))throw Error(o+m.s*e);if((c=c-d-1)>F)m.c=m.e=null;else if(c<D)m.c=[m.e=0];else{if(m.e=c,m.c=[],d=(c+1)%u,c<0&&(d+=u),d<h){for(d&&m.c.push(+f.slice(0,d)),h-=u;d<h;)m.c.push(+f.slice(d,d+=u));d=u-(f=f.slice(d)).length}else d-=h;for(;d--;f+="0");m.c.push(+f)}}else m.c=[m.e=0]}function K(e,t,n,r){var s,i,a,o,c;if(null==n?n=x:y(n,0,8),!e.c)return e.toString();if(s=e.c[0],a=e.e,null==t)c=m(e.c),c=1==r||2==r&&(a<=N||a>=R)?b(c,a):v(c,a,"0");else if(i=(e=V(new W(e),t,n)).e,o=(c=m(e.c)).length,1==r||2==r&&(t<=i||i<=N)){for(;o<t;c+="0",o++);c=b(c,i)}else if(t-=a+(2===r&&i>a),c=v(c,i,"0"),i+1>o){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-o)>0)for(i+1==o&&(c+=".");t--;c+="0");return e.s<0&&s?"-"+c:c}function G(e,t){for(var n,r,s=1,i=new W(e[0]);s<e.length;s++)(!(r=new W(e[s])).s||(n=g(i,r))===t||0===n&&i.s===t)&&(i=r);return i}function Q(e,t,n){for(var r=1,s=t.length;!t[--s];t.pop());for(s=t[0];s>=10;s/=10,r++);return(n=r+n*u-1)>F?e.c=e.e=null:n<D?e.c=[e.e=0]:(e.e=n,e.c=t),e}function V(e,t,n,r){var a,o,l,p,h,f,m,g=e.c,y=d;if(g){e:{for(a=1,p=g[0];p>=10;p/=10,a++);if((o=t-a)<0)o+=u,l=t,h=g[f=0],m=i(h/y[a-l-1]%10);else if((f=s((o+1)/u))>=g.length){if(!r)break e;for(;g.length<=f;g.push(0));h=m=0,a=1,l=(o%=u)-u+1}else{for(h=p=g[f],a=1;p>=10;p/=10,a++);m=(l=(o%=u)-u+a)<0?0:i(h/y[a-l-1]%10)}if(r=r||t<0||null!=g[f+1]||(l<0?h:h%y[a-l-1]),r=n<4?(m||r)&&(0==n||n==(e.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(o>0?l>0?h/y[a-l]:0:g[f-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(u-t%u)%u],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,p=1,f--):(g.length=f+1,p=y[u-o],g[f]=l>0?i(h/y[a-l]%y[l])*p:0),r)for(;;){if(0==f){for(o=1,l=g[0];l>=10;l/=10,o++);for(l=g[0]+=p,p=1;l>=10;l/=10,p++);o!=p&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[f]+=p,g[f]!=c)break;g[f--]=0,p=1}for(o=g.length;0===g[--o];g.pop());}e.e>F?e.c=e.e=null:e.e<D&&(e.c=[e.e=0])}return e}function z(e){var t,n=e.e;return null===n?e.toString():(t=m(e.c),t=n<=N||n>=R?b(t,n):v(t,n,"0"),e.s<0?"-"+t:t)}return W.clone=e,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(a+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(n=e[t],0,h,t),j=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(n=e[t],0,8,t),x=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(y(n[0],-h,0,t),y(n[1],0,h,t),N=n[0],R=n[1]):(y(n,-h,h,t),N=-(R=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)y(n[0],-h,-1,t),y(n[1],1,h,t),D=n[0],F=n[1];else{if(y(n,-h,h,t),!n)throw Error(a+t+" cannot be zero: "+n);D=-(F=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(a+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw B=!n,Error(a+"crypto unavailable");B=n}else B=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(n=e[t],0,9,t),L=n),e.hasOwnProperty(t="POW_PRECISION")&&(y(n=e[t],0,h,t),U=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(a+t+" not an object: "+n);q=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(a+t+" invalid: "+n);$="0123456789"==n.slice(0,10),H=n}}return{DECIMAL_PLACES:j,ROUNDING_MODE:x,EXPONENTIAL_AT:[N,R],RANGE:[D,F],CRYPTO:B,MODULO_MODE:L,POW_PRECISION:U,FORMAT:q,ALPHABET:H}},W.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!W.DEBUG)return!0;var t,n,r=e.c,s=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&s>=-h&&s<=h&&s===i(s)){if(0===r[0]){if(0===s&&1===r.length)return!0;break e}if((t=(s+1)%u)<1&&(t+=u),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=c||n!==i(n))break e;if(0!==n)return!0}}}else if(null===r&&null===s&&(null===o||1===o||-1===o))return!0;throw Error(a+"Invalid BigNumber: "+e)},W.maximum=W.max=function(){return G(arguments,-1)},W.minimum=W.min=function(){return G(arguments,1)},W.random=(_=9007199254740992,k=Math.random()*_&2097151?function(){return i(Math.random()*_)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,o,c,l=0,p=[],f=new W(O);if(null==e?e=j:y(e,0,h),o=s(e/u),B)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));l<o;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[l]=n[0],t[l+1]=n[1]):(p.push(c%1e14),l+=2);l=o/2}else{if(!crypto.randomBytes)throw B=!1,Error(a+"crypto unavailable");for(t=crypto.randomBytes(o*=7);l<o;)(c=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(p.push(c%1e14),l+=7);l=o/7}if(!B)for(;l<o;)(c=k())<9e15&&(p[l++]=c%1e14);for(o=p[--l],e%=u,o&&e&&(c=d[u-e],p[l]=i(o/c)*c);0===p[l];p.pop(),l--);if(l<0)p=[r=0];else{for(r=-1;0===p[0];p.splice(0,1),r-=u);for(l=1,c=p[0];c>=10;c/=10,l++);l<u&&(r-=u-l)}return f.e=r,f.c=p,f}),W.sum=function(){for(var e=1,t=arguments,n=new W(t[0]);e<t.length;)n=n.plus(t[e++]);return n},T=function(){var e="0123456789";function t(e,t,n,r){for(var s,i,a=[0],o=0,c=e.length;o<c;){for(i=a.length;i--;a[i]*=t);for(a[0]+=r.indexOf(e.charAt(o++)),s=0;s<a.length;s++)a[s]>n-1&&(null==a[s+1]&&(a[s+1]=0),a[s+1]+=a[s]/n|0,a[s]%=n)}return a.reverse()}return function(r,s,i,a,o){var c,u,l,d,p,h,f,g,y=r.indexOf("."),w=j,b=x;for(y>=0&&(d=U,U=0,r=r.replace(".",""),h=(g=new W(s)).pow(r.length-y),U=d,g.c=t(v(m(h.c),h.e,"0"),10,i,e),g.e=g.c.length),l=d=(f=t(r,s,i,o?(c=H,e):(c=e,H))).length;0==f[--d];f.pop());if(!f[0])return c.charAt(0);if(y<0?--l:(h.c=f,h.e=l,h.s=a,f=(h=n(h,g,w,b,i)).c,p=h.r,l=h.e),y=f[u=l+w+1],d=i/2,p=p||u<0||null!=f[u+1],p=b<4?(null!=y||p)&&(0==b||b==(h.s<0?3:2)):y>d||y==d&&(4==b||p||6==b&&1&f[u-1]||b==(h.s<0?8:7)),u<1||!f[0])r=p?v(c.charAt(1),-w,c.charAt(0)):c.charAt(0);else{if(f.length=u,p)for(--i;++f[--u]>i;)f[u]=0,u||(++l,f=[1].concat(f));for(d=f.length;!f[--d];);for(y=0,r="";y<=d;r+=c.charAt(f[y++]));r=v(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,s,i,a,o=0,c=e.length,u=t%p,l=t/p|0;for(e=e.slice();c--;)o=((s=u*(i=e[c]%p)+(r=l*i+(a=e[c]/p|0)*u)%p*p+o)/n|0)+(r/p|0)+l*a,e[c]=s%n;return o&&(e=[o].concat(e)),e}function t(e,t,n,r){var s,i;if(n!=r)i=n>r?1:-1;else for(s=i=0;s<n;s++)if(e[s]!=t[s]){i=e[s]>t[s]?1:-1;break}return i}function n(e,t,n,r){for(var s=0;n--;)e[n]-=s,s=e[n]<t[n]?1:0,e[n]=s*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,s,a,o,l){var d,p,h,m,g,y,w,b,v,T,S,_,k,E,I,A,C,M=r.s==s.s?1:-1,P=r.c,O=s.c;if(!(P&&P[0]&&O&&O[0]))return new W(r.s&&s.s&&(P?!O||P[0]!=O[0]:O)?P&&0==P[0]||!O?0*M:M/0:NaN);for(v=(b=new W(M)).c=[],M=a+(p=r.e-s.e)+1,l||(l=c,p=f(r.e/u)-f(s.e/u),M=M/u|0),h=0;O[h]==(P[h]||0);h++);if(O[h]>(P[h]||0)&&p--,M<0)v.push(1),m=!0;else{for(E=P.length,A=O.length,h=0,M+=2,(g=i(l/(O[0]+1)))>1&&(O=e(O,g,l),P=e(P,g,l),A=O.length,E=P.length),k=A,S=(T=P.slice(0,A)).length;S<A;T[S++]=0);C=O.slice(),C=[0].concat(C),I=O[0],O[1]>=l/2&&I++;do{if(g=0,(d=t(O,T,A,S))<0){if(_=T[0],A!=S&&(_=_*l+(T[1]||0)),(g=i(_/I))>1)for(g>=l&&(g=l-1),w=(y=e(O,g,l)).length,S=T.length;1==t(y,T,w,S);)g--,n(y,A<w?C:O,w,l),w=y.length,d=1;else 0==g&&(d=g=1),w=(y=O.slice()).length;if(w<S&&(y=[0].concat(y)),n(T,y,S,l),S=T.length,-1==d)for(;t(O,T,A,S)<1;)g++,n(T,A<S?C:O,S,l),S=T.length}else 0===d&&(g++,T=[0]);v[h++]=g,T[0]?T[S++]=P[k]||0:(T=[P[k]],S=1)}while((k++<E||null!=T[0])&&M--);m=null!=T[0],v[0]||v.splice(0,1)}if(l==c){for(h=1,M=v[0];M>=10;M/=10,h++);V(b,a+(b.e=h+p*u-1)+1,o,m)}else b.e=p,b.r=+m;return b}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,A=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,M=/^\s*\+(?=[\w.])|^\s+|\s+$/g,S=function(e,t,n,r){var s,i=n?t:t.replace(M,"");if(C.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(E,function(e,t,n){return s="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=s?e:t}),r&&(s=r,i=i.replace(I,"$1").replace(A,"0.$1")),t!=i))return new W(i,s);if(W.DEBUG)throw Error(a+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},P.absoluteValue=P.abs=function(){var e=new W(this);return e.s<0&&(e.s=1),e},P.comparedTo=function(e,t){return g(this,new W(e,t))},P.decimalPlaces=P.dp=function(e,t){var n,r,s,i=this;if(null!=e)return y(e,0,h),null==t?t=x:y(t,0,8),V(new W(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((s=n.length-1)-f(this.e/u))*u,s=n[s])for(;s%10==0;s/=10,r--);return r<0&&(r=0),r},P.dividedBy=P.div=function(e,t){return n(this,new W(e,t),j,x)},P.dividedToIntegerBy=P.idiv=function(e,t){return n(this,new W(e,t),0,1)},P.exponentiatedBy=P.pow=function(e,t){var n,r,o,c,l,d,p,h,f=this;if((e=new W(e)).c&&!e.isInteger())throw Error(a+"Exponent not an integer: "+z(e));if(null!=t&&(t=new W(t)),l=e.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!e.c||!e.c[0])return h=new W(Math.pow(+z(f),l?e.s*(2-w(e)):+z(e))),t?h.mod(t):h;if(d=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new W(NaN);(r=!d&&f.isInteger()&&t.isInteger())&&(f=f.mod(t))}else{if(e.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||l&&f.c[1]>=24e7:f.c[0]<8e13||l&&f.c[0]<=9999975e7)))return c=f.s<0&&w(e)?-0:0,f.e>-1&&(c=1/c),new W(d?1/c:c);U&&(c=s(U/u+2))}for(l?(n=new W(.5),d&&(e.s=1),p=w(e)):p=(o=Math.abs(+z(e)))%2,h=new W(O);;){if(p){if(!(h=h.times(f)).c)break;c?h.c.length>c&&(h.c.length=c):r&&(h=h.mod(t))}if(o){if(0===(o=i(o/2)))break;p=o%2}else if(V(e=e.times(n),e.e+1,1),e.e>14)p=w(e);else{if(0===(o=+z(e)))break;p=o%2}f=f.times(f),c?f.c&&f.c.length>c&&(f.c.length=c):r&&(f=f.mod(t))}return r?h:(d&&(h=O.div(h)),t?h.mod(t):c?V(h,U,x,undefined):h)},P.integerValue=function(e){var t=new W(this);return null==e?e=x:y(e,0,8),V(t,t.e+1,e)},P.isEqualTo=P.eq=function(e,t){return 0===g(this,new W(e,t))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(e,t){return g(this,new W(e,t))>0},P.isGreaterThanOrEqualTo=P.gte=function(e,t){return 1===(t=g(this,new W(e,t)))||0===t},P.isInteger=function(){return!!this.c&&f(this.e/u)>this.c.length-2},P.isLessThan=P.lt=function(e,t){return g(this,new W(e,t))<0},P.isLessThanOrEqualTo=P.lte=function(e,t){return-1===(t=g(this,new W(e,t)))||0===t},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(e,t){var n,r,s,i,a=this,o=a.s;if(t=(e=new W(e,t)).s,!o||!t)return new W(NaN);if(o!=t)return e.s=-t,a.plus(e);var l=a.e/u,d=e.e/u,p=a.c,h=e.c;if(!l||!d){if(!p||!h)return p?(e.s=-t,e):new W(h?a:NaN);if(!p[0]||!h[0])return h[0]?(e.s=-t,e):new W(p[0]?a:3==x?-0:0)}if(l=f(l),d=f(d),p=p.slice(),o=l-d){for((i=o<0)?(o=-o,s=p):(d=l,s=h),s.reverse(),t=o;t--;s.push(0));s.reverse()}else for(r=(i=(o=p.length)<(t=h.length))?o:t,o=t=0;t<r;t++)if(p[t]!=h[t]){i=p[t]<h[t];break}if(i&&(s=p,p=h,h=s,e.s=-e.s),(t=(r=h.length)-(n=p.length))>0)for(;t--;p[n++]=0);for(t=c-1;r>o;){if(p[--r]<h[r]){for(n=r;n&&!p[--n];p[n]=t);--p[n],p[r]+=c}p[r]-=h[r]}for(;0==p[0];p.splice(0,1),--d);return p[0]?Q(e,p,d):(e.s=3==x?-1:1,e.c=[e.e=0],e)},P.modulo=P.mod=function(e,t){var r,s,i=this;return e=new W(e,t),!i.c||!e.s||e.c&&!e.c[0]?new W(NaN):!e.c||i.c&&!i.c[0]?new W(i):(9==L?(s=e.s,e.s=1,r=n(i,e,0,3),e.s=s,r.s*=s):r=n(i,e,0,L),(e=i.minus(r.times(e))).c[0]||1!=L||(e.s=i.s),e)},P.multipliedBy=P.times=function(e,t){var n,r,s,i,a,o,l,d,h,m,g,y,w,b,v,T=this,S=T.c,_=(e=new W(e,t)).c;if(!(S&&_&&S[0]&&_[0]))return!T.s||!e.s||S&&!S[0]&&!_||_&&!_[0]&&!S?e.c=e.e=e.s=null:(e.s*=T.s,S&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=f(T.e/u)+f(e.e/u),e.s*=T.s,(l=S.length)<(m=_.length)&&(w=S,S=_,_=w,s=l,l=m,m=s),s=l+m,w=[];s--;w.push(0));for(b=c,v=p,s=m;--s>=0;){for(n=0,g=_[s]%v,y=_[s]/v|0,i=s+(a=l);i>s;)n=((d=g*(d=S[--a]%v)+(o=y*d+(h=S[a]/v|0)*g)%v*v+w[i]+n)/b|0)+(o/v|0)+y*h,w[i--]=d%b;w[i]=n}return n?++r:w.splice(0,1),Q(e,w,r)},P.negated=function(){var e=new W(this);return e.s=-e.s||null,e},P.plus=function(e,t){var n,r=this,s=r.s;if(t=(e=new W(e,t)).s,!s||!t)return new W(NaN);if(s!=t)return e.s=-t,r.minus(e);var i=r.e/u,a=e.e/u,o=r.c,l=e.c;if(!i||!a){if(!o||!l)return new W(s/0);if(!o[0]||!l[0])return l[0]?e:new W(o[0]?r:0*s)}if(i=f(i),a=f(a),o=o.slice(),s=i-a){for(s>0?(a=i,n=l):(s=-s,n=o),n.reverse();s--;n.push(0));n.reverse()}for((s=o.length)-(t=l.length)<0&&(n=l,l=o,o=n,t=s),s=0;t;)s=(o[--t]=o[t]+l[t]+s)/c|0,o[t]=c===o[t]?0:o[t]%c;return s&&(o=[s].concat(o),++a),Q(e,o,a)},P.precision=P.sd=function(e,t){var n,r,s,i=this;if(null!=e&&e!==!!e)return y(e,1,h),null==t?t=x:y(t,0,8),V(new W(i),e,t);if(!(n=i.c))return null;if(r=(s=n.length-1)*u+1,s=n[s]){for(;s%10==0;s/=10,r--);for(s=n[0];s>=10;s/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},P.shiftedBy=function(e){return y(e,-9007199254740991,l),this.times("1e"+e)},P.squareRoot=P.sqrt=function(){var e,t,r,s,i,a=this,o=a.c,c=a.s,u=a.e,l=j+4,d=new W("0.5");if(1!==c||!o||!o[0])return new W(!c||c<0&&(!o||o[0])?NaN:o?a:1/0);if(0==(c=Math.sqrt(+z(a)))||c==1/0?(((t=m(o)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=f((u+1)/2)-(u<0||u%2),r=new W(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new W(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=d.times(i.plus(n(a,i,l,1))),m(i.c).slice(0,c)===(t=m(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(s||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(V(r,r.e+j+2,1),e=!r.times(r).eq(a));break}if(!s&&(V(i,i.e+j+2,0),i.times(i).eq(a))){r=i;break}l+=4,c+=4,s=1}return V(r,r.e+j+1,x,e)},P.toExponential=function(e,t){return null!=e&&(y(e,0,h),e++),K(this,e,t,1)},P.toFixed=function(e,t){return null!=e&&(y(e,0,h),e=e+this.e+1),K(this,e,t)},P.toFormat=function(e,t,n){var r,s=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=q;else if("object"!=typeof n)throw Error(a+"Argument not an object: "+n);if(r=s.toFixed(e,t),s.c){var i,o=r.split("."),c=+n.groupSize,u=+n.secondaryGroupSize,l=n.groupSeparator||"",d=o[0],p=o[1],h=s.s<0,f=h?d.slice(1):d,m=f.length;if(u&&(i=c,c=u,u=i,m-=i),c>0&&m>0){for(i=m%c||c,d=f.substr(0,i);i<m;i+=c)d+=l+f.substr(i,c);u>0&&(d+=l+f.slice(i)),h&&(d="-"+d)}r=p?d+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?p.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):p):d}return(n.prefix||"")+r+(n.suffix||"")},P.toFraction=function(e){var t,r,s,i,o,c,l,p,h,f,g,y,w=this,b=w.c;if(null!=e&&(!(l=new W(e)).isInteger()&&(l.c||1!==l.s)||l.lt(O)))throw Error(a+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+z(l));if(!b)return new W(w);for(t=new W(O),h=r=new W(O),s=p=new W(O),y=m(b),o=t.e=y.length-w.e-1,t.c[0]=d[(c=o%u)<0?u+c:c],e=!e||l.comparedTo(t)>0?o>0?t:h:l,c=F,F=1/0,l=new W(y),p.c[0]=0;f=n(l,t,0,1),1!=(i=r.plus(f.times(s))).comparedTo(e);)r=s,s=i,h=p.plus(f.times(i=h)),p=i,t=l.minus(f.times(i=t)),l=i;return i=n(e.minus(r),s,0,1),p=p.plus(i.times(h)),r=r.plus(i.times(s)),p.s=h.s=w.s,g=n(h,s,o*=2,x).minus(w).abs().comparedTo(n(p,r,o,x).minus(w).abs())<1?[h,s]:[p,r],F=c,g},P.toNumber=function(){return+z(this)},P.toPrecision=function(e,t){return null!=e&&y(e,1,h),K(this,e,t,2)},P.toString=function(e){var t,n=this,r=n.s,s=n.e;return null===s?r?(t="Infinity",r<0&&(t="-"+t)):t="NaN":(null==e?t=s<=N||s>=R?b(m(n.c),s):v(m(n.c),s,"0"):10===e&&$?t=v(m((n=V(new W(n),j+s+1,x)).c),n.e,"0"):(y(e,2,H.length,"Base"),t=T(v(m(n.c),s,"0"),10,e,r,!0)),r<0&&n.c[0]&&(t="-"+t)),t},P.valueOf=P.toJSON=function(){return z(this)},P._isBigNumber=!0,null!=t&&W.set(t),W}(),n.default=n.BigNumber=n,"function"==typeof define&&define.amd?define(function(){return n}):void 0!==t&&t.exports?t.exports=n:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=n)}(this)}}},{package:"@metamask/bridge-status-controller>bignumber.js",file:"node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"}],[1548,{"@metamask/utils":4030,buffer:6265},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.isVaultUpdated=n.updateVaultWithDetail=n.updateVault=n.generateSalt=n.serializeBufferForStorage=n.serializeBufferFromStorage=n.keyFromPassword=n.exportKey=n.importKey=n.decryptWithKey=n.decryptWithDetail=n.decrypt=n.encryptWithKey=n.encryptWithDetail=n.encrypt=void 0;const r=e("@metamask/utils"),s="jwk",i="AES-GCM",a="utf-8",o={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function u(e,t,n,r=g(),s=c){const i=n||await m(e,r,!1,s),a=await d(i,t);return a.salt=r,JSON.stringify(a)}async function l(e,t,n=g(),r=c){const s=await m(e,n,!0,r),i=await f(s);return{vault:await u(e,t,s,n),exportedKeyString:i}}async function d(e,n){const r=JSON.stringify(n),s=t.from(r,a),o=globalThis.crypto.getRandomValues(new Uint8Array(16)),c=b(e),u=await globalThis.crypto.subtle.encrypt({name:i,iv:o},c,s),l=new Uint8Array(u),d=t.from(o).toString("base64"),p={data:t.from(l).toString("base64"),iv:d};return y(e)&&(p.keyMetadata=e.derivationOptions),p}async function p(e,t,n){const r=JSON.parse(t),{salt:s,keyMetadata:i}=r,a=b(n||await m(e,s,!1,i));return await h(a,r)}async function h(e,n){const r=t.from(n.data,"base64"),s=t.from(n.iv,"base64"),o=b(e);let c;try{const e=await crypto.subtle.decrypt({name:i,iv:s},o,r),n=new Uint8Array(e),u=t.from(n).toString(a);c=JSON.parse(u)}catch(e){throw new Error("Incorrect password")}return c}async function f(e){return y(e)?JSON.stringify({key:await globalThis.crypto.subtle.exportKey(s,e.key),derivationOptions:e.derivationOptions}):JSON.stringify(await globalThis.crypto.subtle.exportKey(s,e))}async function m(e,n,r=!1,s=o){const c=t.from(e,a),u=t.from(n,"base64"),l=await globalThis.crypto.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),d=await globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:s.params.iterations,hash:"SHA-256"},l,{name:i,length:256},r,["encrypt","decrypt"]);return s?{key:d,derivationOptions:s}:d}function g(e=32){const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);return btoa(String.fromCharCode.apply(null,t))}function y(e){return(0,r.isPlainObject)(e)&&(0,r.hasProperty)(e,"key")&&(0,r.hasProperty)(e,"derivationOptions")&&e.key instanceof CryptoKey&&w(e.derivationOptions)}function w(e){return(0,r.isPlainObject)(e)&&(0,r.hasProperty)(e,"algorithm")&&(0,r.hasProperty)(e,"params")}function b(e){return y(e)?e.key:e}function v(e,t=c){const{keyMetadata:n}=JSON.parse(e);return w(n)&&n.algorithm===t.algorithm&&n.params.iterations===t.params.iterations}n.encrypt=u,n.encryptWithDetail=l,n.encryptWithKey=d,n.decrypt=p,n.decryptWithDetail=async function(e,t){const n=JSON.parse(t),{salt:r,keyMetadata:s}=n,i=await m(e,r,!0,s);return{exportedKeyString:await f(i),vault:await p(e,t,i),salt:r}},n.decryptWithKey=h,n.importKey=async function(e){const t=JSON.parse(e);return n=t,(0,r.isPlainObject)(n)&&(0,r.hasProperty)(n,"key")&&(0,r.hasProperty)(n,"derivationOptions")&&w(n.derivationOptions)?{key:await globalThis.crypto.subtle.importKey(s,t.key,i,!0,["encrypt","decrypt"]),derivationOptions:t.derivationOptions}:await globalThis.crypto.subtle.importKey(s,t,i,!0,["encrypt","decrypt"]);var n},n.exportKey=f,n.keyFromPassword=m,n.serializeBufferFromStorage=function(e){const t="0x"===e.slice(0,2)?e.slice(2):e,n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const r=t.substr(e,2);n[e/2]=parseInt(r,16)}return n},n.serializeBufferForStorage=function(e){let t="0x";return e.forEach(e=>{t+=function(e){let t=e.toString(16);for(;t.length<2;)t=`0${t}`;return t}(e)}),t},n.generateSalt=g,n.updateVault=async function(e,t,n=c){return v(e,n)?e:u(t,await p(t,e),undefined,undefined,n)},n.updateVaultWithDetail=async function(e,t,n=c){return v(e.vault,n)?e:l(t,await p(t,e.vault),undefined,n)},n.isVaultUpdated=v}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/browser-passworder",file:"node_modules/@metamask/browser-passworder/dist/index.js"}],[155,{"../../../../shared/lib/trace":8732},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.addPersonalMessage=async function({signatureParams:e,signatureController:t}){return s(e,t,"newUnsignedPersonalMessage")},n.addTypedMessage=async function({signatureParams:e,signatureController:t}){return s(e,t,"newUnsignedTypedMessage")};var r=e("../../../../shared/lib/trace");async function s(e,t,n){const[s,i,a,o]=e,{id:c,method:u,params:l}=i,d={id:c,method:u,params:l,origin:a.get("origin"),networkClientId:a.get("networkClientId"),securityAlertResponse:a.get("securityAlertResponse")},p=c?.toString();(0,r.endTrace)({name:r.TraceName.Middleware,id:p});const h=await t[n](s,d,o);return(0,r.endTrace)({name:r.TraceName.Signature,id:p}),h}}}},{package:"$root$",file:"app/scripts/lib/signature/util.ts"}],[156,{"../../../../shared/constants/app":8502,"../../../../shared/constants/smartTransactions":8542,"../../../../shared/lib/conversion.utils":8593,"../../../../shared/lib/selectors":8700,"../../../../shared/lib/selectors/keyring":8701,"../../../../shared/lib/selectors/networks":8703,"../../../../shared/lib/transaction.utils":8734,"../transaction/util":204,"./utils":157,"@metamask/smart-transactions-controller":3558,"@metamask/transaction-controller":3915,loglevel:7191},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getSmartTransactionCommonParams=function(e,t){const n=function(e){return{metamask:e}}(e),r=t??(0,p.getCurrentChainId)(n),s=(0,l.getIsSmartTransaction)(n,t),i=(0,l.getSmartTransactionsFeatureFlagsForChain)(n,r),a=(0,d.isHardwareWallet)(n);return{isSmartTransaction:s,featureFlags:i,isHardwareWalletAccount:a}},n.submitSmartTransactionHook=n.submitBatchSmartTransactionHook=void 0;var r,s=e("@metamask/smart-transactions-controller"),i=e("@metamask/transaction-controller"),a=(r=e("loglevel"))&&r.__esModule?r:{default:r},o=e("../../../../shared/constants/app"),c=e("../../../../shared/constants/smartTransactions"),u=e("../../../../shared/lib/conversion.utils"),l=e("../../../../shared/lib/selectors"),d=e("../../../../shared/lib/selectors/keyring"),p=e("../../../../shared/lib/selectors/networks"),h=e("../../../../shared/lib/transaction.utils"),f=e("../transaction/util"),m=e("./utils");function g(e,t,n){y(e,t),t.set(e,n)}function y(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function w(e,t){return e.get(v(e,t))}function b(e,t,n){return e.set(v(e,t),n),n}function v(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var T=new WeakMap,S=new WeakMap,_=new WeakMap,k=new WeakMap,E=new WeakMap,I=new WeakMap,A=new WeakMap,C=new WeakMap,M=new WeakMap,P=new WeakMap,O=new WeakMap,j=new WeakMap,x=new WeakMap,N=new WeakMap,R=new WeakSet;class D{constructor(e){!function(e,t){y(e,t),t.add(e)}(this,R),g(this,T,void 0),g(this,S,void 0),g(this,_,void 0),g(this,k,void 0),g(this,E,void 0),g(this,I,void 0),g(this,A,void 0),g(this,C,void 0),g(this,M,void 0),g(this,P,void 0),g(this,O,void 0),g(this,j,void 0),g(this,x,void 0),g(this,N,void 0);const{transactionMeta:t,signedTransactionInHex:n,smartTransactionsController:r,transactionController:s,isSmartTransaction:c,controllerMessenger:u,featureFlags:l,transactions:d}=e;b(S,this,""),b(T,this,!1),b(P,this,t),b(O,this,n),b(C,this,r),b(M,this,s),b(A,this,c),b(k,this,u),b(E,this,l),b(I,this,t.origin!==o.ORIGIN_METAMASK),b(_,this,t.chainId),b(x,this,t.txParams),b(j,this,d);const p=Boolean(t.type!==i.TransactionType.bridge&&t.type!==i.TransactionType.shieldSubscriptionApprove&&t.type!==i.TransactionType.perpsDeposit&&t.type!==i.TransactionType.perpsDepositAndOrder||w(j,this)&&w(j,this).length>0);b(N,this,p),a.default.info("[SmartTransaction] shouldShowStatusPage:",w(N,this))}async submit(){const e=!!w(P,this).type&&[i.TransactionType.swapAndSend,i.TransactionType.swapApproval,i.TransactionType.bridgeApproval].includes(w(P,this).type),t={transactionHash:undefined};if(!w(A,this)||e||(0,h.isLegacyTransaction)(w(P,this)))return t;let n;if(!w(O,this)||!w(P,this).isGasFeeSponsored)try{n=await w(C,this).getFees({...w(x,this),chainId:w(_,this)},undefined,{networkClientId:w(P,this).networkClientId})}catch(e){return a.default.error("Error in smart transaction publish hook, falling back to regular transaction submission",e),v(R,this,L).call(this),t}try{const e=await v(R,this,W).call(this,{getFeesResponse:n}),t=e?.uuid;if(!t)throw new Error("No smart transaction UUID");await v(R,this,B).call(this,t);const r=w(E,this)?.extensionReturnTxHashAsap;let s;if(s=r&&e?.txHash?e.txHash:await v(R,this,$).call(this,{uuid:t}),null===s)throw new Error("Transaction does not have a transaction hash, there was a problem");return{transactionHash:s}}catch(e){throw a.default.error("Error in smart transaction publish hook",e),v(R,this,L).call(this),e}}async submitBatch(){if(!w(A,this))throw new Error("submitBatch: Smart Transaction is required for batch submissions");try{const e=await v(R,this,W).call(this),t=e?.uuid;if(!t)throw new Error("submitBatch: No smart transaction UUID");let n;await v(R,this,B).call(this,t),n=e?.txHashes?{results:e.txHashes.map(e=>({transactionHash:e}))}:{results:[]};const r=w(E,this)?.extensionReturnTxHashAsapBatch;if(r&&n?.results?.length>0)return n;if(null===await v(R,this,$).call(this,{uuid:t}))throw new Error("submitBatch: Transaction does not have a transaction hash, there was a problem");return n}catch(e){throw a.default.error("submitBatch: Error in smart transaction publish batch hook",e),v(R,this,L).call(this),e}}}function F(e){return{txType:e.type,client:(0,m.getClientForTransactionMetadata)(),clientVersion:(0,m.getClientVersionForTransactionMetadata)(),origin:(0,m.sanitizeOrigin)(e.origin)}}async function B(e){w(N,this)&&(v(R,this,U).call(this,{uuid:e}),v(R,this,H).call(this,{uuid:e}))}function L(){w(N,this)&&!w(T,this)&&b(T,this,!0)}function U({uuid:e}){const t=()=>{v(R,this,L).call(this)};b(S,this,e),w(k,this).call("ApprovalController:addRequest",{id:w(S,this),origin:origin,type:o.SMART_TRANSACTION_CONFIRMATION_TYPES.showSmartTransactionStatusPage,requestState:{smartTransaction:{status:s.SmartTransactionStatuses.PENDING,creationTime:Date.now(),uuid:e,chainId:w(_,this)},isDapp:w(I,this),txId:w(P,this).id}},!1).then(t,t)}async function q({smartTransaction:e}){return await w(k,this).call("ApprovalController:updateRequestState",{id:w(S,this),requestState:{smartTransaction:e,isDapp:w(I,this),txId:w(P,this).id}})}async function H({uuid:e}){w(k,this).subscribe("SmartTransactionsController:smartTransaction",async t=>{if(t.uuid===e){const{status:e}=t;if(!e||e===s.SmartTransactionStatuses.PENDING)return;w(T,this)||await v(R,this,q).call(this,{smartTransaction:t})}})}function $({uuid:e}){return new Promise(t=>{w(k,this).subscribe("SmartTransactionsController:smartTransaction",async n=>{if(n.uuid===e){const{status:e,statusMetadata:r}=n;if(!e||e===s.SmartTransactionStatuses.PENDING)return;a.default.debug("Smart Transaction: ",n),r?.minedHash?(a.default.debug("Smart Transaction - Received tx hash: ",r?.minedHash),t(r.minedHash)):t(null)}})})}async function W({getFeesResponse:e}={}){let t=[],n=[];if(w(j,this)&&Array.isArray(w(j,this))&&w(j,this).length>0)t=w(j,this).filter(e=>e?.signedTx).map(e=>{const t=(0,f.getTransactionById)(e.id??"",w(M,this)),n={tx:e.signedTx};return t&&(n.metadata=v(R,this,F).call(this,t)),n});else if(w(O,this))t=[{tx:w(O,this),metadata:v(R,this,F).call(this,w(P,this))}];else if(e){t=(await v(R,this,G).call(this,e.tradeTxFees?.fees??[],!1)).map(e=>({tx:e,metadata:v(R,this,F).call(this,w(P,this))}))}n=t.map(e=>e.tx);const r={signedTransactions:n,signedTransactionsWithMetadata:t,signedCanceledTransactions:[],txParams:w(x,this),transactionMeta:w(P,this),networkClientId:w(P,this).networkClientId};return await w(C,this).submitSignedTransactions(r)}function K(e,t){if(!w(x,this))throw new Error("Transaction params are required");const n={...w(x,this),maxFeePerGas:`0x${(0,u.decimalToHex)(e.maxFeePerGas)}`,maxPriorityFeePerGas:`0x${(0,u.decimalToHex)(e.maxPriorityFeePerGas)}`,gas:t?`0x${(0,u.decimalToHex)(c.CANCEL_GAS_LIMIT_DEC)}`:w(x,this).gas};return t&&(n.to=n.from,n.data="0x"),n}async function G(e,t){if(!w(x,this)||!w(_,this))throw new Error("Transaction params and chainId are required");const n=e.map(e=>v(R,this,K).call(this,e,t)).map(e=>({...e,chainId:e.chainId||w(_,this)}));return await w(M,this).approveTransactionsWithSameNonce(n,{hasNonce:!0})}n.submitSmartTransactionHook=e=>new D(e).submit();n.submitBatchSmartTransactionHook=e=>new D(e).submitBatch()}}},{package:"$root$",file:"app/scripts/lib/smart-transaction/smart-transactions.ts"}],[157,{"../../../../shared/constants/app":8502,"../../../../shared/constants/smartTransactions":8542,"../util":210},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sanitizeOrigin=n.getClientVersionForTransactionMetadata=n.getClientForTransactionMetadata=void 0;var r=e("../../../../shared/constants/app"),s=e("../../../../shared/constants/smartTransactions"),i=e("../util");n.getClientForTransactionMetadata=()=>(0,i.getPlatform)()===r.PLATFORM_FIREFOX?s.CLIENT_ID_EXTENSION_FIREFOX:s.CLIENT_ID_EXTENSION_CHROME;n.getClientVersionForTransactionMetadata=()=>"13.41.0";n.sanitizeOrigin=e=>{if(!e)return undefined;try{return new URL(e).hostname||e}catch{return e}}}}},{package:"$root$",file:"app/scripts/lib/smart-transaction/utils.ts"}],[1588,{"@metamask/polling-controller":3302,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.ConfigRegistryController=n.DEFAULT_POLLING_INTERVAL=void 0;const l=e("@metamask/polling-controller"),d=e("@metamask/utils");n.DEFAULT_POLLING_INTERVAL=(0,d.inMilliseconds)(1,d.Duration.Day);const p="configRegistryApiEnabled",h={configs:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!0,usedInUi:!0},version:{persist:!0,includeInStateLogs:!0,includeInDebugSnapshot:!0,usedInUi:!1},lastFetched:{persist:!0,includeInStateLogs:!0,includeInDebugSnapshot:!0,usedInUi:!1},etag:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!1}},f={},m=["startPolling","stopPolling"];class g extends((0,l.StaticIntervalPollingController)()){constructor({messenger:e,state:t={},pollingInterval:i=n.DEFAULT_POLLING_INTERVAL,fallbackConfig:a=f}){super({name:"ConfigRegistryController",metadata:h,messenger:e,state:{configs:{networks:t.configs?.networks??{...a}},version:t.version??null,lastFetched:t.lastFetched??null,etag:t.etag??null}}),r.add(this),this.setIntervalLength(i),this.messenger.registerMethodActionHandlers(this,m),u(this,r,"m",s).call(this)}async _executePoll(e){try{const e=await this.messenger.call("ConfigRegistryApiService:fetchConfig",{etag:this.state.etag??undefined});if(!e.modified)return void this.update(t=>{t.lastFetched=Date.now(),e.etag!==undefined&&(t.etag=e.etag??null)});const t=e.data.data.chains,n={};t.forEach(e=>{const{chainId:t}=e;n[t]=e}),this.update(t=>{t.configs.networks=n,t.version=e.data.data.version,t.lastFetched=Date.now(),t.etag=e.etag??null})}catch(e){const t=e instanceof Error?e:new Error(String(e));this.messenger.captureException?.(t)}}stopPolling(){super.stopAllPolling()}}n.ConfigRegistryController=g,r=new WeakSet,s=function(){this.messenger.subscribe("KeyringController:unlock",u(this,r,"m",i).bind(this)),this.messenger.subscribe("KeyringController:lock",u(this,r,"m",a).bind(this)),this.messenger.subscribe("RemoteFeatureFlagController:stateChange",u(this,r,"m",o).bind(this),e=>e.remoteFeatureFlags[p])},i=function(){u(this,r,"m",c).call(this)&&this.startPolling(null)},a=function(){this.stopAllPolling()},o=function(e){const{isUnlocked:t}=this.messenger.call("KeyringController:getState");"boolean"==typeof e&&e&&t?this.startPolling(null):this.stopAllPolling()},c=function(){const e=this.messenger.call("RemoteFeatureFlagController:getState").remoteFeatureFlags[p];return"boolean"==typeof e&&e}}}},{package:"@metamask/config-registry-controller",file:"node_modules/@metamask/config-registry-controller/dist/ConfigRegistryController.cjs"}],[1589,{"./types.cjs":1591,"@metamask/controller-utils":1602,"@metamask/profile-sync-controller":3357},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},u=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.ConfigRegistryApiService=n.serviceName=void 0;const l=e("@metamask/controller-utils"),d=e("@metamask/profile-sync-controller"),p=e("./types.cjs");n.serviceName="ConfigRegistryApiService";const h=["fetchConfig"];n.ConfigRegistryApiService=class{constructor({messenger:e,env:t=d.SDK.Env.UAT,fetch:p=globalThis.fetch,policyOptions:f={}}){r.set(this,void 0),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,null),this.name=n.serviceName,c(this,r,e,"f"),c(this,i,function(e){return`https://client-config.${e===d.SDK.Env.PRD?"":`${e}-`}api.cx.metamask.io/v1/config/networks`}(t),"f"),c(this,a,p,"f"),c(this,s,(0,l.createServicePolicy)(f),"f"),u(this,r,"f").registerMethodActionHandlers(this,h)}onRetry(e){return u(this,s,"f").onRetry(e)}onBreak(...e){return u(this,s,"f").onBreak(...e)}onDegraded(...e){return u(this,s,"f").onDegraded(...e)}async fetchConfig(e={}){const t={"Cache-Control":"no-cache"};e.etag&&(t["If-None-Match"]=e.etag);const n=await u(this,s,"f").execute(async()=>{const e=await u(this,a,"f").call(this,u(this,i,"f"),{headers:t});if(304===e.status)return e;if(!e.ok)throw new l.HttpError(e.status,`Failed to fetch config: ${e.status} ${e.statusText}`);return e});if(304===n.status){return{modified:!1,etag:n.headers.get("ETag")??undefined,...null!==u(this,o,"f")&&{data:u(this,o,"f")}}}const r=n.headers.get("ETag")??undefined,d=await n.json();return(0,p.validateRegistryConfigApiResponse)(d),c(this,o,d,"f"),{data:d,etag:r,modified:!0}}},r=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap}}},{package:"@metamask/config-registry-controller",file:"node_modules/@metamask/config-registry-controller/dist/config-registry-api-service/config-registry-api-service.cjs"}],[159,{"./snap-keyring":163,"./snap-keyring-v2":162,"./utils":164},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getAccountsBySnapId",{enumerable:!0,get:function(){return i.getAccountsBySnapId}}),Object.defineProperty(n,"snapKeyringBuilder",{enumerable:!0,get:function(){return r.snapKeyringBuilder}}),Object.defineProperty(n,"snapKeyringV2Builder",{enumerable:!0,get:function(){return s.snapKeyringV2Builder}});var r=e("./snap-keyring"),s=e("./snap-keyring-v2"),i=e("./utils")}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/index.ts"}],[1590,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.filterNetworks=void 0;const r=["isFeatured","isTestnet","isActive","isDeprecated","isDefault"];n.filterNetworks=function(e,t={}){return e.filter(e=>{const{config:n}=e;for(const e of r){const r=t[e];if(r!==undefined&&n[e]!==r)return!1}return!0})}}}},{package:"@metamask/config-registry-controller",file:"node_modules/@metamask/config-registry-controller/dist/config-registry-api-service/filters.cjs"}],[1591,{"@metamask/superstruct":3858},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateRegistryConfigApiResponse=n.RegistryConfigApiResponseSchema=n.RegistryNetworkConfigSchema=void 0;const r=e("@metamask/superstruct"),s=(0,r.type)({assetId:(0,r.string)(),imageUrl:(0,r.string)(),name:(0,r.string)(),symbol:(0,r.string)(),decimals:(0,r.number)(),coingeckoCoinId:(0,r.optional)((0,r.string)())}),i=(0,r.type)({listUrl:(0,r.optional)((0,r.string)()),native:s,governance:(0,r.optional)(s)}),a=(0,r.type)({url:(0,r.string)(),type:(0,r.string)(),networkClientId:(0,r.string)()}),o=(0,r.type)({default:a,fallbacks:(0,r.array)((0,r.string)())}),c=(0,r.type)({default:(0,r.string)(),fallbacks:(0,r.array)((0,r.string)())}),u=(0,r.type)({isActive:(0,r.boolean)(),isTestnet:(0,r.boolean)(),isDefault:(0,r.boolean)(),isFeatured:(0,r.boolean)(),isDeprecated:(0,r.boolean)(),isDeletable:(0,r.boolean)(),priority:(0,r.number)()});n.RegistryNetworkConfigSchema=(0,r.type)({chainId:(0,r.string)(),name:(0,r.string)(),imageUrl:(0,r.string)(),coingeckoPlatformId:(0,r.string)(),geckoTerminalPlatformId:(0,r.optional)((0,r.string)()),assets:i,rpcProviders:o,blockExplorerUrls:c,config:u}),n.RegistryConfigApiResponseSchema=(0,r.type)({data:(0,r.type)({version:(0,r.string)(),timestamp:(0,r.number)(),chains:(0,r.array)(n.RegistryNetworkConfigSchema)})}),n.validateRegistryConfigApiResponse=function(e){(0,r.assert)(e,n.RegistryConfigApiResponseSchema)}}}},{package:"@metamask/config-registry-controller",file:"node_modules/@metamask/config-registry-controller/dist/config-registry-api-service/types.cjs"}],[1592,{"./ConfigRegistryController.cjs":1588,"./config-registry-api-service/config-registry-api-service.cjs":1589,"./config-registry-api-service/filters.cjs":1590,"./selectors.cjs":1593},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.filterNetworks=n.ConfigRegistryApiService=n.selectNetworks=n.selectFeaturedNetworks=n.DEFAULT_POLLING_INTERVAL=n.ConfigRegistryController=void 0;var r=e("./ConfigRegistryController.cjs");Object.defineProperty(n,"ConfigRegistryController",{enumerable:!0,get:function(){return r.ConfigRegistryController}}),Object.defineProperty(n,"DEFAULT_POLLING_INTERVAL",{enumerable:!0,get:function(){return r.DEFAULT_POLLING_INTERVAL}});var s=e("./selectors.cjs");Object.defineProperty(n,"selectFeaturedNetworks",{enumerable:!0,get:function(){return s.selectFeaturedNetworks}}),Object.defineProperty(n,"selectNetworks",{enumerable:!0,get:function(){return s.selectNetworks}});var i=e("./config-registry-api-service/config-registry-api-service.cjs");Object.defineProperty(n,"ConfigRegistryApiService",{enumerable:!0,get:function(){return i.ConfigRegistryApiService}});var a=e("./config-registry-api-service/filters.cjs");Object.defineProperty(n,"filterNetworks",{enumerable:!0,get:function(){return a.filterNetworks}})}}},{package:"@metamask/config-registry-controller",file:"node_modules/@metamask/config-registry-controller/dist/index.cjs"}],[1593,{"./config-registry-api-service/filters.cjs":1590,reselect:7701},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.selectFeaturedNetworks=n.selectNetworks=void 0;const r=e("reselect"),s=e("./config-registry-api-service/filters.cjs");n.selectNetworks=e=>e.configs.networks,n.selectFeaturedNetworks=(0,r.createSelector)(n.selectNetworks,e=>{const t=Object.values(e),n=(0,s.filterNetworks)(t,{isFeatured:!0,isActive:!0,isTestnet:!1}),r={};return n.forEach(e=>{r[e.chainId]=e}),r})}}},{package:"@metamask/config-registry-controller",file:"node_modules/@metamask/config-registry-controller/dist/selectors.cjs"}],[16,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.PREINSTALLED_SNAPS_URLS=void 0;n.PREINSTALLED_SNAPS_URLS=[new URL("/snaps/bitcoin-wallet-snap.json",self.document?.baseURI||self.location.href),new URL("/snaps/solana-wallet-snap.json",self.document?.baseURI||self.location.href),new URL("/snaps/tron-wallet-snap.json",self.document?.baseURI||self.location.href),new URL("/snaps/permissions-kernel-snap.json",self.document?.baseURI||self.location.href),new URL("/snaps/gator-permissions-snap.json",self.document?.baseURI||self.location.href),new URL("/snaps/message-signing-snap.json",self.document?.baseURI||self.location.href),new URL("/snaps/ens-resolver-snap.json",self.document?.baseURI||self.location.href),new URL("/snaps/institutional-wallet-snap.json",self.document?.baseURI||self.location.href)]}}},{package:"$root$",file:"app/scripts/constants/snaps.ts"}],[160,{"../../../../shared/lib/build-types":8588,"@metamask/keyring-api":2747,"@metamask/permission-controller":3129},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isProtocolAllowed=d,n.keyringSnapPermissionsBuilder=function(e,t){return()=>{if("metamask"===t)return o;if(a.includes(t))return u;const n=e.getSubjectMetadata(t);return n?.subjectType===s.SubjectType.Website&&d(t)?c:[]}};var r=e("@metamask/keyring-api"),s=e("@metamask/permission-controller"),i=e("../../../../shared/lib/build-types");const a=["https://app.metamask.io",...(0,i.isFlask)()?["https://dev.app.metamask.io","https://stage.app.metamask.io","https://ramps-dev.app.metamask.io","https://portfolio-builds.metafi-dev.codefi.network"]:[]],o=[r.KeyringRpcMethod.ListAccounts,r.KeyringRpcMethod.GetAccount,r.KeyringRpcMethod.CreateAccount,r.KeyringRpcMethod.CreateAccounts,r.KeyringRpcMethod.FilterAccountChains,r.KeyringRpcMethod.DeleteAccount,r.KeyringRpcMethod.ListRequests,r.KeyringRpcMethod.GetRequest,r.KeyringRpcMethod.SubmitRequest,r.KeyringRpcMethod.RejectRequest,r.KeyringRpcMethod.ResolveAccountAddress,r.KeyringRpcMethod.SetSelectedAccounts],c=[r.KeyringRpcMethod.ListAccounts,r.KeyringRpcMethod.GetAccount,r.KeyringRpcMethod.CreateAccount,r.KeyringRpcMethod.FilterAccountChains,r.KeyringRpcMethod.UpdateAccount,r.KeyringRpcMethod.DeleteAccount,r.KeyringRpcMethod.ExportAccount,r.KeyringRpcMethod.ListRequests,r.KeyringRpcMethod.GetRequest,r.KeyringRpcMethod.ApproveRequest,r.KeyringRpcMethod.RejectRequest],u=[r.KeyringRpcMethod.ListAccounts,r.KeyringRpcMethod.GetAccount,r.KeyringRpcMethod.GetAccountBalances,r.KeyringRpcMethod.SubmitRequest],l=["https:",...(0,i.isFlask)()?["http:"]:[]];function d(e){try{const t=new URL(e);return l.includes(t.protocol)}catch(e){return!1}}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/keyring-snaps-permissions.ts"}],[161,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getSnapAndHardwareInfoForMetrics=async function(e,t,n,r){if(!r)return{};const s=r.call("AccountsController:getSelectedAccount"),i=s.address;let a;s.metadata.snap?.id&&(a=r.call("SnapController:getSnap",s.metadata.snap?.id));let o={};const{isUnlocked:c}=r.call("KeyringController:getState");if(c){o={account_type:await e(i),device_model:await t(i)};const r=await n(i);r&&(o={...o,account_hardware_type:r})}return{...o,account_snap_type:a?.id,account_snap_version:a?.version}}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/metrics.ts"}],[162,{"../../../../shared/lib/build-types":8588,"../../messenger-client-init/messengers/accounts/snap-keyring-builder-messenger":272,"./snap-keyring":163,"@metamask/eth-snap-keyring/v2":2531,"@metamask/keyring-api/v2":2770,"@metamask/keyring-sdk/v2":2815,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SnapKeyringV2Impl=void 0,n.getSnapKeyringV2BuilderMessenger=function(e){return(0,c.getSnapKeyringBuilderMessenger)(e)},n.snapKeyringV2AdaptedAsV1Builder=function(e){const t=()=>{const t=new r.SnapKeyring({messenger:e,callbacks:new l(e),isAnyAccountTypeAllowed:(0,o.isFlask)()});return new r.SnapKeyringV1Adapter(t)};return t.type=i.KeyringType.Snap,t},n.snapKeyringV2Builder=function(){const e=e=>((0,a.assert)(e instanceof s.KeyringV1Adapter,"Expected KeyringV1Adapter instance (that wraps a SnapKeyringV2)"),e.unwrap());return e.type=i.KeyringType.Snap,e};var r=e("@metamask/eth-snap-keyring/v2"),s=e("@metamask/keyring-sdk/v2"),i=e("@metamask/keyring-api/v2"),a=e("@metamask/utils"),o=e("../../../../shared/lib/build-types"),c=e("../../messenger-client-init/messengers/accounts/snap-keyring-builder-messenger"),u=e("./snap-keyring");class l extends u.SnapKeyringImpl{async assertAccountCanBeUsed(e){}}n.SnapKeyringV2Impl=l}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/snap-keyring-v2.ts"}],[163,{"../../../../shared/constants/app":8502,"../../../../shared/constants/metametrics":8524,"../../../../shared/lib/accounts/snaps":8566,"../../../../shared/lib/build-types":8588,"../../../../shared/lib/snaps/snaps":8717,"../../../../shared/lib/translate":8740,"../../../../ui/components/component-library/icon":9500,"../../controllers/analytics":21,"../../messenger-client-init/messengers/accounts/snap-keyring-builder-messenger":272,"./utils/isBlockedUrl":165,"./utils/showResult":166,"@metamask/eth-snap-keyring":2504,"@metamask/snaps-utils":3822,"webextension-polyfill":8489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SnapKeyringImpl=void 0,Object.defineProperty(n,"getSnapKeyringBuilderMessenger",{enumerable:!0,get:function(){return y.getSnapKeyringBuilderMessenger}}),n.showAccountCreationDialog=T,n.snapKeyringBuilder=function(e){const t=()=>new s.SnapKeyring({messenger:e,callbacks:new k(e),isAnyAccountTypeAllowed:(0,h.isFlask)()});return t.type=s.SnapKeyring.type,t};var r,s=e("@metamask/eth-snap-keyring"),i=(r=e("webextension-polyfill"))&&r.__esModule?r:{default:r},a=e("@metamask/snaps-utils"),o=e("../../../../shared/constants/metametrics"),c=e("../../../../shared/constants/app"),u=e("../../../../shared/lib/translate"),l=e("../../../../ui/components/component-library/icon"),d=e("../../../../shared/lib/snaps/snaps"),p=e("../../../../shared/lib/accounts/snaps"),h=e("../../../../shared/lib/build-types"),f=e("../../controllers/analytics"),m=e("./utils/isBlockedUrl"),g=e("./utils/showResult"),y=e("../../messenger-client-init/messengers/accounts/snap-keyring-builder-messenger");function w(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function b(e,t){return e.get(v(e,t))}function v(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}async function T(e,t){try{return Boolean(await t.call("ApprovalController:addRequest",{origin:e,type:c.SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation},!0))}catch(e){throw new Error(`Error occurred while showing account creation dialog.\n${e}`)}}var S=new WeakMap,_=new WeakSet;class k{constructor(e){var t,n,r;!function(e,t){w(e,t),t.add(e)}(this,_),function(e,t,n){w(e,t),t.set(e,n)}(this,S,void 0),n=this,r=e,(t=S).set(v(t,n),r)}async addressExists(e){return(await b(S,this).call("KeyringController:getAccounts")).includes(e.toLowerCase())}async redirectUser(e,t,n){if(t.length>0||n.length>0){const r=await(0,m.isBlockedUrl)(t,async()=>await b(S,this).call("PhishingController:maybeUpdateState"),e=>b(S,this).call("PhishingController:testOrigin",e)),s=await b(S,this).call("ApprovalController:addRequest",{origin:e,requestData:{url:t,message:n,isBlockedUrl:r},type:c.SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showSnapAccountRedirect},!0);Boolean(s)&&t.length>0?i.default.tabs.create({url:t}):console.log("User refused snap account redirection to:",t)}else console.log("Error occurred when redirecting snap account. url or message must be defined")}async saveState(){await b(S,this).call("KeyringController:persistAllKeyrings"),await b(S,this).call("AccountsController:updateAccounts")}async addAccount(e,t,n,r,i,{displayConfirmation:o,setSelectedAccount:c}=(0,s.getDefaultInternalOptions)()){(0,a.assertIsValidSnapId)(t);const u=(0,d.isSnapPreinstalled)(t);let l=u&&(0,p.isMultichainWalletSnap)(t);const h=l||u&&!o,f=l||u&&!c,m=h;await v(_,this,I).call(this,{snapId:t,skipConfirmationDialog:h,skipApprovalFlow:m,handleUserInput:n}),v(_,this,A).call(this,{address:e,snapId:t,skipConfirmationDialog:h,skipSetSelectedAccountStep:f,skipApprovalFlow:m,onceSaved:r})}async removeAccount(e,t,n){(0,a.assertIsValidSnapId)(t);const r=(0,p.getSnapName)(t,b(S,this)),{id:s}=b(S,this).call("ApprovalController:startFlow"),i="https://support.metamask.io/managing-my-wallet/accounts-and-addresses/how-to-remove-an-account-from-your-metamask-wallet/?utm_source=extension",d=e=>{(0,f.trackEvent)((0,f.createEventBuilder)(e).addCategory(o.MetaMetricsEventCategory.Accounts).addProperties({account_type:o.MetaMetricsEventAccountType.Snap,snap_id:t,snap_name:r}).build())};let h=!1;try{if(h=Boolean(await b(S,this).call("ApprovalController:addRequest",{origin:t,type:c.SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountRemoval,requestData:{publicAddress:e}},!0)),!h)throw await n(h),new Error("User denied account removal");try{await b(S,this).call("LegacyBackgroundApiService:removeAccount",e),await n(h),await this.saveState(),d(o.MetaMetricsEventName.RemoveSnapAccountSuccessViewed),await(0,g.showError)(b(S,this),t,{icon:l.IconName.UserCircleRemove,title:(0,u.t)("snapAccountRemoved")},{message:(0,u.t)("snapAccountRemovedDescription"),learnMoreLink:i}),d(o.MetaMetricsEventName.RemoveSnapAccountSuccessClicked)}catch(e){const n=e.message;throw await(0,g.showError)(b(S,this),t,{icon:l.IconName.UserCircleRemove,title:(0,u.t)("snapAccountRemovalFailed")},{message:(0,u.t)("snapAccountRemovalFailedDescription",r),learnMoreLink:i,error:n}),d(o.MetaMetricsEventName.AccountRemoveFailed),new Error(`Error occurred while removing snap account: ${n}`)}}finally{h&&d(o.MetaMetricsEventName.AccountRemoved),b(S,this).call("ApprovalController:endFlow",{id:s})}}}async function E(e){const{id:t}=b(S,this).call("ApprovalController:startFlow");try{return await e(t)}finally{b(S,this).call("ApprovalController:endFlow",{id:t})}}async function I({snapId:e,skipConfirmationDialog:t,skipApprovalFlow:n,handleUserInput:r}){return n?await r(!0):await v(_,this,E).call(this,async n=>{const s=t||await T(e,b(S,this));if(await r(s),!s)throw new Error("User denied account creation")})}async function A({address:e,snapId:t,skipConfirmationDialog:n,skipSetSelectedAccountStep:r,skipApprovalFlow:s,onceSaved:i}){const a="https://support.metamask.io/managing-my-wallet/accounts-and-addresses/how-to-add-accounts-in-your-wallet/?utm_source=extension",c=(0,p.getSnapName)(t,b(S,this)),d=e=>{(0,f.trackEvent)((0,f.createEventBuilder)(e).addCategory(o.MetaMetricsEventCategory.Accounts).addProperties({account_type:o.MetaMetricsEventAccountType.Snap,snap_id:t,snap_name:c,...e===o.MetaMetricsEventName.AccountAdded&&{is_suggested_name:!1}}).build())},h=async()=>{try{const s=await i;r||b(S,this).call("AccountsController:setSelectedAccount",s),n||(d(o.MetaMetricsEventName.AddSnapAccountSuccessViewed),await(0,g.showSuccess)(b(S,this),t,{icon:l.IconName.UserCircleAdd,title:(0,u.t)("snapAccountCreated")},{message:(0,u.t)("snapAccountCreatedDescription"),address:e,learnMoreLink:a}),d(o.MetaMetricsEventName.AddSnapAccountSuccessClicked)),d(o.MetaMetricsEventName.AccountAdded)}catch(e){const n=e.message;await(0,g.showError)(b(S,this),t,{icon:l.IconName.UserCircleAdd,title:(0,u.t)("snapAccountCreationFailed")},{message:(0,u.t)("snapAccountCreationFailedDescription",c),learnMoreLink:a,error:n}),console.error("Error occurred while creating snap account:",n)}};s?await h():await v(_,this,E).call(this,h)}n.SnapKeyringImpl=k}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/snap-keyring.ts"}],[164,{"@metamask/eth-snap-keyring/v2":2531},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getAccountsBySnapId=void 0;var r=e("@metamask/eth-snap-keyring/v2");n.getAccountsBySnapId=async(e,t)=>{try{return await e.call("KeyringController:withKeyringV2",{filter:e=>(0,r.isSnapKeyring)(e)&&e.snapId===t},async({keyring:e})=>{if(!(0,r.isSnapKeyring)(e))return[];return(await e.getAccounts()).map(e=>e.address)})}catch{return[]}}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/utils.ts"}],[1649,{"./utils.cjs":1652,"@metamask/base-controller":1480,"@metamask/keyring-controller":1656,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},i=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=n.controllerName=void 0;const a=e("@metamask/base-controller"),o=e("@metamask/keyring-controller"),c=e("@metamask/utils"),u=e("./utils.cjs");n.controllerName="DelegationController";const l=["signDelegation"],d={};class p extends a.BaseController{constructor({messenger:e,state:t,getDelegationEnvironment:i}){super({messenger:e,metadata:d,name:n.controllerName,state:{...t}}),r.set(this,void 0),s(this,r,i,"f"),this.messenger.registerMethodActionHandlers(this,l)}async signDelegation(e){const{delegation:t,chainId:n}=e,{DelegationManager:s}=i(this,r,"f").call(this,n),a=(0,u.createTypedMessageParams)({chainId:(0,c.hexToNumber)(n),from:t.delegator,delegation:{...t,signature:"0x"},verifyingContract:s});return await this.messenger.call("KeyringController:signTypedMessage",a,o.SignTypedDataVersion.V4)}}n.DelegationController=p,r=new WeakMap}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"}],[165,{"../keyring-snaps-permissions":160},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isBlockedUrl=void 0;var r=e("../keyring-snaps-permissions");n.isBlockedUrl=async(e,t,n)=>{try{return!(0,r.isProtocolAllowed)(e)||(await t(),n(e).result)}catch(e){return console.error("Invalid URL passed into snap-keyring:",e),!1}}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/utils/isBlockedUrl.ts"}],[1650,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SIGNABLE_DELEGATION_TYPED_DATA=n.ROOT_AUTHORITY=void 0,n.ROOT_AUTHORITY="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";n.SIGNABLE_DELEGATION_TYPED_DATA={EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Caveat:[{name:"enforcer",type:"address"},{name:"terms",type:"bytes"}],Delegation:[{name:"delegate",type:"address"},{name:"delegator",type:"address"},{name:"authority",type:"bytes32"},{name:"caveats",type:"Caveat[]"},{name:"salt",type:"uint256"}]}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/constants.cjs"}],[1651,{"./DelegationController.cjs":1649},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=void 0;var r=e("./DelegationController.cjs");Object.defineProperty(n,"DelegationController",{enumerable:!0,get:function(){return r.DelegationController}})}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/index.cjs"}],[1652,{"./constants.cjs":1650,"@metamask/utils":4030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createTypedMessageParams=n.toDelegationStruct=void 0;const r=e("@metamask/utils"),s=e("./constants.cjs");n.toDelegationStruct=e=>{const t=e.caveats.map(e=>({enforcer:(0,r.getChecksumAddress)(e.enforcer),terms:e.terms,args:e.args})),n="0x"===e.salt?0n:BigInt(e.salt);return{delegate:(0,r.getChecksumAddress)(e.delegate),delegator:(0,r.getChecksumAddress)(e.delegator),authority:e.authority,caveats:t,salt:n,signature:e.signature}},n.createTypedMessageParams=function(e){const{chainId:t,from:r,delegation:i,verifyingContract:a}=e;return{data:{types:s.SIGNABLE_DELEGATION_TYPED_DATA,primaryType:"Delegation",domain:{chainId:t,name:"DelegationManager",version:"1",verifyingContract:a},message:(0,n.toDelegationStruct)(i)},from:r}}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/utils.cjs"}]],[],{});