diff --git a/assets/js/app.js b/assets/js/app.js index 1ed1bd9e..e501390e 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -15,7 +15,5 @@ import { TempusDominus } from '@eonasdan/tempus-dominus'; document.addEventListener('DOMContentLoaded', () => { const datePickers = document.querySelectorAll('[data-sonata-form-datepicker]'); - datePickers.forEach((datePicker) => { - TempusDominus(datePicker); - }); + datePickers.forEach((datePicker) => new TempusDominus(datePicker)); }); diff --git a/src/Bridge/Symfony/Resources/public/app.js b/src/Bridge/Symfony/Resources/public/app.js index 43f0f3f0..ae833f0e 100644 --- a/src/Bridge/Symfony/Resources/public/app.js +++ b/src/Bridge/Symfony/Resources/public/app.js @@ -1 +1 @@ -!function(){"use strict";function t(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function e(e){return e instanceof t(e).Element||e instanceof Element}function s(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function i(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}var o=Math.max,n=Math.min,a=Math.round;function r(t,e){void 0===e&&(e=!1);var i=t.getBoundingClientRect(),o=1,n=1;if(s(t)&&e){var r=t.offsetHeight,c=t.offsetWidth;c>0&&(o=a(i.width)/c||1),r>0&&(n=a(i.height)/r||1)}return{width:i.width/o,height:i.height/n,top:i.top/n,right:i.right/o,bottom:i.bottom/n,left:i.left/o,x:i.left/o,y:i.top/n}}function c(e){var s=t(e);return{scrollLeft:s.pageXOffset,scrollTop:s.pageYOffset}}function d(t){return t?(t.nodeName||"").toLowerCase():null}function l(t){return((e(t)?t.ownerDocument:t.document)||window.document).documentElement}function h(t){return r(l(t)).left+c(t).scrollLeft}function p(e){return t(e).getComputedStyle(e)}function u(t){var e=p(t),s=e.overflow,i=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(s+o+i)}function m(e,i,o){void 0===o&&(o=!1);var n,p,m=s(i),f=s(i)&&function(t){var e=t.getBoundingClientRect(),s=a(e.width)/t.offsetWidth||1,i=a(e.height)/t.offsetHeight||1;return 1!==s||1!==i}(i),y=l(i),v=r(e,f),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(m||!m&&!o)&&(("body"!==d(i)||u(y))&&(g=(n=i)!==t(n)&&s(n)?{scrollLeft:(p=n).scrollLeft,scrollTop:p.scrollTop}:c(n)),s(i)?((b=r(i,!0)).x+=i.clientLeft,b.y+=i.clientTop):y&&(b.x=h(y))),{x:v.left+g.scrollLeft-b.x,y:v.top+g.scrollTop-b.y,width:v.width,height:v.height}}function f(t){var e=r(t),s=t.offsetWidth,i=t.offsetHeight;return Math.abs(e.width-s)<=1&&(s=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:t.offsetLeft,y:t.offsetTop,width:s,height:i}}function y(t){return"html"===d(t)?t:t.assignedSlot||t.parentNode||(i(t)?t.host:null)||l(t)}function v(t){return["html","body","#document"].indexOf(d(t))>=0?t.ownerDocument.body:s(t)&&u(t)?t:v(y(t))}function g(e,s){var i;void 0===s&&(s=[]);var o=v(e),n=o===(null==(i=e.ownerDocument)?void 0:i.body),a=t(o),r=n?[a].concat(a.visualViewport||[],u(o)?o:[]):o,c=s.concat(r);return n?c:c.concat(g(y(r)))}function b(t){return["table","td","th"].indexOf(d(t))>=0}function w(t){return s(t)&&"fixed"!==p(t).position?t.offsetParent:null}function S(e){for(var o=t(e),n=w(e);n&&b(n)&&"static"===p(n).position;)n=w(n);return n&&("html"===d(n)||"body"===d(n)&&"static"===p(n).position)?o:n||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&s(t)&&"fixed"===p(t).position)return null;var o=y(t);for(i(o)&&(o=o.host);s(o)&&["html","body"].indexOf(d(o))<0;){var n=p(o);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return o;o=o.parentNode}return null}(e)||o}var D="top",k="bottom",C="right",_="left",E="auto",M=[D,k,C,_],x="start",O="end",L="viewport",A="popper",T=M.reduce((function(t,e){return t.concat([e+"-"+x,e+"-"+O])}),[]),H=[].concat(M,[E]).reduce((function(t,e){return t.concat([e,e+"-"+x,e+"-"+O])}),[]),V=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function $(t){var e=new Map,s=new Set,i=[];function o(t){s.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!s.has(t)){var i=e.get(t);i&&o(i)}})),i.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){s.has(t.name)||o(t)})),i}var P={placement:"bottom",modifiers:[],strategy:"absolute"};function I(){for(var t=arguments.length,e=new Array(t),s=0;s=0?"x":"y"}function F(t){var e,s=t.reference,i=t.element,o=t.placement,n=o?B(o):null,a=o?z(o):null,r=s.x+s.width/2-i.width/2,c=s.y+s.height/2-i.height/2;switch(n){case D:e={x:r,y:s.y-i.height};break;case k:e={x:r,y:s.y+s.height};break;case C:e={x:s.x+s.width,y:c};break;case _:e={x:s.x-i.width,y:c};break;default:e={x:s.x,y:s.y}}var d=n?W(n):null;if(null!=d){var l="y"===d?"height":"width";switch(a){case x:e[d]=e[d]-(s[l]/2-i[l]/2);break;case O:e[d]=e[d]+(s[l]/2-i[l]/2)}}return e}var q={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Y(e){var s,i=e.popper,o=e.popperRect,n=e.placement,r=e.variation,c=e.offsets,d=e.position,h=e.gpuAcceleration,u=e.adaptive,m=e.roundOffsets,f=e.isFixed,y=c.x,v=void 0===y?0:y,g=c.y,b=void 0===g?0:g,w="function"==typeof m?m({x:v,y:b}):{x:v,y:b};v=w.x,b=w.y;var E=c.hasOwnProperty("x"),M=c.hasOwnProperty("y"),x=_,L=D,A=window;if(u){var T=S(i),H="clientHeight",V="clientWidth";if(T===t(i)&&"static"!==p(T=l(i)).position&&"absolute"===d&&(H="scrollHeight",V="scrollWidth"),T=T,n===D||(n===_||n===C)&&r===O)L=k,b-=(f&&T===A&&A.visualViewport?A.visualViewport.height:T[H])-o.height,b*=h?1:-1;if(n===_||(n===D||n===k)&&r===O)x=C,v-=(f&&T===A&&A.visualViewport?A.visualViewport.width:T[V])-o.width,v*=h?1:-1}var $,P=Object.assign({position:d},u&&q),I=!0===m?function(t){var e=t.x,s=t.y,i=window.devicePixelRatio||1;return{x:a(e*i)/i||0,y:a(s*i)/i||0}}({x:v,y:b}):{x:v,y:b};return v=I.x,b=I.y,h?Object.assign({},P,(($={})[L]=M?"0":"",$[x]=E?"0":"",$.transform=(A.devicePixelRatio||1)<=1?"translate("+v+"px, "+b+"px)":"translate3d("+v+"px, "+b+"px, 0)",$)):Object.assign({},P,((s={})[L]=M?b+"px":"",s[x]=E?v+"px":"",s.transform="",s))}var U={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,s=t.options,i=t.name,o=s.offset,n=void 0===o?[0,0]:o,a=H.reduce((function(t,s){return t[s]=function(t,e,s){var i=B(t),o=[_,D].indexOf(i)>=0?-1:1,n="function"==typeof s?s(Object.assign({},e,{placement:t})):s,a=n[0],r=n[1];return a=a||0,r=(r||0)*o,[_,C].indexOf(i)>=0?{x:r,y:a}:{x:a,y:r}}(s,e.rects,n),t}),{}),r=a[e.placement],c=r.x,d=r.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[i]=a}},R={left:"right",right:"left",bottom:"top",top:"bottom"};function K(t){return t.replace(/left|right|bottom|top/g,(function(t){return R[t]}))}var J={start:"end",end:"start"};function Q(t){return t.replace(/start|end/g,(function(t){return J[t]}))}function X(t,e){var s=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(s&&i(s)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function G(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Z(s,i){return i===L?G(function(e){var s=t(e),i=l(e),o=s.visualViewport,n=i.clientWidth,a=i.clientHeight,r=0,c=0;return o&&(n=o.width,a=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(r=o.offsetLeft,c=o.offsetTop)),{width:n,height:a,x:r+h(e),y:c}}(s)):e(i)?function(t){var e=r(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(i):G(function(t){var e,s=l(t),i=c(t),n=null==(e=t.ownerDocument)?void 0:e.body,a=o(s.scrollWidth,s.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),r=o(s.scrollHeight,s.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),d=-i.scrollLeft+h(t),u=-i.scrollTop;return"rtl"===p(n||s).direction&&(d+=o(s.clientWidth,n?n.clientWidth:0)-a),{width:a,height:r,x:d,y:u}}(l(s)))}function tt(t,i,a){var r="clippingParents"===i?function(t){var i=g(y(t)),o=["absolute","fixed"].indexOf(p(t).position)>=0&&s(t)?S(t):t;return e(o)?i.filter((function(t){return e(t)&&X(t,o)&&"body"!==d(t)})):[]}(t):[].concat(i),c=[].concat(r,[a]),l=c[0],h=c.reduce((function(e,s){var i=Z(t,s);return e.top=o(i.top,e.top),e.right=n(i.right,e.right),e.bottom=n(i.bottom,e.bottom),e.left=o(i.left,e.left),e}),Z(t,l));return h.width=h.right-h.left,h.height=h.bottom-h.top,h.x=h.left,h.y=h.top,h}function et(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function st(t,e){return e.reduce((function(e,s){return e[s]=t,e}),{})}function it(t,s){void 0===s&&(s={});var i=s,o=i.placement,n=void 0===o?t.placement:o,a=i.boundary,c=void 0===a?"clippingParents":a,d=i.rootBoundary,h=void 0===d?L:d,p=i.elementContext,u=void 0===p?A:p,m=i.altBoundary,f=void 0!==m&&m,y=i.padding,v=void 0===y?0:y,g=et("number"!=typeof v?v:st(v,M)),b=u===A?"reference":A,w=t.rects.popper,S=t.elements[f?b:u],_=tt(e(S)?S:S.contextElement||l(t.elements.popper),c,h),E=r(t.elements.reference),x=F({reference:E,element:w,strategy:"absolute",placement:n}),O=G(Object.assign({},w,x)),T=u===A?O:E,H={top:_.top-T.top+g.top,bottom:T.bottom-_.bottom+g.bottom,left:_.left-T.left+g.left,right:T.right-_.right+g.right},V=t.modifiersData.offset;if(u===A&&V){var $=V[n];Object.keys(H).forEach((function(t){var e=[C,k].indexOf(t)>=0?1:-1,s=[D,k].indexOf(t)>=0?"y":"x";H[t]+=$[s]*e}))}return H}function ot(t,e,s){return o(t,n(e,s))}var nt={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,s=t.options,i=t.name,a=s.mainAxis,r=void 0===a||a,c=s.altAxis,d=void 0!==c&&c,l=s.boundary,h=s.rootBoundary,p=s.altBoundary,u=s.padding,m=s.tether,y=void 0===m||m,v=s.tetherOffset,g=void 0===v?0:v,b=it(e,{boundary:l,rootBoundary:h,padding:u,altBoundary:p}),w=B(e.placement),E=z(e.placement),M=!E,O=W(w),L="x"===O?"y":"x",A=e.modifiersData.popperOffsets,T=e.rects.reference,H=e.rects.popper,V="function"==typeof g?g(Object.assign({},e.rects,{placement:e.placement})):g,$="number"==typeof V?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,I={x:0,y:0};if(A){if(r){var N,j="y"===O?D:_,F="y"===O?k:C,q="y"===O?"height":"width",Y=A[O],U=Y+b[j],R=Y-b[F],K=y?-H[q]/2:0,J=E===x?T[q]:H[q],Q=E===x?-H[q]:-T[q],X=e.elements.arrow,G=y&&X?f(X):{width:0,height:0},Z=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},tt=Z[j],et=Z[F],st=ot(0,T[q],G[q]),nt=M?T[q]/2-K-st-tt-$.mainAxis:J-st-tt-$.mainAxis,at=M?-T[q]/2+K+st+et+$.mainAxis:Q+st+et+$.mainAxis,rt=e.elements.arrow&&S(e.elements.arrow),ct=rt?"y"===O?rt.clientTop||0:rt.clientLeft||0:0,dt=null!=(N=null==P?void 0:P[O])?N:0,lt=Y+at-dt,ht=ot(y?n(U,Y+nt-dt-ct):U,Y,y?o(R,lt):R);A[O]=ht,I[O]=ht-Y}if(d){var pt,ut="x"===O?D:_,mt="x"===O?k:C,ft=A[L],yt="y"===L?"height":"width",vt=ft+b[ut],gt=ft-b[mt],bt=-1!==[D,_].indexOf(w),wt=null!=(pt=null==P?void 0:P[L])?pt:0,St=bt?vt:ft-T[yt]-H[yt]-wt+$.altAxis,Dt=bt?ft+T[yt]+H[yt]-wt-$.altAxis:gt,kt=y&&bt?function(t,e,s){var i=ot(t,e,s);return i>s?s:i}(St,ft,Dt):ot(y?St:vt,ft,y?Dt:gt);A[L]=kt,I[L]=kt-ft}e.modifiersData[i]=I}},requiresIfExists:["offset"]};var at={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,s=t.state,i=t.name,o=t.options,n=s.elements.arrow,a=s.modifiersData.popperOffsets,r=B(s.placement),c=W(r),d=[_,C].indexOf(r)>=0?"height":"width";if(n&&a){var l=function(t,e){return et("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:st(t,M))}(o.padding,s),h=f(n),p="y"===c?D:_,u="y"===c?k:C,m=s.rects.reference[d]+s.rects.reference[c]-a[c]-s.rects.popper[d],y=a[c]-s.rects.reference[c],v=S(n),g=v?"y"===c?v.clientHeight||0:v.clientWidth||0:0,b=m/2-y/2,w=l[p],E=g-h[d]-l[u],x=g/2-h[d]/2+b,O=ot(w,x,E),L=c;s.modifiersData[i]=((e={})[L]=O,e.centerOffset=O-x,e)}},effect:function(t){var e=t.state,s=t.options.element,i=void 0===s?"[data-popper-arrow]":s;null!=i&&("string"!=typeof i||(i=e.elements.popper.querySelector(i)))&&X(e.elements.popper,i)&&(e.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function rt(t,e,s){return void 0===s&&(s={x:0,y:0}),{top:t.top-e.height-s.y,right:t.right-e.width+s.x,bottom:t.bottom-e.height+s.y,left:t.left-e.width-s.x}}function ct(t){return[D,C,k,_].some((function(e){return t[e]>=0}))}var dt,lt=N({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var s=e.state,i=e.instance,o=e.options,n=o.scroll,a=void 0===n||n,r=o.resize,c=void 0===r||r,d=t(s.elements.popper),l=[].concat(s.scrollParents.reference,s.scrollParents.popper);return a&&l.forEach((function(t){t.addEventListener("scroll",i.update,j)})),c&&d.addEventListener("resize",i.update,j),function(){a&&l.forEach((function(t){t.removeEventListener("scroll",i.update,j)})),c&&d.removeEventListener("resize",i.update,j)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,s=t.name;e.modifiersData[s]=F({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,s=t.options,i=s.gpuAcceleration,o=void 0===i||i,n=s.adaptive,a=void 0===n||n,r=s.roundOffsets,c=void 0===r||r,d={placement:B(e.placement),variation:z(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Y(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:c})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Y(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},o=e.attributes[t]||{},n=e.elements[t];s(n)&&d(n)&&(Object.assign(n.style,i),Object.keys(o).forEach((function(t){var e=o[t];!1===e?n.removeAttribute(t):n.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var o=e.elements[t],n=e.attributes[t]||{},a=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});s(o)&&d(o)&&(Object.assign(o.style,a),Object.keys(n).forEach((function(t){o.removeAttribute(t)})))}))}},requires:["computeStyles"]},U,{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,s=t.options,i=t.name;if(!e.modifiersData[i]._skip){for(var o=s.mainAxis,n=void 0===o||o,a=s.altAxis,r=void 0===a||a,c=s.fallbackPlacements,d=s.padding,l=s.boundary,h=s.rootBoundary,p=s.altBoundary,u=s.flipVariations,m=void 0===u||u,f=s.allowedAutoPlacements,y=e.options.placement,v=B(y),g=c||(v===y||!m?[K(y)]:function(t){if(B(t)===E)return[];var e=K(t);return[Q(t),e,Q(e)]}(y)),b=[y].concat(g).reduce((function(t,s){return t.concat(B(s)===E?function(t,e){void 0===e&&(e={});var s=e,i=s.placement,o=s.boundary,n=s.rootBoundary,a=s.padding,r=s.flipVariations,c=s.allowedAutoPlacements,d=void 0===c?H:c,l=z(i),h=l?r?T:T.filter((function(t){return z(t)===l})):M,p=h.filter((function(t){return d.indexOf(t)>=0}));0===p.length&&(p=h);var u=p.reduce((function(e,s){return e[s]=it(t,{placement:s,boundary:o,rootBoundary:n,padding:a})[B(s)],e}),{});return Object.keys(u).sort((function(t,e){return u[t]-u[e]}))}(e,{placement:s,boundary:l,rootBoundary:h,padding:d,flipVariations:m,allowedAutoPlacements:f}):s)}),[]),w=e.rects.reference,S=e.rects.popper,O=new Map,L=!0,A=b[0],V=0;V=0,j=N?"width":"height",W=it(e,{placement:$,boundary:l,rootBoundary:h,altBoundary:p,padding:d}),F=N?I?C:_:I?k:D;w[j]>S[j]&&(F=K(F));var q=K(F),Y=[];if(n&&Y.push(W[P]<=0),r&&Y.push(W[F]<=0,W[q]<=0),Y.every((function(t){return t}))){A=$,L=!1;break}O.set($,Y)}if(L)for(var U=function(t){var e=b.find((function(e){var s=O.get(e);if(s)return s.slice(0,t).every((function(t){return t}))}));if(e)return A=e,"break"},R=m?3:1;R>0;R--){if("break"===U(R))break}e.placement!==A&&(e.modifiersData[i]._skip=!0,e.placement=A,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},nt,at,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,s=t.name,i=e.rects.reference,o=e.rects.popper,n=e.modifiersData.preventOverflow,a=it(e,{elementContext:"reference"}),r=it(e,{altBoundary:!0}),c=rt(a,i),d=rt(r,o,n),l=ct(c),h=ct(d);e.modifiersData[s]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:l,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":h})}}]});!function(t){t.seconds="seconds",t.minutes="minutes",t.hours="hours",t.date="date",t.month="month",t.year="year"}(dt||(dt={}));const ht={month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0},pt={hour:"2-digit",hour12:!1},ut=t=>{switch(t){case"date":return{dateStyle:"short"};case"month":return{month:"numeric",year:"numeric"};case"year":return{year:"numeric"}}};class mt extends Date{constructor(){super(...arguments),this.locale="default",this.nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],this.leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335]}setLocale(t){return this.locale=t,this}static convert(t,e="default"){if(!t)throw new Error("A date is required");return new mt(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).setLocale(e)}get clone(){return new mt(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.getMilliseconds()).setLocale(this.locale)}startOf(t,e=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(0);break;case"minutes":this.setSeconds(0,0);break;case"hours":this.setMinutes(0,0,0);break;case"date":this.setHours(0,0,0,0);break;case"weekDay":if(this.startOf(dt.date),this.weekDay===e)break;let t=this.weekDay;0!==e&&0===this.weekDay&&(t=8-e),this.manipulate(e-t,dt.date);break;case"month":this.startOf(dt.date),this.setDate(1);break;case"year":this.startOf(dt.date),this.setMonth(0,1)}return this}endOf(t,e=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(999);break;case"minutes":this.setSeconds(59,999);break;case"hours":this.setMinutes(59,59,999);break;case"date":this.setHours(23,59,59,999);break;case"weekDay":this.endOf(dt.date),this.manipulate(6+e-this.weekDay,dt.date);break;case"month":this.endOf(dt.date),this.manipulate(1,dt.month),this.setDate(0);break;case"year":this.endOf(dt.date),this.manipulate(1,dt.year),this.setDate(0)}return this}manipulate(t,e){if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this[e]+=t,this}format(t,e=this.locale){return new Intl.DateTimeFormat(e,t).format(this)}isBefore(t,e){if(!e)return this.valueOf()t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this.clone.startOf(e).valueOf()>t.clone.startOf(e).valueOf()}isSame(t,e){if(!e)return this.valueOf()===t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return t=mt.convert(t),this.clone.startOf(e).valueOf()===t.startOf(e).valueOf()}isBetween(t,e,s,i="()"){if(s&&void 0===this[s])throw new Error(`Unit '${s}' is not valid`);const o="("===i[0],n=")"===i[1];return(o?this.isAfter(t,s):!this.isBefore(t,s))&&(n?this.isBefore(e,s):!this.isAfter(e,s))||(o?this.isBefore(t,s):!this.isAfter(t,s))&&(n?this.isAfter(e,s):!this.isBefore(e,s))}parts(t=this.locale,e={dateStyle:"full",timeStyle:"long"}){const s={};return new Intl.DateTimeFormat(t,e).formatToParts(this).filter((t=>"literal"!==t.type)).forEach((t=>s[t.type]=t.value)),s}get seconds(){return this.getSeconds()}set seconds(t){this.setSeconds(t)}get secondsFormatted(){return this.parts(void 0,ht).second}get minutes(){return this.getMinutes()}set minutes(t){this.setMinutes(t)}get minutesFormatted(){return this.parts(void 0,ht).minute}get hours(){return this.getHours()}set hours(t){this.setHours(t)}get hoursFormatted(){let t=this.parts(void 0,pt).hour;return"24"===t&&(t="00"),t}get twelveHoursFormatted(){return this.parts(void 0,ht).hour}meridiem(t=this.locale){var e;return null===(e=new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).formatToParts(this).find((t=>"dayPeriod"===t.type)))||void 0===e?void 0:e.value}get date(){return this.getDate()}set date(t){this.setDate(t)}get dateFormatted(){return this.parts(void 0,ht).day}get weekDay(){return this.getDay()}get month(){return this.getMonth()}set month(t){const e=new Date(this.year,t+1);e.setDate(0);const s=e.getDate();this.date>s&&(this.date=s),this.setMonth(t)}get monthFormatted(){return this.parts(void 0,ht).month}get year(){return this.getFullYear()}set year(t){this.setFullYear(t)}get week(){const t=this.computeOrdinal(),e=this.getUTCDay();let s=Math.floor((t-e+10)/7);return s<1?s=this.weeksInWeekYear(this.year-1):s>this.weeksInWeekYear(this.year)&&(s=1),s}weeksInWeekYear(t){const e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,s=t-1,i=(s+Math.floor(s/4)-Math.floor(s/100)+Math.floor(s/400))%7;return 4===e||3===i?53:52}get isLeapYear(){return this.year%4==0&&(this.year%100!=0||this.year%400==0)}computeOrdinal(){return this.date+(this.isLeapYear?this.leapLadder:this.nonLeapLadder)[this.month]}}class ft extends Error{}const yt="tempus-dominus";class vt{}vt.NAME=yt,vt.version="6.0.0-beta7",vt.dataKey="td",vt.events=new class{constructor(){this.key=".td",this.change=`change${this.key}`,this.update=`update${this.key}`,this.error=`error${this.key}`,this.show=`show${this.key}`,this.hide=`hide${this.key}`,this.blur=`blur${this.key}`,this.focus=`focus${this.key}`,this.keyup=`keyup${this.key}`,this.keydown=`keydown${this.key}`}},vt.css=new class{constructor(){this.widget=`${yt}-widget`,this.calendarHeader="calendar-header",this.switch="picker-switch",this.toolbar="toolbar",this.noHighlight="no-highlight",this.sideBySide="timepicker-sbs",this.previous="previous",this.next="next",this.disabled="disabled",this.old="old",this.new="new",this.active="active",this.dateContainer="date-container",this.decadesContainer=`${this.dateContainer}-decades`,this.decade="decade",this.yearsContainer=`${this.dateContainer}-years`,this.year="year",this.monthsContainer=`${this.dateContainer}-months`,this.month="month",this.daysContainer=`${this.dateContainer}-days`,this.day="day",this.calendarWeeks="cw",this.dayOfTheWeek="dow",this.today="today",this.weekend="weekend",this.timeContainer="time-container",this.separator="separator",this.clockContainer=`${this.timeContainer}-clock`,this.hourContainer=`${this.timeContainer}-hour`,this.minuteContainer=`${this.timeContainer}-minute`,this.secondContainer=`${this.timeContainer}-second`,this.hour="hour",this.minute="minute",this.second="second",this.toggleMeridiem="toggleMeridiem",this.show="show",this.collapsing="td-collapsing",this.collapse="td-collapse",this.inline="inline"}},vt.errorMessages=new class{constructor(){this.base="TD:",this.failedToSetInvalidDate="Failed to set invalid date",this.failedToParseInput="Failed parse input field"}unexpectedOption(t){const e=new ft(`${this.base} Unexpected option: ${t} does not match a known option.`);throw e.code=1,e}unexpectedOptions(t){const e=new ft(`${this.base}: ${t.join(", ")}`);throw e.code=1,e}unexpectedOptionValue(t,e,s){const i=new ft(`${this.base} Unexpected option value: ${t} does not accept a value of "${e}". Valid values are: ${s.join(", ")}`);throw i.code=2,i}typeMismatch(t,e,s){const i=new ft(`${this.base} Mismatch types: ${t} has a type of ${e} instead of the required ${s}`);throw i.code=3,i}numbersOutOfRage(t,e,s){const i=new ft(`${this.base} ${t} expected an array of number between ${e} and ${s}.`);throw i.code=4,i}failedToParseDate(t,e,s=!1){const i=new ft(`${this.base} Could not correctly parse "${e}" to a date for ${t}.`);if(i.code=5,!s)throw i;console.warn(i)}mustProvideElement(){const t=new ft(`${this.base} No element was provided.`);throw t.code=6,t}subscribeMismatch(){const t=new ft(`${this.base} The subscribed events does not match the number of callbacks`);throw t.code=7,t}conflictingConfiguration(t){const e=new ft(`${this.base} A configuration value conflicts with another rule. ${t}`);throw e.code=8,e}dateString(){console.warn(`${this.base} Using a string for date options is not recommended unless you specify an ISO string.`)}throwError(t){const e=new ft(`${this.base} ${t}`);throw e.code=9,e}};class gt{constructor(){this.cache=new Map}locate(t){const e=this.cache.get(t);if(e)return e;const s=new t;return this.cache.set(t,s),s}}let bt;const wt=[{name:"calendar",className:vt.css.daysContainer,unit:dt.month,step:1},{name:"months",className:vt.css.monthsContainer,unit:dt.year,step:1},{name:"years",className:vt.css.yearsContainer,unit:dt.year,step:10},{name:"decades",className:vt.css.decadesContainer,unit:dt.year,step:100}];class St{constructor(){this.viewDate=new mt,this._currentCalendarViewMode=0,this.minimumCalendarViewMode=0,this.currentView="calendar"}get currentCalendarViewMode(){return this._currentCalendarViewMode}set currentCalendarViewMode(t){this._currentCalendarViewMode=t,this.currentView=wt[t].name}refreshCurrentView(){this.currentView=wt[this.currentCalendarViewMode].name}}class Dt{constructor(){this.optionsStore=bt.locate(St)}isValid(t,e){var s;if(this.optionsStore.options.restrictions.disabledDates.length>0&&this._isInDisabledDates(t))return!1;if(this.optionsStore.options.restrictions.enabledDates.length>0&&!this._isInEnabledDates(t))return!1;if(e!==dt.month&&e!==dt.year&&(null===(s=this.optionsStore.options.restrictions.daysOfWeekDisabled)||void 0===s?void 0:s.length)>0&&-1!==this.optionsStore.options.restrictions.daysOfWeekDisabled.indexOf(t.weekDay))return!1;if(this.optionsStore.options.restrictions.minDate&&t.isBefore(this.optionsStore.options.restrictions.minDate,e))return!1;if(this.optionsStore.options.restrictions.maxDate&&t.isAfter(this.optionsStore.options.restrictions.maxDate,e))return!1;if(e===dt.hours||e===dt.minutes||e===dt.seconds){if(this.optionsStore.options.restrictions.disabledHours.length>0&&this._isInDisabledHours(t))return!1;if(this.optionsStore.options.restrictions.enabledHours.length>0&&!this._isInEnabledHours(t))return!1;if(this.optionsStore.options.restrictions.disabledTimeIntervals.length>0)for(let e of this.optionsStore.options.restrictions.disabledTimeIntervals)if(t.isBetween(e.from,e.to))return!1}return!0}_isInDisabledDates(t){if(!this.optionsStore.options.restrictions.disabledDates||0===this.optionsStore.options.restrictions.disabledDates.length)return!1;const e=t.format(ut(dt.date));return this.optionsStore.options.restrictions.disabledDates.map((t=>t.format(ut(dt.date)))).find((t=>t===e))}_isInEnabledDates(t){if(!this.optionsStore.options.restrictions.enabledDates||0===this.optionsStore.options.restrictions.enabledDates.length)return!0;const e=t.format(ut(dt.date));return this.optionsStore.options.restrictions.enabledDates.map((t=>t.format(ut(dt.date)))).find((t=>t===e))}_isInDisabledHours(t){if(!this.optionsStore.options.restrictions.disabledHours||0===this.optionsStore.options.restrictions.disabledHours.length)return!1;const e=t.hours;return this.optionsStore.options.restrictions.disabledHours.find((t=>t===e))}_isInEnabledHours(t){if(!this.optionsStore.options.restrictions.enabledHours||0===this.optionsStore.options.restrictions.enabledHours.length)return!0;const e=t.hours;return this.optionsStore.options.restrictions.enabledHours.find((t=>t===e))}}class kt{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),this.unsubscribe.bind(this,this.subscribers.length-1)}unsubscribe(t){this.subscribers.splice(t,1)}emit(t){this.subscribers.forEach((e=>{e(t)}))}destory(){this.subscribers=null,this.subscribers=[]}}class Ct{constructor(){this.triggerEvent=new kt,this.viewUpdate=new kt,this.updateDisplay=new kt,this.action=new kt}destory(){this.triggerEvent.destory(),this.viewUpdate.destory(),this.updateDisplay.destory(),this.action.destory()}}const _t={restrictions:{minDate:void 0,maxDate:void 0,disabledDates:[],enabledDates:[],daysOfWeekDisabled:[],disabledTimeIntervals:[],disabledHours:[],enabledHours:[]},display:{icons:{type:"icons",time:"fa-solid fa-clock",date:"fa-solid fa-calendar",up:"fa-solid fa-arrow-up",down:"fa-solid fa-arrow-down",previous:"fa-solid fa-chevron-left",next:"fa-solid fa-chevron-right",today:"fa-solid fa-calendar-check",clear:"fa-solid fa-trash",close:"fa-solid fa-xmark"},sideBySide:!1,calendarWeeks:!1,viewMode:"calendar",toolbarPlacement:"bottom",keepOpen:!1,buttons:{today:!1,clear:!1,close:!1},components:{calendar:!0,date:!0,month:!0,year:!0,decades:!0,clock:!0,hours:!0,minutes:!0,seconds:!1,useTwentyfourHour:!1},inline:!1},stepping:1,useCurrent:!0,defaultDate:void 0,localization:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",previousMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",previousYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",previousDecade:"Previous Decade",nextDecade:"Next Decade",previousCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",toggleMeridiem:"Toggle Meridiem",selectTime:"Select Time",selectDate:"Select Date",dayViewHeaderFormat:{month:"long",year:"2-digit"},locale:"default",startOfTheWeek:0},keepInvalid:!1,debug:!1,allowInputToggle:!1,viewDate:new mt,multipleDates:!1,multipleDatesSeparator:"; ",promptTimeOnDateChange:!1,promptTimeOnDateChangeTransitionDelay:200,meta:{},container:void 0};class Et{static deepCopy(t){const e={};return Object.keys(t).forEach((s=>{const i=t[s];e[s]=i,"object"!=typeof i||i instanceof HTMLElement||i instanceof Element||i instanceof Date||Array.isArray(i)||(e[s]=Et.deepCopy(i))})),e}static objectPath(t,e){return"."===t.charAt(0)&&(t=t.slice(1)),t.split(".").reduce(((t,e)=>Et.isValue(t)||Et.isValue(t[e])?t[e]:void 0),e)}static spread(t,e,s,i="",o=""){const n=Object.keys(t).filter((t=>!Object.keys(e).includes(t)));if(n.length>0){const t=Et.getFlattenDefaultOptions(),e=n.map((e=>{let s=`"${i}.${e}" in not a known option.`,o=t.find((t=>t.includes(e)));return o&&(s+=`Did you mean "${o}"?`),s}));vt.errorMessages.unexpectedOptions(e)}Object.keys(e).forEach((e=>{"."===(i+=`.${e}`).charAt(0)&&(i=i.slice(1));const n=Et.objectPath(i,_t);let a=typeof t[e],r=typeof n,c=t[e];if(!t.hasOwnProperty(e)){if("undefined"===r||0===(null==c?void 0:c.length)&&Array.isArray(n))return s[e]=n,void(i=i.substring(0,i.lastIndexOf(`.${e}`)));t[e]=n,c=t[e]}s[e]=Et.processKey(e,c,a,r,i,o),"object"!=typeof n||n instanceof Date||Et.ignoreProperties.includes(e)||Array.isArray(t[e])||Et.spread(t[e],n,s[e],i,o),i=i.substring(0,i.lastIndexOf(`.${e}`))}))}static processKey(t,e,s,i,o,n){switch(t){case"defaultDate":{const t=this.dateConversion(e,"defaultDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("defaultDate",s,"DateTime or Date");break}case"viewDate":{const t=this.dateConversion(e,"viewDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("viewDate",s,"DateTime or Date");break}case"minDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.minDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("restrictions.minDate",s,"DateTime or Date");break}case"maxDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.maxDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("restrictions.maxDate",s,"DateTime or Date");break}case"disabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.disabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&vt.errorMessages.numbersOutOfRage("restrictions.disabledHours",0,23),e);case"enabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.enabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&vt.errorMessages.numbersOutOfRage("restrictions.enabledHours",0,23),e);case"daysOfWeekDisabled":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.daysOfWeekDisabled",e,s),e.filter((t=>t<0||t>6)).length>0&&vt.errorMessages.numbersOutOfRage("restrictions.daysOfWeekDisabled",0,6),e);case"enabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.enabledDates",e,s,n),e);case"disabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.disabledDates",e,s,n),e);case"disabledTimeIntervals":if(void 0===e)return[];Array.isArray(e)||vt.errorMessages.typeMismatch(t,s,"array of { from: DateTime|Date, to: DateTime|Date }");const a=e;for(let e=0;e{const i=`${t}[${e}].${s}`;let o=a[e][s];const r=this.dateConversion(o,i);r||vt.errorMessages.typeMismatch(i,typeof o,"DateTime or Date"),r.setLocale(n),a[e][s]=r}));return a;case"toolbarPlacement":case"type":case"viewMode":const r={toolbarPlacement:["top","bottom","default"],type:["icons","sprites"],viewMode:["clock","calendar","months","years","decades"]}[t];return r.includes(e)||vt.errorMessages.unexpectedOptionValue(o.substring(1),e,r),e;case"meta":case"dayViewHeaderFormat":return e;case"container":return e&&!(e instanceof HTMLElement||e instanceof Element||(null==e?void 0:e.appendChild))&&vt.errorMessages.typeMismatch(o.substring(1),typeof e,"HTMLElement"),e;default:switch(i){case"boolean":return"true"===e||!0===e;case"number":return+e;case"string":return e.toString();case"object":return{};case"function":return e;default:vt.errorMessages.typeMismatch(o,s,i)}}}static _mergeOptions(t,e){var s;const i={},o="default"!==e.localization.locale?e.localization.locale:(null===(s=null==t?void 0:t.localization)||void 0===s?void 0:s.locale)||"default";return Et.spread(t,e,i,"",o),i}static _dataToOptions(t,e){const s=JSON.parse(JSON.stringify(t.dataset));if((null==s?void 0:s.tdTargetInput)&&delete s.tdTargetInput,(null==s?void 0:s.tdTargetToggle)&&delete s.tdTargetToggle,!s||0===Object.keys(s).length||s.constructor!==DOMStringMap)return e;let i={};const o=t=>{const e={};return Object.keys(t).forEach((t=>{e[t.toLowerCase()]=t})),e},n=(t,e,s,i)=>{const a=o(s)[t[e].toLowerCase()],r={};return void 0===a||(s[a].constructor===Object?(e++,r[a]=n(t,e,s[a],i)):r[a]=i),r},a=o(e);return Object.keys(s).filter((t=>t.startsWith(vt.dataKey))).map((t=>t.substring(2))).forEach((t=>{let o=a[t.toLowerCase()];if(t.includes("_")){const r=t.split("_");o=a[r[0].toLowerCase()],void 0!==o&&e[o].constructor===Object&&(i[o]=n(r,1,e[o],s[`td${t}`]))}else void 0!==o&&(i[o]=s[`td${t}`])})),this._mergeOptions(i,e)}static _dateTypeCheck(t){if(t.constructor.name===mt.name)return t;if(t.constructor.name===Date.name)return mt.convert(t);if("string"==typeof t){const e=new mt(t);return"null"===JSON.stringify(e)?null:e}return null}static _typeCheckDateArray(t,e,s,i="default"){Array.isArray(e)||vt.errorMessages.typeMismatch(t,s,"array of DateTime or Date");for(let s=0;s"number"!=typeof t))||vt.errorMessages.typeMismatch(t,s,"array of numbers")}static dateConversion(t,e){"string"==typeof t&&"input"!==e&&vt.errorMessages.dateString();const s=this._dateTypeCheck(t);return s||vt.errorMessages.failedToParseDate(e,t,"input"===e),s}static getFlattenDefaultOptions(){if(this._flattenDefaults)return this._flattenDefaults;const t=(e,s=[])=>Array.isArray(e)?[]:Object(e)===e?Object.entries(e).flatMap((([e,i])=>t(i,[...s,e]))):s.join(".");return this._flattenDefaults=t(_t),this._flattenDefaults}static _validateConflicts(t){!t.display.sideBySide||t.display.components.clock&&(t.display.components.hours||t.display.components.minutes||t.display.components.seconds)||vt.errorMessages.conflictingConfiguration("Cannot use side by side mode without the clock components"),t.restrictions.minDate&&t.restrictions.maxDate&&(t.restrictions.minDate.isAfter(t.restrictions.maxDate)&&vt.errorMessages.conflictingConfiguration("minDate is after maxDate"),t.restrictions.maxDate.isBefore(t.restrictions.minDate)&&vt.errorMessages.conflictingConfiguration("maxDate is before minDate"))}}Et.ignoreProperties=["meta","dayViewHeaderFormat","container"],Et.isValue=t=>null!=t;class Mt{constructor(){this._dates=[],this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt),this._eventEmitters=bt.locate(Ct)}get picked(){return this._dates}get lastPicked(){return this._dates[this.lastPickedIndex]}get lastPickedIndex(){return 0===this._dates.length?0:this._dates.length-1}formatInput(t){const e=this.optionsStore.options.display.components;return t?t.format({year:e.calendar&&e.year?"numeric":void 0,month:e.calendar&&e.month?"2-digit":void 0,day:e.calendar&&e.date?"2-digit":void 0,hour:e.clock&&e.hours?e.useTwentyfourHour?"2-digit":"numeric":void 0,minute:e.clock&&e.minutes?"2-digit":void 0,second:e.clock&&e.seconds?"2-digit":void 0,hour12:!e.useTwentyfourHour}):""}parseInput(t){return Et.dateConversion(t,"input")}setFromInput(t,e){if(!t)return void this.setValue(void 0,e);const s=this.parseInput(t);s&&(s.setLocale(this.optionsStore.options.localization.locale),this.setValue(s,e))}add(t){this._dates.push(t)}isPicked(t,e){if(!e)return void 0!==this._dates.find((e=>e===t));const s=ut(e);let i=t.format(s);return void 0!==this._dates.map((t=>t.format(s))).find((t=>t===i))}pickedIndex(t,e){if(!e)return this._dates.indexOf(t);const s=ut(e);let i=t.format(s);return this._dates.map((t=>t.format(s))).indexOf(i)}clear(){this.optionsStore.unset=!0,this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:void 0,oldDate:this.lastPicked,isClear:!0,isValid:!0}),this._dates=[]}static getStartEndYear(t,e){const s=t/10,i=Math.floor(e/t)*t;return[i,i+9*s,Math.floor(e/s)*s]}setValue(t,e){const s=void 0===e,i=!t&&s;let o=this.optionsStore.unset?null:this._dates[e];!o&&!this.optionsStore.unset&&s&&i&&(o=this.lastPicked);const n=()=>{if(!this.optionsStore.input)return;let e=this.formatInput(t);this.optionsStore.options.multipleDates&&(e=this._dates.map((t=>this.formatInput(t))).join(this.optionsStore.options.multipleDatesSeparator)),this.optionsStore.input.value!=e&&(this.optionsStore.input.value=e)};if(t&&(null==o?void 0:o.isSame(t)))n();else{if(!t)return!this.optionsStore.options.multipleDates||1===this._dates.length||i?(this.optionsStore.unset=!0,this._dates=[]):this._dates.splice(e,1),n(),this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:void 0,oldDate:o,isClear:i,isValid:!0}),void this._eventEmitters.updateDisplay.emit("all");if(e=e||0,t=t.clone,1!==this.optionsStore.options.stepping&&(t.minutes=Math.round(t.minutes/this.optionsStore.options.stepping)*this.optionsStore.options.stepping,t.seconds=0),this.validation.isValid(t))return this._dates[e]=t,this.optionsStore.viewDate=t.clone,n(),this.optionsStore.unset=!1,this._eventEmitters.updateDisplay.emit("all"),void this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:t,oldDate:o,isClear:i,isValid:!0});this.optionsStore.options.keepInvalid&&(this._dates[e]=t,this.optionsStore.viewDate=t.clone,n(),this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:t,oldDate:o,isClear:i,isValid:!1})),this._eventEmitters.triggerEvent.emit({type:vt.events.error,reason:vt.errorMessages.failedToSetInvalidDate,date:t,oldDate:o})}}}var xt;!function(t){t.next="next",t.previous="previous",t.changeCalendarView="changeCalendarView",t.selectMonth="selectMonth",t.selectYear="selectYear",t.selectDecade="selectDecade",t.selectDay="selectDay",t.selectHour="selectHour",t.selectMinute="selectMinute",t.selectSecond="selectSecond",t.incrementHours="incrementHours",t.incrementMinutes="incrementMinutes",t.incrementSeconds="incrementSeconds",t.decrementHours="decrementHours",t.decrementMinutes="decrementMinutes",t.decrementSeconds="decrementSeconds",t.toggleMeridiem="toggleMeridiem",t.togglePicker="togglePicker",t.showClock="showClock",t.showHours="showHours",t.showMinutes="showMinutes",t.showSeconds="showSeconds",t.clear="clear",t.close="close",t.today="today"}(xt||(xt={}));var Ot=xt;class Lt{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");if(t.classList.add(vt.css.daysContainer),t.append(...this._daysOfTheWeek()),this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(vt.css.calendarWeeks,vt.css.noHighlight),t.appendChild(e)}for(let e=0;e<42;e++){if(0!==e&&e%7==0&&this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(vt.css.calendarWeeks,vt.css.noHighlight),t.appendChild(e)}const s=document.createElement("div");s.setAttribute("data-action",Ot.selectDay),t.appendChild(s)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.daysContainer)[0],[i,o,n]=s.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");o.setAttribute(vt.css.daysContainer,this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.month),dt.month)?i.classList.remove(vt.css.disabled):i.classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.month),dt.month)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled);let a=this.optionsStore.viewDate.clone.startOf(dt.month).startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).manipulate(12,dt.hours);s.querySelectorAll(`[data-action="${Ot.selectDay}"], .${vt.css.calendarWeeks}`).forEach((t=>{if(this.optionsStore.options.display.calendarWeeks&&t.classList.contains(vt.css.calendarWeeks)){if("#"===t.innerText)return;return void(t.innerText=`${a.week}`)}let s=[];s.push(vt.css.day),a.isBefore(this.optionsStore.viewDate,dt.month)&&s.push(vt.css.old),a.isAfter(this.optionsStore.viewDate,dt.month)&&s.push(vt.css.new),!this.optionsStore.unset&&this.dates.isPicked(a,dt.date)&&s.push(vt.css.active),this.validation.isValid(a,dt.date)||s.push(vt.css.disabled),a.isSame(new mt,dt.date)&&s.push(vt.css.today),0!==a.weekDay&&6!==a.weekDay||s.push(vt.css.weekend),e(dt.date,a,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${a.year}-${a.monthFormatted}-${a.dateFormatted}`),t.setAttribute("data-day",`${a.date}`),t.innerText=a.format({day:"numeric"}),a.manipulate(1,dt.date)}))}_daysOfTheWeek(){let t=this.optionsStore.viewDate.clone.startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).startOf(dt.date);const e=[];if(document.createElement("div"),this.optionsStore.options.display.calendarWeeks){const t=document.createElement("div");t.classList.add(vt.css.calendarWeeks,vt.css.noHighlight),t.innerText="#",e.push(t)}for(let s=0;s<7;s++){const s=document.createElement("div");s.classList.add(vt.css.dayOfTheWeek,vt.css.noHighlight),s.innerText=t.format({weekday:"short"}),t.manipulate(1,dt.date),e.push(s)}return e}}class At{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.monthsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectMonth),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.monthsContainer)[0],[i,o,n]=s.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");o.setAttribute(vt.css.monthsContainer,this.optionsStore.viewDate.format({year:"numeric"})),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.year),dt.year)?i.classList.remove(vt.css.disabled):i.classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.year),dt.year)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled);let a=this.optionsStore.viewDate.clone.startOf(dt.year);s.querySelectorAll(`[data-action="${Ot.selectMonth}"]`).forEach(((t,s)=>{let i=[];i.push(vt.css.month),!this.optionsStore.unset&&this.dates.isPicked(a,dt.month)&&i.push(vt.css.active),this.validation.isValid(a,dt.month)||i.push(vt.css.disabled),e(dt.month,a,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${s}`),t.innerText=`${a.format({month:"short"})}`,a.manipulate(1,dt.month)}))}}class Tt{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.yearsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectYear),t.appendChild(e)}return t}_update(t,e){this._startYear=this.optionsStore.viewDate.clone.manipulate(-1,dt.year),this._endYear=this.optionsStore.viewDate.clone.manipulate(10,dt.year);const s=t.getElementsByClassName(vt.css.yearsContainer)[0],[i,o,n]=s.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");o.setAttribute(vt.css.yearsContainer,`${this._startYear.format({year:"numeric"})}-${this._endYear.format({year:"numeric"})}`),this.validation.isValid(this._startYear,dt.year)?i.classList.remove(vt.css.disabled):i.classList.add(vt.css.disabled),this.validation.isValid(this._endYear,dt.year)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled);let a=this.optionsStore.viewDate.clone.startOf(dt.year).manipulate(-1,dt.year);s.querySelectorAll(`[data-action="${Ot.selectYear}"]`).forEach((t=>{let s=[];s.push(vt.css.year),!this.optionsStore.unset&&this.dates.isPicked(a,dt.year)&&s.push(vt.css.active),this.validation.isValid(a,dt.year)||s.push(vt.css.disabled),e(dt.year,a,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${a.year}`),t.innerText=a.format({year:"numeric"}),a.manipulate(1,dt.year)}))}}class Ht{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.decadesContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectDecade),t.appendChild(e)}return t}_update(t,e){const[s,i]=Mt.getStartEndYear(100,this.optionsStore.viewDate.year);this._startDecade=this.optionsStore.viewDate.clone.startOf(dt.year),this._startDecade.year=s,this._endDecade=this.optionsStore.viewDate.clone.startOf(dt.year),this._endDecade.year=i;const o=t.getElementsByClassName(vt.css.decadesContainer)[0],[n,a,r]=o.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");a.setAttribute(vt.css.decadesContainer,`${this._startDecade.format({year:"numeric"})}-${this._endDecade.format({year:"numeric"})}`),this.validation.isValid(this._startDecade,dt.year)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled),this.validation.isValid(this._endDecade,dt.year)?r.classList.remove(vt.css.disabled):r.classList.add(vt.css.disabled);const c=this.dates.picked.map((t=>t.year));o.querySelectorAll(`[data-action="${Ot.selectDecade}"]`).forEach(((t,s)=>{if(0===s)return t.classList.add(vt.css.old),this._startDecade.year-10<0?(t.textContent=" ",n.classList.add(vt.css.disabled),t.classList.add(vt.css.disabled),void t.setAttribute("data-value","")):(t.innerText=this._startDecade.clone.manipulate(-10,dt.year).format({year:"numeric"}),void t.setAttribute("data-value",`${this._startDecade.year}`));let i=[];i.push(vt.css.decade);const o=this._startDecade.year,a=this._startDecade.year+9;!this.optionsStore.unset&&c.filter((t=>t>=o&&t<=a)).length>0&&i.push(vt.css.active),e("decade",this._startDecade,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${this._startDecade.year}`),t.innerText=`${this._startDecade.format({year:"numeric"})}`,this._startDecade.manipulate(10,dt.year)}))}}class Vt{constructor(){this._gridColumns="",this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(t){const e=document.createElement("div");return e.classList.add(vt.css.clockContainer),e.append(...this._grid(t)),e}_update(t){const e=t.getElementsByClassName(vt.css.clockContainer)[0],s=(this.dates.lastPicked||this.optionsStore.viewDate).clone;if(e.querySelectorAll(".disabled").forEach((t=>t.classList.remove(vt.css.disabled))),this.optionsStore.options.display.components.hours&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.hours),dt.hours)||e.querySelector(`[data-action=${Ot.incrementHours}]`).classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.hours),dt.hours)||e.querySelector(`[data-action=${Ot.decrementHours}]`).classList.add(vt.css.disabled),e.querySelector(`[data-time-component=${dt.hours}]`).innerText=this.optionsStore.options.display.components.useTwentyfourHour?s.hoursFormatted:s.twelveHoursFormatted),this.optionsStore.options.display.components.minutes&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.minutes),dt.minutes)||e.querySelector(`[data-action=${Ot.incrementMinutes}]`).classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.minutes),dt.minutes)||e.querySelector(`[data-action=${Ot.decrementMinutes}]`).classList.add(vt.css.disabled),e.querySelector(`[data-time-component=${dt.minutes}]`).innerText=s.minutesFormatted),this.optionsStore.options.display.components.seconds&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.seconds),dt.seconds)||e.querySelector(`[data-action=${Ot.incrementSeconds}]`).classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.seconds),dt.seconds)||e.querySelector(`[data-action=${Ot.decrementSeconds}]`).classList.add(vt.css.disabled),e.querySelector(`[data-time-component=${dt.seconds}]`).innerText=s.secondsFormatted),!this.optionsStore.options.display.components.useTwentyfourHour){const t=e.querySelector(`[data-action=${Ot.toggleMeridiem}]`);t.innerText=s.meridiem(),this.validation.isValid(s.clone.manipulate(s.hours>=12?-12:12,dt.hours))?t.classList.remove(vt.css.disabled):t.classList.add(vt.css.disabled)}e.style.gridTemplateAreas=`"${this._gridColumns}"`}_grid(t){this._gridColumns="";const e=[],s=[],i=[],o=document.createElement("div"),n=t(this.optionsStore.options.display.icons.up),a=t(this.optionsStore.options.display.icons.down);o.classList.add(vt.css.separator,vt.css.noHighlight);const r=o.cloneNode(!0);r.innerHTML=":";const c=(t=!1)=>t?r.cloneNode(!0):o.cloneNode(!0);if(this.optionsStore.options.display.components.hours){let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementHour),t.setAttribute("data-action",Ot.incrementHours),t.appendChild(n.cloneNode(!0)),e.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickHour),t.setAttribute("data-action",Ot.showHours),t.setAttribute("data-time-component",dt.hours),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementHour),t.setAttribute("data-action",Ot.decrementHours),t.appendChild(a.cloneNode(!0)),i.push(t),this._gridColumns+="a"}if(this.optionsStore.options.display.components.minutes){this._gridColumns+=" a",this.optionsStore.options.display.components.hours&&(e.push(c()),s.push(c(!0)),i.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementMinute),t.setAttribute("data-action",Ot.incrementMinutes),t.appendChild(n.cloneNode(!0)),e.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickMinute),t.setAttribute("data-action",Ot.showMinutes),t.setAttribute("data-time-component",dt.minutes),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementMinute),t.setAttribute("data-action",Ot.decrementMinutes),t.appendChild(a.cloneNode(!0)),i.push(t)}if(this.optionsStore.options.display.components.seconds){this._gridColumns+=" a",this.optionsStore.options.display.components.minutes&&(e.push(c()),s.push(c(!0)),i.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementSecond),t.setAttribute("data-action",Ot.incrementSeconds),t.appendChild(n.cloneNode(!0)),e.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickSecond),t.setAttribute("data-action",Ot.showSeconds),t.setAttribute("data-time-component",dt.seconds),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementSecond),t.setAttribute("data-action",Ot.decrementSeconds),t.appendChild(a.cloneNode(!0)),i.push(t)}if(!this.optionsStore.options.display.components.useTwentyfourHour){this._gridColumns+=" a";let t=c();e.push(t);let o=document.createElement("button");o.setAttribute("title",this.optionsStore.options.localization.toggleMeridiem),o.setAttribute("data-action",Ot.toggleMeridiem),o.setAttribute("tabindex","-1"),vt.css.toggleMeridiem.includes(",")?o.classList.add(...vt.css.toggleMeridiem.split(",")):o.classList.add(vt.css.toggleMeridiem),t=document.createElement("div"),t.classList.add(vt.css.noHighlight),t.appendChild(o),s.push(t),t=c(),i.push(t)}return this._gridColumns=this._gridColumns.trim(),[...e,...s,...i]}}class $t{constructor(){this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.hourContainer);for(let e=0;e<(this.optionsStore.options.display.components.useTwentyfourHour?24:12);e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectHour),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.hourContainer)[0];let i=this.optionsStore.viewDate.clone.startOf(dt.date);s.querySelectorAll(`[data-action="${Ot.selectHour}"]`).forEach((t=>{let s=[];s.push(vt.css.hour),this.validation.isValid(i,dt.hours)||s.push(vt.css.disabled),e(dt.hours,i,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${i.hours}`),t.innerText=this.optionsStore.options.display.components.useTwentyfourHour?i.hoursFormatted:i.twelveHoursFormatted,i.manipulate(1,dt.hours)}))}}class Pt{constructor(){this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.minuteContainer);let e=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;for(let s=0;s<60/e;s++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectMinute),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.minuteContainer)[0];let i=this.optionsStore.viewDate.clone.startOf(dt.hours),o=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;s.querySelectorAll(`[data-action="${Ot.selectMinute}"]`).forEach((t=>{let s=[];s.push(vt.css.minute),this.validation.isValid(i,dt.minutes)||s.push(vt.css.disabled),e(dt.minutes,i,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${i.minutesFormatted}`),t.innerText=i.minutesFormatted,i.manipulate(o,dt.minutes)}))}}class It{constructor(){this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.secondContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectSecond),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.secondContainer)[0];let i=this.optionsStore.viewDate.clone.startOf(dt.minutes);s.querySelectorAll(`[data-action="${Ot.selectSecond}"]`).forEach((t=>{let s=[];s.push(vt.css.second),this.validation.isValid(i,dt.seconds)||s.push(vt.css.disabled),e(dt.seconds,i,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${i.seconds}`),t.innerText=i.secondsFormatted,i.manipulate(5,dt.seconds)}))}}class Nt{static toggle(t){t.classList.contains(vt.css.show)?this.hide(t):this.show(t)}static show(t){if(t.classList.contains(vt.css.collapsing)||t.classList.contains(vt.css.show))return;t.style.height="0",t.classList.remove(vt.css.collapse),t.classList.add(vt.css.collapsing),setTimeout((()=>{t.classList.remove(vt.css.collapsing),t.classList.add(vt.css.collapse,vt.css.show),t.style.height=""}),this.getTransitionDurationFromElement(t)),t.style.height=`${t.scrollHeight}px`}static hide(t){if(t.classList.contains(vt.css.collapsing)||!t.classList.contains(vt.css.show))return;t.style.height=`${t.getBoundingClientRect().height}px`;t.offsetHeight,t.classList.remove(vt.css.collapse,vt.css.show),t.classList.add(vt.css.collapsing),t.style.height="",setTimeout((()=>{t.classList.remove(vt.css.collapsing),t.classList.add(vt.css.collapse)}),this.getTransitionDurationFromElement(t))}}Nt.getTransitionDurationFromElement=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e),o=Number.parseFloat(s);return i||o?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0};class jt{constructor(){this._isVisible=!1,this._documentClickEvent=t=>{var e;this.optionsStore.options.debug||window.debug||!this._isVisible||t.composedPath().includes(this.widget)||(null===(e=t.composedPath())||void 0===e?void 0:e.includes(this.optionsStore.element))||this.hide()},this._actionsClickEvent=t=>{this._eventEmitters.action.emit({e:t})},this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt),this.dates=bt.locate(Mt),this.dateDisplay=bt.locate(Lt),this.monthDisplay=bt.locate(At),this.yearDisplay=bt.locate(Tt),this.decadeDisplay=bt.locate(Ht),this.timeDisplay=bt.locate(Vt),this.hourDisplay=bt.locate($t),this.minuteDisplay=bt.locate(Pt),this.secondDisplay=bt.locate(It),this._eventEmitters=bt.locate(Ct),this._widget=void 0,this._eventEmitters.updateDisplay.subscribe((t=>{this._update(t)}))}get widget(){return this._widget}get isVisible(){return this._isVisible}_update(t){if(this.widget)switch(t){case dt.seconds:this.secondDisplay._update(this.widget,this.paint);break;case dt.minutes:this.minuteDisplay._update(this.widget,this.paint);break;case dt.hours:this.hourDisplay._update(this.widget,this.paint);break;case dt.date:this.dateDisplay._update(this.widget,this.paint);break;case dt.month:this.monthDisplay._update(this.widget,this.paint);break;case dt.year:this.yearDisplay._update(this.widget,this.paint);break;case"clock":if(!this._hasTime)break;this.timeDisplay._update(this.widget),this._update(dt.hours),this._update(dt.minutes),this._update(dt.seconds);break;case"calendar":this._update(dt.date),this._update(dt.year),this._update(dt.month),this.decadeDisplay._update(this.widget,this.paint),this._updateCalendarHeader();break;case"all":this._hasTime&&this._update("clock"),this._hasDate&&this._update("calendar")}}paint(t,e,s,i){}show(){var t,e;if(null==this.widget){if(0==this.dates.picked.length){if(this.optionsStore.options.useCurrent&&!this.optionsStore.options.defaultDate){const e=(new mt).setLocale(this.optionsStore.options.localization.locale);if(!this.optionsStore.options.keepInvalid){let s=0,i=1;for((null===(t=this.optionsStore.options.restrictions.maxDate)||void 0===t?void 0:t.isBefore(e))&&(i=-1);!(this.validation.isValid(e)||(e.manipulate(i,dt.date),s>31));)s++}this.dates.setValue(e)}this.optionsStore.options.defaultDate&&this.dates.setValue(this.optionsStore.options.defaultDate)}this._buildWidget();const s=this._hasTime&&!this._hasDate;if(s&&(this.optionsStore.currentView="clock",this._eventEmitters.action.emit({e:null,action:Ot.showClock})),this.optionsStore.currentCalendarViewMode||(this.optionsStore.currentCalendarViewMode=this.optionsStore.minimumCalendarViewMode),s||(this._hasTime&&Nt.hide(this.widget.querySelector(`div.${vt.css.timeContainer}`)),Nt.show(this.widget.querySelector(`div.${vt.css.dateContainer}`))),this._hasDate&&this._showMode(),this.optionsStore.options.display.inline)this.optionsStore.element.appendChild(this.widget);else{((null===(e=this.optionsStore.options)||void 0===e?void 0:e.container)||document.body).appendChild(this.widget),this._popperInstance=lt(this.optionsStore.element,this.widget,{modifiers:[{name:"eventListeners",enabled:!0}],placement:"rtl"===document.documentElement.dir?"bottom-end":"bottom-start"})}"clock"==this.optionsStore.options.display.viewMode&&this._eventEmitters.action.emit({e:null,action:Ot.showClock}),this.widget.querySelectorAll("[data-action]").forEach((t=>t.addEventListener("click",this._actionsClickEvent))),this._hasTime&&this.optionsStore.options.display.sideBySide&&(this.timeDisplay._update(this.widget),this.widget.getElementsByClassName(vt.css.clockContainer)[0].style.display="grid")}this.widget.classList.add(vt.css.show),this.optionsStore.options.display.inline||(this._popperInstance.update(),document.addEventListener("click",this._documentClickEvent)),this._eventEmitters.triggerEvent.emit({type:vt.events.show}),this._isVisible=!0}_showMode(t){if(!this.widget)return;if(t){const e=Math.max(this.optionsStore.minimumCalendarViewMode,Math.min(3,this.optionsStore.currentCalendarViewMode+t));if(this.optionsStore.currentCalendarViewMode==e)return;this.optionsStore.currentCalendarViewMode=e}this.widget.querySelectorAll(`.${vt.css.dateContainer} > div:not(.${vt.css.calendarHeader}), .${vt.css.timeContainer} > div:not(.${vt.css.clockContainer})`).forEach((t=>t.style.display="none"));const e=wt[this.optionsStore.currentCalendarViewMode];let s=this.widget.querySelector(`.${e.className}`);switch(e.className){case vt.css.decadesContainer:this.decadeDisplay._update(this.widget,this.paint);break;case vt.css.yearsContainer:this.yearDisplay._update(this.widget,this.paint);break;case vt.css.monthsContainer:this.monthDisplay._update(this.widget,this.paint);break;case vt.css.daysContainer:this.dateDisplay._update(this.widget,this.paint)}s.style.display="grid",this._updateCalendarHeader(),this._eventEmitters.viewUpdate.emit()}_updateCalendarHeader(){const t=[...this.widget.querySelector(`.${vt.css.dateContainer} div[style*="display: grid"]`).classList].find((t=>t.startsWith(vt.css.dateContainer))),[e,s,i]=this.widget.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");switch(t){case vt.css.decadesContainer:e.setAttribute("title",this.optionsStore.options.localization.previousCentury),s.setAttribute("title",""),i.setAttribute("title",this.optionsStore.options.localization.nextCentury);break;case vt.css.yearsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousDecade),s.setAttribute("title",this.optionsStore.options.localization.selectDecade),i.setAttribute("title",this.optionsStore.options.localization.nextDecade);break;case vt.css.monthsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousYear),s.setAttribute("title",this.optionsStore.options.localization.selectYear),i.setAttribute("title",this.optionsStore.options.localization.nextYear);break;case vt.css.daysContainer:e.setAttribute("title",this.optionsStore.options.localization.previousMonth),s.setAttribute("title",this.optionsStore.options.localization.selectMonth),i.setAttribute("title",this.optionsStore.options.localization.nextMonth),s.innerText=this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)}s.innerText=s.getAttribute(t)}hide(){this.widget&&this._isVisible&&(this.widget.classList.remove(vt.css.show),this._isVisible&&(this._eventEmitters.triggerEvent.emit({type:vt.events.hide,date:this.optionsStore.unset?null:this.dates.lastPicked?this.dates.lastPicked.clone:void 0}),this._isVisible=!1),document.removeEventListener("click",this._documentClickEvent))}toggle(){return this._isVisible?this.hide():this.show()}_dispose(){document.removeEventListener("click",this._documentClickEvent),this.widget&&(this.widget.querySelectorAll("[data-action]").forEach((t=>t.removeEventListener("click",this._actionsClickEvent))),this.widget.parentNode.removeChild(this.widget),this._widget=void 0)}_buildWidget(){const t=document.createElement("div");t.classList.add(vt.css.widget);const e=document.createElement("div");e.classList.add(vt.css.dateContainer),e.append(this.getHeadTemplate(),this.decadeDisplay.getPicker(),this.yearDisplay.getPicker(),this.monthDisplay.getPicker(),this.dateDisplay.getPicker());const s=document.createElement("div");s.classList.add(vt.css.timeContainer),s.appendChild(this.timeDisplay.getPicker(this._iconTag.bind(this))),s.appendChild(this.hourDisplay.getPicker()),s.appendChild(this.minuteDisplay.getPicker()),s.appendChild(this.secondDisplay.getPicker());const i=document.createElement("div");if(i.classList.add(vt.css.toolbar),i.append(...this.getToolbarElements()),this.optionsStore.options.display.inline&&t.classList.add(vt.css.inline),this.optionsStore.options.display.calendarWeeks&&t.classList.add("calendarWeeks"),this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){t.classList.add(vt.css.sideBySide),"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");return o.classList.add("td-row"),e.classList.add("td-half"),s.classList.add("td-half"),o.appendChild(e),o.appendChild(s),t.appendChild(o),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),void(this._widget=t)}"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),this._hasDate&&(this._hasTime&&(e.classList.add(vt.css.collapse),"clock"!==this.optionsStore.options.display.viewMode&&e.classList.add(vt.css.show)),t.appendChild(e)),this._hasTime&&(this._hasDate&&(s.classList.add(vt.css.collapse),"clock"===this.optionsStore.options.display.viewMode&&s.classList.add(vt.css.show)),t.appendChild(s)),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");o.classList.add("arrow"),o.setAttribute("data-popper-arrow",""),t.appendChild(o),this._widget=t}get _hasTime(){return this.optionsStore.options.display.components.clock&&(this.optionsStore.options.display.components.hours||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.components.seconds)}get _hasDate(){return this.optionsStore.options.display.components.calendar&&(this.optionsStore.options.display.components.year||this.optionsStore.options.display.components.month||this.optionsStore.options.display.components.date)}getToolbarElements(){const t=[];if(this.optionsStore.options.display.buttons.today){const e=document.createElement("div");e.setAttribute("data-action",Ot.today),e.setAttribute("title",this.optionsStore.options.localization.today),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.today)),t.push(e)}if(!this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){let e,s;"clock"===this.optionsStore.options.display.viewMode?(e=this.optionsStore.options.localization.selectDate,s=this.optionsStore.options.display.icons.date):(e=this.optionsStore.options.localization.selectTime,s=this.optionsStore.options.display.icons.time);const i=document.createElement("div");i.setAttribute("data-action",Ot.togglePicker),i.setAttribute("title",e),i.appendChild(this._iconTag(s)),t.push(i)}if(this.optionsStore.options.display.buttons.clear){const e=document.createElement("div");e.setAttribute("data-action",Ot.clear),e.setAttribute("title",this.optionsStore.options.localization.clear),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.clear)),t.push(e)}if(this.optionsStore.options.display.buttons.close){const e=document.createElement("div");e.setAttribute("data-action",Ot.close),e.setAttribute("title",this.optionsStore.options.localization.close),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.close)),t.push(e)}return t}getHeadTemplate(){const t=document.createElement("div");t.classList.add(vt.css.calendarHeader);const e=document.createElement("div");e.classList.add(vt.css.previous),e.setAttribute("data-action",Ot.previous),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.previous));const s=document.createElement("div");s.classList.add(vt.css.switch),s.setAttribute("data-action",Ot.changeCalendarView);const i=document.createElement("div");return i.classList.add(vt.css.next),i.setAttribute("data-action",Ot.next),i.appendChild(this._iconTag(this.optionsStore.options.display.icons.next)),t.append(e,s,i),t}_iconTag(t){if("sprites"===this.optionsStore.options.display.icons.type){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("xlink:href",t),s.setAttribute("href",t),e.appendChild(s),e}const e=document.createElement("i");return e.classList.add(...t.split(" ")),e}_rebuild(){const t=this._isVisible;t&&this.hide(),this._dispose(),t&&this.show()}}class Bt{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt),this.display=bt.locate(jt),this._eventEmitters=bt.locate(Ct),this._eventEmitters.action.subscribe((t=>{this.do(t.e,t.action)}))}do(t,e){var s,i;const o=null==t?void 0:t.currentTarget;if(null===(s=null==o?void 0:o.classList)||void 0===s?void 0:s.contains(vt.css.disabled))return!1;e=e||(null===(i=null==o?void 0:o.dataset)||void 0===i?void 0:i.action);const n=(this.dates.lastPicked||this.optionsStore.viewDate).clone;switch(e){case Ot.next:case Ot.previous:this.handleNextPrevious(e);break;case Ot.changeCalendarView:this.display._showMode(1),this.display._updateCalendarHeader();break;case Ot.selectMonth:case Ot.selectYear:case Ot.selectDecade:const s=+o.dataset.value;switch(e){case Ot.selectMonth:this.optionsStore.viewDate.month=s;break;case Ot.selectYear:case Ot.selectDecade:this.optionsStore.viewDate.year=s}this.optionsStore.currentCalendarViewMode===this.optionsStore.minimumCalendarViewMode?(this.dates.setValue(this.optionsStore.viewDate,this.dates.lastPickedIndex),this.optionsStore.options.display.inline||this.display.hide()):this.display._showMode(-1);break;case Ot.selectDay:const i=this.optionsStore.viewDate.clone;o.classList.contains(vt.css.old)&&i.manipulate(-1,dt.month),o.classList.contains(vt.css.new)&&i.manipulate(1,dt.month),i.date=+o.dataset.day;let a=0;this.optionsStore.options.multipleDates?(a=this.dates.pickedIndex(i,dt.date),-1!==a?this.dates.setValue(null,a):this.dates.setValue(i,this.dates.lastPickedIndex+1)):this.dates.setValue(i,this.dates.lastPickedIndex),this.display._hasTime||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline||this.optionsStore.options.multipleDates||this.display.hide();break;case Ot.selectHour:let r=+o.dataset.value;n.hours>=12&&!this.optionsStore.options.display.components.useTwentyfourHour&&(r+=12),n.hours=r,this.dates.setValue(n,this.dates.lastPickedIndex),this.hideOrClock(t);break;case Ot.selectMinute:n.minutes=+o.dataset.value,this.dates.setValue(n,this.dates.lastPickedIndex),this.hideOrClock(t);break;case Ot.selectSecond:n.seconds=+o.dataset.value,this.dates.setValue(n,this.dates.lastPickedIndex),this.hideOrClock(t);break;case Ot.incrementHours:this.manipulateAndSet(n,dt.hours);break;case Ot.incrementMinutes:this.manipulateAndSet(n,dt.minutes,this.optionsStore.options.stepping);break;case Ot.incrementSeconds:this.manipulateAndSet(n,dt.seconds);break;case Ot.decrementHours:this.manipulateAndSet(n,dt.hours,-1);break;case Ot.decrementMinutes:this.manipulateAndSet(n,dt.minutes,-1*this.optionsStore.options.stepping);break;case Ot.decrementSeconds:this.manipulateAndSet(n,dt.seconds,-1);break;case Ot.toggleMeridiem:this.manipulateAndSet(n,dt.hours,this.dates.lastPicked.hours>=12?-12:12);break;case Ot.togglePicker:o.getAttribute("title")===this.optionsStore.options.localization.selectDate?(o.setAttribute("title",this.optionsStore.options.localization.selectTime),o.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.time).outerHTML,this.display._updateCalendarHeader(),this.optionsStore.refreshCurrentView()):(o.setAttribute("title",this.optionsStore.options.localization.selectDate),o.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.date).outerHTML,this.display._hasTime&&(this.do(t,Ot.showClock),this.display._update("clock"))),this.display.widget.querySelectorAll(`.${vt.css.dateContainer}, .${vt.css.timeContainer}`).forEach((t=>Nt.toggle(t))),this._eventEmitters.viewUpdate.emit();break;case Ot.showClock:case Ot.showHours:case Ot.showMinutes:case Ot.showSeconds:this.handleShowClockContainers(e);break;case Ot.clear:this.dates.setValue(null),this.display._updateCalendarHeader();break;case Ot.close:this.display.hide();break;case Ot.today:const c=(new mt).setLocale(this.optionsStore.options.localization.locale);this.optionsStore.viewDate=c,this.validation.isValid(c,dt.date)&&this.dates.setValue(c,this.dates.lastPickedIndex)}}handleShowClockContainers(t){if(!this.display._hasTime)return void vt.errorMessages.throwError("Cannot show clock containers when time is disabled.");this.optionsStore.currentView="clock",this.display.widget.querySelectorAll(`.${vt.css.timeContainer} > div`).forEach((t=>t.style.display="none"));let e="";switch(t){case Ot.showClock:e=vt.css.clockContainer,this.display._update("clock");break;case Ot.showHours:e=vt.css.hourContainer,this.display._update(dt.hours);break;case Ot.showMinutes:e=vt.css.minuteContainer,this.display._update(dt.minutes);break;case Ot.showSeconds:e=vt.css.secondContainer,this.display._update(dt.seconds)}this.display.widget.getElementsByClassName(e)[0].style.display="grid"}handleNextPrevious(t){const{unit:e,step:s}=wt[this.optionsStore.currentCalendarViewMode];t===Ot.next?this.optionsStore.viewDate.manipulate(s,e):this.optionsStore.viewDate.manipulate(-1*s,e),this._eventEmitters.viewUpdate.emit(),this.display._showMode()}hideOrClock(t){!this.optionsStore.options.display.components.useTwentyfourHour||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline?this.do(t,Ot.showClock):this.display.hide()}manipulateAndSet(t,e,s=1){const i=t.manipulate(s,e);this.validation.isValid(i,e)&&this.dates.setValue(i,this.dates.lastPickedIndex)}}class zt{constructor(t,e={}){this._subscribers={},this._isDisabled=!1,this._inputChangeEvent=t=>{if(null==t?void 0:t.detail)return;const e=()=>{this.dates.lastPicked&&(this.optionsStore.viewDate=this.dates.lastPicked)},s=this.optionsStore.input.value;if(this.optionsStore.options.multipleDates)try{const t=s.split(this.optionsStore.options.multipleDatesSeparator);for(let e=0;e{var t,e;(null===(t=this.optionsStore.element)||void 0===t?void 0:t.disabled)||(null===(e=this.optionsStore.input)||void 0===e?void 0:e.disabled)||this.toggle()},bt=new gt,this._eventEmitters=bt.locate(Ct),this.optionsStore=bt.locate(St),this.display=bt.locate(jt),this.dates=bt.locate(Mt),this.actions=bt.locate(Bt),t||vt.errorMessages.mustProvideElement(),this.optionsStore.element=t,this._initializeOptions(e,_t,!0),this.optionsStore.viewDate.setLocale(this.optionsStore.options.localization.locale),this.optionsStore.unset=!0,this._initializeInput(),this._initializeToggle(),this.optionsStore.options.display.inline&&this.display.show(),this._eventEmitters.triggerEvent.subscribe((t=>{this._triggerEvent(t)})),this._eventEmitters.viewUpdate.subscribe((()=>{this._viewUpdate()}))}get viewDate(){return this.optionsStore.viewDate}updateOptions(t,e=!1){e?this._initializeOptions(t,_t):this._initializeOptions(t,this.optionsStore.options),this.display._rebuild()}toggle(){this._isDisabled||this.display.toggle()}show(){this._isDisabled||this.display.show()}hide(){this.display.hide()}disable(){var t;this._isDisabled=!0,null===(t=this.optionsStore.input)||void 0===t||t.setAttribute("disabled","disabled"),this.display.hide()}enable(){var t;this._isDisabled=!1,null===(t=this.optionsStore.input)||void 0===t||t.removeAttribute("disabled")}clear(){this.optionsStore.input.value="",this.dates.clear()}subscribe(t,e){let s;"string"==typeof t&&(t=[t]),s=Array.isArray(e)?e:[e],t.length!==s.length&&vt.errorMessages.subscribeMismatch();const i=[];for(let e=0;e{e(t)}))}_viewUpdate(){this._triggerEvent({type:vt.events.update,viewDate:this.optionsStore.viewDate.clone})}_unsubscribe(t,e){this._subscribers[t].splice(e,1)}_initializeOptions(t,e,s=!1){var i;let o=Et.deepCopy(t);o=Et._mergeOptions(o,e),s&&(o=Et._dataToOptions(this.optionsStore.element,o)),Et._validateConflicts(o),o.viewDate=o.viewDate.setLocale(o.localization.locale),this.optionsStore.viewDate.isSame(o.viewDate)||(this.optionsStore.viewDate=o.viewDate),o.display.components.year&&(this.optionsStore.minimumCalendarViewMode=2),o.display.components.month&&(this.optionsStore.minimumCalendarViewMode=1),o.display.components.date&&(this.optionsStore.minimumCalendarViewMode=0),this.optionsStore.currentCalendarViewMode=Math.max(this.optionsStore.minimumCalendarViewMode,this.optionsStore.currentCalendarViewMode),wt[this.optionsStore.currentCalendarViewMode].name!==o.display.viewMode&&(this.optionsStore.currentCalendarViewMode=Math.max(wt.findIndex((t=>t.name===o.display.viewMode)),this.optionsStore.minimumCalendarViewMode)),(null===(i=this.display)||void 0===i?void 0:i.isVisible)&&this.display._update("all"),this.optionsStore.options=o}_initializeInput(){if("INPUT"==this.optionsStore.element.tagName)this.optionsStore.input=this.optionsStore.element;else{let t=this.optionsStore.element.dataset.tdTargetInput;this.optionsStore.input=null==t||"nearest"==t?this.optionsStore.element.querySelector("input"):this.optionsStore.element.querySelector(t)}this.optionsStore.input&&(this.optionsStore.input.addEventListener("change",this._inputChangeEvent),this.optionsStore.options.allowInputToggle&&this.optionsStore.input.addEventListener("click",this._toggleClickEvent),this.optionsStore.input.value&&this._inputChangeEvent())}_initializeToggle(){if(this.optionsStore.options.display.inline)return;let t=this.optionsStore.element.dataset.tdTargetToggle;"nearest"==t&&(t='[data-td-toggle="datetimepicker"]'),this._toggle=null==t?this.optionsStore.element:this.optionsStore.element.querySelector(t),this._toggle.addEventListener("click",this._toggleClickEvent)}_handleAfterChangeEvent(t){var e,s;!this.optionsStore.options.promptTimeOnDateChange||this.optionsStore.options.display.inline||this.optionsStore.options.display.sideBySide||!this.display._hasTime||(null===(e=this.display.widget)||void 0===e?void 0:e.getElementsByClassName(vt.css.show)[0].classList.contains(vt.css.timeContainer))||!t.oldDate&&this.optionsStore.options.useCurrent||t.oldDate&&(null===(s=t.date)||void 0===s?void 0:s.isSame(t.oldDate))||(clearTimeout(this._currentPromptTimeTimeout),this._currentPromptTimeTimeout=setTimeout((()=>{this.display.widget&&this._eventEmitters.action.emit({e:{currentTarget:this.display.widget.querySelector(`.${vt.css.switch} div`)},action:Ot.togglePicker})}),this.optionsStore.options.promptTimeOnDateChangeTransitionDelay))}}const Wt={};document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("[data-sonata-form-datepicker]").forEach((function(t){zt(t)}))}))}(); \ No newline at end of file +!function(){"use strict";function t(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function e(e){return e instanceof t(e).Element||e instanceof Element}function s(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function i(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}var o=Math.max,n=Math.min,a=Math.round;function r(t,e){void 0===e&&(e=!1);var i=t.getBoundingClientRect(),o=1,n=1;if(s(t)&&e){var r=t.offsetHeight,c=t.offsetWidth;c>0&&(o=a(i.width)/c||1),r>0&&(n=a(i.height)/r||1)}return{width:i.width/o,height:i.height/n,top:i.top/n,right:i.right/o,bottom:i.bottom/n,left:i.left/o,x:i.left/o,y:i.top/n}}function c(e){var s=t(e);return{scrollLeft:s.pageXOffset,scrollTop:s.pageYOffset}}function d(t){return t?(t.nodeName||"").toLowerCase():null}function l(t){return((e(t)?t.ownerDocument:t.document)||window.document).documentElement}function h(t){return r(l(t)).left+c(t).scrollLeft}function p(e){return t(e).getComputedStyle(e)}function u(t){var e=p(t),s=e.overflow,i=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(s+o+i)}function m(e,i,o){void 0===o&&(o=!1);var n,p,m=s(i),f=s(i)&&function(t){var e=t.getBoundingClientRect(),s=a(e.width)/t.offsetWidth||1,i=a(e.height)/t.offsetHeight||1;return 1!==s||1!==i}(i),y=l(i),v=r(e,f),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(m||!m&&!o)&&(("body"!==d(i)||u(y))&&(g=(n=i)!==t(n)&&s(n)?{scrollLeft:(p=n).scrollLeft,scrollTop:p.scrollTop}:c(n)),s(i)?((b=r(i,!0)).x+=i.clientLeft,b.y+=i.clientTop):y&&(b.x=h(y))),{x:v.left+g.scrollLeft-b.x,y:v.top+g.scrollTop-b.y,width:v.width,height:v.height}}function f(t){var e=r(t),s=t.offsetWidth,i=t.offsetHeight;return Math.abs(e.width-s)<=1&&(s=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:t.offsetLeft,y:t.offsetTop,width:s,height:i}}function y(t){return"html"===d(t)?t:t.assignedSlot||t.parentNode||(i(t)?t.host:null)||l(t)}function v(t){return["html","body","#document"].indexOf(d(t))>=0?t.ownerDocument.body:s(t)&&u(t)?t:v(y(t))}function g(e,s){var i;void 0===s&&(s=[]);var o=v(e),n=o===(null==(i=e.ownerDocument)?void 0:i.body),a=t(o),r=n?[a].concat(a.visualViewport||[],u(o)?o:[]):o,c=s.concat(r);return n?c:c.concat(g(y(r)))}function b(t){return["table","td","th"].indexOf(d(t))>=0}function w(t){return s(t)&&"fixed"!==p(t).position?t.offsetParent:null}function S(e){for(var o=t(e),n=w(e);n&&b(n)&&"static"===p(n).position;)n=w(n);return n&&("html"===d(n)||"body"===d(n)&&"static"===p(n).position)?o:n||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&s(t)&&"fixed"===p(t).position)return null;var o=y(t);for(i(o)&&(o=o.host);s(o)&&["html","body"].indexOf(d(o))<0;){var n=p(o);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return o;o=o.parentNode}return null}(e)||o}var D="top",k="bottom",C="right",_="left",E="auto",M=[D,k,C,_],x="start",O="end",L="viewport",A="popper",T=M.reduce((function(t,e){return t.concat([e+"-"+x,e+"-"+O])}),[]),H=[].concat(M,[E]).reduce((function(t,e){return t.concat([e,e+"-"+x,e+"-"+O])}),[]),V=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function $(t){var e=new Map,s=new Set,i=[];function o(t){s.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!s.has(t)){var i=e.get(t);i&&o(i)}})),i.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){s.has(t.name)||o(t)})),i}var P={placement:"bottom",modifiers:[],strategy:"absolute"};function I(){for(var t=arguments.length,e=new Array(t),s=0;s=0?"x":"y"}function F(t){var e,s=t.reference,i=t.element,o=t.placement,n=o?B(o):null,a=o?z(o):null,r=s.x+s.width/2-i.width/2,c=s.y+s.height/2-i.height/2;switch(n){case D:e={x:r,y:s.y-i.height};break;case k:e={x:r,y:s.y+s.height};break;case C:e={x:s.x+s.width,y:c};break;case _:e={x:s.x-i.width,y:c};break;default:e={x:s.x,y:s.y}}var d=n?W(n):null;if(null!=d){var l="y"===d?"height":"width";switch(a){case x:e[d]=e[d]-(s[l]/2-i[l]/2);break;case O:e[d]=e[d]+(s[l]/2-i[l]/2)}}return e}var q={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Y(e){var s,i=e.popper,o=e.popperRect,n=e.placement,r=e.variation,c=e.offsets,d=e.position,h=e.gpuAcceleration,u=e.adaptive,m=e.roundOffsets,f=e.isFixed,y=c.x,v=void 0===y?0:y,g=c.y,b=void 0===g?0:g,w="function"==typeof m?m({x:v,y:b}):{x:v,y:b};v=w.x,b=w.y;var E=c.hasOwnProperty("x"),M=c.hasOwnProperty("y"),x=_,L=D,A=window;if(u){var T=S(i),H="clientHeight",V="clientWidth";if(T===t(i)&&"static"!==p(T=l(i)).position&&"absolute"===d&&(H="scrollHeight",V="scrollWidth"),T=T,n===D||(n===_||n===C)&&r===O)L=k,b-=(f&&T===A&&A.visualViewport?A.visualViewport.height:T[H])-o.height,b*=h?1:-1;if(n===_||(n===D||n===k)&&r===O)x=C,v-=(f&&T===A&&A.visualViewport?A.visualViewport.width:T[V])-o.width,v*=h?1:-1}var $,P=Object.assign({position:d},u&&q),I=!0===m?function(t){var e=t.x,s=t.y,i=window.devicePixelRatio||1;return{x:a(e*i)/i||0,y:a(s*i)/i||0}}({x:v,y:b}):{x:v,y:b};return v=I.x,b=I.y,h?Object.assign({},P,(($={})[L]=M?"0":"",$[x]=E?"0":"",$.transform=(A.devicePixelRatio||1)<=1?"translate("+v+"px, "+b+"px)":"translate3d("+v+"px, "+b+"px, 0)",$)):Object.assign({},P,((s={})[L]=M?b+"px":"",s[x]=E?v+"px":"",s.transform="",s))}var U={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,s=t.options,i=t.name,o=s.offset,n=void 0===o?[0,0]:o,a=H.reduce((function(t,s){return t[s]=function(t,e,s){var i=B(t),o=[_,D].indexOf(i)>=0?-1:1,n="function"==typeof s?s(Object.assign({},e,{placement:t})):s,a=n[0],r=n[1];return a=a||0,r=(r||0)*o,[_,C].indexOf(i)>=0?{x:r,y:a}:{x:a,y:r}}(s,e.rects,n),t}),{}),r=a[e.placement],c=r.x,d=r.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[i]=a}},R={left:"right",right:"left",bottom:"top",top:"bottom"};function K(t){return t.replace(/left|right|bottom|top/g,(function(t){return R[t]}))}var J={start:"end",end:"start"};function Q(t){return t.replace(/start|end/g,(function(t){return J[t]}))}function X(t,e){var s=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(s&&i(s)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function G(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Z(s,i){return i===L?G(function(e){var s=t(e),i=l(e),o=s.visualViewport,n=i.clientWidth,a=i.clientHeight,r=0,c=0;return o&&(n=o.width,a=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(r=o.offsetLeft,c=o.offsetTop)),{width:n,height:a,x:r+h(e),y:c}}(s)):e(i)?function(t){var e=r(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(i):G(function(t){var e,s=l(t),i=c(t),n=null==(e=t.ownerDocument)?void 0:e.body,a=o(s.scrollWidth,s.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),r=o(s.scrollHeight,s.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),d=-i.scrollLeft+h(t),u=-i.scrollTop;return"rtl"===p(n||s).direction&&(d+=o(s.clientWidth,n?n.clientWidth:0)-a),{width:a,height:r,x:d,y:u}}(l(s)))}function tt(t,i,a){var r="clippingParents"===i?function(t){var i=g(y(t)),o=["absolute","fixed"].indexOf(p(t).position)>=0&&s(t)?S(t):t;return e(o)?i.filter((function(t){return e(t)&&X(t,o)&&"body"!==d(t)})):[]}(t):[].concat(i),c=[].concat(r,[a]),l=c[0],h=c.reduce((function(e,s){var i=Z(t,s);return e.top=o(i.top,e.top),e.right=n(i.right,e.right),e.bottom=n(i.bottom,e.bottom),e.left=o(i.left,e.left),e}),Z(t,l));return h.width=h.right-h.left,h.height=h.bottom-h.top,h.x=h.left,h.y=h.top,h}function et(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function st(t,e){return e.reduce((function(e,s){return e[s]=t,e}),{})}function it(t,s){void 0===s&&(s={});var i=s,o=i.placement,n=void 0===o?t.placement:o,a=i.boundary,c=void 0===a?"clippingParents":a,d=i.rootBoundary,h=void 0===d?L:d,p=i.elementContext,u=void 0===p?A:p,m=i.altBoundary,f=void 0!==m&&m,y=i.padding,v=void 0===y?0:y,g=et("number"!=typeof v?v:st(v,M)),b=u===A?"reference":A,w=t.rects.popper,S=t.elements[f?b:u],_=tt(e(S)?S:S.contextElement||l(t.elements.popper),c,h),E=r(t.elements.reference),x=F({reference:E,element:w,strategy:"absolute",placement:n}),O=G(Object.assign({},w,x)),T=u===A?O:E,H={top:_.top-T.top+g.top,bottom:T.bottom-_.bottom+g.bottom,left:_.left-T.left+g.left,right:T.right-_.right+g.right},V=t.modifiersData.offset;if(u===A&&V){var $=V[n];Object.keys(H).forEach((function(t){var e=[C,k].indexOf(t)>=0?1:-1,s=[D,k].indexOf(t)>=0?"y":"x";H[t]+=$[s]*e}))}return H}function ot(t,e,s){return o(t,n(e,s))}var nt={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,s=t.options,i=t.name,a=s.mainAxis,r=void 0===a||a,c=s.altAxis,d=void 0!==c&&c,l=s.boundary,h=s.rootBoundary,p=s.altBoundary,u=s.padding,m=s.tether,y=void 0===m||m,v=s.tetherOffset,g=void 0===v?0:v,b=it(e,{boundary:l,rootBoundary:h,padding:u,altBoundary:p}),w=B(e.placement),E=z(e.placement),M=!E,O=W(w),L="x"===O?"y":"x",A=e.modifiersData.popperOffsets,T=e.rects.reference,H=e.rects.popper,V="function"==typeof g?g(Object.assign({},e.rects,{placement:e.placement})):g,$="number"==typeof V?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,I={x:0,y:0};if(A){if(r){var N,j="y"===O?D:_,F="y"===O?k:C,q="y"===O?"height":"width",Y=A[O],U=Y+b[j],R=Y-b[F],K=y?-H[q]/2:0,J=E===x?T[q]:H[q],Q=E===x?-H[q]:-T[q],X=e.elements.arrow,G=y&&X?f(X):{width:0,height:0},Z=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},tt=Z[j],et=Z[F],st=ot(0,T[q],G[q]),nt=M?T[q]/2-K-st-tt-$.mainAxis:J-st-tt-$.mainAxis,at=M?-T[q]/2+K+st+et+$.mainAxis:Q+st+et+$.mainAxis,rt=e.elements.arrow&&S(e.elements.arrow),ct=rt?"y"===O?rt.clientTop||0:rt.clientLeft||0:0,dt=null!=(N=null==P?void 0:P[O])?N:0,lt=Y+at-dt,ht=ot(y?n(U,Y+nt-dt-ct):U,Y,y?o(R,lt):R);A[O]=ht,I[O]=ht-Y}if(d){var pt,ut="x"===O?D:_,mt="x"===O?k:C,ft=A[L],yt="y"===L?"height":"width",vt=ft+b[ut],gt=ft-b[mt],bt=-1!==[D,_].indexOf(w),wt=null!=(pt=null==P?void 0:P[L])?pt:0,St=bt?vt:ft-T[yt]-H[yt]-wt+$.altAxis,Dt=bt?ft+T[yt]+H[yt]-wt-$.altAxis:gt,kt=y&&bt?function(t,e,s){var i=ot(t,e,s);return i>s?s:i}(St,ft,Dt):ot(y?St:vt,ft,y?Dt:gt);A[L]=kt,I[L]=kt-ft}e.modifiersData[i]=I}},requiresIfExists:["offset"]};var at={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,s=t.state,i=t.name,o=t.options,n=s.elements.arrow,a=s.modifiersData.popperOffsets,r=B(s.placement),c=W(r),d=[_,C].indexOf(r)>=0?"height":"width";if(n&&a){var l=function(t,e){return et("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:st(t,M))}(o.padding,s),h=f(n),p="y"===c?D:_,u="y"===c?k:C,m=s.rects.reference[d]+s.rects.reference[c]-a[c]-s.rects.popper[d],y=a[c]-s.rects.reference[c],v=S(n),g=v?"y"===c?v.clientHeight||0:v.clientWidth||0:0,b=m/2-y/2,w=l[p],E=g-h[d]-l[u],x=g/2-h[d]/2+b,O=ot(w,x,E),L=c;s.modifiersData[i]=((e={})[L]=O,e.centerOffset=O-x,e)}},effect:function(t){var e=t.state,s=t.options.element,i=void 0===s?"[data-popper-arrow]":s;null!=i&&("string"!=typeof i||(i=e.elements.popper.querySelector(i)))&&X(e.elements.popper,i)&&(e.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function rt(t,e,s){return void 0===s&&(s={x:0,y:0}),{top:t.top-e.height-s.y,right:t.right-e.width+s.x,bottom:t.bottom-e.height+s.y,left:t.left-e.width-s.x}}function ct(t){return[D,C,k,_].some((function(e){return t[e]>=0}))}var dt,lt=N({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var s=e.state,i=e.instance,o=e.options,n=o.scroll,a=void 0===n||n,r=o.resize,c=void 0===r||r,d=t(s.elements.popper),l=[].concat(s.scrollParents.reference,s.scrollParents.popper);return a&&l.forEach((function(t){t.addEventListener("scroll",i.update,j)})),c&&d.addEventListener("resize",i.update,j),function(){a&&l.forEach((function(t){t.removeEventListener("scroll",i.update,j)})),c&&d.removeEventListener("resize",i.update,j)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,s=t.name;e.modifiersData[s]=F({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,s=t.options,i=s.gpuAcceleration,o=void 0===i||i,n=s.adaptive,a=void 0===n||n,r=s.roundOffsets,c=void 0===r||r,d={placement:B(e.placement),variation:z(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Y(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:c})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Y(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},o=e.attributes[t]||{},n=e.elements[t];s(n)&&d(n)&&(Object.assign(n.style,i),Object.keys(o).forEach((function(t){var e=o[t];!1===e?n.removeAttribute(t):n.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var o=e.elements[t],n=e.attributes[t]||{},a=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});s(o)&&d(o)&&(Object.assign(o.style,a),Object.keys(n).forEach((function(t){o.removeAttribute(t)})))}))}},requires:["computeStyles"]},U,{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,s=t.options,i=t.name;if(!e.modifiersData[i]._skip){for(var o=s.mainAxis,n=void 0===o||o,a=s.altAxis,r=void 0===a||a,c=s.fallbackPlacements,d=s.padding,l=s.boundary,h=s.rootBoundary,p=s.altBoundary,u=s.flipVariations,m=void 0===u||u,f=s.allowedAutoPlacements,y=e.options.placement,v=B(y),g=c||(v===y||!m?[K(y)]:function(t){if(B(t)===E)return[];var e=K(t);return[Q(t),e,Q(e)]}(y)),b=[y].concat(g).reduce((function(t,s){return t.concat(B(s)===E?function(t,e){void 0===e&&(e={});var s=e,i=s.placement,o=s.boundary,n=s.rootBoundary,a=s.padding,r=s.flipVariations,c=s.allowedAutoPlacements,d=void 0===c?H:c,l=z(i),h=l?r?T:T.filter((function(t){return z(t)===l})):M,p=h.filter((function(t){return d.indexOf(t)>=0}));0===p.length&&(p=h);var u=p.reduce((function(e,s){return e[s]=it(t,{placement:s,boundary:o,rootBoundary:n,padding:a})[B(s)],e}),{});return Object.keys(u).sort((function(t,e){return u[t]-u[e]}))}(e,{placement:s,boundary:l,rootBoundary:h,padding:d,flipVariations:m,allowedAutoPlacements:f}):s)}),[]),w=e.rects.reference,S=e.rects.popper,O=new Map,L=!0,A=b[0],V=0;V=0,j=N?"width":"height",W=it(e,{placement:$,boundary:l,rootBoundary:h,altBoundary:p,padding:d}),F=N?I?C:_:I?k:D;w[j]>S[j]&&(F=K(F));var q=K(F),Y=[];if(n&&Y.push(W[P]<=0),r&&Y.push(W[F]<=0,W[q]<=0),Y.every((function(t){return t}))){A=$,L=!1;break}O.set($,Y)}if(L)for(var U=function(t){var e=b.find((function(e){var s=O.get(e);if(s)return s.slice(0,t).every((function(t){return t}))}));if(e)return A=e,"break"},R=m?3:1;R>0;R--){if("break"===U(R))break}e.placement!==A&&(e.modifiersData[i]._skip=!0,e.placement=A,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},nt,at,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,s=t.name,i=e.rects.reference,o=e.rects.popper,n=e.modifiersData.preventOverflow,a=it(e,{elementContext:"reference"}),r=it(e,{altBoundary:!0}),c=rt(a,i),d=rt(r,o,n),l=ct(c),h=ct(d);e.modifiersData[s]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:l,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":h})}}]});!function(t){t.seconds="seconds",t.minutes="minutes",t.hours="hours",t.date="date",t.month="month",t.year="year"}(dt||(dt={}));const ht={month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0},pt={hour:"2-digit",hour12:!1},ut=t=>{switch(t){case"date":return{dateStyle:"short"};case"month":return{month:"numeric",year:"numeric"};case"year":return{year:"numeric"}}};class mt extends Date{constructor(){super(...arguments),this.locale="default",this.nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],this.leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335]}setLocale(t){return this.locale=t,this}static convert(t,e="default"){if(!t)throw new Error("A date is required");return new mt(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).setLocale(e)}get clone(){return new mt(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.getMilliseconds()).setLocale(this.locale)}startOf(t,e=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(0);break;case"minutes":this.setSeconds(0,0);break;case"hours":this.setMinutes(0,0,0);break;case"date":this.setHours(0,0,0,0);break;case"weekDay":if(this.startOf(dt.date),this.weekDay===e)break;let t=this.weekDay;0!==e&&0===this.weekDay&&(t=8-e),this.manipulate(e-t,dt.date);break;case"month":this.startOf(dt.date),this.setDate(1);break;case"year":this.startOf(dt.date),this.setMonth(0,1)}return this}endOf(t,e=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(999);break;case"minutes":this.setSeconds(59,999);break;case"hours":this.setMinutes(59,59,999);break;case"date":this.setHours(23,59,59,999);break;case"weekDay":this.endOf(dt.date),this.manipulate(6+e-this.weekDay,dt.date);break;case"month":this.endOf(dt.date),this.manipulate(1,dt.month),this.setDate(0);break;case"year":this.endOf(dt.date),this.manipulate(1,dt.year),this.setDate(0)}return this}manipulate(t,e){if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this[e]+=t,this}format(t,e=this.locale){return new Intl.DateTimeFormat(e,t).format(this)}isBefore(t,e){if(!e)return this.valueOf()t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this.clone.startOf(e).valueOf()>t.clone.startOf(e).valueOf()}isSame(t,e){if(!e)return this.valueOf()===t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return t=mt.convert(t),this.clone.startOf(e).valueOf()===t.startOf(e).valueOf()}isBetween(t,e,s,i="()"){if(s&&void 0===this[s])throw new Error(`Unit '${s}' is not valid`);const o="("===i[0],n=")"===i[1];return(o?this.isAfter(t,s):!this.isBefore(t,s))&&(n?this.isBefore(e,s):!this.isAfter(e,s))||(o?this.isBefore(t,s):!this.isAfter(t,s))&&(n?this.isAfter(e,s):!this.isBefore(e,s))}parts(t=this.locale,e={dateStyle:"full",timeStyle:"long"}){const s={};return new Intl.DateTimeFormat(t,e).formatToParts(this).filter((t=>"literal"!==t.type)).forEach((t=>s[t.type]=t.value)),s}get seconds(){return this.getSeconds()}set seconds(t){this.setSeconds(t)}get secondsFormatted(){return this.parts(void 0,ht).second}get minutes(){return this.getMinutes()}set minutes(t){this.setMinutes(t)}get minutesFormatted(){return this.parts(void 0,ht).minute}get hours(){return this.getHours()}set hours(t){this.setHours(t)}get hoursFormatted(){let t=this.parts(void 0,pt).hour;return"24"===t&&(t="00"),t}get twelveHoursFormatted(){return this.parts(void 0,ht).hour}meridiem(t=this.locale){var e;return null===(e=new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).formatToParts(this).find((t=>"dayPeriod"===t.type)))||void 0===e?void 0:e.value}get date(){return this.getDate()}set date(t){this.setDate(t)}get dateFormatted(){return this.parts(void 0,ht).day}get weekDay(){return this.getDay()}get month(){return this.getMonth()}set month(t){const e=new Date(this.year,t+1);e.setDate(0);const s=e.getDate();this.date>s&&(this.date=s),this.setMonth(t)}get monthFormatted(){return this.parts(void 0,ht).month}get year(){return this.getFullYear()}set year(t){this.setFullYear(t)}get week(){const t=this.computeOrdinal(),e=this.getUTCDay();let s=Math.floor((t-e+10)/7);return s<1?s=this.weeksInWeekYear(this.year-1):s>this.weeksInWeekYear(this.year)&&(s=1),s}weeksInWeekYear(t){const e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,s=t-1,i=(s+Math.floor(s/4)-Math.floor(s/100)+Math.floor(s/400))%7;return 4===e||3===i?53:52}get isLeapYear(){return this.year%4==0&&(this.year%100!=0||this.year%400==0)}computeOrdinal(){return this.date+(this.isLeapYear?this.leapLadder:this.nonLeapLadder)[this.month]}}class ft extends Error{}const yt="tempus-dominus";class vt{}vt.NAME=yt,vt.version="6.0.0-beta7",vt.dataKey="td",vt.events=new class{constructor(){this.key=".td",this.change=`change${this.key}`,this.update=`update${this.key}`,this.error=`error${this.key}`,this.show=`show${this.key}`,this.hide=`hide${this.key}`,this.blur=`blur${this.key}`,this.focus=`focus${this.key}`,this.keyup=`keyup${this.key}`,this.keydown=`keydown${this.key}`}},vt.css=new class{constructor(){this.widget=`${yt}-widget`,this.calendarHeader="calendar-header",this.switch="picker-switch",this.toolbar="toolbar",this.noHighlight="no-highlight",this.sideBySide="timepicker-sbs",this.previous="previous",this.next="next",this.disabled="disabled",this.old="old",this.new="new",this.active="active",this.dateContainer="date-container",this.decadesContainer=`${this.dateContainer}-decades`,this.decade="decade",this.yearsContainer=`${this.dateContainer}-years`,this.year="year",this.monthsContainer=`${this.dateContainer}-months`,this.month="month",this.daysContainer=`${this.dateContainer}-days`,this.day="day",this.calendarWeeks="cw",this.dayOfTheWeek="dow",this.today="today",this.weekend="weekend",this.timeContainer="time-container",this.separator="separator",this.clockContainer=`${this.timeContainer}-clock`,this.hourContainer=`${this.timeContainer}-hour`,this.minuteContainer=`${this.timeContainer}-minute`,this.secondContainer=`${this.timeContainer}-second`,this.hour="hour",this.minute="minute",this.second="second",this.toggleMeridiem="toggleMeridiem",this.show="show",this.collapsing="td-collapsing",this.collapse="td-collapse",this.inline="inline"}},vt.errorMessages=new class{constructor(){this.base="TD:",this.failedToSetInvalidDate="Failed to set invalid date",this.failedToParseInput="Failed parse input field"}unexpectedOption(t){const e=new ft(`${this.base} Unexpected option: ${t} does not match a known option.`);throw e.code=1,e}unexpectedOptions(t){const e=new ft(`${this.base}: ${t.join(", ")}`);throw e.code=1,e}unexpectedOptionValue(t,e,s){const i=new ft(`${this.base} Unexpected option value: ${t} does not accept a value of "${e}". Valid values are: ${s.join(", ")}`);throw i.code=2,i}typeMismatch(t,e,s){const i=new ft(`${this.base} Mismatch types: ${t} has a type of ${e} instead of the required ${s}`);throw i.code=3,i}numbersOutOfRage(t,e,s){const i=new ft(`${this.base} ${t} expected an array of number between ${e} and ${s}.`);throw i.code=4,i}failedToParseDate(t,e,s=!1){const i=new ft(`${this.base} Could not correctly parse "${e}" to a date for ${t}.`);if(i.code=5,!s)throw i;console.warn(i)}mustProvideElement(){const t=new ft(`${this.base} No element was provided.`);throw t.code=6,t}subscribeMismatch(){const t=new ft(`${this.base} The subscribed events does not match the number of callbacks`);throw t.code=7,t}conflictingConfiguration(t){const e=new ft(`${this.base} A configuration value conflicts with another rule. ${t}`);throw e.code=8,e}dateString(){console.warn(`${this.base} Using a string for date options is not recommended unless you specify an ISO string.`)}throwError(t){const e=new ft(`${this.base} ${t}`);throw e.code=9,e}};class gt{constructor(){this.cache=new Map}locate(t){const e=this.cache.get(t);if(e)return e;const s=new t;return this.cache.set(t,s),s}}let bt;const wt=[{name:"calendar",className:vt.css.daysContainer,unit:dt.month,step:1},{name:"months",className:vt.css.monthsContainer,unit:dt.year,step:1},{name:"years",className:vt.css.yearsContainer,unit:dt.year,step:10},{name:"decades",className:vt.css.decadesContainer,unit:dt.year,step:100}];class St{constructor(){this.viewDate=new mt,this._currentCalendarViewMode=0,this.minimumCalendarViewMode=0,this.currentView="calendar"}get currentCalendarViewMode(){return this._currentCalendarViewMode}set currentCalendarViewMode(t){this._currentCalendarViewMode=t,this.currentView=wt[t].name}refreshCurrentView(){this.currentView=wt[this.currentCalendarViewMode].name}}class Dt{constructor(){this.optionsStore=bt.locate(St)}isValid(t,e){var s;if(this.optionsStore.options.restrictions.disabledDates.length>0&&this._isInDisabledDates(t))return!1;if(this.optionsStore.options.restrictions.enabledDates.length>0&&!this._isInEnabledDates(t))return!1;if(e!==dt.month&&e!==dt.year&&(null===(s=this.optionsStore.options.restrictions.daysOfWeekDisabled)||void 0===s?void 0:s.length)>0&&-1!==this.optionsStore.options.restrictions.daysOfWeekDisabled.indexOf(t.weekDay))return!1;if(this.optionsStore.options.restrictions.minDate&&t.isBefore(this.optionsStore.options.restrictions.minDate,e))return!1;if(this.optionsStore.options.restrictions.maxDate&&t.isAfter(this.optionsStore.options.restrictions.maxDate,e))return!1;if(e===dt.hours||e===dt.minutes||e===dt.seconds){if(this.optionsStore.options.restrictions.disabledHours.length>0&&this._isInDisabledHours(t))return!1;if(this.optionsStore.options.restrictions.enabledHours.length>0&&!this._isInEnabledHours(t))return!1;if(this.optionsStore.options.restrictions.disabledTimeIntervals.length>0)for(let e of this.optionsStore.options.restrictions.disabledTimeIntervals)if(t.isBetween(e.from,e.to))return!1}return!0}_isInDisabledDates(t){if(!this.optionsStore.options.restrictions.disabledDates||0===this.optionsStore.options.restrictions.disabledDates.length)return!1;const e=t.format(ut(dt.date));return this.optionsStore.options.restrictions.disabledDates.map((t=>t.format(ut(dt.date)))).find((t=>t===e))}_isInEnabledDates(t){if(!this.optionsStore.options.restrictions.enabledDates||0===this.optionsStore.options.restrictions.enabledDates.length)return!0;const e=t.format(ut(dt.date));return this.optionsStore.options.restrictions.enabledDates.map((t=>t.format(ut(dt.date)))).find((t=>t===e))}_isInDisabledHours(t){if(!this.optionsStore.options.restrictions.disabledHours||0===this.optionsStore.options.restrictions.disabledHours.length)return!1;const e=t.hours;return this.optionsStore.options.restrictions.disabledHours.find((t=>t===e))}_isInEnabledHours(t){if(!this.optionsStore.options.restrictions.enabledHours||0===this.optionsStore.options.restrictions.enabledHours.length)return!0;const e=t.hours;return this.optionsStore.options.restrictions.enabledHours.find((t=>t===e))}}class kt{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),this.unsubscribe.bind(this,this.subscribers.length-1)}unsubscribe(t){this.subscribers.splice(t,1)}emit(t){this.subscribers.forEach((e=>{e(t)}))}destory(){this.subscribers=null,this.subscribers=[]}}class Ct{constructor(){this.triggerEvent=new kt,this.viewUpdate=new kt,this.updateDisplay=new kt,this.action=new kt}destory(){this.triggerEvent.destory(),this.viewUpdate.destory(),this.updateDisplay.destory(),this.action.destory()}}const _t={restrictions:{minDate:void 0,maxDate:void 0,disabledDates:[],enabledDates:[],daysOfWeekDisabled:[],disabledTimeIntervals:[],disabledHours:[],enabledHours:[]},display:{icons:{type:"icons",time:"fa-solid fa-clock",date:"fa-solid fa-calendar",up:"fa-solid fa-arrow-up",down:"fa-solid fa-arrow-down",previous:"fa-solid fa-chevron-left",next:"fa-solid fa-chevron-right",today:"fa-solid fa-calendar-check",clear:"fa-solid fa-trash",close:"fa-solid fa-xmark"},sideBySide:!1,calendarWeeks:!1,viewMode:"calendar",toolbarPlacement:"bottom",keepOpen:!1,buttons:{today:!1,clear:!1,close:!1},components:{calendar:!0,date:!0,month:!0,year:!0,decades:!0,clock:!0,hours:!0,minutes:!0,seconds:!1,useTwentyfourHour:!1},inline:!1},stepping:1,useCurrent:!0,defaultDate:void 0,localization:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",previousMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",previousYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",previousDecade:"Previous Decade",nextDecade:"Next Decade",previousCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",toggleMeridiem:"Toggle Meridiem",selectTime:"Select Time",selectDate:"Select Date",dayViewHeaderFormat:{month:"long",year:"2-digit"},locale:"default",startOfTheWeek:0},keepInvalid:!1,debug:!1,allowInputToggle:!1,viewDate:new mt,multipleDates:!1,multipleDatesSeparator:"; ",promptTimeOnDateChange:!1,promptTimeOnDateChangeTransitionDelay:200,meta:{},container:void 0};class Et{static deepCopy(t){const e={};return Object.keys(t).forEach((s=>{const i=t[s];e[s]=i,"object"!=typeof i||i instanceof HTMLElement||i instanceof Element||i instanceof Date||Array.isArray(i)||(e[s]=Et.deepCopy(i))})),e}static objectPath(t,e){return"."===t.charAt(0)&&(t=t.slice(1)),t.split(".").reduce(((t,e)=>Et.isValue(t)||Et.isValue(t[e])?t[e]:void 0),e)}static spread(t,e,s,i="",o=""){const n=Object.keys(t).filter((t=>!Object.keys(e).includes(t)));if(n.length>0){const t=Et.getFlattenDefaultOptions(),e=n.map((e=>{let s=`"${i}.${e}" in not a known option.`,o=t.find((t=>t.includes(e)));return o&&(s+=`Did you mean "${o}"?`),s}));vt.errorMessages.unexpectedOptions(e)}Object.keys(e).forEach((e=>{"."===(i+=`.${e}`).charAt(0)&&(i=i.slice(1));const n=Et.objectPath(i,_t);let a=typeof t[e],r=typeof n,c=t[e];if(!t.hasOwnProperty(e)){if("undefined"===r||0===(null==c?void 0:c.length)&&Array.isArray(n))return s[e]=n,void(i=i.substring(0,i.lastIndexOf(`.${e}`)));t[e]=n,c=t[e]}s[e]=Et.processKey(e,c,a,r,i,o),"object"!=typeof n||n instanceof Date||Et.ignoreProperties.includes(e)||Array.isArray(t[e])||Et.spread(t[e],n,s[e],i,o),i=i.substring(0,i.lastIndexOf(`.${e}`))}))}static processKey(t,e,s,i,o,n){switch(t){case"defaultDate":{const t=this.dateConversion(e,"defaultDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("defaultDate",s,"DateTime or Date");break}case"viewDate":{const t=this.dateConversion(e,"viewDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("viewDate",s,"DateTime or Date");break}case"minDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.minDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("restrictions.minDate",s,"DateTime or Date");break}case"maxDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.maxDate");if(void 0!==t)return t.setLocale(n),t;vt.errorMessages.typeMismatch("restrictions.maxDate",s,"DateTime or Date");break}case"disabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.disabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&vt.errorMessages.numbersOutOfRage("restrictions.disabledHours",0,23),e);case"enabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.enabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&vt.errorMessages.numbersOutOfRage("restrictions.enabledHours",0,23),e);case"daysOfWeekDisabled":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.daysOfWeekDisabled",e,s),e.filter((t=>t<0||t>6)).length>0&&vt.errorMessages.numbersOutOfRage("restrictions.daysOfWeekDisabled",0,6),e);case"enabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.enabledDates",e,s,n),e);case"disabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.disabledDates",e,s,n),e);case"disabledTimeIntervals":if(void 0===e)return[];Array.isArray(e)||vt.errorMessages.typeMismatch(t,s,"array of { from: DateTime|Date, to: DateTime|Date }");const a=e;for(let e=0;e{const i=`${t}[${e}].${s}`;let o=a[e][s];const r=this.dateConversion(o,i);r||vt.errorMessages.typeMismatch(i,typeof o,"DateTime or Date"),r.setLocale(n),a[e][s]=r}));return a;case"toolbarPlacement":case"type":case"viewMode":const r={toolbarPlacement:["top","bottom","default"],type:["icons","sprites"],viewMode:["clock","calendar","months","years","decades"]}[t];return r.includes(e)||vt.errorMessages.unexpectedOptionValue(o.substring(1),e,r),e;case"meta":case"dayViewHeaderFormat":return e;case"container":return e&&!(e instanceof HTMLElement||e instanceof Element||(null==e?void 0:e.appendChild))&&vt.errorMessages.typeMismatch(o.substring(1),typeof e,"HTMLElement"),e;default:switch(i){case"boolean":return"true"===e||!0===e;case"number":return+e;case"string":return e.toString();case"object":return{};case"function":return e;default:vt.errorMessages.typeMismatch(o,s,i)}}}static _mergeOptions(t,e){var s;const i={},o="default"!==e.localization.locale?e.localization.locale:(null===(s=null==t?void 0:t.localization)||void 0===s?void 0:s.locale)||"default";return Et.spread(t,e,i,"",o),i}static _dataToOptions(t,e){const s=JSON.parse(JSON.stringify(t.dataset));if((null==s?void 0:s.tdTargetInput)&&delete s.tdTargetInput,(null==s?void 0:s.tdTargetToggle)&&delete s.tdTargetToggle,!s||0===Object.keys(s).length||s.constructor!==DOMStringMap)return e;let i={};const o=t=>{const e={};return Object.keys(t).forEach((t=>{e[t.toLowerCase()]=t})),e},n=(t,e,s,i)=>{const a=o(s)[t[e].toLowerCase()],r={};return void 0===a||(s[a].constructor===Object?(e++,r[a]=n(t,e,s[a],i)):r[a]=i),r},a=o(e);return Object.keys(s).filter((t=>t.startsWith(vt.dataKey))).map((t=>t.substring(2))).forEach((t=>{let o=a[t.toLowerCase()];if(t.includes("_")){const r=t.split("_");o=a[r[0].toLowerCase()],void 0!==o&&e[o].constructor===Object&&(i[o]=n(r,1,e[o],s[`td${t}`]))}else void 0!==o&&(i[o]=s[`td${t}`])})),this._mergeOptions(i,e)}static _dateTypeCheck(t){if(t.constructor.name===mt.name)return t;if(t.constructor.name===Date.name)return mt.convert(t);if("string"==typeof t){const e=new mt(t);return"null"===JSON.stringify(e)?null:e}return null}static _typeCheckDateArray(t,e,s,i="default"){Array.isArray(e)||vt.errorMessages.typeMismatch(t,s,"array of DateTime or Date");for(let s=0;s"number"!=typeof t))||vt.errorMessages.typeMismatch(t,s,"array of numbers")}static dateConversion(t,e){"string"==typeof t&&"input"!==e&&vt.errorMessages.dateString();const s=this._dateTypeCheck(t);return s||vt.errorMessages.failedToParseDate(e,t,"input"===e),s}static getFlattenDefaultOptions(){if(this._flattenDefaults)return this._flattenDefaults;const t=(e,s=[])=>Array.isArray(e)?[]:Object(e)===e?Object.entries(e).flatMap((([e,i])=>t(i,[...s,e]))):s.join(".");return this._flattenDefaults=t(_t),this._flattenDefaults}static _validateConflicts(t){!t.display.sideBySide||t.display.components.clock&&(t.display.components.hours||t.display.components.minutes||t.display.components.seconds)||vt.errorMessages.conflictingConfiguration("Cannot use side by side mode without the clock components"),t.restrictions.minDate&&t.restrictions.maxDate&&(t.restrictions.minDate.isAfter(t.restrictions.maxDate)&&vt.errorMessages.conflictingConfiguration("minDate is after maxDate"),t.restrictions.maxDate.isBefore(t.restrictions.minDate)&&vt.errorMessages.conflictingConfiguration("maxDate is before minDate"))}}Et.ignoreProperties=["meta","dayViewHeaderFormat","container"],Et.isValue=t=>null!=t;class Mt{constructor(){this._dates=[],this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt),this._eventEmitters=bt.locate(Ct)}get picked(){return this._dates}get lastPicked(){return this._dates[this.lastPickedIndex]}get lastPickedIndex(){return 0===this._dates.length?0:this._dates.length-1}formatInput(t){const e=this.optionsStore.options.display.components;return t?t.format({year:e.calendar&&e.year?"numeric":void 0,month:e.calendar&&e.month?"2-digit":void 0,day:e.calendar&&e.date?"2-digit":void 0,hour:e.clock&&e.hours?e.useTwentyfourHour?"2-digit":"numeric":void 0,minute:e.clock&&e.minutes?"2-digit":void 0,second:e.clock&&e.seconds?"2-digit":void 0,hour12:!e.useTwentyfourHour}):""}parseInput(t){return Et.dateConversion(t,"input")}setFromInput(t,e){if(!t)return void this.setValue(void 0,e);const s=this.parseInput(t);s&&(s.setLocale(this.optionsStore.options.localization.locale),this.setValue(s,e))}add(t){this._dates.push(t)}isPicked(t,e){if(!e)return void 0!==this._dates.find((e=>e===t));const s=ut(e);let i=t.format(s);return void 0!==this._dates.map((t=>t.format(s))).find((t=>t===i))}pickedIndex(t,e){if(!e)return this._dates.indexOf(t);const s=ut(e);let i=t.format(s);return this._dates.map((t=>t.format(s))).indexOf(i)}clear(){this.optionsStore.unset=!0,this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:void 0,oldDate:this.lastPicked,isClear:!0,isValid:!0}),this._dates=[]}static getStartEndYear(t,e){const s=t/10,i=Math.floor(e/t)*t;return[i,i+9*s,Math.floor(e/s)*s]}setValue(t,e){const s=void 0===e,i=!t&&s;let o=this.optionsStore.unset?null:this._dates[e];!o&&!this.optionsStore.unset&&s&&i&&(o=this.lastPicked);const n=()=>{if(!this.optionsStore.input)return;let e=this.formatInput(t);this.optionsStore.options.multipleDates&&(e=this._dates.map((t=>this.formatInput(t))).join(this.optionsStore.options.multipleDatesSeparator)),this.optionsStore.input.value!=e&&(this.optionsStore.input.value=e)};if(t&&(null==o?void 0:o.isSame(t)))n();else{if(!t)return!this.optionsStore.options.multipleDates||1===this._dates.length||i?(this.optionsStore.unset=!0,this._dates=[]):this._dates.splice(e,1),n(),this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:void 0,oldDate:o,isClear:i,isValid:!0}),void this._eventEmitters.updateDisplay.emit("all");if(e=e||0,t=t.clone,1!==this.optionsStore.options.stepping&&(t.minutes=Math.round(t.minutes/this.optionsStore.options.stepping)*this.optionsStore.options.stepping,t.seconds=0),this.validation.isValid(t))return this._dates[e]=t,this.optionsStore.viewDate=t.clone,n(),this.optionsStore.unset=!1,this._eventEmitters.updateDisplay.emit("all"),void this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:t,oldDate:o,isClear:i,isValid:!0});this.optionsStore.options.keepInvalid&&(this._dates[e]=t,this.optionsStore.viewDate=t.clone,n(),this._eventEmitters.triggerEvent.emit({type:vt.events.change,date:t,oldDate:o,isClear:i,isValid:!1})),this._eventEmitters.triggerEvent.emit({type:vt.events.error,reason:vt.errorMessages.failedToSetInvalidDate,date:t,oldDate:o})}}}var xt;!function(t){t.next="next",t.previous="previous",t.changeCalendarView="changeCalendarView",t.selectMonth="selectMonth",t.selectYear="selectYear",t.selectDecade="selectDecade",t.selectDay="selectDay",t.selectHour="selectHour",t.selectMinute="selectMinute",t.selectSecond="selectSecond",t.incrementHours="incrementHours",t.incrementMinutes="incrementMinutes",t.incrementSeconds="incrementSeconds",t.decrementHours="decrementHours",t.decrementMinutes="decrementMinutes",t.decrementSeconds="decrementSeconds",t.toggleMeridiem="toggleMeridiem",t.togglePicker="togglePicker",t.showClock="showClock",t.showHours="showHours",t.showMinutes="showMinutes",t.showSeconds="showSeconds",t.clear="clear",t.close="close",t.today="today"}(xt||(xt={}));var Ot=xt;class Lt{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");if(t.classList.add(vt.css.daysContainer),t.append(...this._daysOfTheWeek()),this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(vt.css.calendarWeeks,vt.css.noHighlight),t.appendChild(e)}for(let e=0;e<42;e++){if(0!==e&&e%7==0&&this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(vt.css.calendarWeeks,vt.css.noHighlight),t.appendChild(e)}const s=document.createElement("div");s.setAttribute("data-action",Ot.selectDay),t.appendChild(s)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.daysContainer)[0],[i,o,n]=s.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");o.setAttribute(vt.css.daysContainer,this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.month),dt.month)?i.classList.remove(vt.css.disabled):i.classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.month),dt.month)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled);let a=this.optionsStore.viewDate.clone.startOf(dt.month).startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).manipulate(12,dt.hours);s.querySelectorAll(`[data-action="${Ot.selectDay}"], .${vt.css.calendarWeeks}`).forEach((t=>{if(this.optionsStore.options.display.calendarWeeks&&t.classList.contains(vt.css.calendarWeeks)){if("#"===t.innerText)return;return void(t.innerText=`${a.week}`)}let s=[];s.push(vt.css.day),a.isBefore(this.optionsStore.viewDate,dt.month)&&s.push(vt.css.old),a.isAfter(this.optionsStore.viewDate,dt.month)&&s.push(vt.css.new),!this.optionsStore.unset&&this.dates.isPicked(a,dt.date)&&s.push(vt.css.active),this.validation.isValid(a,dt.date)||s.push(vt.css.disabled),a.isSame(new mt,dt.date)&&s.push(vt.css.today),0!==a.weekDay&&6!==a.weekDay||s.push(vt.css.weekend),e(dt.date,a,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${a.year}-${a.monthFormatted}-${a.dateFormatted}`),t.setAttribute("data-day",`${a.date}`),t.innerText=a.format({day:"numeric"}),a.manipulate(1,dt.date)}))}_daysOfTheWeek(){let t=this.optionsStore.viewDate.clone.startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).startOf(dt.date);const e=[];if(document.createElement("div"),this.optionsStore.options.display.calendarWeeks){const t=document.createElement("div");t.classList.add(vt.css.calendarWeeks,vt.css.noHighlight),t.innerText="#",e.push(t)}for(let s=0;s<7;s++){const s=document.createElement("div");s.classList.add(vt.css.dayOfTheWeek,vt.css.noHighlight),s.innerText=t.format({weekday:"short"}),t.manipulate(1,dt.date),e.push(s)}return e}}class At{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.monthsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectMonth),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.monthsContainer)[0],[i,o,n]=s.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");o.setAttribute(vt.css.monthsContainer,this.optionsStore.viewDate.format({year:"numeric"})),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.year),dt.year)?i.classList.remove(vt.css.disabled):i.classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.year),dt.year)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled);let a=this.optionsStore.viewDate.clone.startOf(dt.year);s.querySelectorAll(`[data-action="${Ot.selectMonth}"]`).forEach(((t,s)=>{let i=[];i.push(vt.css.month),!this.optionsStore.unset&&this.dates.isPicked(a,dt.month)&&i.push(vt.css.active),this.validation.isValid(a,dt.month)||i.push(vt.css.disabled),e(dt.month,a,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${s}`),t.innerText=`${a.format({month:"short"})}`,a.manipulate(1,dt.month)}))}}class Tt{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.yearsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectYear),t.appendChild(e)}return t}_update(t,e){this._startYear=this.optionsStore.viewDate.clone.manipulate(-1,dt.year),this._endYear=this.optionsStore.viewDate.clone.manipulate(10,dt.year);const s=t.getElementsByClassName(vt.css.yearsContainer)[0],[i,o,n]=s.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");o.setAttribute(vt.css.yearsContainer,`${this._startYear.format({year:"numeric"})}-${this._endYear.format({year:"numeric"})}`),this.validation.isValid(this._startYear,dt.year)?i.classList.remove(vt.css.disabled):i.classList.add(vt.css.disabled),this.validation.isValid(this._endYear,dt.year)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled);let a=this.optionsStore.viewDate.clone.startOf(dt.year).manipulate(-1,dt.year);s.querySelectorAll(`[data-action="${Ot.selectYear}"]`).forEach((t=>{let s=[];s.push(vt.css.year),!this.optionsStore.unset&&this.dates.isPicked(a,dt.year)&&s.push(vt.css.active),this.validation.isValid(a,dt.year)||s.push(vt.css.disabled),e(dt.year,a,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${a.year}`),t.innerText=a.format({year:"numeric"}),a.manipulate(1,dt.year)}))}}class Ht{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.decadesContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectDecade),t.appendChild(e)}return t}_update(t,e){const[s,i]=Mt.getStartEndYear(100,this.optionsStore.viewDate.year);this._startDecade=this.optionsStore.viewDate.clone.startOf(dt.year),this._startDecade.year=s,this._endDecade=this.optionsStore.viewDate.clone.startOf(dt.year),this._endDecade.year=i;const o=t.getElementsByClassName(vt.css.decadesContainer)[0],[n,a,r]=o.parentElement.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");a.setAttribute(vt.css.decadesContainer,`${this._startDecade.format({year:"numeric"})}-${this._endDecade.format({year:"numeric"})}`),this.validation.isValid(this._startDecade,dt.year)?n.classList.remove(vt.css.disabled):n.classList.add(vt.css.disabled),this.validation.isValid(this._endDecade,dt.year)?r.classList.remove(vt.css.disabled):r.classList.add(vt.css.disabled);const c=this.dates.picked.map((t=>t.year));o.querySelectorAll(`[data-action="${Ot.selectDecade}"]`).forEach(((t,s)=>{if(0===s)return t.classList.add(vt.css.old),this._startDecade.year-10<0?(t.textContent=" ",n.classList.add(vt.css.disabled),t.classList.add(vt.css.disabled),void t.setAttribute("data-value","")):(t.innerText=this._startDecade.clone.manipulate(-10,dt.year).format({year:"numeric"}),void t.setAttribute("data-value",`${this._startDecade.year}`));let i=[];i.push(vt.css.decade);const o=this._startDecade.year,a=this._startDecade.year+9;!this.optionsStore.unset&&c.filter((t=>t>=o&&t<=a)).length>0&&i.push(vt.css.active),e("decade",this._startDecade,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${this._startDecade.year}`),t.innerText=`${this._startDecade.format({year:"numeric"})}`,this._startDecade.manipulate(10,dt.year)}))}}class Vt{constructor(){this._gridColumns="",this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt)}getPicker(t){const e=document.createElement("div");return e.classList.add(vt.css.clockContainer),e.append(...this._grid(t)),e}_update(t){const e=t.getElementsByClassName(vt.css.clockContainer)[0],s=(this.dates.lastPicked||this.optionsStore.viewDate).clone;if(e.querySelectorAll(".disabled").forEach((t=>t.classList.remove(vt.css.disabled))),this.optionsStore.options.display.components.hours&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.hours),dt.hours)||e.querySelector(`[data-action=${Ot.incrementHours}]`).classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.hours),dt.hours)||e.querySelector(`[data-action=${Ot.decrementHours}]`).classList.add(vt.css.disabled),e.querySelector(`[data-time-component=${dt.hours}]`).innerText=this.optionsStore.options.display.components.useTwentyfourHour?s.hoursFormatted:s.twelveHoursFormatted),this.optionsStore.options.display.components.minutes&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.minutes),dt.minutes)||e.querySelector(`[data-action=${Ot.incrementMinutes}]`).classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.minutes),dt.minutes)||e.querySelector(`[data-action=${Ot.decrementMinutes}]`).classList.add(vt.css.disabled),e.querySelector(`[data-time-component=${dt.minutes}]`).innerText=s.minutesFormatted),this.optionsStore.options.display.components.seconds&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,dt.seconds),dt.seconds)||e.querySelector(`[data-action=${Ot.incrementSeconds}]`).classList.add(vt.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,dt.seconds),dt.seconds)||e.querySelector(`[data-action=${Ot.decrementSeconds}]`).classList.add(vt.css.disabled),e.querySelector(`[data-time-component=${dt.seconds}]`).innerText=s.secondsFormatted),!this.optionsStore.options.display.components.useTwentyfourHour){const t=e.querySelector(`[data-action=${Ot.toggleMeridiem}]`);t.innerText=s.meridiem(),this.validation.isValid(s.clone.manipulate(s.hours>=12?-12:12,dt.hours))?t.classList.remove(vt.css.disabled):t.classList.add(vt.css.disabled)}e.style.gridTemplateAreas=`"${this._gridColumns}"`}_grid(t){this._gridColumns="";const e=[],s=[],i=[],o=document.createElement("div"),n=t(this.optionsStore.options.display.icons.up),a=t(this.optionsStore.options.display.icons.down);o.classList.add(vt.css.separator,vt.css.noHighlight);const r=o.cloneNode(!0);r.innerHTML=":";const c=(t=!1)=>t?r.cloneNode(!0):o.cloneNode(!0);if(this.optionsStore.options.display.components.hours){let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementHour),t.setAttribute("data-action",Ot.incrementHours),t.appendChild(n.cloneNode(!0)),e.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickHour),t.setAttribute("data-action",Ot.showHours),t.setAttribute("data-time-component",dt.hours),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementHour),t.setAttribute("data-action",Ot.decrementHours),t.appendChild(a.cloneNode(!0)),i.push(t),this._gridColumns+="a"}if(this.optionsStore.options.display.components.minutes){this._gridColumns+=" a",this.optionsStore.options.display.components.hours&&(e.push(c()),s.push(c(!0)),i.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementMinute),t.setAttribute("data-action",Ot.incrementMinutes),t.appendChild(n.cloneNode(!0)),e.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickMinute),t.setAttribute("data-action",Ot.showMinutes),t.setAttribute("data-time-component",dt.minutes),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementMinute),t.setAttribute("data-action",Ot.decrementMinutes),t.appendChild(a.cloneNode(!0)),i.push(t)}if(this.optionsStore.options.display.components.seconds){this._gridColumns+=" a",this.optionsStore.options.display.components.minutes&&(e.push(c()),s.push(c(!0)),i.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementSecond),t.setAttribute("data-action",Ot.incrementSeconds),t.appendChild(n.cloneNode(!0)),e.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickSecond),t.setAttribute("data-action",Ot.showSeconds),t.setAttribute("data-time-component",dt.seconds),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementSecond),t.setAttribute("data-action",Ot.decrementSeconds),t.appendChild(a.cloneNode(!0)),i.push(t)}if(!this.optionsStore.options.display.components.useTwentyfourHour){this._gridColumns+=" a";let t=c();e.push(t);let o=document.createElement("button");o.setAttribute("title",this.optionsStore.options.localization.toggleMeridiem),o.setAttribute("data-action",Ot.toggleMeridiem),o.setAttribute("tabindex","-1"),vt.css.toggleMeridiem.includes(",")?o.classList.add(...vt.css.toggleMeridiem.split(",")):o.classList.add(vt.css.toggleMeridiem),t=document.createElement("div"),t.classList.add(vt.css.noHighlight),t.appendChild(o),s.push(t),t=c(),i.push(t)}return this._gridColumns=this._gridColumns.trim(),[...e,...s,...i]}}class $t{constructor(){this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.hourContainer);for(let e=0;e<(this.optionsStore.options.display.components.useTwentyfourHour?24:12);e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectHour),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.hourContainer)[0];let i=this.optionsStore.viewDate.clone.startOf(dt.date);s.querySelectorAll(`[data-action="${Ot.selectHour}"]`).forEach((t=>{let s=[];s.push(vt.css.hour),this.validation.isValid(i,dt.hours)||s.push(vt.css.disabled),e(dt.hours,i,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${i.hours}`),t.innerText=this.optionsStore.options.display.components.useTwentyfourHour?i.hoursFormatted:i.twelveHoursFormatted,i.manipulate(1,dt.hours)}))}}class Pt{constructor(){this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.minuteContainer);let e=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;for(let s=0;s<60/e;s++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectMinute),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.minuteContainer)[0];let i=this.optionsStore.viewDate.clone.startOf(dt.hours),o=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;s.querySelectorAll(`[data-action="${Ot.selectMinute}"]`).forEach((t=>{let s=[];s.push(vt.css.minute),this.validation.isValid(i,dt.minutes)||s.push(vt.css.disabled),e(dt.minutes,i,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${i.minutesFormatted}`),t.innerText=i.minutesFormatted,i.manipulate(o,dt.minutes)}))}}class It{constructor(){this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt)}getPicker(){const t=document.createElement("div");t.classList.add(vt.css.secondContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",Ot.selectSecond),t.appendChild(e)}return t}_update(t,e){const s=t.getElementsByClassName(vt.css.secondContainer)[0];let i=this.optionsStore.viewDate.clone.startOf(dt.minutes);s.querySelectorAll(`[data-action="${Ot.selectSecond}"]`).forEach((t=>{let s=[];s.push(vt.css.second),this.validation.isValid(i,dt.seconds)||s.push(vt.css.disabled),e(dt.seconds,i,s,t),t.classList.remove(...t.classList),t.classList.add(...s),t.setAttribute("data-value",`${i.seconds}`),t.innerText=i.secondsFormatted,i.manipulate(5,dt.seconds)}))}}class Nt{static toggle(t){t.classList.contains(vt.css.show)?this.hide(t):this.show(t)}static show(t){if(t.classList.contains(vt.css.collapsing)||t.classList.contains(vt.css.show))return;t.style.height="0",t.classList.remove(vt.css.collapse),t.classList.add(vt.css.collapsing),setTimeout((()=>{t.classList.remove(vt.css.collapsing),t.classList.add(vt.css.collapse,vt.css.show),t.style.height=""}),this.getTransitionDurationFromElement(t)),t.style.height=`${t.scrollHeight}px`}static hide(t){if(t.classList.contains(vt.css.collapsing)||!t.classList.contains(vt.css.show))return;t.style.height=`${t.getBoundingClientRect().height}px`;t.offsetHeight,t.classList.remove(vt.css.collapse,vt.css.show),t.classList.add(vt.css.collapsing),t.style.height="",setTimeout((()=>{t.classList.remove(vt.css.collapsing),t.classList.add(vt.css.collapse)}),this.getTransitionDurationFromElement(t))}}Nt.getTransitionDurationFromElement=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e),o=Number.parseFloat(s);return i||o?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0};class jt{constructor(){this._isVisible=!1,this._documentClickEvent=t=>{var e;this.optionsStore.options.debug||window.debug||!this._isVisible||t.composedPath().includes(this.widget)||(null===(e=t.composedPath())||void 0===e?void 0:e.includes(this.optionsStore.element))||this.hide()},this._actionsClickEvent=t=>{this._eventEmitters.action.emit({e:t})},this.optionsStore=bt.locate(St),this.validation=bt.locate(Dt),this.dates=bt.locate(Mt),this.dateDisplay=bt.locate(Lt),this.monthDisplay=bt.locate(At),this.yearDisplay=bt.locate(Tt),this.decadeDisplay=bt.locate(Ht),this.timeDisplay=bt.locate(Vt),this.hourDisplay=bt.locate($t),this.minuteDisplay=bt.locate(Pt),this.secondDisplay=bt.locate(It),this._eventEmitters=bt.locate(Ct),this._widget=void 0,this._eventEmitters.updateDisplay.subscribe((t=>{this._update(t)}))}get widget(){return this._widget}get isVisible(){return this._isVisible}_update(t){if(this.widget)switch(t){case dt.seconds:this.secondDisplay._update(this.widget,this.paint);break;case dt.minutes:this.minuteDisplay._update(this.widget,this.paint);break;case dt.hours:this.hourDisplay._update(this.widget,this.paint);break;case dt.date:this.dateDisplay._update(this.widget,this.paint);break;case dt.month:this.monthDisplay._update(this.widget,this.paint);break;case dt.year:this.yearDisplay._update(this.widget,this.paint);break;case"clock":if(!this._hasTime)break;this.timeDisplay._update(this.widget),this._update(dt.hours),this._update(dt.minutes),this._update(dt.seconds);break;case"calendar":this._update(dt.date),this._update(dt.year),this._update(dt.month),this.decadeDisplay._update(this.widget,this.paint),this._updateCalendarHeader();break;case"all":this._hasTime&&this._update("clock"),this._hasDate&&this._update("calendar")}}paint(t,e,s,i){}show(){var t,e;if(null==this.widget){if(0==this.dates.picked.length){if(this.optionsStore.options.useCurrent&&!this.optionsStore.options.defaultDate){const e=(new mt).setLocale(this.optionsStore.options.localization.locale);if(!this.optionsStore.options.keepInvalid){let s=0,i=1;for((null===(t=this.optionsStore.options.restrictions.maxDate)||void 0===t?void 0:t.isBefore(e))&&(i=-1);!(this.validation.isValid(e)||(e.manipulate(i,dt.date),s>31));)s++}this.dates.setValue(e)}this.optionsStore.options.defaultDate&&this.dates.setValue(this.optionsStore.options.defaultDate)}this._buildWidget();const s=this._hasTime&&!this._hasDate;if(s&&(this.optionsStore.currentView="clock",this._eventEmitters.action.emit({e:null,action:Ot.showClock})),this.optionsStore.currentCalendarViewMode||(this.optionsStore.currentCalendarViewMode=this.optionsStore.minimumCalendarViewMode),s||(this._hasTime&&Nt.hide(this.widget.querySelector(`div.${vt.css.timeContainer}`)),Nt.show(this.widget.querySelector(`div.${vt.css.dateContainer}`))),this._hasDate&&this._showMode(),this.optionsStore.options.display.inline)this.optionsStore.element.appendChild(this.widget);else{((null===(e=this.optionsStore.options)||void 0===e?void 0:e.container)||document.body).appendChild(this.widget),this._popperInstance=lt(this.optionsStore.element,this.widget,{modifiers:[{name:"eventListeners",enabled:!0}],placement:"rtl"===document.documentElement.dir?"bottom-end":"bottom-start"})}"clock"==this.optionsStore.options.display.viewMode&&this._eventEmitters.action.emit({e:null,action:Ot.showClock}),this.widget.querySelectorAll("[data-action]").forEach((t=>t.addEventListener("click",this._actionsClickEvent))),this._hasTime&&this.optionsStore.options.display.sideBySide&&(this.timeDisplay._update(this.widget),this.widget.getElementsByClassName(vt.css.clockContainer)[0].style.display="grid")}this.widget.classList.add(vt.css.show),this.optionsStore.options.display.inline||(this._popperInstance.update(),document.addEventListener("click",this._documentClickEvent)),this._eventEmitters.triggerEvent.emit({type:vt.events.show}),this._isVisible=!0}_showMode(t){if(!this.widget)return;if(t){const e=Math.max(this.optionsStore.minimumCalendarViewMode,Math.min(3,this.optionsStore.currentCalendarViewMode+t));if(this.optionsStore.currentCalendarViewMode==e)return;this.optionsStore.currentCalendarViewMode=e}this.widget.querySelectorAll(`.${vt.css.dateContainer} > div:not(.${vt.css.calendarHeader}), .${vt.css.timeContainer} > div:not(.${vt.css.clockContainer})`).forEach((t=>t.style.display="none"));const e=wt[this.optionsStore.currentCalendarViewMode];let s=this.widget.querySelector(`.${e.className}`);switch(e.className){case vt.css.decadesContainer:this.decadeDisplay._update(this.widget,this.paint);break;case vt.css.yearsContainer:this.yearDisplay._update(this.widget,this.paint);break;case vt.css.monthsContainer:this.monthDisplay._update(this.widget,this.paint);break;case vt.css.daysContainer:this.dateDisplay._update(this.widget,this.paint)}s.style.display="grid",this._updateCalendarHeader(),this._eventEmitters.viewUpdate.emit()}_updateCalendarHeader(){const t=[...this.widget.querySelector(`.${vt.css.dateContainer} div[style*="display: grid"]`).classList].find((t=>t.startsWith(vt.css.dateContainer))),[e,s,i]=this.widget.getElementsByClassName(vt.css.calendarHeader)[0].getElementsByTagName("div");switch(t){case vt.css.decadesContainer:e.setAttribute("title",this.optionsStore.options.localization.previousCentury),s.setAttribute("title",""),i.setAttribute("title",this.optionsStore.options.localization.nextCentury);break;case vt.css.yearsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousDecade),s.setAttribute("title",this.optionsStore.options.localization.selectDecade),i.setAttribute("title",this.optionsStore.options.localization.nextDecade);break;case vt.css.monthsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousYear),s.setAttribute("title",this.optionsStore.options.localization.selectYear),i.setAttribute("title",this.optionsStore.options.localization.nextYear);break;case vt.css.daysContainer:e.setAttribute("title",this.optionsStore.options.localization.previousMonth),s.setAttribute("title",this.optionsStore.options.localization.selectMonth),i.setAttribute("title",this.optionsStore.options.localization.nextMonth),s.innerText=this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)}s.innerText=s.getAttribute(t)}hide(){this.widget&&this._isVisible&&(this.widget.classList.remove(vt.css.show),this._isVisible&&(this._eventEmitters.triggerEvent.emit({type:vt.events.hide,date:this.optionsStore.unset?null:this.dates.lastPicked?this.dates.lastPicked.clone:void 0}),this._isVisible=!1),document.removeEventListener("click",this._documentClickEvent))}toggle(){return this._isVisible?this.hide():this.show()}_dispose(){document.removeEventListener("click",this._documentClickEvent),this.widget&&(this.widget.querySelectorAll("[data-action]").forEach((t=>t.removeEventListener("click",this._actionsClickEvent))),this.widget.parentNode.removeChild(this.widget),this._widget=void 0)}_buildWidget(){const t=document.createElement("div");t.classList.add(vt.css.widget);const e=document.createElement("div");e.classList.add(vt.css.dateContainer),e.append(this.getHeadTemplate(),this.decadeDisplay.getPicker(),this.yearDisplay.getPicker(),this.monthDisplay.getPicker(),this.dateDisplay.getPicker());const s=document.createElement("div");s.classList.add(vt.css.timeContainer),s.appendChild(this.timeDisplay.getPicker(this._iconTag.bind(this))),s.appendChild(this.hourDisplay.getPicker()),s.appendChild(this.minuteDisplay.getPicker()),s.appendChild(this.secondDisplay.getPicker());const i=document.createElement("div");if(i.classList.add(vt.css.toolbar),i.append(...this.getToolbarElements()),this.optionsStore.options.display.inline&&t.classList.add(vt.css.inline),this.optionsStore.options.display.calendarWeeks&&t.classList.add("calendarWeeks"),this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){t.classList.add(vt.css.sideBySide),"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");return o.classList.add("td-row"),e.classList.add("td-half"),s.classList.add("td-half"),o.appendChild(e),o.appendChild(s),t.appendChild(o),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),void(this._widget=t)}"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),this._hasDate&&(this._hasTime&&(e.classList.add(vt.css.collapse),"clock"!==this.optionsStore.options.display.viewMode&&e.classList.add(vt.css.show)),t.appendChild(e)),this._hasTime&&(this._hasDate&&(s.classList.add(vt.css.collapse),"clock"===this.optionsStore.options.display.viewMode&&s.classList.add(vt.css.show)),t.appendChild(s)),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");o.classList.add("arrow"),o.setAttribute("data-popper-arrow",""),t.appendChild(o),this._widget=t}get _hasTime(){return this.optionsStore.options.display.components.clock&&(this.optionsStore.options.display.components.hours||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.components.seconds)}get _hasDate(){return this.optionsStore.options.display.components.calendar&&(this.optionsStore.options.display.components.year||this.optionsStore.options.display.components.month||this.optionsStore.options.display.components.date)}getToolbarElements(){const t=[];if(this.optionsStore.options.display.buttons.today){const e=document.createElement("div");e.setAttribute("data-action",Ot.today),e.setAttribute("title",this.optionsStore.options.localization.today),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.today)),t.push(e)}if(!this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){let e,s;"clock"===this.optionsStore.options.display.viewMode?(e=this.optionsStore.options.localization.selectDate,s=this.optionsStore.options.display.icons.date):(e=this.optionsStore.options.localization.selectTime,s=this.optionsStore.options.display.icons.time);const i=document.createElement("div");i.setAttribute("data-action",Ot.togglePicker),i.setAttribute("title",e),i.appendChild(this._iconTag(s)),t.push(i)}if(this.optionsStore.options.display.buttons.clear){const e=document.createElement("div");e.setAttribute("data-action",Ot.clear),e.setAttribute("title",this.optionsStore.options.localization.clear),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.clear)),t.push(e)}if(this.optionsStore.options.display.buttons.close){const e=document.createElement("div");e.setAttribute("data-action",Ot.close),e.setAttribute("title",this.optionsStore.options.localization.close),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.close)),t.push(e)}return t}getHeadTemplate(){const t=document.createElement("div");t.classList.add(vt.css.calendarHeader);const e=document.createElement("div");e.classList.add(vt.css.previous),e.setAttribute("data-action",Ot.previous),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.previous));const s=document.createElement("div");s.classList.add(vt.css.switch),s.setAttribute("data-action",Ot.changeCalendarView);const i=document.createElement("div");return i.classList.add(vt.css.next),i.setAttribute("data-action",Ot.next),i.appendChild(this._iconTag(this.optionsStore.options.display.icons.next)),t.append(e,s,i),t}_iconTag(t){if("sprites"===this.optionsStore.options.display.icons.type){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("xlink:href",t),s.setAttribute("href",t),e.appendChild(s),e}const e=document.createElement("i");return e.classList.add(...t.split(" ")),e}_rebuild(){const t=this._isVisible;t&&this.hide(),this._dispose(),t&&this.show()}}class Bt{constructor(){this.optionsStore=bt.locate(St),this.dates=bt.locate(Mt),this.validation=bt.locate(Dt),this.display=bt.locate(jt),this._eventEmitters=bt.locate(Ct),this._eventEmitters.action.subscribe((t=>{this.do(t.e,t.action)}))}do(t,e){var s,i;const o=null==t?void 0:t.currentTarget;if(null===(s=null==o?void 0:o.classList)||void 0===s?void 0:s.contains(vt.css.disabled))return!1;e=e||(null===(i=null==o?void 0:o.dataset)||void 0===i?void 0:i.action);const n=(this.dates.lastPicked||this.optionsStore.viewDate).clone;switch(e){case Ot.next:case Ot.previous:this.handleNextPrevious(e);break;case Ot.changeCalendarView:this.display._showMode(1),this.display._updateCalendarHeader();break;case Ot.selectMonth:case Ot.selectYear:case Ot.selectDecade:const s=+o.dataset.value;switch(e){case Ot.selectMonth:this.optionsStore.viewDate.month=s;break;case Ot.selectYear:case Ot.selectDecade:this.optionsStore.viewDate.year=s}this.optionsStore.currentCalendarViewMode===this.optionsStore.minimumCalendarViewMode?(this.dates.setValue(this.optionsStore.viewDate,this.dates.lastPickedIndex),this.optionsStore.options.display.inline||this.display.hide()):this.display._showMode(-1);break;case Ot.selectDay:const i=this.optionsStore.viewDate.clone;o.classList.contains(vt.css.old)&&i.manipulate(-1,dt.month),o.classList.contains(vt.css.new)&&i.manipulate(1,dt.month),i.date=+o.dataset.day;let a=0;this.optionsStore.options.multipleDates?(a=this.dates.pickedIndex(i,dt.date),-1!==a?this.dates.setValue(null,a):this.dates.setValue(i,this.dates.lastPickedIndex+1)):this.dates.setValue(i,this.dates.lastPickedIndex),this.display._hasTime||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline||this.optionsStore.options.multipleDates||this.display.hide();break;case Ot.selectHour:let r=+o.dataset.value;n.hours>=12&&!this.optionsStore.options.display.components.useTwentyfourHour&&(r+=12),n.hours=r,this.dates.setValue(n,this.dates.lastPickedIndex),this.hideOrClock(t);break;case Ot.selectMinute:n.minutes=+o.dataset.value,this.dates.setValue(n,this.dates.lastPickedIndex),this.hideOrClock(t);break;case Ot.selectSecond:n.seconds=+o.dataset.value,this.dates.setValue(n,this.dates.lastPickedIndex),this.hideOrClock(t);break;case Ot.incrementHours:this.manipulateAndSet(n,dt.hours);break;case Ot.incrementMinutes:this.manipulateAndSet(n,dt.minutes,this.optionsStore.options.stepping);break;case Ot.incrementSeconds:this.manipulateAndSet(n,dt.seconds);break;case Ot.decrementHours:this.manipulateAndSet(n,dt.hours,-1);break;case Ot.decrementMinutes:this.manipulateAndSet(n,dt.minutes,-1*this.optionsStore.options.stepping);break;case Ot.decrementSeconds:this.manipulateAndSet(n,dt.seconds,-1);break;case Ot.toggleMeridiem:this.manipulateAndSet(n,dt.hours,this.dates.lastPicked.hours>=12?-12:12);break;case Ot.togglePicker:o.getAttribute("title")===this.optionsStore.options.localization.selectDate?(o.setAttribute("title",this.optionsStore.options.localization.selectTime),o.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.time).outerHTML,this.display._updateCalendarHeader(),this.optionsStore.refreshCurrentView()):(o.setAttribute("title",this.optionsStore.options.localization.selectDate),o.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.date).outerHTML,this.display._hasTime&&(this.do(t,Ot.showClock),this.display._update("clock"))),this.display.widget.querySelectorAll(`.${vt.css.dateContainer}, .${vt.css.timeContainer}`).forEach((t=>Nt.toggle(t))),this._eventEmitters.viewUpdate.emit();break;case Ot.showClock:case Ot.showHours:case Ot.showMinutes:case Ot.showSeconds:this.handleShowClockContainers(e);break;case Ot.clear:this.dates.setValue(null),this.display._updateCalendarHeader();break;case Ot.close:this.display.hide();break;case Ot.today:const c=(new mt).setLocale(this.optionsStore.options.localization.locale);this.optionsStore.viewDate=c,this.validation.isValid(c,dt.date)&&this.dates.setValue(c,this.dates.lastPickedIndex)}}handleShowClockContainers(t){if(!this.display._hasTime)return void vt.errorMessages.throwError("Cannot show clock containers when time is disabled.");this.optionsStore.currentView="clock",this.display.widget.querySelectorAll(`.${vt.css.timeContainer} > div`).forEach((t=>t.style.display="none"));let e="";switch(t){case Ot.showClock:e=vt.css.clockContainer,this.display._update("clock");break;case Ot.showHours:e=vt.css.hourContainer,this.display._update(dt.hours);break;case Ot.showMinutes:e=vt.css.minuteContainer,this.display._update(dt.minutes);break;case Ot.showSeconds:e=vt.css.secondContainer,this.display._update(dt.seconds)}this.display.widget.getElementsByClassName(e)[0].style.display="grid"}handleNextPrevious(t){const{unit:e,step:s}=wt[this.optionsStore.currentCalendarViewMode];t===Ot.next?this.optionsStore.viewDate.manipulate(s,e):this.optionsStore.viewDate.manipulate(-1*s,e),this._eventEmitters.viewUpdate.emit(),this.display._showMode()}hideOrClock(t){!this.optionsStore.options.display.components.useTwentyfourHour||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline?this.do(t,Ot.showClock):this.display.hide()}manipulateAndSet(t,e,s=1){const i=t.manipulate(s,e);this.validation.isValid(i,e)&&this.dates.setValue(i,this.dates.lastPickedIndex)}}class zt{constructor(t,e={}){this._subscribers={},this._isDisabled=!1,this._inputChangeEvent=t=>{if(null==t?void 0:t.detail)return;const e=()=>{this.dates.lastPicked&&(this.optionsStore.viewDate=this.dates.lastPicked)},s=this.optionsStore.input.value;if(this.optionsStore.options.multipleDates)try{const t=s.split(this.optionsStore.options.multipleDatesSeparator);for(let e=0;e{var t,e;(null===(t=this.optionsStore.element)||void 0===t?void 0:t.disabled)||(null===(e=this.optionsStore.input)||void 0===e?void 0:e.disabled)||this.toggle()},bt=new gt,this._eventEmitters=bt.locate(Ct),this.optionsStore=bt.locate(St),this.display=bt.locate(jt),this.dates=bt.locate(Mt),this.actions=bt.locate(Bt),t||vt.errorMessages.mustProvideElement(),this.optionsStore.element=t,this._initializeOptions(e,_t,!0),this.optionsStore.viewDate.setLocale(this.optionsStore.options.localization.locale),this.optionsStore.unset=!0,this._initializeInput(),this._initializeToggle(),this.optionsStore.options.display.inline&&this.display.show(),this._eventEmitters.triggerEvent.subscribe((t=>{this._triggerEvent(t)})),this._eventEmitters.viewUpdate.subscribe((()=>{this._viewUpdate()}))}get viewDate(){return this.optionsStore.viewDate}updateOptions(t,e=!1){e?this._initializeOptions(t,_t):this._initializeOptions(t,this.optionsStore.options),this.display._rebuild()}toggle(){this._isDisabled||this.display.toggle()}show(){this._isDisabled||this.display.show()}hide(){this.display.hide()}disable(){var t;this._isDisabled=!0,null===(t=this.optionsStore.input)||void 0===t||t.setAttribute("disabled","disabled"),this.display.hide()}enable(){var t;this._isDisabled=!1,null===(t=this.optionsStore.input)||void 0===t||t.removeAttribute("disabled")}clear(){this.optionsStore.input.value="",this.dates.clear()}subscribe(t,e){let s;"string"==typeof t&&(t=[t]),s=Array.isArray(e)?e:[e],t.length!==s.length&&vt.errorMessages.subscribeMismatch();const i=[];for(let e=0;e{e(t)}))}_viewUpdate(){this._triggerEvent({type:vt.events.update,viewDate:this.optionsStore.viewDate.clone})}_unsubscribe(t,e){this._subscribers[t].splice(e,1)}_initializeOptions(t,e,s=!1){var i;let o=Et.deepCopy(t);o=Et._mergeOptions(o,e),s&&(o=Et._dataToOptions(this.optionsStore.element,o)),Et._validateConflicts(o),o.viewDate=o.viewDate.setLocale(o.localization.locale),this.optionsStore.viewDate.isSame(o.viewDate)||(this.optionsStore.viewDate=o.viewDate),o.display.components.year&&(this.optionsStore.minimumCalendarViewMode=2),o.display.components.month&&(this.optionsStore.minimumCalendarViewMode=1),o.display.components.date&&(this.optionsStore.minimumCalendarViewMode=0),this.optionsStore.currentCalendarViewMode=Math.max(this.optionsStore.minimumCalendarViewMode,this.optionsStore.currentCalendarViewMode),wt[this.optionsStore.currentCalendarViewMode].name!==o.display.viewMode&&(this.optionsStore.currentCalendarViewMode=Math.max(wt.findIndex((t=>t.name===o.display.viewMode)),this.optionsStore.minimumCalendarViewMode)),(null===(i=this.display)||void 0===i?void 0:i.isVisible)&&this.display._update("all"),this.optionsStore.options=o}_initializeInput(){if("INPUT"==this.optionsStore.element.tagName)this.optionsStore.input=this.optionsStore.element;else{let t=this.optionsStore.element.dataset.tdTargetInput;this.optionsStore.input=null==t||"nearest"==t?this.optionsStore.element.querySelector("input"):this.optionsStore.element.querySelector(t)}this.optionsStore.input&&(this.optionsStore.input.addEventListener("change",this._inputChangeEvent),this.optionsStore.options.allowInputToggle&&this.optionsStore.input.addEventListener("click",this._toggleClickEvent),this.optionsStore.input.value&&this._inputChangeEvent())}_initializeToggle(){if(this.optionsStore.options.display.inline)return;let t=this.optionsStore.element.dataset.tdTargetToggle;"nearest"==t&&(t='[data-td-toggle="datetimepicker"]'),this._toggle=null==t?this.optionsStore.element:this.optionsStore.element.querySelector(t),this._toggle.addEventListener("click",this._toggleClickEvent)}_handleAfterChangeEvent(t){var e,s;!this.optionsStore.options.promptTimeOnDateChange||this.optionsStore.options.display.inline||this.optionsStore.options.display.sideBySide||!this.display._hasTime||(null===(e=this.display.widget)||void 0===e?void 0:e.getElementsByClassName(vt.css.show)[0].classList.contains(vt.css.timeContainer))||!t.oldDate&&this.optionsStore.options.useCurrent||t.oldDate&&(null===(s=t.date)||void 0===s?void 0:s.isSame(t.oldDate))||(clearTimeout(this._currentPromptTimeTimeout),this._currentPromptTimeTimeout=setTimeout((()=>{this.display.widget&&this._eventEmitters.action.emit({e:{currentTarget:this.display.widget.querySelector(`.${vt.css.switch} div`)},action:Ot.togglePicker})}),this.optionsStore.options.promptTimeOnDateChangeTransitionDelay))}}const Wt={};document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("[data-sonata-form-datepicker]").forEach((function(t){return new zt(t)}))}))}(); \ No newline at end of file