(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[285],{46754(__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:()=>Y.Z,_2:()=>$._2,b1:()=>Z,hz:()=>j,or:()=>R,vJ:()=>$.vJ});var t=__webpack_require__(258205);var e=__webpack_require__.n(t);var a=__webpack_require__(171097);var r=__webpack_require__.n(a);var n=__webpack_require__(860012);var o=__webpack_require__(879505);var s=__webpack_require__(413279);var i=__webpack_require__.n(s);var l=__webpack_require__(296639);__webpack_require__(480021);var c=__webpack_require__(655204);var u=__webpack_require__(367149);var d=__webpack_require__(490335);var v=__webpack_require__(441670);var g=__webpack_require__(630496);var p=__webpack_require__(796213);var w=__webpack_require__(299150);var m=__webpack_require__(124397);var h=__webpack_require__(721127);var f=__webpack_require__(510168);var S=__webpack_require__(55638);var k=__webpack_require__(802870);var y=__webpack_require__(163305);var b=__webpack_require__(657218);var A=__webpack_require__(177540);var M=__webpack_require__(365337);var T=__webpack_require__(936007);var L=__webpack_require__(79222);var P=__webpack_require__(302764);var C=__webpack_require__(667855);var E=__webpack_require__(354779);var O=__webpack_require__(83432);var _=__webpack_require__(212814);var H=__webpack_require__(438174);var I=__webpack_require__(90260);var N=__webpack_require__(609654);var D=__webpack_require__(885830);var F=__webpack_require__(597436);var J=__webpack_require__(321505);var x=__webpack_require__(345791);var B=__webpack_require__(320077);var U=__webpack_require__(947266);var Y=__webpack_require__(760264);var $=__webpack_require__(259016);r().setLevel(globalThis.METAMASK_DEBUG?"debug":"warn",!1);let K=(0,c.Y)();let R=(t,e)=>{(0,N.R3)(t),t.onNotification(async t=>{let{method:a}=t;if(a===h.c9)await e(t.params[0]);else if(a==="perpsStreamUpdate")(0,x.SB)().handleBackgroundUpdate(t.params[0]);else if(a!==A.g)throw new Error(`Internal JSON-RPC Notification Not Handled:

 ${JSON.stringify(t)}`)})};let j=t=>{(0,B.tO)(t,{handleSendUpdate:async t=>{(await K.promise).dispatch(L.M_O(t.params[0]))}})};async function Z(t){let{patchSubstream:e,initialState:a}=t;let r=await G(a,t);return e.write({jsonrpc:"2.0",method:f.f.StartSendingPatches}),X(r),r}async function z(t,e){!t.featureFlags&&(t.featureFlags={});let{currentLocaleMessages:a,enLocaleMessages:r}=await (0,k.UN)(t.currentLocale);t.textDirection==="rtl"&&(0,S.s)("rtl");let n={activeTab:e,metamask:t,appState:{},localeMessages:{currentLocale:t.currentLocale,current:a,en:r}};if((0,u.mc)()===p.YY||(0,u.mc)()===p.x$){let{origin:t}=n.activeTab;let e=(0,C.B4u)(n);let a=(0,M._)(n);let r=a&&(0,l.vI)(a,e);let o=(0,O.pm)(n);let s=(0,O.mD)(n);t&&s&&!o[t]&&e.length>0&&!r&&(n[d._1.unconnectedAccount]={state:E.nK.OPEN},L.dij(t))}let o=(0,P.A)(n);K.resolve(o);let s=(0,C.EcM)(t);let i=(0,I.A)(s,t.unapprovedPersonalMsgs,t.unapprovedDecryptMsgs,t.unapprovedEncryptionPublicKeyMsgs,t.unapprovedTypedMessages,t.networkId,(0,b.gr)({metamask:t}));return i.length>0&&o.dispatch(L.Z23({id:i[0].id})),o}async function G(t,e){let{traceContext:a}=e;(0,J.KO)();let r=(0,D.M)({metamask:t});let s=await (0,y.uP)({name:y.dg.SetupStore,parentContext:a,tags:r},()=>z(t,e.activeTab));globalThis.metamask={updateCurrentLocale:t=>{s.dispatch(L.DAg(t))},setFeatureFlag:(t,e)=>{s.dispatch(L.B4g(t,e))}},await (0,y.uP)({name:y.dg.InitialActions,parentContext:a},()=>Q(s));let i=(0,U._)();return(0,y.uP)({name:y.dg.FirstRender,parentContext:a},()=>(0,o.render)(n.createElement(H.A,{store:s,uiMessenger:i}),e.container)),s}async function Q(t){let e=t.getState();try{let a=(0,w.Y0)().toLowerCase();let{os:n}=e.metamask.browserEnvironment||{};n&&a&&t.dispatch(L.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,C.UyX)(e);if(a&&await t.dispatch(L.o$f(a)),(0,u.mc)()===p.YY){let e=Date.now();globalThis.metamask.id=e,await t.dispatch(L.AJb(e))}try{let a=async e=>{(0,_.QA)(e)&&await t.dispatch(L.s8B(!1,!1))};await a(e);let r=setInterval(()=>{let e=t.getState();let n=(0,C.SPM)(e);let o=(0,C.nT$)(e);if(n!==null&&!o){clearInterval(r);return}a(e)},F.a)}catch(t){r().error("[Metamask] checkIsSeedlessPasswordOutdated error",t)}}async function V(t){let e={...t.getState()};return e.version=globalThis.platform.getVersion(),e.browser=window.navigator.userAgent,e.metamask={...e.metamask,socialLoginEmail:undefined},e}function X(t){window.stateHooks.reloadExtension=()=>{i().runtime.reload()},window.stateHooks.getCleanAppState=async function(){return V(t)},window.stateHooks.getSentryAppState=function(){let e=t.getState();return(0,v.c)(e,g.z)},window.stateHooks.getLogs=function(){let{logs:e}=t.getState().metamask;return Object.values(e).sort((t,e)=>{return t.timestamp-e.timestamp})},(0,T.De)(!1?0:.1),!0&&(0,T.sr)()}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,m.T),console.log("State log copied")):console.log(a)}catch(t){console.error(t.message)}}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);