origami-zen
Version:
Collection of reusable web components. Built for Origami CMS.
21 lines (20 loc) • 46.7 kB
JavaScript
function __decorate(e,t,n,a){var s,o=arguments.length,l=3>o?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,a);else for(var _=e.length-1;0<=_;_--)(s=e[_])&&(l=(3>o?s(l):3<o?s(t,n,l):s(t,n))||l);return 3<o&&l&&Object.defineProperty(t,n,l),l}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}window.JSCompiler_renameProperty=function(e){return e};let dedupeId=0;const dedupingMixin=function(e){function t(t){let r=t.__mixinSet;if(r&&r[a])return t;let i=n,s=i.get(t);s||(s=e(t),i.set(t,s));let d=Object.create(s.__mixinSet||r||null);return d[a]=!0,s.__mixinSet=d,s}let n=e.__mixinApplications;n||(n=new WeakMap,e.__mixinApplications=n);let a=dedupeId++;return t};let microtaskCurrHandle=0,microtaskLastHandle=0,microtaskCallbacks=[],microtaskNodeContent=0,microtaskNode=document.createTextNode("");new window.MutationObserver(microtaskFlush).observe(microtaskNode,{characterData:!0});function microtaskFlush(){const e=microtaskCallbacks.length;for(let t,n=0;n<e;n++)if(t=microtaskCallbacks[n],t)try{t()}catch(t){setTimeout(()=>{throw t})}microtaskCallbacks.splice(0,e),microtaskLastHandle+=e}const microTask={run(e){return microtaskNode.textContent=microtaskNodeContent++,microtaskCallbacks.push(e),microtaskCurrHandle++},cancel(e){const t=e-microtaskLastHandle;if(0<=t){if(!microtaskCallbacks[t])throw new Error("invalid async handle: "+e);microtaskCallbacks[t]=null}}},microtask=microTask,PropertiesChanged=dedupingMixin(e=>{return class extends e{static createProperties(e){const t=this.prototype;for(let n in e)n in t||t._createPropertyAccessor(n)}static attributeNameForProperty(e){return e.toLowerCase()}static typeForProperty(){}_createPropertyAccessor(e,t){this._addPropertyToAttributeMap(e),this.hasOwnProperty("__dataHasAccessor")||(this.__dataHasAccessor=Object.assign({},this.__dataHasAccessor)),this.__dataHasAccessor[e]||(this.__dataHasAccessor[e]=!0,this._definePropertyAccessor(e,t))}_addPropertyToAttributeMap(e){if(this.hasOwnProperty("__dataAttributes")||(this.__dataAttributes=Object.assign({},this.__dataAttributes)),!this.__dataAttributes[e]){const t=this.constructor.attributeNameForProperty(e);this.__dataAttributes[t]=e}}_definePropertyAccessor(e,t){Object.defineProperty(this,e,{get(){return this._getProperty(e)},set:t?function(){}:function(t){this._setProperty(e,t)}})}constructor(){super(),this.__dataEnabled=!1,this.__dataReady=!1,this.__dataInvalid=!1,this.__data={},this.__dataPending=null,this.__dataOld=null,this.__dataInstanceProps=null,this.__serializing=!1,this._initializeProperties()}ready(){this.__dataReady=!0,this._flushProperties()}_initializeProperties(){for(let e in this.__dataHasAccessor)this.hasOwnProperty(e)&&(this.__dataInstanceProps=this.__dataInstanceProps||{},this.__dataInstanceProps[e]=this[e],delete this[e])}_initializeInstanceProperties(e){Object.assign(this,e)}_setProperty(e,t){this._setPendingProperty(e,t)&&this._invalidateProperties()}_getProperty(e){return this.__data[e]}_setPendingProperty(e,t){let n=this.__data[e],a=this._shouldPropertyChange(e,t,n);return a&&(!this.__dataPending&&(this.__dataPending={},this.__dataOld={}),this.__dataOld&&!(e in this.__dataOld)&&(this.__dataOld[e]=n),this.__data[e]=t,this.__dataPending[e]=t),a}_invalidateProperties(){!this.__dataInvalid&&this.__dataReady&&(this.__dataInvalid=!0,microtask.run(()=>{this.__dataInvalid&&(this.__dataInvalid=!1,this._flushProperties())}))}_enableProperties(){this.__dataEnabled||(this.__dataEnabled=!0,this.__dataInstanceProps&&(this._initializeInstanceProperties(this.__dataInstanceProps),this.__dataInstanceProps=null),this.ready())}_flushProperties(){const e=this.__data,t=this.__dataPending,n=this.__dataOld;this._shouldPropertiesChange(e,t,n)&&(this.__dataPending=null,this.__dataOld=null,this._propertiesChanged(e,t,n))}_shouldPropertiesChange(e,t){return!!t}_propertiesChanged(){}_shouldPropertyChange(e,t,n){return n!==t&&(n===n||t===t)}attributeChangedCallback(e,t,n,a){t!==n&&this._attributeToProperty(e,n),super.attributeChangedCallback&&super.attributeChangedCallback(e,t,n,a)}_attributeToProperty(e,t,n){if(!this.__serializing){const a=this.__dataAttributes,r=a&&a[e]||e;this[r]=this._deserializeValue(t,n||this.constructor.typeForProperty(r))}}_propertyToAttribute(e,t,n){this.__serializing=!0,n=3>arguments.length?this[e]:n,this._valueToNodeAttribute(this,n,t||this.constructor.attributeNameForProperty(e)),this.__serializing=!1}_valueToNodeAttribute(e,t,n){const a=this._serializeValue(t);a===void 0?e.removeAttribute(n):e.setAttribute(n,a)}_serializeValue(e){switch(typeof e){case"boolean":return e?"":void 0;default:return null==e?void 0:e.toString();}}_deserializeValue(e,t){return t===Boolean?null!==e:t===Number?+e:e}}});function normalizeProperties(e){const t={};for(let n in e){const a=e[n];t[n]="function"==typeof a?{type:a}:a}return t}const PropertiesMixin=dedupingMixin(e=>{function t(e){const t=Object.getPrototypeOf(e);return t.prototype instanceof r?t:null}function n(e){if(!e.hasOwnProperty(JSCompiler_renameProperty("__ownProperties",e))){let t=null;e.hasOwnProperty(JSCompiler_renameProperty("properties",e))&&e.properties&&(t=normalizeProperties(e.properties)),e.__ownProperties=t}return e.__ownProperties}const a=PropertiesChanged(e);class r extends a{static get observedAttributes(){const e=this._properties;return e?Object.keys(e).map(e=>this.attributeNameForProperty(e)):[]}static finalize(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__finalized",this))){const e=t(this);e&&e.finalize(),this.__finalized=!0,this._finalizeClass()}}static _finalizeClass(){const e=n(this);e&&this.createProperties(e)}static get _properties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__properties",this))){const e=t(this);this.__properties=Object.assign({},e&&e._properties,n(this))}return this.__properties}static typeForProperty(e){const t=this._properties[e];return t&&t.type}_initializeProperties(){this.constructor.finalize(),super._initializeProperties()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._enableProperties()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback()}}return r}),templateCaches=new Map;class TemplateResult{constructor(e,t,n,a=defaultPartCallback){this.strings=e,this.values=t,this.type=n,this.partCallback=a}getHTML(){const e=this.strings.length-1;let t="",n=!0;for(let a=0;a<e;a++){const e=this.strings[a];t+=e;const r=findTagClose(e);n=-1<r?r<e.length:n,t+=n?nodeMarker:marker}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}function defaultTemplateFactory(e){let t=templateCaches.get(e.type);void 0===t&&(t=new Map,templateCaches.set(e.type,t));let n=t.get(e.strings);return void 0===n&&(n=new Template(e,e.getTemplateElement()),t.set(e.strings,n)),n}function render(e,t,n=defaultTemplateFactory){const a=n(e);let r=t.__templateInstance;if(void 0!==r&&r.template===a&&r._partCallback===e.partCallback)return void r.update(e.values);r=new TemplateInstance(a,e.partCallback,n),t.__templateInstance=r;const i=r._clone();r.update(e.values),removeNodes(t,t.firstChild),t.appendChild(i)}const marker=`{{lit-${(Math.random()+"").slice(2)}}}`,nodeMarker=`<!--${marker}-->`,markerRegex=new RegExp(`${marker}|${nodeMarker}`),lastAttributeNameRegex=/[ \x09\x0a\x0c\x0d]([^\0-\x1F\x7F-\x9F \x09\x0a\x0c\x0d"'>=/]+)[ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*)$/;function findTagClose(e){const t=e.lastIndexOf(">"),n=e.indexOf("<",t+1);return-1<n?e.length:t}class TemplatePart{constructor(e,t,n,a,r){this.type=e,this.index=t,this.name=n,this.rawName=a,this.strings=r}}class Template{constructor(e,t){this.parts=[],this.element=t;const n=this.element.content,a=document.createTreeWalker(n,133,null,!1);let r=-1,i=0;const s=[];for(let n,d;a.nextNode();){r++,n=d;const t=d=a.currentNode;if(1===t.nodeType){if(!t.hasAttributes())continue;const n=t.attributes;let a=0;for(let e=0;e<n.length;e++)0<=n[e].value.indexOf(marker)&&a++;for(;0<a--;){const a=e.strings[i],s=lastAttributeNameRegex.exec(a)[1],d=n.getNamedItem(s),o=d.value.split(markerRegex);this.parts.push(new TemplatePart("attribute",r,d.name,s,o)),t.removeAttribute(d.name),i+=o.length-1}}else if(3===t.nodeType){const e=t.nodeValue;if(0>e.indexOf(marker))continue;const n=t.parentNode,a=e.split(markerRegex),d=a.length-1;i+=d;for(let e=0;e<d;e++)n.insertBefore(""===a[e]?document.createComment(""):document.createTextNode(a[e]),t),this.parts.push(new TemplatePart("node",r++));n.insertBefore(""===a[d]?document.createComment(""):document.createTextNode(a[d]),t),s.push(t)}else if(8===t.nodeType&&t.nodeValue===marker){const e=t.parentNode,a=t.previousSibling;null===a||a!==n||a.nodeType!==Node.TEXT_NODE?e.insertBefore(document.createComment(""),t):r--,this.parts.push(new TemplatePart("node",r++)),s.push(t),null===t.nextSibling?e.insertBefore(document.createComment(""),t):r--,d=n,i++}}for(const a of s)a.parentNode.removeChild(a)}}const getValue=(e,t)=>isDirective(t)?(t=t(e),directiveValue):null===t?void 0:t,isDirective=e=>"function"==typeof e&&!0===e.__litDirective,directiveValue={},isPrimitiveValue=e=>null===e||"object"!=typeof e&&"function"!=typeof e;class AttributePart{constructor(e,t,n,a){this.instance=e,this.element=t,this.name=n,this.strings=a,this.size=a.length-1,this._previousValues=[]}_interpolate(e,t){const n=this.strings,a=n.length-1;let r="";for(let s=0;s<a;s++){r+=n[s];const a=getValue(this,e[t+s]);if(a&&a!==directiveValue&&(Array.isArray(a)||"string"!=typeof a&&a[Symbol.iterator]))for(const e of a)r+=e;else r+=a}return r+n[a]}_equalToPreviousValues(e,t){for(let n=t;n<t+this.size;n++)if(this._previousValues[n]!==e[n]||!isPrimitiveValue(e[n]))return!1;return!0}setValue(e,t){if(this._equalToPreviousValues(e,t))return;const n=this.strings;let a;2===n.length&&""===n[0]&&""===n[1]?(a=getValue(this,e[t]),Array.isArray(a)&&(a=a.join(""))):a=this._interpolate(e,t),a!==directiveValue&&this.element.setAttribute(this.name,a),this._previousValues=e}}class NodePart{constructor(e,t,n){this.instance=e,this.startNode=t,this.endNode=n,this._previousValue=void 0}setValue(e){if(e=getValue(this,e),e!==directiveValue)if(isPrimitiveValue(e)){if(e===this._previousValue)return;this._setText(e)}else e instanceof TemplateResult?this._setTemplateResult(e):Array.isArray(e)||e[Symbol.iterator]?this._setIterable(e):e instanceof Node?this._setNode(e):void 0===e.then?this._setText(e):this._setPromise(e)}_insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}_setNode(e){this._previousValue===e||(this.clear(),this._insert(e),this._previousValue=e)}_setText(e){const t=this.startNode.nextSibling;e=e===void 0?"":e,t===this.endNode.previousSibling&&t.nodeType===Node.TEXT_NODE?t.textContent=e:this._setNode(document.createTextNode(e)),this._previousValue=e}_setTemplateResult(e){const t=this.instance._getTemplate(e);let n;this._previousValue&&this._previousValue.template===t?n=this._previousValue:(n=new TemplateInstance(t,this.instance._partCallback,this.instance._getTemplate),this._setNode(n._clone()),this._previousValue=n),n.update(e.values)}_setIterable(e){Array.isArray(this._previousValue)||(this.clear(),this._previousValue=[]);const t=this._previousValue;let n=0;for(const a of e){let e=t[n];if(e===void 0){let a=this.startNode;if(0<n){const e=t[n-1];a=e.endNode=document.createTextNode(""),this._insert(a)}e=new NodePart(this.instance,a,this.endNode),t.push(e)}e.setValue(a),n++}if(0==n)this.clear(),this._previousValue=void 0;else if(n<t.length){const e=t[n-1];t.length=n,this.clear(e.endNode.previousSibling),e.endNode=this.endNode}}_setPromise(e){this._previousValue=e,e.then(t=>{this._previousValue===e&&this.setValue(t)})}clear(e=this.startNode){removeNodes(this.startNode.parentNode,e.nextSibling,this.endNode)}}const defaultPartCallback=(e,t,n)=>{if("attribute"===t.type)return new AttributePart(e,n,t.name,t.strings);if("node"===t.type)return new NodePart(e,n,n.nextSibling);throw new Error(`Unknown part type ${t.type}`)};class TemplateInstance{constructor(e,t,n){this._parts=[],this.template=e,this._partCallback=t,this._getTemplate=n}update(e){let t=0;for(const n of this._parts)void 0===n.size?(n.setValue(e[t]),t++):(n.setValue(e,t),t+=n.size)}_clone(){const e=document.importNode(this.template.element.content,!0),t=this.template.parts;if(0<t.length){const n=document.createTreeWalker(e,133,null,!1);let a=-1;for(let e=0;e<t.length;e++){const r=t[e];for(;a<r.index;)a++,n.nextNode();this._parts.push(this._partCallback(this,r,n.currentNode))}}return e}}const removeNodes=(e,t,n=null)=>{for(let a=t;a!==n;){const t=a.nextSibling;e.removeChild(a),a=t}},shadyTemplateFactory=e=>t=>{const n=`${t.type}--${e}`;let a=templateCaches.get(n);a===void 0&&(a=new Map,templateCaches.set(n,a));let r=a.get(t.strings);if(r===void 0){const n=t.getTemplateElement();"object"==typeof window.ShadyCSS&&window.ShadyCSS.prepareTemplate(n,e),r=new Template(t,n),a.set(t.strings,r)}return r};function render$1(e,t,n){return render(e,t,shadyTemplateFactory(n))}const html$1=(e,...t)=>new TemplateResult(e,t,"html",extendedPartCallback),extendedPartCallback=(e,t,n)=>{if("attribute"===t.type){if("on-"===t.rawName.substr(0,3)){const a=t.rawName.slice(3);return new EventPart(e,n,a)}const a=t.name.substr(t.name.length-1);if("$"===a){const a=t.name.slice(0,-1);return new AttributePart(e,n,a,t.strings)}if("?"===a){const a=t.name.slice(0,-1);return new BooleanAttributePart(e,n,a,t.strings)}return new PropertyPart(e,n,t.rawName,t.strings)}return defaultPartCallback(e,t,n)};class BooleanAttributePart extends AttributePart{setValue(e,t){const n=this.strings;if(2===n.length&&""===n[0]&&""===n[1]){const n=getValue(this,e[t]);if(n===directiveValue)return;n?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}else throw new Error("boolean attributes can only contain a single expression")}}class PropertyPart extends AttributePart{setValue(e,t){const n=this.strings;let a;this._equalToPreviousValues(e,t)||(a=2===n.length&&""===n[0]&&""===n[1]?getValue(this,e[t]):this._interpolate(e,t),a!==directiveValue&&(this.element[this.name]=a),this._previousValues=e)}}class EventPart{constructor(e,t,n){this.instance=e,this.element=t,this.eventName=n}setValue(e){const t=getValue(this,e);t===this._listener||(null==t?this.element.removeEventListener(this.eventName,this):null==this._listener&&this.element.addEventListener(this.eventName,this),this._listener=t)}handleEvent(e){"function"==typeof this._listener?this._listener.call(this.element,e):"function"==typeof this._listener.handleEvent&&this._listener.handleEvent(e)}}class LitElement extends PropertiesMixin(HTMLElement){constructor(){super(...arguments),this.__renderComplete=null,this.__resolveRenderComplete=null,this.__isInvalid=!1,this.__isChanging=!1}ready(){this._root=this._createRoot(),super.ready(),this._firstRendered()}_firstRendered(){}_createRoot(){return this.attachShadow({mode:"open"})}_shouldPropertiesChange(e,t,n){const a=this._shouldRender(e,t,n);return!a&&this.__resolveRenderComplete&&this.__resolveRenderComplete(!1),a}_shouldRender(){return!0}_propertiesChanged(e,t,n){super._propertiesChanged(e,t,n);const a=this._render(e);a&&this._root!==void 0&&this._applyRender(a,this._root),this._didRender(e,t,n),this.__resolveRenderComplete&&this.__resolveRenderComplete(!0)}_flushProperties(){this.__isChanging=!0,this.__isInvalid=!1,super._flushProperties(),this.__isChanging=!1}_shouldPropertyChange(e,t,n){const a=super._shouldPropertyChange(e,t,n);return a&&this.__isChanging&&console.trace(`Setting properties in response to other properties changing `+`considered harmful. Setting '${e}' from `+`'${this._getProperty(e)}' to '${t}'.`),a}_render(){throw new Error("_render() not implemented")}_applyRender(e,t){render$1(e,t,this.localName)}_didRender(){}_requestRender(){this._invalidateProperties()}_invalidateProperties(){this.__isInvalid=!0,super._invalidateProperties()}get renderComplete(){return this.__renderComplete||(this.__renderComplete=new Promise(e=>{this.__resolveRenderComplete=t=>{this.__resolveRenderComplete=this.__renderComplete=null,e(t)}}),!this.__isInvalid&&this.__resolveRenderComplete&&Promise.resolve().then(()=>this.__resolveRenderComplete(!1))),this.__renderComplete}}var tester=/^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/,validate=function(e){if(!e)return!1;if(254<e.length)return!1;var t=tester.test(e);if(!t)return!1;var n=e.split("@");if(64<n[0].length)return!1;var a=n[1].split(".");return!a.some(function(e){return 63<e.length})};const rules={required(e,t){if(!!!e&&t)return"This field is required"},maxlen(e,t){if(e.length>t)return`This field has a maximum size of ${t}`},minlen(e,t){if(e.length<t)return`This field has a minimum size of ${t}`},number(e,t){if(!/^[0-9]+$/.test(e)&&t)return"This field should be a number"},alpha(e){if(!/^[A-z\s]+$/.test(e))return"This field should only contain letters and spaces"},min(e,t){if(+e<t)return`This field should be above ${t}`},max(e,t){if(+e>t)return`This field should be below ${t}`},tel(e,t){if(t)return"NO"},email(e){if(!validate(e))return"Invalid email"}};class Validator{constructor({fields:e,fieldsets:t}){this._defaultRules={required:!0},this._fields=e||[],this._fieldsets=t||{}}validate(e){let t,n="fields";this._fields?t=this._validateFields(e):(t=this._validateFieldsets(e),n="fieldsets");const a={valid:!0===t};return!0!==t&&(a[n]=t),a}_validateFieldsets(e){const t={};for(const[n,a]of Object.entries(this._fieldsets)){const r=this._validateFields(e,a);!0!==r&&(t[n]=r)}return!Object.entries(t).length||t}_validateFields(e,t=this._fields){const n=t.map(t=>this._validateField(e[t.name],t)),a=n.filter(e=>!0!==e);if(!a.length)return!0;const r={};return a.forEach(e=>r[e.field]=e.errors),r}_validateField(t,n){if(n.disabled||"submit"===n.type)return!0;if(n.validate&&!n.validate.required&&!t)return!0;const e=Object.assign({},this._defaultRules,n.validate),a={},r=rules;for(const[i,s]of Object.entries(e))if(!1!==s&&"require"!==i){const e=r[i];if(!e)throw new Error(`Zen.UI.Validator: Invalid rule ${i}`);const n=e(t,s);n&&(a[i]=n)}switch(n.type){case"email":const i=r.email(t,!0);i&&(a.email=i);break;default:}return!Object.entries(a).length||{field:n.name,errors:a}}}var Reflect$1,CSS=html$1`<style>:host input[type="submit"],:host zen-ui-button{display:inline-block;width:auto;text-transform:uppercase;font-weight:600;letter-spacing:2px;border:none;height:var(--btn-height, var(--size-main, 4rem));line-height:var(--btn-height, var(--size-main, 4rem));padding:0 var(--btn-padding, var(--size-small, 2rem));border-radius:var(--btn-border-radius, var(--border-radius, .4rem));color:var(--color-white, #fff);transition:color var(--transition-time, .35s),background var(--transition-time, .35s);user-select:none;font-family:var(--btn-font-family, var(--font-family, "Work Sans",sans-serif));cursor:pointer;font-size:var(--btn-font-size, var(--font-size-main, 1.6rem));text-align:center;white-space:nowrap}:host input:not([color])[type="submit"],:host zen-ui-button:not([color]){background-color:var(--btn-bg, linear-gradient(to bottom right, var(--color-main-alt, #b155ba), var(--color-main, var(--color-purple, #693a91))));background:var(--btn-bg, linear-gradient(to bottom right, var(--color-main-alt, #b155ba), var(--color-main, var(--color-purple, #693a91))))}:host input[type="submit"] *,:host zen-ui-button *{vertical-align:middle}:host input[type="submit"]+input[type="submit"],:host zen-ui-button+input[type="submit"],:host input[type="submit"]+zen-ui-button,:host zen-ui-button+zen-ui-button{margin-left:var(--size-small)}:host input:hover[type="submit"],:host zen-ui-button:hover{filter:brightness(1.1)}:host input:focus[type="submit"],:host zen-ui-button:focus{border:none;filter:brightness(0.9)}:host input.round[type="submit"],:host zen-ui-button.round{padding:0;border-radius:50%}:host input.has-icon[type="submit"],:host zen-ui-button.has-icon{padding-left:var(--size-small, 2rem)}:host input.has-icon[type="submit"] .i,:host zen-ui-button.has-icon .i{vertical-align:top;margin-right:var(--size-small, 2rem)}:host input.has-icon[type="submit"] .loader,:host zen-ui-button.has-icon .loader{margin-top:calc(default('size-small') / 2)}:host input.no-text[type="submit"],:host zen-ui-button.no-text{padding:0}:host input.no-text[type="submit"] .i,:host zen-ui-button.no-text .i{margin:0}:host input:disabled[type="submit"],:host zen-ui-button:disabled{opacity:0.5;pointer-events:none}:host input[type="submit"]>span,:host zen-ui-button>span{display:inline-block;vertical-align:middle}:host input.size-tiny[type="submit"],:host zen-ui-button.size-tiny,:host input[size=tiny][type="submit"],:host zen-ui-button[size=tiny]{width:auto;height:var(--size-tiny, 1rem);line-height:var(--size-tiny, 1rem);padding:0 calc(var(--size-tiny, 1rem) / 2)}:host input.size-tiny.icon-right[type="submit"],:host zen-ui-button.size-tiny.icon-right,:host input[size=tiny].icon-right[type="submit"],:host zen-ui-button[size=tiny].icon-right{padding-right:var(--size-tiny, 1rem)}:host input.size-small[type="submit"],:host zen-ui-button.size-small,:host input[size=small][type="submit"],:host zen-ui-button[size=small]{width:auto;height:var(--size-small, 2rem);line-height:var(--size-small, 2rem);padding:0 calc(var(--size-small, 2rem) / 2)}:host input.size-small.icon-right[type="submit"],:host zen-ui-button.size-small.icon-right,:host input[size=small].icon-right[type="submit"],:host zen-ui-button[size=small].icon-right{padding-right:var(--size-small, 2rem)}:host input.size-medium[type="submit"],:host zen-ui-button.size-medium,:host input[size=medium][type="submit"],:host zen-ui-button[size=medium]{width:auto;height:var(--size-medium, 3rem);line-height:var(--size-medium, 3rem);padding:0 calc(var(--size-medium, 3rem) / 2)}:host input.size-medium.icon-right[type="submit"],:host zen-ui-button.size-medium.icon-right,:host input[size=medium].icon-right[type="submit"],:host zen-ui-button[size=medium].icon-right{padding-right:var(--size-medium, 3rem)}:host input.size-main[type="submit"],:host zen-ui-button.size-main,:host input[size=main][type="submit"],:host zen-ui-button[size=main]{width:auto;height:var(--size-main, 4rem);line-height:var(--size-main, 4rem);padding:0 calc(var(--size-main, 4rem) / 2)}:host input.size-main.icon-right[type="submit"],:host zen-ui-button.size-main.icon-right,:host input[size=main].icon-right[type="submit"],:host zen-ui-button[size=main].icon-right{padding-right:var(--size-main, 4rem)}:host input.size-large[type="submit"],:host zen-ui-button.size-large,:host input[size=large][type="submit"],:host zen-ui-button[size=large]{width:auto;height:var(--size-large, 6rem);line-height:var(--size-large, 6rem);padding:0 calc(var(--size-large, 6rem) / 2)}:host input.size-large.icon-right[type="submit"],:host zen-ui-button.size-large.icon-right,:host input[size=large].icon-right[type="submit"],:host zen-ui-button[size=large].icon-right{padding-right:var(--size-large, 6rem)}:host input.size-huge[type="submit"],:host zen-ui-button.size-huge,:host input[size=huge][type="submit"],:host zen-ui-button[size=huge]{width:auto;height:var(--size-huge, 8rem);line-height:var(--size-huge, 8rem);padding:0 calc(var(--size-huge, 8rem) / 2)}:host input.size-huge.icon-right[type="submit"],:host zen-ui-button.size-huge.icon-right,:host input[size=huge].icon-right[type="submit"],:host zen-ui-button[size=huge].icon-right{padding-right:var(--size-huge, 8rem)}:host input.size-super[type="submit"],:host zen-ui-button.size-super,:host input[size=super][type="submit"],:host zen-ui-button[size=super]{width:auto;height:var(--size-super, 12rem);line-height:var(--size-super, 12rem);padding:0 calc(var(--size-super, 12rem) / 2)}:host input.size-super.icon-right[type="submit"],:host zen-ui-button.size-super.icon-right,:host input[size=super].icon-right[type="submit"],:host zen-ui-button[size=super].icon-right{padding-right:var(--size-super, 12rem)}:host input.size-hero[type="submit"],:host zen-ui-button.size-hero,:host input[size=hero][type="submit"],:host zen-ui-button[size=hero]{width:auto;height:var(--size-hero, 24rem);line-height:var(--size-hero, 24rem);padding:0 calc(var(--size-hero, 24rem) / 2)}:host input.size-hero.icon-right[type="submit"],:host zen-ui-button.size-hero.icon-right,:host input[size=hero].icon-right[type="submit"],:host zen-ui-button[size=hero].icon-right{padding-right:var(--size-hero, 24rem)}:host input.hollow[type="submit"],:host zen-ui-button.hollow,:host input[hollow][type="submit"],:host zen-ui-button[hollow]{background:transparent ;color:var(--color-main, var(--color-purple, #693a91));padding-left:0;padding-right:0}:host input.hollow[color=main][type="submit"],:host zen-ui-button.hollow[color=main],:host input[color=main][hollow][type="submit"],:host zen-ui-button[color=main][hollow]{color:var(--color-main)}:host input.hollow[color=alt][type="submit"],:host zen-ui-button.hollow[color=alt],:host input[color=alt][hollow][type="submit"],:host zen-ui-button[color=alt][hollow]{color:var(--color-alt)}:host input.hollow[color=text][type="submit"],:host zen-ui-button.hollow[color=text],:host input[color=text][hollow][type="submit"],:host zen-ui-button[color=text][hollow]{color:var(--color-text)}:host input.hollow[color=white][type="submit"],:host zen-ui-button.hollow[color=white],:host input[color=white][hollow][type="submit"],:host zen-ui-button[color=white][hollow]{color:var(--color-white)}:host input.hollow[color=grey-50][type="submit"],:host zen-ui-button.hollow[color=grey-50],:host input[color=grey-50][hollow][type="submit"],:host zen-ui-button[color=grey-50][hollow]{color:var(--color-grey-50)}:host input.hollow[color=grey-100][type="submit"],:host zen-ui-button.hollow[color=grey-100],:host input[color=grey-100][hollow][type="submit"],:host zen-ui-button[color=grey-100][hollow]{color:var(--color-grey-100)}:host input.hollow[color=grey-200][type="submit"],:host zen-ui-button.hollow[color=grey-200],:host input[color=grey-200][hollow][type="submit"],:host zen-ui-button[color=grey-200][hollow]{color:var(--color-grey-200)}:host input.hollow[color=grey-300][type="submit"],:host zen-ui-button.hollow[color=grey-300],:host input[color=grey-300][hollow][type="submit"],:host zen-ui-button[color=grey-300][hollow]{color:var(--color-grey-300)}:host input.hollow[color=grey-400][type="submit"],:host zen-ui-button.hollow[color=grey-400],:host input[color=grey-400][hollow][type="submit"],:host zen-ui-button[color=grey-400][hollow]{color:var(--color-grey-400)}:host input.hollow[color=grey-500][type="submit"],:host zen-ui-button.hollow[color=grey-500],:host input[color=grey-500][hollow][type="submit"],:host zen-ui-button[color=grey-500][hollow]{color:var(--color-grey-500)}:host input.hollow[color=grey-600][type="submit"],:host zen-ui-button.hollow[color=grey-600],:host input[color=grey-600][hollow][type="submit"],:host zen-ui-button[color=grey-600][hollow]{color:var(--color-grey-600)}:host input.hollow[color=grey-700][type="submit"],:host zen-ui-button.hollow[color=grey-700],:host input[color=grey-700][hollow][type="submit"],:host zen-ui-button[color=grey-700][hollow]{color:var(--color-grey-700)}:host input.hollow[color=grey-800][type="submit"],:host zen-ui-button.hollow[color=grey-800],:host input[color=grey-800][hollow][type="submit"],:host zen-ui-button[color=grey-800][hollow]{color:var(--color-grey-800)}:host input.hollow[color=grey-900][type="submit"],:host zen-ui-button.hollow[color=grey-900],:host input[color=grey-900][hollow][type="submit"],:host zen-ui-button[color=grey-900][hollow]{color:var(--color-grey-900)}:host input.hollow[color=black][type="submit"],:host zen-ui-button.hollow[color=black],:host input[color=black][hollow][type="submit"],:host zen-ui-button[color=black][hollow]{color:var(--color-black)}:host input.hollow[color=error][type="submit"],:host zen-ui-button.hollow[color=error],:host input[color=error][hollow][type="submit"],:host zen-ui-button[color=error][hollow]{color:var(--color-error)}:host input,:host select,:host textarea,:host input[type="file"]+span.input{display:inline-block;color:var(--color-text, var(--color-grey-900, #443750));background-color:var(--input-bg, rgba(0,0,0,0));height:var(--input-height, var(--size-large, 6rem));line-height:var(--input-height, var(--size-large, 6rem));padding:0 var(--input-padding, var(--size-small, 2rem));border-radius:var(--input-border-radius, var(--border-radius, .4rem));border:none;width:100%;border:var(--input-border, var(--border-200, 2px solid var(--color-grey-200, #eae3f0)));transition:border var(--transition-time, .35s);font-size:var(--input-font-size, var(--font-size-main, 1.6rem));box-shadow:var(--input-shadow, );font-family:var(--font-family, "Work Sans",sans-serif)}:host input:focus,:host select:focus,:host textarea:focus,:host input[type="file"]+span.input:focus{border:var(--input-border-focus, var(--border-main, 2px solid var(--color-main, var(--color-purple, #693a91))))}:host input::placeholder,:host select::placeholder,:host textarea::placeholder,:host input[type="file"]+span.input::placeholder{color:var(--color-grey-300, #bda9cf)}:host input:disabled,:host select:disabled,:host textarea:disabled,:host input[type="file"]+span.input:disabled{opacity:0.5;user-select:none}:host input:read-only,:host select:read-only,:host textarea:read-only,:host input[type="file"]+span.input:read-only{user-select:none}:host input.error,:host select.error,:host textarea.error,:host input[type="file"]+span.error.input{border-color:var(--color-error, var(--color-red, #ff5554))}:host .form-row>.i textarea,:host zen-ui-form-row>.i textarea,:host .form-row>zen-icon textarea,:host zen-ui-form-row>zen-icon textarea{resize:none;min-height:calc(var(--input-height, var(--size-large, 6rem)) * 2);max-width:100%;outline:none}:host select{padding-right:4rem;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0idmFyKC0tY29sb3ItZ3JleS0zMDAsICNlZGVkZWQpIiBkPSJNMjkuNyAxNC44Yy0uNC0uNC0xLS40LTEuNCAwTDIwIDIzLjFsLTguMy04LjNjLS40LS40LTEtLjQtMS40IDBzLS40IDEgMCAxLjRsOSA5Yy4yLjIuNS4zLjcuM3MuNS0uMS43LS4zbDktOWMuNC0uNC40LTEgMC0xLjR6Ii8+PC9zdmc+);background-repeat:no-repeat;background-position:right center}:host .form-row,:host zen-ui-form-row{display:flex;flex-wrap:wrap;margin-bottom:var(--size-small, 2rem);position:relative;flex-basis:100%}:host .form-row>*,:host zen-ui-form-row>*{align-self:flex-end;width:100%}:host .form-row>.i,:host zen-ui-form-row>.i,:host .form-row>zen-icon,:host zen-ui-form-row>zen-icon{position:absolute;left:0;bottom:0;margin:1rem;z-index:1}:host .form-row>.i:not(.hide)+input,:host zen-ui-form-row>.i:not(.hide)+input,:host .form-row>.i:not(.hide)+select,:host zen-ui-form-row>.i:not(.hide)+select,:host .form-row>.i:not(.hide)+*+input,:host zen-ui-form-row>.i:not(.hide)+*+input,:host .form-row>.i:not(.hide)+*+select,:host zen-ui-form-row>.i:not(.hide)+*+select,:host .form-row>zen-icon:not(.hide)+input,:host zen-ui-form-row>zen-icon:not(.hide)+input,:host .form-row>zen-icon:not(.hide)+select,:host zen-ui-form-row>zen-icon:not(.hide)+select,:host .form-row>zen-icon:not(.hide)+*+input,:host zen-ui-form-row>zen-icon:not(.hide)+*+input,:host .form-row>zen-icon:not(.hide)+*+select,:host zen-ui-form-row>zen-icon:not(.hide)+*+select{padding-left:var(--input-height, var(--size-large, 6rem))}:host .form-row>.i+zen-autocomplete,:host zen-ui-form-row>.i+zen-autocomplete,:host .form-row>zen-icon+zen-autocomplete,:host zen-ui-form-row>zen-icon+zen-autocomplete{--autocomplete-padding-left: default('input-height')}:host .form-row span.error,:host zen-ui-form-row span.error{display:block;flex-basis:100%;color:var(--color-error, var(--color-red, #ff5554))}:host .form-row span.error *,:host zen-ui-form-row span.error *{vertical-align:middle}:host .width-50.form-row,:host zen-ui-form-row.width-50,:host .form-row[rowwidth=half],:host zen-ui-form-row[rowwidth=half]{flex:1;margin-right:var(--size-small, 2rem)}:host .width-50.form-row:nth-of-type(2n),:host zen-ui-form-row.width-50:nth-of-type(2n),:host .form-row[rowwidth=half]:nth-of-type(2n),:host zen-ui-form-row[rowwidth=half]:nth-of-type(2n){margin-right:0}:host .form-row button,:host zen-ui-form-row button{flex-basis:var(--btn-height, var(--size-main, 4rem));padding:0;margin-left:var(--size-small, 2rem)}:host .disabled.form-row .i,:host zen-ui-form-row.disabled .i{opacity:0.5}:host .form-row zen-checkbox+span,:host zen-ui-form-row zen-checkbox+span{margin-left:var(--size-small, 2rem)}:host{user-select:none;display:flex;flex-wrap:wrap}.full-field-width:host{width:100%}.full-field-width:host .form-group,.full-field-width:host input,.full-field-width:host button,.full-field-width:host select,.full-field-width:host textarea{width:100%}:host input[type="submit"],:host zen-ui-button{width:100%}:host fieldset legend{font-size:var(--fs-large);color:var(--color-alt);padding-top:var(--size-small);width:100%}:host fieldset+fieldset{margin-top:var(--size-hero)}:host fieldset+fieldset legend{padding-top:var(--size-hero);border-top:var(--border-100)}.input-small:host input,.input-small:host select,.input-small:host textarea{height:var(--input-height-small)}:host{display:block}:host form{display:flex;flex-wrap:wrap}:host>.error{margin-bottom:var(--size-small, 2rem)}.error{color:var(--color-error, var(--color-red, #ff5554))}span.error{display:block;margin-bottom:var(--size-small, 2rem)}span.error zen-ui-icon,span.error zen-ui-icon+span{vertical-align:middle}span.error:empty{display:none}zen-form-row[rowwidth=half]+zen-form-row[rowwidth=half]{margin-right:0}
</style>`,commonjsGlobal="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window;(function(e){(function(t){function n(e,t){return function(n,a){"function"!=typeof e[n]&&Object.defineProperty(e,n,{configurable:!0,writable:!0,value:a}),t&&t(n,a)}}var a="object"==typeof commonjsGlobal?commonjsGlobal:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),r=n(e);"undefined"==typeof a.Reflect?a.Reflect=e:r=n(a.Reflect,r),t(r)})(function(e){function t(e,t){for(var n=e.length-1;0<=n;--n){var a=e[n],r=a(t);if(!u(r)&&!c(r)){if(!C(r))throw new TypeError;t=r}}return t}function n(e,t,n,a){for(var r=e.length-1;0<=r;--r){var s=e[r],d=s(t,n,a);if(!u(d)&&!c(d)){if(!f(d))throw new TypeError;a=d}}return a}function a(e,t,n){var a=W.get(e);if(u(a)){if(!n)return;a=new q,W.set(e,a)}var r=a.get(t);if(u(r)){if(!n)return;r=new q,a.set(t,r)}return r}function r(e,t,n){var a=i(e,t,n);if(a)return!0;var s=E(t);return!c(s)&&r(e,s,n)}function i(e,t,n){var r=a(t,n,!1);return!u(r)&&h(r.has(e))}function s(e,t,n){var a=i(e,t,n);if(a)return d(e,t,n);var r=E(t);return c(r)?void 0:s(e,r,n)}function d(e,t,n){var r=a(t,n,!1);return u(r)?void 0:r.get(e)}function o(e,t,n,r){var i=a(n,r,!0);i.set(e,t)}function l(e,t){var n=_(e,t),a=E(e);if(null===a)return n;var r=l(a,t);if(0>=r.length)return n;if(0>=n.length)return r;for(var i=new H,s=[],d=0,o=n;d<o.length;d++){var p=o[d],u=i.has(p);u||(i.add(p),s.push(p))}for(var c=0,y=r;c<y.length;c++){var p=y[c],u=i.has(p);u||(i.add(p),s.push(p))}return s}function _(e,t){var n=[],r=a(e,t,!1);if(u(r))return n;for(var i=r.keys(),s=I(i),d=0;;){var o=A(s);if(!o)return n.length=d,n;var l=T(o);try{n[d]=l}catch(t){try{O(s)}finally{throw t}}d++}}function p(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6;}}function u(e){return e===void 0}function c(e){return null===e}function y(e){return"symbol"==typeof e}function f(e){return"object"==typeof e?null!==e:"function"==typeof e}function g(e,t){switch(p(e)){case 0:return e;case 1:return e;case 2:return e;case 3:return e;case 4:return e;case 5:return e;}var n=3===t?"string":5===t?"number":"default",a=N(e,R);if(a!==void 0){var r=a.call(e,n);if(f(r))throw new TypeError;return r}return m(e,"default"==n?"number":n)}function m(e,t){if("string"===t){var n=e.toString;if(x(n)){var a=n.call(e);if(!f(a))return a}var r=e.valueOf;if(x(r)){var a=r.call(e);if(!f(a))return a}}else{var r=e.valueOf;if(x(r)){var a=r.call(e);if(!f(a))return a}var i=e.toString;if(x(i)){var a=i.call(e);if(!f(a))return a}}throw new TypeError}function h(e){return!!e}function v(e){return""+e}function b(e){var t=g(e,3);return y(t)?t:v(t)}function P(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function x(e){return"function"==typeof e}function C(e){return"function"==typeof e}function k(e){switch(p(e)){case 3:return!0;case 4:return!0;default:return!1;}}function N(e,t){var n=e[t];if(void 0!==n&&null!==n){if(!x(n))throw new TypeError;return n}}function I(e){var t=N(e,z);if(!x(t))throw new TypeError;var n=t.call(e);if(!f(n))throw new TypeError;return n}function T(e){return e.value}function A(e){var t=e.next();return!t.done&&t}function O(e){var t=e["return"];t&&t.call(e)}function E(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===D)return t;if(t!==D)return t;var n=e.prototype,a=n&&Object.getPrototypeOf(n);if(null==a||a===Object.prototype)return t;var r=a.constructor;return"function"==typeof r?r===e?t:r:t}function w(e){return e.__=void 0,delete e.__,e}var V=Object.prototype.hasOwnProperty,S="function"==typeof Symbol,R=S&&"undefined"!=typeof Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",z=S&&"undefined"!=typeof Symbol.iterator?Symbol.iterator:"@@iterator",M="function"==typeof Object.create,j={__proto__:[]}instanceof Array,L=!M&&!j,F={create:M?function(){return w(Object.create(null))}:j?function(){return w({__proto__:null})}:function(){return w({})},has:L?function(e,t){return V.call(e,t)}:function(e,t){return t in e},get:L?function(e,t){return V.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},D=Object.getPrototypeOf(Function),K="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,q=K||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){function e(e){return e}function t(e,t){return t}function n(e,t){return[e,t]}var a={},r=[],i=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype["@@iterator"]=function(){return this},e.prototype[z]=function(){return this},e.prototype.next=function(){var e=this._index;if(0<=e&&e<this._keys.length){var t=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=r,this._values=r):this._index++,{value:t,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw 0<=this._index&&(this._index=-1,this._keys=r,this._values=r),e},e.prototype.return=function(e){return 0<=this._index&&(this._index=-1,this._keys=r,this._values=r),{value:e,done:!0}},e}();return function(){function r(){this._keys=[],this._values=[],this._cacheKey=a,this._cacheIndex=-2}return Object.defineProperty(r.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),r.prototype.has=function(e){return 0<=this._find(e,!1)},r.prototype.get=function(e){var t=this._find(e,!1);return 0<=t?this._values[t]:void 0},r.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},r.prototype.delete=function(e){var t=this._find(e,!1);if(0<=t){for(var n=this._keys.length,r=t+1;r<n;r++)this._keys[r-1]=this._keys[r],this._values[r-1]=this._values[r];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=a,this._cacheIndex=-2),!0}return!1},r.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=a,this._cacheIndex=-2},r.prototype.keys=function(){return new i(this._keys,this._values,e)},r.prototype.values=function(){return new i(this._keys,this._values,t)},r.prototype.entries=function(){return new i(this._keys,this._values,n)},r.prototype["@@iterator"]=function(){return this.entries()},r.prototype[z]=function(){return this.entries()},r.prototype._find=function(e,t){return this._cacheKey!==e&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=e)),0>this._cacheIndex&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},r}()}():Map,H=K||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){return function(){function e(){this._map=new q}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.values()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[z]=function(){return this.keys()},e}()}():Set,B=K||"function"!=typeof WeakMap?function(){function e(){var e;do e="@@WeakMap@@"+r();while(F.has(i,e));return i[e]=!0,e}function t(e,t){if(!V.call(e,s)){if(!t)return;Object.defineProperty(e,s,{value:F.create()})}return e[s]}function n(e,t){for(var n=0;n<t;++n)e[n]=0|255*Math.random();return e}function a(e){return"function"==typeof Uint8Array?"undefined"==typeof crypto?"undefined"==typeof msCrypto?n(new Uint8Array(e),e):msCrypto.getRandomValues(new Uint8Array(e)):crypto.getRandomValues(new Uint8Array(e)):n(Array(e),e)}function r(){var e=a(16);e[6]=64|79&e[6],e[8]=128|191&e[8];for(var t,n="",r=0;r<16;++r)t=e[r],(4===r||6===r||8===r)&&(n+="-"),16>t&&(n+="0"),n+=t.toString(16).toLowerCase();return n}var i=F.create(),s=e();return function(){function n(){this._key=e()}return n.prototype.has=function(e){var n=t(e,!1);return void 0!==n&&F.has(n,this._key)},n.prototype.get=function(e){var n=t(e,!1);return void 0===n?void 0:F.get(n,this._key)},n.prototype.set=function(e,n){var a=t(e,!0);return a[this._key]=n,this},n.prototype.delete=function(e){var n=t(e,!1);return void 0!==n&&delete n[this._key]},n.prototype.clear=function(){this._key=e()},n}()}():WeakMap,W=new B;e("decorate",function(e,a,r,i){if(!u(r)){if(!P(e))throw new TypeError;if(!f(a))throw new TypeError;if(!f(i)&&!u(i)&&!c(i))throw new TypeError;return c(i)&&(i=void 0),r=b(r),n(e,a,r,i)}if(!P(e))throw new TypeError;if(!C(a))throw new TypeError;return t(e,a)}),e("metadata",function(e,t){return function(n,a){if(!f(n))throw new TypeError;if(!u(a)&&!k(a))throw new TypeError;o(e,t,n,a)}}),e("defineMetadata",function(e,t,n,a){if(!f(n))throw new TypeError;return u(a)||(a=b(a)),o(e,t,n,a)}),e("hasMetadata",function(e,t,n){if(!f(t))throw new TypeError;return u(n)||(n=b(n)),r(e,t,n)}),e("hasOwnMetadata",function(e,t,n){if(!f(t))throw new TypeError;return u(n)||(n=b(n)),i(e,t,n)}),e("getMetadata",function(e,t,n){if(!f(t))throw new TypeError;return u(n)||(n=b(n)),s(e,t,n)}),e("getOwnMetadata",function(e,t,n){if(!f(t))throw new TypeError;return u(n)||(n=b(n)),d(e,t,n)}),e("getMetadataKeys",function(e,t){if(!f(e))throw new TypeError;return u(t)||(t=b(t)),l(e,t)}),e("getOwnMetadataKeys",function(e,t){if(!f(e))throw new TypeError;return u(t)||(t=b(t)),_(e,t)}),e("deleteMetadata",function(e,t,n){if(!f(t))throw new TypeError;u(n)||(n=b(n));var r=a(t,n,!1);if(u(r))return!1;if(!r.delete(e))return!1;if(0<r.size)return!0;var i=W.get(t);return!(i.delete(n),!(0<i.size))||(W.delete(t),!0)})})})(Reflect$1||(Reflect$1={}));const component=e=>function(t){window.customElements.define(e,t)};function property(e,t){function n(e,t){Reflect.hasMetadata("design:type",e,t)&&(a.type=Reflect.getMetadata("design:type",e,t)),e.constructor.properties=e.constructor.properties||{},e.constructor.properties[t]=Object.assign(a,e.constructor.properties[t]||{})}let a,r=!1;return void 0===t?(a=e||{},r=!0):a={},r?n:n(e,t)}let Form=class extends LitElement{constructor(){super(),this.values={},this.fields=[],this.loading=!1,this.fieldErrors={},this._validateOnChange=!1,this._showErrors=!1,this.submit=this.submit.bind(this),this._handleChange=this._handleChange.bind(this)}_render({error:e,fields:t,values:n,fieldErrors:a}){const r=a||{};return html$1`
${CSS}
${e?html$1`<div class="error"><zen-icon type="error" color="error"></zen-icon><span>${e}</span>`:""}
<form novalidate on-submit="${this.submit}">
${t.filter(e=>!e.hidden).map(e=>html$1`
<zen-form-row
field=${e}
value=${n[e.name]}
on-change=${this._handleChange}
on-submit=${this.submit}
name=${e.name}
error=${r[e.name]}
rowwidth=${e.width}
disabled=${e.disabled}
></zen-form-row>
`)}
</form>
`}scrollToError(){if(this.fieldErrors){const e=Array.from(this.shadowRoot.querySelectorAll("zen-form-row")).find(e=>e.name===Object.keys(this.fieldErrors)[0]);if(e)return e.scrollIntoView(),e}}submit(t){if(t&&(t.preventDefault(),t.stopPropagation()),!this.validate())return!1;const e=this.shadowRoot.querySelector("*:focus");return e&&e.blur&&e.blur(),this.dispatchEvent(new CustomEvent("submit")),!1}validate(e=!0){this._validateOnChange=!0,this._showErrors=e,this.fieldErrors={};const t=new Validator({fields:this.fields}),{valid:n,fields:a}=t.validate(this.values);if(a){this.fieldErrors=a;const e=this.scrollToError();e&&e.focus()}return this.dispatchEvent(new CustomEvent("validated",{detail:{valid:n}})),n}_propertiesChanged(e,t,n){super._propertiesChanged(e,t,n),t&&t.values&&(this._showErrors&&this.validate(),this.dispatchEvent(new CustomEvent("change")))}_handleChange(t){this.values=Object.assign({},this.values,{[t.target.name]:t.target.value})}};__decorate([property,__metadata("design:type",Object)],Form.prototype,"values",void 0),__decorate([property,__metadata("design:type",String)],Form.prototype,"error",void 0),__decorate([property,__metadata("design:type",Array)],Form.prototype,"fields",void 0),__decorate([property,__metadata("design:type",Boolean)],Form.prototype,"loading",void 0),__decorate([property,__metadata("design:type",Object)],Form.prototype,"fieldErrors",void 0),Form=__decorate([component("zen-form"),__metadata("design:paramtypes",[])],Form);
//# sourceMappingURL=Form.js.map