LavaPack.loadBundle([[10215,{"./prompt":10216},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.PanelController=void 0;var r=e("./prompt");function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i="rgb(56, 56, 56)",o="rgb(64, 64, 64)",a="rgb(30, 30, 30)",c="rgb(42, 42, 42)",u="rgb(13, 153, 255)",l="rgb(255, 255, 255)",d="rgb(173, 173, 173)",p="rgb(119, 119, 119)",m="rgb(13, 153, 255)",h="rgba(13, 153, 255, 0.15)",f="rgb(48, 209, 88)",g="rgb(255, 69, 58)",b="rgb(64, 64, 64)",y='Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif',k="ui-monospace,SFMono-Regular,Menlo,monospace";function w(e){return e?e.replace(/px$/u,"").trim():""}const v=[{pattern:/^(token|ds|theme)-/u,category:"Design Token"},{pattern:/^(text|bg|border|shadow|color)-/u,category:"Tailwind Color"},{pattern:/^(p|m|gap|space|w|h|min|max)-/u,category:"Tailwind Spacing"},{pattern:/^(flex|grid|col|row|justify|items|self)-/u,category:"Tailwind Layout"},{pattern:/^(font|text|leading|tracking|uppercase|lowercase|capitalize)/u,category:"Tailwind Typography"}],T=(function(e,...t){return e.reduce((e,n,r)=>e+n+(t[r]??""),"")})`
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  :host {
    all: initial;
  }

  @keyframes pulse-orb {
    0%,
    100% {
      opacity: 0.4;
      transform: scale(1);
    }
    50% {
      opacity: 1;
      transform: scale(1.3);
    }
  }

  .panel {
    position: fixed;
    width: 340px;
    background: ${"rgb(44, 44, 44)"};
    border-radius: 10px;
    box-shadow:
      0 8px 32px rgba(0, 0, 0, 0.55),
      0 0 0 1px rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    font-family: ${y};
    font-size: 12px;
    color: ${l};
    z-index: 2147483645;
    overflow: hidden;
    user-select: none;
    transition: max-height 0.2s ease;
  }
  .panel.hover-mode {
    max-height: 280px;
    overflow: hidden;
  }
  .panel.locked-mode {
    max-height: 680px;
    overflow-y: auto;
  }

  /* Header */
  .header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: ${i};
    cursor: move;
    flex-shrink: 0;
    border-bottom: 1px solid ${b};
  }
  .drag-handle {
    color: ${d};
    font-size: 16px;
    cursor: grab;
    flex-shrink: 0;
    line-height: 1;
  }
  .header-title {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    color: ${d};
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }
  .icon-btn {
    background: none;
    border: none;
    color: ${d};
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1;
  }
  .icon-btn:hover {
    background: ${o};
    color: ${l};
  }
  .copy-btn {
    font-size: 10px;
    background: ${i};
    color: ${d};
    border: 1px solid ${b};
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .copy-btn:hover {
    color: ${l};
    border-color: ${m};
  }
  .copy-btn.copied {
    color: ${f};
    border-color: ${f};
  }

  /* Lock bar */
  .lock-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    background: ${h};
    font-size: 10px;
    color: ${m};
  }
  .unlock-btn {
    background: transparent;
    border: 1px solid ${m};
    color: ${m};
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 10px;
    cursor: pointer;
  }
  .unlock-btn:hover {
    background: ${m};
    color: rgb(255, 255, 255);
  }

  /* Empty state */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    color: ${p};
    text-align: center;
  }

  /* Element header */
  .el-header {
    padding: 10px 12px;
    border-bottom: 1px solid ${b};
  }
  .el-name {
    font-weight: 700;
    font-size: 13px;
    color: ${l};
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .test-id-pill {
    font-size: 9px;
    font-family: ${k};
    background: ${h};
    color: ${m};
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
  }
  .el-breadcrumb {
    font-size: 10px;
    color: ${p};
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .el-filepath {
    font-size: 10px;
    color: ${p};
    font-family: ${k};
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Body */
  .body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
  .body::-webkit-scrollbar {
    width: 4px;
  }
  .body::-webkit-scrollbar-track {
    background: transparent;
  }
  .body::-webkit-scrollbar-thumb {
    background: ${b};
    border-radius: 2px;
  }

  /* Sections */
  .section {
    border-bottom: 1px solid ${b};
  }
  .section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: none;
    border: none;
    width: 100%;
    color: ${d};
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    font-family: ${y};
  }
  .section-header:hover {
    background: ${o};
  }
  .section-icon {
    font-size: 11px;
    width: 14px;
    text-align: center;
  }
  .chevron {
    font-size: 8px;
    transition: transform 0.15s;
    color: ${"rgb(136, 136, 136)"};
    margin-left: auto;
  }
  .chevron.open {
    transform: rotate(90deg);
  }
  .section-body {
    padding: 6px 12px 10px;
  }

  /* Property rows */
  .prop-row {
    display: flex;
    align-items: flex-start;
    min-height: 24px;
    gap: 6px;
    margin: 1px 0;
  }
  .prop-label {
    font-size: 10px;
    color: ${p};
    width: 72px;
    flex-shrink: 0;
    padding-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .prop-value {
    flex: 1;
    min-width: 0;
  }

  /* Two-col grid */
  .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
  }

  /* Editable values */
  .editable {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: ${k};
    color: ${l};
    border: 1px solid transparent;
    min-height: 22px;
    word-break: break-all;
    transition: background 0.1s;
  }
  .editable:hover {
    background: ${c};
    border-color: ${b};
  }
  .editable input,
  .edit-input {
    width: 100%;
    background: ${a};
    color: ${l};
    border: 1px solid ${u};
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: ${k};
    outline: none;
  }
  .color-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    cursor: pointer;
  }
  .color-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
  }
  .readonly {
    font-size: 11px;
    font-family: ${k};
    color: ${l};
    padding: 2px 6px;
    word-break: break-all;
  }

  /* Text area */
  .text-input {
    width: 100%;
    background: ${a};
    color: ${l};
    border: 1px solid ${b};
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 11px;
    font-family: ${y};
    outline: none;
    resize: vertical;
    min-height: 40px;
  }
  .text-input:focus {
    border-color: ${u};
  }

  /* Spacing editor */
  .spacing-editor {
    margin: 4px 0;
  }
  .spacing-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    font-family: ${y};
  }
  .spacing-cross-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: ${a};
    border-radius: 6px;
    border: 1px solid ${b};
  }
  .spacing-mid-row {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    justify-content: center;
  }
  .spacing-cross-wrap .sc-center {
    width: 36px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
  }
  .mini-input {
    width: 40px;
    text-align: center;
    background: transparent;
    color: ${l};
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 2px 2px;
    font-size: 10px;
    font-family: ${k};
    outline: none;
    cursor: pointer;
    transition:
      border-color 0.1s,
      background-color 0.1s;
  }
  .mini-input:hover {
    border-color: ${b};
    background: ${c};
  }
  .mini-input:focus {
    border-color: ${u};
    background: ${a};
  }

  /* Pill list */
  .pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: ${i};
    border-radius: 10px;
    font-size: 10px;
    font-family: ${k};
    color: ${d};
    max-width: 100%;
    overflow: hidden;
  }
  .pill-x {
    color: ${p};
    cursor: pointer;
    padding: 0 2px;
    font-size: 10px;
  }
  .pill-x:hover {
    color: ${g};
  }
  .add-btn {
    font-size: 10px;
    color: ${m};
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    margin-top: 4px;
  }
  .add-input {
    font-size: 10px;
    font-family: ${k};
    background: ${a};
    color: ${l};
    border: 1px solid ${u};
    border-radius: 4px;
    padding: 3px 6px;
    outline: none;
    width: 100%;
    margin-top: 4px;
  }

  /* Props JSON */
  .props-pre {
    font-size: 10px;
    font-family: ${k};
    color: ${p};
    background: ${a};
    border-radius: 4px;
    padding: 6px 8px;
    margin-top: 6px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 100px;
    overflow-y: auto;
    line-height: 1.4;
  }

  /* Chat footer */
  .footer {
    flex-shrink: 0;
    background: rgb(26, 26, 26);
    border-radius: 0 0 10px 10px;
  }
  .footer-top {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-top: 1px solid ${b};
  }
  .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: ${p};
  }
  .status-dot.connected {
    background: ${f};
    box-shadow: 0 0 6px ${f};
  }
  .status-dot.disconnected {
    background: ${g};
    box-shadow: 0 0 6px ${g};
  }
  .component-pill {
    font-size: 10px;
    font-family: ${k};
    color: ${d};
    background: ${i};
    padding: 1px 6px;
    border-radius: 8px;
  }

  /* Pending edits banner */
  .edits-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: rgba(255, 165, 0, 0.12);
    font-size: 10px;
    color: rgb(255, 179, 71);
  }
  .edits-banner-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .apply-btn {
    background: rgb(255, 179, 71);
    color: rgb(26, 26, 26);
    border: none;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
  }
  .apply-btn:hover {
    background: rgb(255, 197, 110);
  }

  /* Message thread */
  .message-thread {
    max-height: 160px;
    overflow-y: auto;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .message-thread::-webkit-scrollbar {
    width: 3px;
  }
  .message-thread::-webkit-scrollbar-thumb {
    background: ${b};
    border-radius: 2px;
  }
  .msg-sent {
    align-self: flex-end;
    background: ${m};
    color: rgb(255, 255, 255);
    border-radius: 8px 8px 2px 8px;
    padding: 5px 8px;
    font-size: 11px;
    max-width: 85%;
    word-break: break-word;
    line-height: 1.35;
  }
  .msg-agent {
    align-self: flex-start;
    background: ${i};
    color: ${d};
    border-radius: 8px 8px 8px 2px;
    padding: 5px 8px;
    font-size: 11px;
    max-width: 85%;
    word-break: break-word;
    line-height: 1.35;
  }
  .msg-status {
    align-self: center;
    color: ${p};
    font-size: 10px;
    font-style: italic;
  }

  /* Agent working indicator */
  .agent-working {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 10px;
    color: ${p};
  }
  .pulse-orb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: ${m};
    animation: pulse-orb 1.2s ease-in-out infinite;
  }

  /* Composer */
  .composer {
    display: flex;
    align-items: flex-end;
    padding: 6px 12px 10px;
    gap: 0;
    position: relative;
  }
  .composer-wrap {
    flex: 1;
    position: relative;
  }
  .chat-input {
    width: 100%;
    box-sizing: border-box;
    background: ${a};
    color: ${l};
    border: 1px solid ${b};
    border-radius: 8px;
    padding: 8px 40px 8px 10px;
    font-size: 11px;
    font-family: ${y};
    outline: none;
    resize: none;
    min-height: 36px;
  }
  .chat-input:focus {
    border-color: ${u};
  }
  .send-btn {
    position: absolute;
    right: 5px;
    bottom: 7px;
    background: ${m};
    color: rgb(255, 255, 255);
    border: none;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
  }
  .send-btn:disabled {
    opacity: 0.3;
    cursor: default;
  }

  /* Minimized */
  .minimized .body,
  .minimized .footer,
  .minimized .el-header,
  .minimized .lock-bar,
  .minimized .empty-state {
    display: none;
  }
`;n.PanelController=class{constructor(e,t){s(this,"host",null),s(this,"shadow",null),s(this,"relay",void 0),s(this,"options",void 0),s(this,"info",null),s(this,"selectedEl",null),s(this,"originalSnapshot",{}),s(this,"editLog",new Map),s(this,"editLogStrings",[]),s(this,"chatMessages",[]),s(this,"agentWorking",!1),s(this,"relayStatus","checking"),s(this,"isMinimized",!1),s(this,"isVisible",!1),s(this,"isLocked",!1),s(this,"anchor",{h:"right",x:20,v:"bottom",y:20}),s(this,"sectionStates",new Map),s(this,"healthInterval",null),this.relay=e,this.options=t}mount(e){this.host=document.createElement("div"),this.host.className="dm-panel",this.host.setAttribute("data-designer-mode","panel"),this.shadow=this.host.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=T,this.shadow.appendChild(t),this.render(),e.appendChild(this.host),this.relay.onResponse(e=>{this.agentWorking=!1,this.chatMessages.push({type:"agent",text:e}),this.render()}),this.checkHealth(),this.healthInterval=setInterval(()=>this.checkHealth(),1e4)}setPosition(e,t){const n=window.innerWidth-e-44;e+340<=window.innerWidth?this.anchor={...this.anchor,h:"right",x:e}:n+340<=window.innerWidth?this.anchor={...this.anchor,h:"left",x:n}:this.anchor={...this.anchor,h:"right",x:Math.max(0,window.innerWidth-340)};const r=window.innerHeight-t-44;t+680<=window.innerHeight?this.anchor={...this.anchor,v:"bottom",y:t}:r+680<=window.innerHeight?this.anchor={...this.anchor,v:"top",y:r}:this.anchor={...this.anchor,v:"bottom",y:Math.max(0,window.innerHeight-680)}}showCompact(){this.info=null,this.selectedEl=null,this.isLocked=!1,this.isVisible=!0,this.render()}show(e,t){this.info=e,this.selectedEl=t,this.isLocked=!0;const n={};for(const t of Object.values(e.computedStyles))for(const[e,r]of Object.entries(t))n[e]=r;e.textContent&&(n.__textContent=e.textContent),this.originalSnapshot=n,this.editLog.clear(),this.editLogStrings=[],this.isVisible=!0,this.render()}showHover(e,t){this.isLocked||(this.info=e,this.selectedEl=t,this.isVisible=!0,this.render())}hideHover(){this.isLocked||(this.info=null,this.selectedEl=null,this.render())}hide(){this.info=null,this.selectedEl=null,this.isLocked=!1,this.isVisible=!1,this.editLog.clear(),this.editLogStrings=[],this.render()}recordEdit(e,t,n){const r=this.originalSnapshot[e]??"";if(t===r)this.editLog.delete(e);else{const n=this.editLog.get(e),s=n?.original??r;this.editLog.set(e,{original:s,current:t});const i=`${e}: ${w(s)} → ${w(t)}`,o=this.editLogStrings.findIndex(t=>t.startsWith(`${e}:`));o>=0?this.editLogStrings[o]=i:this.editLogStrings.push(i)}e.startsWith("__")||n.style.setProperty(e,t)}applyEdit(e,t,n){this.recordEdit(e,t,n),this.render()}unmount(){this.healthInterval&&clearInterval(this.healthInterval),this.host?.remove()}getChangeset(){return Array.from(this.editLog.entries()).map(([e,{original:t,current:n}])=>({property:e,original:t,current:n}))}async checkHealth(){const e=this.relayStatus;this.relayStatus=await this.relay.checkHealth(),this.relayStatus!==e&&this.render()}async sendToAgent(e){if(!this.info)return;e&&this.chatMessages.push({type:"sent",text:e}),this.agentWorking=!0,this.render();const t=(0,r.formatAgentPrompt)(this.info,this.getChangeset(),e);await this.relay.sendMessage(t)}getAllStyles(){if(!this.info)return{};const e={};for(const t of Object.values(this.info.computedStyles))for(const[n,r]of Object.entries(t))e[n]=r;return e}getVal(e){return this.editLog.get(e)?.current??this.getAllStyles()[e]??""}detectTokens(){if(!this.info)return[];const e=this.options.tokenPatterns??v,t=[];for(const n of this.info.classes)for(const r of e)if(r.pattern.test(n)){t.push(n);break}return t}getComponentPath(){if(!this.info?.domPath)return"";return this.info.domPath.split(" > ").slice(-3).join(" › ")}render(){if(!this.shadow)return;const e=this.shadow.querySelector(".panel"),t=e?e.scrollTop:0;if(e&&e.remove(),!this.isVisible)return;const n=document.createElement("div");n.className=`panel${this.isMinimized?" minimized":""} ${this.isLocked?"locked-mode":"hover-mode"}`,n.style.cssText=`${this.anchor.h}:${this.anchor.x}px;${this.anchor.v}:${this.anchor.y}px;`,n.appendChild(this.renderHeader()),this.isMinimized||(this.isLocked&&n.appendChild(this.renderLockBar()),this.info?(n.appendChild(this.renderElementHeader()),n.appendChild(this.renderBody()),n.appendChild(this.renderFooter())):n.appendChild(this.renderEmptyState())),this.shadow.appendChild(n),t&&requestAnimationFrame(()=>{n.scrollTop=t}),this.setupDrag(n)}renderHeader(){const e=document.createElement("div");e.className="header";const t=document.createElement("span");t.className="drag-handle",t.textContent="⠿";const n=document.createElement("span");n.className="header-title",n.textContent="Designer Mode";const s=document.createElement("div");s.className="header-actions";const i=document.createElement("button");i.className="copy-btn",i.textContent="Copy for AI",i.onclick=()=>{const{info:e}=this;e&&navigator.clipboard.writeText((0,r.formatForClipboard)(e,this.getChangeset())).then(()=>{i.textContent="✓ Copied",i.classList.add("copied"),setTimeout(()=>{i.textContent="Copy for AI",i.classList.remove("copied")},2e3)}).catch(()=>{})};const o=document.createElement("button");o.className="icon-btn",o.textContent=this.isMinimized?"▢":"▁",o.onclick=()=>{this.isMinimized=!this.isMinimized,this.render()};const a=document.createElement("button");return a.className="icon-btn",a.textContent="×",a.onclick=()=>{this.options.onClose?.()},s.appendChild(i),s.appendChild(o),s.appendChild(a),e.appendChild(t),e.appendChild(n),e.appendChild(s),e}renderLockBar(){const e=document.createElement("div");e.className="lock-bar";const t=document.createElement("span");t.textContent="🔒 Selection locked";const n=document.createElement("button");return n.className="unlock-btn",n.textContent="Unlock",n.onclick=()=>{this.options.onUnlock?.()},e.appendChild(t),e.appendChild(n),e}renderEmptyState(){const e=document.createElement("div");e.className="empty-state";const t=document.createElement("div");t.textContent="◎",t.style.cssText="font-size:32px;margin-bottom:12px;opacity:0.4;";const n=document.createElement("div");n.textContent="Hover over any element",n.style.cssText="font-size:12px;font-weight:500;margin-bottom:4px;";const r=document.createElement("div");return r.textContent="Click to lock selection and edit values",r.style.cssText="font-size:11px;",e.appendChild(t),e.appendChild(n),e.appendChild(r),e}renderElementHeader(){const e=document.createElement("div");e.className="el-header";const t=document.createElement("div");t.className="el-name";const n=document.createElement("span");if(n.textContent=this.info?.componentName??"—",t.appendChild(n),this.info?.testId){const e=document.createElement("span");e.className="test-id-pill",e.textContent=this.info.testId,t.appendChild(e)}e.appendChild(t);const r=this.getComponentPath();if(r){const t=document.createElement("div");t.className="el-breadcrumb",t.textContent=r,e.appendChild(t)}if(this.info?.filePath){const t=document.createElement("div");t.className="el-filepath";const n=this.info.filePath.split("/").slice(-2).join("/"),r=`${this.info.filePath}${this.info.lineNumber?`:${this.info.lineNumber}`:""}`;t.textContent=`${n}${this.info.lineNumber?`:${this.info.lineNumber}`:""}`,t.title=r,e.appendChild(t)}return e}renderBody(){const e=document.createElement("div");e.className="body",this.info&&null!==this.info.textContent&&e.appendChild(this.renderTextSection()),e.appendChild(this.renderLayoutSection()),e.appendChild(this.renderSpacingSection()),e.appendChild(this.renderTypographySection()),e.appendChild(this.renderFillStrokeSection()),e.appendChild(this.renderComponentSection());const t=this.detectTokens();return t.length>0&&e.appendChild(this.renderTokensSection(t)),this.info?.classes.length&&e.appendChild(this.renderClassesSection()),e}renderTextSection(){return this.buildSection("Text Content","✏",!0,e=>{const t=document.createElement("textarea");t.className="text-input",t.value=this.info?.textContent??"",t.rows=2,t.oninput=()=>{if(this.selectedEl){this.recordEdit("__textContent",t.value,this.selectedEl);const e=Array.from(this.selectedEl.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE);e.length>0&&(e[0].textContent=t.value)}},e.appendChild(t)})}renderLayoutSection(){return this.buildSection("Layout","⊞",!0,e=>{const t=this.getAllStyles(),n=document.createElement("div");n.className="two-col";const r=[["Display","display"],["Position","position"],["W","width"],["H","height"]];for(const[e,t]of r)n.appendChild(this.makePropRow(e,t,this.getVal(t)));e.appendChild(n);const s=function(e,t){return e[t]??""}(t,"flex-direction");if(s){const t=document.createElement("div");t.className="two-col",t.style.marginTop="6px";const n=[["Direction","flex-direction"],["Align","align-items"],["Justify","justify-content"],["Gap","gap"]];for(const[e,r]of n)t.appendChild(this.makePropRow(e,r,this.getVal(r)));e.appendChild(t)}const i=this.getVal("overflow");i&&"visible"!==i&&e.appendChild(this.makePropRowFull("Overflow","overflow",i))})}renderSpacingSection(){return this.buildSection("Spacing","⬜",!0,e=>{e.appendChild(this.buildSpacingCross("Margin",m,h,["margin-top","margin-right","margin-bottom","margin-left"])),e.appendChild(this.buildSpacingCross("Padding",f,"rgba(48, 209, 88, 0.15)",["padding-top","padding-right","padding-bottom","padding-left"]))})}buildSpacingCross(e,t,n,r){const s=document.createElement("div");s.className="spacing-editor",s.style.marginBottom="8px";const i=document.createElement("div");i.className="spacing-label",i.style.color=t,i.textContent=e,s.appendChild(i);const o=document.createElement("div");o.className="spacing-cross-wrap";const a=e=>{const n=document.createElement("input");return n.className="mini-input",n.value=w(this.getVal(r[e]))||"0",n.style.color=t,this.setupMiniInput(n,r[e],t),n};o.appendChild(a(0));const c=document.createElement("div");c.className="spacing-mid-row",c.appendChild(a(3));const u=document.createElement("div");return u.className="sc-center",u.style.background=n,u.style.opacity="0.15",u.style.backgroundColor=t,c.appendChild(u),c.appendChild(a(1)),o.appendChild(c),o.appendChild(a(2)),s.appendChild(o),s}setupMiniInput(e,t,n){let r="";e.onfocus=()=>{r=e.value,e.select()},e.onblur=()=>{if(this.selectedEl&&e.value!==r){const n=e.value.trim(),r=/^\d+$/u.test(n)?`${n}px`:n;this.applyEdit(t,r,this.selectedEl)}},e.onkeydown=n=>{if("Enter"!==n.key){if("Escape"===n.key)return e.value=w(this.getVal(t))||"0",void e.blur();if("ArrowUp"===n.key||"ArrowDown"===n.key){n.preventDefault();const r=n.shiftKey?10:1,s="ArrowUp"===n.key?r:-r,i=parseFloat(e.value)||0;e.value=String(i+s),this.selectedEl&&this.recordEdit(t,`${e.value}px`,this.selectedEl)}}else e.blur()}}renderTypographySection(){return this.buildSection("Typography","T",!0,e=>{e.appendChild(this.makePropRowFull("Font","font-family",this.getVal("font-family")));const t=document.createElement("div");t.className="two-col";const n=[["Size","font-size"],["Weight","font-weight"],["Line H.","line-height"],["Align","text-align"]];for(const[e,r]of n)t.appendChild(this.makePropRow(e,r,this.getVal(r)));e.appendChild(t);const r=this.getVal("color");r&&e.appendChild(this.makeColorRow("Color","color",r))})}renderFillStrokeSection(){return this.buildSection("Fill & Stroke","◉",!1,e=>{const t=this.getVal("background-color")||this.getVal("background");t&&"rgba(0, 0, 0, 0)"!==t&&e.appendChild(this.makeColorRow("Background","background-color",t));const n=this.getVal("opacity");n&&"1"!==n&&e.appendChild(this.makePropRowFull("Opacity","opacity",n));const r=this.getVal("border-width"),s=this.getVal("border-style"),i=this.getVal("border-color");r&&"0px"!==r&&e.appendChild(this.makePropRowFull("Border","border-width",`${r} ${s} ${i}`));const o=this.getVal("border-radius");o&&"0px"!==o&&e.appendChild(this.makePropRowFull("Radius","border-radius",o));const a=this.getVal("box-shadow");a&&"none"!==a&&e.appendChild(this.makePropRowFull("Shadow","box-shadow",a))})}renderComponentSection(){return this.buildSection("Component","⚛",!1,e=>{const{info:t}=this;if(!t)return;const n=[["Name",t.componentName],["Test ID",t.testId??"—"],["File",t.filePath?`${t.filePath.split("/").slice(-2).join("/")}${t.lineNumber?`:${t.lineNumber}`:""}`:"—"]];for(const[r,s]of n){const n=document.createElement("div");n.className="prop-row";const i=document.createElement("span");i.className="prop-label",i.textContent=r;const o=document.createElement("span");o.className="readonly",o.textContent=s,"File"===r&&t.filePath&&(o.title=`${t.filePath}${t.lineNumber?`:${t.lineNumber}`:""}`),n.appendChild(i),n.appendChild(o),e.appendChild(n)}if(t.domPath){const n=document.createElement("div");n.className="prop-row";const r=document.createElement("span");r.className="prop-label",r.textContent="DOM Path";const s=document.createElement("span");s.className="readonly",s.style.cssText=`font-size:9px;color:${p};word-break:break-all;`,s.textContent=t.domPath,n.appendChild(r),n.appendChild(s),e.appendChild(n)}if(t.props&&Object.keys(t.props).length>0){const n=document.createElement("pre");n.className="props-pre",n.textContent=JSON.stringify(t.props,null,2),e.appendChild(n)}})}renderTokensSection(e){return this.buildSection("Design Tokens","◆",!1,t=>{this.buildEditablePillList(t,e,{onRemove:e=>{this.selectedEl&&this.selectedEl.classList.remove(e),this.render()},onAdd:e=>{this.selectedEl&&this.selectedEl.classList.add(e),this.render()}})})}renderClassesSection(){return this.buildSection("Classes","{ }",!1,e=>{const t=this.info?.classes??[];this.buildEditablePillList(e,t,{onRemove:e=>{this.selectedEl&&this.selectedEl.classList.remove(e),this.render()},onAdd:e=>{this.selectedEl&&this.selectedEl.classList.add(e),this.render()}})})}buildEditablePillList(e,t,n){const r=document.createElement("div");r.className="pill-list";for(const e of t){const t=document.createElement("span");t.className="pill";const s=document.createElement("span");s.textContent=e,s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;";const i=document.createElement("span");i.className="pill-x",i.textContent="×",i.onclick=t=>{t.stopPropagation(),n.onRemove(e)},t.appendChild(s),t.appendChild(i),r.appendChild(t)}e.appendChild(r);const s=document.createElement("button");s.className="add-btn",s.textContent="+ Add",s.onclick=()=>{s.style.display="none";const t=document.createElement("input");t.className="add-input",t.placeholder="Type and press Enter",e.appendChild(t),t.focus(),t.onkeydown=e=>{if("Enter"===e.key){const e=t.value.trim();e&&n.onAdd(e),t.remove(),s.style.display=""}"Escape"===e.key&&(t.remove(),s.style.display="")},t.onblur=()=>{t.remove(),s.style.display=""}},e.appendChild(s)}renderFooter(){const e=document.createElement("div");e.className="footer";const t=document.createElement("div");t.className="footer-top";const n=document.createElement("span");n.className=`status-dot ${this.relayStatus}`;const r=document.createElement("span");r.style.cssText=`font-size:10px;color:${"connected"===this.relayStatus?f:p};`,r.textContent="connected"===this.relayStatus?"Connected":"Not connected";const s=document.createElement("span");if(s.className="component-pill",s.textContent=this.info?.componentName??"No selection",t.appendChild(n),t.appendChild(r),t.appendChild(s),e.appendChild(t),this.editLog.size>0){const t=document.createElement("div");t.className="edits-banner";const n=document.createElement("span");n.className="edits-banner-text";const r=this.editLogStrings.slice(0,2).join(", "),s=this.editLog.size>2?` +${this.editLog.size-2} more`:"";n.textContent=`${this.editLog.size} pending edit${this.editLog.size>1?"s":""}: ${r}${s}`;const i=document.createElement("button");i.className="apply-btn",i.textContent="Apply",i.onclick=()=>this.sendToAgent(""),t.appendChild(n),t.appendChild(i),e.appendChild(t)}if(this.chatMessages.length>0){const t=document.createElement("div");t.className="message-thread";for(const e of this.chatMessages){const n=document.createElement("div");n.className=`msg-${e.type}`,n.textContent=e.text,t.appendChild(n)}e.appendChild(t),requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}if(this.agentWorking){const t=document.createElement("div");t.className="agent-working";const n=document.createElement("span");n.className="pulse-orb";const r=document.createElement("span");r.textContent="Check your agent for progress and approvals",t.appendChild(n),t.appendChild(r),e.appendChild(t)}const i=document.createElement("div");i.className="composer";const o=document.createElement("div");o.className="composer-wrap";const a=document.createElement("textarea");a.className="chat-input",a.placeholder="Describe the change...",a.rows=3;const c=document.createElement("button");c.className="send-btn",c.textContent="↑",c.disabled="connected"!==this.relayStatus;const u=()=>{const e=a.value.trim();(e||0!==this.editLog.size)&&(this.sendToAgent(e),a.value="")};return a.onkeydown=e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u())},c.onclick=u,o.appendChild(a),o.appendChild(c),i.appendChild(o),e.appendChild(i),e}buildSection(e,t,n,r){const s=document.createElement("div");s.className="section";const i=document.createElement("button");i.className="section-header";const o=document.createElement("span");o.className="section-icon",o.textContent=t;const a=document.createElement("span");a.textContent=e;const c=this.sectionStates.get(e)??n,u=document.createElement("span");u.className="chevron"+(c?" open":""),u.textContent="▶",i.appendChild(o),i.appendChild(a),i.appendChild(u);const l=document.createElement("div");return l.className="section-body",l.style.display=c?"block":"none",r(l),i.onclick=()=>{const t="none"!==l.style.display;l.style.display=t?"none":"block",u.className="chevron"+(t?"":" open"),this.sectionStates.set(e,!t)},s.appendChild(i),s.appendChild(l),s}makePropRow(e,t,n){const r=document.createElement("div");r.className="prop-row";const s=document.createElement("span");s.className="prop-label",s.textContent=e;const i=document.createElement("div");return i.className="prop-value",i.appendChild(this.makeEditableValue(t,n)),r.appendChild(s),r.appendChild(i),r}makePropRowFull(e,t,n){const r=document.createElement("div");r.className="prop-row";const s=document.createElement("span");s.className="prop-label",s.textContent=e;const i=document.createElement("div");return i.className="prop-value",i.appendChild(this.makeEditableValue(t,n)),r.appendChild(s),r.appendChild(i),r}makeColorRow(e,t,n){const r=document.createElement("div");r.className="prop-row";const s=document.createElement("span");s.className="prop-label",s.textContent=e;const i=document.createElement("div");return i.className="prop-value",i.appendChild(this.makeEditableValue(t,n,!0)),r.appendChild(s),r.appendChild(i),r}makeEditableValue(e,t,n=!1){const r=document.createElement("div");if(r.className="editable",n&&t&&"rgba(0, 0, 0, 0)"!==t){const n=document.createElement("span");n.className="color-swatch",n.style.background=t;const s=document.createElement("input");s.type="color",s.className="color-input",s.value=function(e){if(e.startsWith("#"))return e;const t=e=>e.toString(16).padStart(2,"0"),n=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/u);return n?`#${t(Number(n[1]))}${t(Number(n[2]))}${t(Number(n[3]))}`:`#${t(0)}${t(0)}${t(0)}`}(t),s.oninput=()=>{n.style.background=s.value,this.selectedEl&&this.recordEdit(e,s.value,this.selectedEl)},n.onclick=e=>{e.stopPropagation(),s.click()},r.appendChild(n),r.appendChild(s)}const s=document.createElement("span");return s.textContent=w(t)||"—",s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",r.appendChild(s),r.onclick=()=>{const s=document.createElement("input");s.className="edit-input",s.value=t,r.replaceWith(s),s.focus(),s.select();const i=t,o=/^-?\d*\.?\d+(px|em|rem|%|vh|vw|pt)?$/u.test(t.trim());s.onkeydown=t=>{if("Enter"!==t.key){if("Escape"===t.key)return s.value=i,void s.blur();if(o&&("ArrowUp"===t.key||"ArrowDown"===t.key)){t.preventDefault();const n=t.shiftKey?10:1,r="ArrowUp"===t.key?n:-n,i=s.value.match(/^(-?\d*\.?\d+)(.*)/u);i&&(s.value=`${parseFloat(i[1])+r}${i[2]}`,this.selectedEl&&this.recordEdit(e,s.value,this.selectedEl))}}else s.blur()},s.oninput=()=>{this.selectedEl&&this.recordEdit(e,s.value,this.selectedEl)},s.onblur=()=>{const t=s.value,r=this.makeEditableValue(e,t,n);s.replaceWith(r),this.selectedEl&&t!==i&&this.applyEdit(e,t,this.selectedEl)}},r}setupDrag(e){const t=e.querySelector(".header");if(!t)return;let n=!1,r=0,s=0;t.onmousedown=e=>{e.target.closest("button")||(n=!0,r=e.clientX,s=e.clientY,e.preventDefault())};document.addEventListener("mousemove",t=>{if(!n)return;const i=t.clientX-r,o=t.clientY-s,a="right"===this.anchor.h?-1:1,c="bottom"===this.anchor.v?-1:1;this.anchor.x=Math.max(0,Math.min(window.innerWidth-340,this.anchor.x+i*a)),this.anchor.y=Math.max(0,Math.min(window.innerHeight-100,this.anchor.y+o*c)),e.style[this.anchor.h]=`${this.anchor.x}px`,e.style[this.anchor.v]=`${this.anchor.y}px`,r=t.clientX,s=t.clientY}),document.addEventListener("mouseup",()=>{n=!1})}}}}},{package:"$root$",file:"ui/helpers/designer-mode/core/panel.ts"}],[10216,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t,n){const r=["=== DESIGNER MODE REQUEST ===",""];if(r.push("Selected Element"),r.push(`  Component : ${e.componentName}`),e.filePath&&r.push(`  File      : ${e.filePath}${e.lineNumber?`:${e.lineNumber}`:""}`),e.testId&&r.push(`  Test ID   : ${e.testId}`),e.classes.length&&r.push(`  Classes   : ${e.classes.join(" ")}`),e.domPath&&r.push(`  DOM Path  : ${e.domPath}`),r.push(""),e.props&&Object.keys(e.props).length>0){r.push("Props");for(const[t,n]of Object.entries(e.props))r.push(`  ${t.padEnd(12)}: ${n}`);r.push("")}const s=[["Layout",e.computedStyles.layout],["Typography",e.computedStyles.typography],["Color",e.computedStyles.color],["Spacing",e.computedStyles.spacing],["Borders",e.computedStyles.border],["Effects",e.computedStyles.effects]];for(const[e,t]of s){const n=Object.entries(t).filter(([,e])=>e);if(n.length){r.push(e);for(const[e,t]of n)r.push(`  ${e.padEnd(20)}: ${t}`);r.push("")}}if(t.length>0){r.push("Changeset (inline edits made by designer)");for(const e of t)r.push(`  ${e.property.padEnd(20)}: ${e.original} → ${e.current}`);r.push("")}return e.textContent&&(r.push("Text Content"),r.push(`  "${e.textContent}"`),r.push("")),n&&(r.push("Designer Message"),r.push(`  "${n}"`),r.push("")),r.push("=== END ==="),r.join("\n")}Object.defineProperty(n,"__esModule",{value:!0}),n.formatAgentPrompt=r,n.formatForClipboard=function(e,t=[]){return r(e,t,"")}}}},{package:"$root$",file:"ui/helpers/designer-mode/core/prompt.ts"}],[10217,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(n,"__esModule",{value:!0}),n.RelayClient=void 0;n.RelayClient=class{constructor(e="http://localhost:3334"){r(this,"baseUrl",void 0),r(this,"polling",!1),r(this,"onResponseCallback",null),this.baseUrl=e}async sendMessage(e){await fetch(`${this.baseUrl}/api/message`,{method:"POST",headers:{"Content-Type":"text/plain"},body:e}),this.startPolling()}onResponse(e){this.onResponseCallback=e}startPolling(){this.polling||(this.polling=!0,this.pollLoop().catch(()=>{this.polling=!1}))}async pollLoop(){for(;this.polling;)try{const e=await fetch(`${this.baseUrl}/api/poll`);if(200===e.status){const t=await e.text();if(t&&this.onResponseCallback)return this.onResponseCallback(t),void(this.polling=!1)}}catch{await new Promise(e=>setTimeout(e,1e3))}}stopPolling(){this.polling=!1}async checkHealth(){try{return(await fetch(`${this.baseUrl}/api/health`,{signal:AbortSignal.timeout(2e3)})).ok?"connected":"disconnected"}catch{return"disconnected"}}}}}},{package:"$root$",file:"ui/helpers/designer-mode/core/relay.ts"}],[10218,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(n,"__esModule",{value:!0}),n.ToggleController=void 0;n.ToggleController=class{constructor(){r(this,"btn",null),r(this,"isActive",!1),r(this,"onToggle",null),r(this,"label",null),r(this,"pos",{right:20,bottom:20})}mount(e){this.btn=document.createElement("button"),this.btn.className="dm-toggle",this.btn.setAttribute("data-designer-mode","toggle"),Object.assign(this.btn.style,{position:"fixed",bottom:`${this.pos.bottom}px`,right:`${this.pos.right}px`,width:"44px",height:"44px",borderRadius:"22px",border:"none",background:"rgb(3, 125, 214)",cursor:"grab",fontSize:"20px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(3, 125, 214, 0.4)",zIndex:"2147483644",transition:"width 0.2s ease-out, padding 0.2s ease-out",overflow:"hidden",gap:"8px",padding:"0",whiteSpace:"nowrap"});const t=document.createElement("span");t.textContent="🎨",t.style.flexShrink="0",this.label=document.createElement("span"),Object.assign(this.label.style,{fontSize:"13px",fontWeight:"600",color:"rgb(255, 255, 255)",display:"none",whiteSpace:"nowrap"}),this.label.textContent="Designer Mode",this.btn.appendChild(t),this.btn.appendChild(this.label),this.btn.title="Toggle Designer Mode (Ctrl+Shift+D)",this.btn.onmouseenter=()=>{this.btn&&this.label&&(this.label.style.display="inline",this.btn.style.width="auto",this.btn.style.padding="0 16px")},this.btn.onmouseleave=()=>{this.btn&&this.label&&(this.label.style.display="none",this.btn.style.width="44px",this.btn.style.padding="0")},this.setupDrag(),e.appendChild(this.btn)}setupDrag(){if(!this.btn)return;let e=!1,t=!1,n=0,r=0;this.btn.onmousedown=s=>{e=!0,t=!1,n=s.clientX,r=s.clientY,this.btn&&(this.btn.style.cursor="grabbing"),s.preventDefault()};document.addEventListener("mousemove",s=>{if(!e||!this.btn)return;const i=s.clientX-n,o=s.clientY-r;!t&&Math.abs(i)<4&&Math.abs(o)<4||(t=!0,this.pos={right:Math.max(0,Math.min(window.innerWidth-44,this.pos.right-i)),bottom:Math.max(0,Math.min(window.innerHeight-44,this.pos.bottom-o))},this.btn.style.right=`${this.pos.right}px`,this.btn.style.bottom=`${this.pos.bottom}px`,n=s.clientX,r=s.clientY)}),document.addEventListener("mouseup",()=>{e&&(e=!1,this.btn&&(this.btn.style.cursor="grab"),t||this.onToggle?.())})}setActive(e){this.isActive=e,this.btn&&(this.btn.style.display=e?"none":"flex")}getPosition(){return this.pos}setOnToggle(e){this.onToggle=e}unmount(){this.btn?.remove()}}}}},{package:"$root$",file:"ui/helpers/designer-mode/core/toggle.ts"}],[10219,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t){return{componentName:t.componentName,filePath:t.filePath??null,lineNumber:t.lineNumber??null,props:t.props??null,testId:t.testId===undefined?e.dataset.testid??e.getAttribute("data-testid")??null:t.testId,classes:Array.from(e.classList),computedStyles:d(e),layoutRect:e.getBoundingClientRect(),textContent:p(e),...t.domPath?{domPath:t.domPath}:{},...t.extra?{extra:t.extra}:{}}}Object.defineProperty(n,"__esModule",{value:!0}),n.buildComponentInfo=r,n.buildDomPath=function(e){const t=[];let n=e;for(;n&&n!==document.body;){const e=n;let r=e.tagName.toLowerCase();if(e.id){t.unshift(`#${e.id}`);break}e.classList.length>0&&(r+=`.${Array.from(e.classList).slice(0,2).join(".")}`);const s=e.parentElement;if(s){const t=Array.from(s.children).filter(t=>t.tagName===e.tagName);t.length>1&&(r+=`:nth-child(${t.indexOf(e)+1})`)}t.unshift(r),n=e.parentElement}return t.join(" > ")},n.buildFallbackInfo=function(e){return r(e,{componentName:e.tagName.toLowerCase()})},n.detectFramework=function(){return new Promise(e=>{setTimeout(()=>{const{body:t}=document,n=t.firstElementChild;if(n){if(Object.keys(n).some(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$")))return e("react")}const r=window,s=n??{},i=r.ng;return r.__REACT_DEVTOOLS_GLOBAL_HOOK__?e("react"):r.__VUE__||s.__vueParentComponent?e("vue"):i?.getComponent||document.querySelector("[ng-version]")?e("angular"):document.querySelector("[data-svelte-component]")?e("svelte"):void e("vanilla")},150)})},n.extractComponentNameFromPath=function(e){if(!e)return null;const t=e.split("/").pop();if(!t)return null;return t.replace(s,"")||null},n.extractComputedStyles=d,n.getDirectTextContent=p,n.serializeProps=function(e){return Object.fromEntries(Object.entries(e).filter(([e])=>"children"!==e&&!e.startsWith("__")).slice(0,20).map(([e,t])=>null===t||t===undefined?[e,String(t)]:"function"==typeof t?[e,`fn:${t.name||"anonymous"}`]:"boolean"==typeof t||"number"==typeof t?[e,String(t)]:"string"==typeof t?[e,`"${t}"`]:t instanceof HTMLElement?[e,`<${t.tagName.toLowerCase()}>`]:Array.isArray(t)?[e,`Array(${t.length})`]:"object"==typeof t?[e,JSON.stringify(t).slice(0,80)]:[e,String(t)]))};const s=/\.(vue|svelte|tsx?|jsx?|component\.ts)$/u;const i=["display","position","width","height","min-width","max-width","min-height","max-height","flex","flex-direction","flex-wrap","align-items","align-self","justify-content","gap","overflow","z-index","top","left","right","bottom","box-sizing"],o=["font-family","font-size","font-weight","font-style","line-height","letter-spacing","text-align","text-decoration","text-transform","white-space","word-break"],a=["color","opacity"],c=["margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left"],u=["border","border-width","border-style","border-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius","outline"],l=["background","background-color","box-shadow","transform","transition","cursor"];function d(e){const t=getComputedStyle(e),n=e=>t.getPropertyValue(e).trim(),r=e=>Object.fromEntries(e.map(e=>[e,n(e)]).filter(([e,t])=>t&&"none"!==t&&"normal"!==t&&"0px"!==t&&"auto"!==t||["display","position","width","height"].includes(e)));return{layout:r(i),typography:r(o),color:r(a),spacing:r(c),border:r(u),effects:r(l)}}function p(e){return Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent?.trim()).filter(Boolean).join(" ")||null}}}},{package:"$root$",file:"ui/helpers/designer-mode/core/utils.ts"}],[10220,{"./core":10213,"./react-adapter":10221},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.initDesignerMode=function(e={}){const t=new s.ReactInspectorAdapter,n=new r.DesignerModeCore({...e,adapter:t});return n.mount(),()=>n.unmount()};var r=e("./core"),s=e("./react-adapter")}}},{package:"$root$",file:"ui/helpers/designer-mode/index.ts"}],[10221,{"./core":10213},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ReactInspectorAdapter=void 0;var r=e("./core");const s=["Suspense","StrictMode","Fragment","Provider","Consumer"];n.ReactInspectorAdapter=class{getComponentInfo(e){const t=function(e){const t=Object.keys(e).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return t?e[t]??null:null}(e);if(!t)return(0,r.buildFallbackInfo)(e);const n=function(e){let t=e?.return??null;for(;t;){const{type:e}=t;if("function"==typeof e&&e.name&&e.name.length>0&&!s.includes(e.name))return t;if("object"==typeof e&&null!==e){const n=e;if(n.displayName??n.render?.displayName??n.render?.name)return t}t=t.return}return null}(t),i=n?._debugSource??t._debugSource??null,o=function(e){if(!e)return null;const{type:t}=e;if("function"==typeof t){const e=t;return e.displayName??e.name??null}if("object"==typeof t&&null!==t){const e=t;return e.displayName??e.render?.displayName??e.render?.name??null}return null}(n)??e.tagName.toLowerCase(),a=n?.memoizedProps??{},c=(0,r.serializeProps)(a),u=e.dataset.testid??e.closest("[data-testid]")?.getAttribute("data-testid")??null;return(0,r.buildComponentInfo)(e,{componentName:o,filePath:i?.fileName,lineNumber:i?.lineNumber,props:c,testId:u})}onActivate(){}onDeactivate(){}}}}},{package:"$root$",file:"ui/helpers/designer-mode/react-adapter.ts"}],[10222,{"../../../selectors":11575,"../../constants/routes":10205,react:7855,"react-redux":7818,"react-router-dom":7831},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,s=(r=e("react"))&&r.__esModule?r:{default:r},i=e("react-router-dom"),o=e("react-redux"),a=e("../../../selectors"),c=e("../../constants/routes");n.default=()=>{const e=(0,o.useSelector)(a.getUseExternalServices),t=(0,i.useLocation)(),n=`${t.pathname}${t.search}${t.hash}`;if(!0!==e){const e={blockedRoutePath:n};return s.default.createElement(i.Navigate,{to:c.BASIC_FUNCTIONALITY_OFF_ROUTE,state:e,replace:!0})}return s.default.createElement(i.Outlet,null)}}}},{package:"$root$",file:"ui/helpers/higher-order-components/require-basic-functionality/require-basic-functionality.tsx"}],[10223,{"./with-modal-props":10224},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return s.default}});var r,s=(r=e("./with-modal-props"))&&r.__esModule?r:{default:r}}}},{package:"$root$",file:"ui/helpers/higher-order-components/with-modal-props/index.js"}],[10224,{"../../../store/actions":11613,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){return(0,r.connect)(i,o)(e)};var r=e("react-redux"),s=e("../../../store/actions");const i=e=>{const{appState:t}=e,{props:n}=t.modal.modalState;return{...n}},o=e=>({hideModal:()=>e((0,s.hideModal)())})}}},{package:"$root$",file:"ui/helpers/higher-order-components/with-modal-props/with-modal-props.js"}],[10225,{"../../../hooks/useShallowEqualityCheck":10467,react:7855,"react-redux":7818,"react-router-dom":7831},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=function(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var s,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(s=t?r:n){if(s.has(e))return s.get(e);s.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?s(o,t,i):o[t]=e[t]);return o}(e,t)}(e("react")),s=e("react-router-dom"),i=e("react-redux"),o=e("../../../hooks/useShallowEqualityCheck");function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a.apply(null,arguments)}n.default=function(e){const t=t=>{const n=(0,s.useNavigate)(),c=(0,s.useLocation)(),u=(0,s.useParams)(),l=(0,o.useShallowEqualityCheck)(u),d=t.params??l,p=function(e){const t=(0,r.useRef)(e);return t.current.pathname===e.pathname&&t.current.search===e.search&&t.current.hash===e.hash&&(0,i.shallowEqual)(t.current.state,e.state)||(t.current=e),t.current}(c),m=t.location??p,h=t.navigate??n;return r.default.createElement(e,a({},t,{navigate:h,location:m,params:d}))};return t.displayName=`withRouterHooks(${e.displayName||e.name||"Component"})`,t}}}},{package:"$root$",file:"ui/helpers/higher-order-components/with-router-hooks/with-router-hooks.tsx"}],[10226,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.__resetPerpsInAppLeaveMarkerForTests=function(){r=0},n.markPerpsUnmountInApp=function(){r=Date.now()},n.wasPerpsUnmountedInAppRecently=function(e){return r>0&&Date.now()-r<e};let r=0}}},{package:"$root$",file:"ui/helpers/perps/in-app-leave-marker.ts"}],[10228,{"../layouts/route-with-messenger":10500,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createRouteWithMessenger=function({path:e,element:t,capabilities:n}){return{path:e,element:s.default.createElement(i.RouteWithMessenger,{path:e,capabilities:n},t)}},n.defineAllowedRouteCapabilities=function(e){return e};var r,s=(r=e("react"))&&r.__esModule?r:{default:r},i=e("../layouts/route-with-messenger")}}},{package:"$root$",file:"ui/helpers/route-messenger-helpers.tsx"}],[10229,{"../constants/transactions":10209,"../utils/transactions.util":10268},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isTransactionPending=function(e){return(0,r.getStatusKey)(e)in s.PENDING_STATUS_HASH};var r=e("../utils/transactions.util"),s=e("../constants/transactions")}}},{package:"$root$",file:"ui/helpers/transactions/is-transaction-pending.ts"}],[10230,{"./is-transaction-pending":10229,"@metamask/transaction-controller":4006},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isIntentBridgeActivity=n.getPendingTransactionActionVisibility=void 0;var r=e("@metamask/transaction-controller"),s=e("./is-transaction-pending");n.getPendingTransactionActionVisibility=({hasCancelled:e,primaryTransaction:t,shouldShowSpeedUp:n,isBridgeTx:i,hasIntentBridgeActivity:o})=>{const{status:a,selectedGasFeeToken:c}=t,u=Boolean(c),l=(0,s.isTransactionPending)(t),d=a===r.TransactionStatus.unapproved,p=a===r.TransactionStatus.approved,m=a===r.TransactionStatus.signed;return{showCancel:!e&&l&&!d&&!m&&!i&&!o&&!u,showSpeedUp:n&&l&&!d&&!p&&!m&&!u,speedUpLabel:e?"speedUpCancellation":"speedUp"}};n.isIntentBridgeActivity=e=>Boolean(e?.quote?.intent)}}},{package:"$root$",file:"ui/helpers/transactions/pending-transaction-actions.ts"}],[10231,{"../../../shared/constants/hardware-wallets":8719,"../../../shared/constants/keyring":8721,"../../../shared/constants/multichain/accounts":8727,"../../../shared/constants/network":8730,"../../../shared/lib/snaps/snaps":8909,"../../../shared/lib/translate":8931,"../../components/component-library":9667,"../constants/design-system":10200,"@metamask/snaps-sdk/jsx":3828,"@metamask/utils":4236},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getAccountLabels=function(e,t,n,i){if(!t)return[];const o=[],a=n.filter(e=>e.type===c.KeyringType.hdKeyTree);switch(e){case c.KeyringType.hdKeyTree:if(a.length>1){const e=a.findIndex(e=>e.accounts.includes(t.address));o.push({label:m(e),icon:null})}break;case c.KeyringType.imported:o.push({label:(0,l.t)("imported"),icon:null});break;case c.KeyringType.qr:o.push({label:u.HardwareKeyringNames.qr,icon:null});break;case c.KeyringType.trezor:o.push({label:u.HardwareKeyringNames.trezor,icon:null});break;case c.KeyringType.ledger:o.push({label:u.HardwareKeyringNames.ledger,icon:null});break;case c.KeyringType.oneKey:o.push({label:u.HardwareKeyringNames.oneKey,icon:null});break;case c.KeyringType.lattice:o.push({label:u.HardwareKeyringNames.lattice,icon:null});break;case c.KeyringType.snap:{const{entropySource:e}=t.options;if(e&&a.length>1){const t=a.findIndex(t=>t.metadata.id===e);o.push({label:m(t),icon:null})}if((0,d.isSnapPreinstalled)(t.metadata.snap.id))break;if(i){o.push({label:`${i} (${(0,l.t)("beta")})`,icon:r.IconName.Snaps});break}o.push({label:`${(0,l.t)("snaps")} (${(0,l.t)("beta")})`,icon:r.IconName.Snaps});break}}const{namespace:h}=(0,s.parseCaipChainId)(t.type);h===s.KnownCaipNamespace.Bip122&&o.push({label:`${p.MULTICHAIN_ACCOUNT_TYPE_TO_NAME[t.type]}`,icon:null});return o},n.getAccountNameErrorMessage=function(e,t,n,r){const s=e.some(e=>e.metadata?.name?.toLowerCase()===n?.toLowerCase()),o=!n||""===n,a=t.t("newAccountNumberName").replace(" $1",""),c=new RegExp(`^\\s*${a} \\d+\\s*$`,"iu").test(n||""),u=n?.toLowerCase()===r?.toLowerCase()||!s&&!c&&!o;let l;u?l=i.InvisibleCharacter:s?l=t.t("accountNameDuplicate"):c?l=t.t("accountNameReserved"):o&&(l=t.t("required"));return{isValidAccountName:u,errorMessage:l}},n.getAvatarNetworkColor=function(e){switch(e){case o.GOERLI_DISPLAY_NAME:return a.BackgroundColor.goerli;case o.LINEA_GOERLI_DISPLAY_NAME:return a.BackgroundColor.lineaGoerli;case o.LINEA_SEPOLIA_DISPLAY_NAME:return a.BackgroundColor.lineaSepolia;case o.SEPOLIA_DISPLAY_NAME:return a.BackgroundColor.sepolia;default:return undefined}};var r=e("@metamask/snaps-sdk/jsx"),s=e("@metamask/utils"),i=e("../../components/component-library"),o=e("../../../shared/constants/network"),a=e("../constants/design-system"),c=e("../../../shared/constants/keyring"),u=e("../../../shared/constants/hardware-wallets"),l=e("../../../shared/lib/translate"),d=e("../../../shared/lib/snaps/snaps"),p=e("../../../shared/constants/multichain/accounts");const m=e=>`SRP #${e+1}`}}},{package:"$root$",file:"ui/helpers/utils/accounts.js"}],[10232,{"./util":10271,"@metamask/chain-agnostic-permission":1566,"@metamask/utils":4236},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCaip25CaveatValueFromPermissions=function(e){return e?.[s.Caip25EndowmentPermissionName]?.caveats?.find(e=>e.type===s.Caip25CaveatType)?.value??{optionalScopes:{},requiredScopes:{},sessionProperties:{},isMultichainOrigin:!1}},n.getCaip25PermissionsResponse=function(e,t,n){const r=(0,s.setPermittedEthChainIds)(e,n),i=(0,s.setEthAccounts)(r,t);return{[s.Caip25EndowmentPermissionName]:{caveats:[{type:s.Caip25CaveatType,value:i}]}}},n.getDefaultAccounts=function(e,t,n){const s=[],o=new Set;t.forEach(t=>{const{chain:{namespace:n}}=(0,r.parseCaipAccountId)(t.caipAccountId);e.includes(n)&&(s.push(t),o.add(n))});const a=e.filter(e=>!o.has(e));if(a.length>0){const e=(0,i.sortSelectedInternalAccounts)(n);for(const t of a){const n=e.find(e=>{const{chain:{namespace:n}}=(0,r.parseCaipAccountId)(e.caipAccountId);return n===t});n&&s.push(n)}}return s};var r=e("@metamask/utils"),s=e("@metamask/chain-agnostic-permission"),i=e("./util")}}},{package:"$root$",file:"ui/helpers/utils/caip25-permissions.ts"}],[10233,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.camelCaseToCapitalize=function(e=""){return e.replace(/([A-Z])/gu," $1").replace(/^./u,e=>e.toUpperCase())},n.getCurrencySymbol=function(e){const t={EUR:"€",HKD:"$",JPY:"¥",PHP:"₱",RUB:"₽",SGD:"$",USD:"$"};if(t[e.toUpperCase()])return t[e.toUpperCase()];return e.toUpperCase()}}}},{package:"$root$",file:"ui/helpers/utils/common.util.js"}],[10235,{"../../../shared/constants/start-up-errors":8745,"../../../shared/constants/state-corruption":8746,"../../../shared/constants/ui-initialization":8753,"./display-critical-error":10236,"./state-corruption-html":10261,"@metamask/utils":4236,loglevel:7398},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.CriticalStartupErrorHandler=void 0;var r,s=e("@metamask/utils"),i=(r=e("loglevel"))&&r.__esModule?r:{default:r},o=e("../../../shared/constants/state-corruption"),a=e("../../../shared/constants/ui-initialization"),c=e("../../../shared/constants/start-up-errors"),u=e("./state-corruption-html"),l=e("./display-critical-error");function d(e,t,n){p(e,t),t.set(e,n)}function p(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function m(e,t){return e.get(f(e,t))}function h(e,t,n){return e.set(f(e,t),n),n}function f(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var g=new WeakMap,b=new WeakMap,y=new WeakMap,k=new WeakMap,w=new WeakMap,v=new WeakMap,T=new WeakMap,S=new WeakMap,C=new WeakMap,P=new WeakMap,_=new WeakMap,x=new WeakMap,I=new WeakMap,E=new WeakMap,M=new WeakMap,A=new WeakMap,N=new WeakSet,$=new WeakMap;function O(e){e.sentryTags={"uiStartup.receivedAppInitPing":m(y,this).toString()}}async function L(){const e=new Promise((e,t)=>{h(k,this,setTimeout(()=>t(new Error("Background connection unresponsive")),15e3))});let t=null;try{await Promise.race([m(w,this),e])}catch(e){t=e}if(clearTimeout(m(k,this)),h(k,this,undefined),null!==t){if(m(A,this))return;h(A,this,!0),f(N,this,O).call(this,t),await(0,l.displayCriticalErrorMessage)(m(b,this),l.CriticalErrorTranslationKey.TroubleStarting,t,undefined,m(g,this),o.CriticalErrorType.BackgroundConnectionTimeout)}else m(M,this)||(m(P,this)?m(E,this)||await f(N,this,R).call(this):await f(N,this,B).call(this))}async function B(){const e=new Promise((e,t)=>{h(T,this,setTimeout(()=>t(new Error("Background initialization timeout")),16e3))});let t=null;try{await Promise.race([m(S,this),e])}catch(e){t=e}if(clearTimeout(m(T,this)),h(T,this,undefined),null!==t){if(m(A,this))return;h(A,this,!0),f(N,this,O).call(this,t),await(0,l.displayCriticalErrorMessage)(m(b,this),l.CriticalErrorTranslationKey.TroubleStarting,t,undefined,m(g,this),o.CriticalErrorType.BackgroundInitTimeout)}else m(M,this)||m(E,this)||await f(N,this,R).call(this)}async function R(){const e=new Promise((e,t)=>{h(_,this,setTimeout(()=>t(new Error("Background state sync timeout")),16e3))});let t=null;try{await Promise.race([m(x,this),e])}catch(e){t=e}if(clearTimeout(m(_,this)),h(_,this,undefined),null!==t){if(m(A,this))return;h(A,this,!0),f(N,this,O).call(this,t),await(0,l.displayCriticalErrorMessage)(m(b,this),l.CriticalErrorTranslationKey.TroubleStarting,t,undefined,m(g,this),o.CriticalErrorType.BackgroundStateSyncTimeout)}}n.CriticalStartupErrorHandler=class{constructor(e,t){!function(e,t){p(e,t),t.add(e)}(this,N),d(this,g,void 0),d(this,b,void 0),d(this,y,!1),d(this,k,void 0),d(this,w,void 0),d(this,v,void 0),d(this,T,void 0),d(this,S,void 0),d(this,C,void 0),d(this,P,!1),d(this,_,void 0),d(this,x,void 0),d(this,I,void 0),d(this,E,!1),d(this,M,!1),d(this,A,!1),d(this,$,async e=>{if(!(0,s.isObject)(e)||!(0,s.hasProperty)(e,"data"))return;const{data:t}=e;if(!(0,s.isObject)(t)||!(0,s.hasProperty)(t,"method"))return;const{method:n}=t;if(n===a.APP_INIT_LIVENESS_METHOD)h(y,this,!0);else if(n===a.BACKGROUND_LIVENESS_METHOD)m(v,this)?m(v,this).call(this):m(A,this)||(h(A,this,!0),await(0,l.displayCriticalErrorMessage)(m(b,this),l.CriticalErrorTranslationKey.TroubleStarting,new Error("Unreachable error, liveness check not initialized"),undefined,m(g,this),o.CriticalErrorType.UnreachableLivenessCheck));else if(n===a.BACKGROUND_INITIALIZED_METHOD)h(P,this,!0),m(C,this)?m(C,this).call(this):m(A,this)||(h(A,this,!0),await(0,l.displayCriticalErrorMessage)(m(b,this),l.CriticalErrorTranslationKey.TroubleStarting,new Error("Unreachable error, initialization check not initialized"),undefined,m(g,this),o.CriticalErrorType.UnreachableInitializationCheck));else if(n===c.RELOAD_WINDOW)window.location.reload();else if(n===o.METHOD_DISPLAY_STATE_CORRUPTION_ERROR){if(!(0,s.hasProperty)(t,"params")||!(0,s.isObject)(t.params))return void i.default.error("Received state corruption error message without valid params:",e);const{error:n,hasBackup:r,currentLocale:o}=t.params;m(A,this)||(h(A,this,!0),(0,u.displayStateCorruptionError)(m(b,this),m(g,this),n,r,o))}else if(n===c.DISPLAY_GENERAL_STARTUP_ERROR){if(!(0,s.hasProperty)(t,"params")||!(0,s.isObject)(t.params))return void i.default.error("Received general start up error message without valid params:",e);const{error:n,currentLocale:r}=t.params;m(A,this)||(h(A,this,!0),await(0,l.displayCriticalErrorMessage)(m(b,this),l.CriticalErrorTranslationKey.TroubleStarting,n,r,m(g,this),o.CriticalErrorType.GeneralStartupError))}}),h(g,this,e),h(b,this,t)}startUiSyncReceived(){h(E,this,!0),m(I,this)&&m(I,this).call(this)}install(){m(g,this).onMessage.addListener(m($,this));const{promise:e,resolve:t}=(0,s.createDeferredPromise)(),{promise:n,resolve:r}=(0,s.createDeferredPromise)(),{promise:i,resolve:o}=(0,s.createDeferredPromise)();h(w,this,e),h(S,this,n),h(x,this,i),h(v,this,t),h(C,this,r),h(I,this,o),f(N,this,L).call(this)}uninstall(){h(M,this,!0),m(g,this).onMessage.removeListener(m($,this)),clearTimeout(m(k,this)),clearTimeout(m(T,this)),clearTimeout(m(_,this)),m(I,this)&&(m(I,this).call(this),h(I,this,undefined)),m(C,this)&&(m(C,this).call(this),h(C,this,undefined)),m(v,this)&&(m(v,this).call(this),h(v,this,undefined))}}}}},{package:"$root$",file:"ui/helpers/utils/critical-startup-error-handler.ts"}],[10236,{"../../../shared/constants/start-up-errors":8745,"../../../shared/constants/state-corruption":8746,"../../../shared/lib/error-utils":8831,"../../../shared/lib/stores/persistence-manager":8915,"../../../shared/lib/ui-utils":8934,loglevel:7398,uuid:8333,"webextension-polyfill":8691},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.CriticalErrorTranslationKey=void 0,n.displayCriticalErrorMessage=async function(e,t,n,d,f,g){const b=f?await async function(e=p){const t=globalThis.stateHooks?.getBackupState;if(!t)return null;const n=new Promise(t=>{setTimeout(()=>t(null),e)}),r=t().catch(()=>null);return Promise.race([r,n])}():null,y=f&&(0,l.hasVault)(b);try{f?.postMessage({data:{method:u.CRITICAL_ERROR_SCREEN_VIEWED,params:{backup:b,canTriggerRestore:y,criticalErrorType:g}}})}catch(e){s.default.warn("Failed to notify background of critical error screen view",e)}const k=await(0,o.maybeGetLocaleContext)(d),w=(0,o.getErrorHtml)(t,n,k,a.SUPPORT_LINK,y),v=h(e,w);if(v){const e=v.querySelector("#critical-error-button"),t=v.querySelector("#critical-error-checkbox");if(e?.addEventListener("click",async()=>{const e=t?.checked??!1;await async function(e,t){t&&await async function(e){const t="https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496";if(!t)return;try{const n=(0,i.v4)().replace(/-/gu,""),s=Math.floor(Date.now()/1e3),o=e,a=o?.sentryTags&&"object"==typeof o.sentryTags?o.sentryTags:{};let c;if(e&&"object"==typeof e){const{sentryTags:e,...t}=o;c=t}else c={message:String(e)};const u={event_id:n,timestamp:s,platform:"javascript",level:"error",message:e?.message||"MetaMask extension crash critical error",release:r.default.runtime.getManifest()?.version||"unknown",extra:{error_details:c,user_agent:globalThis.navigator?.userAgent||"unknown"},tags:a},l={event_id:n,dsn:t,sent_at:(new Date).toISOString()},d=JSON.stringify(u),p={type:"event",length:d.length},h=`${JSON.stringify(l)}\n${JSON.stringify(p)}\n${d}`,f=m(t);await fetch(f,{method:"POST",headers:{"Content-Type":"application/x-sentry-envelope"},body:h})}catch(e){console.error("Error sending report to Sentry:",e)}}(e);r.default.runtime.reload()}(n,e)}),y){const e=v.querySelector("#critical-error-restore-link");e?.addEventListener("click",e=>{e.preventDefault();confirm(k.t("stateCorruptionAreYouSure")??"")&&f.postMessage({data:{method:c.METHOD_REPAIR_DATABASE_TIMEOUT,params:{criticalErrorType:g,backup:b}}})})}}throw s.default.error(n.stack),n},n.displayCriticalErrorPage=h,n.extractEnvelopeUrlFromDsn=m;var r=d(e("webextension-polyfill")),s=d(e("loglevel")),i=e("uuid"),o=e("../../../shared/lib/error-utils"),a=e("../../../shared/lib/ui-utils"),c=e("../../../shared/constants/state-corruption"),u=e("../../../shared/constants/start-up-errors"),l=e("../../../shared/lib/stores/persistence-manager");function d(e){return e&&e.__esModule?e:{default:e}}const p=5e3;function m(e){try{const t=new URL(e),n=t.pathname.slice(1),r=t.hostname.split("."),s=r[0];return`https://${s}.${r.slice(1).join(".")}/api/${n}/envelope/`}catch(e){throw new Error("Invalid Sentry DSN format")}}n.CriticalErrorTranslationKey=function(e){return e.TroubleStarting="troubleStarting",e.SomethingIsWrong="somethingIsWrong",e}({});function h(e,t){const n=e.parentElement;if(!n)return console.warn("Cannot display critical error. Another critical error may already be shown."),undefined;const r=document.createElement("div");return r.setAttribute("id","critical-error-content"),r.innerHTML=t,n.removeChild(e),n.prepend(r),r}}}},{package:"$root$",file:"ui/helpers/utils/display-critical-error.ts"}],[10237,{buffer:6484},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.ExportableContentType=void 0,n.exportAsFile=async function(t,n,s){if(!r[s])throw new Error(`Unsupported file type: ${s}`);"undefined"!=typeof window&&void 0!==window.showSaveFilePicker&&void 0!==window.Blob?await async function(e,t,n){const s=new window.Blob([t],{contentType:n}),i=r[n],o=await window.showSaveFilePicker({suggestedName:e,types:[{description:e,accept:{[n]:[i]}}]}),a=await o.createWritable();await a.write(s),await a.close()}(t,n,s):function(t,n,r){const s=e.from(n,"utf8").toString("base64"),i=document.createElement("a");i.href=`data:${r};Base64,${s}`,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)}(t,n,s)};const t=n.ExportableContentType={JSON:"application/json",TXT:"text/plain"},r={[t.JSON]:".json",[t.TXT]:".txt"}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"$root$",file:"ui/helpers/utils/export-utils.js"}],[10239,{"../../../shared/constants/gas":8718,"../../../shared/lib/Numeric":8756,"../../../shared/lib/conversion.utils":8790,"./util":10271,"bignumber.js":6427,"ethereumjs-util":6749,lodash:7388},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.addTenPercentAndRound=p,n.editGasModeIsSpeedUpOrCancel=function(e){return e===a.EditGasModes.cancel||e===a.EditGasModes.speedUp},n.formatGasFeeOrFeeRange=function(e,{precision:t=2}={}){if((0,l.isNullish)(e)||Array.isArray(e)&&0===e.length)return null;const n=Array.isArray(e)?e.slice(0,2):[e],r=Array.isArray(t)?t.slice(0,2):(0,s.times)(n.length,(0,s.constant)(t));return`${(0,s.uniq)((0,s.zip)(n,r).map(([e,t])=>t===undefined?e:(0,l.roundToDecimalPlacesRemovingExtraZeroes)(e,t))).join(" - ")} GWEI`},n.gasEstimateGreaterThanGasUsedPlusTenPercent=void 0,n.getGasValuesForReplacement=function(e,t,n){const r=e=>null===e||e===undefined?new i.default(0):new i.default((0,o.addHexPrefix)(String(e))),s=e?.gas??e?.gasLimit??t?.gas??t?.gasLimit;if(t?.gasPrice&&!t?.maxFeePerGas){const o=new u.Numeric(t.gasPrice,16).times(new u.Numeric(n,10)).round(0).toPrefixedHexString(),a=r(e?.gasPrice).gte(new i.default(o))?e.gasPrice:o;return{...e,gasPrice:a,gas:s,gasLimit:s}}if(!t?.maxFeePerGas||!t?.maxPriorityFeePerGas)return e??{};const a=new u.Numeric(t.maxFeePerGas,16).times(new u.Numeric(n,10)).round(0).toPrefixedHexString(),c=new u.Numeric(t.maxPriorityFeePerGas,16).times(new u.Numeric(n,10)).round(0).toPrefixedHexString(),l=r(e?.maxFeePerGas).gte(new i.default(a))?e.maxFeePerGas:a,d=r(e?.maxPriorityFeePerGas).gte(new i.default(c))?e.maxPriorityFeePerGas:c;return{...e,maxFeePerGas:l,maxPriorityFeePerGas:d,gas:s,gasLimit:s}},n.isMetamaskSuggestedGasEstimate=function(e){return[a.GasRecommendations.high,a.GasRecommendations.medium,a.GasRecommendations.low].includes(e)};var r,s=e("lodash"),i=(r=e("bignumber.js"))&&r.__esModule?r:{default:r},o=e("ethereumjs-util"),a=e("../../../shared/constants/gas"),c=e("../../../shared/lib/conversion.utils"),u=e("../../../shared/lib/Numeric"),l=e("./util");const d=new u.Numeric(1.1,10);function p(e){return e===undefined?undefined:new u.Numeric(e,16).times(d).round(0).toPrefixedHexString()}n.gasEstimateGreaterThanGasUsedPlusTenPercent=(e,t,n)=>{const r=p(e?.maxFeePerGas??e?.gasPrice);if(!r)return!1;const s=new i.default((0,c.hexWEIToDecGWEI)(r)),o=t?.[n],a="object"==typeof o?o?.suggestedMaxFeePerGas:o;return(0,l.bnGreaterThan)(a,s)}}}},{package:"$root$",file:"ui/helpers/utils/gas.js"}],[10240,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isHardwareKeyring=function(e=""){return e.includes("Hardware")}}}},{package:"$root$",file:"ui/helpers/utils/hardware.js"}],[10241,{"../../../shared/constants/network":8730,"../../../shared/lib/i18n":8857,"../../../shared/lib/sentry":8901,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getMessage=void 0,n.getNetworkLabelKey=function(e){if(e===o.NETWORK_TYPES.LINEA_SEPOLIA)return"lineaSepolia";if(e===o.NETWORK_TYPES.LINEA_MAINNET)return"lineaMainnet";return e};var r,s=(r=e("react"))&&r.__esModule?r:{default:r},i=e("../../../shared/lib/i18n"),o=e("../../../shared/constants/network"),a=e("../../../shared/lib/sentry");n.getMessage=(e,t,n,r)=>{const o=r?.some(e=>null!==e&&("function"==typeof e||"object"==typeof e)),c=o?e=>s.default.createElement("span",null," ",e," "):undefined;return(0,i.getMessage)(e,t,n,r,e=>{(0,a.captureException)(e)},c)}}}},{package:"$root$",file:"ui/helpers/utils/i18n-helper.tsx"}],[10242,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=()=>window.matchMedia("screen and (max-width: 575px)").matches}}},{package:"$root$",file:"ui/helpers/utils/is-mobile-view.js"}],[10243,{"../../../shared/constants/network":8730,"../../../shared/constants/time":8750,"../../../shared/lib/fetch-with-cache":8835},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isOriginalNativeTokenSymbol=n.getOriginalNativeTokenSymbol=void 0;var r,s=e("../../../shared/constants/network"),i=(r=e("../../../shared/lib/fetch-with-cache"))&&r.__esModule?r:{default:r},o=e("../../../shared/constants/time");const a=async({chainId:e,useAPICall:t=!1})=>{try{const n=s.CHAIN_ID_TO_CURRENCY_SYMBOL_MAP[e];if(n)return n;const r=s.CHAIN_ID_TO_CURRENCY_SYMBOL_MAP_NETWORK_COLLISION[e];if(r?.[0].currencySymbol)return r[0].currencySymbol;if(!t)return null;const a=(await(0,i.default)({url:s.CHAIN_SPEC_URL,allowStale:!0,cacheOptions:{cacheRefreshTime:o.DAY},functionName:"getSafeChainsList"})).find(t=>t.chainId===parseInt(e,16));return a?.nativeCurrency?.symbol??null}catch(e){return null}};n.getOriginalNativeTokenSymbol=a;n.isOriginalNativeTokenSymbol=async({ticker:e,chainId:t,useAPICall:n=!1})=>{const r=await a({chainId:t,useAPICall:n});return null===r||r===e}}}},{package:"$root$",file:"ui/helpers/utils/isOriginalNativeTokenSymbol.ts"}],[10245,{"../../../shared/lib/manifestFlags":8860,"../../../shared/lib/trace":8924,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.mmLazy=function(e){return s.default.lazy(async()=>{const t=(0,o.getPerformanceTimestamp)(),n=await e(),{componentName:r,component:s}=function(e){if("default"in e&&e.default){const t=e.default;return{componentName:t.WrappedComponent?.name||t.name||t.displayName||"Unknown",component:{...e,default:e.default}}}const t=Object.keys(e);if(1===t.length){const n=t[0];return{componentName:n,component:{default:e[n]}}}throw new Error("mmLazy: You cannot lazy-load a component when there are multiple exported components in one file")}(n);return a&&Math.random()<a&&((0,o.trace)({name:o.TraceName.LazyLoadComponent,data:{componentName:r},startTime:t}),(0,o.endTrace)({name:o.TraceName.LazyLoadComponent})),s})};var r,s=(r=e("react"))&&r.__esModule?r:{default:r},i=e("../../../shared/lib/manifestFlags"),o=e("../../../shared/lib/trace");const a=(0,i.getManifestFlags)().sentry?.lazyLoadSubSampleRate}}},{package:"$root$",file:"ui/helpers/utils/mm-lazy.ts"}],[10246,{"../../../../shared/lib/multichain/address":8866,"../../../../shared/lib/multichain/networks":8869,"@metamask/etherscan-link":2522,"@metamask/utils":4236},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getMultichainBlockExplorerUrl=n.getMultichainAccountUrl=n.getAssetDetailsAccountUrl=void 0;var r=e("@metamask/utils"),s=e("@metamask/etherscan-link"),i=e("../../../../shared/lib/multichain/address"),o=e("../../../../shared/lib/multichain/networks");n.getMultichainBlockExplorerUrl=e=>e.network?.rpcPrefs?.blockExplorerUrl??"";n.getMultichainAccountUrl=(e,t)=>{const{namespace:n}=(0,r.parseCaipChainId)(t.chainId);if(n===r.KnownCaipNamespace.Eip155){return`https://etherscan.io/address/${(0,i.normalizeSafeAddress)(e)}#asset-multichain`}const{blockExplorerFormatUrls:s}=t.network;return s?(0,o.formatBlockExplorerAddressUrl)(s,e):""};n.getAssetDetailsAccountUrl=(e,t)=>{const{namespace:n}=(0,r.parseCaipChainId)(t.chainId);if(n===r.KnownCaipNamespace.Eip155)return(0,s.getAccountLink)((0,i.normalizeSafeAddress)(e),t.network.chainId,t.network?.rpcPrefs);const{blockExplorerFormatUrls:a}=t.network;return a?(0,o.formatBlockExplorerAddressUrl)(a,e):""}}}},{package:"$root$",file:"ui/helpers/utils/multichain/blockExplorer.ts"}],[10247,{"../../../../shared/constants/common":8709,"../../../../shared/constants/multichain/networks":8729,"../../../../shared/lib/multichain/networks":8869,"@metamask/utils":4236},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getBlockExplorerInfo=void 0;var r=e("@metamask/utils"),s=e("../../../../shared/constants/common"),i=e("../../../../shared/constants/multichain/networks"),o=e("../../../../shared/lib/multichain/networks");n.getBlockExplorerInfo=(e,t,n)=>{const{chainId:a,blockExplorerUrl:c}=n;if(a){const n=i.MULTICHAIN_NETWORK_BLOCK_EXPLORER_FORMAT_URLS_MAP[a];if(n){const{name:r}=n;return{addressUrl:(0,o.formatBlockExplorerAddressUrl)(n,t),name:r,buttonText:e("viewAddressOnExplorer",[r])}}}if(a?.startsWith(r.KnownCaipNamespace.Eip155)){const n=`0x${parseInt(a.split(":")[1],10).toString(16)}`;if(c){const r=s.CHAINID_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL_MAP[n]||"Block Explorer";return{addressUrl:`${c}/address/${t}`,name:r,buttonText:e("viewAddressOnExplorer",[r])}}const r=s.CHAINID_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL_MAP[n];if(r){const i=s.CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP[n]?.replace(/\/$/u,"");if(i)return{addressUrl:`${i}/address/${t}`,name:r,buttonText:e("viewAddressOnExplorer",[r])}}}return null}}}},{package:"$root$",file:"ui/helpers/utils/multichain/getBlockExplorerInfo.ts"}],[10248,{"../../../shared/constants/network":8730,"../../../shared/lib/network.utils":8874,"@metamask/multichain-network-controller":2932,"@metamask/utils":4236},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isTestNetwork=n.getMatchedSymbols=n.getMatchedNames=n.getMatchedChain=void 0;var r=e("@metamask/multichain-network-controller"),s=e("@metamask/utils"),i=e("../../../shared/constants/network"),o=e("../../../shared/lib/network.utils");n.getMatchedChain=(e,t)=>t.find(t=>t.chainId.toString()===e);n.getMatchedSymbols=(e,t)=>t.reduce((t,n)=>(n.chainId.toString()===e&&t.push(n.nativeCurrency?.symbol),t),[]);n.getMatchedNames=(e,t)=>t.reduce((t,n)=>(n.chainId.toString()===e&&t.push(n?.name),t),[]);n.isTestNetwork=e=>(0,s.isCaipChainId)(e)?e.startsWith("eip155:")?i.TEST_CHAINS.includes((0,o.convertCaipToHexChainId)(e)):r.NON_EVM_TESTNET_IDS.includes(e):i.TEST_CHAINS.includes(e)}}},{package:"$root$",file:"ui/helpers/utils/network-helper.ts"}],[10249,{"../../../shared/constants/network":8730,"../../../shared/lib/asset-utils":8778,"../../../shared/lib/network.utils":8874,"@metamask/multichain-network-controller":2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getNetworkSectionKey=u,n.getNetworkSections=function(e,t){return a.map(n=>({key:n,items:e.filter(e=>u(e.chainId)===n).sort(t)})).filter(({items:e})=>e.length>0).map(({key:e,items:t})=>({key:e,titleKey:c[e],items:t}))};var r=e("@metamask/multichain-network-controller"),s=e("../../../shared/constants/network"),i=e("../../../shared/lib/asset-utils"),o=e("../../../shared/lib/network.utils");const a=["default","custom","test"],c={default:"defaultNetworks",custom:"customNetworks",test:"testnets"};function u(e){const t=function(e){return e.includes(":")&&(0,i.isEvmChainId)(e)?(0,o.convertCaipToHexChainId)(e):e}(e),n=function(e){return e.startsWith("0x")}(t)?t:undefined,a=s.FEATURED_NETWORK_CHAIN_IDS_MULTICHAIN.map(e=>e.includes(":")&&(0,i.isEvmChainId)(e)?(0,o.convertCaipToHexChainId)(e):e);return n&&s.TEST_CHAINS.includes(n)||r.NON_EVM_TESTNET_IDS.includes(e)?"test":(n?a.includes(n):a.includes(t))||n&&s.FEATURED_NETWORK_CHAIN_IDS.includes(n)?"default":"custom"}}}},{package:"$root$",file:"ui/helpers/utils/network-sections.ts"}],[10250,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.nftTruncateAltText=n.getNftImageAlt=n.getNftImage=void 0;const r=(e,t)=>{if(e.length<=t)return e;const n=e.substring(0,t),r=n.lastIndexOf(" ");return r>0?`${n.substring(0,r)}...`:`${n}...`};n.nftTruncateAltText=r;n.getNftImageAlt=({name:e,tokenId:t,description:n})=>{if(!e&&!t&&!n)return"";const s=n??`${e??""} ${t??""}`.trim();return r(s,100)};n.getNftImage=e=>"string"==typeof e?e:Array.isArray(e)?e[0]:undefined}}},{package:"$root$",file:"ui/helpers/utils/nfts.ts"}],[10251,{"../../../shared/constants/network":8730,"../../../shared/lib/conversion.utils":8790,"../../../shared/lib/transactions-controller-utils":8928,"@ethersproject/providers":913,"bignumber.js":6427},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.formatAmount=n.createTextItems=void 0,n.formatIsoDateString=function(e){const t=new Date(e);return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",hour12:!0}).format(t)},n.formatMenuItemDate=function(e){const t=new Date;if(c(t,e))return new Intl.DateTimeFormat("en",{hour:"numeric",minute:"numeric",hour12:!1}).format(e);if(u(t,e))return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-1,"day");if(l(t,e))return new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}).format(e);return new Intl.DateTimeFormat("en",{year:"numeric",month:"short",day:"numeric"}).format(e)},n.getLeadingZeroCount=n.getAmount=void 0,n.getNativeCurrencyLogoByChainId=function(e){const t=`0x${(0,a.decimalToHex)(e)}`;return i.CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP[t]??""},n.getNetworkDetailsFromNotifPayload=function(e){return{networkName:e?.name??"",nativeCurrencySymbol:e?.native_symbol??"",blockExplorerUrl:e?.block_explorer?.url??"",blockExplorerName:e?.block_explorer?.name??""}},n.getRandomKey=n.getNetworkNameByChainId=n.getNetworkFees=void 0,n.getRpcUrlByChainId=h,n.getUsdAmount=void 0,n.hasNetworkFeeFields=f,n.isIpfsURL=void 0;var r=e("bignumber.js"),s=e("@ethersproject/providers"),i=e("../../../shared/constants/network"),o=e("../../../shared/lib/transactions-controller-utils"),a=e("../../../shared/lib/conversion.utils");const c=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),u=(e,t)=>{const n=new Date(e);return n.setDate(e.getDate()-1),c(n,t)},l=(e,t)=>e.getFullYear()===t.getFullYear();const d={decimalPlaces:4},p=e=>{const t=new r.BigNumber(e,10).toString(10).split(".")[1]??"";return t.match(/^0*/u)?.[0]?.length||0};n.getLeadingZeroCount=p;const m=(e,t)=>{const n={...d,...t},r=p(e),s=e.toString().includes(".")||r>0||e.toString().includes("e-");if(e>999)return Intl.NumberFormat("en-US",{notation:"compact",compactDisplay:"short",maximumFractionDigits:2}).format(e);if(s){const t=(i=n.decimalPlaces,Boolean(n?.shouldEllipse)&&r>=i),s=Intl.NumberFormat("en-US",{minimumFractionDigits:t?n.decimalPlaces:undefined,maximumFractionDigits:n.decimalPlaces}).format(e);return t?`${s}...`:s}var i;return e.toString()};n.formatAmount=m;n.getRandomKey=(e,t)=>`${e.replace(/\s+/gu,"_").replace(/[^\w-]/gu,"")}-${t}-${Math.random().toString(36).substring(2,15)}`;n.createTextItems=(e,t)=>({items:e.map((e,t)=>({text:e,highlighted:t%2==1})),variant:t});n.getAmount=(e,t,n)=>{if(!e||!t)return"";const r=(0,o.calcTokenAmount)(e,parseFloat(t)).toNumber();return m(r,n)};n.getUsdAmount=(e,t,n)=>{if(!e||!t||!n)return"";const r=(0,o.calcTokenAmount)(e,parseFloat(t)).toNumber(),s=parseFloat(`${r}`)*parseFloat(n);return m(s)};function h(e){const t=i.FEATURED_RPCS.find(t=>t.chainId===e);if(t)return t.rpcEndpoints[0].url;switch(e){case i.CHAIN_IDS.MAINNET:return i.MAINNET_RPC_URL;case i.CHAIN_IDS.GOERLI:return i.GOERLI_RPC_URL;case i.CHAIN_IDS.SEPOLIA:return i.SEPOLIA_RPC_URL;case i.CHAIN_IDS.LINEA_GOERLI:return i.LINEA_GOERLI_RPC_URL;case i.CHAIN_IDS.LINEA_SEPOLIA:return i.LINEA_SEPOLIA_RPC_URL;case i.CHAIN_IDS.LINEA_MAINNET:return i.LINEA_MAINNET_RPC_URL;case i.CHAIN_IDS.LOCALHOST:return i.LOCALHOST_RPC_URL;default:return i.MAINNET_RPC_URL}}function f(e){return"network_fee"in e.payload.data}n.getNetworkNameByChainId=e=>i.NETWORK_TO_NAME_MAP[e];n.getNetworkFees=async e=>{if(!f(e))throw new Error("Invalid notification type");const t=(0,a.decimalToHex)(e.payload.chain_id),n={url:h(`0x${t}`),headers:{"Infura-Source":"metamask/metamask"}},r=new s.JsonRpcProvider(n);if(!r)throw new Error(`No provider found for chainId ${t}`);try{const[t,n,s]=await Promise.all([r.getTransactionReceipt(e.payload.tx_hash),r.getTransaction(e.payload.tx_hash),r.getBlock(e.payload.block_number)]),i=(t,n)=>m(parseFloat(t)*parseFloat(e.payload.data.network_fee.native_token_price_in_usd),{decimalPlaces:n??4}),o=(0,a.hexWEIToDecETH)(t.gasUsed.mul(t.effectiveGasPrice)._hex),c=i(o),u=n.gasLimit.toNumber(),l=t.gasUsed.toNumber(),d=s.baseFeePerGas?(0,a.hexWEIToDecGWEI)(s.baseFeePerGas._hex):null,p=s.baseFeePerGas?(0,a.hexWEIToDecGWEI)(t.effectiveGasPrice.sub(s.baseFeePerGas)._hex):null;return{transactionFeeInEth:o,transactionFeeInUsd:c,gasLimit:u,gasUsed:l,baseFee:d,priorityFee:p,maxFeePerGas:n.maxFeePerGas?(0,a.hexWEIToDecGWEI)(n.maxFeePerGas._hex):null}}catch(e){throw new Error(`Error fetching network fees for chainId ${t}: ${e}`)}};n.isIpfsURL=e=>e.startsWith("ipfs://")}}},{package:"$root$",file:"ui/helpers/utils/notification.util.ts"}],[10252,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isZeroAmount=function(e){if(null===e||e===undefined)return!0;if("number"==typeof e)return 0===e;const t=e.replace(/\D+/gu,"").trim();return/^0*$/u.test(t)}}}},{package:"$root$",file:"ui/helpers/utils/number-utils.ts"}],[10253,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.disconnectLongTaskObserver=u,n.exposeLongTaskMetricsForTesting=function(){0},n.getLongTaskMetrics=l,n.getLongTaskMetricsWithTBT=m,n.getTBTRating=p,n.reportLongTaskMetricsToSentry=h,n.resetLongTaskMetrics=d,n.setupLongTaskObserver=function(e=.1){if(Math.random()>e)return()=>{};if(!("PerformanceObserver"in globalThis))return()=>{};if(c)return()=>{u()};try{c=new PerformanceObserver(e=>{for(const t of e.getEntries())a.count+=1,a.totalDuration+=t.duration,a.maxDuration=Math.max(a.maxDuration,t.duration),a.tbt+=Math.max(0,t.duration-s),a.tasks.length<r&&a.tasks.push({name:t.name,duration:t.duration,startTime:t.startTime})}),c.observe({type:"longtask",buffered:!0})}catch(e){c=null,console.warn("[Performance] Failed to setup Long Task observer:",e)}return()=>{u()}},n.setupLongTaskSentryReporting=function(){if("undefined"==typeof document)return()=>{};const e=()=>{"hidden"===document.visibilityState&&h()};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}};const r=50,s=50,i=200,o=600;let a={count:0,totalDuration:0,maxDuration:0,tbt:0,tasks:[]},c=null;function u(){c&&(c.disconnect(),c=null)}function l(e=!1){const t={...a,tasks:[...a.tasks]};return e&&d(),t}function d(){a={count:0,totalDuration:0,maxDuration:0,tbt:0,tasks:[]}}function p(e){return e<i?"good":e<o?"needs-improvement":"poor"}function m(e=!1){const t=l(e);return{...t,tbtRating:p(t.tbt)}}function h(e){const t=e??m(),{sentry:n}=globalThis;n&&(n.setMeasurement?.("long_task_count",t.count,"none"),n.setMeasurement?.("long_task_total_ms",t.totalDuration,"millisecond"),n.setMeasurement?.("long_task_max_ms",t.maxDuration,"millisecond"),n.setMeasurement?.("tbt",t.tbt,"millisecond"),n.setTag?.("tbt.rating",t.tbtRating),n.setTag?.("long_task.count_bucket",function(e){if(0===e)return"0";if(e<=5)return"1-5";if(e<=10)return"6-10";if(e<=25)return"11-25";if(e<=50)return"26-50";return"50+"}(t.count)),n.addBreadcrumb?.({category:"performance",message:`Long tasks: ${t.count}, TBT: ${t.tbt}ms (${t.tbtRating})`,level:"info",data:{topTasks:t.tasks.slice(0,5)}}))}}}},{package:"$root$",file:"ui/helpers/utils/performance-observers.ts"}],[10254,{"../../../app/scripts/controllers/permissions":27,"../../../shared/constants/permissions":8735,"../../components/component-library":9667,"../constants/design-system":10200,"./util":10271,"@metamask/chain-agnostic-permission":1566,"@metamask/controller-utils":1611,"@metamask/snaps-rpc-methods":3688,"@metamask/snaps-utils":3858,"deep-freeze-strict":6649,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPermissionDescription=void 0,n.getWeightedPermissions=function({t:e,isRequestApprovalPermittedChains:t,permissions:n,getSubjectName:r,subjectName:s}){return Object.entries(n).reduce((n,[i,o])=>n.concat(k({t:e,isRequestApprovalPermittedChains:t,permissionName:i,permissionValue:o,subjectName:s,getSubjectName:r})),[]).sort((e,t)=>e.weight-t.weight)};var r=h(e("deep-freeze-strict")),s=h(e("react")),i=e("@metamask/snaps-rpc-methods"),o=e("@metamask/snaps-utils"),a=e("@metamask/controller-utils"),c=e("@metamask/chain-agnostic-permission"),u=e("../../../shared/constants/permissions"),l=e("../../components/component-library"),d=e("../constants/design-system"),p=e("../../../app/scripts/controllers/permissions"),m=e("./util");function h(e){return e&&e.__esModule?e:{default:e}}const f=Symbol("unknown"),g=s.default.createElement(l.Icon,{name:l.IconName.Info,size:l.IconSize.Sm,color:d.IconColor.iconMuted});function b(e){return s.default.createElement(l.Text,{fontWeight:d.FontWeight.Medium,variant:d.TextVariant.inherit,color:d.TextColor.inherit},e)}const y=(0,r.default)({[c.Caip25EndowmentPermissionName]:({t:e,isRequestApprovalPermittedChains:t})=>t?{label:e("permission_walletSwitchEthereumChain"),leftIcon:l.IconName.Wifi,weight:u.PermissionWeight.permittedChains}:{label:e("permission_ethereumAccounts"),leftIcon:l.IconName.Eye,weight:u.PermissionWeight.eth_accounts},[u.RestrictedMethods.eth_accounts]:({t:e})=>({label:e("permission_ethereumAccounts"),leftIcon:l.IconName.Eye,weight:u.PermissionWeight.eth_accounts}),[p.PermissionNames.permittedChains]:({t:e})=>({label:e("permission_walletSwitchEthereumChain"),leftIcon:l.IconName.Wifi,weight:u.PermissionWeight.permittedChains}),[u.RestrictedMethods.snap_dialog]:({t:e,subjectName:t})=>({label:e("permission_dialog"),description:e("permission_dialogDescription",[b(t)]),leftIcon:l.IconName.Messages,weight:u.PermissionWeight.snap_dialog}),[u.RestrictedMethods.snap_notify]:({t:e,subjectName:t})=>({label:e("permission_notifications"),description:e("permission_notificationsDescription",[b(t)]),leftIcon:l.IconName.Notification,weight:u.PermissionWeight.snap_notify}),[u.RestrictedMethods.snap_getBip32PublicKey]:({t:e,permissionValue:t,subjectName:n})=>t.caveats[0].value.map(({path:t,curve:r},i)=>{const a={leftIcon:l.IconName.SecuritySearch,weight:u.PermissionWeight.snap_getBip32PublicKey,id:`public-key-access-bip32-${t.join("-")?.replace(/'/gu,"h")}-${r}-${i}`,warningMessageSubject:(0,o.getSnapDerivationPathName)(t,r)??`${e("unknownNetworkForKeyEntropy")}  ${t.join("/")} (${r})`},c=(0,o.getSnapDerivationPathName)(t,r);return c?{...a,label:e("permission_viewNamedBip32PublicKeys",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:t.join("/")},c)]),description:e("permission_viewBip32PublicKeysDescription",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:`description-${t.join("/")}`},c),b(n)])}:{...a,label:e("permission_viewBip32PublicKeys",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:t.join("/")},`${e("unknownNetworkForKeyEntropy")} `," ",t.join("/")),r]),description:e("permission_viewBip32PublicKeysDescription",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:`description-${t.join("/")}`},t.join("/")),b(n)])}}),[u.RestrictedMethods.snap_getBip32Entropy]:({t:e,permissionValue:t,subjectName:n})=>t.caveats[0].value.map(({path:t,curve:r},i)=>{const a={leftIcon:l.IconName.Key,weight:u.PermissionWeight.snap_getBip32Entropy,id:`key-access-bip32-${t.join("-")?.replace(/'/gu,"h")}-${r}-${i}`,warningMessageSubject:(0,o.getSnapDerivationPathName)(t,r)??`${e("unknownNetworkForKeyEntropy")} ${t.join("/")} (${r})`},c=(0,o.getSnapDerivationPathName)(t,r);return c?{...a,label:e("permission_manageBip32Keys",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:t.join("/")},c)]),description:e("permission_manageBip44AndBip32KeysDescription",[b(n)])}:{...a,label:e("permission_manageBip32Keys",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:t.join("/")},`${e("unknownNetworkForKeyEntropy")} ${t.join("/")} (${r})`)]),description:e("permission_manageBip44AndBip32KeysDescription",[b(n)])}}),[u.RestrictedMethods.snap_getBip44Entropy]:({t:e,permissionValue:t,subjectName:n})=>t.caveats[0].value.map(({coinType:t},r)=>({label:e("permission_manageBip44Keys",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:`coin-type-${t}`},(0,o.getSlip44ProtocolName)(t)??`${e("unknownNetworkForKeyEntropy")} m/44'/${t}'`)]),description:e("permission_manageBip44AndBip32KeysDescription",[b(n)]),leftIcon:l.IconName.Key,weight:u.PermissionWeight.snap_getBip44Entropy,id:`key-access-bip44-${t}-${r}`,warningMessageSubject:(0,o.getSlip44ProtocolName)(t)??`${e("unknownNetworkForKeyEntropy")} m/44'/${t}'`})),[u.RestrictedMethods.snap_getEntropy]:({t:e,subjectName:t})=>({label:e("permission_getEntropy",[b(t)]),description:e("permission_getEntropyDescription",[b(t)]),leftIcon:l.IconName.SecurityKey,weight:u.PermissionWeight.snap_getEntropy}),[u.RestrictedMethods.snap_manageState]:({t:e,subjectName:t})=>({label:e("permission_manageState"),description:e("permission_manageStateDescription",[b(t)]),leftIcon:l.IconName.AddSquare,weight:u.PermissionWeight.snap_manageState}),[u.RestrictedMethods.snap_getLocale]:({t:e,subjectName:t})=>({label:e("permission_getLocale"),description:e("permission_getLocaleDescription",[b(t)]),leftIcon:l.IconName.Global,weight:u.PermissionWeight.snap_getLocale}),[u.RestrictedMethods.snap_getPreferences]:({t:e,subjectName:t})=>({label:e("permission_getPreferences"),description:e("permission_getPreferencesDescription",[b(t)]),leftIcon:l.IconName.Customize,weight:4}),[u.RestrictedMethods.wallet_snap]:({t:e,permissionValue:t,getSubjectName:n})=>{const r=t.caveats[0].value,i={leftIcon:l.IconName.Flash,rightIcon:g,weight:u.PermissionWeight.wallet_snap};return Object.keys(r).map(t=>{const r=n(t);return r?{...i,label:e("permission_accessNamedSnap",[s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:t},r)]),description:e("permission_accessSnapDescription",[r])}:{...i,label:e("permission_accessSnap",[t]),description:e("permission_accessSnapDescription",[t])}})},[u.EndowmentPermissions["endowment:network-access"]]:({t:e,subjectName:t})=>({label:e("permission_accessNetwork"),description:e("permission_accessNetworkDescription",[b(t)]),leftIcon:l.IconName.Wifi,weight:u.PermissionWeight.endowment_networkAccess}),[u.EndowmentPermissions["endowment:webassembly"]]:({t:e,subjectName:t})=>({label:e("permission_webAssembly"),description:e("permission_webAssemblyDescription",[b(t)]),leftIcon:l.IconName.DocumentCode,rightIcon:null,weight:u.PermissionWeight.endowment_webassembly}),[u.EndowmentPermissions["endowment:transaction-insight"]]:({t:e,permissionValue:t,subjectName:n})=>{const r={leftIcon:l.IconName.Speedometer,weight:u.PermissionWeight.endowment_transactionInsight},s=[{...r,label:e("permission_transactionInsight"),description:e("permission_transactionInsightDescription",[b(n)])}];return(0,a.isNonEmptyArray)(t.caveats)&&t.caveats[0].type===o.SnapCaveatType.TransactionOrigin&&t.caveats[0].value&&s.push({...r,label:e("permission_transactionInsightOrigin"),description:e("permission_transactionInsightOriginDescription",[b(n)]),leftIcon:l.IconName.Explore}),s},[u.EndowmentPermissions["endowment:cronjob"]]:({t:e,subjectName:t})=>({label:e("permission_cronjob"),description:e("permission_cronjobDescription",[b(t)]),leftIcon:l.IconName.Clock,weight:u.PermissionWeight.endowment_cronjob}),[u.EndowmentPermissions["endowment:ethereum-provider"]]:({t:e,subjectName:t})=>({label:e("permission_ethereumProvider"),description:e("permission_ethereumProviderDescription",[b(t)]),leftIcon:l.IconName.Ethereum,weight:u.PermissionWeight.endowment_ethereumProvider,id:"ethereum-provider-access",message:e("ethereumProviderAccess",[b(t)])}),[u.EndowmentPermissions["endowment:multichain-provider"]]:({t:e,subjectName:t})=>({label:e("permission_multichainProvider"),description:e("permission_multichainProviderDescription",[b(t)]),leftIcon:l.IconName.Connect,weight:u.PermissionWeight.endowment_multichainProvider,id:"multichain-provider-access",message:e("multichainProviderAccess",[b(t)])}),[u.EndowmentPermissions["endowment:rpc"]]:({t:e,permissionValue:t,subjectName:n})=>{const r={leftIcon:l.IconName.Hierarchy,weight:u.PermissionWeight.endowment_rpc},{snaps:o,dapps:a,allowedOrigins:c}=(0,i.getRpcCaveatOrigins)(t),p=[];if(o&&p.push({...r,label:e("permission_rpc",[e("otherSnaps"),b(n)]),description:e("permission_rpcDescription",[e("otherSnaps"),b(n)])}),a&&p.push({...r,label:e("permission_rpc",[e("websites"),b(n)]),description:e("permission_rpcDescription",[e("websites"),b(n)])}),c?.length>0){let t;if(1===c.length)t=s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,style:{lineBreak:"anywhere"}},c[0]);else{const n=c.slice(-1);t=e("permission_rpcDescriptionOriginList",[c.slice(0,-1).map(e=>s.default.createElement(s.default.Fragment,null,s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,style:{lineBreak:"anywhere"}},e),", ")),s.default.createElement(l.Text,{color:d.TextColor.inherit,variant:d.TextVariant.inherit,fontWeight:d.FontWeight.Medium,key:"2",style:{lineBreak:"anywhere"}},n)])}p.push({...r,label:e("permission_rpc",[t,b(n)]),description:e("permission_rpcDescription",[t,b(n)])})}return p},[u.EndowmentPermissions["endowment:lifecycle-hooks"]]:({t:e,subjectName:t})=>({label:e("permission_lifecycleHooks"),description:e("permission_lifecycleHooksDescription",[b(t)]),leftIcon:l.IconName.Hierarchy,weight:u.PermissionWeight.endowment_lifecycleHooks}),[u.EndowmentPermissions["endowment:page-home"]]:({t:e,subjectName:t})=>({label:e("permission_homePage"),description:e("permission_homePageDescription",[b(t)]),leftIcon:l.IconName.Home,weight:u.PermissionWeight.endowment_pageHome}),[u.RestrictedMethods.snap_manageAccounts]:({t:e,subjectName:t})=>({label:e("permission_manageAccounts"),description:e("permission_manageAccountsDescription",[b(t)]),leftIcon:l.IconName.UserCircleAdd,rightIcon:null,weight:u.PermissionWeight.snap_manageAccounts}),[u.EndowmentPermissions["endowment:keyring"]]:({t:e,subjectName:t})=>({label:e("permission_keyring"),description:e("permission_keyringDescription",[b(t)]),leftIcon:l.IconName.UserCircleAdd,rightIcon:null,weight:u.PermissionWeight.endowment_keyring}),[u.EndowmentPermissions["endowment:name-lookup"]]:({t:e})=>({label:e("permission_nameLookup"),description:e("permission_nameLookupDescription"),leftIcon:l.IconName.Search,weight:u.PermissionWeight.endowment_nameLookup}),[u.EndowmentPermissions["endowment:assets"]]:({t:e,subjectName:t})=>({label:e("permission_assets"),description:e("permission_assetsDescription",[b(t)]),leftIcon:l.IconName.Coin,weight:u.PermissionWeight.endowment_assets}),[u.EndowmentPermissions["endowment:protocol"]]:({t:e,subjectName:t})=>({label:e("permission_protocol"),description:e("permission_protocolDescription",[b(t)]),leftIcon:l.IconName.GlobalSearch,weight:u.PermissionWeight.endowment_protocol}),[u.EndowmentPermissions["endowment:signature-insight"]]:({t:e,permissionValue:t,subjectName:n})=>{const r={leftIcon:l.IconName.Warning,weight:u.PermissionWeight.endowment_signatureInsight},s=[{...r,label:e("permission_signatureInsight"),description:e("permission_signatureInsightDescription",[b(n)])}];return(0,a.isNonEmptyArray)(t.caveats)&&t.caveats.find(e=>e.type===o.SnapCaveatType.SignatureOrigin&&e.value)&&s.push({...r,label:e("permission_signatureInsightOrigin"),description:e("permission_signatureInsightOriginDescription",[b(n)]),leftIcon:l.IconName.Explore}),s},[u.ConnectionPermission.connection_permission]:({t:e,permissionValue:t,subjectName:n})=>Object.keys(t).map(t=>{let r=(0,m.getURLHost)(t);return r||(r=t.replace("npm:","")),{label:e("snapConnectTo",[s.default.createElement(l.Text,{key:"connectToMain",fontWeight:d.FontWeight.Medium,variant:d.TextVariant.inherit,color:d.TextColor.inherit,style:{lineBreak:"anywhere"}},r)]),description:e("snapConnectionPermissionDescription",[b(n),s.default.createElement(l.Text,{key:"connectToDescription",fontWeight:d.FontWeight.Medium,variant:d.TextVariant.inherit,color:d.TextColor.inherit},r)]),leftIcon:undefined,connection:t,connectionName:r,subjectName:n,weight:u.PermissionWeight.connection_permission}}),[f]:({t:e,permissionName:t})=>({label:e("permission_unknown",[t??"undefined"]),leftIcon:l.IconName.Question,rightIcon:null,weight:u.PermissionWeight.unknown_permission})}),k=({t:e,isRequestApprovalPermittedChains:t,permissionName:n,permissionValue:r,subjectName:s,getSubjectName:i})=>{let o=y[f];Object.hasOwnProperty.call(y,n)&&(o=y[n]);const a=o({t:e,isRequestApprovalPermittedChains:t,permissionName:n,permissionValue:r,subjectName:s,getSubjectName:i});return Array.isArray(a)?a.map(e=>({...e,permissionName:n,permissionValue:r})):[{...a,permissionName:n,permissionValue:r}]};n.getPermissionDescription=k}}},{package:"$root$",file:"ui/helpers/utils/permission.js"}],[10255,{"../../../shared/constants/permissions":8735,"@metamask/keyring-api":2766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.containsEthPermissionsAndNonEvmAccount=void 0;var r=e("@metamask/keyring-api"),s=e("../../../shared/constants/permissions");n.containsEthPermissionsAndNonEvmAccount=(e,t)=>{const n=Object.keys(s.RestrictedEthMethods),i=Object.keys(t).some(e=>n.includes(e)),o=e.some(e=>!(0,r.isEvmAccountType)(e.type));return i&&o}}}},{package:"$root$",file:"ui/helpers/utils/permissions.ts"}],[10256,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPortfolioUrl=function(e="",t="",n="",r=!1,s=!1,i,o){const a=new URL(e,"https://app.metamask.io");a.searchParams.append("metamaskEntry",t),a.searchParams.append("metametricsId",n),a.searchParams.append("metricsEnabled",String(r)),a.searchParams.append("marketingEnabled",String(s)),i&&a.searchParams.append("accountAddress",i);o&&a.searchParams.append("tab",o);return a.href}}}},{package:"$root$",file:"ui/helpers/utils/portfolio.js"}],[10257,{"../../store/actions":11613,"webextension-polyfill":8691},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.reloadExtensionFromUi=async function(){try{await(0,i.requestSafeReload)(),window.close()}catch{s.default.runtime.reload()}};var r,s=(r=e("webextension-polyfill"))&&r.__esModule?r:{default:r},i=e("../../store/actions")}}},{package:"$root$",file:"ui/helpers/utils/reload-extension-from-ui.ts"}],[10258,{"../../../shared/lib/deep-links/constants":8795,"../../../shared/lib/deep-links/parse":8797},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isInternalRouteHref=i,n.resolveTrustedDeepLinkHref=async function(e){if(i(e))return e;try{const n=new URL(e);if((t=n.hostname)!==r.DEEP_LINK_HOST&&!t.endsWith(`.${r.DEEP_LINK_HOST}`))return e;const i=await(0,s.parse)(n,{verify:!1});return i?"redirectTo"in i.destination?i.destination.redirectTo.toString():function(e,t){const n=t.toString();return n?`${e}?${n}`:e}(i.destination.path,i.destination.query):e}catch{return e}var t};var r=e("../../../shared/lib/deep-links/constants"),s=e("../../../shared/lib/deep-links/parse");function i(e){return e.startsWith("/")&&!e.startsWith("//")}}}},{package:"$root$",file:"ui/helpers/utils/resolve-deep-link-href.ts"}],[10259,{"../../../shared/lib/hexstring-utils":8856,"@metamask/bridge-controller":1436,"@metamask/utils":4236,loglevel:7398},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.formatAccountToCaipAccountId=void 0;var r,s=e("@metamask/bridge-controller"),i=e("@metamask/utils"),o=(r=e("loglevel"))&&r.__esModule?r:{default:r},a=e("../../../shared/lib/hexstring-utils");n.formatAccountToCaipAccountId=(e,t)=>{try{const n=(0,s.formatChainIdToCaip)(t),{namespace:r,reference:o}=(0,i.parseCaipChainId)(n),c=(0,i.isValidHexAddress)(e)?(0,a.toChecksumHexAddress)(e):e;return(0,i.toCaipAccountId)(r,o,c)}catch(e){return o.default.error("[rewards-utils] Error formatting account to CAIP-10:",e),null}}}}},{package:"$root$",file:"ui/helpers/utils/rewards-utils.ts"}],[10261,{"../../../shared/constants/state-corruption":8746,"../../../shared/lib/error-utils":8831,"../../../shared/lib/get-first-preferred-lang-code":8854,"../../../shared/lib/switch-direction":8920,"../../../shared/lib/translate":8931,"../../../shared/lib/ui-utils":8934,"./display-critical-error":10236,lodash:7388,loglevel:7398},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.displayStateCorruptionError=async function(e,t,n,s,o){r.default.error(n);const a=await m(i.VAULT_RECOVERY_LINK,s,o,i.SUPPORT_LINK),c=(0,d.displayCriticalErrorPage)(e,a);if(!c)return;const p=c.querySelector("#critical-error-button");p&&(p.addEventListener("click",function e(){confirm((0,l.t)("stateCorruptionAreYouSure")??"")&&(this.removeEventListener("click",e),this.disabled=!0,this.innerText=s?(0,l.t)("stateCorruptionRestoringDatabase")??"":(0,l.t)("stateCorruptionResettingDatabase")??"",t.postMessage({data:{method:u.METHOD_REPAIR_DATABASE}}))}),setTimeout(()=>{p.disabled=!1},5e3))},n.getStateCorruptionErrorHtml=m;var r=p(e("loglevel")),s=e("lodash"),i=e("../../../shared/lib/ui-utils"),o=e("../../../shared/lib/error-utils"),a=e("../../../shared/lib/switch-direction"),c=p(e("../../../shared/lib/get-first-preferred-lang-code")),u=e("../../../shared/constants/state-corruption"),l=e("../../../shared/lib/translate"),d=e("./display-critical-error");function p(e){return e&&e.__esModule?e:{default:e}}async function m(e,t,n,r){let i;n?(i=n,await(0,l.updateCurrentLocale)(n)):(i=await(0,c.default)(),await(0,l.updateCurrentLocale)(i)),(0,a.switchDirectionForPreferredLocale)(i);const u=`<a href="${(0,s.escape)(e)}" title="${(0,s.escape)((0,l.t)("stateCorruptionTheseInstructionsLinkTitle")??"")}" class="critical-error__link" target="_blank" rel="noopener noreferrer">${(0,s.escape)((0,l.t)("stateCorruptionTheseInstructions")??"")}</a>`;let d,p,m;t?(d=(0,l.t)("stateCorruptionDetectedWithBackup")??"",p=(0,l.t)("stateCorruptionCopyAndRestoreBeforeRecovery",u)??"",m=(0,l.t)("stateCorruptionRestoreAccountsFromBackup")??""):(d=(0,l.t)("stateCorruptionDetectedNoBackup")??"",p=(0,l.t)("stateCorruptionCopyAndRestoreBeforeReset",u)??"",m=(0,l.t)("stateCorruptionResetMetaMaskState")??"");const h=`\n    <div class="critical-error__header">\n      ${(0,o.criticalErrorWarningIconMarkup)()}\n      <h1 class="critical-error__title">${(0,l.t)("stateCorruptionMetamaskDatabaseCannotBeAccessed")}</h1>\n    </div>\n  `,f=r?`<p class="critical-error__footer small">${(0,s.escape)((0,l.t)("unexpectedBehavior")??"")} <a\n        href="${(0,s.escape)(r)}"\n        class="critical-error__link"\n        target="_blank"\n        rel="noopener noreferrer">\n          ${(0,s.escape)((0,l.t)("sendBugReport")??"")}\n      </a>\n    </p>`:"",g=`\n    <div class="critical-error__body">\n      <p>${(0,s.escape)(d)}</p>\n      <p>${p}</p>\n    </div>\n    <div class="critical-error__footer-actions">\n      <button disabled id="critical-error-button" class="critical-error__button-restore button btn-primary">\n        ${m}\n      </button>\n      ${f}\n    </div>\n  `;return(0,o.getErrorHtmlBase)(`\n    ${h}\n    ${g}\n  `)}}}},{package:"$root$",file:"ui/helpers/utils/state-corruption-html.ts"}],[10262,{"../../../shared/lib/environment-type":8829,"../../ducks/metamask/base-selectors":10184,"../../selectors":11575,"../../selectors/metamask-notifications/metamask-notifications":11576,"../../selectors/nft":11590},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getStartupTraceTags=function(e){const t=(0,r.getEnvironmentType)(),n=(0,s.getIsUnlocked)(e),c=(0,i.getInternalAccounts)(e).length,u=(0,a.selectAllNftsFlat)(e).length,l=(0,o.getMetamaskNotifications)(e).length,d=(0,i.selectAllTokensFlat)(e).length,p=(0,i.getTransactions)(e).length,m=(0,i.getPendingApprovals)(e),h=m?.[0]?.type;return{"wallet.account_count":c,"wallet.nft_count":u,"wallet.notification_count":l,"wallet.pending_approval":h,"wallet.token_count":d,"wallet.transaction_count":p,"wallet.unlocked":n,"wallet.ui_type":t}};var r=e("../../../shared/lib/environment-type"),s=e("../../ducks/metamask/base-selectors"),i=e("../../selectors"),o=e("../../selectors/metamask-notifications/metamask-notifications"),a=e("../../selectors/nft")}}},{package:"$root$",file:"ui/helpers/utils/tags.ts"}],[10263,{"../../../shared/lib/hexstring-utils":8856,"@metamask/bridge-controller":1436,"@metamask/design-system-react":2058,"@metamask/utils":4236},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.shouldShowContractAddress=n.isNativeAddress=n.getPriceChangeColor=n.formatPercentage=n.formatContractAddress=n.formatCompactCurrency=void 0;var r=e("@metamask/utils"),s=e("@metamask/bridge-controller"),i=e("@metamask/design-system-react"),o=e("../../../shared/lib/hexstring-utils");const a=e=>{if(!e)return!1;if((0,s.isNativeAddress)(e))return!0;const t=e.toLowerCase();return["0","0x0","0x","0x0000000000000000000000000000000000000000"].includes(t)};n.isNativeAddress=a;n.formatPercentage=e=>{if(e===undefined||null===e)return"—";return`${e>0?"+":""}${e.toFixed(2)}%`};n.formatCompactCurrency=(e,t,n="en-US")=>{if(!e)return"—";return new Intl.NumberFormat(n,{style:"currency",currency:t,notation:"compact",maximumFractionDigits:2}).format(e)};n.formatContractAddress=e=>{if(!e)return"";if((0,r.isCaipAssetType)(e)){const{assetReference:t}=(0,r.parseCaipAssetType)(e);return(0,r.isStrictHexString)(t)?(0,o.toChecksumHexAddress)(t):t}return(0,r.isStrictHexString)(e)?(0,o.toChecksumHexAddress)(e):e};n.getPriceChangeColor=e=>e>0?i.TextColor.SuccessDefault:e<0?i.TextColor.ErrorDefault:i.TextColor.TextDefault;n.shouldShowContractAddress=e=>{if(!e)return!1;if(a(e))return!1;const t=e.toLowerCase();return!["0","0x0","0x"].includes(t)}}}},{package:"$root$",file:"ui/helpers/utils/token-insights.ts"}],[10267,{"../../hooks/useI18nContext":10435},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useTransactionDisplay=function(e){return{title:(0,r.useI18nContext)()(s[e])}};var r=e("../../hooks/useI18nContext");const s={pending:"transactionSubmitted",success:"transactionConfirmed",failed:"transactionFailed"}}}},{package:"$root$",file:"ui/helpers/utils/transaction-display.ts"}],[10268,{"../../../shared/constants/transaction":8752,"../../../shared/lib/add-hex-prefix":8776,"../../../shared/lib/contract-utils":8789,"@metamask/transaction-controller":4006},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getFourBytePrefix=function(e=""){const t=(0,s.addHexPrefix)(e);return t.slice(0,10)},n.getLatestSubmittedTxWithNonce=function(e=[],t="0x0"){if(!e.length)return{};return e.reduce((e,n)=>{const{submittedTime:r,txParams:{nonce:s}={}}=n;return s===t?e.submittedTime?r>e.submittedTime?n:e:n:e},{})},n.getStatusKey=function(e){const{txReceipt:{status:t}={},type:n,status:s}=e;if("0x0"===t)return r.TransactionStatus.failed;if(s===r.TransactionStatus.confirmed&&n===r.TransactionType.cancel)return i.TransactionGroupStatus.cancelled;return e.status},n.getTransactionTypeTitle=function(e,t,n="ETH"){switch(t){case r.TransactionType.tokenMethodTransfer:return e("transfer");case r.TransactionType.tokenMethodTransferFrom:return e("transferFrom");case r.TransactionType.tokenMethodSafeTransferFrom:return e("safeTransferFrom");case r.TransactionType.tokenMethodApprove:return e("approve");case r.TransactionType.tokenMethodSetApprovalForAll:return e("setApprovalForAll");case r.TransactionType.tokenMethodIncreaseAllowance:return e("approveIncreaseAllowance");case r.TransactionType.simpleSend:return e("sendingNativeAsset",[n]);case r.TransactionType.contractInteraction:case r.TransactionType.batch:case r.TransactionType.revokeDelegation:return e("contractInteraction");case r.TransactionType.deployContract:return e("contractDeployment");case r.TransactionType.swap:return e("swap");case r.TransactionType.swapAndSend:return e("swapAndSend");case r.TransactionType.swapApproval:return e("swapApproval");default:throw new Error(`Unrecognized transaction type: ${t}`)}},n.isLegacyTransaction=function(e){return e?.type===r.TransactionEnvelopeType.legacy},n.isSmartContractAddress=async function(e){const{isContractAddress:t}=await(0,o.readAddressAsContract)(global.ethereumProvider,e);return t},n.isTokenMethodAction=function(e){return[r.TransactionType.tokenMethodTransfer,r.TransactionType.tokenMethodApprove,r.TransactionType.tokenMethodSetApprovalForAll,r.TransactionType.tokenMethodTransferFrom,r.TransactionType.tokenMethodSafeTransferFrom,r.TransactionType.tokenMethodIncreaseAllowance].includes(e)};var r=e("@metamask/transaction-controller"),s=e("../../../shared/lib/add-hex-prefix"),i=e("../../../shared/constants/transaction"),o=e("../../../shared/lib/contract-utils")}}},{package:"$root$",file:"ui/helpers/utils/transactions.util.js"}],[10269,{"../../components/component-library":9667,"../../hooks/useTrustSignals":10492,"../constants/design-system":10200},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getTrustSignalIcon=function(e){if(!e)return null;switch(e){case i.TrustSignalDisplayState.Malicious:return{name:r.IconName.Danger,color:s.IconColor.errorDefault};case i.TrustSignalDisplayState.Verified:return{name:r.IconName.VerifiedFilled,color:s.IconColor.infoDefault};case i.TrustSignalDisplayState.Warning:return null;case i.TrustSignalDisplayState.Unknown:return{name:r.IconName.Question,color:undefined};case i.TrustSignalDisplayState.Petname:case i.TrustSignalDisplayState.Recognized:return null;default:return{name:r.IconName.Question,color:undefined}}};var r=e("../../components/component-library"),s=e("../constants/design-system"),i=e("../../hooks/useTrustSignals")}}},{package:"$root$",file:"ui/helpers/utils/trust-signals.ts"}],[10272,{"web-vitals/attribution":8689},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getWebVitalsMetrics=k,n.initCLSObserver=y,n.initFCPObserver=g,n.initINPObserver=f,n.initLCPObserver=b,n.initWebVitals=function(){f(),g(),b(),y(),!1},n.resetWebVitalsMetrics=w;var r=e("web-vitals/attribution");const s={inp:null,fcp:null,lcp:null,cls:null,inpRating:null,fcpRating:null,lcpRating:null,clsRating:null},i=200,o=500,a=2500,c=4e3,u=1800,l=3e3,d=.1,p=.25;function m(e,t,n){return e<=t?"good":e<=n?"needs-improvement":"poor"}function h(e,t,n,r,s){const{sentry:i}=globalThis;i&&(i.setTag?.(`${e.toLowerCase()}.rating`,r),s&&Object.keys(s).length>0&&i.setContext?.(`${e.toLowerCase()}_attribution`,s),"poor"!==r&&"needs-improvement"!==r||i.addBreadcrumb?.({category:`performance.${e.toLowerCase()}`,message:`${e}: ${t}${"millisecond"===n?"ms":""} (${r})`,level:"poor"===r?"warning":"info",data:s}))}function f(){try{(0,r.onINP)(e=>{const{value:t,attribution:n}=e,r=m(t,i,o);s.inp=t,s.inpRating=r;const a={};n&&(a.interactionTarget=n.interactionTarget??null,a.interactionType=n.interactionType??null,a.loadState=n.loadState??null,a.inputDelay=n.inputDelay??null,a.processingDuration=n.processingDuration??null,a.presentationDelay=n.presentationDelay??null),h("INP",t,"millisecond",r,a)},{reportAllChanges:!0})}catch(e){console.warn("[Performance] Failed to initialize INP observer:",e)}}function g(){try{(0,r.onFCP)(e=>{const{value:t,attribution:n}=e,r=m(t,u,l);s.fcp=t,s.fcpRating=r;const i={};n&&(i.timeToFirstByte=n.timeToFirstByte??null,i.firstByteToFCP=n.firstByteToFCP??null,i.loadState=n.loadState??null),h("FCP",t,"millisecond",r,i)},{reportAllChanges:!0})}catch(e){console.warn("[Performance] Failed to initialize FCP observer:",e)}}function b(){try{(0,r.onLCP)(e=>{const{value:t,attribution:n}=e,r=m(t,a,c);s.lcp=t,s.lcpRating=r;const i={};n&&(i.element=n.element??null,i.url=n.url??null),h("LCP",t,"millisecond",r,i)},{reportAllChanges:!0})}catch(e){console.warn("[Performance] Failed to initialize LCP observer:",e)}}function y(){try{(0,r.onCLS)(e=>{const{value:t,attribution:n}=e,r=m(t,d,p);s.cls=t,s.clsRating=r;const i={};n&&(i.largestShiftTarget=n.largestShiftTarget??null,i.largestShiftTime=n.largestShiftTime??null,i.largestShiftValue=n.largestShiftValue??null),h("CLS",t,"none",r,i)},{reportAllChanges:!0})}catch(e){console.warn("[Performance] Failed to initialize CLS observer:",e)}}function k(){return{...s}}function w(){s.inp=null,s.fcp=null,s.lcp=null,s.cls=null,s.inpRating=null,s.fcpRating=null,s.lcpRating=null,s.clsRating=null}}}},{package:"$root$",file:"ui/helpers/utils/web-vitals.ts"}],[10273,{"../../../shared/constants/app":8704,"../../../shared/lib/browser-runtime.utils":8784,"../../../shared/lib/environment-type":8829,"../../contexts/hardware-wallets/webConnectionUtils":10145},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("../../../shared/constants/app"),s=e("../../../shared/lib/environment-type"),i=e("../../../shared/lib/browser-runtime.utils"),o=e("../../contexts/hardware-wallets/webConnectionUtils");n.default=class{static async queryCameraPermission(){return(0,o.queryCameraPermissionWithStatus)()}static async requestVideoStream(){return(0,o.openCameraVideoStream)()}static stopVideoStream(e){(0,o.stopMediaStreamTracks)(e)}static async checkStatus(){const e=(0,s.getEnvironmentType)(),t=e===r.ENVIRONMENT_TYPE_POPUP,n=e===r.ENVIRONMENT_TYPE_SIDEPANEL,o=(0,i.getBrowserName)(),a=o===r.PLATFORM_FIREFOX||o===r.PLATFORM_BRAVE,c=(await window.navigator.mediaDevices.enumerateDevices()).filter(e=>"videoinput"===e.kind),u=c.length>0,l=c.some(e=>e.label&&e.label.length>0);if(u){let e=!0;const r=t||n;return(a&&r||r&&!l)&&(e=!1),{permissions:l,environmentReady:e}}const d=new Error("No webcam found");throw d.type="NO_WEBCAM_FOUND",d}}}}},{package:"$root$",file:"ui/helpers/utils/webcam-utils.js"}],[10274,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.openWindow=void 0;n.openWindow=(e,t)=>{window.open(e,t||"_blank","noopener")}}}},{package:"$root$",file:"ui/helpers/utils/window.ts"}],[10275,{"../../selectors":11575,"@metamask/keyring-utils":2863,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useAccountNetworkAvailability=void 0;var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("@metamask/keyring-utils"),o=e("../../selectors");n.useAccountNetworkAvailability=()=>{const e=(0,r.c)(4),t=(0,s.useSelector)(o.getMetaMaskAccountsOrdered);let n;e[0]!==t?(n=e=>t.some(t=>{const{scopes:n}=t;return(0,i.isScopeEqualToAny)(e,n)}),e[0]=t,e[1]=n):n=e[1];const a=n;let c;return e[2]!==a?(c={hasAnyAccountsInNetwork:a},e[2]=a,e[3]=c):c=e[3],c}}}},{package:"$root$",file:"ui/hooks/accounts/useAccountNetworkAvailability.ts"}],[10276,{"../../store/actions":11613,"../useI18nContext":10435,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useAccountsOperationsLoadingStates=void 0;var r=e("react-compiler-runtime"),s=e("react-redux"),i=e("react"),o=e("../useI18nContext"),a=e("../../store/actions");function c(e){return e.metamask.isAccountTreeSyncingInProgress}n.useAccountsOperationsLoadingStates=()=>{const e=(0,r.c)(10),t=(0,o.useI18nContext)(),n=(0,s.useDispatch)(),u=(0,s.useSelector)(c);let l,d;e[0]!==n?(l=()=>{(0,a.forceUpdateMetamaskState)(n)},e[0]=n,e[1]=l):l=e[1],e[2]!==u?(d=[u],e[2]=u,e[3]=d):d=e[3],(0,i.useEffect)(l,d);const p=u;let m;e:{if(!0===u){let n;e[4]!==t?(n=t("syncing"),e[4]=t,e[5]=n):n=e[5],m=n;break e}m=undefined}const h=m;let f;return e[6]!==p||e[7]!==u||e[8]!==h?(f={areAnyOperationsLoading:p,isAccountTreeSyncingInProgress:u,loadingMessage:h},e[6]=p,e[7]=u,e[8]=h,e[9]=f):f=e[9],f}}}},{package:"$root$",file:"ui/hooks/accounts/useAccountsOperationsLoadingStates.ts"}],[10277,{"../../store/actions":11613,"@metamask/snaps-utils":3858,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MultichainWalletSnapSender=void 0,n.useMultichainWalletSnapSender=function(e){const t=(0,r.c)(2);let n;t[0]!==e?(n=new l(e),t[0]=e,t[1]=n):n=t[1];return n};var r=e("react-compiler-runtime"),s=e("@metamask/snaps-utils"),i=(e("react"),e("../../store/actions"));function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function c(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var u=new WeakMap;class l{constructor(e){var t,n,r;a(this,u,void 0),o(this,"send",async e=>{return await(0,i.handleSnapRequest)({origin:"metamask",snapId:(t=u,n=this,t.get(c(t,n))),handler:s.HandlerType.OnKeyringRequest,request:e});var t,n}),n=this,r=e,(t=u).set(c(t,n),r)}}n.MultichainWalletSnapSender=l}}},{package:"$root$",file:"ui/hooks/accounts/useMultichainWalletSnapSender.ts"}],[10278,{"./useBatchSellNavigation":10279,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useBatchSell=void 0;var r=e("react-compiler-runtime"),s=(e("react"),e("./useBatchSellNavigation"));n.useBatchSell=()=>{const e=(0,r.c)(4),{navigateToBatchSellSelectPage:t}=(0,s.useBatchSellNavigation)();let n;e[0]!==t?(n=()=>{t()},e[0]=t,e[1]=n):n=e[1];const i=n;let o;return e[2]!==i?(o={openBatchSellExperience:i},e[2]=i,e[3]=o):o=e[3],o}}}},{package:"$root$",file:"ui/hooks/batch-sell/useBatchSell.ts"}],[10279,{"../../helpers/constants/routes":10205,react:7855,"react-compiler-runtime":7766,"react-router-dom":7831},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useBatchSellNavigation=void 0;var r=e("react-compiler-runtime"),s=(e("react"),e("react-router-dom")),i=e("../../helpers/constants/routes");n.useBatchSellNavigation=()=>{const e=(0,r.c)(14),t=(0,s.useNavigate)(),{pathname:n}=(0,s.useLocation)();let o;e[0]!==t||e[1]!==n?(o=(e,r)=>{const s=e===undefined?{pathname:n}:e,i=r!==undefined&&r;t(s,{state:{stayOnHomePage:i}})},e[0]=t,e[1]=n,e[2]=o):o=e[2];const a=o;let c;e[3]!==a?(c=()=>{a(i.DEFAULT_ROUTE,!0)},e[3]=a,e[4]=c):c=e[4];const u=c;let l;e[5]!==t?(l=()=>{t({pathname:i.BATCH_SELL_SELECT_ROUTE})},e[5]=t,e[6]=l):l=e[6];const d=l;let p;e[7]!==t?(p=()=>{t({pathname:i.BATCH_SELL_REVIEW_ROUTE})},e[7]=t,e[8]=p):p=e[8];const m=p;let h;return e[9]!==m||e[10]!==d||e[11]!==u||e[12]!==a?(h={resetLocationState:a,navigateToDefaultRoute:u,navigateToBatchSellSelectPage:d,navigateToBatchSellConfirmPage:m},e[9]=m,e[10]=d,e[11]=u,e[12]=a,e[13]=h):h=e[13],h}}}},{package:"$root$",file:"ui/hooks/batch-sell/useBatchSellNavigation.ts"}],[10280,{react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useSortBatchSellAssetsByBalance=void 0;var r=e("react-compiler-runtime");e("react");n.useSortBatchSellAssetsByBalance=(e,t)=>{const n=(0,r.c)(5);let s;if(n[0]!==e||n[1]!==t){let r;n[3]!==t?(r=(e,n)=>{const r=e.tokenFiatAmount??0,s=n.tokenFiatAmount??0;return"desc"===t?s-r:r-s},n[3]=t,n[4]=r):r=n[4],s=e.toSorted(r),n[0]=e,n[1]=t,n[2]=s}else s=n[2];return s}}}},{package:"$root$",file:"ui/hooks/batch-sell/useSortBatchSellAssetsByBalance.ts"}],[10281,{"../../components/multichain/activity-v2/helpers":9808,"../../pages/bridge/hooks/useBridgeTokenDisplayData":10593,"./useBridgeChainInfo":10282,"./useBridgeTxHistoryData":10285,"@metamask/transaction-controller":4006,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useBridgeActivityData=void 0;var r,s=e("react-compiler-runtime"),i=(e("react"),e("@metamask/transaction-controller")),o=e("../../pages/bridge/hooks/useBridgeTokenDisplayData"),a=e("../../components/multichain/activity-v2/helpers"),c=(r=e("./useBridgeChainInfo"))&&r.__esModule?r:{default:r},u=e("./useBridgeTxHistoryData");n.useBridgeActivityData=e=>{const t=(0,s.c)(12),{transaction:n}=e;let r;t[0]!==n?(r=n?{...n,type:n.type&&[i.TransactionType.bridge,i.TransactionType.swap].includes(n.type)?n.type:(0,a.resolveTransactionType)(n)}:undefined,t[0]=n,t[1]=r):r=t[1];const l=r;let d;t[2]!==l?(d={transaction:l},t[2]=l,t[3]=d):d=t[3];const p=(0,o.useBridgeTokenDisplayData)(d);let m;t[4]!==l?(m={transaction:l},t[4]=l,t[5]=m):m=t[5];const h=(0,c.default)(m);let f;t[6]!==l?(f={transaction:l},t[6]=l,t[7]=f):f=t[7];const g=(0,u.useBridgeTxHistoryData)(f);let b;t[8]!==g||t[9]!==h||t[10]!==p?(b={...p,...h,...g},t[8]=g,t[9]=h,t[10]=p,t[11]=b):b=t[11];return b}}}},{package:"$root$",file:"ui/hooks/bridge/useBridgeActivityData.ts"}],[10282,{"../../../shared/constants/bridge":8706,"../../../shared/constants/common":8709,"../../../shared/constants/multichain/networks":8729,"../../ducks/bridge-status/selectors":10169,"@metamask/bridge-controller":1436,"@metamask/transaction-controller":4006,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){const t=(0,r.c)(18),{transaction:n,nonEvmTransaction:p}=e;let m;t[0]!==p?.id||t[1]!==n?.hash?(m=e=>(0,l.selectBridgeHistoryItemByHash)(e,n?.hash??p?.id),t[0]=p?.id,t[1]=n?.hash,t[2]=m):m=t[2];const h=(0,i.useSelector)(m);if(!(h||n?.type&&[s.TransactionType.bridge,s.TransactionType.swap].includes(n.type)||p)){let e;return t[3]===Symbol.for("react.memo_cache_sentinel")?(e={srcNetwork:undefined,destNetwork:undefined},t[3]=e):e=t[3],e}let f,g,b,y,k;if(t[4]!==h||t[5]!==p?.chain||t[6]!==n?.chainId){k=Symbol.for("react.early_return_sentinel");e:{const{srcChainId:e,destChainId:r}=h?d(h):{srcChainId:n?.chainId??p?.chain,destChainId:n?.chainId??p?.chain};if(!e||!r){let e;t[12]===Symbol.for("react.memo_cache_sentinel")?(e={srcNetwork:undefined,destNetwork:undefined},t[12]=e):e=t[12],k=e;break e}let s,i,l,m;try{s=(0,o.formatChainIdToCaip)(e),l=(0,o.getNativeAssetForChainId)(e),i=(0,o.formatChainIdToCaip)(r),m=(0,o.getNativeAssetForChainId)(r)}catch(w){const e=w;let n;console.warn("Error getting XChain swaps network info",e),t[13]===Symbol.for("react.memo_cache_sentinel")?(n={srcNetwork:undefined,destNetwork:undefined},t[13]=n):n=t[13],k=n;break e}const v=(0,o.isNonEvmChainId)(e)?s:(0,o.formatChainIdToHex)(e),T={...{chainId:s,name:c.NETWORK_TO_SHORT_NETWORK_NAME_MAP[v]},...(0,o.isNonEvmChainId)(s)?{isEvm:!1,nativeCurrency:l?.assetId,blockExplorerUrl:u.MULTICHAIN_NETWORK_BLOCK_EXPLORER_FORMAT_URLS_MAP[s]?.url}:{defaultBlockExplorerUrlIndex:0,blockExplorerUrls:[a.CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP[v]],defaultRpcEndpointIndex:0,rpcEndpoints:[],nativeCurrency:l?.symbol,isEvm:!0}},S=(0,o.isNonEvmChainId)(r)?i:(0,o.formatChainIdToHex)(r);b=T,y={...{chainId:i,name:c.NETWORK_TO_SHORT_NETWORK_NAME_MAP[S]},...(0,o.isNonEvmChainId)(i)?{isEvm:!1,nativeCurrency:m?.assetId,blockExplorerUrl:u.MULTICHAIN_NETWORK_BLOCK_EXPLORER_FORMAT_URLS_MAP[i]?.url}:{defaultBlockExplorerUrlIndex:0,blockExplorerUrls:[a.CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP[S]],defaultRpcEndpointIndex:0,rpcEndpoints:[],nativeCurrency:m?.symbol,isEvm:!0}},f=Boolean,g=e&&r&&(0,o.isCrossChain)(e,r)}t[4]=h,t[5]=p?.chain,t[6]=n?.chainId,t[7]=f,t[8]=g,t[9]=b,t[10]=y,t[11]=k}else f=t[7],g=t[8],b=t[9],y=t[10],k=t[11];if(k!==Symbol.for("react.early_return_sentinel"))return k;const w=f(g);let v;t[14]!==b||t[15]!==y||t[16]!==w?(v={srcNetwork:b,destNetwork:y,isBridgeTx:w},t[14]=b,t[15]=y,t[16]=w,t[17]=v):v=t[17];return v};var r=e("react-compiler-runtime"),s=e("@metamask/transaction-controller"),i=e("react-redux"),o=e("@metamask/bridge-controller"),a=e("../../../shared/constants/common"),c=e("../../../shared/constants/bridge"),u=e("../../../shared/constants/multichain/networks"),l=e("../../ducks/bridge-status/selectors");const d=({quote:e})=>{const{srcChainId:t,destChainId:n}=e;return{srcChainId:t,destChainId:n}}}}},{package:"$root$",file:"ui/hooks/bridge/useBridgeChainInfo.ts"}],[10283,{"../../ducks/bridge/bridge":10172,"../../ducks/bridge/selectors":10174,"../../ducks/bridge/utils":10175,"../../ducks/metamask/metamask":10185,"../../selectors":11575,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useBridgeExchangeRates=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("../../ducks/bridge/selectors"),a=e("../../selectors"),c=e("../../ducks/metamask/metamask"),u=e("../../ducks/bridge/bridge"),l=e("../../ducks/bridge/utils");n.useBridgeExchangeRates=()=>{const e=(0,r.c)(12),t=(0,i.useDispatch)(),n=(0,i.useSelector)(c.getCurrentCurrency),d=(0,i.useSelector)(o.getFromToken),p=(0,i.useSelector)(a.getMarketData);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=new AbortController,e[0]=m):m=e[0];const h=(0,s.useRef)(m);let f;e[1]!==d||e[2]!==p?(f=d?(0,l.exchangeRateFromMarketData)(d.assetId,p):undefined,e[1]=d,e[2]=p,e[3]=f):f=e[3];const g=f;let b,y,k,w;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=()=>()=>{h.current?.abort(),h.current=null},y=[],e[4]=b,e[5]=y):(b=e[4],y=e[5]),(0,s.useEffect)(b,y),e[6]!==g||e[7]!==n||e[8]!==t||e[9]!==d?(k=()=>{h.current?.abort(),h.current=new AbortController,d&&!g&&t((0,u.setSrcTokenExchangeRates)({assetId:d.assetId,currency:n,signal:h.current.signal}))},w=[n,t,d,g],e[6]=g,e[7]=n,e[8]=t,e[9]=d,e[10]=k,e[11]=w):(k=e[10],w=e[11]),(0,s.useEffect)(k,w)}}}},{package:"$root$",file:"ui/hooks/bridge/useBridgeExchangeRates.ts"}],[10284,{"../../../shared/lib/deep-links/routes/route":8813,"../../../shared/lib/deep-links/routes/swap":8816,"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"../../helpers/constants/routes":10205,"@metamask/bridge-controller":1436,"@metamask/utils":4236,react:7855,"react-redux":7818,"react-router-dom":7831},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useBridgeNavigation=void 0;var r=e("react"),s=e("react-redux"),i=e("react-router-dom"),o=e("@metamask/utils"),a=e("@metamask/bridge-controller"),c=e("../../../shared/lib/deep-links/routes/swap"),u=e("../../../shared/lib/deep-links/routes/route"),l=e("../../helpers/constants/routes"),d=e("../../ducks/bridge/selectors"),p=e("../../ducks/bridge/actions");n.useBridgeNavigation=()=>{const e=(0,i.useNavigate)(),t=(0,s.useDispatch)(),{search:n,pathname:m,state:h}=(0,i.useLocation)(),f=(0,r.useMemo)(()=>h??{},[h]),g=(0,s.useSelector)(d.getBridgeState),b=(0,r.useCallback)((t={pathname:m},n=!1)=>{e(t,{state:{...f,bridgeState:null,token:null,stayOnHomePage:n}})},[f,m]),y=(0,r.useCallback)(t=>{const r=new URLSearchParams(n);t.forEach(e=>{r.get(e)&&r.delete(e)}),e({pathname:m,search:r.toString()},{replace:!0,state:f})},[n,m,f]),k=(0,r.useCallback)((n={token:f?.token,search:new URLSearchParams(""),isEntrypoint:!1})=>{const{token:r,search:s,isEntrypoint:i}=n;i&&t((0,p.trackUnifiedSwapBridgeEvent)(a.UnifiedSwapBridgeEventName.PageViewed,{})),e({pathname:`${l.CROSS_CHAIN_SWAP_ROUTE}${l.PREPARE_SWAP_ROUTE}`,search:s.toString()},{state:{...f,token:r},replace:!i})},[f]),w=(0,r.useCallback)(t=>{const{assetReference:n}=(0,o.parseCaipAssetType)(t.assetId),r=(0,a.isNonEvmChainId)(t.chainId),s=r?t.chainId:(0,a.formatChainIdToHex)(t.chainId),i=r?t.assetId:(0,a.formatAddressToCaipReference)(n),c=(0,a.isNativeAddress)(r?n:i);e(c&&!r?`${u.ASSET_ROUTE}/${s}`:`${u.ASSET_ROUTE}/${s}/${encodeURIComponent(i)}`,{state:{...f,bridgeState:g,token:{type:c?a.AssetType.native:a.AssetType.token,assetId:t.assetId,address:i,symbol:t.symbol,name:t.name??t.symbol,chainId:s,image:t.iconUrl,isNative:c,decimals:t.decimals}}})},[e,f]),v=(0,r.useCallback)(()=>{e(`${l.CROSS_CHAIN_SWAP_ROUTE}${l.AWAITING_SIGNATURES_ROUTE}`,{state:f})},[f]),T=(0,r.useCallback)(()=>{e(`${u.DEFAULT_ROUTE}?tab=activity`,{state:{...f,bridgeState:null,token:null,stayOnHomePage:!0},replace:!0})},[f]),S=(0,r.useCallback)(async()=>{t((0,p.resetBridgeController)());new URLSearchParams(n||"").get(c.BridgeQueryParams.IsFromTransactionShield)?b(l.TRANSACTION_SHIELD_ROUTE):b(u.DEFAULT_ROUTE,!0)},[n,b]),C=(0,r.useMemo)(()=>f.token,[f.token]);return{bridgeState:(0,r.useMemo)(()=>f.bridgeState,[f.bridgeState]),token:C,search:n,resetLocationState:b,resetSearchParams:y,navigateToAssetPage:w,navigateToBridgePage:k,navigateToHwSigningPage:v,navigateToActivityPage:T,navigateToDefaultRoute:S}}}}},{package:"$root$",file:"ui/hooks/bridge/useBridgeNavigation.ts"}],[10285,{"../../../shared/lib/bridge-status/utils":8782,"../../ducks/bridge-status/selectors":10169,"../../helpers/constants/routes":10205,"@metamask/bridge-controller":1436,"@metamask/transaction-controller":4006,react:7855,"react-redux":7818,"react-router-dom":7831},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.FINAL_NON_CONFIRMED_STATUSES=void 0,n.serialize=d,n.useBridgeTxHistoryData=function({transactionGroup:e,transaction:t}){const n=(0,o.useNavigate)(),p=e?.initialTransaction??t,m=(0,r.useSelector)(e=>(0,l.selectLocalTxForTxHash)(e,p?.hash)),h=(0,r.useSelector)(e=>(0,l.selectBridgeHistoryItemByHash)(e,p?.hash)),f=(0,r.useSelector)(e=>(0,l.selectBridgeHistoryForOriginalTxMetaId)(e,p?.id)),g=h??f,b=!Boolean(g?.approvalTxId)||g?.approvalTxId!==m?.id&&g?.approvalTxId!==p?.id?g:undefined,y=b?b?.status.status===a.StatusTypes.FAILED:null,k=b||p?.type===i.TransactionType.bridge||p?.type===i.TransactionType.swap,w=(0,s.useCallback)(()=>{const e=p?.hash??p?.id;if(!e)return;const t=d(p);n(`${u.CROSS_CHAIN_SWAP_TX_DETAILS_ROUTE}/${e}`,{state:{transaction:t}})},[n,p]);return{bridgeHistoryItem:g,isBridgeComplete:b?(0,c.isBridgeComplete)(b):null,isBridgeFailed:y,showBridgeTxDetails:k?w:undefined}};var r=e("react-redux"),s=e("react"),i=e("@metamask/transaction-controller"),o=e("react-router-dom"),a=e("@metamask/bridge-controller"),c=e("../../../shared/lib/bridge-status/utils"),u=e("../../helpers/constants/routes"),l=e("../../ducks/bridge-status/selectors");n.FINAL_NON_CONFIRMED_STATUSES=[i.TransactionStatus.failed,i.TransactionStatus.dropped,i.TransactionStatus.rejected];function d(e){if(null===e||e===undefined)return e;if("bigint"==typeof e)return e.toString();if(Array.isArray(e))return e.map(d);if("object"==typeof e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=d(e[n]));return t}return e}}}},{package:"$root$",file:"ui/hooks/bridge/useBridgeTxHistoryData.ts"}],[10286,{"../../../shared/constants/metametrics":8726,"../../../shared/lib/asset-utils":8778,"../../../shared/lib/deep-links/routes/swap":8816,"../../../shared/lib/trace":8924,"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"../../ducks/bridge/utils":10175,"../../pages/bridge/utils/tokens":10653,"./useBridgeNavigation":10284,"@metamask/bridge-controller":1436,"@metamask/utils":4236,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("react"),s=e("react-redux"),i=e("@metamask/bridge-controller"),o=e("@metamask/utils"),a=e("../../../shared/constants/metametrics"),c=e("../../../shared/lib/deep-links/routes/swap"),u=e("../../../shared/lib/trace"),l=e("../../../shared/lib/asset-utils"),d=e("../../ducks/bridge/selectors"),p=e("../../ducks/bridge/actions"),m=e("../../pages/bridge/utils/tokens"),h=e("../../ducks/bridge/utils"),f=e("./useBridgeNavigation");n.default=()=>{const e=(0,s.useDispatch)(),{navigateToBridgePage:t,bridgeState:n}=(0,f.useBridgeNavigation)(),g=(0,s.useSelector)(d.getLastSelectedChainId),b=(0,s.useSelector)(d.getFromChain),y=(0,s.useSelector)(d.getFromChains),k=(0,s.useSelector)(d.getBip44DefaultPairsConfig),w=(0,r.useCallback)(e=>(0,h.isSupportedBridgeChain)(e)&&y.some(t=>(0,i.formatChainIdToCaip)(t.chainId)===(0,i.formatChainIdToCaip)(e)),[y]);return{openBridgeExperience:(0,r.useCallback)((r,s,d)=>{!n&&e((0,p.resetInputFields)()),(0,u.trace)({name:u.TraceName.SwapViewLoaded,startTime:Date.now()}),e((0,p.trackUnifiedSwapBridgeEvent)(i.UnifiedSwapBridgeEventName.ButtonClicked,{location:r,token_symbol_source:s?.symbol??"ETH",token_symbol_destination:""}));let f=null;const y=new URLSearchParams(""),v=s?.chainId&&(0,h.isSupportedBridgeChain)(s.chainId)?(0,l.toAssetId)(s.address,(0,i.formatChainIdToCaip)(s.chainId)):undefined;if(s&&v){const e={...s,assetId:v,name:s.name??s.symbol,chainId:(0,i.formatChainIdToCaip)(s.chainId)};(0,m.validateMinimalAssetObject)(e)?f=e:!n&&w(s.chainId)&&y.set(c.BridgeQueryParams.From,v)}else if(g!==b.chainId){const e=g??b.chainId,{namespace:t}=(0,o.parseCaipChainId)(e),n=Object.keys(k?.[t]?.standard??{})[0]??(0,i.getNativeAssetForChainId)(e)?.assetId;y.set(c.BridgeQueryParams.From,n)}d&&y.set(c.BridgeQueryParams.To,d),r===a.MetaMetricsSwapsEventSource.TransactionShield&&y.set(c.BridgeQueryParams.IsFromTransactionShield,"true"),t({token:f,search:y,isEntrypoint:!0})},[t,g,b?.chainId,w,k,n,e])}}}}},{package:"$root$",file:"ui/hooks/bridge/useBridging.ts"}],[10287,{"../../ducks/bridge/selectors":10174,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useCountdownTimer=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("../../ducks/bridge/selectors");const a=1e3;n.useCountdownTimer=()=>{const e=(0,r.c)(9),{quotesLastFetchedMs:t}=(0,i.useSelector)(o.getBridgeQuotes),n=(0,i.useSelector)(o.getQuoteRefreshRate),[c,u]=(0,s.useState)(n+a),l=(0,s.useRef)(n);let d,p,m,h,f,g;return e[0]!==c?(d=()=>{l.current=c},p=[c],e[0]=c,e[1]=d,e[2]=p):(d=e[1],p=e[2]),(0,s.useEffect)(d,p),e[3]!==t||e[4]!==n?(m=()=>{t&&u(n-(Date.now()-t)+a)},h=[t,n],e[3]=t,e[4]=n,e[5]=m,e[6]=h):(m=e[5],h=e[6]),(0,s.useEffect)(m,h),e[7]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{const e=setInterval(()=>{u(Math.max(0,l.current-a))},a);return()=>clearInterval(e)},g=[],e[7]=f,e[8]=g):(f=e[7],g=e[8]),(0,s.useEffect)(f,g),Math.floor(c/1e3)}}}},{package:"$root$",file:"ui/hooks/bridge/useCountdownTimer.ts"}],[10288,{"../../ducks/bridge/selectors":10174,"@metamask/bridge-controller":1436,"bignumber.js":6427,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useHasSufficientGasForQuoteForMetrics=n.computeHasSufficientGasForQuoteForMetrics=void 0;var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("@metamask/bridge-controller"),o=e("bignumber.js"),a=e("../../ducks/bridge/selectors");const c=({quote:e,nativeBalance:t,fromToken:n,minimumBalanceToKeep:r})=>!t||!e||!n||(0,i.isNativeAddress)(n.assetId)&&new o.BigNumber(t).sub(e.sentAmount.amount).lte(0)?null:!(0,a.isNativeBalanceInsufficientForQuote)(e,t,n,r);n.computeHasSufficientGasForQuoteForMetrics=c;function u(e){return(0,i.selectMinimumBalanceForRentExemptionInSOL)(e.metamask)}n.useHasSufficientGasForQuoteForMetrics=()=>{const e=(0,r.c)(5),t=(0,s.useSelector)(a.getFromNativeBalance),n=(0,s.useSelector)(a.getFromToken),i=(0,s.useSelector)(a.getQuoteRequest),o=(0,s.useSelector)(u);let l;return e[0]!==n||e[1]!==o||e[2]!==t||e[3]!==i?.srcChainId?(l=e=>{const r=i?.srcChainId??e?.quote?.srcChainId,s=(0,a.resolveMinimumBalanceToKeep)(r,o);return c({quote:e,nativeBalance:t,fromToken:n,minimumBalanceToKeep:s})},e[0]=n,e[1]=o,e[2]=t,e[3]=i?.srcChainId,e[4]=l):l=e[4],l}}}},{package:"$root$",file:"ui/hooks/bridge/useHasSufficientGasForQuoteForMetrics.ts"}],[10289,{"../../../shared/constants/bridge":8706,"../../ducks/bridge/asset-selectors":10171,"../../ducks/bridge/selectors":10174,"../../ducks/bridge/utils":10175,"../../pages/bridge/utils/tokens":10653,"../../selectors":11575,"../../selectors/multichain-accounts/account-tree":11579,"../../store/actions":11613,"../useAsync":10410,"@metamask/bridge-controller":1436,lodash:7388,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useInitialBridgeTokens=void 0;var r=e("react"),s=e("react-redux"),i=e("@metamask/bridge-controller"),o=e("lodash"),a=e("../../../shared/constants/bridge"),c=e("../../store/actions"),u=e("../../pages/bridge/utils/tokens"),l=e("../../selectors"),d=e("../useAsync"),p=e("../../ducks/bridge/selectors"),m=e("../../ducks/bridge/asset-selectors"),h=e("../../selectors/multichain-accounts/account-tree"),f=e("../../ducks/bridge/utils");n.useInitialBridgeTokens=e=>{const t=(0,s.useSelector)(l.getUseExternalServices),n=(0,s.useSelector)(p.getFromChains),g=(0,s.useSelector)(p.getFromAccount),b=(0,s.useSelector)(e=>(0,h.getAccountGroupsByAddress)(e,[g?.address]))[0]?.id,y=(0,r.useMemo)(()=>new Set(n.map(e=>e.chainId)),[n]),k=e??y,w=(0,s.useSelector)(e=>(0,m.getBridgeSortedAssets)(e,b)),v=(0,r.useMemo)(()=>(0,o.uniqBy)(w.filter(e=>k.has(e.chainId)),e=>e.assetId?.toLowerCase()),[k,w]),{value:T}=(0,d.useAsyncResult)(async()=>t?await(0,c.getBearerToken)():undefined,[t]),S=(0,r.useMemo)(()=>v.map(({assetId:e})=>e).join("|"),[v]),C=(0,r.useCallback)(async e=>{if(!T||!t)return v;return await(0,u.fetchPopularTokens)({jwt:T,chainIds:Array.from(k),assetsWithBalances:v,clientId:i.BridgeClientId.EXTENSION,clientVersion:"13.37.0-beta.0",signal:e,bridgeApiBaseUrl:a.BRIDGE_API_BASE_URL})},[S,k,T,t]);return{assetsToInclude:v.map(e=>(0,f.toBridgeToken)(e)),fetchTokens:C}}}}},{package:"$root$",file:"ui/hooks/bridge/useInitialBridgeTokens.ts"}],[10290,{"../../ducks/bridge/selectors":10174,"../../selectors/multichain":11582,"../useMultichainSelector":10450,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useIsTxSubmittable=void 0;var r=e("react-redux"),s=e("../../ducks/bridge/selectors"),i=e("../../selectors/multichain"),o=e("../useMultichainSelector");n.useIsTxSubmittable=()=>{const e=(0,r.useSelector)(s.getFromToken),t=(0,r.useSelector)(s.getToToken),n=(0,o.useMultichainSelector)(i.getMultichainCurrentChainId),a=(0,r.useSelector)(s.getFromAmount),{activeQuote:c}=(0,r.useSelector)(s.getBridgeQuotes),{isInsufficientBalance:u,isInsufficientGasBalance:l,isInsufficientNativeReserve:d,isInsufficientGasForQuote:p,isNetworkFeeUnavailable:m,isTxAlertPresent:h,isTxAlertLoading:f}=(0,r.useSelector)(s.getValidationErrors,r.shallowEqual);return Boolean(e&&t&&n&&a&&c&&!u&&!l&&!p&&!d&&!m&&!(f||h))}}}},{package:"$root$",file:"ui/hooks/bridge/useIsTxSubmittable.ts"}],[10291,{"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"../../selectors/multichain":11582,"./useBridgeNavigation":10284,"@metamask/bridge-controller":1436,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useLatestBalance=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("@metamask/bridge-controller"),a=e("../../ducks/bridge/actions"),c=e("../../ducks/bridge/selectors"),u=e("../../selectors/multichain"),l=e("./useBridgeNavigation");n.useLatestBalance=()=>{const e=(0,r.c)(10),t=(0,i.useDispatch)(),n=(0,i.useSelector)(c.getFromToken),d=(0,i.useSelector)(u.getMultichainCurrentChainId),{token:p}=(0,l.useBridgeNavigation)();let m,h;e[0]!==d||e[1]!==t||e[2]!==n.assetId||e[3]!==n.chainId||e[4]!==p?(m=()=>{(0,o.isCrossChain)(n.chainId,d)||p&&p.assetId.toLowerCase()!==n.assetId.toLowerCase()||t((0,a.setEvmBalances)(n.assetId))},e[0]=d,e[1]=t,e[2]=n.assetId,e[3]=n.chainId,e[4]=p,e[5]=m):m=e[5],e[6]!==d||e[7]!==n||e[8]!==p?(h=[n,d,p],e[6]=d,e[7]=n,e[8]=p,e[9]=h):h=e[9],(0,s.useEffect)(m,h)}}}},{package:"$root$",file:"ui/hooks/bridge/useLatestBalance.ts"}],[10292,{"../../ducks/bridge/asset-selectors":10171,"../../ducks/bridge/utils":10175,"../useAsync":10410,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePopularTokens=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("../../ducks/bridge/utils"),a=e("../../ducks/bridge/asset-selectors"),c=e("../useAsync");n.usePopularTokens=e=>{const t=(0,r.c)(13),{fetchTokens:n,assetsToInclude:u,accountGroupId:l}=e;let d;t[0]!==l?(d=e=>(0,a.getBridgeAssetsByAssetId)(e,l),t[0]=l,t[1]=d):d=t[1];const p=(0,i.useSelector)(d),m=(0,s.useRef)(null);let h,f;t[2]!==n?(h=async()=>(m.current?.abort("ChainIds or asset balances changed"),m.current=new AbortController,await n(m.current?.signal)),f=[n],t[2]=n,t[3]=h,t[4]=f):(h=t[3],f=t[4]);const{value:g,pending:b}=(0,c.useAsyncResult)(h,f);let y;t[5]!==p||t[6]!==g?(y=g?.map(e=>(0,o.toBridgeToken)(e,p?.[e.assetId.toLowerCase()])),t[5]=p,t[6]=g,t[7]=y):y=t[7];const k=y;let w,v;t[8]===Symbol.for("react.memo_cache_sentinel")?(w=()=>()=>{m.current?.abort("Component unmounted")},v=[],t[8]=w,t[9]=v):(w=t[8],v=t[9]),(0,s.useEffect)(w,v);const T=k&&k.length>0?k:u,S=b||0===k?.length;let C;return t[10]!==T||t[11]!==S?(C={popularTokensList:T,isLoading:S},t[10]=T,t[11]=S,t[12]=C):C=t[12],C}}}},{package:"$root$",file:"ui/hooks/bridge/usePopularTokens.ts"}],[10293,{"../../../shared/constants/app":8704,"../../../shared/lib/environment-type":8829,"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"./useBridgeNavigation":10284,"@metamask/bridge-controller":1436,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePrefillFromBridgeState=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("@metamask/bridge-controller"),a=e("../../../shared/constants/app"),c=e("../../../shared/lib/environment-type"),u=e("../../ducks/bridge/actions"),l=e("../../ducks/bridge/selectors"),d=e("./useBridgeNavigation");n.usePrefillFromBridgeState=()=>{const e=(0,r.c)(14),t=(0,i.useDispatch)(),{activeQuote:n}=(0,i.useSelector)(l.getBridgeQuotes),p=(0,i.useSelector)(l.getFromChains),{resetLocationState:m,token:h,bridgeState:f}=(0,d.useBridgeNavigation)(),g=f||h;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,c.getEnvironmentType)(),e[0]=b):b=e[0];const y=b===a.ENVIRONMENT_TYPE_POPUP,k=!f&&n&&y;let w;e[1]!==t?(w=()=>{t((0,u.resetBridgeController)()),t((0,u.resetInputFields)())},e[1]=t,e[2]=w):w=e[2];const v=w;let T,S;e[3]!==n||e[4]!==f||e[5]!==t||e[6]!==p||e[7]!==v||e[8]!==m||e[9]!==g||e[10]!==k||e[11]!==h?(T=()=>{if(g){if(f&&t((0,u.rehydrateBridgeStore)({bridgeState:f})),h){const e=!f?.isSrcAssetPickerOpen&&!f?.isDestAssetPickerOpen,n=p.some(e=>(0,o.formatChainIdToCaip)(e.chainId)===(0,o.formatChainIdToCaip)(h.chainId)),r=f?.isSrcAssetPickerOpen||e&&n,s=f?.isDestAssetPickerOpen;r?t((0,u.setFromToken)(h)):s&&t((0,u.setToToken)(h))}m()}else k&&t((0,u.restoreQuoteRequestFromState)(n));return window.addEventListener("beforeunload",v),()=>{window.removeEventListener("beforeunload",v)}},e[3]=n,e[4]=f,e[5]=t,e[6]=p,e[7]=v,e[8]=m,e[9]=g,e[10]=k,e[11]=h,e[12]=T):T=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(S=[],e[13]=S):S=e[13],(0,s.useEffect)(T,S)}}}},{package:"$root$",file:"ui/hooks/bridge/usePrefillFromBridgeState.ts"}],[10294,{"../../../shared/lib/asset-utils":8778,"../../../shared/lib/deep-links/routes/swap":8816,"../../../shared/lib/transactions-controller-utils":8928,"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"../../ducks/bridge/utils":10175,"./useBridgeNavigation":10284,"@metamask/utils":4236,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePrefillFromSearchQuery=void 0;var r=e("react"),s=e("react-redux"),i=e("@metamask/utils"),o=e("../../../shared/lib/asset-utils"),a=e("../../../shared/lib/deep-links/routes/swap"),c=e("../../../shared/lib/transactions-controller-utils"),u=e("../../ducks/bridge/actions"),l=e("../../ducks/bridge/selectors"),d=e("../../ducks/bridge/utils"),p=e("./useBridgeNavigation");const m=e=>{if(!e)return null;try{const t=i.CaipAssetTypeStruct.create(e),{chainId:n,assetReference:r}=(0,i.parseCaipAssetType)(t);return{chainId:n,assetReference:r,assetId:t}}catch{return null}};n.usePrefillFromSearchQuery=()=>{const e=(0,s.useDispatch)(),t=(0,s.useSelector)(l.getFromToken),n=(0,r.useRef)(new AbortController),{resetSearchParams:i,search:h}=(0,p.useBridgeNavigation)(),f=(0,r.useMemo)(()=>new URLSearchParams(h),[h]),[g,b]=(0,r.useState)(null),[y,k]=(0,r.useState)(null),[w,v]=(0,r.useState)(null);(0,r.useEffect)(()=>()=>{n.current.abort()},[]);const[T,S]=(0,r.useState)(null);(0,r.useEffect)(()=>{const e=m(f.get(a.BridgeQueryParams.From)),t=m(f.get(a.BridgeQueryParams.To)),r=f.get(a.BridgeQueryParams.Amount);(e||t||r)&&(k(t),b(e),r&&v(r),i([a.BridgeQueryParams.From,a.BridgeQueryParams.To,a.BridgeQueryParams.Amount]),(t?.assetId||e?.assetId)&&(n.current.abort(),n.current=new AbortController,(async(e,t,n)=>{const r=[];if(t&&r.push(t),n&&r.push(n),0===r.length)return null;try{return await(0,o.fetchAssetMetadataForAssetIds)(r,e)}catch{return null}})(n.current.signal,e?.assetId,t?.assetId).then(e=>{S(e)})))},[f]);const C=(0,r.useCallback)(async t=>{e((0,u.setToToken)(t)),k(null)},[]);(0,r.useEffect)(()=>{if(!g||!T)return;const t=T?.[g.assetId]??T?.[g.assetId.toLowerCase()];t&&e((0,u.setFromToken)(t))},[T,g]),(0,r.useEffect)(()=>{if(!y)return;if(!(0,d.isSupportedBridgeChain)(y.chainId))return;const e=T?.[y.assetId]??T?.[y.assetId.toLowerCase()];e&&C(e)},[y,T]),(0,r.useEffect)(()=>{g&&t&&T&&t.assetId?.toLowerCase()===g.assetId.toLowerCase()&&(b(null),w&&(e((0,u.setFromTokenInputValue)((0,c.calcTokenAmount)(w,t.decimals).toFixed(t.decimals))),v(null)))},[w,g,T,t])}}}},{package:"$root$",file:"ui/hooks/bridge/usePrefillFromSearchQuery.ts"}],[10295,{"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"./useHasSufficientGasForQuoteForMetrics":10288,"./useIsTxSubmittable":10290,"@metamask/bridge-controller":1436,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useQuoteFetchEvents=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("@metamask/bridge-controller"),a=e("../../ducks/bridge/selectors"),c=e("../../ducks/bridge/actions"),u=e("./useIsTxSubmittable"),l=e("./useHasSufficientGasForQuoteForMetrics");function d(e){return(0,a.getWarningLabels)(e,Date.now())}n.useQuoteFetchEvents=()=>{const e=(0,r.c)(16),t=(0,i.useDispatch)(),{isLoading:n,quotesRefreshCount:p,quoteFetchError:m,activeQuote:h,recommendedQuote:f}=(0,i.useSelector)(a.getBridgeQuotes),g=(0,u.useIsTxSubmittable)(),b=(0,i.useSelector)(d,i.shallowEqual),y=(0,i.useSelector)(a.getFromTokenBalanceInUsd),k=(0,l.useHasSufficientGasForQuoteForMetrics)(),w=h??null;let v;e[0]!==k||e[1]!==w?(v=k(w),e[0]=k,e[1]=w,e[2]=v):v=e[2];const T=v;let S,C;e[3]!==h||e[4]!==t||e[5]!==y||e[6]!==T||e[7]!==n||e[8]!==g||e[9]!==m||e[10]!==p||e[11]!==f||e[12]!==b?(S=()=>{!n&&p>0&&!m&&t((0,c.trackUnifiedSwapBridgeEvent)(o.UnifiedSwapBridgeEventName.QuotesReceived,(0,o.getQuotesReceivedProperties)(h??null,b,g,f,y,T)))},e[3]=h,e[4]=t,e[5]=y,e[6]=T,e[7]=n,e[8]=g,e[9]=m,e[10]=p,e[11]=f,e[12]=b,e[13]=S):S=e[13],e[14]!==p?(C=[p],e[14]=p,e[15]=C):C=e[15],(0,s.useEffect)(S,C)}}}},{package:"$root$",file:"ui/hooks/bridge/useQuoteFetchEvents.ts"}],[10296,{"../../ducks/bridge/selectors":10174,"../../ducks/rewards/selectors":10193,"../../helpers/utils/rewards-utils":10259,"../../selectors/multichain":11582,"../../selectors/multichain-accounts/account-tree":11579,"../../store/actions":11613,"../rewards/usePrimaryWalletGroupAccounts":10384,"../useMultichainSelector":10450,"../usePrevious":10463,"@metamask/bridge-controller":1436,"bignumber.js":6427,lodash:7388,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useRewardsWithQuote=n.useRewards=n.getUsdPricePerToken=void 0;var r=e("react"),s=e("react-redux"),i=e("bignumber.js"),o=e("@metamask/bridge-controller"),a=e("lodash"),c=e("../../ducks/bridge/selectors"),u=e("../../selectors/multichain"),l=e("../usePrevious"),d=e("../useMultichainSelector"),p=(e("../../store/actions"),e("../../helpers/utils/rewards-utils"),e("../../selectors/multichain-accounts/account-tree")),m=e("../../ducks/rewards/selectors"),h=e("../rewards/usePrimaryWalletGroupAccounts");n.getUsdPricePerToken=(e,t,n)=>{try{const r=new i.BigNumber(e),s=new i.BigNumber(t).div(new i.BigNumber(10).pow(n));return r.isZero()||s.isZero()?undefined:r.dividedBy(s).toString()}catch(e){return console.error(e,"useRewards: Error calculating USD price per token"),undefined}};const f=({quote:e,fromAddress:t,fromAddressAccount:n,chainId:i})=>{const o=(0,s.useDispatch)(),[c,u]=(0,r.useState)(!1),[d,p]=(0,r.useState)(null),[f,g]=(0,r.useState)(!1),[b,y]=(0,r.useState)(!1),k=(0,l.usePrevious)(e?.requestId),[w,v]=(0,r.useState)(null),T=(0,s.useSelector)(m.selectRewardsEnabled),S=(0,s.useSelector)(m.selectRewardsAccountLinkedTimestamp),{accounts:C}=(0,h.usePrimaryWalletGroupAccounts)(),P=(0,r.useRef)(new Map),[_,x]=(0,r.useState)(null),I=(0,r.useCallback)((0,a.debounce)(async(e,t)=>{p(null),g(!1),u(!1),y(!1)},750),[o]),E=(0,r.useCallback)(async e=>(p(null),g(!1),v(null),u(!1),void y(!1)),[t,i,T,o,n,I]);return(0,r.useEffect)(()=>{k!==e?.requestId&&E(e)},[E,e?.requestId,e,k]),(0,r.useEffect)(()=>{if(t&&null!==S)P.current.set(t,S),x(S);else if(t){const e=P.current.get(t);x(e??null)}else x(null)},[S,t]),(0,r.useEffect)(()=>{null!==_&&!1===w&&E(e)},[_,w,E,e]),{shouldShowRewardsRow:f,isLoading:c,estimatedPoints:d,hasError:b,accountOptedIn:w,rewardsAccountScope:e&&f?n:null}};n.useRewardsWithQuote=f;n.useRewards=({activeQuote:e})=>{const t=(0,s.useSelector)(c.getFromToken),n=(0,s.useSelector)(c.getToToken),r=(0,s.useSelector)(c.getQuoteRequest),i=(0,d.useMultichainSelector)(u.getMultichainCurrentChainId),a=i?(0,o.formatChainIdToCaip)(i.toString()):null,l=(0,s.useSelector)(e=>a?(0,p.getInternalAccountBySelectedAccountGroupAndCaip)(e,a):null);return f({quote:t&&n&&r?.srcTokenAmount&&l?.address?e:null,fromAddress:l?.address,fromAddressAccount:l,chainId:i?.toString()})}}}},{package:"$root$",file:"ui/hooks/bridge/useRewards.ts"}],[10297,{"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"../../pages/bridge/utils/slippage-service":10651,"../../selectors/rwa/feature-flags":11597,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useSmartSlippage=function(){const e=(0,r.c)(6),t=(0,i.useDispatch)(),n=(0,i.useSelector)(c.getFromToken),l=(0,i.useSelector)(c.getToToken),d=(0,i.useSelector)(u.getIsRWATokensEnabled);let p,m;e[0]!==t||e[1]!==n||e[2]!==d||e[3]!==l?(p=()=>{const e={fromToken:n,toToken:l,isRWAEnabled:d},r=(0,o.calculateSlippage)(e);t((0,a.setSlippage)(r))},m=[n,l,d,t],e[0]=t,e[1]=n,e[2]=d,e[3]=l,e[4]=p,e[5]=m):(p=e[4],m=e[5]);(0,s.useEffect)(p,m)};var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("../../pages/bridge/utils/slippage-service"),a=e("../../ducks/bridge/actions"),c=e("../../ducks/bridge/selectors"),u=e("../../selectors/rwa/feature-flags")}}},{package:"$root$",file:"ui/hooks/bridge/useSmartSlippage.ts"}],[10298,{"../../../shared/constants/bridge":8706,"../../ducks/bridge/asset-selectors":10171,"../../ducks/bridge/utils":10175,"../../pages/bridge/utils/tokens":10653,"../../store/actions":11613,"../useAsync":10410,"@metamask/bridge-controller":1436,lodash:7388,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useTokenSearchResults=void 0;var r=e("react"),s=e("@metamask/bridge-controller"),i=e("react-redux"),o=e("lodash"),a=e("../../../shared/constants/bridge"),c=e("../../ducks/bridge/utils"),u=e("../../ducks/bridge/asset-selectors"),l=e("../../pages/bridge/utils/tokens"),d=e("../../store/actions"),p=e("../useAsync");n.useTokenSearchResults=({searchQuery:e,accountGroupId:t,chainIds:n,assetsToInclude:m})=>{const h=(0,i.useSelector)(e=>(0,u.getBridgeAssetsByAssetId)(e,t)),f=(0,r.useRef)(new AbortController),[g,b]=(0,r.useState)(!1),[y,k]=(0,r.useState)([]),[w,v]=(0,r.useState)(!1),[T,S]=(0,r.useState)(undefined),{value:C}=(0,p.useAsyncResult)(async()=>await(0,d.getBearerToken)(),[]),P=(0,r.useCallback)((e,t,r)=>{b(!0),f.current.abort("Asset balances changed"),f.current=new AbortController,(0,l.fetchTokensBySearchQuery)({chainIds:Array.from(n),assetsWithBalances:t,query:e,jwt:C,clientId:s.BridgeClientId.EXTENSION,clientVersion:"13.37.0-beta.0",signal:f.current?.signal,bridgeApiBaseUrl:a.BRIDGE_API_BASE_URL,after:r})?.then(({endCursor:e,tokens:t,hasNextPage:n})=>{v(n),k(e=>[...r||0===t.length?e:[],...t.map(e=>(0,c.toBridgeToken)(e,h?.[e.assetId.toLowerCase()]))]),S(e)}).finally(()=>{b(!1)})},[h,n,f,C]),_=(0,r.useCallback)((0,o.debounce)((e,t)=>P(e,t),300),[P]),x=(0,r.useMemo)(()=>m.filter(t=>t.symbol.toLowerCase().includes(e.toLowerCase())||t.name?.toLowerCase().includes(e.toLowerCase())||t.assetId?.toLowerCase().includes(e.toLowerCase())),[e,m]),I=(0,r.useMemo)(()=>x.map(({assetId:e})=>e).join("|"),[x]);return(0,r.useEffect)(()=>{C&&(f.current.abort("Search query changed"),k([]),S(undefined),v(!1),e.length>0&&(b(!0),k(x),_(e,x)))},[e,I,C]),(0,r.useEffect)(()=>{const e=_;return()=>{f.current.abort("Page unmounted"),e.cancel()}},[]),{searchResults:y,isSearchResultsLoading:g,onFetchMoreResults:e=>P(e,x,T),hasMoreResults:w}}}}},{package:"$root$",file:"ui/hooks/bridge/useTokenSearchResults.ts"}],[10299,{"../../../shared/constants/bridge":8706,"../../../shared/constants/multichain/networks":8729,"../../../shared/constants/network":8730,"../../../shared/constants/time":8750,"../../../shared/constants/transaction":8752,"../../../shared/lib/asset-utils":8778,"../../../shared/lib/fetch-with-cache":8835,"../../ducks/bridge/selectors":10174,"../../ducks/bridge/utils":10175,"../../pages/swaps/swaps.util":11534,"../../store/actions":11613,"../useAsync":10410,"../useMultichainBalances":10449,"@metamask/bridge-controller":1436,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useTokensWithFiltering=void 0;var r,s=e("react"),i=e("react-redux"),o=e("@metamask/bridge-controller"),a=e("../../../shared/constants/transaction"),c=e("../../../shared/constants/network"),u=e("../useMultichainBalances"),l=e("../useAsync"),d=e("../../pages/swaps/swaps.util"),p=e("../../../shared/constants/time"),m=e("../../ducks/bridge/selectors"),h=(r=e("../../../shared/lib/fetch-with-cache"))&&r.__esModule?r:{default:r},f=e("../../../shared/constants/bridge"),g=e("../../ducks/bridge/utils"),b=e("../../store/actions"),y=e("../../../shared/constants/multichain/networks"),k=e("../../../shared/lib/asset-utils");const w=(e,t)=>{if(!e||!t)return undefined;const n={...t,chainId:(0,o.isNonEvmChainId)(e)?(0,o.formatChainIdToCaip)(e):(0,o.formatChainIdToHex)(e),assetId:"assetId"in t?t.assetId:(0,k.toAssetId)(t.address,e)};if((0,o.isNativeAddress)(t.address)){const r=(0,o.isNonEvmChainId)(e)?y.MULTICHAIN_TOKEN_IMAGE_MAP[n.chainId]:c.CHAIN_ID_TOKEN_IMAGE_MAP[n.chainId];return{...n,type:a.AssetType.native,address:"",image:r??(t.iconUrl||("icon"in t?t.icon:"")||""),balance:"0",string:"0"}}return{...n,type:a.AssetType.token,image:t.iconUrl??("icon"in t?t.icon:"")??"",balance:"",string:undefined}};n.useTokensWithFiltering=(e,t,n)=>{const r=(0,i.useSelector)(t=>(0,m.getTopAssetsFromFeatureFlags)(t,e)),{assetsWithBalance:v}=(0,u.useMultichainBalances)(n),T=(0,i.useSelector)(e=>e.metamask.tokensChainsCache),S=(0,s.useMemo)(()=>{if(!e)return undefined;if((0,o.isBitcoinChainId)(e)){const t=(0,o.getNativeAssetForChainId)(e);if(t){const e=t.address??"";return{[e]:t}}return undefined}if((0,o.isSolanaChainId)(e))return undefined;const t=(0,o.formatChainIdToHex)(e);return t?T[t]?.data:undefined},[e,T]),C=Boolean(S),{value:P}=(0,l.useAsyncResult)(async()=>await(0,b.getBearerToken)(),[]),{value:_,pending:x}=(0,l.useAsyncResult)(async()=>C||!e?{}:await(0,o.fetchBridgeTokens)(e,o.BridgeClientId.EXTENSION,P,async(e,t)=>{const{headers:n,...r}=t??{};return await(0,h.default)({url:e,...r,fetchOptions:{method:"GET",headers:n},cacheOptions:{cacheRefreshTime:10*p.MINUTE},functionName:"fetchBridgeTokens"})},f.BRIDGE_API_BASE_URL,"13.37.0-beta.0"),[e,C,P]),I=(0,s.useMemo)(()=>S??_,[S,_]),{value:E,pending:M}=(0,l.useAsyncResult)(async()=>e?r?r.map(e=>({address:e})):await(0,d.fetchTopAssetsList)(e):[],[e,r]);return{filteredTokenListGenerator:(0,s.useCallback)(n=>function*(){const r=(e,r,s)=>{const i=e=>e&&(0,o.isNativeAddress)(e)?"":e;return n(e,r,s)&&(!t||!s||!(t.symbol===e&&((0,o.isSolanaChainId)(s)?i(t.address)===i(r):t.address?.toLowerCase()===r?.toLowerCase())&&t.chainId===(0,o.formatChainIdToCaip)(s)))};if(e&&E&&I&&0!==Object.keys(I).length){for(const e of v)if(!(0,k.isTronSpecialAsset)(e.assetId)&&r(e.symbol,e.address,e.chainId))if((0,o.isNativeAddress)(e.address)||e.isNative){const t=(0,g.getNativeAssetForChainIdSafe)(e.chainId);let n;try{n=(0,k.getAssetImageUrl)(e.address,(0,o.formatChainIdToCaip)(e.chainId))}catch(e){n=undefined}yield{symbol:e.symbol,chainId:e.chainId,tokenFiatAmount:e.tokenFiatAmount,decimals:e.decimals,address:"",type:a.AssetType.native,balance:e.balance??"0",string:e.string??undefined,image:c.CHAIN_ID_TOKEN_IMAGE_MAP[e.chainId]??y.MULTICHAIN_TOKEN_IMAGE_MAP[e.chainId]??(t?.icon||t?.iconUrl||n),accountType:e.accountType}}else{const t=(0,k.toAssetId)(e.address,(0,o.formatChainIdToCaip)(e.chainId));yield{...e,symbol:e.symbol,chainId:e.chainId,tokenFiatAmount:e.tokenFiatAmount,decimals:e.decimals,address:e.address,type:a.AssetType.token,balance:e.balance??"0",string:e.string??undefined,image:(e.image||e.address&&I?.[e.address.toLowerCase()]?.iconUrl)??(t?(0,k.getAssetImageUrl)(t,e.chainId):undefined)??""}}for(const t of E){const n=I?.[t.address]??I?.[t.address.toLowerCase()],s=w(e,n);s&&!(0,k.isTronSpecialAsset)(s.assetId)&&r(s.symbol,s.address??undefined,e)&&(yield s)}for(const t of Object.values(I)){const n=w(e,t);n&&-1===n.symbol.indexOf("$")&&!(0,k.isTronSpecialAsset)(n.assetId)&&r(n.symbol,n.address??undefined,e)&&(yield n)}}}(),[v,E,e,I,t]),isLoading:x||M}}}}},{package:"$root$",file:"ui/hooks/bridge/useTokensWithFiltering.ts"}],[10300,{"../../../shared/constants/multichain/networks":8729,"../../ducks/bridge/actions":10170,"../../ducks/bridge/selectors":10174,"@metamask/bridge-controller":1436,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useTxAlerts=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("@metamask/bridge-controller"),a=e("../../../shared/constants/multichain/networks"),c=e("../../ducks/bridge/selectors"),u=e("../../ducks/bridge/actions");n.useTxAlerts=()=>{const e=(0,r.c)(14),t=(0,i.useDispatch)(),n=(0,i.useSelector)(c.getFromChain),{activeQuote:l}=(0,i.useSelector)(c.getBridgeQuotes);let d;e[0]!==l?(d=l??{},e[0]=l,e[1]=d):d=e[1];const{trade:p}=d,m=(0,i.useSelector)(c.getFromAccount);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=new AbortController,e[2]=h):h=e[2];const f=(0,s.useRef)(h);let g,b,y;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=()=>()=>{f.current?.abort(),f.current=null},b=[],e[3]=g,e[4]=b):(g=e[3],b=e[4]),(0,s.useEffect)(g,b),e[5]!==m||e[6]!==t||e[7]!==n||e[8]!==p?(y=()=>{f.current?.abort(),p&&"string"==typeof p&&n?.chainId&&(0,o.isSolanaChainId)(n.chainId)&&m?.address?(f.current=new AbortController,t((0,u.setTxAlerts)({signal:f.current.signal,chainId:a.MultichainNetworks.SOLANA,trade:p,accountAddress:m.address}))):t((0,u.setTxAlerts)(null))},e[5]=m,e[6]=t,e[7]=n,e[8]=p,e[9]=y):y=e[9];const k=n?.chainId,w=m?.address;let v;e[10]!==k||e[11]!==w||e[12]!==p?(v=[p,k,w],e[10]=k,e[11]=w,e[12]=p,e[13]=v):v=e[13],(0,s.useEffect)(y,v)}}}},{package:"$root$",file:"ui/hooks/bridge/useTxAlerts.ts"}],[10301,{"../../store/actions":11613,"../../store/background-connection":11615},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deFiStartPolling=async function(){const e=await(0,s.submitRequestToBackground)("deFiStartPolling",[null]);return await(0,r.addPollingTokenToAppState)(e),e},n.deFiStopPolling=async function(e){await(0,s.submitRequestToBackground)("deFiStopPolling",[e]),await(0,r.removePollingTokenFromAppState)(e)};var r=e("../../store/actions"),s=e("../../store/background-connection")}}},{package:"$root$",file:"ui/hooks/defi/defiPollingActions.ts"}],[10302,{"../../ducks/metamask/base-selectors":10184,"../../ducks/metamask/metamask":10185,"../useMultiPolling":10446,"./defiPollingActions":10301,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,s=e("react-compiler-runtime"),i=e("react-redux"),o=e("../../ducks/metamask/metamask"),a=e("../../ducks/metamask/base-selectors"),c=(r=e("../useMultiPolling"))&&r.__esModule?r:{default:r},u=e("./defiPollingActions");n.default=()=>{const e=(0,s.c)(3),t=(0,i.useSelector)(o.getCompletedOnboarding),n=(0,i.useSelector)(a.getIsUnlocked),r=t&&n;let l,d;return e[0]!==r?(l={startPolling:u.deFiStartPolling,stopPollingByPollingToken:u.deFiStopPolling,input:r?[null]:[]},e[0]=r,e[1]=l):l=e[1],(0,c.default)(l),e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2],d}}}},{package:"$root$",file:"ui/hooks/defi/useDeFiPolling.ts"}],[10303,{"../../../shared/lib/gator-permissions/feature-flags":8842,"../../../shared/lib/selectors/remote-feature-flags":8897,"../../../shared/lib/sentry":8901,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useEnabledAdvancedPermissions=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("../../../shared/lib/gator-permissions/feature-flags"),a=e("../../../shared/lib/selectors/remote-feature-flags"),c=e("../../../shared/lib/sentry");const u=e=>(0,a.getRemoteFeatureFlags)(e)[o.ENABLED_ADVANCED_PERMISSIONS_FEATURE_FLAG];n.useEnabledAdvancedPermissions=()=>{const e=(0,r.c)(5),t=(0,i.useSelector)(u),n=(0,s.useRef)(!1);let a,l,d;return e[0]!==t?(a=()=>{var e;n.current||(e=t,e===undefined||"object"==typeof e&&null!==e&&Array.isArray(e.permissions))||(n.current=!0,(0,c.captureMessage)("Invalid enabledAdvancedPermissions remote feature flag",{level:"warning",extra:{featureFlag:o.ENABLED_ADVANCED_PERMISSIONS_FEATURE_FLAG}}))},l=[t],e[0]=t,e[1]=a,e[2]=l):(a=e[1],l=e[2]),(0,s.useEffect)(a,l),e[3]!==t?(d=(0,o.getEnabledAdvancedPermissions)({remoteFeatureFlags:{[o.ENABLED_ADVANCED_PERMISSIONS_FEATURE_FLAG]:t}}),e[3]=t,e[4]=d):d=e[4],d}}}},{package:"$root$",file:"ui/hooks/gator-permissions/useEnabledAdvancedPermissions.ts"}],[10304,{"../../pages/confirmations/hooks/useConfirmationNavigation":11129,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useGatorPermissionRedirect=function(e){const t=(0,r.c)(16);let n;t[0]!==e?(n=e===undefined?{}:e,t[0]=e,t[1]=n):n=t[1];const{onRedirect:o}=n,[a,c]=(0,s.useState)(),{confirmations:u,navigateToId:l}=(0,i.useConfirmationNavigation)();let d;if(t[2]!==u||t[3]!==a){let e;t[5]!==a?(e=e=>e.id===a,t[5]=a,t[6]=e):e=t[6],d=u.some(e),t[2]=u,t[3]=a,t[4]=d}else d=t[4];const p=d;let m,h,f;t[7]!==p||t[8]!==l||t[9]!==o||t[10]!==a?(m=()=>{p&&(l(a),o?.())},h=[p,l,a,o],t[7]=p,t[8]=l,t[9]=o,t[10]=a,t[11]=m,t[12]=h):(m=t[11],h=t[12]);(0,s.useEffect)(m,h),t[13]!==p||t[14]!==a?(f={transactionId:a,setTransactionId:c,isRedirectPending:p},t[13]=p,t[14]=a,t[15]=f):f=t[15];return f};var r=e("react-compiler-runtime"),s=e("react"),i=e("../../pages/confirmations/hooks/useConfirmationNavigation")}}},{package:"$root$",file:"ui/hooks/gator-permissions/useGatorPermissionRedirect.ts"}],[10305,{"../../../shared/lib/gator-permissions/gator-permissions-utils":8844,"../../../shared/lib/selectors/networks":8895,"../../selectors/selectors":11598,"../../store/actions":11613,"../useAsync":10410,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useGatorPermissionTokenInfo=function(e,t,n){const l=(0,r.c)(30),d=(0,s.useSelector)(i.selectERC20TokensByChain),p=(0,s.useSelector)(i.getAllTokens),m=(0,s.useSelector)(i.getUseExternalServices),h=(0,s.useSelector)(o.getAllNetworkConfigurationsByCaipChainId);let f;l[0]!==n?(f=n?.includes("native-token")??!1,l[0]=n,l[1]=f):f=l[1];const g=f;let b;e:{if(!g||!t){b=null;break e}let e;l[2]!==t||l[3]!==h?(e=(0,c.resolveNativeTokenInfo)(t,h),l[2]=t,l[3]=h,l[4]=e):e=l[4],b=e}const y=b;let k;e:{if(g||!e||!t){k=null;break e}let n;l[5]!==p||l[6]!==t||l[7]!==d||l[8]!==e?(n=(0,c.lookupCachedOrImportedTokenInfo)(e,t,d,p),l[5]=p,l[6]=t,l[7]=d,l[8]=e,l[9]=n):n=l[9],k=n}const w=k,v=Boolean(!g&&!w&&e&&t);let T,S;l[10]!==m||l[11]!==t||l[12]!==v||l[13]!==e?(T=async()=>v&&e&&t?await(0,c.getGatorErc20TokenInfo)(e,t,Boolean(m),a.getTokenStandardAndDetailsByChain):null,S=[v,e,t,m],l[10]=m,l[11]=t,l[12]=v,l[13]=e,l[14]=T,l[15]=S):(T=l[14],S=l[15]);const C=(0,u.useAsyncResult)(T,S),P=C.value??null,_=C.error??null,x=v&&C.pending;let I;e:{if(y){let e;l[16]!==y?(e={tokenInfo:y,loading:!1},l[16]=y,l[17]=e):e=l[17],I=e;break e}if(w){let e;l[18]!==w?(e={tokenInfo:w,loading:!1},l[18]=w,l[19]=e):e=l[19],I=e;break e}if(P){let e;l[20]!==P?(e={tokenInfo:P,loading:!1},l[20]=P,l[21]=e):e=l[21],I=e;break e}const e=t||"0x0";let n,r;l[22]!==e?(n={symbol:"Unknown Token",chainId:e},l[22]=e,l[23]=n):n=l[23],l[24]!==x||l[25]!==n?(r={tokenInfo:n,loading:x},l[24]=x,l[25]=n,l[26]=r):r=l[26],I=r}const E=I;let M;l[27]!==_||l[28]!==E?(M={...E,error:_},l[27]=_,l[28]=E,l[29]=M):M=l[29];return M};var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../../selectors/selectors"),o=e("../../../shared/lib/selectors/networks"),a=e("../../store/actions"),c=e("../../../shared/lib/gator-permissions/gator-permissions-utils"),u=e("../useAsync")}}},{package:"$root$",file:"ui/hooks/gator-permissions/useGatorPermissionTokenInfo.ts"}],[10306,{"../../store/controller-actions/gator-permissions-controller":11616,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useGatorPermissions=function(e={}){const{refreshInBackground:t=!0}=e,n=(0,s.useDispatch)(),o=(0,s.useSelector)(e=>e.metamask.grantedPermissions?.length>0),[a,c]=(0,r.useState)(!o),u=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{let e=!1;return o&&!t?c(!1):u.current||(async()=>{try{o||c(!0),await(0,i.fetchAndUpdateGatorPermissions)()}catch(e){}finally{e||c(!1)}})().then(()=>{u.current=!0}).catch(()=>{}),()=>{e=!0}},[n,o,t]),{loading:a}};var r=e("react"),s=e("react-redux"),i=e("../../store/controller-actions/gator-permissions-controller")}}},{package:"$root$",file:"ui/hooks/gator-permissions/useGatorPermissions.ts"}],[10307,{"../../../shared/lib/delegation/delegation":8822,"../../selectors":11575,"../../store/actions":11613,"../../store/controller-actions/gator-permissions-controller":11616,"./useGatorPermissionRedirect":10304,"./utils":10309,"@metamask/transaction-controller":4006,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useRevokeGatorPermissions=function({chainId:e,onRedirect:t}){const{setTransactionId:n}=(0,l.useGatorPermissionRedirect)({onRedirect:t}),p=(0,s.useStore)(),m=(0,r.useCallback)(e=>{if(Array.isArray(e)){if(0===e.length)throw new Error("No gator permissions provided");for(const t of e)m(t)}else if(!e)throw new Error("No gator permission provided")},[]),h=(0,r.useCallback)(t=>{if(t.permissionResponse.chainId!==e)throw new Error("Chain ID does not match")},[e]),f=(0,r.useCallback)(e=>{const{permissionResponse:t}=e,n=(0,o.getInternalAccountByAddress)(p.getState(),t.from);if(!n)throw new Error("Internal account not found for delegator of permission");return{permissionContext:t.context,delegationManagerAddress:t.delegationManager,accountAddress:n.address}},[p]),g=(0,r.useCallback)(async e=>{const t=e.permissionResponse.chainId;let n;try{n=await(0,a.findNetworkClientIdByChainId)(t)}catch(e){throw new Error(`Failed to find network client for chain ${t}`,{cause:e})}const{permissionContext:r,delegationManagerAddress:s,accountAddress:o}=f(e),l=(0,d.extractDelegationFromGatorPermissionContext)(r),p=(0,c.getDelegationHashOffchain)(l);if(await(0,u.checkDelegationDisabled)(s,p,n))return await(0,u.submitDirectRevocation)({permissionContext:r}),null;const m=(0,c.encodeDisableDelegation)({delegation:l}),h=await(0,a.addTransaction)({from:o,to:s,data:m,value:"0x0"},{networkClientId:n,type:i.TransactionType.contractInteraction});if(!h)throw new Error("No transaction meta found");if(!h.id)throw new Error("No transaction id found");return await(0,u.addPendingRevocation)({txId:h.id,permissionContext:r}),h},[f]),b=(0,r.useCallback)(async e=>{m(e),h(e);const t=await g(e);return n(t?.id),t},[g,h,m,n]),y=(0,r.useCallback)(async e=>{m(e);for(const t of e)h(t);const t=[];for(const n of e){const e=await g(n);t.push(e)}const r=t.filter(e=>null!==e);return n(r[0]?.id),r},[g,h,m,n]);return{revokeGatorPermission:b,revokeGatorPermissionBatch:y}};var r=e("react"),s=e("react-redux"),i=e("@metamask/transaction-controller"),o=e("../../selectors"),a=e("../../store/actions"),c=e("../../../shared/lib/delegation/delegation"),u=e("../../store/controller-actions/gator-permissions-controller"),l=e("./useGatorPermissionRedirect"),d=e("./utils")}}},{package:"$root$",file:"ui/hooks/gator-permissions/useRevokeGatorPermissions.ts"}],[10308,{"../../../shared/lib/delegation/delegation":8822,"../../selectors":11575,"../../store/actions":11613,"../../store/controller-actions/gator-permissions-controller":11616,"./useGatorPermissionRedirect":10304,"./utils":10309,"@metamask/transaction-controller":4006,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useRevokeGatorPermissionsMultiChain=function({onRedirect:e}={}){const{setTransactionId:t}=(0,d.useGatorPermissionRedirect)({onRedirect:e}),n=(0,s.useStore)();return{revokeGatorPermissionsBatchMultiChain:(0,r.useCallback)(async e=>{const r={},s=[];for(const[t,d]of Object.entries(e)){if(r[t]={revoked:[],skipped:[],errors:[]},0===d.length)continue;let e;try{e=await(0,o.findNetworkClientIdByChainId)(t)}catch(e){const n=e instanceof Error?e.message:String(e);r[t].errors.push(new Error(`No network client ID found for chain ${t}: ${n}`));continue}for(const p of d)try{const{permissionResponse:d}=p,m=(0,a.getInternalAccountByAddress)(n.getState(),d.from);if(!m){r[t].skipped.push(p);continue}const h=(0,l.extractDelegationFromGatorPermissionContext)(d.context),f=(0,c.getDelegationHashOffchain)(h);if(await(0,u.checkDelegationDisabled)(d.delegationManager,f,e)){await(0,u.submitDirectRevocation)({permissionContext:d.context}),r[t].skipped.push(p);continue}const g=(0,c.encodeDisableDelegation)({delegation:h}),b=await(0,o.addTransaction)({from:m.address,to:d.delegationManager,data:g,value:"0x0"},{networkClientId:e,type:i.TransactionType.contractInteraction});if(!b)throw new Error("No transaction meta found");if(!b.id)throw new Error("No transaction id found");r[t].revoked.push(b),s.push(b.id),await(0,u.addPendingRevocation)({txId:b.id,permissionContext:d.context})}catch(e){r[t].errors.push(e)}}return s.length>0&&t(s[0]),r},[n,t])}};var r=e("react"),s=e("react-redux"),i=e("@metamask/transaction-controller"),o=e("../../store/actions"),a=e("../../selectors"),c=e("../../../shared/lib/delegation/delegation"),u=e("../../store/controller-actions/gator-permissions-controller"),l=e("./utils"),d=e("./useGatorPermissionRedirect")}}},{package:"$root$",file:"ui/hooks/gator-permissions/useRevokeGatorPermissionsMultiChain.ts"}],[10309,{"@metamask/delegation-core":1643},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.extractDelegationFromGatorPermissionContext=function(e){const t=(0,r.decodeDelegations)(e),n=t[0];if(!n)throw new Error("No delegation found");if(1!==t.length)throw new Error("Multiple delegations found");return{...n,salt:`0x${n.salt.toString(16)}`}};var r=e("@metamask/delegation-core")}}},{package:"$root$",file:"ui/hooks/gator-permissions/utils.ts"}],[10310,{"./useAccountSyncing":10311},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useAccountSyncing",{enumerable:!0,get:function(){return r.useAccountSyncing}}),Object.defineProperty(n,"useDeleteAccountSyncingDataFromUserStorage",{enumerable:!0,get:function(){return r.useDeleteAccountSyncingDataFromUserStorage}}),Object.defineProperty(n,"useShouldDispatchAccountSyncing",{enumerable:!0,get:function(){return r.useShouldDispatchAccountSyncing}});var r=e("./useAccountSyncing")}}},{package:"$root$",file:"ui/hooks/identity/useAccountSyncing/index.ts"}],[10311,{"../../../ducks/metamask/base-selectors":10184,"../../../ducks/metamask/metamask":10185,"../../../selectors":11575,"../../../selectors/identity/authentication":11573,"../../../selectors/identity/backup-and-sync":11574,"../../../store/actions":11613,loglevel:7398,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useShouldDispatchAccountSyncing=n.useDeleteAccountSyncingDataFromUserStorage=n.useAccountSyncing=void 0;var r,s=e("react-compiler-runtime"),i=(r=e("loglevel"))&&r.__esModule?r:{default:r},o=(e("react"),e("react-redux")),a=e("../../../store/actions"),c=e("../../../selectors/identity/backup-and-sync"),u=e("../../../selectors"),l=e("../../../ducks/metamask/metamask"),d=e("../../../ducks/metamask/base-selectors"),p=e("../../../selectors/identity/authentication");const m=()=>{const e=(0,o.useSelector)(c.selectIsBackupAndSyncEnabled),t=(0,o.useSelector)(c.selectIsAccountSyncingEnabled),n=(0,o.useSelector)(u.getUseExternalServices),r=(0,o.useSelector)(d.getIsUnlocked),s=(0,o.useSelector)(p.selectIsSignedIn),i=(0,o.useSelector)(l.getCompletedOnboarding);return Boolean(n&&e&&t&&r&&s&&i)};n.useShouldDispatchAccountSyncing=m;n.useAccountSyncing=()=>{const e=(0,s.c)(6),t=(0,o.useDispatch)(),n=m();let r;e[0]!==t||e[1]!==n?(r=()=>{try{if(!n)return;t((0,a.syncAccountTreeWithUserStorage)())}catch(e){const t=e;i.default.error(t)}},e[0]=t,e[1]=n,e[2]=r):r=e[2];const c=r;let u;return e[3]!==c||e[4]!==n?(u={dispatchAccountSyncing:c,shouldDispatchAccountSyncing:n},e[3]=c,e[4]=n,e[5]=u):u=e[5],u};n.useDeleteAccountSyncingDataFromUserStorage=()=>{const e=(0,s.c)(4),t=(0,o.useDispatch)();let n;e[0]!==t?(n=async()=>{try{await t((0,a.deleteAccountSyncingDataFromUserStorage)())}catch{}},e[0]=t,e[1]=n):n=e[1];const r=n;let i;return e[2]!==r?(i={dispatchDeleteAccountSyncingData:r},e[2]=r,e[3]=i):i=e[3],i}}}},{package:"$root$",file:"ui/hooks/identity/useAccountSyncing/useAccountSyncing.ts"}],[10312,{"./useAutoSignIn":10313,"./useAutoSignOut":10314,"./useSignIn":10315,"./useSignOut":10316},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useAutoSignIn",{enumerable:!0,get:function(){return i.useAutoSignIn}}),Object.defineProperty(n,"useAutoSignOut",{enumerable:!0,get:function(){return o.useAutoSignOut}}),Object.defineProperty(n,"useSignIn",{enumerable:!0,get:function(){return r.useSignIn}}),Object.defineProperty(n,"useSignOut",{enumerable:!0,get:function(){return s.useSignOut}});var r=e("./useSignIn"),s=e("./useSignOut"),i=e("./useAutoSignIn"),o=e("./useAutoSignOut")}}},{package:"$root$",file:"ui/hooks/identity/useAuthentication/index.ts"}],[10313,{"../../../ducks/metamask/base-selectors":10184,"../../../ducks/metamask/metamask":10185,"../../../selectors":11575,"../../../selectors/identity/authentication":11573,"../../../store/actions":11613,"./useSignIn":10315,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useAutoSignIn=function(){const e=(0,r.c)(12),t=(0,i.useDispatch)(),[n,p]=(0,s.useState)(!1),{signIn:m}=(0,d.useSignIn)(),h=Boolean((0,i.useSelector)(a.getIsUnlocked)),f=Boolean((0,i.useSelector)(c.getUseExternalServices)),g=Boolean((0,i.useSelector)(o.getCompletedOnboarding)),b=(0,i.useSelector)(u.selectIsSignedIn),y=(0,i.useSelector)(u.selectNeedsProfilePairing),k=(0,i.useSelector)(c.getMetaMaskKeyrings),w=(0,s.useRef)(k.length);let v,T;e[0]!==t||e[1]!==k.length?(v=()=>{k.length!==w.current&&(w.current=k.length,p(!0),t((0,l.requestProfilePairing)()))},T=[k.length,t],e[0]=t,e[1]=k.length,e[2]=v,e[3]=T):(v=e[2],T=e[3]);(0,s.useEffect)(v,T);const S=(!b||n||y)&&h&&f&&g;let C;e[4]!==n||e[5]!==y||e[6]!==S||e[7]!==m?(C=async()=>{S&&(n||y?(await m(!0),p(!1)):await m())},e[4]=n,e[5]=y,e[6]=S,e[7]=m,e[8]=C):C=e[8];const P=C;let _;e[9]!==P||e[10]!==S?(_={autoSignIn:P,shouldAutoSignIn:S},e[9]=P,e[10]=S,e[11]=_):_=e[11];return _};var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("../../../ducks/metamask/metamask"),a=e("../../../ducks/metamask/base-selectors"),c=e("../../../selectors"),u=e("../../../selectors/identity/authentication"),l=e("../../../store/actions"),d=e("./useSignIn")}}},{package:"$root$",file:"ui/hooks/identity/useAuthentication/useAutoSignIn.ts"}],[10314,{"../../../ducks/metamask/base-selectors":10184,"../../../selectors":11575,"../../../selectors/identity/authentication":11573,"./useSignOut":10316,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useAutoSignOut=function(){const e=(0,r.c)(6),{signOut:t}=(0,c.useSignOut)(),n=Boolean((0,s.useSelector)(i.getIsUnlocked)),u=Boolean((0,s.useSelector)(o.getUseExternalServices)),l=(0,s.useSelector)(a.selectIsSignedIn),d=l&&n&&!u;let p;e[0]!==d||e[1]!==t?(p=async()=>{d&&await t()},e[0]=d,e[1]=t,e[2]=p):p=e[2];const m=p;let h;e[3]!==m||e[4]!==d?(h={autoSignOut:m,shouldAutoSignOut:d},e[3]=m,e[4]=d,e[5]=h):h=e[5];return h};var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../../../ducks/metamask/base-selectors"),o=e("../../../selectors"),a=e("../../../selectors/identity/authentication"),c=e("./useSignOut")}}},{package:"$root$",file:"ui/hooks/identity/useAuthentication/useAutoSignOut.ts"}],[10315,{"../../../selectors/identity/authentication":11573,"../../../store/actions":11613,loglevel:7398,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useSignIn=function(){const e=(0,s.c)(5),t=(0,i.useDispatch)(),n=!(0,i.useSelector)(a.selectIsSignedIn);let r;e[0]!==n||e[1]!==t?(r=async e=>{if(e??n)try{await t((0,c.performSignIn)())}catch(e){const t=e,n=t instanceof Error?t.message:JSON.stringify(t??"");o.default.error(n)}},e[0]=n,e[1]=t,e[2]=r):r=e[2];const u=r;let l;e[3]!==u?(l={signIn:u},e[3]=u,e[4]=l):l=e[4];return l};var r,s=e("react-compiler-runtime"),i=(e("react"),e("react-redux")),o=(r=e("loglevel"))&&r.__esModule?r:{default:r},a=e("../../../selectors/identity/authentication"),c=e("../../../store/actions")}}},{package:"$root$",file:"ui/hooks/identity/useAuthentication/useSignIn.ts"}],[10316,{"../../../selectors/identity/authentication":11573,"../../../store/actions":11613,loglevel:7398,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useSignOut=function(){const e=(0,s.c)(5),t=(0,i.useDispatch)(),n=(0,i.useSelector)(a.selectIsSignedIn),r=Boolean(n);let u;e[0]!==t||e[1]!==r?(u=async()=>{if(r)try{await t((0,c.performSignOut)())}catch(e){const t=e,n=t instanceof Error?t.message:JSON.stringify(t??"");o.default.error(n)}},e[0]=t,e[1]=r,e[2]=u):u=e[2];const l=u;let d;e[3]!==l?(d={signOut:l},e[3]=l,e[4]=d):d=e[4];return d};var r,s=e("react-compiler-runtime"),i=(e("react"),e("react-redux")),o=(r=e("loglevel"))&&r.__esModule?r:{default:r},a=e("../../../selectors/identity/authentication"),c=e("../../../store/actions")}}},{package:"$root$",file:"ui/hooks/identity/useAuthentication/useSignOut.ts"}],[10317,{"./useBackupAndSync":10318},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useBackupAndSync",{enumerable:!0,get:function(){return r.useBackupAndSync}});var r=e("./useBackupAndSync")}}},{package:"$root$",file:"ui/hooks/identity/useBackupAndSync/index.ts"}],[10318,{"../../../store/actions":11613,loglevel:7398,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useBackupAndSync=function(){const e=(0,i.useDispatch)(),[t,n]=(0,s.useState)(null),r=(0,s.useCallback)(async(t,r)=>{n(null);try{await e((0,a.setIsBackupAndSyncFeatureEnabled)(t,r))}catch(e){const t=e instanceof Error?e.message:JSON.stringify(e??"");o.default.error(t),n(t)}finally{e((0,a.hideLoadingIndication)())}},[e]);return{error:t,setIsBackupAndSyncFeatureEnabled:r}};var r,s=e("react"),i=e("react-redux"),o=(r=e("loglevel"))&&r.__esModule?r:{default:r},a=e("../../../store/actions")}}},{package:"$root$",file:"ui/hooks/identity/useBackupAndSync/useBackupAndSync.ts"}],[10319,{"./useContactSyncing":10320},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useContactSyncing",{enumerable:!0,get:function(){return r.useContactSyncing}}),Object.defineProperty(n,"useShouldDispatchContactSyncing",{enumerable:!0,get:function(){return r.useShouldDispatchContactSyncing}});var r=e("./useContactSyncing")}}},{package:"$root$",file:"ui/hooks/identity/useContactSyncing/index.ts"}],[10320,{"../../../ducks/metamask/base-selectors":10184,"../../../ducks/metamask/metamask":10185,"../../../selectors":11575,"../../../selectors/identity/authentication":11573,"../../../selectors/identity/backup-and-sync":11574,"../../../store/actions":11613,loglevel:7398,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useShouldDispatchContactSyncing=n.useContactSyncing=void 0;var r,s=e("react-compiler-runtime"),i=(r=e("loglevel"))&&r.__esModule?r:{default:r},o=(e("react"),e("react-redux")),a=e("../../../store/actions"),c=e("../../../selectors/identity/backup-and-sync"),u=e("../../../selectors"),l=e("../../../ducks/metamask/metamask"),d=e("../../../ducks/metamask/base-selectors"),p=e("../../../selectors/identity/authentication");const m=()=>{const e=(0,o.useSelector)(c.selectIsBackupAndSyncEnabled),t=(0,o.useSelector)(c.selectIsContactSyncingEnabled),n=(0,o.useSelector)(u.getUseExternalServices),r=(0,o.useSelector)(d.getIsUnlocked),s=(0,o.useSelector)(p.selectIsSignedIn),i=(0,o.useSelector)(l.getCompletedOnboarding);return Boolean(n&&e&&t&&r&&s&&i)};n.useShouldDispatchContactSyncing=m;n.useContactSyncing=()=>{const e=(0,s.c)(6),t=(0,o.useDispatch)(),n=m();let r;e[0]!==t||e[1]!==n?(r=()=>{try{if(!n)return;t((0,a.syncContactsWithUserStorage)())}catch(e){const t=e;i.default.error(t)}},e[0]=t,e[1]=n,e[2]=r):r=e[2];const c=r;let u;return e[3]!==c||e[4]!==n?(u={dispatchContactSyncing:c,shouldDispatchContactSyncing:n},e[3]=c,e[4]=n,e[5]=u):u=e[5],u}}}},{package:"$root$",file:"ui/hooks/identity/useContactSyncing/useContactSyncing.ts"}],[10321,{"../../selectors/metamask-notifications/metamask-notifications":11576,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useReadNotificationsCounter=function(){const e=(0,r.c)(2),{readSnapNotificationsCount:t}=o(),{featureAnnouncementsReadCount:n}=a(),{onChainMetamaskNotificationsReadCount:s}=c(),i=t+n+s;let u;e[0]!==i?(u={notificationsReadCount:i},e[0]=i,e[1]=u):u=e[1];return u},n.useUnreadNotificationsCounter=function(){const e=(0,r.c)(2),{unreadSnapNotificationsCount:t}=o(),{featureAnnouncementsUnreadCount:n}=a(),{onChainMetamaskNotificationsUnreadCount:s}=c(),i=t+n+s;let u;e[0]!==i?(u={notificationsUnreadCount:i},e[0]=i,e[1]=u):u=e[1];return u};var r=e("react-compiler-runtime"),s=e("react-redux"),i=e("../../selectors/metamask-notifications/metamask-notifications");const o=()=>{const e=(0,r.c)(3),t=(0,s.useSelector)(i.getSnapNotificationsUnreadCount),n=(0,s.useSelector)(i.getSnapNotificationsReadCount);let o;return e[0]!==n||e[1]!==t?(o={unreadSnapNotificationsCount:t,readSnapNotificationsCount:n},e[0]=n,e[1]=t,e[2]=o):o=e[2],o},a=()=>{const e=(0,r.c)(4),t=(0,s.useSelector)(i.selectIsFeatureAnnouncementsEnabled),n=(0,s.useSelector)(i.getFeatureAnnouncementsUnreadCount),o=(0,s.useSelector)(i.getFeatureAnnouncementsReadCount);let a;return e[0]!==o||e[1]!==n||e[2]!==t?(a=t?{featureAnnouncementsUnreadCount:n,featureAnnouncementsReadCount:o}:{featureAnnouncementsUnreadCount:0,featureAnnouncementsReadCount:0},e[0]=o,e[1]=n,e[2]=t,e[3]=a):a=e[3],a},c=()=>{const e=(0,r.c)(4),t=(0,s.useSelector)(i.selectIsMetamaskNotificationsEnabled),n=(0,s.useSelector)(i.getOnChainMetamaskNotificationsUnreadCount),o=(0,s.useSelector)(i.getOnChainMetamaskNotificationsReadCount);let a;return e[0]!==t||e[1]!==o||e[2]!==n?(a=t?{onChainMetamaskNotificationsUnreadCount:n,onChainMetamaskNotificationsReadCount:o}:{onChainMetamaskNotificationsUnreadCount:0,onChainMetamaskNotificationsReadCount:0},e[0]=t,e[1]=o,e[2]=n,e[3]=a):a=e[3],a}}}},{package:"$root$",file:"ui/hooks/metamask-notifications/useCounter.tsx"}],[10322,{"../../contexts/metamask-notifications/notification-storage-keys":10150,"../../store/actions":11613,loglevel:7398,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useCreateNotifications=function(){const e=(0,s.c)(6),t=(0,o.useDispatch)(),[n,r]=l(null);let i;e[0]!==t||e[1]!==r?(i=async()=>{r(null);try{await t((0,c.createOnChainTriggers)()),await(0,u.updateNotificationSubscriptionExpiration)()}catch(e){const t=e;throw r(t instanceof Error?t.message:"An unexpected error occurred"),a.default.error(t),t}},e[0]=t,e[1]=r,e[2]=i):i=e[2];const d=i;let p;e[3]!==d||e[4]!==n?(p={createNotifications:d,error:n},e[3]=d,e[4]=n,e[5]=p):p=e[5];return p},n.useDisableNotifications=function(){const e=(0,s.c)(6),t=(0,o.useDispatch)(),[n,r]=l(null);let i;e[0]!==t||e[1]!==r?(i=async()=>{r(null);try{await t((0,c.disableMetamaskNotifications)()),await(0,u.setUserHasTurnedOffNotificationsOnce)()}catch(e){const t=e;throw r(t instanceof Error?t.message:"An unexpected error occurred"),a.default.error(t),t}},e[0]=t,e[1]=r,e[2]=i):i=e[2];const d=i;let p;e[3]!==d||e[4]!==n?(p={disableNotifications:d,error:n},e[3]=d,e[4]=n,e[5]=p):p=e[5];return p},n.useEnableNotifications=function(){const e=(0,s.c)(6),t=(0,o.useDispatch)(),[n,r]=l(null);let i;e[0]!==t||e[1]!==r?(i=async()=>{r(null);try{await t((0,c.enableMetamaskNotifications)()),await(0,u.updateNotificationSubscriptionExpiration)()}catch(e){const t=e;throw r(t instanceof Error?t.message:"An unexpected error occurred"),a.default.error(t),t}},e[0]=t,e[1]=r,e[2]=i):i=e[2];const d=i;let p;e[3]!==d||e[4]!==n?(p={enableNotifications:d,error:n},e[3]=d,e[4]=n,e[5]=p):p=e[5];return p},n.useListNotifications=function(){const e=(0,o.useDispatch)(),[t,n]=l(!1),[r,s]=l(null),[u,d]=l(undefined);return{listNotifications:(0,i.useCallback)(async()=>{n(!0),s(null);const t=new URLSearchParams(window.location.search).get("previewToken");try{const n=await e((0,c.fetchAndUpdateMetamaskNotifications)(t??undefined));return d(n),n}catch(e){throw a.default.error(e),s(e instanceof Error?e.message:"An unexpected error occurred"),e}finally{n(!1)}},[e,n,s,d]),notificationsData:u,isLoading:t,error:r}},n.useMarkNotificationAsRead=function(){const e=(0,s.c)(4),t=(0,o.useDispatch)();let n;e[0]!==t?(n=async e=>{try{t((0,c.markMetamaskNotificationsAsRead)(e))}catch(e){const t=e;throw a.default.error(t),t}},e[0]=t,e[1]=n):n=e[1];const r=n;let i;e[2]!==r?(i={markNotificationAsRead:r},e[2]=r,e[3]=i):i=e[3];return i},n.useSafeState=l;var r,s=e("react-compiler-runtime"),i=e("react"),o=e("react-redux"),a=(r=e("loglevel"))&&r.__esModule?r:{default:r},c=e("../../store/actions"),u=e("../../contexts/metamask-notifications/notification-storage-keys");function l(e){const t=(0,s.c)(5),[n,r]=(0,i.useState)(e),o=(0,i.useRef)(!0);let a,c,u;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>(o.current=!0,()=>{o.current=!1}),c=[],t[0]=a,t[1]=c):(a=t[0],c=t[1]),(0,i.useEffect)(a,c),t[2]===Symbol.for("react.memo_cache_sentinel")?(u=e=>{o.current&&r(e)},t[2]=u):u=t[2];const l=u;let d;return t[3]!==n?(d=[n,l],t[3]=n,t[4]=d):d=t[4],d}}}},{package:"$root$",file:"ui/hooks/metamask-notifications/useNotifications.ts"}],[10323,{"../../selectors/metamask-notifications/metamask-notifications":11576,"../../store/actions":11613,loglevel:7398,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useAccountSettingsProps=function(e){const t=(0,o.useSelector)(u.getIsUpdatingMetamaskNotificationsAccount),n=(0,o.useSelector)(u.selectIsMetamaskNotificationsEnabled),r=function(){const e=(0,o.useDispatch)(),t=(0,i.useCallback)(async t=>{try{return await e((0,c.checkAccountsPresence)(t))}catch{return{}}},[]);return t}(),[s,a]=(0,i.useState)({}),[l,d]=(0,i.useState)(!1),[p,m]=(0,i.useState)(null),h=(0,i.useMemo)(()=>JSON.stringify(e),[e]),f=(0,i.useCallback)(async e=>{try{d(!0),m(null);const t=await r(e);a(t)}catch{m("Failed to get account settings")}finally{d(!1)}},[]);return(0,i.useEffect)(()=>{if(!n)return;const e=JSON.parse(h);f(e)},[h,r,n]),{data:s,initialLoading:l,error:p,accountsBeingUpdated:t,update:f}},n.useSwitchAccountNotificationsChange=function(){const e=(0,s.c)(5),t=(0,o.useDispatch)(),[n,r]=(0,i.useState)(null);let u;e[0]!==t?(u=async(e,n)=>{r(null);try{n?await t((0,c.enableAccounts)(e)):await t((0,c.disableAccounts)(e))}catch(e){const t=e,n=t instanceof Error?t.message:JSON.stringify(t??"");a.default.error(n),r(n)}t((0,c.hideLoadingIndication)())},e[0]=t,e[1]=u):u=e[1];const l=u;let d;e[2]!==n||e[3]!==l?(d={onChange:l,error:n},e[2]=n,e[3]=l,e[4]=d):d=e[4];return d},n.useSwitchFeatureAnnouncementsChange=function(){const e=(0,s.c)(5),t=(0,o.useDispatch)(),[n,r]=(0,i.useState)(null);let a;e[0]!==t?(a=async e=>{r(null);try{await t((0,c.setFeatureAnnouncementsEnabled)(e))}catch(e){const t=e,n=t instanceof Error?t.message:JSON.stringify(t??"");r(n)}},e[0]=t,e[1]=a):a=e[1];const u=a;let l;e[2]!==n||e[3]!==u?(l={onChange:u,error:n},e[2]=n,e[3]=u,e[4]=l):l=e[4];return l};var r,s=e("react-compiler-runtime"),i=e("react"),o=e("react-redux"),a=(r=e("loglevel"))&&r.__esModule?r:{default:r},c=e("../../store/actions"),u=e("../../selectors/metamask-notifications/metamask-notifications")}}},{package:"$root$",file:"ui/hooks/metamask-notifications/useSwitchNotifications.ts"}],[10324,{"../../../shared/lib/snaps/snaps":8909,"../../selectors":11575,"../../selectors/accounts":11556,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useHdKeyringsWithSnapAccounts=void 0;var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../../selectors/accounts"),o=e("../../selectors"),a=e("../../../shared/lib/snaps/snaps");function c(e){return e.address}n.useHdKeyringsWithSnapAccounts=()=>{const e=(0,r.c)(5),t=(0,s.useSelector)(o.getMetaMaskHdKeyrings),n=(0,s.useSelector)(i.getInternalAccounts);let u;if(e[0]!==t||e[1]!==n){let r;e[3]!==n?(r=e=>{const t=n.filter(t=>t.metadata.snap&&(0,a.isSnapPreinstalled)(t.metadata.snap.id)&&t.options?.entropySource===e.metadata.id).map(c);return{...e,accounts:[...e.accounts,...t]}},e[3]=n,e[4]=r):r=e[4],u=t.map(r),e[0]=t,e[1]=n,e[2]=u}else u=e[2];return u}}}},{package:"$root$",file:"ui/hooks/multi-srp/useHdKeyringsWithSnapAccounts.ts"}],[10325,{"../../components/app/assets/util/formatWithThreshold":9025,"../../ducks/locale/locale":10183,"../../ducks/metamask/metamask":10185,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useDisplayBalanceCalc=function(){const e=(0,r.c)(3),t=(0,s.useSelector)(o.getCurrentCurrency),n=(0,s.useSelector)(a.getIntlLocale);let c;e[0]!==t||e[1]!==n?(c=(e,r)=>{const s=e===undefined?0:e,o=r===undefined?t:r;return(0,i.formatWithThreshold)(s,.01,n,{style:"currency",currency:o})},e[0]=t,e[1]=n,e[2]=c):c=e[2];return c};var r=e("react-compiler-runtime"),s=e("react-redux"),i=(e("react"),e("../../components/app/assets/util/formatWithThreshold")),o=e("../../ducks/metamask/metamask"),a=e("../../ducks/locale/locale")}}},{package:"$root$",file:"ui/hooks/multichain-accounts/useAccountBalance.ts"}],[10326,{"../../selectors/assets":11565,"./useAccountBalance":10325,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useSingleWalletAccountsBalanceCallback=function(e){const t=(0,r.c)(5);let n;t[0]!==e?(n=(0,i.selectBalanceByWallet)(e),t[0]=e,t[1]=n):n=t[1];const a=n,c=(0,s.useSelector)(a),u=(0,o.useDisplayBalanceCalc)();let l;t[2]!==u||t[3]!==c.groups?(l=e=>{const t=c.groups?.[e];if(!t)return;return u(t?.totalBalanceInUserCurrency,t?.userCurrency)},t[2]=u,t[3]=c.groups,t[4]=l):l=t[4];return l},n.useSingleWalletDisplayBalance=function(e){const t=(0,r.c)(6);let n;t[0]!==e?(n=(0,i.selectBalanceByWallet)(e),t[0]=e,t[1]=n):n=t[1];const a=n,c=(0,s.useSelector)(a),u=(0,o.useDisplayBalanceCalc)();let l;t[2]!==u||t[3]!==c.totalBalanceInUserCurrency||t[4]!==c.userCurrency?(l=u(c.totalBalanceInUserCurrency,c.userCurrency),t[2]=u,t[3]=c.totalBalanceInUserCurrency,t[4]=c.userCurrency,t[5]=l):l=t[5];return l};var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../../selectors/assets"),o=e("./useAccountBalance")}}},{package:"$root$",file:"ui/hooks/multichain-accounts/useWalletBalance.ts"}],[10327,{"../../ducks/metamask/metamask":10185,"../../selectors/multichain-accounts/account-tree":11579,"../multi-srp/useHdKeyringsWithSnapAccounts":10324,"./utils":10328,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useWalletInfo=void 0;var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../multi-srp/useHdKeyringsWithSnapAccounts"),o=e("../../selectors/multichain-accounts/account-tree"),a=e("../../ducks/metamask/metamask"),c=e("./utils");n.useWalletInfo=e=>{const t=(0,r.c)(12),n=(0,i.useHdKeyringsWithSnapAccounts)(),u=(0,s.useSelector)(a.getIsPrimarySeedPhraseBackedUp);let l;t[0]!==e?(l=t=>(0,o.getMultichainAccountsByWalletId)(t,e),t[0]=e,t[1]=l):l=t[1];const d=(0,s.useSelector)(l);let p;t[2]!==d?(p=Object.values(d??{}),t[2]=d,t[3]=p):p=t[3];const m=p;let h;e:{if(0===Object.entries(m||{}).length){let e;t[4]!==m?(e={multichainAccounts:m,keyringId:undefined},t[4]=m,t[5]=e):e=t[5],h=e;break e}const r=n.findIndex(t=>t.metadata.id===(0,c.stripWalletTypePrefixFromWalletId)(e));if(-1===r){let e;t[6]!==m?(e={multichainAccounts:m,keyringId:undefined},t[6]=m,t[7]=e):e=t[7],h=e;break e}const s=n[r],i=s?.metadata.id??undefined,o=1===r+1?u:undefined;let a;t[8]!==o||t[9]!==i||t[10]!==m?(a={multichainAccounts:m,keyringId:i,isSRPBackedUp:o},t[8]=o,t[9]=i,t[10]=m,t[11]=a):a=t[11],h=a}return h}}}},{package:"$root$",file:"ui/hooks/multichain-accounts/useWalletInfo.ts"}],[10329,{"../../components/app/musd/utils":9185,"./useCanBuyMusd":10332,"./useCustomAmount":10333,"./useMusdBalance":10335,"./useMusdConversion":10336,"./useMusdConversionConfirmTrace":10337,"./useMusdConversionToastStatus":10338,"./useMusdConversionTokens":10339,"./useMusdCtaVisibility":10340,"./useMusdGeoBlocking":10341,"./useMusdMerklPosition":10342,"./useMusdNetworkFilter":10343,"./useMusdPaymentToken":10344},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BuyGetMusdCtaVariant",{enumerable:!0,get:function(){return i.BuyGetMusdCtaVariant}}),Object.defineProperty(n,"checkTokenAllowed",{enumerable:!0,get:function(){return i.checkTokenAllowed}}),Object.defineProperty(n,"isMerklClaimTransaction",{enumerable:!0,get:function(){return f.isMerklClaimTransaction}}),Object.defineProperty(n,"isTokenInWildcardList",{enumerable:!0,get:function(){return i.isTokenInWildcardList}}),Object.defineProperty(n,"useCanBuyMusd",{enumerable:!0,get:function(){return p.useCanBuyMusd}}),Object.defineProperty(n,"useCustomAmount",{enumerable:!0,get:function(){return d.useCustomAmount}}),Object.defineProperty(n,"useMusdBalance",{enumerable:!0,get:function(){return o.useMusdBalance}}),Object.defineProperty(n,"useMusdConversion",{enumerable:!0,get:function(){return r.useMusdConversion}}),Object.defineProperty(n,"useMusdConversionConfirmTrace",{enumerable:!0,get:function(){return m.useMusdConversionConfirmTrace}}),Object.defineProperty(n,"useMusdConversionToastStatus",{enumerable:!0,get:function(){return l.useMusdConversionToastStatus}}),Object.defineProperty(n,"useMusdConversionTokens",{enumerable:!0,get:function(){return u.useMusdConversionTokens}}),Object.defineProperty(n,"useMusdCtaVisibility",{enumerable:!0,get:function(){return i.useMusdCtaVisibility}}),Object.defineProperty(n,"useMusdGeoBlocking",{enumerable:!0,get:function(){return s.useMusdGeoBlocking}}),Object.defineProperty(n,"useMusdMerklPosition",{enumerable:!0,get:function(){return a.useMusdMerklPosition}}),Object.defineProperty(n,"useMusdNetworkFilter",{enumerable:!0,get:function(){return c.useMusdNetworkFilter}}),Object.defineProperty(n,"useMusdPaymentToken",{enumerable:!0,get:function(){return h.useMusdPaymentToken}});var r=e("./useMusdConversion"),s=e("./useMusdGeoBlocking"),i=e("./useMusdCtaVisibility"),o=e("./useMusdBalance"),a=e("./useMusdMerklPosition"),c=e("./useMusdNetworkFilter"),u=e("./useMusdConversionTokens"),l=e("./useMusdConversionToastStatus"),d=e("./useCustomAmount"),p=e("./useCanBuyMusd"),m=e("./useMusdConversionConfirmTrace"),h=e("./useMusdPaymentToken"),f=e("../../components/app/musd/utils")}}},{package:"$root$",file:"ui/hooks/musd/index.ts"}],[10330,{"../../../shared/lib/transaction.utils":8926,"../../components/app/musd/constants":9167,"../../components/app/musd/merkl-client":9176,"@ethersproject/abi":852,"bignumber.js":6427},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.decodeMerklClaimParams=u,n.extractTransactionAmount=function(e){const t=e.txParams?.data;if(t)try{const e=(0,i.parseStandardTokenTransactionData)(t),n=e?.args?._value;if(n)return new r.BigNumber(n.toString()).toString(10)}catch(e){console.error("Failed to parse amount from transaction data:",e)}if(e.txParams?.value)try{return new r.BigNumber(e.txParams.value).toString(10)}catch(e){console.error("Failed to parse amount from txParams.value:",e)}return undefined},n.getClaimPayoutFromReceipt=m,n.getUnclaimedAmountForMerklClaimTx=l,n.resolveClaimAmount=async function(e){const t=u(e.txParams?.data);if(!t)return undefined;const n=e.txReceipt;if(n?.logs){const e=m(n.logs,t.userAddress);if(e)return e}const r=await l(e.txParams?.data);return r?.unclaimedRaw};var r=e("bignumber.js"),s=e("@ethersproject/abi"),i=e("../../../shared/lib/transaction.utils"),o=e("../../components/app/musd/constants"),a=e("../../components/app/musd/merkl-client");const c="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";function u(e){if(!e||"string"!=typeof e)return null;try{const t=new s.Interface(o.DISTRIBUTOR_CLAIM_ABI).decodeFunctionData("claim",e),[n,r,i]=t;return n?.length&&r?.length&&i?.length?{totalAmount:i[0].toString(),userAddress:n[0],tokenAddress:r[0]}:null}catch{return null}}async function l(e){const t=u(e);if(!t)return null;const n=t.totalAmount,r=BigInt(n);try{const e=await(0,a.getClaimedAmountFromContract)(t.userAddress,t.tokenAddress),s=BigInt(e??"0");return{totalAmountRaw:n,unclaimedRaw:r>s?(r-s).toString():"0",contractCallSucceeded:!0}}catch{return{totalAmountRaw:n,unclaimedRaw:n,contractCallSucceeded:!1}}}function d(e){return e&&Array.isArray(e)?e:null}function p(e){return!e||e.length<42?undefined:`0x${e.slice(-40)}`.toLowerCase()}function m(e,t){if(!e?.length||!t)return null;for(const n of e){const e=d(n.topics);if(!e||e.length<3)continue;const r=e[0]?.toLowerCase()===c,s=p(e[1])===o.MERKL_DISTRIBUTOR_ADDRESS.toLowerCase(),i=p(e[2])===t.toLowerCase(),a=n.address?.toLowerCase()===o.MUSD_TOKEN_ADDRESS.toLowerCase();if(r&&s&&i&&a){const e=n.data;if(!e)continue;return BigInt(e).toString()}}return null}}}},{package:"$root$",file:"ui/hooks/musd/transaction-amount-utils.ts"}],[10331,{"@metamask/transaction-controller":4006},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.IN_FLIGHT_STATUSES=void 0;var r=e("@metamask/transaction-controller");n.IN_FLIGHT_STATUSES=[r.TransactionStatus.approved,r.TransactionStatus.signed,r.TransactionStatus.submitted]}}},{package:"$root$",file:"ui/hooks/musd/transaction-status-constants.ts"}],[10332,{"../../components/app/musd/constants":9167,"./useMusdGeoBlocking":10341,"./useMusdNetworkFilter":10343,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.clearRegionTokenCache=function(){l.country=null,l.tokens=[],l.timestamp=null},n.default=void 0,n.fetchRegionTokens=d,n.regionTokenCache=void 0,n.useCanBuyMusd=p;var r=e("react-compiler-runtime"),s=e("react"),i=e("../../components/app/musd/constants"),o=e("./useMusdGeoBlocking"),a=e("./useMusdNetworkFilter");const c="https://on-ramp-cache.api.cx.metamask.io",u=3e5,l=n.regionTokenCache={country:null,tokens:[],timestamp:null};async function d(e){if(l.country===e&&l.timestamp&&Date.now()-l.timestamp<u)return l.tokens;try{const t=new URL(`/regions/${e.toLowerCase()}/tokens`,c);t.searchParams.set("action","buy");const n=await fetch(t.toString());if(!n.ok)throw new Error(`Token cache API error: ${n.status}`);const r=(await n.json()).allTokens??[];return l.country=e,l.tokens=r,l.timestamp=Date.now(),r}catch{return[]}}function p(){const e=(0,r.c)(12),{isBlocked:t,isLoading:n,userCountry:c}=(0,o.useMusdGeoBlocking)(),{selectedChainId:u,isPopularNetworksFilterActive:l}=(0,a.useMusdNetworkFilter)();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[m,h]=(0,s.useState)(p),[f,g]=(0,s.useState)(!0);let b,y,k;if(e[1]!==c?(b=()=>{if(!c)return h([]),void g(!1);let e=!1;return g(!0),d(c).then(t=>{e||(h(t),g(!1))}),()=>{e=!0}},y=[c],e[1]=c,e[2]=b,e[3]=y):(b=e[2],y=e[3]),(0,s.useEffect)(b,y),e[4]!==m){k={};for(const e of i.MUSD_BUYABLE_CHAIN_IDS){const t=i.MUSD_TOKEN_ASSET_ID_BY_CHAIN[e];t?k[e]=m.some(e=>e.assetId?.toLowerCase()===t.toLowerCase()&&!0===e.tokenSupported):k[e]=!1}e[4]=m,e[5]=k}else k=e[5];const w=k,v=Object.values(w).some(Boolean);let T;T=l?v:!!u&&(w[u]??!1);const S=T,C=!t&&S,P=n||f;let _;return e[6]!==S||e[7]!==v||e[8]!==w||e[9]!==C||e[10]!==P?(_={canBuyMusdInRegion:C,isMusdBuyableOnChain:w,isMusdBuyableOnAnyChain:v,isMusdBuyable:S,isLoading:P},e[6]=S,e[7]=v,e[8]=w,e[9]=C,e[10]=P,e[11]=_):_=e[11],_}n.default=p}}},{package:"$root$",file:"ui/hooks/musd/useCanBuyMusd.ts"}],[10333,{"../../pages/confirmations/context/confirm":11001,"../../selectors/musd":11587,"@metamask/transaction-controller":4006,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useCustomAmount=n.default=void 0;var r=e("react-compiler-runtime"),s=e("@metamask/transaction-controller"),i=(e("react"),e("react-redux")),o=e("../../selectors/musd"),a=e("../../pages/confirmations/context/confirm");const c=e=>{const t=(0,r.c)(6),{amountHuman:n}=e,c=(0,i.useSelector)(o.selectIsMusdConversionFlowEnabled),{currentConfirmation:u}=(0,a.useConfirmContext)(),l=c&&u?.type===s.TransactionType.musdConversion;let d;e:{if(!l){d=null;break e}const e=parseFloat(n)||0;let r;t[0]!==e?(p=e,m=2,r=isNaN(p)?(0).toFixed(m):p.toFixed(m),t[0]=e,t[1]=r):r=t[1],d=r}var p,m;const h=d;let f;f=l?"mUSD":null;const g=f;let b;return t[2]!==h||t[3]!==g||t[4]!==l?(b={shouldShowOutputAmountTag:l,outputAmount:h,outputSymbol:g},t[2]=h,t[3]=g,t[4]=l,t[5]=b):b=t[5],b};n.useCustomAmount=c;n.default=c}}},{package:"$root$",file:"ui/hooks/musd/useCustomAmount.ts"}],[10334,{"../../../shared/constants/metametrics":8726,"../../components/app/musd/constants":9167,"../../components/app/musd/utils":9185,"../../contexts/metametrics":10151,"../../selectors/multichain":11582,"../../selectors/transactions":11611,"./transaction-amount-utils":10330,"./transaction-status-constants":10331,"@metamask/transaction-controller":4006,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useMerklClaimStatus=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("@metamask/transaction-controller"),a=e("../../selectors/transactions"),c=e("../../contexts/metametrics"),u=e("../../../shared/constants/metametrics"),l=e("../../components/app/musd/constants"),d=e("../../selectors/multichain"),p=e("../../components/app/musd/utils"),m=e("./transaction-amount-utils"),h=e("./transaction-status-constants");function f(e){return h.IN_FLIGHT_STATUSES.includes(e.status)}function g(e){return h.IN_FLIGHT_STATUSES.includes(e.status)}function b(e){return e.id}n.useMerklClaimStatus=()=>{const e=(0,r.c)(15),t=(0,i.useSelector)(a.getTransactions),{trackEvent:n}=(0,s.useContext)(c.MetaMetricsContext),y=(0,i.useSelector)(d.getMultichainNetworkConfigurationsByChainId),[k,w]=(0,s.useState)(null),[v,T]=(0,s.useState)(!1);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=new Set,e[0]=S):S=e[0];const C=(0,s.useRef)(S);let P;e[1]===Symbol.for("react.memo_cache_sentinel")?(P=new Set,e[1]=P):P=e[1];const _=(0,s.useRef)(P);let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=new Map,e[2]=x):x=e[2];const I=(0,s.useRef)(x);let E;e[3]!==y||e[4]!==n?(E=async(e,t)=>{const r=y[l.MERKL_CLAIM_CHAIN_ID],s=r?.name??"Unknown Network";let i;try{i=await(0,m.resolveClaimAmount)(e)}catch{}const o={transaction_id:e.id,transaction_status:t,transaction_type:"merklClaim",network_chain_id:l.MERKL_CLAIM_CHAIN_ID,network_name:s,...i===undefined?{}:{amount_claimed_decimal:i}};n({event:u.MetaMetricsEventName.MusdClaimBonusStatusUpdated,category:u.MetaMetricsEventCategory.MusdConversion,properties:o})},e[3]=y,e[4]=n,e[5]=E):E=e[5];const M=E;let A;e[6]!==t?(A=t.filter(p.isMerklClaimTransaction),e[6]=t,e[7]=A):A=e[7];const N=A,$=N.some(f);let O,L,B;e[8]!==N||e[9]!==M?(O=()=>{const e=new Set(N.filter(g).map(b));for(const e of N){const t=I.current.get(e.id)??new Set;if(h.IN_FLIGHT_STATUSES.includes(e.status)&&!t.has("approved")&&(M(e,"approved"),t.add("approved"),I.current.set(e.id,t)),_.current.has(e.id))continue;const n=C.current.has(e.id);if(e.status===o.TransactionStatus.confirmed&&n)t.has("confirmed")||(M(e,"confirmed"),t.add("confirmed"),I.current.set(e.id,t)),w("success"),T(!1),_.current.add(e.id);else if((e.status===o.TransactionStatus.failed||e.status===o.TransactionStatus.dropped)&&n){const n=e.status===o.TransactionStatus.failed?"failed":"dropped";t.has(n)||(M(e,n),t.add(n),I.current.set(e.id,t)),w("failed"),T(!1),_.current.add(e.id)}}for(const t of e)if(!C.current.has(t)){T(!1);break}C.current=e},L=[N,M],e[8]=N,e[9]=M,e[10]=O,e[11]=L):(O=e[10],L=e[11]),(0,s.useEffect)(O,L),e[12]===Symbol.for("react.memo_cache_sentinel")?(B=()=>{w(null),T(!0)},e[12]=B):B=e[12];const R=B,D=v?null:k??($?"in-progress":null);let F;return e[13]!==D?(F={toastState:D,dismissToast:R},e[13]=D,e[14]=F):F=e[14],F}}}},{package:"$root$",file:"ui/hooks/musd/useMerklClaimStatus.ts"}],[10335,{"../../components/app/musd/constants":9167,"../../selectors":11575,"../../selectors/assets":11565,"bignumber.js":6427,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,n.useMusdBalance=u;var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("bignumber.js"),o=e("../../selectors/assets"),a=e("../../selectors"),c=e("../../components/app/musd/constants");function u(){const e=(0,r.c)(13),t=(0,s.useSelector)(a.getSelectedAccount),n=(0,s.useSelector)(o.getAssetsBySelectedAccountGroup);let u;if(e[0]!==n||e[1]!==t?.address){e:{let r=!1,s="0";const o={};if(!t?.address){let t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t={hasMusdBalance:!1,totalMusdBalance:"0",musdBalancesByChain:{},isLoading:!1},e[3]=t):t=e[3],u=t;break e}for(const[e,t]of Object.entries(n)){const n=e.toLowerCase();if((0,c.isMusdSupportedChain)(n))for(const e of t){const t="address"in e?e.address:null;if(t&&(0,c.isMusdToken)(t)){const t=e.balance||"0";"0"!==t&&(r=!0,o[n]=t,s=new i.BigNumber(s).plus(t).toString())}}}let a;e[4]!==o||e[5]!==r||e[6]!==s?(a={hasMusdBalance:r,totalMusdBalance:s,musdBalancesByChain:o,isLoading:!1},e[4]=o,e[5]=r,e[6]=s,e[7]=a):a=e[7],u=a}e[0]=n,e[1]=t?.address,e[2]=u}else u=e[2];const{hasMusdBalance:l,totalMusdBalance:d,musdBalancesByChain:p,isLoading:m}=u;let h;return e[8]!==l||e[9]!==m||e[10]!==p||e[11]!==d?(h={hasMusdBalance:l,totalMusdBalance:d,musdBalancesByChain:p,isLoading:m},e[8]=l,e[9]=m,e[10]=p,e[11]=d,e[12]=h):h=e[12],h}n.default=u}}},{package:"$root$",file:"ui/hooks/musd/useMusdBalance.ts"}],[10336,{"../../../shared/lib/selectors/accounts":8890,"../../../shared/lib/trace":8924,"../../components/app/musd/constants":9167,"../../components/app/musd/utils":9185,"../../helpers/constants/routes":10205,"../../pages/confirmations/hooks/useConfirmationNavigation":11129,"../../pages/musd/constants/routes":11283,"../../selectors/musd":11587,"../../selectors/transactions":11611,"../../store/actions":11613,"../../store/controller-actions/transaction-pay-controller":11619,"./useMusdGeoBlocking":10341,react:7855,"react-redux":7818,"react-router-dom":7831},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,n.useMusdConversion=k;var r=e("react"),s=e("react-redux"),i=e("react-router-dom"),o=e("../../../shared/lib/trace"),a=e("../../selectors/musd"),c=e("../../../shared/lib/selectors/accounts"),u=e("../../selectors/transactions"),l=e("../../store/actions"),d=e("../../components/app/musd/utils"),p=e("../../helpers/constants/routes"),m=e("../../pages/musd/constants/routes"),h=e("../../pages/confirmations/hooks/useConfirmationNavigation"),f=e("../../components/app/musd/constants"),g=e("../../store/controller-actions/transaction-pay-controller"),b=e("./useMusdGeoBlocking");const y=new Map;function k(){const e=(0,s.useDispatch)(),t=(0,i.useNavigate)(),n=(0,i.useLocation)(),[k,w]=(0,r.useState)(null),v=(0,s.useSelector)(c.getSelectedInternalAccount),T=v?.address,S=(0,s.useSelector)(u.getUnapprovedTransactions),C=(0,s.useSelector)(a.selectMusdConversionEducationSeen),P=(0,s.useSelector)(a.selectIsMusdConversionFlowEnabled),{isBlocked:_,isLoading:x}=(0,b.useMusdGeoBlocking)(),I=(0,r.useCallback)(async e=>{const{chainId:t,fromAddress:n,amountHex:r}=e,s=await(0,l.findNetworkClientIdByChainId)(t),{txParams:i,addTxOptions:o}=(0,d.buildMusdConversionTx)({chainId:t,fromAddress:n,recipientAddress:n,amountHex:r,networkClientId:s});return(await(0,l.addTransaction)(i,o)).id},[]),E=(0,r.useCallback)(async r=>{const{preferredToken:s,skipEducation:i}=r;if(!P)return void console.warn("[MUSD] Conversion flow not enabled");if(_)return void console.warn("[MUSD] User is geo-blocked");if(!C&&!i)return void t(m.MUSD_CONVERSION_EDUCATION_ROUTE);if(!T)return;const a=s?.chainId??f.MUSD_CONVERSION_DEFAULT_CHAIN_ID;try{w(null);const r=(0,d.ensureMusdTokenImportedForChain)(a,e),i=function(e){const{unapprovedTransactions:t,selectedAddress:n,chainId:r}=e;return Object.values(t).find(e=>(0,d.isMatchingMusdConversion)(e,n,r))}({unapprovedTransactions:S,selectedAddress:T,chainId:a});let c;if(i?.id)c=i.id;else{const e=function(e){const{selectedAddress:t,chainId:n}=e;return`${t.toLowerCase()}_${n.toLowerCase()}`}({selectedAddress:T,chainId:a}),t=y.get(e);if(t===undefined){const t=I({chainId:a,fromAddress:T,amountHex:"0x0"});y.set(e,t.catch(()=>undefined));try{c=await t}catch(e){return console.error("[MUSD] Transaction creation failed:",e),void w("Failed to start conversion")}finally{y.delete(e)}}else{const e=await t;if(!e)return void w("Failed to start conversion");c=e}}const u={paymentTokenChainId:a,paymentTokenAddress:s?.address??"unknown",hasPreferredToken:Boolean(s)};(0,o.trace)({name:o.TraceName.MusdConversionNavigation,op:o.TraceOperation.MusdConversionOperation,tags:u}),await r,t({pathname:`${p.CONFIRM_TRANSACTION_ROUTE}/${c}`,search:new URLSearchParams({loader:h.ConfirmationLoader.CustomAmount,goBackTo:n.pathname+n.search}).toString()}),s?.address&&await(0,g.updateTransactionPaymentToken)({transactionId:c,tokenAddress:s.address,chainId:a}).catch(e=>{console.warn("[MUSD] Failed to pre-select payment token:",e)})}catch(e){const t=e instanceof Error?e.message:"Failed to start conversion";console.error("[MUSD] startConversionFlow failed:",e),w(t)}},[e,P,_,C,T,S,I,t,n.pathname,n.search]),M=(0,r.useCallback)(()=>{t(-1)},[t]),A=(0,r.useCallback)(()=>{e((0,l.setMusdConversionEducationSeen)(!0))},[e]);return{educationSeen:C,isFeatureEnabled:P,isUserGeoBlocked:_,isGeoLoading:x,startConversionFlow:E,cancelConversion:M,markEducationSeen:A,error:k}}n.default=k}}},{package:"$root$",file:"ui/hooks/musd/useMusdConversion.ts"}],[10337,{"../../../shared/lib/trace":8924,"../../selectors/transactionPayController":11610,"../../selectors/transactions":11611,"./transaction-status-constants":10331,"@metamask/transaction-controller":4006,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,n.useMusdConversionConfirmTrace=d;var r=e("react"),s=e("react-redux"),i=e("@metamask/transaction-controller"),o=e("../../../shared/lib/trace"),a=e("../../selectors/transactions"),c=e("../../selectors/transactionPayController"),u=e("./transaction-status-constants");const l=[i.TransactionStatus.confirmed,i.TransactionStatus.failed,i.TransactionStatus.dropped,i.TransactionStatus.rejected];function d(e){const t=(0,r.useRef)(!1),n=(0,r.useRef)(null),d=(0,r.useRef)(null),p=t.current?n.current??e:e,m=(0,s.useSelector)(a.getTransactions),h=(0,s.useSelector)(e=>p?(0,c.selectTransactionPaymentTokenByTransactionId)(e,p):undefined),f=(0,s.useSelector)(e=>p?(0,c.selectTransactionPayQuotesByTransactionId)(e,p):undefined),g=m.find(e=>e.id===p&&e.type===i.TransactionType.musdConversion);(0,r.useEffect)(()=>{if(g){if(u.IN_FLIGHT_STATUSES.includes(g.status)&&!t.current){t.current=!0,n.current=g.id;const e=f?.[0],r={paymentTokenAddress:h?.address??"unknown",paymentTokenChainId:h?.chainId??"unknown",transactionChainId:g.chainId??"unknown",strategy:e?.strategy??"unknown"};d.current=r,(0,o.trace)({name:o.TraceName.MusdConversionConfirm,op:o.TraceOperation.MusdConversionOperation,id:g.id,tags:{transactionId:g.id,...r}})}if(t.current&&d.current){const e=f?.[0];h?.address&&(d.current.paymentTokenAddress=h.address),h?.chainId&&(d.current.paymentTokenChainId=h.chainId),g.chainId&&(d.current.transactionChainId=g.chainId),e?.strategy&&(d.current.strategy=e.strategy)}if(t.current&&(e=g.status,l.includes(e))){t.current=!1;const e=d.current,r={success:g.status===i.TransactionStatus.confirmed,status:g.status,transactionChainId:e?.transactionChainId??g.chainId??"unknown",paymentTokenAddress:e?.paymentTokenAddress??"unknown",paymentTokenChainId:e?.paymentTokenChainId??"unknown",...g.status===i.TransactionStatus.confirmed&&{strategy:e?.strategy??"unknown"}};(0,o.endTrace)({name:o.TraceName.MusdConversionConfirm,id:g.id,data:r}),n.current=null,d.current=null}var e}},[g,e,h,f]),(0,r.useEffect)(()=>()=>{t.current&&n.current&&((0,o.endTrace)({name:o.TraceName.MusdConversionConfirm,id:n.current,data:{success:!1,status:"unmounted"}}),t.current=!1,n.current=null,d.current=null)},[])}n.default=d}}},{package:"$root$",file:"ui/hooks/musd/useMusdConversionConfirmTrace.ts"}],[10338,{"../../../shared/constants/metametrics":8726,"../../contexts/metametrics":10151,"../../selectors/multichain":11582,"../../selectors/transactionPayController":11610,"../../selectors/transactions":11611,"./transaction-amount-utils":10330,"./transaction-status-constants":10331,"@metamask/transaction-controller":4006,"bignumber.js":6427,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useMusdConversionToastStatus=void 0;var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("@metamask/transaction-controller"),a=e("bignumber.js"),c=e("../../selectors/transactions"),u=e("../../selectors/transactionPayController"),l=e("../../contexts/metametrics"),d=e("../../../shared/constants/metametrics"),p=e("../../selectors/multichain"),m=e("./transaction-amount-utils"),h=e("./transaction-status-constants");const f=e=>e.type===o.TransactionType.musdConversion;function g(e){return h.IN_FLIGHT_STATUSES.includes(e.status)}function b(e){const t=(0,m.extractTransactionAmount)(e);return t?{amountHex:`0x${new a.BigNumber(t).toString(16)}`,amountDecimal:t}:{amountHex:"0x0",amountDecimal:"0"}}function y(e){return e.id}n.useMusdConversionToastStatus=()=>{const e=(0,r.c)(29),t=(0,i.useSelector)(c.getTransactions),{trackEvent:n}=(0,s.useContext)(l.MetaMetricsContext),a=(0,i.useSelector)(p.getMultichainNetworkConfigurationsByChainId),[m,k]=(0,s.useState)(null),[w,v]=(0,s.useState)(!1);let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=new Set,e[0]=T):T=e[0];const S=(0,s.useRef)(T);let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=new Set,e[1]=C):C=e[1];const P=(0,s.useRef)(C);let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=new Map,e[2]=_):_=e[2];const x=(0,s.useRef)(_);let I;e[3]!==t?(I=t.filter(f),e[3]=t,e[4]=I):I=e[4];const E=I;let M;e[5]!==E?(M=E.filter(g),e[5]=E,e[6]=M):M=e[6];const A=M,N=A.length>0,$=A[A.length-1]?.id;let O;e[7]!==$?(O=e=>$?(0,u.selectTransactionPaymentTokenByTransactionId)(e,$):undefined,e[7]=$,e[8]=O):O=e[8];const L=(0,i.useSelector)(O),[B,R]=(0,s.useState)(undefined),D=(0,s.useRef)(undefined);let F;e[9]!==$||e[10]!==L?(F=()=>{$!==D.current&&($!==undefined&&R(undefined),D.current=$),L?.symbol&&R(L.symbol)},e[9]=$,e[10]=L,e[11]=F):F=e[11];const j=L?.symbol;let U;e[12]!==$||e[13]!==j?(U=[$,j],e[12]=$,e[13]=j,e[14]=U):U=e[14],(0,s.useEffect)(F,U);const W=L?.symbol??B,H=b;let G;e[15]!==a||e[16]!==n?(G=(e,t,r)=>{const{chainId:s}=e,i=s?a[s]:null,o=i?.name??"Unknown Network",{amountHex:c,amountDecimal:u}=H(e),l={transaction_id:e.id,transaction_status:t,transaction_type:"musdConversion",asset_symbol:r??"Unknown",network_chain_id:s??"",network_name:o,amount_decimal:u,amount_hex:c};n({event:d.MetaMetricsEventName.MusdConversionStatusUpdated,category:d.MetaMetricsEventCategory.MusdConversion,properties:l})},e[15]=a,e[16]=n,e[17]=G):G=e[17];const z=G;let V,K,q;e[18]!==E||e[19]!==A||e[20]!==W||e[21]!==z?(V=()=>{const e=new Set(A.map(y));let t=!1;for(const e of E){const n=x.current.get(e.id)??new Set;if(h.IN_FLIGHT_STATUSES.includes(e.status)&&!n.has("approved")&&(z(e,"approved",W),n.add("approved"),x.current.set(e.id,n)),P.current.has(e.id))continue;const r=S.current.has(e.id);if(e.status===o.TransactionStatus.confirmed&&r)n.has("confirmed")||(z(e,"confirmed",W),n.add("confirmed"),x.current.set(e.id,n)),k("success"),v(!1),P.current.add(e.id),t=!0;else if((e.status===o.TransactionStatus.failed||e.status===o.TransactionStatus.dropped)&&r){const r=e.status===o.TransactionStatus.failed?"failed":"dropped";n.has(r)||(z(e,r,W),n.add(r),x.current.set(e.id,n)),k("failed"),v(!1),P.current.add(e.id),t=!0}}if(!t)for(const t of e)if(!S.current.has(t)){k(null),v(!1);break}S.current=e},K=[E,A,W,z],e[18]=E,e[19]=A,e[20]=W,e[21]=z,e[22]=V,e[23]=K):(V=e[22],K=e[23]),(0,s.useEffect)(V,K),e[24]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{k(null),v(!0)},e[24]=q):q=e[24];const Q=q;let Y,X=null;return w||(X=m??(N?"in-progress":null)),e[25]!==$||e[26]!==W||e[27]!==X?(Y={toastState:X,sourceTokenSymbol:W,activeTransactionId:$,dismissToast:Q},e[25]=$,e[26]=W,e[27]=X,e[28]=Y):Y=e[28],Y}}}},{package:"$root$",file:"ui/hooks/musd/useMusdConversionToastStatus.ts"}],[10339,{"../../../shared/lib/hexstring-utils":8856,"../../components/app/musd/constants":9167,"../../components/app/musd/utils/token-allowlist":9187,"../../pages/confirmations/types/send":11164,"../../selectors/assets":11565,"../../selectors/musd":11587,"./useMusdNetworkFilter":10343,"@metamask/controller-utils":1611,"@metamask/transaction-controller":4006,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,n.useMusdConversionTokens=f;var r=e("react-compiler-runtime"),s=e("@metamask/controller-utils"),i=(e("react"),e("react-redux")),o=e("@metamask/transaction-controller"),a=e("../../components/app/musd/constants"),c=e("../../../shared/lib/hexstring-utils"),u=e("../../pages/confirmations/types/send"),l=e("../../selectors/assets"),d=e("../../selectors/musd"),p=e("../../components/app/musd/utils/token-allowlist"),m=e("./useMusdNetworkFilter");function h(e){return e?"string"==typeof e&&e.startsWith("0x")?e.toLowerCase():(0,s.toHex)(e):"0x0"}function f(e){const t=(0,r.c)(39);let n;t[0]!==e?(n=e??{},t[0]=e,t[1]=n):n=t[1];const{transactionType:s}=n,{selectedChainId:a}=(0,m.useMusdNetworkFilter)(),f=(0,i.useSelector)(d.selectMusdConvertibleTokensAllowlist),y=(0,i.useSelector)(d.selectMusdConvertibleTokensBlocklist),k=(0,i.useSelector)(d.selectMusdMinAssetBalanceRequired),w=(0,i.useSelector)(l.getAssetsBySelectedAccountGroup);let v;t[2]!==w?(v=Object.entries(w).flatMap(b),t[2]=w,t[3]=v):v=t[3];const T=v;let S;t[4]!==k?(S=e=>{const t=function(e){return e.tokenFiatAmount!==undefined&&null!==e.tokenFiatAmount?e.tokenFiatAmount:e.fiat?.balance!==undefined&&null!==e.fiat?.balance?e.fiat.balance:null}(e);if(t===undefined||null===t)return!1;const n=Number(t);return!!Number.isFinite(n)&&n>=k},t[4]=k,t[5]=S):S=t[5];const C=S;let P;t[6]!==f||t[7]!==y?(P=e=>(0,p.checkTokenAllowed)(e.symbol,f,y,e.chainId),t[6]=f,t[7]=y,t[8]=P):P=t[8];const _=P;let x;t[9]!==_||t[10]!==C?(x=e=>e.filter(e=>_(e)).filter(e=>C(e)),t[9]=_,t[10]=C,t[11]=x):x=t[11];const I=x;let E;try{let e;t[12]!==T||t[13]!==I?(e=I(T),t[12]=T,t[13]=I,t[14]=e):e=t[14],E=e}catch{let e;t[15]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[15]=e):e=t[15],E=e}const M=E;let A;if(t[16]!==M||t[17]!==a){e:{if(0===M.length){A=null;break e}const e=a?M.find(e=>e.chainId&&h(e.chainId)===a):M[0];if(!e?.chainId||!e?.address){A=null;break e}const n=h(e.chainId);if(!n.startsWith("0x")){A=null;break e}let r;t[19]!==e?(r=(0,c.toChecksumHexAddress)(e.address),t[19]=e,t[20]=r):r=t[20];const s=n;let i;t[21]!==r||t[22]!==s?(i={address:r,chainId:s},t[21]=r,t[22]=s,t[23]=i):i=t[23],A=i}t[16]=M,t[17]=a,t[18]=A}else A=t[18];const N=A;let $;t[24]!==M?($=e=>M.some(t=>t.chainId&&h(t.chainId)===h(e)),t[24]=M,t[25]=$):$=t[25];const O=$;let L;t[26]!==M?(L=e=>{if(!e)return!1;if(!e.chainId)return!1;const t=h(e.chainId);return M.some(n=>e.address.toLowerCase()===n.address.toLowerCase()&&n.chainId&&h(n.chainId)===t)},t[26]=M,t[27]=L):L=t[27];const B=L,R=g;let D;t[28]!==_||t[29]!==C||t[30]!==s?(D=e=>s&&s!==o.TransactionType.musdConversion?e:e.filter(e=>{if(e.standard&&e.standard!==u.AssetStandard.ERC20)return!1;if(!e.symbol||!e.chainId)return!1;const t={address:e.address??"",chainId:String(e.chainId),symbol:e.symbol,fiat:e.fiat};return _(t)&&C(t)}),t[28]=_,t[29]=C,t[30]=s,t[31]=D):D=t[31];const F=D;let j;return t[32]!==M||t[33]!==N||t[34]!==I||t[35]!==F||t[36]!==O||t[37]!==B?(j={filterAllowedTokens:I,filterTokens:F,isConversionToken:B,isMusdSupportedOnChain:R,hasConvertibleTokensByChainId:O,tokens:M,defaultPaymentToken:N},t[32]=M,t[33]=N,t[34]=I,t[35]=F,t[36]=O,t[37]=B,t[38]=j):j=t[38],j}function g(e){if(!e)return!1;const t=h(e);return(0,a.isMusdSupportedChain)(t)}function b(e){const[t,n]=e;return(n??[]).filter(y).map(e=>{const n=e;return{...n,address:n.address,secondary:0,title:n.name??n.symbol??"",chainId:t,tokenFiatAmount:n.fiat?.balance??0}})}function y(e){return"address"in e&&"string"==typeof e.address}n.default=f}}},{package:"$root$",file:"ui/hooks/musd/useMusdConversionTokens.ts"}],[10340,{"../../components/app/musd/constants":9167,"../../components/app/musd/utils/token-allowlist":9187,"../../selectors/musd":11587,"./useMusdConversionTokens":10339,"./useMusdGeoBlocking":10341,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BuyGetMusdCtaVariant=void 0,Object.defineProperty(n,"checkTokenAllowed",{enumerable:!0,get:function(){return a.checkTokenAllowed}}),n.default=void 0,Object.defineProperty(n,"isTokenInWildcardList",{enumerable:!0,get:function(){return a.isTokenInWildcardList}}),n.useMusdCtaVisibility=p;var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../../selectors/musd"),o=e("../../components/app/musd/constants"),a=e("../../components/app/musd/utils/token-allowlist"),c=e("./useMusdGeoBlocking"),u=e("./useMusdConversionTokens");let l=n.BuyGetMusdCtaVariant=function(e){return e.BUY="buy",e.GET="get",e}({});const d={shouldShowCta:!1,selectedChainId:null,isEmptyWallet:!1,variant:null};function p(){const e=(0,r.c)(36),t=(0,s.useSelector)(i.selectIsMusdConversionFlowEnabled),n=(0,s.useSelector)(i.selectIsMusdCtaEnabled),p=(0,s.useSelector)(i.selectIsMusdTokenListItemCtaEnabled),h=(0,s.useSelector)(i.selectIsMusdAssetOverviewCtaEnabled),f=(0,s.useSelector)(i.selectMusdCtaTokens),{isBlocked:g,isLoading:b}=(0,c.useMusdGeoBlocking)(),y=(0,s.useSelector)(i.selectMusdConversionDismissedCtaKeys),{tokens:k}=(0,u.useMusdConversionTokens)();let w;if(e[0]!==k||e[1]!==f){let t;e[3]!==f?(t=e=>(0,a.isTokenInWildcardList)(e.symbol,f,e.chainId),e[3]=f,e[4]=t):t=e[4],w=k.filter(t),e[0]=k,e[1]=f,e[2]=w}else w=e[2];const v=w;let T;e[5]!==v?(T=e=>!(!e.address||!e.chainId)&&v.some(t=>e.address.toLowerCase()===t.address.toLowerCase()&&e.chainId.toLowerCase()===t.chainId.toLowerCase()),e[5]=v,e[6]=T):T=e[6];const S=T,C=m;let P;e[7]!==f?(P=(e,t)=>(0,a.isTokenInWildcardList)(e,f,t),e[7]=f,e[8]=P):P=e[8];const _=P;let x;e[9]!==y?(x=(e,t)=>{const n=C(e,t);return y.includes(n)},e[9]=y,e[10]=x):x=e[10];const I=x;let E;e[11]!==g||e[12]!==b||e[13]!==t||e[14]!==n?(E=e=>{const r=e===undefined?{}:e,{hasConvertibleTokens:s,hasMusdBalance:i,isEmptyWallet:a,selectedChainId:c}=r,u=s!==undefined&&s,p=i!==undefined&&i,m=a!==undefined&&a,h=c===undefined?null:c;if(!t||!n)return{...d,isEmptyWallet:m};if(b||g)return{...d,isEmptyWallet:m};if(p)return{...d,isEmptyWallet:m};if(u)return{shouldShowCta:!0,selectedChainId:h,isEmptyWallet:m,variant:l.GET};if(m){if(h?o.MUSD_BUYABLE_CHAIN_IDS.includes(h):o.MUSD_BUYABLE_CHAIN_IDS.length>0)return{shouldShowCta:!0,selectedChainId:h,isEmptyWallet:!0,variant:l.BUY}}return{...d,isEmptyWallet:m}},e[11]=g,e[12]=b,e[13]=t,e[14]=n,e[15]=E):E=e[15];const M=E;let A;e[16]!==g||e[17]!==b||e[18]!==t||e[19]!==p||e[20]!==S?(A=(e,n)=>{const r=n===undefined?{}:n,{hasMusdBalance:s}=r,i=s!==undefined&&s;return!(!t||!p)&&(!b&&!g&&(!(!e.address||!e.chainId)&&(!!(0,o.isMusdSupportedChain)(e.chainId)&&(!!S(e)&&i))))},e[16]=g,e[17]=b,e[18]=t,e[19]=p,e[20]=S,e[21]=A):A=e[21];const N=A;let $;e[22]!==I||e[23]!==g||e[24]!==b||e[25]!==h||e[26]!==t||e[27]!==S?($=e=>!(!t||!h)&&(!b&&!g&&(!(!e.address||!e.chainId)&&(!I(e.chainId,e.address)&&(!!(0,o.isMusdSupportedChain)(e.chainId)&&S(e))))),e[22]=I,e[23]=g,e[24]=b,e[25]=h,e[26]=t,e[27]=S,e[28]=$):$=e[28];const O=$;let L;return e[29]!==g||e[30]!==b||e[31]!==_||e[32]!==O||e[33]!==M||e[34]!==N?(L={shouldShowBuyGetMusdCta:M,shouldShowTokenListItemCta:N,shouldShowAssetOverviewCta:O,isTokenWithCta:_,getCtaKey:C,isGeoBlocked:g,isGeoBlockingLoading:b},e[29]=g,e[30]=b,e[31]=_,e[32]=O,e[33]=M,e[34]=N,e[35]=L):L=e[35],L}function m(e,t){return`${e.toLowerCase()}-${t.toLowerCase()}`}n.default=p}}},{package:"$root$",file:"ui/hooks/musd/useMusdCtaVisibility.ts"}],[10341,{"../../components/app/musd/utils":9185,"../../selectors/musd":11587,"../../store/background-connection":11615,react:7855,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,n.useMusdGeoBlocking=u;var r=e("react"),s=e("react-redux"),i=e("../../selectors/musd"),o=e("../../components/app/musd/utils"),a=e("../../store/background-connection");const c="UNKNOWN";function u(){const e=(0,s.useSelector)(i.selectMusdBlockedRegions),[t,n]=(0,r.useState)(null),[u,l]=(0,r.useState)(!0),[d,p]=(0,r.useState)(null),m=(0,r.useCallback)(async(e,t)=>{const r=()=>!t.isCancelled();if(!r())return null;l(!0),p(null);try{const t=await(0,a.submitRequestToBackground)(e),s=t===c?null:t;return r()&&n(s),s}catch(e){const t=e instanceof Error?e.message:"Failed to fetch geolocation";return r()&&(p(t),n(null)),null}finally{r()&&l(!1)}},[]);(0,r.useEffect)(()=>{let e=!1;return m("getGeolocation",{isCancelled:()=>e}),()=>{e=!0}},[m]);const h=(0,r.useCallback)(async()=>{await m("refreshGeolocation",{isCancelled:()=>!1})},[m]),f=!u&&(0,o.isGeoBlocked)(t,e);return{isBlocked:f,userCountry:t,isLoading:u,error:d,blockedRegions:e,blockedMessage:f?"mUSD conversion is not available in your region.":null,refreshGeolocation:h}}n.default=u}}},{package:"$root$",file:"ui/hooks/musd/useMusdGeoBlocking.ts"}],[10342,{"../../../shared/lib/hexstring-utils":8856,"../../components/app/musd/constants":9167,"../../helpers/utils/number-utils":10252,"../../selectors/assets":11565,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.useMusdMerklPosition=function(e){const t=(0,r.c)(7),n=e===undefined||e,d=(0,s.useSelector)(c.getAssetsBySelectedAccountGroup);let p;e:{if(!n){let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={aggregatedFiat:0,hasAnyBalance:!1},t[0]=e):e=t[0],p=e;break e}let e,r,s;if(t[1]!==d){const n=a.MERKL_ELIGIBLE_MUSD_CHAIN_IDS.map(e=>(d[e]??[]).find(l)).filter(u);e=0,r=!1;for(const t of n){const n=t.fiat?.balance;if("number"==typeof n&&Number.isFinite(n)&&(e+=n),!r){const e=t.rawBalance;r="string"==typeof e&&e.length>0?!(0,i.isEmptyHexString)(e):!(0,o.isZeroAmount)(t.balance??"0")}}t[1]=d,t[2]=e,t[3]=r}else e=t[2],r=t[3];t[4]!==e||t[5]!==r?(s={aggregatedFiat:e,hasAnyBalance:r},t[4]=e,t[5]=r,t[6]=s):s=t[6],p=s}return p};var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../../../shared/lib/hexstring-utils"),o=e("../../helpers/utils/number-utils"),a=e("../../components/app/musd/constants"),c=e("../../selectors/assets");function u(e){return Boolean(e)}function l(e){return"address"in e&&(0,a.isMusdToken)(e.address)}}}},{package:"$root$",file:"ui/hooks/musd/useMusdMerklPosition.ts"}],[10343,{"../../../shared/lib/selectors/multichain":8894,"@metamask/utils":4236,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,n.useMusdNetworkFilter=a;var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("@metamask/utils"),o=e("../../../shared/lib/selectors/multichain");function a(){const e=(0,r.c)(8),t=(0,s.useSelector)(o.getEnabledNetworks);let n;e[0]!==t?(n=t?.[i.KnownCaipNamespace.Eip155]??{},e[0]=t,e[1]=n):n=e[1];const a=n;let l;e[2]!==a?(l=Object.entries(a).filter(u).map(c),e[2]=a,e[3]=l):l=e[3];const d=l,p=d.length>1,m=p||1!==d.length?null:d[0];let h;return e[4]!==d||e[5]!==p||e[6]!==m?(h={isPopularNetworksFilterActive:p,selectedChainId:m,enabledChainIds:d},e[4]=d,e[5]=p,e[6]=m,e[7]=h):h=e[7],h}function c(e){const[t]=e;return t}function u(e){const[,t]=e;return t}n.default=a}}},{package:"$root$",file:"ui/hooks/musd/useMusdNetworkFilter.ts"}],[10344,{"../../components/app/musd/utils/transaction-utils":9188,"../../helpers/constants/routes":10205,"../../pages/confirmations/context/confirm":11001,"../../pages/confirmations/hooks/pay/useTransactionPayToken":11068,"../../store/actions":11613,"../../store/controller-actions/transaction-pay-controller":11619,"@metamask/rpc-errors":3442,react:7855,"react-redux":7818,"react-router-dom":7831},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,n.useMusdPaymentToken=m;var r=e("react"),s=e("react-redux"),i=e("react-router-dom"),o=e("@metamask/rpc-errors"),a=e("../../pages/confirmations/context/confirm"),c=e("../../pages/confirmations/hooks/pay/useTransactionPayToken"),u=e("../../components/app/musd/utils/transaction-utils"),l=e("../../store/actions"),d=e("../../store/controller-actions/transaction-pay-controller"),p=e("../../helpers/constants/routes");function m(){const{currentConfirmation:e}=(0,a.useConfirmContext)(),{setPayToken:t}=(0,c.useTransactionPayToken)(),n=(0,s.useDispatch)(),m=(0,i.useNavigate)(),h=(0,i.useLocation)(),[f,g]=(0,r.useState)(!1),b=(0,r.useRef)(!1),y=(0,r.useMemo)(()=>({addTransaction:async(e,t)=>(0,l.addTransaction)(e,t),findNetworkClientIdByChainId:async e=>(0,l.findNetworkClientIdByChainId)(e),updatePaymentToken:e=>{(0,d.updateTransactionPaymentToken)(e)},rejectApproval:async e=>{const t=(0,o.serializeError)(o.providerErrors.userRejectedRequest());await n((0,l.rejectPendingApproval)(e,t))}}),[n]);return{onPaymentTokenChange:(0,r.useCallback)(async n=>{if(b.current)return;const r=e?.chainId,s=n.chainId;if(s&&r&&s.toLowerCase()!==r.toLowerCase()&&e){b.current=!0,g(!0);let t=!1;try{const r=await(0,u.replaceMusdConversionTransactionForPayToken)(e,n,y);if(r){t=!0;const e=h.search;m(`${p.CONFIRM_TRANSACTION_ROUTE}/${r}${e}`,{replace:!0})}}catch(e){console.error("[mUSD Conversion] Failed to replace transaction from PayWithModal",e)}finally{b.current=!1,t||g(!1)}return}t(n)},[e,t,m,h.search,y]),isReplacing:f}}n.default=m}}},{package:"$root$",file:"ui/hooks/musd/useMusdPaymentToken.ts"}],[10345,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.clearAllCoalescedRequests=o,n.coalesceBackgroundRequest=async function(e,t,n=r){const o=Date.now(),a=s.get(e);if(a&&o-a.at<n)return a.value;const c=i.get(e);if(c!==undefined)return c;const u=Promise.resolve().then(async()=>{try{const n=await t();return i.get(e)===u&&s.set(e,{at:Date.now(),value:n}),n}finally{i.get(e)===u&&i.delete(e)}});return i.set(e,u),u},n.invalidateCoalescedRequest=function(e){s.delete(e)},n.resetCoalesceCacheForTests=function(){o()};const r=1e4,s=new Map,i=new Map;function o(){s.clear(),i.clear()}}}},{package:"$root$",file:"ui/hooks/perps/coalesceBackgroundRequest.ts"}],[10346,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getTradeableBalance=function(e){return e?.withdrawableBalance??e?.spendableBalance??"0"}}}},{package:"$root$",file:"ui/hooks/perps/getTradeableBalance.ts"}],[10347,{"./marginUtils":10348,"./usePerpsEligibility":10364,"./usePerpsEstimatedSlippage":10365,"./usePerpsEventTracking":10366,"./usePerpsLifecycleBreadcrumbs":10367,"./usePerpsMarginCalculations":10369,"./usePerpsMarketFills":10370,"./usePerpsMarketInfo":10371,"./usePerpsMaxSlippage":10372,"./usePerpsMeasurement":10373,"./usePerpsMetamaskFeeDiscountBips":10374,"./usePerpsOrderFees":10375,"./usePerpsOrderForm":10376,"./usePerpsTransactionHistory":10377,"./useUserHistory":10378},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"MARGIN_ADJUSTMENT_CONFIG",{enumerable:!0,get:function(){return b.MARGIN_ADJUSTMENT_CONFIG}}),Object.defineProperty(n,"estimateLiquidationPrice",{enumerable:!0,get:function(){return b.estimateLiquidationPrice}}),Object.defineProperty(n,"liquidationDistancePercent",{enumerable:!0,get:function(){return b.liquidationDistancePercent}}),Object.defineProperty(n,"maintenanceMarginRateFromMaxLeverage",{enumerable:!0,get:function(){return b.maintenanceMarginRateFromMaxLeverage}}),Object.defineProperty(n,"safeDenominator",{enumerable:!0,get:function(){return b.safeDenominator}}),Object.defineProperty(n,"usePerpsEligibility",{enumerable:!0,get:function(){return s.usePerpsEligibility}}),Object.defineProperty(n,"usePerpsEstimatedSlippage",{enumerable:!0,get:function(){return f.usePerpsEstimatedSlippage}}),Object.defineProperty(n,"usePerpsEventTracking",{enumerable:!0,get:function(){return g.usePerpsEventTracking}}),Object.defineProperty(n,"usePerpsLifecycleBreadcrumbs",{enumerable:!0,get:function(){return o.usePerpsLifecycleBreadcrumbs}}),Object.defineProperty(n,"usePerpsMarginCalculations",{enumerable:!0,get:function(){return m.usePerpsMarginCalculations}}),Object.defineProperty(n,"usePerpsMarketFills",{enumerable:!0,get:function(){return p.usePerpsMarketFills}}),Object.defineProperty(n,"usePerpsMarketInfo",{enumerable:!0,get:function(){return a.usePerpsMarketInfo}}),Object.defineProperty(n,"usePerpsMaxSlippage",{enumerable:!0,get:function(){return h.usePerpsMaxSlippage}}),Object.defineProperty(n,"usePerpsMeasurement",{enumerable:!0,get:function(){return i.usePerpsMeasurement}}),Object.defineProperty(n,"usePerpsMetamaskFeeDiscountBips",{enumerable:!0,get:function(){return u.usePerpsMetamaskFeeDiscountBips}}),Object.defineProperty(n,"usePerpsOrderFees",{enumerable:!0,get:function(){return c.usePerpsOrderFees}}),Object.defineProperty(n,"usePerpsOrderForm",{enumerable:!0,get:function(){return r.usePerpsOrderForm}}),Object.defineProperty(n,"usePerpsTransactionHistory",{enumerable:!0,get:function(){return d.usePerpsTransactionHistory}}),Object.defineProperty(n,"useUserHistory",{enumerable:!0,get:function(){return l.useUserHistory}});var r=e("./usePerpsOrderForm"),s=e("./usePerpsEligibility"),i=e("./usePerpsMeasurement"),o=e("./usePerpsLifecycleBreadcrumbs"),a=e("./usePerpsMarketInfo"),c=e("./usePerpsOrderFees"),u=e("./usePerpsMetamaskFeeDiscountBips"),l=e("./useUserHistory"),d=e("./usePerpsTransactionHistory"),p=e("./usePerpsMarketFills"),m=e("./usePerpsMarginCalculations"),h=e("./usePerpsMaxSlippage"),f=e("./usePerpsEstimatedSlippage"),g=e("./usePerpsEventTracking"),b=e("./marginUtils")}}},{package:"$root$",file:"ui/hooks/perps/index.ts"}],[10348,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MARGIN_ADJUSTMENT_CONFIG=void 0,n.assessMarginRemovalRisk=function(e){const{newLiquidationPrice:t,currentPrice:n,isLong:s}=e;if(!t||!n||Number.isNaN(t)||Number.isNaN(n))return{riskLevel:"safe",priceDiff:0,riskRatio:0};const i=s?n-t:t-n,o=i/t;let a;a=o<r.LiquidationRiskThreshold-1?"danger":o<r.LiquidationWarningThreshold-1?"warning":"safe";return{riskLevel:a,priceDiff:i,riskRatio:o}},n.calculateMaxRemovableMargin=function(e){const{currentMargin:t,positionSize:n,currentPrice:s,positionLeverage:i,notionalValue:o}=e;if(Number.isNaN(t)||Number.isNaN(i)||t<=0||i<=0)return 0;let a=o;if(a===undefined||Number.isNaN(a)||a<=0){if(Number.isNaN(n)||Number.isNaN(s)||n<=0||s<=0)return 0;a=n*s}const c=a/i,u=a*r.MarginRemovalSafetyBuffer,l=Math.max(c,u);return Math.max(0,t-l)},n.estimateLiquidationPrice=function(e){const{anchorLiquidationPrice:t,currentMargin:n,newMargin:o,positionSize:a,isLong:c,maxLeverage:u}=e;if(!(Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(o)&&Number.isFinite(a)&&Number.isFinite(u)))return t;if(0===o||0===a)return t;const l=i(u>0?u:r.FallbackMaxLeverage),d=s(a*(1-l)),p=t+(o-n)/d*(c?-1:1);return Math.max(0,p)},n.liquidationDistancePercent=function(e,t){if(null===t||!Number.isFinite(t)||!Number.isFinite(e)||0===e||t<=0)return 0;return Math.abs(e-t)/e*100},n.maintenanceMarginRateFromMaxLeverage=i,n.safeDenominator=s;const r=n.MARGIN_ADJUSTMENT_CONFIG={LiquidationRiskThreshold:1.2,LiquidationWarningThreshold:1.5,MarginRemovalSafetyBuffer:.1,MinAdjustmentAmount:1,FallbackMaxLeverage:50};function s(e,t=1e-12){return Number.isFinite(e)?Math.abs(e)<t?t:e:t}function i(e){const t=1/r.FallbackMaxLeverage;return!Number.isFinite(e)||e<=0?t:1/e}}}},{package:"$root$",file:"ui/hooks/perps/marginUtils.ts"}],[10349,{"./usePerpsChannel":10350,"./usePerpsLiveAccount":10351,"./usePerpsLiveCandles":10352,"./usePerpsLiveFills":10353,"./usePerpsLiveMarketData":10354,"./usePerpsLiveMarketListData":10355,"./usePerpsLiveOrderBook":10356,"./usePerpsLiveOrders":10357,"./usePerpsLivePositions":10358,"./usePerpsLivePrices":10359,"./usePerpsStreamManager":10360,"./usePerpsTopOfBook":10361,"./usePerpsViewActive":10362},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"usePerpsChannel",{enumerable:!0,get:function(){return i.usePerpsChannel}}),Object.defineProperty(n,"usePerpsLiveAccount",{enumerable:!0,get:function(){return u.usePerpsLiveAccount}}),Object.defineProperty(n,"usePerpsLiveCandles",{enumerable:!0,get:function(){return d.usePerpsLiveCandles}}),Object.defineProperty(n,"usePerpsLiveFills",{enumerable:!0,get:function(){return l.usePerpsLiveFills}}),Object.defineProperty(n,"usePerpsLiveMarketData",{enumerable:!0,get:function(){return h.usePerpsLiveMarketData}}),Object.defineProperty(n,"usePerpsLiveMarketListData",{enumerable:!0,get:function(){return f.usePerpsLiveMarketListData}}),Object.defineProperty(n,"usePerpsLiveOrderBook",{enumerable:!0,get:function(){return p.usePerpsLiveOrderBook}}),Object.defineProperty(n,"usePerpsLiveOrders",{enumerable:!0,get:function(){return c.usePerpsLiveOrders}}),Object.defineProperty(n,"usePerpsLivePositions",{enumerable:!0,get:function(){return a.usePerpsLivePositions}}),Object.defineProperty(n,"usePerpsLivePrices",{enumerable:!0,get:function(){return o.usePerpsLivePrices}}),Object.defineProperty(n,"usePerpsStreamManager",{enumerable:!0,get:function(){return r.usePerpsStreamManager}}),Object.defineProperty(n,"usePerpsTopOfBook",{enumerable:!0,get:function(){return m.usePerpsTopOfBook}}),Object.defineProperty(n,"usePerpsViewActive",{enumerable:!0,get:function(){return s.usePerpsViewActive}});var r=e("./usePerpsStreamManager"),s=e("./usePerpsViewActive"),i=e("./usePerpsChannel"),o=e("./usePerpsLivePrices"),a=e("./usePerpsLivePositions"),c=e("./usePerpsLiveOrders"),u=e("./usePerpsLiveAccount"),l=e("./usePerpsLiveFills"),d=e("./usePerpsLiveCandles"),p=e("./usePerpsLiveOrderBook"),m=e("./usePerpsTopOfBook"),h=e("./usePerpsLiveMarketData"),f=e("./usePerpsLiveMarketListData")}}},{package:"$root$",file:"ui/hooks/perps/stream/index.ts"}],[10350,{"./usePerpsStreamManager":10360,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsChannel=function(e,t,n){const{streamManager:i,isInitializing:o}=(0,s.usePerpsStreamManager)(),a=(0,r.useRef)(e);a.current=e;const c=(0,r.useRef)(t);c.current=t;const u=(0,r.useRef)(undefined),[l,d]=(0,r.useState)(()=>i?a.current(i).getCachedData():t),p=(0,r.useRef)(!1),[m,h]=(0,r.useState)(()=>{if(i){if(a.current(i).hasCachedData())return p.current=!0,!1}return!0});if((0,r.useLayoutEffect)(()=>{if(n===undefined||!i)return;const e=u.current;e!==undefined&&e!==n&&(a.current(i).clearCache(),p.current=!1,d(c.current),h(!0)),u.current=n},[n,i]),(0,r.useEffect)(()=>{if(o||!i)return;const e=a.current(i);e.hasCachedData()?(d(e.getCachedData()),p.current||(p.current=!0,h(!1))):(p.current=!1,d(c.current),h(!0));const t=e.subscribe(e=>{p.current||(p.current=!0,h(!1)),d(e)});return()=>{t()}},[i,o]),!i||o)return{data:t,isInitialLoading:!0};return{data:l,isInitialLoading:m}};var r=e("react"),s=e("./usePerpsStreamManager")}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsChannel.ts"}],[10351,{"./usePerpsChannel":10350,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLiveAccount=function(e){const t=(0,r.c)(3);undefined;const{data:n,isInitialLoading:o}=(0,s.usePerpsChannel)(i,null);let a;t[0]!==n||t[1]!==o?(a={account:n,isInitialLoading:o},t[0]=n,t[1]=o,t[2]=a):a=t[2];return a};var r=e("react-compiler-runtime"),s=e("./usePerpsChannel");function i(e){return e.account}}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLiveAccount.ts"}],[10352,{"../../../providers/perps/PerpsStreamManager":11551,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLiveCandles=function(e){const{symbol:t,interval:n,duration:i,throttleMs:o=1e3,onError:a}=e,[c,u]=(0,r.useState)(null),[l,d]=(0,r.useState)(!0),[p,m]=(0,r.useState)(!1),[h,f]=(0,r.useState)(null),g=(0,r.useRef)(!1),b=(0,r.useRef)(t),y=(0,r.useRef)(n);b.current=t,y.current=n,(0,r.useEffect)(()=>{if(u(null),d(!0),f(null),g.current=!1,!t||!n)return u(null),d(!1),undefined;const e=(0,s.getPerpsStreamManager)().candles.subscribe({symbol:t,interval:n,duration:i,throttleMs:o,callback:e=>{e.symbol===b.current&&e.interval===y.current&&(g.current||(g.current=!0,d(!1)),f(null),u(e))},onError:e=>{f(e),g.current||d(!1),a?.(e)}});return()=>{e()}},[t,n,i,o,a]);const k=(0,r.useCallback)(()=>{if(p||!t||!n||!i)return;m(!0);(0,s.getPerpsStreamManager)().candles.fetchHistoricalCandles(t,n,i).catch(e=>{console.error("[usePerpsLiveCandles] fetchMoreHistory failed:",e)}).finally(()=>{m(!1)})},[t,n,i,p]),w=Boolean(c?.candles&&c.candles.length>0);return{candleData:c,isInitialLoading:l,isLoadingMore:p,hasHistoricalData:w,error:h,fetchMoreHistory:k}};var r=e("react"),s=e("../../../providers/perps/PerpsStreamManager")}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLiveCandles.ts"}],[10353,{"./usePerpsChannel":10350,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLiveFills=function(e){const t=(0,r.c)(4);let n;undefined,t[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],t[0]=n):n=t[0];const{data:o,isInitialLoading:a}=(0,s.usePerpsChannel)(i,n);let c;t[1]!==o||t[2]!==a?(c={fills:o,isInitialLoading:a},t[1]=o,t[2]=a,t[3]=c):c=t[3];return c};var r=e("react-compiler-runtime"),s=e("./usePerpsChannel");const i=e=>e.fills}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLiveFills.ts"}],[10354,{"../../../components/app/perps/utils":9348,"./usePerpsStreamManager":10360,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLiveMarketData=function(e={}){const{autoSubscribe:t=!0}=e,{streamManager:n,isInitializing:a}=(0,i.usePerpsStreamManager)(),[c,u]=(0,r.useState)(()=>n?n.markets.getCachedData():o),[l,d]=(0,r.useState)(null),p=(0,r.useRef)(!1),[m,h]=(0,r.useState)(()=>!n?.markets.hasCachedData()||(p.current=!0,!1)),f=(0,r.useCallback)((e,t)=>(0,s.parseVolume)(t.volume)-(0,s.parseVolume)(e.volume),[]),g=(0,r.useMemo)(()=>c.filter(s.hasVolume).sort(f),[c,f]),b=(0,r.useMemo)(()=>g.filter(e=>!e.marketSource),[g]),y=(0,r.useMemo)(()=>g.filter(e=>e.marketSource),[g]),k=(0,r.useCallback)(()=>{n&&n.markets.refresh()},[n]);if((0,r.useEffect)(()=>{if(a||!n)return;if(!t)return void h(!1);if(n.markets.hasCachedData()){const e=n.markets.getCachedData();u(e),p.current||(p.current=!0,h(!1))}const e=n.markets.subscribe(e=>{p.current||(p.current=!0,h(!1)),u(e),d(null)});return()=>{e()}},[n,a,t]),!n||a)return{markets:o,cryptoMarkets:o,hip3Markets:o,isInitialLoading:!0,error:null,refresh:k};return{markets:g,cryptoMarkets:b,hip3Markets:y,isInitialLoading:m,error:l,refresh:k}};var r=e("react"),s=e("../../../components/app/perps/utils"),i=e("./usePerpsStreamManager");const o=[]}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLiveMarketData.ts"}],[10355,{"../../../components/app/perps/utils/formatPerpsDisplayPrice":9349,"./usePerpsLiveMarketData":10354,"./usePerpsLivePrices":10359,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLiveMarketListData=function(e){const t=(0,r.c)(37);let n;t[0]!==e?(n=e===undefined?{}:e,t[0]=e,t[1]=n):n=t[1];const p=n,{refreshIntervalMs:m}=p,h=m===undefined?c:m,{markets:f,cryptoMarkets:g,hip3Markets:b,isInitialLoading:y,error:k,refresh:w}=(0,o.usePerpsLiveMarketData)();let v;t[2]!==f?(v=Array.from(new Set(f.map(d))).sort(l),t[2]=f,t[3]=v):v=t[3];const T=v;let S;t[4]!==T?(S=T.join("|"),t[4]=T,t[5]=S):S=t[5];const C=S;let P;t[6]!==T?(P={symbols:T,activateStream:!0,includeMarketData:!1},t[6]=T,t[7]=P):P=t[7];const{prices:_}=(0,a.usePerpsLivePrices)(P);let x,I,E;t[8]!==C||t[9]!==w||t[10]!==h?(x=()=>{if(!C)return;const e=globalThis.setInterval(()=>{w()},h);return()=>globalThis.clearInterval(e)},I=[C,w,h],t[8]=C,t[9]=w,t[10]=h,t[11]=x,t[12]=I):(x=t[11],I=t[12]);(0,s.useEffect)(x,I);e:{if(0===Object.keys(_).length){E=f;break e}let e;if(t[13]!==f||t[14]!==_){let n;t[16]!==_?(n=e=>{const t=_[e.symbol];return t?{...e,price:t.price?(0,i.formatPerpsFiatUniversal)(t.price):e.price,change24hPercent:t.percentChange24h??e.change24hPercent}:e},t[16]=_,t[17]=n):n=t[17],e=f.map(n),t[13]=f,t[14]=_,t[15]=e}else e=t[15];E=e}const M=E;let A;t[18]!==M?(A=new Map(M.map(u)),t[18]=M,t[19]=A):A=t[19];const N=A;let $;if(t[20]!==g||t[21]!==N){let e;t[23]!==N?(e=e=>N.get(e.symbol)??e,t[23]=N,t[24]=e):e=t[24],$=g.map(e),t[20]=g,t[21]=N,t[22]=$}else $=t[22];const O=$;let L;if(t[25]!==b||t[26]!==N){let e;t[28]!==N?(e=e=>N.get(e.symbol)??e,t[28]=N,t[29]=e):e=t[29],L=b.map(e),t[25]=b,t[26]=N,t[27]=L}else L=t[27];const B=L;let R;t[30]!==k||t[31]!==y||t[32]!==O||t[33]!==B||t[34]!==M||t[35]!==w?(R={markets:M,cryptoMarkets:O,hip3Markets:B,isInitialLoading:y,error:k,refresh:w},t[30]=k,t[31]=y,t[32]=O,t[33]=B,t[34]=M,t[35]=w,t[36]=R):R=t[36];return R};var r=e("react-compiler-runtime"),s=e("react"),i=e("../../../components/app/perps/utils/formatPerpsDisplayPrice"),o=e("./usePerpsLiveMarketData"),a=e("./usePerpsLivePrices");const c=3e4;function u(e){return[e.symbol,e]}function l(e,t){return e.localeCompare(t)}function d(e){return e.symbol}}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLiveMarketListData.ts"}],[10356,{"../../../store/background-connection":11615,"./usePerpsChannel":10350,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLiveOrderBook=function(e){const t=(0,r.c)(11),{symbol:n,levels:u,nSigFigs:d,mantissa:p,enabled:m,manageStream:h}=e,f=m===undefined||m,g=h===undefined||h,b=f?n:undefined,{data:y,isInitialLoading:k}=(0,o.usePerpsChannel)(a,null,b||undefined);let w,v;t[0]!==f||t[1]!==u||t[2]!==g||t[3]!==p||t[4]!==d||t[5]!==n?(w=()=>{if(g&&f&&n)return(0,i.submitRequestToBackground)("perpsActivateOrderBookStream",[{symbol:n,levels:u,nSigFigs:d,mantissa:p}]).catch(l),c},v=[g,f,n,u,d,p],t[0]=f,t[1]=u,t[2]=g,t[3]=p,t[4]=d,t[5]=n,t[6]=w,t[7]=v):(w=t[6],v=t[7]);(0,s.useEffect)(w,v);const T=k||!b;let S;t[8]!==y||t[9]!==T?(S={orderBook:y,isInitialLoading:T},t[8]=y,t[9]=T,t[10]=S):S=t[10];return S};var r=e("react-compiler-runtime"),s=e("react"),i=e("../../../store/background-connection"),o=e("./usePerpsChannel");const a=e=>e.orderBook;function c(){(0,i.submitRequestToBackground)("perpsDeactivateOrderBookStream",[]).catch(u)}function u(){}function l(){}}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLiveOrderBook.ts"}],[10357,{"./usePerpsChannel":10350,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLiveOrders=function(e){const t=(0,r.c)(3);undefined;const{data:n,isInitialLoading:a}=(0,s.usePerpsChannel)(o,i);let c;t[0]!==a||t[1]!==n?(c={orders:n,isInitialLoading:a},t[0]=a,t[1]=n,t[2]=c):c=t[2];return c};var r=e("react-compiler-runtime"),s=e("./usePerpsChannel");const i=[];function o(e){return e.orders}}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLiveOrders.ts"}],[10358,{"./usePerpsChannel":10350,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLivePositions=function(e){const t=(0,r.c)(3);undefined;const{data:n,isInitialLoading:a}=(0,s.usePerpsChannel)(o,i);let c;t[0]!==a||t[1]!==n?(c={positions:n,isInitialLoading:a},t[0]=a,t[1]=n,t[2]=c):c=t[2];return c};var r=e("react-compiler-runtime"),s=e("./usePerpsChannel");const i=[];function o(e){return e.positions}}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLivePositions.ts"}],[10359,{"../../../store/background-connection":11615,"./usePerpsChannel":10350,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLivePrices=function(e){const t=(0,r.c)(15),{symbols:n,activateStream:d,includeMarketData:h}=e,f=d!==undefined&&d,g=h!==undefined&&h;let b;t[0]!==n?(b=Array.from(new Set(n)).sort(m).join("|"),t[0]=n,t[1]=b):b=t[1];const y=b;let k,w;t[2]!==f||t[3]!==g||t[4]!==y?(k=()=>{if(!f||!y)return;const e=y.split("|");return(0,i.submitRequestToBackground)("perpsActivatePriceStream",[{symbols:e,includeMarketData:g}]).catch(p),l},w=[f,g,y],t[2]=f,t[3]=g,t[4]=y,t[5]=k,t[6]=w):(k=t[5],w=t[6]);(0,s.useEffect)(k,w);const{data:v,isInitialLoading:T}=(0,o.usePerpsChannel)(u,a);let S;t[7]!==y?(S=y?new Set(y.split("|")):new Set,t[7]=y,t[8]=S):S=t[8];const C=S;let P;e:{if(T||0===v.length){P=c;break e}let e;t[9]!==v||t[10]!==C?(e={},v.forEach(t=>{(0===C.size||C.has(t.symbol))&&(e[t.symbol]={...t,timestamp:t.timestamp??Date.now(),markPrice:t.markPrice})}),t[9]=v,t[10]=C,t[11]=e):e=t[11],P=e}const _=P;let x;t[12]!==T||t[13]!==_?(x={prices:_,isInitialLoading:T},t[12]=T,t[13]=_,t[14]=x):x=t[14];return x};var r=e("react-compiler-runtime"),s=e("react"),i=e("../../../store/background-connection"),o=e("./usePerpsChannel");const a=[],c={},u=e=>e.prices;function l(){(0,i.submitRequestToBackground)("perpsDeactivatePriceStream",[]).catch(d)}function d(e){console.debug("[usePerpsLivePrices] perpsDeactivatePriceStream failed:",e)}function p(e){console.debug("[usePerpsLivePrices] perpsActivatePriceStream failed:",e)}function m(e,t){return e.localeCompare(t)}}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsLivePrices.ts"}],[10360,{"../../../../shared/lib/selectors/accounts":8890,"../../../providers/perps/PerpsStreamManager":11551,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsStreamManager=function(){const e=(0,r.c)(11),t=(0,i.useSelector)(o.getSelectedInternalAccount),n=t?.address??null;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.getPerpsStreamManager)(),e[0]=c):c=e[0];const u=c;let l;e[1]!==n?(l=()=>null!==n&&u.isInitialized(n),e[1]=n,e[2]=l):l=e[2];const[d,p]=(0,s.useState)(l),[m,h]=(0,s.useState)(null);let f,g;e[3]!==n?(f=()=>{if(!n)return p(!1),void h(new Error("No account selected"));if(u.isInitialized(n))return p(!0),void h(null);let e=!1;return p(!1),h(null),u.initForAddress(n).then(()=>{e||p(!0)}).catch(t=>{e||(console.error("[usePerpsStreamManager] Init failed:",t),h(t instanceof Error?t:new Error(String(t))))}),()=>{e=!0}},g=[n,u],e[3]=n,e[4]=f,e[5]=g):(f=e[4],g=e[5]);(0,s.useEffect)(f,g);const b=d?u:null,y=!d&&!m&&null!==n;let k;e[6]!==m||e[7]!==n||e[8]!==b||e[9]!==y?(k={streamManager:b,isInitializing:y,error:m,selectedAddress:n},e[6]=m,e[7]=n,e[8]=b,e[9]=y,e[10]=k):k=e[10];return k};var r=e("react-compiler-runtime"),s=e("react"),i=e("react-redux"),o=e("../../../../shared/lib/selectors/accounts"),a=e("../../../providers/perps/PerpsStreamManager")}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsStreamManager.ts"}],[10361,{"../../../store/background-connection":11615,"./usePerpsChannel":10350,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsTopOfBook=function(e){const t=(0,r.c)(9),{symbol:n}=e,[l,d]=(0,s.useState)(undefined),{data:p,isInitialLoading:m}=(0,o.usePerpsChannel)(a,null,n||undefined);let h,f,g,b;t[0]!==n?(h=()=>{if(n)return(0,i.submitRequestToBackground)("perpsActivateOrderBookStream",[{symbol:n}]).catch(u),c},f=[n],t[0]=n,t[1]=h,t[2]=f):(h=t[1],f=t[2]);(0,s.useEffect)(h,f),t[3]!==p?(g=()=>{if(p)if(p.bids.length>0&&p.asks.length>0){const e=p.bids[0],t=p.asks[0];d({bestBid:e.price,bestBidSize:e.size,bestAsk:t.price,bestAskSize:t.size,spread:p.spread,spreadPercent:p.spreadPercentage,midPrice:p.midPrice})}else d(undefined);else d(undefined)},b=[p],t[3]=p,t[4]=g,t[5]=b):(g=t[4],b=t[5]);(0,s.useEffect)(g,b);const y=m||!n;let k;t[6]!==y||t[7]!==l?(k={topOfBook:l,isInitialLoading:y},t[6]=y,t[7]=l,t[8]=k):k=t[8];return k};var r=e("react-compiler-runtime"),s=e("react"),i=e("../../../store/background-connection"),o=e("./usePerpsChannel");const a=e=>e.orderBook;function c(){(0,i.submitRequestToBackground)("perpsDeactivateOrderBookStream",[])}function u(e){return console.warn("[usePerpsTopOfBook] activate streaming failed:",e)}}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsTopOfBook.ts"}],[10362,{"../../../store/background-connection":11615,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsViewActive=function(e){const t=(0,r.c)(3);let n,o;t[0]!==e?(n=()=>((0,i.submitRequestToBackground)("perpsViewActive",[!0]).catch(t=>{console.debug(`[${e}] perpsViewActive(true) failed:`,t)}),()=>{(0,i.submitRequestToBackground)("perpsViewActive",[!1]).catch(t=>{console.debug(`[${e}] perpsViewActive(false) failed:`,t)})}),o=[e],t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]);(0,s.useEffect)(n,o)};var r=e("react-compiler-runtime"),s=e("react"),i=e("../../../store/background-connection")}}},{package:"$root$",file:"ui/hooks/perps/stream/usePerpsViewActive.ts"}],[10363,{"../../../shared/lib/selectors/accounts":8890,"../../providers/perps/perps-cache":11554,"../../selectors/perps-controller":11594,react:7855,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsCacheKey=function(){const e=(0,r.c)(4),t=(0,s.useSelector)(o.selectPerpsActiveProvider),n=(0,s.useSelector)(o.selectPerpsIsTestnet),c=(0,s.useSelector)(i.getSelectedInternalAccount),u=c?.address;let l;e[0]!==t||e[1]!==n||e[2]!==u?(l=(0,a.buildPerpsCacheKey)(t,n,u),e[0]=t,e[1]=n,e[2]=u,e[3]=l):l=e[3];return l};var r=e("react-compiler-runtime"),s=(e("react"),e("react-redux")),i=e("../../../shared/lib/selectors/accounts"),o=e("../../selectors/perps-controller"),a=e("../../providers/perps/perps-cache")}}},{package:"$root$",file:"ui/hooks/perps/usePerpsCacheKey.ts"}],[10364,{"../../selectors/perps-controller":11594,"react-compiler-runtime":7766,"react-redux":7818},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsEligibility=function(){const e=(0,r.c)(2),t=(0,s.useSelector)(i.selectPerpsIsEligible);let n;e[0]!==t?(n={isEligible:t},e[0]=t,e[1]=n):n=e[1];return n};var r=e("react-compiler-runtime"),s=e("react-redux"),i=e("../../selectors/perps-controller")}}},{package:"$root$",file:"ui/hooks/perps/usePerpsEligibility.ts"}],[10365,{"../../components/app/perps/utils/slippageCalculation":9351,"./stream/usePerpsLiveOrderBook":10356,"@metamask/perps-controller":3103,react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsEstimatedSlippage=function(e){const t=(0,r.c)(10),{symbol:n,sizeUsd:c,isBuy:u,enabled:l}=e,d=l===undefined||l;let p;t[0]!==d||t[1]!==n?(p={symbol:n,levels:i.PERFORMANCE_CONFIG.SlippageEstimateBookLevels,enabled:d,manageStream:!1},t[0]=d,t[1]=n,t[2]=p):p=t[2];const{orderBook:m,isInitialLoading:h}=(0,a.usePerpsLiveOrderBook)(p),f=function(e,t,n){const i=(0,r.c)(5),[o,a]=(0,s.useState)(e),c=(0,s.useRef)(0),u=(0,s.useRef)(),l=(0,s.useRef)(n);let d,p;i[0]!==n||i[1]!==t||i[2]!==e?(d=()=>{if(n!==undefined&&n!==l.current)return l.current=n,c.current=Date.now(),a(e),()=>{window.clearTimeout(u.current)};const r=Date.now()-c.current,s=()=>{c.current=Date.now(),a(e)};return r>=t?s():(window.clearTimeout(u.current),u.current=window.setTimeout(s,t-r)),()=>{window.clearTimeout(u.current)}},p=[e,t,n],i[0]=n,i[1]=t,i[2]=e,i[3]=d,i[4]=p):(d=i[3],p=i[4]);return(0,s.useEffect)(d,p),o}(m,i.PERFORMANCE_CONFIG.SlippageEstimateThrottleMs,n);let g;e:{if(!d||!c||c<=0){g=null;break e}let e;t[3]!==u||t[4]!==c||t[5]!==f?(e=(0,o.calculateEstimatedSlippageBps)({orderBook:f,sizeUsd:c,isBuy:u}),t[3]=u,t[4]=c,t[5]=f,t[6]=e):e=t[6],g=e}const b=g,y=!h&&null!==f;let k;t[7]!==b||t[8]!==y?(k={estimatedSlippageBps:b,isReady:y},t[7]=b,t[8]=y,t[9]=k):k=t[9];return k};var r=e("react-compiler-runtime"),s=e("react"),i=e("@metamask/perps-controller"),o=e("../../components/app/perps/utils/slippageCalculation"),a=e("./stream/usePerpsLiveOrderBook")}}},{package:"$root$",file:"ui/hooks/perps/usePerpsEstimatedSlippage.ts"}],[10366,{"../../../shared/constants/metametrics":8726,"../../../shared/constants/perps-events":8736,"../../contexts/metametrics":10151,react:7855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsEventTracking=function(e){const{trackEvent:t}=(0,r.useContext)(i.MetaMetricsContext),n=(0,r.useRef)(!1),a=(0,r.useCallback)((e,n)=>{t({event:e,category:o.MetaMetricsEventCategory.Perps,properties:{...n,[s.PERPS_EVENT_PROPERTY.TIMESTAMP]:Date.now()}})},[t]),c=(0,r.useMemo)(()=>({track:a}),[a]),u=e?.resetKey,l=(0,r.useRef)(u);l.current!==u&&(l.current=u,n.current=!1);if((0,r.useEffect)(()=>{if(!e)return;const{eventName:r,conditions:i,properties:a}=e;i?n.current||(n.current=!0,t({event:r,category:o.MetaMetricsEventCategory.Perps,properties:{...a,[s.PERPS_EVENT_PROPERTY.TIMESTAMP]:Date.now()}})):n.current=!1},[e,t]),e)return undefined;return c};var r=e("react"),s=e("../../../shared/constants/perps-events"),i=e("../../contexts/metametrics"),o=e("../../../shared/constants/metametrics")}}},{package:"$root$",file:"ui/hooks/perps/usePerpsEventTracking.ts"}],[10367,{react:7855,"react-compiler-runtime":7766},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.usePerpsLifecycleBreadcrumbs=function(){const e=(0,r.c)(1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];(0,s.useEffect)(i,t)};var r=e("react-compiler-runtime"),s=e("react");function i(){globalThis.sentry?.addBreadcrumb?.({category:"perps.lifecycle",message:"Perps popup opened",level:"info"});const e=a,t=o;return document.addEventListener("visibilitychange",e),window.addEventListener("beforeunload",t),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("beforeunload",t)}}function o(){globalThis.sentry?.addBreadcrumb?.({category:"perps.lifecycle",message:"Perps popup closing",level:"info"})}function a(){document.hidden?globalThis.sentry?.addBreadcrumb?.({category:"perps.lifecycle",message:"Perps popup hidden",level:"info",data:{visibilityState:document.visibilityState}}):globalThis.sentry?.addBreadcrumb?.({category:"perps.lifecycle",message:"Perps popup visible",level:"info"})}}}},{package:"$root$",file:"ui/hooks/perps/usePerpsLifecycleBreadcrumbs.ts"}]],[],{});