(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[9903],{80663(__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:()=>$.Z,_2:()=>K._2,b1:()=>z,hz:()=>Z,or:()=>j,vJ:()=>K.vJ});var t=__webpack_require__(244670);var e=__webpack_require__.n(t);var a=__webpack_require__(298166);var r=__webpack_require__.n(a);var n=__webpack_require__(67659);var o=__webpack_require__(879910);var s=__webpack_require__(954364);var i=__webpack_require__.n(s);var l=__webpack_require__(406288);var c=__webpack_require__(505632);var u=__webpack_require__(648609);var d=__webpack_require__(492691);var w=__webpack_require__(643918);var v=__webpack_require__(447043);var g=__webpack_require__(123101);var p=__webpack_require__(482978);var m=__webpack_require__(757705);var h=__webpack_require__(42948);var f=__webpack_require__(980072);var S=__webpack_require__(925775);var k=__webpack_require__(542583);var y=__webpack_require__(316577);var E=__webpack_require__(732994);var T=__webpack_require__(54563);var b=__webpack_require__(928989);var A=__webpack_require__(967500);var M=__webpack_require__(934520);var H=__webpack_require__(440869);var L=__webpack_require__(987607);var P=__webpack_require__(739506);var C=__webpack_require__(791648);var O=__webpack_require__(566941);var _=__webpack_require__(672269);var B=__webpack_require__(170849);var D=__webpack_require__(20051);var I=__webpack_require__(544089);var N=__webpack_require__(231903);var F=__webpack_require__(512153);var J=__webpack_require__(82236);var x=__webpack_require__(985532);var U=__webpack_require__(813456);var Y=__webpack_require__(860181);var $=__webpack_require__(876641);var K=__webpack_require__(191273);r().setLevel(globalThis.METAMASK_DEBUG?"debug":"warn",!1);let R=(0,u.Y)();let j=(t,e)=>{(0,I.R3)(t),t.onNotification(async t=>{let{method:a}=t;if(a===f.c9)await e(t.params[0]);else if(a==="perpsStreamUpdate")(0,x.SB)().handleBackgroundUpdate(t.params[0]);else if(a!==b.g)throw new Error(`Internal JSON-RPC Notification Not Handled:

 ${JSON.stringify(t)}`)})};let Z=t=>{(0,U.tO)(t,{handleSendUpdate:async t=>{(await R.promise).dispatch(H.M_O(t.params[0]))}})};async function z(t){let{patchSubstream:e,initialState:a}=t;let r=await Q(a,t);return e.write({jsonrpc:"2.0",method:S.f.StartSendingPatches}),X(r),r}async function G(t,e){!t.featureFlags&&(t.featureFlags={});let{currentLocaleMessages:a,enLocaleMessages:r}=await (0,y.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,P.B4u)(n);let a=(0,A._)(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[w._1.unconnectedAccount]={state:C.nK.OPEN},H.dij(t))}let o=(0,L.A)(n);R.resolve(o);let s=(0,P.EcM)(t);let i=(0,D.A)(s,t.unapprovedPersonalMsgs,t.unapprovedDecryptMsgs,t.unapprovedEncryptionPublicKeyMsgs,t.unapprovedTypedMessages,t.networkId,(0,T.gr)({metamask:t}));return i.length>0&&o.dispatch(H.Z23({id:i[0].id})),o}async function Q(t,e){let{traceContext:a}=e;(0,J.KO)();let r=(0,N.M)({metamask:t});let s=await (0,E.uP)({name:E.dg.SetupStore,parentContext:a,tags:r},()=>G(t,e.activeTab));globalThis.metamask={updateCurrentLocale:t=>{s.dispatch(H.DAg(t))},setFeatureFlag:(t,e)=>{s.dispatch(H.B4g(t,e))}},await (0,E.uP)({name:E.dg.InitialActions,parentContext:a},()=>V(s));let i=(0,Y._)();return(0,E.uP)({name:E.dg.FirstRender,parentContext:a},()=>(0,o.render)(n.createElement(B.A,{store:s,uiMessenger:i}),e.container)),s}async function V(t){let e=t.getState();try{let a=(0,m.Y0)().toLowerCase();let{os:n}=e.metamask.browserEnvironment||{};n&&a&&t.dispatch(H.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,P.UyX)(e);if(a&&await t.dispatch(H.o$f(a)),(0,d.mc)()===p.YY){let e=Date.now();globalThis.metamask.id=e,await t.dispatch(H.AJb(e))}try{let a=async e=>{(0,_.QA)(e)&&await t.dispatch(H.s8B(!1,!1))};await a(e);let r=setInterval(()=>{let e=t.getState();let n=(0,P.SPM)(e);let o=(0,P.nT$)(e);if(n!==null&&!o){clearInterval(r);return}a(e)},F.a)}catch(t){r().error("[Metamask] checkIsSeedlessPasswordOutdated error",t)}}async function W(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){!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 H.LWm(t)},window.stateHooks.captureBackgroundError=async function(t="Test Error"){await H.PDE(t)}),window.stateHooks.reloadExtension=()=>{i().runtime.reload()},window.stateHooks.getCleanAppState=async function(){return W(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,M.De)(!0?1:0),!0&&(0,M.Kf)()}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,h.T),console.log("State log copied")):console.log(a)}catch(t){console.error(t.message)}}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);