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

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