(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[6026],{267540(__unused_webpack_module,__webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";__webpack_require__.d(__webpack_exports__,{ZL:()=>O.Z,_2:()=>_._2,b1:()=>x,or:()=>J,vJ:()=>_.vJ});var t=__webpack_require__(588239);var e=__webpack_require__.n(t);var a=__webpack_require__(688723);var r=__webpack_require__.n(a);var n=__webpack_require__(469842);var o=__webpack_require__(590387);var s=__webpack_require__(190937);var i=__webpack_require__.n(s);var l=__webpack_require__(872129);var c=__webpack_require__(423236);var u=__webpack_require__(538125);var d=__webpack_require__(650212);var w=__webpack_require__(94002);var g=__webpack_require__(73011);var v=__webpack_require__(837505);var p=__webpack_require__(365174);var m=__webpack_require__(221057);var f=__webpack_require__(527096);var h=__webpack_require__(554300);var k=__webpack_require__(337619);var S=__webpack_require__(659045);var y=__webpack_require__(156454);var E=__webpack_require__(720375);var T=__webpack_require__(658457);var b=__webpack_require__(3705);var A=__webpack_require__(717771);var M=__webpack_require__(690401);var H=__webpack_require__(387117);var L=__webpack_require__(139842);var P=__webpack_require__(254757);var C=__webpack_require__(770247);var B=__webpack_require__(723229);var F=__webpack_require__(399635);var I=__webpack_require__(771794);var N=__webpack_require__(305288);var O=__webpack_require__(201893);var _=__webpack_require__(450045);r().setLevel(globalThis.METAMASK_DEBUG?"debug":"warn",!1);let D=(0,u.Y)();let J=(t,e)=>{(0,B.R3)(t),t.onNotification(async t=>{let{method:a}=t;if(a==="sendUpdate")(await D.promise).dispatch(b.M_O(t.params[0]));else if(a===h.c9)await e(t.params[0]);else if(a==="perpsStreamUpdate")(0,N.SB)().handleBackgroundUpdate(t.params[0]);else if(a!==T.g)throw new Error(`Internal JSON-RPC Notification Not Handled:

 ${JSON.stringify(t)}`)})};async function x(t){let{backgroundConnection:e,initialState:a}=t;let r=await Y(a,t);return await e.startSendingPatches(),K(r),r}async function U(t,e){!t.featureFlags&&(t.featureFlags={});let{currentLocaleMessages:a,enLocaleMessages:r}=await (0,S.UN)(t.currentLocale);t.textDirection==="rtl"&&(0,k.s)("rtl");let n={activeTab:e,metamask:t,appState:{},localeMessages:{currentLocale:t.currentLocale,current:a,en:r}};if((0,d.mc)()===p.YY||(0,d.mc)()===p.x$){let{origin:t}=n.activeTab;let e=(0,M.B4u)(n);let a=(0,M._rF)(n);let r=a&&(0,l.vI)(a,e);let o=(0,L.pm)(n);let s=(0,L.mD)(n);t&&s&&!o[t]&&e.length>0&&!r&&(n[w._1.unconnectedAccount]={state:H.nK.OPEN},b.dij(t))}let o=(0,A.A)(n);D.resolve(o);let s=(0,M.EcM)(t);let i=(0,C.A)(s,t.unapprovedPersonalMsgs,t.unapprovedDecryptMsgs,t.unapprovedEncryptionPublicKeyMsgs,t.unapprovedTypedMessages,t.networkId,(0,E.gr)({metamask:t}));return i.length>0&&o.dispatch(b.Z23({id:i[0].id})),o}async function Y(t,e){let{traceContext:a}=e;let r=(0,F.M)({metamask:t});let s=await (0,y.uP)({name:y.dg.SetupStore,parentContext:a,tags:r},()=>U(t,e.activeTab));return globalThis.metamask={updateCurrentLocale:t=>{s.dispatch(b.DAg(t))},setFeatureFlag:(t,e)=>{s.dispatch(b.B4g(t,e))}},await (0,y.uP)({name:y.dg.InitialActions,parentContext:a},()=>$(s)),(0,y.uP)({name:y.dg.FirstRender,parentContext:a},()=>(0,o.render)(n.createElement(P.A,{store:s}),e.container)),s}async function $(t){let e=t.getState();try{let a=(0,m.Y0)().toLowerCase();let{os:n}=e.metamask.browserEnvironment||{};n&&a&&t.dispatch(b.OdJ(n,a)).catch(t=>{r().error("Failed to update browser environment:",t)})}catch(t){r().error("Failed to get browser name:",t)}let a=(0,M.UyX)(e);if(a&&await t.dispatch(b.o$f(a)),(0,d.mc)()===p.YY){let e=Date.now();globalThis.metamask.id=e,await t.dispatch(b.AJb(e))}try{let a=async e=>{(0,L.QA)(e)&&await t.dispatch(b.s8B())};await a(e);let r=setInterval(()=>{let e=t.getState();let n=(0,M.SPM)(e);let o=(0,M.nT$)(e);if(n!==null&&!o){clearInterval(r);return}a(e)},I.a)}catch(t){r().error("[Metamask] checkIsSeedlessPasswordOutdated error",t)}}async function R(t){let e={...t.getState()};return e.version=globalThis.platform.getVersion(),e.browser=window.navigator.userAgent,e.metamask={...e.metamask,socialLoginEmail:undefined},e}function K(t){!0&&(window.stateHooks.throwTestError=async function(t="Test Error"){let e=new Error(t);throw e.name="TestError",e},window.stateHooks.captureTestError=async function(t="Test Error"){let e=new Error(t);e.name="TestError",(0,c.Cp)(e)},window.stateHooks.throwTestBackgroundError=async function(t="Test Error"){await b.LWm(t)},window.stateHooks.captureBackgroundError=async function(t="Test Error"){await b.PDE(t)}),window.stateHooks.reloadExtension=()=>{i().runtime.reload()},window.stateHooks.getCleanAppState=async function(){return R(t)},window.stateHooks.getSentryAppState=function(){let e=t.getState();return(0,g.c)(e,v.z)},window.stateHooks.getLogs=function(){let{logs:e}=t.getState().metamask;return Object.values(e).sort((t,e)=>{return t.timestamp-e.timestamp})}}window.logStateString=async function(){let t=await window.stateHooks.getCleanAppState();return t.logs=window.stateHooks.getLogs(),t.platform=await i().runtime.getPlatformInfo(),JSON.stringify(t,null,2)},window.logState=async function(t){try{let a=await window.logStateString();t?(e()(a,f.T),console.log("State log copied")):console.log(a)}catch(t){console.error(t.message)}}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);