LavaPack.loadBundle([[977,{_process:7741},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(e){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Sha1=r.RANDOM_FACTOR=r.MAX_VALUE_MILLIS=r.FirebaseError=r.ErrorFactory=r.Deferred=r.DecodeBase64StringError=r.CONSTANTS=void 0,r.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.
 */,r.assertionError=r.assert=void 0,r.async=function(e,t){return(...r)=>{Promise.resolve(!0).then(()=>{e(...r)}).catch(e=>{t&&t(e)})}},r.base64urlEncodeWithoutPadding=r.base64Encode=r.base64Decode=r.base64=void 0,r.calculateBackoffMillis=function(e,t=N,r=P){const n=t*Math.pow(r,e),o=Math.round(k*n*(Math.random()-.5)*2);return Math.min(I,n+o)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,r.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.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 r=t||"demo-project",n=e.iat||0,o=e.sub||e.user_id;if(!o)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:n,exp:n+3600,auth_time:n,sub:o,user_id:o,firebase:{sign_in_provider:"custom",identities:{}}},e);return[c(JSON.stringify({alg:"none",type:"JWT"})),c(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.
 */,r.createSubscribe=function(e,t){const r=new O(e,t);return r.subscribe.bind(r)},r.decode=void 0,r.deepCopy=function(e){return f(undefined,e)},r.deepEqual=function e(t,r){if(t===r)return!0;const n=Object.keys(t),o=Object.keys(r);for(const i of n){if(!o.includes(i))return!1;const n=t[i],a=r[i];if(T(n)&&T(a)){if(!e(n,a))return!1}else if(n!==a)return!1}for(const e of o)if(!n.includes(e))return!1;return!0},r.deepExtend=f,r.errorPrefix=C,r.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const r=e.indexOf("#",t);return e.substring(t,r>0?r: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.
 */,r.getExperimentalSetting=r.getDefaults=r.getDefaultEmulatorHostnameAndPort=r.getDefaultEmulatorHost=r.getDefaultAppConfig=void 0,r.getGlobal=p,r.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},r.getUA=b,r.isAdmin=void 0,r.isBrowser=function(){return"undefined"!=typeof window||v()},r.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},r.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},r.isElectron=function(){return b().indexOf("Electron/")>=0},r.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},r.isIE=function(){const e=b();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},r.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},r.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(b())},r.isNode=y,r.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},r.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},r.isSafari=function(){return!y()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},r.isUWP=function(){return b().indexOf("MSAppHost/")>=0},r.isValidTimestamp=r.isValidFormat=void 0,r.isWebWorker=v,r.issuedAtTime=void 0,r.jsonEval=S,r.map=function(e,t,r){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=t.call(r,e[o],o,e));return n},r.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 r=e%10;if(1===r)return"st";if(2===r)return"nd";if(3===r)return"rd";return"th"}(e)},r.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 r=new g;return setTimeout(()=>r.reject("timeout!"),t),e.then(r.resolve,r.reject),r.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.
 */,r.querystring=function(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""},r.querystringDecode=function(e){const t={},r=e.replace(/^\?/,"").split("&");return r.forEach(e=>{if(e){const[r,n]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(n)}}),t},r.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},r.stringToByteArray=r.stringLength=void 0,r.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.
 */,r.validateArgCount=void 0,r.validateCallback=function(e,t,r,n){if(n&&!r)return;if("function"!=typeof r)throw new Error(C(e,t)+"must be a valid function.")},r.validateContextObject=function(e,t,r,n){if(n&&!r)return;if("object"!=typeof r||null===r)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.
 */,r.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(n);o.onsuccess=()=>{o.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},o.onupgradeneeded=()=>{r=!1},o.onerror=()=>{var e;t((null===(e=o.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},r.validateNamespace=function(e,t,r){if(r&&!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=r.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},n=function(e,t){if(!e)throw o(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.
 */r.assert=n;const o=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.
 */r.assertionError=o;const i=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=63&o|128):55296==(64512&o)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=63&o|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=63&o|128)}return t},a=r.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 r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const o=e[t],i=t+1<e.length,a=i?e[t+1]:0,s=t+2<e.length,l=s?e[t+2]:0,c=o>>2,u=(3&o)<<4|a>>4;let f=(15&a)<<2|l>>6,d=63&l;s||(d=64,i||(f=64)),n.push(r[c],r[u],r[f],r[d])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const o=e[r++];if(o<128)t[n++]=String.fromCharCode(o);else if(o>191&&o<224){const i=e[r++];t[n++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){const i=((7&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}else{const i=e[r++],a=e[r++];t[n++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const o=r[e.charAt(t++)],i=t<e.length?r[e.charAt(t)]:0;++t;const a=t<e.length?r[e.charAt(t)]:64;++t;const l=t<e.length?r[e.charAt(t)]:64;if(++t,null==o||null==i||null==a||null==l)throw new s;const c=o<<2|i>>4;if(n.push(c),64!==a){const e=i<<4&240|a>>2;if(n.push(e),64!==l){const e=a<<6&192|l;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}r.DecodeBase64StringError=s;const l=function(e){const t=i(e);return a.encodeByteArray(t,!0)};r.base64Encode=l;const c=function(e){return l(e).replace(/\./g,"")};r.base64urlEncodeWithoutPadding=c;const u=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 f(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 r in t)t.hasOwnProperty(r)&&d(r)&&(e[r]=f(e[r],t[r]));return e}function d(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 p(){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.
 */r.base64Decode=u;const h=()=>{try{return p().__FIREBASE_DEFAULTS__||(()=>{if(void 0===e||void 0===e.env)return})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&u(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};r.getDefaults=h;const m=e=>{var t,r;return null===(r=null===(t=h())||void 0===t?void 0:t.emulatorHosts)||void 0===r?void 0:r[e]};r.getDefaultEmulatorHost=m;r.getDefaultEmulatorHostnameAndPort=e=>{const t=m(e);if(!t)return undefined;const r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(r+1),10);return"["===t[0]?[t.substring(1,r-1),n]:[t.substring(0,r),n]};r.getDefaultAppConfig=()=>{var e;return null===(e=h())||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.
 */
r.getExperimentalSetting=e=>{var t;return null===(t=h())||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,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,r))}}}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function b(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function y(){var e;const t=null===(e=h())||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 v(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}r.Deferred=g;class E extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,E.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_.prototype.create)}}r.FirebaseError=E;class _{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,o=this.errors[e],i=o?function(e,t){return e.replace(w,(e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`})}(o,r):"Error",a=`${this.serviceName}: ${i} (${n}).`;return new E(n,a,r)}}r.ErrorFactory=_;const w=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function S(e){return JSON.parse(e)}const M=function(e){let t={},r={},n={},o="";try{const i=e.split(".");t=S(u(i[0])||""),r=S(u(i[1])||""),o=i[2],n=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:n,signature:o}};r.decode=M;r.isValidTimestamp=function(e){const t=M(e).claims,r=Math.floor((new Date).getTime()/1e3);let n=0,o=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?n=t.nbf:t.hasOwnProperty("iat")&&(n=t.iat),o=t.hasOwnProperty("exp")?t.exp:n+86400),!!r&&!!n&&!!o&&r>=n&&r<=o};r.issuedAtTime=function(e){const t=M(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};r.isValidFormat=function(e){const t=M(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function T(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.
 */
r.isAdmin=function(e){const t=M(e).claims;return"object"==typeof t&&!0===t.admin};r.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 r=this.W_;if("string"==typeof e)for(let n=0;n<16;n++)r[n]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let n=0;n<16;n++)r[n]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=r[e-3]^r[e-8]^r[e-14]^r[e-16];r[e]=4294967295&(t<<1|t>>>31)}let n,o,i=this.chain_[0],a=this.chain_[1],s=this.chain_[2],l=this.chain_[3],c=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=l^a&(s^l),o=1518500249):(n=a^s^l,o=1859775393):e<60?(n=a&s|l&(a|s),o=2400959708):(n=a^s^l,o=3395469782);const t=(i<<5|i>>>27)+n+c+o+r[e]&4294967295;c=l,l=s,s=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]+s&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const r=t-this.blockSize;let n=0;const o=this.buf_;let i=this.inbuf_;for(;n<t;){if(0===i)for(;n<=r;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(o[i]=e.charCodeAt(n),++i,++n,i===this.blockSize){this.compress_(o),i=0;break}}else for(;n<t;)if(o[i]=e[n],++i,++n,i===this.blockSize){this.compress_(o),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 r=0;for(let t=0;t<5;t++)for(let n=24;n>=0;n-=8)e[r]=this.chain_[t]>>n&255,++r;return e}};class O{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,r){let n;if(e===undefined&&t===undefined&&r===undefined)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r},n.next===undefined&&(n.next=A),n.error===undefined&&(n.error=A),n.complete===undefined&&(n.complete=A);const o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),o}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 `}r.validateArgCount=function(e,t,r,n){let o;if(n<t?o="at least "+t:n>r&&(o=0===r?"none":"no more than "+r),o){throw new Error(e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+o+".")}};r.stringToByteArray=function(e){const t=[];let r=0;for(let o=0;o<e.length;o++){let i=e.charCodeAt(o);if(i>=55296&&i<=56319){const t=i-55296;o++,n(o<e.length,"Surrogate pair missing trail surrogate.");i=65536+(t<<10)+(e.charCodeAt(o)-56320)}i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):i<65536?(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=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.
 */
r.stringLength=function(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);n<128?t++:n<2048?t+=2:n>=55296&&n<=56319?(t+=4,r++):t+=3}return t};const N=1e3,P=2,I=r.MAX_VALUE_MILLIS=144e5,k=r.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"}],[98,{lodash:7447},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return o((0,n.cloneDeep)(e),e=>null===e?"null":typeof e)};var n=e("lodash");function o(e={},t){return Object.entries(e).forEach(([r,n])=>{e[r]="object"==typeof n&&null!==n?o(n,t):t(n)}),e}}}},{package:"$root$",file:"app/scripts/lib/getObjStructure.js"}],[981,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});class n{static parse(e){if(""===e)return new n([]);if(!e.startsWith("/"))throw new o(e);const[,...t]=e.split("/");return new n(t.map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~")))}constructor(e){this.tokens=e}toString(){if(0===this.tokens.length)return"";return`/${this.tokens.map(e=>e.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`}shmeval(e){for(const t of this.tokens){if(!e.hasOwnProperty(t))throw new i(e,t);e=e[t]}return e}}r.default=n;class o extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}r.InvalidPtrError=o;class i extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}r.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"}],[982,{"@json-schema-tools/reference-resolver":987,"@json-schema-tools/traverse":990,"fast-safe-stringify":6871},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.NonStringRefError=void 0;var s=a(e("@json-schema-tools/traverse")),l=a(e("@json-schema-tools/reference-resolver")),c=a(e("fast-safe-stringify")),u=function(e){this.name="NonStringRefError",this.message=["NonStringRefError","Found an improperly formatted $ref in schema. $ref must be a string","schema in question: ".concat((0,c.default)(e))].join("\n")};r.NonStringRefError=u;var f=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var r=n(n({},t),e);return delete r.$ref,r}return t},d=function(){function e(e,t){var r;if(void 0===t&&(t={}),this.options=t,this.refCache={},r=!0===this.options.mutate||!0===e||!1===e?e:n({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=r),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=r),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var o=0,i=Object.keys(this.options.protocolHandlerMap);o<i.length;o++){var a=i[o];l.default.protocolHandlerMap[a]=this.options.protocolHandlerMap[a]}this.schema=r,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return o(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 o(this,void 0,void 0,function(){var t,r,o,a,c,u,d,p,h,m,g,b=this;return i(this,function(i){switch(i.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return b.refCache[e]===undefined}),r=[],o=0,a=t,i.label=1;case 1:return o<a.length?(c=a[o],u=void 0,this.refCache[c]===undefined?[3,2]:(u=this.refCache[c],[3,5])):[3,11];case 2:if("#"!==c)return[3,3];if(this.options.rootSchema===undefined)throw new Error("options.rootSchema was not provided, but one of the schemas references '#'");return u=this.options.rootSchema,[3,5];case 3:return d=l.default.resolve(c,this.options.rootSchema),r.push(d),[4,d];case 4:u=i.sent(),i.label=5;case 5:return!0!==this.options.recursive||!0===u||!1===u||"#"===c?[3,9]:(p=n(n({},this.options),{refCache:this.refCache}),0===(h=new e(u,p)).refs.length?[3,7]:(m=h._resolve(),r.push(m),[4,m]));case 6:return g=i.sent(),this.refCache[c]=f(u,g),[3,8];case 7:this.refCache[c]=u,i.label=8;case 8:return[3,10];case 9:this.refCache[c]=u,i.label=10;case 10:return o++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=f(this.schema,this.refCache[this.schema.$ref]):(0,s.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=b.refCache[e.$ref];return f(e,t)}return e},{mutable:!0}),[4,Promise.all(r)];case 12:return i.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,s.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new u(t);e.push(t.$ref)}return t}),e},e}();r.default=d}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],[983,{"./dereferencer":982},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.NonStringRefError=void 0;var o=n(e("./dereferencer")),i=e("./dereferencer");Object.defineProperty(r,"NonStringRefError",{enumerable:!0,get:function(){return i.NonStringRefError}}),r.default=o.default}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/index.js"}],[984,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.jsonSchema=void 0,r.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:[]}}},r.default=r.jsonSchema}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/meta-schema",file:"node_modules/@json-schema-tools/meta-schema/index.js"}],[985,{"./errors":986,"isomorphic-fetch":7173},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var a=e("./errors"),s=i(e("isomorphic-fetch")),l=function(e){return n(void 0,void 0,void 0,function(){var t,r;return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,(0,s.default)(e)];case 1:return t=n.sent(),[3,3];case 2:throw n.sent(),new a.InvalidRemoteURLError(e);case 3:return n.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,n.sent()];case 5:throw r=n.sent(),new a.NonJsonRefError({$ref:e},r.message);case 6:return[2]}})})};r.default={https:l,http:l}}}},{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"}],[986,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.InvalidFileSystemPathError=r.InvalidRemoteURLError=r.NotResolvableError=r.NonJsonRefError=void 0;var n=function(e,t){this.name="NonJsonRefError",this.message=["NonJsonRefError","The resolved value at the reference: ".concat(e.$ref," was not JSON.parse 'able"),"The non-json content in question: ".concat(t)].join("\n")};r.NonJsonRefError=n;var o=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")};r.NotResolvableError=o;var i=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};r.InvalidRemoteURLError=i;var a=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};r.InvalidFileSystemPathError=a}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/errors.js"}],[987,{"./default-protocol-handler-map":985,"./reference-resolver":988},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var s=a(e("./default-protocol-handler-map")),l=a(e("./reference-resolver")),c=n(n({},s.default),{file:function(){return o(void 0,void 0,void 0,function(){return i(this,function(e){return[2,undefined]})})}});r.default=new l.default(c)}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/index-web.js"}],[988,{"./errors":986,"./resolve-pointer":989},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var a=e("./errors"),s=i(e("./resolve-pointer")),l=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return n(this,arguments,void 0,function(e,t){var r,n,i,l,c,u,f,d,p,h;return void 0===t&&(t={}),o(this,function(o){switch(o.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,s.default)(e,t))];(r=e.split("#")).length>1&&(n=r[r.length-1]),i=r[0],o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(i,t)];case 2:return l=o.sent(),[3,4];case 3:throw c=o.sent(),new a.NonJsonRefError({$ref:e},c.message);case 4:if(l!==undefined)return h=l,n&&(h=(0,s.default)(n,h)),[2,h];if(!1===e.includes("://"))throw new a.InvalidFileSystemPathError(e);u=0,f=Object.keys(this.protocolHandlerMap),o.label=5;case 5:return u<f.length?(d=f[u],i.startsWith(d)?[4,this.protocolHandlerMap[d](i,t)]:[3,7]):[3,8];case 6:if((p=o.sent())!==undefined)return h=p,n&&(h=(0,s.default)(n,h)),[2,h];o.label=7;case 7:return u++,[3,5];case 8:throw new a.NotResolvableError(e)}})})},e}();r.default=l}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"}],[989,{"@json-schema-spec/json-pointer":981},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.InvalidJsonPointerRefError=void 0;var o=n(e("@json-schema-spec/json-pointer")),i=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};r.InvalidJsonPointerRefError=i,r.default=function(e,t){try{var r=e.replace("#","");return o.default.parse(r).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"}],[99,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.hardwareKeyringBuilderFactory=function(e,t){const r=()=>new e({bridge:new t});return r.type=e.type,r}}}},{package:"$root$",file:"app/scripts/lib/hardware-keyring-builder-factory.ts"}],[990,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(r,"__esModule",{value:!0}),r.defaultOptions=void 0,r.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 r=t.find(function(t){return t===e});return r||!1},s=function(e,t){return void 0===t&&(t=1),e[e.length-t]};r.default=function e(t,l,c,u,f,d,p,h,m){void 0===c&&(c=r.defaultOptions),void 0===u&&(u=0),void 0===f&&(f=[]),void 0===d&&(d=[]),void 0===p&&(p=[]),void 0===h&&(h=[]),void 0===m&&(m=[]);var g=n(n({},r.defaultOptions),c);if(0===u&&(p=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===u?t:l(t,!1,i(p),s(d));var b=t;!1===g.mutable&&(b=n({},t)),d.push(b),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===u||(b=l(b,!1,i(p),s(d,2)))),f.push(t),h.push([t,b]);var y=function(t,r){var n=a(t,f);return n?(m.push(n),!0===g.skipFirstMutation&&n===f[0]?l(t,!0,i(r),s(d)):h.find(function(e){var t=e[0];return n===t})[1]):e(t,l,c,u+1,f,d,r,h,m)};if(t.anyOf)b.anyOf=t.anyOf.map(function(e,t){return y(e,o(o([],p,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)b.allOf=t.allOf.map(function(e,t){return y(e,o(o([],p,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)b.oneOf=t.oneOf.map(function(e,t){return y(e,o(o([],p,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)b.items=t.items.map(function(e,t){return y(e,o(o([],p,!0),["items[".concat(t,"]")],!1))});else{var v=a(t.items,f);if(v)if(m.push(v),!0===g.skipFirstMutation&&v===f[0])b.items=l(t.items,!0,i(p),s(d));else{var E=h.find(function(e){var t=e[0];return v===t})[1];b.items=E}else b.items=e(t.items,l,c,u+1,f,d,o(o([],p,!0),["items"],!1),h,m)}if(t.additionalItems!==undefined&&(b.additionalItems=y(t.additionalItems,o(o([],p,!0),["additionalItems"],!1))),t.properties!==undefined){var _=t.properties,w={};Object.keys(t.properties).forEach(function(e){w[e]=y(_[e],o(o([],p,!0),["properties",e.toString()],!1))}),b.properties=w}if(t.patternProperties!==undefined){var S=t.patternProperties,M={};Object.keys(t.patternProperties).forEach(function(e){M[e]=y(S[e],o(o([],p,!0),["patternProperties",e.toString()],!1))}),b.patternProperties=M}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(b.additionalProperties=y(t.additionalProperties,o(o([],p,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===u)return b;if(!0===g.bfs)return d.pop(),b;var T=-1!==m.indexOf(t);return d.pop(),l(b,T,i(p),s(d))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],[10,{"../../shared/constants/app":8763,"../../shared/constants/app-state":8762,"../../shared/constants/defi-referrals":8773,"../../shared/constants/errors":8774,"../../shared/constants/infura-project-id":8779,"../../shared/constants/messages":8784,"../../shared/constants/metametrics":8785,"../../shared/constants/offscreen-communication":8791,"../../shared/constants/onboarding":8792,"../../shared/constants/start-up-errors":8804,"../../shared/constants/ui-initialization":8812,"../../shared/lib/active-tab-domain-metrics":8827,"../../shared/lib/browser-runtime.utils":8843,"../../shared/lib/caip-stream":8845,"../../shared/lib/fetch-with-timeout":8895,"../../shared/lib/get-first-preferred-lang-code":8913,"../../shared/lib/install-attribution":8917,"../../shared/lib/manifestFlags":8919,"../../shared/lib/mv3.utils":8931,"../../shared/lib/object.utils":8934,"../../shared/lib/promise-with-resolvers":8944,"../../shared/lib/selectors/networks":8954,"../../shared/lib/sentry":8960,"../../shared/lib/stores/persistence-manager":8974,"./constants/background":11,"./constants/marketing-site-whitelist":12,"./constants/sentry-state":13,"./constants/snaps":14,"./constants/stream":15,"./first-time-state":55,"./lib/CronjobControllerStorageManager":59,"./lib/approval/utils":66,"./lib/createDefiReferralMiddleware":68,"./lib/critical-error/critical-error-recovery":82,"./lib/critical-error/critical-error-tab-handoff":83,"./lib/deep-links/deep-link-router":87,"./lib/deep-links/metrics":88,"./lib/ens-ipfs/setup":94,"./lib/extension-lazy-listener/extension-lazy-listener":95,"./lib/getIframeProperties":97,"./lib/getObjStructure":98,"./lib/migrator":104,"./lib/notification-manager":107,"./lib/repair":121,"./lib/safe-reload":138,"./lib/setup-initial-state-hooks":142,"./lib/start-up-errors/start-up-errors":155,"./lib/state-corruption/state-corruption-recovery":156,"./lib/stream-utils":159,"./lib/update-remote-feature-flags":196,"./lib/use-split-state-storage":197,"./lib/util":198,"./metamask-controller":422,"./migrations":669,"./offscreen":670,"./on-update":671,"./platforms/extension":672,"@metamask/base-controller":1484,"@metamask/design-tokens":2173,"@metamask/utils":4295,"extension-port-stream":6856,loglevel:7457,"readable-stream":7934,"webextension-polyfill":8750},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.loadStateFromPersistence=ot,r.setupController=ut;var n=e("./lib/setup-initial-state-hooks");e("../../shared/constants/infura-project-id");var o=e("@metamask/design-tokens"),i=e("readable-stream"),a=fe(e("loglevel")),s=fe(e("webextension-polyfill")),l=e("@metamask/utils"),c=e("@metamask/base-controller"),u=e("extension-port-stream"),f=e("../../shared/lib/promise-with-resolvers"),d=e("../../shared/constants/onboarding"),p=e("../../shared/constants/app"),h=e("../../shared/constants/app-state"),m=e("../../shared/constants/messages"),g=e("../../shared/constants/ui-initialization"),b=e("../../shared/constants/metametrics"),y=e("../../shared/lib/active-tab-domain-metrics"),v=e("../../shared/lib/browser-runtime.utils"),E=e("../../shared/lib/mv3.utils"),_=e("../../shared/lib/object.utils"),w=(e("../../shared/constants/offscreen-communication"),e("../../shared/lib/sentry")),S=e("../../shared/lib/selectors/networks"),M=e("../../shared/lib/caip-stream"),T=fe(e("../../shared/lib/fetch-with-timeout")),O=e("../../shared/constants/errors"),A=fe(e("../../shared/lib/get-first-preferred-lang-code")),C=(e("../../shared/lib/manifestFlags"),e("../../shared/constants/start-up-errors")),N=e("../../shared/constants/defi-referrals"),P=e("../../shared/lib/install-attribution"),I=e("../../shared/lib/stores/persistence-manager"),k=e("./lib/critical-error/critical-error-recovery"),j=e("./lib/state-corruption/state-corruption-recovery"),R=e("./lib/approval/utils"),D=e("./lib/use-split-state-storage"),L=fe(e("./migrations")),x=fe(e("./lib/migrator")),U=e("./lib/update-remote-feature-flags"),$=fe(e("./platforms/extension")),F=e("./constants/sentry-state"),B=ue(e("./lib/notification-manager")),V=ue(e("./metamask-controller")),K=fe(e("./lib/getObjStructure")),W=fe(e("./lib/ens-ipfs/setup")),H=e("./lib/util"),z=e("./offscreen"),G=e("./lib/stream-utils"),J=fe(e("./first-time-state")),Y=e("./on-update"),q=e("./constants/marketing-site-whitelist"),X=e("./constants/stream"),Q=e("./constants/snaps"),Z=e("./lib/extension-lazy-listener/extension-lazy-listener"),ee=e("./lib/deep-links/deep-link-router"),te=e("./lib/deep-links/metrics"),re=e("./lib/safe-reload"),ne=e("./lib/critical-error/critical-error-tab-handoff"),oe=e("./lib/repair"),ie=e("./lib/start-up-errors/start-up-errors"),ae=e("./lib/CronjobControllerStorageManager"),se=e("./lib/createDefiReferralMiddleware"),le=e("./lib/getIframeProperties"),ce=e("./constants/background");function ue(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return(ue=function(e,t){if(!t&&e&&e.__esModule)return e;var o,i,a={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return a;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,a)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?o(a,t,i):a[t]=e[t]);return a})(e,t)}function fe(e){return e&&e.__esModule?e:{default:e}}const de=globalThis.stateHooks.lazyListener??new Z.ExtensionLazyListener(s.default),pe="#0376C9",he=o.lightTheme.colors.error.default,me=9,ge=99,be=!1;const ye=null,{safePersist:ve,requestSafeReload:Ee,evacuate:_e}=(0,re.getRequestSafeReload)(n.persistenceManager);global.stateHooks.getMostRecentPersistedState=()=>n.persistenceManager.mostRecentRetrievedState,global.stateHooks.getStorageKind=()=>n.persistenceManager.storageKind,global.logEncryptedVault=()=>{n.persistenceManager.logEncryptedVault()};const{sentry:we}=global;let Se={...J.default};const Me={[p.ENVIRONMENT_TYPE_POPUP]:!0,[p.ENVIRONMENT_TYPE_NOTIFICATION]:!0,[p.ENVIRONMENT_TYPE_FULLSCREEN]:!0};a.default.setLevel("info",!1);const Te=new $.default,Oe=new B.default,Ae=(0,H.getPlatform)()===p.PLATFORM_FIREFOX;function Ce(e){const t=e.name,r=e.sender?.url?new URL(e.sender.url):null;let n;return n=Ae?Boolean(Me[t]):r?.origin===`chrome-extension://${s.default.runtime.id}`,{processName:t,senderUrl:r,isMetaMaskUIPort:n}}let Ne=0,Pe=!1,Ie=!1,ke=0,je=0;const Re=new Set,De={},Le={};let xe;const Ue={},$e={},Fe={};const Be=new URL("https://metamask.github.io/phishing-warning/v5.1.0/"),Ve=Be.toString();let Ke,We,He;function ze(){const e=(0,f.withResolvers)();Ke=e.promise,We=e.resolve,He=e.reject}de.once("runtime","onInstalled").then(e=>{!async function([e]){if("install"===e.reason)await async function(){a.default.debug("First install detected");const e=(0,P.getInstallAttribution)();Te.openExtensionInBrowser();await Ke,await dt(e)}();else if("update"===e.reason){const{previousVersion:t}=e;if(!t||t===Te.getVersion())return;await Ke,(0,Y.onUpdate)(xe,Te,t,Ee)}}(e)}),ze(),s.default?.sidePanel?.setPanelBehavior&&s.default.sidePanel.setPanelBehavior({openPanelOnActionClick:!0}).catch(()=>{});let Ge,Je,Ye,qe;const Xe=new j.CorruptionHandler,Qe=new k.CriticalErrorHandler,Ze=async e=>{const{isMetaMaskUIPort:t}=Ce(e);try{e.postMessage({data:{method:g.BACKGROUND_LIVENESS_METHOD},name:"background-liveness"})}catch(e){return void a.default.error("MetaMask - background-liveness check: Failed to message to port",e)}let r;t&&(Qe.registerPortForCriticalError({port:e,repairCallback:()=>(0,oe.requestRepair)(()=>(0,ne.openRestoringTabAndReload)(Ee))}),r=()=>Qe.removeListenersForPort(e));try{if(await Ke,!(0,ie.tryPostMessage)(e,g.BACKGROUND_INITIALIZED_METHOD))return;be,Ge(e,r)}catch(o){try{if(we?.captureException(o),t)if((0,O.isStateCorruptionError)(o))await Xe.handleStateCorruptionError({port:e,error:o,database:n.persistenceManager,repairCallback:async e=>{ze(),(0,I.hasVault)(e)?(await pt(e),xe.onboardingController.setFirstTimeFlowType(d.FirstTimeFlowType.restore)):(await n.persistenceManager.reset(),await pt(null))}});else{const t=(0,l.isObject)(o)?{message:o.message??"Unknown error",name:o.name??"UnknownError",stack:o.stack,...o.sentryTags&&{sentryTags:o.sentryTags}}:{message:String(o),name:"UnknownError",stack:""};(0,ie.tryPostMessage)(e,C.DISPLAY_GENERAL_STARTUP_ERROR,{error:t,currentLocale:xe?.preferencesController?.state?.currentLocale})}}finally{r?.()}}},et=()=>{de.addListener("runtime","onConnect",Ze)};function tt(){const e=(new Date).toISOString();s.default.storage.session.set({timestamp:e})}async function rt(e){(0,H.initInstallType)();const t=E.isManifestV3?(0,z.createOffscreen)():null;let r=null,o=!1;E.isManifestV3&&(0,z.addOffscreenConnectivityListener)(e=>{if(o&&xe.messengerClientApi.setConnectivityStatus){const t=e?"online":"offline";xe.messengerClientApi.setConnectivityStatus(t)}else r=e});const i=await ot(e),a=i.data,l=await(0,A.default)();let c;if(E.isManifestV3){if(!1!==a.PreferencesController?.enableMV3TimestampSave){const e=2e3;tt(),setInterval(tt,e)}const e=await s.default.storage.session.get(["isFirstMetaMaskControllerSetup"]);c=e?.isFirstMetaMaskControllerSetup===undefined,await s.default.storage.session.set({isFirstMetaMaskControllerSetup:c})}const u=await async function(){const e=(0,T.default)(),t=Q.PREINSTALLED_SNAPS_URLS.map(async t=>{const r=await e(t);if(t.pathname.endsWith(".json.gz")){const e=new DecompressionStream("gzip"),t=r.body.pipeThrough(e);return await new Response(t).json()}return await r.json()});return Promise.all(t)}(),f=new ae.CronjobControllerStorageManager;if(await f.init(),ut(a,l,c,i.meta,t,u,f),xe.metaMetricsController.updateTraits({[b.MetaMetricsUserTrait.StorageKind]:n.persistenceManager.storageKind}),function(e){async function t(e,t){try{const r=await s.default.tabs.get(e);return!(r.url&&r.url.startsWith("https://www.google.com/search")||(await s.default.tabs.update(e,{url:t}),0))}catch(e){return we?.captureException(e),!1}}const r=!E.isManifestV3;s.default.webRequest.onBeforeRequest.addListener(n=>{if(n.tabId===s.default.tabs.TAB_ID_NONE)return{};const{completedOnboarding:o}=e.onboardingController.state;if(!o)return{};if(!e.preferencesController.state.usePhishDetect)return{};if(n.initiator&&"null"!==n.initiator&&new URL(n.initiator).host===Be.host)return{};const{hostname:i,href:a,searchParams:l}=new URL(n.url);e.phishingController.maybeUpdateState();const c=e.phishingController.isBlockedRequest(n.url);let u,f;if("main_frame"!==n.type&&"sub_frame"!==n.type||(u=e.phishingController.test(n.url)),!u?.result&&!c.result)return{};let d,p=a;u?.result&&c.result?f=`${u.type} and ${c.type}`:u?.result?f=u.type:(f=c.type,p=n.initiator);try{d=new URL(p).hostname}catch{d=i,p=a}const h=new URLSearchParams({hostname:d,href:p}),m=new URL(Ve);m.hash=h.toString();const g=m.toString(),y=()=>{Ae||e.metaMetricsController.trackEvent({event:b.MetaMetricsEventName.PhishingPageDisplayed,category:b.MetaMetricsEventCategory.Phishing,properties:{url:p,referrer:{url:p},reason:f,requestDomain:c.result?i:undefined}},{excludeMetaMetricsId:!0})};return r?"main_frame"===n.type?(y(),{redirectUrl:g}):(t(n.tabId,g).then(e=>{e&&y()}),{cancel:!0}):(t(n.tabId,g).then(e=>{e&&y()}),{})},{urls:["http://*/*","https://*/*","ws://*/*","wss://*/*"]},r?["blocking"]:[])}(xe),E.isManifestV3){if(o=!0,null!==r){const e=r?"online":"offline";xe.messengerClientApi.setConnectivityStatus(e)}}else{const e=e=>{const t=e?"online":"offline";xe.messengerClientApi.setConnectivityStatus(t)};e(globalThis.navigator.onLine),globalThis.addEventListener("online",()=>e(!0)),globalThis.addEventListener("offline",()=>e(!1))}E.isManifestV3||await async function(){let e;try{const t=new URL(Ve);let r,n;t.hash="#extensionStartup",e=window.document.createElement("iframe"),e.setAttribute("src",t.href),e.setAttribute("sandbox","allow-scripts allow-same-origin");const o=new Promise((e,t)=>{r=e,n=t});e.addEventListener("load",r),window.document.body.appendChild(e),setTimeout(()=>n(new nt),1e3),await o}catch(e){e instanceof nt?console.warn("Phishing warning page timeout; page not guaranteed to work offline."):console.error("Failed to initialize phishing warning page",e)}finally{e&&e.remove()}}(),await(async()=>{const e=await s.default.tabs.query({url:"<all_urls>",windowType:"normal"}).then(e=>((0,v.checkForLastErrorAndLog)(),e)).catch(()=>{(0,v.checkForLastErrorAndLog)()});for(const t of e)s.default.tabs.sendMessage(t.id,{name:m.EXTENSION_MESSAGES.READY}).then(()=>{(0,v.checkForLastErrorAndLog)()}).catch(()=>{(0,v.checkForLastErrorAndLog)()})})(),new ee.DeepLinkRouter({getExtensionURL:Te.getExtensionURL,getState:xe.getState.bind(xe)}).on("navigate",async({url:e,parsed:t})=>{"redirectTo"in t||await xe.metaMetricsController.trackEvent((0,te.createEvent)({signature:t.signature,url:e}))}).on("error",e=>we?.captureException(e)).install()}et(),s.default.runtime.onConnectExternal.addListener(async(...e)=>{await Ke,Je(...e)});class nt extends Error{constructor(){super("Timeout failed")}}async function ot(e){let t;if(e){t={data:{},meta:{}};for(const r of I.backedUpStateKeys)(0,l.hasProperty)(e,r)&&(t.data[r]=e[r]);(0,l.hasProperty)(e,"meta")&&(0,l.isObject)(e.meta)&&(t.meta=e.meta,"split"===e.meta.storageKind||"data"===e.meta.storageKind?n.persistenceManager.storageKind=e.meta.storageKind:n.persistenceManager.storageKind="data"),"number"!=typeof t.meta.version&&(a.default.error("The `backup`'s `meta.version` property was missing during backup restore."),t.meta.version=155)}else{const e=!0;t=await n.persistenceManager.get({validateVault:e})}const r=new x.default({migrations:L.default,defaultVersion:null});r.on("error",e=>{console.warn(e);const r=(0,K.default)(t);we?.captureException(e,{extra:{vaultStructure:r}})});let o=!1;t?.data||t?.meta||(o=!0,t=r.generateInitialState(Se));const{state:i,changedKeys:s}=await r.migrateData(t),c=async r=>{const o=t?.meta?.version,a="number"==typeof o&&o>=157;let s=e?.AppMetadataController?.firstTimeInfo??i?.data?.AppMetadataController?.firstTimeInfo??i?.data?.firstTimeInfo??t?.data?.AppMetadataController?.firstTimeInfo??t?.data?.firstTimeInfo;if(!s)try{const e=await n.persistenceManager.getBackup();s=e?.AppMetadataController?.firstTimeInfo}catch{}const l=new Error(r);return l.sentryTags={"corruption.preMigrationVersion":String(o??"unknown"),"corruption.backupShouldExist":String(a),"corruption.installVersion":String(s?.version??"unknown"),"corruption.installDate":String(s?.date??"unknown")},l};if(!i)throw await c("MetaMask - migrator returned undefined");if(!(0,l.isObject)(i.meta))throw await c(`MetaMask - migrator metadata has invalid type '${typeof i.meta}'`);if("number"!=typeof i.meta.version)throw await c(`MetaMask - migrator metadata version has invalid type '${typeof i.meta.version}'`);if(!["data","split",undefined].includes(i.meta.storageKind))throw await c(`MetaMask - migrator metadata storageKind has invalid value '${i.meta.storageKind}'`);if(!(0,l.isObject)(i.data))throw await c(`MetaMask - migrator data has invalid type '${typeof i.data}'`);if(n.persistenceManager.setMetadata(i.meta),a.default.debug("[Split State]: Loaded data from persistence with storageKind '%s'",n.persistenceManager.storageKind),"data"===n.persistenceManager.storageKind){const e=!0===i.meta.platformSplitStateGradualRolloutAttempted,t=!e&&await(0,D.useSplitStateStorage)(i.data);a.default.debug("[Split State]: shouldUseSplitStateStorage: %s (alreadyTried: %s)",t,e),t&&(i.meta.platformSplitStateGradualRolloutAttempted=!0,n.persistenceManager.setMetadata(i.meta)),a.default.debug("[Split State]: Writing data to persistence with storageKind 'data'"),await n.persistenceManager.set(i.data),t&&(await n.persistenceManager.migrateToSplitState(i.data),i.meta=n.persistenceManager.getMetaData(),i.meta!==undefined&&(delete i.meta.platformSplitStateGradualRolloutAttempted,n.persistenceManager.setMetadata(i.meta)),await n.persistenceManager.persist())}else{if("split"!==n.persistenceManager.storageKind)throw new Error(`MetaMask - persistenceManager has invalid storageKind '${n.persistenceManager.storageKind}'`);if(o)for(const[e,t]of Object.entries(i.data))n.persistenceManager.update(e,t);else for(const e of s)n.persistenceManager.update(e,i.data[e]);await n.persistenceManager.persist()}return a.default.debug("[Split State]: Load complete."),i}function it(e,t,r){const{analyticsId:n}=xe.getState();if(!(0,H.shouldEmitDappViewedEvent)(n))return;const o=xe.getPermittedAccounts(e).length;if(0===o)return;const i=xe.controllerMessenger.call("AccountsController:getState"),a=Object.keys(i.internalAccounts.accounts).length,s=(0,le.getIframeProperties)({frameId:r,origin:e,mainFrameOrigin:t});xe.metaMetricsController.trackEvent({event:b.MetaMetricsEventName.DappViewed,category:b.MetaMetricsEventCategory.InpageProvider,referrer:{url:e},properties:{is_first_visit:!1,number_of_accounts:a,number_of_accounts_connected:o,...s}},{excludeMetaMetricsId:!0})}function at(e){if(!e.sender?.tab||!e.sender?.url||!e.sender?.tab?.url)return;const t=e.sender.tab.id,r=new URL(e.sender.url),{origin:n}=r,o=new URL(e.sender.tab.url),{origin:i}=o,{frameId:a}=e.sender;Object.keys(Ue).includes(t)||(Ue[t]=n),t in $e||($e[t]=i),t in Fe||(Fe[t]=a);const s=xe.controllerMessenger.call("PermissionController:hasPermissions",n),l="New Tab"!==e.sender.tab.title;s&&l&&it(n,i,a)}function st(e){const{completedMetaMetricsOnboarding:t,optedIn:r}=xe.getState();if(!t||!r)return;const n=xe.appStateController.state.appActiveTab?.origin,o=(0,y.getActiveTabDomainAllowlist)(xe.remoteFeatureFlagController.state),i=(0,y.getActiveTabDomainForMetrics)(n,o);xe.metaMetricsController.trackEvent({event:b.MetaMetricsEventName.AppOpened,category:b.MetaMetricsEventCategory.App,environmentType:e,properties:{...i?{active_tab_domain:i}:{}}})}function lt(e){const t=[p.ENVIRONMENT_TYPE_POPUP,p.ENVIRONMENT_TYPE_NOTIFICATION,p.ENVIRONMENT_TYPE_FULLSCREEN,p.ENVIRONMENT_TYPE_SIDEPANEL];return!(Object.values(De).some(Boolean)||Pe||Ne>0||ke>0)&&t.includes(e)}const ct=async e=>{if(await Ke,xe)try{const t=e?{active:!0,windowId:e}:{active:!0,currentWindow:!0},r=await s.default.tabs.query(t);if(!r||0===r.length)return;const n=r[0],{id:o,title:i,url:a,favIconUrl:l}=n;if(!a)return void xe.appStateController.clearAppActiveTab();const{origin:c,protocol:u,host:f,href:d}=new URL(a);if(!(0,H.isWebOrigin)(c))return void xe.appStateController.clearAppActiveTab();xe.appStateController.setAppActiveTab({id:o,title:i,origin:c,protocol:u,url:a,host:f,href:d,favIconUrl:l}),xe.subjectMetadataController.addSubjectMetadata({origin:c,name:i||f||c,iconUrl:l||null,subjectType:"website"})}catch(e){console.log("Error refreshing appActiveTab:",e.message)}};function ut(e,t,r,o,l,f,d){xe=new V.default({infuraProjectId:globalThis.INFURA_PROJECT_ID,showUserConfirmation:ft,initState:e,initLangCode:t,platform:Te,notificationManager:Oe,browser:s.default,getRequestAccountTabIds:()=>Le,getOpenMetamaskTabsIds:()=>De,isFirstMetaMaskControllerSetup:r,currentMigrationVersion:o.version,featureFlags:{},offscreenPromise:l,preinstalledSnaps:f,requestSafeReload:Ee,cronjobControllerStorageManager:d}),n.persistenceManager.setOnSetFailed(e=>{xe.appStateController.setStorageWriteErrorType(e)});const m=[],g=xe.store.getState();for(const t of Object.keys(g)){const r=e[t]||{},n=g[t];if(null===n||"object"!=typeof n){(0,w.captureException)(new Error(`Invalid controller state for '${t}' of type '${null===n?"null":typeof n}'`));continue}const o=Object.keys(n);if(o.length===Object.keys(r).length){for(const e of o)if(n[e]!==r[e]){m.push(t);break}}else m.push(t)}var y;"split"===n.persistenceManager.storageKind?(m.length>0&&(a.default.info(`MetaMaskController state changed during configuration for controllers: ${m.join(", ")}. Persisting updated state.`),m.forEach(e=>{n.persistenceManager.update(e,g[e])}),ve().catch(e=>{a.default.error("Error persisting updated state:",e),we?.captureException(e)})),xe.store.on("stateChange",async({controllerKey:e,newState:t,_oldState:r,_patches:o})=>{n.persistenceManager.update(e,t),I.backedUpStateKeys.includes(e)&&I.backedUpStateKeys.forEach(t=>{if(t===e)return;const r=xe.store.config[t];if(!r?.metadata)throw new Error(`Cannot backup ${t}: controller metadata is required but not found. All controllers in backedUpStateKeys must extend BaseController and define metadata.`);const o=xe.controllerMessenger.call(`${t}:getState`),i=(0,c.deriveStateFromMetadata)(o,r.metadata,"persist");n.persistenceManager.update(t,i)});try{await ve()}catch(e){a.default.error("Error persisting state change:",e),we?.captureException(e)}})):(m.length>0&&(a.default.info(`MetaMaskController state changed during configuration for controllers: ${m.join(", ")}. Persisting updated state.`),ve(g).catch(e=>{a.default.error("Error persisting updated controller state:",e),we?.captureException(e)})),xe.store.on("update",ve)),xe.store.on("error",e=>{a.default.error("MetaMask controller.store error:",e),we?.captureException(e)}),(0,W.default)({getCurrentChainId:()=>(0,S.getCurrentChainId)({metamask:xe.networkController.state}),getIpfsGateway:xe.preferencesController.getIpfsGateway.bind(xe.preferencesController),getUseAddressBarEnsResolution:()=>xe.preferencesController.state.useAddressBarEnsResolution,provider:xe.provider}),y=xe,global.stateHooks.getSentryAppState=function(){const e=y.memStore.getState();return(0,_.maskObject)(e,F.SENTRY_BACKGROUND_STATE)};const v=()=>Ne>0||Boolean(Object.keys(De).length)||Pe||ke>0||!1,T=()=>Ne>0||ke>0,O=()=>Pe&&!T(),A=(e,t)=>{if(!1===e)xe.onClientClosed();else{if(t===p.ENVIRONMENT_TYPE_FULLSCREEN&&Boolean(Object.keys(De).length)||t===p.ENVIRONMENT_TYPE_SIDEPANEL&&ke>0)return;xe.onEnvironmentTypeClosed(t)}};function C(e){try{xe.appStateController.setDefaultHomeActiveTabName(e??null)}catch(e){console.error("Error setting landing tab:",e)}}function N(){Re.clear(),je=0,k()}function P(e,t){return e>t?`${t}+`:String(e)}function k(){const e=j();let t="",r=pe;je>0&&!O()?(t=P(je,me),r=he):e>0&&(t=P(e,me));try{const e={text:t},n={color:r};E.isManifestV3?(s.default.action.setBadgeText(e),s.default.action.setBadgeBackgroundColor(n)):(s.default.browserAction.setBadgeText(e),s.default.browserAction.setBadgeBackgroundColor(n))}catch(e){console.error("Error updating browser badge:",e)}}function j(){try{return(0,R.getAttentionRequiredApprovalCount)({approvalController:xe.approvalController})}catch(e){return console.error("Failed to get pending approval count:",e),0}}Ge=(e,t)=>{if(ce.BLOCKED_PORTS.includes(e.name))return;const{processName:r,senderUrl:n,isMetaMaskUIPort:o}=Ce(e);if(o){const n=new u.ExtensionPortStream(e),o=function({chunkSize:e}){xe.metaMetricsController.trackEvent({event:b.MetaMetricsEventName.PortStreamChunked,category:b.MetaMetricsEventCategory.PortStream,properties:{chunkSize:e}})};e.onDisconnect.addListener(()=>n.off("message-too-large",o)),n.on("message-too-large",o),xe.isClientOpen=!0,xe.setupTrustedCommunication(n,e.sender).finally(()=>{t?.()});const s=r===p.ENVIRONMENT_TYPE_SIDEPANEL&&lt(p.ENVIRONMENT_TYPE_SIDEPANEL);if(r!==p.ENVIRONMENT_TYPE_SIDEPANEL&&lt(a=r)&&st(a),(0,U.updateRemoteFeatureFlags)(xe),r===p.ENVIRONMENT_TYPE_POPUP&&(N(),Ne+=1,(0,i.finished)(n,()=>{Ne-=1;const e=v();xe.isClientOpen=e,A(e,p.ENVIRONMENT_TYPE_POPUP)})),r===p.ENVIRONMENT_TYPE_SIDEPANEL&&(N(),ke+=1,ct().then(()=>{s&&st(p.ENVIRONMENT_TYPE_SIDEPANEL)}),(0,i.finished)(n,()=>{ke=Math.max(ke-1,0);const e=v();xe.isClientOpen=e,A(e,p.ENVIRONMENT_TYPE_SIDEPANEL)})),r===p.ENVIRONMENT_TYPE_NOTIFICATION&&(Pe=!0,(0,i.finished)(n,()=>{Pe=!1,je>0&&C(h.AccountOverviewTabKey.Activity),k();const e=v();xe.isClientOpen=e,A(e,p.ENVIRONMENT_TYPE_NOTIFICATION)})),r===p.ENVIRONMENT_TYPE_FULLSCREEN){N();const t=e.sender.tab.id;De[t]=!0,(0,i.finished)(n,()=>{delete De[t];const e=v();xe.isClientOpen=e,A(e,p.ENVIRONMENT_TYPE_FULLSCREEN)})}}else if(n&&n.origin===Be.origin&&n.pathname===Be.pathname){const t=new u.ExtensionPortStream(e,{chunkSize:0});xe.setupPhishingCommunication({connectionStream:t})}else{if(e.sender&&e.sender.tab&&e.sender.url){const t=e.sender.tab.id,r=new URL(e.sender.url),{origin:n}=r;at(e),e.onMessage.addListener(e=>{e.data&&e.data.method===p.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS&&(Le[n]=t)})}if(n&&q.COOKIE_ID_MARKETING_WHITELIST_ORIGINS.some(e=>e===n.origin)){const t=new u.ExtensionPortStream(e,{chunkSize:0});xe.setUpCookieHandlerCommunication({connectionStream:t})}const t=new u.ExtensionPortStream(e,{chunkSize:0});if(Ye(t,e.sender),Ae||!E.isManifestV3){const r=(0,G.setupMultiplex)(t);r.ignoreStream(X.METAMASK_EIP_1193_PROVIDER),qe(r.createStream(X.METAMASK_CAIP_MULTICHAIN_PROVIDER),e.sender)}}var a},Je=e=>{const t=e.sender?.url;if(t){const{hostname:r}=new URL(t);if(ce.BLOCKED_HOSTNAMES.includes(r))return void e.disconnect()}const r=new u.ExtensionPortStream(e,{chunkSize:0});if(!e.sender.id){if(ce.BLOCKED_PORTS.includes(e.name))return;at(e),qe((0,M.createCaipStream)(r),e.sender)}else Ye(r,e.sender)},Ye=(e,t)=>{xe.setupUntrustedCommunicationEip1193({connectionStream:e,sender:t})},qe=(e,t)=>{xe.setupUntrustedCommunicationCaip({connectionStream:e,sender:t})},k(),xe.controllerMessenger.subscribe(V.METAMASK_CONTROLLER_EVENTS.DECRYPT_MESSAGE_MANAGER_UPDATE_BADGE,k),xe.controllerMessenger.subscribe(V.METAMASK_CONTROLLER_EVENTS.ENCRYPTION_PUBLIC_KEY_MANAGER_UPDATE_BADGE,k),xe.signatureController.hub.on(V.METAMASK_CONTROLLER_EVENTS.UPDATE_BADGE,k),xe.controllerMessenger.subscribe(V.METAMASK_CONTROLLER_EVENTS.APP_STATE_UNLOCK_CHANGE,k),xe.controllerMessenger.subscribe(V.METAMASK_CONTROLLER_EVENTS.APPROVAL_STATE_CHANGE,k),xe.controllerMessenger.subscribe(V.METAMASK_CONTROLLER_EVENTS.METAMASK_NOTIFICATIONS_LIST_UPDATED,k),xe.controllerMessenger.subscribe(V.METAMASK_CONTROLLER_EVENTS.METAMASK_NOTIFICATIONS_MARK_AS_READ,k),xe.controllerMessenger.subscribe("TransactionController:transactionStatusUpdated",function({transactionMeta:e}){const{status:t,txParams:r,chainId:n}=e??{};if("failed"!==t&&"dropped"!==t)return;const{from:o,nonce:i}=r??{},a=o&&i!==undefined&&n?`${n}:${o.toLowerCase()}:${i}`:undefined;if(a&&Re.has(a))return;if(T())return;a&&(Re.size>=ge&&Re.clear(),Re.add(a));je+=1,O()||C(h.AccountOverviewTabKey.Activity);k()}),Oe.on(B.NOTIFICATION_MANAGER_EVENTS.POPUP_CLOSED,({automaticallyClosed:e})=>{e?j()>0&&ft():(xe.signatureController.rejectUnapproved(b.REJECT_NOTIFICATION_CLOSE_SIG),xe.decryptMessageController.rejectUnapproved(b.REJECT_NOTIFICATION_CLOSE),xe.encryptionPublicKeyController.rejectUnapproved(b.REJECT_NOTIFICATION_CLOSE),xe.rejectAllPendingApprovals()),k()})}async function ft(){const e=await Te.getActiveTabs(),t=Boolean(e.find(e=>De[e.id])),r=e.length>0&&e[0].extData&&e[0].extData.indexOf("vivaldi_tab")>-1;if(!Ie&&(r||0===Ne)&&!t&&0===ke){Ie=!0;try{const e=xe.appStateController.getCurrentPopupId();await Oe.showPopup(e=>xe.appStateController.setCurrentPopupId(e),e)}finally{Ie=!1}}}const dt=async e=>{const{deferredDeepLink:t,traits:r}=await e;xe.metaMetricsController.updateTraits({[b.MetaMetricsUserTrait.InstallDateExt]:(new Date).toISOString().split("T")[0],...r});const n={};t&&(xe.appStateController.setDeferredDeepLink(t),n.install_source="deeplink",n.deeplink_path=t.referringLink);const o={category:b.MetaMetricsEventCategory.App,event:b.MetaMetricsEventName.AppInstalled,properties:n},{completedMetaMetricsOnboarding:i,optedIn:a,analyticsId:s}=xe.getState();!0===i&&!1===a||(!0===i&&!0===a&&s?xe.metaMetricsController.trackEvent(o):xe.metaMetricsController.addEventBeforeMetricsOptIn(o))};s.default.runtime.onUpdateAvailable.addListener(async function(e){await Ke,a.default.info("An update is available",e?.version),xe.appStateController.setPendingExtensionVersion(e?.version??null)});(async()=>{if(s.default?.sidePanel)try{await Ke,await async function(){if(!s.default?.sidePanel?.setPanelBehavior)return;const e=xe?.preferencesController?.state?.preferences?.useSidePanelAsDefault??!0;await s.default.sidePanel.setPanelBehavior({openPanelOnActionClick:e})}(),xe?.controllerMessenger?.subscribe("PreferencesController:stateChange",e=>{s.default?.sidePanel?.setPanelBehavior&&s.default.sidePanel.setPanelBehavior({openPanelOnActionClick:e}).catch(e=>console.error("Error updating panel behavior:",e))},e=>e?.preferences?.useSidePanelAsDefault??!0)}catch(e){console.error("Error setting side panel toolbar behavior:",e)}})();async function pt(e){s.default.tabs.onActivated.addListener(e=>{if(xe){const{tabId:t}=e,r=Ue[t],n=$e[t];r&&xe.permissionController.state.subjects[r]!==undefined&&it(r,n,Fe[t]);const o=(0,N.getPartnerByOrigin)(n);o&&xe.permissionController.state.subjects[n]!==undefined&&xe.handleDefiReferral(o,t,se.ReferralTriggerType.OnNavigateConnectedTab).catch(e=>{a.default.error(`Failed to handle ${o.name} referral after navigation to connected tab: `,e)})}});try{await rt(e),n.persistenceManager.cleanUpMostRecentRetrievedState(),a.default.info("MetaMask initialization complete."),We()}catch(e){a.default.error(e),He(e)}}(async()=>{await ct()})(),s.default.tabs.onActivated.addListener(async({tabId:e})=>{if(await Ke,!xe)return{};try{const t=await s.default.tabs.get(e),{id:r,title:n,url:o,favIconUrl:i}=t;if(!o)return xe.appStateController.clearAppActiveTab(),{};const{origin:a,protocol:l,host:c,href:u}=new URL(o);if(!(0,H.isWebOrigin)(a))return xe.appStateController.clearAppActiveTab(),{};xe.appStateController.setAppActiveTab({id:r,title:n,origin:a,protocol:l,url:o,host:c,href:u,favIconUrl:i}),xe.subjectMetadataController.addSubjectMetadata({origin:a,name:n||c||a,iconUrl:i||null,subjectType:"website"})}catch(e){console.log("Error in tabs.onActivated listener:",e.message)}return{}}),s.default.tabs.onUpdated.addListener(async(e,t,r)=>{if(await Ke,!xe)return{};const n=t.url!==undefined,o="complete"===t.status;if(!n&&!o)return{};try{const t=r||await s.default.tabs.get(e),{id:i,title:a,url:l,favIconUrl:c}=t,u=xe.appStateController.state.appActiveTab,f=u?.id===i;if(!l)return f&&xe.appStateController.clearAppActiveTab(),{};const{origin:d,protocol:p,host:h,href:m}=new URL(l);if(!d||"null"===d||d.startsWith("chrome-extension://")||d.startsWith("moz-extension://"))return f&&xe.appStateController.clearAppActiveTab(),{};let g=!1;try{g=(await s.default.tabs.query({active:!0,currentWindow:!0})).some(e=>e.id===i)}catch(e){g=f}(n||o)&&g&&(xe.appStateController.setAppActiveTab({id:i,title:a,origin:d,protocol:p,url:l,host:h,href:m,favIconUrl:c}),xe.subjectMetadataController.addSubjectMetadata({origin:d,name:a||h||d,iconUrl:c||null,subjectType:"website"}))}catch(e){console.log("Error in tabs.onUpdated listener:",e.message)}return{}}),s.default.windows.onFocusChanged.addListener(async e=>{e!==s.default.windows.WINDOW_ID_NONE&&await ct(e)}),async function(){const e=await(0,ne.readCriticalErrorRestoreSession)(s.default),t=undefined;let r=null;(e||t?.simulateBackgroundStateSyncHang||t?.simulateBackgroundInitializationHang)&&(r=await n.persistenceManager.getBackup().catch(()=>null));const o=(0,I.hasVault)(r);if((t?.simulateBackgroundStateSyncHang||t?.simulateBackgroundInitializationHang)&&ye&&(ye.hasVaultAtStartup=o?Date.now():null),e&&(await(0,ne.clearCriticalErrorRestoreSession)(s.default),o)){ye&&(ye.restoreInProgress=!0);const t={tabId:e.tabId,tabUrl:e.tabUrl};pt(r);try{await Ke}catch(e){return void a.default.error("critical-error-restore: initialization failed",e)}return xe.onboardingController.setFirstTimeFlowType(d.FirstTimeFlowType.restore),void await(0,ne.handoffRestoringTabToExtension)(Te,t)}pt(null)}().catch(e=>{a.default.error("initOrRestoreBackground failed",e)})}}},{package:"$root$",file:"app/scripts/background.js"}]],[10],{});