text: /*!
   * (C) Ionic http://ionicframework.com - MIT License
   * Built with http://stenciljs.com
   */
  const{h:t}=window.Ionic;import{f as e,c as i}from"./chunk-deb847e6.js";import{a as s,e as a}from"./chunk-11949516.js";import{f as n,g as o,i as r,a as l,b as h,c,d}from"./chunk-06643eba.js";import"./chunk-f79257a1.js";import{a as u}from"./chunk-9b785f2c.js";function m(t,e,i,s){if(t===T||t===N){try{return e=new Date(i.year,i.month-1,i.day).getDay(),t===T?(s.dayNames?s.dayNames:J)[e]:(s.dayShortNames?s.dayShortNames:z)[e]}catch(t){}return""}if(t===L)return i&&i.hour?i.hour<12?"AM":"PM":e?e.toUpperCase():"";if(t===q)return i&&i.hour?i.hour<12?"am":"pm":e||"";if(null==e)return"";if(t===w||t===Y||t===F||t===A||t===$||t===B)return M(e);if(t===S)return D(e);if(t===C)return(s.monthNames?s.monthNames:R)[e-1];if(t===I)return(s.monthShortNames?s.monthShortNames:K)[e-1];if(t===O||t===V){if(0===e)return"12";if(e>12&&(e-=12),t===O&&e<10)return"0"+e}return e.toString()}function p(t,e,i,s=0,a=0){return parseInt(`1${D(t)}${M(e)}${M(i)}${M(s)}${M(a)}`,10)}function y(t){return t?p(t.year,t.month,t.day,t.hour,t.minute):-1}const f=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/,b=/^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;function g(t){let e=null;if(t&&""!==t&&((e=b.exec(t))?(e.unshift(void 0,void 0),e[2]=e[3]=void 0):e=f.exec(t)),null==e)return null;for(let t=1;t<8;t++)e[t]=void 0!==e[t]?parseInt(e[t],10):null;let i=0;return e[9]&&e[10]&&(i=60*parseInt(e[10],10),e[11]&&(i+=parseInt(e[11],10)),"-"===e[9]&&(i*=-1)),{year:e[1],month:e[2],day:e[3],hour:e[4],minute:e[5],second:e[6],millisecond:e[7],tzOffset:i}}function k(t){for(const e in U)if(U[e].f===t)return U[e].k;return null}function v(t,e){if(!t)return;"string"==typeof t&&(t=t.replace(/\[|\]/g,"").split(","));let i=void 0;return Array.isArray(t)&&(i=t.map(t=>t.toString().trim())),i&&i.length||console.warn(`Invalid "${e}Names". Must be an array of strings, or a comma separated string.`),i}function x(t,e){let i;return"string"==typeof t&&(t=t.replace(/\[|\]|\s/g,"").split(",")),(i=Array.isArray(t)?t.map(t=>parseInt(t,10)).filter(isFinite):[t])&&i.length||console.warn(`Invalid "${e}Values". Must be an array of numbers, or a comma separated string of numbers.`),i}function M(t){return("0"+(t?Math.abs(t):"0")).slice(-2)}function D(t){return("000"+(t?Math.abs(t):"0")).slice(-4)}const S="YYYY",w="YY",C="MMMM",I="MMM",Y="MM",P="M",T="DDDD",N="DDD",F="DD",W="D",A="HH",E="H",O="hh",V="h",$="mm",H="m",B="ss",j="s",L="A",q="a",U=[{f:S,k:"year"},{f:C,k:"month"},{f:T,k:"day"},{f:I,k:"month"},{f:N,k:"day"},{f:w,k:"year"},{f:Y,k:"month"},{f:F,k:"day"},{f:A,k:"hour"},{f:O,k:"hour"},{f:$,k:"minute"},{f:B,k:"second"},{f:P,k:"month"},{f:W,k:"day"},{f:E,k:"hour"},{f:V,k:"hour"},{f:H,k:"minute"},{f:j,k:"second"},{f:L,k:"ampm"},{f:q,k:"ampm"}],J=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],z=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],R=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Z=[O,V,$,H,B,j];class X{constructor(){this.inputId=`ion-dt-${G++}`,this.labelId=`${this.inputId}-lbl`,this.locale={},this.datetimeMin={},this.datetimeMax={},this.datetimeValue={},this.disabled=!1,this.displayFormat="MMM D, YYYY",this.cancelText="Cancel",this.doneText="Done",this.pickerOptions={buttons:[],columns:[]}}disabledChanged(){this.emitStyle()}valueChanged(){this.updateValue(),this.emitStyle()}componentWillLoad(){this.ionStyle=i(this.ionStyle),this.locale={monthNames:v(this.monthNames,"monthNames"),monthShortNames:v(this.monthShortNames,"monthShortNames"),dayNames:v(this.dayNames,"dayNames"),dayShortNames:v(this.dayShortNames,"dayShortNames")},this.updateValue()}componentDidLoad(){this.emitStyle()}emitStyle(){this.ionStyle.emit({interactive:!0,datetime:!0,"has-value":this.hasValue(),"interactive-disabled":this.disabled})}updateValue(){!function(t,e){if(e&&""!==e){if("string"==typeof e){if(e=g(e))return Object.assign(t,e),!0}else if(e.year||e.hour||e.month||e.day||e.minute||e.second){e.ampm&&e.hour&&(e.hour.value="pm"===e.ampm.value?12===e.hour.value?12:e.hour.value+12:12===e.hour.value?0:e.hour.value);for(const i in e)t[i]=e[i].value;return!0}console.warn(`Error parsing date: "${e}". Please provide a valid ISO 8601 datetime format: https://www.w3.org/TR/NOTE-datetime`)}else for(const e in t)delete t[e]}(this.datetimeValue,this.value),this.updateText()}buildPicker(t){const e=t.buttons;return e&&0!==e.length||(t.buttons=[{text:this.cancelText,role:"cancel",handler:()=>this.ionCancel.emit()},{text:this.doneText,handler:t=>this.value=t}]),t.columns=this.generateColumns(),this.pickerCtrl.create(t)}async open(){if(this.disabled)return;const t=Object.assign({},this.pickerOptions);this.picker=await this.buildPicker(t),this.validate(),await this.picker.present()}generateColumns(){let t=[],e=this.pickerFormat||this.displayFormat||Q;if(e){this.calcMinMax(),-1===(e=e.replace("DDDD","{~}").replace("DDD","{~}")).indexOf("D")&&(e=e.replace("{~}","D")),function(t){const e=[];t=t.replace(/[^\w\s]/gi," "),U.forEach(e=>{e.f.length>1&&t.indexOf(e.f)>-1&&t.indexOf(e.f+e.f.charAt(0))<0&&(t=t.replace(e.f," "+e.f+" "))});const i=t.split(" ").filter(t=>t.length>0);return i.forEach((t,s)=>{U.forEach(a=>{if(t===a.f){if((t===L||t===q)&&(e.indexOf(V)<0&&e.indexOf(O)<0||-1===Z.indexOf(i[s-1])))return;e.push(t)}})}),e}(e=e.replace(/{~}/g,"")).forEach(e=>{const s=k(e);let a;const n={name:s,selectedIndex:0,options:(a=this[s+"Values"]?x(this[s+"Values"],s):function(t,e,i){const s=[];if(t===S||t===w){if(!i.year||!e.year)throw new Error("min and max year is undefined");for(let t=i.year-1;t>=e.year;t--)s.push(t)}else if(t===C||t===I||t===Y||t===P||t===O||t===V)for(let t=1;t<13;t++)s.push(t);else if(t===T||t===N||t===F||t===W)for(let t=1;t<32;t++)s.push(t);else if(t===A||t===E)for(let t=0;t<24;t++)s.push(t);else if(t===$||t===H)for(let t=0;t<60;t++)s.push(t);else if(t===B||t===j)for(let t=0;t<60;t++)s.push(t);else t!==L&&t!==q||s.push("am","pm");return s}(e,this.datetimeMin,this.datetimeMax)).map(t=>({value:t,text:m(e,t,null,this.locale)}))},o=(i=this.datetimeValue,(e=e)===L||e===q?i.hour<12?"am":"pm":e===O||e===V?i.hour>12?i.hour-12:i.hour:i[k(e)]),r=n.options.findIndex(t=>t.value===o);r>=0&&(n.selectedIndex=r),t.push(n)});const s=this.datetimeMin,a=this.datetimeMax;["month","day","hour","minute"].filter(e=>!t.find(t=>t.name===e)).forEach(t=>{s[t]=0,a[t]=0}),t=this.divyColumns(t)}var i;return t}validate(){const t=new Date,e=y(this.datetimeMin),i=y(this.datetimeMax),s=this.picker.getColumn("year");let a=t.getFullYear();if(s){s.options.find(e=>e.value===t.getFullYear())||(a=s.options[0].value);const e=s.selectedIndex;if(null!=e){const t=s.options[e];t&&(a=t.value)}}const n=this.validateColumn("month",1,e,i,[a,0,0,0,0],[a,12,31,23,59]),o=4===(r=n)||6===r||9===r||11===r?30:2===r?a%4==0&&a%100!=0||a%400==0?29:28:31;var r;const l=this.validateColumn("day",2,e,i,[a,n,0,0,0],[a,n,o,23,59]),h=this.validateColumn("hour",3,e,i,[a,n,l,0,0],[a,n,l,23,59]);this.validateColumn("minute",4,e,i,[a,n,l,h,0],[a,n,l,h,59])}calcMinMax(t){const e=(t||new Date).getFullYear();if(this.yearValues){const t=x(this.yearValues,"year");null==this.min&&(this.min=Math.min.apply(Math,t)),null==this.max&&(this.max=Math.max.apply(Math,t))}else null==this.min&&(this.min=(e-100).toString()),null==this.max&&(this.max=e.toString());const i=this.datetimeMin=g(this.min),s=this.datetimeMax=g(this.max);i.year=i.year||e,s.year=s.year||e,i.month=i.month||1,s.month=s.month||12,i.day=i.day||1,s.day=s.day||31,i.hour=i.hour||0,s.hour=s.hour||23,i.minute=i.minute||0,s.minute=s.minute||59,i.second=i.second||0,s.second=s.second||59,i.year>s.year&&(console.error("min.year > max.year"),i.year=s.year-100),i.year===s.year&&(i.month>s.month?(console.error("min.month > max.month"),i.month=1):i.month===s.month&&i.day>s.day&&(console.error("min.day > max.day"),i.day=1))}validateColumn(t,i,s,a,n,o){const r=this.picker.getColumn(t);if(!r)return 0;const l=n.slice(),h=o.slice(),c=r.options;let d=c.length-1,u=0;for(let t=0;t<c.length;t++){const e=c[t],r=e.value;l[i]=e.value,h[i]=e.value,(e.disabled=r<n[i]||r>o[i]||p(h[0],h[1],h[2],h[3],h[4])<s||p(l[0],l[1],l[2],l[3],l[4])>a)||(d=Math.min(d,t),u=Math.max(u,t))}const m=r.selectedIndex=e(d,r.selectedIndex,u),y=r.options[m];return y?y.value:0}divyColumns(t){const e=t,i=[];let s,a;for(let t=0;t<e.length;t++){s=e[t],i.push(0);for(let e=0;e<s.options.length;e++)(a=s.options[e].text.length)>i[t]&&(i[t]=a)}return 2===i.length?(a=Math.max(i[0],i[1]),e[0].align="right",e[1].align="left",e[0].optionsWidth=e[1].optionsWidth=`${17*a}px`):3===i.length&&(a=Math.max(i[0],i[2]),e[0].align="right",e[1].columnWidth=`${17*i[1]}px`,e[0].optionsWidth=e[2].optionsWidth=`${17*a}px`,e[2].align="left"),t}updateText(){const t=this.displayFormat||this.pickerFormat||Q;this.text=function(t,e,i){if(void 0===e)return;const s=[];let a=!1;if(U.forEach((n,o)=>{if(t.indexOf(n.f)>-1){const r="{"+o+"}",l=m(n.f,e[n.k],e,i);!a&&l&&e[n.k]&&(a=!0),s.push(r,l),t=t.replace(n.f,r)}}),a){for(let e=0;e<s.length;e+=2)t=t.replace(s[e],s[e+1]);return t}}(t,this.datetimeValue,this.locale)}hasValue(){const t=this.datetimeValue;return t&&"object"==typeof t&&Object.keys(t).length>0}hostData(){return{class:Object.assign({},s(this.mode,"datetime"),{"datetime-disabled":this.disabled})}}render(){let e=!1,i=this.text;return null==i&&(this.placeholder?(i=this.placeholder,e=!0):i=""),[t("div",{class:{"datetime-text":!0,"datetime-placeholder":e}},i),t("button",{type:"button","aria-haspopup":"true",id:this.datetimeId,"aria-labelledby":this.labelId,"aria-disabled":!!this.disabled&&"true",onClick:this.open.bind(this),class:"datetime-cover"},"md"===this.mode&&t("ion-ripple-effect",{tapClick:!0}))]}static get is(){return"ion-datetime"}static get properties(){return{cancelText:{type:String,attr:"cancel-text"},dayNames:{type:String,attr:"day-names"},dayShortNames:{type:String,attr:"day-short-names"},dayValues:{type:"Any",attr:"day-values"},disabled:{type:Boolean,attr:"disabled",watchCallbacks:["disabledChanged"]},displayFormat:{type:String,attr:"display-format"},doneText:{type:String,attr:"done-text"},hourValues:{type:"Any",attr:"hour-values"},max:{type:String,attr:"max",mutable:!0},min:{type:String,attr:"min",mutable:!0},minuteValues:{type:"Any",attr:"minute-values"},monthNames:{type:String,attr:"month-names"},monthShortNames:{type:String,attr:"month-short-names"},monthValues:{type:"Any",attr:"month-values"},pickerCtrl:{connect:"ion-picker-controller"},pickerFormat:{type:String,attr:"picker-format"},pickerOptions:{type:"Any",attr:"picker-options"},placeholder:{type:String,attr:"placeholder"},text:{state:!0},value:{type:String,attr:"value",mutable:!0,watchCallbacks:["valueChanged"]},yearValues:{type:"Any",attr:"year-values"}}}static get events(){return[{name:"ionCancel",method:"ionCancel",bubbles:!0,cancelable:!0,composed:!0},{name:"ionStyle",method:"ionStyle",bubbles:!0,cancelable:!0,composed:!0}]}static get style(){return"ion-datetime{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;overflow:hidden}.datetime-cover{left:0;top:0;margin:0;position:absolute;width:100%;height:100%;border:0;background:0 0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0}.datetime-text{-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:16px;min-height:1.2em;font-size:inherit;line-height:1.2;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.datetime-disabled,.item-datetime-disabled ion-label{opacity:.4;pointer-events:none}.item-label-floating ion-datetime,.item-label-stacked ion-datetime{padding-left:0;width:100%}.item .datetime{position:static}.datetime-md{padding:11px 8px 11px 16px;font-family:var(--ion-font-family,inherit)}.datetime-md .datetime-placeholder{color:var(--ion-placeholder-text-color,#999)}"}static get styleMode(){return"md"}}let G=0;const Q="MMM D, YYYY";function _(t,e){const i=new t,s=new t;s.addElement(e.querySelector("ion-backdrop"));const a=new t;return a.addElement(e.querySelector(".picker-wrapper")),s.fromTo("opacity",.01,.26),a.fromTo("translateY","100%","0%"),Promise.resolve(i.addElement(e).easing("cubic-bezier(.36,.66,.04,1)").duration(400).add(s).add(a))}function tt(t,e){const i=new t,s=new t;s.addElement(e.querySelector("ion-backdrop"));const a=new t;return a.addElement(e.querySelector(".picker-wrapper")),s.fromTo("opacity",.26,.01),a.fromTo("translateY","0%","100%"),Promise.resolve(i.addElement(e).easing("cubic-bezier(.36,.66,.04,1)").duration(400).add(s).add(a))}class et{constructor(){this.presented=!1,this.keyboardClose=!0,this.buttons=[],this.columns=[],this.showBackdrop=!0,this.enableBackdropDismiss=!0,this.willAnimate=!0}componentWillLoad(){if(!this.spinner){const t="ios"===this.mode?"lines":"crescent";this.spinner=this.config.get("pickerSpinner",t)}void 0===this.showSpinner&&(this.showSpinner=!(!this.spinner||"hide"===this.spinner))}componentDidLoad(){this.ionPickerDidLoad.emit()}componentDidUnload(){this.ionPickerDidUnload.emit()}onBackdropTap(){const t=this.buttons.find(t=>"cancel"===t.role);t?this.buttonClick(t):this.dismiss()}async present(){await r(this,"pickerEnter",_,_,void 0),this.duration&&(this.durationTimeout=setTimeout(()=>this.dismiss(),this.duration))}dismiss(t,e){return this.durationTimeout&&clearTimeout(this.durationTimeout),n(this,t,e,"pickerLeave",tt,tt)}onDidDismiss(t){return o(this.el,"ionPickerDidDismiss",t)}onWillDismiss(t){return o(this.el,"ionPickerWillDismiss",t)}addButton(t){this.buttons.push(t)}addColumn(t){this.columns.push(t)}getColumn(t){return this.columns.find(e=>e.name===t)}getColumns(){return this.columns}buttonClick(t){let e=!0;t.handler&&!1===t.handler(this.getSelected())&&(e=!1),e&&this.dismiss()}getSelected(){const t={};return this.columns.forEach((e,i)=>{const s=e.selectedIndex?e.options[e.selectedIndex]:null;t[e.name]={text:s?s.text:null,value:s?s.value:null,columnIndex:i}}),t}hostData(){return{class:Object.assign({},s(this.mode,"picker")),style:{zIndex:2e4+this.overlayId}}}render(){const e=this.buttons.map(t=>("string"==typeof t&&(t={text:t}),t.cssClass||(t.cssClass=""),t)).filter(t=>null!==t),i=this.columns;return[t("ion-backdrop",{visible:this.showBackdrop,tappable:this.enableBackdropDismiss}),t("div",{class:"picker-wrapper",role:"dialog"},t("div",{class:"picker-toolbar"},e.map(e=>t("div",{class:function(t){const e={"picker-toolbar-button":!0};return t.role&&(e[`picker-toolbar-${t.role}`]=!0),e}(e)},t("button",{onClick:()=>this.buttonClick(e),class:(s=e,Object.assign({"picker-button":!0},a(s.cssClass)))},e.text)))),t("div",{class:"picker-columns"},t("div",{class:"picker-above-highlight"}),i.map(e=>t("ion-picker-column",{col:e})),t("div",{class:"picker-below-highlight"})))];var s}static get is(){return"ion-picker"}static get properties(){return{addButton:{method:!0},addColumn:{method:!0},animationCtrl:{connect:"ion-animation-controller"},buttons:{type:"Any",attr:"buttons"},columns:{type:"Any",attr:"columns"},config:{context:"config"},cssClass:{type:String,attr:"css-class"},dismiss:{method:!0},duration:{type:Number,attr:"duration"},el:{elementRef:!0},enableBackdropDismiss:{type:Boolean,attr:"enable-backdrop-dismiss"},enterAnimation:{type:"Any",attr:"enter-animation"},getColumn:{method:!0},getColumns:{method:!0},keyboardClose:{type:Boolean,attr:"keyboard-close"},leaveAnimation:{type:"Any",attr:"leave-animation"},onDidDismiss:{method:!0},onWillDismiss:{method:!0},overlayId:{type:Number,attr:"overlay-id"},present:{method:!0},showBackdrop:{type:Boolean,attr:"show-backdrop"},showSpinner:{state:!0},spinner:{state:!0},willAnimate:{type:Boolean,attr:"will-animate"}}}static get events(){return[{name:"ionPickerDidLoad",method:"ionPickerDidLoad",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerDidPresent",method:"didPresent",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerWillPresent",method:"willPresent",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerWillDismiss",method:"willDismiss",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerDidDismiss",method:"didDismiss",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerDidUnload",method:"ionPickerDidUnload",bubbles:!0,cancelable:!0,composed:!0}]}static get listeners(){return[{name:"ionBackdropTap",method:"onBackdropTap"}]}static get style(){return"ion-picker{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;top:0;display:block;position:absolute;width:100%;height:100%;contain:strict;z-index:1000}.picker-toolbar{width:100%;contain:strict;z-index:1}.picker-wrapper{left:0;right:0;bottom:0;margin:auto;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);display:-webkit-box;display:-ms-flexbox;display:flex;position:absolute;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;width:100%;max-width:500px;contain:strict;overflow:hidden;z-index:10}.picker-columns{margin-bottom:env(safe-area-inset-bottom);display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;contain:strict;overflow:hidden}.picker-col{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-flex:1;-ms-flex:1;flex:1;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-sizing:content-box;box-sizing:content-box;contain:content}.picker-opts{position:relative;-webkit-box-flex:1;-ms-flex:1;flex:1;max-width:100%}.picker-prefix{position:relative;-webkit-box-flex:2;-ms-flex:2;flex:2;min-width:45%;max-width:50%;text-align:end;white-space:nowrap}.picker-suffix{position:relative;-webkit-box-flex:2;-ms-flex:2;flex:2;min-width:45%;max-width:50%;text-align:start;white-space:nowrap}.picker-opt{left:0;top:0;display:block;position:absolute;width:100%;border:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;contain:strict;overflow:hidden;will-change:transform}.picker-opt.picker-opt-disabled{pointer-events:none}.picker-opt-disabled{opacity:0}.picker-opts-left{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.picker-opts-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.picker-above-highlight,.picker-below-highlight{display:none;pointer-events:none}.picker-button{border:0;font-family:inherit}.picker-button:active,.picker-button:focus,.picker-opt:active,.picker-opt:focus{outline:0}.picker-md{font-family:var(--ion-font-family,inherit)}.picker-md .picker-wrapper{height:260px;border-top:.55px solid rgba(var(--ion-item-border-color-rgb,0,0,0),.13);background:var(--ion-background-color,#fff)}.picker-md .picker-toolbar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;height:44px;background:var(--ion-background-color,#fff)}.picker-md .picker-button,.picker-md .picker-button.activated{margin:0;padding:0 1.1em;height:44px;background:0 0;color:var(--ion-color-primary,#3880ff);font-size:14px;font-weight:500;text-transform:uppercase;-webkit-box-shadow:none;box-shadow:none}.picker-md .picker-columns{height:216px;-webkit-perspective:1800px;perspective:1800px}.picker-md .picker-col{padding:0 8px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.picker-md .picker-opts,.picker-md .picker-prefix,.picker-md .picker-suffix{top:77px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;color:var(--ion-item-text-color,var(--ion-text-color,#000));font-size:22px;line-height:42px;pointer-events:none}.picker-md .picker-opt{margin:0;padding:0;height:43px;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;background:0 0;color:var(--ion-item-text-color,var(--ion-text-color,#000));font-size:22px;line-height:42px;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:auto}.picker-md .picker-opt.picker-opt-selected,.picker-md .picker-prefix,.picker-md .picker-suffix{color:var(--ion-color-primary,#3880ff)}.picker-md .picker-above-highlight{left:0;top:0;-webkit-transform:translate3d(0,0,90px);transform:translate3d(0,0,90px);position:absolute;width:100%;height:81px;border-bottom:1px solid rgba(var(--ion-item-border-color-rgb,0,0,0),.13);background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,var(--ion-background-color,#fff)),to(rgba(var(--ion-background-color-rgb,255,255,255),.8)));background:linear-gradient(to bottom,var(--ion-background-color,#fff) 20%,rgba(var(--ion-background-color-rgb,255,255,255),.8) 100%);z-index:10}.picker-md .picker-below-highlight{left:0;top:115px;-webkit-transform:translate3d(0,0,90px);transform:translate3d(0,0,90px);position:absolute;width:100%;height:119px;border-top:1px solid rgba(var(--ion-item-border-color-rgb,0,0,0),.13);background:-webkit-gradient(linear,left bottom,left top,color-stop(30%,var(--ion-background-color,#fff)),to(rgba(var(--ion-background-color-rgb,255,255,255),.8)));background:linear-gradient(to top,var(--ion-background-color,#fff) 30%,rgba(var(--ion-background-color-rgb,255,255,255),.8) 100%);z-index:11}"}static get styleMode(){return"md"}}class it{constructor(){this.optHeight=0,this.pos=[],this.rotateFactor=0,this.scaleFactor=1,this.velocity=0,this.y=0}componentWillLoad(){let t=0,e=.81;"ios"===this.mode&&(t=-.46,e=1),this.rotateFactor=t,this.scaleFactor=e}componentDidLoad(){const t=this.el.querySelector(".picker-opts");this.optHeight=t.firstElementChild?t.firstElementChild.clientHeight:0,this.refresh()}optClick(t,e){this.velocity||(t.preventDefault(),t.stopPropagation(),this.setSelected(e,150))}setSelected(t,e){const i=t>-1?t*this.optHeight*-1:0;this.velocity=0,this.update(i,e,!0,!0)}update(t,e,i,s){let a,n,o,r,l;t=Math.round(t);let h,c,d,u=0,m=0;const p=this.el.querySelector(".picker-opts").children,y=p.length,f=this.col.selectedIndex=Math.min(Math.max(Math.round(-t/this.optHeight),0),y-1),b=0===e?null:e+"ms",g=`scale(${this.scaleFactor})`;for(a=0;a<y;a++)n=p[a],o=this.col.options[a],r=a*this.optHeight+t,l=!0,c="",0!==this.rotateFactor?(h=r*this.rotateFactor,Math.abs(h)>90?l=!1:(u=0,m=90,c=`rotateX(${h}deg) `)):(m=0,u=r,Math.abs(u)>170&&(l=!1)),d=f===a,l?(c+=`translate3d(0px,${u}px,${m}px) `,1===this.scaleFactor||d||(c+=g)):c="translate3d(-9999px,0px,0px)",e!==o.duration&&(o.duration=e,n.style.transitionDuration=b),c!==o.transform&&(o.transform=c,n.style.transform=c),d!==o.selected&&(o.selected=d,d?n.classList.add(st):n.classList.remove(st));this.col.prevSelected=f,i&&(this.y=t),s&&(void 0===this.lastIndex?this.lastIndex=this.col.selectedIndex:this.lastIndex!==this.col.selectedIndex&&(this.lastIndex=this.col.selectedIndex))}decelerate(){let t=0;if(isNaN(this.y)||!this.optHeight)this.update(t,0,!0,!0);else if(Math.abs(this.velocity)>0){this.velocity*=at,this.velocity=this.velocity>0?Math.max(this.velocity,1):Math.min(this.velocity,-1),(t=Math.round(this.y-this.velocity))>this.minY?(t=this.minY,this.velocity=0):t<this.maxY&&(t=this.maxY,this.velocity=0);const e=t%this.optHeight!=0||Math.abs(this.velocity)>1;this.update(t,0,!0,!e),e&&this.queue.read(()=>this.decelerate())}else if(this.y%this.optHeight!=0){const t=Math.abs(this.y%this.optHeight);this.velocity=t>this.optHeight/2?1:-1,this.decelerate()}const e=Math.max(Math.abs(Math.round(t/this.optHeight)),0);e!==this.lastTempIndex&&u(),this.lastTempIndex=e}canStart(){return!0}onDragStart(t){this.startY,t.event&&(t.event.preventDefault(),t.event.stopPropagation()),this.startY=t.startY,this.velocity=0,this.pos.length=0,this.pos.push(this.startY,Date.now());const e=this.col.options;let i=e.length-1,s=0;for(let t=0;t<e.length;t++)e[t].disabled||(i=Math.min(i,t),s=Math.max(s,t));return this.minY=i*this.optHeight*-1,this.maxY=s*this.optHeight*-1,!0}onDragMove(t){t.event&&(t.event.preventDefault(),t.event.stopPropagation());const e=t.currentY;if(this.pos.push(e,Date.now()),void 0===this.startY)return;let i=this.y+(e-this.startY);i>this.minY?(i=Math.pow(i,.8),this.bounceFrom=i):i<this.maxY?(i+=Math.pow(this.maxY-i,.9),this.bounceFrom=i):this.bounceFrom=0,this.update(i,0,!1,!1);const s=Math.max(Math.abs(Math.round(i/this.optHeight)),0);s!==this.lastTempIndex&&(this.lastTempIndex=s)}onDragEnd(t){if(void 0===this.startY)return;if(this.velocity=0,this.bounceFrom>0)return void this.update(this.minY,100,!0,!0);if(this.bounceFrom<0)return void this.update(this.maxY,100,!0,!0);const i=t.currentY;this.pos.push(i,Date.now());const s=this.pos.length-1;let a=s;const n=Date.now()-100;for(let t=s;t>0&&this.pos[t]>n;t-=2)a=t;if(a!==s){const t=this.pos[s]-this.pos[a],i=(this.pos[a-1]-this.pos[s-1])/t*nt;this.velocity=e(-ot,i,ot)}if(Math.abs(i-this.startY)>3){const t=this.y+(i-this.startY);this.update(t,0,!0,!0)}this.startY=void 0,this.decelerate()}refresh(){let t=this.col.options.length-1,i=0;const s=this.col.options;for(let e=0;e<s.length;e++)s[e].disabled||(t=Math.min(t,e),i=Math.max(i,e));const a=e(t,this.col.selectedIndex,i);if(this.col.prevSelected!==a){const t=a*this.optHeight*-1;this.velocity=0,this.update(t,150,!0,!1)}}hostData(){return{class:Object.assign({},s(this.mode,"picker-col"),{"picker-opts-left":"left"===this.col.align,"picker-opts-right":"right"===this.col.align}),style:{"max-width":this.col.columnWidth}}}render(){const e=this.col,i=e.options.map(t=>("string"==typeof t&&(t={text:t}),t)).filter(t=>null!==t),s=[];return e.prefix&&s.push(t("div",{class:"picker-prefix",style:{width:e.prefixWidth}},e.prefix)),s.push(t("ion-gesture",{canStart:this.canStart.bind(this),onStart:this.onDragStart.bind(this),onMove:this.onDragMove.bind(this),onEnd:this.onDragEnd.bind(this),gestureName:"picker-swipe",gesturePriority:10,direction:"y",passive:!1,threshold:0,attachTo:"parent"}),t("div",{class:"picker-opts",style:{maxWidth:e.optionsWidth}},i.map((e,i)=>t("button",{class:{"picker-opt":!0,"picker-opt-disabled":!!e.disabled},"disable-activated":!0,onClick:t=>this.optClick(t,i)},e.text)))),e.suffix&&s.push(t("div",{class:"picker-suffix",style:{width:e.suffixWidth}},e.suffix)),s}static get is(){return"ion-picker-column"}static get properties(){return{col:{type:"Any",attr:"col"},el:{elementRef:!0},queue:{context:"queue"}}}}const st="picker-opt-selected",at=.97,nt=1e3/60,ot=60;class rt{constructor(){this.pickers=new Map}pickerWillPresent(t){this.pickers.set(t.target.overlayId,t.target)}pickerWillDismiss(t){this.pickers.delete(t.target.overlayId)}escapeKeyUp(){d(this.pickers)}create(t){return l(this.doc.createElement("ion-picker"),t)}dismiss(t,e,i=-1){return h(t,e,this.pickers,i)}getTop(){return c(this.pickers)}static get is(){return"ion-picker-controller"}static get properties(){return{create:{method:!0},dismiss:{method:!0},doc:{context:"document"},getTop:{method:!0}}}static get listeners(){return[{name:"body:ionPickerWillPresent",method:"pickerWillPresent"},{name:"body:ionPickerWillDismiss",method:"pickerWillDismiss"},{name:"body:ionPickerDidUnload",method:"pickerWillDismiss"},{name:"body:keyup.escape",method:"escapeKeyUp"}]}}export{X as IonDatetime,et as IonPicker,it as IonPickerColumn,rt as IonPickerController};