import*as e from"lit/directives/style-map.js";import*as t from"lit";import*as i from"@momentum-ui/utils/lib/getColorValue";import*as s from"lit/directives/if-defined.js";import*as r from"lit/directives/class-map.js";import*as o from"mobx";import*as a from"lit/decorators.js";import*as c from"@momentum-ui/icons/data/momentumUiIconsNames.json";var n,d,l={1156(t,i,s){var r,o;t.exports=(r={styleMap:()=>e.styleMap},o={},s.d(o,r),o)},2927(e,i,s){var r,o;e.exports=(r={LitElement:()=>t.LitElement,css:()=>t.css,html:()=>t.html,nothing:()=>t.nothing},o={},s.d(o,r),o)},3496(e,t,s){var r,o;e.exports=(r={default:()=>i.default},o={},s.d(o,r),o)},3517(e,t,i){var r,o;e.exports=(r={ifDefined:()=>s.ifDefined},o={},i.d(o,r),o)},4955(e,t,i){var s,o;e.exports=(s={classMap:()=>r.classMap},o={},i.d(o,s),o)},4980(e,t,i){var s,r;e.exports=(s={action:()=>o.action,observable:()=>o.observable},r={},i.d(r,s),r)},8381(e,t,i){i.d(t,{S:()=>s}),i(1821);var s,r=i(2900),o=i(7704),a=i(9609),c=i(4084),n=i(2927),d=i(8899),l=i(4973),h=function(e,t,i,s){var r,o=arguments.length,a=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var c=e.length-1;c>=0;c--)(r=e[c])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};!function(e){let t=class extends((0,o.yC)(n.LitElement)){constructor(){super(...arguments),this.autofocus=!1,this._checked=!1,this._indeterminate=!1,this._disabled=!1,this.label="",this.tabIndex=0}get checked(){return this._checked}set checked(e){const t=this._checked;this._checked=e,this.requestUpdate("checked",t)}get indeterminate(){return this._indeterminate}set indeterminate(e){const t=this._indeterminate;this._indeterminate=e,this.requestUpdate("indeterminate",t)}get disabled(){return this._disabled}set disabled(e){const t=this._disabled;this._disabled=e,this.tabIndex=e?-1:0,this.requestUpdate("disabled",t)}static get styles(){return[c.A,l.A]}toggleCheckbox(){this.checked=!this.checked}isCheckboxActive(){return this.disabled||this.indeterminate}handleClick(e){this.isCheckboxActive()?e.stopPropagation():(this.toggleCheckbox(),this.handleChange(e))}handleKeyDown(e){const{code:t}=e;t!==r.Uz.Space&&t!==r.Uz.Enter||(e.preventDefault(),this.isCheckboxActive()?e.stopPropagation():(this.toggleCheckbox(),this.handleChange(e)))}handleChange(e){this.dispatchEvent(new CustomEvent("checkbox-change",{bubbles:!0,composed:!0,detail:{sourceEvent:e,checked:this.checked}}))}firstUpdated(e){super.firstUpdated(e),this.setAttribute("role","checkbox"),this.label&&this.setAttribute("aria-label",this.label)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("click",this.handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("click",this.handleClick)}willUpdate(e){var t;null===(t=super.willUpdate)||void 0===t||t.call(this,e),e.has("indeterminate")&&this.indeterminate&&(this.checked=!1),(e.has("checked")||e.has("indeterminate"))&&(this.indeterminate?this.setAttribute("aria-checked","mixed"):this.setAttribute("aria-checked",`${this.checked}`)),e.has("disabled")&&this.setAttribute("aria-disabled",`${this.disabled}`)}updated(e){super.updated(e),e.has("indeterminate")&&(this.input.indeterminate=this.indeterminate)}get checkboxIconName(){return this.checked?"check-bold":this.indeterminate?"minus-bold":null}checkboxIconTemplate(){const e=this.checkboxIconName;return e?n.html`<md-icon name="${e}" iconSet="momentumDesign" size="16"></md-icon>`:n.nothing}checkboxBoxTemplate(){return n.html` <div part="checkbox-box" class="checkbox-box">${this.checkboxIconTemplate()}</div> `}render(){return n.html`
        <input
          class="checkbox-input"
          type="checkbox"
          part="checkbox-input"
          ?checked=${this.checked}
          ?disabled=${this.disabled}
          ?autofocus=${this.autofocus}
          aria-hidden="true"
        />
        <label part="checkbox-label" class="checkbox-label">
          ${this.checkboxBoxTemplate()}
          <slot></slot>
        </label>
      `}};h([(0,d.property)({type:Boolean,reflect:!0})],t.prototype,"autofocus",void 0),h([(0,d.property)({type:Boolean,reflect:!0})],t.prototype,"checked",null),h([(0,d.property)({type:Boolean,reflect:!0})],t.prototype,"indeterminate",null),h([(0,d.property)({type:Boolean,reflect:!0})],t.prototype,"disabled",null),h([(0,d.property)({type:String})],t.prototype,"label",void 0),h([(0,d.property)({type:Number,reflect:!0})],t.prototype,"tabIndex",void 0),h([(0,d.query)(".checkbox-input")],t.prototype,"input",void 0),t=h([(0,a.w)("md-checkbox")],t),e.ELEMENT=t}(s||(s={}))},8899(e,t,i){var s,r;e.exports=(s={property:()=>a.property,query:()=>a.query,state:()=>a.state},r={},i.d(r,s),r)},9500(e,t,i){var s,r;e.exports=(s={default:()=>c.default},r={},i.d(r,s),r)}},h={};function p(e){var t=h[e];if(void 0!==t)return t.exports;var i=h[e]={exports:{}};return l[e](i,i.exports,p),i.exports}p.m=l,n=[],p.O=(e,t,i,s)=>{if(!t){var r=1/0;for(d=0;d<n.length;d++){for(var[t,i,s]=n[d],o=!0,a=0;a<t.length;a++)(!1&s||r>=s)&&Object.keys(p.O).every(e=>p.O[e](t[a]))?t.splice(a--,1):(o=!1,s<r&&(r=s));if(o){n.splice(d--,1);var c=i();void 0!==c&&(e=c)}}return e}s=s||0;for(var d=n.length;d>0&&n[d-1][2]>s;d--)n[d]=n[d-1];n[d]=[t,i,s]},p.d=(e,t)=>{for(var i in t)p.o(t,i)&&!p.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},p.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);export{p as __webpack_require__};d={502:0,1745:0,4545:0,4928:0,5369:0,6060:0,6920:0,7455:0,8111:0,8442:0},p.C=e=>{var t,i,{__webpack_esm_ids__:s,__webpack_esm_modules__:r,__webpack_esm_runtime__:o}=e,a=0;for(t in r)p.o(r,t)&&(p.m[t]=r[t]);for(o&&o(p);a<s.length;a++)i=s[a],p.o(d,i)&&d[i]&&d[i][0](),d[s[a]]=0;p.O()},p.O.j=e=>0===d[e];import*as m from"../9609.js";p.C(m);import*as b from"../4084.js";p.C(b);import*as u from"../3305.js";p.C(u);import*as f from"../4739.js";p.C(f);import*as k from"../7154.js";p.C(k);import*as v from"../9773.js";p.C(v);import*as x from"../5983.js";p.C(x);import*as y from"../9488.js";p.C(y);import*as C from"../1821.js";p.C(C);import*as g from"../2364.js";p.C(g);import*as j from"../9938.js";p.C(j);import*as _ from"../4781.js";p.C(_);import*as w from"../5201.js";p.C(w);import*as E from"../5584.js";p.C(E);import*as O from"../8227.js";p.C(O);import*as A from"../2900.js";p.C(A);import*as U from"../7704.js";p.C(U);import*as D from"../4973.js";p.C(D);var I=p.O(void 0,[9609,4084,3305,4739,7154,9773,5983,9488,1821,2364,9938,4781,5201,5584,8227,2900,7704,4973],()=>p(8381));const L=(I=p.O(I)).S;export{L as Checkbox};