(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[8851],{241912(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";var e=__webpack_require__(494708);__webpack_require__.n(e),__webpack_require__(61625),__webpack_require__(692796),__webpack_require__(254629);var t=__webpack_require__(38588);__webpack_require__.n(t);var r=__webpack_require__(413279);var n=__webpack_require__.n(r);var a=__webpack_require__(78279);var i=__webpack_require__(129385);var o=__webpack_require__(171097);var l=__webpack_require__.n(o);var s=__webpack_require__(48050);__webpack_require__.n(s);var c=__webpack_require__(46754);var d=__webpack_require__(796213);var u=__webpack_require__(650710);__webpack_require__.n(u);var m=__webpack_require__(299150);var w=__webpack_require__(163305);var p=__webpack_require__(574618);var g=__webpack_require__(627009);var h=__webpack_require__(367149);var f=__webpack_require__(809654);let v=1*1e3;let b="phishing-warning-sw-registered";let S=document.getElementById("app-content");class y extends Error{constructor(){super("Timeout failed")}}async function T(){if((await n().storage.session.get(b))[b])return;let e=(0,h.uo)();let t;try{let r=new URL("http://localhost:9999/");r.hash="#extensionStartup",(t=window.document.createElement("iframe")).setAttribute("src",r.href),t.setAttribute("sandbox","allow-scripts allow-same-origin");let a;let i;let o=new Promise((e,t)=>{a=e,i=t});t.addEventListener("load",a),window.document.body.appendChild(t),setTimeout(()=>i(new y),v),await o,e===d.Yb?console.error("Firefox does not support required MV3 APIs: Phishing warning page iframe and service worker will reload each page refresh"):n().storage.session.set({[b]:!0})}catch(e){e instanceof y?console.warn("Phishing warning page timeout; page not guaranteed to work offline."):console.error("Failed to initialize phishing warning page",e)}finally{t&&t.remove()}}async function k(e,t,r,n,a){try{let i=await (0,c.b1)({activeTab:e,container:S,patchSubstream:t,traceContext:n,initialState:a});(0,w.t7)({name:w.dg.UIStartup}),!0&&window.document?.documentElement?.classList.add("controller-loaded");let{metamask:{completedOnboarding:o}={}}=i.getState();!o&&r!==d.t8&&globalThis.platform.openExtensionInBrowser()}catch(e){await (0,c.vJ)(S,c._2.TroubleStarting,e,undefined)}}async function L(e){if(!0){let e=new URLSearchParams(window.location.search).get("activeTabOrigin");if(e){let{origin:t,protocol:r}=new URL(e);return{id:"mock-site",title:"Mock Site",url:e,origin:t,protocol:r}}}if(e!==d.YY&&e!==d.x$)return{};let[t]=await n().tabs.query({active:!0,currentWindow:!0}).catch(e=>{(0,m.L3)()||l().error(e)});let{id:r,title:a,url:i}=t;let{origin:o,protocol:s}=i?new URL(i):{};return!o||o==="null"?{}:(0,{id:r,title:a,origin:o,protocol:s,url:i})}function P(e){let t=(0,g.Q)(e);let r=t.createStream("controller");let n=t.createStream("provider");let a=t.createStream("patch-store");return t.ignoreStream("background-liveness"),t.ignoreStream("app-init-liveness"),{controller:r,provider:n,patch:a}}async function x(e){let t=new a.K(e,{rpcMiddleware:[(0,i.$)()]});e.on("error",console.error.bind(console)),t.on("error",console.error.bind(console)),await t.initialize(),globalThis.ethereumProvider=t}(async function e(){let e=performance.now();let t=(0,w.uP)({name:w.dg.UIStartup,startTime:performance.timeOrigin});(0,w.uP)({name:w.dg.LoadScripts,startTime:performance.timeOrigin,parentContext:t}),(0,w.t7)({name:w.dg.LoadScripts,timestamp:performance.timeOrigin+e}),globalThis.platform=new p.A;let r=(0,h.mc)();let a=n().runtime.connect({name:r});let i=new c.ZL(a,S);i.install();let o=P(new s.ExtensionPortStream(a));let l=(0,f.Ay)(o.controller);async function d(e){(0,w.t7)({name:w.dg.BackgroundConnect}),i.startUiSyncReceived(),i.uninstall(),await x(o.provider);let n=await L(r);await k(n,o.patch,r,t,e),u.isManifestV3&&await T()}(0,c.or)(l,d),(0,c.hz)(o.patch),(0,w.uP)({name:w.dg.BackgroundConnect,parentContext:t})})().catch(l().error)}}).call(__webpack_require__._LM_("$root$",{__webpack_require__}))()}}]);