You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
validator/demo/demo.js

12 lines
35 KiB

(()=>{var t={2:(t,e,n)=>{"use strict";function r(t){return t.replace(/-(\w)/g,((t,e)=>e.toUpperCase()))}function i(t,e){t.firstChild&&(e.appendChild(t.firstChild),i(t,e))}function s(t){Array.from(t).forEach(o)}const o=t=>t&&t.parentNode&&t.parentNode.removeChild(t),a=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),u=new Map,l=Symbol("riot-component"),c=new Set,f="is",d="mount",h="update",p="unmount",m="shouldUpdate",g="onBeforeMount",v="onMounted",b="onBeforeUpdate",y="onUpdated",E="onBeforeUnmount",x="onUnmounted",O="props",N="state",w="slots",T="root",j=Symbol.for("pure"),A=Symbol("parent"),S=Symbol("attributes"),M=Symbol("template");var _=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:u,DOM_COMPONENT_INSTANCE_PROPERTY:l,PLUGINS_SET:c,IS_DIRECTIVE:f,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:d,UPDATE_METHOD_KEY:h,UNMOUNT_METHOD_KEY:p,SHOULD_UPDATE_KEY:m,ON_BEFORE_MOUNT_KEY:g,ON_MOUNTED_KEY:v,ON_BEFORE_UPDATE_KEY:b,ON_UPDATED_KEY:y,ON_BEFORE_UNMOUNT_KEY:E,ON_UNMOUNTED_KEY:x,PROPS_KEY:O,STATE_KEY:N,SLOTS_KEY:w,ROOT_KEY:T,IS_PURE_SYMBOL:j,PARENT_KEY_SYMBOL:A,ATTRIBUTES_KEY_SYMBOL:S,TEMPLATE_KEY_SYMBOL:M});var D={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var P={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};function C(t,e){return typeof t===e}function L(t){const e=t.ownerSVGElement;return!!e||null===e}function U(t){return!R(t.content)}function k(t){return C(t,"function")}function I(t){return!R(t)&&C(t,"object")}function R(t){return null==t}const z=Symbol("unmount"),V={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:i}=this,s=t===z?null:this.evaluate(t),u=s?Array.from(s):[],{newChildrenMap:l,batches:c,futureNodes:f}=(n.parentNode,function(t,e,n,r){const{condition:i,template:s,childrenMap:o,itemName:a,getKey:u,indexName:l,root:c,isTemplateTag:f}=r,d=new Map,h=[],p=[];return t.forEach(((t,r)=>{const m=function(t,e){let{itemName:n,indexName:r,index:i,item:s}=e;t[n]=s,r&&(t[r]=i);return t}(Object.create(e),{itemName:a,indexName:l,index:r,item:t}),g=u?u(m):r,v=o.get(g);if(function(t,e){return!!t&&!1===Boolean(t(e))}(i,m))return;const b=v?v.template:s.clone(),y=v?b.el:c.cloneNode(),E=!v,x=f&&E?function(t){const e=t.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:e,children:Array.from(e.childNodes)}}(b):{};if(E?h.push((()=>b.mount(y,m,n,x))):h.push((()=>b.update(m,n))),f){const t=x.children||b.children;p.push(...t)}else p.push(y);o.delete(g),d.set(g,{template:b,context:m,index:r})})),{newChildrenMap:d,batches:h,futureNodes:p}}(u,t,e,this));return((t,e,n,r,i)=>{const s=n.length;let u=e.length,l=s,c=0,f=0,d=null;for(;c<u||f<l;)if(u===c){const t=l<s?f?r(n[f-1],-0).nextSibling:r(n[l-f],0):i;for(;f<l;)a(r(n[f++],1),t)}else if(l===f)for(;c<u;)d&&d.has(e[c])||o(r(e[c],-1)),c++;else if(e[c]===n[f])c++,f++;else if(e[u-1]===n[l-1])u--,l--;else if(e[c]===n[l-1]&&n[f]===e[u-1]){const t=r(e[--u],-1).nextSibling;a(r(n[f++],1),r(e[c++],-1).nextSibling),a(r(n[--l],1),t),e[u]=n[l]}else{if(!d){d=new Map;let t=f;for(;t<l;)d.set(n[t],t++)}if(d.has(e[c])){const t=d.get(e[c]);if(f<t&&t<l){let i=c,s=1;for(;++i<u&&i<l&&d.get(e[i])===t+s;)s++;if(s>t-f){const i=r(e[c],0);for(;f<t;)a(r(n[f++],1),i)}else h=r(n[f++],1),(p=r(e[c++],-1))&&p.parentNode&&p.parentNode.replaceChild(h,p)}else c++}else o(r(e[c++],-1))}var h,p})(0,r,f,function(t,e){return(n,r)=>{if(r<0){const n=t.pop();if(n){const{template:t,context:r}=n;t.unmount(r,e,null)}}return n}}(Array.from(i.values()),e),n),c.forEach((t=>t())),this.childrenMap=l,this.nodes=f,this},unmount(t,e){return this.update(z,e),this}};const F={mount(t,e){return this.update(t,e)},update(t,e){const n=!!this.evaluate(t),r=!this.value&&n,i=this.value&&!n,s=()=>{const n=this.node.cloneNode();a(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,t,e)};switch(!0){case r:s();break;case i:this.unmount(t);break;default:n&&this.template.update(t,e)}return this.value=n,this},unmount(t,e){return this.template.unmount(t,e,!0),this}};function K(t){throw new Error(t)}function B(t){return t.reduce(((t,e)=>{const{value:n,type:i}=e;switch(!0){case!e.name&&0===i:return Object.assign({},t,n);case 3===i:t.value=e.value;break;default:t[r(e.name)]=e.value}return t}),{})}const Y="removeAttribute",$="setAttribute",q="undefined"==typeof Element?{}:Element.prototype,H=function(t){const e=new Map,n=n=>(e.has(n)||e.set(n,t.call(this,n)))&&e.get(n);return n.cache=e,n}((t=>q.hasOwnProperty(t)));function G(t,e,n,r){let{name:i}=e;if(!i)return r&&function(t,e,n){const r=e?Object.keys(e):[];Object.keys(n).filter((t=>!r.includes(t))).forEach((e=>t.removeAttribute(e)))}(t,n,r),void(n&&function(t,e){Object.entries(e).forEach((e=>{let[n,r]=e;return G(t,{name:n},r)}))}(t,n));!H(i)&&(function(t){return C(t,"boolean")}(n)||I(n)||k(n))&&(t[i]=n),t[function(t){return R(t)||!1===t||""===t||I(t)||k(t)?Y:$}(n)](i,function(t,e){return!0===e?t:e}(i,n))}const X=/^on/,J={handleEvent(t){this[t.type](t)}},Z=new WeakMap;function W(t){return R(t)?"":t}const Q=(t,e)=>{const n=t.childNodes[e];if(n.nodeType===Node.COMMENT_NODE){const e=document.createTextNode("");return t.replaceChild(e,n),e}return n};var tt={0:G,1:function(t,e,n){let{name:r}=e;const i=r.replace(X,""),s=Z.get(t)||(t=>{const e=Object.create(J);return Z.set(t,e),e})(t),[o,a]=(t=>Array.isArray(t)?t:[t,!1])(n),u=s[i],l=o&&!u;u&&!o&&t.removeEventListener(i,s),l&&t.addEventListener(i,s,a),s[i]=o},2:function(t,e,n){t.data=W(n)},3:function(t,e,n){t.value=W(n)}};const et={mount(t){return this.value=this.evaluate(t),nt(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(nt(this,e),this.value=e),this},unmount(){return 1===this.type&&nt(this,null),this}};function nt(t,e){return tt[t.type](t.node,t,e,t.value)}function rt(t,e){return Object.assign({},et,e,{node:2===e.type?Q(t,e.childNodeIndex):t})}const it=(t,e)=>t[A]||e,st={attributes:[],getTemplateScope(t,e){return function(t,e,n){if(!t||!t.length)return n;const r=t.map((t=>Object.assign({},t,{value:t.evaluate(e)})));return Object.assign(Object.create(n||null),B(r))}(this.attributes,t,e)},mount(t,e){const n=!!t.slots&&t.slots.find((t=>{let{id:e}=t;return e===this.name})),{parentNode:r}=this.node,i=it(t,e);return this.template=n&&mt(n.html,n.bindings).createDOM(r),this.template&&(this.template.mount(this.node,this.getTemplateScope(t,i),i),this.template.children=Array.from(this.node.childNodes),ot(this.node)),o(this.node),this},update(t,e){if(this.template){const n=it(t,e);this.template.update(this.getTemplateScope(t,n),n)}return this},unmount(t,e,n){return this.template&&this.template.unmount(this.getTemplateScope(t,e),null,n),this}};function ot(t){const e=t&&t.firstChild;e&&(a(e,t),ot(t))}function at(t){return t.reduce(((t,e)=>{let{bindings:n}=e;return t.concat(n)}),[])}const ut={mount(t){return this.update(t)},update(t,e){const n=this.evaluate(t);return n===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=n,this.tag=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=[]),t?t({slots:e,attributes:n}):mt(function(t){return t.reduce(((t,e)=>t+e.html),"")}(e),[...at(e),{expressions:n.map((t=>Object.assign({type:0},t)))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,t)),this},unmount(t,e,n){return this.tag&&this.tag.unmount(n),this}};var lt={1:function(t,e){let{evaluate:n,template:r}=e;const i=document.createTextNode("");return a(i,t),o(t),Object.assign({},F,{node:t,evaluate:n,placeholder:i,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map((e=>rt(t,e))),["mount","update","unmount"].reduce(((t,e)=>Object.assign({},t,{[e]:t=>r.map((n=>n[e](t)))&&i})),{})));var r,i},0:function(t,e){let{evaluate:n,condition:r,itemName:i,indexName:s,getKey:u,template:l}=e;const c=document.createTextNode(""),f=t.cloneNode();return a(c,t),o(t),Object.assign({},V,{childrenMap:new Map,node:t,root:f,condition:r,evaluate:n,isTemplateTag:U(f),template:l.createDOM(t),getKey:u,indexName:s,itemName:i,placeholder:c})},3:function(t,e){let{evaluate:n,getComponent:r,slots:i,attributes:s}=e;return Object.assign({},ut,{node:t,evaluate:n,slots:i,attributes:s,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},st,{attributes:r,node:t,name:n})}};function ct(t,e){return t.map((t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t))}function ft(t,e,n){const{selector:r,type:i,redundantAttribute:s,expressions:o}=e,a=r?t.querySelector(r):t;s&&a.removeAttribute(s);const u=o||[];return(lt[i]||lt[2])(a,Object.assign({},e,{expressions:n&&!r?ct(u,n):u}))}function dt(t,e){return L(t)?function(t,e){return e.ownerDocument.importNode((new window.DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"application/xml").documentElement,!0)}(e,t):function(t,e){const n=U(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}function ht(t,e){switch(!0){case L(t):i(e,t);break;case U(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const pt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?dt(t,e):e)}(t,this.html),this},mount(t,e,n,r){if(void 0===r&&(r={}),!t)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:i,children:s,avoidDOMInjection:o}=r,{parentNode:a}=s?s[0]:t,u=U(t),l=u?Math.max(Array.from(a.childNodes).indexOf(t),0):null;return this.isTemplateTag=u,this.createDOM(t),this.dom&&(this.fragment=i||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?a:t,this.children=this.isTemplateTag?s||Array.from(this.fragment.childNodes):null,!o&&this.fragment&&ht(t,this.fragment),this.bindings=this.bindingsData.map((t=>ft(this.el,t,l))),this.bindings.forEach((t=>t.mount(e,n))),this},update(t,e){return this.bindings.forEach((n=>n.update(t,e))),this},unmount(t,e,n){if(this.el){switch(this.bindings.forEach((r=>r.unmount(t,e,n))),!0){case this.el[j]:break;case this.children&&null!==n:s(this.children);break;case!0===n:o(this.el);break;case null!==n:s(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function mt(t,e){return void 0===e&&(e=[]),Object.assign({},pt,{html:t,bindingsData:e})}function gt(){return this}function vt(t){return k(t)?t.prototype&&t.prototype.constructor?new t:t():t}function bt(t,e,n,r){return void 0===r&&(r={}),Object.defineProperty(t,e,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function yt(t,e,n){return Object.entries(e).forEach((e=>{let[r,i]=e;bt(t,r,i,n)})),t}function Et(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}function xt(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function Ot(t,e){return xt("string"==typeof t?(e||document).querySelectorAll(t):t)}const Nt=t=>1===t.length?t[0]:t;function wt(t,e,n){const r="object"==typeof e?e:{[e]:n},i=Object.keys(r);return xt(t).forEach((t=>{i.forEach((e=>t.setAttribute(e,r[e])))})),t}function Tt(t,e){return function(t,e,n){const r="string"==typeof e?[e]:e;return Nt(xt(t).map((t=>Nt(r.map((e=>t[n](e)))))))}(t,e,"getAttribute")}const jt=new Map,At=()=>St||(wt(St=Ot("style[riot]")[0]||document.createElement("style"),"type","text/css"),St.parentNode||document.head.appendChild(St),St);var St,Mt={CSS_BY_NAME:jt,add(t,e){return jt.has(t)||(jt.set(t,e),this.inject()),this},inject(){return At().innerHTML=[...jt.values()].join("\n"),this},remove(t){return jt.has(t)&&(jt.delete(t),this.inject()),this}};function _t(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return(r=[...n,...r]).length<t.length?_t(t,...r):t(...r)}}function Dt(t){return Tt(t,f)||t.tagName.toLowerCase()}const Pt=Object.freeze({$(t){return Ot(t,this.root)[0]},$$(t){return Ot(t,this.root)}}),Ct=Object.freeze({[d]:gt,[h]:gt,[p]:gt}),Lt=Object.freeze({[m]:gt,[g]:gt,[v]:gt,[b]:gt,[y]:gt,[E]:gt,[x]:gt}),Ut=Object.assign({},Ct,{clone:gt,createDOM:gt});function kt(t,e){return void 0===e&&(e={}),Object.assign({},function(t){return Array.from(t.attributes).reduce(((t,e)=>(t[r(e.name)]=e.value,t)),{})}(t),vt(e))}const It=(t,e)=>t[l]=e;function Rt(t){return[d,h,p].reduce(((e,n)=>(e[n]=t(n),e)),{})}function zt(t){let{css:e,template:n,exports:r,name:i}=t;const s=n?function(t,e){return t(mt,P,D,(t=>e[t]||u.get(t)))}(n,r?function(t){void 0===t&&(t={});return Object.entries(vt(t)).reduce(((t,e)=>{let[n,r]=e;
/* Riot v5.1.2, @license MIT */
var i;return t[(i=n,i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=zt(r),t}),{})}(r.components):{}):Ut;return t=>{let{slots:o,attributes:a,props:u}=t;if(r&&r[j])return function(t,e){let{slots:n,attributes:r,props:i,css:s,template:o}=e;o&&K("Pure components can not have html"),s&&K("Pure components do not have css");const a=Et(t({slots:n,attributes:r,props:i}),Ct);return Rt((t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===d){const[t]=n;t[j]=!0,It(t,a)}return a[t](...n),a}))}(r,{slots:o,attributes:a,props:u,css:e,template:n});const l=vt(r)||{},c=Vt({css:e,template:s,componentAPI:l,name:i})({slots:o,attributes:a,props:u});return{mount:(t,e,n)=>c.mount(t,n,e),update:(t,e)=>c.update(e,t),unmount:t=>c.unmount(t)}}}function Vt(t){let{css:e,template:n,componentAPI:r,name:i}=t;return e&&i&&Mt.add(i,e),_t(Kt)(yt(Et(r,Object.assign({},Lt,{[N]:{}})),Object.assign({[w]:null,[T]:null},Pt,{name:i,css:e,template:n})))}function Ft(t,e){return Object.assign({},t,vt(e))}function Kt(t,e){let{slots:n,attributes:r,props:i}=e;return s=function(t){return[...c].reduce(((t,e)=>e(t)||t),t)}(yt(Object.create(t),{mount(e,s,o){return void 0===s&&(s={}),this[S]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>rt(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},Rt((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(o),bt(this,O,Object.freeze(Object.assign({},kt(e,i),B(this[S].expressions)))),this.state=Ft(this.state,s),this[M]=this.template.createDOM(e).clone(),It(e,this),t.name&&function(t,e){Dt(t)!==e&&wt(t,f,e)}(e,t.name),bt(this,T,e),bt(this,w,n),this.onBeforeMount(this.props,this.state),this[A]=o,this[M].mount(e,this,o),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[A]=e,this[S].update(e));const n=B(this[S].expressions);if(!1!==this.shouldUpdate(n,this.props))return bt(this,O,Object.freeze(Object.assign({},this.props,n))),this.state=Ft(this.state,t),this.onBeforeUpdate(this.props,this.state),this[M].update(this,this[A]),this.onUpdated(this.props,this.state),this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[S].unmount(),this[M].unmount(this,this[A],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>k(t[e]))).forEach((t=>{s[t]=s[t].bind(s)})),s;var s}const{DOM_COMPONENT_INSTANCE_PROPERTY:Bt,COMPONENTS_IMPLEMENTATION_MAP:Yt,PLUGINS_SET:$t}=_;var qt=n(765),Ht=n.n(qt),Gt=n(422),Xt=n.n(Gt);function Jt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}const Zt=function(){function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.formSelector=e,this.constraits=n,this.form=document.querySelector(this.formSelector),this.elements=this.form.querySelectorAll("field-error"),this.form.addEventListener("submit",(function(t){r.onSubmit(t)})),this.form.addEventListener("field-update",(function(t){r.onFieldUpdate(t)}))}var e,n,r;return e=t,(n=[{key:"onSubmit",value:function(t){var e=this,n=Ht()(Xt()(t.target,{hash:!0}),this.constraits,{fullMessages:!1});n&&(t.preventDefault(),this.elements.forEach((function(t){var r=!1;n[t.attributes.name.nodeValue]&&(r=n[t.attributes.name.nodeValue]),e.dispatchCustomEvent(r,t)})))}},{key:"onFieldUpdate",value:function(t){var e=this;""==t.detail.value&&(t.detail.value=void 0);var n=Ht().single(t.detail.value,this.constraits[t.detail.name]);this.elements.forEach((function(r){r.attributes.name.nodeValue==t.detail.name&&e.dispatchCustomEvent(n,r)}))}},{key:"dispatchCustomEvent",value:function(t,e){var n=!1;t&&(n=t);var r=new CustomEvent("form-validation",{detail:n});e.dispatchEvent(r)}}])&&Jt(e.prototype,n),r&&Jt(e,r),t}();var Wt,Qt;!function(t,e){let{css:n,template:r,exports:i}=e;Yt.has(t)&&K(`The component "${t}" was already registered`),Yt.set(t,zt({name:t,css:n,template:r,exports:i}))}("field-error",{css:null,exports:{state:{errors:[]},onMounted(t,e){const n=this.root.closest(".field"),r=document.querySelector('[name="'+t.name+'"]'),i=r.closest("form");r&&i&&!t.nofieldupdate&&r.addEventListener("input",(e=>{this.dispatchCustomEvent(e,i,t.name)})),this.root.addEventListener("form-validation",(t=>{this.onFormValidation(t,n)}))},onFormValidation(t,e){t.detail?(this.state.errors=t.detail,e.classList.add("field--error"),e.classList.remove("field--valid")):(this.state.errors=[],e.classList.remove("field--error"),e.classList.add("field--valid")),this.update()},dispatchCustomEvent(t,e,n){const r=new CustomEvent("field-update",{detail:{name:n,value:t.target.value}});e.dispatchEvent(r)}},template:function(t,e,n,r){return t('<div expr0="expr0" class="field__error"></div>',[{type:n.IF,evaluate:function(t){return t.state.errors.length>0},redundantAttribute:"expr0",selector:"[expr0]",template:t('<ul><li expr1="expr1"></li></ul>',[{type:n.EACH,getKey:null,condition:null,template:t(" ",[{expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return[t.error].join("")}}]}]),redundantAttribute:"expr1",selector:"[expr1]",itemName:"error",indexName:null,evaluate:function(t){return t.state.errors}}])}])},name:"field-error"}),Ot("field-error").map((t=>function(t,e,n){const r=n||Dt(t);return u.has(r)||K(`The component named "${r}" was never registered`),u.get(r)({props:e}).mount(t)}(t,Wt,Qt)));new Zt("form",{email:{presence:!0,email:!0},password:{presence:!0}})},422:t=>{var e=/^(?:submit|button|image|reset|file)$/i,n=/^(?:input|select|textarea|keygen)/i,r=/(\[[^\[\]]*\])/g;function i(t,e,n){if(0===e.length)return t=n;var r=e.shift(),s=r.match(/^\[(.+?)\]$/);if("[]"===r)return t=t||[],Array.isArray(t)?t.push(i(null,e,n)):(t._values=t._values||[],t._values.push(i(null,e,n))),t;if(s){var o=s[1],a=+o;isNaN(a)?(t=t||{})[o]=i(t[o],e,n):(t=t||[])[a]=i(t[a],e,n)}else t[r]=i(t[r],e,n);return t}function s(t,e,n){if(e.match(r)){i(t,function(t){var e=[],n=new RegExp(r),i=/^([^\[\]]*)/.exec(t);for(i[1]&&e.push(i[1]);null!==(i=n.exec(t));)e.push(i[1]);return e}(e),n)}else{var s=t[e];s?(Array.isArray(s)||(t[e]=[s]),t[e].push(n)):t[e]=n}return t}function o(t,e,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=(n=encodeURIComponent(n)).replace(/%20/g,"+"),t+(t?"&":"")+encodeURIComponent(e)+"="+n}t.exports=function(t,r){"object"!=typeof r?r={hash:!!r}:void 0===r.hash&&(r.hash=!0);for(var i=r.hash?{}:"",a=r.serializer||(r.hash?s:o),u=t&&t.elements?t.elements:[],l=Object.create(null),c=0;c<u.length;++c){var f=u[c];if((r.disabled||!f.disabled)&&f.name&&(n.test(f.nodeName)&&!e.test(f.type))){var d=f.name,h=f.value;if("checkbox"!==f.type&&"radio"!==f.type||f.checked||(h=void 0),r.empty){if("checkbox"!==f.type||f.checked||(h=""),"radio"===f.type&&(l[f.name]||f.checked?f.checked&&(l[f.name]=!0):l[f.name]=!1),null==h&&"radio"==f.type)continue}else if(!h)continue;if("select-multiple"!==f.type)i=a(i,d,h);else{h=[];for(var p=f.options,m=!1,g=0;g<p.length;++g){var v=p[g],b=r.empty&&!v.value,y=v.value||b;v.selected&&y&&(m=!0,i=r.hash&&"[]"!==d.slice(d.length-2)?a(i,d+"[]",v.value):a(i,d,v.value))}!m&&r.empty&&(i=a(i,d,""))}}}if(r.empty)for(var d in l)l[d]||(i=a(i,d,""));return i}},837:()=>{},765:function(t,e,n){t=n.nmd(t),
/*!
* validate.js 0.13.1
*
* (c) 2013-2019 Nicklas Ansman, 2013 Wrapp
* Validate.js may be freely distributed under the MIT license.
* For all details and documentation:
* http://validatejs.org/
*/
function(t,e,r){"use strict";var i=function(t,e,n){n=s.extend({},s.options,n);var r=s.runValidations(t,e,n);if(r.some((function(t){return s.isPromise(t.error)})))throw new Error("Use validate.async if you want support for promises");return i.processValidationResults(r,n)},s=i;s.extend=function(t){return[].slice.call(arguments,1).forEach((function(e){for(var n in e)t[n]=e[n]})),t},s.extend(i,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var t=s.format("%{major}.%{minor}.%{patch}",s.version);return s.isEmpty(s.version.metadata)||(t+="+"+s.version.metadata),t}},Promise:"undefined"!=typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(t,e,n){var r,i,o,a,u,l,c,f=[];for(r in(s.isDomElement(t)||s.isJqueryElement(t))&&(t=s.collectFormValues(t)),e)for(i in o=s.getDeepObjectValue(t,r),a=s.result(e[r],o,t,r,n,e)){if(!(u=s.validators[i]))throw c=s.format("Unknown validator %{name}",{name:i}),new Error(c);l=a[i],(l=s.result(l,o,t,r,n,e))&&f.push({attribute:r,value:o,validator:i,globalOptions:n,attributes:t,options:l,error:u.call(u,o,l,r,t,n)})}return f},processValidationResults:function(t,e){t=s.pruneEmptyErrors(t,e),t=s.expandMultipleErrors(t,e),t=s.convertErrorMessages(t,e);var n=e.format||"grouped";if("function"!=typeof s.formatters[n])throw new Error(s.format("Unknown format %{format}",e));return t=s.formatters[n](t),s.isEmpty(t)?void 0:t},async:function(t,e,n){var r=(n=s.extend({},s.async.options,n)).wrapErrors||function(t){return t};!1!==n.cleanAttributes&&(t=s.cleanAttributes(t,e));var i=s.runValidations(t,e,n);return new s.Promise((function(o,a){s.waitForResults(i).then((function(){var u=s.processValidationResults(i,n);u?a(new r(u,n,t,e)):o(t)}),(function(t){a(t)}))}))},single:function(t,e,n){return n=s.extend({},s.single.options,n,{format:"flat",fullMessages:!1}),s({single:t},{single:e},n)},waitForResults:function(t){return t.reduce((function(t,e){return s.isPromise(e.error)?t.then((function(){return e.error.then((function(t){e.error=t||null}))})):t}),new s.Promise((function(t){t()})))},result:function(t){var e=[].slice.call(arguments,1);return"function"==typeof t&&(t=t.apply(null,e)),t},isNumber:function(t){return"number"==typeof t&&!isNaN(t)},isFunction:function(t){return"function"==typeof t},isInteger:function(t){return s.isNumber(t)&&t%1==0},isBoolean:function(t){return"boolean"==typeof t},isObject:function(t){return t===Object(t)},isDate:function(t){return t instanceof Date},isDefined:function(t){return null!=t},isPromise:function(t){return!!t&&s.isFunction(t.then)},isJqueryElement:function(t){return t&&s.isString(t.jquery)},isDomElement:function(t){return!!t&&(!(!t.querySelectorAll||!t.querySelector)&&(!(!s.isObject(document)||t!==document)||("object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName)))},isEmpty:function(t){var e;if(!s.isDefined(t))return!0;if(s.isFunction(t))return!1;if(s.isString(t))return s.EMPTY_STRING_REGEXP.test(t);if(s.isArray(t))return 0===t.length;if(s.isDate(t))return!1;if(s.isObject(t)){for(e in t)return!1;return!0}return!1},format:s.extend((function(t,e){return s.isString(t)?t.replace(s.format.FORMAT_REGEXP,(function(t,n,r){return"%"===n?"%{"+r+"}":String(e[r])})):t}),{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(t){return s.isNumber(t)?100*t%1==0?""+t:parseFloat(Math.round(100*t)/100).toFixed(2):s.isArray(t)?t.map((function(t){return s.prettify(t)})).join(", "):s.isObject(t)?s.isDefined(t.toString)?t.toString():JSON.stringify(t):(t=""+t).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,(function(t,e,n){return e+" "+n.toLowerCase()})).toLowerCase()},stringifyValue:function(t,e){return(e&&e.prettify||s.prettify)(t)},isString:function(t){return"string"==typeof t},isArray:function(t){return"[object Array]"==={}.toString.call(t)},isHash:function(t){return s.isObject(t)&&!s.isArray(t)&&!s.isFunction(t)},contains:function(t,e){return!!s.isDefined(t)&&(s.isArray(t)?-1!==t.indexOf(e):e in t)},unique:function(t){return s.isArray(t)?t.filter((function(t,e,n){return n.indexOf(t)==e})):t},forEachKeyInKeypath:function(t,e,n){if(s.isString(e)){var r,i="",o=!1;for(r=0;r<e.length;++r)switch(e[r]){case".":o?(o=!1,i+="."):(t=n(t,i,!1),i="");break;case"\\":o?(o=!1,i+="\\"):o=!0;break;default:o=!1,i+=e[r]}return n(t,i,!0)}},getDeepObjectValue:function(t,e){if(s.isObject(t))return s.forEachKeyInKeypath(t,e,(function(t,e){if(s.isObject(t))return t[e]}))},collectFormValues:function(t,e){var n,r,i,o,a,u,l={};if(s.isJqueryElement(t)&&(t=t[0]),!t)return l;for(e=e||{},o=t.querySelectorAll("input[name], textarea[name]"),n=0;n<o.length;++n)if(i=o.item(n),!s.isDefined(i.getAttribute("data-ignored"))){var c=i.name.replace(/\./g,"\\\\.");u=s.sanitizeFormValue(i.value,e),"number"===i.type?u=u?+u:null:"checkbox"===i.type?i.attributes.value?i.checked||(u=l[c]||null):u=i.checked:"radio"===i.type&&(i.checked||(u=l[c]||null)),l[c]=u}for(o=t.querySelectorAll("select[name]"),n=0;n<o.length;++n)if(i=o.item(n),!s.isDefined(i.getAttribute("data-ignored"))){if(i.multiple)for(r in u=[],i.options)(a=i.options[r])&&a.selected&&u.push(s.sanitizeFormValue(a.value,e));else{var f=void 0!==i.options[i.selectedIndex]?i.options[i.selectedIndex].value:"";u=s.sanitizeFormValue(f,e)}l[i.name]=u}return l},sanitizeFormValue:function(t,e){return e.trim&&s.isString(t)&&(t=t.trim()),!1!==e.nullify&&""===t?null:t},capitalize:function(t){return s.isString(t)?t[0].toUpperCase()+t.slice(1):t},pruneEmptyErrors:function(t){return t.filter((function(t){return!s.isEmpty(t.error)}))},expandMultipleErrors:function(t){var e=[];return t.forEach((function(t){s.isArray(t.error)?t.error.forEach((function(n){e.push(s.extend({},t,{error:n}))})):e.push(t)})),e},convertErrorMessages:function(t,e){var n=[],r=(e=e||{}).prettify||s.prettify;return t.forEach((function(t){var i=s.result(t.error,t.value,t.attribute,t.options,t.attributes,t.globalOptions);s.isString(i)?("^"===i[0]?i=i.slice(1):!1!==e.fullMessages&&(i=s.capitalize(r(t.attribute))+" "+i),i=i.replace(/\\\^/g,"^"),i=s.format(i,{value:s.stringifyValue(t.value,e)}),n.push(s.extend({},t,{error:i}))):n.push(t)})),n},groupErrorsByAttribute:function(t){var e={};return t.forEach((function(t){var n=e[t.attribute];n?n.push(t):e[t.attribute]=[t]})),e},flattenErrorsToArray:function(t){return t.map((function(t){return t.error})).filter((function(t,e,n){return n.indexOf(t)===e}))},cleanAttributes:function(t,e){function n(t,e,n){return s.isObject(t[e])?t[e]:t[e]=!!n||{}}return s.isObject(e)&&s.isObject(t)?function t(e,n){if(!s.isObject(e))return e;var r,i,o=s.extend({},e);for(i in e)r=n[i],s.isObject(r)?o[i]=t(o[i],r):r||delete o[i];return o}(t,e=function(t){var e,r={};for(e in t)t[e]&&s.forEachKeyInKeypath(r,e,n);return r}(e)):{}},exposeModule:function(t,e,n,r,i){n?(r&&r.exports&&(n=r.exports=t),n.validate=t):(e.validate=t,t.isFunction(i)&&i.amd&&i([],(function(){return t})))},warn:function(t){"undefined"!=typeof console&&console.warn&&console.warn("[validate.js] "+t)},error:function(t){"undefined"!=typeof console&&console.error&&console.error("[validate.js] "+t)}}),i.validators={presence:function(t,e){if(!1!==(e=s.extend({},this.options,e)).allowEmpty?!s.isDefined(t):s.isEmpty(t))return e.message||this.message||"can't be blank"},length:function(t,e,n){if(s.isDefined(t)){var r,i=(e=s.extend({},this.options,e)).is,o=e.maximum,a=e.minimum,u=[],l=(t=(e.tokenizer||function(t){return t})(t)).length;return s.isNumber(l)?(s.isNumber(i)&&l!==i&&(r=e.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",u.push(s.format(r,{count:i}))),s.isNumber(a)&&l<a&&(r=e.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",u.push(s.format(r,{count:a}))),s.isNumber(o)&&l>o&&(r=e.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",u.push(s.format(r,{count:o}))),u.length>0?e.message||u:void 0):e.message||this.notValid||"has an incorrect length"}},numericality:function(t,e,n,r,i){if(s.isDefined(t)){var o,a,u=[],l={greaterThan:function(t,e){return t>e},greaterThanOrEqualTo:function(t,e){return t>=e},equalTo:function(t,e){return t===e},lessThan:function(t,e){return t<e},lessThanOrEqualTo:function(t,e){return t<=e},divisibleBy:function(t,e){return t%e==0}},c=(e=s.extend({},this.options,e)).prettify||i&&i.prettify||s.prettify;if(s.isString(t)&&e.strict){var f="^-?(0|[1-9]\\d*)";if(e.onlyInteger||(f+="(\\.\\d+)?"),f+="$",!new RegExp(f).test(t))return e.message||e.notValid||this.notValid||this.message||"must be a valid number"}if(!0!==e.noStrings&&s.isString(t)&&!s.isEmpty(t)&&(t=+t),!s.isNumber(t))return e.message||e.notValid||this.notValid||this.message||"is not a number";if(e.onlyInteger&&!s.isInteger(t))return e.message||e.notInteger||this.notInteger||this.message||"must be an integer";for(o in l)if(a=e[o],s.isNumber(a)&&!l[o](t,a)){var d="not"+s.capitalize(o),h=e[d]||this[d]||this.message||"must be %{type} %{count}";u.push(s.format(h,{count:a,type:c(o)}))}return e.odd&&t%2!=1&&u.push(e.notOdd||this.notOdd||this.message||"must be odd"),e.even&&t%2!=0&&u.push(e.notEven||this.notEven||this.message||"must be even"),u.length?e.message||u:void 0}},datetime:s.extend((function(t,e){if(!s.isFunction(this.parse)||!s.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(s.isDefined(t)){var n,r=[],i=(e=s.extend({},this.options,e)).earliest?this.parse(e.earliest,e):NaN,o=e.latest?this.parse(e.latest,e):NaN;return t=this.parse(t,e),isNaN(t)||e.dateOnly&&t%864e5!=0?(n=e.notValid||e.message||this.notValid||"must be a valid date",s.format(n,{value:arguments[0]})):(!isNaN(i)&&t<i&&(n=e.tooEarly||e.message||this.tooEarly||"must be no earlier than %{date}",n=s.format(n,{value:this.format(t,e),date:this.format(i,e)}),r.push(n)),!isNaN(o)&&t>o&&(n=e.tooLate||e.message||this.tooLate||"must be no later than %{date}",n=s.format(n,{date:this.format(o,e),value:this.format(t,e)}),r.push(n)),r.length?s.unique(r):void 0)}}),{parse:null,format:null}),date:function(t,e){return e=s.extend({},e,{dateOnly:!0}),s.validators.datetime.call(s.validators.datetime,t,e)},format:function(t,e){(s.isString(e)||e instanceof RegExp)&&(e={pattern:e});var n,r=(e=s.extend({},this.options,e)).message||this.message||"is invalid",i=e.pattern;if(s.isDefined(t))return s.isString(t)?(s.isString(i)&&(i=new RegExp(e.pattern,e.flags)),(n=i.exec(t))&&n[0].length==t.length?void 0:r):r},inclusion:function(t,e){if(s.isDefined(t)&&(s.isArray(e)&&(e={within:e}),e=s.extend({},this.options,e),!s.contains(e.within,t))){var n=e.message||this.message||"^%{value} is not included in the list";return s.format(n,{value:t})}},exclusion:function(t,e){if(s.isDefined(t)&&(s.isArray(e)&&(e={within:e}),e=s.extend({},this.options,e),s.contains(e.within,t))){var n=e.message||this.message||"^%{value} is restricted";return s.isString(e.within[t])&&(t=e.within[t]),s.format(n,{value:t})}},email:s.extend((function(t,e){var n=(e=s.extend({},this.options,e)).message||this.message||"is not a valid email";if(s.isDefined(t))return s.isString(t)&&this.PATTERN.exec(t)?void 0:n}),{PATTERN:/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(t,e,n,r,i){if(s.isDefined(t)){s.isString(e)&&(e={attribute:e});var o=(e=s.extend({},this.options,e)).message||this.message||"is not equal to %{attribute}";if(s.isEmpty(e.attribute)||!s.isString(e.attribute))throw new Error("The attribute must be a non empty string");var a=s.getDeepObjectValue(r,e.attribute),u=e.comparator||function(t,e){return t===e},l=e.prettify||i&&i.prettify||s.prettify;return u(t,a,e,n,r)?void 0:s.format(o,{attribute:l(e.attribute)})}},url:function(t,e){if(s.isDefined(t)){var n=(e=s.extend({},this.options,e)).message||this.message||"is not a valid url",r=e.schemes||this.schemes||["http","https"],i=e.allowLocal||this.allowLocal||!1,o=e.allowDataUrl||this.allowDataUrl||!1;if(!s.isString(t))return n;var a="^(?:(?:"+r.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",u="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";if(i?u+="?":a+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",a+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+u+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",o){a="(?:"+a+")|(?:^data:(?:\\w+\\/[-+.\\w]+(?:;[\\w=]+)*)?(?:;base64)?,[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*$)"}return new RegExp(a,"i").exec(t)?void 0:n}},type:s.extend((function(t,e,n,r,i){if(s.isString(e)&&(e={type:e}),s.isDefined(t)){var o,a=s.extend({},this.options,e),u=a.type;if(!s.isDefined(u))throw new Error("No type was specified");if(o=s.isFunction(u)?u:this.types[u],!s.isFunction(o))throw new Error("validate.validators.type.types."+u+" must be a function.");if(!o(t,a,n,r,i)){var l=e.message||this.messages[u]||this.message||a.message||(s.isFunction(u)?"must be of the correct type":"must be of type %{type}");return s.isFunction(l)&&(l=l(t,e,n,r,i)),s.format(l,{attribute:s.prettify(n),type:u})}}}),{types:{object:function(t){return s.isObject(t)&&!s.isArray(t)},array:s.isArray,integer:s.isInteger,number:s.isNumber,string:s.isString,date:s.isDate,boolean:s.isBoolean},messages:{}})},i.formatters={detailed:function(t){return t},flat:s.flattenErrorsToArray,grouped:function(t){var e;for(e in t=s.groupErrorsByAttribute(t))t[e]=s.flattenErrorsToArray(t[e]);return t},constraint:function(t){var e;for(e in t=s.groupErrorsByAttribute(t))t[e]=t[e].map((function(t){return t.validator})).sort();return t}},i.exposeModule(i,this,t,e,n.amdD)}.call(this,e,t,n.amdD)}},e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=t,n.x=t=>{},n.amdD=function(){throw new Error("define cannot be used indirect")},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t={669:0},e=[[2],[837]],r=t=>{},i=(i,s)=>{for(var o,a,[u,l,c,f]=s,d=0,h=[];d<u.length;d++)a=u[d],n.o(t,a)&&t[a]&&h.push(t[a][0]),t[a]=0;for(o in l)n.o(l,o)&&(n.m[o]=l[o]);for(c&&c(n),i&&i(s);h.length;)h.shift()();return f&&e.push.apply(e,f),r()},s=self.webpackChunk_tentakelfabrik_tiny_validator=self.webpackChunk_tentakelfabrik_tiny_validator||[];function o(){for(var r,i=0;i<e.length;i++){for(var s=e[i],o=!0,a=1;a<s.length;a++){var u=s[a];0!==t[u]&&(o=!1)}o&&(e.splice(i--,1),r=n(n.s=s[0]))}return 0===e.length&&(n.x(),n.x=t=>{}),r}s.forEach(i.bind(null,0)),s.push=i.bind(null,s.push.bind(s));var a=n.x;n.x=()=>(n.x=a||(t=>{}),(r=o)())})(),n.x()})();