import"../../../ui/components/icon_button/icon_button.js";import*as e from"../../../core/i18n/i18n.js";import*as t from"../../../ui/lit/lit.js";import{render as o,html as r,nothing as s}from"../../../ui/lit/lit.js";import*as n from"../../../ui/visual_logging/visual_logging.js";import*as i from"../../../core/platform/platform.js";import*as a from"../../../ui/components/input/input.js";import"../../../ui/components/buttons/buttons.js";import*as l from"../../../core/common/common.js";var d={cssText:`.highlight-chip-list{min-height:20px;display:flex;flex-wrap:wrap;justify-content:left;align-items:center;background-color:var(--sys-color-cdt-base-container);margin:8px 0;gap:8px;row-gap:6px}.highlight-chip{background:var(--sys-color-cdt-base-container);border:1px solid var(--sys-color-divider);height:18px;border-radius:4px;flex:0 0 auto;max-width:250px;position:relative;padding:0 6px}.highlight-chip:hover{background-color:var(--sys-color-state-hover-on-subtle)}.delete-highlight-container{display:none;height:100%;position:absolute;right:0;top:0;border-radius:4px;width:24px;align-items:center;justify-content:center}.delete-highlight-button{cursor:pointer;width:13px;height:13px;border:none;background-color:transparent;display:flex;align-items:center;justify-content:center}.delete-highlight-button:hover{background-color:var(--sys-color-state-hover-on-subtle);border-radius:50%}.jump-to-highlight-button{cursor:pointer;padding:0;border:none;background:none;height:100%;align-items:center;max-width:100%;overflow:hidden}.delete-highlight-button devtools-icon{width:13px;height:13px;display:flex;align-items:center;justify-content:center;border-radius:50%}.source-code{font-family:var(--source-code-font-family);font-size:var(--source-code-font-size);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sys-color-on-surface)}.value{color:var(--sys-color-token-tag)}.separator{white-space:pre;flex-shrink:0}.highlight-chip.focused{outline:2px solid var(--sys-color-state-focus-ring);outline-offset:2px}.highlight-chip:hover > .delete-highlight-container{display:flex;background:linear-gradient(90deg,transparent 0%,rgb(241 243 244) 25%)}.highlight-chip.focused:hover > .delete-highlight-container{background:linear-gradient(90deg,transparent 0%,rgb(231 241 253) 25%)}:host-context(.theme-with-dark-background) .highlight-chip:hover > .delete-highlight-container{display:flex;background:linear-gradient(90deg,transparent 0%,rgb(41 42 45) 25%)}:host-context(.theme-with-dark-background) .highlight-chip.focused:hover > .delete-highlight-container{background:linear-gradient(90deg,transparent 0%,rgb(48 55 68) 25%)}\n/*# sourceURL=${import.meta.resolve("./linearMemoryHighlightChipList.css")} */\n`};const c=new CSSStyleSheet;c.replaceSync(d.cssText);const h={jumpToAddress:"Jump to this memory",deleteHighlight:"Stop highlighting this memory"},p=e.i18n.registerUIStrings("panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts",h),u=e.i18n.getLocalizedString.bind(void 0,p),{render:g,html:v}=t;class m extends Event{static eventName="deletememoryhighlight";data;constructor(e){super(m.eventName,{bubbles:!0,composed:!0}),this.data=e}}class b extends Event{static eventName="jumptohighlightedmemory";data;constructor(e){super(b.eventName),this.data=e}}class y extends HTMLElement{#e=this.attachShadow({mode:"open"});#t=[];#o;connectedCallback(){this.#e.adoptedStyleSheets=[c]}set data(e){this.#t=e.highlightInfos,this.#o=e.focusedMemoryHighlight,this.#r()}#r(){const e=[];for(const t of this.#t)e.push(this.#s(t));const t=v`
            <div class="highlight-chip-list">
              ${e}
            </div>
        `;g(t,this.#e,{host:this})}#s(e){const o=e.name||"<anonymous>",r=e.type,s={focused:e===this.#o,"highlight-chip":!0};return v`
      <div class=${t.Directives.classMap(s)}>
        <button class="jump-to-highlight-button" title=${u(h.jumpToAddress)}
            jslog=${n.action("linear-memory-inspector.jump-to-highlight").track({click:!0})}
            @click=${()=>this.#n(e.startAddress)}>
          <span class="source-code">
            <span class="value">${o}</span><span class="separator">: </span><span>${r}</span>
          </span>
        </button>
        <div class="delete-highlight-container">
          <button class="delete-highlight-button" title=${u(h.deleteHighlight)}
              jslog=${n.action("linear-memory-inspector.delete-highlight").track({click:!0})}
              @click=${()=>this.#i(e)}>
            <devtools-icon .data=${{iconName:"cross",color:"var(--icon-default-hover)",width:"16px"}}>
            </devtools-icon>
          </button>
        </div>
      </div>
    `}#n(e){this.dispatchEvent(new b(e))}#i(e){this.dispatchEvent(new m(e))}}customElements.define("devtools-linear-memory-highlight-chip-list",y);var f=Object.freeze({__proto__:null,DeleteMemoryHighlightEvent:m,JumpToHighlightedMemoryEvent:b,LinearMemoryHighlightChipList:y}),x={cssText:`*{box-sizing:border-box;min-width:0;min-height:0}:root{height:100%;overflow:hidden;interpolate-size:allow-keywords}body{height:100%;width:100%;position:relative;overflow:hidden;margin:0;cursor:default;font-family:var(--default-font-family);font-size:12px;tab-size:4;user-select:none;color:var(--sys-color-on-surface);background:var(--sys-color-cdt-base-container)}:focus{outline-width:0}.monospace{font-family:var(--monospace-font-family);font-size:var(\n    --monospace-font-size\n  )!important}.source-code{font-family:var(--source-code-font-family);font-size:var(\n    --source-code-font-size\n  )!important;white-space:pre-wrap;&:not(input)::selection{color:var(--sys-color-on-surface)}}.source-code.breakpoint{white-space:nowrap}.source-code .devtools-link.text-button{max-width:100%;overflow:hidden;text-overflow:ellipsis}img{-webkit-user-drag:none}iframe,\na img{border:none}.fill{position:absolute;inset:0}iframe.fill{width:100%;height:100%}.widget{position:relative;flex:auto;contain:style}.hbox{display:flex;flex-direction:row!important;position:relative}.vbox{display:flex;flex-direction:column!important;position:relative}.view-container > devtools-toolbar{border-bottom:1px solid var(--sys-color-divider)}.flex-auto{flex:auto}.flex-none{flex:none}.flex-centered{display:flex;align-items:center;justify-content:center}.overflow-auto{overflow:auto;background-color:var(--sys-color-cdt-base-container)}iframe.widget{position:absolute;width:100%;height:100%;inset:0}.hidden{display:none!important}.highlighted-search-result{border-radius:1px;background-color:var(--sys-color-yellow-container);outline:1px solid var(--sys-color-yellow-container)}.link{cursor:pointer;text-decoration:underline;color:var(--sys-color-primary);outline-offset:2px}button,\ninput,\nselect{font-family:inherit;font-size:inherit}select option,\nselect optgroup,\ninput{background-color:var(--sys-color-cdt-base-container)}input{color:inherit;&[type="checkbox"]{position:relative;outline:none;display:flex;align-items:center;justify-content:center;&:hover::after,\n    &:active::before{content:"";height:24px;width:24px;border-radius:var(--sys-shape-corner-full);position:absolute}&:not(.-theme-preserve){accent-color:var(--sys-color-primary-bright);color:var(--sys-color-on-primary)}&:not(:disabled):hover::after{background-color:var(--sys-color-state-hover-on-subtle)}&:not(:disabled):active::before{background-color:var(--sys-color-state-ripple-neutral-on-subtle)}&:not(:disabled):focus-visible::before{content:"";height:15px;width:15px;border-radius:5px;position:absolute;border:2px solid var(--sys-color-state-focus-ring)}&.small:hover::after,\n    &.small:active::before{height:12px;width:12px;border-radius:2px}}}input::placeholder{--override-input-placeholder-color:rgb(0 0 0/54%);color:var(--override-input-placeholder-color)}.theme-with-dark-background input::placeholder,\n:host-context(.theme-with-dark-background) input::placeholder{--override-input-placeholder-color:rgb(230 230 230/54%)}.harmony-input:not([type]),\n.harmony-input[type="number"],\n.harmony-input[type="text"]{padding:3px 6px;height:24px;border:1px solid var(--sys-color-neutral-outline);border-radius:4px;&.error-input,\n  &:invalid{border-color:var(--sys-color-error)}&:not(.error-input, :invalid):focus{border-color:var(--sys-color-state-focus-ring)}&:not(.error-input, :invalid):hover:not(:focus){background:var(--sys-color-state-hover-on-subtle)}}input[type="radio"]{height:17px;width:17px;min-width:17px;border-radius:8px;vertical-align:sub;margin:0 5px 5px 0;accent-color:var(--sys-color-primary-bright);color:var(--sys-color-on-primary);&:focus{box-shadow:var(--legacy-focus-ring-active-shadow)}}@media (forced-colors: active){input[type="radio"]{--gradient-start:ButtonFace;--gradient-end:ButtonFace;&:checked{--gradient-start:Highlight;--gradient-end:Highlight}}}input[type="range"]{appearance:none;margin:0;padding:0;height:10px;width:88px;outline:none;background:none}input[type="range"]::-webkit-slider-thumb,\n.-theme-preserve{appearance:none;margin:0;padding:0;border:0;width:12px;height:12px;margin-top:-5px;border-radius:50%;background-color:var(--sys-color-primary)}input[type="range"]::-webkit-slider-runnable-track{appearance:none;margin:0;padding:0;width:100%;height:2px;background-color:var(--sys-color-surface-variant)}input[type="range"]:focus::-webkit-slider-thumb{box-shadow:0 0 0 2px var(--sys-color-inverse-primary)}input[type="range"]:disabled::-webkit-slider-thumb{background-color:var(--sys-color-state-disabled)}@media (forced-colors: active){input[type="range"]{forced-color-adjust:none}}.highlighted-search-result.current-search-result{--override-current-search-result-background-color:rgb(255 127 0/80%);border-radius:1px;padding:1px;margin:-1px;background-color:var(--override-current-search-result-background-color)}.dimmed{opacity:60%}.editing{box-shadow:var(--drop-shadow);background-color:var(--sys-color-cdt-base-container);text-overflow:clip!important;padding-left:2px;margin-left:-2px;padding-right:2px;margin-right:-2px;margin-bottom:-1px;padding-bottom:1px;opacity:100%!important}.editing,\n.editing *{color:var(\n    --sys-color-on-surface\n  )!important;text-decoration:none!important}select{appearance:none;user-select:none;height:var(--sys-size-11);border:var(--sys-size-1) solid var(--sys-color-neutral-outline);border-radius:var(--sys-shape-corner-extra-small);color:var(--sys-color-on-surface);font:inherit;margin:0;outline:none;padding:0 var(--sys-size-9) 0 var(--sys-size-5);background-image:var(--combobox-dropdown-arrow);background-color:transparent;background-position:right center;background-repeat:no-repeat;&:disabled{opacity:100%;border-color:transparent;color:var(--sys-color-state-disabled);background-color:var(--sys-color-state-disabled-container);pointer-events:none}&:enabled{&:hover{background-color:var(--sys-color-state-hover-on-subtle)}&:active{background-color:var(--sys-color-state-ripple-neutral-on-subtle)}&:hover:active{background:var(--combobox-dropdown-arrow),linear-gradient(var(--sys-color-state-hover-on-subtle),var(--sys-color-state-hover-on-subtle)),linear-gradient(var(--sys-color-state-ripple-neutral-on-subtle),var(--sys-color-state-ripple-neutral-on-subtle));background-position:right center;background-repeat:no-repeat}&:focus{outline:var(--sys-size-2) solid var(--sys-color-state-focus-ring);outline-offset:-1px}}}@media (forced-colors: active) and (prefers-color-scheme: light){:root,\n  .theme-with-dark-background,\n  :host-context(.theme-with-dark-background){--combobox-dropdown-arrow:var(--image-file-arrow-drop-down-light)}}@media (forced-colors: active) and (prefers-color-scheme: dark){:root,\n  .theme-with-dark-background,\n  :host-context(.theme-with-dark-background){--combobox-dropdown-arrow:var(--image-file-arrow-drop-down-dark)}}.chrome-select-label{margin:0 var(--sys-size-10);flex:none;p p{margin-top:0;color:var(--sys-color-token-subtle)}.reload-warning{margin-left:var(--sys-size-5)}}.settings-select{margin:0}select optgroup,\nselect option{background-color:var(--sys-color-cdt-base-container);color:var(--sys-color-on-surface)}.gray-info-message{text-align:center;font-style:italic;padding:6px;color:var(--sys-color-token-subtle);white-space:nowrap}.empty-state{margin:var(--sys-size-5);display:flex;flex-grow:1;justify-content:center;align-items:center;flex-direction:column;text-align:center;min-height:fit-content;min-width:fit-content;> *{max-width:var(--sys-size-29)}.empty-state-header{font:var(--sys-typescale-headline5);margin-bottom:var(--sys-size-3)}.empty-state-description{font:var(--sys-typescale-body4-regular);color:var(--sys-color-on-surface-subtle);> x-link{white-space:nowrap;margin-left:var(--sys-size-3)}}> devtools-button{margin-top:var(--sys-size-7)}}dt-icon-label{flex:none}.full-widget-dimmed-banner a{color:inherit}.full-widget-dimmed-banner{color:var(--sys-color-token-subtle);background-color:var(--sys-color-cdt-base-container);display:flex;justify-content:center;align-items:center;text-align:center;padding:20px;position:absolute;inset:0;font-size:13px;overflow:auto;z-index:500}.dot::before{content:var(--image-file-empty);width:6px;height:6px;border-radius:50%;outline:1px solid var(--icon-gap-default);left:9px;position:absolute;top:9px;z-index:1}.green::before{background-color:var(--sys-color-green-bright)}.purple::before{background-color:var(--sys-color-purple-bright)}.expandable-inline-button{background-color:var(--sys-color-cdt-base-container);color:var(--sys-color-on-surface);cursor:pointer;border-radius:3px}.undisplayable-text,\n.expandable-inline-button{border:none;padding:1px 3px;margin:0 2px;font-size:11px;font-family:sans-serif;white-space:nowrap;display:inline-block}.undisplayable-text::after,\n.expandable-inline-button::after{content:attr(data-text)}.undisplayable-text{color:var(--sys-color-state-disabled);font-style:italic}.expandable-inline-button:hover,\n.expandable-inline-button:focus-visible{background-color:var(--sys-color-state-hover-on-subtle)}.expandable-inline-button:focus-visible{background-color:var(--sys-color-state-focus-highlight)}::selection{background-color:var(--sys-color-state-text-highlight);color:var(--sys-color-state-on-text-highlight)}button.link{border:none;background:none;padding:3px}button.link:focus-visible{outline:2px solid var(--sys-color-state-focus-ring);outline-offset:2px;border-radius:var(--sys-shape-corner-full)}.data-grid-data-grid-node button.link:focus-visible{border-radius:var(--sys-shape-corner-extra-small);padding:0;margin-top:3px}@media (forced-colors: active){.dimmed,\n  select:disabled{opacity:100%}.harmony-input:not([type]),\n  .harmony-input[type="number"],\n  .harmony-input[type="text"]{border:1px solid ButtonText}.harmony-input:not([type]):focus,\n  .harmony-input[type="number"]:focus,\n  .harmony-input[type="text"]:focus{border:1px solid Highlight}}input.custom-search-input::-webkit-search-cancel-button{appearance:none;width:16px;height:15px;margin-right:0;opacity:70%;mask-image:var(--image-file-cross-circle-filled);mask-position:center;mask-repeat:no-repeat;mask-size:99%;background-color:var(--icon-default)}input.custom-search-input::-webkit-search-cancel-button:hover{opacity:99%}.spinner::before{display:block;width:var(--dimension,24px);height:var(--dimension,24px);border:var(--override-spinner-size,3px) solid var(--override-spinner-color,var(--sys-color-token-subtle));border-radius:12px;clip:rect(0,var(--clip-size,15px),var(--clip-size,15px),0);content:"";position:absolute;animation:spinner-animation 1s linear infinite;box-sizing:border-box}@keyframes spinner-animation{from{transform:rotate(0)}to{transform:rotate(360deg)}}.adorner-container{display:inline-flex;vertical-align:middle}.adorner-container.hidden{display:none}.adorner-container devtools-adorner{margin-left:3px}:host-context(.theme-with-dark-background) devtools-adorner{--override-adorner-border-color:var(--sys-color-tonal-outline);--override-adorner-active-background-color:var(\n    --sys-color-state-riple-neutral-on-subtle\n  )}.panel{display:flex;overflow:hidden;position:absolute;inset:0;z-index:0;background-color:var(--sys-color-cdt-base-container)}.panel-sidebar{overflow-x:hidden;background-color:var(--sys-color-cdt-base-container)}iframe.extension{flex:auto;width:100%;height:100%}iframe.panel.extension{display:block;height:100%}@media (forced-colors: active){:root{--legacy-accent-color:Highlight;--legacy-focus-ring-inactive-shadow-color:ButtonText}}devtools-toolbar{& > *{position:relative;display:flex;background-color:transparent;flex:none;align-items:center;justify-content:center;height:var(--toolbar-height);border:none;white-space:pre;overflow:hidden;max-width:100%;color:var(--icon-default);cursor:default;& .devtools-link{color:var(--icon-default)}}.status-buttons{padding:0 var(--sys-size-2);gap:var(--sys-size-2)}& > :not(select){padding:0}& > devtools-issue-counter{margin-top:-4px;padding:0 1px}devtools-adorner.fix-perf-icon{--override-adorner-text-color:transparent;--override-adorner-border-color:transparent;--override-adorner-background-color:transparent}devtools-issue-counter.main-toolbar{margin-left:1px;margin-right:1px}.toolbar-dropdown-arrow{pointer-events:none;flex:none;top:2px}.toolbar-button.dark-text .toolbar-dropdown-arrow{color:var(--sys-color-on-surface)}.toolbar-button{white-space:nowrap;overflow:hidden;min-width:28px;background:transparent;border-radius:0;&[aria-haspopup="true"][aria-expanded="true"]{pointer-events:none}}.toolbar-item-search{min-width:5.2em;max-width:300px;flex:1 1 auto;justify-content:start;overflow:revert}.toolbar-text{margin:0 5px;flex:none;color:var(--ui-text)}.toolbar-text:empty{margin:0}.toolbar-has-dropdown{justify-content:space-between;height:var(--sys-size-9);padding:0 var(--sys-size-2) 0 var(--sys-size-4);margin:0 var(--sys-size-2);gap:var(--sys-size-2);border-radius:var(--sys-shape-corner-extra-small);&:hover::after,\n    &:active::before{content:"";height:100%;width:100%;border-radius:inherit;position:absolute;top:0;left:0}&:hover::after{background-color:var(--sys-color-state-hover-on-subtle)}&:active::before{background-color:var(--sys-color-state-ripple-neutral-on-subtle)}&:focus-visible{outline:var(--sys-size-2) solid var(--sys-color-state-focus-ring)}&[disabled]{pointer-events:none;background-color:var(--sys-color-state-disabled-container);color:var(--sys-color-state-disabled)}}.toolbar-has-dropdown-shrinkable{flex-shrink:1}.toolbar-has-dropdown .toolbar-text{margin:0;text-overflow:ellipsis;flex:auto;overflow:hidden;text-align:right}.toolbar-button:not(.toolbar-has-dropdown):focus-visible::before{position:absolute;inset:2px;background-color:var(--sys-color-state-focus-highlight);border-radius:2px;content:"";z-index:-1}.toolbar-glyph{flex:none}.toolbar-button:disabled{opacity:50%}.toolbar-button.copied-to-clipboard::after{content:attr(data-content);position:fixed;margin-top:calc(2 * var(--toolbar-height));padding:3px 5px;color:var(--sys-color-token-subtle);background:var(--sys-color-cdt-base-container);animation:2s fade-out;font-weight:normal;border:1px solid var(--sys-color-divider);border-radius:3px}.toolbar-button.toolbar-state-on .toolbar-glyph{color:var(--icon-toggled)}.toolbar-state-on.toolbar-toggle-with-dot .toolbar-text::after{content:"";position:absolute;bottom:2px;background-color:var(--sys-color-primary-bright);width:4.5px;height:4.5px;border:2px solid var(--override-toolbar-background-color,--sys-color-cdt-base-container);border-radius:50%;right:0}.toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color .toolbar-glyph,\n  .toolbar-button.toolbar-state-off.toolbar-default-with-red-color\n    .toolbar-glyph{color:var(\n      --icon-error\n    )!important}.toolbar-button:not(\n      .toolbar-has-glyph,\n      .toolbar-has-dropdown,\n      .largeicon-menu,\n      .toolbar-button-secondary\n    ){font-weight:bold}.toolbar-button.dark-text .toolbar-text{color:var(\n      --sys-color-on-surface\n    )!important}.toolbar-button.toolbar-state-on .toolbar-text{color:var(--sys-color-primary)}.toolbar-button.toolbar-state-on:enabled:active .toolbar-text{color:var(--sys-color-primary-bright)}.toolbar-button:enabled:hover:not(:active) .toolbar-glyph{color:var(--sys-color-on-surface)}.toolbar-button:enabled:hover:not(:active) .toolbar-text{color:var(--sys-color-on-surface)}.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-glyph{color:var(--sys-color-primary)}.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-text{color:var(--sys-color-primary)}& > dt-checkbox{padding:0 5px 0 0}& > select{height:var(--sys-size-9);min-width:var(--sys-size-14)}.toolbar-input{box-shadow:inset 0 0 0 2px transparent;box-sizing:border-box;width:120px;height:var(--sys-size-9);padding:0 var(--sys-size-2) 0 var(--sys-size-5);margin:1px 3px;border-radius:100px;min-width:35px;position:relative;&.focused{box-shadow:inset 0 0 0 2px var(--sys-color-state-focus-ring)}&:not(:has(devtools-button:hover), .disabled):hover{background-color:var(--sys-color-state-hover-on-subtle)}&::before{content:"";box-sizing:inherit;height:100%;width:100%;position:absolute;left:0;background:var(--sys-color-cdt-base);z-index:-1}& > devtools-icon{color:var(--sys-color-on-surface-subtle);width:var(--sys-size-8);height:var(--sys-size-8);margin-right:var(--sys-size-3)}&.disabled > devtools-icon{color:var(--sys-color-state-disabled)}}.toolbar-filter .toolbar-input-clear-button{margin-right:var(--sys-size-4)}.toolbar-input-empty .toolbar-input-clear-button{display:none}.toolbar-prompt-proxy{flex:1}.toolbar-input-prompt{flex:1;overflow:hidden;white-space:nowrap;cursor:text;color:var(--sys-color-on-surface)}.toolbar-divider{background-color:var(--sys-color-divider);width:1px;margin:5px 4px;height:16px}.toolbar-spacer{flex:auto}.toolbar-button.emulate-active{background-color:var(--sys-color-surface-variant)}&:not([floating]) > :last-child:not(:first-child, select){flex-shrink:1;justify-content:left}&:not([floating]) > .toolbar-button:last-child:not(:first-child, select){justify-content:left;margin-right:2px}& > .highlight::before{content:"";position:absolute;inset:2px;border-radius:2px;background:var(--sys-color-neutral-container);z-index:-1}& > .highlight:focus-visible{background:var(--sys-color-tonal-container);& > .title{color:var(--sys-color-on-tonal-container)}}devtools-icon.leading-issue-icon{margin:0 7px}@media (forced-colors: active){.toolbar-button:disabled{opacity:100%;color:Graytext}devtools-toolbar > *,\n    .toolbar-text{color:ButtonText}.toolbar-button:disabled .toolbar-text{color:Graytext}devtools-toolbar > select:disabled{opacity:100%;color:Graytext}.toolbar-button.toolbar-state-on .toolbar-glyph{forced-color-adjust:none;color:Highlight}.toolbar-button.toolbar-state-on .toolbar-text{forced-color-adjust:none;color:Highlight}.toolbar-button:enabled:hover:not(:active) .toolbar-text,\n    .toolbar-button:enabled:focus:not(:active) .toolbar-text{color:HighlightText}.toolbar-button:disabled devtools-icon{color:GrayText}.toolbar-button:disabled .toolbar-glyph{color:GrayText}.toolbar-button:enabled.hover:not(:active) .toolbar-glyph{forced-color-adjust:none;color:Highlight}.toolbar-button:enabled:hover .toolbar-glyph,\n    .toolbar-button:enabled:focus .toolbar-glyph,\n    .toolbar-button:enabled:hover:not(:active) .toolbar-glyph,\n    .toolbar-button:enabled:hover devtools-icon,\n    .toolbar-button:enabled:focus devtools-icon{color:HighlightText}.toolbar-input{forced-color-adjust:none;background:canvas;box-shadow:var(--legacy-focus-ring-inactive-shadow)}.toolbar-input.focused,\n    .toolbar-input:not(.toolbar-input-empty){forced-color-adjust:none;background:canvas;box-shadow:var(--legacy-focus-ring-active-shadow)}.toolbar-input:hover{box-shadow:var(--legacy-focus-ring-active-shadow)}devtools-toolbar .devtools-link{color:linktext}.toolbar-has-dropdown{forced-color-adjust:none;background:ButtonFace;color:ButtonText}}}@keyframes fade-out{from{opacity:100%}to{opacity:0%}}.webkit-css-property{color:var(--webkit-css-property-color,var(--sys-color-token-property-special))}.webkit-html-comment{color:var(--sys-color-token-comment)}.webkit-html-tag{color:var(--sys-color-token-tag)}.webkit-html-tag-name,\n.webkit-html-close-tag-name{color:var(--sys-color-token-tag)}.webkit-html-pseudo-element{color:var(--sys-color-token-pseudo-element)}.webkit-html-js-node,\n.webkit-html-css-node{color:var(--text-primary);white-space:pre-wrap}.webkit-html-text-node{color:var(--text-primary);unicode-bidi:-webkit-isolate}.webkit-html-entity-value{background-color:rgb(0 0 0/15%);unicode-bidi:-webkit-isolate}.webkit-html-doctype{color:var(--text-secondary)}.webkit-html-attribute-name{color:var(--sys-color-token-attribute);unicode-bidi:-webkit-isolate}.webkit-html-attribute-value{color:var(--sys-color-token-attribute-value);unicode-bidi:-webkit-isolate;word-break:break-all}.devtools-link{color:var(--text-link);text-decoration:underline;outline-offset:2px;.elements-disclosure &{color:var(--text-link)}devtools-icon{vertical-align:baseline;color:var(--sys-color-primary)}:focus .selected & devtools-icon{color:var(--sys-color-tonal-container)}&:focus-visible{outline-width:unset}&.invalid-link{color:var(--text-disabled);text-decoration:none}&:not(.devtools-link-prevent-click, .invalid-link){cursor:pointer}@media (forced-colors: active){&:not(.devtools-link-prevent-click){forced-color-adjust:none;color:linktext}&:focus-visible{background:Highlight;color:HighlightText}}}\n/*# sourceURL=${import.meta.resolve("./inspectorCommon.css")} */\n`},w={cssText:`:host{flex:auto;display:flex}.value-types{width:100%;display:grid;grid-template-columns:auto auto 1fr;gap:4px 24px;min-height:24px;overflow:hidden;padding:2px 12px;align-items:baseline;justify-content:start}.value-type-cell{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:flex;flex-direction:column;min-height:24px}.value-type-value-with-link{display:flex;align-items:center}.value-type-cell-no-mode{grid-column:1/3}.jump-to-button{display:flex;width:20px;height:20px;border:none;padding:0;outline:none;justify-content:center;align-items:center;cursor:pointer;background-color:var(--sys-color-cdt-base-container)}.signed-divider{width:1px;height:15px;background-color:var(--sys-color-divider);margin:0 4px}.selectable-text{user-select:text}.selectable-text::selection{background-color:var(--sys-color-tonal-container);color:currentcolor}\n/*# sourceURL=${import.meta.resolve("./valueInterpreterDisplay.css")} */\n`};const k={notApplicable:"N/A"},S=e.i18n.registerUIStrings("panels/linear_memory_inspector/components/ValueInterpreterDisplayUtils.ts",k),$=e.i18n.getLocalizedString.bind(void 0,S);function T(){return new Map(M)}const M=new Map([["Integer 8-bit","dec"],["Integer 16-bit","dec"],["Integer 32-bit","dec"],["Integer 64-bit","dec"],["Float 32-bit","dec"],["Float 64-bit","dec"],["Pointer 32-bit","hex"],["Pointer 64-bit","hex"]]),I=["dec","hex","oct","sci"];function E(t){return e.i18n.lockedString(t)}function z(e,t){switch(e){case"Integer 8-bit":case"Integer 16-bit":case"Integer 32-bit":case"Integer 64-bit":return"dec"===t||"hex"===t||"oct"===t;case"Float 32-bit":case"Float 64-bit":return"sci"===t||"dec"===t;case"Pointer 32-bit":case"Pointer 64-bit":return"hex"===t;default:return i.assertNever(e,`Unknown value type: ${e}`)}}function A(e){switch(e){case"Integer 8-bit":case"Integer 16-bit":case"Integer 32-bit":case"Integer 64-bit":case"Float 32-bit":case"Float 64-bit":return!0;default:return!1}}function j(e,t,o){if(!C(e))return console.error(`Requesting address of a non-pointer type: ${e}.\n`),NaN;try{const r=new DataView(t),s="Little Endian"===o;return"Pointer 32-bit"===e?r.getUint32(0,s):r.getBigUint64(0,s)}catch{return NaN}}function C(e){return"Pointer 32-bit"===e||"Pointer 64-bit"===e}function L(e){if(!e.mode)return console.error(`No known way of showing value for ${e.type}`),$(k.notApplicable);const t=new DataView(e.buffer),o="Little Endian"===e.endianness;let r;try{switch(e.type){case"Integer 8-bit":return r=e.signed?t.getInt8(0):t.getUint8(0),B(r,e.mode);case"Integer 16-bit":return r=e.signed?t.getInt16(0,o):t.getUint16(0,o),B(r,e.mode);case"Integer 32-bit":return r=e.signed?t.getInt32(0,o):t.getUint32(0,o),B(r,e.mode);case"Integer 64-bit":return r=e.signed?t.getBigInt64(0,o):t.getBigUint64(0,o),B(r,e.mode);case"Float 32-bit":return r=t.getFloat32(0,o),H(r,e.mode);case"Float 64-bit":return r=t.getFloat64(0,o),H(r,e.mode);case"Pointer 32-bit":return r=t.getUint32(0,o),B(r,"hex");case"Pointer 64-bit":return r=t.getBigUint64(0,o),B(r,"hex");default:return i.assertNever(e.type,`Unknown value type: ${e.type}`)}}catch{return $(k.notApplicable)}}function H(e,t){switch(t){case"dec":return e.toFixed(2).toString();case"sci":return e.toExponential(2).toString();default:throw new Error(`Unknown mode for floats: ${t}.`)}}function B(e,t){switch(t){case"dec":return e.toString();case"hex":return e<0?$(k.notApplicable):"0x"+e.toString(16).toUpperCase();case"oct":return e<0?$(k.notApplicable):e.toString(8);default:throw new Error(`Unknown mode for integers: ${t}.`)}}var N=Object.freeze({__proto__:null,VALUE_INTEPRETER_MAX_NUM_BYTES:8,VALUE_TYPE_MODE_LIST:I,format:L,formatFloat:H,formatInteger:B,getDefaultValueTypeMapping:T,getPointerAddress:j,isNumber:A,isPointer:C,isValidMode:z,valueTypeToLocalizedString:E});const R=new CSSStyleSheet;R.replaceSync(x.cssText);const _=new CSSStyleSheet;_.replaceSync(w.cssText);const O={unsignedValue:"`Unsigned` value",changeValueTypeMode:"Change mode",signedValue:"`Signed` value",jumpToPointer:"Jump to address",addressOutOfRange:"Address out of memory range"},P=e.i18n.registerUIStrings("panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts",O),V=e.i18n.getLocalizedString.bind(void 0,P),{render:U,html:F}=t,D=Array.from(T().keys());class G extends Event{static eventName="valuetypemodechanged";data;constructor(e,t){super(G.eventName,{composed:!0}),this.data={type:e,mode:t}}}class q extends Event{static eventName="jumptopointeraddress";data;constructor(e){super(q.eventName,{composed:!0}),this.data=e}}class J extends HTMLElement{#e=this.attachShadow({mode:"open"});#a="Little Endian";#l=new ArrayBuffer(0);#d=new Set;#c=T();#h=0;constructor(){super(),this.#e.adoptedStyleSheets=[R]}connectedCallback(){this.#e.adoptedStyleSheets=[R,_]}set data(e){this.#l=e.buffer,this.#a=e.endianness,this.#d=e.valueTypes,this.#h=e.memoryLength,e.valueTypeModes&&e.valueTypeModes.forEach(((e,t)=>{z(t,e)&&this.#c.set(t,e)})),this.#r()}#r(){U(F`
      <div class="value-types">
        ${D.map((e=>this.#d.has(e)?this.#p(e):""))}
      </div>
    `,this.#e,{host:this})}#p(e){if(A(e))return this.#u(e);if(C(e))return this.#g(e);throw new Error(`No known way to format ${e}`)}#g(t){const o=this.#v({type:t,signed:!1}),r=j(t,this.#l,this.#a),s=Number.isNaN(r)||BigInt(r)>=BigInt(this.#h),i=V(s?O.addressOutOfRange:O.jumpToPointer),a=s?"var(--icon-default)":"var(--icon-link)";return F`
      <span class="value-type-cell-no-mode value-type-cell selectable-text">${e.i18n.lockedString(t)}</span>
      <div class="value-type-cell">
        <div class="value-type-value-with-link" data-value="true">
        <span class="selectable-text">${o}</span>
          ${F`
              <button class="jump-to-button" data-jump="true" title=${i} ?disabled=${s}
                jslog=${n.action("linear-memory-inspector.jump-to-address").track({click:!0})}
                @click=${this.#m.bind(this,Number(r))}>
                <devtools-icon .data=${{iconName:"open-externally",color:a,width:"16px"}}>
                </devtools-icon>
              </button>`}
        </div>
      </div>
    `}#m(e){this.dispatchEvent(new q(e))}#u(t){return F`
      <span class="value-type-cell selectable-text">${e.i18n.lockedString(t)}</span>
      <div>
        <select title=${V(O.changeValueTypeMode)}
          data-mode-settings="true"
          jslog=${n.dropDown("linear-memory-inspector.value-type-mode").track({change:!0})}
          @change=${this.#b.bind(this,t)}>
            ${I.filter((e=>z(t,e))).map((o=>F`
                <option value=${o} .selected=${this.#c.get(t)===o}
                        jslog=${n.item(o).track({click:!0})}>${e.i18n.lockedString(o)}
                </option>`))}
        </select>
      </div>
      ${this.#y(t)}
    `}#y(e){const t=this.#v({type:e,signed:!1}),o=this.#v({type:e,signed:!0}),r=this.#c.get(e),s=o!==t&&"hex"!==r&&"oct"!==r,n=F`<span class="value-type-cell selectable-text"  title=${V(O.unsignedValue)} data-value="true">${t}</span>`;if(!s)return n;const i="Integer 32-bit"===e||"Integer 64-bit"===e,a=F`<span class="selectable-text" data-value="true" title=${V(O.signedValue)}>${o}</span>`;return i?F`
        <div class="value-type-cell">
          ${n}
          ${a}
        </div>
        `:F`
      <div class="value-type-cell" style="flex-direction: row;">
        ${n}
        <span class="signed-divider"></span>
        ${a}
      </div>
    `}#b(e,t){t.preventDefault();const o=t.target.value;this.dispatchEvent(new G(e,o))}#v(e){const t=this.#c.get(e.type);return L({buffer:this.#l,type:e.type,endianness:this.#a,signed:e.signed||!1,mode:t})}}customElements.define("devtools-linear-memory-inspector-interpreter-display",J);var K=Object.freeze({__proto__:null,JumpToPointerAddressEvent:q,ValueInterpreterDisplay:J,ValueTypeModeChangedEvent:G}),X={cssText:`:host{flex:auto;display:flex;min-height:20px}.settings{display:flex;flex-wrap:wrap;margin:0 12px 12px;gap:15px 45px}.value-types-selection{display:flex;flex-direction:column}.group{font-weight:bold;margin-bottom:11px}.type-label{white-space:nowrap}.group + .type-label{margin-top:5px}.type-label input{margin:0 6px 0 0;padding:0}.type-label + .type-label{margin-top:6px}\n/*# sourceURL=${import.meta.resolve("./valueInterpreterSettings.css")} */\n`};const W=new CSSStyleSheet;W.replaceSync(X.cssText);const{render:Y,html:Q}=t,Z={otherGroup:"Other"},ee=e.i18n.registerUIStrings("panels/linear_memory_inspector/components/ValueInterpreterSettings.ts",Z),te=e.i18n.getLocalizedString.bind(void 0,ee),oe=new Map([["Integer",["Integer 8-bit","Integer 16-bit","Integer 32-bit","Integer 64-bit"]],["Floating point",["Float 32-bit","Float 64-bit"]],["Other",["Pointer 32-bit","Pointer 64-bit"]]]);class re extends Event{static eventName="typetoggle";data;constructor(e,t){super(re.eventName),this.data={type:e,checked:t}}}class se extends HTMLElement{#e=this.attachShadow({mode:"open"});#d=new Set;connectedCallback(){this.#e.adoptedStyleSheets=[a.checkboxStyles,W]}set data(e){this.#d=e.valueTypes,this.#r()}#r(){Y(Q`
      <div class="settings" jslog=${n.pane("settings")}>
       ${[...oe.keys()].map((e=>Q`
          <div class="value-types-selection">
            <span class="group">${function(e){return"Other"===e?te(Z.otherGroup):e}(e)}</span>
            ${this.#f(e)}
          </div>
        `))}
      </div>
      `,this.#e,{host:this})}#f(e){const t=oe.get(e);if(!t)throw new Error(`Unknown group ${e}`);return Q`
      ${t.map((e=>Q`
          <label class="type-label" title=${E(e)}>
            <input data-input="true" type="checkbox" .checked=${this.#d.has(e)} @change=${t=>this.#x(e,t)} jslog=${n.toggle().track({change:!0}).context(i.StringUtilities.toKebabCase(e))}>
            <span data-title="true">${E(e)}</span>
          </label>
     `))}`}#x(e,t){const o=t.target;this.dispatchEvent(new re(e,o.checked))}}customElements.define("devtools-linear-memory-inspector-interpreter-settings",se);var ne=Object.freeze({__proto__:null,TypeToggleEvent:re,ValueInterpreterSettings:se}),ie={cssText:`:host{flex:auto;display:flex}.value-interpreter{border:1px solid var(--sys-color-divider);background-color:var(--sys-color-cdt-base-container);overflow:hidden;width:400px}.settings-toolbar{min-height:26px;display:flex;flex-wrap:nowrap;justify-content:space-between;padding-left:var(--sys-size-3);padding-right:var(--sys-size-3);align-items:center}.settings-toolbar-button{padding:0;width:20px;height:20px;border:none;outline:none;background-color:transparent}.settings-toolbar-button.active devtools-icon{color:var(--icon-toggled)}.divider{display:block;height:1px;margin-bottom:12px;background-color:var(--sys-color-divider)}\n/*# sourceURL=${import.meta.resolve("./linearMemoryValueInterpreter.css")} */\n`};const ae=new CSSStyleSheet;ae.replaceSync(x.cssText);const le=new CSSStyleSheet;le.replaceSync(ie.cssText);const de={toggleValueTypeSettings:"Toggle value type settings",changeEndianness:"Change `Endianness`"},ce=e.i18n.registerUIStrings("panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts",de),he=e.i18n.getLocalizedString.bind(void 0,ce),{render:pe,html:ue}=t;class ge extends Event{static eventName="endiannesschanged";data;constructor(e){super(ge.eventName),this.data=e}}class ve extends Event{static eventName="valuetypetoggled";data;constructor(e,t){super(ve.eventName),this.data={type:e,checked:t}}}class me extends HTMLElement{#e=this.attachShadow({mode:"open"});#a="Little Endian";#l=new ArrayBuffer(0);#d=new Set;#c=new Map;#h=0;#w=!1;connectedCallback(){this.#e.adoptedStyleSheets=[ae,le]}set data(e){this.#a=e.endianness,this.#l=e.value,this.#d=e.valueTypes,this.#c=e.valueTypeModes||new Map,this.#h=e.memoryLength,this.#r()}#r(){pe(ue`
      <div class="value-interpreter">
        <div class="settings-toolbar">
          ${this.#k()}
          <devtools-button data-settings="true" class="toolbar-button ${this.#w?"":"disabled"}"
              title=${he(de.toggleValueTypeSettings)} @click=${this.#S}
              jslog=${n.toggleSubpane("linear-memory-inspector.toggle-value-settings").track({click:!0})}
              .iconName=${"gear"}
              .toggledIconName=${"gear-filled"}
              .toggleType=${"primary-toggle"}
              .variant=${"icon_toggle"}
          ></devtools-button>
        </div>
        <span class="divider"></span>
        <div>
          ${this.#w?ue`
              <devtools-linear-memory-inspector-interpreter-settings
                .data=${{valueTypes:this.#d}}
                @typetoggle=${this.#x}>
              </devtools-linear-memory-inspector-interpreter-settings>`:ue`
              <devtools-linear-memory-inspector-interpreter-display
                .data=${{buffer:this.#l,valueTypes:this.#d,endianness:this.#a,valueTypeModes:this.#c,memoryLength:this.#h}}>
              </devtools-linear-memory-inspector-interpreter-display>`}
        </div>
      </div>
    `,this.#e,{host:this})}#$(e){e.preventDefault();const t=e.target.value;this.dispatchEvent(new ge(t))}#k(){const t=this.#$.bind(this);return ue`
    <label data-endianness-setting="true" title=${he(de.changeEndianness)}>
      <select
        jslog=${n.dropDown("linear-memory-inspector.endianess").track({change:!0})}
        style="border: none;"
        data-endianness="true" @change=${t}>
        ${["Little Endian","Big Endian"].map((t=>ue`<option value=${t} .selected=${this.#a===t}
            jslog=${n.item(i.StringUtilities.toKebabCase(t)).track({click:!0})}>${e.i18n.lockedString(t)}</option>`))}
      </select>
    </label>
    `}#S(){this.#w=!this.#w,this.#r()}#x(e){this.dispatchEvent(new ve(e.data.type,e.data.checked))}}customElements.define("devtools-linear-memory-inspector-interpreter",me);var be=Object.freeze({__proto__:null,EndiannessChangedEvent:ge,LinearMemoryValueInterpreter:me,ValueTypeToggledEvent:ve});const ye=/^0x[a-fA-F0-9]+$/,fe=/^0$|[1-9]\d*$/;function xe(e){const t=e.number.toString(16).padStart(e.pad,"0").toUpperCase();return e.prefix?"0x"+t:t}function we(e){return xe({number:e,pad:8,prefix:!0})}function ke(e){const t=e.match(ye),o=e.match(fe);let r;return t&&t[0].length===e.length?r=parseInt(e,16):o&&o[0].length===e.length&&(r=parseInt(e,10)),r}var Se=Object.freeze({__proto__:null,DECIMAL_REGEXP:fe,HEXADECIMAL_REGEXP:ye,formatAddress:we,parseAddress:ke,toHexString:xe}),$e={cssText:`:host{flex:auto;display:flex;min-height:20px}.view{overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;background:var(--sys-color-cdt-base-container);outline:none}.row{display:flex;height:20px;align-items:center}.cell{text-align:center;border:1px solid transparent;border-radius:2px;&.focused-area{background-color:var(--sys-color-tonal-container);color:var(--sys-color-on-tonal-container)}&.selected{border-color:var(--sys-color-state-focus-ring);color:var(--sys-color-on-tonal-container);background-color:var(--sys-color-state-focus-select)}}.byte-cell{min-width:21px;color:var(--sys-color-on-surface)}.byte-group-margin{margin-left:var(--byte-group-margin)}.text-cell{min-width:14px;color:var(--sys-color-on-surface-subtle)}.address{color:var(--sys-color-state-disabled)}.address.selected{font-weight:bold;color:var(--sys-color-on-surface)}.divider{width:1px;height:inherit;background-color:var(--sys-color-divider);margin:0 4px}.highlight-area{background-color:var(--sys-color-surface-variant)}\n/*# sourceURL=${import.meta.resolve("./linearMemoryViewer.css")} */\n`};const Te=new CSSStyleSheet;Te.replaceSync($e.cssText);const{render:Me,html:Ie}=t;class Ee extends Event{static eventName="byteselected";data;constructor(e){super(Ee.eventName),this.data=e}}class ze extends Event{static eventName="resize";data;constructor(e){super(ze.eventName),this.data=e}}class Ae extends HTMLElement{#e=this.attachShadow({mode:"open"});#T=new ResizeObserver((()=>this.#M()));#I=!1;#E=new Uint8Array;#z=0;#A=0;#j;#o;#C=1;#L=4;#H=!0;#B=void 0;set data(e){if(e.address<e.memoryOffset||e.address>e.memoryOffset+e.memory.length||e.address<0)throw new Error("Address is out of bounds.");if(e.memoryOffset<0)throw new Error("Memory offset has to be greater or equal to zero.");this.#E=e.memory,this.#z=e.address,this.#j=e.highlightInfo,this.#o=e.focusedMemoryHighlight,this.#A=e.memoryOffset,this.#H=e.focus,this.#N()}connectedCallback(){this.style.setProperty("--byte-group-margin","8px"),this.#e.adoptedStyleSheets=[Te]}disconnectedCallback(){this.#I=!1,this.#T.disconnect()}#N(){this.#R(),this.#r(),this.#_(),this.#O()}#_(){if(this.#H){const e=this.#e.querySelector(".view");e&&e.focus()}}#M(){this.#N(),this.dispatchEvent(new ze(this.#L*this.#C))}#R(){if(0===this.clientWidth||0===this.clientHeight||!this.shadowRoot)return this.#L=4,void(this.#C=1);const e=this.shadowRoot.querySelector(".byte-cell"),t=this.shadowRoot.querySelector(".text-cell"),o=this.shadowRoot.querySelector(".divider"),r=this.shadowRoot.querySelector(".row"),s=this.shadowRoot.querySelector(".address");if(!(e&&t&&o&&r&&s))return this.#L=4,void(this.#C=1);const n=4*(e.getBoundingClientRect().width+t.getBoundingClientRect().width)+8,i=o.getBoundingClientRect().width,a=e.getBoundingClientRect().left-s.getBoundingClientRect().left,l=this.clientWidth-1-a-i;if(l<n)return this.#L=4,void(this.#C=1);this.#L=4*Math.floor(l/n),this.#C=Math.floor(this.clientHeight/r.clientHeight)}#O(){this.#T&&!this.#I&&(this.#T.observe(this),this.#I=!0)}#r(){const e=n.section().track({keydown:"ArrowUp|ArrowDown|ArrowLeft|ArrowRight|PageUp|PageDown"}).context("linear-memory-inspector.viewer");Me(Ie`
      <div class="view" tabindex="0" @keydown=${this.#P} jslog=${e}>
        ${this.#V()}
      </div>
      `,this.#e,{host:this})}#P(e){const t=e;let o;"ArrowUp"===t.code?o=this.#z-this.#L:"ArrowDown"===t.code?o=this.#z+this.#L:"ArrowLeft"===t.code?o=this.#z-1:"ArrowRight"===t.code?o=this.#z+1:"PageUp"===t.code?o=this.#z-this.#L*this.#C:"PageDown"===t.code&&(o=this.#z+this.#L*this.#C),void 0!==o&&o!==this.#B&&(this.#B=o,this.dispatchEvent(new Ee(o)))}#V(){const e=[];for(let t=0;t<this.#C;++t)e.push(this.#U(t));return Ie`${e}`}#U(e){const{startIndex:o,endIndex:r}={startIndex:e*this.#L,endIndex:(e+1)*this.#L},s={address:!0,selected:Math.floor((this.#z-this.#A)/this.#L)===e};return Ie`
    <div class="row">
      <span class=${t.Directives.classMap(s)}>${xe({number:o+this.#A,pad:8,prefix:!1})}</span>
      <span class="divider"></span>
      ${this.#F(o,r)}
      <span class="divider"></span>
      ${this.#D(o,r)}
    </div>
    `}#F(e,o){const r=[];for(let s=e;s<o;++s){const o=s+this.#A,i={cell:!0,"byte-cell":!0,"byte-group-margin":s!==e&&(s-e)%4==0,selected:s===this.#z-this.#A,"highlight-area":this.#G(o),"focused-area":this.#q(o)},a=s<this.#E.length,l=a?Ie`${xe({number:this.#E[s],pad:2,prefix:!1})}`:"",d=a?this.#J.bind(this,o):"",c=n.tableCell("linear-memory-inspector.byte-cell").track({click:!0});r.push(Ie`<span class=${t.Directives.classMap(i)} @click=${d} jslog=${c}>${l}</span>`)}return Ie`${r}`}#D(e,o){const r=[];for(let s=e;s<o;++s){const e=s+this.#A,o=this.#G(e),i=this.#q(e),a={cell:!0,"text-cell":!0,selected:this.#z-this.#A===s,"highlight-area":o,"focused-area":i},l=s<this.#E.length,d=l?Ie`${this.#K(this.#E[s])}`:"",c=l?this.#J.bind(this,s+this.#A):"",h=n.tableCell("linear-memory-inspector.text-cell").track({click:!0});r.push(Ie`<span class=${t.Directives.classMap(a)} @click=${c} jslog=${h}>${d}</span>`)}return Ie`${r}`}#K(e){return e>=20&&e<=127?String.fromCharCode(e):"."}#J(e){this.dispatchEvent(new Ee(e))}#G(e){return void 0!==this.#j&&(this.#j.startAddress<=e&&e<this.#j.startAddress+this.#j.size)}#q(e){return!!this.#o&&(this.#o.startAddress<=e&&e<this.#o.startAddress+this.#o.size)}}customElements.define("devtools-linear-memory-inspector-viewer",Ae);var je=Object.freeze({__proto__:null,ByteSelectedEvent:Ee,LinearMemoryViewer:Ae,ResizeEvent:ze}),Ce={cssText:`:host{flex:auto;display:flex}.view{width:100%;display:flex;flex:1;flex-direction:column;font-family:var(--monospace-font-family);font-size:var(--monospace-font-size);padding:9px 12px 9px 7px}devtools-linear-memory-inspector-viewer{justify-content:center}devtools-linear-memory-inspector-navigator + devtools-linear-memory-inspector-viewer{margin-top:12px}.value-interpreter{display:flex}\n/*# sourceURL=${import.meta.resolve("./linearMemoryInspector.css")} */\n`};const Le=new CSSStyleSheet;Le.replaceSync(Ce.cssText);const He={addressHasToBeANumberBetweenSAnd:"Address has to be a number between {PH1} and {PH2}"},Be=e.i18n.registerUIStrings("panels/linear_memory_inspector/components/LinearMemoryInspector.ts",He),Ne=e.i18n.getLocalizedString.bind(void 0,Be);class Re extends Event{static eventName="memoryrequest";data;constructor(e,t,o){super(Re.eventName),this.data={start:e,end:t,address:o}}}class _e extends Event{static eventName="addresschanged";data;constructor(e){super(_e.eventName),this.data=e}}class Oe extends Event{static eventName="settingschanged";data;constructor(e){super(Oe.eventName),this.data=e}}class Pe{#z=0;#X;constructor(e,t){if(e<0)throw new Error("Address should be a greater or equal to zero");this.#z=e,this.#X=t}valid(){return!0}reveal(){this.#X(this.#z)}}class Ve extends HTMLElement{#e=this.attachShadow({mode:"open"});#W=new l.SimpleHistoryManager.SimpleHistoryManager(10);#E=new Uint8Array;#A=0;#Y=0;#z=-1;#j;#Q="Submitted";#Z=`${this.#z}`;#ee=4;#te=T();#d=new Set(this.#te.keys());#a="Little Endian";#oe=!1;connectedCallback(){this.#e.adoptedStyleSheets=[Le]}set data(e){if(e.address<e.memoryOffset||e.address>e.memoryOffset+e.memory.length||e.address<0)throw new Error("Address is out of bounds.");if(e.memoryOffset<0)throw new Error("Memory offset has to be greater or equal to zero.");if(e.highlightInfo){if(e.highlightInfo.size<0)throw new Error("Object size has to be greater than or equal to zero");if(e.highlightInfo.startAddress<0||e.highlightInfo.startAddress>=e.outerMemoryLength)throw new Error("Object start address is out of bounds.")}this.#E=e.memory,this.#A=e.memoryOffset,this.#Y=e.outerMemoryLength,this.#te=e.valueTypeModes||this.#te,this.#d=e.valueTypes||this.#d,this.#a=e.endianness||this.#a,this.#j=e.highlightInfo,this.#oe=e.hideValueInspector??this.#oe,this.#re(e.address),this.#r()}#r(){const{start:e,end:t}=this.#se(this.#z,this.#ee),n="Submitted"===this.#Q?we(this.#z):this.#Z,i=this.#ne(n),a=Ne(He.addressHasToBeANumberBetweenSAnd,{PH1:we(0),PH2:we(this.#Y)}),l=i?void 0:a,d=this.#W.canRollback(),c=this.#W.canRollover(),h=this.#j?[this.#j]:[],p=this.#ie(h,this.#z);o(r`
      <div class="view">
        <devtools-linear-memory-inspector-navigator
          .data=${{address:n,valid:i,mode:this.#Q,error:l,canGoBackInHistory:d,canGoForwardInHistory:c}}
          @refreshrequested=${this.#ae}
          @addressinputchanged=${this.#le}
          @pagenavigation=${this.#de}
          @historynavigation=${this.#ce}></devtools-linear-memory-inspector-navigator>
          <devtools-linear-memory-highlight-chip-list
          .data=${{highlightInfos:h,focusedMemoryHighlight:p}}
          @jumptohighlightedmemory=${this.#he}>
          </devtools-linear-memory-highlight-chip-list>
        <devtools-linear-memory-inspector-viewer
          .data=${{memory:this.#E.slice(e-this.#A,t-this.#A),address:this.#z,memoryOffset:e,focus:"Submitted"===this.#Q,highlightInfo:this.#j,focusedMemoryHighlight:p}}
          @byteselected=${this.#pe}
          @resize=${this.#M}>
        </devtools-linear-memory-inspector-viewer>
      </div>
      ${this.#oe?s:r`
      <div class="value-interpreter">
        <devtools-linear-memory-inspector-interpreter
          .data=${{value:this.#E.slice(this.#z-this.#A,this.#z+8).buffer,valueTypes:this.#d,valueTypeModes:this.#te,endianness:this.#a,memoryLength:this.#Y}}
          @valuetypetoggled=${this.#ue}
          @valuetypemodechanged=${this.#ge}
          @endiannesschanged=${this.#ve}
          @jumptopointeraddress=${this.#he}
          >
        </devtools-linear-memory-inspector-interpreter/>
      </div>`}
      `,this.#e,{host:this})}#he(e){e.stopPropagation(),this.#Q="Submitted";const t=Math.max(0,Math.min(e.data,this.#Y-1));this.#me(t)}#ae(){const{start:e,end:t}=this.#se(this.#z,this.#ee);this.dispatchEvent(new Re(e,t,this.#z))}#pe(e){this.#Q="Submitted";const t=Math.max(0,Math.min(e.data,this.#Y-1));this.#me(t)}#be(){return{valueTypes:this.#d,modes:this.#te,endianness:this.#a}}#ve(e){this.#a=e.data,this.dispatchEvent(new Oe(this.#be())),this.#r()}#ne(e){const t=ke(e);return void 0!==t&&t>=0&&t<this.#Y}#le(e){const{address:t,mode:o}=e.data,r=this.#ne(t),s=ke(t);if(this.#Z=t,void 0!==s&&r)return this.#Q=o,void this.#me(s);this.#Q="Submitted"!==o||r?"Edit":"InvalidSubmit",this.#r()}#ue(e){const{type:t,checked:o}=e.data;o?this.#d.add(t):this.#d.delete(t),this.dispatchEvent(new Oe(this.#be())),this.#r()}#ge(e){e.stopImmediatePropagation();const{type:t,mode:o}=e.data;this.#te.set(t,o),this.dispatchEvent(new Oe(this.#be())),this.#r()}#ce(e){return"Forward"===e.data?this.#W.rollover():this.#W.rollback()}#de(e){const t="Forward"===e.data?this.#z+this.#ee:this.#z-this.#ee,o=Math.max(0,Math.min(t,this.#Y-1));this.#me(o)}#me(e){e<0||e>=this.#Y?console.warn(`Specified address is out of bounds: ${e}`):(this.#re(e),this.#N())}#se(e,t){const o=Math.floor(e/t)*t;return{start:o,end:Math.min(o+t,this.#Y)}}#M(e){this.#ee=e.data,this.#N()}#N(){const{start:e,end:t}=this.#se(this.#z,this.#ee);e<this.#A||t>this.#A+this.#E.length?this.dispatchEvent(new Re(e,t,this.#z)):this.#r()}#re(e){if(this.#z===e)return;const t=new Pe(e,(()=>this.#me(e)));this.#W.push(t),this.#z=e,this.dispatchEvent(new _e(this.#z))}#ie(e,t){let o;for(const r of e)r.startAddress<=t&&t<r.startAddress+r.size&&(o?r.size<o.size&&(o=r):o=r);return o}}customElements.define("devtools-linear-memory-inspector-inspector",Ve);var Ue=Object.freeze({__proto__:null,AddressChangedEvent:_e,LinearMemoryInspector:Ve,MemoryRequestEvent:Re,SettingsChangedEvent:Oe}),Fe={cssText:`.navigator{min-height:24px;display:flex;flex-wrap:nowrap;justify-content:space-between;overflow:hidden;align-items:center;background-color:var(--sys-color-cdt-base-container);color:var(--sys-color-on-surface)}.navigator-item{display:flex;white-space:nowrap;overflow:hidden}.address-input{text-align:center;outline:none;color:var(--sys-color-on-surface);border:1px solid var(--sys-color-neutral-outline);background:transparent}.address-input.invalid{color:var(--sys-color-error)}.navigator-button{display:flex;width:20px;height:20px;background:transparent;overflow:hidden;border:none;padding:0;outline:none;justify-content:center;align-items:center;cursor:pointer}.navigator-button:disabled devtools-icon{opacity:50%}.navigator-button:enabled:hover devtools-icon{color:var(--icon-default-hover)}.navigator-button:enabled:focus devtools-icon{color:var(--icon-default-hover)}\n/*# sourceURL=${import.meta.resolve("./linearMemoryNavigator.css")} */\n`};const De=new CSSStyleSheet;De.replaceSync(Fe.cssText);const Ge={enterAddress:"Enter address",goBackInAddressHistory:"Go back in address history",goForwardInAddressHistory:"Go forward in address history",previousPage:"Previous page",nextPage:"Next page",refresh:"Refresh"},qe=e.i18n.registerUIStrings("panels/linear_memory_inspector/components/LinearMemoryNavigator.ts",Ge),Je=e.i18n.getLocalizedString.bind(void 0,qe),{render:Ke,html:Xe,Directives:{ifDefined:We}}=t;class Ye extends Event{static eventName="addressinputchanged";data;constructor(e,t){super(Ye.eventName),this.data={address:e,mode:t}}}class Qe extends Event{static eventName="pagenavigation";data;constructor(e){super(Qe.eventName,{}),this.data=e}}class Ze extends Event{static eventName="historynavigation";data;constructor(e){super(Ze.eventName,{}),this.data=e}}class et extends Event{static eventName="refreshrequested";constructor(){super(et.eventName,{})}}class tt extends HTMLElement{#e=this.attachShadow({mode:"open"});#z="0";#ye=void 0;#fe=!0;#xe=!1;#we=!1;connectedCallback(){this.#e.adoptedStyleSheets=[De]}set data(e){this.#z=e.address,this.#ye=e.error,this.#fe=e.valid,this.#xe=e.canGoBackInHistory,this.#we=e.canGoForwardInHistory,this.#r();const t=this.#e.querySelector(".address-input");t&&("Submitted"===e.mode?t.blur():"InvalidSubmit"===e.mode&&t.select())}#r(){const e=Xe`
      <div class="navigator">
        <div class="navigator-item">
          ${this.#ke({icon:"undo",title:Je(Ge.goBackInAddressHistory),event:new Ze("Backward"),enabled:this.#xe,jslogContext:"linear-memory-inspector.history-back"})}
          ${this.#ke({icon:"redo",title:Je(Ge.goForwardInAddressHistory),event:new Ze("Forward"),enabled:this.#we,jslogContext:"linear-memory-inspector.history-forward"})}
        </div>
        <div class="navigator-item">
          ${this.#ke({icon:"chevron-left",title:Je(Ge.previousPage),event:new Qe("Backward"),enabled:!0,jslogContext:"linear-memory-inspector.previous-page"})}
          ${this.#Se()}
          ${this.#ke({icon:"chevron-right",title:Je(Ge.nextPage),event:new Qe("Forward"),enabled:!0,jslogContext:"linear-memory-inspector.next-page"})}
        </div>
        ${this.#ke({icon:"refresh",title:Je(Ge.refresh),event:new et,enabled:!0,jslogContext:"linear-memory-inspector.refresh"})}
      </div>
      `;Ke(e,this.#e,{host:this})}#Se(){const e={"address-input":!0,invalid:!this.#fe};return Xe`
      <input class=${t.Directives.classMap(e)} data-input="true" .value=${this.#z}
        jslog=${n.textField("linear-memory-inspector.address").track({change:!0})}
        title=${We(this.#fe?Je(Ge.enterAddress):this.#ye)} @change=${this.#le.bind(this,"Submitted")} @input=${this.#le.bind(this,"Edit")}/>`}#le(e,t){const o=t.target;this.dispatchEvent(new Ye(o.value,e))}#ke(e){return Xe`
      <button class="navigator-button" ?disabled=${!e.enabled}
        jslog=${n.action().track({click:!0,keydown:"Enter"}).context(e.jslogContext)}
        data-button=${e.event.type} title=${e.title}
        @click=${this.dispatchEvent.bind(this,e.event)}>
        <devtools-icon name=${e.icon}></devtools-icon>
      </button>`}}customElements.define("devtools-linear-memory-inspector-navigator",tt);var ot=Object.freeze({__proto__:null,AddressInputChangedEvent:Ye,HistoryNavigationEvent:Ze,LinearMemoryNavigator:tt,PageNavigationEvent:Qe,RefreshRequestedEvent:et}),rt=Object.freeze({__proto__:null});export{f as LinearMemoryHighlightChipList,Ue as LinearMemoryInspector,Se as LinearMemoryInspectorUtils,ot as LinearMemoryNavigator,be as LinearMemoryValueInterpreter,je as LinearMemoryViewer,rt as LinearMemoryViewerUtils,K as ValueInterpreterDisplay,N as ValueInterpreterDisplayUtils,ne as ValueInterpreterSettings};
