1
0
mirror of synced 2024-11-22 13:26:06 +03:00
vue-formulario/dist/formulate.min.js
2020-05-19 11:03:49 +03:00

16 lines
48 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var VueFormulate=function(){"use strict";var t=function(t,e){return{classification:t,component:"FormulateInput"+(e||t[0].toUpperCase()+t.substr(1))}},e=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(e,r){var i;return Object.assign({},e,((i={})[r]=t("text"),i))}),{}),{range:t("slider"),textarea:t("textarea","TextArea"),checkbox:t("box"),radio:t("box"),submit:t("button"),button:t("button"),select:t("select"),file:t("file"),image:t("file"),group:t("group")}),r=function(t){if("string"!=typeof t)return!1;var e=t.match(i);if(!e)return!1;var r=e[1];if(!r)return!1;if(o.test(r)||n.test(r))return!0;return!1},i=/^(?:\w+:)?\/\/(\S+)$/,o=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/;for(var s="-_",a=36;a--;)s+=a.toString(36);for(a=36;a---10;)s+=a.toString(36).toUpperCase();var u=function(t){var e="";for(a=t||21;a--;)e+=s[64*Math.random()|0];return e},l=function(t,e,r){void 0===r&&(r={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},r),this.results=!1,this.context=e,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function c(t,e){var r={};for(var i in t)r[i]=e(i,t[i]);return r}function h(t,e){if(t===e)return!0;if(!t||!e)return!1;var r=Object.keys(t),i=Object.keys(e),o=r.length;if(i.length!==o)return!1;for(var n=0;n<o;n++){var s=r[n];if(t[s]!==e[s])return!1}return!0}function d(t){return"string"==typeof t?t.replace(/([_][a-z0-9])/gi,(function(e){return 0!==t.indexOf(e)&&"_"!==t[t.indexOf(e)-1]?e.toUpperCase().replace("_",""):e})):t}function f(t){return t?"string"==typeof t?[t]:Array.isArray(t)?t:"object"==typeof t?Object.values(t):[]:[]}function p(t,e){return"string"==typeof t?p(t.split("|"),e):Array.isArray(t)?t.map((function(t){return function(t,e){if("function"==typeof t)return[t,[]];if(Array.isArray(t)&&t.length){var r=m((t=t.map((function(t){return t}))).shift()),i=r[0],o=r[1];if("string"==typeof i&&e.hasOwnProperty(i))return[e[i],t,i,o];if("function"==typeof i)return[i,t,i,o]}if("string"==typeof t){var n=t.split(":"),s=m(n.shift()),a=s[0],u=s[1];if(e.hasOwnProperty(a))return[e[a],n.length?n.join(":").split(","):[],a,u];throw new Error("Unknown validation rule "+t)}return!1}(t,e)})).filter((function(t){return!!t})):[]}function m(t){return/^[\^]/.test(t.charAt(0))?[d(t.substr(1)),t.charAt(0)]:[d(t),null]}function v(t){switch(typeof t){case"symbol":case"number":case"string":case"boolean":case"undefined":return!0;default:return null===t}}function y(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function g(t,e){return Object.defineProperty(t,"__id",Object.assign(Object.create(null),{value:e||Symbol("uuid")}))}l.prototype.rehydrateFileList=function(t){var e=this,r=t.reduce((function(t,r){var i=r[e.options?e.options.fileUrlKey:"url"],o=!(!i||-1===i.lastIndexOf("."))&&i.substr(i.lastIndexOf(".")+1),n=e.options.mimes[o]||!1;return t.push(Object.assign({},r,i?{name:i.substr(i.lastIndexOf("/")+1||0),type:r.type?r.type:n,previewData:i}:{})),t}),[]);this.results=t,this.addFileList(r)},l.prototype.addFileList=function(t){for(var e=this,r=function(r){var i=t[r],o=u();e.files.push({progress:!1,error:!1,complete:!1,justFinished:!1,name:i.name||"file-upload",file:i,uuid:o,path:!1,removeFile:function(){this.removeFile(o)}.bind(e),previewData:i.previewData||!1})},i=0;i<t.length;i++)r(i)},l.prototype.hasUploader=function(){return!!this.context.uploader},l.prototype.uploaderIsAxios=function(){return!(!this.hasUploader||"function"!=typeof this.context.uploader.request||"function"!=typeof this.context.uploader.get||"function"!=typeof this.context.uploader.delete||"function"!=typeof this.context.uploader.post)},l.prototype.getUploader=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];if(this.uploaderIsAxios()){var i=new FormData;if(i.append(this.context.name||"file",e[0]),!1===this.context.uploadUrl)throw new Error("No uploadURL specified: https://vueformulate.com/guide/inputs/file/#props");return this.context.uploader.post(this.context.uploadUrl,i,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:function(t){e[1](Math.round(100*t.loaded/t.total))}}).then((function(t){return t.data})).catch((function(t){return e[2](t)}))}return(t=this.context).uploader.apply(t,e)},l.prototype.upload=function(){var t=this;return this.results?Promise.resolve(this.results):new Promise((function(e,r){if(!t.hasUploader)return r(new Error("No uploader has been defined"));Promise.all(t.files.map((function(e){return e.path?Promise.resolve(e.path):t.getUploader(e.file,(function(r){e.progress=r,r>=100&&(e.complete||(e.justFinished=!0,setTimeout((function(){e.justFinished=!1}),t.options.uploadJustCompleteDuration)),e.complete=!0)}),(function(t){e.progress=0,e.error=t,e.complete=!0}),t.options)}))).then((function(r){t.results=r,e(r)})).catch((function(t){throw new Error(t)}))}))},l.prototype.removeFile=function(t){if(this.files=this.files.filter((function(e){return e.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var e=new DataTransfer;this.files.map((function(t){return e.items.add(t.file)})),this.fileList=e.files,this.input.files=this.fileList}},l.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var e=new FileReader;e.onload=function(e){return Object.assign(t,{previewData:e.target.result})},e.readAsDataURL(t.file)}}))},l.prototype.getFileList=function(){return this.fileList},l.prototype.getFiles=function(){return this.files},l.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var b={accepted:function(t){var e=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(e))},after:function(t,e){var r=t.value;void 0===e&&(e=!1);var i=Date.parse(e||new Date),o=Date.parse(r);return Promise.resolve(!isNaN(o)&&o>i)},alpha:function(t,e){var r=t.value;void 0===e&&(e="default");var i={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},o=i.hasOwnProperty(e)?e:"default";return Promise.resolve(i[o].test(r))},alphanumeric:function(t,e){var r=t.value;void 0===e&&(e="default");var i={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},o=i.hasOwnProperty(e)?e:"default";return Promise.resolve(i[o].test(r))},before:function(t,e){var r=t.value;void 0===e&&(e=!1);var i=Date.parse(e||new Date),o=Date.parse(r);return Promise.resolve(!isNaN(o)&&o<i)},between:function(t,e,r,i){var o=t.value;return void 0===e&&(e=0),void 0===r&&(r=10),Promise.resolve(null!==e&&null!==r&&!isNaN(e)&&!isNaN(r)&&(!isNaN(o)&&"length"!==i||"value"===i?(o=Number(o),e=Number(e),r=Number(r),o>e&&o<r):("string"==typeof o||"length"===i)&&(o=isNaN(o)?o:o.toString()).length>e&&o.length<r))},confirm:function(t,e){var r,i,o=t.value,n=t.getFormValues,s=t.name;return Promise.resolve((r=n(),(i=e)||(i=/_confirm$/.test(s)?s.substr(0,s.length-8):s+"_confirm"),r[i]===o))},date:function(t,e){var r=t.value;return void 0===e&&(e=!1),Promise.resolve(e&&"string"==typeof e?function(t){var e="^"+t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"$",r={MM:"(0[1-9]|1[012])",M:"([1-9]|1[012])",DD:"([012][1-9]|3[01])",D:"([012]?[1-9]|3[01])",YYYY:"\\d{4}",YY:"\\d{2}"};return new RegExp(Object.keys(r).reduce((function(t,e){return t.replace(e,r[e])}),e))}(e).test(r):!isNaN(Date.parse(r)))},email:function(t){var e=t.value;return Promise.resolve(/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(e))},endsWith:function(t){for(var e=t.value,r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.endsWith(t)})):"string"==typeof e&&0===r.length)},in:function(t){for(var e=t.value,r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];return Promise.resolve(void 0!==r.find((function(t){return"object"==typeof t?h(t,e):t===e})))},matches:function(t){for(var e=t.value,r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];return Promise.resolve(!!r.find((function(t){return"string"==typeof t&&"/"===t.substr(0,1)&&"/"===t.substr(-1)&&(t=new RegExp(t.substr(1,t.length-2))),t instanceof RegExp?t.test(e):t===e})))},mime:function(t){for(var e=t.value,r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];return Promise.resolve(function(){if(e instanceof l)for(var t=e.getFiles(),i=0;i<t.length;i++){var o=t[i].file;if(!r.includes(o.type))return!1}return!0}())},min:function(t,e,r){var i=t.value;return void 0===e&&(e=1),Promise.resolve(Array.isArray(i)?(e=isNaN(e)?e:Number(e),i.length>=e):!isNaN(i)&&"length"!==r||"value"===r?(i=isNaN(i)?i:Number(i))>=e:("string"==typeof i||"length"===r)&&(i=isNaN(i)?i:i.toString()).length>=e)},max:function(t,e,r){var i=t.value;return void 0===e&&(e=10),Promise.resolve(Array.isArray(i)?(e=isNaN(e)?e:Number(e),i.length<=e):!isNaN(i)&&"length"!==r||"value"===r?(i=isNaN(i)?i:Number(i))<=e:("string"==typeof i||"length"===r)&&(i=isNaN(i)?i:i.toString()).length<=e)},not:function(t){for(var e=t.value,r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];return Promise.resolve(void 0===r.find((function(t){return"object"==typeof t?h(t,e):t===e})))},number:function(t){var e=t.value;return Promise.resolve(!isNaN(e))},required:function(t,e){var r=t.value;return void 0===e&&(e=!0),Promise.resolve(!(e&&!["no","false"].includes(e))||(Array.isArray(r)?!!r.length:r instanceof l?r.getFiles().length>0:"string"==typeof r?!!r:"object"!=typeof r||!!r&&!!Object.keys(r).length))},startsWith:function(t){for(var e=t.value,r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.startsWith(t)})):"string"==typeof e&&0===r.length)},url:function(t){var e=t.value;return Promise.resolve(r(e))},bail:function(){return Promise.resolve(!0)}},x="image/",E={csv:"text/csv",gif:x+"gif",jpg:x+"jpeg",jpeg:x+"jpeg",png:x+"png",pdf:"application/pdf",svg:x+"svg+xml"};
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function w(t){return!0==(null!=(e=t)&&"object"==typeof e&&!1===Array.isArray(e))&&"[object Object]"===Object.prototype.toString.call(t);
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var e}function F(t){var e,r;return!1!==w(t)&&("function"==typeof(e=t.constructor)&&(!1!==w(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}function O(t){return"string"==typeof t?t[0].toUpperCase()+t.substr(1):t}var V={accepted:function(t){return"Please accept the "+t.name+"."},after:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?O(e)+" must be after "+r[0]+".":O(e)+" must be a later date."},alpha:function(t){return O(t.name)+" can only contain alphabetical characters."},alphanumeric:function(t){return O(t.name)+" can only contain letters and numbers."},before:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?O(e)+" must be before "+r[0]+".":O(e)+" must be an earlier date."},between:function(t){var e=t.name,r=t.value,i=t.args,o=!(!Array.isArray(i)||!i[2])&&i[2];return!isNaN(r)&&"length"!==o||"value"===o?O(e)+" must be between "+i[0]+" and "+i[1]+".":O(e)+" must be between "+i[0]+" and "+i[1]+" characters long."},confirm:function(t){var e=t.name;return t.args,O(e)+" does not match."},date:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?O(e)+" is not a valid, please use the format "+r[0]:O(e)+" is not a valid date."},default:function(t){return t.name,"This field isnt valid."},email:function(t){t.name;var e=t.value;return e?"“"+e+"” is not a valid email address.":"Please enter a valid email address."},endsWith:function(t){t.name;var e=t.value;return e?"“"+e+"” doesnt end with a valid value.":"This field doesnt end with a valid value."},in:function(t){var e=t.name,r=t.value;return"string"==typeof r&&r?"“"+O(r)+"” is not an allowed "+e+".":"This is not an allowed "+e+"."},matches:function(t){return O(t.name)+" is not an allowed value."},max:function(t){var e=t.name,r=t.value,i=t.args;if(Array.isArray(r))return"You may only select "+i[0]+" "+e+".";var o=!(!Array.isArray(i)||!i[1])&&i[1];return!isNaN(r)&&"length"!==o||"value"===o?O(e)+" must be less than or equal to "+i[0]+".":O(e)+" must be less than or equal to "+i[0]+" characters long."},mime:function(t){var e=t.name,r=t.args;return O(e)+" must be of the the type: "+(r[0]||"No file formats allowed.")},min:function(t){var e=t.name,r=t.value,i=t.args;if(Array.isArray(r))return"You must select at least "+i[0]+" "+e+".";var o=!(!Array.isArray(i)||!i[1])&&i[1];return!isNaN(r)&&"length"!==o||"value"===o?O(e)+" must be more than "+i[0]+".":O(e)+" must be more than "+i[0]+" characters long."},not:function(t){var e=t.name;return"“"+t.value+"” is not an allowed "+e+"."},number:function(t){return O(t.name)+" must be a number."},required:function(t){return O(t.name)+" is required."},startsWith:function(t){t.name;var e=t.value;return e?"“"+e+"” doesnt start with a valid value.":"This field doesnt start with a valid value."},url:function(t){return t.name,"Please include a valid url."}};function A(t){var e;t.extend({locales:(e={},e.en=V,e)})}function S(t,e,r,i){return new Promise((function(r,o){var n=(i.fauxUploaderDuration||2e3)*(.5+Math.random()),s=performance.now(),a=function(){return setTimeout((function(){var i=performance.now()-s,o=Math.min(100,Math.round(i/n*100));if(e(o),o>=100)return r({url:"http://via.placeholder.com/350x150.png",name:t.name});a()}),20)};a()}))}function j(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&-1===e.indexOf(i)&&(r[i]=t[i]);return r}var P={inheritAttrs:!1,functional:!0,render:function(t,e){for(var r=e.props,i=e.data,o=e.parent,n=e.children,s=o,a=(r.name,r.forceWrap),u=r.context,l=j(r,["name","forceWrap","context"]);s&&"FormulateInput"!==s.$options.name;)s=s.$parent;if(!s)return null;if(s.$scopedSlots&&s.$scopedSlots[r.name])return s.$scopedSlots[r.name](Object.assign({},u,l));if(Array.isArray(n)&&(n.length>1||a&&n.length>0)){var c=i.attrs,h=(c.name,c.context,j(c,["name","context"]));return t("div",Object.assign({},i,{attrs:h}),n)}return Array.isArray(n)&&1===n.length?n[0]:null}};function _(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&-1===e.indexOf(i)&&(r[i]=t[i]);return r}var $=function(t){this.registry=new Map,this.ctx=t};function R(t){return new $(t).dataProps()}function N(){return{hasInitialValue:function(){return this.formulateValue&&"object"==typeof this.formulateValue||this.values&&"object"==typeof this.values||this.isGrouping&&"object"==typeof this.context.model[this.index]},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return y(this.$options.propsData,"formulateValue")&&"object"==typeof this.formulateValue?Object.assign({},this.formulateValue):y(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):this.isGrouping&&"object"==typeof this.context.model[this.index]?this.context.model[this.index]:{}}}}function C(t){void 0===t&&(t=[]);var e={applyInitialValues:function(){this.hasInitialValue&&(this.proxy=this.initialValues)},setFieldValue:function(t,e){var r;if(void 0===e){var i=this.proxy,o=(i[t],_(i,[String(t)]));this.proxy=o}else Object.assign(this.proxy,((r={})[t]=e,r));this.$emit("input",Object.assign({},this.proxy))},getFormValues:function(){return this.proxy},hasValidationErrors:function(){return Promise.all(this.registry.reduce((function(t,e,r){return t.push(e.performValidation()&&e.getValidationErrors()),t}),[])).then((function(t){return t.some((function(t){return t.hasErrors}))}))},showErrors:function(){this.childrenShouldShowErrors=!0,this.registry.map((function(t){t.formShouldShowErrors=!0}))},hideErrors:function(){this.childrenShouldShowErrors=!1,this.registry.map((function(t){t.formShouldShowErrors=!1,t.behavioralErrorVisibility=!1}))},setValues:function(t){var e=this;Array.from(new Set(Object.keys(t).concat(Object.keys(this.proxy)))).forEach((function(r){!e.registry.has(r)||h(t[r],e.proxy[r])||h(t[r],e.registry.get(r).proxy)||(e.setFieldValue(r,t[r]),e.registry.get(r).context.model=t[r])}))}};return Object.keys(e).reduce((function(r,i){var o;return t.includes(i)?r:Object.assign({},r,((o={})[i]=e[i],o))}),{})}function I(t){return{formulateSetter:t.setFieldValue,formulateRegister:t.register,formulateDeregister:t.deregister,getFormValues:t.getFormValues}}$.prototype.add=function(t,e){return this.registry.set(t,e),this},$.prototype.remove=function(t){this.registry.delete(t);var e=this.ctx.proxy,r=(e[t],_(e,[String(t)]));return this.ctx.proxy=r,this},$.prototype.has=function(t){return this.registry.has(t)},$.prototype.get=function(t){return this.registry.get(t)},$.prototype.map=function(t){var e={};return this.registry.forEach((function(r,i){var o;return Object.assign(e,((o={})[i]=t(r,i),o))})),e},$.prototype.keys=function(){return Array.from(this.registry.keys())},$.prototype.register=function(t,e){if(this.registry.has(t))return!1;this.registry.set(t,e);var r=y(e.$options.propsData,"formulateValue"),i=y(e.$options.propsData,"value");!r&&this.ctx.hasInitialValue&&this.ctx.initialValues[t]?e.context.model=this.ctx.initialValues[t]:!r&&!i||h(e.proxy,this.ctx.initialValues[t])||this.ctx.setFieldValue(t,e.proxy),this.childrenShouldShowErrors&&(e.formShouldShowErrors=!0)},$.prototype.reduce=function(t,e){return this.registry.forEach((function(r,i){e=t(e,r,i)})),e},$.prototype.dataProps=function(){var t=this;return{proxy:{},registry:this,register:this.register.bind(this),deregister:function(e){return t.remove(e)},childrenShouldShowErrors:!1}};var k=function(t){this.form=t};function D(t,e,r,i,o,n,s,a,u,l){"boolean"!=typeof s&&(u=a,a=s,s=!1);var c,h="function"==typeof r?r.options:r;if(t&&t.render&&(h.render=t.render,h.staticRenderFns=t.staticRenderFns,h._compiled=!0,o&&(h.functional=!0)),i&&(h._scopeId=i),n?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,u(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},h._ssrRegister=c):e&&(c=s?function(t){e.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(h.functional){var d=h.render;h.render=function(t,e){return c.call(e),d(t,e)}}else{var f=h.beforeCreate;h.beforeCreate=f?[].concat(f,c):[c]}return r}k.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},k.prototype.values=function(){var t=this;return new Promise((function(e,r){var i=[],o=function t(e){if("object"!=typeof e)return e;var r=Array.isArray(e)?[]:{};for(var i in e)e[i]instanceof l||v(e[i])?r[i]=e[i]:r[i]=t(e[i]);return r}(t.form.proxy),n=function(e){"object"==typeof t.form.proxy[e]&&t.form.proxy[e]instanceof l&&i.push(t.form.proxy[e].upload().then((function(t){var r;return Object.assign(o,((r={})[e]=t,r))})))};for(var s in o)n(s);Promise.all(i).then((function(){return e(o)})).catch((function(t){return r(t)}))}))};var L={provide:function(){return Object.assign({},I(this),{observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formulateFieldValidation:this.formulateFieldValidation})},name:"FormulateForm",model:{prop:"formulateValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formulateValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return Object.assign({},R(this),{formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}})},computed:Object.assign({},N(),{formContext:function(){return{errors:this.mergedFormErrors}},classes:function(){var t={"formulate-form":!0};return this.name&&(t["formulate-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var e in this.errors)t[e]=f(this.errors[e]);for(var r in this.namedFieldErrors)t[r]=f(this.namedFieldErrors[r]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}}),watch:{formulateValue:{handler:function(t){this.isVmodeled&&t&&"object"==typeof t&&this.setValues(t)},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(e){return e.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(e){return e.callback(t[e.field]||[])}))},immediate:!0}},created:function(){this.$formulate.register(this),this.applyInitialValues()},destroyed:function(){this.$formulate.deregister(this)},methods:Object.assign({},C(),{applyErrors:function(t){var e=t.formErrors,r=t.inputErrors;this.namedErrors=e,this.namedFieldErrors=r},addErrorObserver:function(t){this.errorObservers.find((function(e){return t.callback===e.callback}))||(this.errorObservers.push(t),"form"===t.type?t.callback(this.mergedFormErrors):y(this.mergedFieldErrors,t.field)&&t.callback(this.mergedFieldErrors[t.field]))},removeErrorObserver:function(t){this.errorObservers=this.errorObservers.filter((function(e){return e.callback!==t}))},registerErrorComponent:function(t){this.errorComponents.includes(t)||this.errorComponents.push(t)},formSubmitted:function(){var t=this;this.showErrors();var e=new k(this);return this.$emit("submit-raw",e),e.hasValidationErrors().then((function(t){return t?void 0:e.values()})).then((function(e){if(void 0!==e)return t.$emit("submit",e),e}))},formulateFieldValidation:function(t){this.$emit("validation",t)}})},U=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("form",{class:t.classes,on:{submit:function(e){return e.preventDefault(),t.formSubmitted(e)}}},[t.hasFormErrorObservers?t._e():r("FormulateErrors",{attrs:{context:t.formContext}}),t._v(" "),t._t("default")],2)};U._withStripped=!0;var B=D({render:U,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0),M={context:function(){return T.call(this,Object.assign({},{addLabel:this.logicalAddLabel,attributes:this.elementAttributes,blurHandler:q.bind(this),classification:this.classification,component:this.component,disableErrors:this.disableErrors,errors:this.explicitErrors,allErrors:this.allErrors,formShouldShowErrors:this.formShouldShowErrors,getValidationErrors:this.getValidationErrors.bind(this),hasGivenName:this.hasGivenName,hasLabel:this.label&&"button"!==this.classification,hasValidationErrors:this.hasValidationErrors.bind(this),help:this.help,helpPosition:this.logicalHelpPosition,id:this.id||this.defaultId,imageBehavior:this.imageBehavior,label:this.label,labelPosition:this.logicalLabelPosition,limit:this.limit,name:this.nameOrFallback,performValidation:this.performValidation.bind(this),preventWindowDrops:this.preventWindowDrops,repeatable:this.repeatable,setErrors:this.setErrors.bind(this),showValidationErrors:this.showValidationErrors,slotComponents:this.slotComponents,type:this.type,uploadBehavior:this.uploadBehavior,uploadUrl:this.mergedUploadUrl,uploader:this.uploader||this.$formulate.getUploader(),validationErrors:this.validationErrors,value:this.value,visibleValidationErrors:this.visibleValidationErrors,isSubField:this.isSubField},this.typeContext))},nameOrFallback:function(){if(!0===this.name&&"button"!==this.classification)return this.type+"_"+this.elementAttributes.id;if(!1===this.name||"button"===this.classification&&!0===this.name)return!1;return this.name},hasGivenName:function(){return"boolean"!=typeof this.name},typeContext:function(){var t=this;switch(this.classification){case"select":return{options:G.call(this,this.options),optionGroups:!!this.optionGroups&&c(this.optionGroups,(function(e,r){return G.call(t,r)})),placeholder:this.$attrs.placeholder||!1};case"slider":return{showValue:!!this.showValue};default:return this.options?{options:G.call(this,this.options)}:{}}},elementAttributes:function(){var t=Object.assign({},this.localAttributes);this.id?t.id=this.id:t.id=this.defaultId;this.hasGivenName&&(t.name=this.name);this.help&&(t["aria-describedby"]=t.id+"-help");return t},logicalLabelPosition:function(){if(this.labelPosition)return this.labelPosition;switch(this.classification){case"box":return"after";default:return"before"}},logicalHelpPosition:function(){if(this.helpPosition)return this.helpPosition;switch(this.classification){case"group":return"before";default:return"after"}},mergedUploadUrl:function(){return this.uploadUrl||this.$formulate.getUploadUrl()},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},mergedValidationName:function(){if(this.validationName)return this.validationName;if("string"==typeof this.name)return this.name;if(this.label)return this.label;return this.type},explicitErrors:function(){return f(this.errors).concat(this.localErrors).concat(f(this.error))},allErrors:function(){return this.explicitErrors.concat(f(this.validationErrors))},hasErrors:function(){return!!this.allErrors.length},hasVisibleErrors:function(){return this.validationErrors&&this.showValidationErrors||!!this.explicitErrors.length},showValidationErrors:function(){if(this.showErrors||this.formShouldShowErrors)return!0;if("file"===this.classification&&"live"===this.uploadBehavior&&W.call(this))return!0;return this.behavioralErrorVisibility},visibleValidationErrors:function(){return this.showValidationErrors&&this.validationErrors.length?this.validationErrors:[]},slotComponents:function(){return{label:this.$formulate.slotComponent(this.type,"label"),help:this.$formulate.slotComponent(this.type,"help"),errors:this.$formulate.slotComponent(this.type,"errors"),repeatable:this.$formulate.slotComponent(this.type,"repeatable"),addMore:this.$formulate.slotComponent(this.type,"addMore"),remove:this.$formulate.slotComponent(this.type,"remove")}},logicalAddLabel:function(){if("boolean"==typeof this.addLabel)return"+ "+(this.label||this.name||"Add");return this.addLabel}};function G(t){if(!Array.isArray(t)&&t&&"object"==typeof t){var e=[];for(var r in t)e.push({value:r,label:t[r],id:this.elementAttributes.id+"_"+r});return e}return t}function q(){this.$emit("blur"),"blur"===this.errorBehavior&&(this.behavioralErrorVisibility=!0)}function T(t){return Object.defineProperty(t,"model",{get:W.bind(this),set:H.bind(this)})}function W(){var t=this.isVmodeled?"formulateValue":"proxy";return"checkbox"===this.type&&!Array.isArray(this[t])&&this.options?[]:this[t]?this[t]:""}function H(t){h(t,this.proxy)||(this.proxy=t),this.$emit("input",t),this.context.name&&"function"==typeof this.formulateSetter&&this.formulateSetter(this.context.name,t)}var Y={name:"FormulateInput",inheritAttrs:!1,provide:function(){return{formulateRegisterRule:this.registerRule,formulateRemoveRule:this.removeRule}},inject:{formulateSetter:{default:void 0},formulateFieldValidation:{default:function(){return function(){return{}}}},formulateRegister:{default:void 0},formulateDeregister:{default:void 0},getFormValues:{default:function(){return function(){return{}}}},observeErrors:{default:void 0},removeErrorObserver:{default:void 0},isSubField:{default:function(){return function(){return!1}}}},model:{prop:"formulateValue",event:"input"},props:{type:{type:String,default:"text"},name:{type:[String,Boolean],default:!0},formulateValue:{default:""},value:{default:!1},options:{type:[Object,Array,Boolean],default:!1},optionGroups:{type:[Object,Boolean],default:!1},id:{type:[String,Boolean,Number],default:!1},label:{type:[String,Boolean],default:!1},labelPosition:{type:[String,Boolean],default:!1},limit:{type:Number,default:1/0},help:{type:[String,Boolean],default:!1},helpPosition:{type:[String,Boolean],default:!1},errors:{type:[String,Array,Boolean],default:!1},repeatable:{type:Boolean,default:!1},validation:{type:[String,Boolean,Array],default:!1},validationName:{type:[String,Boolean],default:!1},error:{type:[String,Boolean],default:!1},errorBehavior:{type:String,default:"blur",validator:function(t){return["blur","live","submit"].includes(t)}},showErrors:{type:Boolean,default:!1},imageBehavior:{type:String,default:"preview"},uploadUrl:{type:[String,Boolean],default:!1},uploader:{type:[Function,Object,Boolean],default:!1},uploadBehavior:{type:String,default:"live"},preventWindowDrops:{type:Boolean,default:!0},showValue:{type:[String,Boolean],default:!1},validationMessages:{type:Object,default:function(){return{}}},validationRules:{type:Object,default:function(){return{}}},checked:{type:[String,Boolean],default:!1},disableErrors:{type:Boolean,default:!1},addLabel:{type:[Boolean,String],default:!1}},data:function(){return{defaultId:this.$formulate.nextId(this),localAttributes:{},localErrors:[],proxy:this.getInitialValue(),behavioralErrorVisibility:"live"===this.errorBehavior,formShouldShowErrors:!1,validationErrors:[],pendingValidation:Promise.resolve(),ruleRegistry:[],messageRegistry:{}}},computed:Object.assign({},M,{classification:function(){var t=this.$formulate.classify(this.type);return"box"===t&&this.options?"group":t},component:function(){return"group"===this.classification?"FormulateInputGroup":this.$formulate.component(this.type)},parsedValidationRules:function(){var t=this,e={};return Object.keys(this.validationRules).forEach((function(r){e[d(r)]=t.validationRules[r]})),e},messages:function(){var t=this,e={};return Object.keys(this.validationMessages).forEach((function(r){e[d(r)]=t.validationMessages[r]})),Object.keys(this.messageRegistry).forEach((function(r){e[d(r)]=t.messageRegistry[r]})),e}}),watch:{$attrs:{handler:function(t){this.updateLocalAttributes(t)},deep:!0},proxy:function(t,e){this.performValidation(),this.isVmodeled||h(t,e)||(this.context.model=t)},formulateValue:function(t,e){this.isVmodeled&&!h(t,e)&&(this.context.model=t)},showValidationErrors:{handler:function(t){this.$emit("error-visibility",t)},immediate:!0}},created:function(){this.applyInitialValue(),this.formulateRegister&&"function"==typeof this.formulateRegister&&this.formulateRegister(this.nameOrFallback,this),this.disableErrors||"function"!=typeof this.observeErrors||this.observeErrors({callback:this.setErrors,type:"input",field:this.nameOrFallback}),this.updateLocalAttributes(this.$attrs),this.performValidation()},beforeDestroy:function(){this.disableErrors||"function"!=typeof this.removeErrorObserver||this.removeErrorObserver(this.setErrors),"function"==typeof this.formulateDeregister&&this.formulateDeregister(this.nameOrFallback)},methods:{getInitialValue:function(){var t=this.$formulate.classify(this.type);return"box"===(t="box"===t&&this.options?"group":t)&&this.checked?this.value||!0:y(this.$options.propsData,"value")&&"box"!==t?this.value:y(this.$options.propsData,"formulateValue")?this.formulateValue:""},applyInitialValue:function(){!h(this.context.model,this.proxy)&&Object.prototype.hasOwnProperty(this.$options.propsData,"options")&&"box"===this.classification&&(this.context.model=this.proxy)},updateLocalAttributes:function(t){h(t,this.localAttributes)||(this.localAttributes=t)},performValidation:function(){var t=this,e=p(this.validation,this.$formulate.rules(this.parsedValidationRules));return e=this.ruleRegistry.length?this.ruleRegistry.concat(e):e,this.pendingValidation=this.runRules(e).then((function(e){return t.didValidate(e)})),this.pendingValidation},runRules:function(t){var e=this,r=function(t){var r=t[0],i=t[1],o=t[2],n=(t[3],r.apply(void 0,[{value:e.context.model,getFormValues:e.getFormValues.bind(e),name:e.context.name}].concat(i)));return(n=n instanceof Promise?n:Promise.resolve(n)).then((function(t){return!t&&e.getMessage(o,i)}))};return new Promise((function(e){var i=function(t,o){void 0===o&&(o=[]);var n=t.shift();Array.isArray(n)&&n.length?Promise.all(n.map(r)).then((function(t){return t.filter((function(t){return!!t}))})).then((function(r){return(r=Array.isArray(r)?r:[]).length&&n.bail||!t.length?e(o.concat(r)):i(t,o.concat(r))})):e([])};i(function(t){var e=[],r=t.findIndex((function(t){return"bail"===t[2].toLowerCase()}));if(r>=0){var i=t.splice(0,r+1).slice(0,-1);i.length&&e.push(i),t.map((function(t){return e.push(Object.defineProperty([t],"bail",{value:!0}))}))}else e.push(t);return e.reduce((function(t,e){var r=function(t,e){if(void 0===e&&(e=!1),t.length<2)return Object.defineProperty([t],"bail",{value:e});var i=[],o=t.findIndex((function(t){return"^"===t[3]}));if(o>=0){var n=t.splice(0,o);n.length&&i.push.apply(i,r(n,e)),i.push(Object.defineProperty([t.shift()],"bail",{value:!0})),t.length&&i.push.apply(i,r(t,e))}else i.push(t);return i};return t.concat(r(e))}),[])}(t))}))},didValidate:function(t){var e=!h(t,this.validationErrors);if(this.validationErrors=t,e){var r=this.getErrorObject();this.$emit("validation",r),this.formulateFieldValidation&&"function"==typeof this.formulateFieldValidation&&this.formulateFieldValidation(r)}},getMessage:function(t,e){return this.getMessageFunc(t)({args:e,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()})},getMessageFunc:function(t){var e=this;if(t=d(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":case"boolean":return function(){return e.messages[t]}}return function(r){return e.$formulate.validationMessage(t,r,e)}},hasValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){return t.pendingValidation.then((function(){return e(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors.filter((function(t){return"string"==typeof t})),hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=f(t)},registerRule:function(t,e,r,i){void 0===i&&(i=null),this.ruleRegistry.some((function(t){return t[2]===r}))||(this.ruleRegistry.push([t,e,r]),null!==i&&(this.messageRegistry[r]=i))},removeRule:function(t){var e=this.ruleRegistry.findIndex((function(e){return e[2]===t}));e>=0&&(this.ruleRegistry.splice(e,1),delete this.messageRegistry[t])}}},z=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"formulate-input",attrs:{"data-classification":t.classification,"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[t._t("default",null,{id:t.id,context:t.context,errors:t.errors,validationErrors:t.validationErrors})],2)};z._withStripped=!0;var K=D({render:z,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Z={inject:{observeErrors:{default:!1},removeErrorObserver:{default:!1}},props:{context:{type:Object,default:function(){return{}}},type:{type:String,default:"form"}},data:function(){return{boundSetErrors:this.setErrors.bind(this),localErrors:[]}},computed:{visibleValidationErrors:function(){return Array.isArray(this.context.visibleValidationErrors)?this.context.visibleValidationErrors:[]},errors:function(){return Array.isArray(this.context.errors)?this.context.errors:[]},mergedErrors:function(){return this.errors.concat(this.localErrors)},visibleErrors:function(){return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors))).filter((function(t){return"string"==typeof t}))}},created:function(){"form"!==this.type||"function"!=typeof this.observeErrors||Array.isArray(this.context.errors)||this.observeErrors({callback:this.boundSetErrors,type:this.type})},destroyed:function(){"form"!==this.type||"function"!=typeof this.removeErrorObserver||Array.isArray(this.context.errors)||this.removeErrorObserver(this.boundSetErrors)},methods:{setErrors:function(t){this.localErrors=f(t)}}},J=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.visibleErrors.length?r("ul",{class:"formulate-"+t.type+"-errors"},t._l(t.visibleErrors,(function(e){return r("li",{key:e,class:"formulate-"+t.type+"-error",domProps:{textContent:t._s(e)}})})),0):t._e()};J._withStripped=!0;var X=D({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),Q={props:{context:{type:Object,required:!0}}},tt=function(){var t=this.$createElement,e=this._self._c||t;return this.context.help?e("div",{class:"formulate-input-help formulate-input-help--"+this.context.helpPosition,attrs:{id:this.context.id+"-help"},domProps:{textContent:this._s(this.context.help)}}):this._e()};tt._withStripped=!0;var et=D({render:tt,staticRenderFns:[]},void 0,Q,void 0,!1,void 0,!1,void 0,void 0,void 0),rt={name:"FormulateGrouping",props:{context:{type:Object,required:!0}},provide:function(){return{isSubField:function(){return!0},registerProvider:this.registerProvider,deregisterProvider:this.deregisterProvider}},data:function(){return{providers:[]}},inject:["formulateRegisterRule","formulateRemoveRule"],computed:{items:function(){return Array.isArray(this.context.model)&&(this.context.repeatable||0!==this.context.model.length)?this.context.model.map((function(t){return g(t,t.__id)})):[g({})]},formShouldShowErrors:function(){return this.context.formShouldShowErrors}},watch:{providers:function(){this.formShouldShowErrors&&this.showErrors()},formShouldShowErrors:function(t){t&&this.showErrors()}},created:function(){this.formulateRegisterRule(this.validateGroup.bind(this),[],"formulateGrouping",!0)},destroyed:function(){this.formulateRemoveRule("formulateGrouping")},methods:{getAtIndex:function(t){return void 0!==this.context.model[t]&&this.context.model[t].__id?this.context.model[t]:void 0!==this.context.model[t]?g(this.context.model[t]):void 0===this.context.model[t]&&void 0!==this.items[t]?g({},this.items[t].__id):g({})},setFieldValue:function(t,e,r){var i,o=Array.isArray(this.context.model)?this.context.model:[],n=this.getAtIndex(t),s=g(Object.assign({},n,((i={})[e]=r,i)),n.__id);o.splice(t,1,s),this.context.model=o},validateGroup:function(){return Promise.all(this.providers.reduce((function(t,e){return e&&"function"==typeof e.hasValidationErrors&&t.push(e.hasValidationErrors()),t}),[])).then((function(t){return!t.some((function(t){return!!t}))}))},showErrors:function(){this.providers.forEach((function(t){return t&&"function"==typeof t.showErrors&&t.showErrors()}))},removeItem:function(t){Array.isArray(this.context.model)&&this.context.model.splice(t,1)},registerProvider:function(t){this.providers.some((function(e){return e===t}))||this.providers.push(t)},deregisterProvider:function(t){this.providers=this.providers.filter((function(e){return e!==t}))}}},it=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{staticClass:"formulate-input-grouping",attrs:{name:"grouping",context:t.context,"force-wrap":t.context.repeatable}},t._l(t.items,(function(e,i){return r("FormulateRepeatableProvider",{key:e.__id,attrs:{index:i,"set-field-value":function(e,r){return t.setFieldValue(i,e,r)},context:t.context},on:{remove:t.removeItem}},[t._t("default")],2)})),1)};it._withStripped=!0;var ot=D({render:it,staticRenderFns:[]},void 0,rt,void 0,!1,void 0,!1,void 0,void 0,void 0),nt={props:{context:{type:Object,required:!0}}},st=function(){var t=this.$createElement;return(this._self._c||t)("label",{class:"formulate-input-label formulate-input-label--"+this.context.labelPosition,attrs:{for:this.context.id},domProps:{textContent:this._s(this.context.label)}})};st._withStripped=!0;var at=D({render:st,staticRenderFns:[]},void 0,nt,void 0,!1,void 0,!1,void 0,void 0,void 0),ut={props:{context:{type:Object,required:!0},addMore:{type:Function,required:!0}}},lt=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"formulate-input-group-add-more"},[e("FormulateInput",{attrs:{type:"button",label:this.context.addLabel,"data-minor":"","data-ghost":""},on:{click:this.addMore}})],1)};lt._withStripped=!0;var ct=D({render:lt,staticRenderFns:[]},void 0,ut,void 0,!1,void 0,!1,void 0,void 0,void 0),ht={props:{context:{type:Object,required:!0},removeItem:{type:Function,required:!0},index:{type:Number,required:!0}}},dt=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"formulate-input-group-repeatable"},[e("FormulateSlot",{attrs:{name:"remove",context:this.context,"remove-item":this.removeItem}},[e(this.context.slotComponents.remove,{tag:"component",attrs:{context:this.context,"remove-item":this.removeItem}})],1),this._v(" "),this._t("default")],2)};dt._withStripped=!0;var ft=D({render:dt,staticRenderFns:[]},void 0,ht,void 0,!1,void 0,!1,void 0,void 0,void 0);function pt(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&-1===e.indexOf(i)&&(r[i]=t[i]);return r}var mt={name:"FormulateInputGroup",props:{context:{type:Object,required:!0}},computed:{options:function(){return this.context.options||[]},subType:function(){return"group"===this.context.type?"grouping":"inputs"},optionsWithContext:function(){var t=this,e=this.context,r=e.attributes,i=(r.id,pt(r,["id"])),o=(e.blurHandler,e.classification,e.component,e.getValidationErrors,e.hasLabel,e.hasValidationErrors,e.isSubField,e.labelPosition,e.options,e.performValidation,e.setErrors,e.slotComponents,e.validationErrors,e.visibleValidationErrors,e.help,pt(e,["attributes","blurHandler","classification","component","getValidationErrors","hasLabel","hasValidationErrors","isSubField","labelPosition","options","performValidation","setErrors","slotComponents","validationErrors","visibleValidationErrors","help"]));return this.options.map((function(e){return t.groupItemContext(o,e,i)}))},canAddMore:function(){return this.context.repeatable&&this.items.length<this.context.limit},items:function(){return Array.isArray(this.context.model)?this.context.model:[{}]}},methods:{addItem:function(){Array.isArray(this.context.model)?this.context.model.push(g({})):this.context.model=this.items.concat([g({})])},groupItemContext:function(t,e,r){return Object.assign({},t,e,r,{},t.hasGivenName?{}:{name:!0})}}},vt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-group",attrs:{"data-is-repeatable":t.context.repeatable}},["grouping"!==t.subType?t._l(t.optionsWithContext,(function(e){return r("FormulateInput",t._b({key:e.id,staticClass:"formulate-input-group-item",attrs:{"disable-errors":!0},on:{blur:t.context.blurHandler},model:{value:t.context.model,callback:function(e){t.$set(t.context,"model",e)},expression:"context.model"}},"FormulateInput",e,!1))})):[r("FormulateGrouping",{attrs:{context:t.context}},[t._t("default")],2),t._v(" "),t.canAddMore?r("FormulateSlot",{attrs:{name:"addmore",context:t.context,"add-more":t.addItem}},[r(t.context.slotComponents.addMore,{tag:"component",attrs:{context:t.context,"add-more":t.addItem},on:{add:t.addItem}})],1):t._e()]],2)};vt._withStripped=!0;var yt=D({render:vt,staticRenderFns:[]},void 0,mt,void 0,!1,void 0,!1,void 0,void 0,void 0),gt={provide:function(){var t=this;return Object.assign({},I(this),{formulateSetter:function(e,r){return t.setFieldValue(e,r)}})},inject:{registerProvider:"registerProvider",deregisterProvider:"deregisterProvider"},props:{index:{type:Number,required:!0},context:{type:Object,required:!0},setFieldValue:{type:Function,required:!0}},data:function(){return Object.assign({},R(this),{isGrouping:!0})},computed:Object.assign({},N()),created:function(){this.registerProvider(this)},beforeDestroy:function(){this.deregisterProvider(this)},methods:Object.assign({},C(["setFieldValue"]),{removeItem:function(){this.$emit("remove",this.index)}})},bt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{attrs:{name:"repeatable",context:t.context,index:t.index,"remove-item":t.removeItem}},[r(t.context.slotComponents.repeatable,{tag:"component",attrs:{context:t.context,index:t.index,"remove-item":t.removeItem}},[r("FormulateSlot",{attrs:{context:t.context,index:t.index,name:"default"}})],1)],1)};bt._withStripped=!0;var xt=D({render:bt,staticRenderFns:[]},void 0,gt,void 0,!1,void 0,!1,void 0,void 0,void 0),Et={props:{context:{type:Object,required:!0},removeItem:{type:Function,required:!0}}},wt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.context.repeatable?r("a",{staticClass:"formulate-input-group-repeatable-remove",attrs:{role:"button"},domProps:{textContent:t._s("Remove")},on:{click:function(e){return e.preventDefault(),t.removeItem(e)},keypress:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.removeItem(e)}}}):t._e()};wt._withStripped=!0;var Ft=D({render:wt,staticRenderFns:[]},void 0,Et,void 0,!1,void 0,!1,void 0,void 0,void 0),Ot=function(){this.options={},this.defaults={components:{FormulateSlot:P,FormulateForm:B,FormulateHelp:et,FormulateLabel:at,FormulateInput:K,FormulateErrors:X,FormulateAddMore:ct,FormulateGrouping:ot,FormulateRepeatable:ft,FormulateInputGroup:yt,FormulateRepeatableRemove:Ft,FormulateRepeatableProvider:xt},slotComponents:{label:"FormulateLabel",help:"FormulateHelp",errors:"FormulateErrors",repeatable:"FormulateRepeatable",addMore:"FormulateAddMore",remove:"FormulateRepeatableRemove"},library:e,rules:b,mimes:E,locale:!1,uploader:S,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[A],locales:{},idPrefix:"formulate-"},this.registry=new Map,this.idRegistry={}};return Ot.prototype.install=function(t,e){var r=this;t.prototype.$formulate=this,this.options=this.defaults;var i=this.defaults.plugins;for(var o in e&&Array.isArray(e.plugins)&&e.plugins.length&&(i=i.concat(e.plugins)),i.forEach((function(t){return"function"==typeof t?t(r):null})),this.extend(e||{}),this.options.components)t.component(o,this.options.components[o])},Ot.prototype.nextId=function(t){var e=!(!t.$route||!t.$route.path)&&t.$route.path?t.$route.path.replace(/[/\\.\s]/g,"-"):"global";return Object.prototype.hasOwnProperty.call(this.idRegistry,e)||(this.idRegistry[e]=0),""+this.options.idPrefix+e+"-"+ ++this.idRegistry[e]},Ot.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulate extend() should be passed an object (was "+typeof t+")")},Ot.prototype.merge=function(t,e,r){void 0===r&&(r=!0);var i={};for(var o in t)e.hasOwnProperty(o)?F(e[o])&&F(t[o])?i[o]=this.merge(t[o],e[o],r):r&&Array.isArray(t[o])&&Array.isArray(e[o])?i[o]=t[o].concat(e[o]):i[o]=e[o]:i[o]=t[o];for(var n in e)i.hasOwnProperty(n)||(i[n]=e[n]);return i},Ot.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},Ot.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},Ot.prototype.slotComponent=function(t,e){var r=this.options.library[t];return r&&r.slotComponents&&r.slotComponents[e]?r.slotComponents[e]:this.options.slotComponents[e]},Ot.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},Ot.prototype.i18n=function(t){if(t.$i18n)switch(typeof t.$i18n.locale){case"string":return t.$i18n.locale;case"function":return t.$i18n.locale()}return!1},Ot.prototype.getLocale=function(t){var e=this;return this.selectedLocale||(this.selectedLocale=[this.options.locale,this.i18n(t),"en"].reduce((function(t,r){if(t)return t;if(r){var i=function(t){return t.split("-").reduce((function(t,e){return t.length&&t.unshift(t[0]+"-"+e),t.length?t:[e]}),[])}(r).find((function(t){return y(e.options.locales,t)}));i&&(t=i)}return t}),!1)),this.selectedLocale},Ot.prototype.validationMessage=function(t,e,r){var i=this.options.locales[this.getLocale(r)];return i.hasOwnProperty(t)?i[t](e):"_"===t[0]&&i.hasOwnProperty(t.substr(1))?i[t.substr(1)](e):i.hasOwnProperty("default")?i.default(e):"This field does not have a valid value"},Ot.prototype.register=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},Ot.prototype.deregister=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},Ot.prototype.handle=function(t,e,r){void 0===r&&(r=!1);var i=r?t:this.options.errorHandler(t,e);return e&&this.registry.has(e)&&this.registry.get(e).applyErrors({formErrors:f(i.formErrors),inputErrors:i.inputErrors||{}}),i},Ot.prototype.reset=function(t,e){void 0===e&&(e={}),this.resetValidation(t),this.setValues(t,e)},Ot.prototype.resetValidation=function(t){var e=this.registry.get(t);e.hideErrors(t),e.namedErrors=[],e.namedFieldErrors={}},Ot.prototype.setValues=function(t,e){e&&!Array.isArray(e)&&"object"==typeof e&&this.registry.get(t).setValues(Object.assign({},e))},Ot.prototype.getUploader=function(){return this.options.uploader||!1},Ot.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},Ot.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},Ot.prototype.createUpload=function(t,e){return new l(t,e,this.options)},new Ot}();