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 e={619:(e,t,n)=>{"use strict";function r(e){return e.replace(/-(\w)/g,((e,t)=>t.toUpperCase()))}function i(e,t){e.firstChild&&(t.appendChild(e.firstChild),i(e,t))}function o(e){Array.from(e).forEach(s)}const s=e=>e&&e.parentNode&&e.parentNode.removeChild(e),a=(e,t)=>t&&t.parentNode&&t.parentNode.insertBefore(e,t),u=new Map,l=Symbol("riot-component"),c=new Set,f="is",p="mount",d="update",h="unmount",m="shouldUpdate",g="onBeforeMount",b="onMounted",v="onBeforeUpdate",y="onUpdated",E="onBeforeUnmount",x="onUnmounted",O="props",N="state",T="slots",w="root",A=Symbol.for("pure"),j=Symbol("parent"),_=Symbol("attributes"),S=Symbol("template");var M=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:p,UPDATE_METHOD_KEY:d,UNMOUNT_METHOD_KEY:h,SHOULD_UPDATE_KEY:m,ON_BEFORE_MOUNT_KEY:g,ON_MOUNTED_KEY:b,ON_BEFORE_UPDATE_KEY:v,ON_UPDATED_KEY:y,ON_BEFORE_UNMOUNT_KEY:E,ON_UNMOUNTED_KEY:x,PROPS_KEY:O,STATE_KEY:N,SLOTS_KEY:T,ROOT_KEY:w,IS_PURE_SYMBOL:A,PARENT_KEY_SYMBOL:j,ATTRIBUTES_KEY_SYMBOL:_,TEMPLATE_KEY_SYMBOL:S});var D={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var P={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};function I(e,t){return typeof e===t}function U(e){const t=e.ownerSVGElement;return!!t||null===t}function C(e){return!L(e.content)}function k(e){return I(e,"function")}function R(e){return!L(e)&&I(e,"object")}function L(e){return null==e}const z=Symbol("unmount"),V={nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:r,childrenMap:i}=this,o=e===z?null:this.evaluate(e),u=o?Array.from(o):[],{newChildrenMap:l,batches:c,futureNodes:f}=(n.parentNode,function(e,t,n,r){const{condition:i,template:o,childrenMap:s,itemName:a,getKey:u,indexName:l,root:c,isTemplateTag:f}=r,p=new Map,d=[],h=[];return e.forEach(((e,r)=>{const m=function(e,t){let{itemName:n,indexName:r,index:i,item:o}=t;e[n]=o,r&&(e[r]=i);return e}(Object.create(t),{itemName:a,indexName:l,index:r,item:e}),g=u?u(m):r,b=s.get(g);if(function(e,t){return!!e&&!1===Boolean(e(t))}(i,m))return;const v=b?b.template:o.clone(),y=b?v.el:c.cloneNode(),E=!b,x=f&&E?function(e){const t=e.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:t,children:Array.from(t.childNodes)}}(v):{};if(E?d.push((()=>v.mount(y,m,n,x))):d.push((()=>v.update(m,n))),f){const e=x.children||v.children;h.push(...e)}else h.push(y);s.delete(g),p.set(g,{template:v,context:m,index:r})})),{newChildrenMap:p,batches:d,futureNodes:h}}(u,e,t,this));return((e,t,n,r,i)=>{const o=n.length;let u=t.length,l=o,c=0,f=0,p=null;for(;c<u||f<l;)if(u===c){const e=l<o?f?r(n[f-1],-0).nextSibling:r(n[l-f],0):i;for(;f<l;)a(r(n[f++],1),e)}else if(l===f)for(;c<u;)p&&p.has(t[c])||s(r(t[c],-1)),c++;else if(t[c]===n[f])c++,f++;else if(t[u-1]===n[l-1])u--,l--;else if(t[c]===n[l-1]&&n[f]===t[u-1]){const e=r(t[--u],-1).nextSibling;a(r(n[f++],1),r(t[c++],-1).nextSibling),a(r(n[--l],1),e),t[u]=n[l]}else{if(!p){p=new Map;let e=f;for(;e<l;)p.set(n[e],e++)}if(p.has(t[c])){const e=p.get(t[c]);if(f<e&&e<l){let i=c,o=1;for(;++i<u&&i<l&&p.get(t[i])===e+o;)o++;if(o>e-f){const i=r(t[c],0);for(;f<e;)a(r(n[f++],1),i)}else d=r(n[f++],1),(h=r(t[c++],-1))&&h.parentNode&&h.parentNode.replaceChild(d,h)}else c++}else s(r(t[c++],-1))}var d,h})(0,r,f,function(e,t){return(n,r)=>{if(r<0){const n=e.pop();if(n){const{template:e,context:r}=n;e.unmount(r,t,null)}}return n}}(Array.from(i.values()),t),n),c.forEach((e=>e())),this.childrenMap=l,this.nodes=f,this},unmount(e,t){return this.update(z,t),this}};const B={mount(e,t){return this.update(e,t)},update(e,t){const n=!!this.evaluate(e),r=!this.value&&n,i=this.value&&!n,o=()=>{const n=this.node.cloneNode();a(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,e,t)};switch(!0){case r:o();break;case i:this.unmount(e);break;default:n&&this.template.update(e,t)}return this.value=n,this},unmount(e,t){return this.template.unmount(e,t,!0),this}};function F(e){throw new Error(e)}function K(e){return e.reduce(((e,t)=>{const{value:n,type:i}=t;switch(!0){case!t.name&&0===i:return Object.assign({},e,n);case 3===i:e.value=t.value;break;default:e[r(t.name)]=t.value}return e}),{})}const Y="removeAttribute",$="setAttribute",q="undefined"==typeof Element?{}:Element.prototype,G=function(e){const t=new Map,n=n=>(t.has(n)||t.set(n,e.call(this,n)))&&t.get(n);return n.cache=t,n}((e=>q.hasOwnProperty(e)));function H(e,t,n,r){let{name:i}=t;if(!i)return r&&function(e,t,n){const r=t?Object.keys(t):[];Object.keys(n).filter((e=>!r.includes(e))).forEach((t=>e.removeAttribute(t)))}(e,n,r),void(n&&function(e,t){Object.entries(t).forEach((t=>{let[n,r]=t;return H(e,{name:n},r)}))}(e,n));!G(i)&&(function(e){return I(e,"boolean")}(n)||R(n)||k(n))&&(e[i]=n),e[function(e){return L(e)||!1===e||""===e||R(e)||k(e)?Y:$}(n)](i,function(e,t){return!0===t?e:t}(i,n))}const X=/^on/,J={handleEvent(e){this[e.type](e)}},Z=new WeakMap;function W(e){return L(e)?"":e}const Q=(e,t)=>{const n=e.childNodes[t];if(n.nodeType===Node.COMMENT_NODE){const t=document.createTextNode("");return e.replaceChild(t,n),t}return n};var ee={0:H,1:function(e,t,n){let{name:r}=t;const i=r.replace(X,""),o=Z.get(e)||(e=>{const t=Object.create(J);return Z.set(e,t),t})(e),[s,a]=(e=>Array.isArray(e)?e:[e,!1])(n),u=o[i],l=s&&!u;u&&!s&&e.removeEventListener(i,o),l&&e.addEventListener(i,o,a),o[i]=s},2:function(e,t,n){e.data=W(n)},3:function(e,t,n){e.value=W(n)}};const te={mount(e){return this.value=this.evaluate(e),ne(this,this.value),this},update(e){const t=this.evaluate(e);return this.value!==t&&(ne(this,t),this.value=t),this},unmount(){return 1===this.type&&ne(this,null),this}};function ne(e,t){return ee[e.type](e.node,e,t,e.value)}function re(e,t){return Object.assign({},te,t,{node:2===t.type?Q(e,t.childNodeIndex):e})}const ie=(e,t)=>e[j]||t,oe={attributes:[],getTemplateScope(e,t){return function(e,t,n){if(!e||!e.length)return n;const r=e.map((e=>Object.assign({},e,{value:e.evaluate(t)})));return Object.assign(Object.create(n||null),K(r))}(this.attributes,e,t)},mount(e,t){const n=!!e.slots&&e.slots.find((e=>{let{id:t}=e;return t===this.name})),{parentNode:r}=this.node,i=ie(e,t);return this.template=n&&me(n.html,n.bindings).createDOM(r),this.template&&(this.template.mount(this.node,this.getTemplateScope(e,i),i),this.template.children=Array.from(this.node.childNodes),se(this.node)),s(this.node),this},update(e,t){if(this.template){const n=ie(e,t);this.template.update(this.getTemplateScope(e,n),n)}return this},unmount(e,t,n){return this.template&&this.template.unmount(this.getTemplateScope(e,t),null,n),this}};function se(e){const t=e&&e.firstChild;t&&(a(t,e),se(e))}function ae(e){return e.reduce(((e,t)=>{let{bindings:n}=t;return e.concat(n)}),[])}const ue={mount(e){return this.update(e)},update(e,t){const n=this.evaluate(e);return n===this.name?this.tag.update(e):(this.unmount(e,t,!0),this.name=n,this.tag=function(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),e?e({slots:t,attributes:n}):me(function(e){return e.reduce(((e,t)=>e+t.html),"")}(t),[...ae(t),{expressions:n.map((e=>Object.assign({type:0},e)))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,e)),this},unmount(e,t,n){return this.tag&&this.tag.unmount(n),this}};var le={1:function(e,t){let{evaluate:n,template:r}=t;const i=document.createTextNode("");return a(i,e),s(e),Object.assign({},B,{node:e,evaluate:n,placeholder:i,template:r.createDOM(e)})},2:function(e,t){let{expressions:n}=t;return Object.assign({},(r=n.map((t=>re(e,t))),["mount","update","unmount"].reduce(((e,t)=>Object.assign({},e,{[t]:e=>r.map((n=>n[t](e)))&&i})),{})));var r,i},0:function(e,t){let{evaluate:n,condition:r,itemName:i,indexName:o,getKey:u,template:l}=t;const c=document.createTextNode(""),f=e.cloneNode();return a(c,e),s(e),Object.assign({},V,{childrenMap:new Map,node:e,root:f,condition:r,evaluate:n,isTemplateTag:C(f),template:l.createDOM(e),getKey:u,indexName:o,itemName:i,placeholder:c})},3:function(e,t){let{evaluate:n,getComponent:r,slots:i,attributes:o}=t;return Object.assign({},ue,{node:e,evaluate:n,slots:i,attributes:o,getComponent:r})},4:function(e,t){let{name:n,attributes:r}=t;return Object.assign({},oe,{attributes:r,node:e,name:n})}};function ce(e,t){return e.map((e=>2===e.type?Object.assign({},e,{childNodeIndex:e.childNodeIndex+t}):e))}function fe(e,t,n){const{selector:r,type:i,redundantAttribute:o,expressions:s}=t,a=r?e.querySelector(r):e;o&&a.removeAttribute(o);const u=s||[];return(le[i]||le[2])(a,Object.assign({},t,{expressions:n&&!r?ce(u,n):u}))}function pe(e,t){return U(e)?function(e,t){return t.ownerDocument.importNode((new window.DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,"application/xml").documentElement,!0)}(t,e):function(e,t){const n=C(t)?t:document.createElement("template");return n.innerHTML=e,n.content}(t,e)}function de(e,t){switch(!0){case U(e):i(t,e);break;case C(e):e.parentNode.replaceChild(t,e);break;default:e.appendChild(t)}}const he=Object.freeze({createDOM(e){return this.dom=this.dom||function(e,t){return t&&("string"==typeof t?pe(e,t):t)}(e,this.html),this},mount(e,t,n,r){if(void 0===r&&(r={}),!e)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(t);const{fragment:i,children:o,avoidDOMInjection:s}=r,{parentNode:a}=o?o[0]:e,u=C(e),l=u?Math.max(Array.from(a.childNodes).indexOf(e),0):null;return this.isTemplateTag=u,this.createDOM(e),this.dom&&(this.fragment=i||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?a:e,this.children=this.isTemplateTag?o||Array.from(this.fragment.childNodes):null,!s&&this.fragment&&de(e,this.fragment),this.bindings=this.bindingsData.map((e=>fe(this.el,e,l))),this.bindings.forEach((e=>e.mount(t,n))),this},update(e,t){return this.bindings.forEach((n=>n.update(e,t))),this},unmount(e,t,n){if(this.el){switch(this.bindings.forEach((r=>r.unmount(e,t,n))),!0){case this.el[A]:break;case this.children&&null!==n:o(this.children);break;case!0===n:s(this.el);break;case null!==n:o(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function me(e,t){return void 0===t&&(t=[]),Object.assign({},he,{html:e,bindingsData:t})}function ge(){return this}function be(e){return k(e)?e.prototype&&e.prototype.constructor?new e:e():e}function ve(e,t,n,r){return void 0===r&&(r={}),Object.defineProperty(e,t,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function ye(e,t,n){return Object.entries(t).forEach((t=>{let[r,i]=t;ve(e,r,i,n)})),e}function Ee(e,t){return Object.entries(t).forEach((t=>{let[n,r]=t;e[n]||(e[n]=r)})),e}function xe(e){return Array.isArray(e)?e:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&"number"==typeof e.length?Array.from(e):[e]}function Oe(e,t){return xe("string"==typeof e?(t||document).querySelectorAll(e):e)}const Ne=e=>1===e.length?e[0]:e;function Te(e,t,n){const r="object"==typeof t?t:{[t]:n},i=Object.keys(r);return xe(e).forEach((e=>{i.forEach((t=>e.setAttribute(t,r[t])))})),e}function we(e,t){return function(e,t,n){const r="string"==typeof t?[t]:t;return Ne(xe(e).map((e=>Ne(r.map((t=>e[n](t)))))))}(e,t,"getAttribute")}const Ae=new Map,je=()=>_e||(Te(_e=Oe("style[riot]")[0]||document.createElement("style"),"type","text/css"),_e.parentNode||document.head.appendChild(_e),_e);var _e,Se={CSS_BY_NAME:Ae,add(e,t){return Ae.has(e)||(Ae.set(e,t),this.inject()),this},inject(){return je().innerHTML=[...Ae.values()].join("\n"),this},remove(e){return Ae.has(e)&&(Ae.delete(e),this.inject()),this}};function Me(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return(r=[...n,...r]).length<e.length?Me(e,...r):e(...r)}}function De(e){return we(e,f)||e.tagName.toLowerCase()}const Pe=Object.freeze({$(e){return Oe(e,this.root)[0]},$$(e){return Oe(e,this.root)}}),Ie=Object.freeze({[p]:ge,[d]:ge,[h]:ge}),Ue=Object.freeze({[m]:ge,[g]:ge,[b]:ge,[v]:ge,[y]:ge,[E]:ge,[x]:ge}),Ce=Object.assign({},Ie,{clone:ge,createDOM:ge});function ke(e,t){return void 0===t&&(t={}),Object.assign({},function(e){return Array.from(e.attributes).reduce(((e,t)=>(e[r(t.name)]=t.value,e)),{})}(e),be(t))}const Re=(e,t)=>e[l]=t;function Le(e){return[p,d,h].reduce(((t,n)=>(t[n]=e(n),t)),{})}function ze(e){let{css:t,template:n,exports:r,name:i}=e;const o=n?function(e,t){return e(me,P,D,(e=>t[e]||u.get(e)))}(n,r?function(e){void 0===e&&(e={});return Object.entries(be(e)).reduce(((e,t)=>{let[n,r]=t;
/* Riot v5.1.2, @license MIT */
var i;return e[(i=n,i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=ze(r),e}),{})}(r.components):{}):Ce;return e=>{let{slots:s,attributes:a,props:u}=e;if(r&&r[A])return function(e,t){let{slots:n,attributes:r,props:i,css:o,template:s}=t;s&&F("Pure components can not have html"),o&&F("Pure components do not have css");const a=Ee(e({slots:n,attributes:r,props:i}),Ie);return Le((e=>function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(e===p){const[e]=n;e[A]=!0,Re(e,a)}return a[e](...n),a}))}(r,{slots:s,attributes:a,props:u,css:t,template:n});const l=be(r)||{},c=Ve({css:t,template:o,componentAPI:l,name:i})({slots:s,attributes:a,props:u});return{mount:(e,t,n)=>c.mount(e,n,t),update:(e,t)=>c.update(t,e),unmount:e=>c.unmount(e)}}}function Ve(e){let{css:t,template:n,componentAPI:r,name:i}=e;return t&&i&&Se.add(i,t),Me(Fe)(ye(Ee(r,Object.assign({},Ue,{[N]:{}})),Object.assign({[T]:null,[w]:null},Pe,{name:i,css:t,template:n})))}function Be(e,t){return Object.assign({},e,be(t))}function Fe(e,t){let{slots:n,attributes:r,props:i}=t;return o=function(e){return[...c].reduce(((e,t)=>t(e)||e),e)}(ye(Object.create(e),{mount(t,o,s){return void 0===o&&(o={}),this[_]=function(e,t){void 0===t&&(t=[]);const n=t.map((t=>re(e,t))),r={};return Object.assign(r,Object.assign({expressions:n},Le((e=>t=>(n.forEach((n=>n[e](t))),r)))))}(t,r).mount(s),ve(this,O,Object.freeze(Object.assign({},ke(t,i),K(this[_].expressions)))),this.state=Be(this.state,o),this[S]=this.template.createDOM(t).clone(),Re(t,this),e.name&&function(e,t){De(e)!==t&&Te(e,f,t)}(t,e.name),ve(this,w,t),ve(this,T,n),this.onBeforeMount(this.props,this.state),this[j]=s,this[S].mount(t,this,s),this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&(this[j]=t,this[_].update(t));const n=K(this[_].expressions);if(!1!==this.shouldUpdate(n,this.props))return ve(this,O,Object.freeze(Object.assign({},this.props,n))),this.state=Be(this.state,e),this.onBeforeUpdate(this.props,this.state),this[S].update(this,this[j]),this.onUpdated(this.props,this.state),this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[_].unmount(),this[S].unmount(this,this[j],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter((t=>k(e[t]))).forEach((e=>{o[e]=o[e].bind(o)})),o;var o}const{DOM_COMPONENT_INSTANCE_PROPERTY:Ke,COMPONENTS_IMPLEMENTATION_MAP:Ye,PLUGINS_SET:$e}=M;function qe(e,t){let{css:n,template:r,exports:i}=t;return Ye.has(e)&&F(`The component "${e}" was already registered`),Ye.set(e,ze({name:e,css:n,template:r,exports:i})),Ye}function Ge(e,t,n){return Oe(e).map((e=>function(e,t,n){const r=n||De(e);return u.has(r)||F(`The component named "${r}" was never registered`),u.get(r)({props:t}).mount(e)}(e,t,n)))}var He=n(765),Xe=n.n(He),Je=n(422),Ze=n.n(Je);function We(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}const Qe=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._rules=t,this._component=n,this._errors={}}var t,n,r;return t=e,(n=[{key:"handle",value:function(e,t){e.preventDefault();var n,r,i=null;t?e.target.value&&(i=e.target.value):i=Ze()(e.target,{hash:!0}),t?(n=this._rules[t],(r=Xe().single(i,n,{flat:!0}))?this._errors[t]=r:delete this._errors[t]):this._errors=Xe()(i,this._rules),this._component.update()}},{key:"errors",value:function(e){return e?this._errors[e]:this._errors}}])&&We(t.prototype,n),r&&We(t,r),e}(),et={css:null,exports:{onBeforeMount(){this.state.validator=new Qe({email:{presence:!0,email:!0},password:{presence:!0}},this)}},template:function(e,t,n,r){return e('<form expr2="expr2" novalidate><div class="field"><label>\n email\n <input expr3="expr3" type="email" name="email"/></label><field-error expr4="expr4"></field-error></div><div class="field"><label>\n password\n <input expr5="expr5" type="password" name="email"/></label><field-error expr6="expr6"></field-error></div><button type="submit">Send</button></form>',[{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:t.EVENT,name:"onsubmit",evaluate:function(e){return t=>{e.state.validator.handle(t)}}}]},{redundantAttribute:"expr3",selector:"[expr3]",expressions:[{type:t.EVENT,name:"onkeyup",evaluate:function(e){return t=>{e.state.validator.handle(t,"email")}}}]},{type:n.TAG,getComponent:r,evaluate:function(e){return"field-error"},slots:[],attributes:[{type:t.ATTRIBUTE,name:"errors",evaluate:function(e){return e.state.validator.errors("email")}}],redundantAttribute:"expr4",selector:"[expr4]"},{redundantAttribute:"expr5",selector:"[expr5]",expressions:[{type:t.EVENT,name:"onkeyup",evaluate:function(e){return t=>{e.state.validator.handle(t,"password")}}}]},{type:n.TAG,getComponent:r,evaluate:function(e){return"field-error"},slots:[],attributes:[{type:t.ATTRIBUTE,name:"errors",evaluate:function(e){return e.state.validator.errors("password")}}],redundantAttribute:"expr6",selector:"[expr6]"}])},name:"demo"};qe("field-error",{css:null,exports:{state:{errors:[]},onBeforeUpdate(e,t){e.errors&&e.errors.length>0?t.errors=e.errors:t.errors=[]}},template:function(e,t,n,r){return e('<div expr0="expr0" class="field__error"></div>',[{type:n.IF,evaluate:function(e){return e.state.errors.length>0},redundantAttribute:"expr0",selector:"[expr0]",template:e('<ul><li expr1="expr1"></li></ul>',[{type:n.EACH,getKey:null,condition:null,template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.error}}]}]),redundantAttribute:"expr1",selector:"[expr1]",itemName:"error",indexName:null,evaluate:function(e){return e.state.errors}}])}])},name:"field-error"}),Ge("field-error"),qe("demo",et),Ge("demo")},422:e=>{var t=/^(?:submit|button|image|reset|file)$/i,n=/^(?:input|select|textarea|keygen)/i,r=/(\[[^\[\]]*\])/g;function i(e,t,n){if(0===t.length)return e=n;var r=t.shift(),o=r.match(/^\[(.+?)\]$/);if("[]"===r)return e=e||[],Array.isArray(e)?e.push(i(null,t,n)):(e._values=e._values||[],e._values.push(i(null,t,n))),e;if(o){var s=o[1],a=+s;isNaN(a)?(e=e||{})[s]=i(e[s],t,n):(e=e||[])[a]=i(e[a],t,n)}else e[r]=i(e[r],t,n);return e}function o(e,t,n){if(t.match(r)){i(e,function(e){var t=[],n=new RegExp(r),i=/^([^\[\]]*)/.exec(e);for(i[1]&&t.push(i[1]);null!==(i=n.exec(e));)t.push(i[1]);return t}(t),n)}else{var o=e[t];o?(Array.isArray(o)||(e[t]=[o]),e[t].push(n)):e[t]=n}return e}function s(e,t,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=(n=encodeURIComponent(n)).replace(/%20/g,"+"),e+(e?"&":"")+encodeURIComponent(t)+"="+n}e.exports=function(e,r){"object"!=typeof r?r={hash:!!r}:void 0===r.hash&&(r.hash=!0);for(var i=r.hash?{}:"",a=r.serializer||(r.hash?o:s),u=e&&e.elements?e.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)&&!t.test(f.type))){var p=f.name,d=f.value;if("checkbox"!==f.type&&"radio"!==f.type||f.checked||(d=void 0),r.empty){if("checkbox"!==f.type||f.checked||(d=""),"radio"===f.type&&(l[f.name]||f.checked?f.checked&&(l[f.name]=!0):l[f.name]=!1),null==d&&"radio"==f.type)continue}else if(!d)continue;if("select-multiple"!==f.type)i=a(i,p,d);else{d=[];for(var h=f.options,m=!1,g=0;g<h.length;++g){var b=h[g],v=r.empty&&!b.value,y=b.value||v;b.selected&&y&&(m=!0,i=r.hash&&"[]"!==p.slice(p.length-2)?a(i,p+"[]",b.value):a(i,p,b.value))}!m&&r.empty&&(i=a(i,p,""))}}}if(r.empty)for(var p in l)l[p]||(i=a(i,p,""));return i}},837:()=>{},765:function(e,t,n){e=n.nmd(e),
/*!
* 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(e,t,r){"use strict";var i=function(e,t,n){n=o.extend({},o.options,n);var r=o.runValidations(e,t,n);if(r.some((function(e){return o.isPromise(e.error)})))throw new Error("Use validate.async if you want support for promises");return i.processValidationResults(r,n)},o=i;o.extend=function(e){return[].slice.call(arguments,1).forEach((function(t){for(var n in t)e[n]=t[n]})),e},o.extend(i,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var e=o.format("%{major}.%{minor}.%{patch}",o.version);return o.isEmpty(o.version.metadata)||(e+="+"+o.version.metadata),e}},Promise:"undefined"!=typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(e,t,n){var r,i,s,a,u,l,c,f=[];for(r in(o.isDomElement(e)||o.isJqueryElement(e))&&(e=o.collectFormValues(e)),t)for(i in s=o.getDeepObjectValue(e,r),a=o.result(t[r],s,e,r,n,t)){if(!(u=o.validators[i]))throw c=o.format("Unknown validator %{name}",{name:i}),new Error(c);l=a[i],(l=o.result(l,s,e,r,n,t))&&f.push({attribute:r,value:s,validator:i,globalOptions:n,attributes:e,options:l,error:u.call(u,s,l,r,e,n)})}return f},processValidationResults:function(e,t){e=o.pruneEmptyErrors(e,t),e=o.expandMultipleErrors(e,t),e=o.convertErrorMessages(e,t);var n=t.format||"grouped";if("function"!=typeof o.formatters[n])throw new Error(o.format("Unknown format %{format}",t));return e=o.formatters[n](e),o.isEmpty(e)?void 0:e},async:function(e,t,n){var r=(n=o.extend({},o.async.options,n)).wrapErrors||function(e){return e};!1!==n.cleanAttributes&&(e=o.cleanAttributes(e,t));var i=o.runValidations(e,t,n);return new o.Promise((function(s,a){o.waitForResults(i).then((function(){var u=o.processValidationResults(i,n);u?a(new r(u,n,e,t)):s(e)}),(function(e){a(e)}))}))},single:function(e,t,n){return n=o.extend({},o.single.options,n,{format:"flat",fullMessages:!1}),o({single:e},{single:t},n)},waitForResults:function(e){return e.reduce((function(e,t){return o.isPromise(t.error)?e.then((function(){return t.error.then((function(e){t.error=e||null}))})):e}),new o.Promise((function(e){e()})))},result:function(e){var t=[].slice.call(arguments,1);return"function"==typeof e&&(e=e.apply(null,t)),e},isNumber:function(e){return"number"==typeof e&&!isNaN(e)},isFunction:function(e){return"function"==typeof e},isInteger:function(e){return o.isNumber(e)&&e%1==0},isBoolean:function(e){return"boolean"==typeof e},isObject:function(e){return e===Object(e)},isDate:function(e){return e instanceof Date},isDefined:function(e){return null!=e},isPromise:function(e){return!!e&&o.isFunction(e.then)},isJqueryElement:function(e){return e&&o.isString(e.jquery)},isDomElement:function(e){return!!e&&(!(!e.querySelectorAll||!e.querySelector)&&(!(!o.isObject(document)||e!==document)||("object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName)))},isEmpty:function(e){var t;if(!o.isDefined(e))return!0;if(o.isFunction(e))return!1;if(o.isString(e))return o.EMPTY_STRING_REGEXP.test(e);if(o.isArray(e))return 0===e.length;if(o.isDate(e))return!1;if(o.isObject(e)){for(t in e)return!1;return!0}return!1},format:o.extend((function(e,t){return o.isString(e)?e.replace(o.format.FORMAT_REGEXP,(function(e,n,r){return"%"===n?"%{"+r+"}":String(t[r])})):e}),{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(e){return o.isNumber(e)?100*e%1==0?""+e:parseFloat(Math.round(100*e)/100).toFixed(2):o.isArray(e)?e.map((function(e){return o.prettify(e)})).join(", "):o.isObject(e)?o.isDefined(e.toString)?e.toString():JSON.stringify(e):(e=""+e).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,(function(e,t,n){return t+" "+n.toLowerCase()})).toLowerCase()},stringifyValue:function(e,t){return(t&&t.prettify||o.prettify)(e)},isString:function(e){return"string"==typeof e},isArray:function(e){return"[object Array]"==={}.toString.call(e)},isHash:function(e){return o.isObject(e)&&!o.isArray(e)&&!o.isFunction(e)},contains:function(e,t){return!!o.isDefined(e)&&(o.isArray(e)?-1!==e.indexOf(t):t in e)},unique:function(e){return o.isArray(e)?e.filter((function(e,t,n){return n.indexOf(e)==t})):e},forEachKeyInKeypath:function(e,t,n){if(o.isString(t)){var r,i="",s=!1;for(r=0;r<t.length;++r)switch(t[r]){case".":s?(s=!1,i+="."):(e=n(e,i,!1),i="");break;case"\\":s?(s=!1,i+="\\"):s=!0;break;default:s=!1,i+=t[r]}return n(e,i,!0)}},getDeepObjectValue:function(e,t){if(o.isObject(e))return o.forEachKeyInKeypath(e,t,(function(e,t){if(o.isObject(e))return e[t]}))},collectFormValues:function(e,t){var n,r,i,s,a,u,l={};if(o.isJqueryElement(e)&&(e=e[0]),!e)return l;for(t=t||{},s=e.querySelectorAll("input[name], textarea[name]"),n=0;n<s.length;++n)if(i=s.item(n),!o.isDefined(i.getAttribute("data-ignored"))){var c=i.name.replace(/\./g,"\\\\.");u=o.sanitizeFormValue(i.value,t),"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(s=e.querySelectorAll("select[name]"),n=0;n<s.length;++n)if(i=s.item(n),!o.isDefined(i.getAttribute("data-ignored"))){if(i.multiple)for(r in u=[],i.options)(a=i.options[r])&&a.selected&&u.push(o.sanitizeFormValue(a.value,t));else{var f=void 0!==i.options[i.selectedIndex]?i.options[i.selectedIndex].value:"";u=o.sanitizeFormValue(f,t)}l[i.name]=u}return l},sanitizeFormValue:function(e,t){return t.trim&&o.isString(e)&&(e=e.trim()),!1!==t.nullify&&""===e?null:e},capitalize:function(e){return o.isString(e)?e[0].toUpperCase()+e.slice(1):e},pruneEmptyErrors:function(e){return e.filter((function(e){return!o.isEmpty(e.error)}))},expandMultipleErrors:function(e){var t=[];return e.forEach((function(e){o.isArray(e.error)?e.error.forEach((function(n){t.push(o.extend({},e,{error:n}))})):t.push(e)})),t},convertErrorMessages:function(e,t){var n=[],r=(t=t||{}).prettify||o.prettify;return e.forEach((function(e){var i=o.result(e.error,e.value,e.attribute,e.options,e.attributes,e.globalOptions);o.isString(i)?("^"===i[0]?i=i.slice(1):!1!==t.fullMessages&&(i=o.capitalize(r(e.attribute))+" "+i),i=i.replace(/\\\^/g,"^"),i=o.format(i,{value:o.stringifyValue(e.value,t)}),n.push(o.extend({},e,{error:i}))):n.push(e)})),n},groupErrorsByAttribute:function(e){var t={};return e.forEach((function(e){var n=t[e.attribute];n?n.push(e):t[e.attribute]=[e]})),t},flattenErrorsToArray:function(e){return e.map((function(e){return e.error})).filter((function(e,t,n){return n.indexOf(e)===t}))},cleanAttributes:function(e,t){function n(e,t,n){return o.isObject(e[t])?e[t]:e[t]=!!n||{}}return o.isObject(t)&&o.isObject(e)?function e(t,n){if(!o.isObject(t))return t;var r,i,s=o.extend({},t);for(i in t)r=n[i],o.isObject(r)?s[i]=e(s[i],r):r||delete s[i];return s}(e,t=function(e){var t,r={};for(t in e)e[t]&&o.forEachKeyInKeypath(r,t,n);return r}(t)):{}},exposeModule:function(e,t,n,r,i){n?(r&&r.exports&&(n=r.exports=e),n.validate=e):(t.validate=e,e.isFunction(i)&&i.amd&&i([],(function(){return e})))},warn:function(e){"undefined"!=typeof console&&console.warn&&console.warn("[validate.js] "+e)},error:function(e){"undefined"!=typeof console&&console.error&&console.error("[validate.js] "+e)}}),i.validators={presence:function(e,t){if(!1!==(t=o.extend({},this.options,t)).allowEmpty?!o.isDefined(e):o.isEmpty(e))return t.message||this.message||"can't be blank"},length:function(e,t,n){if(o.isDefined(e)){var r,i=(t=o.extend({},this.options,t)).is,s=t.maximum,a=t.minimum,u=[],l=(e=(t.tokenizer||function(e){return e})(e)).length;return o.isNumber(l)?(o.isNumber(i)&&l!==i&&(r=t.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",u.push(o.format(r,{count:i}))),o.isNumber(a)&&l<a&&(r=t.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",u.push(o.format(r,{count:a}))),o.isNumber(s)&&l>s&&(r=t.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",u.push(o.format(r,{count:s}))),u.length>0?t.message||u:void 0):t.message||this.notValid||"has an incorrect length"}},numericality:function(e,t,n,r,i){if(o.isDefined(e)){var s,a,u=[],l={greaterThan:function(e,t){return e>t},greaterThanOrEqualTo:function(e,t){return e>=t},equalTo:function(e,t){return e===t},lessThan:function(e,t){return e<t},lessThanOrEqualTo:function(e,t){return e<=t},divisibleBy:function(e,t){return e%t==0}},c=(t=o.extend({},this.options,t)).prettify||i&&i.prettify||o.prettify;if(o.isString(e)&&t.strict){var f="^-?(0|[1-9]\\d*)";if(t.onlyInteger||(f+="(\\.\\d+)?"),f+="$",!new RegExp(f).test(e))return t.message||t.notValid||this.notValid||this.message||"must be a valid number"}if(!0!==t.noStrings&&o.isString(e)&&!o.isEmpty(e)&&(e=+e),!o.isNumber(e))return t.message||t.notValid||this.notValid||this.message||"is not a number";if(t.onlyInteger&&!o.isInteger(e))return t.message||t.notInteger||this.notInteger||this.message||"must be an integer";for(s in l)if(a=t[s],o.isNumber(a)&&!l[s](e,a)){var p="not"+o.capitalize(s),d=t[p]||this[p]||this.message||"must be %{type} %{count}";u.push(o.format(d,{count:a,type:c(s)}))}return t.odd&&e%2!=1&&u.push(t.notOdd||this.notOdd||this.message||"must be odd"),t.even&&e%2!=0&&u.push(t.notEven||this.notEven||this.message||"must be even"),u.length?t.message||u:void 0}},datetime:o.extend((function(e,t){if(!o.isFunction(this.parse)||!o.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(o.isDefined(e)){var n,r=[],i=(t=o.extend({},this.options,t)).earliest?this.parse(t.earliest,t):NaN,s=t.latest?this.parse(t.latest,t):NaN;return e=this.parse(e,t),isNaN(e)||t.dateOnly&&e%864e5!=0?(n=t.notValid||t.message||this.notValid||"must be a valid date",o.format(n,{value:arguments[0]})):(!isNaN(i)&&e<i&&(n=t.tooEarly||t.message||this.tooEarly||"must be no earlier than %{date}",n=o.format(n,{value:this.format(e,t),date:this.format(i,t)}),r.push(n)),!isNaN(s)&&e>s&&(n=t.tooLate||t.message||this.tooLate||"must be no later than %{date}",n=o.format(n,{date:this.format(s,t),value:this.format(e,t)}),r.push(n)),r.length?o.unique(r):void 0)}}),{parse:null,format:null}),date:function(e,t){return t=o.extend({},t,{dateOnly:!0}),o.validators.datetime.call(o.validators.datetime,e,t)},format:function(e,t){(o.isString(t)||t instanceof RegExp)&&(t={pattern:t});var n,r=(t=o.extend({},this.options,t)).message||this.message||"is invalid",i=t.pattern;if(o.isDefined(e))return o.isString(e)?(o.isString(i)&&(i=new RegExp(t.pattern,t.flags)),(n=i.exec(e))&&n[0].length==e.length?void 0:r):r},inclusion:function(e,t){if(o.isDefined(e)&&(o.isArray(t)&&(t={within:t}),t=o.extend({},this.options,t),!o.contains(t.within,e))){var n=t.message||this.message||"^%{value} is not included in the list";return o.format(n,{value:e})}},exclusion:function(e,t){if(o.isDefined(e)&&(o.isArray(t)&&(t={within:t}),t=o.extend({},this.options,t),o.contains(t.within,e))){var n=t.message||this.message||"^%{value} is restricted";return o.isString(t.within[e])&&(e=t.within[e]),o.format(n,{value:e})}},email:o.extend((function(e,t){var n=(t=o.extend({},this.options,t)).message||this.message||"is not a valid email";if(o.isDefined(e))return o.isString(e)&&this.PATTERN.exec(e)?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(e,t,n,r,i){if(o.isDefined(e)){o.isString(t)&&(t={attribute:t});var s=(t=o.extend({},this.options,t)).message||this.message||"is not equal to %{attribute}";if(o.isEmpty(t.attribute)||!o.isString(t.attribute))throw new Error("The attribute must be a non empty string");var a=o.getDeepObjectValue(r,t.attribute),u=t.comparator||function(e,t){return e===t},l=t.prettify||i&&i.prettify||o.prettify;return u(e,a,t,n,r)?void 0:o.format(s,{attribute:l(t.attribute)})}},url:function(e,t){if(o.isDefined(e)){var n=(t=o.extend({},this.options,t)).message||this.message||"is not a valid url",r=t.schemes||this.schemes||["http","https"],i=t.allowLocal||this.allowLocal||!1,s=t.allowDataUrl||this.allowDataUrl||!1;if(!o.isString(e))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*)?$",s){a="(?:"+a+")|(?:^data:(?:\\w+\\/[-+.\\w]+(?:;[\\w=]+)*)?(?:;base64)?,[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*$)"}return new RegExp(a,"i").exec(e)?void 0:n}},type:o.extend((function(e,t,n,r,i){if(o.isString(t)&&(t={type:t}),o.isDefined(e)){var s,a=o.extend({},this.options,t),u=a.type;if(!o.isDefined(u))throw new Error("No type was specified");if(s=o.isFunction(u)?u:this.types[u],!o.isFunction(s))throw new Error("validate.validators.type.types."+u+" must be a function.");if(!s(e,a,n,r,i)){var l=t.message||this.messages[u]||this.message||a.message||(o.isFunction(u)?"must be of the correct type":"must be of type %{type}");return o.isFunction(l)&&(l=l(e,t,n,r,i)),o.format(l,{attribute:o.prettify(n),type:u})}}}),{types:{object:function(e){return o.isObject(e)&&!o.isArray(e)},array:o.isArray,integer:o.isInteger,number:o.isNumber,string:o.isString,date:o.isDate,boolean:o.isBoolean},messages:{}})},i.formatters={detailed:function(e){return e},flat:o.flattenErrorsToArray,grouped:function(e){var t;for(t in e=o.groupErrorsByAttribute(e))e[t]=o.flattenErrorsToArray(e[t]);return e},constraint:function(e){var t;for(t in e=o.groupErrorsByAttribute(e))e[t]=e[t].map((function(e){return e.validator})).sort();return e}},i.exposeModule(i,this,e,t,n.amdD)}.call(this,t,e,n.amdD)}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=e,n.x=e=>{},n.amdD=function(){throw new Error("define cannot be used indirect")},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={669:0},t=[[619],[837]],r=e=>{},i=(i,o)=>{for(var s,a,[u,l,c,f]=o,p=0,d=[];p<u.length;p++)a=u[p],n.o(e,a)&&e[a]&&d.push(e[a][0]),e[a]=0;for(s in l)n.o(l,s)&&(n.m[s]=l[s]);for(c&&c(n),i&&i(o);d.length;)d.shift()();return f&&t.push.apply(t,f),r()},o=self.webpackChunktiny_validator=self.webpackChunktiny_validator||[];function s(){for(var r,i=0;i<t.length;i++){for(var o=t[i],s=!0,a=1;a<o.length;a++){var u=o[a];0!==e[u]&&(s=!1)}s&&(t.splice(i--,1),r=n(n.s=o[0]))}return 0===t.length&&(n.x(),n.x=e=>{}),r}o.forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var a=n.x;n.x=()=>(n.x=a||(e=>{}),(r=s)())})(),n.x()})();