@descope/web-components-ui 1.0.206 → 1.0.208

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,654 @@
1
+ /*! For license information please see 1990.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[1990],{1990:(e,t,s)=>{s(3787),s(9098),s(9416);var i=s(6754),a=s(5128);const n=a.iv`
3
+ [part='overlay'] {
4
+ /*
5
+ Width:
6
+ date cell widths
7
+ + month calendar side padding
8
+ + year scroller width
9
+ */
10
+ /* prettier-ignore */
11
+ width:
12
+ calc(
13
+ var(--lumo-size-m) * 7
14
+ + var(--lumo-space-xs) * 2
15
+ + 57px
16
+ );
17
+ height: 100%;
18
+ max-height: calc(var(--lumo-size-m) * 14);
19
+ overflow: hidden;
20
+ -webkit-tap-highlight-color: transparent;
21
+ }
22
+
23
+ [part='overlay'] {
24
+ flex-direction: column;
25
+ }
26
+
27
+ [part='content'] {
28
+ padding: 0;
29
+ height: 100%;
30
+ overflow: hidden;
31
+ -webkit-mask-image: none;
32
+ mask-image: none;
33
+ }
34
+
35
+ :host([top-aligned]) [part~='overlay'] {
36
+ margin-top: var(--lumo-space-xs);
37
+ }
38
+
39
+ :host([bottom-aligned]) [part~='overlay'] {
40
+ margin-bottom: var(--lumo-space-xs);
41
+ }
42
+
43
+ @media (max-width: 420px), (max-height: 420px) {
44
+ [part='overlay'] {
45
+ width: 100vw;
46
+ height: 70vh;
47
+ max-height: 70vh;
48
+ }
49
+ }
50
+ `;(0,a.hC)("vaadin-date-picker-overlay",[i.L,n],{moduleId:"lumo-date-picker-overlay"}),s(1195),s(9849),s(4173),s(4513),(0,a.hC)("vaadin-date-picker-year",a.iv`
51
+ :host([current]) [part='year-number'] {
52
+ color: var(--lumo-primary-text-color);
53
+ }
54
+
55
+ :host(:not([current])) [part='year-number'],
56
+ [part='year-separator'] {
57
+ opacity: var(--_lumo-date-picker-year-opacity, 0.7);
58
+ transition: 0.2s opacity;
59
+ }
60
+
61
+ [part='year-number'],
62
+ [part='year-separator'] {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ height: 50%;
67
+ transform: translateY(-50%);
68
+ }
69
+
70
+ [part='year-separator']::after {
71
+ color: var(--lumo-disabled-text-color);
72
+ content: '\\2022';
73
+ }
74
+ `,{moduleId:"lumo-date-picker-year"}),(0,a.hC)("vaadin-date-picker-overlay-content",a.iv`
75
+ :host {
76
+ position: relative;
77
+ /* Background for the year scroller, placed here as we are using a mask image on the actual years part */
78
+ background-image: linear-gradient(var(--lumo-shade-5pct), var(--lumo-shade-5pct));
79
+ background-size: 57px 100%;
80
+ background-position: top right;
81
+ background-repeat: no-repeat;
82
+ cursor: default;
83
+ }
84
+
85
+ ::slotted([slot='months']) {
86
+ /* Month calendar height:
87
+ header height + margin-bottom
88
+ + weekdays height + margin-bottom
89
+ + date cell heights
90
+ + small margin between month calendars
91
+ */
92
+ /* prettier-ignore */
93
+ --vaadin-infinite-scroller-item-height:
94
+ calc(
95
+ var(--lumo-font-size-l) + var(--lumo-space-m)
96
+ + var(--lumo-font-size-xs) + var(--lumo-space-s)
97
+ + var(--lumo-size-m) * 6
98
+ + var(--lumo-space-s)
99
+ );
100
+ --vaadin-infinite-scroller-buffer-offset: 10%;
101
+ -webkit-mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
102
+ mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
103
+ position: relative;
104
+ margin-right: 57px;
105
+ }
106
+
107
+ ::slotted([slot='years']) {
108
+ /* TODO get rid of fixed magic number */
109
+ --vaadin-infinite-scroller-buffer-width: 97px;
110
+ width: 57px;
111
+ height: auto;
112
+ top: 0;
113
+ bottom: 0;
114
+ font-size: var(--lumo-font-size-s);
115
+ box-shadow: inset 2px 0 4px 0 var(--lumo-shade-5pct);
116
+ -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
117
+ mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
118
+ cursor: var(--lumo-clickable-cursor);
119
+ }
120
+
121
+ ::slotted([slot='years']:hover) {
122
+ --_lumo-date-picker-year-opacity: 1;
123
+ }
124
+
125
+ /* TODO unsupported selector */
126
+ #scrollers {
127
+ position: static;
128
+ display: block;
129
+ }
130
+
131
+ /* TODO fix this in vaadin-date-picker that it adapts to the width of the year scroller */
132
+ :host([desktop]) ::slotted([slot='months']) {
133
+ right: auto;
134
+ }
135
+
136
+ /* Year scroller position indicator */
137
+ ::slotted([slot='years'])::before {
138
+ border: none;
139
+ width: 1em;
140
+ height: 1em;
141
+ background-color: var(--lumo-base-color);
142
+ background-image: linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct));
143
+ transform: translate(-75%, -50%) rotate(45deg);
144
+ border-top-right-radius: var(--lumo-border-radius-s);
145
+ box-shadow: 2px -2px 6px 0 var(--lumo-shade-5pct);
146
+ z-index: 1;
147
+ }
148
+
149
+ [part='toolbar'] {
150
+ padding: var(--lumo-space-s);
151
+ border-bottom-left-radius: var(--lumo-border-radius-l);
152
+ margin-right: 57px;
153
+ }
154
+
155
+ [part='toolbar'] ::slotted(vaadin-button) {
156
+ margin: 0;
157
+ }
158
+
159
+ /* Narrow viewport mode (fullscreen) */
160
+
161
+ :host([fullscreen]) [part='toolbar'] {
162
+ order: -1;
163
+ background-color: var(--lumo-base-color);
164
+ }
165
+
166
+ :host([fullscreen]) [part='overlay-header'] {
167
+ order: -2;
168
+ height: var(--lumo-size-m);
169
+ padding: var(--lumo-space-s);
170
+ position: absolute;
171
+ left: 0;
172
+ right: 0;
173
+ justify-content: center;
174
+ }
175
+
176
+ :host([fullscreen]) [part='toggle-button'],
177
+ :host([fullscreen]) [part='clear-button'],
178
+ [part='overlay-header'] [part='label'] {
179
+ display: none;
180
+ }
181
+
182
+ /* Very narrow screen (year scroller initially hidden) */
183
+
184
+ [part='years-toggle-button'] {
185
+ display: flex;
186
+ align-items: center;
187
+ height: var(--lumo-size-s);
188
+ padding: 0 0.5em;
189
+ border-radius: var(--lumo-border-radius-m);
190
+ z-index: 3;
191
+ color: var(--lumo-primary-text-color);
192
+ font-weight: 500;
193
+ -webkit-font-smoothing: antialiased;
194
+ -moz-osx-font-smoothing: grayscale;
195
+ }
196
+
197
+ :host([years-visible]) [part='years-toggle-button'] {
198
+ background-color: var(--lumo-primary-color);
199
+ color: var(--lumo-primary-contrast-color);
200
+ }
201
+
202
+ /* TODO magic number (same as used for media-query in vaadin-date-picker-overlay-content) */
203
+ @media screen and (max-width: 374px) {
204
+ :host {
205
+ background-image: none;
206
+ }
207
+
208
+ [part='toolbar'],
209
+ ::slotted([slot='months']) {
210
+ margin-right: 0;
211
+ }
212
+
213
+ /* TODO make date-picker adapt to the width of the years part */
214
+ ::slotted([slot='years']) {
215
+ --vaadin-infinite-scroller-buffer-width: 90px;
216
+ width: 50px;
217
+ background-color: var(--lumo-shade-5pct);
218
+ }
219
+
220
+ :host([years-visible]) ::slotted([slot='months']) {
221
+ padding-left: 50px;
222
+ }
223
+ }
224
+ `,{moduleId:"lumo-date-picker-overlay-content"}),(0,a.hC)("vaadin-month-calendar",a.iv`
225
+ :host {
226
+ -moz-user-select: none;
227
+ -webkit-user-select: none;
228
+ -webkit-tap-highlight-color: transparent;
229
+ user-select: none;
230
+ font-size: var(--lumo-font-size-m);
231
+ color: var(--lumo-body-text-color);
232
+ text-align: center;
233
+ padding: 0 var(--lumo-space-xs);
234
+ }
235
+
236
+ /* Month header */
237
+
238
+ [part='month-header'] {
239
+ color: var(--lumo-header-text-color);
240
+ font-size: var(--lumo-font-size-l);
241
+ line-height: 1;
242
+ font-weight: 500;
243
+ margin-bottom: var(--lumo-space-m);
244
+ }
245
+
246
+ /* Week days and numbers */
247
+
248
+ [part='weekdays'],
249
+ [part='weekday'],
250
+ [part='week-number'] {
251
+ font-size: var(--lumo-font-size-xxs);
252
+ line-height: 1;
253
+ color: var(--lumo-secondary-text-color);
254
+ }
255
+
256
+ [part='weekdays'] {
257
+ margin-bottom: var(--lumo-space-s);
258
+ }
259
+
260
+ [part='weekday']:empty,
261
+ [part='week-number'] {
262
+ width: var(--lumo-size-xs);
263
+ }
264
+
265
+ /* Date and week number cells */
266
+
267
+ [part~='date'],
268
+ [part='week-number'] {
269
+ box-sizing: border-box;
270
+ display: inline-flex;
271
+ align-items: center;
272
+ justify-content: center;
273
+ height: var(--lumo-size-m);
274
+ position: relative;
275
+ }
276
+
277
+ [part~='date'] {
278
+ transition: color 0.1s;
279
+ }
280
+
281
+ [part~='date']:not(:empty) {
282
+ cursor: var(--lumo-clickable-cursor);
283
+ }
284
+
285
+ :host([week-numbers]) [part='weekday']:not(:empty),
286
+ :host([week-numbers]) [part~='date'] {
287
+ width: calc((100% - var(--lumo-size-xs)) / 7);
288
+ }
289
+
290
+ /* Today date */
291
+
292
+ [part~='date'][part~='today'] {
293
+ color: var(--lumo-primary-text-color);
294
+ }
295
+
296
+ /* Focused date */
297
+
298
+ [part~='date']::before {
299
+ content: '';
300
+ position: absolute;
301
+ z-index: -1;
302
+ top: 50%;
303
+ left: 50%;
304
+ transform: translate(-50%, -50%);
305
+ min-width: 2em;
306
+ min-height: 2em;
307
+ width: 80%;
308
+ height: 80%;
309
+ max-height: 100%;
310
+ max-width: 100%;
311
+ border-radius: var(--lumo-border-radius-m);
312
+ }
313
+
314
+ [part~='date'][part~='focused']::before {
315
+ box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
316
+ }
317
+
318
+ :host(:not([focused])) [part~='date'][part~='focused']::before {
319
+ animation: vaadin-date-picker-month-calendar-focus-date 1.4s infinite;
320
+ }
321
+
322
+ @keyframes vaadin-date-picker-month-calendar-focus-date {
323
+ 50% {
324
+ box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px transparent;
325
+ }
326
+ }
327
+
328
+ [part~='date']:not(:empty):not([part~='disabled']):not([part~='selected']):hover::before {
329
+ background-color: var(--lumo-primary-color-10pct);
330
+ }
331
+
332
+ [part~='date'][part~='selected'] {
333
+ color: var(--lumo-primary-contrast-color);
334
+ }
335
+
336
+ [part~='date'][part~='selected']::before {
337
+ background-color: var(--lumo-primary-color);
338
+ }
339
+
340
+ [part~='date'][part~='disabled'] {
341
+ color: var(--lumo-disabled-text-color);
342
+ }
343
+
344
+ @media (pointer: coarse) {
345
+ [part~='date']:hover:not([part~='selected'])::before,
346
+ [part~='focused']:not([part~='selected'])::before {
347
+ display: none;
348
+ }
349
+
350
+ [part~='date']:not(:empty):not([part~='disabled']):active::before {
351
+ display: block;
352
+ }
353
+
354
+ [part~='date'][part~='selected']::before {
355
+ box-shadow: none;
356
+ }
357
+ }
358
+
359
+ /* Disabled */
360
+
361
+ :host([disabled]) * {
362
+ color: var(--lumo-disabled-text-color) !important;
363
+ }
364
+ `,{moduleId:"lumo-month-calendar"});const o=document.createElement("template");o.innerHTML="\n <style>\n @keyframes vaadin-date-picker-month-calendar-focus-date {\n 50% {\n box-shadow: 0 0 0 2px transparent;\n }\n }\n </style>\n",document.head.appendChild(o.content),s(1735);var r=s(2279);const l=a.iv`
365
+ :host {
366
+ outline: none;
367
+ }
368
+
369
+ [part='toggle-button']::before {
370
+ content: var(--lumo-icons-calendar);
371
+ }
372
+
373
+ [part='clear-button']::before {
374
+ content: var(--lumo-icons-cross);
375
+ }
376
+
377
+ @media (max-width: 420px), (max-height: 420px) {
378
+ [part='overlay-content'] {
379
+ height: 70vh;
380
+ }
381
+ }
382
+
383
+ :host([dir='rtl']) [part='input-field'] ::slotted(input) {
384
+ --_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);
385
+ }
386
+
387
+ :host([dir='rtl']) [part='input-field'] ::slotted(input:placeholder-shown) {
388
+ --_lumo-text-field-overflow-mask-image: none;
389
+ }
390
+ `;(0,a.hC)("vaadin-date-picker",[r.J,l],{moduleId:"lumo-date-picker"}),s(3130);var h=s(4241),d=s(2807),c=s(1914),u=s(7673),_=s(3373),p=s(6196),m=s(9897);const f=m.iv`
391
+ [part='overlay'] {
392
+ display: flex;
393
+ flex: auto;
394
+ }
395
+
396
+ [part~='content'] {
397
+ flex: auto;
398
+ }
399
+
400
+ @media (forced-colors: active) {
401
+ [part='overlay'] {
402
+ outline: 3px solid;
403
+ }
404
+ }
405
+ `;(0,a.hC)("vaadin-date-picker-overlay",[p.r,f],{moduleId:"vaadin-date-picker-overlay-styles"});class y extends((0,_.y)((0,u.F)((0,c.U)((0,a.Tb)(h.H3))))){static get is(){return"vaadin-date-picker-overlay"}static get template(){return h.dy`
406
+ <div id="backdrop" part="backdrop" hidden$="[[!withBackdrop]]"></div>
407
+ <div part="overlay" id="overlay">
408
+ <div part="content" id="content">
409
+ <slot></slot>
410
+ </div>
411
+ </div>
412
+ `}}function g(e,t){return e instanceof Date&&t instanceof Date&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function b(e,t,s){return(!t||e>=t)&&(!s||e<=s)}function v(e,t){return t.filter((e=>void 0!==e)).reduce(((t,s)=>s?t?Math.abs(e.getTime()-s.getTime())<Math.abs(t.getTime()-e.getTime())?s:t:s:t))}function D(e){return{day:e.getDate(),month:e.getMonth(),year:e.getFullYear()}}function w(e){const t=new Date,s=new Date(t);return s.setDate(1),s.setMonth(parseInt(e)+t.getMonth()),s}function k(e){const t=/^([-+]\d{1}|\d{2,4}|[-+]\d{6})-(\d{1,2})-(\d{1,2})$/u.exec(e);if(!t)return;const s=new Date(0,0);return s.setFullYear(parseInt(t[1],10)),s.setMonth(parseInt(t[2],10)-1),s.setDate(parseInt(t[3],10)),s}(0,d.M)(y),s(7078);var C=s(7913),x=s(1037),S=s(6139),T=s(3971);const E=document.createElement("template");E.innerHTML='\n <style>\n :host {\n display: block;\n overflow: hidden;\n height: 500px;\n }\n\n #scroller {\n position: relative;\n height: 100%;\n overflow: auto;\n outline: none;\n margin-right: -40px;\n -webkit-overflow-scrolling: touch;\n overflow-x: hidden;\n }\n\n #scroller.notouchscroll {\n -webkit-overflow-scrolling: auto;\n }\n\n #scroller::-webkit-scrollbar {\n display: none;\n }\n\n .buffer {\n position: absolute;\n width: var(--vaadin-infinite-scroller-buffer-width, 100%);\n box-sizing: border-box;\n padding-right: 40px;\n top: var(--vaadin-infinite-scroller-buffer-offset, 0);\n animation: fadein 0.2s;\n }\n\n @keyframes fadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n </style>\n\n <div id="scroller">\n <div class="buffer"></div>\n <div class="buffer"></div>\n <div id="fullHeight"></div>\n </div>\n';class M extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).appendChild(E.content.cloneNode(!0)),this.bufferSize=20,this._initialScroll=5e5,this._initialIndex=0,this._activated=!1}get active(){return this._activated}set active(e){e&&!this._activated&&(this._createPool(),this._activated=!0)}get bufferOffset(){return this._buffers[0].offsetTop}get itemHeight(){if(!this._itemHeightVal){const e=getComputedStyle(this).getPropertyValue("--vaadin-infinite-scroller-item-height"),t="background-position";this.$.fullHeight.style.setProperty(t,e);const s=getComputedStyle(this.$.fullHeight).getPropertyValue(t);this.$.fullHeight.style.removeProperty(t),this._itemHeightVal=parseFloat(s)}return this._itemHeightVal}get _bufferHeight(){return this.itemHeight*this.bufferSize}get position(){return(this.$.scroller.scrollTop-this._buffers[0].translateY)/this.itemHeight+this._firstIndex}set position(e){this._preventScrollEvent=!0,e>this._firstIndex&&e<this._firstIndex+2*this.bufferSize?this.$.scroller.scrollTop=this.itemHeight*(e-this._firstIndex)+this._buffers[0].translateY:(this._initialIndex=~~e,this._reset(),this._scrollDisabled=!0,this.$.scroller.scrollTop+=e%1*this.itemHeight,this._scrollDisabled=!1),this._mayHaveMomentum&&(this.$.scroller.classList.add("notouchscroll"),this._mayHaveMomentum=!1,setTimeout((()=>{this.$.scroller.classList.remove("notouchscroll")}),10))}connectedCallback(){this._ready||(this._ready=!0,this.$={},this.shadowRoot.querySelectorAll("[id]").forEach((e=>{this.$[e.id]=e})),this.$.scroller.addEventListener("scroll",(()=>this._scroll())),this._buffers=[...this.shadowRoot.querySelectorAll(".buffer")],this.$.fullHeight.style.height=2*this._initialScroll+"px",x.vU&&(this.$.scroller.tabIndex=-1))}forceUpdate(){this._debouncerUpdateClones&&(this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones(),this._debouncerUpdateClones.cancel())}_createElement(){}_updateElement(e,t){}_finishInit(){this._initDone||(this._buffers.forEach((e=>{[...e.children].forEach((e=>{this._ensureStampedInstance(e._itemWrapper)}))})),this._buffers[0].translateY||this._reset(),this._initDone=!0,this.dispatchEvent(new CustomEvent("init-done")))}_translateBuffer(e){const t=e?1:0;this._buffers[t].translateY=this._buffers[t?0:1].translateY+this._bufferHeight*(t?-1:1),this._buffers[t].style.transform=`translate3d(0, ${this._buffers[t].translateY}px, 0)`,this._buffers[t].updated=!1,this._buffers.reverse()}_scroll(){if(this._scrollDisabled)return;const e=this.$.scroller.scrollTop;(e<this._bufferHeight||e>2*this._initialScroll-this._bufferHeight)&&(this._initialIndex=~~this.position,this._reset());const t=this.itemHeight+this.bufferOffset,s=e>this._buffers[1].translateY+t,i=e<this._buffers[0].translateY+t;(s||i)&&(this._translateBuffer(i),this._updateClones()),this._preventScrollEvent||(this.dispatchEvent(new CustomEvent("custom-scroll",{bubbles:!1,composed:!0})),this._mayHaveMomentum=!0),this._preventScrollEvent=!1,this._debouncerScrollFinish=S.dx.debounce(this._debouncerScrollFinish,C.Wc.after(200),(()=>{const e=this.$.scroller.getBoundingClientRect();this._isVisible(this._buffers[0],e)||this._isVisible(this._buffers[1],e)||(this.position=this.position)}))}_reset(){this._scrollDisabled=!0,this.$.scroller.scrollTop=this._initialScroll,this._buffers[0].translateY=this._initialScroll-this._bufferHeight,this._buffers[1].translateY=this._initialScroll,this._buffers.forEach((e=>{e.style.transform=`translate3d(0, ${e.translateY}px, 0)`})),this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones(!0),this._debouncerUpdateClones=S.dx.debounce(this._debouncerUpdateClones,C.Wc.after(200),(()=>{this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones()})),this._scrollDisabled=!1}_createPool(){const e=this.getBoundingClientRect();this._buffers.forEach((t=>{for(let s=0;s<this.bufferSize;s++){const s=document.createElement("div");s.style.height=`${this.itemHeight}px`,s.instance={};const i=`vaadin-infinite-scroller-item-content-${(0,T.l)()}`,a=document.createElement("slot");a.setAttribute("name",i),a._itemWrapper=s,t.appendChild(a),s.setAttribute("slot",i),this.appendChild(s),this._isVisible(s,e)&&this._ensureStampedInstance(s)}})),requestAnimationFrame((()=>{this._finishInit()}))}_ensureStampedInstance(e){if(e.firstElementChild)return;const t=e.instance;e.instance=this._createElement(),e.appendChild(e.instance),Object.keys(t).forEach((s=>{e.instance[s]=t[s]}))}_updateClones(e){this._firstIndex=~~((this._buffers[0].translateY-this._initialScroll)/this.itemHeight)+this._initialIndex;const t=e?this.$.scroller.getBoundingClientRect():void 0;this._buffers.forEach(((s,i)=>{if(!s.updated){const a=this._firstIndex+this.bufferSize*i;[...s.children].forEach(((s,i)=>{const n=s._itemWrapper;e&&!this._isVisible(n,t)||this._updateElement(n.instance,a+i)})),s.updated=!0}}))}_isVisible(e,t){const s=e.getBoundingClientRect();return s.bottom>t.top&&s.top<t.bottom}}const P=document.createElement("template");P.innerHTML="\n <style>\n :host {\n --vaadin-infinite-scroller-item-height: 270px;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n }\n </style>\n",(0,d.M)(class extends M{static get is(){return"vaadin-date-picker-month-scroller"}constructor(){super(),this.bufferSize=3,this.shadowRoot.appendChild(P.content.cloneNode(!0))}_createElement(){return document.createElement("vaadin-month-calendar")}_updateElement(e,t){e.month=w(t)}});const I=document.createElement("template");I.innerHTML="\n <style>\n :host {\n --vaadin-infinite-scroller-item-height: 80px;\n width: 50px;\n display: block;\n height: 100%;\n position: absolute;\n right: 0;\n transform: translateX(100%);\n -webkit-tap-highlight-color: transparent;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n /* Center the year scroller position. */\n --vaadin-infinite-scroller-buffer-offset: 50%;\n }\n\n :host::before {\n content: '';\n display: block;\n background: transparent;\n width: 0;\n height: 0;\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n border-width: 6px;\n border-style: solid;\n border-color: transparent;\n border-left-color: #000;\n }\n </style>\n",(0,d.M)(class extends M{static get is(){return"vaadin-date-picker-year-scroller"}constructor(){super(),this.bufferSize=12,this.shadowRoot.appendChild(I.content.cloneNode(!0))}_createElement(){return document.createElement("vaadin-date-picker-year")}_updateElement(e,t){e.year=this._yearAfterXYears(t)}_yearAfterXYears(e){const t=new Date,s=new Date(t);return s.setFullYear(parseInt(e)+t.getFullYear()),s.getFullYear()}});class O extends((0,a.Tb)(h.H3)){static get is(){return"vaadin-date-picker-year"}static get template(){return h.dy`
413
+ <style>
414
+ :host {
415
+ display: block;
416
+ height: 100%;
417
+ }
418
+ </style>
419
+ <div part="year-number">[[year]]</div>
420
+ <div part="year-separator" aria-hidden="true"></div>
421
+ `}static get properties(){return{year:{type:String},selectedDate:{type:Object}}}static get observers(){return["__updateSelected(year, selectedDate)"]}__updateSelected(e,t){this.toggleAttribute("selected",t&&t.getFullYear()===e),this.toggleAttribute("current",e===(new Date).getFullYear())}}(0,d.M)(O),s(7894);var F=s(4933),A=s(1014);function H(e,t,s,i,a){let n;a&&(n="object"==typeof s&&null!==s,n&&(i=e.__dataTemp[t]));let o=i!==s&&(i==i||s==s);return n&&o&&(e.__dataTemp[t]=s),o}const Y=(0,A.o)((e=>class extends e{_shouldPropertyChange(e,t,s){return H(this,e,t,s,!0)}})),B=(0,A.o)((e=>class extends e{static get properties(){return{mutableData:Boolean}}_shouldPropertyChange(e,t,s){return H(this,e,t,s,this.mutableData)}}));Y._mutablePropertyChange=H;var N=s(9387),z=s(1342);let $=null;function L(){return $}L.prototype=Object.create(HTMLTemplateElement.prototype,{constructor:{value:L,writable:!0}});const W=(0,F.q)(L),R=Y(W),V=(0,F.q)(class{});class j extends V{constructor(e){super(),this._configureProperties(e),this.root=this._stampTemplate(this.__dataHost);let t=[];this.children=t;for(let e=this.root.firstChild;e;e=e.nextSibling)t.push(e),e.__templatizeInstance=this;this.__templatizeOwner&&this.__templatizeOwner.__hideTemplateChildren__&&this._showHideChildren(!0);let s=this.__templatizeOptions;(e&&s.instanceProps||!s.instanceProps)&&this._enableProperties()}_configureProperties(e){if(this.__templatizeOptions.forwardHostProp)for(let e in this.__hostProps)this._setPendingProperty(e,this.__dataHost["_host_"+e]);for(let t in e)this._setPendingProperty(t,e[t])}forwardHostProp(e,t){this._setPendingPropertyOrPath(e,t,!1,!0)&&this.__dataHost._enqueueClient(this)}_addEventListenerToNode(e,t,s){if(this._methodHost&&this.__templatizeOptions.parentModel)this._methodHost._addEventListenerToNode(e,t,(e=>{e.model=this,s(e)}));else{let i=this.__dataHost.__dataHost;i&&i._addEventListenerToNode(e,t,s)}}_showHideChildren(e){!function(e,t){for(let s=0;s<t.length;s++){let i=t[s];if(Boolean(e)!=Boolean(i.__hideTemplateChildren__))if(i.nodeType===Node.TEXT_NODE)e?(i.__polymerTextContent__=i.textContent,i.textContent=""):i.textContent=i.__polymerTextContent__;else if("slot"===i.localName)if(e)i.__polymerReplaced__=document.createComment("hidden-slot"),(0,z.r)((0,z.r)(i).parentNode).replaceChild(i.__polymerReplaced__,i);else{const e=i.__polymerReplaced__;e&&(0,z.r)((0,z.r)(e).parentNode).replaceChild(i,e)}else i.style&&(e?(i.__polymerDisplay__=i.style.display,i.style.display="none"):i.style.display=i.__polymerDisplay__);i.__hideTemplateChildren__=e,i._showHideChildren&&i._showHideChildren(e)}}(e,this.children)}_setUnmanagedPropertyToNode(e,t,s){e.__hideTemplateChildren__&&e.nodeType==Node.TEXT_NODE&&"textContent"==t?e.__polymerTextContent__=s:super._setUnmanagedPropertyToNode(e,t,s)}get parentModel(){let e=this.__parentModel;if(!e){let t;e=this;do{e=e.__dataHost.__dataHost}while((t=e.__templatizeOptions)&&!t.parentModel);this.__parentModel=e}return e}dispatchEvent(e){return!0}}j.prototype.__dataHost,j.prototype.__templatizeOptions,j.prototype._methodHost,j.prototype.__templatizeOwner,j.prototype.__hostProps;const q=Y(j);function K(e){let t=e.__dataHost;return t&&t._methodHost||t}function X(e,t){return function(e,s,i){t.call(e.__templatizeOwner,s.substring(6),i[s])}}function U(e,t){return function(e,s,i){t.call(e.__templatizeOwner,e,s,i[s])}}function Q(e,t,s){if(N.XN&&!K(e))throw new Error("strictTemplatePolicy: template owner not trusted");if(s=s||{},e.__templatizeOwner)throw new Error("A <template> can only be templatized once");e.__templatizeOwner=t;let i=(t?t.constructor:j)._parseTemplate(e),a=i.templatizeInstanceClass;a||(a=function(e,t,s){let i=s.mutableData?q:j;Q.mixin&&(i=Q.mixin(i));let a=class extends i{};return a.prototype.__templatizeOptions=s,a.prototype._bindTemplate(e),function(e,t,s,i){let a=s.hostProps||{};for(let t in i.instanceProps){delete a[t];let s=i.notifyInstanceProp;s&&e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:U(0,s)})}if(i.forwardHostProp&&t.__dataHost)for(let t in a)s.hasHostProps||(s.hasHostProps=!0),e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:function(e,t,s){e.__dataHost._setPendingPropertyOrPath("_host_"+t,s[t],!0,!0)}})}(a,e,t,s),a}(e,i,s),i.templatizeInstanceClass=a);const n=K(e);!function(e,t,s,i){let a=s.forwardHostProp;if(a&&t.hasHostProps){const n="template"==e.localName;let o=t.templatizeTemplateClass;if(!o){if(n){let e=s.mutableData?R:W;class i extends e{}o=t.templatizeTemplateClass=i}else{const s=e.constructor;class i extends s{}o=t.templatizeTemplateClass=i}let r=t.hostProps;for(let e in r)o.prototype._addPropertyEffect("_host_"+e,o.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,{fn:X(0,a)}),o.prototype._createNotifyingProperty("_host_"+e);N.a2&&i&&function(e,t,s){const i=s.constructor._properties,{propertyEffects:a}=e,{instanceProps:n}=t;for(let e in a)if(!(i[e]||n&&n[e])){const t=a[e];for(let s=0;s<t.length;s++){const{part:i}=t[s].info;if(!i.signature||!i.signature.static){console.warn(`Property '${e}' used in template but not declared in 'properties'; attribute will not be observed.`);break}}}}(t,s,i)}if(e.__dataProto&&Object.assign(e.__data,e.__dataProto),n)!function(e,t){$=e,Object.setPrototypeOf(e,t.prototype),new t,$=null}(e,o),e.__dataTemp={},e.__dataPending=null,e.__dataOld=null,e._enableProperties();else{Object.setPrototypeOf(e,o.prototype);const s=t.hostProps;for(let t in s)if(t="_host_"+t,t in e){const s=e[t];delete e[t],e.__data[t]=s}}}}(e,i,s,n);let o=class extends a{};return o.prototype._methodHost=n,o.prototype.__dataHost=e,o.prototype.__templatizeOwner=t,o.prototype.__hostProps=i.hostProps,o}var J=s(2224);class G{constructor(){this._asyncModule=null,this._callback=null,this._timer=null}setConfig(e,t){this._asyncModule=e,this._callback=t,this._timer=this._asyncModule.run((()=>{this._timer=null,Z.delete(this),this._callback()}))}cancel(){this.isActive()&&(this._cancelAsync(),Z.delete(this))}_cancelAsync(){this.isActive()&&(this._asyncModule.cancel(this._timer),this._timer=null)}flush(){this.isActive()&&(this.cancel(),this._callback())}isActive(){return null!=this._timer}static debounce(e,t,s){return e instanceof G?e._cancelAsync():e=new G,e.setConfig(t,s),e}}let Z=new Set;const ee=function(){const e=Boolean(Z.size);return Z.forEach((e=>{try{e.flush()}catch(e){setTimeout((()=>{throw e}))}})),e},te=function(){let e,t;do{e=window.ShadyDOM&&ShadyDOM.flush(),window.ShadyCSS&&window.ShadyCSS.ScopingShim&&window.ShadyCSS.ScopingShim.flush(),t=ee()}while(e||t)};var se=s(1446);let ie=!1;const ae=B(h.H3);class ne extends ae{static get is(){return"dom-repeat"}static get template(){return null}static get properties(){return{items:{type:Array},as:{type:String,value:"item"},indexAs:{type:String,value:"index"},itemsIndexAs:{type:String,value:"itemsIndex"},sort:{type:Function,observer:"__sortChanged"},filter:{type:Function,observer:"__filterChanged"},observe:{type:String,observer:"__observeChanged"},delay:Number,renderedItemCount:{type:Number,notify:!N.dJ,readOnly:!0},initialCount:{type:Number},targetFramerate:{type:Number,value:20},_targetFrameTime:{type:Number,computed:"__computeFrameTime(targetFramerate)"},notifyDomChange:{type:Boolean},reuseChunkedInstances:{type:Boolean}}}static get observers(){return["__itemsChanged(items.*)"]}constructor(){super(),this.__instances=[],this.__renderDebouncer=null,this.__itemsIdxToInstIdx={},this.__chunkCount=null,this.__renderStartTime=null,this.__itemsArrayChanged=!1,this.__shouldMeasureChunk=!1,this.__shouldContinueChunking=!1,this.__chunkingId=0,this.__sortFn=null,this.__filterFn=null,this.__observePaths=null,this.__ctor=null,this.__isDetached=!0,this.template=null,this._templateInfo}disconnectedCallback(){super.disconnectedCallback(),this.__isDetached=!0;for(let e=0;e<this.__instances.length;e++)this.__detachInstance(e);this.__chunkingId&&cancelAnimationFrame(this.__chunkingId)}connectedCallback(){if(super.connectedCallback(),function(){if(N.nL&&!N.my){if(!ie){ie=!0;const e=document.createElement("style");e.textContent="dom-bind,dom-if,dom-repeat{display:none;}",document.head.appendChild(e)}return!0}return!1}()||(this.style.display="none"),this.__isDetached){this.__isDetached=!1;let e=(0,z.r)((0,z.r)(this).parentNode);for(let t=0;t<this.__instances.length;t++)this.__attachInstance(t,e);this.__chunkingId&&this.__render()}}__ensureTemplatized(){if(!this.__ctor){const e=this;let t=this.template=e._templateInfo?e:this.querySelector("template");if(!t){let e=new MutationObserver((()=>{if(!this.querySelector("template"))throw new Error("dom-repeat requires a <template> child");e.disconnect(),this.__render()}));return e.observe(this,{childList:!0}),!1}let s={};s[this.as]=!0,s[this.indexAs]=!0,s[this.itemsIndexAs]=!0,this.__ctor=Q(t,this,{mutableData:this.mutableData,parentModel:!0,instanceProps:s,forwardHostProp:function(e,t){let s=this.__instances;for(let i,a=0;a<s.length&&(i=s[a]);a++)i.forwardHostProp(e,t)},notifyInstanceProp:function(e,t,s){if((0,se.wB)(this.as,t)){let i=e[this.itemsIndexAs];t==this.as&&(this.items[i]=s);let a=(0,se.Iu)(this.as,`${JSCompiler_renameProperty("items",this)}.${i}`,t);this.notifyPath(a,s)}}})}return!0}__getMethodHost(){return this.__dataHost._methodHost||this.__dataHost}__functionFromPropertyValue(e){if("string"==typeof e){let t=e,s=this.__getMethodHost();return function(){return s[t].apply(s,arguments)}}return e}__sortChanged(e){this.__sortFn=this.__functionFromPropertyValue(e),this.items&&this.__debounceRender(this.__render)}__filterChanged(e){this.__filterFn=this.__functionFromPropertyValue(e),this.items&&this.__debounceRender(this.__render)}__computeFrameTime(e){return Math.ceil(1e3/e)}__observeChanged(){this.__observePaths=this.observe&&this.observe.replace(".*",".").split(" ")}__handleObservedPaths(e){if(this.__sortFn||this.__filterFn)if(e){if(this.__observePaths){let t=this.__observePaths;for(let s=0;s<t.length;s++)0===e.indexOf(t[s])&&this.__debounceRender(this.__render,this.delay)}}else this.__debounceRender(this.__render,this.delay)}__itemsChanged(e){this.items&&!Array.isArray(this.items)&&console.warn("dom-repeat expected array for `items`, found",this.items),this.__handleItemPath(e.path,e.value)||("items"===e.path&&(this.__itemsArrayChanged=!0),this.__debounceRender(this.__render))}__debounceRender(e,t=0){var s;this.__renderDebouncer=G.debounce(this.__renderDebouncer,t>0?J.Wc.after(t):J.YA,e.bind(this)),s=this.__renderDebouncer,Z.add(s)}render(){this.__debounceRender(this.__render),te()}__render(){if(!this.__ensureTemplatized())return;let e=this.items||[];const t=this.__sortAndFilterItems(e),s=this.__calculateLimit(t.length);this.__updateInstances(e,s,t),this.initialCount&&(this.__shouldMeasureChunk||this.__shouldContinueChunking)&&(cancelAnimationFrame(this.__chunkingId),this.__chunkingId=requestAnimationFrame((()=>{this.__chunkingId=null,this.__continueChunking()}))),this._setRenderedItemCount(this.__instances.length),N.dJ&&!this.notifyDomChange||this.dispatchEvent(new CustomEvent("dom-change",{bubbles:!0,composed:!0}))}__sortAndFilterItems(e){let t=new Array(e.length);for(let s=0;s<e.length;s++)t[s]=s;return this.__filterFn&&(t=t.filter(((t,s,i)=>this.__filterFn(e[t],s,i)))),this.__sortFn&&t.sort(((t,s)=>this.__sortFn(e[t],e[s]))),t}__calculateLimit(e){let t=e;const s=this.__instances.length;if(this.initialCount){let i;!this.__chunkCount||this.__itemsArrayChanged&&!this.reuseChunkedInstances?(t=Math.min(e,this.initialCount),i=Math.max(t-s,0),this.__chunkCount=i||1):(i=Math.min(Math.max(e-s,0),this.__chunkCount),t=Math.min(s+i,e)),this.__shouldMeasureChunk=i===this.__chunkCount,this.__shouldContinueChunking=t<e,this.__renderStartTime=performance.now()}return this.__itemsArrayChanged=!1,t}__continueChunking(){if(this.__shouldMeasureChunk){const e=performance.now()-this.__renderStartTime,t=this._targetFrameTime/e;this.__chunkCount=Math.round(this.__chunkCount*t)||1}this.__shouldContinueChunking&&this.__debounceRender(this.__render)}__updateInstances(e,t,s){const i=this.__itemsIdxToInstIdx={};let a;for(a=0;a<t;a++){let t=this.__instances[a],n=s[a],o=e[n];i[n]=a,t?(t._setPendingProperty(this.as,o),t._setPendingProperty(this.indexAs,a),t._setPendingProperty(this.itemsIndexAs,n),t._flushProperties()):this.__insertInstance(o,a,n)}for(let e=this.__instances.length-1;e>=a;e--)this.__detachAndRemoveInstance(e)}__detachInstance(e){let t=this.__instances[e];const s=(0,z.r)(t.root);for(let e=0;e<t.children.length;e++){let i=t.children[e];s.appendChild(i)}return t}__attachInstance(e,t){let s=this.__instances[e];t.insertBefore(s.root,this)}__detachAndRemoveInstance(e){this.__detachInstance(e),this.__instances.splice(e,1)}__stampInstance(e,t,s){let i={};return i[this.as]=e,i[this.indexAs]=t,i[this.itemsIndexAs]=s,new this.__ctor(i)}__insertInstance(e,t,s){const i=this.__stampInstance(e,t,s);let a=this.__instances[t+1],n=a?a.children[0]:this;return(0,z.r)((0,z.r)(this).parentNode).insertBefore(i.root,n),this.__instances[t]=i,i}_showHideChildren(e){for(let t=0;t<this.__instances.length;t++)this.__instances[t]._showHideChildren(e)}__handleItemPath(e,t){let s=e.slice(6),i=s.indexOf("."),a=i<0?s:s.substring(0,i);if(a==parseInt(a,10)){let e=i<0?"":s.substring(i+1);this.__handleObservedPaths(e);let n=this.__itemsIdxToInstIdx[a],o=this.__instances[n];if(o){let s=this.as+(e?"."+e:"");o._setPendingPropertyOrPath(s,t,!1,!0),o._flushProperties()}return!0}}itemForElement(e){let t=this.modelForElement(e);return t&&t[this.as]}indexForElement(e){let t=this.modelForElement(e);return t&&t[this.indexAs]}modelForElement(e){return function(e,t){let s;for(;t;)if(s=t.__dataHost?t:t.__templatizeInstance){if(s.__dataHost==e)return s;t=s.__dataHost}else t=(0,z.r)(t).parentNode;return null}(this.template,e)}}customElements.define(ne.is,ne);var oe=s(1360),re=s(9109);const le=e=>class extends((0,oe.W)(e)){static get properties(){return{month:{type:Object,value:new Date,sync:!0},selectedDate:{type:Object,notify:!0,sync:!0},focusedDate:{type:Object},showWeekNumbers:{type:Boolean,value:!1},i18n:{type:Object},ignoreTaps:{type:Boolean},minDate:{type:Date,value:null,sync:!0},maxDate:{type:Date,value:null,sync:!0},disabled:{type:Boolean,reflectToAttribute:!0},_days:{type:Array},_weeks:{type:Array},_notTapping:{type:Boolean}}}static get observers(){return["__focusedDateChanged(focusedDate, _days)"]}get focusableDateElement(){return[...this.shadowRoot.querySelectorAll("[part~=date]")].find((e=>g(e.date,this.focusedDate)))}ready(){super.ready(),(0,re.NH)(this.$.monthGrid,"tap",this._handleTap.bind(this))}_isDisabled(e,t,s){const i=new Date(0,0);i.setFullYear(e.getFullYear()),i.setMonth(e.getMonth()),i.setDate(1);const a=new Date(0,0);return a.setFullYear(e.getFullYear()),a.setMonth(e.getMonth()+1),a.setDate(0),!(t&&s&&t.getMonth()===s.getMonth()&&t.getMonth()===e.getMonth()&&s.getDate()-t.getDate()>=0||b(i,t,s)||b(a,t,s))}_getTitle(e,t){if(void 0!==e&&void 0!==t)return t.formatTitle(t.monthNames[e.getMonth()],e.getFullYear())}_onMonthGridTouchStart(){this._notTapping=!1,setTimeout((()=>{this._notTapping=!0}),300)}_dateAdd(e,t){e.setDate(e.getDate()+t)}_applyFirstDayOfWeek(e,t){if(void 0!==e&&void 0!==t)return e.slice(t).concat(e.slice(0,t))}_getWeekDayNames(e,t){if(void 0===e||void 0===t)return[];const{weekdays:s,weekdaysShort:i,firstDayOfWeek:a}=e,n=this._applyFirstDayOfWeek(i,a);return this._applyFirstDayOfWeek(s,a).map(((e,t)=>({weekDay:e,weekDayShort:n[t]})))}__focusedDateChanged(e,t){Array.isArray(t)&&t.some((t=>g(t,e)))?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true")}_getDate(e){return e?e.getDate():""}_showWeekSeparator(e,t){return e&&t&&1===t.firstDayOfWeek}_isToday(e){return g(new Date,e)}_getDays(e,t){if(void 0===e||void 0===t)return[];const s=new Date(0,0);for(s.setFullYear(e.getFullYear()),s.setMonth(e.getMonth()),s.setDate(1);s.getDay()!==t.firstDayOfWeek;)this._dateAdd(s,-1);const i=[],a=s.getMonth(),n=e.getMonth();for(;s.getMonth()===n||s.getMonth()===a;)i.push(s.getMonth()===n?new Date(s.getTime()):null),this._dateAdd(s,1);return i}_getWeeks(e){return e.reduce(((e,t,s)=>(s%7==0&&e.push([]),e[e.length-1].push(t),e)),[])}_handleTap(e){this.ignoreTaps||this._notTapping||!e.target.date||e.target.hasAttribute("disabled")||(this.selectedDate=e.target.date,this.dispatchEvent(new CustomEvent("date-tap",{detail:{date:e.target.date},bubbles:!0,composed:!0})))}_preventDefault(e){e.preventDefault()}__getWeekNumber(e){return function(e){let t=e.getDay();0===t&&(t=7);const s=4-t,i=new Date(e.getTime()+24*s*3600*1e3),a=new Date(0,0);a.setFullYear(i.getFullYear());const n=i.getTime()-a.getTime(),o=Math.round(n/864e5);return Math.floor(o/7+1)}(e.reduce(((e,t)=>!e&&t?t:e)))}__getDayAriaLabel(e){if(!e)return"";let t=`${this._getDate(e)} ${this.i18n.monthNames[e.getMonth()]} ${e.getFullYear()}, ${this.i18n.weekdays[e.getDay()]}`;return this._isToday(e)&&(t+=`, ${this.i18n.today}`),t}},he=m.iv`
422
+ :host {
423
+ display: block;
424
+ }
425
+
426
+ #monthGrid {
427
+ width: 100%;
428
+ border-collapse: collapse;
429
+ }
430
+
431
+ #days-container tr,
432
+ #weekdays-container tr {
433
+ display: flex;
434
+ }
435
+
436
+ [part~='date'] {
437
+ outline: none;
438
+ }
439
+
440
+ [part~='disabled'] {
441
+ pointer-events: none;
442
+ }
443
+
444
+ [part='week-number'][hidden],
445
+ [part='weekday'][hidden] {
446
+ display: none;
447
+ }
448
+
449
+ [part='weekday'],
450
+ [part~='date'] {
451
+ width: calc(100% / 7);
452
+ padding: 0;
453
+ font-weight: normal;
454
+ }
455
+
456
+ [part='weekday']:empty,
457
+ [part='week-number'] {
458
+ width: 12.5%;
459
+ flex-shrink: 0;
460
+ padding: 0;
461
+ }
462
+
463
+ :host([week-numbers]) [part='weekday']:not(:empty),
464
+ :host([week-numbers]) [part~='date'] {
465
+ width: 12.5%;
466
+ }
467
+
468
+ @media (forced-colors: active) {
469
+ [part~='date'][part~='focused'] {
470
+ outline: 1px solid;
471
+ }
472
+
473
+ [part~='date'][part~='selected'] {
474
+ outline: 3px solid;
475
+ }
476
+ }
477
+ `;(0,a.hC)("vaadin-month-calendar",he,{moduleId:"vaadin-month-calendar-styles"});class de extends(le((0,a.Tb)(h.H3))){static get template(){return h.dy`
478
+ <div part="month-header" id="month-header" aria-hidden="true">[[_getTitle(month, i18n)]]</div>
479
+ <table
480
+ id="monthGrid"
481
+ role="grid"
482
+ aria-labelledby="month-header"
483
+ on-touchend="_preventDefault"
484
+ on-touchstart="_onMonthGridTouchStart"
485
+ >
486
+ <thead id="weekdays-container">
487
+ <tr role="row" part="weekdays">
488
+ <th part="weekday" aria-hidden="true" hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n)]]"></th>
489
+ <template is="dom-repeat" items="[[_getWeekDayNames(i18n, showWeekNumbers)]]">
490
+ <th role="columnheader" part="weekday" scope="col" abbr$="[[item.weekDay]]" aria-hidden="true">
491
+ [[item.weekDayShort]]
492
+ </th>
493
+ </template>
494
+ </tr>
495
+ </thead>
496
+ <tbody id="days-container">
497
+ <template is="dom-repeat" items="[[_weeks]]" as="week">
498
+ <tr role="row">
499
+ <td part="week-number" aria-hidden="true" hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n)]]">
500
+ [[__getWeekNumber(week)]]
501
+ </td>
502
+ <template is="dom-repeat" items="[[week]]">
503
+ <td
504
+ role="gridcell"
505
+ part$="[[__getDatePart(item, focusedDate, selectedDate, minDate, maxDate)]]"
506
+ date="[[item]]"
507
+ tabindex$="[[__getDayTabindex(item, focusedDate)]]"
508
+ disabled$="[[__isDayDisabled(item, minDate, maxDate)]]"
509
+ aria-selected$="[[__getDayAriaSelected(item, selectedDate)]]"
510
+ aria-disabled$="[[__getDayAriaDisabled(item, minDate, maxDate)]]"
511
+ aria-label$="[[__getDayAriaLabel(item)]]"
512
+ >[[_getDate(item)]]</td
513
+ >
514
+ </template>
515
+ </tr>
516
+ </template>
517
+ </tbody>
518
+ </table>
519
+ `}static get is(){return"vaadin-month-calendar"}static get properties(){return{_days:{type:Array,computed:"_getDays(month, i18n, minDate, maxDate)"},_weeks:{type:Array,computed:"_getWeeks(_days)"},disabled:{type:Boolean,reflectToAttribute:!0,computed:"_isDisabled(month, minDate, maxDate)"}}}static get observers(){return["_showWeekNumbersChanged(showWeekNumbers, i18n)"]}_showWeekNumbersChanged(e,t){e&&t&&1===t.firstDayOfWeek?this.setAttribute("week-numbers",""):this.removeAttribute("week-numbers")}__getDatePart(e,t,s,i,a){const n=["date"];return this.__isDayDisabled(e,i,a)&&n.push("disabled"),this.__isDayFocused(e,t)&&n.push("focused"),this.__isDaySelected(e,s)&&n.push("selected"),this._isToday(e)&&n.push("today"),n.join(" ")}__isDayFocused(e,t){return g(e,t)}__isDaySelected(e,t){return g(e,t)}__getDayAriaSelected(e,t){if(this.__isDaySelected(e,t))return"true"}__isDayDisabled(e,t,s){return!b(e,t,s)}__getDayAriaDisabled(e,t,s){if(void 0!==e&&void 0!==t&&void 0!==s)return this.__isDayDisabled(e,t,s)?"true":void 0}__getDayTabindex(e,t){return this.__isDayFocused(e,t)?"0":"-1"}}(0,d.M)(de);var ce=s(6155),ue=s(2223);class _e{constructor(e,t){this.query=e,this.callback=t,this._boundQueryHandler=this._queryHandler.bind(this)}hostConnected(){this._removeListener(),this._mediaQuery=window.matchMedia(this.query),this._addListener(),this._queryHandler(this._mediaQuery)}hostDisconnected(){this._removeListener()}_addListener(){this._mediaQuery&&this._mediaQuery.addListener(this._boundQueryHandler)}_removeListener(){this._mediaQuery&&this._mediaQuery.removeListener(this._boundQueryHandler),this._mediaQuery=null}_queryHandler(e){"function"==typeof this.callback&&this.callback(e.matches)}}var pe=s(9229);const me=e=>class extends e{static get properties(){return{scrollDuration:{type:Number,value:300},selectedDate:{type:Object,value:null,sync:!0},focusedDate:{type:Object,notify:!0,observer:"_focusedDateChanged",sync:!0},_focusedMonthDate:Number,initialPosition:{type:Object,observer:"_initialPositionChanged"},_originDate:{type:Object,value:new Date},_visibleMonthIndex:Number,_desktopMode:{type:Boolean,observer:"_desktopModeChanged"},_desktopMediaQuery:{type:String,value:"(min-width: 375px)"},_translateX:{observer:"_translateXChanged"},_yearScrollerWidth:{value:50},i18n:{type:Object},showWeekNumbers:{type:Boolean,value:!1},_ignoreTaps:Boolean,_notTapping:Boolean,minDate:{type:Object,sync:!0},maxDate:{type:Object,sync:!0},label:String,_cancelButton:{type:Object},_todayButton:{type:Object},calendars:{type:Array,value:()=>[]},years:{type:Array,value:()=>[]}}}static get observers(){return["__updateCalendars(calendars, i18n, minDate, maxDate, selectedDate, focusedDate, showWeekNumbers, _ignoreTaps, _theme)","__updateCancelButton(_cancelButton, i18n)","__updateTodayButton(_todayButton, i18n, minDate, maxDate)","__updateYears(years, selectedDate, _theme)"]}get __useSubMonthScrolling(){return this._monthScroller.clientHeight<this._monthScroller.itemHeight+this._monthScroller.bufferOffset}get focusableDateElement(){return this.calendars.map((e=>e.focusableDateElement)).find(Boolean)}_addListeners(){(0,re.BP)(this.$.scrollers,"pan-y"),(0,re.NH)(this.$.scrollers,"track",this._track.bind(this)),(0,re.NH)(this.shadowRoot.querySelector('[part="clear-button"]'),"tap",this._clear.bind(this)),(0,re.NH)(this.shadowRoot.querySelector('[part="toggle-button"]'),"tap",this._cancel.bind(this)),(0,re.NH)(this.shadowRoot.querySelector('[part="years-toggle-button"]'),"tap",this._toggleYearScroller.bind(this))}_initControllers(){this.addController(new _e(this._desktopMediaQuery,(e=>{this._desktopMode=e}))),this.addController(new pe.n(this,"today-button","vaadin-button",{observe:!1,initializer:e=>{e.setAttribute("theme","tertiary"),e.addEventListener("keydown",(e=>this.__onTodayButtonKeyDown(e))),(0,re.NH)(e,"tap",this._onTodayTap.bind(this)),this._todayButton=e}})),this.addController(new pe.n(this,"cancel-button","vaadin-button",{observe:!1,initializer:e=>{e.setAttribute("theme","tertiary"),e.addEventListener("keydown",(e=>this.__onCancelButtonKeyDown(e))),(0,re.NH)(e,"tap",this._cancel.bind(this)),this._cancelButton=e}})),this.__initMonthScroller(),this.__initYearScroller()}reset(){this._closeYearScroller(),this._toggleAnimateClass(!0)}focusCancel(){this._cancelButton.focus()}scrollToDate(e,t){const s=this.__useSubMonthScrolling?this._calculateWeekScrollOffset(e):0;this._scrollToPosition(this._differenceInMonths(e,this._originDate)+s,t),this._monthScroller.forceUpdate()}__initMonthScroller(){this.addController(new pe.n(this,"months","vaadin-date-picker-month-scroller",{observe:!1,initializer:e=>{e.addEventListener("custom-scroll",(()=>{this._onMonthScroll()})),e.addEventListener("touchstart",(()=>{this._onMonthScrollTouchStart()})),e.addEventListener("keydown",(e=>{this.__onMonthCalendarKeyDown(e)})),e.addEventListener("init-done",(()=>{const e=[...this.querySelectorAll("vaadin-month-calendar")];e.forEach((e=>{e.addEventListener("selected-date-changed",(e=>{this.selectedDate=e.detail.value}))})),this.calendars=e})),this._monthScroller=e}}))}__initYearScroller(){this.addController(new pe.n(this,"years","vaadin-date-picker-year-scroller",{observe:!1,initializer:e=>{e.setAttribute("aria-hidden","true"),(0,re.NH)(e,"tap",(e=>{this._onYearTap(e)})),e.addEventListener("custom-scroll",(()=>{this._onYearScroll()})),e.addEventListener("touchstart",(()=>{this._onYearScrollTouchStart()})),e.addEventListener("init-done",(()=>{this.years=[...this.querySelectorAll("vaadin-date-picker-year")]})),this._yearScroller=e}}))}__updateCancelButton(e,t){e&&(e.textContent=t&&t.cancel)}__updateTodayButton(e,t,s,i){e&&(e.textContent=t&&t.today,e.disabled=!this._isTodayAllowed(s,i))}__updateCalendars(e,t,s,i,a,n,o,r,l){e&&e.length&&e.forEach((e=>{e.i18n=t,e.minDate=s,e.maxDate=i,e.focusedDate=n,e.selectedDate=a,e.showWeekNumbers=o,e.ignoreTaps=r,l?e.setAttribute("theme",l):e.removeAttribute("theme")}))}__updateYears(e,t,s){e&&e.length&&e.forEach((e=>{e.selectedDate=t,s?e.setAttribute("theme",s):e.removeAttribute("theme")}))}_selectDate(e){this.selectedDate=e,this.dispatchEvent(new CustomEvent("date-selected",{detail:{date:e},bubbles:!0,composed:!0}))}_desktopModeChanged(e){this.toggleAttribute("desktop",e)}_focusedDateChanged(e){this.revealDate(e)}revealDate(e,t=!0){if(!e)return;const s=this._differenceInMonths(e,this._originDate);if(this.__useSubMonthScrolling){const i=this._calculateWeekScrollOffset(e);return void this._scrollToPosition(s+i,t)}const i=this._monthScroller.position>s,a=Math.max(this._monthScroller.itemHeight,this._monthScroller.clientHeight-2*this._monthScroller.bufferOffset)/this._monthScroller.itemHeight,n=this._monthScroller.position+a-1<s;i?this._scrollToPosition(s,t):n&&this._scrollToPosition(s-a+1,t)}_calculateWeekScrollOffset(e){const t=new Date(0,0);t.setFullYear(e.getFullYear()),t.setMonth(e.getMonth()),t.setDate(1);let s=0;for(;t.getDate()<e.getDate();)t.setDate(t.getDate()+1),t.getDay()===this.i18n.firstDayOfWeek&&(s+=1);return s/6}_initialPositionChanged(e){this._monthScroller&&this._yearScroller&&(this._monthScroller.active=!0,this._yearScroller.active=!0),this.scrollToDate(e)}_repositionYearScroller(){const e=this._monthScroller.position;this._visibleMonthIndex=Math.floor(e),this._yearScroller.position=(e+this._originDate.getMonth())/12}_repositionMonthScroller(){this._monthScroller.position=12*this._yearScroller.position-this._originDate.getMonth(),this._visibleMonthIndex=Math.floor(this._monthScroller.position)}_onMonthScroll(){this._repositionYearScroller(),this._doIgnoreTaps()}_onYearScroll(){this._repositionMonthScroller(),this._doIgnoreTaps()}_onYearScrollTouchStart(){this._notTapping=!1,setTimeout((()=>{this._notTapping=!0}),300),this._repositionMonthScroller()}_onMonthScrollTouchStart(){this._repositionYearScroller()}_doIgnoreTaps(){this._ignoreTaps=!0,this._debouncer=S.dx.debounce(this._debouncer,C.Wc.after(300),(()=>{this._ignoreTaps=!1}))}_formatDisplayed(e,t,s){return e&&t&&"function"==typeof t.formatDate?t.formatDate(D(e)):s}_onTodayTap(){const e=new Date;Math.abs(this._monthScroller.position-this._differenceInMonths(e,this._originDate))<.001?(this._selectDate(e),this._close()):this._scrollToCurrentMonth()}_scrollToCurrentMonth(){this.focusedDate&&(this.focusedDate=new Date),this.scrollToDate(new Date,!0)}_onYearTap(e){if(!this._ignoreTaps&&!this._notTapping){const t=(e.detail.y-(this._yearScroller.getBoundingClientRect().top+this._yearScroller.clientHeight/2))/this._yearScroller.itemHeight;this._scrollToPosition(this._monthScroller.position+12*t,!0)}}_scrollToPosition(e,t){if(void 0!==this._targetPosition)return void(this._targetPosition=e);if(!t)return this._monthScroller.position=e,this._targetPosition=void 0,this._repositionYearScroller(),void this.__tryFocusDate();let s;this._targetPosition=e,this._revealPromise=new Promise((e=>{s=e}));let i=0;const a=this._monthScroller.position,n=e=>{i||(i=e);const t=e-i;if(t<this.scrollDuration){const e=(o=t,r=a,l=this._targetPosition-a,(o/=this.scrollDuration/2)<1?l/2*o*o+r:-l/2*((o-=1)*(o-2)-1)+r);this._monthScroller.position=e,window.requestAnimationFrame(n)}else this.dispatchEvent(new CustomEvent("scroll-animation-finished",{bubbles:!0,composed:!0,detail:{position:this._targetPosition,oldPosition:a}})),this._monthScroller.position=this._targetPosition,this._targetPosition=void 0,s(),this._revealPromise=void 0;var o,r,l;setTimeout(this._repositionYearScroller.bind(this),1)};window.requestAnimationFrame(n)}_limit(e,t){return Math.min(t.max,Math.max(t.min,e))}_handleTrack(e){if(Math.abs(e.detail.dx)<10||Math.abs(e.detail.ddy)>10)return;Math.abs(e.detail.ddx)>this._yearScrollerWidth/3&&this._toggleAnimateClass(!0);const t=this._translateX+e.detail.ddx;this._translateX=this._limit(t,{min:0,max:this._yearScrollerWidth})}_track(e){if(!this._desktopMode)switch(e.detail.state){case"start":this._toggleAnimateClass(!1);break;case"track":this._handleTrack(e);break;case"end":this._toggleAnimateClass(!0),this._translateX>=this._yearScrollerWidth/2?this._closeYearScroller():this._openYearScroller()}}_toggleAnimateClass(e){e?this.classList.add("animate"):this.classList.remove("animate")}_toggleYearScroller(){this._isYearScrollerVisible()?this._closeYearScroller():this._openYearScroller()}_openYearScroller(){this._translateX=0,this.setAttribute("years-visible","")}_closeYearScroller(){this.removeAttribute("years-visible"),this._translateX=this._yearScrollerWidth}_isYearScrollerVisible(){return this._translateX<this._yearScrollerWidth/2}_translateXChanged(e){this._desktopMode||(this._monthScroller.style.transform=`translateX(${e-this._yearScrollerWidth}px)`,this._yearScroller.style.transform=`translateX(${e}px)`)}_yearAfterXMonths(e){return w(e).getFullYear()}_differenceInMonths(e,t){return 12*(e.getFullYear()-t.getFullYear())-t.getMonth()+e.getMonth()}_clear(){this._selectDate("")}_close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}_cancel(){this.focusedDate=this.selectedDate,this._close()}_preventDefault(e){e.preventDefault()}__toggleDate(e){g(e,this.selectedDate)?(this._clear(),this.focusedDate=e):this._selectDate(e)}__onMonthCalendarKeyDown(e){let t=!1;switch(e.key){case"ArrowDown":this._moveFocusByDays(7),t=!0;break;case"ArrowUp":this._moveFocusByDays(-7),t=!0;break;case"ArrowRight":this._moveFocusByDays(this.__isRTL?-1:1),t=!0;break;case"ArrowLeft":this._moveFocusByDays(this.__isRTL?1:-1),t=!0;break;case"Enter":this._selectDate(this.focusedDate),this._close(),t=!0;break;case" ":this.__toggleDate(this.focusedDate),t=!0;break;case"Home":this._moveFocusInsideMonth(this.focusedDate,"minDate"),t=!0;break;case"End":this._moveFocusInsideMonth(this.focusedDate,"maxDate"),t=!0;break;case"PageDown":this._moveFocusByMonths(e.shiftKey?12:1),t=!0;break;case"PageUp":this._moveFocusByMonths(e.shiftKey?-12:-1),t=!0;break;case"Tab":this._onTabKeyDown(e,"calendar")}t&&(e.preventDefault(),e.stopPropagation())}_onTabKeyDown(e,t){switch(e.stopPropagation(),t){case"calendar":e.shiftKey&&(e.preventDefault(),this.hasAttribute("fullscreen")?this.focusCancel():this.__focusInput());break;case"today":e.shiftKey&&(e.preventDefault(),this.focusDateElement());break;case"cancel":e.shiftKey||(e.preventDefault(),this.hasAttribute("fullscreen")?this.focusDateElement():this.__focusInput())}}__onTodayButtonKeyDown(e){"Tab"===e.key&&this._onTabKeyDown(e,"today")}__onCancelButtonKeyDown(e){"Tab"===e.key&&this._onTabKeyDown(e,"cancel")}__focusInput(){this.dispatchEvent(new CustomEvent("focus-input",{bubbles:!0,composed:!0}))}__tryFocusDate(){if(this.__pendingDateFocus){const e=this.focusableDateElement;e&&g(e.date,this.__pendingDateFocus)&&(delete this.__pendingDateFocus,e.focus())}}async focusDate(e,t){const s=e||this.selectedDate||this.initialPosition||new Date;this.focusedDate=s,t||(this._focusedMonthDate=s.getDate()),await this.focusDateElement(!1)}async focusDateElement(e=!0){this.__pendingDateFocus=this.focusedDate,this.calendars.length||await new Promise((e=>{(0,ue.T8)(this,(()=>{te(),e()}))})),e&&this.revealDate(this.focusedDate),this._revealPromise&&await this._revealPromise,this.__tryFocusDate()}_focusClosestDate(e){this.focusDate(v(e,[this.minDate,this.maxDate]))}_focusAllowedDate(e,t,s){this._dateAllowed(e)?this.focusDate(e,s):this._dateAllowed(this.focusedDate)?t>0?this.focusDate(this.maxDate):this.focusDate(this.minDate):this._focusClosestDate(this.focusedDate)}_getDateDiff(e,t){const s=new Date(0,0);return s.setFullYear(this.focusedDate.getFullYear()),s.setMonth(this.focusedDate.getMonth()+e),t&&s.setDate(this.focusedDate.getDate()+t),s}_moveFocusByDays(e){const t=this._getDateDiff(0,e);this._focusAllowedDate(t,e,!1)}_moveFocusByMonths(e){const t=this._getDateDiff(e),s=t.getMonth();this._focusedMonthDate||(this._focusedMonthDate=this.focusedDate.getDate()),t.setDate(this._focusedMonthDate),t.getMonth()!==s&&t.setDate(0),this._focusAllowedDate(t,e,!0)}_moveFocusInsideMonth(e,t){const s=new Date(0,0);s.setFullYear(e.getFullYear()),"minDate"===t?(s.setMonth(e.getMonth()),s.setDate(1)):(s.setMonth(e.getMonth()+1),s.setDate(0)),this._dateAllowed(s)?this.focusDate(s):this._dateAllowed(e)?this.focusDate(this[t]):this._focusClosestDate(e)}_dateAllowed(e,t=this.minDate,s=this.maxDate){return(!t||e>=t)&&(!s||e<=s)}_isTodayAllowed(e,t){const s=new Date,i=new Date(0,0);return i.setFullYear(s.getFullYear()),i.setMonth(s.getMonth()),i.setDate(s.getDate()),this._dateAllowed(i,e,t)}},fe=m.iv`
520
+ :host {
521
+ display: flex;
522
+ flex-direction: column;
523
+ height: 100%;
524
+ width: 100%;
525
+ outline: none;
526
+ }
527
+
528
+ [part='overlay-header'] {
529
+ display: flex;
530
+ flex-shrink: 0;
531
+ flex-wrap: nowrap;
532
+ align-items: center;
533
+ }
534
+
535
+ :host(:not([fullscreen])) [part='overlay-header'] {
536
+ display: none;
537
+ }
538
+
539
+ [part='label'] {
540
+ flex-grow: 1;
541
+ }
542
+
543
+ [hidden] {
544
+ display: none !important;
545
+ }
546
+
547
+ [part='years-toggle-button'] {
548
+ display: flex;
549
+ }
550
+
551
+ #scrollers {
552
+ display: flex;
553
+ height: 100%;
554
+ width: 100%;
555
+ position: relative;
556
+ overflow: hidden;
557
+ }
558
+
559
+ :host([desktop]) ::slotted([slot='months']) {
560
+ right: 50px;
561
+ transform: none !important;
562
+ }
563
+
564
+ :host([desktop]) ::slotted([slot='years']) {
565
+ transform: none !important;
566
+ }
567
+
568
+ :host(.animate) ::slotted([slot='months']),
569
+ :host(.animate) ::slotted([slot='years']) {
570
+ transition: all 200ms;
571
+ }
572
+
573
+ [part='toolbar'] {
574
+ display: flex;
575
+ justify-content: space-between;
576
+ z-index: 2;
577
+ flex-shrink: 0;
578
+ }
579
+ `;(0,a.hC)("vaadin-date-picker-overlay-content",fe,{moduleId:"vaadin-date-picker-overlay-content-styles"});class ye extends(me((0,ce.k)((0,a.Tb)((0,c.U)(h.H3))))){static get template(){return h.dy`
580
+ <div part="overlay-header" on-touchend="_preventDefault" aria-hidden="true">
581
+ <div part="label">[[_formatDisplayed(selectedDate, i18n, label)]]</div>
582
+ <div part="clear-button" hidden$="[[!selectedDate]]"></div>
583
+ <div part="toggle-button"></div>
584
+
585
+ <div part="years-toggle-button" hidden$="[[_desktopMode]]" aria-hidden="true">
586
+ [[_yearAfterXMonths(_visibleMonthIndex)]]
587
+ </div>
588
+ </div>
589
+
590
+ <div id="scrollers">
591
+ <slot name="months"></slot>
592
+ <slot name="years"></slot>
593
+ </div>
594
+
595
+ <div on-touchend="_preventDefault" role="toolbar" part="toolbar">
596
+ <slot name="today-button"></slot>
597
+ <slot name="cancel-button"></slot>
598
+ </div>
599
+ `}static get is(){return"vaadin-date-picker-overlay-content"}ready(){super.ready(),this.setAttribute("role","dialog"),this._addListeners(),this._initControllers()}}(0,d.M)(ye);var ge=s(2521),be=s(4463),ve=s(3398),De=s(3208),we=s(6729),ke=s(2743),Ce=s(962),xe=s(1370),Se=s(2628),Te=s(9320),Ee=s(9091),Me=s(9580);const Pe=e=>class extends((0,Te.u)((0,ce.k)((0,xe.B)((0,Ee.t)((0,Se.L)(e)))))){static get properties(){return{_selectedDate:{type:Object,sync:!0},_focusedDate:{type:Object,sync:!0},value:{type:String,notify:!0,value:"",sync:!0},initialPosition:String,opened:{type:Boolean,reflectToAttribute:!0,notify:!0,observer:"_openedChanged",sync:!0},autoOpenDisabled:Boolean,showWeekNumbers:{type:Boolean,value:!1,sync:!0},_fullscreen:{type:Boolean,value:!1,sync:!0},_fullscreenMediaQuery:{value:"(max-width: 420px), (max-height: 420px)"},i18n:{type:Object,sync:!0,value:()=>({monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],firstDayOfWeek:0,today:"Today",cancel:"Cancel",referenceDate:"",formatDate(e){const t=String(e.year).replace(/\d+/u,(e=>"0000".substr(e.length)+e));return[e.month+1,e.day,t].join("/")},parseDate(e){const t=e.split("/"),s=new Date;let i,a=s.getMonth(),n=s.getFullYear();if(3===t.length?(a=parseInt(t[0])-1,i=parseInt(t[1]),n=parseInt(t[2]),t[2].length<3&&n>=0&&(n=function(e,t,s=0,i=1){if(t>99)throw new Error("The provided year cannot have more than 2 digits.");if(t<0)throw new Error("The provided year cannot be negative.");let a=t+100*Math.floor(e.getFullYear()/100);return e<new Date(a-50,s,i)?a-=100:e>new Date(a+50,s,i)&&(a+=100),a}(this.referenceDate?k(this.referenceDate):new Date,n,a,i))):2===t.length?(a=parseInt(t[0])-1,i=parseInt(t[1])):1===t.length&&(i=parseInt(t[0])),void 0!==i)return{day:i,month:a,year:n}},formatTitle:(e,t)=>`${e} ${t}`})},min:{type:String,sync:!0},max:{type:String,sync:!0},_minDate:{type:Date,computed:"__computeMinOrMaxDate(min)",sync:!0},_maxDate:{type:Date,computed:"__computeMinOrMaxDate(max)",sync:!0},_noInput:{type:Boolean,computed:"_isNoInput(inputElement, _fullscreen, _ios, i18n, opened, autoOpenDisabled)"},_ios:{type:Boolean,value:x.gn},_focusOverlayOnOpen:Boolean,_overlayContent:{type:Object,sync:!0},_hasInputValue:{type:Boolean}}}static get observers(){return["_selectedDateChanged(_selectedDate, i18n)","_focusedDateChanged(_focusedDate, i18n)","__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers)","__updateOverlayContentTheme(_overlayContent, _theme)","__updateOverlayContentFullScreen(_overlayContent, _fullscreen)"]}static get constraints(){return[...super.constraints,"min","max"]}constructor(){super(),this._boundOnClick=this._onClick.bind(this),this._boundOnScroll=this._onScroll.bind(this),this._boundOverlayRenderer=this._overlayRenderer.bind(this)}get _inputElementValue(){return super._inputElementValue}set _inputElementValue(e){super._inputElementValue=e,this._hasInputValue=!1}get clearElement(){return null}get _nativeInput(){return this.inputElement?this.inputElement.focusElement||this.inputElement:null}_onFocus(e){super._onFocus(e),this._noInput&&e.target.blur()}_onBlur(e){super._onBlur(e),this.opened||(this._selectParsedOrFocusedDate(),document.hasFocus()&&this.validate())}ready(){super.ready(),this.addEventListener("click",this._boundOnClick),this.addController(new _e(this._fullscreenMediaQuery,(e=>{this._fullscreen=e}))),this.addController(new Me.B(this));const e=this.$.overlay;this._overlayElement=e,e.renderer=this._boundOverlayRenderer,this.addEventListener("mousedown",(()=>this.__bringToFront())),this.addEventListener("touchstart",(()=>this.__bringToFront()))}disconnectedCallback(){super.disconnectedCallback(),this.opened=!1}open(){this.disabled||this.readonly||(this.opened=!0)}close(){this.$.overlay.close()}_overlayRenderer(e){if(e.firstChild)return;const t=document.createElement("vaadin-date-picker-overlay-content");e.appendChild(t),this._overlayContent=t,t.addEventListener("close",(()=>{this._close()})),t.addEventListener("focus-input",this._focusAndSelect.bind(this)),t.addEventListener("date-tap",(e=>{this.__userConfirmedDate=!0,this._selectDate(e.detail.date),this._close()})),t.addEventListener("date-selected",(e=>{this.__userConfirmedDate=!!e.detail.date,this._selectDate(e.detail.date)})),t.addEventListener("focusin",(()=>{this._keyboardActive&&this._setFocused(!0)})),t.addEventListener("focused-date-changed",(e=>{this._focusedDate=e.detail.value}))}__parseDate(e){if(!this.i18n.parseDate)return;let t=this.i18n.parseDate(e);return t&&(t=k(`${t.year}-${t.month+1}-${t.day}`)),t&&!isNaN(t.getTime())?t:void 0}__formatDate(e){if(this.i18n.formatDate)return this.i18n.formatDate(D(e))}checkValidity(){const e=this._inputElementValue,t=!e||!!this._selectedDate&&e===this.__formatDate(this._selectedDate),s=!this._selectedDate||b(this._selectedDate,this._minDate,this._maxDate);let i=!0;return this.inputElement&&(this.inputElement.checkValidity?i=this.inputElement.checkValidity():this.inputElement.validate&&(i=this.inputElement.validate())),t&&s&&i}_shouldSetFocus(e){return!this._shouldKeepFocusRing}_shouldRemoveFocus(e){return!this.opened}_setFocused(e){super._setFocused(e),this._shouldKeepFocusRing=e&&this._keyboardActive}__dispatchChange(){this.validate(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}_selectDate(e){const t=this.value;this._selectedDate=e,t!==this.value&&this.__dispatchChange()}_close(){this._focus(),this.close()}__bringToFront(){requestAnimationFrame((()=>{this.$.overlay.bringToFront()}))}_isNoInput(e,t,s,i,a,n){return!e||t&&(!n||a)||s&&a||!i.parseDate}_formatISO(e){if(!(e instanceof Date))return"";const t=(e,t="00")=>(t+e).substr((t+e).length-t.length);let s="",i="0000",a=e.getFullYear();return a<0?(a=-a,s="-",i="000000"):e.getFullYear()>=1e4&&(s="+",i="000000"),[s+t(a,i),t(e.getMonth()+1),t(e.getDate())].join("-")}_inputElementChanged(e){super._inputElementChanged(e),e&&(e.autocomplete="off",e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded",!!this.opened),this._applyInputValue(this._selectedDate))}_openedChanged(e){this.inputElement&&this.inputElement.setAttribute("aria-expanded",e)}_selectedDateChanged(e,t){void 0!==e&&void 0!==t&&(this.__keepInputValue||this._applyInputValue(e),this.value=this._formatISO(e),this._ignoreFocusedDateChange=!0,this._focusedDate=e,this._ignoreFocusedDateChange=!1)}_focusedDateChanged(e,t){void 0!==e&&void 0!==t&&(this._ignoreFocusedDateChange||this._noInput||this._applyInputValue(e))}_valueChanged(e,t){const s=k(e);!e||s?(e?g(this._selectedDate,s)||(this._selectedDate=s,void 0!==t&&this.validate()):this._selectedDate=null,this._toggleHasValue(this._hasValue)):this.value=t}__updateOverlayContent(e,t,s,i,a,n,o,r){e&&(e.i18n=t,e.label=s,e.minDate=i,e.maxDate=a,e.focusedDate=n,e.selectedDate=o,e.showWeekNumbers=r)}__updateOverlayContentTheme(e,t){e&&(t?e.setAttribute("theme",t):e.removeAttribute("theme"))}__updateOverlayContentFullScreen(e,t){e&&e.toggleAttribute("fullscreen",t)}_onOverlayEscapePress(){this._focusedDate=this._selectedDate,this._close()}_onOverlayOpened(){const e=this._overlayContent;e.reset();const t=this._getInitialPosition();e.initialPosition=t;const s=e.focusedDate||t;e.scrollToDate(s),this._ignoreFocusedDateChange=!0,e.focusedDate=s,this._ignoreFocusedDateChange=!1,window.addEventListener("scroll",this._boundOnScroll,!0),this._focusOverlayOnOpen?(e.focusDateElement(),this._focusOverlayOnOpen=!1):this._focus();const i=this._nativeInput;this._noInput&&i&&(i.blur(),this._overlayContent.focusDateElement());const a=this._noInput?e:[i,e];this.__showOthers=(0,Ce.Ry)(a)}_getInitialPosition(){const e=k(this.initialPosition),t=this._selectedDate||this._overlayContent.initialPosition||e||new Date;return e||b(t,this._minDate,this._maxDate)?t:v(t,[this._minDate,this._maxDate])}_selectParsedOrFocusedDate(){if(this._ignoreFocusedDateChange=!0,this.i18n.parseDate){const e=this._inputElementValue||"",t=this.__parseDate(e);t?this._selectDate(t):(this.__keepInputValue=!0,this._selectDate(null),this._selectedDate=null,this.__keepInputValue=!1)}else this._focusedDate&&this._selectDate(this._focusedDate);this._ignoreFocusedDateChange=!1}_onOverlayClosed(){this.__showOthers&&(this.__showOthers(),this.__showOthers=null),window.removeEventListener("scroll",this._boundOnScroll,!0),this.__userConfirmedDate?this.__userConfirmedDate=!1:this._selectParsedOrFocusedDate(),this._nativeInput&&this._nativeInput.selectionStart&&(this._nativeInput.selectionStart=this._nativeInput.selectionEnd),this.value||this._keyboardActive||this.validate()}_onScroll(e){e.target!==window&&this._overlayContent.contains(e.target)||this._overlayContent._repositionYearScroller()}_focus(){this._noInput||this.inputElement.focus()}_focusAndSelect(){this._focus(),this._setSelectionRange(0,this._inputElementValue.length)}_applyInputValue(e){this._inputElementValue=e?this.__formatDate(e):""}_setSelectionRange(e,t){this._nativeInput&&this._nativeInput.setSelectionRange&&this._nativeInput.setSelectionRange(e,t)}_onChange(e){e.stopPropagation()}_onClick(e){this._isClearButton(e)||this._onHostClick(e)}_onHostClick(e){this.autoOpenDisabled&&!this._noInput||(e.preventDefault(),this.open())}_onClearButtonClick(e){e.preventDefault(),this._inputElementValue="",this.value="",this.__dispatchChange()}_onKeyDown(e){switch(super._onKeyDown(e),this._noInput&&-1===[9].indexOf(e.keyCode)&&e.preventDefault(),e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this.opened?this._overlayContent.focusDateElement():(this._focusOverlayOnOpen=!0,this.open());break;case"Tab":this.opened&&(e.preventDefault(),e.stopPropagation(),this._setSelectionRange(0,0),e.shiftKey?this._overlayContent.focusCancel():this._overlayContent.focusDateElement())}}_onEnter(e){const t=this.value;this.opened?this.close():this._selectParsedOrFocusedDate(),t===this.value&&this.validate()}_onEscape(e){if(!this.opened)return this.clearButtonVisible&&this.value?(e.stopPropagation(),void this._onClearButtonClick(e)):void(this.autoOpenDisabled?(""===this.inputElement.value&&this._selectDate(null),this._applyInputValue(this._selectedDate)):(this._focusedDate=this._selectedDate,this._selectParsedOrFocusedDate()))}_isClearButton(e){return e.composedPath()[0]===this.clearElement}_onInput(){if(this.opened||!this._inputElementValue||this.autoOpenDisabled||this.open(),this._inputElementValue){const e=this.__parseDate(this._inputElementValue);e&&(this._ignoreFocusedDateChange=!0,g(e,this._focusedDate)||(this._focusedDate=e),this._ignoreFocusedDateChange=!1)}}__computeMinOrMaxDate(e){return k(e)}},Ie=m.iv`
600
+ :host([opened]) {
601
+ pointer-events: auto;
602
+ }
603
+
604
+ :host([dir='rtl']) [part='input-field'] {
605
+ direction: ltr;
606
+ }
607
+
608
+ :host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
609
+ direction: rtl;
610
+ text-align: left;
611
+ }
612
+ `;(0,a.hC)("vaadin-date-picker",[ke.J,Ie],{moduleId:"vaadin-date-picker-styles"});class Oe extends(Pe((0,ve.L)((0,a.Tb)((0,ge.S)(h.H3))))){static get is(){return"vaadin-date-picker"}static get template(){return h.dy`
613
+ <div class="vaadin-date-picker-container">
614
+ <div part="label">
615
+ <slot name="label"></slot>
616
+ <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
617
+ </div>
618
+
619
+ <vaadin-input-container
620
+ part="input-field"
621
+ readonly="[[readonly]]"
622
+ disabled="[[disabled]]"
623
+ invalid="[[invalid]]"
624
+ theme$="[[_theme]]"
625
+ >
626
+ <slot name="prefix" slot="prefix"></slot>
627
+ <slot name="input"></slot>
628
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
629
+ <div part="toggle-button" slot="suffix" aria-hidden="true" on-click="_toggle"></div>
630
+ </vaadin-input-container>
631
+
632
+ <div part="helper-text">
633
+ <slot name="helper"></slot>
634
+ </div>
635
+
636
+ <div part="error-message">
637
+ <slot name="error-message"></slot>
638
+ </div>
639
+ </div>
640
+
641
+ <vaadin-date-picker-overlay
642
+ id="overlay"
643
+ fullscreen$="[[_fullscreen]]"
644
+ theme$="[[_theme]]"
645
+ opened="{{opened}}"
646
+ on-vaadin-overlay-escape-press="_onOverlayEscapePress"
647
+ on-vaadin-overlay-open="_onOverlayOpened"
648
+ on-vaadin-overlay-closing="_onOverlayClosed"
649
+ restore-focus-on-close
650
+ restore-focus-node="[[inputElement]]"
651
+ ></vaadin-date-picker-overlay>
652
+
653
+ <slot name="tooltip"></slot>
654
+ `}get clearElement(){return this.$.clearButton}ready(){super.ready(),this.addController(new De.b(this,(e=>{this._setInputElement(e),this._setFocusElement(e),this.stateTarget=e,this.ariaTarget=e}))),this.addController(new we.v(this.inputElement,this._labelController)),this._tooltipController=new be.f(this),this.addController(this._tooltipController),this._tooltipController.setPosition("top"),this._tooltipController.setAriaTarget(this.inputElement),this._tooltipController.setShouldShow((e=>!e.opened)),this.shadowRoot.querySelector('[part="toggle-button"]').addEventListener("mousedown",(e=>e.preventDefault())),this.$.overlay.addEventListener("vaadin-overlay-close",this._onVaadinOverlayClose.bind(this))}_onVaadinOverlayClose(e){e.detail.sourceEvent&&e.detail.sourceEvent.composedPath().includes(this)&&e.preventDefault()}_toggle(e){e.stopPropagation(),this.$.overlay.opened?this.close():this.open()}_openedChanged(e){super._openedChanged(e),this.$.overlay.positionTarget=this.shadowRoot.querySelector('[part="input-field"]'),this.$.overlay.noVerticalOverlap=!0}}(0,d.M)(Oe)}}]);