var M=Object.defineProperty;var u=(h,t)=>{for(var e in t)M(h,e,{get:t[e],enumerable:!0})};var w={};u(w,{SettingCheckbox:()=>d});import"./../tooltips/tooltips.js";var $={};u($,{SettingDeprecationWarning:()=>c});import"./../../kit/kit.js";import*as b from"./../../../core/common/common.js";import*as l from"./../../lit/lit.js";var v=`.clickable{cursor:pointer}devtools-icon{vertical-align:text-bottom;padding-left:2px}
/*# sourceURL=${import.meta.resolve("./settingDeprecationWarning.css")} */`;var{html:C}=l,c=class extends HTMLElement{#e=this.attachShadow({mode:"open"});set data(t){this.#t(t)}#t({disabled:t,warning:e,experiment:s}){let i={clickable:!1,medium:!0},o;t&&s&&(i.clickable=!0,o=()=>{b.Revealer.reveal(s)}),l.render(C`
        <style>${v}</style>
        <devtools-icon class=${l.Directives.classMap(i)} name="info" title=${e} @click=${o}></devtools-icon>`,this.#e,{host:this})}};customElements.define("devtools-setting-deprecation-warning",c);import"./../../kit/kit.js";import*as L from"./../../../core/host/host.js";import*as f from"./../../../core/i18n/i18n.js";import*as a from"./../../lit/lit.js";import*as g from"./../../settings/settings.js";import*as y from"./../../visual_logging/visual_logging.js";import"./../buttons/buttons.js";import*as S from"./../input/input.js";var x=`:host{padding:0;margin:0}input{height:12px;width:12px;min-height:12px;min-width:12px;margin:6px}label{display:inline-flex;align-items:center;overflow:hidden;text-overflow:ellipsis}p{margin:6px 0}.disabled-reason{box-sizing:border-box;margin-left:var(--sys-size-2);width:var(--sys-size-9);height:var(--sys-size-9)}.info-icon{cursor:pointer;position:relative;margin-left:var(--sys-size-2);top:var(--sys-size-2);width:var(--sys-size-9);height:var(--sys-size-9)}.link{color:var(--text-link);text-decoration:underline}
/*# sourceURL=${import.meta.resolve("./settingCheckbox.css")} */`;var{html:r,Directives:{ifDefined:I}}=a,m={learnMore:"Learn more"},R=f.i18n.registerUIStrings("ui/components/settings/SettingCheckbox.ts",m),k=f.i18n.getLocalizedString.bind(void 0,R),d=class extends HTMLElement{#e=this.attachShadow({mode:"open"});#t;#i;#o;set data(t){this.#i&&this.#t&&this.#t.removeChangeListener(this.#i.listener),this.#t=t.setting,this.#o=t.textOverride,this.#i=this.#t.addChangeListener(()=>{this.#s()}),this.#s()}icon(){if(!this.#t)return;if(this.#t.deprecation)return r`<devtools-setting-deprecation-warning .data=${this.#t.deprecation}></devtools-setting-deprecation-warning>`;let e=g.SettingUIRegistration.maybeResolve(this.#t.descriptor())?.learnMore??this.#t.learnMore();if(e){let s=`${this.#t.name}-documentation`,i={iconName:"info",variant:"icon",size:"SMALL",jslogContext:s},o=e.url;if(e.tooltip){let n=`${this.#t.name}-information`;return r`
          <devtools-button
            class="info-icon"
            aria-details=${n}
            aria-disabled=true
            accessibleLabel=${e.tooltip()}
            .data=${i}
          ></devtools-button>
          <devtools-tooltip id=${n} variant="rich">
            <span>${e.tooltip()}</span><br />
            ${o?r`<devtools-link
                  href=${o}
                  class="link"
                  .jslogContext=${s}
                  >${k(m.learnMore)}</devtools-link
                >`:a.nothing}
          </devtools-tooltip>
        `}if(o){let n=p=>{L.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(o),p.consume()};return i.iconName="help",i.title=k(m.learnMore),r`<devtools-button
          class="info-icon"
          @click=${n}
          .data=${i}
        ></devtools-button>`}}}get checked(){return!this.#t||this.#t.disabledReasons().length>0?!1:this.#t.get()}#s(){if(!this.#t)throw new Error('No "Setting" object provided for rendering');let t=g.SettingUIRegistration.maybeResolve(this.#t.descriptor()),e=t?.learnMore??this.#t.learnMore(),s=t?.title?.()??this.#t.title(),i=this.icon(),o=e?.tooltip?.()??"",n=this.#t.disabledReasons(),p=n.length?r`
      <devtools-button class="disabled-reason" .iconName=${"info"} .variant=${"icon"} .size=${"SMALL"} title=${I(n.join(`
`))} @click=${onclick}></devtools-button>
    `:a.nothing;a.render(r`
      <style>${S.checkboxStyles}</style>
      <style>${x}</style>
      <p>
        <label title=${o}>
          <input
            type="checkbox"
            .checked=${this.checked}
            ?disabled=${this.#t.disabled()}
            @change=${this.#n}
            jslog=${y.toggle().track({change:!0}).context(this.#t.name)}
            aria-label=${s}
          />
          ${this.#o||s}${p}
        </label>
        ${i}
      </p>`,this.#e,{host:this})}#n(t){this.#t?.set(t.target.checked),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!1}))}};customElements.define("setting-checkbox",d);export{w as SettingCheckbox,$ as SettingDeprecationWarning};
//# sourceMappingURL=settings.js.map
