UNPKG

primereact

Version:

PrimeReact is an open source UI library for React featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime

2 lines (1 loc) 46.1 kB
import*as e from"react";import t,{localeOptions as n,localeOption as a}from"primereact/api";import{Button as r}from"primereact/button";import{usePrevious as o,useOverlayListener as l,useMountEffect as i,useUpdateEffect as u,useUnmountEffect as s}from"primereact/hooks";import{InputText as c}from"primereact/inputtext";import{OverlayService as m}from"primereact/overlayservice";import{Ripple as d}from"primereact/ripple";import{UniqueComponentId as p,DomHandler as f,ObjectUtils as g,mask as h,ZIndexUtils as v,classNames as D}from"primereact/utils";import{CSSTransition as y}from"primereact/csstransition";import{Portal as b}from"primereact/portal";function M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},w.apply(this,arguments)}function k(e){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(e)}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function E(e){if(Array.isArray(e))return S(e)}function x(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function N(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function C(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function F(e){return E(e)||x(e)||N(e)||C()}function I(e){if(Array.isArray(e))return e}function T(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(a=n.next()).done)&&(o.push(a.value),!t||o.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==n.return||n.return()}finally{if(i)throw r}}return o}}function H(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Y(e,t){return I(e)||T(e,t)||N(e,t)||H()}var O=e.forwardRef((function(t,n){var a=e.createElement(y,{nodeRef:n,classNames:"p-connected-overlay",in:t.in,timeout:{enter:120,exit:100},options:t.transitionOptions,unmountOnExit:!0,onEnter:t.onEnter,onEntered:t.onEntered,onExit:t.onExit,onExited:t.onExited},e.createElement("div",{ref:n,className:t.className,style:t.style,onClick:t.onClick,onMouseUp:t.onMouseUp},t.children));return t.inline?a:e.createElement(b,{element:a,appendTo:t.appendTo})}));function A(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=R(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,r=function(){};return{s:r,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function R(e,t){if(e){if("string"==typeof e)return U(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}O.displayName="CalendarPanel";var B=e.memo(e.forwardRef((function(y,b){var S,E=Y(e.useState(!1),2),x=E[0],N=E[1],C=Y(e.useState(!1),2),I=C[0],T=C[1],H=Y(e.useState(null),2),R=H[0],U=H[1],K=e.useRef(null),P=e.useRef(null),L=e.useRef(y.inputRef),V=e.useRef(null),j=e.useRef(!1),W=e.useRef(!1),Z=e.useRef(null),q=e.useRef(!1),z=e.useRef(null),J=e.useRef(null),X=e.useRef(null),$=e.useRef(!1),_=e.useRef(!1),G=Y(e.useState("date"),2),Q=G[0],ee=G[1],te=Y(e.useState(null),2),ne=te[0],ae=te[1],re=Y(e.useState(null),2),oe=re[0],le=re[1],ie=Y(e.useState([]),2),ue=ie[0],se=ie[1],ce=o(y.value),me=y.inline||(y.onVisibleChange?y.visible:I),de=p(),pe=Y(l({target:K,overlay:P,listener:function(e,t){t.valid&&("outside"===t.type?!$.current&&!Yt(e.target)&&Nt("outside"):Nt()),$.current=!1},when:!(y.touchUI||y.inline)&&me}),2),fe=pe[0],ge=pe[1],he=function(){return y.dateFormat||a("dateFormat",y.locale)},ve=function(e){j.current?(N(!0),j.current=!1):(y.showOnFocus&&!me&&xt(),N(!0),y.onFocus&&y.onFocus(e))},De=function(e){N(!1),!y.keepInvalid&&ln(y.value),y.onBlur&&y.onBlur(e)},ye=function(e){switch(W.current=!0,e.which){case 27:Nt();break;case 9:me&&Ce(e),y.touchUI&&It()}},be=function(e){W.current&&(W.current=!1,Me(e,e.target.value),y.onInput&&y.onInput(e))},Me=function(e,t){try{var n=mn(t);ke(n)&&(Et(e,n),dt(e,n.length?n[0]:n))}catch(n){Et(e,y.keepInvalid?t:null)}},we=function(){!y.inline&&L.current&&(j.current=!0,f.focus(L.current))},ke=function(e){var t=!0;return en()?Zt(e.getDate(),e.getMonth(),e.getFullYear(),!1)&&qt(e)||(t=!1):e.every((function(e){return Zt(e.getDate(),e.getMonth(),e.getFullYear(),!1)&&qt(e)}))&&tn()&&(t=e.length>1&&e[1]>e[0]),t},Se=function(){me?Nt():xt()},Ee=function(e){V.current={backward:!0,button:!0},Te(e)},xe=function(e){V.current={backward:!1,button:!0},He(e)},Ne=function(e){switch(e.which){case 9:Ce(e);break;case 27:Nt(null,we),e.preventDefault()}},Ce=function(e){e.preventDefault();var t=f.getFocusableElements(P.current);if(t&&t.length>0)if(document.activeElement){var n=t.indexOf(document.activeElement);e.shiftKey?-1===n||0===n?t[t.length-1].focus():t[n-1].focus():-1===n||n===t.length-1?t[0].focus():t[n+1].focus()}else t[0].focus()},Fe=function(){if(V.current){if(V.current.button)Ie(),V.current.backward?f.findSingle(P.current,".p-datepicker-prev").focus():f.findSingle(P.current,".p-datepicker-next").focus();else{var e;if(V.current.backward){var t=f.find(P.current,".p-datepicker-calendar td span:not(.p-disabled)");e=t[t.length-1]}else e=f.findSingle(P.current,".p-datepicker-calendar td span:not(.p-disabled)");e&&(e.tabIndex="0",e.focus())}V.current=null}else Ie()},Ie=function(){var e;if("month"===y.view){var t=f.find(P.current,".p-monthpicker .p-monthpicker-month"),n=f.findSingle(P.current,".p-monthpicker .p-monthpicker-month.p-highlight");t.forEach((function(e){return e.tabIndex=-1})),e=n||t[0]}else{if(!(e=f.findSingle(P.current,"span.p-highlight")))e=f.findSingle(P.current,"td.p-datepicker-today span:not(.p-disabled)")||f.findSingle(P.current,".p-datepicker-calendar td span:not(.p-disabled)")}e&&(e.tabIndex="0")},Te=function(e){if(y.disabled)e.preventDefault();else{var t=new Date(nt().getTime());if(t.setDate(1),"date"===Q)0===t.getMonth()?(t.setMonth(11),t.setFullYear(Oe()),ae(11)):(t.setMonth(t.getMonth()-1),ae((function(e){return e-1})));else if("month"===Q){var n=t.getFullYear()-1;if(y.yearNavigator){var a=parseInt(y.yearRange.split(":")[0],10);n<a&&(n=a)}t.setFullYear(n)}"month"===Q?t.setFullYear(Oe()):"year"===Q&&t.setFullYear(yt()),dt(e,t),e.preventDefault()}},He=function(e){if(y.disabled)e.preventDefault();else{var t=new Date(nt().getTime());if(t.setDate(1),"date"===Q)11===t.getMonth()?(t.setMonth(0),t.setFullYear(Ae()),ae(0)):(t.setMonth(t.getMonth()+1),ae((function(e){return e+1})));else if("month"===Q){var n=t.getFullYear()+1;if(y.yearNavigator){var a=parseInt(y.yearRange.split(":")[1],10);n>a&&(n=a)}t.setFullYear(n)}"month"===Q?t.setFullYear(Ae()):"year"===Q&&t.setFullYear(bt()),dt(e,t),e.preventDefault()}},Ye=function(e,t){for(var n=e;n<=t;n++)ue.push(n);se([])},Oe=function(){var e=oe-1;if(le(e),y.yearNavigator&&e<ue[0]){var t=ue[ue.length-1]-ue[0];Ye(ue[0]-t,ue[ue.length-1]-t)}return e},Ae=function(){var e=oe+1;if(le(e),y.yearNavigator&&e.current>ue[ue.length-1]){var t=ue[ue.length-1]-ue[0];Ye(ue[0]+t,ue[ue.length-1]+t)}return e},Re=function(e,t){var n=nt(),a=new Date(n.getTime());a.setMonth(parseInt(t,10)),dt(e,a)},Ue=function(e,t){var n=nt(),a=new Date(n.getTime());a.setFullYear(parseInt(t,10)),dt(e,a)},Be=function(e){var t=new Date,n={day:t.getDate(),month:t.getMonth(),year:t.getFullYear(),today:!0,selectable:!0},a={hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),milliseconds:t.getMilliseconds()};dt(e,t),ht(e,n,a),y.onTodayButtonClick&&y.onTodayButtonClick(e)},Ke=function(e){Et(e,null),ln(null),Nt(),y.onClearButtonClick&&y.onClearButtonClick(e)},Pe=function(e){y.inline||m.emit("overlay-click",{originalEvent:e,target:K.current})},Le=function(e,t,n){y.disabled||(We(e,null,t,n),e.preventDefault())},Ve=function(){y.disabled||Ze()},je=function(){y.disabled||Ze()},We=function e(t,n,a,r){switch(Ze(),Z.current=setTimeout((function(){e(t,100,a,r)}),n||500),a){case 0:1===r?qe(t):ze(t);break;case 1:1===r?Xe(t):$e(t);break;case 2:1===r?_e(t):Ge(t);break;case 3:1===r?Qe(t):et(t)}},Ze=function(){Z.current&&clearTimeout(Z.current)},qe=function(e){var t=at(),n=t.getHours()+y.stepHour;lt(n=n>=24?n-24:n,t)&&(y.maxDate&&y.maxDate.toDateString()===t.toDateString()&&y.maxDate.getHours()===n&&(y.maxDate.getMinutes()<t.getMinutes()||y.maxDate.getMinutes()===t.getMinutes())?y.maxDate.getSeconds()<t.getSeconds()?y.maxDate.getMilliseconds()<t.getMilliseconds()?mt(e,n,y.maxDate.getMinutes(),y.maxDate.getSeconds(),y.maxDate.getMilliseconds()):mt(e,n,y.maxDate.getMinutes(),y.maxDate.getSeconds(),t.getMilliseconds()):mt(e,n,y.maxDate.getMinutes(),t.getSeconds(),t.getMilliseconds()):mt(e,n,t.getMinutes(),t.getSeconds(),t.getMilliseconds())),e.preventDefault()},ze=function(e){var t=at(),n=t.getHours()-y.stepHour;lt(n=n<0?n+24:n,t)&&(y.minDate&&y.minDate.toDateString()===t.toDateString()&&y.minDate.getHours()===n&&(y.minDate.getMinutes()>t.getMinutes()||y.minDate.getMinutes()===t.getMinutes())?y.minDate.getSeconds()>t.getSeconds()?y.minDate.getMilliseconds()>t.getMilliseconds()?mt(e,n,y.minDate.getMinutes(),y.minDate.getSeconds(),y.minDate.getMilliseconds()):mt(e,n,y.minDate.getMinutes(),y.minDate.getSeconds(),t.getMilliseconds()):mt(e,n,y.minDate.getMinutes(),t.getSeconds(),t.getMilliseconds()):mt(e,n,t.getMinutes(),t.getSeconds(),t.getMilliseconds())),e.preventDefault()},Je=function(e,t){return y.stepMinute<=1?t?e+t:e:t||e%(t=y.stepMinute)!=0?Math.floor((e+t)/t)*t:e},Xe=function(e){var t=at(),n=t.getMinutes(),a=Je(n,y.stepMinute);it(a=a>59?a-60:a,t)&&(y.maxDate&&y.maxDate.toDateString()===t.toDateString()&&y.maxDate.getMinutes()===a&&y.maxDate.getSeconds()<t.getSeconds()?y.maxDate.getMilliseconds()<t.getMilliseconds()?mt(e,t.getHours(),a,y.maxDate.getSeconds(),y.maxDate.getMilliseconds()):mt(e,t.getHours(),a,y.maxDate.getSeconds(),t.getMilliseconds()):mt(e,t.getHours(),a,t.getSeconds(),t.getMilliseconds())),e.preventDefault()},$e=function(e){var t=at(),n=t.getMinutes(),a=Je(n,-y.stepMinute);it(a=a<0?a+60:a,t)&&(y.minDate&&y.minDate.toDateString()===t.toDateString()&&y.minDate.getMinutes()===a&&y.minDate.getSeconds()>t.getSeconds()?y.minDate.getMilliseconds()>t.getMilliseconds()?mt(e,t.getHours(),a,y.minDate.getSeconds(),y.minDate.getMilliseconds()):mt(e,t.getHours(),a,y.minDate.getSeconds(),t.getMilliseconds()):mt(e,t.getHours(),a,t.getSeconds(),t.getMilliseconds())),e.preventDefault()},_e=function(e){var t=at(),n=t.getSeconds()+y.stepSecond;ut(n=n>59?n-60:n,t)&&(y.maxDate&&y.maxDate.toDateString()===t.toDateString()&&y.maxDate.getSeconds()===n&&y.maxDate.getMilliseconds()<t.getMilliseconds()?mt(e,t.getHours(),t.getMinutes(),n,y.maxDate.getMilliseconds()):mt(e,t.getHours(),t.getMinutes(),n,t.getMilliseconds())),e.preventDefault()},Ge=function(e){var t=at(),n=t.getSeconds()-y.stepSecond;ut(n=n<0?n+60:n,t)&&(y.minDate&&y.minDate.toDateString()===t.toDateString()&&y.minDate.getSeconds()===n&&y.minDate.getMilliseconds()>t.getMilliseconds()?mt(e,t.getHours(),t.getMinutes(),n,y.minDate.getMilliseconds()):mt(e,t.getHours(),t.getMinutes(),n,t.getMilliseconds())),e.preventDefault()},Qe=function(e){var t=at(),n=t.getMilliseconds()+y.stepMillisec;st(n=n>999?n-1e3:n,t)&&mt(e,t.getHours(),t.getMinutes(),t.getSeconds(),n),e.preventDefault()},et=function(e){var t=at(),n=t.getMilliseconds()-y.stepMillisec;st(n=n<0?n+999:n,t)&&mt(e,t.getHours(),t.getMinutes(),t.getSeconds(),n),e.preventDefault()},tt=function(e){var t=at(),n=t.getHours(),a=n>=12?n-12:n+12;lt(ot(a,!(n>11)),t)&&mt(e,a,t.getMinutes(),t.getSeconds(),t.getMilliseconds()),e.preventDefault()},nt=function(e){var t=y.value,n=e||(y.onViewDateChange?y.viewDate:R);return Array.isArray(t)&&(t=t[0]),n&&rt(n)?n:t&&rt(t)?t:new Date},at=function(){if(en())return y.value&&y.value instanceof Date?y.value:nt();if(nn()){if(y.value&&y.value.length)return y.value[y.value.length-1]}else if(tn()){if(y.value&&y.value.length)return y.value[1]||y.value[0]}return new Date},rt=function(e){return e instanceof Date&&!isNaN(e)},ot=function(e,t){return"12"==y.hourFormat?12===e?t?12:0:t?e+12:e:e},lt=function(e,t){var n=!0,a=t?t.toDateString():null;return y.minDate&&a&&y.minDate.toDateString()===a&&y.minDate.getHours()>e&&(n=!1),y.maxDate&&a&&y.maxDate.toDateString()===a&&y.maxDate.getHours()<e&&(n=!1),n},it=function(e,t){var n=!0,a=t?t.toDateString():null;return y.minDate&&a&&y.minDate.toDateString()===a&&t.getHours()===y.minDate.getHours()&&y.minDate.getMinutes()>e&&(n=!1),y.maxDate&&a&&y.maxDate.toDateString()===a&&t.getHours()===y.maxDate.getHours()&&y.maxDate.getMinutes()<e&&(n=!1),n},ut=function(e,t){var n=!0,a=t?t.toDateString():null;return y.minDate&&a&&y.minDate.toDateString()===a&&t.getHours()===y.minDate.getHours()&&t.getMinutes()===y.minDate.getMinutes()&&y.minDate.getSeconds()>e&&(n=!1),y.maxDate&&a&&y.maxDate.toDateString()===a&&t.getHours()===y.maxDate.getHours()&&t.getMinutes()===y.maxDate.getMinutes()&&y.maxDate.getSeconds()<e&&(n=!1),n},st=function(e,t){var n=!0,a=t?t.toDateString():null;return y.minDate&&a&&y.minDate.toDateString()===a&&t.getHours()===y.minDate.getHours()&&t.getSeconds()===y.minDate.getSeconds()&&t.getMinutes()===y.minDate.getMinutes()&&y.minDate.getMilliseconds()>e&&(n=!1),y.maxDate&&a&&y.maxDate.toDateString()===a&&t.getHours()===y.maxDate.getHours()&&t.getSeconds()===y.maxDate.getSeconds()&&t.getMinutes()===y.maxDate.getMinutes()&&y.maxDate.getMilliseconds()<e&&(n=!1),n},ct=function(e){if(y.yearNavigator){var t=e.getFullYear(),n=y.yearRange?parseInt(y.yearRange.split(":")[0],10):null,a=y.yearRange?parseInt(y.yearRange.split(":")[1],10):null,r=y.minDate&&null!=n?Math.max(y.minDate.getFullYear(),n):y.minDate||n,o=y.maxDate&&null!=a?Math.min(y.maxDate.getFullYear(),a):y.maxDate||a;r&&r>t&&(t=r),o&&o<t&&(t=o),e.setFullYear(t)}if(y.monthNavigator&&"month"!==y.view){var l=e.getMonth(),i=parseInt(hn(e)&&Math.max(y.minDate.getMonth(),l).toString()||vn(e)&&Math.min(y.maxDate.getMonth(),l).toString()||l);e.setMonth(i)}},mt=function(e,t,n,a,r){var o=at();if(o.setHours(t),o.setMinutes(n),o.setSeconds(a),o.setMilliseconds(r),nn())if(y.value&&y.value.length){var l=F(y.value);l[l.length-1]=o,o=l}else o=[o];else if(tn()){if(y.value&&y.value.length)o=y.value[1]?[y.value[0],o]:[o,null];else o=[o,null]}Et(e,o),y.onSelect&&y.onSelect({originalEvent:e,value:o}),ln(o)},dt=function(e,t){ct(t),y.onViewDateChange?y.onViewDateChange({originalEvent:e,value:t}):(q.current=!0,U(t)),ae(t.getMonth()),le(t.getFullYear())},pt=function(e){if(y.showMinMaxRange&&"date"===y.view&&P.current){var t=f.findSingle(P.current,".p-datepicker-prev"),n=f.findSingle(P.current,".p-datepicker-next");if(y.disabled)return f.addClass(t,"p-disabled"),void f.addClass(n,"p-disabled");if(y.minDate){var a=new Date(e.getTime());0===a.getMonth()?(a.setMonth(11,1),a.setFullYear(a.getFullYear()-1)):a.setMonth(a.getMonth()-1,1),a.setHours(0),a.setMinutes(0),a.setSeconds(0),y.minDate>a?f.addClass(t,"p-disabled"):f.removeClass(t,"p-disabled")}if(y.maxDate){var r=new Date(e.getTime());11===r.getMonth()?(r.setMonth(0,1),r.setFullYear(r.getFullYear()+1)):r.setMonth(r.getMonth()+1,1),r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setSeconds(-1),y.maxDate<r?f.addClass(n,"p-disabled"):f.removeClass(n,"p-disabled")}}},ft=function(e,t,n){var a=e.currentTarget,r=a.parentElement;switch(e.which){case 40:a.tabIndex="-1";var o=f.index(r),l=r.parentElement.nextElementSibling;if(l)f.hasClass(l.children[o].children[0],"p-disabled")?(V.current={backward:!1},He(e)):(l.children[o].children[0].tabIndex="0",l.children[o].children[0].focus());else V.current={backward:!1},He(e);e.preventDefault();break;case 38:a.tabIndex="-1";var i=f.index(r),u=r.parentElement.previousElementSibling;if(u){var s=u.children[i].children[0];f.hasClass(s,"p-disabled")?(V.current={backward:!0},Te(e)):(s.tabIndex="0",s.focus())}else V.current={backward:!0},Te(e);e.preventDefault();break;case 37:a.tabIndex="-1";var c=r.previousElementSibling;if(c){var m=c.children[0];f.hasClass(m,"p-disabled")?gt(!0,n,e):(m.tabIndex="0",m.focus())}else gt(!0,n,e);e.preventDefault();break;case 39:a.tabIndex="-1";var d=r.nextElementSibling;if(d){var p=d.children[0];f.hasClass(p,"p-disabled")?gt(!1,n,e):(p.tabIndex="0",p.focus())}else gt(!1,n,e);e.preventDefault();break;case 13:ht(e,t),e.preventDefault();break;case 27:Nt(null,we),e.preventDefault();break;case 9:Ce(e)}},gt=function(e,t,n){if(e)if(1===y.numberOfMonths||0===t)V.current={backward:!0},Te(n);else{var a=f.find(P.current.children[t-1],".p-datepicker-calendar td span:not(.p-disabled)"),r=a[a.length-1];r.tabIndex="0",r.focus()}else if(1===y.numberOfMonths||t===y.numberOfMonths-1)V.current={backward:!1},He(n);else{var o=f.findSingle(P.current.children[t+1],".p-datepicker-calendar td span:not(.p-disabled)");o.tabIndex="0",o.focus()}},ht=function(e,t,n){if(!y.disabled&&t.selectable){if(f.find(P.current,".p-datepicker-calendar td span:not(.p-disabled)").forEach((function(e){return e.tabIndex=-1})),e.currentTarget.focus(),nn())if(zt(t)){var a=y.value.filter((function(e,n){return!Gt(e,t)}));Et(e,a),ln(a)}else(!y.maxDateCount||!y.value||y.maxDateCount>y.value.length)&&Dt(e,t,n);else Dt(e,t,n);y.inline||!en()||y.showTime&&!y.hideOnDateTimeSelect||(setTimeout((function(){Nt("dateselect")}),100),z.current&&It()),e.preventDefault()}else e.preventDefault()},vt=function(e,t){if(y.showTime){var n,a,r,o;if(t)n=t.hours,a=t.minutes,r=t.seconds,o=t.milliseconds;else{var l=at(),i=[l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds()];n=i[0],a=i[1],r=i[2],o=i[3]}e.setHours(n),e.setMinutes(a),e.setSeconds(r),e.setMilliseconds(o)}},Dt=function(e,t,n){var a=new Date(t.year,t.month,t.day);vt(a,n),y.minDate&&y.minDate>a&&(a=y.minDate),y.maxDate&&y.maxDate<a&&(a=y.maxDate);var r=a;if(en())Et(e,a);else if(nn())r=y.value?[].concat(F(y.value),[a]):[a],Et(e,r);else if(tn())if(y.value&&y.value.length){var o=y.value[0],l=y.value[1];l?(o=a,l=null):a.getTime()>=o.getTime()?l=a:(l=o,o=a),Et(e,r=[o,l])}else Et(e,r=[a,null]);y.onSelect&&y.onSelect({originalEvent:e,value:a}),ln(r)},yt=function(){var e=oe-10;return le(e),e},bt=function(){var e=oe+10;return le(e),e},Mt=function(e){ee("month"),e.preventDefault()},wt=function(e){ee("year"),e.preventDefault()},kt=function(e,t){if("month"===y.view)ht(e,{year:oe,month:t,day:1,selectable:!0}),e.preventDefault();else{ae(t),Vt(t,oe);var n=new Date(at().getTime());n.setDate(1),n.setMonth(t),n.setYear(oe),U(n),ee("date"),y.onMonthChange&&y.onMonthChange({month:t+1,year:oe})}},St=function(e,t){"year"===y.view?ht(e,{year:t,month:0,day:1,selectable:!0}):(le(t),ee("month"),y.onMonthChange&&y.onMonthChange({month:ne+1,year:t}))},Et=function(e,t){if(y.onChange){var n=t&&t instanceof Date?new Date(t.getTime()):t;q.current=!0,y.onChange({originalEvent:e,value:n,stopPropagation:function(){},preventDefault:function(){},target:{name:y.name,id:y.id,value:n}})}},xt=function(e){y.onVisibleChange?y.onVisibleChange({visible:!0,type:e}):(T(!0),J.current=function(e){Ht(e)||($.current=!0)},m.on("overlay-click",J.current))},Nt=function(e,t){var n=function(){q.current=!1,j.current=!1,$.current=!1,t&&t(),m.off("overlay-click",J.current),J.current=null};y.touchUI&&It(),y.onVisibleChange?y.onVisibleChange({visible:!1,type:e,callback:n}):(T(!1),n())},Ct=function(){y.touchUI?Ft():P&&P.current&&L&&L.current&&(f.alignOverlay(P.current,L.current,y.appendTo||t.appendTo),"self"===y.appendTo||y.inline?f.relativePosition(P.current,L.current):("date"===Q?(P.current.style.width=f.getOuterWidth(P.current)+"px",P.current.style.minWidth=f.getOuterWidth(L.current)+"px"):P.current.style.width=f.getOuterWidth(L.current)+"px",f.absolutePosition(P.current,L.current)))},Ft=function(){z.current||(z.current=document.createElement("div"),z.current.style.zIndex=String(v.get(P.current)-1),f.addMultipleClasses(z.current,"p-component-overlay p-datepicker-mask p-datepicker-mask-scrollblocker p-component-overlay-enter"),X.current=function(){It(),Nt()},z.current.addEventListener("click",X.current),document.body.appendChild(z.current),f.addClass(document.body,"p-overflow-hidden"))},It=function(){z.current&&(f.addClass(z.current,"p-component-overlay-leave"),z.current.addEventListener("animationend",(function(){Tt()})))},Tt=function(){z.current&&(z.current.removeEventListener("click",X.current),X.current=null,document.body.removeChild(z.current),z.current=null);for(var e,t=document.body.children,n=0;n<t.length;n++){if(f.hasClass(t[n],"p-datepicker-mask-scrollblocker")){e=!0;break}}e||f.removeClass(document.body,"p-overflow-hidden")},Ht=function(e){return K.current&&!(K.current.isSameNode(e.target)||Yt(e.target)||K.current.contains(e.target)||P.current&&P.current.contains(e.target))},Yt=function(e){return f.hasClass(e,"p-datepicker-prev")||f.hasClass(e,"p-datepicker-prev-icon")||f.hasClass(e,"p-datepicker-next")||f.hasClass(e,"p-datepicker-next-icon")},Ot=function(e,t){var n=new Date;n.setDate(1),n.setMonth(e),n.setFullYear(t);var a=n.getDay()+Pt();return a>=7?a-7:a},At=function(e,t){return 32-Ut(new Date(t,e,32)).getDate()},Rt=function(e,t){var n=Bt(e,t);return At(n.month,n.year)},Ut=function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},Bt=function(e,t){var n,a;return 0===e?(n=11,a=t-1):(n=e-1,a=t),{month:n,year:a}},Kt=function(e,t){var n,a;return 11===e?(n=0,a=t+1):(n=e+1,a=t),{month:n,year:a}},Pt=function(){var e=a("firstDayOfWeek",y.locale);return e>0?7-e:0},Lt=function(){for(var e=[],t=n(y.locale),a=t.firstDayOfWeek,r=t.dayNamesMin,o=0;o<7;o++)e.push(r[a]),a=6===a?0:++a;return e},Vt=function(e,t){for(var n=[],a=0;a<y.numberOfMonths;a++){var r=e+a,o=t;r>11&&(r=r%11-1,o=t+1),n.push(jt(r,o))}return n},jt=function(e,t){for(var n=[],a=Ot(e,t),r=At(e,t),o=Rt(e,t),l=1,i=new Date,u=[],s=Math.ceil((r+a)/7),c=0;c<s;c++){var m=[];if(0===c){for(var d=o-a+1;d<=o;d++){var p=Bt(e,t);m.push({day:d,month:p.month,year:p.year,otherMonth:!0,today:an(i,d,p.month,p.year),selectable:Zt(d,p.month,p.year,!0)})}for(var f=7-m.length,g=0;g<f;g++)m.push({day:l,month:e,year:t,today:an(i,l,e,t),selectable:Zt(l,e,t,!1)}),l++}else for(var h=0;h<7;h++){if(l>r){var v=Kt(e,t);m.push({day:l-r,month:v.month,year:v.year,otherMonth:!0,today:an(i,l-r,v.month,v.year),selectable:Zt(l-r,v.month,v.year,!0)})}else m.push({day:l,month:e,year:t,today:an(i,l,e,t),selectable:Zt(l,e,t,!1)});l++}y.showWeek&&u.push(Wt(new Date(m[0].year,m[0].month,m[0].day))),n.push(m)}return{month:e,year:t,dates:n,weekNumbers:u}},Wt=function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t.getTime())/864e5)/7)+1},Zt=function(e,t,n,a){var r=!0,o=!0,l=!0,i=!0,u=!0;return y.minDate&&(y.minDate.getFullYear()>n||y.minDate.getFullYear()===n&&(y.minDate.getMonth()>t||y.minDate.getMonth()===t&&e>0&&y.minDate.getDate()>e))&&(r=!1),y.maxDate&&(y.maxDate.getFullYear()<n||y.maxDate.getFullYear()===n&&(y.maxDate.getMonth()<t||y.maxDate.getMonth()===t&&e>0&&y.maxDate.getDate()<e))&&(o=!1),y.disabledDates&&(l=!rn(e,t,n)),y.disabledDays&&(i=!on(e,t,n)),!1===y.selectOtherMonths&&a&&(u=!1),r&&o&&l&&i&&u},qt=function(e){var t=!0,n=!0;return y.minDate&&y.minDate.toDateString()===e.toDateString()&&(y.minDate.getHours()>e.getHours()||y.minDate.getHours()===e.getHours()&&(y.minDate.getMinutes()>e.getMinutes()||y.minDate.getMinutes()===e.getMinutes()&&(y.minDate.getSeconds()>e.getSeconds()||y.minDate.getSeconds()===e.getSeconds()&&y.minDate.getMilliseconds()>e.getMilliseconds())))&&(t=!1),y.maxDate&&y.maxDate.toDateString()===e.toDateString()&&(y.maxDate.getHours()<e.getHours()||y.maxDate.getHours()===e.getHours()&&(y.maxDate.getMinutes()<e.getMinutes()||y.maxDate.getMinutes()===e.getMinutes()&&(y.maxDate.getSeconds()<e.getSeconds()||y.maxDate.getSeconds()===e.getSeconds()&&y.maxDate.getMilliseconds()<e.getMilliseconds())))&&(n=!1),t&&n},zt=function(e){if(!y.value)return!1;if(en())return Gt(y.value,e);if(nn()){var t,n=!1,a=A(y.value);try{for(a.s();!(t=a.n()).done;){if(n=Gt(t.value,e))break}}catch(e){a.e(e)}finally{a.f()}return n}return tn()?y.value[1]?Gt(y.value[0],e)||Gt(y.value[1],e)||Qt(y.value[0],y.value[1],e):Gt(y.value[0],e):void 0},Jt=function(){return null!=y.value&&"string"!=typeof y.value},Xt=function(e){if(Jt()){var t=tn()?y.value[0]:y.value;return!nn()&&(t.getMonth()===e&&t.getFullYear()===oe)}return!1},$t=function(e){if(Jt()){var t=tn()?y.value[0]:y.value;return!(nn()||!Jt())&&t.getFullYear()===e}return!1},_t=function(){return y.numberOfMonths>1||y.disabled},Gt=function(e,t){return!!(e&&e instanceof Date)&&(e.getDate()===t.day&&e.getMonth()===t.month&&e.getFullYear()===t.year)},Qt=function(e,t,n){if(e&&t){var a=new Date(n.year,n.month,n.day);return e.getTime()<=a.getTime()&&t.getTime()>=a.getTime()}return!1},en=function(){return"single"===y.selectionMode},tn=function(){return"range"===y.selectionMode},nn=function(){return"multiple"===y.selectionMode},an=function(e,t,n,a){return e.getDate()===t&&e.getMonth()===n&&e.getFullYear()===a},rn=function(e,t,n){return!!y.disabledDates&&y.disabledDates.some((function(a){return a.getFullYear()===n&&a.getMonth()===t&&a.getDate()===e}))},on=function(e,t,n){if(y.disabledDays){var a=new Date(n,t,e).getDay();return-1!==y.disabledDays.indexOf(a)}return!1},ln=function(e){if(L.current){var t="";if(e)try{if(en())t=rt(e)?un(e):"";else if(nn())for(var n=0;n<e.length;n++){var a=e[n];t+=rt(a)?un(a):"",n!==e.length-1&&(t+=", ")}else if(tn()&&e&&e.length){var r=e[0],o=e[1];t=rt(r)?un(r):"",o&&(t+=rt(o)?" - "+un(o):"")}}catch(n){t=e}L.current.value=t}},un=function(e){if(y.formatDateTime)return y.formatDateTime(e);var t=null;return e&&(y.timeOnly?t=cn(e):(t=sn(e,he()),y.showTime&&(t+=" "+cn(e)))),t},sn=function(e,t){if(!e)return"";var a,r=function(e){var n=a+1<t.length&&t.charAt(a+1)===e;return n&&a++,n},o=function(e,t,n){var a=""+t;if(r(e))for(;a.length<n;)a="0"+a;return a},l=function(e,t,n,a){return r(e)?a[t]:n[t]},i="",u=!1,s=n(y.locale),c=s.dayNamesShort,m=s.dayNames,d=s.monthNamesShort,p=s.monthNames;if(e)for(a=0;a<t.length;a++)if(u)"'"!==t.charAt(a)||r("'")?i+=t.charAt(a):u=!1;else switch(t.charAt(a)){case"d":i+=o("d",e.getDate(),2);break;case"D":i+=l("D",e.getDay(),c,m);break;case"o":i+=o("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":i+=o("m",e.getMonth()+1,2);break;case"M":i+=l("M",e.getMonth(),d,p);break;case"y":i+=r("y")?e.getFullYear():(e.getFullYear()%100<10?"0":"")+e.getFullYear()%100;break;case"@":i+=e.getTime();break;case"!":i+=1e4*e.getTime()+ticksTo1970;break;case"'":r("'")?i+="'":u=!0;break;default:i+=t.charAt(a)}return i},cn=function(e){if(!e)return"";var t="",n=e.getHours(),a=e.getMinutes(),r=e.getSeconds(),o=e.getMilliseconds();return"12"===y.hourFormat&&n>11&&12!==n&&(n-=12),t+="12"===y.hourFormat&&0===n?12:n<10?"0"+n:n,t+=":",t+=a<10?"0"+a:a,y.showSeconds&&(t+=":",t+=r<10?"0"+r:r),y.showMillisec&&(t+=".",t+=o<100?(o<10?"00":"0")+o:o),"12"===y.hourFormat&&(t+=e.getHours()>11?" PM":" AM"),t},mn=function(e){if(!e||0===e.trim().length)return null;var t;if(en())t=dn(e);else if(nn()){t=[];var n,a=A(e.split(","));try{for(a.s();!(n=a.n()).done;){t.push(dn(n.value.trim()))}}catch(e){a.e(e)}finally{a.f()}}else if(tn()){var r=e.split(" - ");t=[];for(var o=0;o<r.length;o++)t[o]=dn(r[o].trim())}return t},dn=function(e){if(y.parseDateTime)return y.parseDateTime(e);var t,n=e.split(" ");return y.timeOnly?(t=new Date,pn(t,n[0],n[1])):y.showTime?(t=gn(n[0],he()),pn(t,n[1],n[2])):t=gn(e,he()),t},pn=function(e,t,n){if("12"===y.hourFormat&&"PM"!==n&&"AM"!==n)throw new Error("Invalid Time");var a=fn(t,n);e.setHours(a.hour),e.setMinutes(a.minute),e.setSeconds(a.second),e.setMilliseconds(a.millisecond)},fn=function(e,t){var n=(e=y.showMillisec?e.replace(".",":"):e).split(":"),a=y.showSeconds?3:2;if(n.length!==(a=y.showMillisec?a+1:a)||2!==n[0].length||2!==n[1].length||y.showSeconds&&2!==n[2].length||y.showMillisec&&3!==n[3].length)throw new Error("Invalid time");var r=parseInt(n[0],10),o=parseInt(n[1],10),l=y.showSeconds?parseInt(n[2],10):null,i=y.showMillisec?parseInt(n[3],10):null;if(isNaN(r)||isNaN(o)||r>23||o>59||"12"===y.hourFormat&&r>12||y.showSeconds&&(isNaN(l)||l>59)||y.showMillisec&&(isNaN(l)||l>1e3))throw new Error("Invalid time");return"12"===y.hourFormat&&12!==r&&"PM"===t&&(r+=12),{hour:r,minute:o,second:l,millisecond:i}},gn=function(e,t){if(null==t||null==e)throw new Error("Invalid arguments");if(""===(e="object"===k(e)?e.toString():e+""))return null;var a,r,o,l,i=0,u="string"!=typeof y.shortYearCutoff?y.shortYearCutoff:(new Date).getFullYear()%100+parseInt(y.shortYearCutoff,10),s=-1,c=-1,m=-1,d=-1,p=!1,f=function(e){var n=a+1<t.length&&t.charAt(a+1)===e;return n&&a++,n},g=function(t){var n=f(t),a="@"===t?14:"!"===t?20:"y"===t&&n?4:"o"===t?3:2,r=new RegExp("^\\d{"+("y"===t?a:1)+","+a+"}"),o=e.substring(i).match(r);if(!o)throw new Error("Missing number at position "+i);return i+=o[0].length,parseInt(o[0],10)},h=function(t,n,a){for(var r=-1,o=f(t)?a:n,l=[],u=0;u<o.length;u++)l.push([u,o[u]]);l.sort((function(e,t){return-(e[1].length-t[1].length)}));for(var s=0;s<l.length;s++){var c=l[s][1];if(e.substr(i,c.length).toLowerCase()===c.toLowerCase()){r=l[s][0],i+=c.length;break}}if(-1!==r)return r+1;throw new Error("Unknown name at position "+i)},v=function(){if(e.charAt(i)!==t.charAt(a))throw new Error("Unexpected literal at position "+i);i++};"month"===y.view&&(m=1);var D=n(y.locale),b=D.dayNamesShort,M=D.dayNames,w=D.monthNamesShort,S=D.monthNames;for(a=0;a<t.length;a++)if(p)"'"!==t.charAt(a)||f("'")?v():p=!1;else switch(t.charAt(a)){case"d":m=g("d");break;case"D":h("D",b,M);break;case"o":d=g("o");break;case"m":c=g("m");break;case"M":c=h("M",w,S);break;case"y":s=g("y");break;case"@":s=(l=new Date(g("@"))).getFullYear(),c=l.getMonth()+1,m=l.getDate();break;case"!":s=(l=new Date((g("!")-ticksTo1970)/1e4)).getFullYear(),c=l.getMonth()+1,m=l.getDate();break;case"'":f("'")?v():p=!0;break;default:v()}if(i<e.length&&(o=e.substr(i),!/^\s+/.test(o)))throw new Error("Extra/unparsed characters found in date: "+o);if(-1===s?s=(new Date).getFullYear():s<100&&(s+=(new Date).getFullYear()-(new Date).getFullYear()%100+(s<=u?0:-100)),d>-1)for(c=1,m=d;;){if(m<=(r=At(s,c-1)))break;c++,m-=r}if((l=Ut(new Date(s,c-1,m))).getFullYear()!==s||l.getMonth()+1!==c||l.getDate()!==m)throw new Error("Invalid date");return l},hn=function(e){return y.minDate&&y.minDate.getFullYear()===e.getFullYear()},vn=function(e){return y.maxDate&&y.maxDate.getFullYear()===e.getFullYear()};e.useEffect((function(){g.combinedRefs(L,y.inputRef)}),[L,y.inputRef]),i((function(){var e=null,t=nt(y.viewDate);return ct(t),U(t),ae(t.getMonth()),le(t.getFullYear()),ee(y.view),y.inline?(P&&P.current.setAttribute(de,""),y.disabled||(Ie(),1===y.numberOfMonths&&(P.current.style.width=f.getOuterWidth(P.current)+"px"))):y.mask&&(e=h(L.current,{mask:y.mask,readOnly:y.readOnlyInput||y.disabled,onChange:function(e){!_.current&&Me(e.originalEvent,e.value),_.current=!1},onBlur:function(){_.current=!0}}).unbindEvents),y.value&&(ln(y.value),Cn(y.value)),function(){y.mask&&e()}})),u((function(){ee(y.view)}),[y.view]),u((function(){y.onViewDateChange||q.current||Cn(y.value)}),[y.onViewDateChange,y.value]),u((function(){ce===y.value||q.current&&!me||ln(y.value)}),[y.value,me]),u((function(){ln(y.value)}),[y.dateFormat,y.hourFormat,y.timeOnly,y.showSeconds,y.showMillisec]),u((function(){P.current&&(pt(R),Fe())})),s((function(){z.current&&(It(),z.current=null),v.clear(P.current)})),e.useImperativeHandle(b,(function(){return{props:y,show:xt,hide:Nt,getCurrentDateTime:at,getViewDate:nt,updateViewDate:dt,getElement:function(){return K.current},getOverlay:function(){return P.current},getInput:function(){return L.current}}}));var Dn,yn,bn,Mn,wn,kn,Sn,En,xn,Nn,Cn=function(e){Array.isArray(e)&&(e=e[0]);var t=ce;if(Array.isArray(t)&&(t=t[0]),!t&&e||e&&e instanceof Date&&e.getTime()!==t.getTime()){var n=y.viewDate&&rt(y.viewDate)?y.viewDate:e&&rt(e)?e:new Date;ct(n),U(n),q.current=!0}},Fn=function(t){return e.createElement("button",w({type:"button",className:"p-datepicker-prev"},t?{onClick:Ee,onKeyDown:function(e){return Ne(e)}}:{style:{visibility:"hidden"}}),e.createElement("span",{className:"p-datepicker-prev-icon pi pi-chevron-left"}),e.createElement(d,null))},In=function(t){return e.createElement("button",w({type:"button",className:"p-datepicker-next"},t?{onClick:xe,onKeyDown:function(e){return Ne(e)}}:{style:{visibility:"hidden"}}),e.createElement("span",{className:"p-datepicker-next-icon pi pi-chevron-right"}),e.createElement(d,null))},Tn=function(t){var n=a("monthNames",y.locale);if(y.monthNavigator&&"month"!==y.view){var r=nt(),o=r.getMonth(),l=n.map((function(e,t){return(!hn(r)||t>=y.minDate.getMonth())&&(!vn(r)||t<=y.maxDate.getMonth())?{label:e,value:t,index:t}:null})).filter((function(e){return!!e})),i=l.map((function(e){return e.label})),u=e.createElement("select",{className:"p-datepicker-month",onChange:function(e){return Re(e,e.target.value)},value:o},l.map((function(t){return e.createElement("option",{key:t.label,value:t.value},t.label)})));return y.monthNavigatorTemplate?g.getJSXElement(y.monthNavigatorTemplate,{onChange:Re,className:"p-datepicker-month",value:o,names:i,options:l,element:u,props:y}):u}return"date"===Q&&e.createElement("button",{className:"p-datepicker-month p-link",onClick:Mt,disabled:_t()},n[t])},Hn=function(){if(y.yearNavigator){for(var t=[],n=y.yearRange.split(":"),a=parseInt(n[0],10),r=parseInt(n[1],10),o=a;o<=r;o++)t.push(o);var l=nt().getFullYear(),i=t.filter((function(e){return!(y.minDate&&y.minDate.getFullYear()>e||y.maxDate&&y.maxDate.getFullYear()<e)})),u=e.createElement("select",{className:"p-datepicker-year",onChange:function(e){return Ue(e,e.target.value)},value:l},i.map((function(t){return e.createElement("option",{key:t,value:t},t)})));if(y.yearNavigatorTemplate){var s=i.map((function(e,t){return{label:e,value:e,index:t}}));return g.getJSXElement(y.yearNavigatorTemplate,{onChange:Ue,className:"p-datepicker-year",value:l,names:i,options:s,element:u,props:y})}return u}return"year"!==Q&&e.createElement("button",{className:"p-datepicker-year p-link",onClick:wt,disabled:_t()},oe)},Yn=function(){var t=jn();return"year"===Q?e.createElement("span",{className:"p-datepicker-decade"},y.decadeTemplate?y.decadeTemplate(t):e.createElement("span",null,"".concat(jn()[0]," - ").concat(jn()[jn().length-1]))):null},On=function(t){var n=Tn(t.month),a=Hn(),r=Yn();return e.createElement("div",{className:"p-datepicker-title"},n,a,r)},An=function(t){var n=t.map((function(t,n){return e.createElement("th",{key:"".concat(t,"-").concat(n),scope:"col"},e.createElement("span",null,t))}));return y.showWeek?[e.createElement("th",{scope:"col",key:"wn",className:"p-datepicker-weekheader p-disabled"},e.createElement("span",null,a("weekHeader",y.locale)))].concat(F(n)):n},Rn=function(t,n,a){var r=y.dateTemplate?y.dateTemplate(t):t.day;return e.createElement("span",{className:n,onClick:function(e){return ht(e,t)},onKeyDown:function(e){return ft(e,t,a)}},r,e.createElement(d,null))},Un=function(t,n,a){var r=t.map((function(t){var n=zt(t),r=D({"p-datepicker-other-month":t.otherMonth,"p-datepicker-today":t.today}),o=D({"p-highlight":n,"p-disabled":!t.selectable}),l=t.otherMonth&&!y.showOtherMonths?null:Rn(t,o,a);return e.createElement("td",{key:t.day,className:r},l)}));return y.showWeek?[e.createElement("td",{key:"wn"+n,className:"p-datepicker-weeknumber"},e.createElement("span",{className:"p-disabled"},n))].concat(F(r)):r},Bn=function(t,n){return t.dates.map((function(a,r){return e.createElement("tr",{key:r},Un(a,t.weekNumbers[r],n))}))},Kn=function(t,n,a){var r=An(n),o=Bn(t,a);return"date"===Q&&e.createElement("div",{className:"p-datepicker-calendar-container"},e.createElement("table",{className:"p-datepicker-calendar"},e.createElement("thead",null,e.createElement("tr",null,r)),e.createElement("tbody",null,o)))},Pn=function(t,n){var a=Lt(),r=Fn(0===n),o=In(1===y.numberOfMonths||n===y.numberOfMonths-1),l=On(t),i=Kn(t,a,n),u=y.headerTemplate?y.headerTemplate():null;return e.createElement("div",{key:t.month,className:"p-datepicker-group"},e.createElement("div",{className:"p-datepicker-header"},u,r,l,o),i)},Ln=function(t){var n=t.map(Pn);return e.createElement("div",{className:"p-datepicker-group-container"},n)},Vn=function(){for(var e=[],t=a("monthNamesShort",y.locale),n=0;n<=11;n++)e.push(t[n]);return e},jn=function(){for(var e=[],t=oe-oe%10,n=0;n<10;n++)e.push(t+n);return e},Wn=function(){var t=at().getHours();"12"===y.hourFormat&&(0===t?t=12:t>11&&12!==t&&(t-=12));var n=t<10?"0"+t:t;return e.createElement("div",{className:"p-hour-picker"},e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,0,1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-up"}),e.createElement(d,null)),e.createElement("span",null,n),e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,0,-1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-down"}),e.createElement(d,null)))},Zn=function(){if(y.showSeconds){var t=at().getSeconds(),n=t<10?"0"+t:t;return e.createElement("div",{className:"p-second-picker"},e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,2,1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-up"}),e.createElement(d,null)),e.createElement("span",null,n),e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,2,-1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-down"}),e.createElement(d,null)))}return null},qn=function(){if(y.showMillisec){var t=at().getMilliseconds(),n=t<100?(t<10?"00":"0")+t:t;return e.createElement("div",{className:"p-millisecond-picker"},e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,3,1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-up"}),e.createElement(d,null)),e.createElement("span",null,n),e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,3,-1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-down"}),e.createElement(d,null)))}return null},zn=function(){if("12"===y.hourFormat){var t=at().getHours()>11?"PM":"AM";return e.createElement("div",{className:"p-ampm-picker"},e.createElement("button",{type:"button",className:"p-link",onClick:tt},e.createElement("span",{className:"pi pi-chevron-up"}),e.createElement(d,null)),e.createElement("span",null,t),e.createElement("button",{type:"button",className:"p-link",onClick:tt},e.createElement("span",{className:"pi pi-chevron-down"}),e.createElement(d,null)))}return null},Jn=function(t){return e.createElement("div",{className:"p-separator"},e.createElement("span",null,t))},Xn=g.findDiffKeys(y,B.defaultProps),$n=D("p-calendar p-component p-inputwrapper",y.className,(M(S={},"p-calendar-w-btn p-calendar-w-btn-".concat(y.iconPos),y.showIcon),M(S,"p-calendar-disabled",y.disabled),M(S,"p-calendar-timeonly",y.timeOnly),M(S,"p-inputwrapper-filled",y.value||f.hasClass(L.current,"p-filled")&&""!==L.current.value),M(S,"p-inputwrapper-focus",x),S)),_n=D("p-datepicker p-component",y.panelClassName,{"p-datepicker-inline":y.inline,"p-disabled":y.disabled,"p-datepicker-timeonly":y.timeOnly,"p-datepicker-multiple-month":y.numberOfMonths>1,"p-datepicker-monthpicker":"month"===Q,"p-datepicker-touch-ui":y.touchUI}),Gn=(Dn=y.inline?null:e.createElement(c,{ref:L,id:y.inputId,name:y.name,type:"text",className:y.inputClassName,style:y.inputStyle,readOnly:y.readOnlyInput,disabled:y.disabled,required:y.required,autoComplete:"off",placeholder:y.placeholder,tabIndex:y.tabIndex,onInput:be,onFocus:ve,onBlur:De,onKeyDown:ye,"aria-labelledby":y.ariaLabelledBy,inputMode:y.inputMode,tooltip:y.tooltip,tooltipOptions:y.tooltipOptions}),yn=y.showIcon?e.createElement(r,{type:"button",icon:y.icon,onClick:Se,tabIndex:"-1",disabled:y.disabled,className:"p-datepicker-trigger"}):null,"left"===y.iconPos?e.createElement(e.Fragment,null,yn,Dn):e.createElement(e.Fragment,null,Dn,yn)),Qn=y.timeOnly?null:"date"===y.view?(Sn=nt(),En=Vt(Sn.getMonth(),Sn.getFullYear()),Ln(En)):(bn=Fn(!0),Mn=In(!0),wn=Hn(nt().getFullYear()),kn=Yn(),e.createElement(e.Fragment,null,e.createElement("div",{className:"p-datepicker-group-container"},e.createElement("div",{className:"p-datepicker-group"},e.createElement("div",{className:"p-datepicker-header"},bn,e.createElement("div",{className:"p-datepicker-title"},wn,kn),Mn))))),ea=(y.showTime||y.timeOnly)&&"date"===Q?e.createElement("div",{className:"p-timepicker"},Wn(),Jn(":"),(xn=at().getMinutes(),Nn=xn<10?"0"+xn:xn,e.createElement("div",{className:"p-minute-picker"},e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,1,1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-up"}),e.createElement(d,null)),e.createElement("span",null,Nn),e.createElement("button",{type:"button",className:"p-link",onMouseDown:function(e){return Le(e,1,-1)},onMouseUp:Ve,onMouseLeave:je,onKeyDown:function(e){return Ne(e)}},e.createElement("span",{className:"pi pi-chevron-down"}),e.createElement(d,null)))),y.showSeconds&&Jn(":"),Zn(),y.showMillisec&&Jn("."),qn(),"12"===y.hourFormat&&Jn(":"),zn()):null,ta=function(){if(y.showButtonBar){var t=D("p-button-text",y.todayButtonClassName),a=D("p-button-text",y.clearButtonClassName),o=n(y.locale),l=o.clear;return e.createElement("div",{className:"p-datepicker-buttonbar"},e.createElement(r,{type:"button",label:o.today,onClick:Be,onKeyDown:function(e){return Ne(e)},className:t}),e.createElement(r,{type:"button",label:l,onClick:Ke,onKeyDown:function(e){return Ne(e)},className:a}))}return null}(),na=function(){if(y.footerTemplate){var t=y.footerTemplate();return e.createElement("div",{className:"p-datepicker-footer"},t)}return null}(),aa="month"===Q?e.createElement("div",{className:"p-monthpicker"},Vn().map((function(t,n){return e.createElement("span",{onClick:function(e){return kt(e,n)},key:"month".concat(n+1),className:D("p-monthpicker-month",{"p-highlight":Xt(n),"p-disabled":!Zt(0,n,oe)})},t)}))):null,ra="year"===Q?e.createElement("div",{className:"p-yearpicker"},jn().map((function(t,n){return e.createElement("span",{onClick:function(e){return St(e,t)},key:"year".concat(n+1),className:D("p-yearpicker-year",{"p-highlight":$t(t),"p-disabled":!Zt(0,0,t)})},t)}))):null;return e.createElement("span",w({ref:K,id:y.id,className:$n,style:y.style},Xn),Gn,e.createElement(O,{ref:P,className:_n,style:y.panelStyle,appendTo:y.appendTo,inline:y.inline,onClick:Pe,onMouseUp:function(e){Pe(e)},in:me,onEnter:function(){if(y.autoZIndex){var e=y.touchUI?"modal":"overlay";v.set(e,P.current,t.autoZIndex,y.baseZIndex||t.zIndex[e])}Ct()},onEntered:function(){fe(),y.onShow&&y.onShow()},onExit:function(){ge()},onExited:function(){v.clear(P.current),y.onHide&&y.onHide()},transitionOptions:y.transitionOptions},Qn,ea,aa,ra,ta,na))})));B.displayName="Calendar",B.defaultProps={__TYPE:"Calendar",appendTo:null,ariaLabelledBy:null,autoZIndex:!0,baseZIndex:0,className:null,clearButtonClassName:"p-button-secondary",dateFormat:null,dateTemplate:null,decadeTemplate:null,disabled:!1,disabledDates:null,disabledDays:null,footerTemplate:null,headerTemplate:null,hideOnDateTimeSelect:!1,hourFormat:"24",icon:"pi pi-calendar",iconPos:"right",id:null,inline:!1,inputClassName:null,inputId:null,inputMode:"none",inputRef:null,inputStyle:null,keepInvalid:!1,locale:null,mask:null,maxDate:null,maxDateCount:null,minDate:null,monthNavigator:!1,monthNavigatorTemplate:null,name:null,numberOfMonths:1,onBlur:null,onChange:null,onClearButtonClick:null,onFocus:null,onHide:null,onInput:null,onMonthChange:null,onSelect:null,onShow:null,onTodayButtonClick:null,onViewDateChange:null,onVisibleChange:null,panelClassName:null,panelStyle:null,placeholder:null,readOnlyInput:!1,required:!1,selectOtherMonths:!1,selectionMode:"single",shortYearCutoff:"+10",showButtonBar:!1,showIcon:!1,showMillisec:!1,showMinMaxRange:!1,showOnFocus:!0,showOtherMonths:!0,showSeconds:!1,showTime:!1,showWeek:!1,stepHour:1,stepMillisec:1,stepMinute:1,stepSecond:1,style:null,tabIndex:null,timeOnly:!1,todayButtonClassName:"p-button-secondary",tooltip:null,tooltipOptions:null,touchUI:!1,transitionOptions:null,value:null,view:"date",viewDate:null,visible:!1,yearNavigator:!1,yearNavigatorTemplate:null,yearRange:null};export{B as Calendar};