var t,e,i={2218(t,e,i){i.d(e,{AG:()=>R,F7:()=>f,K_:()=>y}),i(2273),i(9189);var s=i(2900),o=i(9609),a=i(878),r=i(3331),m=i(4084),n=i(2927),l=i(8899),h=i(4955),u=i(3517),p=i(9642),c=i(7911),d=function(t,e,i,s){var o,a=arguments.length,r=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var m=t.length-1;m>=0;m--)(o=t[m])&&(r=(a<3?o(r):a>3?o(e,i,r):o(e,i))||r);return a>3&&r&&Object.defineProperty(e,i,r),r};const f=[s.R5.HOUR,s.R5.MINUTE,s.R5.SECOND,s.R5.AM_PM],y=[s.R5.HOUR,s.R5.MINUTE,s.R5.SECOND],v={[s.R5.HOUR]:"HH",[s.R5.MINUTE]:"MM",[s.R5.SECOND]:"SS",[s.R5.AM_PM]:"AM"};var R;!function(t){let e=class extends n.LitElement{constructor(){super(...arguments),this.twoDigitAutoTab=!1,this.twentyFourHourFormat=!1,this.timeSpecificity=s.R5.SECOND,this.locale="en-US",this.value=null,this.showDefaultNowTime=!0,this.finalTwentyFourFormat=!1,this.timeObject=(0,a.tB)(),this.tabNext=!1,this.timeValue={[s.R5.HOUR]:"12",[s.R5.MINUTE]:"00",[s.R5.SECOND]:"00",[s.R5.AM_PM]:"AM"},this.timeValidity={[s.R5.HOUR]:!0,[s.R5.MINUTE]:!0,[s.R5.SECOND]:!0,[s.R5.AM_PM]:!0},this.addLeadingZeros=t=>{if(t){if(0===t.length)return"00";if(1===t.length)return`0${t}`}return t},this.formatAndValidate=(t,e)=>{if(t&&(this.updateValidity(t,e),this.timeValidity[e]))return this.addLeadingZeros(t)},this.getLocaleTimeFormat=t=>{const e=t.toFormat("tt"),[,i]=e.split(" ");return!i},this.updateTimeValues=()=>{let t;t=this.finalTwentyFourFormat?this.timeObject.toFormat("HH:mm:ss"):this.timeObject.toFormat("hh:mm:ss a");const[e,i]=t.split(" "),o=e.split(":");y.forEach(t=>{const e=this.formatAndValidate(o.shift(),t);e&&(t===s.R5.HOUR&&i&&(this.timeValue[s.R5.AM_PM]=i),this.timeValue[t]=e)})},this.updateValidity=(t,e)=>{let i=!0;if(!this.showDefaultNowTime&&!this.value&&!t)return void(this.timeValidity[e]=!0);const o=e=>{null===t.match(e)&&(i=!1)};switch(e){case s.R5.HOUR:this.finalTwentyFourFormat?o(new RegExp(r.b.twentyFourHourString)):o(new RegExp(r.b.hourString));break;case s.R5.MINUTE:case s.R5.SECOND:o(new RegExp(r.b.minuteSecondString));break;case s.R5.AM_PM:o(new RegExp(r.b.amPmString))}this.timeValidity[e]=i},this.to12HourFormat=(t,e)=>{if(!this.finalTwentyFourFormat&&this.timeValidity[s.R5.HOUR]&&this.timeValidity[s.R5.AM_PM]){let i=Number(e);return"PM"===t?i=12+i%12:i%=12,i}},this.isEntireTimeValid=()=>{const t=[s.R5.HOUR];this.timeSpecificity!==s.R5.MINUTE&&this.timeSpecificity!==s.R5.SECOND||t.push(s.R5.MINUTE),this.timeSpecificity===s.R5.SECOND&&t.push(s.R5.SECOND),this.finalTwentyFourFormat||t.push(s.R5.AM_PM);const e=t.every(t=>this.timeValidity[t]);return(this.showDefaultNowTime||this.value||t.every(t=>!!this.timeValue[t]))&&e},this.updateTimeUnit=t=>{var e,i;if(this.updateValidity(this.timeValue[t],t),this.showDefaultNowTime||this.value){if(this.timeObject&&this.timeValidity[t]){if(t!==s.R5.AM_PM)this.timeObject=null===(e=this.timeObject)||void 0===e?void 0:e.set({[t]:Number(this.timeValue[t])});else{const t=this.to12HourFormat(this.timeValue[s.R5.AM_PM],this.timeValue[s.R5.HOUR]);void 0!==t&&(this.timeObject=null===(i=this.timeObject)||void 0===i?void 0:i.set({hour:t}))}this.isEntireTimeValid()&&(this.value=this.timeObject.toISOTime({suppressMilliseconds:!0})||this.value,this.dispatchTimeChangeEvent())}}else{const t=this.timeValue[s.R5.HOUR]||"00",e=this.timeValue[s.R5.MINUTE]||"00",i=this.timeValue[s.R5.SECOND]||"00";try{let o=`${t}:${e}:${i}`;!this.finalTwentyFourFormat&&this.timeValue[s.R5.AM_PM]&&(o+=` ${this.timeValue[s.R5.AM_PM]}`),this.timeObject=p.DateTime.fromFormat(o,this.finalTwentyFourFormat?"HH:mm:ss":"hh:mm:ss a"),this.timeObject.isValid&&this.isEntireTimeValid()&&(this.value=this.timeObject.toISOTime({suppressMilliseconds:!0}),this.dispatchTimeChangeEvent())}catch(t){console.warn("Failed to construct time object:")}}},this.formatTimeUnit=t=>{if(1===this.timeValue[t].length)"0"!==this.timeValue[t]&&(this.timeValue[t]="0"+this.timeValue[t]);else if(this.timeValue[t].length>2&&"0"===this.timeValue[t][0]){const e=this.timeValue[t].substring(1);RegExp(r.b.noPrecedingZerosString).test(e)&&(this.timeValue[t]=e)}this.requestUpdate()},this.messageType=t=>t?"":"error",this.generateTimeBox=t=>{const e=(i=this.finalTwentyFourFormat,{[s.R5.HOUR]:{type:"number",min:i?0:1,max:i?23:12},[s.R5.MINUTE]:{type:"number",min:0,max:59},[s.R5.SECOND]:{type:"number",min:0,max:59},[s.R5.AM_PM]:{type:"text",min:void 0,max:void 0}})[t];var i;return n.html`
        ${t===s.R5.MINUTE||t===s.R5.SECOND?n.html` <span class="colon-separator">:</span> `:n.nothing}
        <md-input
          newMomentum
          select-when-in-focus
          exportparts="input:timepicker-part-input"
          class="${`time-input-box ${t}`}"
          id="time-${f.findIndex(e=>e===t)+1}"
          value="${this.timeValue[t]}"
          type="${e.type}"
          min=${(0,u.ifDefined)(e.min)}
          max=${(0,u.ifDefined)(e.max)}
          maxLength=${2}
          placeholder="${v[t]}"
          @input-change=${e=>this.handleTimeChange(e,t)}
          @input-keydown=${e=>this.handleTimeKeyDown(e,t)}
          @input-blur=${e=>this.handleTimeBlur(e,t)}
          .messageArr=${[{message:"",type:this.messageType(this.timeValidity[t])}]}
          .ariaLabel="${t}-input"
          ariaInvalid="${!this.timeValidity[t]}"
        ></md-input>
      `},this.generateAmPmComboBox=()=>n.html`
        <md-combobox
          newMomentum
          select-when-in-focus
          class="amPm-combo-box"
          .options=${["AM","PM"]}
          .value=${[this.timeValue[s.R5.AM_PM]]}
          .preventFilter=${!0}
          is-dropdown-arrow
          no-clear-icon
          .inputValue=${this.timeValue[s.R5.AM_PM]}
          .ariaLabel=${this.timeValue[s.R5.AM_PM]}
          @change-selected=${t=>this.handleTimeChange(t,s.R5.AM_PM)}
        >
        </md-combobox>
      `}get timePickerClassMap(){return{"twenty-four-hour-format":this.finalTwentyFourFormat}}connectedCallback(){super.connectedCallback(),this.initializeTimeValues()}updated(t){super.updated(t),["value","locale","twentyFourHourFormat","showDefaultNowTime","timeSpecificity"].some(e=>t.has(e))&&this.initializeTimeValues()}initializeTimeValues(){if(this.showDefaultNowTime||this.value){const t=this.value||(0,a.tB)().toISOTime({suppressMilliseconds:!0});t&&this.updateValue(t)}else{const t=p.DateTime.now().setLocale(this.locale),e=this.getLocaleTimeFormat(t);this.finalTwentyFourFormat=this.twentyFourHourFormat||e;const i=this.timeSpecificity===s.R5.MINUTE||this.timeSpecificity===s.R5.SECOND,o=this.timeSpecificity===s.R5.SECOND;this.timeValue={[s.R5.HOUR]:"",[s.R5.MINUTE]:i?"":"00",[s.R5.SECOND]:o?"":"00",[s.R5.AM_PM]:"AM"}}}updateValue(t){const e=t||this.value;if(!e)return;this.timeObject=p.DateTime.fromISO(e,{locale:this.locale});const i=this.getLocaleTimeFormat(this.timeObject);this.finalTwentyFourFormat=this.twentyFourHourFormat||i,this.value=this.timeObject.toISOTime({suppressMilliseconds:!0}),this.updateTimeValues()}dispatchTimeChangeEvent(){this.dispatchEvent(new CustomEvent("time-selection-change",{bubbles:!0,composed:!0,detail:{time:this.value,data:this.timeObject,isValid:this.isEntireTimeValid()}}))}handleTimeChange(t,e){var i,o,a;this.timeValue[e]=null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.value,this.requestUpdate(),this.formatTimeUnit(e);const r=this.timeValue[e];if(this.twoDigitAutoTab&&this.tabNext&&(e!==s.R5.AM_PM&&2===r.length&&"0"!==r[0]||"00"===r)){t.preventDefault();const e=null==t?void 0:t.target,i=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll("md-input, md-combobox");if(i){const t=Array.prototype.findIndex.call(i,t=>null==e?void 0:e.isEqualNode(t)),s=(t+1)%i.length;if(t<i.length-1){const t=null===(a=i[s].shadowRoot)||void 0===a?void 0:a.querySelector("input");null==t||t.focus()}}}else e===s.R5.AM_PM&&this.updateTimeUnit(e);t.stopPropagation(),this.dispatchEvent(new CustomEvent(`${e}-change`,{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.timeValue[e]}`,isValid:this.timeValidity[e]}}))}handleTimeKeyDown(t,e){var i;const o=null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.srcEvent;if(!o)return void console.warn("srcEvent is undefined");const{key:a}=o;a===s.Uz.ArrowDown||a===s.Uz.ArrowUp?this.tabNext=!1:this.tabNext=!0,this.timeValidity[e]=!0,this.requestUpdate(),t.stopPropagation(),this.dispatchEvent(new CustomEvent(`${e}-keydown`,{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.timeValue[e]}`}}))}handleTimeBlur(t,e){"0"===this.timeValue[e]&&(this.timeValue[e]="00"),this.updateTimeUnit(e),this.requestUpdate(),t.stopPropagation(),this.dispatchEvent(new CustomEvent(`${e}-blur`,{bubbles:!0,composed:!0,detail:{srcEvent:t,time:this.value,isValid:this.timeValidity[e]}}))}static get styles(){return[m.A,c.A]}render(){return n.html`
        <div class="md-timepicker ${(0,h.classMap)(this.timePickerClassMap)}">
          <div class="time-inputs-wrapper">
            ${this.generateTimeBox(s.R5.HOUR)}
            ${this.timeSpecificity===s.R5.HOUR?n.nothing:this.generateTimeBox(s.R5.MINUTE)}
            ${this.timeSpecificity===s.R5.MINUTE||this.timeSpecificity===s.R5.HOUR?n.nothing:this.generateTimeBox(s.R5.SECOND)}
            ${this.finalTwentyFourFormat?n.nothing:this.generateAmPmComboBox()}
          </div>
        </div>
      `}};d([(0,l.property)({type:Boolean,attribute:"two-digit-auto-tab"})],e.prototype,"twoDigitAutoTab",void 0),d([(0,l.property)({type:Boolean,attribute:"twenty-four-hour-format",reflect:!0})],e.prototype,"twentyFourHourFormat",void 0),d([(0,l.property)({type:String})],e.prototype,"timeSpecificity",void 0),d([(0,l.property)({type:String})],e.prototype,"locale",void 0),d([(0,l.property)({type:String,reflect:!0})],e.prototype,"value",void 0),d([(0,l.property)({type:Boolean,attribute:"show-default-now-time"})],e.prototype,"showDefaultNowTime",void 0),d([(0,l.state)()],e.prototype,"finalTwentyFourFormat",void 0),d([(0,l.state)()],e.prototype,"timeObject",void 0),d([(0,l.state)()],e.prototype,"tabNext",void 0),d([(0,l.state)()],e.prototype,"timeValue",void 0),d([(0,l.state)()],e.prototype,"timeValidity",void 0),e=d([(0,o.w)("md-timepicker")],e),t.ELEMENT=e}(R||(R={}))},2900(t,e,i){var s,o,a,r;i.d(e,{R5:()=>o,Uz:()=>s,iw:()=>r}),function(t){t.ArrowDown="ArrowDown",t.ArrowLeft="ArrowLeft",t.ArrowRight="ArrowRight",t.ArrowUp="ArrowUp",t.Backspace="Backspace",t.Delete="Delete",t.End="End",t.Enter="Enter",t.Escape="Escape",t.Home="Home",t.Space="Space",t.Tab="Tab",t.Digit1="Digit1",t.Digit2="Digit2",t.Digit3="Digit3",t.Digit4="Digit4",t.Digit5="Digit5",t.Digit6="Digit6",t.Digit7="Digit7",t.Digit8="Digit8",t.Digit9="Digit9",t.NumpadEnter="NumpadEnter"}(s||(s={})),function(t){t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.AM_PM="am_pm"}(o||(o={})),function(t){t.GRAMMAR="grammar",t.FALSE="false",t.SPELLING="spelling",t.TRUE="true"}(a||(a={})),function(t){t.AriaActivedescendant="aria-activedescendant"}(r||(r={}))}},s={};function o(t){var e=s[t];if(void 0!==e)return e.exports;var a=s[t]={exports:{}};return i[t].call(a.exports,a,a.exports,o),a.exports}o.m=i,t=[],o.O=(e,i,s,a)=>{if(!i){var r=1/0;for(h=0;h<t.length;h++){for(var[i,s,a]=t[h],m=!0,n=0;n<i.length;n++)(!1&a||r>=a)&&Object.keys(o.O).every(t=>o.O[t](i[n]))?i.splice(n--,1):(m=!1,a<r&&(r=a));if(m){t.splice(h--,1);var l=s();void 0!==l&&(e=l)}}return e}a=a||0;for(var h=t.length;h>0&&t[h-1][2]>a;h--)t[h]=t[h-1];t[h]=[i,s,a]},o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);export{o as __webpack_require__};e={519:0,2900:0,5757:0,7145:0,8138:0},o.C=t=>{var i,s,{__webpack_esm_ids__:a,__webpack_esm_modules__:r,__webpack_esm_runtime__:m}=t,n=0;for(i in r)o.o(r,i)&&(o.m[i]=r[i]);for(m&&m(o);n<a.length;n++)s=a[n],o.o(e,s)&&e[s]&&e[s][0](),e[a[n]]=0;o.O()},o.O.j=t=>0===e[t];import*as a from"../7103.js";o.C(a);import*as r from"../9609.js";o.C(r);import*as m from"../4084.js";o.C(m);import*as n from"../4955.js";o.C(n);import*as l from"../3517.js";o.C(l);import*as h from"../1156.js";o.C(h);import*as u from"../3305.js";o.C(u);import*as p from"../4739.js";o.C(p);import*as c from"../7154.js";o.C(c);import*as d from"../9773.js";o.C(d);import*as f from"../5983.js";o.C(f);import*as y from"../7755.js";o.C(y);import*as v from"../1821.js";o.C(v);import*as R from"../2364.js";o.C(R);import*as g from"../4980.js";o.C(g);import*as w from"../5308.js";o.C(w);import*as b from"../9938.js";o.C(b);import*as T from"../4781.js";o.C(T);import*as M from"../5201.js";o.C(M);import*as E from"../5584.js";o.C(E);import*as C from"../8227.js";o.C(C);import*as O from"../7704.js";o.C(O);import*as V from"../2577.js";o.C(V);import*as j from"../2797.js";o.C(j);import*as D from"../3970.js";o.C(D);import*as A from"../7906.js";o.C(A);import*as S from"../9336.js";o.C(S);import*as N from"../2369.js";o.C(N);import*as F from"../9642.js";o.C(F);import*as U from"../7119.js";o.C(U);import*as _ from"../9189.js";o.C(_);import*as x from"../4047.js";o.C(x);import*as P from"../3331.js";o.C(P);import*as $ from"../4613.js";o.C($);import*as H from"../4431.js";o.C(H);import*as I from"../4654.js";o.C(I);import*as k from"../8497.js";o.C(k);import*as L from"../7911.js";o.C(L);var B=o.O(void 0,[7103,9609,4084,4955,3517,1156,3305,4739,7154,9773,5983,7755,1821,2364,4980,5308,9938,4781,5201,5584,8227,7704,2577,2797,3970,7906,9336,2369,9642,7119,9189,4047,3331,4613,4431,4654,8497,7911],()=>o(2218));const q=(B=o.O(B)).AG,z=B.K_,G=B.F7;export{q as TimePicker,z as timeSpecificity,G as timeUnits};