@7pmlabs/design-system 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/design-system102.js +1 -1
- package/dist/design-system102.mjs +3 -3
- package/dist/design-system103.js +1 -1
- package/dist/design-system103.js.map +1 -1
- package/dist/design-system103.mjs +1069 -2138
- package/dist/design-system103.mjs.map +1 -1
- package/dist/design-system104.js +1 -1
- package/dist/design-system104.js.map +1 -1
- package/dist/design-system104.mjs +25 -1103
- package/dist/design-system104.mjs.map +1 -1
- package/dist/design-system105.js +1 -1
- package/dist/design-system105.js.map +1 -1
- package/dist/design-system105.mjs +2171 -24
- package/dist/design-system105.mjs.map +1 -1
- package/dist/design-system107.js +1 -1
- package/dist/design-system107.mjs +1 -1
- package/dist/design-system111.js +1 -1
- package/dist/design-system111.mjs +1 -1
- package/dist/design-system118.js +1 -1
- package/dist/design-system118.js.map +1 -1
- package/dist/design-system118.mjs +63 -4
- package/dist/design-system118.mjs.map +1 -1
- package/dist/design-system119.js +1 -1
- package/dist/design-system119.js.map +1 -1
- package/dist/design-system119.mjs +3 -7
- package/dist/design-system119.mjs.map +1 -1
- package/dist/design-system120.js +1 -1
- package/dist/design-system120.js.map +1 -1
- package/dist/design-system120.mjs +9 -7
- package/dist/design-system120.mjs.map +1 -1
- package/dist/design-system121.js +1 -1
- package/dist/design-system121.js.map +1 -1
- package/dist/design-system121.mjs +6 -62
- package/dist/design-system121.mjs.map +1 -1
- package/dist/design-system122.js +1 -1
- package/dist/design-system122.js.map +1 -1
- package/dist/design-system122.mjs +3 -3
- package/dist/design-system122.mjs.map +1 -1
- package/dist/design-system123.js +1 -1
- package/dist/design-system123.js.map +1 -1
- package/dist/design-system123.mjs +3 -9
- package/dist/design-system123.mjs.map +1 -1
- package/dist/design-system124.js +1 -1
- package/dist/design-system124.js.map +1 -1
- package/dist/design-system124.mjs +5 -6
- package/dist/design-system124.mjs.map +1 -1
- package/dist/design-system125.js +1 -1
- package/dist/design-system125.js.map +1 -1
- package/dist/design-system125.mjs +9 -3
- package/dist/design-system125.mjs.map +1 -1
- package/dist/design-system126.js +1 -1
- package/dist/design-system126.js.map +1 -1
- package/dist/design-system126.mjs +5 -3
- package/dist/design-system126.mjs.map +1 -1
- package/dist/design-system127.js +1 -1
- package/dist/design-system127.js.map +1 -1
- package/dist/design-system127.mjs +5 -6
- package/dist/design-system127.mjs.map +1 -1
- package/dist/design-system128.js +1 -1
- package/dist/design-system128.js.map +1 -1
- package/dist/design-system128.mjs +4 -10
- package/dist/design-system128.mjs.map +1 -1
- package/dist/design-system129.js +1 -1
- package/dist/design-system129.js.map +1 -1
- package/dist/design-system129.mjs +3 -4
- package/dist/design-system129.mjs.map +1 -1
- package/dist/design-system13.js +1 -1
- package/dist/design-system13.mjs +2 -2
- package/dist/design-system130.js +1 -1
- package/dist/design-system130.js.map +1 -1
- package/dist/design-system130.mjs +12 -5
- package/dist/design-system130.mjs.map +1 -1
- package/dist/design-system131.js +1 -1
- package/dist/design-system131.js.map +1 -1
- package/dist/design-system131.mjs +27 -4
- package/dist/design-system131.mjs.map +1 -1
- package/dist/design-system132.js +1 -1
- package/dist/design-system132.js.map +1 -1
- package/dist/design-system132.mjs +4 -2
- package/dist/design-system132.mjs.map +1 -1
- package/dist/design-system133.js +1 -1
- package/dist/design-system133.js.map +1 -1
- package/dist/design-system133.mjs +6 -12
- package/dist/design-system133.mjs.map +1 -1
- package/dist/design-system134.js +1 -1
- package/dist/design-system134.js.map +1 -1
- package/dist/design-system134.mjs +8 -27
- package/dist/design-system134.mjs.map +1 -1
- package/dist/design-system135.js +1 -1
- package/dist/design-system135.js.map +1 -1
- package/dist/design-system135.mjs +4 -5
- package/dist/design-system135.mjs.map +1 -1
- package/dist/design-system136.js +1 -1
- package/dist/design-system136.js.map +1 -1
- package/dist/design-system136.mjs +6 -6
- package/dist/design-system136.mjs.map +1 -1
- package/dist/design-system137.js +1 -1
- package/dist/design-system137.js.map +1 -1
- package/dist/design-system137.mjs +6 -7
- package/dist/design-system137.mjs.map +1 -1
- package/dist/design-system138.js +1 -1
- package/dist/design-system138.js.map +1 -1
- package/dist/design-system138.mjs +5 -4
- package/dist/design-system138.mjs.map +1 -1
- package/dist/design-system139.js +1 -1
- package/dist/design-system139.js.map +1 -1
- package/dist/design-system139.mjs +10 -6
- package/dist/design-system139.mjs.map +1 -1
- package/dist/design-system140.js +1 -1
- package/dist/design-system140.js.map +1 -1
- package/dist/design-system140.mjs +6 -7
- package/dist/design-system140.mjs.map +1 -1
- package/dist/design-system141.js +1 -1
- package/dist/design-system141.js.map +1 -1
- package/dist/design-system141.mjs +6 -5
- package/dist/design-system141.mjs.map +1 -1
- package/dist/design-system142.js +1 -1
- package/dist/design-system142.js.map +1 -1
- package/dist/design-system142.mjs +10 -10
- package/dist/design-system142.mjs.map +1 -1
- package/dist/design-system143.js +1 -1
- package/dist/design-system143.js.map +1 -1
- package/dist/design-system143.mjs +7 -6
- package/dist/design-system143.mjs.map +1 -1
- package/dist/design-system144.js +1 -1
- package/dist/design-system144.js.map +1 -1
- package/dist/design-system144.mjs +17 -6
- package/dist/design-system144.mjs.map +1 -1
- package/dist/design-system145.js +1 -1
- package/dist/design-system145.js.map +1 -1
- package/dist/design-system145.mjs +6 -9
- package/dist/design-system145.mjs.map +1 -1
- package/dist/design-system146.js +1 -1
- package/dist/design-system146.js.map +1 -1
- package/dist/design-system146.mjs +12 -6
- package/dist/design-system146.mjs.map +1 -1
- package/dist/design-system147.js +1 -1
- package/dist/design-system147.js.map +1 -1
- package/dist/design-system147.mjs +3 -17
- package/dist/design-system147.mjs.map +1 -1
- package/dist/design-system148.js +1 -1
- package/dist/design-system148.js.map +1 -1
- package/dist/design-system148.mjs +3 -6
- package/dist/design-system148.mjs.map +1 -1
- package/dist/design-system149.js +1 -1
- package/dist/design-system149.js.map +1 -1
- package/dist/design-system149.mjs +7 -12
- package/dist/design-system149.mjs.map +1 -1
- package/dist/design-system15.js +1 -1
- package/dist/design-system15.mjs +2 -2
- package/dist/design-system150.js +1 -1
- package/dist/design-system150.js.map +1 -1
- package/dist/design-system150.mjs +6 -3
- package/dist/design-system150.mjs.map +1 -1
- package/dist/design-system151.js +1 -1
- package/dist/design-system151.mjs +1 -1
- package/dist/design-system157.js +1 -1
- package/dist/design-system157.mjs +1 -1
- package/dist/design-system158.js +1 -1
- package/dist/design-system158.mjs +1 -1
- package/dist/design-system159.js +1 -1
- package/dist/design-system159.mjs +1 -1
- package/dist/design-system163.js +1 -1
- package/dist/design-system163.mjs +1 -1
- package/dist/design-system164.js +1 -1
- package/dist/design-system164.mjs +1 -1
- package/dist/design-system167.js +1 -1
- package/dist/design-system167.mjs +1 -1
- package/dist/design-system169.js +1 -1
- package/dist/design-system169.mjs +1 -1
- package/dist/design-system172.js +1 -1
- package/dist/design-system172.mjs +1 -1
- package/dist/design-system176.js +1 -1
- package/dist/design-system176.mjs +1 -1
- package/dist/design-system177.js +1 -1
- package/dist/design-system177.mjs +1 -1
- package/dist/design-system178.js +1 -1
- package/dist/design-system178.mjs +1 -1
- package/dist/design-system179.js +1 -1
- package/dist/design-system179.mjs +1 -1
- package/dist/design-system180.js +1 -1
- package/dist/design-system180.mjs +1 -1
- package/dist/design-system182.js +1 -1
- package/dist/design-system182.mjs +2 -2
- package/dist/design-system195.js +1 -1
- package/dist/design-system195.mjs +1 -1
- package/dist/design-system196.js +1 -1
- package/dist/design-system196.mjs +1 -1
- package/dist/design-system204.js +1 -1
- package/dist/design-system204.mjs +1 -1
- package/dist/design-system210.js +1 -1
- package/dist/design-system210.mjs +1 -1
- package/dist/design-system219.js +1 -1
- package/dist/design-system219.mjs +1 -1
- package/dist/design-system226.js +1 -1
- package/dist/design-system226.mjs +1 -1
- package/dist/design-system89.js +1 -1
- package/dist/design-system89.mjs +1 -1
- package/dist/design-system92.js +1 -1
- package/dist/design-system92.mjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/design-system102.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const c=require("./design-
|
|
1
|
+
"use strict";const c=require("./design-system148.js"),u=require("./design-system149.js"),a=require("./design-system150.js");function x(n,e,t){if(c.randomUUID&&!e&&!n)return c.randomUUID();n=n||{};const r=n.random||(n.rng||u)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=r[i];return e}return a.unsafeStringify(r)}module.exports=x;
|
|
2
2
|
//# sourceMappingURL=design-system102.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import e from "./design-
|
|
2
|
-
import i from "./design-
|
|
3
|
-
import { unsafeStringify as d } from "./design-
|
|
1
|
+
import e from "./design-system148.mjs";
|
|
2
|
+
import i from "./design-system149.mjs";
|
|
3
|
+
import { unsafeStringify as d } from "./design-system150.mjs";
|
|
4
4
|
function g(n, m, t) {
|
|
5
5
|
if (e.randomUUID && !m && !n)
|
|
6
6
|
return e.randomUUID();
|
package/dist/design-system103.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(function(p,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(p=typeof globalThis<"u"?globalThis:p||self,m(p.IMask={}))})(globalThis,function(p){function m(n){return typeof n=="string"||n instanceof String}function P(n){var t;return typeof n=="object"&&n!=null&&(n==null||(t=n.constructor)==null?void 0:t.name)==="Object"}function U(n,t){return Array.isArray(t)?U(n,(e,s)=>t.includes(s)):Object.entries(n).reduce((e,s)=>{let[i,u]=s;return t(u,i)&&(e[i]=u),e},{})}const h={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function j(n){switch(n){case h.LEFT:return h.FORCE_LEFT;case h.RIGHT:return h.FORCE_RIGHT;default:return n}}function y(n){return n.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function b(n,t){if(t===n)return!0;const e=Array.isArray(t),s=Array.isArray(n);let i;if(e&&s){if(t.length!=n.length)return!1;for(i=0;i<t.length;i++)if(!b(t[i],n[i]))return!1;return!0}if(e!=s)return!1;if(t&&n&&typeof t=="object"&&typeof n=="object"){const u=t instanceof Date,a=n instanceof Date;if(u&&a)return t.getTime()==n.getTime();if(u!=a)return!1;const r=t instanceof RegExp,l=n instanceof RegExp;if(r&&l)return t.toString()==n.toString();if(r!=l)return!1;const d=Object.keys(t);for(i=0;i<d.length;i++)if(!Object.prototype.hasOwnProperty.call(n,d[i]))return!1;for(i=0;i<d.length;i++)if(!b(n[d[i]],t[d[i]]))return!1;return!0}else if(t&&n&&typeof t=="function"&&typeof n=="function")return t.toString()===n.toString();return!1}class Z{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?h.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?h.RIGHT:h.LEFT}}function o(n,t){return new o.InputMask(n,t)}function H(n){if(n==null)throw new Error("mask property should be defined");return n instanceof RegExp?o.MaskedRegExp:m(n)?o.MaskedPattern:n===Date?o.MaskedDate:n===Number?o.MaskedNumber:Array.isArray(n)||n===Array?o.MaskedDynamic:o.Masked&&n.prototype instanceof o.Masked?n:o.Masked&&n instanceof o.Masked?n.constructor:n instanceof Function?o.MaskedFunction:(console.warn("Mask not found for mask",n),o.Masked)}function M(n){if(!n)throw new Error("Options in not defined");if(o.Masked){if(n.prototype instanceof o.Masked)return{mask:n};const{mask:t=void 0,...e}=n instanceof o.Masked?{mask:n}:P(n)&&n.mask instanceof o.Masked?n:{};if(t){const s=t.mask;return{...U(t,(i,u)=>!u.startsWith("_")),mask:t.constructor,_mask:s,...e}}}return P(n)?{...n}:{mask:n}}function A(n){if(o.Masked&&n instanceof o.Masked)return n;const t=M(n),e=H(t.mask);if(!e)throw new Error("Masked class is not found for provided mask, appropriate module needs to be imported manually before creating mask.");return t.mask===e&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new e(t)}o.createMask=A;class I{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,e){if(!(t==null||e==null||t===this.selectionStart&&e===this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}o.MaskElement=I;class F extends I{constructor(t){super(),this.input=t,this._handlers={}}get rootElement(){var t,e,s;return(t=(e=(s=this.input).getRootNode)==null?void 0:e.call(s))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){Object.keys(t).forEach(e=>this._toggleEventHandler(F.EVENTS_MAP[e],t[e]))}unbindEvents(){Object.keys(this._handlers).forEach(t=>this._toggleEventHandler(t))}_toggleEventHandler(t,e){this._handlers[t]&&(this.input.removeEventListener(t,this._handlers[t]),delete this._handlers[t]),e&&(this.input.addEventListener(t,e),this._handlers[t]=e)}}F.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"},o.HTMLMaskElement=F;class z extends F{constructor(t){super(t),this.input=t,this._handlers={}}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}o.HTMLMaskElement=F;class w extends F{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return i==null||s==null||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return i==null||s==null||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,u=i.getSelection&&i.getSelection();u&&(u.removeAllRanges(),u.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}o.HTMLContenteditableMaskElement=w;class G{constructor(t,e){this.el=t instanceof I?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new w(t):new z(t),this.masked=A(e),this._listeners={},this._value="",this._unmaskedValue="",this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return t==null||((e=this.masked)==null?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof o.Masked)&&this.masked.constructor===H(t)){this.masked.updateOptions({mask:t});return}const e=t instanceof o.Masked?t:A({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl(),this.alignCursor())}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl(),this.alignCursor())}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach(i=>i(e))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value}updateControl(){const t=this.masked.unmaskedValue,e=this.masked.value,s=this.displayValue,i=this.unmaskedValue!==t||this.value!==e;this._unmaskedValue=t,this._value=e,this.el.value!==s&&(this.el.value=s),i&&this._fireChangeEvents()}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),u=!b(this.masked,s);i&&(this.mask=e),u&&this.masked.updateOptions(s),(i||u)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,h.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){if(this._inputEvent=t,this._abortUpdateCursor(),!this._selection)return this.updateValue();const e=new Z({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,u=s===this.masked.rawInputValue?e.removeDirection:h.NONE;let a=this.masked.nearestInputPos(e.startChangePos+i,u);u!==h.NONE&&(a=this.masked.nearestInputPos(a,h.NONE)),this.updateControl(),this.updateCursor(a),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}o.InputMask=G;class c{static normalize(t){return Array.isArray(t)?t:[t,new c]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},t)}aggregate(t){return this.rawInserted+=t.rawInserted,this.skip=this.skip||t.skip,this.inserted+=t.inserted,this.tailShift+=t.tailShift,this}get offset(){return this.tailShift+this.inserted.length}}o.ChangeDetails=c;class E{constructor(t,e,s){t===void 0&&(t=""),e===void 0&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class f{constructor(t){this._value="",this._update({...f.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){Object.keys(t).length&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){e===void 0&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),new E(this.extractInput(t,e),t)}appendTail(t){return m(t)&&(t=new E(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new c({inserted:t,rawInserted:t})):new c}_appendChar(t,e,s){e===void 0&&(e={});const i=this.state;let u;if([t,u]=this.doPrepareChar(t,e),u=u.aggregate(this._appendCharRaw(t,e)),u.inserted){let a,r=this.doValidate(e)!==!1;if(r&&s!=null){const l=this.state;this.overwrite===!0&&(a=s.state,s.unshift(this.displayValue.length-u.tailShift));let d=this.appendTail(s);r=d.rawInserted===s.toString(),!(r&&d.inserted)&&this.overwrite==="shift"&&(this.state=l,a=s.state,s.shift(),d=this.appendTail(s),r=d.rawInserted===s.toString()),r&&d.inserted&&(this.state=l)}r||(u=new c,this.state=i,s&&a&&(s.state=a))}return u}_appendPlaceholder(){return new c}_appendEager(){return new c}append(t,e,s){if(!m(t))throw new Error("value should be string");const i=m(s)?new E(String(s)):s;e!=null&&e.tail&&(e._beforeTailState=this.state);let u;[t,u]=this.doPrepare(t,e);for(let a=0;a<t.length;++a){const r=this._appendChar(t[a],e,i);if(!r.rawInserted&&!this.doSkipInvalid(t[a],e,i))break;u.aggregate(r)}return(this.eager===!0||this.eager==="append")&&e!=null&&e.input&&t&&u.aggregate(this._appendEager()),i!=null&&(u.tailShift+=this.appendTail(i).tailShift),u}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new c}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&s.indexOf(this.value)===0&&this.append(s.slice(this.displayValue.length),{},""),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return!!this.skipInvalid}doPrepare(t,e){return e===void 0&&(e={}),c.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return e===void 0&&(e={}),c.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,u){i===void 0&&(i=h.NONE),u===void 0&&(u={input:!0});const a=t+e,r=this.extractTail(a),l=this.eager===!0||this.eager==="remove";let d;l&&(i=j(i),d=this.extractInput(0,a,{raw:!0}));let v=t;const _=new c;if(i!==h.NONE&&(v=this.nearestInputPos(t,e>1&&t!==0&&!l?h.NONE:i),_.tailShift=v-t),_.aggregate(this.remove(v)),l&&i!==h.NONE&&d===this.rawInputValue)if(i===h.FORCE_LEFT){let S;for(;d===this.rawInputValue&&(S=this.displayValue.length);)_.aggregate(new c({tailShift:-1})).aggregate(this.remove(S-1))}else i===h.FORCE_RIGHT&&r.unshift();return _.aggregate(this.append(s,u,r))}maskEquals(t){return this.mask===t}typedValueEquals(t){const e=this.typedValue;return t===e||f.EMPTY_VALUES.includes(t)&&f.EMPTY_VALUES.includes(e)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}}f.DEFAULTS={skipInvalid:!0},f.EMPTY_VALUES=[void 0,null,""],o.Masked=f;class C{constructor(t,e){t===void 0&&(t=[]),e===void 0&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=m(t)?new E(String(t)):t;const e=this.chunks[this.chunks.length-1],s=e&&(e.stop===t.stop||t.stop==null)&&t.from===e.from+e.toString().length;if(t instanceof E)s?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof C){if(t.stop==null){let i;for(;t.chunks.length&&t.chunks[0].stop==null;)i=t.chunks.shift(),i.from+=t.from,this.extend(i)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof o.MaskedPattern))return new E(this.toString()).appendTo(t);const e=new c;for(let s=0;s<this.chunks.length&&!e.skip;++s){const i=this.chunks[s],u=t._mapPosToBlock(t.displayValue.length),a=i.stop;let r;if(a!=null&&(!u||u.index<=a)){if(i instanceof C||t._stops.indexOf(a)>=0){const l=t._appendPlaceholder(a);e.aggregate(l)}r=i instanceof C&&t._blocks[a]}if(r){const l=r.appendTail(i);l.skip=!1,e.aggregate(l),t._value+=l.inserted;const d=i.toString().slice(l.rawInserted.length);d&&e.aggregate(t.append(d,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map(i=>{const u="chunks"in i?new C:new E;return u.state=i,u})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const e=t!=null?t-this.from:t;let s=0;for(;s<this.chunks.length;){const i=this.chunks[s],u=i.unshift(e);if(i.toString()){if(!u)break;++s}else this.chunks.splice(s,1);if(u)return u}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class X{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((e=this.block)==null?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,h.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,h.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h.NONE),!0})}}class R{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new c}nearestInputPos(t,e){e===void 0&&(e=h.NONE);const s=0,i=this._value.length;switch(e){case h.LEFT:case h.FORCE_LEFT:return s;case h.NONE:case h.RIGHT:case h.FORCE_RIGHT:default:return i}}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),s===void 0&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,e){e===void 0&&(e={});const s=new c;if(this.isFilled)return s;const i=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!i)&&!e.tail;return a&&(s.rawInserted=this.char),this._value=s.inserted=this.char,this._isRawInput=a&&(e.raw||e.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new c;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new E("")}appendTail(t){return m(t)&&(t=new E(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return s!=null&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}}class x{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:u,lazy:a,eager:r,...l}=t;this.masked=A(l),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:u,lazy:a,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),t===0&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new c}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,e){if(e===void 0&&(e={}),this.isFilled)return new c;const s=this.masked.state,i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&this.doValidate(e)===!1&&(i.inserted=i.rawInserted="",this.masked.state=s),!i.inserted&&!this.isOptional&&!this.lazy&&!e.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){const t=new c;return this.isFilled||this.isOptional||(this.isFilled=!0,t.inserted=this.placeholderChar),t}_appendEager(){return new c}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){e===void 0&&(e=h.NONE);const s=0,i=this.value.length,u=Math.min(Math.max(t,s),i);switch(e){case h.LEFT:case h.FORCE_LEFT:return this.isComplete?u:s;case h.RIGHT:case h.FORCE_RIGHT:return this.isComplete?u:i;case h.NONE:default:return u}}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(t==null||(e=t._beforeTailState)==null?void 0:e.masked)||(t==null?void 0:t._beforeTailState)}}}x.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class q extends f{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=s=>s.search(e)>=0),super._update(t)}}o.MaskedRegExp=q;class k extends f{constructor(t){super({...k.DEFAULTS,...t,definitions:Object.assign({},x.DEFAULT_DEFINITIONS,t==null?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let u=0;u<e.length;++u){if(this.blocks){const d=e.slice(u),v=Object.keys(this.blocks).filter(S=>d.indexOf(S)===0);v.sort((S,L)=>L.length-S.length);const _=v[0];if(_){const{expose:S,...L}=M(this.blocks[_]),N=A({lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,...L,parent:this});N&&(this._blocks.push(N),S&&(this.exposeBlock=N),this._maskedBlocks[_]||(this._maskedBlocks[_]=[]),this._maskedBlocks[_].push(this._blocks.length-1)),u+=_.length-1;continue}}let a=e[u],r=a in t;if(a===k.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(a==="{"||a==="}"){s=!s;continue}if(a==="["||a==="]"){i=!i;continue}if(a===k.ESCAPE_CHAR){if(++u,a=e[u],!a)break;r=!1}const l=r?new x({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...M(t[a]),parent:this}):new R({char:a,eager:this.eager,isUnmasking:s});this._blocks.push(l)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){const{_blocks:e,...s}=t;this._blocks.forEach((i,u)=>i.state=e[u]),super.state=s}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,e)=>t+=e.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,e)=>t+=e.value,"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,e)=>t+=e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new c;let s=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(s==null)return e;this._blocks[s].isFilled&&++s;for(let i=s;i<this._blocks.length;++i){const u=this._blocks[i]._appendEager();if(!u.inserted)break;e.aggregate(u)}return e}_appendCharRaw(t,e){e===void 0&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new c;if(!s)return i;for(let a=s.index;;++a){var u;const r=this._blocks[a];if(!r)break;const l=r._appendChar(t,{...e,_beforeTailState:(u=e._beforeTailState)==null||(u=u._blocks)==null?void 0:u[a]}),d=l.skip;if(i.aggregate(l),d||l.rawInserted)break}return i}extractTail(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=new C;return t===e||this._forEachBlocksInRange(t,e,(i,u,a,r)=>{const l=i.extractTail(a,r);l.stop=this._findStopBefore(u),l.from=this._blockStartPos(u),l instanceof C&&(l.blockIndex=u),s.extend(l)}),s}extractInput(t,e,s){if(t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),s===void 0&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,(u,a,r,l)=>{i+=u.extractInput(r,l,s)}),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(i<=t)e=i;else break}return e}_appendPlaceholder(t){const e=new c;if(this.lazy&&t==null)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,u=t??this._blocks.length;return this._blocks.slice(i,u).forEach(a=>{if(!a.lazy||t!=null){var r;const l=a._appendPlaceholder((r=a._blocks)==null?void 0:r.length);this._value+=l.inserted,e.aggregate(l)}}),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],u=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-u}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((e,s)=>e+=s.displayValue.length,0)}_forEachBlocksInRange(t,e,s){e===void 0&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const u=this._mapPosToBlock(e),a=u&&i.index===u.index,r=i.offset,l=u&&a?u.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,r,l),u&&!a){for(let d=i.index+1;d<u.index;++d)s(this._blocks[d],d,0,this._blocks[d].displayValue.length);s(this._blocks[u.index],u.index,0,u.offset)}}}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,(i,u,a,r)=>{s.aggregate(i.remove(a,r))}),s}nearestInputPos(t,e){if(e===void 0&&(e=h.NONE),!this._blocks.length)return 0;const s=new X(this,t);if(e===h.NONE)return s.pushRightBeforeInput()||(s.popState(),s.pushLeftBeforeInput())?s.pos:this.displayValue.length;if(e===h.LEFT||e===h.FORCE_LEFT){if(e===h.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===h.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t||(s.popState(),s.ok&&s.pos<=t))return s.pos;s.popState()}return s.ok?s.pos:e===h.FORCE_LEFT?0:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:0)}return e===h.RIGHT||e===h.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===h.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:this.nearestInputPos(t,h.LEFT))):t}totalInputPositions(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,(i,u,a,r)=>{s+=i.totalInputPositions(a,r)}),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(s=>this._blocks[s]):[]}}k.DEFAULTS={lazy:!0,placeholderChar:"_"},k.STOP_CHAR="`",k.ESCAPE_CHAR="\\",k.InputDefinition=x,k.FixedDefinition=R,o.MaskedPattern=k;class V extends k{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:u=this.autofix,...a}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=u;const r=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<l.length&&l[d]===r[d];)++d;a.mask=l.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(a)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let e="",s="";const[,i,u]=t.match(/^(\D*)(\d*)(\D*)/)||[];return u&&(e="0".repeat(i.length)+u,s="9".repeat(i.length)+u),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){e===void 0&&(e={});let s;if([t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),!this.autofix||!t)return[t,s];const i=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0"),a=this.value+t;if(a.length>this.maxLength)return["",s];const[r,l]=this.boundaries(a);return Number(l)<this.from?[i[a.length-1],s]:Number(r)>this.to?this.autofix==="pad"&&a.length<this.maxLength?["",s.aggregate(this.append(i[a.length-1]+t,e))]:[u[a.length-1],s]:[t,s]}doValidate(t){const e=this.value;if(e.search(/[^0]/)===-1&&e.length<=this._matchFrom)return!0;const[i,u]=this.boundaries(e);return this.from<=Number(u)&&Number(i)<=this.to&&super.doValidate(t)}}o.MaskedRange=V;class B extends k{constructor(t){const{mask:e,pattern:s,...i}={...B.DEFAULTS,...t};super({...i,mask:m(e)?e:s})}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:e,pattern:s,blocks:i,...u}={...B.DEFAULTS,...t},a=Object.assign({},B.GET_DEFAULT_BLOCKS());t.min&&(a.Y.from=t.min.getFullYear()),t.max&&(a.Y.to=t.max.getFullYear()),t.min&&t.max&&a.Y.from===a.Y.to&&(a.m.from=t.min.getMonth()+1,a.m.to=t.max.getMonth()+1,a.m.from===a.m.to&&(a.d.from=t.min.getDate(),a.d.to=t.max.getDate())),Object.assign(a,this.blocks,i),Object.keys(a).forEach(r=>{const l=a[r];!("autofix"in l)&&"autofix"in t&&(l.autofix=t.autofix)}),super._update({...u,mask:m(e)?e:s,blocks:a})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&e!=null&&(this.min==null||this.min<=e)&&(this.max==null||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}}B.GET_DEFAULT_BLOCKS=()=>({d:{mask:V,from:1,to:31,maxLength:2},m:{mask:V,from:1,to:12,maxLength:2},Y:{mask:V,from:1900,to:9999}}),B.DEFAULTS={mask:Date,pattern:"d{.}`m{.}`Y",format:(n,t)=>{if(!n)return"";const e=String(n.getDate()).padStart(2,"0"),s=String(n.getMonth()+1).padStart(2,"0"),i=n.getFullYear();return[e,s,i].join(".")},parse:(n,t)=>{const[e,s,i]=n.split(".").map(Number);return new Date(i,s-1,e)}},o.MaskedDate=B;class D extends f{constructor(t){super({...D.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(e=>{const{expose:s,...i}=M(e),u=A({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return s&&(this.exposeMask=u),u}):[])}_appendCharRaw(t,e){e===void 0&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){t===void 0&&(t=""),e===void 0&&(e={}),s===void 0&&(s="");const i=e.tail&&e._beforeTailState!=null?e._beforeTailState._value:this.value,u=this.rawInputValue,a=e.tail&&e._beforeTailState!=null?e._beforeTailState._rawInputValue:u,r=u.slice(a.length),l=this.currentMask,d=new c,v=l==null?void 0:l.state;if(this.currentMask=this.doDispatch(t,{...e},s),this.currentMask)if(this.currentMask!==l){if(this.currentMask.reset(),a){const _=this.currentMask.append(a,{raw:!0});d.tailShift=_.inserted.length-i.length}r&&(d.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)}else v&&(this.currentMask.state=v);return d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new c;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:((e=t._beforeTailState)==null?void 0:e.currentMaskRef)===this.currentMask&&((s=t._beforeTailState)==null?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return e===void 0&&(e={}),s===void 0&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){e===void 0&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let u;[s,u]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(u)}return[s,i]}doPrepareChar(t,e){e===void 0&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let u;[s,u]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(u)}return[s,i]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(e=>e.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,e){const s=new c;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(e=>e.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...u}=t;e&&this.compiledMasks.forEach((a,r)=>a.state=e[r]),s!=null&&(this.currentMask=s,this.currentMask.state=i),super.state=u}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((e,s)=>{if(!t[s])return;const{mask:i,...u}=t[s];return b(e,u)&&e.maskEquals(i)}):super.maskEquals(t)}typedValueEquals(t){var e;return!!((e=this.currentMask)!=null&&e.typedValueEquals(t))}}D.DEFAULTS=void 0,D.DEFAULTS={dispatch:(n,t,e,s)=>{if(!t.compiledMasks.length)return;const i=t.rawInputValue,u=t.compiledMasks.map((a,r)=>{const l=t.currentMask===a,d=l?a.displayValue.length:a.nearestInputPos(a.displayValue.length,h.FORCE_LEFT);return a.rawInputValue!==i?(a.reset(),a.append(i,{raw:!0})):l||a.remove(d),a.append(n,t.currentMaskFlags(e)),a.appendTail(s),{index:r,weight:a.rawInputValue.length,totalInputPositions:a.totalInputPositions(0,Math.max(d,a.nearestInputPos(a.displayValue.length,h.FORCE_LEFT)))}});return u.sort((a,r)=>r.weight-a.weight||r.totalInputPositions-a.totalInputPositions),t.compiledMasks[u[0].index]}},o.MaskedDynamic=D;class Y extends k{constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const i=e.map(r=>r.length),u=Math.min(...i),a=Math.max(...i)-u;s.mask="*".repeat(u),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=e}super._update(s)}doValidate(t){return this.enum.some(e=>e.indexOf(this.unmaskedValue)===0)&&super.doValidate(t)}}o.MaskedEnum=Y;class $ extends f{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}o.MaskedFunction=$;class g extends f{constructor(t){super({...g.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e="\\d*",s=(this.scale?"("+y(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+e+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(y).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(y(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){e===void 0&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),s&&!this.allowPositive&&!this.value&&s!=="-"&&i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){e===void 0&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){if(e===void 0&&(e={}),!this.thousandsSeparator)return super._appendCharRaw(t,e);const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const u=super._appendCharRaw(t,e);this._value=this._insertThousandsSeparators(this._value);const a=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,r=this._separatorsCountFromSlice(a);return u.tailShift+=(r-i)*this.thousandsSeparator.length,u.skip=!u.rawInserted&&t===this.thousandsSeparator,u}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),u=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const a=this._separatorsCountFromSlice(s);return new c({tailShift:(a-u)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case h.NONE:case h.LEFT:case h.FORCE_LEFT:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===h.FORCE_LEFT)return s}break}case h.RIGHT:case h.FORCE_RIGHT:{const s=this._findSeparatorAround(t);if(s>=0)return s+this.thousandsSeparator.length}}return t}doValidate(t){let e=!!this._removeThousandsSeparators(this.value).match(this._numberRegExp);if(e){const s=this.number;e=e&&!isNaN(s)&&(this.min==null||this.min>=0||this.min<=this.number)&&(this.max==null||this.max<=0||this.number<=this.max)}return e&&super.doValidate(t)}doCommit(){if(this.value){const t=this.number;let e=t;this.min!=null&&(e=Math.max(e,this.min)),this.max!=null&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(s,i,u,a)=>i+a),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){e===void 0&&(e={});const i=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===g.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,g.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(g.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||g.EMPTY_VALUES.includes(t)&&g.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}g.UNMASKED_RADIX=".",g.EMPTY_VALUES=[...f.EMPTY_VALUES,0],g.DEFAULTS={mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[g.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:n=>n.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},o.MaskedNumber=g;const T={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function O(n,t,e){t===void 0&&(t=T.MASKED),e===void 0&&(e=T.MASKED);const s=A(n);return i=>s.runIsolated(u=>(u[t]=i,u[e]))}function K(n,t,e,s){return O(t,e,s)(n)}o.PIPE_TYPE=T,o.createPipe=O,o.pipe=K;try{globalThis.IMask=o}catch{}p.ChangeDetails=c,p.ChunksTailDetails=C,p.DIRECTION=h,p.HTMLContenteditableMaskElement=w,p.HTMLInputMaskElement=z,p.HTMLMaskElement=F,p.InputMask=G,p.MaskElement=I,p.Masked=f,p.MaskedDate=B,p.MaskedDynamic=D,p.MaskedEnum=Y,p.MaskedFunction=$,p.MaskedNumber=g,p.MaskedPattern=k,p.MaskedRange=V,p.MaskedRegExp=q,p.PIPE_TYPE=T,p.PatternFixedDefinition=R,p.PatternInputDefinition=x,p.createMask=A,p.createPipe=O,p.default=o,p.forceDirection=j,p.normalizeOpts=M,p.pipe=K,Object.defineProperty(p,"__esModule",{value:!0})});const W=IMask;module.exports=W;
|
|
1
|
+
"use strict";const ne=require("./design-system112.js"),re=require("./design-system117.js");(function(he,fe){(function(U,j){he.exports=j()})(ne.commonjsGlobal,function(){return function(){var U={d:function(r,e){for(var t in e)U.o(e,t)&&!U.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},o:function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}},j={};U.d(j,{default:function(){return T}});var l={days:"days",months:"months",years:"years",day:"day",month:"month",year:"year",eventChangeViewDate:"changeViewDate",eventChangeCurrentView:"changeCurrentView",eventChangeFocusDate:"changeFocusDate",eventChangeSelectedDate:"changeSelectedDate",eventChangeTime:"changeTime",eventChangeLastSelectedDate:"changeLastSelectedDate",actionSelectDate:"selectDate",actionUnselectDate:"unselectDate",cssClassWeekend:"-weekend-"},Q={classes:"",inline:!1,locale:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.MM.yyyy",timeFormat:"HH:mm",firstDay:1},startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"T",toggleSelected:!0,keyboardNav:!0,selectedDates:!1,container:"",isMobile:!1,visible:!1,position:"bottom left",offset:12,view:l.days,minView:l.days,showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:", ",range:!1,dynamicRange:!0,buttons:!1,monthsField:"monthsShort",showEvent:"focus",autoClose:!1,prevHtml:'<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>',nextHtml:'<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>',navTitles:{days:"MMMM, <i>yyyy</i>",months:"yyyy",years:"yyyy1 - yyyy2"},timepicker:!1,onlyTimepicker:!1,dateTimeSeparator:" ",timeFormat:"",minHours:0,maxHours:24,minMinutes:0,maxMinutes:59,hoursStep:1,minutesStep:1,onSelect:!1,onChangeViewDate:!1,onChangeView:!1,onRenderCell:!1,onShow:!1,onHide:!1,onClickDayName:!1};function y(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document;return typeof r=="string"?e.querySelector(r):r}function b(){let{tagName:r="div",className:e="",innerHtml:t="",id:s="",attrs:a={}}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=document.createElement(r);return e&&n.classList.add(...e.split(" ")),s&&(n.id=s),t&&(n.innerHTML=t),a&&z(n,a),n}function z(r,e){for(let[t,s]of Object.entries(e))s!==void 0&&r.setAttribute(t,s);return r}function Z(r){return new Date(r.getFullYear(),r.getMonth()+1,0).getDate()}function D(r){let e=r.getHours(),t=e%12==0?12:e%12;return{year:r.getFullYear(),month:r.getMonth(),fullMonth:r.getMonth()+1<10?"0"+(r.getMonth()+1):r.getMonth()+1,date:r.getDate(),fullDate:r.getDate()<10?"0"+r.getDate():r.getDate(),day:r.getDay(),hours:e,fullHours:O(e),hours12:t,fullHours12:O(t),minutes:r.getMinutes(),fullMinutes:r.getMinutes()<10?"0"+r.getMinutes():r.getMinutes()}}function O(r){return r<10?"0"+r:r}function F(r){let e=10*Math.floor(r.getFullYear()/10);return[e,e+9]}function M(){let r=[];for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.forEach(a=>{if(typeof a=="object")for(let n in a)a[n]&&r.push(n);else a&&r.push(a)}),r.join(" ")}function v(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.days;if(!r||!e)return!1;let s=D(r),a=D(e);return{[l.days]:s.date===a.date&&s.month===a.month&&s.year===a.year,[l.months]:s.month===a.month&&s.year===a.year,[l.years]:s.year===a.year}[t]}function $(r,e,t){let s=J(r,!1).getTime(),a=J(e,!1).getTime();return t?s>=a:s>a}function E(r,e){return!$(r,e,!0)}function J(r){let e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],t=new Date(r.getTime());return typeof e!="boolean"||e||oe(t),t}function oe(r){return r.setHours(0,0,0,0),r}function w(r,e,t){r.length?r.forEach(s=>{s.addEventListener(e,t)}):r.addEventListener(e,t)}function R(r,e){return!(!r||r===document||r instanceof DocumentFragment)&&(r.matches(e)?r:R(r.parentNode,e))}function A(r,e,t){return r>t?t:r<e?e:r}function Y(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;s<e;s++)t[s-1]=arguments[s];return t.filter(a=>a).forEach(a=>{for(let[n,i]of Object.entries(a))if(i!==void 0&&i.toString()==="[object Object]"){let h=r[n]!==void 0?r[n].toString():void 0,o=i.toString(),d=Array.isArray(i)?[]:{};r[n]=r[n]?h!==o?d:r[n]:d,Y(r[n],i)}else r[n]=i}),r}function C(r){let e=r;return r instanceof Date||(e=new Date(r)),isNaN(e.getTime())&&(console.log('Unable to convert value "'.concat(r,'" to Date object')),e=!1),e}function G(r){let e="\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;";return new RegExp("(^|>|"+e+")("+r+")($|<|"+e+")","g")}function V(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class le{constructor(){let{type:e,date:t,dp:s,opts:a,body:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};V(this,"focus",()=>{this.$cell.classList.add("-focus-"),this.focused=!0}),V(this,"removeFocus",()=>{this.$cell.classList.remove("-focus-"),this.focused=!1}),V(this,"select",()=>{this.$cell.classList.add("-selected-"),this.selected=!0}),V(this,"removeSelect",()=>{this.$cell.classList.remove("-selected-","-range-from-","-range-to-"),this.selected=!1}),V(this,"onChangeSelectedDate",()=>{this.isDisabled||(this._handleSelectedStatus(),this.opts.range&&this._handleRangeStatus())}),V(this,"onChangeFocusDate",i=>{if(!i)return void(this.focused&&this.removeFocus());let h=v(i,this.date,this.type);h?this.focus():!h&&this.focused&&this.removeFocus(),this.opts.range&&this._handleRangeStatus()}),V(this,"render",()=>(this.$cell.innerHTML=this._getHtml(),this.$cell.adpCell=this,this.$cell)),this.type=e,this.singleType=this.type.slice(0,-1),this.date=t,this.dp=s,this.opts=a,this.body=n,this.customData=!1,this.init()}init(){let{range:e,onRenderCell:t}=this.opts;t&&(this.customData=t({date:this.date,cellType:this.singleType,datepicker:this.dp})),this._createElement(),this._bindDatepickerEvents(),this._handleInitialFocusStatus(),this.dp.hasSelectedDates&&(this._handleSelectedStatus(),e&&this._handleRangeStatus())}_bindDatepickerEvents(){this.dp.on(l.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.on(l.eventChangeFocusDate,this.onChangeFocusDate)}unbindDatepickerEvents(){this.dp.off(l.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.off(l.eventChangeFocusDate,this.onChangeFocusDate)}_createElement(){var e;let{year:t,month:s,date:a}=D(this.date),n=((e=this.customData)===null||e===void 0?void 0:e.attrs)||{};this.$cell=b({className:this._getClassName(),attrs:{"data-year":t,"data-month":s,"data-date":a,...n}})}_getClassName(){var e,t;let s=new Date,{selectOtherMonths:a,selectOtherYears:n}=this.opts,{minDate:i,maxDate:h}=this.dp,{day:o}=D(this.date),d=this._isOutOfMinMaxRange(),c=(e=this.customData)===null||e===void 0?void 0:e.disabled,u=M("air-datepicker-cell","-".concat(this.singleType,"-"),{"-current-":v(s,this.date,this.type),"-min-date-":i&&v(i,this.date,this.type),"-max-date-":h&&v(h,this.date,this.type)}),p="";switch(this.type){case l.days:p=M({"-weekend-":this.dp.isWeekend(o),"-other-month-":this.isOtherMonth,"-disabled-":this.isOtherMonth&&!a||d||c});break;case l.months:p=M({"-disabled-":d||c});break;case l.years:p=M({"-other-decade-":this.isOtherDecade,"-disabled-":d||this.isOtherDecade&&!n||c})}return M(u,p,(t=this.customData)===null||t===void 0?void 0:t.classes)}_getHtml(){var e;let{year:t,month:s,date:a}=D(this.date),{showOtherMonths:n,showOtherYears:i}=this.opts;if((e=this.customData)!==null&&e!==void 0&&e.html)return this.customData.html;switch(this.type){case l.days:return!n&&this.isOtherMonth?"":a;case l.months:return this.dp.locale[this.opts.monthsField][s];case l.years:return!i&&this.isOtherDecade?"":t}}_isOutOfMinMaxRange(){let{minDate:e,maxDate:t}=this.dp,{type:s,date:a}=this,{month:n,year:i,date:h}=D(a),o=s===l.days,d=s===l.years,c=!!e&&new Date(i,d?e.getMonth():n,o?h:e.getDate()),u=!!t&&new Date(i,d?t.getMonth():n,o?h:t.getDate());return e&&t?E(c,e)||$(u,t):e?E(c,e):t?$(u,t):void 0}destroy(){this.unbindDatepickerEvents()}_handleRangeStatus(){let{rangeDateFrom:e,rangeDateTo:t}=this.dp,s=M({"-in-range-":e&&t&&(a=this.date,n=e,i=t,$(a,n)&&E(a,i)),"-range-from-":e&&v(this.date,e,this.type),"-range-to-":t&&v(this.date,t,this.type)});var a,n,i;this.$cell.classList.remove("-range-from-","-range-to-","-in-range-"),s&&this.$cell.classList.add(...s.split(" "))}_handleSelectedStatus(){let e=this.dp._checkIfDateIsSelected(this.date,this.type);e?this.select():!e&&this.selected&&this.removeSelect()}_handleInitialFocusStatus(){v(this.dp.focusDate,this.date,this.type)&&this.focus()}get isDisabled(){return this.$cell.matches(".-disabled-")}get isOtherMonth(){return this.dp.isOtherMonth(this.date)}get isOtherDecade(){return this.dp.isOtherDecade(this.date)}}function k(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let de={[l.days]:'<div class="air-datepicker-body--day-names"></div>'+'<div class="air-datepicker-body--cells -'.concat(l.days,'-"></div>'),[l.months]:'<div class="air-datepicker-body--cells -'.concat(l.months,'-"></div>'),[l.years]:'<div class="air-datepicker-body--cells -'.concat(l.years,'-"></div>')};const P=".air-datepicker-cell";class ee{constructor(e){let{dp:t,type:s,opts:a}=e;k(this,"handleClick",n=>{let i=n.target.closest(P).adpCell;if(i.isDisabled)return;if(!this.dp.isMinViewReached)return void this.dp.down();let h=this.dp._checkIfDateIsSelected(i.date,i.type);h?this.dp._handleAlreadySelectedDates(h,i.date):this.dp.selectDate(i.date)}),k(this,"handleDayNameClick",n=>{let i=n.target.getAttribute("data-day-index");this.opts.onClickDayName({dayIndex:Number(i),datepicker:this.dp})}),k(this,"onChangeCurrentView",n=>{n!==this.type?this.hide():(this.show(),this.render())}),k(this,"onMouseOverCell",n=>{let i=R(n.target,P);this.dp.setFocusDate(!!i&&i.adpCell.date)}),k(this,"onMouseOutCell",()=>{this.dp.setFocusDate(!1)}),k(this,"onClickBody",n=>{let{onClickDayName:i}=this.opts,h=n.target;h.closest(P)&&this.handleClick(n),i&&h.closest(".air-datepicker-body--day-name")&&this.handleDayNameClick(n)}),k(this,"onMouseDown",n=>{this.pressed=!0;let i=R(n.target,P),h=i&&i.adpCell;v(h.date,this.dp.rangeDateFrom)&&(this.rangeFromFocused=!0),v(h.date,this.dp.rangeDateTo)&&(this.rangeToFocused=!0)}),k(this,"onMouseMove",n=>{if(!this.pressed||!this.dp.isMinViewReached)return;n.preventDefault();let i=R(n.target,P),h=i&&i.adpCell,{selectedDates:o,rangeDateTo:d,rangeDateFrom:c}=this.dp;if(!h||h.isDisabled)return;let{date:u}=h;if(o.length===2){if(this.rangeFromFocused&&!$(u,d)){let{hours:p,minutes:g}=D(c);u.setHours(p),u.setMinutes(g),this.dp.rangeDateFrom=u,this.dp.replaceDate(c,u)}if(this.rangeToFocused&&!E(u,c)){let{hours:p,minutes:g}=D(d);u.setHours(p),u.setMinutes(g),this.dp.rangeDateTo=u,this.dp.replaceDate(d,u)}}}),k(this,"onMouseUp",()=>{this.pressed=!1,this.rangeFromFocused=!1,this.rangeToFocused=!1}),k(this,"onChangeViewDate",(n,i)=>{if(!this.isVisible)return;let h=F(n),o=F(i);switch(this.dp.currentView){case l.days:if(v(n,i,l.months))return;break;case l.months:if(v(n,i,l.years))return;break;case l.years:if(h[0]===o[0]&&h[1]===o[1])return}this.render()}),k(this,"render",()=>{this.destroyCells(),this._generateCells(),this.cells.forEach(n=>{this.$cells.appendChild(n.render())})}),this.dp=t,this.type=s,this.opts=a,this.cells=[],this.$el="",this.pressed=!1,this.isVisible=!0,this.init()}init(){this._buildBaseHtml(),this.type===l.days&&this.renderDayNames(),this.render(),this._bindEvents(),this._bindDatepickerEvents()}_bindEvents(){let{range:e,dynamicRange:t}=this.opts;w(this.$el,"mouseover",this.onMouseOverCell),w(this.$el,"mouseout",this.onMouseOutCell),w(this.$el,"click",this.onClickBody),e&&t&&(w(this.$el,"mousedown",this.onMouseDown),w(this.$el,"mousemove",this.onMouseMove),w(window.document,"mouseup",this.onMouseUp))}_bindDatepickerEvents(){this.dp.on(l.eventChangeViewDate,this.onChangeViewDate),this.dp.on(l.eventChangeCurrentView,this.onChangeCurrentView)}_buildBaseHtml(){this.$el=b({className:"air-datepicker-body -".concat(this.type,"-"),innerHtml:de[this.type]}),this.$names=y(".air-datepicker-body--day-names",this.$el),this.$cells=y(".air-datepicker-body--cells",this.$el)}_getDayNamesHtml(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.dp.locale.firstDay,t="",s=this.dp.isWeekend,{onClickDayName:a}=this.opts,n=e,i=0;for(;i<7;){let h=n%7,o=M("air-datepicker-body--day-name",{[l.cssClassWeekend]:s(h),"-clickable-":!!a}),d=this.dp.locale.daysMin[h];t+='<div class="'.concat(o,`" data-day-index='`).concat(h,"'>").concat(d,"</div>"),i++,n++}return t}_getDaysCells(){let{viewDate:e,locale:{firstDay:t}}=this.dp,s=Z(e),{year:a,month:n}=D(e),i=new Date(a,n,1),h=new Date(a,n,s),o=i.getDay()-t,d=6-h.getDay()+t;o=o<0?o+7:o,d=d>6?d-7:d;let c=function(N,B){let{year:K,month:I,date:q}=D(N);return new Date(K,I,q-B)}(i,o),u=s+o+d,p=c.getDate(),{year:g,month:f}=D(c),_=0;for(;_<u;){let N=new Date(g,f,p+_);this._generateCell(N),_++}}_generateCell(e){let{type:t,dp:s,opts:a}=this,n=new le({type:t,dp:s,opts:a,date:e,body:this});return this.cells.push(n),n}_generateDayCells(){this._getDaysCells()}_generateMonthCells(){let{year:e}=this.dp.parsedViewDate,t=0;for(;t<12;)this.cells.push(this._generateCell(new Date(e,t))),t++}_generateYearCells(){let e=F(this.dp.viewDate),t=e[0]-1,s=e[1]+1,a=t;for(;a<=s;)this.cells.push(this._generateCell(new Date(a,0))),a++}renderDayNames(){this.$names.innerHTML=this._getDayNamesHtml()}_generateCells(){switch(this.type){case l.days:this._generateDayCells();break;case l.months:this._generateMonthCells();break;case l.years:this._generateYearCells()}}show(){this.isVisible=!0,this.$el.classList.remove("-hidden-")}hide(){this.isVisible=!1,this.$el.classList.add("-hidden-")}destroyCells(){this.cells.forEach(e=>e.destroy()),this.cells=[],this.$cells.innerHTML=""}destroy(){this.destroyCells(),this.dp.off(l.eventChangeViewDate,this.onChangeViewDate),this.dp.off(l.eventChangeCurrentView,this.onChangeCurrentView)}}function x(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class ce{constructor(e){let{dp:t,opts:s}=e;x(this,"onClickNav",a=>{let n=R(a.target,".air-datepicker-nav--action");if(!n)return;let i=n.dataset.action;this.dp[i]()}),x(this,"onChangeViewDate",()=>{this.render(),this._resetNavStatus(),this.handleNavStatus()}),x(this,"onChangeCurrentView",()=>{this.render(),this._resetNavStatus(),this.handleNavStatus()}),x(this,"onClickNavTitle",()=>{this.dp.isFinalView||this.dp.up()}),x(this,"update",()=>{let{prevHtml:a,nextHtml:n}=this.opts;this.$prev.innerHTML=a,this.$next.innerHTML=n,this._resetNavStatus(),this.render(),this.handleNavStatus()}),x(this,"renderDelay",()=>{setTimeout(this.render)}),x(this,"render",()=>{this.$title.innerHTML=this._getTitle(),function(a,n){for(let i in n)n[i]?a.classList.add(i):a.classList.remove(i)}(this.$title,{"-disabled-":this.dp.isFinalView})}),this.dp=t,this.opts=s,this.init()}init(){this._createElement(),this._buildBaseHtml(),this._defineDOM(),this.render(),this.handleNavStatus(),this._bindEvents(),this._bindDatepickerEvents()}_defineDOM(){this.$title=y(".air-datepicker-nav--title",this.$el),this.$prev=y('[data-action="prev"]',this.$el),this.$next=y('[data-action="next"]',this.$el)}_bindEvents(){this.$el.addEventListener("click",this.onClickNav),this.$title.addEventListener("click",this.onClickNavTitle)}_bindDatepickerEvents(){this.dp.on(l.eventChangeViewDate,this.onChangeViewDate),this.dp.on(l.eventChangeCurrentView,this.onChangeCurrentView),this.isNavIsFunction&&(this.dp.on(l.eventChangeSelectedDate,this.renderDelay),this.dp.opts.timepicker&&this.dp.on(l.eventChangeTime,this.render))}destroy(){this.dp.off(l.eventChangeViewDate,this.onChangeViewDate),this.dp.off(l.eventChangeCurrentView,this.onChangeCurrentView),this.isNavIsFunction&&(this.dp.off(l.eventChangeSelectedDate,this.renderDelay),this.dp.opts.timepicker&&this.dp.off(l.eventChangeTime,this.render))}_createElement(){this.$el=b({tagName:"nav",className:"air-datepicker-nav"})}_getTitle(){let{dp:e,opts:t}=this,s=t.navTitles[e.currentView];return typeof s=="function"?s(e):e.formatDate(e.viewDate,s)}handleNavStatus(){let{disableNavWhenOutOfRange:e}=this.opts,{minDate:t,maxDate:s}=this.dp;if(!t&&!s||!e)return;let{year:a,month:n}=this.dp.parsedViewDate,i=!!t&&D(t),h=!!s&&D(s);switch(this.dp.currentView){case l.days:t&&i.month>=n&&i.year>=a&&this._disableNav("prev"),s&&h.month<=n&&h.year<=a&&this._disableNav("next");break;case l.months:t&&i.year>=a&&this._disableNav("prev"),s&&h.year<=a&&this._disableNav("next");break;case l.years:{let o=F(this.dp.viewDate);t&&i.year>=o[0]&&this._disableNav("prev"),s&&h.year<=o[1]&&this._disableNav("next");break}}}_disableNav(e){y('[data-action="'+e+'"]',this.$el).classList.add("-disabled-")}_resetNavStatus(){(function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];e.length?e.forEach(n=>{n.classList.remove(...s)}):e.classList.remove(...s)})(this.$el.querySelectorAll(".air-datepicker-nav--action"),"-disabled-")}_buildBaseHtml(){let{prevHtml:e,nextHtml:t}=this.opts;this.$el.innerHTML='<div class="air-datepicker-nav--action" data-action="prev">'.concat(e,"</div>")+'<div class="air-datepicker-nav--title"></div>'+'<div class="air-datepicker-nav--action" data-action="next">'.concat(t,"</div>")}get isNavIsFunction(){let{navTitles:e}=this.opts;return Object.keys(e).find(t=>typeof e[t]=="function")}}var te={today:{content:r=>r.locale.today,onClick:r=>r.setViewDate(new Date)},clear:{content:r=>r.locale.clear,onClick:r=>r.clear()}};class ue{constructor(e){let{dp:t,opts:s}=e;this.dp=t,this.opts=s,this.init()}init(){this.createElement(),this.render()}createElement(){this.$el=b({className:"air-datepicker-buttons"})}destroy(){this.$el.parentNode.removeChild(this.$el)}clearHtml(){return this.$el.innerHTML="",this}generateButtons(){let{buttons:e}=this.opts;Array.isArray(e)||(e=[e]),e.forEach(t=>{let s=t;typeof t=="string"&&te[t]&&(s=te[t]);let a=this.createButton(s);s.onClick&&this.attachEventToButton(a,s.onClick),this.$el.appendChild(a)})}attachEventToButton(e,t){e.addEventListener("click",()=>{t(this.dp)})}createButton(e){let{content:t,className:s,tagName:a="button",attrs:n={}}=e,i=typeof t=="function"?t(this.dp):t;return b({tagName:a,innerHtml:"<span tabindex='-1'>".concat(i,"</span>"),className:M("air-datepicker-button",s),attrs:n})}render(){this.generateButtons()}}function H(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class pe{constructor(){let{opts:e,dp:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};H(this,"toggleTimepickerIsActive",a=>{this.dp.timepickerIsActive=a}),H(this,"onChangeSelectedDate",a=>{let{date:n,updateTime:i=!1}=a;n&&(this.setMinMaxTime(n),this.setCurrentTime(!!i&&n),this.addTimeToDate(n))}),H(this,"onChangeLastSelectedDate",a=>{a&&(this.setTime(a),this.render())}),H(this,"onChangeInputRange",a=>{let n=a.target;this[n.getAttribute("name")]=n.value,this.updateText(),this.dp.trigger(l.eventChangeTime,{hours:this.hours,minutes:this.minutes})}),H(this,"onMouseEnterLeave",a=>{let n=a.target.getAttribute("name"),i=this.$minutesText;n==="hours"&&(i=this.$hoursText),i.classList.toggle("-focus-")}),H(this,"onFocus",()=>{this.toggleTimepickerIsActive(!0)}),H(this,"onBlur",()=>{this.toggleTimepickerIsActive(!1)}),this.opts=e,this.dp=t;let{timeFormat:s}=this.dp.locale;s&&(s.match(G("h"))||s.match(G("hh")))&&(this.ampm=!0),this.init()}init(){this.setTime(this.dp.lastSelectedDate||this.dp.viewDate),this.createElement(),this.buildHtml(),this.defineDOM(),this.render(),this.bindDatepickerEvents(),this.bindDOMEvents()}bindDatepickerEvents(){this.dp.on(l.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.on(l.eventChangeLastSelectedDate,this.onChangeLastSelectedDate)}bindDOMEvents(){let e="input";navigator.userAgent.match(/trident/gi)&&(e="change"),w(this.$ranges,e,this.onChangeInputRange),w(this.$ranges,"mouseenter",this.onMouseEnterLeave),w(this.$ranges,"mouseleave",this.onMouseEnterLeave),w(this.$ranges,"focus",this.onFocus),w(this.$ranges,"mousedown",this.onFocus),w(this.$ranges,"blur",this.onBlur)}createElement(){this.$el=b({className:M("air-datepicker-time",{"-am-pm-":this.dp.ampm})})}destroy(){this.dp.off(l.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.off(l.eventChangeLastSelectedDate,this.onChangeLastSelectedDate),this.$el.parentNode.removeChild(this.$el)}buildHtml(){let{ampm:e,hours:t,displayHours:s,minutes:a,minHours:n,minMinutes:i,maxHours:h,maxMinutes:o,dayPeriod:d,opts:{hoursStep:c,minutesStep:u}}=this;this.$el.innerHTML='<div class="air-datepicker-time--current">'+' <span class="air-datepicker-time--current-hours">'.concat(O(s),"</span>")+' <span class="air-datepicker-time--current-colon">:</span>'+' <span class="air-datepicker-time--current-minutes">'.concat(O(a),"</span>")+" ".concat(e?"<span class='air-datepicker-time--current-ampm'>".concat(d,"</span>"):"")+'</div><div class="air-datepicker-time--sliders"> <div class="air-datepicker-time--row">'+' <input type="range" name="hours" value="'.concat(t,'" min="').concat(n,'" max="').concat(h,'" step="').concat(c,'"/>')+' </div> <div class="air-datepicker-time--row">'+' <input type="range" name="minutes" value="'.concat(a,'" min="').concat(i,'" max="').concat(o,'" step="').concat(u,'"/>')+" </div></div>"}defineDOM(){let e=t=>y(t,this.$el);this.$ranges=this.$el.querySelectorAll('[type="range"]'),this.$hours=e('[name="hours"]'),this.$minutes=e('[name="minutes"]'),this.$hoursText=e(".air-datepicker-time--current-hours"),this.$minutesText=e(".air-datepicker-time--current-minutes"),this.$ampm=e(".air-datepicker-time--current-ampm")}setTime(e){this.setMinMaxTime(e),this.setCurrentTime(e)}addTimeToDate(e){e&&(e.setHours(this.hours),e.setMinutes(this.minutes))}setMinMaxTime(e){if(this.setMinMaxTimeFromOptions(),e){let{minDate:t,maxDate:s}=this.dp;t&&v(e,t)&&this.setMinTimeFromMinDate(t),s&&v(e,s)&&this.setMaxTimeFromMaxDate(s)}}setCurrentTime(e){let{hours:t,minutes:s}=e?D(e):this;this.hours=A(t,this.minHours,this.maxHours),this.minutes=A(s,this.minMinutes,this.maxMinutes)}setMinMaxTimeFromOptions(){let{minHours:e,minMinutes:t,maxHours:s,maxMinutes:a}=this.opts;this.minHours=A(e,0,23),this.minMinutes=A(t,0,59),this.maxHours=A(s,0,23),this.maxMinutes=A(a,0,59)}setMinTimeFromMinDate(e){let{lastSelectedDate:t}=this.dp;this.minHours=e.getHours(),t&&t.getHours()>e.getHours()?this.minMinutes=this.opts.minMinutes:this.minMinutes=e.getMinutes()}setMaxTimeFromMaxDate(e){let{lastSelectedDate:t}=this.dp;this.maxHours=e.getHours(),t&&t.getHours()<e.getHours()?this.maxMinutes=this.opts.maxMinutes:this.maxMinutes=e.getMinutes()}getDayPeriod(e,t){let s=e,a=Number(e);e instanceof Date&&(s=D(e),a=Number(s.hours));let n="am";if(t||this.ampm){switch(!0){case a===12:case a>11:n="pm"}a=a%12==0?12:a%12}return{hours:a,dayPeriod:n}}updateSliders(){z(this.$hours,{min:this.minHours,max:this.maxHours}).value=this.hours,z(this.$minutes,{min:this.minMinutes,max:this.maxMinutes}).value=this.minutes}updateText(){this.$hoursText.innerHTML=O(this.displayHours),this.$minutesText.innerHTML=O(this.minutes),this.ampm&&(this.$ampm.innerHTML=this.dayPeriod)}set hours(e){this._hours=e;let{hours:t,dayPeriod:s}=this.getDayPeriod(e);this.displayHours=t,this.dayPeriod=s}get hours(){return this._hours}render(){this.updateSliders(),this.updateText()}}function L(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class me{constructor(e){let{dp:t,opts:s}=e;L(this,"pressedKeys",new Set),L(this,"hotKeys",new Map([[[["Control","ArrowRight"],["Control","ArrowUp"]],a=>a.month++],[[["Control","ArrowLeft"],["Control","ArrowDown"]],a=>a.month--],[[["Shift","ArrowRight"],["Shift","ArrowUp"]],a=>a.year++],[[["Shift","ArrowLeft"],["Shift","ArrowDown"]],a=>a.year--],[[["Alt","ArrowRight"],["Alt","ArrowUp"]],a=>a.year+=10],[[["Alt","ArrowLeft"],["Alt","ArrowDown"]],a=>a.year-=10],[["Control","Shift","ArrowUp"],(a,n)=>n.up()]])),L(this,"handleHotKey",a=>{let n=this.hotKeys.get(a),i=D(this.getInitialFocusDate());n(i,this.dp);let{year:h,month:o,date:d}=i,c=Z(new Date(h,o));c<d&&(d=c);let u=this.dp.getClampedDate(new Date(h,o,d));this.dp.setFocusDate(u,{viewDateTransition:!0})}),L(this,"isHotKeyPressed",()=>{let a=!1,n=this.pressedKeys.size,i=h=>this.pressedKeys.has(h);for(let[h]of this.hotKeys){if(a)break;if(Array.isArray(h[0]))h.forEach(o=>{a||n!==o.length||(a=o.every(i)&&h)});else{if(n!==h.length)continue;a=h.every(i)&&h}}return a}),L(this,"isArrow",a=>a>=37&&a<=40),L(this,"onKeyDown",a=>{let{key:n,which:i}=a,{dp:h,dp:{focusDate:o},opts:d}=this;this.registerKey(n);let c=this.isHotKeyPressed();if(c)return a.preventDefault(),void this.handleHotKey(c);if(this.isArrow(i))return a.preventDefault(),void this.focusNextCell(n);if(n==="Enter"){if(h.currentView!==d.minView)return void h.down();if(o){let u=h._checkIfDateIsSelected(o);return void(u?h._handleAlreadySelectedDates(u,o):h.selectDate(o))}}n==="Escape"&&this.dp.hide()}),L(this,"onKeyUp",a=>{this.removeKey(a.key)}),this.dp=t,this.opts=s,this.init()}init(){this.bindKeyboardEvents()}bindKeyboardEvents(){let{$el:e}=this.dp;e.addEventListener("keydown",this.onKeyDown),e.addEventListener("keyup",this.onKeyUp)}destroy(){let{$el:e}=this.dp;e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("keyup",this.onKeyUp),this.hotKeys=null,this.pressedKeys=null}getInitialFocusDate(){let{focusDate:e,currentView:t,selectedDates:s,parsedViewDate:{year:a,month:n}}=this.dp,i=e||s[s.length-1];if(!i)switch(t){case l.days:i=new Date(a,n,new Date().getDate());break;case l.months:i=new Date(a,n,1);break;case l.years:i=new Date(a,0,1)}return i}focusNextCell(e){let t=this.getInitialFocusDate(),{currentView:s}=this.dp,{days:a,months:n,years:i}=l,h=D(t),o=h.year,d=h.month,c=h.date;switch(e){case"ArrowLeft":s===a&&(c-=1),s===n&&(d-=1),s===i&&(o-=1);break;case"ArrowUp":s===a&&(c-=7),s===n&&(d-=3),s===i&&(o-=4);break;case"ArrowRight":s===a&&(c+=1),s===n&&(d+=1),s===i&&(o+=1);break;case"ArrowDown":s===a&&(c+=7),s===n&&(d+=3),s===i&&(o+=4)}let u=this.dp.getClampedDate(new Date(o,d,c));this.dp.setFocusDate(u,{viewDateTransition:!0})}registerKey(e){this.pressedKeys.add(e)}removeKey(e){this.pressedKeys.delete(e)}}let ge={on(r,e){this.__events||(this.__events={}),this.__events[r]?this.__events[r].push(e):this.__events[r]=[e]},off(r,e){this.__events&&this.__events[r]&&(this.__events[r]=this.__events[r].filter(t=>t!==e))},removeAllEvents(){this.__events={}},trigger(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;s<e;s++)t[s-1]=arguments[s];this.__events&&this.__events[r]&&this.__events[r].forEach(a=>{a(...t)})}};function m(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let X="",W="",S="",se=!1;class T{constructor(e,t){var s=this;if(m(this,"viewIndexes",[l.days,l.months,l.years]),m(this,"next",()=>{let{year:i,month:h}=this.parsedViewDate;switch(this.currentView){case l.days:this.setViewDate(new Date(i,h+1,1));break;case l.months:this.setViewDate(new Date(i+1,h,1));break;case l.years:this.setViewDate(new Date(i+10,0,1))}}),m(this,"prev",()=>{let{year:i,month:h}=this.parsedViewDate;switch(this.currentView){case l.days:this.setViewDate(new Date(i,h-1,1));break;case l.months:this.setViewDate(new Date(i-1,h,1));break;case l.years:this.setViewDate(new Date(i-10,0,1))}}),m(this,"_finishHide",()=>{this.hideAnimation=!1,this._destroyComponents(),this.$container.removeChild(this.$datepicker)}),m(this,"setPosition",function(i){let h=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(typeof(i=i||s.opts.position)=="function")return void(s.customHide=i({$datepicker:s.$datepicker,$target:s.$el,$pointer:s.$pointer,isViewChange:h,done:s._finishHide}));let o,d,{isMobile:c}=s.opts,u=s.$el.getBoundingClientRect(),p=s.$el.getBoundingClientRect(),g=s.$datepicker.offsetParent,f=s.$el.offsetParent,_=s.$datepicker.getBoundingClientRect(),N=i.split(" "),B=window.scrollY,K=window.scrollX,I=s.opts.offset,q=N[0],De=N[1];if(c)s.$datepicker.style.cssText="left: 50%; top: 50%";else{if(g===f&&g!==document.body&&(p={top:s.$el.offsetTop,left:s.$el.offsetLeft,width:u.width,height:s.$el.offsetHeight},B=0,K=0),g!==f&&g!==document.body){let ae=g.getBoundingClientRect();p={top:u.top-ae.top,left:u.left-ae.left,width:u.width,height:u.height},B=0,K=0}switch(q){case"top":o=p.top-_.height-I;break;case"right":d=p.left+p.width+I;break;case"bottom":o=p.top+p.height+I;break;case"left":d=p.left-_.width-I}switch(De){case"top":o=p.top;break;case"right":d=p.left+p.width-_.width;break;case"bottom":o=p.top+p.height-_.height;break;case"left":d=p.left;break;case"center":/left|right/.test(q)?o=p.top+p.height/2-_.height/2:d=p.left+p.width/2-_.width/2}s.$datepicker.style.cssText="left: ".concat(d+K,"px; top: ").concat(o+B,"px")}}),m(this,"_setInputValue",()=>{let{opts:i,$altField:h,locale:{dateFormat:o}}=this,{altFieldDateFormat:d,altField:c}=i;c&&h&&(h.value=this._getInputValue(d)),this.$el.value=this._getInputValue(o)}),m(this,"_getInputValue",i=>{let{selectedDates:h,opts:o}=this,{multipleDates:d,multipleDatesSeparator:c}=o;if(!h.length)return"";let u=typeof i=="function",p=u?i(d?h:h[0]):h.map(g=>this.formatDate(g,i));return p=u?p:p.join(c),p}),m(this,"_checkIfDateIsSelected",function(i){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l.days,o=!1;return s.selectedDates.some(d=>{let c=v(i,d,h);return o=c&&d,c}),o}),m(this,"_scheduleCallAfterTransition",i=>{this._cancelScheduledCall(),i&&i(!1),this._onTransitionEnd=()=>{i&&i(!0)},this.$datepicker.addEventListener("transitionend",this._onTransitionEnd,{once:!0})}),m(this,"_cancelScheduledCall",()=>{this.$datepicker.removeEventListener("transitionend",this._onTransitionEnd)}),m(this,"setViewDate",i=>{if(!((i=C(i))instanceof Date)||v(i,this.viewDate))return;let h=this.viewDate;this.viewDate=i;let{onChangeViewDate:o}=this.opts;if(o){let{month:d,year:c}=this.parsedViewDate;o({month:d,year:c,decade:this.curDecade})}this.trigger(l.eventChangeViewDate,i,h)}),m(this,"setFocusDate",function(i){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!i||(i=C(i))instanceof Date)&&(s.focusDate=i,s.opts.range&&i&&s._handleRangeOnFocus(),s.trigger(l.eventChangeFocusDate,i,h))}),m(this,"setCurrentView",i=>{if(this.viewIndexes.includes(i)){if(this.currentView=i,this.elIsInput&&this.visible&&this.setPosition(void 0,!0),this.trigger(l.eventChangeCurrentView,i),!this.views[i]){let h=this.views[i]=new ee({dp:this,opts:this.opts,type:i});this.shouldUpdateDOM&&this.$content.appendChild(h.$el)}this.opts.onChangeView&&this.opts.onChangeView(i)}}),m(this,"_updateLastSelectedDate",i=>{this.lastSelectedDate=i,this.trigger(l.eventChangeLastSelectedDate,i)}),m(this,"destroy",()=>{let{showEvent:i,isMobile:h}=this.opts,o=this.$datepicker.parentNode;o&&o.removeChild(this.$datepicker),this.$el.removeEventListener(i,this._onFocus),this.$el.removeEventListener("blur",this._onBlur),window.removeEventListener("resize",this._onResize),h&&this._removeMobileAttributes(),this.keyboardNav&&this.keyboardNav.destroy(),this.views=null,this.nav=null,this.$datepicker=null,this.opts=null,this.$customContainer=null,this.viewDate=null,this.focusDate=null,this.selectedDates=null,this.rangeDateFrom=null,this.rangeDateTo=null}),m(this,"update",i=>{let h=Y({},this.opts);Y(this.opts,i);let{timepicker:o,buttons:d,range:c,selectedDates:u,isMobile:p}=this.opts,g=this.visible||this.treatAsInline;this._createMinMaxDates(),this._limitViewDateByMaxMinDates(),this._handleLocale(),!h.selectedDates&&u&&this.selectDate(u),i.view&&this.setCurrentView(i.view),this._setInputValue(),h.range&&!c?(this.rangeDateTo=!1,this.rangeDateFrom=!1):!h.range&&c&&this.selectedDates.length&&(this.rangeDateFrom=this.selectedDates[0],this.rangeDateTo=this.selectedDates[1]),h.timepicker&&!o?(g&&this.timepicker.destroy(),this.timepicker=!1,this.$timepicker.parentNode.removeChild(this.$timepicker)):!h.timepicker&&o&&this._addTimepicker(),!h.buttons&&d?this._addButtons():h.buttons&&!d?(this.buttons.destroy(),this.$buttons.parentNode.removeChild(this.$buttons)):g&&h.buttons&&d&&this.buttons.clearHtml().render(),!h.isMobile&&p?(this.treatAsInline||S||this._createMobileOverlay(),this._addMobileAttributes(),this.visible&&this._showMobileOverlay()):h.isMobile&&!p&&(this._removeMobileAttributes(),this.visible&&(S.classList.remove("-active-"),typeof this.opts.position!="function"&&this.setPosition())),g&&(this.nav.update(),this.views[this.currentView].render(),this.currentView===l.days&&this.views[this.currentView].renderDayNames())}),m(this,"isOtherMonth",i=>{let{month:h}=D(i);return h!==this.parsedViewDate.month}),m(this,"isOtherYear",i=>{let{year:h}=D(i);return h!==this.parsedViewDate.year}),m(this,"isOtherDecade",i=>{let{year:h}=D(i),[o,d]=F(this.viewDate);return h<o||h>d}),m(this,"_onChangeSelectedDate",i=>{let{silent:h}=i;setTimeout(()=>{this._setInputValue(),this.opts.onSelect&&!h&&this._triggerOnSelect()})}),m(this,"_onChangeFocusedDate",function(i){let{viewDateTransition:h}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!i)return;let o=!1;h&&(o=s.isOtherMonth(i)||s.isOtherYear(i)||s.isOtherDecade(i)),o&&s.setViewDate(i)}),m(this,"_onChangeTime",i=>{let{hours:h,minutes:o}=i,d=new Date,{lastSelectedDate:c,opts:{onSelect:u}}=this,p=c;c||(p=d);let g=this.getCell(p,this.currentViewSingular),f=g&&g.adpCell;f&&f.isDisabled||(p.setHours(h),p.setMinutes(o),c?(this._setInputValue(),u&&this._triggerOnSelect()):this.selectDate(p))}),m(this,"_onFocus",i=>{this.visible||this.show()}),m(this,"_onBlur",i=>{this.inFocus||!this.visible||this.opts.isMobile||this.hide()}),m(this,"_onMouseDown",i=>{this.inFocus=!0}),m(this,"_onMouseUp",i=>{this.inFocus=!1,this.$el.focus()}),m(this,"_onResize",()=>{this.visible&&typeof this.opts.position!="function"&&this.setPosition()}),m(this,"_onClickOverlay",()=>{this.visible&&this.hide()}),m(this,"isWeekend",i=>this.opts.weekends.includes(i)),m(this,"getClampedDate",i=>{let{minDate:h,maxDate:o}=this,d=i;return o&&$(i,o)?d=o:h&&E(i,h)&&(d=h),d}),this.$el=y(e),!this.$el)return;this.$datepicker=b({className:"air-datepicker"}),this.opts=Y({},Q,t),this.$customContainer=!!this.opts.container&&y(this.opts.container),this.$altField=y(this.opts.altField||!1),X||(X=y("body"));let{view:a,startDate:n}=this.opts;n||(this.opts.startDate=new Date),this.$el.nodeName==="INPUT"&&(this.elIsInput=!0),this.inited=!1,this.visible=!1,this.viewDate=C(this.opts.startDate),this.focusDate=!1,this.initialReadonly=this.$el.getAttribute("readonly"),this.customHide=!1,this.currentView=a,this.selectedDates=[],this.views={},this.keys=[],this.rangeDateFrom="",this.rangeDateTo="",this.timepickerIsActive=!1,this.treatAsInline=this.opts.inline||!this.elIsInput,this.init()}init(){let{opts:e,treatAsInline:t,opts:{inline:s,isMobile:a,selectedDates:n,keyboardNav:i,onlyTimepicker:h}}=this;var o;se||s||!this.elIsInput||(se=!0,W=b({className:o=T.defaultContainerId,id:o}),X.appendChild(W)),!a||S||t||this._createMobileOverlay(),this._handleLocale(),this._bindSubEvents(),this._createMinMaxDates(),this._limitViewDateByMaxMinDates(),this.elIsInput&&(s||this._bindEvents(),i&&!h&&(this.keyboardNav=new me({dp:this,opts:e}))),n&&this.selectDate(n,{silent:!0}),this.opts.visible&&!t&&this.show(),a&&!t&&this.$el.setAttribute("readonly",!0),t&&this._createComponents()}_createMobileOverlay(){S=b({className:"air-datepicker-overlay"}),W.appendChild(S)}_createComponents(){let{opts:e,treatAsInline:t,opts:{inline:s,buttons:a,timepicker:n,position:i,classes:h,onlyTimepicker:o,isMobile:d}}=this;this._buildBaseHtml(),this.elIsInput&&(s||this._setPositionClasses(i)),!s&&this.elIsInput||this.$datepicker.classList.add("-inline-"),h&&this.$datepicker.classList.add(...h.split(" ")),o&&this.$datepicker.classList.add("-only-timepicker-"),d&&!t&&this._addMobileAttributes(),this.views[this.currentView]=new ee({dp:this,type:this.currentView,opts:e}),this.nav=new ce({dp:this,opts:e}),n&&this._addTimepicker(),a&&this._addButtons(),this.$content.appendChild(this.views[this.currentView].$el),this.$nav.appendChild(this.nav.$el)}_destroyComponents(){for(let e in this.views)this.views[e].destroy();this.views={},this.nav.destroy(),this.timepicker&&this.timepicker.destroy()}_addMobileAttributes(){S.addEventListener("click",this._onClickOverlay),this.$datepicker.classList.add("-is-mobile-"),this.$el.setAttribute("readonly",!0)}_removeMobileAttributes(){S.removeEventListener("click",this._onClickOverlay),this.$datepicker.classList.remove("-is-mobile-"),this.initialReadonly||this.initialReadonly===""||this.$el.removeAttribute("readonly")}_createMinMaxDates(){let{minDate:e,maxDate:t}=this.opts;this.minDate=!!e&&C(e),this.maxDate=!!t&&C(t)}_addTimepicker(){this.$timepicker=b({className:"air-datepicker--time"}),this.$datepicker.appendChild(this.$timepicker),this.timepicker=new pe({dp:this,opts:this.opts}),this.$timepicker.appendChild(this.timepicker.$el)}_addButtons(){this.$buttons=b({className:"air-datepicker--buttons"}),this.$datepicker.appendChild(this.$buttons),this.buttons=new ue({dp:this,opts:this.opts}),this.$buttons.appendChild(this.buttons.$el)}_bindSubEvents(){this.on(l.eventChangeSelectedDate,this._onChangeSelectedDate),this.on(l.eventChangeFocusDate,this._onChangeFocusedDate),this.on(l.eventChangeTime,this._onChangeTime)}_buildBaseHtml(){let{inline:e}=this.opts;var t,s;this.elIsInput?e?(t=this.$datepicker,(s=this.$el).parentNode.insertBefore(t,s.nextSibling)):this.$container.appendChild(this.$datepicker):this.$el.appendChild(this.$datepicker),this.$datepicker.innerHTML='<i class="air-datepicker--pointer"></i><div class="air-datepicker--navigation"></div><div class="air-datepicker--content"></div>',this.$content=y(".air-datepicker--content",this.$datepicker),this.$pointer=y(".air-datepicker--pointer",this.$datepicker),this.$nav=y(".air-datepicker--navigation",this.$datepicker)}_handleLocale(){let{locale:e,dateFormat:t,firstDay:s,timepicker:a,onlyTimepicker:n,timeFormat:i,dateTimeSeparator:h}=this.opts;var o;this.locale=(o=e,JSON.parse(JSON.stringify(o))),t&&(this.locale.dateFormat=t),i!==void 0&&i!==""&&(this.locale.timeFormat=i);let{timeFormat:d}=this.locale;if(s!==""&&(this.locale.firstDay=s),a&&typeof t!="function"){let c=d?h:"";this.locale.dateFormat=[this.locale.dateFormat,d||""].join(c)}n&&typeof t!="function"&&(this.locale.dateFormat=this.locale.timeFormat)}_setPositionClasses(e){if(typeof e=="function")return void this.$datepicker.classList.add("-custom-position-");let t=(e=e.split(" "))[0],s=e[1],a="air-datepicker -".concat(t,"-").concat(s,"- -from-").concat(t,"-");this.$datepicker.classList.add(...a.split(" "))}_bindEvents(){this.$el.addEventListener(this.opts.showEvent,this._onFocus),this.$el.addEventListener("blur",this._onBlur),this.$datepicker.addEventListener("mousedown",this._onMouseDown),this.$datepicker.addEventListener("mouseup",this._onMouseUp),window.addEventListener("resize",this._onResize)}_limitViewDateByMaxMinDates(){let{viewDate:e,minDate:t,maxDate:s}=this;s&&$(e,s)&&this.setViewDate(s),t&&E(e,t)&&this.setViewDate(t)}formatDate(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.viewDate,t=arguments.length>1?arguments[1]:void 0;if(e=C(e),!(e instanceof Date))return;let s=t,a=this.locale,n=D(e),i=F(e),h=T.replacer,o="am";this.opts.timepicker&&this.timepicker&&(o=this.timepicker.getDayPeriod(e).dayPeriod);let d={T:e.getTime(),m:n.minutes,mm:n.fullMinutes,h:n.hours12,hh:n.fullHours12,H:n.hours,HH:n.fullHours,aa:o,AA:o.toUpperCase(),E:a.daysShort[n.day],EEEE:a.days[n.day],d:n.date,dd:n.fullDate,M:n.month+1,MM:n.fullMonth,MMM:a.monthsShort[n.month],MMMM:a.months[n.month],yy:n.year.toString().slice(-2),yyyy:n.year,yyyy1:i[0],yyyy2:i[1]};for(let[c,u]of Object.entries(d))s=h(s,G(c),u);return s}down(e){this._handleUpDownActions(e,"down")}up(e){this._handleUpDownActions(e,"up")}selectDate(e){let t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{currentView:a,parsedViewDate:n,selectedDates:i}=this,{updateTime:h}=s,{moveToOtherMonthsOnSelect:o,moveToOtherYearsOnSelect:d,multipleDates:c,range:u,autoClose:p}=this.opts,g=i.length;if(Array.isArray(e))return e.forEach(f=>{this.selectDate(f,s)}),new Promise(f=>{setTimeout(f)});if((e=C(e))instanceof Date){if(a===l.days&&e.getMonth()!==n.month&&o&&(t=new Date(e.getFullYear(),e.getMonth(),1)),a===l.years&&e.getFullYear()!==n.year&&d&&(t=new Date(e.getFullYear(),0,1)),t&&this.setViewDate(t),c&&!u){if(g===c)return;this._checkIfDateIsSelected(e)||i.push(e)}else if(u)switch(g){case 1:i.push(e),this.rangeDateTo||(this.rangeDateTo=e),$(this.rangeDateFrom,this.rangeDateTo)&&(this.rangeDateTo=this.rangeDateFrom,this.rangeDateFrom=e),this.selectedDates=[this.rangeDateFrom,this.rangeDateTo];break;case 2:this.selectedDates=[e],this.rangeDateFrom=e,this.rangeDateTo="";break;default:this.selectedDates=[e],this.rangeDateFrom=e}else this.selectedDates=[e];return this.trigger(l.eventChangeSelectedDate,{action:l.actionSelectDate,silent:s==null?void 0:s.silent,date:e,updateTime:h}),this._updateLastSelectedDate(e),p&&!this.timepickerIsActive&&this.visible&&(c||u?u&&g===1&&this.hide():this.hide()),new Promise(f=>{setTimeout(f)})}}unselectDate(e){let t=this.selectedDates,s=this;if((e=C(e))instanceof Date)return t.some((a,n)=>{if(v(a,e))return t.splice(n,1),s.selectedDates.length?s._updateLastSelectedDate(s.selectedDates[s.selectedDates.length-1]):(s.rangeDateFrom="",s.rangeDateTo="",s._updateLastSelectedDate(!1)),this.trigger(l.eventChangeSelectedDate,{action:l.actionUnselectDate,date:e}),!0})}replaceDate(e,t){let s=this.selectedDates.find(n=>v(n,e,this.currentView)),a=this.selectedDates.indexOf(s);a<0||v(this.selectedDates[a],t,this.currentView)||(this.selectedDates[a]=t,this.trigger(l.eventChangeSelectedDate,{action:l.actionSelectDate,date:t,updateTime:!0}),this._updateLastSelectedDate(t))}clear(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.selectedDates=[],this.rangeDateFrom=!1,this.rangeDateTo=!1,this.trigger(l.eventChangeSelectedDate,{action:l.actionUnselectDate,silent:e.silent}),new Promise(t=>{setTimeout(t)})}show(){let{onShow:e,isMobile:t}=this.opts;this._cancelScheduledCall(),this.visible||this.hideAnimation||this._createComponents(),this.setPosition(this.opts.position),this.$datepicker.classList.add("-active-"),this.visible=!0,e&&this._scheduleCallAfterTransition(e),t&&this._showMobileOverlay()}hide(){let{onHide:e,isMobile:t}=this.opts,s=this._hasTransition();this.visible=!1,this.hideAnimation=!0,this.$datepicker.classList.remove("-active-"),this.customHide&&this.customHide(),this.elIsInput&&this.$el.blur(),this._scheduleCallAfterTransition(a=>{!this.customHide&&(a&&s||!a&&!s)&&this._finishHide(),e&&e(a)}),t&&S.classList.remove("-active-")}_triggerOnSelect(){let e=[],t=[],{selectedDates:s,locale:a,opts:{onSelect:n,multipleDates:i,range:h}}=this,o=i||h,d=typeof a.dateFormat=="function";s.length&&(e=s.map(J),t=d?i?a.dateFormat(e):e.map(c=>a.dateFormat(c)):e.map(c=>this.formatDate(c,a.dateFormat))),n({date:o?e:e[0],formattedDate:o?t:t[0],datepicker:this})}_handleAlreadySelectedDates(e,t){let{range:s,toggleSelected:a}=this.opts;s?a?this.unselectDate(t):this.selectedDates.length!==2&&this.selectDate(t):a&&this.unselectDate(t),a||this._updateLastSelectedDate(e)}_handleUpDownActions(e,t){if(!((e=C(e||this.focusDate||this.viewDate))instanceof Date))return;let s=t==="up"?this.viewIndex+1:this.viewIndex-1;s>2&&(s=2),s<0&&(s=0),this.setViewDate(new Date(e.getFullYear(),e.getMonth(),1)),this.setCurrentView(this.viewIndexes[s])}_handleRangeOnFocus(){this.selectedDates.length===1&&($(this.selectedDates[0],this.focusDate)?(this.rangeDateTo=this.selectedDates[0],this.rangeDateFrom=this.focusDate):(this.rangeDateTo=this.focusDate,this.rangeDateFrom=this.selectedDates[0]))}getCell(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l.day;if(!((e=C(e))instanceof Date))return;let{year:s,month:a,date:n}=D(e),i='[data-year="'.concat(s,'"]'),h='[data-month="'.concat(a,'"]'),o='[data-date="'.concat(n,'"]'),d={[l.day]:"".concat(i).concat(h).concat(o),[l.month]:"".concat(i).concat(h),[l.year]:"".concat(i)};return this.views[this.currentView].$el.querySelector(d[t])}_showMobileOverlay(){S.classList.add("-active-")}_hasTransition(){return window.getComputedStyle(this.$datepicker).getPropertyValue("transition-duration").split(", ").reduce((e,t)=>parseFloat(t)+e,0)>0}get shouldUpdateDOM(){return this.visible||this.treatAsInline}get parsedViewDate(){return D(this.viewDate)}get currentViewSingular(){return this.currentView.slice(0,-1)}get curDecade(){return F(this.viewDate)}get viewIndex(){return this.viewIndexes.indexOf(this.currentView)}get isFinalView(){return this.currentView===l.years}get hasSelectedDates(){return this.selectedDates.length>0}get isMinViewReached(){return this.currentView===this.opts.minView||this.currentView===l.days}get $container(){return this.$customContainer||W}static replacer(e,t,s){return e.replace(t,function(a,n,i,h){return n+s+h})}}var ie;return m(T,"defaults",Q),m(T,"version","3.3.0"),m(T,"defaultContainerId","air-datepicker-global-container"),ie=T.prototype,Object.assign(ie,ge),j.default}()})})(re.__module);var ve=re.__module.exports;const ye=ne.getDefaultExportFromCjs(ve);module.exports=ye;
|
|
2
2
|
//# sourceMappingURL=design-system103.js.map
|