import*as t from"lit";import*as e from"lit/decorators.js";import*as o from"lit/directives/class-map.js";import*as i from"lit/directives/if-defined.js";var r,s,p={2583(t,e,o){o.d(e,{v:()=>i}),o(2708),o(9613);var i,r=o(2900),s=o(9609),p=o(4084),a=o(2927),n=o(8899),l=o(4955),h=o(3517),d=o(9558),c=function(t,e,o,i){var r,s=arguments.length,p=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,o,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(p=(s<3?r(p):s>3?r(e,o,p):r(e,o))||p);return s>3&&p&&Object.defineProperty(e,o,p),p};!function(t){let e=class extends a.LitElement{constructor(){super(...arguments),this.color="",this.bgColor="",this.textColor="",this.height="",this.icon="",this.iconColor="",this.iconSize="",this.role="group",this.id="",this.small=!1,this.readonly=!1,this.selected=!1,this.disabled=!1,this.determinateProgress=0,this.indeterminateProgress=!1,this.tooltipText="",this.tooltipPlacement="auto",this.iconSet="momentumUI",this.suppressDefaultMaxWidth=!1,this.decorative=!1,this.shouldTruncateValue=!0,this.value="",this.textOverflow=!1,this.renderedText="",this.MAXWIDTH=115,this.selectionChange=t=>{this.dispatchEvent(new CustomEvent("chip-selected",{composed:!0,bubbles:!0,detail:{selected:t}}))},this.handleClear=t=>{this.dispatchEvent(new CustomEvent("chip-deleted",{composed:!0,bubbles:!0,detail:{id:t}}))},this.handleSelect=()=>{this.disabled||(this.selected=!0,this.selectionChange(!0))},this.handleDeSelect=()=>{this.selected=!1,this.selectionChange(!1)},this.renderBgColor=()=>this.bgColor?`background-color: ${this.bgColor};`:a.nothing,this.renderTextColor=()=>this.textColor?`color: ${this.textColor};`:a.nothing,this.renderHeight=()=>this.height?`height: ${this.height};`:a.nothing,this.getStyles=()=>this.bgColor||this.textColor||this.height?a.html`
          <style>
            :host .md-chip {
              ${this.renderBgColor()};
              ${this.renderTextColor()};
              ${this.renderHeight()};
            }
          </style>
        `:a.nothing}connectedCallback(){super.connectedCallback(),this.truncStringPortion(this.value),this.setAttribute("role",this.role)}willUpdate(t){super.willUpdate(t),(t.has("value")||t.has("shouldTruncateValue"))&&this.truncStringPortion(this.value)}getTextWidth(t,e){const o=null!=e?e:getComputedStyle(this).font,i=document.createElement("canvas").getContext("2d");return i?(i.font=o,i.measureText(t).width):0}truncStringPortion(t){const e=this.getTextWidth(t);if(!this.shouldTruncateValue||e<this.MAXWIDTH)return this.renderedText=t,void(this.textOverflow=!1);const o=Array.from(t);let i=Math.min(4,o.length),r=Math.min(5,Math.max(0,o.length-i-1)),s=o.slice(0,i).join(""),p=o.slice(-r).join(""),a=`${s}…${p}`;if(this.getTextWidth(a)>this.MAXWIDTH)return this.renderedText=a,void(this.textOverflow=!0);for(;i+r<o.length;){let t=!1;if(i+r<o.length){const e=s+o[i],r=`${e}…${p}`;this.getTextWidth(r)<=this.MAXWIDTH&&(s=e,i+=1,a=r,t=!0)}if(i+r<o.length){const e=o[o.length-r-1]+p,i=`${s}…${e}`;this.getTextWidth(i)<=this.MAXWIDTH&&(p=e,r+=1,a=i,t=!0)}if(!t)break}this.renderedText=a,this.textOverflow=!0}handleClick(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("md-tooltip");null==e||e.dispatchEvent(new CustomEvent("tooltip-destroy",{bubbles:!0,composed:!0,detail:{placement:null==e?void 0:e.placement,reference:null==e?void 0:e.reference,popper:null==e?void 0:e.popper}})),this.dispatchEvent(new CustomEvent("chip-interaction",{composed:!0,bubbles:!0,detail:{id:this.id}}))}handleKeydown(t){switch(t.code){case r.Uz.Space:case r.Uz.Enter:this.handleSelect(),this.handleClick()}}static get styles(){return[p.A,d.A]}loadingTemplate(){return this.determinateProgress||this.indeterminateProgress?this.determinateProgress?a.html`
              <md-progress-bar
                class="md-chip--loading"
                type="determinate"
                value="${this.determinateProgress}"
                displayFormat="none"
              >
              </md-progress-bar>
            `:a.html`
              <md-progress-bar class="md-chip--loading" type="indeterminate" displayFormat="none"></md-progress-bar>
            `:a.nothing}iconTemplate(){const t=this.disabled?"":this.iconColor;return this.icon?a.html`
            <md-icon
              class="md-chip--icon"
              part="chip-icon"
              name="${this.icon}"
              color="${t}"
              iconSet=${(0,h.ifDefined)(this.iconSet)}
              size="${(0,h.ifDefined)(this.iconSize)}"
            >
            </md-icon>
          `:a.nothing}getToolTipContent(){return this.tooltipText&&this.textOverflow?this.value===this.tooltipText?this.tooltipText:`${this.value}, ${this.tooltipText}`:this.tooltipText?this.tooltipText:this.value}get textContentClassMap(){return{"md-chip--textcontent":!0,"md-chip--suppress-default-max-width":this.suppressDefaultMaxWidth}}get textContentTemplate(){return a.html`<span part="text-content" class=${(0,l.classMap)(this.textContentClassMap)}> ${this.renderedText}</span>`}render(){const t={"md-chip--small":this.small,"md-chip--disabled":this.disabled,[`md-chip--${this.color}`]:this.color,"suppress-max-width":this.suppressDefaultMaxWidth,"md-chip--interactive":!this.decorative},e=this.decorative?void 0:this.selected?"true":"false";return a.html`
        ${this.getStyles()}
        <md-tooltip
          ?disabled=${!this.tooltipText&&!this.textOverflow}
          message="${this.getToolTipContent()}"
          part="tooltip"
          placement="${this.tooltipPlacement}"
        >
          <span
            role=${(0,h.ifDefined)(this.decorative?void 0:"button")}
            tabindex="0"
            class="md-chip ${(0,l.classMap)(t)}"
            part="chip"
            aria-pressed=${(0,h.ifDefined)(e)}
            @click=${this.decorative?void 0:()=>this.handleClick()}
            @keydown=${this.decorative?void 0:t=>this.handleKeydown(t)}
          >
            ${this.loadingTemplate()} ${this.iconTemplate()}
            <slot name="custom-left-content" part="chip-left"> </slot>
            ${this.renderedText?this.textContentTemplate:a.nothing}
            <slot name="custom-right-content" part="chip-right"> </slot>
          </span>
        </md-tooltip>
      `}};c([(0,n.property)({type:String})],e.prototype,"color",void 0),c([(0,n.property)({type:String})],e.prototype,"bgColor",void 0),c([(0,n.property)({type:String})],e.prototype,"textColor",void 0),c([(0,n.property)({type:String})],e.prototype,"height",void 0),c([(0,n.property)({type:String})],e.prototype,"icon",void 0),c([(0,n.property)({type:String})],e.prototype,"iconColor",void 0),c([(0,n.property)({type:String})],e.prototype,"iconSize",void 0),c([(0,n.property)({type:String})],e.prototype,"role",void 0),c([(0,n.property)({type:String,reflect:!0})],e.prototype,"id",void 0),c([(0,n.property)({type:Boolean})],e.prototype,"small",void 0),c([(0,n.property)({type:Boolean})],e.prototype,"readonly",void 0),c([(0,n.property)({type:Boolean,reflect:!0})],e.prototype,"selected",void 0),c([(0,n.property)({type:Boolean})],e.prototype,"disabled",void 0),c([(0,n.property)({type:Number})],e.prototype,"determinateProgress",void 0),c([(0,n.property)({type:Boolean})],e.prototype,"indeterminateProgress",void 0),c([(0,n.property)({type:String})],e.prototype,"tooltipText",void 0),c([(0,n.property)({type:String})],e.prototype,"tooltipPlacement",void 0),c([(0,n.property)({type:String})],e.prototype,"iconSet",void 0),c([(0,n.property)({type:Boolean,attribute:"suppress-default-max-width"})],e.prototype,"suppressDefaultMaxWidth",void 0),c([(0,n.property)({type:Boolean})],e.prototype,"decorative",void 0),c([(0,n.property)({type:Boolean})],e.prototype,"shouldTruncateValue",void 0),c([(0,n.property)({type:String,hasChanged:(t,e)=>t!==e})],e.prototype,"value",void 0),c([(0,n.state)({hasChanged:(t,e)=>t!==e})],e.prototype,"textOverflow",void 0),c([(0,n.state)()],e.prototype,"renderedText",void 0),e=c([(0,s.w)("md-chip")],e),t.ELEMENT=e}(i||(i={}))},2708(t,e,o){var i,r=o(9609),s=o(4084),p=o(2927),a=o(8899),n=o(4955),l=o(6631),h=function(t,e,o,i){var r,s=arguments.length,p=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,o,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(p=(s<3?r(p):s>3?r(e,o,p):r(e,o))||p);return s>3&&p&&Object.defineProperty(e,o,p),p};!function(t){let e=class extends p.LitElement{constructor(){super(...arguments),this.dynamic=!1,this.color="",this.label="",this.displayFormat="percentage",this.type="indeterminate",this.min=0,this.max=100,this.value=25,this.adjustedValue=0,this.valueFraction=0,this.meterWidth="100",this.getDisplayFormat=()=>"indeterminate"===this.type?(this.value=100,null):(this.adjustedValue=this.max-this.value<0?this.max:this.value,this.valueFraction=this.adjustedValue/this.max*100||0,this.meterWidth=this.valueFraction.toFixed(0)+"%","none"===this.displayFormat?null:"percentage"===this.displayFormat?this.meterWidth:`${this.adjustedValue} / ${this.max}`),this.getColor=()=>this.color?this.color:this.dynamic?this.valueFraction<25?"success":this.valueFraction<50?"info":this.valueFraction<75?"warning":"danger":void 0}connectedCallback(){super.connectedCallback(),this.requestUpdate("value")}static get styles(){return[s.A,l.A]}render(){const t={[`progress--${this.type}`]:this.type,[`progress--${this.color}`]:this.color};return p.html`
        <span>
          <div class="progressbar-info" data-key="${this.min}">
            <span class="progressbar-label">${this.label}</span>
            <span class="progressbar-progress">${this.getDisplayFormat()}</span>
          </div>
          <div class="progress ${(0,n.classMap)(t)}" data-key="${this.max}">
            <span
              class="meter"
              role="progressbar"
              aria-labelledby="progressbar"
              aria-valuenow=${this.adjustedValue}
              aria-valuemin=${this.min}
              aria-valuemax=${this.max}
              aria-valuetext=${this.meterWidth}
              style="${"width: "+this.meterWidth+"; background: "+this.getColor()}"
            >
            </span>
          </div>
        </span>
      `}};h([(0,a.property)({type:Boolean})],e.prototype,"dynamic",void 0),h([(0,a.property)({type:String})],e.prototype,"color",void 0),h([(0,a.property)({type:String})],e.prototype,"label",void 0),h([(0,a.property)({type:String})],e.prototype,"displayFormat",void 0),h([(0,a.property)({type:String})],e.prototype,"type",void 0),h([(0,a.property)({type:Number})],e.prototype,"min",void 0),h([(0,a.property)({type:Number})],e.prototype,"max",void 0),h([(0,a.property)({type:Number})],e.prototype,"value",void 0),h([(0,a.property)({type:Number})],e.prototype,"adjustedValue",void 0),h([(0,a.property)({type:Number})],e.prototype,"valueFraction",void 0),h([(0,a.property)({type:String})],e.prototype,"meterWidth",void 0),e=h([(0,r.w)("md-progress-bar")],e),t.ELEMENT=e}(i||(i={}))},2927(e,o,i){var r,s;e.exports=(r={LitElement:()=>t.LitElement,css:()=>t.css,html:()=>t.html,nothing:()=>t.nothing},s={},i.d(s,r),s)},8899(t,o,i){var r,s;t.exports=(r={property:()=>e.property,query:()=>e.query,state:()=>e.state},s={},i.d(s,r),s)},4955(t,e,i){var r,s;t.exports=(r={classMap:()=>o.classMap},s={},i.d(s,r),s)},3517(t,e,o){var r,s;t.exports=(r={ifDefined:()=>i.ifDefined},s={},o.d(s,r),s)}},a={};function n(t){var e=a[t];if(void 0!==e)return e.exports;var o=a[t]={exports:{}};return p[t](o,o.exports,n),o.exports}n.m=p,r=[],n.O=(t,e,o,i)=>{if(!e){var s=1/0;for(h=0;h<r.length;h++){for(var[e,o,i]=r[h],p=!0,a=0;a<e.length;a++)(!1&i||s>=i)&&Object.keys(n.O).every(t=>n.O[t](e[a]))?e.splice(a--,1):(p=!1,i<s&&(s=i));if(p){r.splice(h--,1);var l=o();void 0!==l&&(t=l)}}return t}i=i||0;for(var h=r.length;h>0&&r[h-1][2]>i;h--)r[h]=r[h-1];r[h]=[e,o,i]},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);export{n as __webpack_require__};s={502:0,1745:0,2708:0,4928:0,5369:0,6060:0,8111:0,8442:0,8894:0},n.C=t=>{var e,o,{__webpack_esm_ids__:i,__webpack_esm_modules__:r,__webpack_esm_runtime__:p}=t,a=0;for(e in r)n.o(r,e)&&(n.m[e]=r[e]);for(p&&p(n);a<i.length;a++)o=i[a],n.o(s,o)&&s[o]&&s[o][0](),s[i[a]]=0;n.O()},n.O.j=t=>0===s[t];import*as l from"../9609.js";n.C(l);import*as h from"../4084.js";n.C(h);import*as d from"../2364.js";n.C(d);import*as c from"../9938.js";n.C(c);import*as m from"../4781.js";n.C(m);import*as y from"../5584.js";n.C(y);import*as u from"../8227.js";n.C(u);import*as v from"../2900.js";n.C(v);import*as g from"../2050.js";n.C(g);import*as f from"../6343.js";n.C(f);import*as x from"../7582.js";n.C(x);import*as b from"../9613.js";n.C(b);import*as C from"../5323.js";n.C(C);import*as $ from"../6631.js";n.C($);import*as T from"../9558.js";n.C(T);var j=n.O(void 0,[9609,4084,2364,9938,4781,5584,8227,2900,2050,6343,7582,9613,5323,6631,9558],()=>n(2583));const S=(j=n.O(j)).v;export{S as Chip};