import*as t from"lit";import*as e from"lit/decorators.js";import*as s from"lit/directives/class-map.js";var i,o,r={120(t,e,s){s.d(e,{o:()=>y,y:()=>b});var i=s(2900),o=s(7704),r=s(9609),a=s(7154),l=s(4084),n=s(2927),d=s(8899),p=s(4955),c=s(3272),h=function(t,e,s,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(a=(r<3?o(a):r>3?o(e,s,a):o(e,s))||a);return r>3&&a&&Object.defineProperty(e,s,a),a};const b=22;var y;!function(t){let e=class extends((0,o.yC)(n.LitElement)){constructor(){super(...arguments),this.tabIndex=-1,this.ariaLabel="",this.closable="",this.name="",this.isCrossVisible=!1,this.role="tab",this.type="line",this.newMomentum=!1,this.onlyIcon=!1,this.variant="ghost",this.visibleTab=!1,this.size=28,this._disabled=!1,this._selected=0===this.tabIndex,this.vertical=!1,this.viewportHidden=!1}get disabled(){return this._disabled}set disabled(t){const e=this._disabled;this._disabled=t,t?this.tabDisabled():this.tabEnabled(),this.requestUpdate("disabled",e)}tabDisabled(){-1!==this.tabIndex&&(this.tabIndex=-1),this.setAttribute("aria-disabled","true")}tabEnabled(){-1===this.tabIndex&&this.selected&&(this.tabIndex=0),this.removeAttribute("aria-disabled")}get selected(){return this._selected}set selected(t){const e=this._selected;this._selected=t,t?(this.setAttribute("aria-selected","true"),this.tabIndex=0,this.notifySelectedTab()):(this.tabIndex=-1,this.removeAttribute("aria-selected")),this.requestUpdate("selected",e)}static get styles(){return[l.A,c.A]}handleClick(t){t.preventDefault(),this.id&&this.dispatchEvent(new CustomEvent("tab-click",{detail:{id:this.id},bubbles:!0,composed:!0}))}handleKeydown(t){if((0,a.o)(t.code)){if(this.disabled)return void t.preventDefault();this.handleClick(t)}}handleCrossKeydown(t){t.stopPropagation(),t.code===i.Uz.Enter&&this.handleCrossEventDispatch()}handleCrossClick(t){t.preventDefault(),!0!==this.disabled&&this.handleCrossEventDispatch()}handleCrossEventDispatch(){this.id&&("auto"===this.closable?this.dispatchEvent(new CustomEvent("tab-cross-click",{detail:{id:this.id},bubbles:!0,composed:!0})):"custom"===this.closable&&this.dispatchEvent(new CustomEvent("tab-close-click",{detail:{id:this.id,name:this.name},bubbles:!0,composed:!0})))}notifySelectedTab(){this.dispatchEvent(new CustomEvent("focus-visible",{composed:!0,bubbles:!0}))}update(t){super.update(t),t.has("disabled")&&this.disabled&&(this.selected=!1)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeydown)}firstUpdated(t){super.firstUpdated(t)}renderCrossButton(){return n.html`
        <md-button
          variant="ghost"
          size="size-none"
          circle
          class="tab-action-button"
          ?disabled=${this.disabled}
          @click=${t=>this.handleCrossClick(t)}
          @keydown=${t=>this.handleCrossKeydown(t)}
        >
          <md-icon name="cancel-bold" size="14" iconSet="momentumDesign"></md-icon>
        </md-button>
      `}render(){return n.html`
        <div
          part="tab"
          class="${(0,p.classMap)({disabled:this.disabled,"md-tab-content":!0,closable:""!==this.closable,pill:"pill"===this.type,rounded:"rounded"===this.type,line:"line"===this.type,primary:"primary"===this.variant,newMomentum:this.newMomentum,onlyIcon:this.onlyIcon})}"
        >
          <slot class="tab-slot"></slot>
          ${this.isCrossVisible&&this.closable?this.renderCrossButton():""}
        </div>
        <div part="indicator"></div>
        <!-- Invisible button for legacy third party test compatibility -->
        <button
          type="button"
          class="test-compatibility-button"
          aria-hidden="true"
          @click=${t=>this.handleClick(t)}
          @keydown=${t=>this.handleKeydown(t)}
        ></button>
      `}};h([(0,d.property)({type:Number,reflect:!0})],e.prototype,"tabIndex",void 0),h([(0,d.property)({type:String,attribute:"aria-label"})],e.prototype,"ariaLabel",void 0),h([(0,d.property)({type:String,attribute:"closable"})],e.prototype,"closable",void 0),h([(0,d.property)({type:String,attribute:"name"})],e.prototype,"name",void 0),h([(0,d.property)({type:Boolean,attribute:"cross-visible"})],e.prototype,"isCrossVisible",void 0),h([(0,d.property)({type:String,attribute:"role",reflect:!0})],e.prototype,"role",void 0),h([(0,d.property)({type:String,reflect:!0})],e.prototype,"type",void 0),h([(0,d.property)({type:Boolean})],e.prototype,"newMomentum",void 0),h([(0,d.property)({type:Boolean})],e.prototype,"onlyIcon",void 0),h([(0,d.property)({type:String})],e.prototype,"variant",void 0),h([(0,d.property)({type:Boolean,attribute:"visible-tab",reflect:!0})],e.prototype,"visibleTab",void 0),h([(0,d.property)({type:Number})],e.prototype,"size",void 0),h([(0,d.property)({type:Boolean,reflect:!0})],e.prototype,"disabled",null),h([(0,d.property)({type:Boolean,reflect:!0})],e.prototype,"selected",null),h([(0,d.property)({type:Boolean,reflect:!0})],e.prototype,"vertical",void 0),h([(0,d.property)({type:Boolean,reflect:!0})],e.prototype,"viewportHidden",void 0),e=h([(0,r.w)("md-tab")],e),t.ELEMENT=e}(y||(y={}))},2927(e,s,i){var o,r;e.exports=(o={LitElement:()=>t.LitElement,css:()=>t.css,html:()=>t.html},r={},i.d(r,o),r)},8899(t,s,i){var o,r;t.exports=(o={property:()=>e.property},r={},i.d(r,o),r)},4955(t,e,i){var o,r;t.exports=(o={classMap:()=>s.classMap},r={},i.d(r,o),r)}},a={};function l(t){var e=a[t];if(void 0!==e)return e.exports;var s=a[t]={exports:{}};return r[t](s,s.exports,l),s.exports}l.m=r,i=[],l.O=(t,e,s,o)=>{if(!e){var r=1/0;for(p=0;p<i.length;p++){for(var[e,s,o]=i[p],a=!0,n=0;n<e.length;n++)(!1&o||r>=o)&&Object.keys(l.O).every(t=>l.O[t](e[n]))?e.splice(n--,1):(a=!1,o<r&&(r=o));if(a){i.splice(p--,1);var d=s();void 0!==d&&(t=d)}}return t}o=o||0;for(var p=i.length;p>0&&i[p-1][2]>o;p--)i[p]=i[p-1];i[p]=[e,s,o]},l.d=(t,e)=>{for(var s in e)l.o(e,s)&&!l.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);export{l as __webpack_require__};o={502:0,1745:0,2139:0,4928:0,5369:0,8442:0},l.C=t=>{var e,s,{__webpack_esm_ids__:i,__webpack_esm_modules__:r,__webpack_esm_runtime__:a}=t,n=0;for(e in r)l.o(r,e)&&(l.m[e]=r[e]);for(a&&a(l);n<i.length;n++)s=i[n],l.o(o,s)&&o[s]&&o[s][0](),o[i[n]]=0;l.O()},l.O.j=t=>0===o[t];import*as n from"../9609.js";l.C(n);import*as d from"../4084.js";l.C(d);import*as p from"../7154.js";l.C(p);import*as c from"../2364.js";l.C(c);import*as h from"../9938.js";l.C(h);import*as b from"../4781.js";l.C(b);import*as y from"../5201.js";l.C(y);import*as m from"../5584.js";l.C(m);import*as v from"../8227.js";l.C(v);import*as u from"../2900.js";l.C(u);import*as f from"../7704.js";l.C(f);import*as C from"../3272.js";l.C(C);var _=l.O(void 0,[9609,4084,7154,2364,9938,4781,5201,5584,8227,2900,7704,3272],()=>l(120));const k=(_=l.O(_)).y,w=_.o;export{k as TAB_CROSS_WIDTH,w as Tab};