@lifespikes/ui
Version:
Lifespikes ui
1 lines • 429 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),It=require("@tanstack/react-table"),$=require("lucide-react"),l=require("react"),Yt=require("@radix-ui/react-slot"),_e=require("class-variance-authority"),Q2=require("clsx"),en=require("tailwind-merge"),Fr=require("voca"),Ur=require("input-otp"),tn=require("@radix-ui/react-checkbox"),ln=require("@radix-ui/react-dropdown-menu"),rn=require("@radix-ui/react-select"),an=require("@radix-ui/react-avatar"),nn=require("@radix-ui/react-dialog"),sn=require("@radix-ui/react-alert-dialog"),cn=require("@radix-ui/react-tabs"),on=require("@radix-ui/react-accordion"),dn=require("@radix-ui/react-label"),hn=require("@radix-ui/react-switch"),un=require("@radix-ui/react-tooltip"),Gt=require("date-fns"),mn=require("react-day-picker"),pn=require("@radix-ui/react-popover"),vn=require("@radix-ui/react-separator"),fn=require("@radix-ui/react-scroll-area"),gn=require("@radix-ui/react-toast"),En=require("@radix-ui/react-radio-group"),xn=require("react-dropzone"),Be=require("cmdk"),wn=require("react-resizable-panels"),Ue=require("vaul"),zn=require("embla-carousel-react"),Fn=require("@radix-ui/react-navigation-menu"),Mn=require("@radix-ui/react-hover-card"),yn=require("@radix-ui/react-collapsible"),bn=require("sonner"),Hn=require("react-phone-number-input"),Pe=require("@radix-ui/react-icons");function pe(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const f=pe(l),q1=pe(tn),oe=pe(ln),we=pe(rn),pt=pe(an),ce=pe(nn),De=pe(sn),st=pe(cn),it=pe(on),Wr=pe(dn),K1=pe(hn),_t=pe(un),Ct=pe(pn),qr=pe(vn),nt=pe(fn),Re=pe(gn),Dt=pe(En),Q1=pe(wn),Se=pe(Fn),r1=pe(Mn),el=pe(yn),Kr=pe(Hn),Yr=({table:r})=>n.jsx(n.Fragment,{children:Array.from({length:5}).map((e,t)=>n.jsx(ut,{children:Array.from({length:r.getAllColumns().length}).map((a,i)=>n.jsx(At,{children:n.jsx(Xl,{className:"h-4 w-full"})},i))},t))}),Cn=({data:r,columns:e,...t})=>{var E;const{tableOptions:a,renderHeader:i,renderFooter:s,variant:c,variantClassName:o,isLoading:v}=t,p=It.useReactTable({data:r,columns:e,getCoreRowModel:It.getCoreRowModel(),...a,state:{...a==null?void 0:a.state}});return n.jsxs("div",{className:"w-full",children:[i?n.jsxs("div",{className:"flex items-center py-4",children:[i({table:p})," "]}):null,n.jsx("div",{className:"rounded-md",children:n.jsxs(nl,{variant:c,className:o,children:[n.jsx(il,{className:"bg-muted/50",children:p.getHeaderGroups().map(w=>n.jsx(ut,{children:w.headers.map(y=>{const C=y.column.getIsSorted();return n.jsx(cl,{className:"text-muted-foreground",onClick:y.column.getToggleSortingHandler(),children:n.jsxs("div",{className:"flex space-x-2 items-center",children:[y.isPlaceholder?null:It.flexRender(y.column.columnDef.header,y.getContext()),C?C==="asc"?n.jsx($.ChevronUp,{className:"w-4 h-4"}):n.jsx($.ChevronDown,{className:"w-4 h-4"}):null]})},y.id)})},w.id))}),n.jsx(sl,{children:v?n.jsx(Yr,{table:p}):(E=p.getRowModel().rows)!=null&&E.length?p.getRowModel().rows.map(w=>n.jsx(ut,{className:o,variant:c,"data-state":w.getIsSelected()&&"selected",children:w.getVisibleCells().map(y=>n.jsx(At,{children:It.flexRender(y.column.columnDef.cell,y.getContext())},y.id))},w.id)):n.jsx(ut,{children:n.jsx(At,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),s?s({table:p}):n.jsx(K2,{table:p,className:"mt-2"})]})};function Qe(r){return typeof r=="string"||r instanceof String}function Mr(r){var e;return typeof r=="object"&&r!=null&&(r==null||(e=r.constructor)==null?void 0:e.name)==="Object"}function $r(r,e){return Array.isArray(e)?$r(r,(t,a)=>e.includes(a)):Object.entries(r).reduce((t,a)=>{let[i,s]=a;return e(s,i)&&(t[i]=s),t},{})}const V={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Dn(r){switch(r){case V.LEFT:return V.FORCE_LEFT;case V.RIGHT:return V.FORCE_RIGHT;default:return r}}function V1(r){return r.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function $t(r,e){if(e===r)return!0;const t=Array.isArray(e),a=Array.isArray(r);let i;if(t&&a){if(e.length!=r.length)return!1;for(i=0;i<e.length;i++)if(!$t(e[i],r[i]))return!1;return!0}if(t!=a)return!1;if(e&&r&&typeof e=="object"&&typeof r=="object"){const s=e instanceof Date,c=r instanceof Date;if(s&&c)return e.getTime()==r.getTime();if(s!=c)return!1;const o=e instanceof RegExp,v=r instanceof RegExp;if(o&&v)return e.toString()==r.toString();if(o!=v)return!1;const p=Object.keys(e);for(i=0;i<p.length;i++)if(!Object.prototype.hasOwnProperty.call(r,p[i]))return!1;for(i=0;i<p.length;i++)if(!$t(r[p[i]],e[p[i]]))return!1;return!0}else if(e&&r&&typeof e=="function"&&typeof r=="function")return e.toString()===r.toString();return!1}class kn{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}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?V.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?V.RIGHT:V.LEFT}}function R(r,e){return new R.InputMask(r,e)}function Zr(r){if(r==null)throw new Error("mask property should be defined");return r instanceof RegExp?R.MaskedRegExp:Qe(r)?R.MaskedPattern:r===Date?R.MaskedDate:r===Number?R.MaskedNumber:Array.isArray(r)||r===Array?R.MaskedDynamic:R.Masked&&r.prototype instanceof R.Masked?r:R.Masked&&r instanceof R.Masked?r.constructor:r instanceof Function?R.MaskedFunction:(console.warn("Mask not found for mask",r),R.Masked)}function kt(r){if(!r)throw new Error("Options in not defined");if(R.Masked){if(r.prototype instanceof R.Masked)return{mask:r};const{mask:e=void 0,...t}=r instanceof R.Masked?{mask:r}:Mr(r)&&r.mask instanceof R.Masked?r:{};if(e){const a=e.mask;return{...$r(e,(i,s)=>!s.startsWith("_")),mask:e.constructor,_mask:a,...t}}}return Mr(r)?{...r}:{mask:r}}function Ze(r){if(R.Masked&&r instanceof R.Masked)return r;const e=kt(r),t=Zr(e.mask);if(!t)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===t&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new t(e)}R.createMask=Ze;class tl{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,t){if(!(e==null||t==null||e===this.selectionStart&&t===this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}R.MaskElement=tl;const yr=90,An=89;class a1 extends tl{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,a;return(e=(t=(a=this.input).getRootNode)==null?void 0:t.call(a))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===yr&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===An&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===yr&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}R.HTMLMaskElement=a1;class _n extends a1{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}R.HTMLMaskElement=a1;class Xr extends a1{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),a=t&&t.anchorOffset,i=t&&t.focusOffset;return i==null||a==null||a<i?a:i}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),a=t&&t.anchorOffset,i=t&&t.focusOffset;return i==null||a==null||a>i?a:i}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const a=this.rootElement.createRange();a.setStart(this.input.firstChild||this.input,e),a.setEnd(this.input.lastChild||this.input,t);const i=this.rootElement,s=i.getSelection&&i.getSelection();s&&(s.removeAllRanges(),s.addRange(a))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}R.HTMLContenteditableMaskElement=Xr;class n1{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>n1.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}n1.MAX_LENGTH=100;class Bn{constructor(e,t){this.el=e instanceof tl?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Xr(e):new _n(e),this.masked=Ze(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new n1,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._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return e==null||((t=this.masked)==null?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof R.Masked)&&this.masked.constructor===Zr(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof R.Masked?e:Ze({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}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,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const a=this._listeners[e];a&&a.forEach(i=>i(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),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,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,a=this.masked.value,i=this.masked.rawInputValue,s=this.displayValue,c=this.unmaskedValue!==t||this.value!==a||this._rawInputValue!==i;this._unmaskedValue=t,this._value=a,this._rawInputValue=i,this.el.value!==s&&(this.el.value=s),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),c&&this._fireChangeEvents(),!this._historyChanging&&(c||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...a}=e,i=!this.maskEquals(t),s=this.masked.optionsIsChanged(a);i&&(this.mask=t),s&&this.masked.updateOptions(a),(i||s)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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,V.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const a=this._listeners[e].indexOf(t);return a>=0&&this._listeners[e].splice(a,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new kn({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,i=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,s=a===this.masked.rawInputValue?t.removeDirection:V.NONE;let c=this.masked.nearestInputPos(t.startChangePos+i,s);s!==V.NONE&&(c=this.masked.nearestInputPos(c,V.NONE)),this.updateControl(c),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}R.InputMask=Bn;class U{static normalize(e){return Array.isArray(e)?e:[e,new U]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}R.ChangeDetails=U;class qe{constructor(e,t,a){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=a}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class ye{constructor(e){this._value="",this._update({...ye.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){t===void 0&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,a){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new qe(this.extractInput(e,t),e)}appendTail(e){return Qe(e)&&(e=new qe(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new U({inserted:e,rawInserted:e})):new U}_appendChar(e,t,a){t===void 0&&(t={});const i=this.state;let s;if([e,s]=this.doPrepareChar(e,t),e&&(s=s.aggregate(this._appendCharRaw(e,t)),!s.rawInserted&&this.autofix==="pad")){const c=this.state;this.state=i;let o=this.pad(t);const v=this._appendCharRaw(e,t);o=o.aggregate(v),v.rawInserted||o.equals(s)?s=o:this.state=c}if(s.inserted){let c,o=this.doValidate(t)!==!1;if(o&&a!=null){const v=this.state;if(this.overwrite===!0){c=a.state;for(let E=0;E<s.rawInserted.length;++E)a.unshift(this.displayValue.length-s.tailShift)}let p=this.appendTail(a);if(o=p.rawInserted.length===a.toString().length,!(o&&p.inserted)&&this.overwrite==="shift"){this.state=v,c=a.state;for(let E=0;E<s.rawInserted.length;++E)a.shift();p=this.appendTail(a),o=p.rawInserted.length===a.toString().length}o&&p.inserted&&(this.state=v)}o||(s=new U,this.state=i,a&&c&&(a.state=c))}return s}_appendPlaceholder(){return new U}_appendEager(){return new U}append(e,t,a){if(!Qe(e))throw new Error("value should be string");const i=Qe(a)?new qe(String(a)):a;t!=null&&t.tail&&(t._beforeTailState=this.state);let s;[e,s]=this.doPrepare(e,t);for(let c=0;c<e.length;++c){const o=this._appendChar(e[c],t,i);if(!o.rawInserted&&!this.doSkipInvalid(e[c],t,i))break;s.aggregate(o)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&s.aggregate(this._appendEager()),i!=null&&(s.tailShift+=this.appendTail(i).tailShift),s}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new U}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,a=this.value,i=e();return this.rawInputValue=t,this.value&&this.value!==a&&a.indexOf(this.value)===0&&(this.append(a.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,a=e(this);return this.state=t,delete this._isolated,a}doSkipInvalid(e,t,a){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),U.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),U.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,a,i,s){a===void 0&&(a=""),i===void 0&&(i=V.NONE),s===void 0&&(s={input:!0});const c=e+t,o=this.extractTail(c),v=this.eager===!0||this.eager==="remove";let p;v&&(i=Dn(i),p=this.extractInput(0,c,{raw:!0}));let E=e;const w=new U;if(i!==V.NONE&&(E=this.nearestInputPos(e,t>1&&e!==0&&!v?V.NONE:i),w.tailShift=E-e),w.aggregate(this.remove(E)),v&&i!==V.NONE&&p===this.rawInputValue)if(i===V.FORCE_LEFT){let y;for(;p===this.rawInputValue&&(y=this.displayValue.length);)w.aggregate(new U({tailShift:-1})).aggregate(this.remove(y-1))}else i===V.FORCE_RIGHT&&o.unshift();return w.aggregate(this.append(a,s,o))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!$t(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||ye.EMPTY_VALUES.includes(e)&&ye.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new U}}ye.DEFAULTS={skipInvalid:!0};ye.EMPTY_VALUES=[void 0,null,""];R.Masked=ye;class rt{constructor(e,t){e===void 0&&(e=[]),t===void 0&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=Qe(e)?new qe(String(e)):e;const t=this.chunks[this.chunks.length-1],a=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof qe)a?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof rt){if(e.stop==null){let i;for(;e.chunks.length&&e.chunks[0].stop==null;)i=e.chunks.shift(),i.from+=e.from,this.extend(i)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof R.MaskedPattern))return new qe(this.toString()).appendTo(e);const t=new U;for(let a=0;a<this.chunks.length;++a){const i=this.chunks[a],s=e._mapPosToBlock(e.displayValue.length),c=i.stop;let o;if(c!=null&&(!s||s.index<=c)&&((i instanceof rt||e._stops.indexOf(c)>=0)&&t.aggregate(e._appendPlaceholder(c)),o=i instanceof rt&&e._blocks[c]),o){const v=o.appendTail(i);t.aggregate(v);const p=i.toString().slice(v.rawInserted.length);p&&t.aggregate(e.append(p,{tail:!0}))}else t.aggregate(e.append(i.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...a}=e;Object.assign(this,a),this.chunks=t.map(i=>{const s="chunks"in i?new rt:new qe;return s.state=i,s})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let a=0;for(;a<this.chunks.length;){const i=this.chunks[a],s=i.unshift(t);if(i.toString()){if(!s)break;++a}else this.chunks.splice(a,1);if(s)return s}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],a=t.shift();if(t.toString()){if(!a)break;--e}else this.chunks.splice(e,1);if(a)return a}return""}}class Sn{constructor(e,t){this.masked=e,this._log=[];const{offset:a,index:i}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}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(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((t=this.block)==null?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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,V.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,V.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,V.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,V.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,V.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,V.NONE),!0})}}class Jr{constructor(e){Object.assign(this,e),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(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new U}nearestInputPos(e,t){t===void 0&&(t=V.NONE);const a=0,i=this._value.length;switch(t){case V.LEFT:case V.FORCE_LEFT:return a;case V.NONE:case V.RIGHT:case V.FORCE_RIGHT:default:return i}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,a){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new U;const a=this.eager===!0||this.eager==="append",s=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!a)&&!t.tail,c=new U({inserted:this.char,rawInserted:s?this.char:""});return this._value=this.char,this._isRawInput=s&&(t.raw||t.input),c}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new U;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new qe("")}appendTail(e){return Qe(e)&&(e=new qe(String(e))),e.appendTo(this)}append(e,t,a){const i=this._appendChar(e[0],t);return a!=null&&(i.tailShift+=this.appendTail(a).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class Zt{constructor(e){const{parent:t,isOptional:a,placeholderChar:i,displayChar:s,lazy:c,eager:o,...v}=e;this.masked=Ze(v),Object.assign(this,{parent:t,isOptional:a,placeholderChar:i,displayChar:s,lazy:c,eager:o})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),e===0&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new U}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(e,t){if(t===void 0&&(t={}),this.isFilled)return new U;const a=this.masked.state;let i=this.masked._appendChar(e,this.currentMaskFlags(t));return i.inserted&&this.doValidate(t)===!1&&(i=new U,this.masked.state=a),!i.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(e,t,a){return this.masked.append(e,this.currentMaskFlags(t),a)}_appendPlaceholder(){return this.isFilled||this.isOptional?new U:(this.isFilled=!0,new U({inserted:this.placeholderChar}))}_appendEager(){return new U}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,a){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,a)}nearestInputPos(e,t){t===void 0&&(t=V.NONE);const a=0,i=this.value.length,s=Math.min(Math.max(e,a),i);switch(t){case V.LEFT:case V.FORCE_LEFT:return this.isComplete?s:a;case V.RIGHT:case V.FORCE_RIGHT:return this.isComplete?s:i;case V.NONE:default:return s}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(e==null||(t=e._beforeTailState)==null?void 0:t.masked)||(e==null?void 0:e._beforeTailState)}}pad(e){return new U}}Zt.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 Vn extends ye{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=a=>a.search(t)>=0),super._update(e)}}R.MaskedRegExp=Vn;class be extends ye{constructor(e){super({...be.DEFAULTS,...e,definitions:Object.assign({},Zt.DEFAULT_DEFINITIONS,e==null?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let a=!1,i=!1;for(let s=0;s<t.length;++s){if(this.blocks){const p=t.slice(s),E=Object.keys(this.blocks).filter(y=>p.indexOf(y)===0);E.sort((y,C)=>C.length-y.length);const w=E[0];if(w){const{expose:y,repeat:C,...S}=kt(this.blocks[w]),L={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...S,repeat:C,parent:this},j=C!=null?new R.RepeatBlock(L):Ze(L);j&&(this._blocks.push(j),y&&(this.exposeBlock=j),this._maskedBlocks[w]||(this._maskedBlocks[w]=[]),this._maskedBlocks[w].push(this._blocks.length-1)),s+=w.length-1;continue}}let c=t[s],o=c in e;if(c===be.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(c==="{"||c==="}"){a=!a;continue}if(c==="["||c==="]"){i=!i;continue}if(c===be.ESCAPE_CHAR){if(++s,c=t[s],!c)break;o=!1}const v=o?new Zt({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...kt(e[c]),parent:this}):new Jr({char:c,eager:this.eager,isUnmasking:a});this._blocks.push(v)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...a}=e;this._blocks.forEach((i,s)=>i.state=t[s]),super.state=a}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+=t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+=t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+=t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new U;let a=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(a==null)return t;this._blocks[a].isFilled&&++a;for(let i=a;i<this._blocks.length;++i){const s=this._blocks[i]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const a=this._mapPosToBlock(this.displayValue.length),i=new U;if(!a)return i;for(let c=a.index,o;o=this._blocks[c];++c){var s;const v=o._appendChar(e,{...t,_beforeTailState:(s=t._beforeTailState)==null||(s=s._blocks)==null?void 0:s[c]});if(i.aggregate(v),v.consumed)break}return i}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const a=new rt;return e===t||this._forEachBlocksInRange(e,t,(i,s,c,o)=>{const v=i.extractTail(c,o);v.stop=this._findStopBefore(s),v.from=this._blockStartPos(s),v instanceof rt&&(v.blockIndex=s),a.extend(v)}),a}extractInput(e,t,a){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),a===void 0&&(a={}),e===t)return"";let i="";return this._forEachBlocksInRange(e,t,(s,c,o,v)=>{i+=s.extractInput(o,v,a)}),i}_findStopBefore(e){let t;for(let a=0;a<this._stops.length;++a){const i=this._stops[a];if(i<=e)t=i;else break}return t}_appendPlaceholder(e){const t=new U;if(this.lazy&&e==null)return t;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return t;const i=a.index,s=e??this._blocks.length;return this._blocks.slice(i,s).forEach(c=>{if(!c.lazy||e!=null){var o;t.aggregate(c._appendPlaceholder((o=c._blocks)==null?void 0:o.length))}}),t}_mapPosToBlock(e){let t="";for(let a=0;a<this._blocks.length;++a){const i=this._blocks[a],s=t.length;if(t+=i.displayValue,e<=t.length)return{index:a,offset:e-s}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,a)=>t+=a.displayValue.length,0)}_forEachBlocksInRange(e,t,a){t===void 0&&(t=this.displayValue.length);const i=this._mapPosToBlock(e);if(i){const s=this._mapPosToBlock(t),c=s&&i.index===s.index,o=i.offset,v=s&&c?s.offset:this._blocks[i.index].displayValue.length;if(a(this._blocks[i.index],i.index,o,v),s&&!c){for(let p=i.index+1;p<s.index;++p)a(this._blocks[p],p,0,this._blocks[p].displayValue.length);a(this._blocks[s.index],s.index,0,s.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const a=super.remove(e,t);return this._forEachBlocksInRange(e,t,(i,s,c,o)=>{a.aggregate(i.remove(c,o))}),a}nearestInputPos(e,t){if(t===void 0&&(t=V.NONE),!this._blocks.length)return 0;const a=new Sn(this,e);if(t===V.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(t===V.LEFT||t===V.FORCE_LEFT){if(t===V.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===e)return e;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),t===V.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=e||(a.popState(),a.ok&&a.pos<=e))return a.pos;a.popState()}return a.ok?a.pos:t===V.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return t===V.RIGHT||t===V.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:t===V.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(e,V.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let a=0;return this._forEachBlocksInRange(e,t,(i,s,c,o)=>{a+=i.totalInputPositions(c,o)}),a}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(a=>this._blocks[a]):[]}pad(e){const t=new U;return this._forEachBlocksInRange(0,this.displayValue.length,a=>t.aggregate(a.pad(e))),t}}be.DEFAULTS={...ye.DEFAULTS,lazy:!0,placeholderChar:"_"};be.STOP_CHAR="`";be.ESCAPE_CHAR="\\";be.InputDefinition=Zt;be.FixedDefinition=Jr;R.MaskedPattern=be;class Ut extends be{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:a=this.from||0,maxLength:i=this.maxLength||0,autofix:s=this.autofix,...c}=e;this.to=t,this.from=a,this.maxLength=Math.max(String(t).length,i),this.autofix=s;const o=String(this.from).padStart(this.maxLength,"0"),v=String(this.to).padStart(this.maxLength,"0");let p=0;for(;p<v.length&&v[p]===o[p];)++p;c.mask=v.slice(0,p).replace(/0/g,"\\0")+"0".repeat(this.maxLength-p),super._update(c)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",a="";const[,i,s]=e.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(t="0".repeat(i.length)+s,a="9".repeat(i.length)+s),t=t.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[t,a]}doPrepareChar(e,t){t===void 0&&(t={});let a;return[e,a]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(a.skip=!this.isComplete),[e,a]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const a=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[s,c]=this.boundaries(this.value+e);return Number(c)<this.from?super._appendCharRaw(a[this.value.length],t):Number(s)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(i[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(t.search(/[^0]/)===-1&&t.length<=this._matchFrom)return!0;const[i,s]=this.boundaries(t);return this.from<=Number(s)&&Number(i)<=this.to&&super.doValidate(e)}pad(e){const t=new U;if(this.value.length===this.maxLength)return t;const a=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)t.aggregate(super._appendCharRaw("0",e));a.split("").forEach(s=>this._appendCharRaw(s))}return t}}R.MaskedRange=Ut;const Nn="d{.}`m{.}`Y";class $e extends be{static extractPatternOptions(e){const{mask:t,pattern:a,...i}=e;return{...i,mask:Qe(t)?t:a}}constructor(e){super($e.extractPatternOptions({...$e.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:a,blocks:i,...s}={...$e.DEFAULTS,...e},c=Object.assign({},$e.GET_DEFAULT_BLOCKS());e.min&&(c.Y.from=e.min.getFullYear()),e.max&&(c.Y.to=e.max.getFullYear()),e.min&&e.max&&c.Y.from===c.Y.to&&(c.m.from=e.min.getMonth()+1,c.m.to=e.max.getMonth()+1,c.m.from===c.m.to&&(c.d.from=e.min.getDate(),c.d.to=e.max.getDate())),Object.assign(c,this.blocks,i),super._update({...s,mask:Qe(t)?t:a,blocks:c})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&t!=null&&(this.min==null||this.min<=t)&&(this.max==null||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged($e.extractPatternOptions(e))}}$e.GET_DEFAULT_BLOCKS=()=>({d:{mask:Ut,from:1,to:31,maxLength:2},m:{mask:Ut,from:1,to:12,maxLength:2},Y:{mask:Ut,from:1900,to:9999}});$e.DEFAULTS={...be.DEFAULTS,mask:Date,pattern:Nn,format:(r,e)=>{if(!r)return"";const t=String(r.getDate()).padStart(2,"0"),a=String(r.getMonth()+1).padStart(2,"0"),i=r.getFullYear();return[t,a,i].join(".")},parse:(r,e)=>{const[t,a,i]=r.split(".").map(Number);return new Date(i,a-1,t)}};R.MaskedDate=$e;class i1 extends ye{constructor(e){super({...i1.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(t=>{const{expose:a,...i}=kt(t),s=Ze({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return a&&(this.exposeMask=s),s}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const a=this._applyDispatch(e,t);return this.currentMask&&a.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),a}_applyDispatch(e,t,a){e===void 0&&(e=""),t===void 0&&(t={}),a===void 0&&(a="");const i=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,s=this.rawInputValue,c=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:s,o=s.slice(c.length),v=this.currentMask,p=new U,E=v==null?void 0:v.state;return this.currentMask=this.doDispatch(e,{...t},a),this.currentMask&&(this.currentMask!==v?(this.currentMask.reset(),c&&(this.currentMask.append(c,{raw:!0}),p.tailShift=this.currentMask.value.length-i.length),o&&(p.tailShift+=this.currentMask.append(o,{raw:!0,tail:!0}).tailShift)):E&&(this.currentMask.state=E)),p}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new U;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,a;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((a=e._beforeTailState)==null?void 0:a.currentMask)||e._beforeTailState}}doDispatch(e,t,a){return t===void 0&&(t={}),a===void 0&&(a=""),this.dispatch(e,this,t,a)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[a,i]=super.doPrepare(e,t);if(this.currentMask){let s;[a,s]=super.doPrepare(a,this.currentMaskFlags(t)),i=i.aggregate(s)}return[a,i]}doPrepareChar(e,t){t===void 0&&(t={});let[a,i]=super.doPrepareChar(e,t);if(this.currentMask){let s;[a,s]=super.doPrepareChar(a,this.currentMaskFlags(t)),i=i.aggregate(s)}return[a,i]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e