jquery.inputmask.bundle.js 174 KB

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