jquery.inputmask.bundle.js 189 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615
  1. /*!
  2. * jquery.inputmask.bundle.js
  3. * https://github.com/RobinHerbots/Inputmask
  4. * Copyright (c) 2010 - 2017 Robin Herbots
  5. * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. * Version: 4.0.1-42
  7. */
  8. !function(modules) {
  9. function __webpack_require__(moduleId) {
  10. if (installedModules[moduleId]) return installedModules[moduleId].exports;
  11. var module = installedModules[moduleId] = {
  12. i: moduleId,
  13. l: !1,
  14. exports: {}
  15. };
  16. return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
  17. module.l = !0, module.exports;
  18. }
  19. var installedModules = {};
  20. __webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.i = function(value) {
  21. return value;
  22. }, __webpack_require__.d = function(exports, name, getter) {
  23. __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
  24. configurable: !1,
  25. enumerable: !0,
  26. get: getter
  27. });
  28. }, __webpack_require__.n = function(module) {
  29. var getter = module && module.__esModule ? function() {
  30. return module.default;
  31. } : function() {
  32. return module;
  33. };
  34. return __webpack_require__.d(getter, "a", getter), getter;
  35. }, __webpack_require__.o = function(object, property) {
  36. return Object.prototype.hasOwnProperty.call(object, property);
  37. }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 9);
  38. }([ function(module, exports, __webpack_require__) {
  39. "use strict";
  40. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  41. "function" == typeof Symbol && Symbol.iterator;
  42. !function(factory) {
  43. __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory,
  44. void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  45. }(function($) {
  46. return $;
  47. });
  48. }, function(module, exports, __webpack_require__) {
  49. "use strict";
  50. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
  51. return typeof obj;
  52. } : function(obj) {
  53. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  54. };
  55. !function(factory) {
  56. __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(11), __webpack_require__(10) ],
  57. __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  58. }(function($, window, document, undefined) {
  59. function Inputmask(alias, options, internal) {
  60. if (!(this instanceof Inputmask)) return new Inputmask(alias, options, internal);
  61. this.el = undefined, this.events = {}, this.maskset = undefined, this.refreshValue = !1,
  62. !0 !== internal && ($.isPlainObject(alias) ? options = alias : (options = options || {},
  63. options.alias = alias), this.opts = $.extend(!0, {}, this.defaults, options), this.noMasksCache = options && options.definitions !== undefined,
  64. this.userOptions = options || {}, this.isRTL = this.opts.numericInput, resolveAlias(this.opts.alias, options, this.opts));
  65. }
  66. function resolveAlias(aliasStr, options, opts) {
  67. var aliasDefinition = Inputmask.prototype.aliases[aliasStr];
  68. return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, undefined, opts),
  69. $.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr),
  70. !1);
  71. }
  72. function generateMaskSet(opts, nocache) {
  73. function generateMask(mask, metadata, opts) {
  74. var regexMask = !1;
  75. if (null !== mask && "" !== mask || (regexMask = null !== opts.regex, regexMask ? (mask = opts.regex,
  76. mask = mask.replace(/^(\^)(.*)(\$)$/, "$2")) : (regexMask = !0, mask = ".*")), 1 === mask.length && !1 === opts.greedy && 0 !== opts.repeat && (opts.placeholder = ""),
  77. opts.repeat > 0 || "*" === opts.repeat || "+" === opts.repeat) {
  78. var repeatStart = "*" === opts.repeat ? 0 : "+" === opts.repeat ? 1 : opts.repeat;
  79. mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end;
  80. }
  81. var masksetDefinition, maskdefKey = regexMask ? "regex_" + opts.regex : opts.numericInput ? mask.split("").reverse().join("") : mask;
  82. return Inputmask.prototype.masksCache[maskdefKey] === undefined || !0 === nocache ? (masksetDefinition = {
  83. mask: mask,
  84. maskToken: Inputmask.prototype.analyseMask(mask, regexMask, opts),
  85. validPositions: {},
  86. _buffer: undefined,
  87. buffer: undefined,
  88. tests: {},
  89. metadata: metadata,
  90. maskLength: undefined
  91. }, !0 !== nocache && (Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition,
  92. masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]))) : masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]),
  93. masksetDefinition;
  94. }
  95. if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) {
  96. if (opts.mask.length > 1) {
  97. opts.keepStatic = null === opts.keepStatic || opts.keepStatic;
  98. var altMask = opts.groupmarker.start;
  99. return $.each(opts.numericInput ? opts.mask.reverse() : opts.mask, function(ndx, msk) {
  100. altMask.length > 1 && (altMask += opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start),
  101. msk.mask === undefined || $.isFunction(msk.mask) ? altMask += msk : altMask += msk.mask;
  102. }), altMask += opts.groupmarker.end, generateMask(altMask, opts.mask, opts);
  103. }
  104. opts.mask = opts.mask.pop();
  105. }
  106. return opts.mask && opts.mask.mask !== undefined && !$.isFunction(opts.mask.mask) ? generateMask(opts.mask.mask, opts.mask, opts) : generateMask(opts.mask, opts.mask, opts);
  107. }
  108. function maskScope(actionObj, maskset, opts) {
  109. function getMaskTemplate(baseOnInput, minimalPos, includeMode) {
  110. minimalPos = minimalPos || 0;
  111. var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition();
  112. do {
  113. !0 === baseOnInput && getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos],
  114. test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test))) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
  115. test = testPos.match, ndxIntlzr = testPos.locator.slice(), (!1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos) && maskTemplate.push(!1 === includeMode ? test.nativeDef : getPlaceholder(pos, test))),
  116. pos++;
  117. } while ((maxLength === undefined || pos < maxLength) && (null !== test.fn || "" !== test.def) || minimalPos > pos);
  118. return "" === maskTemplate[maskTemplate.length - 1] && maskTemplate.pop(), getMaskSet().maskLength = pos + 1,
  119. maskTemplate;
  120. }
  121. function getMaskSet() {
  122. return maskset;
  123. }
  124. function resetMaskSet(soft) {
  125. var maskset = getMaskSet();
  126. maskset.buffer = undefined, !0 !== soft && (maskset.validPositions = {}, maskset.p = 0);
  127. }
  128. function getLastValidPosition(closestTo, strict, validPositions) {
  129. var before = -1, after = -1, valids = validPositions || getMaskSet().validPositions;
  130. closestTo === undefined && (closestTo = -1);
  131. for (var posNdx in valids) {
  132. var psNdx = parseInt(posNdx);
  133. valids[psNdx] && (strict || !0 !== valids[psNdx].generatedInput) && (psNdx <= closestTo && (before = psNdx),
  134. psNdx >= closestTo && (after = psNdx));
  135. }
  136. return -1 !== before && closestTo - before > 1 || after < closestTo ? before : after;
  137. }
  138. function stripValidPositions(start, end, nocheck, strict) {
  139. var i, startPos = start, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), needsValidation = !1;
  140. for (getMaskSet().p = start, i = end - 1; i >= startPos; i--) getMaskSet().validPositions[i] !== undefined && (!0 !== nocheck && (!getMaskSet().validPositions[i].match.optionality && function(pos) {
  141. var posMatch = getMaskSet().validPositions[pos];
  142. if (posMatch !== undefined && null === posMatch.match.fn) {
  143. var prevMatch = getMaskSet().validPositions[pos - 1], nextMatch = getMaskSet().validPositions[pos + 1];
  144. return prevMatch !== undefined && nextMatch !== undefined;
  145. }
  146. return !1;
  147. }(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, !0), strict, opts)) || delete getMaskSet().validPositions[i]);
  148. for (resetMaskSet(!0), i = startPos + 1; i <= getLastValidPosition(); ) {
  149. for (;getMaskSet().validPositions[startPos] !== undefined; ) startPos++;
  150. if (i < startPos && (i = startPos + 1), getMaskSet().validPositions[i] === undefined && isMask(i)) i++; else {
  151. var t = getTestTemplate(i);
  152. !1 === needsValidation && positionsClone[startPos] && positionsClone[startPos].match.def === t.match.def ? (getMaskSet().validPositions[startPos] = $.extend(!0, {}, positionsClone[startPos]),
  153. getMaskSet().validPositions[startPos].input = t.input, delete getMaskSet().validPositions[i],
  154. i++) : positionCanMatchDefinition(startPos, t.match.def) ? !1 !== isValid(startPos, t.input || getPlaceholder(i), !0) && (delete getMaskSet().validPositions[i],
  155. i++, needsValidation = !0) : isMask(i) || (i++, startPos--), startPos++;
  156. }
  157. }
  158. resetMaskSet(!0);
  159. }
  160. function determineTestTemplate(tests, guessNextBest) {
  161. for (var testPos, testPositions = tests, lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
  162. !(testPos.match && (opts.greedy && !0 !== testPos.match.optionalQuantifier || (!1 === testPos.match.optionality || !1 === testPos.match.newBlockMarker) && !0 !== testPos.match.optionalQuantifier) && (lvTest.alternation === undefined || lvTest.alternation !== testPos.alternation || testPos.locator[lvTest.alternation] !== undefined && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr))) || !0 === guessNextBest && (null !== testPos.match.fn || /[0-9a-bA-Z]/.test(testPos.match.def))); ndx++) ;
  163. return testPos;
  164. }
  165. function getTestTemplate(pos, ndxIntlzr, tstPs) {
  166. return getMaskSet().validPositions[pos] || determineTestTemplate(getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs));
  167. }
  168. function getTest(pos) {
  169. return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos] : getTests(pos)[0];
  170. }
  171. function positionCanMatchDefinition(pos, def) {
  172. for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
  173. valid = !0;
  174. break;
  175. }
  176. return valid;
  177. }
  178. function getTests(pos, ndxIntlzr, tstPs) {
  179. function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
  180. function handleMatch(match, loopNdx, quantifierRecurse) {
  181. function isFirstMatch(latestMatch, tokenGroup) {
  182. var firstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches);
  183. return firstMatch || $.each(tokenGroup.matches, function(ndx, match) {
  184. if (!0 === match.isQuantifier && (firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]))) return !1;
  185. }), firstMatch;
  186. }
  187. function resolveNdxInitializer(pos, alternateNdx, targetAlternation) {
  188. var bestMatch, indexPos;
  189. if (getMaskSet().validPositions[pos - 1] && targetAlternation && getMaskSet().tests[pos]) for (var vpAlternation = getMaskSet().validPositions[pos - 1].locator, tpAlternation = getMaskSet().tests[pos][0].locator, i = 0; i < targetAlternation; i++) if (vpAlternation[i] !== tpAlternation[i]) return vpAlternation.slice(targetAlternation + 1);
  190. return (getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) && $.each(getMaskSet().tests[pos] || [ getMaskSet().validPositions[pos] ], function(ndx, lmnt) {
  191. var alternation = targetAlternation !== undefined ? targetAlternation : lmnt.alternation, ndxPos = lmnt.locator[alternation] !== undefined ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1;
  192. (indexPos === undefined || ndxPos < indexPos) && -1 !== ndxPos && (bestMatch = lmnt,
  193. indexPos = ndxPos);
  194. }), bestMatch ? bestMatch.locator.slice((targetAlternation !== undefined ? targetAlternation : bestMatch.alternation) + 1) : targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined;
  195. }
  196. if (testPos > 1e4) 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. " + getMaskSet().mask;
  197. if (testPos === pos && match.matches === undefined) return matches.push({
  198. match: match,
  199. locator: loopNdx.reverse(),
  200. cd: cacheDependency
  201. }), !0;
  202. if (match.matches !== undefined) {
  203. if (match.isGroup && quantifierRecurse !== match) {
  204. if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx)) return !0;
  205. } else if (match.isOptional) {
  206. var optionalToken = match;
  207. if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
  208. if (latestMatch = matches[matches.length - 1].match, !isFirstMatch(latestMatch, optionalToken)) return !0;
  209. insertStop = !0, testPos = pos;
  210. }
  211. } else if (match.isAlternator) {
  212. var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
  213. if (-1 === altIndex || "string" == typeof altIndex) {
  214. var amndx, currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [];
  215. if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx);
  216. for (var ndx = 0; ndx < altIndexArr.length; ndx++) {
  217. if (amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(),
  218. !0 !== (match = handleMatch(alternateToken.matches[amndx] || maskToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match) && match !== undefined && altIndexArr[altIndexArr.length - 1] < alternateToken.matches.length) {
  219. var ntndx = $.inArray(match, maskToken.matches) + 1;
  220. maskToken.matches.length > ntndx && (match = handleMatch(maskToken.matches[ntndx], [ ntndx ].concat(loopNdx.slice(1, loopNdx.length)), quantifierRecurse)) && (altIndexArr.push(ntndx.toString()),
  221. $.each(matches, function(ndx, lmnt) {
  222. lmnt.alternation = loopNdx.length - 1;
  223. }));
  224. }
  225. maltMatches = matches.slice(), testPos = currentPos, matches = [];
  226. for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
  227. var altMatch = maltMatches[ndx1], dropMatch = !1;
  228. altMatch.alternation = altMatch.alternation || loopNdxCnt;
  229. for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
  230. var altMatch2 = malternateMatches[ndx2];
  231. if ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
  232. if (function(source, target) {
  233. return source.match.nativeDef === target.match.nativeDef || source.match.def === target.match.nativeDef || source.match.nativeDef === target.match.def;
  234. }(altMatch, altMatch2)) {
  235. dropMatch = !0, altMatch.alternation === altMatch2.alternation && -1 === altMatch2.locator[altMatch2.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) && (altMatch2.locator[altMatch2.alternation] = altMatch2.locator[altMatch2.alternation] + "," + altMatch.locator[altMatch.alternation],
  236. altMatch2.alternation = altMatch.alternation), altMatch.match.nativeDef === altMatch2.match.def && (altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation],
  237. malternateMatches.splice(malternateMatches.indexOf(altMatch2), 1, altMatch));
  238. break;
  239. }
  240. if (altMatch.match.def === altMatch2.match.def) {
  241. dropMatch = !1;
  242. break;
  243. }
  244. if (function(source, target) {
  245. return null === source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def, getMaskSet(), pos, !1, opts, !1);
  246. }(altMatch, altMatch2) || function(source, target) {
  247. return null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
  248. }(altMatch, altMatch2)) {
  249. altMatch.alternation === altMatch2.alternation && -1 === altMatch.locator[altMatch.alternation].toString().indexOf(altMatch2.locator[altMatch2.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na || altMatch.locator[altMatch.alternation].toString(),
  250. -1 === altMatch.na.indexOf(altMatch.locator[altMatch.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na + "," + altMatch.locator[altMatch2.alternation].toString().split("")[0]),
  251. dropMatch = !0, altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation].toString().split("")[0] + "," + altMatch.locator[altMatch.alternation],
  252. malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
  253. break;
  254. }
  255. }
  256. }
  257. dropMatch || malternateMatches.push(altMatch);
  258. }
  259. }
  260. "string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) {
  261. if (isFinite(ndx)) {
  262. var alternation = lmnt.alternation, altLocArr = lmnt.locator[alternation].toString().split(",");
  263. lmnt.locator[alternation] = undefined, lmnt.alternation = undefined;
  264. for (var alndx = 0; alndx < altLocArr.length; alndx++) -1 !== $.inArray(altLocArr[alndx], altIndexArr) && (lmnt.locator[alternation] !== undefined ? (lmnt.locator[alternation] += ",",
  265. lmnt.locator[alternation] += altLocArr[alndx]) : lmnt.locator[alternation] = parseInt(altLocArr[alndx]),
  266. lmnt.alternation = alternation);
  267. if (lmnt.locator[alternation] !== undefined) return lmnt;
  268. }
  269. })), matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = matches.length > 0,
  270. match = malternateMatches.length > 0, ndxInitializer = ndxInitializerClone.slice();
  271. } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
  272. if (match) return !0;
  273. } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) {
  274. var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
  275. if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) {
  276. if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1,
  277. isFirstMatch(latestMatch, tokenGroup)) {
  278. if (qndx > qt.quantifier.min - 1) {
  279. insertStop = !0, testPos = pos;
  280. break;
  281. }
  282. return !0;
  283. }
  284. return !0;
  285. }
  286. } else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0;
  287. } else testPos++;
  288. }
  289. for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (!0 !== maskToken.matches[tndx].isQuantifier) {
  290. var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
  291. if (match && testPos === pos) return match;
  292. if (testPos > pos) break;
  293. }
  294. }
  295. function filterTests(tests) {
  296. if (opts.keepStatic && pos > 0 && tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0) && !0 !== tests[0].match.optionality && !0 !== tests[0].match.optionalQuantifier && null === tests[0].match.fn && !/[0-9a-bA-Z]/.test(tests[0].match.def)) {
  297. if (getMaskSet().validPositions[pos - 1] === undefined) return [ determineTestTemplate(tests) ];
  298. if (getMaskSet().validPositions[pos - 1].alternation === tests[0].alternation) return [ determineTestTemplate(tests) ];
  299. if (getMaskSet().validPositions[pos - 1]) return [ determineTestTemplate(tests) ];
  300. }
  301. return tests;
  302. }
  303. var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
  304. if (pos > -1) {
  305. if (ndxIntlzr === undefined) {
  306. for (var test, previousPos = pos - 1; (test = getMaskSet().validPositions[previousPos] || getMaskSet().tests[previousPos]) === undefined && previousPos > -1; ) previousPos--;
  307. test !== undefined && previousPos > -1 && (ndxInitializer = function(tests) {
  308. var locator = [];
  309. return $.isArray(tests) || (tests = [ tests ]), tests.length > 0 && (tests[0].alternation === undefined ? (locator = determineTestTemplate(tests.slice()).locator.slice(),
  310. 0 === locator.length && (locator = tests[0].locator.slice())) : $.each(tests, function(ndx, tst) {
  311. if ("" !== tst.def) if (0 === locator.length) locator = tst.locator.slice(); else for (var i = 0; i < locator.length; i++) tst.locator[i] && -1 === locator[i].toString().indexOf(tst.locator[i]) && (locator[i] += "," + tst.locator[i]);
  312. })), locator;
  313. }(test), cacheDependency = ndxInitializer.join(""), testPos = previousPos);
  314. }
  315. if (getMaskSet().tests[pos] && getMaskSet().tests[pos][0].cd === cacheDependency) return filterTests(getMaskSet().tests[pos]);
  316. for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
  317. if (resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]) && testPos === pos || testPos > pos) break;
  318. }
  319. }
  320. return (0 === matches.length || insertStop) && matches.push({
  321. match: {
  322. fn: null,
  323. cardinality: 0,
  324. optionality: !0,
  325. casing: null,
  326. def: "",
  327. placeholder: ""
  328. },
  329. locator: [],
  330. cd: cacheDependency
  331. }), ndxIntlzr !== undefined && getMaskSet().tests[pos] ? filterTests($.extend(!0, [], matches)) : (getMaskSet().tests[pos] = $.extend(!0, [], matches),
  332. filterTests(getMaskSet().tests[pos]));
  333. }
  334. function getBufferTemplate() {
  335. return getMaskSet()._buffer === undefined && (getMaskSet()._buffer = getMaskTemplate(!1, 1),
  336. getMaskSet().buffer === undefined && (getMaskSet().buffer = getMaskSet()._buffer.slice())),
  337. getMaskSet()._buffer;
  338. }
  339. function getBuffer(noCache) {
  340. return getMaskSet().buffer !== undefined && !0 !== noCache || (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0)),
  341. getMaskSet().buffer;
  342. }
  343. function refreshFromBuffer(start, end, buffer) {
  344. var i, p;
  345. if (!0 === start) resetMaskSet(), start = 0, end = buffer.length; else for (i = start; i < end; i++) delete getMaskSet().validPositions[i];
  346. for (p = start, i = start; i < end; i++) if (resetMaskSet(!0), buffer[i] !== opts.skipOptionalPartCharacter) {
  347. var valResult = isValid(p, buffer[i], !0, !0);
  348. !1 !== valResult && (resetMaskSet(!0), p = valResult.caret !== undefined ? valResult.caret : valResult.pos + 1);
  349. }
  350. }
  351. function casing(elem, test, pos) {
  352. switch (opts.casing || test.casing) {
  353. case "upper":
  354. elem = elem.toUpperCase();
  355. break;
  356. case "lower":
  357. elem = elem.toLowerCase();
  358. break;
  359. case "title":
  360. var posBefore = getMaskSet().validPositions[pos - 1];
  361. elem = 0 === pos || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE) ? elem.toUpperCase() : elem.toLowerCase();
  362. break;
  363. default:
  364. if ($.isFunction(opts.casing)) {
  365. var args = Array.prototype.slice.call(arguments);
  366. args.push(getMaskSet().validPositions), elem = opts.casing.apply(this, args);
  367. }
  368. }
  369. return elem;
  370. }
  371. function checkAlternationMatch(altArr1, altArr2, na) {
  372. for (var naNdx, altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, naArr = na !== undefined ? na.split(",") : [], i = 0; i < naArr.length; i++) -1 !== (naNdx = altArr1.indexOf(naArr[i])) && altArr1.splice(naNdx, 1);
  373. for (var alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) {
  374. isMatch = !0;
  375. break;
  376. }
  377. return isMatch;
  378. }
  379. function isValid(pos, c, strict, fromSetValid, fromAlternate, validateOnly) {
  380. function isSelection(posObj) {
  381. var selection = isRTL ? posObj.begin - posObj.end > 1 || posObj.begin - posObj.end == 1 : posObj.end - posObj.begin > 1 || posObj.end - posObj.begin == 1;
  382. return selection && 0 === posObj.begin && posObj.end === getMaskSet().maskLength ? "full" : selection;
  383. }
  384. function _isValid(position, c, strict) {
  385. var rslt = !1;
  386. return $.each(getTests(position), function(ndx, tst) {
  387. for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = test.cardinality; i > loopend; i--) chrs += getBufferElement(position - (i - 1));
  388. if (c && (chrs += c), getBuffer(!0), !1 !== (rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && "" !== test.def && {
  389. c: getPlaceholder(position, test, !0) || test.def,
  390. pos: position
  391. })) {
  392. var elem = rslt.c !== undefined ? rslt.c : c;
  393. elem = elem === opts.skipOptionalPartCharacter && null === test.fn ? getPlaceholder(position, test, !0) || test.def : elem;
  394. var validatedPos = position, possibleModifiedBuffer = getBuffer();
  395. if (rslt.remove !== undefined && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]),
  396. $.each(rslt.remove.sort(function(a, b) {
  397. return b - a;
  398. }), function(ndx, lmnt) {
  399. stripValidPositions(lmnt, lmnt + 1, !0);
  400. })), rslt.insert !== undefined && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]),
  401. $.each(rslt.insert.sort(function(a, b) {
  402. return a - b;
  403. }), function(ndx, lmnt) {
  404. isValid(lmnt.pos, lmnt.c, !0, fromSetValid);
  405. })), rslt.refreshFromBuffer) {
  406. var refresh = rslt.refreshFromBuffer;
  407. if (refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, possibleModifiedBuffer),
  408. rslt.pos === undefined && rslt.c === undefined) return rslt.pos = getLastValidPosition(),
  409. !1;
  410. if ((validatedPos = rslt.pos !== undefined ? rslt.pos : position) !== position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0, fromSetValid)),
  411. !1;
  412. } else if (!0 !== rslt && rslt.pos !== undefined && rslt.pos !== position && (validatedPos = rslt.pos,
  413. refreshFromBuffer(position, validatedPos, getBuffer().slice()), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
  414. !1;
  415. return (!0 === rslt || rslt.pos !== undefined || rslt.c !== undefined) && (ndx > 0 && resetMaskSet(!0),
  416. setValidPosition(validatedPos, $.extend({}, tst, {
  417. input: casing(elem, test, validatedPos)
  418. }), fromSetValid, isSelection(pos)) || (rslt = !1), !1);
  419. }
  420. }), rslt;
  421. }
  422. function setValidPosition(pos, validTest, fromSetValid, isSelection) {
  423. if (isSelection || opts.insertMode && getMaskSet().validPositions[pos] !== undefined && fromSetValid === undefined) {
  424. var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, !0);
  425. for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
  426. getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
  427. var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1, initialLength = getMaskSet().maskLength;
  428. for (i = j = pos; i <= lvp; i++) {
  429. var t = positionsClone[i];
  430. if (t !== undefined) for (var posMatch = j; posMatch < getMaskSet().maskLength && (null === t.match.fn && vps[i] && (!0 === vps[i].match.optionalQuantifier || !0 === vps[i].match.optionality) || null != t.match.fn); ) {
  431. if (posMatch++, !1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]),
  432. getMaskSet().validPositions[posMatch].input = t.input, fillMissingNonMask(posMatch),
  433. j = posMatch, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
  434. var result = isValid(posMatch, t.input, !0, !0);
  435. valid = !1 !== result, j = result.caret || result.insert ? getLastValidPosition() : posMatch,
  436. needsValidation = !0;
  437. } else if (!(valid = !0 === t.generatedInput) && posMatch >= getMaskSet().maskLength - 1) break;
  438. if (getMaskSet().maskLength < initialLength && (getMaskSet().maskLength = initialLength),
  439. valid) break;
  440. }
  441. if (!valid) break;
  442. }
  443. if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone),
  444. resetMaskSet(!0), !1;
  445. } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
  446. return resetMaskSet(!0), !0;
  447. }
  448. function fillMissingNonMask(maskPos) {
  449. for (var pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
  450. var testTemplate, testsFromPos;
  451. for (pndx++; pndx < maskPos; pndx++) getMaskSet().validPositions[pndx] === undefined && (!1 === opts.jitMasking || opts.jitMasking > pndx) && (testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice(),
  452. "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop(), (testTemplate = determineTestTemplate(testsFromPos)) && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && !1 !== (result = _isValid(pndx, getPlaceholder(pndx, testTemplate.match, !0) || (null == testTemplate.match.fn ? testTemplate.match.def : "" !== getPlaceholder(pndx) ? getPlaceholder(pndx) : getBuffer()[pndx]), !0)) && (getMaskSet().validPositions[result.pos || pndx].generatedInput = !0));
  453. }
  454. strict = !0 === strict;
  455. var maskPos = pos;
  456. pos.begin !== undefined && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin);
  457. var result = !0, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
  458. if ($.isFunction(opts.preValidation) && !strict && !0 !== fromSetValid && !0 !== validateOnly && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts)),
  459. !0 === result) {
  460. if (fillMissingNonMask(maskPos), isSelection(pos) && (handleRemove(undefined, Inputmask.keyCode.DELETE, pos, !0, !0),
  461. maskPos = getMaskSet().p), maskPos < getMaskSet().maskLength && (maxLength === undefined || maskPos < maxLength) && (result = _isValid(maskPos, c, strict),
  462. (!strict || !0 === fromSetValid) && !1 === result && !0 !== validateOnly)) {
  463. var currentPosValid = getMaskSet().validPositions[maskPos];
  464. if (!currentPosValid || null !== currentPosValid.match.fn || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) {
  465. if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && !isMask(maskPos, !0)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (!1 !== (result = _isValid(nPos, c, strict))) {
  466. !function(originalPos, newPos) {
  467. var vp = getMaskSet().validPositions[newPos];
  468. if (vp) for (var targetLocator = vp.locator, tll = targetLocator.length, ps = originalPos; ps < newPos; ps++) if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, !0)) {
  469. var tests = getTests(ps).slice(), bestMatch = determineTestTemplate(tests, !0), equality = -1;
  470. "" === tests[tests.length - 1].match.def && tests.pop(), $.each(tests, function(ndx, tst) {
  471. for (var i = 0; i < tll; i++) {
  472. if (tst.locator[i] === undefined || !checkAlternationMatch(tst.locator[i].toString().split(","), targetLocator[i].toString().split(","), tst.na)) {
  473. var targetAI = targetLocator[i], bestMatchAI = bestMatch.locator[i], tstAI = tst.locator[i];
  474. targetAI - bestMatchAI > Math.abs(targetAI - tstAI) && (bestMatch = tst);
  475. break;
  476. }
  477. equality < i && (equality = i, bestMatch = tst);
  478. }
  479. }), bestMatch = $.extend({}, bestMatch, {
  480. input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
  481. }), bestMatch.generatedInput = !0, setValidPosition(ps, bestMatch, !0), getMaskSet().validPositions[newPos] = undefined,
  482. _isValid(newPos, vp.input, !0);
  483. }
  484. }(maskPos, result.pos !== undefined ? result.pos : nPos), maskPos = nPos;
  485. break;
  486. }
  487. } else result = {
  488. caret: seekNext(maskPos)
  489. };
  490. }
  491. !1 === result && opts.keepStatic && !strict && !0 !== fromAlternate && (result = function(pos, c, strict) {
  492. var lastAlt, alternation, altPos, prevAltPos, i, validPos, altNdxs, decisionPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), isValidRslt = !1, lAltPos = getLastValidPosition();
  493. for (prevAltPos = getMaskSet().validPositions[lAltPos]; lAltPos >= 0; lAltPos--) if ((altPos = getMaskSet().validPositions[lAltPos]) && altPos.alternation !== undefined) {
  494. if (lastAlt = lAltPos, alternation = getMaskSet().validPositions[lastAlt].alternation,
  495. prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) break;
  496. prevAltPos = altPos;
  497. }
  498. if (alternation !== undefined) {
  499. decisionPos = parseInt(lastAlt);
  500. var decisionTaker = prevAltPos.locator[prevAltPos.alternation || alternation] !== undefined ? prevAltPos.locator[prevAltPos.alternation || alternation] : altNdxs[0];
  501. decisionTaker.length > 0 && (decisionTaker = decisionTaker.split(",")[0]);
  502. var possibilityPos = getMaskSet().validPositions[decisionPos], prevPos = getMaskSet().validPositions[decisionPos - 1];
  503. $.each(getTests(decisionPos, prevPos ? prevPos.locator : undefined, decisionPos - 1), function(ndx, test) {
  504. altNdxs = test.locator[alternation] ? test.locator[alternation].toString().split(",") : [];
  505. for (var mndx = 0; mndx < altNdxs.length; mndx++) {
  506. var validInputs = [], staticInputsBeforePos = 0, staticInputsBeforePosAlternate = 0, verifyValidInput = !1;
  507. if (decisionTaker < altNdxs[mndx] && (test.na === undefined || -1 === $.inArray(altNdxs[mndx], test.na.split(",")) || -1 === $.inArray(decisionTaker.toString(), altNdxs))) {
  508. getMaskSet().validPositions[decisionPos] = $.extend(!0, {}, test);
  509. var possibilities = getMaskSet().validPositions[decisionPos].locator;
  510. for (getMaskSet().validPositions[decisionPos].locator[alternation] = parseInt(altNdxs[mndx]),
  511. null == test.match.fn ? (possibilityPos.input !== test.match.def && (verifyValidInput = !0,
  512. !0 !== possibilityPos.generatedInput && validInputs.push(possibilityPos.input)),
  513. staticInputsBeforePosAlternate++, getMaskSet().validPositions[decisionPos].generatedInput = !/[0-9a-bA-Z]/.test(test.match.def),
  514. getMaskSet().validPositions[decisionPos].input = test.match.def) : getMaskSet().validPositions[decisionPos].input = possibilityPos.input,
  515. i = decisionPos + 1; i < getLastValidPosition(undefined, !0) + 1; i++) validPos = getMaskSet().validPositions[i],
  516. validPos && !0 !== validPos.generatedInput && /[0-9a-bA-Z]/.test(validPos.input) ? validInputs.push(validPos.input) : i < pos && staticInputsBeforePos++,
  517. delete getMaskSet().validPositions[i];
  518. for (verifyValidInput && validInputs[0] === test.match.def && validInputs.shift(),
  519. resetMaskSet(!0), isValidRslt = !0; validInputs.length > 0; ) {
  520. var input = validInputs.shift();
  521. if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition(undefined, !0) + 1, input, !1, fromSetValid, !0))) break;
  522. }
  523. if (isValidRslt) {
  524. getMaskSet().validPositions[decisionPos].locator = possibilities;
  525. var targetLvp = getLastValidPosition(pos) + 1;
  526. for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) ((validPos = getMaskSet().validPositions[i]) === undefined || null == validPos.match.fn) && i < pos + (staticInputsBeforePosAlternate - staticInputsBeforePos) && staticInputsBeforePosAlternate++;
  527. pos += staticInputsBeforePosAlternate - staticInputsBeforePos, isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid, !0);
  528. }
  529. if (isValidRslt) return !1;
  530. resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone);
  531. }
  532. }
  533. });
  534. }
  535. return isValidRslt;
  536. }(maskPos, c, strict)), !0 === result && (result = {
  537. pos: maskPos
  538. });
  539. }
  540. if ($.isFunction(opts.postValidation) && !1 !== result && !strict && !0 !== fromSetValid && !0 !== validateOnly) {
  541. var postResult = opts.postValidation(getBuffer(!0), result, opts);
  542. if (postResult !== undefined) {
  543. if (postResult.refreshFromBuffer && postResult.buffer) {
  544. var refresh = postResult.refreshFromBuffer;
  545. refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, postResult.buffer);
  546. }
  547. result = !0 === postResult ? result : postResult;
  548. }
  549. }
  550. return result && result.pos === undefined && (result.pos = maskPos), !1 !== result && !0 !== validateOnly || (resetMaskSet(!0),
  551. getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result;
  552. }
  553. function isMask(pos, strict) {
  554. var test = getTestTemplate(pos).match;
  555. if ("" === test.def && (test = getTest(pos).match), null != test.fn) return test.fn;
  556. if (!0 !== strict && pos > -1) {
  557. var tests = getTests(pos);
  558. return tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0);
  559. }
  560. return !1;
  561. }
  562. function seekNext(pos, newBlock) {
  563. var maskL = getMaskSet().maskLength;
  564. if (pos >= maskL) return maskL;
  565. var position = pos;
  566. for (getTests(maskL + 1).length > 1 && (getMaskTemplate(!0, maskL + 1, !0), maskL = getMaskSet().maskLength); ++position < maskL && (!0 === newBlock && (!0 !== getTest(position).match.newBlockMarker || !isMask(position)) || !0 !== newBlock && !isMask(position)); ) ;
  567. return position;
  568. }
  569. function seekPrevious(pos, newBlock) {
  570. var tests, position = pos;
  571. if (position <= 0) return 0;
  572. for (;--position > 0 && (!0 === newBlock && !0 !== getTest(position).match.newBlockMarker || !0 !== newBlock && !isMask(position) && (tests = getTests(position),
  573. tests.length < 2 || 2 === tests.length && "" === tests[1].match.def)); ) ;
  574. return position;
  575. }
  576. function getBufferElement(position) {
  577. return getMaskSet().validPositions[position] === undefined ? getPlaceholder(position) : getMaskSet().validPositions[position].input;
  578. }
  579. function writeBuffer(input, buffer, caretPos, event, triggerInputEvent) {
  580. if (event && $.isFunction(opts.onBeforeWrite)) {
  581. var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts);
  582. if (result) {
  583. if (result.refreshFromBuffer) {
  584. var refresh = result.refreshFromBuffer;
  585. refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer || buffer),
  586. buffer = getBuffer(!0);
  587. }
  588. caretPos !== undefined && (caretPos = result.caret !== undefined ? result.caret : caretPos);
  589. }
  590. }
  591. input !== undefined && (input.inputmask._valueSet(buffer.join("")), caretPos === undefined || event !== undefined && "blur" === event.type ? renderColorMask(input, caretPos, 0 === buffer.length) : caret(input, caretPos),
  592. !0 === triggerInputEvent && (skipInputEvent = !0, $(input).trigger("input")));
  593. }
  594. function getPlaceholder(pos, test, returnPL) {
  595. if (test = test || getTest(pos).match, test.placeholder !== undefined || !0 === returnPL) return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder;
  596. if (null === test.fn) {
  597. if (pos > -1 && getMaskSet().validPositions[pos] === undefined) {
  598. var prevTest, tests = getTests(pos), staticAlternations = [];
  599. if (tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0)) for (var i = 0; i < tests.length; i++) if (!0 !== tests[i].match.optionality && !0 !== tests[i].match.optionalQuantifier && (null === tests[i].match.fn || prevTest === undefined || !1 !== tests[i].match.fn.test(prevTest.match.def, getMaskSet(), pos, !0, opts)) && (staticAlternations.push(tests[i]),
  600. null === tests[i].match.fn && (prevTest = tests[i]), staticAlternations.length > 1 && /[0-9a-bA-Z]/.test(staticAlternations[0].match.def))) return opts.placeholder.charAt(pos % opts.placeholder.length);
  601. }
  602. return test.def;
  603. }
  604. return opts.placeholder.charAt(pos % opts.placeholder.length);
  605. }
  606. function checkVal(input, writeOut, strict, nptvl, initiatingEvent) {
  607. function isTemplateMatch(ndx, charCodes) {
  608. return -1 !== getBufferTemplate().slice(ndx, seekNext(ndx)).join("").indexOf(charCodes) && !isMask(ndx) && getTest(ndx).match.nativeDef === charCodes.charAt(charCodes.length - 1);
  609. }
  610. var inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = undefined;
  611. if (resetMaskSet(), strict || !0 === opts.autoUnmask) initialNdx = seekNext(initialNdx); else {
  612. var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
  613. matches && matches.length > 0 && (inputValue.splice(0, matches.length * staticInput.length),
  614. initialNdx = seekNext(initialNdx));
  615. }
  616. if (-1 === initialNdx ? (getMaskSet().p = seekNext(initialNdx), initialNdx = 0) : getMaskSet().p = initialNdx,
  617. $.each(inputValue, function(ndx, charCode) {
  618. if (charCode !== undefined) if (getMaskSet().validPositions[ndx] === undefined && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, undefined, undefined, !0)) getMaskSet().p++; else {
  619. var keypress = new $.Event("_checkval");
  620. keypress.which = charCode.charCodeAt(0), charCodes += charCode;
  621. var lvp = getLastValidPosition(undefined, !0), lvTest = getMaskSet().validPositions[lvp], nextTest = getTestTemplate(lvp + 1, lvTest ? lvTest.locator.slice() : undefined, lvp);
  622. if (!isTemplateMatch(initialNdx, charCodes) || strict || opts.autoUnmask) {
  623. var pos = strict ? ndx : null == nextTest.match.fn && nextTest.match.optionality && lvp + 1 < getMaskSet().p ? lvp + 1 : getMaskSet().p;
  624. result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, pos),
  625. initialNdx = pos + 1, charCodes = "";
  626. } else result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, !0, lvp + 1);
  627. if (!1 !== result && !strict && $.isFunction(opts.onBeforeWrite)) {
  628. var origResult = result;
  629. if (result = opts.onBeforeWrite.call(inputmask, keypress, getBuffer(), result.forwardPosition, opts),
  630. (result = $.extend(origResult, result)) && result.refreshFromBuffer) {
  631. var refresh = result.refreshFromBuffer;
  632. refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer),
  633. resetMaskSet(!0), result.caret && (getMaskSet().p = result.caret, result.forwardPosition = result.caret);
  634. }
  635. }
  636. }
  637. }), writeOut) {
  638. var caretPos = undefined;
  639. document.activeElement === input && result && (caretPos = opts.numericInput ? seekPrevious(result.forwardPosition) : result.forwardPosition),
  640. writeBuffer(input, getBuffer(), caretPos, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
  641. }
  642. }
  643. function unmaskedvalue(input) {
  644. if (input) {
  645. if (input.inputmask === undefined) return input.value;
  646. input.inputmask && input.inputmask.refreshValue && EventHandlers.setValueEvent.call(input);
  647. }
  648. var umValue = [], vps = getMaskSet().validPositions;
  649. for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
  650. var unmaskedValue = 0 === umValue.length ? "" : (isRTL ? umValue.reverse() : umValue).join("");
  651. if ($.isFunction(opts.onUnMask)) {
  652. var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
  653. unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts);
  654. }
  655. return unmaskedValue;
  656. }
  657. function caret(input, begin, end, notranslate) {
  658. function translatePosition(pos) {
  659. if (!0 !== notranslate && isRTL && "number" == typeof pos && (!opts.greedy || "" !== opts.placeholder)) {
  660. pos = getBuffer().join("").length - pos;
  661. }
  662. return pos;
  663. }
  664. var range;
  665. if (begin === undefined) return input.setSelectionRange ? (begin = input.selectionStart,
  666. end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0),
  667. range.commonAncestorContainer.parentNode !== input && range.commonAncestorContainer !== input || (begin = range.startOffset,
  668. end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
  669. begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length),
  670. end = begin + range.text.length), {
  671. begin: translatePosition(begin),
  672. end: translatePosition(end)
  673. };
  674. if (begin.begin !== undefined && (end = begin.end, begin = begin.begin), "number" == typeof begin) {
  675. begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin;
  676. var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end;
  677. if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, mobile || !1 !== opts.insertMode || begin !== end || end++,
  678. input.inputmask.caretPos = {
  679. begin: begin,
  680. end: end
  681. }, input.setSelectionRange) input.selectionStart = begin, input.selectionEnd = end; else if (window.getSelection) {
  682. if (range = document.createRange(), input.firstChild === undefined || null === input.firstChild) {
  683. var textNode = document.createTextNode("");
  684. input.appendChild(textNode);
  685. }
  686. range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length),
  687. range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length),
  688. range.collapse(!0);
  689. var sel = window.getSelection();
  690. sel.removeAllRanges(), sel.addRange(range);
  691. } else input.createTextRange && (range = input.createTextRange(), range.collapse(!0),
  692. range.moveEnd("character", end), range.moveStart("character", begin), range.select());
  693. renderColorMask(input, {
  694. begin: begin,
  695. end: end
  696. });
  697. }
  698. }
  699. function determineLastRequiredPosition(returnDefinition) {
  700. var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = lvTest !== undefined ? lvTest.locator.slice() : undefined;
  701. for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
  702. ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
  703. var lvTestAlt = lvTest && lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation] : undefined;
  704. for (pos = bl - 1; pos > lvp && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier && testPos.match.newBlockMarker || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && null != testPos.match.fn || null === testPos.match.fn && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && "" !== getTests(pos)[0].def)) && buffer[pos] === getPlaceholder(pos, testPos.match)); pos--) bl--;
  705. return returnDefinition ? {
  706. l: bl,
  707. def: positions[bl] ? positions[bl].match : undefined
  708. } : bl;
  709. }
  710. function clearOptionalTail(buffer) {
  711. for (var validPos, rl = determineLastRequiredPosition(), bl = buffer.length, lv = getMaskSet().validPositions[getLastValidPosition()]; rl < bl && !isMask(rl, !0) && (validPos = lv !== undefined ? getTestTemplate(rl, lv.locator.slice(""), lv) : getTest(rl)) && !0 !== validPos.match.optionality && (!0 !== validPos.match.optionalQuantifier && !0 !== validPos.match.newBlockMarker || rl + 1 === bl && "" === (lv !== undefined ? getTestTemplate(rl + 1, lv.locator.slice(""), lv) : getTest(rl + 1)).match.def); ) rl++;
  712. for (;(validPos = getMaskSet().validPositions[rl - 1]) && validPos && validPos.match.optionality && validPos.input === opts.skipOptionalPartCharacter; ) rl--;
  713. return buffer.splice(rl), buffer;
  714. }
  715. function isComplete(buffer) {
  716. if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts);
  717. if ("*" === opts.repeat) return undefined;
  718. var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l);
  719. if (lrp.def === undefined || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) {
  720. complete = !0;
  721. for (var i = 0; i <= aml; i++) {
  722. var test = getTestTemplate(i).match;
  723. if (null !== test.fn && getMaskSet().validPositions[i] === undefined && !0 !== test.optionality && !0 !== test.optionalQuantifier || null === test.fn && buffer[i] !== getPlaceholder(i, test)) {
  724. complete = !1;
  725. break;
  726. }
  727. }
  728. }
  729. return complete;
  730. }
  731. function handleRemove(input, k, pos, strict, fromIsValid) {
  732. if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE),
  733. isRTL)) {
  734. var pend = pos.end;
  735. pos.end = pos.begin, pos.begin = pend;
  736. }
  737. k === Inputmask.keyCode.BACKSPACE && (pos.end - pos.begin < 1 || !1 === opts.insertMode) ? (pos.begin = seekPrevious(pos.begin),
  738. getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1,
  739. getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++),
  740. stripValidPositions(pos.begin, pos.end, !1, strict), !0 !== strict && function() {
  741. if (opts.keepStatic) {
  742. for (var validInputs = [], lastAlt = getLastValidPosition(-1, !0), positionsClone = $.extend(!0, {}, getMaskSet().validPositions), prevAltPos = getMaskSet().validPositions[lastAlt]; lastAlt >= 0; lastAlt--) {
  743. var altPos = getMaskSet().validPositions[lastAlt];
  744. if (altPos) {
  745. if (!0 !== altPos.generatedInput && /[0-9a-bA-Z]/.test(altPos.input) && validInputs.push(altPos.input),
  746. delete getMaskSet().validPositions[lastAlt], altPos.alternation !== undefined && altPos.locator[altPos.alternation] !== prevAltPos.locator[altPos.alternation]) break;
  747. prevAltPos = altPos;
  748. }
  749. }
  750. if (lastAlt > -1) for (getMaskSet().p = seekNext(getLastValidPosition(-1, !0)); validInputs.length > 0; ) {
  751. var keypress = new $.Event("keypress");
  752. keypress.which = validInputs.pop().charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !1, !1, getMaskSet().p);
  753. } else getMaskSet().validPositions = $.extend(!0, {}, positionsClone);
  754. }
  755. }();
  756. var lvp = getLastValidPosition(pos.begin, !0);
  757. if (lvp < pos.begin) getMaskSet().p = seekNext(lvp); else if (!0 !== strict && (getMaskSet().p = pos.begin,
  758. !0 !== fromIsValid)) for (;getMaskSet().p < lvp && getMaskSet().validPositions[getMaskSet().p] === undefined; ) getMaskSet().p++;
  759. }
  760. function initializeColorMask(input) {
  761. function findCaretPos(clientx) {
  762. var caretPos, e = document.createElement("span");
  763. for (var style in computedStyle) isNaN(style) && -1 !== style.indexOf("font") && (e.style[style] = computedStyle[style]);
  764. e.style.textTransform = computedStyle.textTransform, e.style.letterSpacing = computedStyle.letterSpacing,
  765. e.style.position = "absolute", e.style.height = "auto", e.style.width = "auto",
  766. e.style.visibility = "hidden", e.style.whiteSpace = "nowrap", document.body.appendChild(e);
  767. var itl, inputText = input.inputmask._valueGet(), previousWidth = 0;
  768. for (caretPos = 0, itl = inputText.length; caretPos <= itl; caretPos++) {
  769. if (e.innerHTML += inputText.charAt(caretPos) || "_", e.offsetWidth >= clientx) {
  770. var offset1 = clientx - previousWidth, offset2 = e.offsetWidth - clientx;
  771. e.innerHTML = inputText.charAt(caretPos), offset1 -= e.offsetWidth / 3, caretPos = offset1 < offset2 ? caretPos - 1 : caretPos;
  772. break;
  773. }
  774. previousWidth = e.offsetWidth;
  775. }
  776. return document.body.removeChild(e), caretPos;
  777. }
  778. var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null), template = document.createElement("div");
  779. template.style.width = computedStyle.width, template.style.textAlign = computedStyle.textAlign,
  780. colorMask = document.createElement("div"), colorMask.className = "im-colormask",
  781. input.parentNode.insertBefore(colorMask, input), input.parentNode.removeChild(input),
  782. colorMask.appendChild(template), colorMask.appendChild(input), input.style.left = template.offsetLeft + "px",
  783. $(input).on("click", function(e) {
  784. return caret(input, findCaretPos(e.clientX)), EventHandlers.clickEvent.call(input, [ e ]);
  785. }), $(input).on("keydown", function(e) {
  786. e.shiftKey || !1 === opts.insertMode || setTimeout(function() {
  787. renderColorMask(input);
  788. }, 0);
  789. });
  790. }
  791. function renderColorMask(input, caretPos, clear) {
  792. function handleStatic() {
  793. isStatic || null !== test.fn && testPos.input !== undefined ? isStatic && (null !== test.fn && testPos.input !== undefined || "" === test.def) && (isStatic = !1,
  794. maskTemplate += "</span>") : (isStatic = !0, maskTemplate += "<span class='im-static'>");
  795. }
  796. function handleCaret(force) {
  797. !0 !== force && pos !== caretPos.begin || document.activeElement !== input || (maskTemplate += "<span class='im-caret' style='border-right-width: 1px;border-right-style: solid;'></span>");
  798. }
  799. var test, testPos, ndxIntlzr, maskTemplate = "", isStatic = !1, pos = 0;
  800. if (colorMask !== undefined) {
  801. var buffer = getBuffer();
  802. if (caretPos === undefined ? caretPos = caret(input) : caretPos.begin === undefined && (caretPos = {
  803. begin: caretPos,
  804. end: caretPos
  805. }), !0 !== clear) {
  806. var lvp = getLastValidPosition();
  807. do {
  808. handleCaret(), getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos],
  809. test = testPos.match, ndxIntlzr = testPos.locator.slice(), handleStatic(), maskTemplate += buffer[pos]) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
  810. test = testPos.match, ndxIntlzr = testPos.locator.slice(), (!1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos) && (handleStatic(),
  811. maskTemplate += getPlaceholder(pos, test))), pos++;
  812. } while ((maxLength === undefined || pos < maxLength) && (null !== test.fn || "" !== test.def) || lvp > pos || isStatic);
  813. -1 === maskTemplate.indexOf("im-caret") && handleCaret(!0), isStatic && handleStatic();
  814. }
  815. var template = colorMask.getElementsByTagName("div")[0];
  816. template.innerHTML = maskTemplate, input.inputmask.positionColorMask(input, template);
  817. }
  818. }
  819. maskset = maskset || this.maskset, opts = opts || this.opts;
  820. var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1, trackCaret = !1, EventRuler = {
  821. on: function(input, eventName, eventHandler) {
  822. var ev = function(e) {
  823. var that = this;
  824. if (that.inputmask === undefined && "FORM" !== this.nodeName) {
  825. var imOpts = $.data(that, "_inputmask_opts");
  826. imOpts ? new Inputmask(imOpts).mask(that) : EventRuler.off(that);
  827. } else {
  828. if ("setvalue" === e.type || "FORM" === this.nodeName || !(that.disabled || that.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || !1 === opts.tabThrough && e.keyCode === Inputmask.keyCode.TAB))) {
  829. switch (e.type) {
  830. case "input":
  831. if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault();
  832. android && (trackCaret = !0);
  833. break;
  834. case "keydown":
  835. skipKeyPressEvent = !1, skipInputEvent = !1;
  836. break;
  837. case "keypress":
  838. if (!0 === skipKeyPressEvent) return e.preventDefault();
  839. skipKeyPressEvent = !0;
  840. break;
  841. case "click":
  842. if (iemobile || iphone) {
  843. var args = arguments;
  844. return setTimeout(function() {
  845. eventHandler.apply(that, args);
  846. }, 0), !1;
  847. }
  848. }
  849. var returnVal = eventHandler.apply(that, arguments);
  850. return trackCaret && (trackCaret = !1, setTimeout(function() {
  851. caret(that, that.inputmask.caretPos);
  852. })), !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
  853. }
  854. e.preventDefault();
  855. }
  856. };
  857. input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev),
  858. -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev);
  859. },
  860. off: function(input, event) {
  861. if (input.inputmask && input.inputmask.events) {
  862. var events;
  863. event ? (events = [], events[event] = input.inputmask.events[event]) : events = input.inputmask.events,
  864. $.each(events, function(eventName, evArr) {
  865. for (;evArr.length > 0; ) {
  866. var ev = evArr.pop();
  867. -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev);
  868. }
  869. delete input.inputmask.events[eventName];
  870. });
  871. }
  872. }
  873. }, EventHandlers = {
  874. keydownEvent: function(e) {
  875. var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
  876. if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !function(eventName) {
  877. var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
  878. return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
  879. el = null, isSupported;
  880. }("cut")) e.preventDefault(), handleRemove(input, k, pos), writeBuffer(input, getBuffer(!0), getMaskSet().p, e, input.inputmask._valueGet() !== getBuffer().join("")),
  881. input.inputmask._valueGet() === getBufferTemplate().join("") ? $input.trigger("cleared") : !0 === isComplete(getBuffer()) && $input.trigger("complete"); else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) {
  882. e.preventDefault();
  883. var caretPos = seekNext(getLastValidPosition());
  884. opts.insertMode || caretPos !== getMaskSet().maskLength || e.shiftKey || caretPos--,
  885. caret(input, e.shiftKey ? pos.begin : caretPos, caretPos, !0);
  886. } else k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? (e.preventDefault(),
  887. caret(input, 0, e.shiftKey ? pos.begin : 0, !0)) : (opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || 90 === k && e.ctrlKey) && !0 !== e.altKey ? (checkVal(input, !0, !1, undoValue.split("")),
  888. $input.trigger("click")) : k !== Inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? !0 === opts.tabThrough && k === Inputmask.keyCode.TAB ? (!0 === e.shiftKey ? (null === getTest(pos.begin).match.fn && (pos.begin = seekNext(pos.begin)),
  889. pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0),
  890. pos.end = seekNext(pos.begin, !0), pos.end < getMaskSet().maskLength && pos.end--),
  891. pos.begin < getMaskSet().maskLength && (e.preventDefault(), caret(input, pos.begin, pos.end))) : e.shiftKey || !1 === opts.insertMode && (k === Inputmask.keyCode.RIGHT ? setTimeout(function() {
  892. var caretPos = caret(input);
  893. caret(input, caretPos.begin);
  894. }, 0) : k === Inputmask.keyCode.LEFT && setTimeout(function() {
  895. var caretPos = caret(input);
  896. caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1);
  897. }, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin !== getMaskSet().maskLength ? pos.begin : pos.begin - 1));
  898. opts.onKeyDown.call(this, e, getBuffer(), caret(input).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables);
  899. },
  900. keypressEvent: function(e, checkval, writeOut, strict, ndx) {
  901. var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode;
  902. if (!(!0 === checkval || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""),
  903. setTimeout(function() {
  904. $input.trigger("change");
  905. }, 0)), !0;
  906. if (k) {
  907. 46 === k && !1 === e.shiftKey && "" !== opts.radixPoint && (k = opts.radixPoint.charCodeAt(0));
  908. var forwardPosition, pos = checkval ? {
  909. begin: ndx,
  910. end: ndx
  911. } : caret(input), c = String.fromCharCode(k);
  912. getMaskSet().writeOutBuffer = !0;
  913. var valResult = isValid(pos, c, strict);
  914. if (!1 !== valResult && (resetMaskSet(!0), forwardPosition = valResult.caret !== undefined ? valResult.caret : checkval ? valResult.pos + 1 : seekNext(valResult.pos),
  915. getMaskSet().p = forwardPosition), !1 !== writeOut && (setTimeout(function() {
  916. opts.onKeyValidation.call(input, k, valResult, opts);
  917. }, 0), getMaskSet().writeOutBuffer && !1 !== valResult)) {
  918. var buffer = getBuffer();
  919. writeBuffer(input, buffer, opts.numericInput && valResult.caret === undefined ? seekPrevious(forwardPosition) : forwardPosition, e, !0 !== checkval),
  920. !0 !== checkval && setTimeout(function() {
  921. !0 === isComplete(buffer) && $input.trigger("complete");
  922. }, 0);
  923. }
  924. if (e.preventDefault(), checkval) return !1 !== valResult && (valResult.forwardPosition = forwardPosition),
  925. valResult;
  926. }
  927. },
  928. pasteEvent: function(e) {
  929. var tempValue, input = this, ev = e.originalEvent || e, $input = $(input), inputValue = input.inputmask._valueGet(!0), caretPos = caret(input);
  930. isRTL && (tempValue = caretPos.end, caretPos.end = caretPos.begin, caretPos.begin = tempValue);
  931. var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
  932. if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""),
  933. valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("") && (valueAfterCaret = ""),
  934. isRTL && (tempValue = valueBeforeCaret, valueBeforeCaret = valueAfterCaret, valueAfterCaret = tempValue),
  935. window.clipboardData && window.clipboardData.getData) inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret; else {
  936. if (!ev.clipboardData || !ev.clipboardData.getData) return !0;
  937. inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
  938. }
  939. var pasteValue = inputValue;
  940. if ($.isFunction(opts.onBeforePaste)) {
  941. if (!1 === (pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts))) return e.preventDefault();
  942. pasteValue || (pasteValue = inputValue);
  943. }
  944. return checkVal(input, !1, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.toString().split("")),
  945. writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join("")),
  946. !0 === isComplete(getBuffer()) && $input.trigger("complete"), e.preventDefault();
  947. },
  948. inputFallBackEvent: function(e) {
  949. var input = this, inputValue = input.inputmask._valueGet();
  950. if (getBuffer().join("") !== inputValue) {
  951. var caretPos = caret(input);
  952. if (inputValue = function(input, inputValue, caretPos) {
  953. return "." === inputValue.charAt(caretPos.begin - 1) && "" !== opts.radixPoint && (inputValue = inputValue.split(""),
  954. inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")),
  955. inputValue;
  956. }(input, inputValue, caretPos), inputValue = function(input, inputValue, caretPos) {
  957. if (iemobile) {
  958. var inputChar = inputValue.replace(getBuffer().join(""), "");
  959. if (1 === inputChar.length) {
  960. var iv = inputValue.split("");
  961. iv.splice(caretPos.begin, 0, inputChar), inputValue = iv.join("");
  962. }
  963. }
  964. return inputValue;
  965. }(input, inputValue, caretPos), caretPos.begin > inputValue.length && (caret(input, inputValue.length),
  966. caretPos = caret(input)), getBuffer().join("") !== inputValue) {
  967. var buffer = getBuffer().join(""), offset = inputValue.length > buffer.length ? -1 : 0, frontPart = inputValue.substr(0, caretPos.begin), backPart = inputValue.substr(caretPos.begin), frontBufferPart = buffer.substr(0, caretPos.begin + offset), backBufferPart = buffer.substr(caretPos.begin + offset), selection = caretPos, entries = "", isEntry = !1;
  968. if (frontPart !== frontBufferPart) {
  969. for (var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) ;
  970. isEntry && (0 === offset && (selection.begin = i), entries += frontPart.slice(i, selection.end));
  971. }
  972. if (backPart !== backBufferPart && (backPart.length > backBufferPart.length ? entries += backPart.slice(0, 1) : backPart.length < backBufferPart.length && (selection.end += backBufferPart.length - backPart.length,
  973. isEntry || "" === opts.radixPoint || "" !== backPart || frontPart.charAt(selection.begin + offset - 1) !== opts.radixPoint || (selection.begin--,
  974. entries = opts.radixPoint))), writeBuffer(input, getBuffer(), {
  975. begin: selection.begin + offset,
  976. end: selection.end + offset
  977. }), entries.length > 0) $.each(entries.split(""), function(ndx, entry) {
  978. var keypress = new $.Event("keypress");
  979. keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress);
  980. }); else {
  981. selection.begin === selection.end - 1 && (selection.begin = seekPrevious(selection.begin + 1),
  982. selection.begin === selection.end - 1 ? caret(input, selection.begin) : caret(input, selection.begin, selection.end));
  983. var keydown = new $.Event("keydown");
  984. keydown.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, keydown),
  985. !1 === opts.insertMode && caret(input, caret(input).begin - 1);
  986. }
  987. e.preventDefault();
  988. }
  989. }
  990. },
  991. setValueEvent: function(e) {
  992. this.inputmask.refreshValue = !1;
  993. var input = this, value = input.inputmask._valueGet(!0);
  994. $.isFunction(opts.onBeforeMask) && (value = opts.onBeforeMask.call(inputmask, value, opts) || value),
  995. value = value.split(""), checkVal(input, !0, !1, isRTL ? value.reverse() : value),
  996. undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet("");
  997. },
  998. focusEvent: function(e) {
  999. var input = this, nptValue = input.inputmask._valueGet();
  1000. opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" === nptValue) && (input.inputmask._valueGet() !== getBuffer().join("") ? writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : !1 === mouseEnter && caret(input, seekNext(getLastValidPosition()))),
  1001. !0 === opts.positionCaretOnTab && !1 === mouseEnter && "" !== nptValue && (writeBuffer(input, getBuffer(), caret(input)),
  1002. EventHandlers.clickEvent.apply(input, [ e, !0 ])), undoValue = getBuffer().join("");
  1003. },
  1004. mouseleaveEvent: function(e) {
  1005. var input = this;
  1006. if (mouseEnter = !1, opts.clearMaskOnLostFocus && document.activeElement !== input) {
  1007. var buffer = getBuffer().slice(), nptValue = input.inputmask._valueGet();
  1008. nptValue !== input.getAttribute("placeholder") && "" !== nptValue && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer),
  1009. writeBuffer(input, buffer));
  1010. }
  1011. },
  1012. clickEvent: function(e, tabbed) {
  1013. function doRadixFocus(clickPos) {
  1014. if ("" !== opts.radixPoint) {
  1015. var vps = getMaskSet().validPositions;
  1016. if (vps[clickPos] === undefined || vps[clickPos].input === getPlaceholder(clickPos)) {
  1017. if (clickPos < seekNext(-1)) return !0;
  1018. var radixPos = $.inArray(opts.radixPoint, getBuffer());
  1019. if (-1 !== radixPos) {
  1020. for (var vp in vps) if (radixPos < vp && vps[vp].input !== getPlaceholder(vp)) return !1;
  1021. return !0;
  1022. }
  1023. }
  1024. }
  1025. return !1;
  1026. }
  1027. var input = this;
  1028. setTimeout(function() {
  1029. if (document.activeElement === input) {
  1030. var selectedCaret = caret(input);
  1031. if (tabbed && (isRTL ? selectedCaret.end = selectedCaret.begin : selectedCaret.begin = selectedCaret.end),
  1032. selectedCaret.begin === selectedCaret.end) switch (opts.positionCaretOnClick) {
  1033. case "none":
  1034. break;
  1035. case "radixFocus":
  1036. if (doRadixFocus(selectedCaret.begin)) {
  1037. var radixPos = getBuffer().join("").indexOf(opts.radixPoint);
  1038. caret(input, opts.numericInput ? seekNext(radixPos) : radixPos);
  1039. break;
  1040. }
  1041. default:
  1042. var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(lvclickPosition);
  1043. if (clickPosition < lastPosition) caret(input, isMask(clickPosition, !0) || isMask(clickPosition - 1, !0) ? clickPosition : seekNext(clickPosition)); else {
  1044. var lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : undefined, lvp), placeholder = getPlaceholder(lastPosition, tt.match);
  1045. if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, !0) && tt.match.def === placeholder) {
  1046. var newPos = seekNext(lastPosition);
  1047. (clickPosition >= newPos || clickPosition === lastPosition) && (lastPosition = newPos);
  1048. }
  1049. caret(input, lastPosition);
  1050. }
  1051. }
  1052. }
  1053. }, 0);
  1054. },
  1055. dblclickEvent: function(e) {
  1056. var input = this;
  1057. setTimeout(function() {
  1058. caret(input, 0, seekNext(getLastValidPosition()));
  1059. }, 0);
  1060. },
  1061. cutEvent: function(e) {
  1062. var input = this, $input = $(input), pos = caret(input), ev = e.originalEvent || e, clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end);
  1063. clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clipData.join("")),
  1064. document.execCommand && document.execCommand("copy"), handleRemove(input, Inputmask.keyCode.DELETE, pos),
  1065. writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")),
  1066. input.inputmask._valueGet() === getBufferTemplate().join("") && $input.trigger("cleared");
  1067. },
  1068. blurEvent: function(e) {
  1069. var $input = $(this), input = this;
  1070. if (input.inputmask) {
  1071. var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice();
  1072. "" !== nptValue && (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)),
  1073. !1 === isComplete(buffer) && (setTimeout(function() {
  1074. $input.trigger("incomplete");
  1075. }, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())),
  1076. writeBuffer(input, buffer, undefined, e)), undoValue !== getBuffer().join("") && (undoValue = buffer.join(""),
  1077. $input.trigger("change"));
  1078. }
  1079. },
  1080. mouseenterEvent: function(e) {
  1081. var input = this;
  1082. mouseEnter = !0, document.activeElement !== input && opts.showMaskOnHover && input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer());
  1083. },
  1084. submitEvent: function(e) {
  1085. undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""),
  1086. opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0),
  1087. setTimeout(function() {
  1088. writeBuffer(el, getBuffer());
  1089. }, 0));
  1090. },
  1091. resetEvent: function(e) {
  1092. el.inputmask.refreshValue = !0, setTimeout(function() {
  1093. $el.trigger("setvalue");
  1094. }, 0);
  1095. }
  1096. };
  1097. Inputmask.prototype.positionColorMask = function(input, template) {
  1098. input.style.left = template.offsetLeft + "px";
  1099. };
  1100. var valueBuffer;
  1101. if (actionObj !== undefined) switch (actionObj.action) {
  1102. case "isComplete":
  1103. return el = actionObj.el, isComplete(getBuffer());
  1104. case "unmaskedvalue":
  1105. return el !== undefined && actionObj.value === undefined || (valueBuffer = actionObj.value,
  1106. valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer : valueBuffer).split(""),
  1107. checkVal(undefined, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(inputmask, undefined, getBuffer(), 0, opts)),
  1108. unmaskedvalue(el);
  1109. case "mask":
  1110. !function(elem) {
  1111. EventRuler.off(elem);
  1112. var isSupported = function(input, opts) {
  1113. var elementType = input.getAttribute("type"), isSupported = "INPUT" === input.tagName && -1 !== $.inArray(elementType, opts.supportsInputType) || input.isContentEditable || "TEXTAREA" === input.tagName;
  1114. if (!isSupported) if ("INPUT" === input.tagName) {
  1115. var el = document.createElement("input");
  1116. el.setAttribute("type", elementType), isSupported = "text" === el.type, el = null;
  1117. } else isSupported = "partial";
  1118. return !1 !== isSupported ? function(npt) {
  1119. function getter() {
  1120. return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : -1 !== getLastValidPosition() || !0 !== opts.nullable ? document.activeElement === this && opts.clearMaskOnLostFocus ? (isRTL ? clearOptionalTail(getBuffer().slice()).reverse() : clearOptionalTail(getBuffer().slice())).join("") : valueGet.call(this) : "" : valueGet.call(this);
  1121. }
  1122. function setter(value) {
  1123. valueSet.call(this, value), this.inputmask && $(this).trigger("setvalue");
  1124. }
  1125. var valueGet, valueSet;
  1126. if (!npt.inputmask.__valueGet) {
  1127. if (!0 !== opts.noValuePatching) {
  1128. if (Object.getOwnPropertyDescriptor) {
  1129. "function" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = "object" === _typeof("test".__proto__) ? function(object) {
  1130. return object.__proto__;
  1131. } : function(object) {
  1132. return object.constructor.prototype;
  1133. });
  1134. var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : undefined;
  1135. valueProperty && valueProperty.get && valueProperty.set ? (valueGet = valueProperty.get,
  1136. valueSet = valueProperty.set, Object.defineProperty(npt, "value", {
  1137. get: getter,
  1138. set: setter,
  1139. configurable: !0
  1140. })) : "INPUT" !== npt.tagName && (valueGet = function() {
  1141. return this.textContent;
  1142. }, valueSet = function(value) {
  1143. this.textContent = value;
  1144. }, Object.defineProperty(npt, "value", {
  1145. get: getter,
  1146. set: setter,
  1147. configurable: !0
  1148. }));
  1149. } else document.__lookupGetter__ && npt.__lookupGetter__("value") && (valueGet = npt.__lookupGetter__("value"),
  1150. valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
  1151. npt.__defineSetter__("value", setter));
  1152. npt.inputmask.__valueGet = valueGet, npt.inputmask.__valueSet = valueSet;
  1153. }
  1154. npt.inputmask._valueGet = function(overruleRTL) {
  1155. return isRTL && !0 !== overruleRTL ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el);
  1156. }, npt.inputmask._valueSet = function(value, overruleRTL) {
  1157. valueSet.call(this.el, null === value || value === undefined ? "" : !0 !== overruleRTL && isRTL ? value.split("").reverse().join("") : value);
  1158. }, valueGet === undefined && (valueGet = function() {
  1159. return this.value;
  1160. }, valueSet = function(value) {
  1161. this.value = value;
  1162. }, function(type) {
  1163. if ($.valHooks && ($.valHooks[type] === undefined || !0 !== $.valHooks[type].inputmaskpatch)) {
  1164. var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
  1165. return elem.value;
  1166. }, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
  1167. return elem.value = value, elem;
  1168. };
  1169. $.valHooks[type] = {
  1170. get: function(elem) {
  1171. if (elem.inputmask) {
  1172. if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue();
  1173. var result = valhookGet(elem);
  1174. return -1 !== getLastValidPosition(undefined, undefined, elem.inputmask.maskset.validPositions) || !0 !== opts.nullable ? result : "";
  1175. }
  1176. return valhookGet(elem);
  1177. },
  1178. set: function(elem, value) {
  1179. var result, $elem = $(elem);
  1180. return result = valhookSet(elem, value), elem.inputmask && $elem.trigger("setvalue"),
  1181. result;
  1182. },
  1183. inputmaskpatch: !0
  1184. };
  1185. }
  1186. }(npt.type), function(npt) {
  1187. EventRuler.on(npt, "mouseenter", function(event) {
  1188. var $input = $(this);
  1189. this.inputmask._valueGet() !== getBuffer().join("") && $input.trigger("setvalue");
  1190. });
  1191. }(npt));
  1192. }
  1193. }(input) : input.inputmask = undefined, isSupported;
  1194. }(elem, opts);
  1195. if (!1 !== isSupported && (el = elem, $el = $(el), maxLength = el !== undefined ? el.maxLength : undefined,
  1196. -1 === maxLength && (maxLength = undefined), !0 === opts.colorMask && initializeColorMask(el),
  1197. android && (el.hasOwnProperty("inputmode") && (el.inputmode = opts.inputmode, el.setAttribute("inputmode", opts.inputmode)),
  1198. "rtfm" === opts.androidHack && (!0 !== opts.colorMask && initializeColorMask(el),
  1199. el.type = "password")), !0 === isSupported && (EventRuler.on(el, "submit", EventHandlers.submitEvent),
  1200. EventRuler.on(el, "reset", EventHandlers.resetEvent), EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent),
  1201. EventRuler.on(el, "blur", EventHandlers.blurEvent), EventRuler.on(el, "focus", EventHandlers.focusEvent),
  1202. EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent), !0 !== opts.colorMask && EventRuler.on(el, "click", EventHandlers.clickEvent),
  1203. EventRuler.on(el, "dblclick", EventHandlers.dblclickEvent), EventRuler.on(el, "paste", EventHandlers.pasteEvent),
  1204. EventRuler.on(el, "dragdrop", EventHandlers.pasteEvent), EventRuler.on(el, "drop", EventHandlers.pasteEvent),
  1205. EventRuler.on(el, "cut", EventHandlers.cutEvent), EventRuler.on(el, "complete", opts.oncomplete),
  1206. EventRuler.on(el, "incomplete", opts.onincomplete), EventRuler.on(el, "cleared", opts.oncleared),
  1207. android || !0 === opts.inputEventOnly ? el.removeAttribute("maxLength") : (EventRuler.on(el, "keydown", EventHandlers.keydownEvent),
  1208. EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "compositionstart", $.noop),
  1209. EventRuler.on(el, "compositionupdate", $.noop), EventRuler.on(el, "compositionend", $.noop),
  1210. EventRuler.on(el, "keyup", $.noop), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent),
  1211. EventRuler.on(el, "beforeinput", $.noop)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent),
  1212. undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) {
  1213. var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(!0), opts) || el.inputmask._valueGet(!0) : el.inputmask._valueGet(!0);
  1214. "" !== initialValue && checkVal(el, !0, !1, isRTL ? initialValue.split("").reverse() : initialValue.split(""));
  1215. var buffer = getBuffer().slice();
  1216. undoValue = buffer.join(""), !1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(),
  1217. opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)),
  1218. writeBuffer(el, buffer), document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
  1219. }
  1220. }(el);
  1221. break;
  1222. case "format":
  1223. return valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value : actionObj.value).split(""),
  1224. checkVal(undefined, !0, !1, isRTL ? valueBuffer.reverse() : valueBuffer), actionObj.metadata ? {
  1225. value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
  1226. metadata: maskScope.call(this, {
  1227. action: "getmetadata"
  1228. }, maskset, opts)
  1229. } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
  1230. case "isValid":
  1231. actionObj.value ? (valueBuffer = actionObj.value.split(""), checkVal(undefined, !0, !0, isRTL ? valueBuffer.reverse() : valueBuffer)) : actionObj.value = getBuffer().join("");
  1232. for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
  1233. return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === getBuffer().join("");
  1234. case "getemptymask":
  1235. return getBufferTemplate().join("");
  1236. case "remove":
  1237. if (el && el.inputmask) {
  1238. $el = $(el), el.inputmask._valueSet(opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(!0)),
  1239. EventRuler.off(el);
  1240. Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value") && el.inputmask.__valueGet && Object.defineProperty(el, "value", {
  1241. get: el.inputmask.__valueGet,
  1242. set: el.inputmask.__valueSet,
  1243. configurable: !0
  1244. }) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet),
  1245. el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = undefined;
  1246. }
  1247. return el;
  1248. case "getmetadata":
  1249. if ($.isArray(maskset.metadata)) {
  1250. var maskTarget = getMaskTemplate(!0, 0, !1).join("");
  1251. return $.each(maskset.metadata, function(ndx, mtdt) {
  1252. if (mtdt.mask === maskTarget) return maskTarget = mtdt, !1;
  1253. }), maskTarget;
  1254. }
  1255. return maskset.metadata;
  1256. }
  1257. }
  1258. var ua = navigator.userAgent, mobile = /mobile/i.test(ua), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile, android = /android/i.test(ua) && !iemobile;
  1259. return Inputmask.prototype = {
  1260. dataAttribute: "data-inputmask",
  1261. defaults: {
  1262. placeholder: "_",
  1263. optionalmarker: {
  1264. start: "[",
  1265. end: "]"
  1266. },
  1267. quantifiermarker: {
  1268. start: "{",
  1269. end: "}"
  1270. },
  1271. groupmarker: {
  1272. start: "(",
  1273. end: ")"
  1274. },
  1275. alternatormarker: "|",
  1276. escapeChar: "\\",
  1277. mask: null,
  1278. regex: null,
  1279. oncomplete: $.noop,
  1280. onincomplete: $.noop,
  1281. oncleared: $.noop,
  1282. repeat: 0,
  1283. greedy: !0,
  1284. autoUnmask: !1,
  1285. removeMaskOnSubmit: !1,
  1286. clearMaskOnLostFocus: !0,
  1287. insertMode: !0,
  1288. clearIncomplete: !1,
  1289. alias: null,
  1290. onKeyDown: $.noop,
  1291. onBeforeMask: null,
  1292. onBeforePaste: function(pastedValue, opts) {
  1293. return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue;
  1294. },
  1295. onBeforeWrite: null,
  1296. onUnMask: null,
  1297. showMaskOnFocus: !0,
  1298. showMaskOnHover: !0,
  1299. onKeyValidation: $.noop,
  1300. skipOptionalPartCharacter: " ",
  1301. numericInput: !1,
  1302. rightAlign: !1,
  1303. undoOnEscape: !0,
  1304. radixPoint: "",
  1305. radixPointDefinitionSymbol: undefined,
  1306. groupSeparator: "",
  1307. keepStatic: null,
  1308. positionCaretOnTab: !0,
  1309. tabThrough: !1,
  1310. supportsInputType: [ "text", "tel", "password" ],
  1311. ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 0, 229 ],
  1312. isComplete: null,
  1313. canClearPosition: $.noop,
  1314. preValidation: null,
  1315. postValidation: null,
  1316. staticDefinitionSymbol: undefined,
  1317. jitMasking: !1,
  1318. nullable: !0,
  1319. inputEventOnly: !1,
  1320. noValuePatching: !1,
  1321. positionCaretOnClick: "lvp",
  1322. casing: null,
  1323. inputmode: "verbatim",
  1324. colorMask: !1,
  1325. androidHack: !1,
  1326. importDataAttributes: !0
  1327. },
  1328. definitions: {
  1329. "9": {
  1330. validator: "[0-9\uff11-\uff19]",
  1331. cardinality: 1,
  1332. definitionSymbol: "*"
  1333. },
  1334. a: {
  1335. validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
  1336. cardinality: 1,
  1337. definitionSymbol: "*"
  1338. },
  1339. "*": {
  1340. validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
  1341. cardinality: 1
  1342. }
  1343. },
  1344. aliases: {},
  1345. masksCache: {},
  1346. mask: function(elems) {
  1347. function importAttributeOptions(npt, opts, userOptions, dataAttribute) {
  1348. if (!0 === opts.importDataAttributes) {
  1349. var option, dataoptions, optionData, p, importOption = function(option, optionData) {
  1350. null !== (optionData = optionData !== undefined ? optionData : npt.getAttribute(dataAttribute + "-" + option)) && ("string" == typeof optionData && (0 === option.indexOf("on") ? optionData = window[optionData] : "false" === optionData ? optionData = !1 : "true" === optionData && (optionData = !0)),
  1351. userOptions[option] = optionData);
  1352. }, attrOptions = npt.getAttribute(dataAttribute);
  1353. if (attrOptions && "" !== attrOptions && (attrOptions = attrOptions.replace(new RegExp("'", "g"), '"'),
  1354. dataoptions = JSON.parse("{" + attrOptions + "}")), dataoptions) {
  1355. optionData = undefined;
  1356. for (p in dataoptions) if ("alias" === p.toLowerCase()) {
  1357. optionData = dataoptions[p];
  1358. break;
  1359. }
  1360. }
  1361. importOption("alias", optionData), userOptions.alias && resolveAlias(userOptions.alias, userOptions, opts);
  1362. for (option in opts) {
  1363. if (dataoptions) {
  1364. optionData = undefined;
  1365. for (p in dataoptions) if (p.toLowerCase() === option.toLowerCase()) {
  1366. optionData = dataoptions[p];
  1367. break;
  1368. }
  1369. }
  1370. importOption(option, optionData);
  1371. }
  1372. }
  1373. return $.extend(!0, opts, userOptions), ("rtl" === npt.dir || opts.rightAlign) && (npt.style.textAlign = "right"),
  1374. ("rtl" === npt.dir || opts.numericInput) && (npt.dir = "ltr", npt.removeAttribute("dir"),
  1375. opts.isRTL = !0), opts;
  1376. }
  1377. var that = this;
  1378. return "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
  1379. elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
  1380. var scopedOpts = $.extend(!0, {}, that.opts);
  1381. importAttributeOptions(el, scopedOpts, $.extend(!0, {}, that.userOptions), that.dataAttribute);
  1382. var maskset = generateMaskSet(scopedOpts, that.noMasksCache);
  1383. maskset !== undefined && (el.inputmask !== undefined && (el.inputmask.opts.autoUnmask = !0,
  1384. el.inputmask.remove()), el.inputmask = new Inputmask(undefined, undefined, !0),
  1385. el.inputmask.opts = scopedOpts, el.inputmask.noMasksCache = that.noMasksCache, el.inputmask.userOptions = $.extend(!0, {}, that.userOptions),
  1386. el.inputmask.isRTL = scopedOpts.isRTL || scopedOpts.numericInput, el.inputmask.el = el,
  1387. el.inputmask.maskset = maskset, $.data(el, "_inputmask_opts", scopedOpts), maskScope.call(el.inputmask, {
  1388. action: "mask"
  1389. }));
  1390. }), elems && elems[0] ? elems[0].inputmask || this : this;
  1391. },
  1392. option: function(options, noremask) {
  1393. return "string" == typeof options ? this.opts[options] : "object" === (void 0 === options ? "undefined" : _typeof(options)) ? ($.extend(this.userOptions, options),
  1394. this.el && !0 !== noremask && this.mask(this.el), this) : void 0;
  1395. },
  1396. unmaskedvalue: function(value) {
  1397. return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
  1398. maskScope.call(this, {
  1399. action: "unmaskedvalue",
  1400. value: value
  1401. });
  1402. },
  1403. remove: function() {
  1404. return maskScope.call(this, {
  1405. action: "remove"
  1406. });
  1407. },
  1408. getemptymask: function() {
  1409. return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
  1410. maskScope.call(this, {
  1411. action: "getemptymask"
  1412. });
  1413. },
  1414. hasMaskedValue: function() {
  1415. return !this.opts.autoUnmask;
  1416. },
  1417. isComplete: function() {
  1418. return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
  1419. maskScope.call(this, {
  1420. action: "isComplete"
  1421. });
  1422. },
  1423. getmetadata: function() {
  1424. return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
  1425. maskScope.call(this, {
  1426. action: "getmetadata"
  1427. });
  1428. },
  1429. isValid: function(value) {
  1430. return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
  1431. maskScope.call(this, {
  1432. action: "isValid",
  1433. value: value
  1434. });
  1435. },
  1436. format: function(value, metadata) {
  1437. return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
  1438. maskScope.call(this, {
  1439. action: "format",
  1440. value: value,
  1441. metadata: metadata
  1442. });
  1443. },
  1444. analyseMask: function(mask, regexMask, opts) {
  1445. function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
  1446. this.matches = [], this.openGroup = isGroup || !1, this.alternatorGroup = !1, this.isGroup = isGroup || !1,
  1447. this.isOptional = isOptional || !1, this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
  1448. this.quantifier = {
  1449. min: 1,
  1450. max: 1
  1451. };
  1452. }
  1453. function insertTestDefinition(mtoken, element, position) {
  1454. position = position !== undefined ? position : mtoken.matches.length;
  1455. var prevMatch = mtoken.matches[position - 1];
  1456. if (regexMask) 0 === element.indexOf("[") || escaped && /\\d|\\s|\\w]/i.test(element) || "." === element ? mtoken.matches.splice(position++, 0, {
  1457. fn: new RegExp(element, opts.casing ? "i" : ""),
  1458. cardinality: 1,
  1459. optionality: mtoken.isOptional,
  1460. newBlockMarker: prevMatch === undefined || prevMatch.def !== element,
  1461. casing: null,
  1462. def: element,
  1463. placeholder: undefined,
  1464. nativeDef: element
  1465. }) : (escaped && (element = element[element.length - 1]), $.each(element.split(""), function(ndx, lmnt) {
  1466. prevMatch = mtoken.matches[position - 1], mtoken.matches.splice(position++, 0, {
  1467. fn: null,
  1468. cardinality: 0,
  1469. optionality: mtoken.isOptional,
  1470. newBlockMarker: prevMatch === undefined || prevMatch.def !== lmnt && null !== prevMatch.fn,
  1471. casing: null,
  1472. def: opts.staticDefinitionSymbol || lmnt,
  1473. placeholder: opts.staticDefinitionSymbol !== undefined ? lmnt : undefined,
  1474. nativeDef: lmnt
  1475. });
  1476. })), escaped = !1; else {
  1477. var maskdef = (opts.definitions ? opts.definitions[element] : undefined) || Inputmask.prototype.definitions[element];
  1478. if (maskdef && !escaped) {
  1479. for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) {
  1480. var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality;
  1481. mtoken.matches.splice(position++, 0, {
  1482. fn: validator ? "string" == typeof validator ? new RegExp(validator, opts.casing ? "i" : "") : new function() {
  1483. this.test = validator;
  1484. }() : new RegExp("."),
  1485. cardinality: cardinality || 1,
  1486. optionality: mtoken.isOptional,
  1487. newBlockMarker: prevMatch === undefined || prevMatch.def !== (maskdef.definitionSymbol || element),
  1488. casing: maskdef.casing,
  1489. def: maskdef.definitionSymbol || element,
  1490. placeholder: maskdef.placeholder,
  1491. nativeDef: element
  1492. }), prevMatch = mtoken.matches[position - 1];
  1493. }
  1494. mtoken.matches.splice(position++, 0, {
  1495. fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator, opts.casing ? "i" : "") : new function() {
  1496. this.test = maskdef.validator;
  1497. }() : new RegExp("."),
  1498. cardinality: maskdef.cardinality,
  1499. optionality: mtoken.isOptional,
  1500. newBlockMarker: prevMatch === undefined || prevMatch.def !== (maskdef.definitionSymbol || element),
  1501. casing: maskdef.casing,
  1502. def: maskdef.definitionSymbol || element,
  1503. placeholder: maskdef.placeholder,
  1504. nativeDef: element
  1505. });
  1506. } else mtoken.matches.splice(position++, 0, {
  1507. fn: null,
  1508. cardinality: 0,
  1509. optionality: mtoken.isOptional,
  1510. newBlockMarker: prevMatch === undefined || prevMatch.def !== element && null !== prevMatch.fn,
  1511. casing: null,
  1512. def: opts.staticDefinitionSymbol || element,
  1513. placeholder: opts.staticDefinitionSymbol !== undefined ? element : undefined,
  1514. nativeDef: element
  1515. }), escaped = !1;
  1516. }
  1517. }
  1518. function verifyGroupMarker(maskToken) {
  1519. maskToken && maskToken.matches && $.each(maskToken.matches, function(ndx, token) {
  1520. var nextToken = maskToken.matches[ndx + 1];
  1521. (nextToken === undefined || nextToken.matches === undefined || !1 === nextToken.isQuantifier) && token && token.isGroup && (token.isGroup = !1,
  1522. regexMask || (insertTestDefinition(token, opts.groupmarker.start, 0), !0 !== token.openGroup && insertTestDefinition(token, opts.groupmarker.end))),
  1523. verifyGroupMarker(token);
  1524. });
  1525. }
  1526. function defaultCase() {
  1527. if (openenings.length > 0) {
  1528. if (currentOpeningToken = openenings[openenings.length - 1], insertTestDefinition(currentOpeningToken, m),
  1529. currentOpeningToken.isAlternator) {
  1530. alternator = openenings.pop();
  1531. for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
  1532. openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
  1533. currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
  1534. }
  1535. } else insertTestDefinition(currentToken, m);
  1536. }
  1537. function reverseTokens(maskToken) {
  1538. maskToken.matches = maskToken.matches.reverse();
  1539. for (var match in maskToken.matches) if (maskToken.matches.hasOwnProperty(match)) {
  1540. var intMatch = parseInt(match);
  1541. if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) {
  1542. var qt = maskToken.matches[match];
  1543. maskToken.matches.splice(match, 1), maskToken.matches.splice(intMatch + 1, 0, qt);
  1544. }
  1545. maskToken.matches[match].matches !== undefined ? maskToken.matches[match] = reverseTokens(maskToken.matches[match]) : maskToken.matches[match] = function(st) {
  1546. return st === opts.optionalmarker.start ? st = opts.optionalmarker.end : st === opts.optionalmarker.end ? st = opts.optionalmarker.start : st === opts.groupmarker.start ? st = opts.groupmarker.end : st === opts.groupmarker.end && (st = opts.groupmarker.start),
  1547. st;
  1548. }(maskToken.matches[match]);
  1549. }
  1550. return maskToken;
  1551. }
  1552. var match, m, openingToken, currentOpeningToken, alternator, lastMatch, groupToken, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g, regexTokenizer = /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g, escaped = !1, currentToken = new MaskToken(), openenings = [], maskTokens = [];
  1553. for (regexMask && (opts.optionalmarker.start = undefined, opts.optionalmarker.end = undefined); match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask); ) {
  1554. if (m = match[0], regexMask) switch (m.charAt(0)) {
  1555. case "?":
  1556. m = "{0,1}";
  1557. break;
  1558. case "+":
  1559. case "*":
  1560. m = "{" + m + "}";
  1561. }
  1562. if (escaped) defaultCase(); else switch (m.charAt(0)) {
  1563. case opts.escapeChar:
  1564. escaped = !0, regexMask && defaultCase();
  1565. break;
  1566. case opts.optionalmarker.end:
  1567. case opts.groupmarker.end:
  1568. if (openingToken = openenings.pop(), openingToken.openGroup = !1, openingToken !== undefined) if (openenings.length > 0) {
  1569. if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
  1570. currentOpeningToken.isAlternator) {
  1571. alternator = openenings.pop();
  1572. for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1,
  1573. alternator.matches[mndx].alternatorGroup = !1;
  1574. openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
  1575. currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
  1576. }
  1577. } else currentToken.matches.push(openingToken); else defaultCase();
  1578. break;
  1579. case opts.optionalmarker.start:
  1580. openenings.push(new MaskToken(!1, !0));
  1581. break;
  1582. case opts.groupmarker.start:
  1583. openenings.push(new MaskToken(!0));
  1584. break;
  1585. case opts.quantifiermarker.start:
  1586. var quantifier = new MaskToken(!1, !1, !0);
  1587. m = m.replace(/[{}]/g, "");
  1588. var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
  1589. if ("*" !== mq1 && "+" !== mq1 || (mq0 = "*" === mq1 ? 0 : 1), quantifier.quantifier = {
  1590. min: mq0,
  1591. max: mq1
  1592. }, openenings.length > 0) {
  1593. var matches = openenings[openenings.length - 1].matches;
  1594. match = matches.pop(), match.isGroup || (groupToken = new MaskToken(!0), groupToken.matches.push(match),
  1595. match = groupToken), matches.push(match), matches.push(quantifier);
  1596. } else match = currentToken.matches.pop(), match.isGroup || (regexMask && null === match.fn && "." === match.def && (match.fn = new RegExp(match.def, opts.casing ? "i" : "")),
  1597. groupToken = new MaskToken(!0), groupToken.matches.push(match), match = groupToken),
  1598. currentToken.matches.push(match), currentToken.matches.push(quantifier);
  1599. break;
  1600. case opts.alternatormarker:
  1601. if (openenings.length > 0) {
  1602. currentOpeningToken = openenings[openenings.length - 1];
  1603. var subToken = currentOpeningToken.matches[currentOpeningToken.matches.length - 1];
  1604. lastMatch = currentOpeningToken.openGroup && (subToken.matches === undefined || !1 === subToken.isGroup && !1 === subToken.isAlternator) ? openenings.pop() : currentOpeningToken.matches.pop();
  1605. } else lastMatch = currentToken.matches.pop();
  1606. if (lastMatch.isAlternator) openenings.push(lastMatch); else if (lastMatch.alternatorGroup ? (alternator = openenings.pop(),
  1607. lastMatch.alternatorGroup = !1) : alternator = new MaskToken(!1, !1, !1, !0), alternator.matches.push(lastMatch),
  1608. openenings.push(alternator), lastMatch.openGroup) {
  1609. lastMatch.openGroup = !1;
  1610. var alternatorGroup = new MaskToken(!0);
  1611. alternatorGroup.alternatorGroup = !0, openenings.push(alternatorGroup);
  1612. }
  1613. break;
  1614. default:
  1615. defaultCase();
  1616. }
  1617. }
  1618. for (;openenings.length > 0; ) openingToken = openenings.pop(), currentToken.matches.push(openingToken);
  1619. return currentToken.matches.length > 0 && (verifyGroupMarker(currentToken), maskTokens.push(currentToken)),
  1620. (opts.numericInput || opts.isRTL) && reverseTokens(maskTokens[0]), maskTokens;
  1621. }
  1622. }, Inputmask.extendDefaults = function(options) {
  1623. $.extend(!0, Inputmask.prototype.defaults, options);
  1624. }, Inputmask.extendDefinitions = function(definition) {
  1625. $.extend(!0, Inputmask.prototype.definitions, definition);
  1626. }, Inputmask.extendAliases = function(alias) {
  1627. $.extend(!0, Inputmask.prototype.aliases, alias);
  1628. }, Inputmask.format = function(value, options, metadata) {
  1629. return Inputmask(options).format(value, metadata);
  1630. }, Inputmask.unmask = function(value, options) {
  1631. return Inputmask(options).unmaskedvalue(value);
  1632. }, Inputmask.isValid = function(value, options) {
  1633. return Inputmask(options).isValid(value);
  1634. }, Inputmask.remove = function(elems) {
  1635. $.each(elems, function(ndx, el) {
  1636. el.inputmask && el.inputmask.remove();
  1637. });
  1638. }, Inputmask.escapeRegex = function(str) {
  1639. var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
  1640. return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
  1641. }, Inputmask.keyCode = {
  1642. ALT: 18,
  1643. BACKSPACE: 8,
  1644. BACKSPACE_SAFARI: 127,
  1645. CAPS_LOCK: 20,
  1646. COMMA: 188,
  1647. COMMAND: 91,
  1648. COMMAND_LEFT: 91,
  1649. COMMAND_RIGHT: 93,
  1650. CONTROL: 17,
  1651. DELETE: 46,
  1652. DOWN: 40,
  1653. END: 35,
  1654. ENTER: 13,
  1655. ESCAPE: 27,
  1656. HOME: 36,
  1657. INSERT: 45,
  1658. LEFT: 37,
  1659. MENU: 93,
  1660. NUMPAD_ADD: 107,
  1661. NUMPAD_DECIMAL: 110,
  1662. NUMPAD_DIVIDE: 111,
  1663. NUMPAD_ENTER: 108,
  1664. NUMPAD_MULTIPLY: 106,
  1665. NUMPAD_SUBTRACT: 109,
  1666. PAGE_DOWN: 34,
  1667. PAGE_UP: 33,
  1668. PERIOD: 190,
  1669. RIGHT: 39,
  1670. SHIFT: 16,
  1671. SPACE: 32,
  1672. TAB: 9,
  1673. UP: 38,
  1674. WINDOWS: 91,
  1675. X: 88
  1676. }, Inputmask;
  1677. });
  1678. }, function(module, exports) {
  1679. module.exports = jQuery;
  1680. }, function(module, exports, __webpack_require__) {
  1681. "use strict";
  1682. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1683. "function" == typeof Symbol && Symbol.iterator;
  1684. !function(factory) {
  1685. __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
  1686. __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  1687. }(function($, Inputmask) {
  1688. function getTokenizer(opts) {
  1689. return opts.tokenizer || (opts.tokenizer = "(" + $.map(formatCode, function(lmnt, ndx) {
  1690. return ndx;
  1691. }).join("|") + ")+|.", opts.tokenizer = new RegExp(opts.tokenizer, "g")), opts.tokenizer;
  1692. }
  1693. function isLeapYear(year) {
  1694. return 29 === new Date(year, 2, 0).getDate();
  1695. }
  1696. function isDateInRange(maskDate, opts) {
  1697. var result = !0;
  1698. return opts.min && opts.min.date.getTime() === opts.min.date.getTime() && (result = result && opts.min.date.getTime() <= maskDate.getTime()),
  1699. opts.max && opts.max.date.getTime() === opts.max.date.getTime() && (result = result && opts.max.date.getTime() >= maskDate.getTime()),
  1700. result;
  1701. }
  1702. function parse(format, opts) {
  1703. for (var match, mask = ""; match = getTokenizer(opts).exec(format); ) mask += formatCode[match[0]] ? "(" + ($.isFunction(formatCode[match[0]]) ? formatCode[match[0]](opts.min, opts.max) : formatCode[match[0]]) + ")" : match[0];
  1704. return mask;
  1705. }
  1706. function analyseMask(maskString, format, opts) {
  1707. function extendYear(year) {
  1708. var correctedyear = 4 === year.length ? year : new Date().getFullYear().toString().substr(0, 4 - year.length) + year;
  1709. return opts.min && opts.min.year && opts.max && opts.max.year ? (correctedyear = correctedyear.replace(/[^0-9]/g, ""),
  1710. correctedyear = year.charAt(0) === opts.max.year.charAt(0) ? year.replace(/[^0-9]/g, "0") : correctedyear + opts.min.year.substr(correctedyear.length)) : correctedyear = correctedyear.replace(/[^0-9]/g, "0"),
  1711. correctedyear;
  1712. }
  1713. var targetProp, match, dateObj = {}, mask = maskString;
  1714. if ("string" == typeof mask) {
  1715. for (;match = getTokenizer(opts).exec(format); ) if ("d" === match[0].charAt(0)) targetProp = "day"; else if ("m" === match[0].charAt(0)) targetProp = "month"; else if ("y" === match[0].charAt(0)) targetProp = "year"; else if ("h" === match[0].charAt(0).toLowerCase()) targetProp = "hour"; else if ("M" === match[0].charAt(0)) targetProp = "minutes"; else if ("s" === match[0].charAt(0)) targetProp = "seconds"; else if (formatCode.hasOwnProperty(match[0])) targetProp = "unmatched"; else {
  1716. var value = mask.split(match[0])[0];
  1717. "year" === targetProp ? (dateObj[targetProp] = extendYear(value), dateObj["raw" + targetProp] = value) : dateObj[targetProp] = opts.min && value.match(/[^0-9]/) ? opts.min[targetProp] : value,
  1718. mask = mask.slice((value + match[0]).length), targetProp = void 0;
  1719. }
  1720. return void 0 !== targetProp && ("year" === targetProp ? (dateObj[targetProp] = extendYear(mask),
  1721. dateObj["raw" + targetProp] = mask) : dateObj[targetProp] = mask.replace(/[^0-9]/g, "0")),
  1722. dateObj.date = new Date(dateObj.year + "-" + dateObj.month + "-" + dateObj.day + "T" + dateObj.hour + ":" + dateObj.minutes + ":" + dateObj.seconds),
  1723. dateObj;
  1724. }
  1725. }
  1726. var formatCode = {
  1727. d: "[1-9]|[12][0-9]|3[01]",
  1728. dd: "0[1-9]|[12][0-9]|3[01]",
  1729. ddd: "",
  1730. dddd: "",
  1731. m: "[1-9]|1[012]",
  1732. mm: "0[1-9]|1[012]",
  1733. mmm: "",
  1734. mmmm: "",
  1735. yy: "[0-9]{2}",
  1736. yyyy: "[0-9]{4}",
  1737. h: "[1-9]|1[0-2]",
  1738. hh: "0[1-9]|1[0-2]",
  1739. H: "1?[1-9]|2[0-4]",
  1740. HH: "[01][1-9]|2[0-4]",
  1741. M: "[1-5]?[0-9]",
  1742. MM: "[0-5][0-9]",
  1743. s: "[1-5]?[0-9]",
  1744. ss: "[0-5][0-9]",
  1745. l: "",
  1746. L: "",
  1747. t: "",
  1748. tt: "",
  1749. T: "",
  1750. TT: "",
  1751. Z: "",
  1752. o: "",
  1753. S: ""
  1754. }, formatAlias = {
  1755. default: "ddd mmm dd yyyy HH:MM:ss",
  1756. shortDate: "m/d/yy",
  1757. mediumDate: "mmm d, yyyy",
  1758. longDate: "mmmm d, yyyy",
  1759. fullDate: "dddd, mmmm d, yyyy",
  1760. shortTime: "h:MM TT",
  1761. mediumTime: "h:MM:ss TT",
  1762. longTime: "h:MM:ss TT Z",
  1763. isoDate: "yyyy-mm-dd",
  1764. isoTime: "HH:MM:ss",
  1765. isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
  1766. isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
  1767. };
  1768. return Inputmask.extendAliases({
  1769. datetime: {
  1770. mask: function(opts) {
  1771. return opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat, opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat,
  1772. opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat,
  1773. opts.placeholder = opts.placeholder !== Inputmask.prototype.defaults.placeholder ? opts.placeholder : opts.inputFormat,
  1774. opts.min = analyseMask(opts.min, opts.inputFormat, opts), opts.max = analyseMask(opts.max, opts.inputFormat, opts),
  1775. opts.regex = parse(opts.inputFormat, opts), console.log(opts.regex), null;
  1776. },
  1777. inputFormat: "dd/mm/yyyy HH:MM",
  1778. displayFormat: void 0,
  1779. outputFormat: void 0,
  1780. min: null,
  1781. max: null,
  1782. postValidation: function(buffer, currentResult, opts) {
  1783. var dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts), result = currentResult;
  1784. return result && isFinite(dateParts.rawyear) && (result = result && ("29" !== dateParts.day || !isLeapYear(dateParts.rawyear))),
  1785. result && dateParts.date.getTime() === dateParts.date.getTime() && (result = result && isDateInRange(dateParts.date, opts)),
  1786. result;
  1787. },
  1788. onKeyDown: function(e, buffer, caretPos, opts) {
  1789. var input = this;
  1790. if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
  1791. for (var match, today = new Date(), date = ""; match = getTokenizer(opts).exec(opts.inputFormat); ) "d" === match[0].charAt(0) ? date += today.getDate().toString() : "m" === match[0].charAt(0) ? date += (today.getMonth() + 1).toString() : "yyyy" === match[0] ? date += today.getFullYear().toString() : "yy" === match[0] && (date += today.getYear().toString());
  1792. input.inputmask._valueSet(date), $(input).trigger("setvalue");
  1793. }
  1794. },
  1795. insertMode: !1
  1796. }
  1797. }), Inputmask;
  1798. });
  1799. }, function(module, exports, __webpack_require__) {
  1800. "use strict";
  1801. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1802. "function" == typeof Symbol && Symbol.iterator;
  1803. !function(factory) {
  1804. __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
  1805. __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  1806. }(function($, Inputmask) {
  1807. return Inputmask.extendDefinitions({
  1808. A: {
  1809. validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
  1810. cardinality: 1,
  1811. casing: "upper"
  1812. },
  1813. "&": {
  1814. validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
  1815. cardinality: 1,
  1816. casing: "upper"
  1817. },
  1818. "#": {
  1819. validator: "[0-9A-Fa-f]",
  1820. cardinality: 1,
  1821. casing: "upper"
  1822. }
  1823. }), Inputmask.extendAliases({
  1824. url: {
  1825. definitions: {
  1826. i: {
  1827. validator: ".",
  1828. cardinality: 1
  1829. }
  1830. },
  1831. mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
  1832. insertMode: !1,
  1833. autoUnmask: !1,
  1834. inputmode: "url"
  1835. },
  1836. ip: {
  1837. mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
  1838. definitions: {
  1839. i: {
  1840. validator: function(chrs, maskset, pos, strict, opts) {
  1841. return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
  1842. chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
  1843. new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
  1844. },
  1845. cardinality: 1
  1846. }
  1847. },
  1848. onUnMask: function(maskedValue, unmaskedValue, opts) {
  1849. return maskedValue;
  1850. },
  1851. inputmode: "numeric"
  1852. },
  1853. email: {
  1854. mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
  1855. greedy: !1,
  1856. onBeforePaste: function(pastedValue, opts) {
  1857. return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
  1858. },
  1859. definitions: {
  1860. "*": {
  1861. validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
  1862. cardinality: 1,
  1863. casing: "lower"
  1864. },
  1865. "-": {
  1866. validator: "[0-9A-Za-z-]",
  1867. cardinality: 1,
  1868. casing: "lower"
  1869. }
  1870. },
  1871. onUnMask: function(maskedValue, unmaskedValue, opts) {
  1872. return maskedValue;
  1873. },
  1874. inputmode: "email"
  1875. },
  1876. mac: {
  1877. mask: "##:##:##:##:##:##"
  1878. },
  1879. vin: {
  1880. mask: "V{13}9{4}",
  1881. definitions: {
  1882. V: {
  1883. validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
  1884. cardinality: 1,
  1885. casing: "upper"
  1886. }
  1887. },
  1888. clearIncomplete: !0,
  1889. autoUnmask: !0
  1890. }
  1891. }), Inputmask;
  1892. });
  1893. }, function(module, exports, __webpack_require__) {
  1894. "use strict";
  1895. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1896. "function" == typeof Symbol && Symbol.iterator;
  1897. !function(factory) {
  1898. __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
  1899. __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  1900. }(function($, Inputmask, undefined) {
  1901. function autoEscape(txt, opts) {
  1902. for (var escapedTxt = "", i = 0; i < txt.length; i++) Inputmask.prototype.definitions[txt.charAt(i)] || opts.definitions[txt.charAt(i)] || opts.optionalmarker.start === txt.charAt(i) || opts.optionalmarker.end === txt.charAt(i) || opts.quantifiermarker.start === txt.charAt(i) || opts.quantifiermarker.end === txt.charAt(i) || opts.groupmarker.start === txt.charAt(i) || opts.groupmarker.end === txt.charAt(i) || opts.alternatormarker === txt.charAt(i) ? escapedTxt += "\\" + txt.charAt(i) : escapedTxt += txt.charAt(i);
  1903. return escapedTxt;
  1904. }
  1905. return Inputmask.extendAliases({
  1906. numeric: {
  1907. mask: function(opts) {
  1908. if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
  1909. opts.repeat = 0, opts.groupSeparator === opts.radixPoint && opts.digits && "0" !== opts.digits && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""),
  1910. " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = undefined), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator,
  1911. opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)),
  1912. isFinite(opts.integerDigits))) {
  1913. var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
  1914. opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps),
  1915. opts.integerDigits < 1 && (opts.integerDigits = "*");
  1916. }
  1917. opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)),
  1918. "radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && !1 === opts.integerOptional && (opts.positionCaretOnClick = "lvp"),
  1919. opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~",
  1920. !0 === opts.numericInput && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick,
  1921. opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts.decimalProtect = !1);
  1922. var mask = "[+]";
  1923. if (mask += autoEscape(opts.prefix, opts), !0 === opts.integerOptional ? mask += "~{1," + opts.integerDigits + "}" : mask += "~{" + opts.integerDigits + "}",
  1924. opts.digits !== undefined) {
  1925. opts.radixPointDefinitionSymbol = opts.decimalProtect ? ":" : opts.radixPoint;
  1926. var dq = opts.digits.toString().split(",");
  1927. isFinite(dq[0] && dq[1] && isFinite(dq[1])) ? mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}" : (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.digitsOptional ? mask += "[" + opts.radixPointDefinitionSymbol + ";{1," + opts.digits + "}]" : mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}");
  1928. }
  1929. return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask;
  1930. },
  1931. placeholder: "",
  1932. greedy: !1,
  1933. digits: "*",
  1934. digitsOptional: !0,
  1935. enforceDigitsOnBlur: !1,
  1936. radixPoint: ".",
  1937. positionCaretOnClick: "radixFocus",
  1938. groupSize: 3,
  1939. groupSeparator: "",
  1940. autoGroup: !1,
  1941. allowMinus: !0,
  1942. negationSymbol: {
  1943. front: "-",
  1944. back: ""
  1945. },
  1946. integerDigits: "+",
  1947. integerOptional: !0,
  1948. prefix: "",
  1949. suffix: "",
  1950. rightAlign: !0,
  1951. decimalProtect: !0,
  1952. min: null,
  1953. max: null,
  1954. step: 1,
  1955. insertMode: !0,
  1956. autoUnmask: !1,
  1957. unmaskAsNumber: !1,
  1958. inputmode: "numeric",
  1959. preValidation: function(buffer, pos, c, isSelection, opts) {
  1960. if ("-" === c || c === opts.negationSymbol.front) return !0 === opts.allowMinus && (opts.isNegative = opts.isNegative === undefined || !opts.isNegative,
  1961. "" === buffer.join("") || {
  1962. caret: pos,
  1963. dopost: !0
  1964. });
  1965. if (!1 === isSelection && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
  1966. var radixPos = $.inArray(opts.radixPoint, buffer);
  1967. if (-1 !== radixPos) return !0 === opts.numericInput ? pos === radixPos : {
  1968. caret: radixPos + 1
  1969. };
  1970. }
  1971. return !0;
  1972. },
  1973. postValidation: function(buffer, currentResult, opts) {
  1974. var suffix = opts.suffix.split(""), prefix = opts.prefix.split("");
  1975. if (currentResult.pos === undefined && currentResult.caret !== undefined && !0 !== currentResult.dopost) return currentResult;
  1976. var caretPos = currentResult.caret !== undefined ? currentResult.caret : currentResult.pos, maskedValue = buffer.slice();
  1977. opts.numericInput && (caretPos = maskedValue.length - caretPos - 1, maskedValue = maskedValue.reverse());
  1978. var charAtPos = maskedValue[caretPos];
  1979. if (charAtPos === opts.groupSeparator && (caretPos += 1, charAtPos = maskedValue[caretPos]),
  1980. caretPos === maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult;
  1981. charAtPos !== undefined && charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (maskedValue[caretPos] = "?",
  1982. opts.prefix.length > 0 && caretPos >= (!1 === opts.isNegative ? 1 : 0) && caretPos < opts.prefix.length - 1 + (!1 === opts.isNegative ? 1 : 0) ? prefix[caretPos - (!1 === opts.isNegative ? 1 : 0)] = "?" : opts.suffix.length > 0 && caretPos >= maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0) && (suffix[caretPos - (maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0))] = "?")),
  1983. prefix = prefix.join(""), suffix = suffix.join("");
  1984. var processValue = maskedValue.join("").replace(prefix, "");
  1985. if (processValue = processValue.replace(suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  1986. processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
  1987. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
  1988. isNaN(opts.placeholder) && (processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "")),
  1989. processValue.length > 1 && 1 !== processValue.indexOf(opts.radixPoint) && ("0" === charAtPos && (processValue = processValue.replace(/^\?/g, "")),
  1990. processValue = processValue.replace(/^0/g, "")), processValue.charAt(0) === opts.radixPoint && "" !== opts.radixPoint && !0 !== opts.numericInput && (processValue = "0" + processValue),
  1991. "" !== processValue) {
  1992. if (processValue = processValue.split(""), (!opts.digitsOptional || opts.enforceDigitsOnBlur && "blur" === currentResult.event) && isFinite(opts.digits)) {
  1993. var radixPosition = $.inArray(opts.radixPoint, processValue), rpb = $.inArray(opts.radixPoint, maskedValue);
  1994. -1 === radixPosition && (processValue.push(opts.radixPoint), radixPosition = processValue.length - 1);
  1995. for (var i = 1; i <= opts.digits; i++) opts.digitsOptional && (!opts.enforceDigitsOnBlur || "blur" !== currentResult.event) || processValue[radixPosition + i] !== undefined && processValue[radixPosition + i] !== opts.placeholder.charAt(0) ? -1 !== rpb && maskedValue[rpb + i] !== undefined && (processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i]) : processValue[radixPosition + i] = currentResult.placeholder || opts.placeholder.charAt(0);
  1996. }
  1997. if (!0 !== opts.autoGroup || "" === opts.groupSeparator || charAtPos === opts.radixPoint && currentResult.pos === undefined && !currentResult.dopost) processValue = processValue.join(""); else {
  1998. var addRadix = processValue[processValue.length - 1] === opts.radixPoint && currentResult.c === opts.radixPoint;
  1999. processValue = Inputmask(function(buffer, opts) {
  2000. var postMask = "";
  2001. if (postMask += "(" + opts.groupSeparator + "*{" + opts.groupSize + "}){*}", "" !== opts.radixPoint) {
  2002. var radixSplit = buffer.join("").split(opts.radixPoint);
  2003. radixSplit[1] && (postMask += opts.radixPoint + "*{" + radixSplit[1].match(/^\d*\??\d*/)[0].length + "}");
  2004. }
  2005. return postMask;
  2006. }(processValue, opts), {
  2007. numericInput: !0,
  2008. jitMasking: !0,
  2009. definitions: {
  2010. "*": {
  2011. validator: "[0-9?]",
  2012. cardinality: 1
  2013. }
  2014. }
  2015. }).format(processValue.join("")), addRadix && (processValue += opts.radixPoint),
  2016. processValue.charAt(0) === opts.groupSeparator && processValue.substr(1);
  2017. }
  2018. }
  2019. if (opts.isNegative && "blur" === currentResult.event && (opts.isNegative = "0" !== processValue),
  2020. processValue = prefix + processValue, processValue += suffix, opts.isNegative && (processValue = opts.negationSymbol.front + processValue,
  2021. processValue += opts.negationSymbol.back), processValue = processValue.split(""),
  2022. charAtPos !== undefined) if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) caretPos = $.inArray("?", processValue),
  2023. caretPos > -1 ? processValue[caretPos] = charAtPos : caretPos = currentResult.caret || 0; else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) {
  2024. var newCaretPos = $.inArray(charAtPos, processValue);
  2025. -1 !== newCaretPos && (caretPos = newCaretPos);
  2026. }
  2027. opts.numericInput && (caretPos = processValue.length - caretPos - 1, processValue = processValue.reverse());
  2028. var rslt = {
  2029. caret: charAtPos === undefined || currentResult.pos !== undefined ? caretPos + (opts.numericInput ? -1 : 1) : caretPos,
  2030. buffer: processValue,
  2031. refreshFromBuffer: currentResult.dopost || buffer.join("") !== processValue.join("")
  2032. };
  2033. return rslt.refreshFromBuffer ? rslt : currentResult;
  2034. },
  2035. onBeforeWrite: function(e, buffer, caretPos, opts) {
  2036. if (e) switch (e.type) {
  2037. case "keydown":
  2038. return opts.postValidation(buffer, {
  2039. caret: caretPos,
  2040. dopost: !0
  2041. }, opts);
  2042. case "blur":
  2043. case "checkval":
  2044. var unmasked;
  2045. if (function(opts) {
  2046. opts.parseMinMaxOptions === undefined && (null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  2047. "," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, ".")),
  2048. opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN, isNaN(opts.min) && (opts.min = Number.MIN_VALUE)),
  2049. null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  2050. "," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, ".")),
  2051. opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN, isNaN(opts.max) && (opts.max = Number.MAX_VALUE)),
  2052. opts.parseMinMaxOptions = "done");
  2053. }(opts), null !== opts.min || null !== opts.max) {
  2054. if (unmasked = opts.onUnMask(buffer.join(""), undefined, $.extend({}, opts, {
  2055. unmaskAsNumber: !0
  2056. })), null !== opts.min && unmasked < opts.min) return opts.isNegative = opts.min < 0,
  2057. opts.postValidation(opts.min.toString().replace(".", opts.radixPoint).split(""), {
  2058. caret: caretPos,
  2059. dopost: !0,
  2060. placeholder: "0"
  2061. }, opts);
  2062. if (null !== opts.max && unmasked > opts.max) return opts.isNegative = opts.max < 0,
  2063. opts.postValidation(opts.max.toString().replace(".", opts.radixPoint).split(""), {
  2064. caret: caretPos,
  2065. dopost: !0,
  2066. placeholder: "0"
  2067. }, opts);
  2068. }
  2069. return opts.postValidation(buffer, {
  2070. caret: caretPos,
  2071. placeholder: "0",
  2072. event: "blur"
  2073. }, opts);
  2074. case "_checkval":
  2075. return {
  2076. caret: caretPos
  2077. };
  2078. }
  2079. },
  2080. regex: {
  2081. integerPart: function(opts, emptyCheck) {
  2082. return emptyCheck ? new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?") : new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+");
  2083. },
  2084. integerNPart: function(opts) {
  2085. return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+");
  2086. }
  2087. },
  2088. definitions: {
  2089. "~": {
  2090. validator: function(chrs, maskset, pos, strict, opts, isSelection) {
  2091. var isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
  2092. if (!0 === isValid) {
  2093. if (!0 !== opts.numericInput && maskset.validPositions[pos] !== undefined && "~" === maskset.validPositions[pos].match.def && !isSelection) {
  2094. var processValue = maskset.buffer.join("");
  2095. processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
  2096. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
  2097. var pvRadixSplit = processValue.split(opts.radixPoint);
  2098. pvRadixSplit.length > 1 && (pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0))),
  2099. "0" === pvRadixSplit[0] && (pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0))),
  2100. processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || "";
  2101. var bufferTemplate = maskset._buffer.join("");
  2102. for (processValue === opts.radixPoint && (processValue = bufferTemplate); null === processValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
  2103. processValue = processValue.replace(bufferTemplate, ""), processValue = processValue.split(""),
  2104. isValid = processValue[pos] === undefined ? {
  2105. pos: pos,
  2106. remove: pos
  2107. } : {
  2108. pos: pos
  2109. };
  2110. }
  2111. } else strict || chrs !== opts.radixPoint || maskset.validPositions[pos - 1] !== undefined || (maskset.buffer[pos] = "0",
  2112. isValid = {
  2113. pos: pos + 1
  2114. });
  2115. return isValid;
  2116. },
  2117. cardinality: 1
  2118. },
  2119. "+": {
  2120. validator: function(chrs, maskset, pos, strict, opts) {
  2121. return opts.allowMinus && ("-" === chrs || chrs === opts.negationSymbol.front);
  2122. },
  2123. cardinality: 1,
  2124. placeholder: ""
  2125. },
  2126. "-": {
  2127. validator: function(chrs, maskset, pos, strict, opts) {
  2128. return opts.allowMinus && chrs === opts.negationSymbol.back;
  2129. },
  2130. cardinality: 1,
  2131. placeholder: ""
  2132. },
  2133. ":": {
  2134. validator: function(chrs, maskset, pos, strict, opts) {
  2135. var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]", isValid = new RegExp(radix).test(chrs);
  2136. return isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = {
  2137. caret: pos + 1
  2138. }), isValid;
  2139. },
  2140. cardinality: 1,
  2141. placeholder: function(opts) {
  2142. return opts.radixPoint;
  2143. }
  2144. }
  2145. },
  2146. onUnMask: function(maskedValue, unmaskedValue, opts) {
  2147. if ("" === unmaskedValue && !0 === opts.nullable) return unmaskedValue;
  2148. var processValue = maskedValue.replace(opts.prefix, "");
  2149. return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  2150. "" !== opts.placeholder.charAt(0) && (processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0")),
  2151. opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
  2152. processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
  2153. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
  2154. Number(processValue)) : processValue;
  2155. },
  2156. isComplete: function(buffer, opts) {
  2157. var maskedValue = buffer.join("");
  2158. if (buffer.slice().join("") !== maskedValue) return !1;
  2159. var processValue = maskedValue.replace(opts.prefix, "");
  2160. return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  2161. "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
  2162. isFinite(processValue);
  2163. },
  2164. onBeforeMask: function(initialValue, opts) {
  2165. if (opts.isNegative = undefined, initialValue = initialValue.toString().charAt(initialValue.length - 1) === opts.radixPoint ? initialValue.toString().substr(0, initialValue.length - 1) : initialValue.toString(),
  2166. "" !== opts.radixPoint && isFinite(initialValue)) {
  2167. var vs = initialValue.split("."), groupSize = "" !== opts.groupSeparator ? parseInt(opts.groupSize) : 0;
  2168. 2 === vs.length && (vs[0].length > groupSize || vs[1].length > groupSize || vs[0].length <= groupSize && vs[1].length < groupSize) && (initialValue = initialValue.replace(".", opts.radixPoint));
  2169. }
  2170. var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
  2171. if (dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
  2172. initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
  2173. initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  2174. 0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
  2175. "" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
  2176. var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
  2177. if (parseInt(opts.digits) < decPart.toString().length) {
  2178. var digitsFactor = Math.pow(10, parseInt(opts.digits));
  2179. initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."),
  2180. initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor,
  2181. initialValue = initialValue.toString().replace(".", opts.radixPoint);
  2182. }
  2183. }
  2184. return initialValue;
  2185. },
  2186. canClearPosition: function(maskset, position, lvp, strict, opts) {
  2187. var vp = maskset.validPositions[position], canClear = vp.input !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && !1 === opts.decimalProtect || vp.input === opts.radixPoint && maskset.validPositions[position + 1] && null === maskset.validPositions[position + 1].match.fn || isFinite(vp.input) || position === lvp || vp.input === opts.groupSeparator || vp.input === opts.negationSymbol.front || vp.input === opts.negationSymbol.back;
  2188. return !canClear || "+" !== vp.match.nativeDef && "-" !== vp.match.nativeDef || (opts.isNegative = !1),
  2189. canClear;
  2190. },
  2191. onKeyDown: function(e, buffer, caretPos, opts) {
  2192. var $input = $(this);
  2193. if (e.ctrlKey) switch (e.keyCode) {
  2194. case Inputmask.keyCode.UP:
  2195. $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), $input.trigger("setvalue");
  2196. break;
  2197. case Inputmask.keyCode.DOWN:
  2198. $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), $input.trigger("setvalue");
  2199. }
  2200. }
  2201. },
  2202. currency: {
  2203. prefix: "$ ",
  2204. groupSeparator: ",",
  2205. alias: "numeric",
  2206. placeholder: "0",
  2207. autoGroup: !0,
  2208. digits: 2,
  2209. digitsOptional: !1,
  2210. clearMaskOnLostFocus: !1
  2211. },
  2212. decimal: {
  2213. alias: "numeric"
  2214. },
  2215. integer: {
  2216. alias: "numeric",
  2217. digits: 0,
  2218. radixPoint: ""
  2219. },
  2220. percentage: {
  2221. alias: "numeric",
  2222. digits: 2,
  2223. digitsOptional: !0,
  2224. radixPoint: ".",
  2225. placeholder: "0",
  2226. autoGroup: !1,
  2227. min: 0,
  2228. max: 100,
  2229. suffix: " %",
  2230. allowMinus: !1
  2231. }
  2232. }), Inputmask;
  2233. });
  2234. }, function(module, exports, __webpack_require__) {
  2235. "use strict";
  2236. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  2237. "function" == typeof Symbol && Symbol.iterator;
  2238. !function(factory) {
  2239. __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
  2240. __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  2241. }(function($, Inputmask) {
  2242. function maskSort(a, b) {
  2243. var maska = (a.mask || a).replace(/#/g, "9").replace(/\)/, "9").replace(/[+()#-]/g, ""), maskb = (b.mask || b).replace(/#/g, "9").replace(/\)/, "9").replace(/[+()#-]/g, ""), maskas = (a.mask || a).split("#")[0], maskbs = (b.mask || b).split("#")[0];
  2244. return 0 === maskbs.indexOf(maskas) ? -1 : 0 === maskas.indexOf(maskbs) ? 1 : maska.localeCompare(maskb);
  2245. }
  2246. var analyseMaskBase = Inputmask.prototype.analyseMask;
  2247. return Inputmask.prototype.analyseMask = function(mask, regexMask, opts) {
  2248. function reduceVariations(masks, previousVariation, previousmaskGroup) {
  2249. previousVariation = previousVariation || "", previousmaskGroup = previousmaskGroup || maskGroups,
  2250. "" !== previousVariation && (previousmaskGroup[previousVariation] = {});
  2251. for (var variation = "", maskGroup = previousmaskGroup[previousVariation] || previousmaskGroup, i = masks.length - 1; i >= 0; i--) mask = masks[i].mask || masks[i],
  2252. variation = mask.substr(0, 1), maskGroup[variation] = maskGroup[variation] || [],
  2253. maskGroup[variation].unshift(mask.substr(1)), masks.splice(i, 1);
  2254. for (var ndx in maskGroup) maskGroup[ndx].length > 500 && reduceVariations(maskGroup[ndx].slice(), ndx, maskGroup);
  2255. }
  2256. function rebuild(maskGroup) {
  2257. var mask = "", submasks = [];
  2258. for (var ndx in maskGroup) $.isArray(maskGroup[ndx]) ? 1 === maskGroup[ndx].length ? submasks.push(ndx + maskGroup[ndx]) : submasks.push(ndx + opts.groupmarker.start + maskGroup[ndx].join(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start) + opts.groupmarker.end) : submasks.push(ndx + rebuild(maskGroup[ndx]));
  2259. return 1 === submasks.length ? mask += submasks[0] : mask += opts.groupmarker.start + submasks.join(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start) + opts.groupmarker.end,
  2260. mask;
  2261. }
  2262. var maskGroups = {};
  2263. return opts.phoneCodes && (opts.phoneCodes && opts.phoneCodes.length > 1e3 && (mask = mask.substr(1, mask.length - 2),
  2264. reduceVariations(mask.split(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start)),
  2265. mask = rebuild(maskGroups)), mask = mask.replace(/9/g, "\\9")), analyseMaskBase.call(this, mask, regexMask, opts);
  2266. }, Inputmask.extendAliases({
  2267. abstractphone: {
  2268. groupmarker: {
  2269. start: "<",
  2270. end: ">"
  2271. },
  2272. countrycode: "",
  2273. phoneCodes: [],
  2274. mask: function(opts) {
  2275. return opts.definitions = {
  2276. "#": Inputmask.prototype.definitions[9]
  2277. }, opts.phoneCodes.sort(maskSort);
  2278. },
  2279. keepStatic: !0,
  2280. onBeforeMask: function(value, opts) {
  2281. var processedValue = value.replace(/^0{1,2}/, "").replace(/[\s]/g, "");
  2282. return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue),
  2283. processedValue;
  2284. },
  2285. onUnMask: function(maskedValue, unmaskedValue, opts) {
  2286. return maskedValue.replace(/[()#-]/g, "");
  2287. },
  2288. inputmode: "tel"
  2289. }
  2290. }), Inputmask;
  2291. });
  2292. }, function(module, exports, __webpack_require__) {
  2293. "use strict";
  2294. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
  2295. return typeof obj;
  2296. } : function(obj) {
  2297. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  2298. };
  2299. !function(factory) {
  2300. __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2), __webpack_require__(1) ],
  2301. __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  2302. }(function($, Inputmask) {
  2303. return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
  2304. var nptmask, input = this[0];
  2305. if (void 0 === options && (options = {}), "string" == typeof fn) switch (fn) {
  2306. case "unmaskedvalue":
  2307. return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
  2308. case "remove":
  2309. return this.each(function() {
  2310. this.inputmask && this.inputmask.remove();
  2311. });
  2312. case "getemptymask":
  2313. return input && input.inputmask ? input.inputmask.getemptymask() : "";
  2314. case "hasMaskedValue":
  2315. return !(!input || !input.inputmask) && input.inputmask.hasMaskedValue();
  2316. case "isComplete":
  2317. return !input || !input.inputmask || input.inputmask.isComplete();
  2318. case "getmetadata":
  2319. return input && input.inputmask ? input.inputmask.getmetadata() : void 0;
  2320. case "setvalue":
  2321. $(input).val(options), input && void 0 === input.inputmask && $(input).triggerHandler("setvalue");
  2322. break;
  2323. case "option":
  2324. if ("string" != typeof options) return this.each(function() {
  2325. if (void 0 !== this.inputmask) return this.inputmask.option(options);
  2326. });
  2327. if (input && void 0 !== input.inputmask) return input.inputmask.option(options);
  2328. break;
  2329. default:
  2330. return options.alias = fn, nptmask = new Inputmask(options), this.each(function() {
  2331. nptmask.mask(this);
  2332. });
  2333. } else {
  2334. if ("object" == (void 0 === fn ? "undefined" : _typeof(fn))) return nptmask = new Inputmask(fn),
  2335. void 0 === fn.mask && void 0 === fn.alias ? this.each(function() {
  2336. if (void 0 !== this.inputmask) return this.inputmask.option(fn);
  2337. nptmask.mask(this);
  2338. }) : this.each(function() {
  2339. nptmask.mask(this);
  2340. });
  2341. if (void 0 === fn) return this.each(function() {
  2342. nptmask = new Inputmask(options), nptmask.mask(this);
  2343. });
  2344. }
  2345. }), $.fn.inputmask;
  2346. });
  2347. }, function(module, exports, __webpack_require__) {
  2348. var content = __webpack_require__(12);
  2349. "string" == typeof content && (content = [ [ module.i, content, "" ] ]);
  2350. __webpack_require__(14)(content, {});
  2351. content.locals && (module.exports = content.locals);
  2352. }, function(module, exports, __webpack_require__) {
  2353. "use strict";
  2354. function _interopRequireDefault(obj) {
  2355. return obj && obj.__esModule ? obj : {
  2356. default: obj
  2357. };
  2358. }
  2359. __webpack_require__(8), __webpack_require__(3), __webpack_require__(4), __webpack_require__(5),
  2360. __webpack_require__(6);
  2361. var _inputmask = __webpack_require__(1), _inputmask2 = _interopRequireDefault(_inputmask), _inputmask3 = __webpack_require__(0), _inputmask4 = _interopRequireDefault(_inputmask3), _jquery = __webpack_require__(2), _jquery2 = _interopRequireDefault(_jquery);
  2362. _inputmask4.default === _jquery2.default && __webpack_require__(7), window.Inputmask = _inputmask2.default;
  2363. }, function(module, exports, __webpack_require__) {
  2364. "use strict";
  2365. var __WEBPACK_AMD_DEFINE_RESULT__;
  2366. "function" == typeof Symbol && Symbol.iterator;
  2367. void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function() {
  2368. return document;
  2369. }.call(exports, __webpack_require__, exports, module)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  2370. }, function(module, exports, __webpack_require__) {
  2371. "use strict";
  2372. var __WEBPACK_AMD_DEFINE_RESULT__;
  2373. "function" == typeof Symbol && Symbol.iterator;
  2374. void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function() {
  2375. return window;
  2376. }.call(exports, __webpack_require__, exports, module)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
  2377. }, function(module, exports, __webpack_require__) {
  2378. exports = module.exports = __webpack_require__(13)(void 0), exports.push([ module.i, "span.im-caret {\r\n -webkit-animation: 1s blink step-end infinite;\r\n animation: 1s blink step-end infinite;\r\n}\r\n\r\n@keyframes blink {\r\n from, to {\r\n border-right-color: black;\r\n }\r\n 50% {\r\n border-right-color: transparent;\r\n }\r\n}\r\n\r\n@-webkit-keyframes blink {\r\n from, to {\r\n border-right-color: black;\r\n }\r\n 50% {\r\n border-right-color: transparent;\r\n }\r\n}\r\n\r\nspan.im-static {\r\n color: grey;\r\n}\r\n\r\ndiv.im-colormask {\r\n display: inline-block;\r\n border-style: inset;\r\n border-width: 2px;\r\n -webkit-appearance: textfield;\r\n -moz-appearance: textfield;\r\n appearance: textfield;\r\n}\r\n\r\ndiv.im-colormask > input {\r\n position: absolute;\r\n display: inline-block;\r\n background-color: transparent;\r\n color: transparent;\r\n -webkit-appearance: caret;\r\n -moz-appearance: caret;\r\n appearance: caret;\r\n border-style: none;\r\n left: 0; /*calculated*/\r\n}\r\n\r\ndiv.im-colormask > input:focus {\r\n outline: none;\r\n}\r\n\r\ndiv.im-colormask > input::-moz-selection{\r\n background: none;\r\n}\r\n\r\ndiv.im-colormask > input::selection{\r\n background: none;\r\n}\r\ndiv.im-colormask > input::-moz-selection{\r\n background: none;\r\n}\r\n\r\ndiv.im-colormask > div {\r\n color: black;\r\n display: inline-block;\r\n width: 100px; /*calculated*/\r\n}", "" ]);
  2379. }, function(module, exports) {
  2380. function cssWithMappingToString(item, useSourceMap) {
  2381. var content = item[1] || "", cssMapping = item[3];
  2382. if (!cssMapping) return content;
  2383. if (useSourceMap && "function" == typeof btoa) {
  2384. var sourceMapping = toComment(cssMapping), sourceURLs = cssMapping.sources.map(function(source) {
  2385. return "/*# sourceURL=" + cssMapping.sourceRoot + source + " */";
  2386. });
  2387. return [ content ].concat(sourceURLs).concat([ sourceMapping ]).join("\n");
  2388. }
  2389. return [ content ].join("\n");
  2390. }
  2391. function toComment(sourceMap) {
  2392. return "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  2393. }
  2394. module.exports = function(useSourceMap) {
  2395. var list = [];
  2396. return list.toString = function() {
  2397. return this.map(function(item) {
  2398. var content = cssWithMappingToString(item, useSourceMap);
  2399. return item[2] ? "@media " + item[2] + "{" + content + "}" : content;
  2400. }).join("");
  2401. }, list.i = function(modules, mediaQuery) {
  2402. "string" == typeof modules && (modules = [ [ null, modules, "" ] ]);
  2403. for (var alreadyImportedModules = {}, i = 0; i < this.length; i++) {
  2404. var id = this[i][0];
  2405. "number" == typeof id && (alreadyImportedModules[id] = !0);
  2406. }
  2407. for (i = 0; i < modules.length; i++) {
  2408. var item = modules[i];
  2409. "number" == typeof item[0] && alreadyImportedModules[item[0]] || (mediaQuery && !item[2] ? item[2] = mediaQuery : mediaQuery && (item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"),
  2410. list.push(item));
  2411. }
  2412. }, list;
  2413. };
  2414. }, function(module, exports, __webpack_require__) {
  2415. function addStylesToDom(styles, options) {
  2416. for (var i = 0; i < styles.length; i++) {
  2417. var item = styles[i], domStyle = stylesInDom[item.id];
  2418. if (domStyle) {
  2419. domStyle.refs++;
  2420. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](item.parts[j]);
  2421. for (;j < item.parts.length; j++) domStyle.parts.push(addStyle(item.parts[j], options));
  2422. } else {
  2423. for (var parts = [], j = 0; j < item.parts.length; j++) parts.push(addStyle(item.parts[j], options));
  2424. stylesInDom[item.id] = {
  2425. id: item.id,
  2426. refs: 1,
  2427. parts: parts
  2428. };
  2429. }
  2430. }
  2431. }
  2432. function listToStyles(list) {
  2433. for (var styles = [], newStyles = {}, i = 0; i < list.length; i++) {
  2434. var item = list[i], id = item[0], css = item[1], media = item[2], sourceMap = item[3], part = {
  2435. css: css,
  2436. media: media,
  2437. sourceMap: sourceMap
  2438. };
  2439. newStyles[id] ? newStyles[id].parts.push(part) : styles.push(newStyles[id] = {
  2440. id: id,
  2441. parts: [ part ]
  2442. });
  2443. }
  2444. return styles;
  2445. }
  2446. function insertStyleElement(options, styleElement) {
  2447. var styleTarget = getElement(options.insertInto);
  2448. if (!styleTarget) throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  2449. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  2450. if ("top" === options.insertAt) lastStyleElementInsertedAtTop ? lastStyleElementInsertedAtTop.nextSibling ? styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling) : styleTarget.appendChild(styleElement) : styleTarget.insertBefore(styleElement, styleTarget.firstChild),
  2451. styleElementsInsertedAtTop.push(styleElement); else {
  2452. if ("bottom" !== options.insertAt) throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  2453. styleTarget.appendChild(styleElement);
  2454. }
  2455. }
  2456. function removeStyleElement(styleElement) {
  2457. styleElement.parentNode.removeChild(styleElement);
  2458. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  2459. idx >= 0 && styleElementsInsertedAtTop.splice(idx, 1);
  2460. }
  2461. function createStyleElement(options) {
  2462. var styleElement = document.createElement("style");
  2463. return options.attrs.type = "text/css", attachTagAttrs(styleElement, options.attrs),
  2464. insertStyleElement(options, styleElement), styleElement;
  2465. }
  2466. function createLinkElement(options) {
  2467. var linkElement = document.createElement("link");
  2468. return options.attrs.type = "text/css", options.attrs.rel = "stylesheet", attachTagAttrs(linkElement, options.attrs),
  2469. insertStyleElement(options, linkElement), linkElement;
  2470. }
  2471. function attachTagAttrs(element, attrs) {
  2472. Object.keys(attrs).forEach(function(key) {
  2473. element.setAttribute(key, attrs[key]);
  2474. });
  2475. }
  2476. function addStyle(obj, options) {
  2477. var styleElement, update, remove;
  2478. if (options.singleton) {
  2479. var styleIndex = singletonCounter++;
  2480. styleElement = singletonElement || (singletonElement = createStyleElement(options)),
  2481. update = applyToSingletonTag.bind(null, styleElement, styleIndex, !1), remove = applyToSingletonTag.bind(null, styleElement, styleIndex, !0);
  2482. } else obj.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (styleElement = createLinkElement(options),
  2483. update = updateLink.bind(null, styleElement, options), remove = function() {
  2484. removeStyleElement(styleElement), styleElement.href && URL.revokeObjectURL(styleElement.href);
  2485. }) : (styleElement = createStyleElement(options), update = applyToTag.bind(null, styleElement),
  2486. remove = function() {
  2487. removeStyleElement(styleElement);
  2488. });
  2489. return update(obj), function(newObj) {
  2490. if (newObj) {
  2491. if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return;
  2492. update(obj = newObj);
  2493. } else remove();
  2494. };
  2495. }
  2496. function applyToSingletonTag(styleElement, index, remove, obj) {
  2497. var css = remove ? "" : obj.css;
  2498. if (styleElement.styleSheet) styleElement.styleSheet.cssText = replaceText(index, css); else {
  2499. var cssNode = document.createTextNode(css), childNodes = styleElement.childNodes;
  2500. childNodes[index] && styleElement.removeChild(childNodes[index]), childNodes.length ? styleElement.insertBefore(cssNode, childNodes[index]) : styleElement.appendChild(cssNode);
  2501. }
  2502. }
  2503. function applyToTag(styleElement, obj) {
  2504. var css = obj.css, media = obj.media;
  2505. if (media && styleElement.setAttribute("media", media), styleElement.styleSheet) styleElement.styleSheet.cssText = css; else {
  2506. for (;styleElement.firstChild; ) styleElement.removeChild(styleElement.firstChild);
  2507. styleElement.appendChild(document.createTextNode(css));
  2508. }
  2509. }
  2510. function updateLink(linkElement, options, obj) {
  2511. var css = obj.css, sourceMap = obj.sourceMap, autoFixUrls = void 0 === options.convertToAbsoluteUrls && sourceMap;
  2512. (options.convertToAbsoluteUrls || autoFixUrls) && (css = fixUrls(css)), sourceMap && (css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */");
  2513. var blob = new Blob([ css ], {
  2514. type: "text/css"
  2515. }), oldSrc = linkElement.href;
  2516. linkElement.href = URL.createObjectURL(blob), oldSrc && URL.revokeObjectURL(oldSrc);
  2517. }
  2518. var stylesInDom = {}, isOldIE = function(fn) {
  2519. var memo;
  2520. return function() {
  2521. return void 0 === memo && (memo = fn.apply(this, arguments)), memo;
  2522. };
  2523. }(function() {
  2524. return window && document && document.all && !window.atob;
  2525. }), getElement = function(fn) {
  2526. var memo = {};
  2527. return function(selector) {
  2528. return void 0 === memo[selector] && (memo[selector] = fn.call(this, selector)),
  2529. memo[selector];
  2530. };
  2531. }(function(styleTarget) {
  2532. return document.querySelector(styleTarget);
  2533. }), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = [], fixUrls = __webpack_require__(15);
  2534. module.exports = function(list, options) {
  2535. if ("undefined" != typeof DEBUG && DEBUG && "object" != typeof document) throw new Error("The style-loader cannot be used in a non-browser environment");
  2536. options = options || {}, options.attrs = "object" == typeof options.attrs ? options.attrs : {},
  2537. void 0 === options.singleton && (options.singleton = isOldIE()), void 0 === options.insertInto && (options.insertInto = "head"),
  2538. void 0 === options.insertAt && (options.insertAt = "bottom");
  2539. var styles = listToStyles(list);
  2540. return addStylesToDom(styles, options), function(newList) {
  2541. for (var mayRemove = [], i = 0; i < styles.length; i++) {
  2542. var item = styles[i], domStyle = stylesInDom[item.id];
  2543. domStyle.refs--, mayRemove.push(domStyle);
  2544. }
  2545. if (newList) {
  2546. addStylesToDom(listToStyles(newList), options);
  2547. }
  2548. for (var i = 0; i < mayRemove.length; i++) {
  2549. var domStyle = mayRemove[i];
  2550. if (0 === domStyle.refs) {
  2551. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  2552. delete stylesInDom[domStyle.id];
  2553. }
  2554. }
  2555. };
  2556. };
  2557. var replaceText = function() {
  2558. var textStore = [];
  2559. return function(index, replacement) {
  2560. return textStore[index] = replacement, textStore.filter(Boolean).join("\n");
  2561. };
  2562. }();
  2563. }, function(module, exports) {
  2564. module.exports = function(css) {
  2565. var location = "undefined" != typeof window && window.location;
  2566. if (!location) throw new Error("fixUrls requires window.location");
  2567. if (!css || "string" != typeof css) return css;
  2568. var baseUrl = location.protocol + "//" + location.host, currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  2569. return css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  2570. var unquotedOrigUrl = origUrl.trim().replace(/^"(.*)"$/, function(o, $1) {
  2571. return $1;
  2572. }).replace(/^'(.*)'$/, function(o, $1) {
  2573. return $1;
  2574. });
  2575. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) return fullMatch;
  2576. var newUrl;
  2577. return newUrl = 0 === unquotedOrigUrl.indexOf("//") ? unquotedOrigUrl : 0 === unquotedOrigUrl.indexOf("/") ? baseUrl + unquotedOrigUrl : currentDir + unquotedOrigUrl.replace(/^\.\//, ""),
  2578. "url(" + JSON.stringify(newUrl) + ")";
  2579. });
  2580. };
  2581. } ]);