{"version":3,"file":"imask.es.js","sources":["../src/core/utils.js","../src/core/action-details.js","../src/core/change-details.js","../src/masked/base.js","../src/masked/factory.js","../src/masked/pattern/input-definition.js","../src/masked/pattern/fixed-definition.js","../src/masked/pattern/chunk-tail-details.js","../src/masked/pattern.js","../src/masked/range.js","../src/masked/date.js","../src/controls/mask-element.js","../src/controls/html-mask-element.js","../src/controls/input.js","../src/masked/enum.js","../src/masked/number.js","../src/masked/regexp.js","../src/masked/function.js","../src/masked/dynamic.js","../src/imask.js"],"sourcesContent":["// @flow\r\n\r\n\r\n/** Checks if value is string */\r\nexport\r\nfunction isString (str: mixed): boolean %checks {\r\n return typeof str === 'string' || str instanceof String;\r\n}\r\n\r\n/**\r\n Direction\r\n @prop {string} NONE\r\n @prop {string} LEFT\r\n @prop {string} FORCE_LEFT\r\n @prop {string} RIGHT\r\n @prop {string} FORCE_RIGHT\r\n*/\r\nexport\r\nconst DIRECTION = {\r\n NONE: 'NONE',\r\n LEFT: 'LEFT',\r\n FORCE_LEFT: 'FORCE_LEFT',\r\n RIGHT: 'RIGHT',\r\n FORCE_RIGHT: 'FORCE_RIGHT',\r\n}\r\n/**\r\n Direction\r\n @enum {string}\r\n*/\r\nexport\r\ntype Direction = $Values;\r\n\r\n/** Returns next char index in direction */\r\nexport\r\nfunction indexInDirection (pos: number, direction: Direction): number {\r\n if (direction === DIRECTION.LEFT) --pos;\r\n return pos;\r\n}\r\n\r\n/** Returns next char position in direction */\r\nexport\r\nfunction posInDirection (pos: number, direction: Direction): number {\r\n switch (direction) {\r\n case DIRECTION.LEFT:\r\n return --pos;\r\n case DIRECTION.RIGHT:\r\n case DIRECTION.FORCE_RIGHT:\r\n return ++pos;\r\n default:\r\n return pos;\r\n }\r\n}\r\n\r\n/** */\r\nexport\r\nfunction forceDirection (direction: Direction): Direction {\r\n switch (direction) {\r\n case DIRECTION.LEFT:\r\n return DIRECTION.FORCE_LEFT;\r\n case DIRECTION.RIGHT:\r\n return DIRECTION.FORCE_RIGHT;\r\n default:\r\n return direction;\r\n }\r\n}\r\n\r\n/** Escapes regular expression control chars */\r\nexport\r\nfunction escapeRegExp (str: string): string {\r\n return str.replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1');\r\n}\r\n\r\n\r\n// cloned from https://github.com/epoberezkin/fast-deep-equal with small changes\r\nexport\r\nfunction objectIncludes (b: any, a: any): boolean {\r\n if (a === b) return true;\r\n\r\n var arrA = Array.isArray(a)\r\n , arrB = Array.isArray(b)\r\n , i;\r\n\r\n if (arrA && arrB) {\r\n if (a.length != b.length) return false;\r\n for (i = 0; i < a.length; i++)\r\n if (!objectIncludes(a[i], b[i])) return false;\r\n return true;\r\n }\r\n\r\n if (arrA != arrB) return false;\r\n\r\n if (a && b && typeof a === 'object' && typeof b === 'object') {\r\n var dateA = a instanceof Date\r\n , dateB = b instanceof Date;\r\n if (dateA && dateB) return a.getTime() == b.getTime();\r\n if (dateA != dateB) return false;\r\n\r\n var regexpA = a instanceof RegExp\r\n , regexpB = b instanceof RegExp;\r\n if (regexpA && regexpB) return a.toString() == b.toString();\r\n if (regexpA != regexpB) return false;\r\n\r\n var keys = Object.keys(a);\r\n // if (keys.length !== Object.keys(b).length) return false;\r\n\r\n for (i = 0; i < keys.length; i++)\r\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\r\n\r\n for (i = 0; i < keys.length; i++)\r\n if(!objectIncludes(b[keys[i]], a[keys[i]])) return false;\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/* eslint-disable no-undef */\r\nexport\r\nconst g: any = typeof window !== 'undefined' && window ||\r\n typeof global !== 'undefined' && global.global === global && global ||\r\n typeof self !== 'undefined' && self.self === self && self ||\r\n {};\r\n/* eslint-enable no-undef */\r\n\r\n/** Selection range */\r\nexport\r\ntype Selection = {\r\n start: number;\r\n end: number;\r\n};\r\n","// @flow\r\nimport {type Direction, type Selection, DIRECTION} from './utils.js';\r\n\r\n\r\n/** Provides details of changing input */\r\nexport default\r\nclass ActionDetails {\r\n /** Current input value */\r\n value: string;\r\n /** Current cursor position */\r\n cursorPos: number;\r\n /** Old input value */\r\n oldValue: string;\r\n /** Old selection */\r\n oldSelection: Selection;\r\n\r\n constructor (\r\n value: string,\r\n cursorPos: number,\r\n oldValue: string,\r\n oldSelection: Selection\r\n ) {\r\n this.value = value;\r\n this.cursorPos = cursorPos;\r\n this.oldValue = oldValue;\r\n this.oldSelection = oldSelection;\r\n\r\n // double check if left part was changed (autofilling, other non-standard input triggers)\r\n while (this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos)) {\r\n --this.oldSelection.start;\r\n }\r\n }\r\n\r\n /**\r\n Start changing position\r\n @readonly\r\n */\r\n get startChangePos (): number {\r\n return Math.min(this.cursorPos, this.oldSelection.start);\r\n }\r\n\r\n /**\r\n Inserted symbols count\r\n @readonly\r\n */\r\n get insertedCount (): number {\r\n return this.cursorPos - this.startChangePos;\r\n }\r\n\r\n /**\r\n Inserted symbols\r\n @readonly\r\n */\r\n get inserted (): string {\r\n return this.value.substr(this.startChangePos, this.insertedCount);\r\n }\r\n\r\n /**\r\n Removed symbols count\r\n @readonly\r\n */\r\n get removedCount (): number {\r\n // Math.max for opposite operation\r\n return Math.max((this.oldSelection.end - this.startChangePos) ||\r\n // for Delete\r\n this.oldValue.length - this.value.length, 0);\r\n }\r\n\r\n /**\r\n Removed symbols\r\n @readonly\r\n */\r\n get removed (): string {\r\n return this.oldValue.substr(this.startChangePos, this.removedCount);\r\n }\r\n\r\n /**\r\n Unchanged head symbols\r\n @readonly\r\n */\r\n get head (): string {\r\n return this.value.substring(0, this.startChangePos);\r\n }\r\n\r\n /**\r\n Unchanged tail symbols\r\n @readonly\r\n */\r\n get tail (): string {\r\n return this.value.substring(this.startChangePos + this.insertedCount);\r\n }\r\n\r\n /**\r\n Remove direction\r\n @readonly\r\n */\r\n get removeDirection (): Direction {\r\n if (!this.removedCount || this.insertedCount) return DIRECTION.NONE;\r\n\r\n // align right if delete at right or if range removed (event with backspace)\r\n return (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) ?\r\n DIRECTION.RIGHT :\r\n DIRECTION.LEFT;\r\n }\r\n}\r\n","// @flow\r\n\r\n\r\n/**\r\n Provides details of changing model value\r\n @param {Object} [details]\r\n @param {string} [details.inserted] - Inserted symbols\r\n @param {boolean} [details.skip] - Can skip chars\r\n @param {number} [details.removeCount] - Removed symbols count\r\n @param {number} [details.tailShift] - Additional offset if any changes occurred before tail\r\n*/\r\nexport default\r\nclass ChangeDetails {\r\n /** Inserted symbols */\r\n inserted: string;\r\n /** Can skip chars */\r\n skip: boolean;\r\n /** Additional offset if any changes occurred before tail */\r\n tailShift: number;\r\n /** Raw inserted is used by dynamic mask */\r\n rawInserted: string;\r\n\r\n constructor (details?: {\r\n inserted?: $PropertyType,\r\n rawInserted?: $PropertyType,\r\n skip?: $PropertyType,\r\n tailShift?: $PropertyType,\r\n }) {\r\n Object.assign(this, {\r\n inserted: '',\r\n rawInserted: '',\r\n skip: false,\r\n tailShift: 0,\r\n }, details);\r\n }\r\n\r\n /**\r\n Aggregate changes\r\n @returns {ChangeDetails} `this`\r\n */\r\n aggregate (details: ChangeDetails): ChangeDetails {\r\n this.rawInserted += details.rawInserted;\r\n this.skip = this.skip || details.skip;\r\n this.inserted += details.inserted;\r\n this.tailShift += details.tailShift;\r\n return this;\r\n }\r\n\r\n /** Total offset considering all changes */\r\n get offset (): number {\r\n return this.tailShift + this.inserted.length;\r\n }\r\n}\r\n","// @flow\r\nimport ChangeDetails from '../core/change-details.js';\r\nimport {type Direction, DIRECTION} from '../core/utils.js';\r\nimport {type TailDetails} from '../core/tail-details.js';\r\n\r\n\r\n/** Supported mask type */\r\nexport\r\ntype Mask =\r\n string |\r\n String |\r\n RegExp |\r\n Class |\r\n Class |\r\n Array |\r\n $PropertyType, 'validate'> |\r\n Masked<*> |\r\n Class>;\r\n\r\nexport\r\ntype MaskedState = {|\r\n _value: string,\r\n|};\r\n\r\n/** Append flags */\r\nexport\r\ntype AppendFlags = {\r\n input?: boolean,\r\n tail?: boolean,\r\n raw?: boolean\r\n};\r\n\r\n/** Extract flags */\r\nexport\r\ntype ExtractFlags = {\r\n raw?: boolean\r\n};\r\n\r\nexport\r\ntype MaskedOptions = {\r\n mask: $PropertyType, 'mask'>,\r\n parent?: $PropertyType, 'parent'>,\r\n prepare?: $PropertyType, 'prepare'>,\r\n validate?: $PropertyType, 'validate'>,\r\n commit?: $PropertyType, 'commit'>,\r\n};\r\n\r\n\r\n/** Provides common masking stuff */\r\nexport default\r\nclass Masked {\r\n static DEFAULTS: any; // $Shape; TODO after fix https://github.com/facebook/flow/issues/4773\r\n\r\n /** @type {Mask} */\r\n mask: MaskType;\r\n /** */ // $FlowFixMe TODO no ideas\r\n parent: ?Masked<*>;\r\n /** Transforms value before mask processing */\r\n prepare: (string, Masked, AppendFlags) => string;\r\n /** Validates if value is acceptable */\r\n validate: (string, Masked, AppendFlags) => boolean;\r\n /** Does additional processing in the end of editing */\r\n commit: (string, AppendFlags) => void;\r\n /** */\r\n isInitialized: boolean;\r\n _value: string;\r\n _refreshing: boolean;\r\n _beforeTailState: ?MaskedState;\r\n\r\n constructor (opts: {[string]: any}) {\r\n this._value = '';\r\n this._update(opts);\r\n this.isInitialized = true;\r\n }\r\n\r\n /** Sets and applies new options */\r\n updateOptions (opts: {[string]: any}) {\r\n if (!Object.keys(opts).length) return;\r\n this.withValueRefresh(this._update.bind(this, opts));\r\n }\r\n\r\n /**\r\n Sets new options\r\n @protected\r\n */\r\n _update (opts: {[string]: any}) {\r\n Object.assign(this, opts);\r\n }\r\n\r\n /** Mask state */\r\n get state (): any {\r\n return {\r\n _value: this.value,\r\n };\r\n }\r\n\r\n set state (state: any) {\r\n this._value = state._value;\r\n }\r\n\r\n /** Resets value */\r\n reset () {\r\n this._value = '';\r\n }\r\n\r\n /** */\r\n get value (): string {\r\n return this._value;\r\n }\r\n\r\n set value (value: string) {\r\n this.resolve(value);\r\n }\r\n\r\n /** Resolve new value */\r\n resolve (value: string): string {\r\n this.reset();\r\n this.append(value, {input: true}, {value: ''});\r\n this.doCommit();\r\n return this.value;\r\n }\r\n\r\n /** */\r\n get unmaskedValue (): string {\r\n return this.value;\r\n }\r\n\r\n set unmaskedValue (value: string) {\r\n this.reset();\r\n this.append(value, {}, {value: ''});\r\n this.doCommit();\r\n }\r\n\r\n /** */\r\n get typedValue (): any {\r\n return this.unmaskedValue;\r\n }\r\n\r\n set typedValue (value: any) {\r\n this.unmaskedValue = value;\r\n }\r\n\r\n /** Value that includes raw user input */\r\n get rawInputValue (): string {\r\n return this.extractInput(0, this.value.length, {raw: true});\r\n }\r\n\r\n set rawInputValue (value: string) {\r\n this.reset();\r\n this.append(value, {raw: true}, {value: ''});\r\n this.doCommit();\r\n }\r\n\r\n /** */\r\n get isComplete (): boolean {\r\n return true;\r\n }\r\n\r\n /** Finds nearest input position in direction */\r\n nearestInputPos (cursorPos: number, direction?: Direction): number {\r\n return cursorPos;\r\n }\r\n\r\n /** Extracts value in range considering flags */\r\n extractInput (fromPos?: number=0, toPos?: number=this.value.length, flags?: ExtractFlags): string {\r\n return this.value.slice(fromPos, toPos);\r\n }\r\n\r\n /** Extracts tail in range */\r\n extractTail (fromPos?: number=0, toPos?: number=this.value.length): TailDetails {\r\n return {\r\n value: this.extractInput(fromPos, toPos),\r\n };\r\n }\r\n\r\n /** Stores state before tail */\r\n _storeBeforeTailState () {\r\n this._beforeTailState = this.state;\r\n }\r\n\r\n /** Restores state before tail */\r\n _restoreBeforeTailState () {\r\n this.state = this._beforeTailState;\r\n }\r\n\r\n /** Resets state before tail */\r\n _resetBeforeTailState () {\r\n this._beforeTailState = null;\r\n }\r\n\r\n /** Appends tail */\r\n appendTail (tail?: TailDetails): ChangeDetails {\r\n return this.append(tail ? tail.value: '', {tail: true});\r\n }\r\n\r\n /** Appends char */\r\n _appendCharRaw (ch: string, flags: AppendFlags={}): ChangeDetails {\r\n this._value += ch;\r\n return new ChangeDetails({\r\n inserted: ch,\r\n rawInserted: ch,\r\n });\r\n }\r\n\r\n /** Appends char */\r\n _appendChar (ch: string, flags: AppendFlags={}, checkTail?: TailDetails): ChangeDetails {\r\n ch = this.doPrepare(ch, flags);\r\n if (!ch) return new ChangeDetails();\r\n\r\n const consistentState: MaskedState = this.state;\r\n const details: ChangeDetails = this._appendCharRaw(ch, flags);\r\n\r\n if (details.inserted) {\r\n let appended = this.doValidate(flags) !== false;\r\n\r\n if (appended && checkTail != null) {\r\n // validation ok, check tail\r\n this._storeBeforeTailState();\r\n\r\n const tailDetails = this.appendTail(checkTail);\r\n\r\n appended = tailDetails.rawInserted === checkTail.value;\r\n\r\n // if ok, rollback state after tail\r\n if (appended && tailDetails.inserted) this._restoreBeforeTailState();\r\n }\r\n\r\n // revert all if something went wrong\r\n if (!appended) {\r\n details.rawInserted = details.inserted = '';\r\n this.state = consistentState;\r\n }\r\n }\r\n return details;\r\n }\r\n\r\n /** Appends symbols considering flags */\r\n append (str: string, flags?: AppendFlags, tail?: TailDetails): ChangeDetails {\r\n const oldValueLength = this.value.length;\r\n const details = new ChangeDetails();\r\n\r\n for (let ci=0; ci(fn: () => T): T {\r\n if (this._refreshing || !this.isInitialized) return fn();\r\n this._refreshing = true;\r\n\r\n const unmasked = this.unmaskedValue;\r\n const value = this.value;\r\n\r\n const ret = fn();\r\n\r\n // try to update with raw value first to keep fixed chars\r\n if (this.resolve(value) !== value) {\r\n // or fallback to unmasked\r\n this.unmaskedValue = unmasked;\r\n }\r\n\r\n delete this._refreshing;\r\n return ret;\r\n }\r\n\r\n /**\r\n Prepares string before mask processing\r\n @protected\r\n */\r\n doPrepare (str: string, flags: AppendFlags={}): string {\r\n return this.prepare ?\r\n this.prepare(str, this, flags) :\r\n str;\r\n }\r\n\r\n /**\r\n Validates if value is acceptable\r\n @protected\r\n */\r\n doValidate (flags: AppendFlags): boolean {\r\n return (!this.validate || this.validate(this.value, this, flags)) &&\r\n (!this.parent || this.parent.doValidate(flags));\r\n }\r\n\r\n /**\r\n Does additional processing in the end of editing\r\n @protected\r\n */\r\n doCommit () {\r\n if (this.commit) this.commit(this.value, this);\r\n }\r\n\r\n /** */\r\n splice (start: number, deleteCount: number, inserted: string, removeDirection: Direction): ChangeDetails {\r\n const tailPos: number = start + deleteCount;\r\n const tail: TailDetails = this.extractTail(tailPos);\r\n\r\n let startChangePos: number = this.nearestInputPos(start, removeDirection);\r\n const changeDetails: ChangeDetails = new ChangeDetails({\r\n tailShift: startChangePos - start // adjust tailShift if start was aligned\r\n }).aggregate(this.remove(startChangePos))\r\n .aggregate(this.append(inserted, {input: true}, tail));\r\n\r\n return changeDetails;\r\n }\r\n}\r\n","// @flow\r\nimport {g, isString} from '../core/utils.js';\r\nimport type Masked from './base.js';\r\nimport {type Mask} from './base.js';\r\n\r\n\r\n/** Get Masked class by mask type */\r\nexport\r\nfunction maskedClass (mask: Mask): Class> {\r\n if (mask == null) {\r\n throw new Error('mask property should be defined');\r\n }\r\n\r\n if (mask instanceof RegExp) return g.IMask.MaskedRegExp;\r\n if (isString(mask)) return g.IMask.MaskedPattern;\r\n if (mask instanceof Date || mask === Date) return g.IMask.MaskedDate;\r\n if (mask instanceof Number || typeof mask === 'number' || mask === Number) return g.IMask.MaskedNumber;\r\n if (Array.isArray(mask) || mask === Array) return g.IMask.MaskedDynamic;\r\n // $FlowFixMe\r\n if (mask.prototype instanceof g.IMask.Masked) return mask;\r\n // $FlowFixMe\r\n if (mask instanceof Function) return g.IMask.MaskedFunction;\r\n\r\n console.warn('Mask not found for mask', mask); // eslint-disable-line no-console\r\n return g.IMask.Masked;\r\n}\r\n\r\n/** Creates new {@link Masked} depending on mask type */\r\nexport default\r\nfunction createMask (opts: {mask: Mask}): Masked<*> {\r\n opts = {...opts};\r\n const mask = opts.mask;\r\n\r\n if (mask instanceof g.IMask.Masked) return mask;\r\n\r\n const MaskedClass = maskedClass(mask);\r\n return new MaskedClass(opts);\r\n}\r\n","// @flow\r\nimport createMask from '../factory.js';\r\nimport type Masked from '../base.js';\r\nimport type MaskedPattern from '../pattern.js';\r\nimport {type TailDetails} from '../../core/tail-details.js';\r\nimport {type Mask, type ExtractFlags, type AppendFlags} from '../base.js';\r\nimport ChangeDetails from '../../core/change-details.js';\r\nimport {DIRECTION, type Direction} from '../../core/utils.js';\r\nimport {type PatternBlock} from './block.js';\r\n\r\n\r\nexport\r\ntype Definitions = {[string]: Mask};\r\n\r\n/** */\r\ntype PatternInputDefinitionOptions = {\r\n parent: $PropertyType,\r\n mask: Mask,\r\n isOptional: $PropertyType,\r\n lazy: $PropertyType,\r\n placeholderChar: $PropertyType,\r\n};\r\n\r\ntype PatternInputDefinitionState = {\r\n masked: *,\r\n _isFilled: boolean,\r\n};\r\n\r\nexport\r\nconst DEFAULT_INPUT_DEFINITIONS = {\r\n '0': /\\d/,\r\n '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-\\u09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A3\\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]/, // http://stackoverflow.com/a/22075070\r\n '*': /./\r\n};\r\n\r\n\r\n/** */\r\nexport default\r\nclass PatternInputDefinition implements PatternBlock {\r\n /** */\r\n +masked: Masked<*>;\r\n /** */\r\n parent: Masked<*>;\r\n /** */\r\n isOptional: boolean;\r\n /** */\r\n _isFilled: boolean;\r\n /** */\r\n lazy: $PropertyType;\r\n /** */\r\n placeholderChar: $PropertyType;\r\n\r\n\r\n constructor(opts: PatternInputDefinitionOptions) {\r\n const {mask, ...blockOpts} = opts;\r\n\r\n this.masked = createMask({mask});\r\n Object.assign(this, blockOpts);\r\n }\r\n\r\n reset () {\r\n this._isFilled = false;\r\n this.masked.reset();\r\n }\r\n\r\n remove (fromPos?: number=0, toPos?: number=this.value.length): ChangeDetails {\r\n if (fromPos === 0 && toPos >= 1) {\r\n this._isFilled = false;\r\n return this.masked.remove(fromPos, toPos);\r\n }\r\n\r\n return new ChangeDetails();\r\n }\r\n\r\n get value (): string {\r\n return this.masked.value ||\r\n (this._isFilled && !this.isOptional ?\r\n this.placeholderChar :\r\n '');\r\n }\r\n\r\n get unmaskedValue (): string {\r\n return this.masked.unmaskedValue;\r\n }\r\n\r\n get isComplete (): boolean {\r\n return Boolean(this.masked.value) || this.isOptional;\r\n }\r\n\r\n _appendChar (str: string, flags: AppendFlags={}): ChangeDetails {\r\n if (this._isFilled) return new ChangeDetails();\r\n\r\n const state = this.masked.state;\r\n // simulate input\r\n const details = this.masked._appendChar(str, flags);\r\n\r\n if (details.inserted && this.doValidate(flags) === false) {\r\n details.inserted = details.rawInserted = '';\r\n this.masked.state = state;\r\n }\r\n\r\n if (!details.inserted && !this.isOptional && !this.lazy && !flags.input) {\r\n details.inserted = this.placeholderChar;\r\n }\r\n details.skip = !details.inserted && !this.isOptional;\r\n this._isFilled = Boolean(details.inserted);\r\n\r\n return details;\r\n }\r\n\r\n _appendPlaceholder (): ChangeDetails {\r\n const details = new ChangeDetails();\r\n\r\n if (this._isFilled || this.isOptional) return details;\r\n\r\n this._isFilled = true;\r\n details.inserted = this.placeholderChar;\r\n return details;\r\n }\r\n\r\n extractTail (...args: *): TailDetails {\r\n return this.masked.extractTail(...args);\r\n }\r\n\r\n appendTail (...args: *): ChangeDetails {\r\n return this.masked.appendTail(...args);\r\n }\r\n\r\n extractInput (fromPos?: number=0, toPos?: number=this.value.length, flags?: ExtractFlags): string {\r\n return this.masked.extractInput(fromPos, toPos, flags);\r\n }\r\n\r\n nearestInputPos (cursorPos: number, direction: Direction=DIRECTION.NONE): number {\r\n const minPos = 0;\r\n const maxPos = this.value.length;\r\n const boundPos = Math.min(Math.max(cursorPos, minPos), maxPos);\r\n\r\n switch (direction) {\r\n case DIRECTION.LEFT:\r\n case DIRECTION.FORCE_LEFT:\r\n return this.isComplete ? boundPos : minPos;\r\n case DIRECTION.RIGHT:\r\n case DIRECTION.FORCE_RIGHT:\r\n return this.isComplete ? boundPos : maxPos;\r\n case DIRECTION.NONE:\r\n default: return boundPos;\r\n }\r\n }\r\n\r\n doValidate (...args: *) {\r\n return this.masked.doValidate(...args) && (\r\n !this.parent || this.parent.doValidate(...args));\r\n }\r\n\r\n doCommit () {\r\n this.masked.doCommit();\r\n }\r\n\r\n get state (): PatternInputDefinitionState {\r\n return {\r\n masked: this.masked.state,\r\n _isFilled: this._isFilled,\r\n };\r\n }\r\n\r\n set state (state: PatternInputDefinitionState) {\r\n this.masked.state = state.masked;\r\n this._isFilled = state._isFilled;\r\n }\r\n}\r\n","// @flow\r\nimport ChangeDetails from '../../core/change-details.js';\r\nimport {DIRECTION, type Direction} from '../../core/utils.js';\r\nimport {type TailDetails} from '../../core/tail-details.js';\r\nimport {type ExtractFlags, type AppendFlags, type MaskedState} from '../base.js';\r\nimport {type PatternBlock} from './block.js';\r\n\r\n\r\n/** */\r\ntype PatternFixedDefinitionOptions = {\r\n char: $PropertyType,\r\n isUnmasking?: $PropertyType,\r\n};\r\n\r\ntype PatternFixedDefinitionState = {|\r\n ...MaskedState,\r\n _isRawInput: ?boolean,\r\n|};\r\n\r\nexport default\r\nclass PatternFixedDefinition implements PatternBlock {\r\n /** */\r\n _value: string;\r\n /** */\r\n char: string;\r\n /** */\r\n isUnmasking: ?boolean;\r\n /** */\r\n _isRawInput: ?boolean;\r\n\r\n constructor(opts: PatternFixedDefinitionOptions) {\r\n Object.assign(this, opts);\r\n this._value = '';\r\n }\r\n\r\n get value (): string {\r\n return this._value;\r\n }\r\n\r\n get unmaskedValue (): string {\r\n return this.isUnmasking ? this.value : '';\r\n }\r\n\r\n reset () {\r\n this._isRawInput = false;\r\n this._value = '';\r\n }\r\n\r\n remove (fromPos?: number=0, toPos?: number=this._value.length): ChangeDetails {\r\n this._value = this._value.slice(0, fromPos) + this._value.slice(toPos);\r\n if (!this._value) this._isRawInput = false;\r\n\r\n return new ChangeDetails();\r\n }\r\n\r\n nearestInputPos (cursorPos: number, direction: Direction=DIRECTION.NONE): number {\r\n const minPos = 0;\r\n const maxPos = this._value.length;\r\n\r\n switch (direction) {\r\n case DIRECTION.LEFT:\r\n case DIRECTION.FORCE_LEFT:\r\n return minPos;\r\n case DIRECTION.NONE:\r\n case DIRECTION.RIGHT:\r\n case DIRECTION.FORCE_RIGHT:\r\n default: return maxPos;\r\n }\r\n }\r\n\r\n extractInput (fromPos?: number=0, toPos?: number=this._value.length, flags?: ExtractFlags={}) {\r\n return flags.raw && this._isRawInput && this._value.slice(fromPos, toPos) || '';\r\n }\r\n\r\n get isComplete (): boolean {\r\n return true;\r\n }\r\n\r\n _appendChar (str: string, flags: AppendFlags) {\r\n const details = new ChangeDetails();\r\n\r\n if (this._value) return details;\r\n\r\n const appended = this.char === str[0];\r\n const isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !flags.tail;\r\n if (isResolved) details.rawInserted = this.char;\r\n this._value = details.inserted = this.char;\r\n this._isRawInput = isResolved && (flags.raw || flags.input);\r\n\r\n return details;\r\n }\r\n\r\n _appendPlaceholder (): ChangeDetails {\r\n const details = new ChangeDetails();\r\n if (this._value) return details;\r\n\r\n this._value = details.inserted = this.char;\r\n return details;\r\n }\r\n\r\n extractTail (fromPos?: number=0, toPos?: number=this.value.length): TailDetails {\r\n return {\r\n value: '',\r\n };\r\n }\r\n\r\n appendTail (tail?: TailDetails): ChangeDetails {\r\n return this._appendChar(tail ? tail.value: '', {tail: true});\r\n }\r\n\r\n doCommit () {}\r\n\r\n get state (): PatternFixedDefinitionState {\r\n return {\r\n _value: this._value,\r\n _isRawInput: this._isRawInput,\r\n };\r\n }\r\n\r\n set state (state: PatternFixedDefinitionState) {\r\n Object.assign(this, state);\r\n }\r\n}\r\n","// @flow\r\nimport {type TailDetails} from '../../core/tail-details.js';\r\n\r\n\r\nexport\r\ntype TailInputChunk = TailDetails | ChunksTailDetails;\r\n\r\nexport\r\nclass ChunksTailDetails implements TailDetails {\r\n chunks: Array;\r\n index: ?number;\r\n\r\n constructor (chunks: Array) {\r\n this.chunks = chunks;\r\n }\r\n\r\n get value (): string {\r\n return this.chunks.map(c => c.value).join('');\r\n }\r\n}\r\n","// @flow\r\nimport {DIRECTION, type Direction, forceDirection} from '../core/utils.js';\r\nimport ChangeDetails from '../core/change-details.js';\r\nimport Masked, {type AppendFlags, type ExtractFlags, type MaskedOptions, type MaskedState} from './base.js';\r\nimport PatternInputDefinition, {DEFAULT_INPUT_DEFINITIONS, type Definitions} from './pattern/input-definition.js';\r\nimport PatternFixedDefinition from './pattern/fixed-definition.js';\r\nimport {ChunksTailDetails, type TailInputChunk} from './pattern/chunk-tail-details.js';\r\nimport {type TailDetails} from '../core/tail-details.js';\r\nimport {type PatternBlock} from './pattern/block.js';\r\nimport createMask from './factory.js';\r\n\r\n\r\ntype MaskedPatternOptions = {\r\n ...MaskedOptions,\r\n definitions: $PropertyType,\r\n blocks: $PropertyType,\r\n placeholderChar: $PropertyType,\r\n lazy: $PropertyType,\r\n};\r\n\r\ntype MaskedPatternState = {|\r\n ...MaskedState,\r\n _blocks: Array<*>,\r\n|};\r\n\r\ntype BlockPosData = {\r\n index: number,\r\n offset: number,\r\n};\r\n\r\n/**\r\n Pattern mask\r\n @param {Object} opts\r\n @param {Object} opts.blocks\r\n @param {Object} opts.definitions\r\n @param {string} opts.placeholderChar\r\n @param {boolean} opts.lazy\r\n*/\r\nexport default\r\nclass MaskedPattern extends Masked {\r\n static DEFAULTS: any;\r\n static STOP_CHAR: string;\r\n static ESCAPE_CHAR: string;\r\n static InputDefinition: Class;\r\n static FixedDefinition: Class;\r\n\r\n /** */\r\n blocks: {[string]: Masked<*>};\r\n /** */\r\n definitions: Definitions;\r\n /** Single char for empty input */\r\n placeholderChar: string;\r\n /** Show placeholder only when needed */\r\n lazy: boolean;\r\n _blocks: Array;\r\n _maskedBlocks: {[string]: Array};\r\n _stops: Array;\r\n\r\n constructor (opts: any={}) { // TODO type $Shape={} does not work\r\n opts.definitions = Object.assign({}, DEFAULT_INPUT_DEFINITIONS, opts.definitions);\r\n super({\r\n ...MaskedPattern.DEFAULTS,\r\n ...opts\r\n });\r\n }\r\n\r\n /**\r\n @override\r\n @param {Object} opts\r\n */\r\n _update (opts: $Shape={}) {\r\n opts.definitions = Object.assign({}, this.definitions, opts.definitions);\r\n super._update(opts);\r\n this._rebuildMask();\r\n }\r\n\r\n /** */\r\n _rebuildMask () {\r\n const defs = this.definitions;\r\n this._blocks = [];\r\n this._stops = [];\r\n this._maskedBlocks = {};\r\n\r\n let pattern = this.mask;\r\n if (!pattern || !defs) return;\r\n\r\n let unmaskingBlock = false;\r\n let optionalBlock = false;\r\n\r\n for (let i=0; i p.indexOf(bName) === 0);\r\n // order by key length\r\n bNames.sort((a, b) => b.length - a.length);\r\n // use block name with max length\r\n const bName = bNames[0];\r\n if (bName) {\r\n const maskedBlock = createMask({\r\n parent: this,\r\n lazy: this.lazy,\r\n placeholderChar: this.placeholderChar,\r\n ...this.blocks[bName]\r\n });\r\n\r\n if (maskedBlock) {\r\n this._blocks.push(maskedBlock);\r\n\r\n // store block index\r\n if (!this._maskedBlocks[bName]) this._maskedBlocks[bName] = [];\r\n this._maskedBlocks[bName].push(this._blocks.length - 1);\r\n }\r\n\r\n i += bName.length - 1;\r\n continue;\r\n }\r\n }\r\n\r\n let char = pattern[i];\r\n let isInput = char in defs;\r\n\r\n if (char === MaskedPattern.STOP_CHAR) {\r\n this._stops.push(this._blocks.length);\r\n continue;\r\n }\r\n\r\n if (char === '{' || char === '}') {\r\n unmaskingBlock = !unmaskingBlock;\r\n continue;\r\n }\r\n\r\n if (char === '[' || char === ']') {\r\n optionalBlock = !optionalBlock;\r\n continue;\r\n }\r\n\r\n if (char === MaskedPattern.ESCAPE_CHAR) {\r\n ++i;\r\n char = pattern[i];\r\n if (!char) break;\r\n isInput = false;\r\n }\r\n\r\n let def;\r\n if (isInput) {\r\n def = new PatternInputDefinition({\r\n parent: this,\r\n lazy: this.lazy,\r\n placeholderChar: this.placeholderChar,\r\n mask: defs[char],\r\n isOptional: optionalBlock,\r\n });\r\n } else {\r\n def = new PatternFixedDefinition({\r\n char,\r\n isUnmasking: unmaskingBlock,\r\n });\r\n }\r\n\r\n this._blocks.push(def);\r\n }\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get state (): MaskedPatternState {\r\n return {\r\n ...super.state,\r\n _blocks: this._blocks.map(b => b.state),\r\n };\r\n }\r\n\r\n set state (state: MaskedPatternState) {\r\n const {_blocks, ...maskedState} = state;\r\n this._blocks.forEach((b, bi) => b.state = _blocks[bi]);\r\n super.state = maskedState;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _storeBeforeTailState () {\r\n this._blocks.forEach(b => {\r\n // $FlowFixMe _storeBeforeTailState is not exist in PatternBlock\r\n if (typeof b._storeBeforeTailState === 'function') {\r\n b._storeBeforeTailState();\r\n }\r\n });\r\n super._storeBeforeTailState();\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _restoreBeforeTailState () {\r\n this._blocks.forEach(b => {\r\n // $FlowFixMe _restoreBeforeTailState is not exist in PatternBlock\r\n if (typeof b._restoreBeforeTailState === 'function') {\r\n b._restoreBeforeTailState();\r\n }\r\n });\r\n super._restoreBeforeTailState();\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _resetBeforeTailState () {\r\n this._blocks.forEach(b => {\r\n // $FlowFixMe _resetBeforeTailState is not exist in PatternBlock\r\n if (typeof b._resetBeforeTailState === 'function') {\r\n b._resetBeforeTailState();\r\n }\r\n });\r\n super._resetBeforeTailState();\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n reset () {\r\n super.reset();\r\n this._blocks.forEach(b => b.reset());\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get isComplete (): boolean {\r\n return this._blocks.every(b => b.isComplete);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doCommit () {\r\n this._blocks.forEach(b => b.doCommit());\r\n super.doCommit();\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get unmaskedValue (): string {\r\n return this._blocks.reduce((str, b) => str += b.unmaskedValue, '');\r\n }\r\n\r\n set unmaskedValue (unmaskedValue: string) {\r\n super.unmaskedValue = unmaskedValue;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get value (): string {\r\n // TODO return _value when not in change?\r\n return this._blocks.reduce((str, b) => str += b.value, '');\r\n }\r\n\r\n set value (value: string) {\r\n super.value = value;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n appendTail (tail?: ChunksTailDetails | TailDetails): ChangeDetails {\r\n const details = new ChangeDetails();\r\n if (tail) {\r\n details.aggregate(tail instanceof ChunksTailDetails ?\r\n this._appendTailChunks(tail.chunks) :\r\n super.appendTail(tail));\r\n }\r\n return details.aggregate(this._appendPlaceholder());\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _appendCharRaw (ch: string, flags: AppendFlags={}): ChangeDetails {\r\n const blockData = this._mapPosToBlock(this.value.length);\r\n const details = new ChangeDetails();\r\n if (!blockData) return details;\r\n\r\n for (let bi=blockData.index; ; ++bi) {\r\n const block = this._blocks[bi];\r\n if (!block) break;\r\n\r\n const blockDetails = block._appendChar(ch, flags);\r\n\r\n const skip = blockDetails.skip;\r\n details.aggregate(blockDetails);\r\n\r\n if (skip || blockDetails.rawInserted) break; // go next char\r\n }\r\n\r\n return details;\r\n }\r\n\r\n /** Appends chunks splitted by stop chars */\r\n _appendTailChunks (chunks: Array) {\r\n const details = new ChangeDetails();\r\n\r\n for (let ci=0; ci < chunks.length && !details.skip; ++ci) {\r\n const chunk = chunks[ci];\r\n\r\n const lastBlock = this._mapPosToBlock(this.value.length);\r\n const chunkBlock = chunk instanceof ChunksTailDetails &&\r\n chunk.index != null &&\r\n (!lastBlock || lastBlock.index <= chunk.index) &&\r\n this._blocks[chunk.index];\r\n if (chunkBlock) {\r\n // $FlowFixMe we already check index above\r\n details.aggregate(this._appendPlaceholder(chunk.index));\r\n\r\n const tailDetails = chunkBlock.appendTail(chunk);\r\n tailDetails.skip = false; // always ignore skip, it will be set on last\r\n details.aggregate(tailDetails);\r\n this._value += tailDetails.inserted;\r\n\r\n // get not inserted chars\r\n const remainChars = chunk.value.slice(tailDetails.rawInserted.length);\r\n if (remainChars) details.aggregate(this.append(remainChars, {tail: true}));\r\n } else {\r\n const {stop, value} = (chunk: any);\r\n if (stop != null && this._stops.indexOf(stop) >= 0) details.aggregate(this._appendPlaceholder(stop));\r\n details.aggregate(this.append(value, {tail: true}));\r\n }\r\n };\r\n\r\n return details;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n extractTail (fromPos?: number=0, toPos?: number=this.value.length): ChunksTailDetails {\r\n return new ChunksTailDetails(this._extractTailChunks(fromPos, toPos));\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n extractInput (fromPos?: number=0, toPos?: number=this.value.length, flags: ExtractFlags={}): string {\r\n if (fromPos === toPos) return '';\r\n\r\n let input = '';\r\n\r\n this._forEachBlocksInRange(fromPos, toPos, (b, _, fromPos, toPos) => {\r\n input += b.extractInput(fromPos, toPos, flags);\r\n });\r\n\r\n return input;\r\n }\r\n\r\n /** Extracts chunks from input splitted by stop chars */\r\n _extractTailChunks (fromPos: number=0, toPos: number=this.value.length): Array {\r\n if (fromPos === toPos) return [];\r\n\r\n const chunks = [];\r\n let lastChunk;\r\n this._forEachBlocksInRange(fromPos, toPos, (b, bi, fromPos, toPos) => {\r\n const blockChunk = b.extractTail(fromPos, toPos);\r\n\r\n let nearestStop;\r\n for (let si=0; si chunk.value)\r\n .forEach(chunk => {\r\n if (lastChunk) lastChunk.value += chunk.value;\r\n // will flat nested chunks\r\n else lastChunk = ({value: chunk.value}: TailDetails);\r\n });\r\n }\r\n\r\n // if block chunk has stops\r\n if (blockChunk.chunks.length) {\r\n if (lastChunk) chunks.push(lastChunk);\r\n blockChunk.index = nearestStop;\r\n chunks.push(blockChunk);\r\n // we cant append to ChunksTailDetails, so just reset lastChunk to force adding new\r\n lastChunk = null;\r\n }\r\n } else {\r\n if (nearestStop != null) {\r\n // on middle chunks consider stop flag and do not consider value\r\n // add block even if it is empty\r\n if (lastChunk) chunks.push(lastChunk);\r\n blockChunk.stop = nearestStop;\r\n } else if (lastChunk) {\r\n lastChunk.value += blockChunk.value;\r\n return;\r\n }\r\n lastChunk = blockChunk;\r\n }\r\n });\r\n\r\n if (lastChunk && lastChunk.value) chunks.push(lastChunk);\r\n\r\n return chunks;\r\n }\r\n\r\n /** Appends placeholder depending on laziness */\r\n _appendPlaceholder (toBlockIndex: ?number): ChangeDetails {\r\n const details = new ChangeDetails();\r\n if (this.lazy && toBlockIndex == null) return details;\r\n\r\n const startBlockData = this._mapPosToBlock(this.value.length);\r\n if (!startBlockData) return details;\r\n\r\n const startBlockIndex = startBlockData.index;\r\n const endBlockIndex = toBlockIndex != null ? toBlockIndex : this._blocks.length;\r\n\r\n this._blocks.slice(startBlockIndex, endBlockIndex)\r\n .forEach(b => {\r\n if (typeof b._appendPlaceholder === 'function') {\r\n // $FlowFixMe `_blocks` may not be present\r\n const args = b._blocks != null ? [b._blocks.length] : [];\r\n const bDetails = b._appendPlaceholder.apply(b, args);\r\n this._value += bDetails.inserted;\r\n details.aggregate(bDetails);\r\n }\r\n });\r\n\r\n return details;\r\n }\r\n\r\n /** Finds block in pos */\r\n _mapPosToBlock (pos: number): ?BlockPosData {\r\n let accVal = '';\r\n for (let bi=0; bi pos += b.value.length, 0);\r\n }\r\n\r\n /** */\r\n _forEachBlocksInRange (fromPos: number, toPos: number=this.value.length, fn: (block: PatternBlock, blockIndex: number, fromPos?: number, toPos?: number) => void) {\r\n const fromBlock = this._mapPosToBlock(fromPos);\r\n\r\n if (fromBlock) {\r\n const toBlock = this._mapPosToBlock(toPos);\r\n // process first block\r\n const isSameBlock = toBlock && fromBlock.index === toBlock.index;\r\n const fromBlockRemoveBegin = fromBlock.offset;\r\n const fromBlockRemoveEnd = toBlock && isSameBlock ? toBlock.offset : undefined;\r\n fn(this._blocks[fromBlock.index], fromBlock.index, fromBlockRemoveBegin, fromBlockRemoveEnd);\r\n\r\n if (toBlock && !isSameBlock) {\r\n // process intermediate blocks\r\n for (let bi=fromBlock.index+1; bi {\r\n removeDetails.aggregate(b.remove(bFromPos, bToPos));\r\n });\r\n return removeDetails;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n nearestInputPos (cursorPos: number, direction: Direction=DIRECTION.NONE): number {\r\n // TODO refactor - extract alignblock\r\n\r\n const beginBlockData = this._mapPosToBlock(cursorPos) || {index: 0, offset: 0};\r\n const {\r\n offset: beginBlockOffset,\r\n index: beginBlockIndex,\r\n } = beginBlockData;\r\n const beginBlock = this._blocks[beginBlockIndex];\r\n\r\n if (!beginBlock) return cursorPos;\r\n\r\n let beginBlockCursorPos = beginBlockOffset;\r\n // if position inside block - try to adjust it\r\n if (beginBlockCursorPos !== 0 && beginBlockCursorPos < beginBlock.value.length) {\r\n beginBlockCursorPos = beginBlock.nearestInputPos(beginBlockOffset, forceDirection(direction));\r\n }\r\n\r\n const cursorAtRight = beginBlockCursorPos === beginBlock.value.length;\r\n const cursorAtLeft = beginBlockCursorPos === 0;\r\n\r\n // cursor is INSIDE first block (not at bounds)\r\n if (!cursorAtLeft && !cursorAtRight) return this._blockStartPos(beginBlockIndex) + beginBlockCursorPos;\r\n\r\n const searchBlockIndex = cursorAtRight ? beginBlockIndex + 1 : beginBlockIndex;\r\n\r\n if (direction === DIRECTION.NONE) {\r\n // NONE direction used to calculate start input position if no chars were removed\r\n // FOR NONE:\r\n // -\r\n // input|any\r\n // ->\r\n // any|input\r\n // <-\r\n // filled-input|any\r\n\r\n // check if first block at left is input\r\n if (searchBlockIndex > 0) {\r\n const blockIndexAtLeft = searchBlockIndex-1;\r\n const blockAtLeft = this._blocks[blockIndexAtLeft];\r\n const blockInputPos = blockAtLeft.nearestInputPos(0, DIRECTION.NONE);\r\n // is input\r\n if (!blockAtLeft.value.length || blockInputPos !== blockAtLeft.value.length) {\r\n return this._blockStartPos(searchBlockIndex);\r\n }\r\n }\r\n\r\n // ->\r\n let firstInputAtRight = searchBlockIndex;\r\n for (let bi=firstInputAtRight; bi < this._blocks.length; ++bi) {\r\n const block = this._blocks[bi];\r\n const blockInputPos = block.nearestInputPos(0, DIRECTION.NONE);\r\n if (blockInputPos !== block.value.length) {\r\n return this._blockStartPos(bi) + blockInputPos;\r\n }\r\n }\r\n\r\n return this.value.length;\r\n }\r\n\r\n if (direction === DIRECTION.LEFT || direction === DIRECTION.FORCE_LEFT) {\r\n // -\r\n // any|filled-input\r\n // <-\r\n // any|first not empty is not-len-aligned\r\n // not-0-aligned|any\r\n // ->\r\n // any|not-len-aligned or end\r\n\r\n // check if first block at right is filled input\r\n let firstFilledBlockIndexAtRight;\r\n for (let bi=searchBlockIndex; bi < this._blocks.length; ++bi) {\r\n if (this._blocks[bi].value) {\r\n firstFilledBlockIndexAtRight = bi;\r\n break;\r\n }\r\n }\r\n if (firstFilledBlockIndexAtRight != null) {\r\n const filledBlock = this._blocks[firstFilledBlockIndexAtRight];\r\n const blockInputPos = filledBlock.nearestInputPos(0, DIRECTION.RIGHT);\r\n if (blockInputPos === 0 && filledBlock.unmaskedValue.length) {\r\n // filled block is input\r\n return this._blockStartPos(firstFilledBlockIndexAtRight) + blockInputPos;\r\n }\r\n }\r\n\r\n // <-\r\n // find this vars\r\n let firstFilledInputBlockIndex = -1;\r\n let firstEmptyInputBlockIndex; // TODO consider nested empty inputs\r\n for (let bi=searchBlockIndex-1; bi >= 0; --bi) {\r\n const block = this._blocks[bi];\r\n const blockInputPos = block.nearestInputPos(block.value.length, DIRECTION.FORCE_LEFT);\r\n if (firstEmptyInputBlockIndex == null && (!block.value || blockInputPos !== 0)) {\r\n firstEmptyInputBlockIndex = bi;\r\n }\r\n if (blockInputPos !== 0) {\r\n if (blockInputPos !== block.value.length) {\r\n // aligned inside block - return immediately\r\n return this._blockStartPos(bi) + blockInputPos;\r\n } else {\r\n // found filled\r\n firstFilledInputBlockIndex = bi;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (direction === DIRECTION.LEFT) {\r\n // try find first empty input before start searching position only when not forced\r\n for (let bi=firstFilledInputBlockIndex+1; bi <= Math.min(searchBlockIndex, this._blocks.length-1); ++bi) {\r\n const block = this._blocks[bi];\r\n const blockInputPos = block.nearestInputPos(0, DIRECTION.NONE);\r\n const blockAlignedPos = this._blockStartPos(bi) + blockInputPos;\r\n // if block is empty and last or not lazy input\r\n if ((!block.value.length && blockAlignedPos === this.value.length || blockInputPos !== block.value.length) && blockAlignedPos <= cursorPos) {\r\n return blockAlignedPos;\r\n }\r\n }\r\n }\r\n\r\n // process overflow\r\n if (firstFilledInputBlockIndex >= 0) {\r\n return this._blockStartPos(firstFilledInputBlockIndex) + this._blocks[firstFilledInputBlockIndex].value.length;\r\n }\r\n\r\n // for lazy if has aligned left inside fixed and has came to the start - use start position\r\n if (\r\n direction === DIRECTION.FORCE_LEFT ||\r\n this.lazy && !this.extractInput() && !isInput(this._blocks[searchBlockIndex])\r\n ) {\r\n return 0;\r\n }\r\n\r\n if (firstEmptyInputBlockIndex != null) {\r\n return this._blockStartPos(firstEmptyInputBlockIndex);\r\n }\r\n\r\n // find first input\r\n for (let bi=searchBlockIndex; bi < this._blocks.length; ++bi) {\r\n const block = this._blocks[bi];\r\n const blockInputPos = block.nearestInputPos(0, DIRECTION.NONE);\r\n // is input\r\n if (!block.value.length || blockInputPos !== block.value.length) {\r\n return this._blockStartPos(bi) + blockInputPos;\r\n }\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n if (direction === DIRECTION.RIGHT || direction === DIRECTION.FORCE_RIGHT) {\r\n // ->\r\n // any|not-len-aligned and filled\r\n // any|not-len-aligned\r\n // <-\r\n // not-0-aligned or start|any\r\n let firstInputBlockAlignedIndex: ?number;\r\n let firstInputBlockAlignedPos: ?number;\r\n for (let bi=searchBlockIndex; bi < this._blocks.length; ++bi) {\r\n const block = this._blocks[bi];\r\n const blockInputPos = block.nearestInputPos(0, DIRECTION.NONE);\r\n if (blockInputPos !== block.value.length) {\r\n firstInputBlockAlignedPos = this._blockStartPos(bi) + blockInputPos;\r\n firstInputBlockAlignedIndex = bi;\r\n break;\r\n }\r\n }\r\n\r\n if (firstInputBlockAlignedIndex != null && firstInputBlockAlignedPos != null) {\r\n for (let bi=firstInputBlockAlignedIndex; bi < this._blocks.length; ++bi) {\r\n const block = this._blocks[bi];\r\n const blockInputPos = block.nearestInputPos(0, DIRECTION.FORCE_RIGHT);\r\n if (blockInputPos !== block.value.length) {\r\n return this._blockStartPos(bi) + blockInputPos;\r\n }\r\n }\r\n return direction === DIRECTION.FORCE_RIGHT ?\r\n this.value.length :\r\n firstInputBlockAlignedPos;\r\n }\r\n\r\n for (let bi=Math.min(searchBlockIndex, this._blocks.length-1); bi >= 0; --bi) {\r\n const block = this._blocks[bi];\r\n const blockInputPos = block.nearestInputPos(block.value.length, DIRECTION.LEFT);\r\n if (blockInputPos !== 0) {\r\n const alignedPos = this._blockStartPos(bi) + blockInputPos;\r\n if (alignedPos >= cursorPos) return alignedPos;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cursorPos;\r\n }\r\n\r\n /** Get block by name */\r\n maskedBlock (name: string): ?PatternBlock {\r\n return this.maskedBlocks(name)[0];\r\n }\r\n\r\n /** Get all blocks by name */\r\n maskedBlocks (name: string): Array {\r\n const indices = this._maskedBlocks[name];\r\n if (!indices) return [];\r\n return indices.map(gi => this._blocks[gi]);\r\n }\r\n}\r\nMaskedPattern.DEFAULTS = {\r\n lazy: true,\r\n placeholderChar: '_'\r\n};\r\nMaskedPattern.STOP_CHAR = '`';\r\nMaskedPattern.ESCAPE_CHAR = '\\\\';\r\nMaskedPattern.InputDefinition = PatternInputDefinition;\r\nMaskedPattern.FixedDefinition = PatternFixedDefinition;\r\n\r\nfunction isInput (block: PatternBlock): boolean {\r\n if (!block) return false;\r\n\r\n const value = block.value;\r\n return !value || block.nearestInputPos(0, DIRECTION.NONE) !== value.length;\r\n}\r\n","// @flow\r\nimport MaskedPattern from './pattern.js';\r\n\r\n\r\n/** Pattern which accepts ranges */\r\nexport default\r\nclass MaskedRange extends MaskedPattern {\r\n /**\r\n Optionally sets max length of pattern.\r\n Used when pattern length is longer then `to` param length. Pads zeros at start in this case.\r\n */\r\n maxLength: number;\r\n /** Min bound */\r\n from: number;\r\n /** Max bound */\r\n to: number;\r\n\r\n get _matchFrom (): number {\r\n return this.maxLength - String(this.from).length;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _update (opts: any) { // TODO type\r\n opts = {\r\n to: this.to || 0,\r\n from: this.from || 0,\r\n ...opts,\r\n };\r\n\r\n let maxLength = String(opts.to).length;\r\n if (opts.maxLength != null) maxLength = Math.max(maxLength, opts.maxLength);\r\n opts.maxLength = maxLength;\r\n\r\n const toStr = String(opts.to).padStart(maxLength, '0');\r\n const fromStr = String(opts.from).padStart(maxLength, '0');\r\n let sameCharsCount = 0;\r\n while (sameCharsCount < toStr.length && toStr[sameCharsCount] === fromStr[sameCharsCount]) ++sameCharsCount;\r\n opts.mask = toStr.slice(0, sameCharsCount).replace(/0/g, '\\\\0') + '0'.repeat(maxLength - sameCharsCount);\r\n\r\n super._update(opts);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get isComplete (): boolean {\r\n return super.isComplete && Boolean(this.value);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doValidate (...args: *): boolean {\r\n const str = this.value;\r\n let minstr = '';\r\n let maxstr = '';\r\n\r\n const [, placeholder, num] = str.match(/^(\\D*)(\\d*)(\\D*)/) || [];\r\n if (num) {\r\n minstr = ('0'.repeat(placeholder.length) + num);\r\n maxstr = ('9'.repeat(placeholder.length) + num);\r\n }\r\n\r\n const firstNonZero = str.search(/[^0]/);\r\n if (firstNonZero === -1 && str.length <= this._matchFrom) return true;\r\n\r\n minstr = minstr.padEnd(this.maxLength, '0');\r\n maxstr = maxstr.padEnd(this.maxLength, '9');\r\n\r\n return this.from <= Number(maxstr) && Number(minstr) <= this.to &&\r\n super.doValidate(...args);\r\n }\r\n}\r\n","// @flow\r\nimport MaskedPattern from './pattern.js';\r\nimport MaskedRange from './range.js';\r\n\r\n\r\n/** Date mask */\r\nexport default\r\nclass MaskedDate extends MaskedPattern {\r\n static GET_DEFAULT_BLOCKS: () => {[string]: any};\r\n static DEFAULTS: any;\r\n\r\n /** Parse string to Date */\r\n parse: (string) => Date;\r\n /** Format Date to string */\r\n format: (Date) => string;\r\n /** Pattern mask for date according to {@link MaskedDate#format} */\r\n pattern: string;\r\n /** Start date */\r\n min: ?Date;\r\n /** End date */\r\n max: ?Date;\r\n\r\n /**\r\n @param {Object} opts\r\n */\r\n constructor (opts: any) {\r\n super({\r\n ...MaskedDate.DEFAULTS,\r\n ...opts\r\n });\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _update (opts: any) {\r\n if (opts.mask === Date) delete opts.mask;\r\n if (opts.pattern) {\r\n opts.mask = opts.pattern;\r\n delete opts.pattern;\r\n }\r\n\r\n const blocks = opts.blocks;\r\n opts.blocks = Object.assign({}, MaskedDate.GET_DEFAULT_BLOCKS());\r\n // adjust year block\r\n if (opts.min) opts.blocks.Y.from = opts.min.getFullYear();\r\n if (opts.max) opts.blocks.Y.to = opts.max.getFullYear();\r\n if (opts.min && opts.max && opts.blocks.Y.from === opts.blocks.Y.to\r\n ) {\r\n opts.blocks.m.from = opts.min.getMonth() + 1;\r\n opts.blocks.m.to = opts.max.getMonth() + 1;\r\n\r\n if (opts.blocks.m.from === opts.blocks.m.to) {\r\n opts.blocks.d.from = opts.min.getDate();\r\n opts.blocks.d.to = opts.max.getDate();\r\n }\r\n }\r\n Object.assign(opts.blocks, blocks);\r\n\r\n super._update(opts);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doValidate (...args: *): boolean {\r\n const date = this.date;\r\n\r\n return super.doValidate(...args) &&\r\n (!this.isComplete ||\r\n this.isDateExist(this.value) && date != null &&\r\n (this.min == null || this.min <= date) &&\r\n (this.max == null || date <= this.max));\r\n }\r\n\r\n /** Checks if date is exists */\r\n isDateExist (str: string): boolean {\r\n return this.format(this.parse(str)) === str;\r\n }\r\n\r\n /** Parsed Date */\r\n get date (): ?Date {\r\n return this.isComplete ?\r\n this.parse(this.value) :\r\n null;\r\n }\r\n set date (date: Date) {\r\n this.value = this.format(date);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get typedValue (): ?Date {\r\n return this.date;\r\n }\r\n set typedValue (value: Date) {\r\n this.date = value;\r\n }\r\n}\r\nMaskedDate.DEFAULTS = {\r\n pattern: 'd{.}`m{.}`Y',\r\n format: date => {\r\n const day = String(date.getDate()).padStart(2, '0');\r\n const month = String(date.getMonth() + 1).padStart(2, '0');\r\n const year = date.getFullYear();\r\n\r\n return [day, month, year].join('.');\r\n },\r\n parse: str => {\r\n const [day, month, year] = str.split('.');\r\n return new Date(year, month - 1, day);\r\n },\r\n};\r\nMaskedDate.GET_DEFAULT_BLOCKS = () => {\r\n return {\r\n d: {\r\n mask: MaskedRange,\r\n from: 1,\r\n to: 31,\r\n maxLength: 2,\r\n },\r\n m: {\r\n mask: MaskedRange,\r\n from: 1,\r\n to: 12,\r\n maxLength: 2,\r\n },\r\n Y: {\r\n mask: MaskedRange,\r\n from: 1900,\r\n to: 9999,\r\n }\r\n };\r\n};\r\n","// @flow\r\n\r\nexport\r\ntype ElementEvent =\r\n 'selectionChange' |\r\n 'input' |\r\n 'drop' |\r\n 'click' |\r\n 'focus' |\r\n 'commit';\r\n\r\n/**\r\n Generic element API to use with mask\r\n @interface\r\n*/\r\nexport default\r\nclass MaskElement {\r\n /** */\r\n +_unsafeSelectionStart: number;\r\n /** */\r\n +_unsafeSelectionEnd: number;\r\n /** */\r\n value: string;\r\n\r\n /** Safely returns selection start */\r\n get selectionStart (): number {\r\n let start;\r\n try {\r\n start = this._unsafeSelectionStart;\r\n } catch (e) {}\r\n\r\n return start != null ?\r\n start :\r\n this.value.length;\r\n }\r\n\r\n /** Safely returns selection end */\r\n get selectionEnd (): number {\r\n let end;\r\n try {\r\n end = this._unsafeSelectionEnd;\r\n } catch (e) {}\r\n\r\n return end != null ?\r\n end :\r\n this.value.length;\r\n }\r\n\r\n /** Safely sets element selection */\r\n select (start: number, end: number) {\r\n if (start == null || end == null ||\r\n start === this.selectionStart && end === this.selectionEnd) return;\r\n\r\n try {\r\n this._unsafeSelect(start, end);\r\n } catch (e) {}\r\n }\r\n\r\n /** Should be overriden in subclasses */\r\n _unsafeSelect (start: number, end: number): void {}\r\n /** Should be overriden in subclasses */\r\n get isActive (): boolean { return false; }\r\n /** Should be overriden in subclasses */\r\n bindEvents (handlers: {[ElementEvent]: Function}) {}\r\n /** Should be overriden in subclasses */\r\n unbindEvents (): void {}\r\n}\r\n","// @flow\r\nimport MaskElement, {type ElementEvent} from './mask-element.js';\r\n\r\n\r\n/** Bridge between HTMLElement and {@link Masked} */\r\nexport default\r\nclass HTMLMaskElement extends MaskElement {\r\n /** Mapping between HTMLElement events and mask internal events */\r\n static EVENTS_MAP: {[ElementEvent]: string};\r\n /** HTMLElement to use mask on */\r\n input: HTMLTextAreaElement | HTMLInputElement;\r\n _handlers: {[string]: Function};\r\n\r\n /**\r\n @param {HTMLInputElement|HTMLTextAreaElement} input\r\n */\r\n constructor (input: HTMLTextAreaElement | HTMLInputElement) {\r\n super();\r\n this.input = input;\r\n this._handlers = {};\r\n }\r\n\r\n /**\r\n Is element in focus\r\n @readonly\r\n */\r\n get isActive (): boolean {\r\n return this.input === document.activeElement;\r\n }\r\n\r\n /**\r\n Returns HTMLElement selection start\r\n @override\r\n */\r\n get _unsafeSelectionStart (): number {\r\n return this.input.selectionStart;\r\n }\r\n\r\n /**\r\n Returns HTMLElement selection end\r\n @override\r\n */\r\n get _unsafeSelectionEnd (): number {\r\n return this.input.selectionEnd;\r\n }\r\n\r\n /**\r\n Sets HTMLElement selection\r\n @override\r\n */\r\n _unsafeSelect (start: number, end: number) {\r\n this.input.setSelectionRange(start, end);\r\n }\r\n\r\n /**\r\n HTMLElement value\r\n @override\r\n */\r\n get value (): string {\r\n return this.input.value;\r\n }\r\n set value (value: string) {\r\n this.input.value = value;\r\n }\r\n\r\n /**\r\n Binds HTMLElement events to mask internal events\r\n @override\r\n */\r\n bindEvents (handlers: {[ElementEvent]: Function}) {\r\n Object.keys(handlers)\r\n .forEach(event => this._toggleEventHandler(HTMLMaskElement.EVENTS_MAP[event], handlers[event]));\r\n }\r\n\r\n /**\r\n Unbinds HTMLElement events to mask internal events\r\n @override\r\n */\r\n unbindEvents () {\r\n Object.keys(this._handlers)\r\n .forEach(event => this._toggleEventHandler(event));\r\n }\r\n\r\n /** */\r\n _toggleEventHandler (event: string, handler?: Function): void {\r\n if (this._handlers[event]) {\r\n this.input.removeEventListener(event, this._handlers[event]);\r\n delete this._handlers[event];\r\n }\r\n\r\n if (handler) {\r\n this.input.addEventListener(event, handler);\r\n this._handlers[event] = handler;\r\n }\r\n }\r\n}\r\nHTMLMaskElement.EVENTS_MAP = {\r\n selectionChange: 'keydown',\r\n input: 'input',\r\n drop: 'drop',\r\n click: 'click',\r\n focus: 'focus',\r\n commit: 'change',\r\n};\r\n","// @flow\r\nimport {objectIncludes, DIRECTION, type Selection} from '../core/utils.js';\r\nimport ActionDetails from '../core/action-details.js';\r\nimport MaskedDate from '../masked/date.js';\r\nimport createMask, {maskedClass} from '../masked/factory.js';\r\nimport type Masked from '../masked/base.js';\r\nimport {type Mask} from '../masked/base.js';\r\nimport MaskElement from './mask-element.js';\r\nimport HTMLMaskElement from './html-mask-element.js';\r\n\r\n\r\n/** Listens to element events and controls changes between element and {@link Masked} */\r\nexport default\r\nclass InputMask {\r\n /**\r\n View element\r\n @readonly\r\n */\r\n el: MaskElement;\r\n\r\n /**\r\n Internal {@link Masked} model\r\n @readonly\r\n */\r\n masked: Masked<*>;\r\n alignCursor: () => void;\r\n alignCursorFriendly: () => void;\r\n\r\n _listeners: {[string]: Array};\r\n _value: string;\r\n _changingCursorPos: number;\r\n _unmaskedValue: string;\r\n _saveSelection: (?Event) => void;\r\n _selection: Selection;\r\n _onInput: () => void;\r\n _onChange: () => void;\r\n _onDrop: (Event) => void;\r\n _cursorChanging: TimeoutID;\r\n\r\n /**\r\n @param {MaskElement|HTMLInputElement|HTMLTextAreaElement} el\r\n @param {Object} opts\r\n */\r\n constructor (el: MaskElement | HTMLTextAreaElement | HTMLInputElement, opts: {[string]: any}) {\r\n this.el = (el instanceof MaskElement) ?\r\n el :\r\n new HTMLMaskElement(el);\r\n this.masked = createMask(opts);\r\n\r\n this._listeners = {};\r\n this._value = '';\r\n this._unmaskedValue = '';\r\n\r\n this._saveSelection = this._saveSelection.bind(this);\r\n this._onInput = this._onInput.bind(this);\r\n this._onChange = this._onChange.bind(this);\r\n this._onDrop = this._onDrop.bind(this);\r\n this.alignCursor = this.alignCursor.bind(this);\r\n this.alignCursorFriendly = this.alignCursorFriendly.bind(this);\r\n\r\n this._bindEvents();\r\n\r\n // refresh\r\n this.updateValue();\r\n this._onChange();\r\n }\r\n\r\n /** Read or update mask */\r\n get mask (): Mask {\r\n return this.masked.mask;\r\n }\r\n\r\n set mask (mask: Mask) {\r\n if (mask == null ||\r\n mask === this.masked.mask ||\r\n mask === Date && this.masked instanceof MaskedDate) return;\r\n\r\n if (this.masked.constructor === maskedClass(mask)) {\r\n this.masked.updateOptions({mask});\r\n return;\r\n }\r\n\r\n const masked = createMask({mask});\r\n masked.unmaskedValue = this.masked.unmaskedValue;\r\n this.masked = masked;\r\n }\r\n\r\n /** Raw value */\r\n get value (): string {\r\n return this._value;\r\n }\r\n\r\n set value (str: string) {\r\n this.masked.value = str;\r\n this.updateControl();\r\n this.alignCursor();\r\n }\r\n\r\n /** Unmasked value */\r\n get unmaskedValue (): string {\r\n return this._unmaskedValue;\r\n }\r\n\r\n set unmaskedValue (str: string) {\r\n this.masked.unmaskedValue = str;\r\n this.updateControl();\r\n this.alignCursor();\r\n }\r\n\r\n /** Typed unmasked value */\r\n get typedValue (): any {\r\n return this.masked.typedValue;\r\n }\r\n\r\n set typedValue (val: any) {\r\n this.masked.typedValue = val;\r\n this.updateControl();\r\n this.alignCursor();\r\n }\r\n\r\n /**\r\n Starts listening to element events\r\n @protected\r\n */\r\n _bindEvents () {\r\n this.el.bindEvents({\r\n selectionChange: this._saveSelection,\r\n input: this._onInput,\r\n drop: this._onDrop,\r\n click: this.alignCursorFriendly,\r\n focus: this.alignCursorFriendly,\r\n commit: this._onChange,\r\n });\r\n }\r\n\r\n /**\r\n Stops listening to element events\r\n @protected\r\n */\r\n _unbindEvents () {\r\n this.el.unbindEvents();\r\n }\r\n\r\n /**\r\n Fires custom event\r\n @protected\r\n */\r\n _fireEvent (ev: string) {\r\n const listeners = this._listeners[ev];\r\n if (!listeners) return;\r\n\r\n listeners.forEach(l => l());\r\n }\r\n\r\n /**\r\n Current selection start\r\n @readonly\r\n */\r\n get selectionStart (): number {\r\n return this._cursorChanging ?\r\n this._changingCursorPos :\r\n\r\n this.el.selectionStart;\r\n }\r\n\r\n /** Current cursor position */\r\n get cursorPos (): number {\r\n return this._cursorChanging ?\r\n this._changingCursorPos :\r\n\r\n this.el.selectionEnd;\r\n }\r\n set cursorPos (pos: number) {\r\n if (!this.el.isActive) return;\r\n\r\n this.el.select(pos, pos);\r\n this._saveSelection();\r\n }\r\n\r\n /**\r\n Stores current selection\r\n @protected\r\n */\r\n _saveSelection (/* ev */) {\r\n if (this.value !== this.el.value) {\r\n console.warn('Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.'); // eslint-disable-line no-console\r\n }\r\n this._selection = {\r\n start: this.selectionStart,\r\n end: this.cursorPos\r\n };\r\n }\r\n\r\n /** Syncronizes model value from view */\r\n updateValue () {\r\n this.masked.value = this.el.value;\r\n }\r\n\r\n /** Syncronizes view from model value, fires change events */\r\n updateControl () {\r\n const newUnmaskedValue = this.masked.unmaskedValue;\r\n const newValue = this.masked.value;\r\n const isChanged = (this.unmaskedValue !== newUnmaskedValue ||\r\n this.value !== newValue);\r\n\r\n this._unmaskedValue = newUnmaskedValue;\r\n this._value = newValue;\r\n\r\n if (this.el.value !== newValue) this.el.value = newValue;\r\n if (isChanged) this._fireChangeEvents();\r\n }\r\n\r\n /** Updates options with deep equal check, recreates @{link Masked} model if mask type changes */\r\n updateOptions (opts: {[string]: any}) {\r\n if (objectIncludes(this.masked, opts)) return;\r\n\r\n const { mask, ...restOpts } = opts;\r\n\r\n this.mask = mask;\r\n this.masked.updateOptions(restOpts);\r\n\r\n this.updateControl();\r\n }\r\n\r\n /** Updates cursor */\r\n updateCursor (cursorPos: number) {\r\n if (cursorPos == null) return;\r\n this.cursorPos = cursorPos;\r\n\r\n // also queue change cursor for mobile browsers\r\n this._delayUpdateCursor(cursorPos);\r\n }\r\n\r\n /**\r\n Delays cursor update to support mobile browsers\r\n @private\r\n */\r\n _delayUpdateCursor (cursorPos: number) {\r\n this._abortUpdateCursor();\r\n this._changingCursorPos = cursorPos;\r\n this._cursorChanging = setTimeout(() => {\r\n if (!this.el) return; // if was destroyed\r\n this.cursorPos = this._changingCursorPos;\r\n this._abortUpdateCursor();\r\n }, 10);\r\n }\r\n\r\n /**\r\n Fires custom events\r\n @protected\r\n */\r\n _fireChangeEvents () {\r\n this._fireEvent('accept');\r\n if (this.masked.isComplete) this._fireEvent('complete');\r\n }\r\n\r\n /**\r\n Aborts delayed cursor update\r\n @private\r\n */\r\n _abortUpdateCursor () {\r\n if (this._cursorChanging) {\r\n clearTimeout(this._cursorChanging);\r\n delete this._cursorChanging;\r\n }\r\n }\r\n\r\n /** Aligns cursor to nearest available position */\r\n alignCursor () {\r\n this.cursorPos = this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT);\r\n }\r\n\r\n /** Aligns cursor only if selection is empty */\r\n alignCursorFriendly () {\r\n if (this.selectionStart !== this.cursorPos) return;\r\n this.alignCursor();\r\n }\r\n\r\n /** Adds listener on custom event */\r\n on (ev: string, handler: Function) {\r\n if (!this._listeners[ev]) this._listeners[ev] = [];\r\n this._listeners[ev].push(handler);\r\n return this;\r\n }\r\n\r\n /** Removes custom event listener */\r\n off (ev: string, handler: Function) {\r\n if (!this._listeners[ev]) return;\r\n if (!handler) {\r\n delete this._listeners[ev];\r\n return;\r\n }\r\n const hIndex = this._listeners[ev].indexOf(handler);\r\n if (hIndex >= 0) this._listeners[ev].splice(hIndex, 1);\r\n return this;\r\n }\r\n\r\n /** Handles view input event */\r\n _onInput () {\r\n this._abortUpdateCursor();\r\n\r\n // fix strange IE behavior\r\n if (!this._selection) return this.updateValue();\r\n\r\n const details = new ActionDetails(\r\n // new state\r\n this.el.value, this.cursorPos,\r\n // old state\r\n this.value, this._selection);\r\n\r\n const offset = this.masked.splice(\r\n details.startChangePos,\r\n details.removed.length,\r\n details.inserted,\r\n details.removeDirection).offset;\r\n\r\n const cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, details.removeDirection);\r\n\r\n this.updateControl();\r\n this.updateCursor(cursorPos);\r\n }\r\n\r\n /** Handles view change event and commits model value */\r\n _onChange () {\r\n if (this.value !== this.el.value) {\r\n this.updateValue();\r\n }\r\n this.masked.doCommit();\r\n this.updateControl();\r\n }\r\n\r\n /** Handles view drop event, prevents by default */\r\n _onDrop (ev: Event) {\r\n ev.preventDefault();\r\n ev.stopPropagation();\r\n }\r\n\r\n /** Unbind view events and removes element reference */\r\n destroy () {\r\n this._unbindEvents();\r\n // $FlowFixMe why not do so?\r\n this._listeners.length = 0;\r\n delete this.el;\r\n }\r\n}\r\n","// @flow\r\nimport MaskedPattern from './pattern.js';\r\n\r\n\r\n/** Pattern which validates enum values */\r\nexport default\r\nclass MaskedEnum extends MaskedPattern {\r\n enum: Array;\r\n\r\n /**\r\n @override\r\n @param {Object} opts\r\n */\r\n _update (opts: any) { // TODO type\r\n if (opts.enum) opts.mask = '*'.repeat(opts.enum[0].length);\r\n\r\n super._update(opts);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doValidate (...args: *): boolean {\r\n return this.enum.some(e => e.indexOf(this.unmaskedValue) >= 0) &&\r\n super.doValidate(...args);\r\n }\r\n}\r\n","// @flow\r\nimport {escapeRegExp, indexInDirection, posInDirection, type Direction} from '../core/utils.js';\r\nimport ChangeDetails from '../core/change-details.js';\r\nimport {type TailDetails} from '../core/tail-details.js';\r\n\r\nimport Masked, {type MaskedOptions, type AppendFlags} from './base.js';\r\n\r\n\r\ntype MaskedNumberOptions = {\r\n ...MaskedOptions,\r\n radix: $PropertyType,\r\n thousandsSeparator: $PropertyType,\r\n mapToRadix: $PropertyType,\r\n scale: $PropertyType,\r\n signed: $PropertyType,\r\n normalizeZeros: $PropertyType,\r\n padFractionalZeros: $PropertyType,\r\n};\r\n\r\n/**\r\n Number mask\r\n @param {Object} opts\r\n @param {string} opts.radix - Single char\r\n @param {string} opts.thousandsSeparator - Single char\r\n @param {Array} opts.mapToRadix - Array of single chars\r\n @param {number} opts.min\r\n @param {number} opts.max\r\n @param {number} opts.scale - Digits after point\r\n @param {boolean} opts.signed - Allow negative\r\n @param {boolean} opts.normalizeZeros - Flag to remove leading and trailing zeros in the end of editing\r\n @param {boolean} opts.padFractionalZeros - Flag to pad trailing zeros after point in the end of editing\r\n*/\r\nexport default\r\nclass MaskedNumber extends Masked {\r\n static DEFAULTS: $Shape;\r\n\r\n /** Single char */\r\n radix: string;\r\n /** Single char */\r\n thousandsSeparator: string;\r\n /** Array of single chars */\r\n mapToRadix: Array;\r\n /** */\r\n min: number;\r\n /** */\r\n max: number;\r\n /** Digits after point */\r\n scale: number;\r\n /** */\r\n signed: boolean;\r\n /** Flag to remove leading and trailing zeros in the end of editing */\r\n normalizeZeros: boolean;\r\n /** Flag to pad trailing zeros after point in the end of editing */\r\n padFractionalZeros: boolean;\r\n _numberRegExp: RegExp;\r\n _numberRegExpInput: RegExp;\r\n _thousandsSeparatorRegExp: RegExp;\r\n _mapToRadixRegExp: RegExp;\r\n _separatorsProcessed: boolean;\r\n\r\n constructor (opts: $Shape) {\r\n super({\r\n ...MaskedNumber.DEFAULTS,\r\n ...opts\r\n });\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _update (opts: MaskedNumberOptions) {\r\n super._update(opts);\r\n this._updateRegExps();\r\n }\r\n\r\n /** */\r\n _updateRegExps () {\r\n // use different regexp to process user input (more strict, input suffix) and tail shifting\r\n const start = '^'\r\n\r\n let midInput = '';\r\n let mid = '';\r\n if (this.allowNegative) {\r\n midInput += '([+|\\\\-]?|([+|\\\\-]?(0|([1-9]+\\\\d*))))';\r\n mid += '[+|\\\\-]?';\r\n } else {\r\n midInput += '(0|([1-9]+\\\\d*))';\r\n }\r\n mid += '\\\\d*';\r\n\r\n let end = (this.scale ?\r\n '(' + escapeRegExp(this.radix) + '\\\\d{0,' + this.scale + '})?' :\r\n '') + '$';\r\n\r\n this._numberRegExpInput = new RegExp(start + midInput + end);\r\n this._numberRegExp = new RegExp(start + mid + end);\r\n this._mapToRadixRegExp = new RegExp('[' +\r\n this.mapToRadix.map(escapeRegExp).join('') +\r\n ']', 'g');\r\n this._thousandsSeparatorRegExp = new RegExp(escapeRegExp(this.thousandsSeparator), 'g');\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n extractTail (fromPos: number=0, toPos: number=this.value.length): TailDetails {\r\n const tail = super.extractTail(fromPos, toPos);\r\n\r\n // $FlowFixMe no ideas\r\n return {\r\n ...tail,\r\n value: this._removeThousandsSeparators(tail.value),\r\n };\r\n }\r\n\r\n /** */\r\n _removeThousandsSeparators (value: string): string {\r\n return value.replace(this._thousandsSeparatorRegExp, '');\r\n }\r\n\r\n /** */\r\n _insertThousandsSeparators (value: string): string {\r\n // https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript\r\n const parts = value.split(this.radix);\r\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, this.thousandsSeparator);\r\n return parts.join(this.radix);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doPrepare (str: string, ...args: *) {\r\n return super.doPrepare(this._removeThousandsSeparators(str.replace(this._mapToRadixRegExp, this.radix)), ...args);\r\n }\r\n\r\n /** */\r\n _separatorsCount (value: string=this._value) {\r\n let rawValueLength = this._removeThousandsSeparators(value).length;\r\n\r\n let valueWithSeparatorsLength = rawValueLength;\r\n for (let pos = 0; pos <= valueWithSeparatorsLength; ++pos) {\r\n if (this._value[pos] === this.thousandsSeparator) ++valueWithSeparatorsLength;\r\n }\r\n\r\n return valueWithSeparatorsLength - rawValueLength;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _appendCharRaw (ch: string, flags: AppendFlags={}): ChangeDetails {\r\n if (!this.thousandsSeparator) return super._appendCharRaw(ch, flags);\r\n\r\n const previousBeforeTailSeparatorsCount = this._separatorsCount(flags.tail && this._beforeTailState ?\r\n this._beforeTailState._value :\r\n this._value);\r\n this._value = this._removeThousandsSeparators(this.value);\r\n const appendDetails = super._appendCharRaw(ch, flags);\r\n\r\n this._value = this._insertThousandsSeparators(this._value);\r\n const beforeTailSeparatorsCount = this._separatorsCount(flags.tail && this._beforeTailState ?\r\n this._beforeTailState._value :\r\n this._value);\r\n\r\n appendDetails.tailShift += beforeTailSeparatorsCount - previousBeforeTailSeparatorsCount;\r\n return appendDetails;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n remove (fromPos?: number=0, toPos?: number=this.value.length): ChangeDetails {\r\n const valueBeforePos = this.value.slice(0, fromPos);\r\n const valueAfterPos = this.value.slice(toPos);\r\n\r\n const previousBeforeTailSeparatorsCount = this._separatorsCount(valueBeforePos);\r\n this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(valueBeforePos + valueAfterPos));\r\n const beforeTailSeparatorsCount = this._separatorsCount(valueBeforePos);\r\n\r\n return new ChangeDetails({\r\n tailShift: beforeTailSeparatorsCount - previousBeforeTailSeparatorsCount,\r\n });\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n nearestInputPos (cursorPos: number, direction?: Direction): number {\r\n if (!direction) return cursorPos;\r\n\r\n const nextPos = indexInDirection(cursorPos, direction);\r\n if (this.value[nextPos] === this.thousandsSeparator) cursorPos = posInDirection(cursorPos, direction);\r\n return cursorPos;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doValidate (flags: AppendFlags) {\r\n const regexp = flags.input ? this._numberRegExpInput : this._numberRegExp;\r\n\r\n // validate as string\r\n let valid = regexp.test(this._removeThousandsSeparators(this.value));\r\n\r\n if (valid) {\r\n // validate as number\r\n const number = this.number;\r\n valid = valid && !isNaN(number) &&\r\n // check min bound for negative values\r\n (this.min == null || this.min >= 0 || this.min <= this.number) &&\r\n // check max bound for positive values\r\n (this.max == null || this.max <= 0 || this.number <= this.max);\r\n }\r\n\r\n return valid && super.doValidate(flags);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doCommit () {\r\n const number = this.number;\r\n let validnum = number;\r\n\r\n // check bounds\r\n if (this.min != null) validnum = Math.max(validnum, this.min);\r\n if (this.max != null) validnum = Math.min(validnum, this.max);\r\n\r\n if (validnum !== number) this.unmaskedValue = String(validnum);\r\n\r\n let formatted = this.value;\r\n\r\n if (this.normalizeZeros) formatted = this._normalizeZeros(formatted);\r\n if (this.padFractionalZeros) formatted = this._padFractionalZeros(formatted);\r\n\r\n this._value = this._insertThousandsSeparators(formatted);\r\n super.doCommit();\r\n }\r\n\r\n /** */\r\n _normalizeZeros (value: string): string {\r\n const parts = this._removeThousandsSeparators(value).split(this.radix);\r\n\r\n // remove leading zeros\r\n parts[0] = parts[0].replace(/^(\\D*)(0*)(\\d*)/, (match, sign, zeros, num) => sign + num);\r\n // add leading zero\r\n if (value.length && !/\\d$/.test(parts[0])) parts[0] = parts[0] + '0';\r\n\r\n if (parts.length > 1) {\r\n parts[1] = parts[1].replace(/0*$/, ''); // remove trailing zeros\r\n if (!parts[1].length) parts.length = 1; // remove fractional\r\n }\r\n\r\n return this._insertThousandsSeparators(parts.join(this.radix));\r\n }\r\n\r\n /** */\r\n _padFractionalZeros (value: string): string {\r\n if (!value) return value;\r\n\r\n const parts = value.split(this.radix);\r\n if (parts.length < 2) parts.push('');\r\n parts[1] = parts[1].padEnd(this.scale, '0');\r\n return parts.join(this.radix);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get unmaskedValue (): string {\r\n return this._removeThousandsSeparators(\r\n this._normalizeZeros(\r\n this.value))\r\n .replace(this.radix, '.');\r\n }\r\n\r\n set unmaskedValue (unmaskedValue: string) {\r\n super.unmaskedValue = unmaskedValue.replace('.', this.radix);\r\n }\r\n\r\n /** Parsed Number */\r\n get number (): number {\r\n return Number(this.unmaskedValue);\r\n }\r\n\r\n set number (number: number) {\r\n this.unmaskedValue = String(number);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get typedValue (): number {\r\n return this.number;\r\n }\r\n\r\n set typedValue (value: number) {\r\n this.number = value;\r\n }\r\n\r\n /**\r\n Is negative allowed\r\n @readonly\r\n */\r\n get allowNegative (): boolean {\r\n return this.signed ||\r\n (this.min != null && this.min < 0) ||\r\n (this.max != null && this.max < 0);\r\n }\r\n}\r\nMaskedNumber.DEFAULTS = {\r\n radix: ',',\r\n thousandsSeparator: '',\r\n mapToRadix: ['.'],\r\n scale: 2,\r\n signed: false,\r\n normalizeZeros: true,\r\n padFractionalZeros: false,\r\n};\r\n","// @flow\r\nimport Masked, {type MaskedOptions} from './base.js';\r\n\r\n\r\n/** Masking by RegExp */\r\nexport default\r\nclass MaskedRegExp extends Masked {\r\n /**\r\n @override\r\n @param {Object} opts\r\n */\r\n _update (opts: $Shape>) {\r\n if (opts.mask) opts.validate = (value) => value.search(opts.mask) >= 0;\r\n super._update(opts);\r\n }\r\n}\r\n","// @flow\r\nimport Masked, {type MaskedOptions} from './base.js';\r\n\r\n\r\n/** Masking by custom Function */\r\nexport default\r\nclass MaskedFunction extends Masked {\r\n /**\r\n @override\r\n @param {Object} opts\r\n */\r\n _update (opts: MaskedOptions) {\r\n if (opts.mask) opts.validate = opts.mask;\r\n super._update(opts);\r\n }\r\n}\r\n","// @flow\r\nimport ChangeDetails from '../core/change-details.js';\r\nimport createMask from './factory.js';\r\nimport Masked, {type AppendFlags, type MaskedState} from './base.js';\r\nimport {type TailDetails} from '../core/tail-details.js';\r\n\r\ntype MaskedDynamicState = {|\r\n ...MaskedState,\r\n _rawInputValue: string,\r\n compiledMasks: Array<*>,\r\n currentMaskRef: ?Masked<*>,\r\n currentMask: *,\r\n|};\r\n\r\ntype DynamicMaskType = Array<{[string]: any}>;\r\n/** Dynamic mask for choosing apropriate mask in run-time */\r\nexport default\r\nclass MaskedDynamic extends Masked {\r\n /** Currently chosen mask */\r\n currentMask: ?Masked<*>;\r\n /** Compliled {@link Masked} options */\r\n compiledMasks: Array>;\r\n /** Chooses {@link Masked} depending on input value */\r\n dispatch: (string, Masked<*>, AppendFlags) => Masked<*>;\r\n\r\n /**\r\n @param {Object} opts\r\n */\r\n constructor (opts: any) {\r\n super({\r\n ...MaskedDynamic.DEFAULTS,\r\n ...opts\r\n });\r\n\r\n this.currentMask = null;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _update (opts: any) {\r\n super._update(opts);\r\n if ('mask' in opts) {\r\n // mask could be totally dynamic with only `dispatch` option\r\n this.compiledMasks = Array.isArray(opts.mask) ?\r\n opts.mask.map(m => createMask(m)) :\r\n [];\r\n }\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _appendCharRaw (...args: *): ChangeDetails {\r\n const details = this._applyDispatch(...args);\r\n\r\n if (this.currentMask) {\r\n details.aggregate(this.currentMask._appendChar(...args));\r\n }\r\n\r\n return details;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _storeBeforeTailState () {\r\n super._storeBeforeTailState();\r\n if (this.currentMask) this.currentMask._storeBeforeTailState();\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _restoreBeforeTailState () {\r\n super._restoreBeforeTailState();\r\n if (this.currentMask) this.currentMask._restoreBeforeTailState();\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n _resetBeforeTailState () {\r\n super._resetBeforeTailState();\r\n if (this.currentMask) this.currentMask._resetBeforeTailState();\r\n }\r\n\r\n _applyDispatch (appended: string='', flags: AppendFlags={}) {\r\n const prevValueBeforeTail = flags.tail && this._beforeTailState ?\r\n this._beforeTailState._value :\r\n this.value;\r\n const inputValue = this.rawInputValue;\r\n const insertValue = flags.tail && this._beforeTailState ?\r\n // $FlowFixMe - tired to fight with type system\r\n this._beforeTailState._rawInputValue :\r\n inputValue;\r\n const tailValue = inputValue.slice(insertValue.length);\r\n const prevMask = this.currentMask;\r\n const details = new ChangeDetails();\r\n\r\n const prevMaskState = prevMask && prevMask.state;\r\n const prevMaskBeforeTailState = prevMask && prevMask._beforeTailState;\r\n\r\n this.currentMask = this.doDispatch(appended, flags);\r\n\r\n // restore state after dispatch\r\n if (this.currentMask) {\r\n if (this.currentMask !== prevMask) {\r\n // if mask changed reapply input\r\n this.currentMask.reset();\r\n\r\n // $FlowFixMe - it's ok, we don't change current mask above\r\n const d = this.currentMask.append(insertValue, {raw: true});\r\n details.tailShift = d.inserted.length - prevValueBeforeTail.length;\r\n\r\n this._storeBeforeTailState();\r\n if (tailValue) {\r\n // $FlowFixMe - it's ok, we don't change current mask above\r\n details.tailShift += this.currentMask.append(tailValue, {raw: true, tail: true}).tailShift;\r\n }\r\n } else {\r\n // Dispatch can do something bad with state, so\r\n // restore prev mask state\r\n this.currentMask.state = prevMaskState;\r\n this.currentMask._beforeTailState = prevMaskBeforeTailState;\r\n }\r\n }\r\n\r\n return details;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doDispatch(appended: string, flags: AppendFlags={}) {\r\n return this.dispatch(appended, this, flags);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doValidate (...args: *): boolean {\r\n return super.doValidate(...args) && (\r\n !this.currentMask || this.currentMask.doValidate(...args));\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n reset () {\r\n if (this.currentMask) this.currentMask.reset();\r\n this.compiledMasks.forEach(m => m.reset());\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get value (): string {\r\n return this.currentMask ? this.currentMask.value : '';\r\n }\r\n\r\n set value (value: string) {\r\n super.value = value;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get unmaskedValue (): string {\r\n return this.currentMask ? this.currentMask.unmaskedValue : '';\r\n }\r\n\r\n set unmaskedValue (unmaskedValue: string) {\r\n super.unmaskedValue = unmaskedValue;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get typedValue (): any {\r\n return this.currentMask ? this.currentMask.typedValue : '';\r\n }\r\n\r\n // probably typedValue should not be used with dynamic\r\n set typedValue (value: any) {\r\n let unmaskedValue = String(value);\r\n\r\n // double check it\r\n if (this.currentMask) {\r\n this.currentMask.typedValue = value;\r\n unmaskedValue = this.currentMask.unmaskedValue;\r\n }\r\n this.unmaskedValue = unmaskedValue;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get isComplete (): boolean {\r\n return !!this.currentMask && this.currentMask.isComplete;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n remove (...args: *): ChangeDetails {\r\n const details: ChangeDetails = new ChangeDetails();\r\n if (this.currentMask) {\r\n details.aggregate(this.currentMask.remove(...args))\r\n // update with dispatch\r\n .aggregate(this._applyDispatch());\r\n }\r\n\r\n return details;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n get state (): MaskedDynamicState {\r\n return {\r\n ...super.state,\r\n _rawInputValue: this.rawInputValue,\r\n compiledMasks: this.compiledMasks.map(m => m.state),\r\n currentMaskRef: this.currentMask,\r\n currentMask: this.currentMask && this.currentMask.state,\r\n };\r\n }\r\n\r\n set state (state: MaskedDynamicState) {\r\n const {compiledMasks, currentMaskRef, currentMask, ...maskedState} = state;\r\n this.compiledMasks.forEach((m, mi) => m.state = compiledMasks[mi]);\r\n if (currentMaskRef != null) {\r\n this.currentMask = currentMaskRef;\r\n this.currentMask.state = currentMask;\r\n }\r\n super.state = maskedState;\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n extractInput (...args: *): string {\r\n return this.currentMask ?\r\n this.currentMask.extractInput(...args) :\r\n '';\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n extractTail (...args: *): TailDetails {\r\n return this.currentMask ?\r\n this.currentMask.extractTail(...args) :\r\n super.extractTail(...args);\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n doCommit () {\r\n if (this.currentMask) this.currentMask.doCommit();\r\n super.doCommit();\r\n }\r\n\r\n /**\r\n @override\r\n */\r\n nearestInputPos(...args: *): number {\r\n return this.currentMask ?\r\n this.currentMask.nearestInputPos(...args) :\r\n super.nearestInputPos(...args);\r\n }\r\n}\r\n\r\nMaskedDynamic.DEFAULTS = {\r\n dispatch: (appended, masked, flags) => {\r\n if (!masked.compiledMasks.length) return;\r\n\r\n const inputValue = masked.rawInputValue;\r\n\r\n // simulate input\r\n const inputs = masked.compiledMasks.map((m, index) => {\r\n m.rawInputValue = inputValue;\r\n m.append(appended, flags);\r\n const weight = m.rawInputValue.length;\r\n\r\n return {weight, index};\r\n });\r\n\r\n // pop masks with longer values first\r\n inputs.sort((i1, i2) => i2.weight - i1.weight);\r\n\r\n return masked.compiledMasks[inputs[0].index];\r\n }\r\n};\r\n","import {g} from './core/utils.js';\r\n\r\nimport InputMask from './controls/input.js';\r\n\r\nimport Masked from './masked/base.js';\r\nimport MaskedPattern from './masked/pattern.js';\r\nimport MaskedEnum from './masked/enum.js';\r\nimport MaskedRange from './masked/range.js';\r\nimport MaskedNumber from './masked/number.js';\r\nimport MaskedDate from './masked/date.js';\r\nimport MaskedRegExp from './masked/regexp.js';\r\nimport MaskedFunction from './masked/function.js';\r\nimport MaskedDynamic from './masked/dynamic.js';\r\nimport createMask from './masked/factory.js';\r\nimport MaskElement from './controls/mask-element.js';\r\nimport HTMLMaskElement from './controls/html-mask-element.js';\r\n\r\n\r\n/**\r\n * Applies mask on element.\r\n * @constructor\r\n * @param {HTMLInputElement|HTMLTextAreaElement|MaskElement} el - Element to apply mask\r\n * @param {Object} opts - Custom mask options\r\n * @return {InputMask}\r\n */\r\nexport default\r\nfunction IMask (el, opts={}) {\r\n\t// currently available only for input-like elements\r\n return new InputMask(el, opts);\r\n}\r\n\r\n/** {@link InputMask} */\r\nIMask.InputMask = InputMask;\r\n\r\n/** {@link Masked} */\r\nIMask.Masked = Masked;\r\n/** {@link MaskedPattern} */\r\nIMask.MaskedPattern = MaskedPattern;\r\n/** {@link MaskedEnum} */\r\nIMask.MaskedEnum = MaskedEnum;\r\n/** {@link MaskedRange} */\r\nIMask.MaskedRange = MaskedRange;\r\n/** {@link MaskedNumber} */\r\nIMask.MaskedNumber = MaskedNumber;\r\n/** {@link MaskedDate} */\r\nIMask.MaskedDate = MaskedDate;\r\n/** {@link MaskedRegExp} */\r\nIMask.MaskedRegExp = MaskedRegExp;\r\n/** {@link MaskedFunction} */\r\nIMask.MaskedFunction = MaskedFunction;\r\n/** {@link MaskedDynamic} */\r\nIMask.MaskedDynamic = MaskedDynamic;\r\n/** {@link createMask} */\r\nIMask.createMask = createMask;\r\n/** {@link MaskElement} */\r\nIMask.MaskElement = MaskElement;\r\n/** {@link HTMLMaskElement} */\r\nIMask.HTMLMaskElement = HTMLMaskElement;\r\n\r\ng.IMask = IMask;\r\n"],"names":["isString","str","String","DIRECTION","NONE","LEFT","FORCE_LEFT","RIGHT","FORCE_RIGHT","indexInDirection","pos","direction","posInDirection","forceDirection","escapeRegExp","replace","objectIncludes","b","a","arrA","Array","isArray","arrB","i","length","dateA","Date","dateB","getTime","regexpA","RegExp","regexpB","toString","keys","Object","prototype","hasOwnProperty","call","g","window","global","self","ActionDetails","constructor","value","cursorPos","oldValue","oldSelection","slice","startChangePos","start","Math","min","insertedCount","inserted","substr","removedCount","max","end","removed","head","substring","tail","removeDirection","ChangeDetails","details","assign","rawInserted","skip","tailShift","aggregate","offset","Masked","opts","_value","_update","isInitialized","updateOptions","withValueRefresh","bind","state","reset","resolve","append","input","doCommit","unmaskedValue","typedValue","rawInputValue","extractInput","raw","isComplete","nearestInputPos","fromPos","toPos","flags","extractTail","_storeBeforeTailState","_beforeTailState","_restoreBeforeTailState","_resetBeforeTailState","appendTail","_appendCharRaw","ch","_appendChar","checkTail","doPrepare","consistentState","appended","doValidate","tailDetails","oldValueLength","ci","remove","fn","_refreshing","unmasked","ret","prepare","validate","parent","commit","splice","deleteCount","tailPos","changeDetails","maskedClass","mask","Error","IMask","MaskedRegExp","MaskedPattern","MaskedDate","Number","MaskedNumber","MaskedDynamic","Function","MaskedFunction","console","warn","createMask","MaskedClass","DEFAULT_INPUT_DEFINITIONS","PatternInputDefinition","blockOpts","masked","_isFilled","isOptional","placeholderChar","Boolean","lazy","_appendPlaceholder","args","minPos","maxPos","boundPos","PatternFixedDefinition","isUnmasking","_isRawInput","char","isResolved","ChunksTailDetails","chunks","map","c","join","definitions","DEFAULTS","_rebuildMask","defs","_blocks","_stops","_maskedBlocks","pattern","unmaskingBlock","optionalBlock","blocks","p","bNames","filter","bName","indexOf","sort","maskedBlock","push","isInput","STOP_CHAR","ESCAPE_CHAR","def","maskedState","forEach","bi","every","reduce","_appendTailChunks","blockData","_mapPosToBlock","index","block","blockDetails","chunk","lastBlock","chunkBlock","remainChars","stop","_extractTailChunks","_forEachBlocksInRange","_","lastChunk","blockChunk","nearestStop","si","headFloatChunksCount","headFloatChunks","toBlockIndex","startBlockData","startBlockIndex","endBlockIndex","bDetails","apply","accVal","blockStartPos","_blockStartPos","blockIndex","fromBlock","toBlock","isSameBlock","fromBlockRemoveBegin","fromBlockRemoveEnd","undefined","removeDetails","bFromPos","bToPos","beginBlockData","beginBlockOffset","beginBlockIndex","beginBlock","beginBlockCursorPos","cursorAtRight","cursorAtLeft","searchBlockIndex","blockIndexAtLeft","blockAtLeft","blockInputPos","firstInputAtRight","firstFilledBlockIndexAtRight","filledBlock","firstFilledInputBlockIndex","firstEmptyInputBlockIndex","blockAlignedPos","firstInputBlockAlignedIndex","firstInputBlockAlignedPos","alignedPos","name","maskedBlocks","indices","gi","InputDefinition","FixedDefinition","MaskedRange","_matchFrom","maxLength","from","to","toStr","padStart","fromStr","sameCharsCount","repeat","minstr","maxstr","match","placeholder","num","firstNonZero","search","padEnd","GET_DEFAULT_BLOCKS","Y","getFullYear","m","getMonth","d","getDate","date","isDateExist","format","parse","day","month","year","split","MaskElement","selectionStart","_unsafeSelectionStart","e","selectionEnd","_unsafeSelectionEnd","select","_unsafeSelect","isActive","bindEvents","handlers","unbindEvents","HTMLMaskElement","_handlers","document","activeElement","setSelectionRange","event","_toggleEventHandler","EVENTS_MAP","handler","removeEventListener","addEventListener","selectionChange","drop","click","focus","InputMask","el","_listeners","_unmaskedValue","_saveSelection","_onInput","_onChange","_onDrop","alignCursor","alignCursorFriendly","_bindEvents","updateValue","updateControl","val","_unbindEvents","_fireEvent","ev","listeners","l","_cursorChanging","_changingCursorPos","_selection","newUnmaskedValue","newValue","isChanged","_fireChangeEvents","restOpts","updateCursor","_delayUpdateCursor","_abortUpdateCursor","setTimeout","clearTimeout","on","off","hIndex","preventDefault","stopPropagation","destroy","MaskedEnum","enum","some","_updateRegExps","midInput","mid","allowNegative","scale","radix","_numberRegExpInput","_numberRegExp","_mapToRadixRegExp","mapToRadix","_thousandsSeparatorRegExp","thousandsSeparator","_removeThousandsSeparators","_insertThousandsSeparators","parts","_separatorsCount","rawValueLength","valueWithSeparatorsLength","previousBeforeTailSeparatorsCount","appendDetails","beforeTailSeparatorsCount","valueBeforePos","valueAfterPos","nextPos","regexp","valid","test","number","isNaN","validnum","formatted","normalizeZeros","_normalizeZeros","padFractionalZeros","_padFractionalZeros","sign","zeros","signed","currentMask","compiledMasks","_applyDispatch","prevValueBeforeTail","inputValue","insertValue","_rawInputValue","tailValue","prevMask","prevMaskState","prevMaskBeforeTailState","doDispatch","dispatch","currentMaskRef","mi","inputs","weight","i1","i2"],"mappings":"AAGA;AACA,AACA,SAASA,QAAT,CAAmBC,GAAnB,EAAgD;SACvC,OAAOA,GAAP,KAAe,QAAf,IAA2BA,GAAG,YAAYC,MAAjD;;;;;;;;;;;AAWF,AACA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAE,MADU;EAEhBC,IAAI,EAAE,MAFU;EAGhBC,UAAU,EAAE,YAHI;EAIhBC,KAAK,EAAE,OAJS;EAKhBC,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