origami-zen
Version:
Collection of reusable web components. Built for Origami CMS.
14 lines (13 loc) • 28.1 kB
JavaScript
function __decorate(e,t,n,a){var o,s=arguments.length,_=3>s?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)_=Reflect.decorate(e,t,n,a);else for(var l=e.length-1;0<=l;l--)(o=e[l])&&(_=(3>s?o(_):3<s?o(t,n,_):o(t,n))||_);return 3<s&&_&&Object.defineProperty(t,n,_),_}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,o=i.get(t);o||(o=e(t),i.set(t,o));let s=Object.create(o.__mixinSet||r||null);return s[a]=!0,o.__mixinSet=s,o}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 o=[];for(let n,s;a.nextNode();){r++,n=s;const t=s=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],o=lastAttributeNameRegex.exec(a)[1],s=n.getNamedItem(o),d=s.value.split(markerRegex);this.parts.push(new TemplatePart("attribute",r,s.name,o,d)),t.removeAttribute(s.name),i+=d.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),s=a.length-1;i+=s;for(let e=0;e<s;e++)n.insertBefore(""===a[e]?document.createComment(""):document.createTextNode(a[e]),t),this.parts.push(new TemplatePart("node",r++));n.insertBefore(""===a[s]?document.createComment(""):document.createTextNode(a[s]),t),o.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++)),o.push(t),null===t.nextSibling?e.insertBefore(document.createComment(""),t):r--,s=n,i++}}for(const a of o)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 o=0;o<a;o++){r+=n[o];const a=getValue(this,e[t+o]);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 Reflect$1,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(!k(r))throw new TypeError;t=r}}return t}function n(e,t,n,a){for(var r=e.length-1;0<=r;--r){var o=e[r],s=o(t,n,a);if(!u(s)&&!c(s)){if(!g(s))throw new TypeError;a=s}}return a}function a(e,t,n){var a=q.get(e);if(u(a)){if(!n)return;a=new F,q.set(e,a)}var r=a.get(t);if(u(r)){if(!n)return;r=new F,a.set(t,r)}return r}function r(e,t,n){var a=i(e,t,n);if(a)return!0;var o=V(t);return!c(o)&&r(e,o,n)}function i(e,t,n){var r=a(t,n,!1);return!u(r)&&h(r.has(e))}function o(e,t,n){var a=i(e,t,n);if(a)return s(e,t,n);var r=V(t);return c(r)?void 0:o(e,r,n)}function s(e,t,n){var r=a(t,n,!1);return u(r)?void 0:r.get(e)}function d(e,t,n,r){var i=a(n,r,!0);i.set(e,t)}function _(e,t){var n=l(e,t),a=V(e);if(null===a)return n;var r=_(a,t);if(0>=r.length)return n;if(0>=n.length)return r;for(var i=new B,o=[],s=0,d=n;s<d.length;s++){var p=d[s],u=i.has(p);u||(i.add(p),o.push(p))}for(var c=0,y=r;c<y.length;c++){var p=y[c],u=i.has(p);u||(i.add(p),o.push(p))}return o}function l(e,t){var n=[],r=a(e,t,!1);if(u(r))return n;for(var i=r.keys(),o=I(i),s=0;;){var d=T(o);if(!d)return n.length=s,n;var _=A(d);try{n[s]=_}catch(t){try{O(o)}finally{throw t}}s++}}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 g(e){return"object"==typeof e?null!==e:"function"==typeof e}function m(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(g(r))throw new TypeError;return r}return f(e,"default"==n?"number":n)}function f(e,t){if("string"===t){var n=e.toString;if(x(n)){var a=n.call(e);if(!g(a))return a}var r=e.valueOf;if(x(r)){var a=r.call(e);if(!g(a))return a}}else{var r=e.valueOf;if(x(r)){var a=r.call(e);if(!g(a))return a}var i=e.toString;if(x(i)){var a=i.call(e);if(!g(a))return a}}throw new TypeError}function h(e){return!!e}function v(e){return""+e}function b(e){var t=m(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 k(e){return"function"==typeof e}function C(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,E);if(!x(t))throw new TypeError;var n=t.call(e);if(!g(n))throw new TypeError;return n}function A(e){return e.value}function T(e){var t=e.next();return!t.done&&t}function O(e){var t=e["return"];t&&t.call(e)}function V(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===H)return t;if(t!==H)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 S(e){return e.__=void 0,delete e.__,e}var w=Object.prototype.hasOwnProperty,z="function"==typeof Symbol,R=z&&"undefined"!=typeof Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",E=z&&"undefined"!=typeof Symbol.iterator?Symbol.iterator:"@@iterator",M="function"==typeof Object.create,j={__proto__:[]}instanceof Array,L=!M&&!j,K={create:M?function(){return S(Object.create(null))}:j?function(){return S({__proto__:null})}:function(){return S({})},has:L?function(e,t){return w.call(e,t)}:function(e,t){return t in e},get:L?function(e,t){return w.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},H=Object.getPrototypeOf(Function),D="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,F=D||"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[E]=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[E]=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,B=D||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){return function(){function e(){this._map=new F}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[E]=function(){return this.keys()},e}()}():Set,W=D||"function"!=typeof WeakMap?function(){function e(){var e;do e="@@WeakMap@@"+r();while(K.has(i,e));return i[e]=!0,e}function t(e,t){if(!w.call(e,o)){if(!t)return;Object.defineProperty(e,o,{value:K.create()})}return e[o]}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=K.create(),o=e();return function(){function n(){this._key=e()}return n.prototype.has=function(e){var n=t(e,!1);return void 0!==n&&K.has(n,this._key)},n.prototype.get=function(e){var n=t(e,!1);return void 0===n?void 0:K.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,q=new W;e("decorate",function(e,a,r,i){if(!u(r)){if(!P(e))throw new TypeError;if(!g(a))throw new TypeError;if(!g(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(!k(a))throw new TypeError;return t(e,a)}),e("metadata",function(e,t){return function(n,a){if(!g(n))throw new TypeError;if(!u(a)&&!C(a))throw new TypeError;d(e,t,n,a)}}),e("defineMetadata",function(e,t,n,a){if(!g(n))throw new TypeError;return u(a)||(a=b(a)),d(e,t,n,a)}),e("hasMetadata",function(e,t,n){if(!g(t))throw new TypeError;return u(n)||(n=b(n)),r(e,t,n)}),e("hasOwnMetadata",function(e,t,n){if(!g(t))throw new TypeError;return u(n)||(n=b(n)),i(e,t,n)}),e("getMetadata",function(e,t,n){if(!g(t))throw new TypeError;return u(n)||(n=b(n)),o(e,t,n)}),e("getOwnMetadata",function(e,t,n){if(!g(t))throw new TypeError;return u(n)||(n=b(n)),s(e,t,n)}),e("getMetadataKeys",function(e,t){if(!g(e))throw new TypeError;return u(t)||(t=b(t)),_(e,t)}),e("getOwnMetadataKeys",function(e,t){if(!g(e))throw new TypeError;return u(t)||(t=b(t)),l(e,t)}),e("deleteMetadata",function(e,t,n){if(!g(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=q.get(t);return!(i.delete(n),!(0<i.size))||(q.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)}const dispatchChange=(e="value",t="change")=>function(n){return class extends n{_propertiesChanged(n,a,r){super._propertiesChanged(n,a,r),a&&a[e]!==void 0&&this.dispatchEvent(new CustomEvent(t))}}};var CSS=html$1`<style>:host{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;margin:0;padding:0;border:0;outline:0;font-size:100%;font:inherit;vertical-align:baseline}:host{user-select:none}:host .option{text-align:left}
</style>`;let Radio=class extends LitElement{constructor(){super(...arguments),this.options={}}_render({value:e,options:t}){const n=Object.entries(t).map(([e,t])=>({value:e,label:t}));return html$1`
${CSS}
<div class="options">
${n.map(t=>html$1`
<div class="option" on-click=${()=>this.value=t.value}>
<zen-icon type="${e===t.value?"radio-checked":"radio-unchecked"}"></zen-icon>
<span>${t.label}</span>
</div>
`)}
</div>
`}};__decorate([property,__metadata("design:type",Object)],Radio.prototype,"options",void 0),__decorate([property,__metadata("design:type",String)],Radio.prototype,"value",void 0),__decorate([property,__metadata("design:type",String)],Radio.prototype,"name",void 0),Radio=__decorate([component("zen-radio"),dispatchChange()],Radio);
//# sourceMappingURL=Radio.js.map