/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
import"../utils/boot.js";import{dedupingMixin as e}from"../utils/mixin.js";import{register as t,incrementInstanceCount as r}from"../utils/telemetry.js";import{PropertiesChanged as i}from"./properties-changed.js";export const PropertiesMixin=e((e=>{const s=i(e);function superPropertiesClass(e){const t=Object.getPrototypeOf(e);return t.prototype instanceof PropertiesMixin?t:null}function ownProperties(e){if(!e.hasOwnProperty(JSCompiler_renameProperty("__ownProperties",e))){let t=null;if(e.hasOwnProperty(JSCompiler_renameProperty("properties",e))){const r=e.properties;r&&(t=function normalizeProperties(e){const t={};for(let r in e){const i=e[r];t[r]="function"==typeof i?{type:i}:i}return t}(r))}e.__ownProperties=t}return e.__ownProperties}class PropertiesMixin extends s{static get observedAttributes(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__observedAttributes",this))){t(this.prototype);const e=this._properties;this.__observedAttributes=e?Object.keys(e).map((e=>this.prototype._addPropertyToAttributeMap(e))):[]}return this.__observedAttributes}static finalize(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__finalized",this))){const e=superPropertiesClass(this);e&&e.finalize(),this.__finalized=!0,this._finalizeClass()}}static _finalizeClass(){const e=ownProperties(this);e&&this.createProperties(e)}static get _properties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__properties",this))){const e=superPropertiesClass(this);this.__properties=Object.assign({},e&&e._properties,ownProperties(this))}return this.__properties}static typeForProperty(e){const t=this._properties[e];return t&&t.type}_initializeProperties(){r(),this.constructor.finalize(),super._initializeProperties()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._enableProperties()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback()}}return PropertiesMixin}));