jquery.inputmask.bundle.js 173 KB

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