/*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */function $(t){return Object.prototype.toString.call(t)==="[object Object]"}function V(t){var n,r;return $(t)===!1?!1:(n=t.constructor,n===void 0?!0:(r=n.prototype,!($(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}function O(){return O=Object.assign||function(t){for(var n=1;n=0||(i[r]=t[r]);return i}const k={silent:!1,logLevel:"warn"},D=["validator"],S=Object.prototype,q=S.toString,F=S.hasOwnProperty,A=/^\s*function (\w+)/;function w(t){var n;const r=(n=t==null?void 0:t.type)!==null&&n!==void 0?n:t;if(r){const e=r.toString().match(A);return e?e[1]:""}return""}const y=V,L=t=>t;let c=L;const h=(t,n)=>F.call(t,n),Y=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t},b=Array.isArray||function(t){return q.call(t)==="[object Array]"},g=t=>q.call(t)==="[object Function]",j=t=>y(t)&&h(t,"_vueTypes_name"),N=t=>y(t)&&(h(t,"type")||["_vueTypes_name","validator","default","required"].some(n=>h(t,n)));function T(t,n){return Object.defineProperty(t.bind(n),"__original",{value:t})}function v(t,n,r=!1){let e,i=!0,o="";e=y(t)?t:{type:t};const s=j(e)?e._vueTypes_name+" - ":"";if(N(e)&&e.type!==null){if(e.type===void 0||e.type===!0||!e.required&&n===void 0)return i;b(e.type)?(i=e.type.some(a=>v(a,n,!0)===!0),o=e.type.map(a=>w(a)).join(" or ")):(o=w(e),i=o==="Array"?b(n):o==="Object"?y(n):o==="String"||o==="Number"||o==="Boolean"||o==="Function"?function(a){if(a==null)return"";const u=a.constructor.toString().match(A);return u?u[1]:""}(n)===o:n instanceof e.type)}if(!i){const a=`${s}value "${n}" should be of type "${o}"`;return r===!1?(c(a),!1):a}if(h(e,"validator")&&g(e.validator)){const a=c,u=[];if(c=l=>{u.push(l)},i=e.validator(n),c=a,!i){const l=(u.length>1?"* ":"")+u.join(` * `);return u.length=0,r===!1?(c(l),i):l}}return i}function d(t,n){const r=Object.defineProperties(n,{_vueTypes_name:{value:t,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(i){return i===void 0?(h(this,"default")&&delete this.default,this):g(i)||v(this,i,!0)===!0?(this.default=b(i)?()=>[...i]:y(i)?()=>Object.assign({},i):i,this):(c(`${this._vueTypes_name} - invalid default value: "${i}"`),this)}}}),{validator:e}=r;return g(e)&&(r.validator=T(e,r)),r}function p(t,n){const r=d(t,n);return Object.defineProperty(r,"validate",{value(e){return g(this.validator)&&c(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info: ${JSON.stringify(this)}`),this.validator=T(e,this),this}})}function P(t,n,r){const e=function(u){const l={};return Object.getOwnPropertyNames(u).forEach(f=>{l[f]=Object.getOwnPropertyDescriptor(u,f)}),Object.defineProperties({},l)}(n);if(e._vueTypes_name=t,!y(r))return e;const{validator:i}=r,o=x(r,D);if(g(i)){let{validator:u}=e;u&&(u=(a=(s=u).__original)!==null&&a!==void 0?a:s),e.validator=T(u?function(l){return u.call(this,l)&&i.call(this,l)}:i,e)}var s,a;return Object.assign(e,o)}function _(t){return t.replace(/^(?!\s*$)/gm," ")}const B=()=>p("any",{}),I=()=>p("function",{type:Function}),J=()=>p("boolean",{type:Boolean}),M=()=>p("string",{type:String}),R=()=>p("number",{type:Number}),z=()=>p("array",{type:Array}),C=()=>p("object",{type:Object}),G=()=>d("integer",{type:Number,validator:t=>Y(t)}),H=()=>d("symbol",{validator:t=>typeof t=="symbol"});function K(t,n="custom validation failed"){if(typeof t!="function")throw new TypeError("[VueTypes error]: You must provide a function as argument");return d(t.name||"<>",{type:null,validator(r){const e=t(r);return e||c(`${this._vueTypes_name} - ${n}`),e}})}function Q(t){if(!b(t))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const n=`oneOf - value should be one of "${t.join('", "')}".`,r=t.reduce((e,i)=>{if(i!=null){const o=i.constructor;e.indexOf(o)===-1&&e.push(o)}return e},[]);return d("oneOf",{type:r.length>0?r:void 0,validator(e){const i=t.indexOf(e)!==-1;return i||c(n),i}})}function U(t){if(!b(t))throw new TypeError("[VueTypes error]: You must provide an array as argument");let n=!1,r=[];for(let i=0;ir.indexOf(i)===o);const e=r.length>0?r:null;return d("oneOfType",n?{type:e,validator(i){const o=[],s=t.some(a=>{const u=v(j(a)&&a._vueTypes_name==="oneOf"?a.type||null:a,i,!0);return typeof u=="string"&&o.push(u),u===!0});return s||c(`oneOfType - provided value does not match any of the ${o.length} passed-in validators: ${_(o.join(` `))}`),s}}:{type:e})}function W(t){return d("arrayOf",{type:Array,validator(n){let r="";const e=n.every(i=>(r=v(t,i,!0),r===!0));return e||c(`arrayOf - value validation error: ${_(r)}`),e}})}function X(t){return d("instanceOf",{type:t})}function Z(t){return d("objectOf",{type:Object,validator(n){let r="";const e=Object.keys(n).every(i=>(r=v(t,n[i],!0),r===!0));return e||c(`objectOf - value validation error: ${_(r)}`),e}})}function tt(t){const n=Object.keys(t),r=n.filter(i=>{var o;return!((o=t[i])===null||o===void 0||!o.required)}),e=d("shape",{type:Object,validator(i){if(!y(i))return!1;const o=Object.keys(i);if(r.length>0&&r.some(s=>o.indexOf(s)===-1)){const s=r.filter(a=>o.indexOf(a)===-1);return c(s.length===1?`shape - required property "${s[0]}" is not defined.`:`shape - required properties "${s.join('", "')}" are not defined.`),!1}return o.every(s=>{if(n.indexOf(s)===-1)return this._vueTypes_isLoose===!0||(c(`shape - shape definition does not include a "${s}" property. Allowed keys: "${n.join('", "')}".`),!1);const a=v(t[s],i[s],!0);return typeof a=="string"&&c(`shape - "${s}" property validation error: ${_(a)}`),a===!0})}});return Object.defineProperty(e,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(e,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),e}const et=["name","validate","getter"],rt=(()=>{var t,n;return n=t=class{static get any(){return B()}static get func(){return I().def(this.defaults.func)}static get bool(){return J().def(this.defaults.bool)}static get string(){return M().def(this.defaults.string)}static get number(){return R().def(this.defaults.number)}static get array(){return z().def(this.defaults.array)}static get object(){return C().def(this.defaults.object)}static get integer(){return G().def(this.defaults.integer)}static get symbol(){return H()}static extend(r){if(b(r))return r.forEach(l=>this.extend(l)),this;const{name:e,validate:i=!1,getter:o=!1}=r,s=x(r,et);if(h(this,e))throw new TypeError(`[VueTypes error]: Type "${e}" already defined`);const{type:a}=s;if(j(a))return delete s.type,Object.defineProperty(this,e,o?{get:()=>P(e,a,s)}:{value(...l){const f=P(e,a,s);return f.validator&&(f.validator=f.validator.bind(f,...l)),f}});let u;return u=o?{get(){const l=Object.assign({},s);return i?p(e,l):d(e,l)},enumerable:!0}:{value(...l){const f=Object.assign({},s);let m;return m=i?p(e,f):d(e,f),f.validator&&(m.validator=f.validator.bind(m,...l)),m},enumerable:!0},Object.defineProperty(this,e,u)}},t.defaults={},t.sensibleDefaults=void 0,t.config=k,t.custom=K,t.oneOf=Q,t.instanceOf=X,t.oneOfType=U,t.arrayOf=W,t.objectOf=Z,t.shape=tt,t.utils={validate:(r,e)=>v(e,r,!0)===!0,toType:(r,e,i=!1)=>i?p(r,e):d(r,e)},n})();function E(t={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var n,r;return r=n=class extends rt{static get sensibleDefaults(){return O({},this.defaults)}static set sensibleDefaults(e){this.defaults=e!==!1?O({},e!==!0?e:t):{}}},n.defaults=O({},t),r}class it extends E(){}const nt=E({func:void 0,bool:void 0,string:void 0,number:void 0,object:void 0,integer:void 0});nt.extend([{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VNodeChild",getter:!0,type:void 0}]);export{nt as p};