forked from nosir/cleave.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleave-react-node.min.js
8 lines (8 loc) · 24.6 KB
/
cleave-react-node.min.js
1
2
3
4
5
6
7
8
/*!
* cleave.js - 1.1.1
* https://github.com/nosir/cleave.js
* Apache License Version 2.0
*
* Copyright (C) 2012-2018 Max Huang https://github.com/nosir/
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.Cleave=t(require("react")):e.Cleave=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(1),a=r(2),s=r(9),c=r(10),u=r(11),l=r(12),p=r(13),d=r(14),m=a({componentDidMount:function(){this.init()},componentDidUpdate:function(){var e=this;e.state.updateCursorPosition&&e.setCurrentSelection(e.state.cursorPosition)},componentWillReceiveProps:function(e){var t=this,r=(e.options||{}).phoneRegionCode,n=e.value;void 0!==n&&(n=n.toString(),n!==t.state.value&&n!==t.properties.result&&(t.properties.initValue=n,t.onInput(n,!0))),r&&r!==t.properties.phoneRegionCode&&(t.properties.phoneRegionCode=r,t.initPhoneFormatter(),t.onInput(t.properties.result))},getInitialState:function(){var e=this,t=e.props,r=t.value,n=t.options,o=t.onKeyDown,i=t.onChange,a=t.onFocus,s=t.onBlur,c=t.onInit;return e.registeredEvents={onInit:c||p.noop,onChange:i||p.noop,onFocus:a||p.noop,onBlur:s||p.noop,onKeyDown:o||p.noop},n||(n={}),n.initValue=r,e.properties=d.assign({},n),{value:e.properties.result,cursorPosition:0,updateCursorPosition:!1}},init:function(){var e=this,t=e.properties;return t.numeral||t.phone||t.creditCard||t.date||0!==t.blocksLength||t.prefix?(t.maxLength=p.getMaxLength(t.blocks),e.isAndroid=p.isAndroid(),e.initPhoneFormatter(),e.initDateFormatter(),e.initNumeralFormatter(),(t.initValue||t.prefix&&!t.noImmediatePrefix)&&e.onInput(t.initValue),void e.registeredEvents.onInit(e)):(e.onInput(t.initValue),void e.registeredEvents.onInit(e))},initNumeralFormatter:function(){var e=this,t=e.properties;t.numeral&&(t.numeralFormatter=new s(t.numeralDecimalMark,t.numeralIntegerScale,t.numeralDecimalScale,t.numeralThousandsGroupStyle,t.numeralPositiveOnly,t.stripLeadingZeroes,t.delimiter))},initDateFormatter:function(){var e=this,t=e.properties;t.date&&(t.dateFormatter=new c(t.datePattern),t.blocks=t.dateFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=p.getMaxLength(t.blocks))},initPhoneFormatter:function(){var e=this,t=e.properties;if(t.phone)try{t.phoneFormatter=new u(new t.root.Cleave.AsYouTypeFormatter(t.phoneRegionCode),t.delimiter)}catch(r){throw new Error("Please include phone-type-formatter.{country}.js lib")}},setRawValue:function(e){var t=this,r=t.properties;e=void 0!==e&&null!==e?e.toString():"",r.numeral&&(e=e.replace(".",r.numeralDecimalMark)),r.backspace=!1,t.onChange({target:{value:e}})},getRawValue:function(){var e=this,t=e.properties,r=t.result;return t.rawValueTrimPrefix&&(r=p.getPrefixStrippedValue(r,t.prefix,t.prefixLength)),r=t.numeral?t.numeralFormatter.getRawValue(r):p.stripDelimiters(r,t.delimiter,t.delimiters)},getISOFormatDate:function(){var e=this,t=e.properties;return t.date?t.dateFormatter.getISOFormatDate():""},onInit:function(e){return e},onKeyDown:function(e){var t=this,r=t.properties,n=e.which||e.keyCode;8===n&&p.isDelimiter(r.result.slice(-r.delimiterLength),r.delimiter,r.delimiters)?r.backspace=!0:r.backspace=!1,t.registeredEvents.onKeyDown(e)},onFocus:function(e){var t=this,r=t.properties;e.target.rawValue=t.getRawValue(),e.target.value=r.result,t.registeredEvents.onFocus(e)},onBlur:function(e){var t=this,r=t.properties;e.target.rawValue=t.getRawValue(),e.target.value=r.result,t.registeredEvents.onBlur(e)},onChange:function(e){var t=this,r=t.properties;t.onInput(e.target.value),e.target.rawValue=t.getRawValue(),e.target.value=r.result,t.registeredEvents.onChange(e)},onInput:function(e,t){var r=this,n=r.properties;return p.isAndroidBackspaceKeydown(r.lastInputValue,r.element.value)&&p.isDelimiter(n.result.slice(-n.delimiterLength),n.delimiter,n.delimiters)&&(n.backspace=!0),t||n.numeral||!n.backspace||p.isDelimiter(e.slice(-n.delimiterLength),n.delimiter,n.delimiters)||(e=p.headStr(e,e.length-n.delimiterLength)),n.phone?(n.result=n.phoneFormatter.format(e),void r.updateValueState()):n.numeral?(!n.prefix||n.noImmediatePrefix&&!e.length?n.result=n.numeralFormatter.format(e):n.result=n.prefix+n.numeralFormatter.format(e),void r.updateValueState()):(n.date&&(e=n.dateFormatter.getValidatedDate(e)),e=p.stripDelimiters(e,n.delimiter,n.delimiters),e=p.getPrefixStrippedValue(e,n.prefix,n.prefixLength),e=n.numericOnly?p.strip(e,/[^\d]/g):e,e=n.uppercase?e.toUpperCase():e,e=n.lowercase?e.toLowerCase():e,!n.prefix||n.noImmediatePrefix&&!e.length||(e=n.prefix+e,0!==n.blocksLength)?(n.creditCard&&r.updateCreditCardPropsByValue(e),e=n.maxLength>0?p.headStr(e,n.maxLength):e,n.result=p.getFormattedValue(e,n.blocks,n.blocksLength,n.delimiter,n.delimiters,n.delimiterLazyShow),void r.updateValueState()):(n.result=e,void r.updateValueState()))},updateCreditCardPropsByValue:function(e){var t,r=this,n=r.properties;p.headStr(n.result,4)!==p.headStr(e,4)&&(t=l.getInfo(e,n.creditCardStrictMode),n.blocks=t.blocks,n.blocksLength=n.blocks.length,n.maxLength=p.getMaxLength(n.blocks),n.creditCardType!==t.type&&(n.creditCardType=t.type,n.onCreditCardTypeChanged.call(r,n.creditCardType)))},getNextCursorPosition:function(e,t,r){return t.length===e?r.length:e},setCurrentSelection:function(e){var t=this.element;if(this.setState({updateCursorPosition:!1}),t===document.activeElement)if(t.createTextRange){var r=t.createTextRange();r.move("character",e),r.select()}else t.setSelectionRange(e,e)},updateValueState:function(){var e=this;e.element||e.setState({value:e.properties.result});var t=e.element.selectionEnd,r=e.element.value,n=e.properties.result,o=e.getNextCursorPosition(t,r,n);return e.lastInputValue=e.properties.result,e.isAndroid?void window.setTimeout(function(){e.setState({value:e.properties.result,cursorPosition:o,updateCursorPosition:!0})},1):void e.setState({value:e.properties.result,cursorPosition:o,updateCursorPosition:!0})},render:function(){var e=this,t=e.props,r=(t.value,t.options,t.onKeyDown,t.onFocus,t.onBlur,t.onChange,t.onInit,t.htmlRef),a=n(t,["value","options","onKeyDown","onFocus","onBlur","onChange","onInit","htmlRef"]);return i.createElement("input",o({type:"text",ref:function(t){e.element=t,r&&r.apply(this,arguments)},value:e.state.value,onKeyDown:e.onKeyDown,onChange:e.onChange,onFocus:e.onFocus,onBlur:e.onBlur},a))}});e.exports=m},function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(1),o=r(3);if("undefined"==typeof n)throw Error("create-react-class could not find the React object. If you are using script tags, make sure that React is being loaded before create-react-class.");var i=(new n.Component).updater;e.exports=o(n.Component,n.isValidElement,i)},function(e,t,r){"use strict";function n(e){return e}function o(e,t,r){function o(e,t,r){for(var n in t)t.hasOwnProperty(n)&&"production"!==process.env.NODE_ENV&&c("function"==typeof t[n],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",u[r],n)}function p(e,t){var r=b.hasOwnProperty(t)?b[t]:null;C.hasOwnProperty(t)&&s("OVERRIDE_BASE"===r,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",t),e&&s("DEFINE_MANY"===r||"DEFINE_MANY_MERGED"===r,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t)}function d(e,r){if(r){s("function"!=typeof r,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),s(!t(r),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var n=e.prototype,o=n.__reactAutoBindPairs;r.hasOwnProperty(l)&&x.mixins(e,r.mixins);for(var i in r)if(r.hasOwnProperty(i)&&i!==l){var a=r[i],u=n.hasOwnProperty(i);if(p(u,i),x.hasOwnProperty(i))x[i](e,a);else{var d=b.hasOwnProperty(i),m="function"==typeof a,f=m&&!d&&!u&&r.autobind!==!1;if(f)o.push(i,a),n[i]=a;else if(u){var y=b[i];s(d&&("DEFINE_MANY_MERGED"===y||"DEFINE_MANY"===y),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",y,i),"DEFINE_MANY_MERGED"===y?n[i]=h(n[i],a):"DEFINE_MANY"===y&&(n[i]=g(n[i],a))}else n[i]=a,"production"!==process.env.NODE_ENV&&"function"==typeof a&&r.displayName&&(n[i].displayName=r.displayName+"_"+i)}}}else if("production"!==process.env.NODE_ENV){var v=typeof r,E="object"===v&&null!==r;"production"!==process.env.NODE_ENV&&c(E,"%s: You're attempting to include a mixin that is either null or not an object. Check the mixins included by the component, as well as any mixins they include themselves. Expected object but got %s.",e.displayName||"ReactClass",null===r?null:v)}}function m(e,t){if(t)for(var r in t){var n=t[r];if(t.hasOwnProperty(r)){var o=r in x;s(!o,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',r);var i=r in e;s(!i,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",r),e[r]=n}}}function f(e,t){s(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var r in t)t.hasOwnProperty(r)&&(s(void 0===e[r],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",r),e[r]=t[r]);return e}function h(e,t){return function(){var r=e.apply(this,arguments),n=t.apply(this,arguments);if(null==r)return n;if(null==n)return r;var o={};return f(o,r),f(o,n),o}}function g(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function y(e,t){var r=t.bind(e);if("production"!==process.env.NODE_ENV){r.__reactBoundContext=e,r.__reactBoundMethod=t,r.__reactBoundArguments=null;var n=e.constructor.displayName,o=r.bind;r.bind=function(i){for(var a=arguments.length,s=Array(a>1?a-1:0),u=1;u<a;u++)s[u-1]=arguments[u];if(i!==e&&null!==i)"production"!==process.env.NODE_ENV&&c(!1,"bind(): React component methods may only be bound to the component instance. See %s",n);else if(!s.length)return"production"!==process.env.NODE_ENV&&c(!1,"bind(): You are binding a component method to the component. React does this for you automatically in a high-performance way, so you can safely remove this call. See %s",n),r;var l=o.apply(r,arguments);return l.__reactBoundContext=e,l.__reactBoundMethod=t,l.__reactBoundArguments=s,l}}return r}function v(e){for(var t=e.__reactAutoBindPairs,r=0;r<t.length;r+=2){var n=t[r],o=t[r+1];e[n]=y(e,o)}}function E(e){var t=n(function(e,n,o){"production"!==process.env.NODE_ENV&&c(this instanceof t,"Something is calling a React component directly. Use a factory or JSX instead. See: https://fb.me/react-legacyfactory"),this.__reactAutoBindPairs.length&&v(this),this.props=e,this.context=n,this.refs=a,this.updater=o||r,this.state=null;var i=this.getInitialState?this.getInitialState():null;"production"!==process.env.NODE_ENV&&void 0===i&&this.getInitialState._isMockFunction&&(i=null),s("object"==typeof i&&!Array.isArray(i),"%s.getInitialState(): must return an object or null",t.displayName||"ReactCompositeComponent"),this.state=i});t.prototype=new S,t.prototype.constructor=t,t.prototype.__reactAutoBindPairs=[],D.forEach(d.bind(null,t)),d(t,N),d(t,e),d(t,w),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),"production"!==process.env.NODE_ENV&&(t.getDefaultProps&&(t.getDefaultProps.isReactClassApproved={}),t.prototype.getInitialState&&(t.prototype.getInitialState.isReactClassApproved={})),s(t.prototype.render,"createClass(...): Class specification must implement a `render` method."),"production"!==process.env.NODE_ENV&&(c(!t.prototype.componentShouldUpdate,"%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",e.displayName||"A component"),c(!t.prototype.componentWillRecieveProps,"%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?",e.displayName||"A component"));for(var o in b)t.prototype[o]||(t.prototype[o]=null);return t}var D=[],b={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},x={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var r=0;r<t.length;r++)d(e,t[r])},childContextTypes:function(e,t){"production"!==process.env.NODE_ENV&&o(e,t,"childContext"),e.childContextTypes=i({},e.childContextTypes,t)},contextTypes:function(e,t){"production"!==process.env.NODE_ENV&&o(e,t,"context"),e.contextTypes=i({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=h(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){"production"!==process.env.NODE_ENV&&o(e,t,"prop"),e.propTypes=i({},e.propTypes,t)},statics:function(e,t){m(e,t)},autobind:function(){}},N={componentDidMount:function(){this.__isMounted=!0}},w={componentWillUnmount:function(){this.__isMounted=!1}},C={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e,t)},isMounted:function(){return"production"!==process.env.NODE_ENV&&(c(this.__didWarnIsMounted,"%s: isMounted is deprecated. Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks.",this.constructor&&this.constructor.displayName||this.name||"Component"),this.__didWarnIsMounted=!0),!!this.__isMounted}},S=function(){};return i(S.prototype,e.prototype,C),E}var i=r(4),a=r(5),s=r(6);if("production"!==process.env.NODE_ENV)var c=r(7);var u,l="mixins";u="production"!==process.env.NODE_ENV?{prop:"prop",context:"context",childContext:"child context"}:{},e.exports=o},function(e,t){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function n(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=n()?Object.assign:function(e,t){for(var n,s,c=r(e),u=1;u<arguments.length;u++){n=Object(arguments[u]);for(var l in n)i.call(n,l)&&(c[l]=n[l]);if(o){s=o(n);for(var p=0;p<s.length;p++)a.call(n,s[p])&&(c[s[p]]=n[s[p]])}}return c}},function(e,t){"use strict";var r={};"production"!==process.env.NODE_ENV&&Object.freeze(r),e.exports=r},function(e,t){"use strict";function r(e,t,r,o,i,a,s,c){if(n(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,o,i,a,s,c],p=0;u=new Error(t.replace(/%s/g,function(){return l[p++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}var n=function(e){};"production"!==process.env.NODE_ENV&&(n=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=r},function(e,t,r){"use strict";var n=r(8),o=n;if("production"!==process.env.NODE_ENV){var i=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0,i="Warning: "+e.replace(/%s/g,function(){return r[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(a){}};o=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];i.apply(void 0,[t].concat(n))}}}e.exports=o},function(e,t){"use strict";function r(e){return function(){return e}}var n=function(){};n.thatReturns=r,n.thatReturnsFalse=r(!1),n.thatReturnsTrue=r(!0),n.thatReturnsNull=r(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},function(e,t){"use strict";var r=function n(e,t,r,o,i,a,s){var c=this;c.numeralDecimalMark=e||".",c.numeralIntegerScale=t>0?t:0,c.numeralDecimalScale=r>=0?r:2,c.numeralThousandsGroupStyle=o||n.groupStyle.thousand,c.numeralPositiveOnly=!!i,c.stripLeadingZeroes=a!==!1,c.delimiter=s||""===s?s:",",c.delimiterRE=s?new RegExp("\\"+s,"g"):""};r.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},r.prototype={getRawValue:function(e){return e.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(e){var t,n,o=this,i="";switch(e=e.replace(/[A-Za-z]/g,"").replace(o.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",o.numeralPositiveOnly?"":"-").replace("M",o.numeralDecimalMark),o.stripLeadingZeroes&&(e=e.replace(/^(-)?0+(?=\d)/,"$1")),n=e,e.indexOf(o.numeralDecimalMark)>=0&&(t=e.split(o.numeralDecimalMark),n=t[0],i=o.numeralDecimalMark+t[1].slice(0,o.numeralDecimalScale)),o.numeralIntegerScale>0&&(n=n.slice(0,o.numeralIntegerScale+("-"===e.slice(0,1)?1:0))),o.numeralThousandsGroupStyle){case r.groupStyle.lakh:n=n.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+o.delimiter);break;case r.groupStyle.wan:n=n.replace(/(\d)(?=(\d{4})+$)/g,"$1"+o.delimiter);break;case r.groupStyle.thousand:n=n.replace(/(\d)(?=(\d{3})+$)/g,"$1"+o.delimiter)}return n.toString()+(o.numeralDecimalScale>0?i.toString():"")}},e.exports=r},function(e,t){"use strict";var r=function(e){var t=this;t.date=[],t.blocks=[],t.datePattern=e,t.initBlocks()};r.prototype={initBlocks:function(){var e=this;e.datePattern.forEach(function(t){"Y"===t?e.blocks.push(4):e.blocks.push(2)})},getISOFormatDate:function(){var e=this,t=e.date;return t[2]?t[2]+"-"+e.addLeadingZero(t[1])+"-"+e.addLeadingZero(t[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(e){var t=this,r="";return e=e.replace(/[^\d]/g,""),t.blocks.forEach(function(n,o){if(e.length>0){var i=e.slice(0,n),a=i.slice(0,1),s=e.slice(n);switch(t.datePattern[o]){case"d":"00"===i?i="01":parseInt(a,10)>3?i="0"+a:parseInt(i,10)>31&&(i="31");break;case"m":"00"===i?i="01":parseInt(a,10)>1?i="0"+a:parseInt(i,10)>12&&(i="12")}r+=i,e=s}}),this.getFixedDateString(r)},getFixedDateString:function(e){var t,r,n,o=this,i=o.datePattern,a=[],s=0,c=0,u=0,l=0,p=0,d=0;return 4===e.length&&"y"!==i[0].toLowerCase()&&"y"!==i[1].toLowerCase()&&(l="d"===i[0]?0:2,p=2-l,t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(p,p+2),10),a=this.getFixedDate(t,r,0)),8===e.length&&(i.forEach(function(e,t){switch(e){case"d":s=t;break;case"m":c=t;break;default:u=t}}),d=2*u,l=s<=u?2*s:2*s+2,p=c<=u?2*c:2*c+2,t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(p,p+2),10),n=parseInt(e.slice(d,d+4),10),a=this.getFixedDate(t,r,n)),o.date=a,0===a.length?e:i.reduce(function(e,t){switch(t){case"d":return e+o.addLeadingZero(a[0]);case"m":return e+o.addLeadingZero(a[1]);default:return e+""+(a[2]||"")}},"")},getFixedDate:function(e,t,r){return e=Math.min(e,31),t=Math.min(t,12),r=parseInt(r||0,10),(t<7&&t%2===0||t>8&&t%2===1)&&(e=Math.min(e,2===t?this.isLeapYear(r)?29:28:30)),[e,t,r]},isLeapYear:function(e){return e%4===0&&e%100!==0||e%400===0},addLeadingZero:function(e){return(e<10?"0":"")+e}},e.exports=r},function(e,t){"use strict";var r=function(e,t){var r=this;r.delimiter=t||""===t?t:" ",r.delimiterRE=t?new RegExp("\\"+t,"g"):"",r.formatter=e};r.prototype={setFormatter:function(e){this.formatter=e},format:function(e){var t=this;t.formatter.clear(),e=e.replace(/[^\d+]/g,""),e=e.replace(t.delimiterRE,"");for(var r,n="",o=!1,i=0,a=e.length;i<a;i++)r=t.formatter.inputDigit(e.charAt(i)),/[\s()-]/g.test(r)?(n=r,o=!0):o||(n=r);return n=n.replace(/[()]/g,""),n=n.replace(/[\s-]/g,t.delimiter)}},e.exports=r},function(e,t){"use strict";var r={blocks:{uatp:[4,5,6],amex:[4,6,5],diners:[4,6,4],discover:[4,4,4,4],mastercard:[4,4,4,4],dankort:[4,4,4,4],instapayment:[4,4,4,4],jcb:[4,4,4,4],maestro:[4,4,4,4],visa:[4,4,4,4],mir:[4,4,4,4],general:[4,4,4,4],unionPay:[4,4,4,4],generalStrict:[4,4,4,7]},re:{uatp:/^(?!1800)1\d{0,14}/,amex:/^3[47]\d{0,13}/,discover:/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,diners:/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,mastercard:/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,dankort:/^(5019|4175|4571)\d{0,12}/,instapayment:/^63[7-9]\d{0,13}/,jcb:/^(?:2131|1800|35\d{0,2})\d{0,12}/,maestro:/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,mir:/^220[0-4]\d{0,12}/,visa:/^4\d{0,15}/,unionPay:/^62\d{0,14}/},getInfo:function(e,t){var n=r.blocks,o=r.re;t=!!t;for(var i in o)if(o[i].test(e)){var a;return a=("discover"===i||"maestro"===i||"visa"===i||"mir"===i||"unionPay"===i)&&t?n.generalStrict:n[i],{type:i,blocks:a}}return{type:"unknown",blocks:t?n.generalStrict:n.general}}};e.exports=r},function(e,t){"use strict";var r={noop:function(){},strip:function(e,t){return e.replace(t,"")},isDelimiter:function(e,t,r){return 0===r.length?e===t:r.some(function(t){if(e===t)return!0})},getDelimiterREByDelimiter:function(e){return new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g")},stripDelimiters:function(e,t,r){var n=this;if(0===r.length){var o=t?n.getDelimiterREByDelimiter(t):"";return e.replace(o,"")}return r.forEach(function(t){e=e.replace(n.getDelimiterREByDelimiter(t),"")}),e},headStr:function(e,t){return e.slice(0,t)},getMaxLength:function(e){return e.reduce(function(e,t){return e+t},0)},getPrefixStrippedValue:function(e,t,r){if(e.slice(0,r)!==t){var n=this.getFirstDiffIndex(t,e.slice(0,r));e=t+e.slice(n,n+1)+e.slice(r+1)}return e.slice(r)},getFirstDiffIndex:function(e,t){for(var r=0;e.charAt(r)===t.charAt(r);)if(""===e.charAt(r++))return-1;return r},getFormattedValue:function(e,t,r,n,o,i){var a,s="",c=o.length>0;return 0===r?e:(t.forEach(function(t,u){if(e.length>0){var l=e.slice(0,t),p=e.slice(t);a=c?o[i?u-1:u]||a:n,i?(u>0&&(s+=a),s+=l):(s+=l,l.length===t&&u<r-1&&(s+=a)),e=p}}),s)},isAndroid:function(){return navigator&&/android/i.test(navigator.userAgent)},isAndroidBackspaceKeydown:function(e,t){return!!(this.isAndroid()&&e&&t)&&t===e.slice(0,-1)}};e.exports=r},function(e,t){"use strict";var r="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},n={assign:function(e,t){return e=e||{},t=t||{},e.creditCard=!!t.creditCard,e.creditCardStrictMode=!!t.creditCardStrictMode,e.creditCardType="",e.onCreditCardTypeChanged=t.onCreditCardTypeChanged||function(){},e.phone=!!t.phone,e.phoneRegionCode=t.phoneRegionCode||"AU",e.phoneFormatter={},e.date=!!t.date,e.datePattern=t.datePattern||["d","m","Y"],e.dateFormatter={},e.numeral=!!t.numeral,e.numeralIntegerScale=t.numeralIntegerScale>0?t.numeralIntegerScale:0,e.numeralDecimalScale=t.numeralDecimalScale>=0?t.numeralDecimalScale:2,e.numeralDecimalMark=t.numeralDecimalMark||".",e.numeralThousandsGroupStyle=t.numeralThousandsGroupStyle||"thousand",e.numeralPositiveOnly=!!t.numeralPositiveOnly,e.stripLeadingZeroes=t.stripLeadingZeroes!==!1,e.numericOnly=e.creditCard||e.date||!!t.numericOnly,e.uppercase=!!t.uppercase,e.lowercase=!!t.lowercase,e.prefix=e.creditCard||e.date?"":t.prefix||"",e.noImmediatePrefix=!!t.noImmediatePrefix,e.prefixLength=e.prefix.length,e.rawValueTrimPrefix=!!t.rawValueTrimPrefix,e.copyDelimiter=!!t.copyDelimiter,e.initValue=void 0!==t.initValue&&null!==t.initValue?t.initValue.toString():"",e.delimiter=t.delimiter||""===t.delimiter?t.delimiter:t.date?"/":t.numeral?",":(t.phone," "),e.delimiterLength=e.delimiter.length,e.delimiterLazyShow=!!t.delimiterLazyShow,e.delimiters=t.delimiters||[],e.blocks=t.blocks||[],e.blocksLength=e.blocks.length,e.root="object"===("undefined"==typeof global?"undefined":r(global))&&global?global:window,e.maxLength=0,e.backspace=!1,e.result="",e}};e.exports=n}])});