var e,t=(e=require("vue"))&&"object"==typeof e&&"default"in e?e.default:e;function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(){return(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}).apply(this,arguments)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function u(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}function a(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var f=Object.prototype,c=f.toString,s=f.hasOwnProperty,l=/^\s*function (\w+)/;function p(e){var t,r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){var n=r.toString().match(l);return n?n[1]:""}return""}var y=function(e){var t,r;return!1!==a(e)&&"function"==typeof(t=e.constructor)&&!1!==a(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")},v=function(e){return e},d=v;if("production"!==process.env.NODE_ENV){var h="undefined"!=typeof console;d=h?function(e){!1===t.config.silent&&console.warn("[VueTypes warn]: "+e)}:v}var b=function(e,t){return s.call(e,t)},O=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},g=Array.isArray||function(e){return"[object Array]"===c.call(e)},m=function(e){return"[object Function]"===c.call(e)},j=function(e){return y(e)&&b(e,"_vueTypes_name")},_=function(e){return y(e)&&(b(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return b(e,t)}))};function T(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function x(e,t,r){var n;void 0===r&&(r=!1);var o=!0,i="";n=y(e)?e:{type:e};var u=j(n)?n._vueTypes_name+" - ":"";if(_(n)&&null!==n.type){if(void 0===n.type)return o;if(!n.required&&void 0===t)return o;void 0===n.type?i="any":g(n.type)?(o=n.type.some(function(e){return!0===x(e,t,!0)}),i=n.type.map(function(e){return p(e)}).join(" or ")):o="Array"===(i=p(n))?g(t):"Object"===i?y(t):"String"===i||"Number"===i||"Boolean"===i||"Function"===i?function(e){if(null==e)return"";var t=e.constructor.toString().match(l);return t?t[1]:""}(t)===i:t instanceof n.type}if(!o){var a=u+'value "'+t+'" should be of type "'+i+'"';return!1===r?(d(a),!1):a}if(b(n,"validator")&&m(n.validator)){var f=d,c=[];if(d=function(e){c.push(e)},o=n.validator(t),d=f,!o){var s=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,!1===r?(d(s),o):s}}return o}function w(e,t){var r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0===e?(b(this,"default")&&delete this.default,this):m(e)||!0===x(this,e,!0)?(this.default=g(e)?function(){return[].concat(e)}:y(e)?function(){return Object.assign({},e)}:e,this):(d(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),n=r.validator;return m(n)&&(r.validator=T(n,r)),r}function k(e,t){var r=w(e,t);return Object.defineProperty(r,"validate",{value:function(e){return m(this.validator)&&d(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=T(e,this),this}})}function P(e,t,r){var n,o,i=(n=t,o={},Object.getOwnPropertyNames(n).forEach(function(e){o[e]=Object.getOwnPropertyDescriptor(n,e)}),Object.defineProperties({},o));if(i._vueTypes_name=e,!y(r))return i;var a,f,c=r.validator,s=u(r,["validator"]);if(m(c)){var l=i.validator;l&&(l=null!==(f=(a=l).__original)&&void 0!==f?f:a),i.validator=T(l?function(e){return l.call(this,e)&&c.call(this,e)}:c,i)}return Object.assign(i,s)}function A(e){return e.replace(/^(?!\s*$)/gm,"  ")}var q=function(){return k("any",{})},E=function(){return k("function",{type:Function})},N=function(){return k("boolean",{type:Boolean})},V=function(){return k("string",{type:String})},S=function(){return k("number",{type:Number})},F=function(){return k("array",{type:Array})},D=function(){return k("object",{type:Object})},L=function(){return w("integer",{type:Number,validator:function(e){return O(e)}})},Y=function(){return w("symbol",{validator:function(e){return"symbol"==typeof e}})};function B(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return w(e.name||"<<anonymous function>>",{validator:function(r){var n=e(r);return n||d(this._vueTypes_name+" - "+t),n}})}function M(e){if(!g(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'".',r=e.reduce(function(e,t){if(null!=t){var r=t.constructor;-1===e.indexOf(r)&&e.push(r)}return e},[]);return w("oneOf",{type:r.length>0?r:void 0,validator:function(r){var n=-1!==e.indexOf(r);return n||d(t),n}})}function I(e){if(!g(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,r=[],n=0;n<e.length;n+=1){var o=e[n];if(_(o)){if(j(o)&&"oneOf"===o._vueTypes_name){r=r.concat(o.type||[]);continue}if(m(o.validator)&&(t=!0),void 0!==o.type){r=r.concat(o.type);continue}}r.push(o)}return r=r.filter(function(e,t){return r.indexOf(e)===t}),w("oneOfType",t?{type:r,validator:function(t){var r=[],n=e.some(function(e){var n=x(j(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof n&&r.push(n),!0===n});return n||d("oneOfType - provided value does not match any of the "+r.length+" passed-in validators:\n"+A(r.join("\n"))),n}}:{type:r})}function J(e){return w("arrayOf",{type:Array,validator:function(t){var r,n=t.every(function(t){return!0===(r=x(e,t,!0))});return n||d("arrayOf - value validation error:\n"+A(r)),n}})}function R(e){return w("instanceOf",{type:e})}function $(e){return w("objectOf",{type:Object,validator:function(t){var r,n=Object.keys(t).every(function(n){return!0===(r=x(e,t[n],!0))});return n||d("objectOf - value validation error:\n"+A(r)),n}})}function z(e){var t=Object.keys(e),r=t.filter(function(t){var r;return!!(null===(r=e[t])||void 0===r?void 0:r.required)}),n=w("shape",{type:Object,validator:function(n){var o=this;if(!y(n))return!1;var i=Object.keys(n);if(r.length>0&&r.some(function(e){return-1===i.indexOf(e)})){var u=r.filter(function(e){return-1===i.indexOf(e)});return d(1===u.length?'shape - required property "'+u[0]+'" is not defined.':'shape - required properties "'+u.join('", "')+'" are not defined.'),!1}return i.every(function(r){if(-1===t.indexOf(r))return!0===o._vueTypes_isLoose||(d('shape - shape definition does not include a "'+r+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var i=x(e[r],n[r],!0);return"string"==typeof i&&d('shape - "'+r+'" property validation error:\n '+A(i)),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),n}var C=function(){function e(){}return e.extend=function(e){var t=this;if(g(e))return e.forEach(function(e){return t.extend(e)}),this;var r=e.name,n=e.validate,o=void 0!==n&&n,i=e.getter,a=void 0!==i&&i,f=u(e,["name","validate","getter"]);if(b(this,r))throw new TypeError('[VueTypes error]: Type "'+r+'" already defined');var c,s=f.type;return j(s)?(delete f.type,Object.defineProperty(this,r,a?{get:function(){return P(r,s,f)}}:{value:function(){var e,t=P(r,s,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=a?{get:function(){var e=Object.assign({},f);return o?k(r,e):w(r,e)},enumerable:!0}:{value:function(){var e,t,n=Object.assign({},f);return e=o?k(r,n):w(r,n),n.validator&&(e.validator=(t=n.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,r,c))},n(e,null,[{key:"any",get:function(){return q()}},{key:"func",get:function(){return E().def(this.defaults.func)}},{key:"bool",get:function(){return N().def(this.defaults.bool)}},{key:"string",get:function(){return V().def(this.defaults.string)}},{key:"number",get:function(){return S().def(this.defaults.number)}},{key:"array",get:function(){return F().def(this.defaults.array)}},{key:"object",get:function(){return D().def(this.defaults.object)}},{key:"integer",get:function(){return L().def(this.defaults.integer)}},{key:"symbol",get:function(){return Y()}}]),e}();function G(e){var t;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(t=function(t){function r(){return t.apply(this,arguments)||this}return i(r,t),n(r,null,[{key:"sensibleDefaults",get:function(){return o({},this.defaults)},set:function(t){this.defaults=!1!==t?o({},!0!==t?t:e):{}}}]),r}(C)).defaults=o({},e),t}C.defaults={},C.custom=B,C.oneOf=M,C.instanceOf=R,C.oneOfType=I,C.arrayOf=J,C.objectOf=$,C.shape=z,C.utils={validate:function(e,t){return!0===x(t,e,!0)},toType:function(e,t,r){return void 0===r&&(r=!1),r?k(e,t):w(e,t)}};var H=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(G());Object.defineProperty(exports,"__esModule",{value:!0}),exports.any=q,exports.array=F,exports.arrayOf=J,exports.bool=N,exports.createTypes=G,exports.custom=B,exports.default=H,exports.fromType=P,exports.func=E,exports.instanceOf=R,exports.integer=L,exports.number=S,exports.object=D,exports.objectOf=$,exports.oneOf=M,exports.oneOfType=I,exports.shape=z,exports.string=V,exports.symbol=Y,exports.toType=w,exports.toValidableType=k,exports.validateType=x;
//# sourceMappingURL=vue-types.js.map
