UNPKG

@zeedhi/autonumeric

Version:

autoNumeric is a standalone Javascript library that provides live *as-you-type* formatting for international numbers and currencies. It supports most international numeric formats and currencies including those used in Europe, Asia, and North and South Am

6 lines 200 kB
/** * AutoNumeric.js v4.6.0 * © 2009-2019 Robert J. Knothe, Alexandre Bonneau * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AutoNumeric=t():e.AutoNumeric=t()}(this,function(){return i=[function(e,t,i){"use strict";i.r(t);var n={allowedTagList:["b","caption","cite","code","const","dd","del","div","dfn","dt","em","h1","h2","h3","h4","h5","h6","input","ins","kdb","label","li","option","output","p","q","s","sample","span","strong","td","th","u"]};Object.freeze(n.allowedTagList),Object.defineProperty(n,"allowedTagList",{configurable:!1,writable:!1}),n.keyCode={Backspace:8,Tab:9,Enter:13,Shift:16,Ctrl:17,Alt:18,Pause:19,CapsLock:20,Esc:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,LeftArrow:37,UpArrow:38,RightArrow:39,DownArrow:40,Insert:45,Delete:46,num0:48,num1:49,num2:50,num3:51,num4:52,num5:53,num6:54,num7:55,num8:56,num9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,OSLeft:91,OSRight:92,ContextMenu:93,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,MultiplyNumpad:106,PlusNumpad:107,MinusNumpad:109,DotNumpad:110,SlashNumpad:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NumLock:144,ScrollLock:145,HyphenFirefox:173,MyComputer:182,MyCalculator:183,Semicolon:186,Equal:187,Comma:188,Hyphen:189,Dot:190,Slash:191,Backquote:192,LeftBracket:219,Backslash:220,RightBracket:221,Quote:222,Command:224,AltGraph:225,AndroidDefault:229},Object.freeze(n.keyCode),Object.defineProperty(n,"keyCode",{configurable:!1,writable:!1}),n.fromCharCodeKeyCode={0:"LaunchCalculator",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",91:"OS",92:"OSRight",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",173:"-",182:"MyComputer",183:"MyCalculator",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Meta",225:"AltGraph"},Object.freeze(n.fromCharCodeKeyCode),Object.defineProperty(n,"fromCharCodeKeyCode",{configurable:!1,writable:!1}),n.keyName={Unidentified:"Unidentified",AndroidDefault:"AndroidDefault",Alt:"Alt",AltGr:"AltGraph",CapsLock:"CapsLock",Ctrl:"Control",Fn:"Fn",FnLock:"FnLock",Hyper:"Hyper",Meta:"Meta",OSLeft:"OS",OSRight:"OS",Command:"OS",NumLock:"NumLock",ScrollLock:"ScrollLock",Shift:"Shift",Super:"Super",Symbol:"Symbol",SymbolLock:"SymbolLock",Enter:"Enter",Tab:"Tab",Space:" ",LeftArrow:"ArrowLeft",UpArrow:"ArrowUp",RightArrow:"ArrowRight",DownArrow:"ArrowDown",End:"End",Home:"Home",PageUp:"PageUp",PageDown:"PageDown",Backspace:"Backspace",Clear:"Clear",Copy:"Copy",CrSel:"CrSel",Cut:"Cut",Delete:"Delete",EraseEof:"EraseEof",ExSel:"ExSel",Insert:"Insert",Paste:"Paste",Redo:"Redo",Undo:"Undo",Accept:"Accept",Again:"Again",Attn:"Attn",Cancel:"Cancel",ContextMenu:"ContextMenu",Esc:"Escape",Execute:"Execute",Find:"Find",Finish:"Finish",Help:"Help",Pause:"Pause",Play:"Play",Props:"Props",Select:"Select",ZoomIn:"ZoomIn",ZoomOut:"ZoomOut",BrightnessDown:"BrightnessDown",BrightnessUp:"BrightnessUp",Eject:"Eject",LogOff:"LogOff",Power:"Power",PowerOff:"PowerOff",PrintScreen:"PrintScreen",Hibernate:"Hibernate",Standby:"Standby",WakeUp:"WakeUp",Compose:"Compose",Dead:"Dead",F1:"F1",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",F10:"F10",F11:"F11",F12:"F12",Print:"Print",num0:"0",num1:"1",num2:"2",num3:"3",num4:"4",num5:"5",num6:"6",num7:"7",num8:"8",num9:"9",a:"a",b:"b",c:"c",d:"d",e:"e",f:"f",g:"g",h:"h",i:"i",j:"j",k:"k",l:"l",m:"m",n:"n",o:"o",p:"p",q:"q",r:"r",s:"s",t:"t",u:"u",v:"v",w:"w",x:"x",y:"y",z:"z",A:"A",B:"B",C:"C",D:"D",E:"E",F:"F",G:"G",H:"H",I:"I",J:"J",K:"K",L:"L",M:"M",N:"N",O:"O",P:"P",Q:"Q",R:"R",S:"S",T:"T",U:"U",V:"V",W:"W",X:"X",Y:"Y",Z:"Z",Semicolon:";",Equal:"=",Comma:",",Hyphen:"-",Minus:"-",Plus:"+",Dot:".",Slash:"/",Backquote:"`",LeftParenthesis:"(",RightParenthesis:")",LeftBracket:"[",RightBracket:"]",Backslash:"\\",Quote:"'",numpad0:"0",numpad1:"1",numpad2:"2",numpad3:"3",numpad4:"4",numpad5:"5",numpad6:"6",numpad7:"7",numpad8:"8",numpad9:"9",NumpadDot:".",NumpadDotAlt:",",NumpadMultiply:"*",NumpadPlus:"+",NumpadMinus:"-",NumpadSubtract:"-",NumpadSlash:"/",NumpadDotObsoleteBrowsers:"Decimal",NumpadMultiplyObsoleteBrowsers:"Multiply",NumpadPlusObsoleteBrowsers:"Add",NumpadMinusObsoleteBrowsers:"Subtract",NumpadSlashObsoleteBrowsers:"Divide",_allFnKeys:["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"],_someNonPrintableKeys:["Tab","Enter","Shift","ShiftLeft","ShiftRight","Control","ControlLeft","ControlRight","Alt","AltLeft","AltRight","Pause","CapsLock","Escape"],_directionKeys:["PageUp","PageDown","End","Home","ArrowDown","ArrowLeft","ArrowRight","ArrowUp"]},Object.freeze(n.keyName._allFnKeys),Object.freeze(n.keyName._someNonPrintableKeys),Object.freeze(n.keyName._directionKeys),Object.freeze(n.keyName),Object.defineProperty(n,"keyName",{configurable:!1,writable:!1}),Object.freeze(n);var u=n;function a(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}()||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,n=arguments[t];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,a,s=[],r=!0,o=!1;try{for(i=i.call(e);!(r=(n=i.next()).done)&&(s.push(n.value),!t||s.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw a}}return s}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(i="Object"===i&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var T=function(){function s(){!function(e){if(!(e instanceof s))throw new TypeError("Cannot call a class as a function")}(this)}return function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(s,[{key:"isNull",value:function(e){return null===e}},{key:"isUndefined",value:function(e){return void 0===e}},{key:"isUndefinedOrNullOrEmpty",value:function(e){return null==e||""===e}},{key:"isString",value:function(e){return"string"==typeof e||e instanceof String}},{key:"isEmptyString",value:function(e){return""===e}},{key:"isBoolean",value:function(e){return"boolean"==typeof e}},{key:"isTrueOrFalseString",value:function(e){return"true"===(e=String(e).toLowerCase())||"false"===e}},{key:"isObject",value:function(e){return"object"===c(e)&&null!==e&&!Array.isArray(e)}},{key:"isEmptyObj",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}},{key:"isNumberStrict",value:function(e){return"number"==typeof e}},{key:"isNumber",value:function(e){return!this.isArray(e)&&!isNaN(parseFloat(e))&&isFinite(e)}},{key:"isDigit",value:function(e){return/\d/.test(e)}},{key:"isNumberOrArabic",value:function(e){return e=this.arabicToLatinNumbers(e,!1,!0,!0),this.isNumber(e)}},{key:"isInt",value:function(e){return"number"==typeof e&&parseFloat(e)===parseInt(e,10)&&!isNaN(e)}},{key:"isFunction",value:function(e){return"function"==typeof e}},{key:"isIE11",value:function(){return"undefined"!=typeof window&&!!window.MSInputMethodContext&&!!document.documentMode}},{key:"contains",value:function(e,t){return!(!this.isString(e)||!this.isString(t)||""===e||""===t)&&-1!==e.indexOf(t)}},{key:"isInArray",value:function(e,t){return!(!this.isArray(t)||t===[]||this.isUndefined(e))&&-1!==t.indexOf(e)}},{key:"isArray",value:function(e){if("[object Array]"===Object.prototype.toString.call([]))return Array.isArray(e)||"object"===c(e)&&"[object Array]"===Object.prototype.toString.call(e);throw new Error("toString message changed for Object Array")}},{key:"isElement",value:function(e){return"undefined"!=typeof Element&&e instanceof Element}},{key:"isInputElement",value:function(e){return this.isElement(e)&&"input"===e.tagName.toLowerCase()}},{key:"decimalPlaces",value:function(e){return e=o(e.split("."),2)[1],this.isUndefined(e)?0:e.length}},{key:"indexFirstNonZeroDecimalPlace",value:function(e){return e=o(String(Math.abs(e)).split("."),2)[1],this.isUndefined(e)?0:(-1===(e=e.lastIndexOf("0"))?e=0:e+=2,e)}},{key:"keyCodeNumber",value:function(e){return void 0===e.which?e.keyCode:e.which}},{key:"character",value:function(e){var t;if("Unidentified"===e.key||void 0===e.key||this.isSeleniumBot()){var i=this.keyCodeNumber(e);if(i===u.keyCode.AndroidDefault)return u.keyName.AndroidDefault;var n=u.fromCharCodeKeyCode[i],a=s.isUndefinedOrNullOrEmpty(n)?String.fromCharCode(i):n}else switch(e.key){case"Add":a=u.keyName.NumpadPlus;break;case"Apps":a=u.keyName.ContextMenu;break;case"Crsel":a=u.keyName.CrSel;break;case"Decimal":a=e.char||u.keyName.NumpadDot;break;case"Del":a="firefox"===(t=this.browser()).name&&t.version<=36||"ie"===t.name&&t.version<=9?u.keyName.Dot:u.keyName.Delete;break;case"Divide":a=u.keyName.NumpadSlash;break;case"Down":a=u.keyName.DownArrow;break;case"Esc":a=u.keyName.Esc;break;case"Exsel":a=u.keyName.ExSel;break;case"Left":a=u.keyName.LeftArrow;break;case"Meta":case"Super":a=u.keyName.OSLeft;break;case"Multiply":a=u.keyName.NumpadMultiply;break;case"Right":a=u.keyName.RightArrow;break;case"Spacebar":a=u.keyName.Space;break;case"Subtract":a=u.keyName.NumpadMinus;break;case"Up":a=u.keyName.UpArrow;break;default:a=e.key}return a}},{key:"browser",value:function(){var e,t=navigator.userAgent,i=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(i[1])?{name:"ie",version:(e=/\brv[ :]+(\d+)/g.exec(t)||[])[1]||""}:"Chrome"===i[1]&&null!==(e=t.match(/\b(OPR|Edge)\/(\d+)/))?{name:e[1].replace("OPR","opera"),version:e[2]}:(i=i[2]?[i[1],i[2]]:[navigator.appName,navigator.appVersion,"-?"],null!==(e=t.match(/version\/(\d+)/i))&&i.splice(1,1,e[1]),{name:i[0].toLowerCase(),version:i[1]})}},{key:"isSeleniumBot",value:function(){return!0===window.navigator.webdriver}},{key:"isNegative",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"-",i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];return e===t||""!==e&&(s.isNumber(e)?e<0:i?this.contains(e,t):this.isNegativeStrict(e,t))}},{key:"isNegativeStrict",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"-";return e.charAt(0)===t}},{key:"isNegativeWithBrackets",value:function(e,t,i){return e.charAt(0)===t&&this.contains(e,i)}},{key:"isZeroOrHasNoValue",value:function(e){return!/[1-9]/g.test(e)}},{key:"setRawNegativeSign",value:function(e){return this.isNegativeStrict(e,"-")?e:"-".concat(e)}},{key:"replaceCharAt",value:function(e,t,i){return"".concat(e.substr(0,t)).concat(i).concat(e.substr(t+i.length))}},{key:"clampToRangeLimits",value:function(e,t){return Math.max(t.minimumValue,Math.min(t.maximumValue,e))}},{key:"countNumberCharactersOnTheCaretLeftSide",value:function(e,t,i){for(var n=new RegExp("[0-9".concat(i,"-]")),a=0,s=0;s<t;s++)n.test(e[s])&&a++;return a}},{key:"findCaretPositionInFormattedNumber",value:function(e,t,i,n){for(var a=i.length,s=e.length,r=0,o=0;o<a&&r<s&&r<t;o++)(e[r]===i[o]||"."===e[r]&&i[o]===n)&&r++;return o}},{key:"countCharInText",value:function(e,t){for(var i=0,n=0;n<t.length;n++)t[n]===e&&i++;return i}},{key:"convertCharacterCountToIndexPosition",value:function(e){return Math.max(e,e-1)}},{key:"getElementSelection",value:function(e){var t,i,n={};try{t=this.isUndefined(e.selectionStart)}catch(e){t=!1}try{t?(i=window.getSelection().getRangeAt(0),n.start=i.startOffset,n.end=i.endOffset):(n.start=e.selectionStart,n.end=e.selectionEnd),n.length=n.end-n.start}catch(e){n.start=0,n.end=0,n.length=0}return n}},{key:"setElementSelection",value:function(e,t){var i,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;this.isUndefinedOrNullOrEmpty(n)&&(n=t),this.isInputElement(e)?e.setSelectionRange(t,n):s.isNull(e.firstChild)||((i=document.createRange()).setStart(e.firstChild,t),i.setEnd(e.firstChild,n),(n=window.getSelection()).removeAllRanges(),n.addRange(i))}},{key:"throwError",value:function(e){throw new Error(e)}},{key:"warning",value:function(e){1<arguments.length&&void 0!==arguments[1]&&!arguments[1]||console.warn("Warning: ".concat(e))}},{key:"isWheelEvent",value:function(e){return e instanceof WheelEvent}},{key:"isWheelUpEvent",value:function(e){return this.isWheelEvent(e)&&!this.isUndefinedOrNullOrEmpty(e.deltaY)||this.throwError("The event passed as a parameter is not a valid wheel event, '".concat(e.type,"' given.")),e.deltaY<0}},{key:"isWheelDownEvent",value:function(e){return this.isWheelEvent(e)&&!this.isUndefinedOrNullOrEmpty(e.deltaY)||this.throwError("The event passed as a parameter is not a valid wheel event, '".concat(e.type,"' given.")),0<e.deltaY}},{key:"forceDecimalPlaces",value:function(e,t){var i=o(String(e).split("."),2),n=i[0];return(i=i[1])?"".concat(n,".").concat(i.substr(0,t)):e}},{key:"roundToNearest",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e3;return 0===e?0:(0===t&&this.throwError("The `stepPlace` used to round is equal to `0`. This value must not be equal to zero."),Math.round(e/t)*t)}},{key:"modifyAndRoundToNearestAuto",value:function(e,t,i){e=Number(this.forceDecimalPlaces(e,i));var n=Math.abs(e);if(0<=n&&n<1){var a=Math.pow(10,-i);return 0===e?t?a:-a:(a=(n=i)-1<=(i=this.indexFirstNonZeroDecimalPlace(e))?a:Math.pow(10,-(i+1)),this.roundToNearest(i=t?e+a:e-a,a))}e=parseInt(e,10);var s,r=Math.abs(e).toString().length;switch(r){case 1:s=0;break;case 2:case 3:s=1;break;case 4:case 5:s=2;break;default:s=r-3}return a=Math.pow(10,s),(e=t?e+a:e-a)<=10&&-10<=e?e:this.roundToNearest(e,a)}},{key:"addAndRoundToNearestAuto",value:function(e,t){return this.modifyAndRoundToNearestAuto(e,!0,t)}},{key:"subtractAndRoundToNearestAuto",value:function(e,t){return this.modifyAndRoundToNearestAuto(e,!1,t)}},{key:"arabicToLatinNumbers",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(this.isNull(e))return e;if(""===(a=e.toString()))return e;if(null===a.match(/[٠١٢٣٤٥٦٧٨٩۴۵۶]/g))return t?Number(a):a;i&&(a=a.replace(/٫/,"."));var a=(a=n?a.replace(/٬/g,""):a).replace(/[٠١٢٣٤٥٦٧٨٩]/g,function(e){return e.charCodeAt(0)-1632}).replace(/[۰۱۲۳۴۵۶۷۸۹]/g,function(e){return e.charCodeAt(0)-1776}),n=Number(a);return isNaN(n)||t?n:a}},{key:"triggerEvent",value:function(e){var t,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,a=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],s=!(4<arguments.length&&void 0!==arguments[4])||arguments[4];window.CustomEvent?t=new CustomEvent(e,{detail:n,bubbles:a,cancelable:s}):(t=document.createEvent("CustomEvent")).initCustomEvent(e,a,s,{detail:n}),i.dispatchEvent(t)}},{key:"parseStr",value:function(e){var t,i,n,a,s={};if(e=(e=0===e&&1/e<0?"-0":e).toString(),this.isNegativeStrict(e,"-")?(e=e.slice(1),s.s=-1):s.s=1,-1<(t=e.indexOf("."))&&(e=e.replace(".","")),t<0&&(t=e.length),(i=-1===e.search(/[1-9]/i)?e.length:e.search(/[1-9]/i))===(n=e.length))s.e=0,s.c=[0];else{for(a=n-1;"0"===e.charAt(a);--a)--n;for(--n,s.e=t-i-1,s.c=[],t=0;i<=n;i+=1)s.c[t]=+e.charAt(i),t+=1}return s}},{key:"testMinMax",value:function(e,t){var i=t.c,n=e.c,a=t.s,s=e.s,r=t.e,t=e.e;if(!i[0]||!n[0])return i[0]?a:n[0]?-s:0;if(a!==s)return a;var o=a<0;if(r!==t)return t<r^o?1:-1;for(a=-1,s=(r=i.length)<(t=n.length)?r:t,a+=1;a<s;a+=1)if(i[a]!==n[a])return i[a]>n[a]^o?1:-1;return r===t?0:t<r^o?1:-1}},{key:"randomString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5;return Math.random().toString(36).substr(2,e)}},{key:"domElement",value:function(e){return s.isString(e)?document.querySelector(e):e}},{key:"getElementValue",value:function(e){return"input"===e.tagName.toLowerCase()?e.value:this.text(e)}},{key:"setElementValue",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;"input"===e.tagName.toLowerCase()?e.value=t:e.textContent=t}},{key:"setInvalidState",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"Invalid";""!==t&&!this.isNull(t)||this.throwError("Cannot set the invalid state with an empty message."),e.setCustomValidity(t)}},{key:"setValidState",value:function(e){e.setCustomValidity("")}},{key:"cloneObject",value:function(e){return r({},e)}},{key:"camelize",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"-",i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=!(3<arguments.length&&void 0!==arguments[3])||arguments[3];return this.isNull(e)?null:(t=(t=(e=i?e.replace(/^data-/,""):e).split(t).map(function(e){return"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1))})).join(""),n?"".concat(t.charAt(0).toLowerCase()).concat(t.slice(1)):t)}},{key:"text",value:function(e){var t=e.nodeType;return t===Node.ELEMENT_NODE||t===Node.DOCUMENT_NODE||t===Node.DOCUMENT_FRAGMENT_NODE?e.textContent:t===Node.TEXT_NODE?e.nodeValue:""}},{key:"setText",value:function(e,t){var i=e.nodeType;i!==Node.ELEMENT_NODE&&i!==Node.DOCUMENT_NODE&&i!==Node.DOCUMENT_FRAGMENT_NODE||(e.textContent=t)}},{key:"filterOut",value:function(e,t){var i=this;return e.filter(function(e){return!i.isInArray(e,t)})}},{key:"trimPaddedZerosFromDecimalPlaces",value:function(e){if(""===(e=String(e)))return"";var e=(t=o(e.split("."),2))[0],t=t[1];return this.isUndefinedOrNullOrEmpty(t)||""===(t=t.replace(/0+$/g,""))?e:"".concat(e,".").concat(t)}},{key:"getHoveredElement",value:function(){var e=a(document.querySelectorAll(":hover"));return e[e.length-1]}},{key:"arrayTrim",value:function(e,t){var i=e.length;return 0===i||i<t?e:t<0?[]:(e.length=parseInt(t,10),e)}},{key:"arrayUnique",value:function(){var e;return a(new Set((e=[]).concat.apply(e,arguments)))}},{key:"mergeMaps",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return new Map(t.reduce(function(e,t){return e.concat(a(t))},[]))}},{key:"objectKeyLookup",value:function(e,t){var i=Object.entries(e).find(function(e){return e[1]===t}),e=null;return void 0!==i?i[0]:e}},{key:"insertAt",value:function(e,t,i){if(i>(e=String(e)).length)throw new Error("The given index is out of the string range.");if(1!==t.length)throw new Error("The given string `char` should be only one character long.");return""===e&&0===i?t:"".concat(e.slice(0,i)).concat(t).concat(e.slice(i))}},{key:"scientificToDecimal",value:function(e){var t=Number(e);if(isNaN(t))return NaN;if(e=String(e),!this.contains(e,"e")&&!this.contains(e,"E"))return e;var i=(s=o(e.split(/e/i),2))[0],n=s[1],a=i<0;a&&(i=i.replace("-","")),(t=+n<0)&&(n=n.replace("-",""));var s=(e=o(i.split(/\./),2))[0],e=e[1],r=t?(r=s.length>n?this.insertAt(s,".",s.length-n):"0.".concat("0".repeat(n-s.length)).concat(s),"".concat(r).concat(e||"")):e?(i="".concat(s).concat(e),n<e.length?this.insertAt(i,".",+n+s.length):"".concat(i).concat("0".repeat(n-e.length))):(i=i.replace(".",""),"".concat(i).concat("0".repeat(Number(n))));return a?"-".concat(r):r}}]),s}(),h=function(){function t(e){if(function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),null===e)throw new Error("Invalid AST")}return function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,[{key:"evaluate",value:function(e){if(null==e)throw new Error("Invalid AST sub-tree");if("number"===e.type)return e.value;if("unaryMinus"===e.type)return-this.evaluate(e.left);var t=this.evaluate(e.left),i=this.evaluate(e.right);switch(e.type){case"op_+":return Number(t)+Number(i);case"op_-":return t-i;case"op_*":return t*i;case"op_/":return t/i;default:throw new Error("Invalid operator '".concat(e.type,"'"))}}}]),t}();var m=function(){function a(){!function(e){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this)}return function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(a,[{key:"createNode",value:function(e,t,i){var n=new a;return n.type=e,n.left=t,n.right=i,n}},{key:"createUnaryNode",value:function(e){var t=new a;return t.type="unaryMinus",t.left=e,t.right=null,t}},{key:"createLeaf",value:function(e){var t=new a;return t.type="number",t.value=e,t}}]),a}();function g(e,t,i){!function(e){if(!(e instanceof g))throw new TypeError("Cannot call a class as a function")}(this),this.type=e,this.value=t,this.symbol=i}var d=function(){function t(e){!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.text=e,this.textLength=e.length,this.index=0,this.token=new g("Error",0,0)}return function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,[{key:"_skipSpaces",value:function(){for(;" "===this.text[this.index]&&this.index<=this.textLength;)this.index++}},{key:"getIndex",value:function(){return this.index}},{key:"getNextToken",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:".";if(this._skipSpaces(),this.textLength===this.index)return this.token.type="EOT",this.token;if(T.isDigit(this.text[this.index]))return this.token.type="num",this.token.value=this._getNumber(e),this.token;switch(this.token.type="Error",this.text[this.index]){case"+":this.token.type="+";break;case"-":this.token.type="-";break;case"*":this.token.type="*";break;case"/":this.token.type="/";break;case"(":this.token.type="(";break;case")":this.token.type=")"}if("Error"===this.token.type)throw new Error("Unexpected token '".concat(this.token.symbol,"' at position '").concat(this.token.index,"' in the token function"));return this.token.symbol=this.text[this.index],this.index++,this.token}},{key:"_getNumber",value:function(e){this._skipSpaces();for(var t=this.index;this.index<=this.textLength&&T.isDigit(this.text[this.index]);)this.index++;for(this.text[this.index]===e&&this.index++;this.index<=this.textLength&&T.isDigit(this.text[this.index]);)this.index++;if(this.index===t)throw new Error("No number has been found while it was expected");return this.text.substring(t,this.index).replace(e,".")}}]),t}(),v=function(){function i(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:".";return function(e){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}(this),this.text=e,this.decimalCharacter=t,this.lexer=new d(e),this.token=this.lexer.getNextToken(this.decimalCharacter),this._exp()}var e=[{key:"_exp",value:function(){var e=this._term(),t=this._moreExp();return m.createNode("op_+",e,t)}},{key:"_moreExp",value:function(){var e,t;switch(this.token.type){case"+":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._term(),t=this._moreExp(),m.createNode("op_+",t,e);case"-":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._term(),t=this._moreExp(),m.createNode("op_-",t,e)}return m.createLeaf(0)}},{key:"_term",value:function(){var e=this._factor(),t=this._moreTerms();return m.createNode("op_*",e,t)}},{key:"_moreTerms",value:function(){var e,t;switch(this.token.type){case"*":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._factor(),t=this._moreTerms(),m.createNode("op_*",t,e);case"/":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._factor(),t=this._moreTerms(),m.createNode("op_/",t,e)}return m.createLeaf(1)}},{key:"_factor",value:function(){var e,t;switch(this.token.type){case"num":return t=this.token.value,this.token=this.lexer.getNextToken(this.decimalCharacter),m.createLeaf(t);case"-":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._factor(),m.createUnaryNode(e);case"(":return this.token=this.lexer.getNextToken(this.decimalCharacter),e=this._exp(),this._match(")"),e;default:throw new Error("Unexpected token '".concat(this.token.symbol,"' with type '").concat(this.token.type,"' at position '").concat(this.token.index,"' in the factor function"))}}},{key:"_match",value:function(e){var t=this.lexer.getIndex()-1;if(this.text[t]!==e)throw new Error("Unexpected token '".concat(this.token.symbol,"' at position '").concat(t,"' in the match function"));this.token=this.lexer.getNextToken(this.decimalCharacter)}}];return function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,e),i}();function p(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}()||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,a,s=[],r=!0,o=!1;try{for(i=i.call(e);!(r=(n=i.next()).done)&&(s.push(n.value),!t||s.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw a}}return s}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return S(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(i="Object"===i&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,n=arguments[t];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function P(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var O,k=function(){function V(){var a=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;!function(e){if(!(e instanceof V))throw new TypeError("Cannot call a class as a function")}(this);var n,t=(e=V._setArgumentsValues(e,t,i)).domElement,i=e.initialValue,e=e.userOptions;if(this.domElement=t,this.defaultRawValue="",this._setSettings(e,!1),this._checkElement(),this.savedCancellableValue=null,this.historyTable=[],this.historyTableIndex=-1,this.onGoingRedo=!1,this.parentForm=this._getParentForm(),!this.runOnce&&this.settings.formatOnPageLoad)this._formatDefaultValueOnPageLoad(i);else{if(T.isNull(i))switch(this.settings.emptyInputBehavior){case V.options.emptyInputBehavior.min:n=this.settings.minimumValue;break;case V.options.emptyInputBehavior.max:n=this.settings.maximumValue;break;case V.options.emptyInputBehavior.zero:n="0";break;case V.options.emptyInputBehavior.focus:case V.options.emptyInputBehavior.press:case V.options.emptyInputBehavior.always:case V.options.emptyInputBehavior.null:n="";break;default:n=this.settings.emptyInputBehavior}else n=i;this._setElementAndRawValue(n)}this.runOnce=!0,this.hasEventListeners=!1,(this.isInputElement||this.isContentEditable)&&(this.settings.noEventListeners||this._createEventListeners(),this._setWritePermissions(!0)),this._saveInitialValues(i),this.sessionStorageAvailable=this.constructor._storageTest(),this.storageNamePrefix="AUTO_",this._setPersistentStorageName(),this.validState=!0,this.isFocused=!1,this.isWheelEvent=!1,this.isDropEvent=!1,this.isEditing=!1,this.rawValueOnFocus=void 0,this.internalModification=!1,this.attributeToWatch=this._getAttributeToWatch(),this.getterSetter=Object.getOwnPropertyDescriptor(this.domElement.__proto__,this.attributeToWatch),this._addWatcher(),this.settings.createLocalList&&this._createLocalList(),this.constructor._addToGlobalList(this),this.global={set:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;a.autoNumericLocalList.forEach(function(e){e.set(t,i)})},setUnformatted:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;a.autoNumericLocalList.forEach(function(e){e.setUnformatted(t,i)})},get:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=[];return a.autoNumericLocalList.forEach(function(e){t.push(e.get())}),a._executeCallback(t,e),t},getNumericString:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=[];return a.autoNumericLocalList.forEach(function(e){t.push(e.getNumericString())}),a._executeCallback(t,e),t},getFormatted:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=[];return a.autoNumericLocalList.forEach(function(e){t.push(e.getFormatted())}),a._executeCallback(t,e),t},getNumber:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=[];return a.autoNumericLocalList.forEach(function(e){t.push(e.getNumber())}),a._executeCallback(t,e),t},getLocalized:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=[];return a.autoNumericLocalList.forEach(function(e){t.push(e.getLocalized())}),a._executeCallback(t,e),t},reformat:function(){a.autoNumericLocalList.forEach(function(e){e.reformat()})},unformat:function(){a.autoNumericLocalList.forEach(function(e){e.unformat()})},unformatLocalized:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;a.autoNumericLocalList.forEach(function(e){e.unformatLocalized(t)})},update:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a.autoNumericLocalList.forEach(function(e){e.update.apply(e,t)})},isPristine:function(){var t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],i=!0;return a.autoNumericLocalList.forEach(function(e){i&&!e.isPristine(t)&&(i=!1)}),i},clear:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];a.autoNumericLocalList.forEach(function(e){e.clear(t)})},remove:function(){a.autoNumericLocalList.forEach(function(e){e.remove()})},wipe:function(){a.autoNumericLocalList.forEach(function(e){e.wipe()})},nuke:function(){a.autoNumericLocalList.forEach(function(e){e.nuke()})},has:function(e){return e instanceof V?a.autoNumericLocalList.has(e.node()):a.autoNumericLocalList.has(e)},addObject:function(e){var t,i,n=e instanceof V?(t=e.node(),e):V.getAutoNumericElement(t=e);a._hasLocalList()||a._createLocalList(),0===(e=n._getLocalList()).size&&(n._createLocalList(),e=n._getLocalList()),(i=e instanceof Map?T.mergeMaps(a._getLocalList(),e):(a._addToLocalList(t,n),a._getLocalList())).forEach(function(e){e._setLocalList(i)})},removeObject:function(e){var t,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=e instanceof V?(t=e.node(),e):V.getAutoNumericElement(t=e),e=a.autoNumericLocalList;a.autoNumericLocalList.delete(t),e.forEach(function(e){e._setLocalList(a.autoNumericLocalList)}),i||t!==a.node()?n._createLocalList():n._setLocalList(new Map)},empty:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];a.autoNumericLocalList.forEach(function(e){t?e._createLocalList():e._setLocalList(new Map)})},elements:function(){var t=[];return a.autoNumericLocalList.forEach(function(e){t.push(e.node())}),t},getList:function(){return a.autoNumericLocalList},size:function(){return a.autoNumericLocalList.size}},this.options={reset:function(){return a.settings={rawValue:a.defaultRawValue},a.update(V.defaultSettings),a},allowDecimalPadding:function(e){return a.update({allowDecimalPadding:e}),a},alwaysAllowDecimalCharacter:function(e){return a.update({alwaysAllowDecimalCharacter:e}),a},caretPositionOnFocus:function(e){return a.settings.caretPositionOnFocus=e,a},createLocalList:function(e){return a.settings.createLocalList=e,a.settings.createLocalList?a._hasLocalList()||a._createLocalList():a._deleteLocalList(),a},currencySymbol:function(e){return a.update({currencySymbol:e}),a},currencySymbolPlacement:function(e){return a.update({currencySymbolPlacement:e}),a},decimalCharacter:function(e){return a.update({decimalCharacter:e}),a},decimalCharacterAlternative:function(e){return a.settings.decimalCharacterAlternative=e,a},decimalPlaces:function(e){return T.warning("Using `options.decimalPlaces()` instead of calling the specific `options.decimalPlacesRawValue()`, `options.decimalPlacesShownOnFocus()` and `options.decimalPlacesShownOnBlur()` methods will reset those options.\nPlease call the specific methods if you do not want to reset those.",a.settings.showWarnings),a.update({decimalPlaces:e}),a},decimalPlacesRawValue:function(e){return a.update({decimalPlacesRawValue:e}),a},decimalPlacesShownOnBlur:function(e){return a.update({decimalPlacesShownOnBlur:e}),a},decimalPlacesShownOnFocus:function(e){return a.update({decimalPlacesShownOnFocus:e}),a},defaultValueOverride:function(e){return a.update({defaultValueOverride:e}),a},digitalGroupSpacing:function(e){return a.update({digitalGroupSpacing:e}),a},digitGroupSeparator:function(e){return a.update({digitGroupSeparator:e}),a},divisorWhenUnfocused:function(e){return a.update({divisorWhenUnfocused:e}),a},emptyInputBehavior:function(e){return null===a.rawValue&&e!==V.options.emptyInputBehavior.null&&(T.warning("You are trying to modify the `emptyInputBehavior` option to something different than `'null'` (".concat(e,"), but the element raw value is currently set to `null`. This would result in an invalid `rawValue`. In order to fix that, the element value has been changed to the empty string `''`."),a.settings.showWarnings),a.rawValue=""),a.update({emptyInputBehavior:e}),a},eventBubbles:function(e){return a.settings.eventBubbles=e,a},eventIsCancelable:function(e){return a.settings.eventIsCancelable=e,a},failOnUnknownOption:function(e){return a.settings.failOnUnknownOption=e,a},formatOnPageLoad:function(e){return a.settings.formatOnPageLoad=e,a},formulaMode:function(e){return a.settings.formulaMode=e,a},historySize:function(e){return a.settings.historySize=e,a},invalidClass:function(e){return a.settings.invalidClass=e,a},isCancellable:function(e){return a.settings.isCancellable=e,a},leadingZero:function(e){return a.update({leadingZero:e}),a},maximumValue:function(e){return a.update({maximumValue:e}),a},minimumValue:function(e){return a.update({minimumValue:e}),a},modifyValueOnWheel:function(e){return a.settings.modifyValueOnWheel=e,a},negativeBracketsTypeOnBlur:function(e){return a.update({negativeBracketsTypeOnBlur:e}),a},negativePositiveSignPlacement:function(e){return a.update({negativePositiveSignPlacement:e}),a},negativeSignCharacter:function(e){return a.update({negativeSignCharacter:e}),a},noEventListeners:function(e){return e===V.options.noEventListeners.noEvents&&a.settings.noEventListeners===V.options.noEventListeners.addEvents&&a._removeEventListeners(),a.update({noEventListeners:e}),a},onInvalidPaste:function(e){return a.settings.onInvalidPaste=e,a},outputFormat:function(e){return a.settings.outputFormat=e,a},overrideMinMaxLimits:function(e){return a.update({overrideMinMaxLimits:e}),a},positiveSignCharacter:function(e){return a.update({positiveSignCharacter:e}),a},rawValueDivisor:function(e){return a.update({rawValueDivisor:e}),a},readOnly:function(e){return a.settings.readOnly=e,a._setWritePermissions(),a},roundingMethod:function(e){return a.update({roundingMethod:e}),a},saveValueToSessionStorage:function(e){return a.update({saveValueToSessionStorage:e}),a},symbolWhenUnfocused:function(e){return a.update({symbolWhenUnfocused:e}),a},selectNumberOnly:function(e){return a.settings.selectNumberOnly=e,a},selectOnFocus:function(e){return a.settings.selectOnFocus=e,a},serializeSpaces:function(e){return a.settings.serializeSpaces=e,a},showOnlyNumbersOnFocus:function(e){return a.update({showOnlyNumbersOnFocus:e}),a},showPositiveSign:function(e){return a.update({showPositiveSign:e}),a},showWarnings:function(e){return a.settings.showWarnings=e,a},styleRules:function(e){return a.update({styleRules:e}),a},suffixText:function(e){return a.update({suffixText:e}),a},unformatOnHover:function(e){return a.settings.unformatOnHover=e,a},unformatOnSubmit:function(e){return a.settings.unformatOnSubmit=e,a},valuesToStrings:function(e){return a.update({valuesToStrings:e}),a},watchExternalChanges:function(e){return a.update({watchExternalChanges:e}),a},wheelOn:function(e){return a.settings.wheelOn=e,a},wheelStep:function(e){return a.settings.wheelStep=e,a}},this._triggerEvent(V.events.initialized,this.domElement,{newValue:T.getElementValue(this.domElement),newRawValue:this.rawValue,error:null,aNElement:this})}var e=V,t=[{key:"version",value:function(){return"4.6.0"}},{key:"_setArgumentsValues",value:function(e,t,i){T.isNull(e)&&T.throwError("At least one valid parameter is needed in order to initialize an AutoNumeric object");var n,a,s,r=T.isElement(e),o=T.isString(e),l=T.isObject(t),c=Array.isArray(t)&&0<t.length,u=T.isNumberOrArabic(t)||""===t,h=this._isPreDefinedOptionValid(t),m=T.isNull(t),g=T.isEmptyString(t),d=T.isObject(i),v=Array.isArray(i)&&0<i.length,p=T.isNull(i),f=this._isPreDefinedOptionValid(i);return r&&m&&p?(n=e,a=s=null):r&&u&&p?(n=e,s=t,a=null):r&&l&&p?(n=e,s=null,a=t):r&&h&&p?(n=e,s=null,a=this._getOptionObject(t)):r&&c&&p?(n=e,s=null,a=this.mergeOptions(t)):r&&(m||g)&&d?(n=e,s=null,a=i):r&&(m||g)&&v?(n=e,s=null,a=this.mergeOptions(i)):o&&m&&p?(n=document.querySelector(e),a=s=null):o&&l&&p?(n=document.querySelector(e),s=null,a=t):o&&h&&p?(n=document.querySelector(e),s=null,a=this._getOptionObject(t)):o&&c&&p?(n=document.querySelector(e),s=null,a=this.mergeOptions(t)):o&&(m||g)&&d?(n=document.querySelector(e),s=null,a=i):o&&(m||g)&&v?(n=document.querySelector(e),s=null,a=this.mergeOptions(i)):o&&u&&p?(n=document.querySelector(e),s=t,a=null):o&&u&&d?(n=document.querySelector(e),s=t,a=i):o&&u&&f?(n=document.querySelector(e),s=t,a=this._getOptionObject(i)):o&&u&&v?(n=document.querySelector(e),s=t,a=this.mergeOptions(i)):r&&u&&d?(n=e,s=t,a=i):r&&u&&f?(n=e,s=t,a=this._getOptionObject(i)):r&&u&&v?(n=e,s=t,a=this.mergeOptions(i)):T.throwError("The parameters given to the AutoNumeric object are not valid, '".concat(e,"', '").concat(t,"' and '").concat(i,"' given.")),T.isNull(n)&&T.throwError("The selector '".concat(e,"' did not select any valid DOM element. Please check on which element you called AutoNumeric.")),{domElement:n,initialValue:s,userOptions:a}}},{key:"mergeOptions",value:function(e){var t=this,i={};return e.forEach(function(e){b(i,t._getOptionObject(e))}),i}},{key:"_isPreDefinedOptionValid",value:function(e){return Object.prototype.hasOwnProperty.call(V.predefinedOptions,e)}},{key:"_getOptionObject",value:function(e){var t;return T.isString(e)?null==(t=V.getPredefinedOptions()[e])&&T.warning("The given pre-defined option [".concat(e,"] is not recognized by autoNumeric. Please check that pre-defined option name."),!0):t=e,t}},{key:"_doesFormHandlerListExists",value:function(){var e=w(window.aNFormHandlerMap);return"undefined"!==e&&"object"===e}},{key:"_createFormHandlerList",value:function(){window.aNFormHandlerMap=new Map}},{key:"_checkValuesToStringsArray",value:function(e,t){return T.isInArray(String(e),t)}},{key:"_checkValuesToStringsSettings",value:function(e,t){return this._checkValuesToStringsArray(e,Object.keys(t.valuesToStrings))}},{key:"_checkStringsToValuesSettings",value:function(e,t){return this._checkValuesToStringsArray(e,Object.values(t.valuesToStrings))}},{key:"_unformatAltHovered",value:function(e){e.hoveredWithAlt=!0,e.unformat()}},{key:"_reformatAltHovered",value:function(e){e.hoveredWithAlt=!1,e.reformat()}},{key:"_getChildANInputElement",value:function(e){var t=this,e=e.getElementsByTagName("input"),i=[];return Array.prototype.slice.call(e,0).forEach(function(e){t.test(e)&&i.push(e)}),i}},{key:"test",value:function(e){return this._isInGlobalList(T.domElement(e))}},{key:"_createWeakMap",value:function(e){window[e]=new WeakMap}},{key:"_createGlobalList",value:function(){this.autoNumericGlobalListName="autoNumericGlobalList",this._createWeakMap(this.autoNumericGlobalListName)}},{key:"_doesGlobalListExists",value:function(){var e=w(window[this.autoNumericGlobalListName]);return"undefined"!==e&&"object"===e}},{key:"_addToGlobalList",value:function(e){this._doesGlobalListExists()||this._createGlobalList();var t=e.node();if(this._isInGlobalList(t)){if(this._getFromGlobalList(t)===this)return;T.warning("A reference to the DOM element you just initialized already exists in the global AutoNumeric element list. Please make sure to not initialize the same DOM element multiple times.",e.getSettings().showWarnings)}window[this.autoNumericGlobalListName].set(t,e)}},{key:"_removeFromGlobalList",value:function(e){this._doesGlobalListExists()&&window[this.autoNumericGlobalListName].delete(e.node())}},{key:"_getFromGlobalList",value:function(e){return this._doesGlobalListExists()?window[this.autoNumericGlobalListName].get(e):null}},{key:"_isInGlobalList",value:function(e){return!!this._doesGlobalListExists()&&window[this.autoNumericGlobalListName].has(e)}},{key:"validate",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;!T.isUndefinedOrNullOrEmpty(e)&&T.isObject(e)||T.throwError("The userOptions are invalid ; it should be a valid object, [".concat(e,"] given."));var n,a=T.isObject(i);a||T.isNull(i)||T.throwError("The 'originalOptions' parameter is invalid ; it should either be a valid option object or `null`, [".concat(e,"] given.")),T.isNull(e)||this._convertOldOptionsToNewOnes(e),n=t?b({},this.getDefaultConfig(),e):e,T.isTrueOrFalseString(n.showWarnings)||T.isBoolean(n.showWarnings)||T.throwError("The debug option 'showWarnings' is invalid ; it should be either 'true' or 'false', [".concat(n.showWarnings,"] given."));var s=/^[0-9]+$/,r=/[0-9]+/,o=/^-?[0-9]+(\.?[0-9]+)?$/,t=/^[0-9]+(\.?[0-9]+)?$/;T.isTrueOrFalseString(n.allowDecimalPadding)||T.isBoolean(n.allowDecimalPadding)||n.allowDecimalPadding===V.options.allowDecimalPadding.floats||T.throwError("The decimal padding option 'allowDecimalPadding' is invalid ; it should either be `false`, `true` or `'floats'`, [".concat(n.allowDecimalPadding,"] given.")),n.allowDecimalPadding!==V.options.allowDecimalPadding.never&&"false"!==n.allowDecimalPadding||n.decimalPlaces===V.options.decimalPlaces.none&&n.decimalPlacesShownOnBlur===V.options.decimalPlacesShownOnBlur.none&&n.decimalPlacesShownOnFocus===V.options.decimalPlacesShownOnFocus.none||T.warning("Setting 'allowDecimalPadding' to [".concat(n.allowDecimalPadding,"] will override the current 'decimalPlaces*' settings [").concat(n.decimalPlaces,", ").concat(n.decimalPlacesShownOnBlur," and ").concat(n.decimalPlacesShownOnFocus,"]."),n.showWarnings),T.isTrueOrFalseString(n.alwaysAllowDecimalCharacter)||T.isBoolean(n.alwaysAllowDecimalCharacter)||T.throwError("The option 'alwaysAllowDecimalCharacter' is invalid ; it should either be `true` or `false`, [".concat(n.alwaysAllowDecimalCharacter,"] given.")),T.isNull(n.caretPositionOnFocus)||T.isInArray(n.caretPositionOnFocus,[V.options.caretPositionOnFocus.start,V.options.caretPositionOnFocus.end,V.options.caretPositionOnFocus.decimalLeft,V.options.caretPositionOnFocus.decimalRight])||T.throwError("The display on empty string option 'caretPositionOnFocus' is invalid ; it should either be `null`, 'focus', 'press', 'always' or 'zero', [".concat(n.caretPositionOnFocus,"] given.")),e=a?i:this._correctCaretPositionOnFocusAndSelectOnFocusOptions(e),T.isNull(e)||e.caretPositionOnFocus===V.options.caretPositionOnFocus.doNoForceCaretPosition||e.selectOnFocus!==V.options.selectOnFocus.select||T.warning("The 'selectOnFocus' option is set to 'select', which is in conflict with the 'caretPositionOnFocus' which is set to '".concat(e.caretPositionOnFocus,"'. As a result, if this has been called when instantiating an AutoNumeric object, the 'selectOnFocus' option is forced to 'doNotSelect'."),n.showWarnings),T.isInArray(n.digitGroupSeparator,[V.options.digitGroupSeparator.comma,V.options.digitGroupSeparator.dot,V.options.digitGroupSeparator.normalSpace,V.options.digitGroupSeparator.thinSpace,V.options.digitGroupSeparator.narrowNoBreakSpace,V.options.digitGroupSeparator.noBreakSpace,V.options.digitGroupSeparator.noSeparator,V.options.digitGroupSeparator.apostrophe,V.options.digitGroupSeparator.arabicThousandsSeparator,V.options.digitGroupSeparator.dotAbove,V.options.digitGroupSeparator.privateUseTwo])||T.throwError("The thousand separator character option 'digitGroupSeparator' is invalid ; it should be ',', '.', '٬', '˙', \"'\", '’', ' ', ' ', ' ', ' ' or empty (''), [".concat(n.digitGroupSeparator,"] given.")),T.isTrueOrFalseString(n.showOnlyNumbersOnFocus)||T.isBoolean(n.showOnlyNumbersOnFocus)||T.throwError("The 'showOnlyNumbersOnFocus' option is invalid ; it should be either 'true' or 'false', [".concat(n.showOnlyNumbersOnFocus,"] given.")),T.isInArray(n.digitalGroupSpacing,[V.options.digitalGroupSpacing.two,V.options.digitalGroupSpacing.twoScaled,V.options.digitalGroupSpacing.three,V.options.digitalGroupSpacing.four])||2<=n.digitalGroupSpacing&&n.digitalGroupSpacing<=4||T.throwError("The grouping separator option for thousands 'digitalGroupSpacing' is invalid ; it should be '2', '2s', '3', or '4', [".concat(n.digitalGroupSpacing,"] given.")),T.isInArray(n.decimalCharacter,[V.options.decimalCharacter.comma,V.options.decimalCharacter.dot,V.options.decimalCharacter.middleDot,V.options.decimalCharacter.arabicDecimalSeparator,V.options.decimalCharacter.decimalSeparatorKeySymbol])||T.throwError("The decimal separator character option 'decimalCharacter' is invalid ; it should be '.', ',', '·', '⎖' or '٫', [".concat(n.decimalCharacter,"] given.")),n.decimalCharacter===n.digitGroupSeparator&&T.throwError("autoNumeric will not function properly when the decimal character 'decimalCharacter' [".concat(n.decimalCharacter,"] and the thousand separator 'digitGroupSeparator' [").concat(n.digitGroupSeparator,"] are the same character.")),T.isNull(n.decimalCharacterAlternative)||T.isString(n.decimalCharacterAlternative)||T.throwError("The alternate decimal separator character option 'decimalCharacterAlternative' is invalid ; it should be a string, [".concat(n.decimalCharacterAlternative,"] given.")),""===n.currencySymbol||T.isString(n.currencySymbol)||T.throwError("The currency symbol option 'currencySymbol' is invalid ; it should be a string, [".concat(n.currencySymbol,"] given.")),T.isInArray(n.currencySymbolPlacement,[V.options.currencySymbolPlacement.prefix,V.options.currencySymbolPlacement.suffix])||T.throwError("The placement of the currency sign option 'currencySymbolPlacement' is invalid ; it should either be 'p' (prefix) or 's' (suffix), [".concat(n.currencySymbolPlacement,"] given.")),T.isInArray(n.negativePositiveSignPlacement,[V.options.negativePositiveSignPlacement.prefix,V.options.negativePositiveSignPlacement.suffix,V.options.negativePositiveSignPlacement.left,V.options.negativePositiveSignPlacement.right,V.options.negativePositiveSignPlacement.none])||T.throwError("The placement of the negative sign option 'negativePositiveSignPlacement' is invalid ; it should either be 'p' (prefix), 's' (suffix), 'l' (left), 'r' (right) or 'null', [".concat(n.negativePositiveSignPlacement,"] given.")),T.isTrueOrFalseString(n.showPositiveSign)||T.isBoolean(n.showPositiveSign)||T.throwError("The show positive sign option 'showPositiveSign' is invalid ; it should be either 'true' or 'false', [".concat(n.showPositiveSign,"] given.")),T.isString(n.suffixText)&&(""===n.suffixText||!T.isNegative(n.su