2 lines
304 KiB
JavaScript
2 lines
304 KiB
JavaScript
function e(e,t,o,i){var a,n=arguments.length,r=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,o,r):a(t,o))||r);return n>3&&r&&Object.defineProperty(t,o,r),r}function t(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}"function"==typeof SuppressedError&&SuppressedError;const o=e=>e.type.includes("energy-flow-card-plus");var i,a;function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e}).apply(this,arguments)}!function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(i||(i={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(a||(a={}));var r=function(e,t,o){var a=t?function(e){switch(e.number_format){case i.comma_decimal:return["en-US","en"];case i.decimal_comma:return["de","es","it"];case i.space_comma:return["fr","sv","cs"];case i.system:return;default:return e.language}}(t):void 0;if(Number.isNaN=Number.isNaN||function e(t){return"number"==typeof t&&e(t)},(null==t?void 0:t.number_format)!==i.none&&!Number.isNaN(Number(e))&&Intl)try{return new Intl.NumberFormat(a,s(e,o)).format(Number(e))}catch(t){return console.error(t),new Intl.NumberFormat(void 0,s(e,o)).format(Number(e))}return"string"==typeof e?e:function(e,t){return void 0===t&&(t=2),Math.round(e*Math.pow(10,t))/Math.pow(10,t)}(e,void 0).toString()+""},s=function(e,t){var o=n({maximumFractionDigits:2},t);if("string"!=typeof e)return o;var i=e.indexOf(".")>-1?e.split(".")[1].length:0;return o.minimumFractionDigits=i,o.maximumFractionDigits=i,o},l=function(e,t,o,i){i=i||{},o=null==o?{}:o;var a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return a.detail=o,e.dispatchEvent(a),a};const c=e=>e?.split("|").map(e=>e.trim()),d=e=>c(e).at(0)??"",u={maxFlowRate:6,minFlowRate:.75,baseDecimals:0,kiloDecimals:1,minExpectedPower:.01,maxExpectedPower:2e3,kiloThreshold:1e3,megaThreshold:1e6,transparencyZeroLines:0,displayZeroLines:{mode:"show",transparency:50,grey_color:[189,189,189]}};const h=(e,t)=>Number(`${Math.round(Number(`${e}e${t}`))}e-${t}`);function p(e){return!isNaN(parseFloat(e))&&!isNaN(Number(e))}function _(e,t=0){return p(e)?Number(e):t}const m=(e,t,i,{unit:a,unitWhiteSpace:n,decimals:s,accept_negative:l})=>{const c=!1===n?"":" ",d=o(t),_=d?"Wh":"W",m=d?"kWh":"kW",f=d?"MWh":"MW";if(null==i||""===i)return`0${c}${a??_}`;if(!p(i))return i.toString();const g=Number(i),y=void 0===a&&g>=(t.kilo_threshold??u.kiloThreshold),v=void 0===a&&g>=(t.mega_threshold??u.megaThreshold),b=s??(v?t.mega_decimals:y?t.kilo_decimals:t.base_decimals);return`${r((e=>l?e:Math.abs(e))(v?h(g/1e6,b??2):y?h(g/1e3,b??2):h(g,b??0)),e.locale)}${c}${a||(v?f:y?m:_)}`},f=globalThis,g=f.ShadowRoot&&(void 0===f.ShadyCSS||f.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,y=Symbol(),v=new WeakMap;let b=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==y)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(g&&void 0===e){const o=void 0!==t&&1===t.length;o&&(e=v.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&v.set(t,e))}return e}toString(){return this.cssText}};const w=(e,...t)=>{const o=1===e.length?e[0]:t.reduce((t,o,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[i+1],e[0]);return new b(o,e,y)},k=g?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const o of e.cssRules)t+=o.cssText;return(e=>new b("string"==typeof e?e:e+"",void 0,y))(t)})(e):e,{is:x,defineProperty:S,getOwnPropertyDescriptor:$,getOwnPropertyNames:E,getOwnPropertySymbols:C,getPrototypeOf:A}=Object,D=globalThis,P=D.trustedTypes,M=P?P.emptyScript:"",T=D.reactiveElementPolyfillSupport,z=(e,t)=>e,O={toAttribute(e,t){switch(t){case Boolean:e=e?M:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let o=e;switch(t){case Boolean:o=null!==e;break;case Number:o=null===e?null:Number(e);break;case Object:case Array:try{o=JSON.parse(e)}catch(e){o=null}}return o}},N=(e,t)=>!x(e,t),I={attribute:!0,type:String,converter:O,reflect:!1,useDefault:!1,hasChanged:N};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),D.litPropertyMetadata??(D.litPropertyMetadata=new WeakMap);let j=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=I){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const o=Symbol(),i=this.getPropertyDescriptor(e,o,t);void 0!==i&&S(this.prototype,e,i)}}static getPropertyDescriptor(e,t,o){const{get:i,set:a}=$(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const n=i?.call(this);a?.call(this,t),this.requestUpdate(e,n,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??I}static _$Ei(){if(this.hasOwnProperty(z("elementProperties")))return;const e=A(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(z("properties"))){const e=this.properties,t=[...E(e),...C(e)];for(const o of t)this.createProperty(o,e[o])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,o]of t)this.elementProperties.set(e,o)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const o=this._$Eu(e,t);void 0!==o&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const o=new Set(e.flat(1/0).reverse());for(const e of o)t.unshift(k(e))}else void 0!==e&&t.push(k(e));return t}static _$Eu(e,t){const o=t.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const o of t.keys())this.hasOwnProperty(o)&&(e.set(o,this[o]),delete this[o]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(g)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const o of t){const t=document.createElement("style"),i=f.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=o.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,o){this._$AK(e,o)}_$ET(e,t){const o=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,o);if(void 0!==i&&!0===o.reflect){const a=(void 0!==o.converter?.toAttribute?o.converter:O).toAttribute(t,o.type);this._$Em=e,null==a?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(e,t){const o=this.constructor,i=o._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=o.getPropertyOptions(i),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:O;this._$Em=i;const n=a.fromAttribute(t,e.type);this[i]=n??this._$Ej?.get(i)??n,this._$Em=null}}requestUpdate(e,t,o,i=!1,a){if(void 0!==e){const n=this.constructor;if(!1===i&&(a=this[e]),o??(o=n.getPropertyOptions(e)),!((o.hasChanged??N)(a,t)||o.useDefault&&o.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,o))))return;this.C(e,t,o)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:o,reflect:i,wrapped:a},n){o&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==a||void 0!==n)||(this._$AL.has(e)||(this.hasUpdated||o||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,o]of e){const{wrapped:e}=o,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,o,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};j.elementStyles=[],j.shadowRootOptions={mode:"open"},j[z("elementProperties")]=new Map,j[z("finalized")]=new Map,T?.({ReactiveElement:j}),(D.reactiveElementVersions??(D.reactiveElementVersions=[])).push("2.1.2");const B=globalThis,L=e=>e,R=B.trustedTypes,H=R?R.createPolicy("lit-html",{createHTML:e=>e}):void 0,U="$lit$",F=`lit$${Math.random().toFixed(9).slice(2)}$`,G="?"+F,V=`<${G}>`,W=document,Z=()=>W.createComment(""),Y=e=>null===e||"object"!=typeof e&&"function"!=typeof e,X=Array.isArray,q="[ \t\n\f\r]",K=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,J=/-->/g,Q=/>/g,ee=RegExp(`>|${q}(?:([^\\s"'>=/]+)(${q}*=${q}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),te=/'/g,oe=/"/g,ie=/^(?:script|style|textarea|title)$/i,ae=e=>(t,...o)=>({_$litType$:e,strings:t,values:o}),ne=ae(1),re=ae(2),se=Symbol.for("lit-noChange"),le=Symbol.for("lit-nothing"),ce=new WeakMap,de=W.createTreeWalker(W,129);function ue(e,t){if(!X(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==H?H.createHTML(t):t}let he=class e{constructor({strings:t,_$litType$:o},i){let a;this.parts=[];let n=0,r=0;const s=t.length-1,l=this.parts,[c,d]=((e,t)=>{const o=e.length-1,i=[];let a,n=2===t?"<svg>":3===t?"<math>":"",r=K;for(let t=0;t<o;t++){const o=e[t];let s,l,c=-1,d=0;for(;d<o.length&&(r.lastIndex=d,l=r.exec(o),null!==l);)d=r.lastIndex,r===K?"!--"===l[1]?r=J:void 0!==l[1]?r=Q:void 0!==l[2]?(ie.test(l[2])&&(a=RegExp("</"+l[2],"g")),r=ee):void 0!==l[3]&&(r=ee):r===ee?">"===l[0]?(r=a??K,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,s=l[1],r=void 0===l[3]?ee:'"'===l[3]?oe:te):r===oe||r===te?r=ee:r===J||r===Q?r=K:(r=ee,a=void 0);const u=r===ee&&e[t+1].startsWith("/>")?" ":"";n+=r===K?o+V:c>=0?(i.push(s),o.slice(0,c)+U+o.slice(c)+F+u):o+F+(-2===c?t:u)}return[ue(e,n+(e[o]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,o);if(this.el=e.createElement(c,i),de.currentNode=this.el.content,2===o||3===o){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=de.nextNode())&&l.length<s;){if(1===a.nodeType){if(a.hasAttributes())for(const e of a.getAttributeNames())if(e.endsWith(U)){const t=d[r++],o=a.getAttribute(e).split(F),i=/([.?@])?(.*)/.exec(t);l.push({type:1,index:n,name:i[2],strings:o,ctor:"."===i[1]?ge:"?"===i[1]?ye:"@"===i[1]?ve:fe}),a.removeAttribute(e)}else e.startsWith(F)&&(l.push({type:6,index:n}),a.removeAttribute(e));if(ie.test(a.tagName)){const e=a.textContent.split(F),t=e.length-1;if(t>0){a.textContent=R?R.emptyScript:"";for(let o=0;o<t;o++)a.append(e[o],Z()),de.nextNode(),l.push({type:2,index:++n});a.append(e[t],Z())}}}else if(8===a.nodeType)if(a.data===G)l.push({type:2,index:n});else{let e=-1;for(;-1!==(e=a.data.indexOf(F,e+1));)l.push({type:7,index:n}),e+=F.length-1}n++}}static createElement(e,t){const o=W.createElement("template");return o.innerHTML=e,o}};function pe(e,t,o=e,i){if(t===se)return t;let a=void 0!==i?o._$Co?.[i]:o._$Cl;const n=Y(t)?void 0:t._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),void 0===n?a=void 0:(a=new n(e),a._$AT(e,o,i)),void 0!==i?(o._$Co??(o._$Co=[]))[i]=a:o._$Cl=a),void 0!==a&&(t=pe(e,a._$AS(e,t.values),a,i)),t}let _e=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:o}=this._$AD,i=(e?.creationScope??W).importNode(t,!0);de.currentNode=i;let a=de.nextNode(),n=0,r=0,s=o[0];for(;void 0!==s;){if(n===s.index){let t;2===s.type?t=new me(a,a.nextSibling,this,e):1===s.type?t=new s.ctor(a,s.name,s.strings,this,e):6===s.type&&(t=new be(a,this,e)),this._$AV.push(t),s=o[++r]}n!==s?.index&&(a=de.nextNode(),n++)}return de.currentNode=W,i}p(e){let t=0;for(const o of this._$AV)void 0!==o&&(void 0!==o.strings?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}},me=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,i){this.type=2,this._$AH=le,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=pe(this,e,t),Y(e)?e===le||null==e||""===e?(this._$AH!==le&&this._$AR(),this._$AH=le):e!==this._$AH&&e!==se&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>X(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==le&&Y(this._$AH)?this._$AA.nextSibling.data=e:this.T(W.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:o}=e,i="number"==typeof o?this._$AC(e):(void 0===o.el&&(o.el=he.createElement(ue(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new _e(i,this),o=e.u(this.options);e.p(t),this.T(o),this._$AH=e}}_$AC(e){let t=ce.get(e.strings);return void 0===t&&ce.set(e.strings,t=new he(e)),t}k(t){X(this._$AH)||(this._$AH=[],this._$AR());const o=this._$AH;let i,a=0;for(const n of t)a===o.length?o.push(i=new e(this.O(Z()),this.O(Z()),this,this.options)):i=o[a],i._$AI(n),a++;a<o.length&&(this._$AR(i&&i._$AB.nextSibling,a),o.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=L(e).nextSibling;L(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},fe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,o,i,a){this.type=1,this._$AH=le,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=le}_$AI(e,t=this,o,i){const a=this.strings;let n=!1;if(void 0===a)e=pe(this,e,t,0),n=!Y(e)||e!==this._$AH&&e!==se,n&&(this._$AH=e);else{const i=e;let r,s;for(e=a[0],r=0;r<a.length-1;r++)s=pe(this,i[o+r],t,r),s===se&&(s=this._$AH[r]),n||(n=!Y(s)||s!==this._$AH[r]),s===le?e=le:e!==le&&(e+=(s??"")+a[r+1]),this._$AH[r]=s}n&&!i&&this.j(e)}j(e){e===le?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ge=class extends fe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===le?void 0:e}},ye=class extends fe{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==le)}},ve=class extends fe{constructor(e,t,o,i,a){super(e,t,o,i,a),this.type=5}_$AI(e,t=this){if((e=pe(this,e,t,0)??le)===se)return;const o=this._$AH,i=e===le&&o!==le||e.capture!==o.capture||e.once!==o.once||e.passive!==o.passive,a=e!==le&&(o===le||i);i&&this.element.removeEventListener(this.name,this,o),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},be=class{constructor(e,t,o){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(e){pe(this,e)}};const we={I:me},ke=B.litHtmlPolyfillSupport;ke?.(he,me),(B.litHtmlVersions??(B.litHtmlVersions=[])).push("3.3.2");const xe=globalThis;let Se=class extends j{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,o)=>{const i=o?.renderBefore??t;let a=i._$litPart$;if(void 0===a){const e=o?.renderBefore??null;i._$litPart$=a=new me(t.insertBefore(Z(),e),e,void 0,o??{})}return a._$AI(e),a})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return se}};Se._$litElement$=!0,Se.finalized=!0,xe.litElementHydrateSupport?.({LitElement:Se});const $e=xe.litElementPolyfillSupport;$e?.({LitElement:Se}),(xe.litElementVersions??(xe.litElementVersions=[])).push("4.2.2");const Ee=e=>!0!==e.disable_dots&&("undefined"==typeof document||"hidden"!==document.visibilityState),Ce=(e,t)=>{const o=(e=>{const t=JSON.parse(JSON.stringify(e)).filter(e=>e?.has);return t})(e);return o?.[t]??void 0},Ae=e=>Ce(e,1),De=e=>Ce(e,2),Pe=e=>Ce(e,3),Me=e=>!!De(e)||!!Pe(e),Te=e=>!!Ae(e)||!!Pe(e),ze=(e,t)=>t>0||"hide"!==e?.display_zero_lines?.mode,Oe=(e,t)=>{if(e>0)return"";const o=t?.display_zero_lines?.mode;if("show"===o||void 0===o)return"";let i="";if("transparency"===o||"custom"===o){const e=t?.display_zero_lines?.transparency;(e??1)&&(i+="transparency ")}return"grey_out"!==o&&"custom"!==o||(i+="grey"),i},Ne=1,Ie=2,je=e=>(...t)=>({_$litDirective$:e,values:t});let Be=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,o){this._$Ct=e,this._$AM=t,this._$Ci=o}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const Le=je(class extends Be{constructor(e){if(super(e),e.type!==Ne||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(e=>""!==e)));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const o=e.element.classList;for(const e of this.st)e in t||(o.remove(e),this.st.delete(e));for(const e in t){const i=!!t[e];i===this.st.has(e)||this.nt?.has(e)||(i?(o.add(e),this.st.add(e)):(o.remove(e),this.st.delete(e)))}return se}}),Re=(e,{battery:t,grid:o,individual:i,newDur:a})=>o.has&&t.has&&ze(e,Math.max(o.state.toBattery||0,t.state.toGrid||0))?ne`<div class="lines ${Le({high:t.has||Te(i),"individual1-individual2":!t.has&&i.every(e=>e?.has),"multi-individual":Me(i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="battery-grid-flow"><path id="battery-grid" class="${Oe(t.state.toGrid||o.state.toBattery||0,e)}" d="M45,100 v-15 c0,-30 -10,-30 -30,-30 h-20" vector-effect="non-scaling-stroke"></path>${((e,t,o)=>Ee(e)&&t.state.toBattery?re`<circle r="1" class="battery-from-grid" vector-effect="non-scaling-stroke"><animateMotion dur="${o.batteryGrid}s" repeatCount="indefinite" keyPoints="1;0" keyTimes="0;1" calcMode="paced"><mpath xlink:href="#battery-grid"></animateMotion></circle>`:le)(e,o,a)} ${((e,t,o)=>Ee(e)&&t.state.toGrid?re`<circle r="1" class="battery-to-grid" vector-effect="non-scaling-stroke"><animateMotion dur="${o.batteryGrid}s" repeatCount="indefinite" calcMode="paced"><mpath xlink:href="#battery-grid"></animateMotion></circle>`:le)(e,t,a)}</svg></div>`:le,He=(e,{battery:t,grid:o,individual:i,newDur:a})=>t.has&&ze(e,t.state.toHome)&&!e.entities.home?.hide?ne`<div class="lines ${Le({high:t.has||Te(i),"individual1-individual2":!t.has&&i.every(e=>e?.has),"multi-individual":Me(i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="battery-home-flow"><path id="battery-home" class="battery-home ${Oe(t.state.toHome||0,e)}" d="M55,100 v-${o.has?15:17} c0,-30 10,-30 30,-30 h20" vector-effect="non-scaling-stroke"></path>${((e,t,o)=>Ee(e)&&t.state.toHome?re`<circle r="1" class="battery-home" vector-effect="non-scaling-stroke"><animateMotion dur="${o.batteryToHome}s" repeatCount="indefinite" calcMode="paced"><mpath xlink:href="#battery-home"></animateMotion></circle>`:le)(e,t,a)}</svg></div>`:le,Ue=(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>o.has&&ze(e,o.state.fromGrid)&&!e.entities.home?.hide?ne`<div class="lines ${Le({high:t.has||Te(i),"individual1-individual2":!t.has&&i.every(e=>e?.has),"multi-individual":Me(i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="grid-home-flow" class="flat-line"><path class="grid ${Oe(o.state.toHome||0,e)}" id="grid" d="M0,${t.has?50:a.has?56:53} H100" vector-effect="non-scaling-stroke"></path>${((e,t,o)=>Ee(e)&&t.state.toHome?re`<circle r="1" class="grid" vector-effect="non-scaling-stroke"><animateMotion dur="${o.gridToHome}s" repeatCount="indefinite" calcMode="paced"><mpath xlink:href="#grid"></animateMotion></circle>`:le)(e,o,n)}</svg></div>`:le,Fe=(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>o.has&&o.hasReturnToGrid&&a.has&&ze(e,a.state.toGrid||0)?ne`<div class="lines ${Le({high:t.has||Te(i),"individual1-individual2":!t.has&&i.every(e=>e?.has),"multi-individual":Me(i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="solar-grid-flow"><path id="return" class="return ${Oe(a.state.toGrid||0,e)}" d="M${t.has?45:47},0 v15 c0,${t.has?"30 -10,30 -30,30":"35 -10,35 -30,35"} h-20" vector-effect="non-scaling-stroke"></path>${((e,t,o)=>Ee(e)&&t.state.toGrid&&t.has?re`<circle r="1" class="return" vector-effect="non-scaling-stroke"><animateMotion dur="${o.solarToGrid}s" repeatCount="indefinite" calcMode="paced"><mpath xlink:href="#return"></animateMotion></circle>`:le)(e,a,n)}</svg></div>`:le,Ge=(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>a.has&&ze(e,a.state.toHome||0)&&!e.entities.home?.hide?ne`<div class="lines ${Le({high:t.has||Te(i),"individual1-individual2":!t.has&&i.every(e=>e?.has),"multi-individual":Me(i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="solar-home-flow"><path id="solar" class="solar ${Oe(a.state.toHome||0,e)}" d="M${t.has?55:53},0 v${o.has?15:17} c0,${t.has?"30 10,30 30,30":"35 10,35 30,35"} h25" vector-effect="non-scaling-stroke"></path>${((e,t,o)=>Ee(e)&&t.state.toHome?re`<circle r="1" class="solar" vector-effect="non-scaling-stroke"><animateMotion dur="${o.solarToHome}s" repeatCount="indefinite" calcMode="paced"><mpath xlink:href="#solar"></animateMotion></circle>`:le)(e,a,n)}</svg></div>`:le,Ve=(e,{battery:t,individual:o,solar:i,newDur:a})=>t.has&&i.has&&ze(e,i.state.toBattery||0)?ne`<div class="lines ${Le({high:t.has||Te(o),"individual1-individual2":!t.has&&o.every(e=>e?.has),"multi-individual":Me(o)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="solar-battery-flow" class="flat-line"><path id="battery-solar" class="battery-solar ${Oe(i.state.toBattery||0,e)}" d="M50,0 V100" vector-effect="non-scaling-stroke"></path>${((e,t,o)=>Ee(e)&&t.state.toBattery?re`<circle r="1" class="battery-solar" vector-effect="non-scaling-stroke"><animateMotion dur="${o.solarToBattery}s" repeatCount="indefinite" calcMode="paced"><mpath xlink:href="#battery-solar"></animateMotion></circle>`:le)(e,i,a)}</svg></div>`:le,We=["unavailable","unknown"],Ze=({main:e,className:t,template:o,value:i,entityId:a,icon:n,actions:r})=>i&&We.includes(i)?le:i||o?ne`<span class="secondary-info ${t}" @click="${t=>{t.stopPropagation(),e.onEntityClick(t,r,a)}}" @dblclick="${t=>{t.stopPropagation(),e.onEntityDoubleClick(t,r,a)}}" @pointerdown="${t=>{t.stopPropagation(),e.onEntityPointerDown(t,r,a)}}" @pointerup="${t=>{t.stopPropagation(),e.onEntityPointerUp(t)}}" @pointercancel="${t=>{t.stopPropagation(),e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&(t.stopPropagation(),e.openDetails(t,r,a,"tap"))}}">${n?ne`<ha-icon class="secondary-info small" .icon="${n}"></ha-icon>`:le} ${o??i}</span>`:le,Ye=(e,t,o,i,a,n)=>a?.secondary?.has||a?.secondary?.template?Ze({main:t,className:n,entityId:a.secondary.entity,icon:a.secondary.icon,value:m(e,o,a.secondary.state,{unit:a.secondary.unit,unitWhiteSpace:a.secondary.unit_white_space,decimals:a.secondary.decimals,accept_negative:a.secondary.accept_negative}),actions:{tap_action:a.secondary.tap_action,hold_action:a.secondary.hold_action,double_tap_action:a.secondary.double_tap_action},template:i[`${n}Secondary`]}):le,Xe=(e,t,o)=>{const i=e.use_new_flow_rate_model??!0?((e,t)=>{const o=e.max_expected_power,i=e.min_expected_power;return((e,t,o,i,a)=>e>a?o:(e-i)*(o-t)/(a-i)+t)(t,e.max_flow_rate,e.min_flow_rate,i,o)})(e,t):((e,t,o)=>{const i=e.min_flow_rate,a=e.max_flow_rate;return a-t/(o>0?o:t>0?t:1)*(a-i)})(e,t,o);return Number.isFinite(i)?i:e.max_flow_rate},qe=(e,t)=>!1!==e&&t?t:"number"==typeof e?e:1.66,Ke=ne`<div class="spacer"></div>`,Je=(e,t,o,i,a,n,r)=>{const s=i.individual[n],l=a?.secondary?.has?m(e,o,a?.secondary?.state,{unit:a?.secondary?.unit||void 0,unitWhiteSpace:a.secondary.unit_white_space,decimals:a?.secondary?.decimals||0,accept_negative:a?.secondary?.accept_negative||!1}):void 0;return(()=>{if(s)return!0;if(!0===a?.secondary?.displayZero)return!0;if(!a?.secondary?.state)return!1;if(!p(a?.secondary?.state))return!0;const e=a?.secondary?.displayZeroTolerance??0;return Number(a.secondary.state)>=e||a.secondary.accept_negative&&"number"==typeof Number(+a.secondary.state)})()?Ze({main:t,className:r,entityId:a?.field?.secondary_info?.entity||a?.secondary.entity||void 0,icon:a?.secondary?.icon||void 0,value:l,template:i.individual[n]||void 0,actions:{tap_action:a?.field?.secondary_info?.tap_action||a?.secondary?.tap_action,hold_action:a?.field?.secondary_info?.hold_action||a?.secondary?.hold_action,double_tap_action:a?.field?.secondary_info?.double_tap_action||a?.secondary?.double_tap_action}}):le},Qe=(e,t)=>{const o=c(t);for(const t of o)if(!p(e.states[t]?.state))return!1;return o.length>0};let et={name:"Unknown Card",version:"0.0.0",readme:"https://github.com/flixlix/"};const tt=function(e,t,o){var i;return void 0===o&&(o=!1),function(){var a=[].slice.call(arguments),n=this,r=o&&!i;clearTimeout(i),i=setTimeout(function(){i=null,o||e.apply(n,a)},t),r&&e.apply(n,a)}}(e=>{console.log(`%c⚡ ${et.name} v${et.version} %cError: ${e}`,"color: #488fc2; font-weight: bold","color: #b33a3a; font-weight: normal")},6e4),ot=e=>{tt(`Entity "${e??"Unknown"}" is not available or misconfigured`)},it=(e,t)=>{if(!t||!Qe(e,t))return ot(t),null;const o=c(t);let i,a=0;for(const t of o){const o=e.states[t];o&&(i=_(o.state),a+=i)}return a},at=["K","M","G","T","P","E","Z","Y"],nt=(e,t)=>{const o=it(e,t);if(!t||null===o)return 0;const i=e.states[d(t)];if(!i)return 0;const a=i.attributes.unit_of_measurement??"";return rt(o,a)},rt=(e,t)=>{const o=t.toUpperCase().slice(0,1),i=at.indexOf(o);return i>-1?e*Math.pow(1e3,i+1):e},st=(e,t,i,a,n)=>{const r=o(t)?"Wh":"W",s=t.entities.fossil_fuel_percentage?.unit_white_space??!0,l="percentage"===t.entities.fossil_fuel_percentage?.state_type?"%":r,c=t.entities.fossil_fuel_percentage?.display_zero_tolerance??0;if(n){const{nonFossilEnergy:o,nonFossilPercentage:i}=((e,t)=>{const o=1e3*Object.values(e).reduce((e,t)=>e+t,0),i=Math.max(t-o,0);return{nonFossilEnergy:i,nonFossilPercentage:t>0?i/t*100:0}})(n,a);if(l===r){let i=o;return c&&i<c&&(i=0),m(e,t,i,{unitWhiteSpace:s})}let d=i;return c&&d<c&&(d=0),m(e,t,d,{unit:"%",unitWhiteSpace:s,decimals:0})}if(!i||!Qe(e,i))return ot(i),"NaN";const d=1-(it(e,i)??0)/100;let u;if(u="string"==typeof t.entities.grid?.entity?a:nt(e,t.entities.grid?.entity.consumption)||0,l===r){let o=u*d;return c&&o<c&&(o=0),m(e,t,o,{unitWhiteSpace:s})}let h=100-(it(e,i)??0);return c&&h<c&&(h=0),m(e,t,h,{unit:"%",unitWhiteSpace:s,decimals:0})},lt=238.76104,ct=async(e,t,o,i)=>{((e,t,o,i)=>{i=i||{},o=null==o?{}:o;const a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});a.detail=o,e.dispatchEvent(a)})(e,"hass-action",{config:o,action:i})};var dt={label:{car:"Cotxe",motorbike:"Moto"}},ut={accept_negative:"Accepta Negatius",action:"Acció",advanced:"Opcions Avançades",allow_layout_break:"Permet trencar el disseny",base_decimals:"Decimals de base",battery:"Bateria",calculate_flow_rate:"Calcula la Relació de Fluxe",circle_animation:"Animació Circular",clickable_entities:"Entitats cliquejables",color:"Color",color_circle:"Color de Cercle",color_dynamically:"Color dinàmic",color_icon:"Color de Icona",color_state_of_charge_value:"Color",color_value:"Color de Valor",combined:"Entitat Combinada (Una entitat amb valors positius i negatius)",consumption:"Consum",custom:"Personalitzat",custom_colors:"Colors Personalitzats",dashboard_link:"Enllaç al Panell",dashboard_link_label:"Nom del Panell",decimals:"Nombre de decimals",disable_dots:"Deshabilitar Punts",display_state:"Mostra Estat",display_zero:"Mostra Zero",display_zero_lines:"Mostra Línies Zero",display_zero_state:"Mostra Estat Zero",display_zero_tolerance:"Mostra Zero Tolerància",double_tap_action:"Acció en doble toc",entity_generator:"Generador",fossil_fuel_percentage:"Comb. Fòssils",grey_color:"Color Gris",grey_out:"En Gris",grid:"Xarxa",hide:"Amaga",hold_action:"Acció en mantenir premut",home:"Casa",icon_alert:"Icona per a Alerta",individual:"Individu",invert_state:"Inverteix l'estat",inverted_animation:"Invertir Animació",kilo_decimals:"Decimals de quilo",kilo_threshold:"Llindar de base a quilo",label_alert:"Etiqueta per a Alerta",max_expected_power:"Potència Màxima Esperada",max_flow_rate:"Rel. Màx de Fluxe",min_expected_power:"Potència Mínima Esperada",min_flow_rate:"Rel. Mín. de Fluxe",mode:"Mode de visualització",mega_decimals:"Decimals de mega",mega_threshold:"Llindar de quilo a mega",navigation_path:"Ruta de Navegació",no_color:"Sense color",no_labels:"Sense etiquetes",override_state:"Sobrescriu l'Estat",power_outage:"Pèrdua de Potència",production:"Producció",secondary_info:"Informació Secundària",separated:"Entitats Separades (Una entitat per a consum i una per a producció)",show:"Mostra",show_direction:"Mostrar Direcció",show_state_of_charge:"Mostra l'Estat de Càrrega",solar:"Energia solar",sort_individual_devices:"Ordena Dispositius Individuals",state_alert:"Estat d'Alerta",state_of_charge:"Estat de Càrrega",state_of_charge_decimals:"Nombre de decimals",state_of_charge_icon:"Icona",state_of_charge_unit:"Unitat",state_of_charge_unit_white_space:"Espai en Blanc",state_type:"Tipus d'Estat",subtract_individual:"Resta Individuals",sum_total:"Suma solar i secundària",tap_action:"Acció al Tocar",template:"Plantilla",transparency:"Transparència",unit_of_measurement:"Unitat",unit_white_space:"Unitat Espai en Blanc",use_metadata:"Empra Metadades",use_new_flow_rate_model:"Nou Model de Rel. de Fluxe"},ht={card:dt,editor:ut},pt=Object.freeze({__proto__:null,card:dt,default:ht,editor:ut}),_t={label:{car:"Auto",motorbike:"Motorka"}},mt={accept_negative:"Povolit záporné hodnoty",action:"Akce",advanced:"Pokročilá nastavení",allow_layout_break:"Povolit zalomení zobrazení",base_decimals:"Desetinná místa pro základ",battery:"Baterie",calculate_flow_rate:"Počítat průtok",circle_animation:"Kruhová animace",clickable_entities:"Klikatelné entity",color:"Barva",color_circle:"Barva kruhu",color_dynamically:"Dynamická barva",color_icon:"Barevná ikona",color_state_of_charge_value:"Barva",color_value:"Barevná hodnota",combined:"Kombinovaná entita (jedna entita s kladnými a zápornými hodnotami)",consumption:"Spotřeba",custom:"Vlastní",custom_colors:"Vlastní barvy",dashboard_link:"Odkaz na informační panel",dashboard_link_label:"Popisek odkazu na informační panel",decimals:"Desetinná místa",disable_dots:"Vypnout tečky",display_state:"Zobrazit stav",display_zero:"Zobrazit nulu",display_zero_lines:"Zobrazit nulové řádky",display_zero_state:"Zobrazit nulové stavy",display_zero_tolerance:"Zobrazit nulovou toleranci",double_tap_action:"Akce při dvojitém klepnutí",entity_generator:"Generátor",fossil_fuel_percentage:"Fosilní palivo",grey_color:"Šedá barva",grey_out:"Šedý výstup",grid:"Síť",hide:"Skrýt",hold_action:"Akce při podržení",home:"Dům",icon_alert:"Ikona pro upozornění",individual:"Individuální",invert_state:"Invertovat stav",inverted_animation:"Invertovat animaci",kilo_decimals:"Desetinná místa pro kilo",kilo_threshold:"Práh ze základu na kilo",label_alert:"Štítek pro upozornění",max_expected_power:"Maximální očekávaný výkon",max_flow_rate:"Maximální průtok",min_expected_power:"Minimální očekávaný výkon",min_flow_rate:"Minimální průtok",mode:"Režim",mega_decimals:"Desetinná místa pro mega",mega_threshold:"Práh z kila na mega",navigation_path:"Navigační cesta",no_color:"Bez barvy",no_labels:"Bez popisků",override_state:"Přepsat stav",power_outage:"Výpadek",production:"Výroba",secondary_info:"Sekundární informace",separated:"Oddělené entity (jedna entita pro spotřebu a jedna pro výrobu)",show:"Zobrazit",show_direction:"Zobrazit směr",show_state_of_charge:"Zobrazit stav nabití",solar:"Solární",sort_individual_devices:"Seřadit jednotlivá zařízení",state_alert:"Stav upozornění",state_of_charge:"Stav nabití",state_of_charge_decimals:"Desetinná místa",state_of_charge_icon:"Ikona",state_of_charge_unit:"Jednotky",state_of_charge_unit_white_space:"Mezera u jednotky",state_type:"Typ stavu",subtract_individual:"Odečíst individuální zařízení",sum_total:"Sečíst solární a sekundární",tap_action:"Akce po klepnutí",template:"Šablona",transparency:"Průhlednost",unit_of_measurement:"Jednotka",unit_white_space:"Mezera u jednotky",use_metadata:"Použít Metadata",use_new_flow_rate_model:"Nový model průtoku"},ft={card:_t,editor:mt},gt=Object.freeze({__proto__:null,card:_t,default:ft,editor:mt}),yt={label:{car:"Auto",motorbike:"Motorrad"}},vt={accept_negative:"Negative Werte akzeptieren",action:"Aktion",advanced:"Erweiterte Optionen",allow_layout_break:"Layoutumbruch zulassen",base_decimals:"Dezimalstellen für Basis",battery:"Batterie",calculate_flow_rate:"Flussrate berechnen",circle_animation:"Kreisanimation",clickable_entities:"Klickbare Entitäten",color:"Farbe",color_circle:"Farbe des Kreises",color_dynamically:"Farbe dynamisch",color_icon:"Farbe des Symbols",color_state_of_charge_value:"Farbe",color_value:"Farbe des Wertes",combined:"Kombinierte Entität (Eine Entität mit positiven und negativen Werten)",consumption:"Verbrauch",custom:"Benutzerdefiniert",custom_colors:"Benutzerdefinierte Farben",dashboard_link:"Dashboard-Link",dashboard_link_label:"Name des Dashboard-Links",decimals:"Dezimalstellen",disable_dots:"Punkte deaktivieren",display_state:"Zustand anzeigen",display_zero:"Null anzeigen",display_zero_lines:"Nulllinien anzeigen",display_zero_state:"Nullzustand anzeigen",display_zero_tolerance:"Nulltoleranz",double_tap_action:"Aktion beim Doppeltippen",entity_generator:"Generator",fossil_fuel_percentage:"Fossile Brennstoffe",grey_color:"Graue Farbe",grey_out:"Ausgrauen",grid:"Netz",hide:"Verstecken",hold_action:"Aktion beim Halten",home:"Zuhause",icon_alert:"Symbol für Alarm",individual:"Individuell",invert_state:"Zustand umkehren",inverted_animation:"Animation umkehren",kilo_decimals:"Dezimalstellen für Kilo",kilo_threshold:"Schwellenwert von Basis zu Kilo",label_alert:"Beschriftung für Alarm",max_expected_power:"Maximale erwartete Leistung",max_flow_rate:"Maximale Flussrate",min_expected_power:"Minimale erwartete Leistung",min_flow_rate:"Minimale Flussrate",mode:"Modus",mega_decimals:"Dezimalstellen für Mega",mega_threshold:"Schwellenwert von Kilo zu Mega",navigation_path:"Navigationspfad",no_color:"Keine Farbe",no_labels:"Keine Beschriftungen",override_state:"Zustand überschreiben",power_outage:"Stromausfall",production:"Produktion",secondary_info:"Sekundäre Information",separated:"Getrennte Entitäten (Eine Entität für den Verbrauch und eine für die Produktion)",show:"Anzeigen",show_direction:"Richtung anzeigen",show_state_of_charge:"Ladezustand anzeigen",solar:"Solarenergie",sort_individual_devices:"Individuelle Geräte sortieren",state_alert:"Alarmzustand",state_of_charge:"Ladezustand",state_of_charge_decimals:"Dezimalstellen",state_of_charge_icon:"Symbol",state_of_charge_unit:"Einheit",state_of_charge_unit_white_space:"Leerzeichen",state_type:"Typ des Zustands",subtract_individual:"Individuell abziehen",sum_total:"Solar und Sekundär summieren",tap_action:"Aktion beim Antippen",template:"Vorlage",transparency:"Transparenz",unit_of_measurement:"Einheit",unit_white_space:"Weißraum für Einheit",use_metadata:"Metadaten verwenden",use_new_flow_rate_model:"Neues Fluss-Modell verwenden"},bt={card:yt,editor:vt},wt=Object.freeze({__proto__:null,card:yt,default:bt,editor:vt}),kt={label:{car:"Bil",motorbike:"Motorcykel"}},xt={accept_negative:"Accepter negative værdier",action:"Handling",advanced:"Avancerede indstillinger",allow_layout_break:"Tillad layout-brud",base_decimals:"Decimaler for basis",battery:"Batteri",calculate_flow_rate:"Beregn Hastighed",circle_animation:"Cirkel Animation",clickable_entities:"Klikbare enheder",color:"Farve",color_circle:"Farve af Cirkel",color_dynamically:"Farve dynamisk",color_icon:"Farve af ikon",color_state_of_charge_value:"Farve",color_value:"Farve af værdi",combined:"Kombineret enhed (Én enhed med positive og negative værdier)",consumption:"Forbrug",custom:"Brugerdefinerede",custom_colors:"Brugerdefinerede farver",dashboard_link:"Dashboard-link",dashboard_link_label:"Navn på dashboard-link",decimals:"Decimaler",disable_dots:"Deaktiver prikker",display_state:"Vis Tilstand",display_zero:"Vis Nul",display_zero_lines:"Vis Nul Linjer",display_zero_state:"Vis Nultilstand",display_zero_tolerance:"Vis ingen tolerance",double_tap_action:"Dobbelttryk-handling",entity_generator:"Generator",fossil_fuel_percentage:"Fossilt Brændstof",grey_color:"Grå farve",grey_out:"Grået ud",grid:"El-Net",hide:"Skjul",hold_action:"Hold-handling",home:"Hjem",icon_alert:"Ikon for alarm",individual:"Individuel",invert_state:"Omvendt tilstand",inverted_animation:"Omvendt Animation",kilo_decimals:"Decimaler for kilo",kilo_threshold:"Tærskel fra basis til kilo",label_alert:"Etiket til Alarm",max_expected_power:"Maks. forventet effekt",max_flow_rate:"Maks. flowhastighed",min_expected_power:"Min. forventet effekt",min_flow_rate:"Min. flowhastighed",mode:"Tilstand",mega_decimals:"Decimaler for mega",mega_threshold:"Tærskel fra kilo til mega",navigation_path:"Navigationssti",no_color:"Ingen farve",no_labels:"Ingen etiketter",override_state:"Overskriv Tilstand",power_outage:"Strømafbrydelse",production:"Produktion",secondary_info:"Sekundær info",separated:"Adskilte enheder (én enhed til forbrug og én til produktion)",show:"Vis",show_direction:"Vis Retning",show_state_of_charge:"Vis ladningstilstand",solar:"Solenergi",sort_individual_devices:"Sorter individuelle enheder",state_alert:"Alarmtilstand",state_of_charge:"Ladningstilstand",state_of_charge_decimals:"Decimal",state_of_charge_icon:"Ikon",state_of_charge_unit:"Enhed",state_of_charge_unit_white_space:"Tomt mellemrum",state_type:"Tilstande",subtract_individual:"Fratræk individuel",sum_total:"Sum sol og sekundær",tap_action:"Tryk-handling",template:"Skabelon",transparency:"Transparens",unit_of_measurement:"Enhed",unit_white_space:"Enhed tomt mellemrum",use_metadata:"Brug Metadata",use_new_flow_rate_model:"Ny flowhastighedsmodel"},St={card:kt,editor:xt},$t=Object.freeze({__proto__:null,card:kt,default:St,editor:xt}),Et={label:{car:"Car",motorbike:"Motorbike"}},Ct={accept_negative:"Accept Negative",action:"Action",advanced:"Advanced Options",allow_layout_break:"Allow Layout Break",base_decimals:"Base Decimals",battery:"Battery",calculate_flow_rate:"Calculate Flow Rate",circle_animation:"Circle Animation",clickable_entities:"Clickable Entities",color:"Color",color_circle:"Color of Circle",color_dynamically:"Color Dynamically",color_icon:"Color of Icon",color_state_of_charge_value:"Color",color_value:"Color of Value",combined:"Combined Entity (One entity with positive and negative values)",consumption:"Consumption",custom:"Custom",custom_colors:"Custom Colors",dashboard_link:"Dashboard Link",dashboard_link_label:"Dashboard Link Name",decimals:"Decimals",disable_dots:"Disable Dots",display_state:"Display State",display_zero:"Display Zero",display_zero_lines:"Display Zero Lines",display_zero_state:"Display Zero State",display_zero_tolerance:"Display Zero Tolerance",double_tap_action:"Double Tap Action",entity_generator:"Generator",fossil_fuel_percentage:"Fossil Fuel",grey_color:"Grey Color",grey_out:"Grey Out",grid:"Grid",hide:"Hide",hold_action:"Hold Action",home:"Home",icon_alert:"Icon for Alert",individual:"Individual",invert_state:"Invert State",inverted_animation:"Invert Animation",kilo_decimals:"Kilo Decimals",kilo_threshold:"Base to Kilo Threshold",label_alert:"Label for Alert",max_expected_power:"Max Expected Power",max_flow_rate:"Max Flow Rate",min_expected_power:"Min Expected Power",min_flow_rate:"Min Flow Rate",mode:"Mode",mega_decimals:"Mega Decimals",mega_threshold:"Kilo to Mega Threshold",navigation_path:"Navigation Path",no_color:"No Color",no_labels:"No Labels",override_state:"Override State",power_outage:"Power Outage",production:"Production",secondary_info:"Secondary Info",separated:"Separated Entities (One entity for consumption and one for production)",show:"Show",show_direction:"Show Direction",show_state_of_charge:"Show State of Charge",solar:"Solar",sort_individual_devices:"Sort individual devices",state_alert:"State of Alert",state_of_charge:"State of Charge",state_of_charge_decimals:"Decimals",state_of_charge_icon:"Icon",state_of_charge_unit:"Unit",state_of_charge_unit_white_space:"White Space",state_type:"Type of State",subtract_individual:"Subtract Individual",sum_total:"Sum solar and secondary",tap_action:"Tap Action",template:"Template",transparency:"Transparency",unit_of_measurement:"Unit",unit_white_space:"Unit White Space",use_metadata:"Use Metadata",use_new_flow_rate_model:"New Flow Rate Model"},At={card:Et,editor:Ct},Dt=Object.freeze({__proto__:null,card:Et,default:At,editor:Ct}),Pt={label:{car:"Coche",motorbike:"Motocicleta"}},Mt={accept_negative:"Aceptar valores negativos",action:"Acción",advanced:"Opciones Avanzadas",allow_layout_break:"Permitir salto de diseño",base_decimals:"Decimales de base",battery:"Batería",calculate_flow_rate:"Calcular Tasa de Flujo",circle_animation:"Animación de Círculo",clickable_entities:"Entidades Clicables",color:"Color",color_circle:"Color del Círculo",color_dynamically:"Color dinámico",color_icon:"Color del Icono",color_state_of_charge_value:"Color",color_value:"Color del Valor",combined:"Entidad combinada (una entidad con valores positivos y negativos)",consumption:"Consumo",custom:"Personalizado",custom_colors:"Colores personalizados",dashboard_link:"Enlace del Tablero",dashboard_link_label:"Nombre del Enlace del Tablero",decimals:"Decimales",disable_dots:"Desactivar Puntos",display_state:"Mostrar Estado",display_zero:"Mostrar Cero",display_zero_lines:"Mostrar Líneas de Cero",display_zero_state:"Mostrar Estado Cero",display_zero_tolerance:"Tolerancia de Cero",double_tap_action:"Acción de Doble Toque",entity_generator:"Generador",fossil_fuel_percentage:"Combustible Fósil",grey_color:"Color Gris",grey_out:"Gris",grid:"Red eléctrica",hide:"Ocultar",hold_action:"Acción al Mantener",home:"Casa",icon_alert:"Ícono para Alerta",individual:"Individuales",invert_state:"Invertir Estado",inverted_animation:"Animación Invertida",kilo_decimals:"Decimales de kilo",kilo_threshold:"Umbral de base a kilo",label_alert:"Etiqueta para Alerta",max_expected_power:"Potencia Máxima Esperada",max_flow_rate:"Tasa de Flujo Máxima",min_expected_power:"Potencia Mínima Esperada",min_flow_rate:"Tasa de Flujo Mínima",mode:"Modo",mega_decimals:"Decimales de mega",mega_threshold:"Umbral de kilo a mega",navigation_path:"Ruta de Navegación",no_color:"Sin color",no_labels:"Sin etiquetas",override_state:"Sobrescribir Estado",power_outage:"Corte de energía",production:"Producción",secondary_info:"Información secundaria",separated:"Entidades separadas (una entidad de consumo y otra de producción)",show:"Mostrar",show_direction:"Mostrar Dirección",show_state_of_charge:"Mostrar Estado de Carga",solar:"Energía solar",sort_individual_devices:"Ordenar dispositivos individuales",state_alert:"Estado de Alerta",state_of_charge:"Estado de Carga",state_of_charge_decimals:"Decimales",state_of_charge_icon:"Ícono",state_of_charge_unit:"Unidad",state_of_charge_unit_white_space:"Espacio en Blanco",state_type:"Tipo de Estado",subtract_individual:"Restar Individualmente",sum_total:"Sumar solar y secundario",tap_action:"Acción de Toque",template:"Plantilla",transparency:"Transparencia",unit_of_measurement:"Unidad",unit_white_space:"Espacio en Blanco de la Unidad",use_metadata:"Utilizar Metadatos",use_new_flow_rate_model:"Utilizar Nuevo Modelo de Tasa de Flujo"},Tt={card:Pt,editor:Mt},zt=Object.freeze({__proto__:null,card:Pt,default:Tt,editor:Mt}),Ot={label:{car:"Auto",motorbike:"Moottoripyörä"}},Nt={accept_negative:"Hyväksy negatiiviset arvot",action:"Toiminto",advanced:"Lisäasetukset",allow_layout_break:"Salli asettelun rivitys",base_decimals:"Whien desimaalit",battery:"Akku",calculate_flow_rate:"Laske virtausnopeus",circle_animation:"Ympyräanimaatio",clickable_entities:"Napautettavat kohteet",color:"Väri",color_circle:"Ympyrän väri",color_dynamically:"Väri dynaamisesti",color_icon:"Ikonin väri",color_state_of_charge_value:"Väri",color_value:"Arvon väri",combined:"Yhdistetty kokonaisuus (yksi kokonaisuus positiivisilla ja negatiivisilla arvoilla)",consumption:"Kulutus",custom:"Mukautettu",custom_colors:"Mukautetut värit",dashboard_link:"Ohjauspaneelin linkki",dashboard_link_label:"Ohjauspaneelin linkin nimi",decimals:"Desimaalit",disable_dots:"Poista pisteet",display_state:"Näytä tila",display_zero:"Näytä nolla",display_zero_lines:"Näytä nolla-viivat",display_zero_state:"Näytä nolla-tila",display_zero_tolerance:"Näytä nolla-toleranssi",double_tap_action:"Kaksoisnapautustoiminto",entity_generator:"Generaattori",fossil_fuel_percentage:"Fossiilinen polttoaine",grey_color:"Harmaa väri",grey_out:"Harmaa",grid:"Sähköverkko",hide:"Piilota",hold_action:"Pidä painettuna -toiminto",home:"Koti",icon_alert:"Hälytyksen kuvake",individual:"Yksittäinen",invert_state:"Käänteinen tila",inverted_animation:"Käänteinen animaatio",kilo_decimals:"kWhien desimaalit",kilo_threshold:"Whin ja kWhin kynnysarvo",label_alert:"Hälytyksen teksti",max_expected_power:"Ennustettu maksimiteho",max_flow_rate:"Maksimivirtausnopeus",min_expected_power:"Ennustettu minimiteho",min_flow_rate:"Minimivirtausnopeus",mode:"Tila",mega_decimals:"MWhien desimaalit",mega_threshold:"kWhin ja MWhin kynnysarvo",navigation_path:"Navigointipolku",no_color:"Ei väriä",no_labels:"Ei nimiöitä",override_state:"Korvaa tila",power_outage:"Sähkökatkos",production:"Tuotanto",secondary_info:"Toissijaiset tiedot",separated:"Erotetut kokonaisuudet (yksi kulutukseen ja yksi tuotantoon)",show:"Näytä",show_direction:"Näytä suunta",show_state_of_charge:"Näytä varauksen tila",solar:"Aurinko",sort_individual_devices:"Lajittele yksittäiset laitteet",state_alert:"Hälytyksen tila",state_of_charge:"Varauksen tila",state_of_charge_decimals:"Desimaalit",state_of_charge_icon:"Kuvake",state_of_charge_unit:"Yksikkö",state_of_charge_unit_white_space:"Välilyönti",state_type:"Tilan tyyppi",subtract_individual:"Vähennä yksittäinen",sum_total:"Summaa aurinko ja toissijainen",tap_action:"Napauta toimintoa",template:"Malli",transparency:"Läpinäkyvyys",unit_of_measurement:"Yksikkö",unit_white_space:"Yksikön välilyönti",use_metadata:"Käytä metatietoja",use_new_flow_rate_model:"Uusi virtausnopeusmalli"},It={card:Ot,editor:Nt},jt=Object.freeze({__proto__:null,card:Ot,default:It,editor:Nt}),Bt={label:{car:"Voiture",motorbike:"Moto"}},Lt={accept_negative:"Accepter les valeurs négatives",action:"Action",advanced:"Options avancées",allow_layout_break:"Autoriser la rupture de mise en page",base_decimals:"Décimales de base",battery:"Batterie",calculate_flow_rate:"Calculer le débit",circle_animation:"Animation de cercle",clickable_entities:"Entités cliquables",color:"Couleur",color_circle:"Couleur du cercle",color_dynamically:"Couleur dynamique",color_icon:"Couleur de l'icône",color_state_of_charge_value:"Couleur",color_value:"Couleur de la valeur",combined:"Entité combinée (une entité avec des valeurs positives et négatives)",consumption:"Consommation",custom:"Personnalisé",custom_colors:"Couleurs personnalisées",dashboard_link:"Lien du tableau de bord",dashboard_link_label:"Nom du lien du tableau de bord",decimals:"Décimales",disable_dots:"Désactiver les points",display_state:"Afficher l'état",display_zero:"Afficher zéro",display_zero_lines:"Afficher les lignes zéro",display_zero_state:"Afficher l'état zéro",display_zero_tolerance:"Tolérance de l'affichage zéro",double_tap_action:"Action de double tap",entity_generator:"Générateur",fossil_fuel_percentage:"Carburant fossile",grey_color:"Couleur grise",grey_out:"Griser",grid:"Réseau Électrique",hide:"Masquer",hold_action:"Action d'appui long",home:"Domicile",icon_alert:"Icône de l'alerte",individual:"Individuel",invert_state:"Inverser l'état",inverted_animation:"Animation inversée",kilo_decimals:"Décimales de kilo",kilo_threshold:"Seuil de base vers kilo",label_alert:"Libellé de l'alerte",max_expected_power:"Puissance maximale attendue",max_flow_rate:"Débit maximal",min_expected_power:"Puissance minimale attendue",min_flow_rate:"Débit minimal",mode:"Mode",mega_decimals:"Décimales de méga",mega_threshold:"Seuil de kilo vers méga",navigation_path:"Chemin de navigation",no_color:"Aucune couleur",no_labels:"Sans libellés",override_state:"Remplacer l'état",power_outage:"Panne de courant",production:"Production",secondary_info:"Informations secondaires",separated:"Entités séparées (une entité pour la consommation et une pour la production)",show:"Afficher",show_direction:"Afficher la direction",show_state_of_charge:"Afficher l'état de charge",solar:"Solaire",sort_individual_devices:"Trier les appareils individuels",state_alert:"État de l'alerte",state_of_charge:"État de charge",state_of_charge_decimals:"Décimales",state_of_charge_icon:"Icône",state_of_charge_unit:"Unité",state_of_charge_unit_white_space:"Espace blanc de l'unité",state_type:"Type d'état",subtract_individual:"Soustraire l'individuel",sum_total:"Somme solaire et secondaire",tap_action:"Action de tap",template:"Modèle",transparency:"Transparence",unit_of_measurement:"Unité",unit_white_space:"Espace blanc de l'unité",use_metadata:"Utiliser les métadonnées",use_new_flow_rate_model:"Nouveau modèle de débit"},Rt={card:Bt,editor:Lt},Ht=Object.freeze({__proto__:null,card:Bt,default:Rt,editor:Lt}),Ut={label:{car:"कार",motorbike:"मोटरसाइकिल"}},Ft={accept_negative:"नकारात्मक स्वीकार करें",action:"क्रिया",advanced:"उन्नत विकल्प",allow_layout_break:"लेआउट तोड़ने की अनुमति दें",base_decimals:"बेस दशमलव",battery:"बैटरी",calculate_flow_rate:"प्रवाह दर की गणना करें",circle_animation:"सर्कल एनिमेशन",clickable_entities:"क्लिक करने योग्य इकाइयाँ",color:"रंग",color_circle:"सर्कल का रंग",color_dynamically:"गतिशील रंग",color_icon:"आइकन का रंग",color_state_of_charge_value:"रंग",color_value:"मान का रंग",combined:"संयुक्त इकाई (सकारात्मक और नकारात्मक मानों के साथ)",consumption:"उपभोग",custom:"कस्टम",custom_colors:"कस्टम रंग",dashboard_link:"डैशबोर्ड लिंक",dashboard_link_label:"डैशबोर्ड लिंक नाम",decimals:"दशमलव",disable_dots:"डॉट्स अक्षम करें",display_state:"स्थिति दिखाएँ",display_zero:"शून्य दिखाएँ",display_zero_lines:"शून्य रेखाएँ दिखाएँ",display_zero_state:"शून्य स्थिति दिखाएँ",display_zero_tolerance:"शून्य सहिष्णुता दिखाएँ",double_tap_action:"डबल टैप क्रिया",entity_generator:"जनरेटर",fossil_fuel_percentage:"जीवाश्म ईंधन",grey_color:"धूसर रंग",grey_out:"धूसर करें",grid:"ग्रिड",hide:"छुपाएँ",hold_action:"होल्ड क्रिया",home:"घर",icon_alert:"अलर्ट के लिए आइकन",individual:"व्यक्तिगत",invert_state:"स्थिति उलटें",inverted_animation:"एनिमेशन उलटें",kilo_decimals:"किलो दशमलव",kilo_threshold:"बेस से किलो सीमा",label_alert:"अलर्ट के लिए लेबल",max_expected_power:"अधिकतम अपेक्षित शक्ति",max_flow_rate:"अधिकतम प्रवाह दर",min_expected_power:"न्यूनतम अपेक्षित शक्ति",min_flow_rate:"न्यूनतम प्रवाह दर",mode:"मोड",mega_decimals:"मेगा दशमलव",mega_threshold:"किलो से मेगा सीमा",navigation_path:"नेविगेशन पथ",no_color:"कोई रंग नहीं",no_labels:"कोई लेबल नहीं",override_state:"स्थिति ओवरराइड करें",power_outage:"बिजली गुल",production:"उत्पादन",secondary_info:"द्वितीयक जानकारी",separated:"अलग-अलग इकाइयाँ (उपभोग और उत्पादन के लिए)",show:"दिखाएँ",show_direction:"दिशा दिखाएँ",show_state_of_charge:"चार्ज की स्थिति दिखाएँ",solar:"सौर ऊर्जा",sort_individual_devices:"व्यक्तिगत डिवाइस क्रमबद्ध करें",state_alert:"अलर्ट की स्थिति",state_of_charge:"चार्ज की स्थिति",state_of_charge_decimals:"दशमलव",state_of_charge_icon:"आइकन",state_of_charge_unit:"इकाई",state_of_charge_unit_white_space:"स्पेस",state_type:"स्थिति प्रकार",subtract_individual:"व्यक्तिगत घटाएँ",sum_total:"सौर और द्वितीयक का योग",tap_action:"टैप क्रिया",template:"टेम्पलेट",transparency:"पारदर्शिता",unit_of_measurement:"माप की इकाई",unit_white_space:"यूनिट स्पेस",use_metadata:"मेटाडेटा का उपयोग करें",use_new_flow_rate_model:"नया प्रवाह दर मॉडल"},Gt={card:Ut,editor:Ft},Vt=Object.freeze({__proto__:null,card:Ut,default:Gt,editor:Ft}),Wt={label:{car:"Auto",motorbike:"Motocicletta"}},Zt={accept_negative:"Accetta Valori Negativi",action:"Azione",advanced:"Opzioni Avanzate",allow_layout_break:"Consenti interruzione del layout",base_decimals:"Decimali di base",battery:"Batteria",calculate_flow_rate:"Calcola Tasso di Flusso",circle_animation:"Animazione Cerchio",clickable_entities:"Entità Cliccabili",color:"Colore",color_circle:"Colore del Cerchio",color_dynamically:"Colore dinamico",color_icon:"Colore dell'Icona",color_state_of_charge_value:"Colore",color_value:"Colore del Valore",combined:"Entità combinata (un'entità con valori positivi e negativi)",consumption:"Consumo",custom:"Personalizzato",custom_colors:"Colori personalizzati",dashboard_link:"Collegamento Dashboard",dashboard_link_label:"Nome Collegamento Dashboard",decimals:"Decimali",disable_dots:"Disabilita Punti",display_state:"Mostra Stato",display_zero:"Mostra Zero",display_zero_lines:"Mostra Linee Zero",display_zero_state:"Mostra Stato Zero",display_zero_tolerance:"Tolleranza dello Zero",double_tap_action:"Azione al doppio tocco",entity_generator:"Generatore",fossil_fuel_percentage:"Carburante Fossile",grey_color:"Colore Sfumato",grey_out:"Sfuma",grid:"Rete Elettrica",hide:"Nascondi",hold_action:"Azione alla pressione prolungata",home:"Casa",icon_alert:"Icona per l'Allarme",individual:"Individuale",invert_state:"Inverti Stato",inverted_animation:"Animazione Invertita",kilo_decimals:"Decimali di chilo",kilo_threshold:"Soglia da base a chilo",label_alert:"Etichetta per l'Allarme",max_expected_power:"Potenza Massima Prevista",max_flow_rate:"Tasso di Flusso Massimo",min_expected_power:"Potenza Minima Prevista",min_flow_rate:"Tasso di Flusso Minimo",mode:"Modalità",mega_decimals:"Decimali di mega",mega_threshold:"Soglia da chilo a mega",navigation_path:"Percorso di navigazione",no_color:"Nessun colore",no_labels:"Senza etichette",override_state:"Sovrascrivi Stato",power_outage:"Interruzione di corrente",production:"Produzione",secondary_info:"Informazioni secondarie",separated:"Entità separate (Un'entità per il consumo e una per la produzione)",show:"Mostra",show_direction:"Mostra Direzione",show_state_of_charge:"Mostra Stato di Carica",solar:"Solare",sort_individual_devices:"Ordina i singoli individuale",state_alert:"Stato dell'Allarme",state_of_charge:"Stato di Carica",state_of_charge_decimals:"Decimali",state_of_charge_icon:"Icona",state_of_charge_unit:"Unità",state_of_charge_unit_white_space:"Spazio Bianco",state_type:"Tipo di Stato",subtract_individual:"Sottrai Individualmente",sum_total:"Somma solare e secondaria",tap_action:"Azione al tocco",template:"Modello",transparency:"Trasparenza",unit_of_measurement:"Unità",unit_white_space:"Spazio Bianco Unità",use_metadata:"Utilizza Metadati",use_new_flow_rate_model:"Utilizza Nuovo Modello di Tasso di Flusso"},Yt={card:Wt,editor:Zt},Xt=Object.freeze({__proto__:null,card:Wt,default:Yt,editor:Zt}),qt={label:{car:"Auto",motorbike:"Motorfiets"}},Kt={accept_negative:"Negatieve waarden accepteren",action:"Actie",advanced:"Geavanceerde Opties",allow_layout_break:"Lay-out doorbreken toestaan",base_decimals:"Decimalen voor basis",battery:"Batterij",calculate_flow_rate:"Stroomsnelheid Berekenen",circle_animation:"Cirkel Animatie",clickable_entities:"Klikbare Entiteiten",color:"Kleur",color_circle:"Kleur van Cirkel",color_dynamically:"Kleur dynamisch",color_icon:"Kleur van Pictogram",color_state_of_charge_value:"Kleur",color_value:"Kleur van Waarde",combined:"Gecombineerde entiteit (één entiteit met positieve en negatieve waarden)",consumption:"Verbruik",custom:"Aangepast",custom_colors:"Aangepaste kleuren",dashboard_link:"Dashboard-link",dashboard_link_label:"Naam van Dashboard Link",decimals:"Decimalen",disable_dots:"Punten Uitschakelen",display_state:"Toestand Weergeven",display_zero:"Nul Weergeven",display_zero_lines:"Nullijnen Weergeven",display_zero_state:"Nul Toestand Weergeven",display_zero_tolerance:"Nultolerantie Weergeven",double_tap_action:"Dubbel tik actie",entity_generator:"Generator",fossil_fuel_percentage:"Fossiele Brandstof",grey_color:"Grijstint",grey_out:"Grijstint",grid:"Elektriciteitsnet",hide:"Verbergen",hold_action:"Ingedrukt houden actie",home:"Thuis",icon_alert:"Pictogram voor Alarm",individual:"Individueel",invert_state:"Toestand Omkeren",inverted_animation:"Animatie Omkeren",kilo_decimals:"Decimalen voor kilo",kilo_threshold:"Drempel van basis naar kilo",label_alert:"Label voor Alarm",max_expected_power:"Maximaal Verwacht Vermogen",max_flow_rate:"Maximale Stroomsnelheid",min_expected_power:"Minimaal Verwacht Vermogen",min_flow_rate:"Minimale Stroomsnelheid",mode:"Modus",mega_decimals:"Decimalen voor mega",mega_threshold:"Drempel van kilo naar mega",navigation_path:"Navigatiepad",no_color:"Geen kleur",no_labels:"Geen labels",override_state:"Toestand Overschrijven",power_outage:"Stroomuitval",production:"Productie",secondary_info:"Secundaire informatie",separated:"Gescheiden entiteiten (één entiteit voor consumptie en één voor productie)",show:"Weergeven",show_direction:"Richting Weergeven",show_state_of_charge:"Laadstatus Weergeven",solar:"Zonne-energie",sort_individual_devices:"Sorteer individuele apparaten",state_alert:"Toestand van Alarm",state_of_charge:"Laadstatus",state_of_charge_decimals:"Decimalen",state_of_charge_icon:"Pictogram",state_of_charge_unit:"Eenheid",state_of_charge_unit_white_space:"Spaties",state_type:"Type Toestand",subtract_individual:"Individueel Aftrekken",sum_total:"Som van zon en secundair",tap_action:"Tik Actie",template:"Sjabloon",transparency:"Transparantie",unit_of_measurement:"Eenheid",unit_white_space:"Eenheid Spaties",use_metadata:"Metadata Gebruiken",use_new_flow_rate_model:"Nieuw Stroomsnelheid Model Gebruiken"},Jt={card:qt,editor:Kt},Qt=Object.freeze({__proto__:null,card:qt,default:Jt,editor:Kt}),eo={label:{car:"Samochód",motorbike:"Motocykl"}},to={accept_negative:"Akceptuj wartości ujemne",action:"Akcja",advanced:"Zaawansowane opcje",allow_layout_break:"Zezwól na łamanie układu",base_decimals:"Miejsca po przecinku dla podstawy",battery:"Bateria",calculate_flow_rate:"Oblicz wskaźnik przepływu",circle_animation:"Animacja okręgu",clickable_entities:"Klikalne jednostki",color:"Kolor",color_circle:"Kolor okręgu",color_dynamically:"Kolor dynamicznie",color_icon:"Kolor ikony",color_state_of_charge_value:"Kolor",color_value:"Kolor wartości",combined:"Jednostka połączona (jedna jednostka z wartościami dodatnimi i ujemnymi)",consumption:"Zużycie",custom:"Niestandardowy",custom_colors:"Kolory niestandardowe",dashboard_link:"Link do panelu",dashboard_link_label:"Nazwa linku do panelu",decimals:"Miejsca po przecinku",disable_dots:"Wyłącz kropki",display_state:"Wyświetl stan",display_zero:"Wyświetl zero",display_zero_lines:"Wyświetl linie zera",display_zero_state:"Wyświetl stan zera",display_zero_tolerance:"Wyświetl tolerancję zera",double_tap_action:"Akcja podwójnego dotknięcia",entity_generator:"Generator",fossil_fuel_percentage:"Paliwo kopalne",grey_color:"Kolor szary",grey_out:"Szary",grid:"Sieć elektryczna",hide:"Ukryj",hold_action:"Akcja przytrzymania",home:"Dom",icon_alert:"Ikona alertu",individual:"Indywidualne",invert_state:"Odwróć stan",inverted_animation:"Odwróć animację",kilo_decimals:"Miejsca po przecinku dla kilo",kilo_threshold:"Próg z podstawy na kilo",label_alert:"Etykieta alertu",max_expected_power:"Maksymalna oczekiwana moc",max_flow_rate:"Maksymalna szybkość przepływu",min_expected_power:"Minimalna oczekiwana moc",min_flow_rate:"Minimalna szybkość przepływu",mode:"Tryb",mega_decimals:"Miejsca po przecinku dla mega",mega_threshold:"Próg z kilo na mega",navigation_path:"Ścieżka nawigacji",no_color:"Bez koloru",no_labels:"Bez etykiet",override_state:"Nadpisanie stanu",power_outage:"Brak prądu",production:"Produkcja",secondary_info:"Informacje dodatkowe",separated:"Oddzielne podmioty (jeden podmiot do konsumpcji i jeden do produkcji)",show:"Pokaż",show_direction:"Pokaż kierunek",show_state_of_charge:"Pokaż stan naładowania",solar:"Energia słoneczna",sort_individual_devices:"Sortuj poszczególne urządzenia",state_alert:"Stan alertu",state_of_charge:"Stan naładowania",state_of_charge_decimals:"Miejsca po przecinku",state_of_charge_icon:"Ikona",state_of_charge_unit:"Jednostka",state_of_charge_unit_white_space:"Spacja jednostki",state_type:"Typ stanu",subtract_individual:"Odjęcie indywidualne",sum_total:"Zsumuj słoneczne i dodatkowe",tap_action:"Akcja dotknięcia",template:"Szablon",transparency:"Przezroczystość",unit_of_measurement:"Jednostka",unit_white_space:"Spacja jednostki",use_metadata:"Użyj metadanych",use_new_flow_rate_model:"Nowy model wskaźnika przepływu"},oo={card:eo,editor:to},io=Object.freeze({__proto__:null,card:eo,default:oo,editor:to}),ao={label:{car:"Carro",motorbike:"Mota"}},no={accept_negative:"Aceitar Valores Negativos",action:"Ação",advanced:"Opções Avançadas",allow_layout_break:"Permitir quebra de layout",base_decimals:"Casas decimais da base",battery:"Bateria",calculate_flow_rate:"Calcular Taxa de Fluxo",circle_animation:"Animação de Círculo",clickable_entities:"Entidades Clicáveis",color:"Cor",color_circle:"Cor do Círculo",color_dynamically:"Cor dinâmica",color_icon:"Cor do Ícone",color_state_of_charge_value:"Cor",color_value:"Cor do Valor",combined:"Entidade combinada (uma entidade com valores positivos e negativos)",consumption:"Consumo",custom:"Personalizado",custom_colors:"Cores personalizadas",dashboard_link:"Link do Painel",dashboard_link_label:"Nome do Link do Painel",decimals:"Casas Decimais",disable_dots:"Desativar Pontos",display_state:"Exibir Estado",display_zero:"Exibir Zero",display_zero_lines:"Exibir Linhas Zero",display_zero_state:"Exibir Estado Zero",display_zero_tolerance:"Tolerância de Zero",double_tap_action:"Ação de Toque Duplo",entity_generator:"Gerador",fossil_fuel_percentage:"Combustíveis Fósseis",grey_color:"Cor do Cinza",grey_out:"Cinza",grid:"Rede",hide:"Esconder",hold_action:"Ação ao Segurar",home:"Casa",icon_alert:"Ícone para Alerta",individual:"Individuais",invert_state:"Inverter Estado",inverted_animation:"Animação Invertida",kilo_decimals:"Casas decimais de quilo",kilo_threshold:"Limiar de base para quilo",label_alert:"Rótulo para Alerta",max_expected_power:"Potência Máxima Esperada",max_flow_rate:"Taxa de Fluxo Máxima",min_expected_power:"Potência Mínima Esperada",min_flow_rate:"Taxa de Fluxo Mínima",mode:"Modo",mega_decimals:"Casas decimais de mega",mega_threshold:"Limiar de quilo para mega",navigation_path:"Caminho de Navegação",no_color:"Sem cor",no_labels:"Sem rótulos",override_state:"Substituir Estado",power_outage:"Falta de energia",production:"Produção",secondary_info:"Informação Secundária",separated:"Entidades Separadas (Uma entidade para consumo e outra para produção)",show:"Mostrar",show_direction:"Mostrar Direção",show_state_of_charge:"Exibir Estado de Carga",solar:"Energia solar",sort_individual_devices:"Classifique dispositivos individuais",state_alert:"Estado do Alerta",state_of_charge:"Estado de Carga",state_of_charge_decimals:"Casas Decimais",state_of_charge_icon:"Ícone",state_of_charge_unit:"Unidade",state_of_charge_unit_white_space:"Espaçamento",state_type:"Tipo de Estado",subtract_individual:"Subtrair Individualmente",sum_total:"Somar solar e secundário",tap_action:"Ação de Toque",template:"Modelo",transparency:"Transparência",unit_of_measurement:"Unidade",unit_white_space:"Espaçamento da Unidade",use_metadata:"Utilizar Metadados",use_new_flow_rate_model:"Utilizar Novo Modelo de Velocidade"},ro={card:ao,editor:no},so=Object.freeze({__proto__:null,card:ao,default:ro,editor:no}),lo={label:{car:"Carro",motorbike:"Mota"}},co={accept_negative:"Aceitar Valores Negativos",action:"Ação",advanced:"Opções Avançadas",allow_layout_break:"Permitir quebra de layout",base_decimals:"Casas decimais da base",battery:"Bateria",calculate_flow_rate:"Calcular Taxa de Fluxo",circle_animation:"Animação de Círculo",clickable_entities:"Entidades Clicáveis",color:"Cor",color_circle:"Cor do Círculo",color_dynamically:"Cor dinâmica",color_icon:"Cor do Ícone",color_state_of_charge_value:"Cor",color_value:"Cor do Valor",combined:"Entidade combinada (uma entidade com valores positivos e negativos)",consumption:"Consumo",custom:"Personalizado",custom_colors:"Cores personalizadas",dashboard_link:"Link do Painel de Controlo",dashboard_link_label:"Nome do Link do Painel de Controlo",decimals:"Casas Decimais",disable_dots:"Desativar Pontos",display_state:"Mostrar Estado",display_zero:"Mostrar Zero",display_zero_lines:"Mostrar Linhas Zero",display_zero_state:"Mostrar Estado Zero",display_zero_tolerance:"Tolerância do Zero",double_tap_action:"Ação de Toque Duplo",entity_generator:"Gerador",fossil_fuel_percentage:"Combustíveis Fósseis",grey_color:"Cor Cinzenta",grey_out:"Cinzento",grid:"Rede",hide:"Esconder",hold_action:"Ação ao Segurar",home:"Casa",icon_alert:"Ícone para Alerta",individual:"Individuais",invert_state:"Inverter Estado",inverted_animation:"Animação Invertida",kilo_decimals:"Casas decimais de quilo",kilo_threshold:"Limiar de base para quilo",label_alert:"Nome para Alerta",max_expected_power:"Potência Máxima Esperada",max_flow_rate:"Taxa de Fluxo Máxima",min_expected_power:"Potência Mínima Esperada",min_flow_rate:"Taxa de Fluxo Mínima",mode:"Modo",mega_decimals:"Casas decimais de mega",mega_threshold:"Limiar de quilo para mega",navigation_path:"Caminho de Navegação",no_color:"Sem cor",no_labels:"Sem etiquetas",override_state:"Substituir Estado",power_outage:"Falta de energia",production:"Produção",secondary_info:"Informação Secundária",separated:"Entidades Separadas (Uma entidade para consumo e outra para produção)",show:"Mostrar",show_direction:"Mostrar Direção",show_state_of_charge:"Mostrar Estado de Carga",solar:"Energia solar",sort_individual_devices:"Classifique dispositivos individuais",state_alert:"Estado do Alerta",state_of_charge:"Estado de Carga",state_of_charge_decimals:"Casas Decimais",state_of_charge_icon:"Ícone",state_of_charge_unit:"Unidade",state_of_charge_unit_white_space:"Espaçamento",state_type:"Tipo de Estado",subtract_individual:"Subtrair Individualmente",sum_total:"Somar solar e secundário",tap_action:"Ação de Toque",template:"Modelo",transparency:"Transparência",unit_of_measurement:"Unidade",unit_white_space:"Espaçamento da Unidade",use_metadata:"Utilizar Metadados",use_new_flow_rate_model:"Utilizar Novo Modelo de Velocidade"},uo={card:lo,editor:co},ho={label:{car:"Автомобиль",motorbike:"Мотоцикл"}},po={accept_negative:"Принять отрицательные значения",action:"Действие",advanced:"Расширенные настройки",allow_layout_break:"Разрешить разрыв макета",base_decimals:"Десятичные базовые",battery:"Батарея",calculate_flow_rate:"Рассчитать скорость потока",circle_animation:"Анимация круга",clickable_entities:"Кликабельные сущности",color:"Цвет",color_circle:"Цвет круга",color_dynamically:"Цвет динамически",color_icon:"Цвет иконки",color_state_of_charge_value:"Цвет",color_value:"Цвет значения",combined:"Комбинированный объект (один объект с положительными и отрицательными значениями)",consumption:"Потребление",custom:"Пользовательский",custom_colors:"Пользовательские цвета",dashboard_link:"Ссылка на панель управления",dashboard_link_label:"Название ссылки на панель управления",decimals:"Десятичные",disable_dots:"Отключить точки",display_state:"Отображать состояние",display_zero:"Отображать ноль",display_zero_lines:"Отображать нулевые линии",display_zero_state:"Отображать состояние нуля",display_zero_tolerance:"Допустимая погрешность нуля",double_tap_action:"действие двойного касания",entity_generator:"Генератор",fossil_fuel_percentage:"Полный объем ископаемого топлива",grey_color:"Серый цвет",grey_out:"Серый",grid:"Электрическая сеть",hide:"Скрыть",hold_action:"действие удержания",home:"Домашняя",icon_alert:"Иконка для предупреждения",individual:"Индивидуальная",invert_state:"Инвертировать состояние",inverted_animation:"Инвертированная анимация",kilo_decimals:"Десятичные кило",kilo_threshold:"Пороговое значение базового в кило",label_alert:"Метка для предупреждения",max_expected_power:"Максимальная ожидаемая мощность",max_flow_rate:"Максимальная скорость потока",min_expected_power:"Минимальная ожидаемая мощность",min_flow_rate:"Минимальная скорость потока",mode:"Режим",mega_decimals:"Десятичные мега",mega_threshold:"Пороговое значение кило в мега",navigation_path:"путь навигации",no_color:"Без цвета",no_labels:"Без подписей",override_state:"Переопределить состояние",power_outage:"Отключение электричества",production:"Производство",secondary_info:"Вторичная информация",separated:"Отдельные объекты (один объект для потребления и один для производства)",show:"Показать",show_direction:"Показать направление",show_state_of_charge:"Показать уровень заряда",solar:"Солнечная",sort_individual_devices:"Сортировка отдельных устройств",state_alert:"Состояние предупреждения",state_of_charge:"Уровень заряда",state_of_charge_decimals:"Десятичные",state_of_charge_icon:"Иконка",state_of_charge_unit:"Единица измерения",state_of_charge_unit_white_space:"Пробел",state_type:"Тип состояния",subtract_individual:"Вычесть индивидуально",sum_total:"Суммировать солнечную и вторичную",tap_action:"действие касания",template:"Шаблон",transparency:"Прозрачность",unit_of_measurement:"Единица измерения",unit_white_space:"Пробел единицы измерения",use_metadata:"Использовать метаданные",use_new_flow_rate_model:"Использовать новую модель скорости потока"},_o={card:ho,editor:po},mo={label:{car:"Auto",motorbike:"Motorka"}},fo={accept_negative:"Povoliť záporné hodnoty",action:"Akcia",advanced:"Pokročilé nastavenia",allow_layout_break:"Povoliť zalomenie rozloženia",base_decimals:"Desatinné miesta pre základ",battery:"Batéria",calculate_flow_rate:"Počítať prietok",circle_animation:"Kruhová animácia",clickable_entities:"Entity, na ktoré sa dá kliknúť",color:"Farba",color_circle:"Farba kruhu",color_dynamically:"Farba dynamicky",color_icon:"Farba ikony",color_state_of_charge_value:"Farba",color_value:"Farba hodnoty",combined:"Kombinovaná entita (jedna entita s kladnými a zápornými hodnotami)",consumption:"Spotreba",custom:"Voliteľné",custom_colors:"Vlastné farby",dashboard_link:"Odkaz na informačný panel",dashboard_link_label:"Názov odkazu na informačný panel",decimals:"Desatinné",disable_dots:"Vypnúť bodky",display_state:"Zobraziť stav",display_zero:"Zobraziť nulu",display_zero_lines:"Zobraziť nulové riadky",display_zero_state:"Zobrazenie nulového stavu",display_zero_tolerance:"Zobraziť nulovú toleranciu",double_tap_action:"Akcia pri dvojitom klepnutí",entity_generator:"Generátor",fossil_fuel_percentage:"Fosílne palivo",grey_color:"Šedá farba",grey_out:"Zosiviť",grid:"Sieť",hide:"Skryť",hold_action:"Akcia pri podržaní",home:"Doma",icon_alert:"Ikona pre upozornenie",individual:"Individuálne",invert_state:"Invertovať stav",inverted_animation:"Invertovať animáciu",kilo_decimals:"Desatinné miesta pre kilo",kilo_threshold:"Prah zo základu na kilo",label_alert:"Štítok pre upozornenie",max_expected_power:"Max očakávaný výkon",max_flow_rate:"Max prietok",min_expected_power:"Min očakávaný výkon",min_flow_rate:"Min prietok",mode:"Mód",mega_decimals:"Desatinné miesta pre mega",mega_threshold:"Prah z kila na mega",navigation_path:"Navigačná cesta",no_color:"Bez farby",no_labels:"Bez popisov",override_state:"Prepísať stav",power_outage:"Výpadok",production:"Výroba",secondary_info:"Sekundárne informácie",separated:"Oddelené subjekty (jeden subjekt pre spotrebu a jeden pre výrobu)",show:"Zobraziť",show_direction:"Zobraziť smer",show_state_of_charge:"Zobraziť stav nabitia",solar:"Solárne",sort_individual_devices:"Zoraďte jednotlivé zariadenia",state_alert:"Stav upozornenia",state_of_charge:"Stav nabitia",state_of_charge_decimals:"Desatinné",state_of_charge_icon:"Ikona",state_of_charge_unit:"Jednotky",state_of_charge_unit_white_space:"Biela plocha",state_type:"Typ stavu",subtract_individual:"Odčítať individuálne",sum_total:"Sčítať solárne a sekundárne",tap_action:"Akcia po klepnutí",template:"Šablóna",transparency:"Transparentnosť",unit_of_measurement:"Jednotka",unit_white_space:"Jednotka bielej plochy",use_metadata:"Použiť Metadata",use_new_flow_rate_model:"Nový model prietoku"},go={card:mo,editor:fo},yo={label:{car:"Bil",motorbike:"Motorcykel"}},vo={accept_negative:"Acceptera negativa värden",action:"Åtgärd",advanced:"Avancerade inställningar",allow_layout_break:"Tillåt layoutbrytning",base_decimals:"Decimaler för bas",battery:"Batteri",calculate_flow_rate:"Beräkna flöde",circle_animation:"Cirkelanimation",clickable_entities:"Klickbara entiteter",color:"Färg",color_circle:"Cirkelfärg",color_dynamically:"Färg dynamiskt",color_icon:"Ikonfärg",color_state_of_charge_value:"Färg",color_value:"Färg på värde",combined:"Sammansatt entitet (en entitet med postitiva och negativa värden)",consumption:"Konsumtion",custom:"Anpassad",custom_colors:"Anpassade färger",dashboard_link:"Länk till kontrollpanel",dashboard_link_label:"Länknamn till kontrollpanel",decimals:"Decimaler",disable_dots:"Avaktivera punkter",display_state:"Visningsläge",display_zero:"Visa vid nollvärde",display_zero_lines:"Vising av inaktiva linjer",display_zero_state:"Visning vid noll",display_zero_tolerance:"Tolerans för nollvärde",double_tap_action:"Dubbeltrycksåtgärd",entity_generator:"Generator",fossil_fuel_percentage:"Fossilt bränsle",grey_color:"Grå färg",grey_out:"Utgråad",grid:"Nät",hide:"Dölj",hold_action:"Hålltrycksåtgärd",home:"Hem",icon_alert:"Varningsikon",individual:"Individuell",invert_state:"Invertera status",inverted_animation:"Reversera animation",kilo_decimals:"Decimaler för kilo",kilo_threshold:"Tröskel från bas till kilo",label_alert:"Varningsetikett",max_expected_power:"Maximal förväntad effekt",max_flow_rate:"Maximalt flöde",min_expected_power:"Minimal förväntad effekt",min_flow_rate:"Minimalt flöde",mode:"Läge",mega_decimals:"Decimaler för mega",mega_threshold:"Tröskel från kilo till mega",navigation_path:"Navigationsväg",no_color:"Ingen färg",no_labels:"Inga etiketter",override_state:"Använd entitetsvärde",power_outage:"Strömavbrott",production:"Produktion",secondary_info:"Sekundär information",separated:"Separata entiteter (en entitet för konsumtion och en för produktion)",show:"Visa",show_direction:"Visa riktning",show_state_of_charge:"Visa laddningsnivå",solar:"Sol",sort_individual_devices:"Sortera enskilda enheter",state_alert:"Status vid strömavbrott",state_of_charge:"Laddningsnivå",state_of_charge_decimals:"Decimaler",state_of_charge_icon:"Ikon",state_of_charge_unit:"Enhet",state_of_charge_unit_white_space:"Mellanrum före enhet",state_type:"Statustyp",subtract_individual:"Individuell avräkning",sum_total:"Summera sol och sekundär",tap_action:"Tryckåtgärd",template:"Mall",transparency:"Transparens",unit_of_measurement:"Enhet",unit_white_space:"Mellanrum före enhet",use_metadata:"Använd metadata",use_new_flow_rate_model:"Ny flödesmodell"},bo={card:yo,editor:vo},wo={label:{car:"Автомобіль",motorbike:"Мотоцикл"}},ko={accept_negative:"Дозволити від’ємні значення",action:"Дія",advanced:"Розширені параметри",allow_layout_break:"Дозволити розрив макета",base_decimals:"Десяткові знаки для бази",battery:"Акумулятор",calculate_flow_rate:"Розраховувати швидкість потоку",circle_animation:"Анімація кола",clickable_entities:"Клікабельні сутності",color:"Колір",color_circle:"Колір кола",color_dynamically:"Колір динамічно",color_icon:"Колір іконки",color_state_of_charge_value:"Колір заряду",color_value:"Колір значення",combined:"Об’єднана сутність (одна сутність із позитивними та негативними значеннями)",consumption:"Споживання",custom:"Користувацький",custom_colors:"Власні кольори",dashboard_link:"Посилання на дашборд",dashboard_link_label:"Назва посилання на дашборд",decimals:"Кількість десяткових знаків",disable_dots:"Вимкнути точки",display_state:"Показувати стан",display_zero:"Показувати нульові значення",display_zero_lines:"Показувати лінії з нульовим значенням",display_zero_state:"Показувати стан при нулі",display_zero_tolerance:"Допуск для нульових значень",double_tap_action:"Дія при подвійному натисканні",entity_generator:"Генератор сутностей",fossil_fuel_percentage:"Частка викопного палива",grey_color:"Колір затемнення",grey_out:"Затемнити неактивні",grid:"Мережа",hide:"Приховати",hold_action:"Дія при утриманні",home:"Дім",icon_alert:"Іконка сповіщення",individual:"Окремо",invert_state:"Інвертувати стан",inverted_animation:"Інвертована анімація",kilo_decimals:"Десяткові знаки для кіло",kilo_threshold:"Поріг переходу база → кіло",label_alert:"Мітка сповіщення",max_expected_power:"Максимальна очікувана потужність",max_flow_rate:"Максимальна швидкість потоку",min_expected_power:"Мінімальна очікувана потужність",min_flow_rate:"Мінімальна швидкість потоку",mode:"Режим",mega_decimals:"Десяткові знаки для мега",mega_threshold:"Поріг переходу кіло → мега",navigation_path:"Шлях переходу",no_color:"Без кольору",no_labels:"Без підписів",override_state:"Перевизначити стан",power_outage:"Відключення живлення",production:"Виробництво",secondary_info:"Додаткова інформація",separated:"Розділені сутності (окрема для споживання та окрема для виробництва)",show:"Показати",show_direction:"Показувати напрямок",show_state_of_charge:"Показувати рівень заряду",solar:"Сонячна енергія",sort_individual_devices:"Сортувати окремі пристрої",state_alert:"Стан сповіщення",state_of_charge:"Рівень заряду",state_of_charge_decimals:"Десяткові знаки заряду",state_of_charge_icon:"Іконка заряду",state_of_charge_unit:"Одиниця виміру заряду",state_of_charge_unit_white_space:"Пробіл одиниці виміру заряду",state_type:"Тип стану",subtract_individual:"Віднімати індивідуальні значення",sum_total:"Сумувати сонячну та вторинну",tap_action:"Дія при натисканні",template:"Шаблон",transparency:"Прозорість",unit_of_measurement:"Одиниця виміру",unit_white_space:"Пробіл між числом і одиницею",use_metadata:"Використовувати метадані",use_new_flow_rate_model:"Новий алгоритм швидкості потоку"},xo={card:wo,editor:ko};const So={ca:pt,cs:gt,en:Dt,de:wt,dk:$t,pt:Object.freeze({__proto__:null,card:lo,default:uo,editor:co}),pt_BR:so,es:zt,nl:Qt,it:Xt,fr:Ht,ru:Object.freeze({__proto__:null,card:ho,default:_o,editor:po}),fi:jt,pl:io,sk:Object.freeze({__proto__:null,card:mo,default:go,editor:fo}),sv:Object.freeze({__proto__:null,card:yo,default:bo,editor:vo}),hi:Vt,ua:Object.freeze({__proto__:null,card:wo,default:xo,editor:ko})};function $o(e,t){try{return e.split(".").reduce((e,t)=>e[t],So[t])}catch{return}}function Eo(e){let t=$o(e,(localStorage.getItem("selectedLanguage")||"en").replace(/['"]+/g,"").replace("-","_"));return t||(t=$o(e,"en")),t??e}const Co=(e,t)=>!!e.entities[t]?.invert_state,Ao=e=>Math.abs(Math.min(e,0)),Do=e=>Math.max(e,0),Po=(e,t,o)=>{const i=t.entities?.[o]?.secondary_info?.entity;if("string"!=typeof i)return null;const a=e.states[d(i)];if(!a)return null;const n=a.state;return p(n)?Number(n):n},Mo=(e,t,o)=>{const i=t.entities[o]?.entity;if(void 0===i)return null;if("string"==typeof i){const a=nt(e,i);return Co(t,o)?Do(a):Ao(a)}return nt(e,i.production)},To=(e,t,o)=>{const i=t.entities[o]?.entity;if(void 0===i)return null;if("string"==typeof i){const a=nt(e,i);return Co(t,o)?Ao(a):Do(a)}return nt(e,i.consumption)},zo=(e,t)=>{const o=t.entities.battery?.state_of_charge;return void 0===o?null:it(e,o)},Oo=(e,t)=>Mo(e,t,"battery"),No=(e,t)=>To(e,t,"battery"),Io=(e,t)=>To(e,t,"grid"),jo=(e,t)=>Po(e,t,"grid"),Bo=(e,t)=>Po(e,t,"home"),Lo=(e,t)=>{if(t&&Qe(e,t))return e.states[d(t)];ot(t)},Ro=(e,t,o)=>t?.icon?t.icon:t?.use_metadata?"string"==typeof t?.entity?Lo(e,t?.entity)?.attributes?.icon||o:Lo(e,t?.entity?.consumption)?.attributes?.icon||Lo(e,t?.entity?.production)?.attributes?.icon||o:o,Ho=(e,t,o)=>t?.name?t.name:t?.use_metadata?"string"==typeof t?.entity?Lo(e,t.entity)?.attributes?.friendly_name||o:Lo(e,t?.entity?.consumption)?.attributes?.friendly_name||Lo(e,t?.entity?.production)?.attributes?.friendly_name||o:o,Uo=["K","M","G","T","P","E","Z","Y"],Fo=(e,t)=>{const o=t.toUpperCase().slice(0,1),i=Uo.indexOf(o);return i>-1?e*Math.pow(1e3,i+1):e},Go=(e,t,o,i)=>{if(!o)return((e,t)=>{const o=it(e,t);if(!t||null===o)return 0;const i=e.states[d(t)];if(!i)return 0;const a=i.attributes.unit_of_measurement??"";return Fo(o,a)})(e,i);if(!t)throw new Error("Energy growth map is required");return((e,t)=>t?c(t).reduce((t,o)=>t+(e[o]??0),0):0)(t,i)},Vo=(e,t)=>{if("string"!=typeof t?.entity)return null;const o=Lo(e,t?.secondary_info?.entity),i=o?.state;return p(i)?Number(i):i},Wo=(e,t)=>!!e&&e>=t,Zo=(e,t)=>e?t?Wo(e,t)?e:0:e:0,Yo={field:void 0,entity:"",has:!1,state:null,displayZero:!1,displayZeroTolerance:0,icon:"",name:"",color:null,unit:void 0,unit_white_space:!1,invertAnimation:!1,showDirection:!1,secondary:{entity:null,template:null,has:!1,state:null,icon:null,unit:null,unit_white_space:!1,displayZero:!1,accept_negative:!1,displayZeroTolerance:0,decimals:null}},Xo=({hass:e,config:t,energyGrowthMap:i,useDateSelection:a,field:n})=>{if(!n||!n?.entity)return Yo;const r=n.entity,s=(({hass:e,config:t,energyGrowthMap:i,useDateSelection:a,field:n})=>{const r=o(t),s=n?.entity;if(void 0===s)return null;if(r)return Math.abs(Go(e,i,a,s));const l=nt(e,s);return Math.abs(l)})({hass:e,config:t,energyGrowthMap:i,useDateSelection:a,field:n}),l=n?.display_zero||!1,c=n?.display_zero_tolerance||0,d=((e,t,o)=>!!e||!!Wo(t,o))(l,s,c),u=s&&s<0,h=n?.inverted_animation||!1,p=u?!h:h;let _=null;var m;return n?.color&&"string"==typeof n?.color?_=n.color:n?.color&&"object"==typeof n?.color&&(_=(m=n.color)?"#".concat(m.map(e=>e.toString(16).padStart(2,"0")).join("")):""),{field:n,entity:r,has:d,state:s,displayZero:l,displayZeroTolerance:c,icon:Ro(e,n,"mdi:flash"),name:Ho(e,n,"Individual"),color:_,unit:n?.unit_of_measurement,unit_white_space:!1!==n?.unit_white_space,decimals:n?.decimals,invertAnimation:p,showDirection:n?.show_direction||!1,secondary:{entity:n?.secondary_info?.entity||null,template:n?.secondary_info?.template||null,has:void 0!==n?.secondary_info?.entity,state:Vo(e,n)||null,accept_negative:n?.secondary_info?.accept_negative||!1,icon:n?.secondary_info?.icon||null,unit:n?.secondary_info?.unit_of_measurement||null,unit_white_space:!1!==n?.secondary_info?.unit_white_space,displayZero:n?.secondary_info?.display_zero||!1,displayZeroTolerance:n?.secondary_info?.display_zero_tolerance||0,decimals:n?.secondary_info?.decimals||null,tap_action:n?.secondary_info?.tap_action,hold_action:n?.secondary_info?.hold_action,double_tap_action:n?.secondary_info?.double_tap_action}}},qo=(e,t)=>{const o=t.entities.fossil_fuel_percentage,i=o?.entity,a=o?.display_zero,n=Io(e,t);return void 0!==i&&(!0===a||null!==n&&1*n-(it(e,i)??0)/100>0)},Ko=(e,t)=>{const o=t.entities.fossil_fuel_percentage,i=o?.entity,a=o?.display_zero,n=Io(e,t);return void 0!==i&&(!0===a||null!==n&&(!1!==qo(e,t)&&1*n-(it(e,i)??0)/100>0))},Jo=(e,t)=>Po(e,t,"fossil_fuel_percentage"),Qo=(e,t)=>{const o=t.entities.solar?.entity,i=t.entities.solar?.secondary_info?.entity;if(void 0===o)return null;const a=nt(e,o),n=i?Math.max(nt(e,i),0):0,r=t.entities.solar?.secondary_info?.sum_total,s=r?a+n:a;return Co(t,"solar")?Ao(s):Do(s)},ei=(e,t)=>Po(e,t,"solar"),ti=(e,t)=>e in t,oi=(e,t,o)=>{let i="var(--primary-text-color)";return"string"==typeof e&&ti(e,t)&&(i=t[e]?.color??i),!0===e&&ti(o,t)&&(i=t[o]?.color??i),i},ii=e=>e?"#".concat(e.map(e=>e.toString(16).padStart(2,"0")).join("")):"",ai=w`:host{--size-circle-entity:79.99px;--mdc-icon-size:24px;--clickable-cursor:pointer;--individual-left-bottom-color:#d0cc5b;--individual-left-top-color:#964cb5;--individual-right-top-color:#b54c9d;--individual-right-bottom-color:#5bd0cc;--non-fossil-color:var(--energy-non-fossil-color, #0f9d58);--icon-non-fossil-color:var(--non-fossil-color, #0f9d58);--icon-solar-color:var(--energy-solar-color, #ff9800);--icon-individual-bottom-color:var(--individual-left-bottom-color, #d0cc5b);--icon-individual-top-color:var(--individual-left-top-color, #964cb5);--icon-grid-color:var(--energy-grid-consumption-color, #488fc2);--icon-battery-color:var(--energy-battery-in-color, #f06292);--icon-home-color:var(--energy-grid-consumption-color, #488fc2);--text-solar-color:var(--primary-text-color);--text-non-fossil-color:var(--primary-text-color);--text-individual-bottom-color:var(--primary-text-color);--text-individual-top-color:var(--primary-text-color);--text-home-color:var(--primary-text-color);--secondary-text-individual-bottom-color:var(--primary-text-color);--secondary-text-individual-top-color:var(--primary-text-color);--text-battery-state-of-charge-color:var(--primary-text-color);--cirlce-grid-color:var(--energy-grid-consumption-color, #488fc2);--circle-battery-color:var(--energy-battery-in-color, #f06292);--battery-grid-line:var(--energy-grid-return-color, #8353d1);--secondary-text-solar-color:var(--primary-text-color);--secondary-text-grid-color:var(--primary-text-color);--secondary-text-home-color:var(--primary-text-color);--secondary-text-non-fossil-color:var(--primary-text-color);--lines-svg-not-flat-line-height:106%;--lines-svg-not-flat-line-top:-2%;--lines-svg-flat-width:calc(100% - 160px);--lines-svg-not-flat-width:calc(103% - 165px);--lines-svg-not-flat-multi-indiv-height:104%;--lines-svg-not-flat-multi-indiv-width:calc(103% - var(--size-circle-entity) * 3.7);--lines-svg-not-flat-multi-indiv-width:calc(((106% - 165px) * 0.5));--lines-svg-not-flat-multi-indiv-width:calc(((130% - 246px) * 0.5));--lines-svg-not-flat-multi-indiv-right-indiv-width:calc(((130% - 210px) * 0.5));--lines-svg-not-flat-multi-indiv-right-indiv-height:103%;--lines-svg-flat-multi-indiv-width:calc((129% - 242px) * 0.5);--lines-svg-flat-left:0;--lines-svg-not-flat-left:0;--dot-size:3.5px;--transparency:var(--transparency-unused-lines);--greyed-out--line-color:#bdbdbd;--text-grid-consumption-color:var(--energy-grid-consumption-color);--text-grid-return-color:var(--energy-grid-return-color);--text-battery-in-color:var(--energy-battery-in-color);--text-battery-out-color:var(--energy-battery-out-color);--home-circle-animation:rotate-in 0.6s ease-in}ha-card{overflow:hidden}ha-card.full-size{height:100%}.card-content.full-size{transform:scale(2) translateY(30%)}.card-content{position:relative;margin:0 auto}.circle{width:80px;height:80px;border-radius:50%;box-sizing:border-box;border:2px solid;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;font-size:12px;line-height:12px;position:relative;text-decoration:none;color:var(--primary-text-color);gap:2px;overflow:hidden}.circle>ha-ripple{position:absolute;inset:0;border-radius:50%;pointer-events:none;z-index:0}.circle>:not(ha-ripple){position:relative;z-index:1}.card-content,.row{max-width:470px}.lines{position:absolute;bottom:0;left:var(--size-circle-entity);width:100%;height:146px;display:flex;justify-content:flex-start;padding:0 16px 16px;box-sizing:border-box;pointer-events:none}:dir(rtl) .lines{justify-content:flex-end}.lines:not(.multi-individual) svg.flat-line{left:var(--lines-svg-flat-left)}.lines:not(.multi-individual) svg:not(.flat-line){left:var(--lines-svg-not-flat-left)}.lines:has(svg:not(.flat-line)){margin-left:-1%}.lines.individual-bottom-individual-top{bottom:110px}.lines.high{bottom:100px;height:156px}.lines svg{width:var(--lines-svg-flat-width);height:100%;max-width:340px;position:relative}.lines svg:not(.flat-line){width:var(--lines-svg-not-flat-width);height:var(--lines-svg-not-flat-line-height);top:var(--lines-svg-not-flat-line-top)}.multi-individual{left:calc(var(--size-circle-entity) + 2%);margin-left:-2.2%!important}.multi-individual svg{width:var(--lines-svg-flat-multi-indiv-width)}.multi-individual svg:not(.flat-line){width:var(--lines-svg-not-flat-multi-indiv-width);margin-top:1px;height:var(--lines-svg-not-flat-multi-indiv-height)}.row{display:flex;justify-content:space-between;max-width:500px;margin:0 auto}.circle-container{display:flex;flex-direction:column;align-items:center}.circle-container.solar{height:130px}.circle-container.individual-top{height:130px}.circle-container.individual-bottom{justify-content:flex-end}.circle-container.individual-bottom.bottom{position:relative;top:-20px;margin-bottom:-20px}.circle-container.battery{height:110px;justify-content:flex-end}.spacer{width:var(--size-circle-entity)}.circle-container .circle{cursor:var(--clickable-cursor)}#battery-grid{stroke:var(--battery-grid-line)}ha-icon{display:inline;padding-bottom:2px}ha-icon.small{--mdc-icon-size:12px}.label{color:var(--secondary-text-color);font-size:12px;max-width:80px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;min-height:20px}.card-content.no-labels .label{display:none}.card-content.no-labels .circle-container.individual-top,.card-content.no-labels .circle-container.low-carbon,.card-content.no-labels .circle-container.solar{height:110px!important}.card-content.no-labels .lines,.card-content.no-labels .right-individual-flow-container{transform:translateY(20px)}line,path{stroke:var(--disabled-text-color);stroke-width:1;fill:none}path.transparency{opacity:calc(calc(100 - var(--transparency))/ 100)}path.grey{stroke:var(--greyed-out--line-color)!important}.circle svg{position:absolute;fill:none;stroke-width:4px;width:100%;height:100%;top:0;left:0}span.secondary-info{color:var(--primary-text-color);font-size:12px;max-width:60px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.individual-top circle,.individual-top path{stroke:var(--individual-left-top-color)}#individual-left-bottom-icon{color:var(--icon-individual-left-bottom-color)}#individual-left-top-icon{color:var(--icon-individual-left-top-color)}#individual-right-bottom-icon{color:var(--icon-individual-right-bottom-color)}#individual-right-top-icon{color:var(--icon-individual-right-top-color)}#solar-icon{color:var(--icon-solar-color)}circle.individual-top{stroke-width:4;width:var(--dot-size);fill:var(--individual-left-top-color)}circle.individual-bottom{stroke-width:4;width:var(--dot-size);fill:var(--individual-left-bottom-color)}.individual-top .circle{border-color:var(--individual-left-top-color)}.individual-bottom circle,.individual-bottom path{stroke:var(--individual-left-bottom-color)}.individual-bottom .circle{border-color:var(--individual-left-bottom-color)}.individual-right-top .circle{border-color:var(--individual-right-top-color)}circle.individual-right-top .circle{fill:var(--individual-right-top-color)}.individual-right-top circle,.individual-right-top path{stroke:var(--individual-right-top-color)}.individual-right-bottom .circle{border-color:var(--individual-right-bottom-color)}circle.individual-right-bottom .circle{fill:var(--individual-right-bottom-color)}.individual-right-bottom circle,.individual-right-bottom path{stroke:var(--individual-right-bottom-color)}.right-individual-flow-container{position:absolute;right:calc(var(--size-circle-entity) - 27% * 1.1 + 6px);width:100%;display:flex;justify-content:flex-end;height:156px;bottom:100px;padding:0 16px 16px;margin-right:-1.2%;box-sizing:border-box;pointer-events:none}.right-individual-flow-container>svg{width:var(--lines-svg-not-flat-multi-indiv-right-indiv-width)}.right-individual-flow{height:var(--lines-svg-not-flat-multi-indiv-right-indiv-height);margin-top:2px;width:var(--lines-svg-not-flat-multi-indiv-width);top:var(--lines-svg-not-flat-line-top);max-width:340px;position:relative}.circle-container.low-carbon{height:130px}.low-carbon path{stroke:var(--non-fossil-color)}.low-carbon .circle{border-color:var(--non-fossil-color)}.low-carbon ha-icon:not(.small){color:var(--icon-non-fossil-color)}circle.low-carbon{stroke-width:4;fill:var(--non-fossil-color);stroke:var(--non-fossil-color)}.solar{color:var(--primary-text-color)}.solar .circle{border-color:var(--energy-solar-color)}.solar ha-icon:not(.small){color:var(--icon-solar-color)}circle.solar,path.solar{stroke:var(--energy-solar-color)}circle.solar{stroke-width:4;fill:var(--energy-solar-color)}.battery .circle{border-color:var(--circle-battery-color)}circle.battery,path.battery{stroke:var(--energy-battery-out-color)}circle.battery-home,path.battery-home{stroke:var(--energy-battery-out-color)}circle.battery-home{stroke-width:4;fill:var(--energy-battery-out-color)}circle.battery-solar,path.battery-solar{stroke:var(--energy-battery-in-color)}circle.battery-solar{stroke-width:4;fill:var(--energy-battery-in-color)}.battery-in{color:var(--energy-battery-in-color)}.battery-out{color:var(--energy-battery-out-color)}span.battery-in{color:var(--text-battery-in-color)}span.battery-out{color:var(--text-battery-out-color)}path.battery-from-grid{stroke:var(--energy-grid-consumption-color)}path.battery-to-grid{stroke:var(--battery-grid-line)}.battery ha-icon:not(.small){color:var(--icon-battery-color)}circle.battery-to-grid,circle.return,path.return{stroke:var(--energy-grid-return-color)}circle.battery-to-grid,circle.return{stroke-width:4;fill:var(--energy-grid-return-color)}.return{color:var(--energy-grid-return-color)}span.return{color:var(--text-grid-return-color)}.grid .circle{border-color:var(--circle-grid-color)}.consumption{color:var(--energy-grid-consumption-color)}span.consumption{color:var(--text-grid-consumption-color)}circle.battery-from-grid,circle.grid,path.grid{stroke:var(--energy-grid-consumption-color)}circle.battery-from-grid,circle.grid{stroke-width:4;fill:var(--energy-grid-consumption-color)}.grid ha-icon:not(.small){color:var(--icon-grid-color)}.home .circle{border-width:0;border-color:var(--primary-color)}.home .circle.border{border-width:2px}.home ha-icon:not(.small){color:var(--icon-home-color)}.circle svg circle{animation:var(--home-circle-animation);transition:stroke-dashoffset .4s,stroke-dasharray .4s;fill:none}span.solar{color:var(--text-solar-color)}span.low-carbon{color:var(--text-non-fossil-color)}span.low-carbon.secondary-info{color:var(--secondary-text-non-fossil-color)}#home-circle{color:var(--text-home-color);z-index:2}.individual-bottom .circle{color:var(--text-individual-bottom-color)}.individual-top .circle{color:var(--text-individual-top-color)}.individual-bottom span.secondary-info{color:var(--secondary-text-individual-bottom-color)}.individual-top span.secondary-info{color:var(--secondary-text-individual-top-color)}span.secondary-info.left-top{color:var(--secondary-text-individual-left-top-color)}span.individual-left-top{color:var(--text-individual-left-top-color)}span.secondary-info.left-bottom{color:var(--secondary-text-individual-left-bottom-color)}span.individual-left-bottom{color:var(--text-individual-left-bottom-color)}span.secondary-info.right-top{color:var(--secondary-text-individual-right-top-color)}span.individual-right-top{color:var(--text-individual-right-top-color)}span.secondary-info.right-bottom{color:var(--secondary-text-individual-right-bottom-color)}span.individual-right-bottom{color:var(--text-individual-right-bottom-color)}.solar span.secondary-info{color:var(--secondary-text-solar-color)}.grid span.secondary-info{color:var(--secondary-text-grid-color)}.home span.secondary-info{color:var(--secondary-text-home-color)}#battery-state-of-charge-text{color:var(--text-battery-state-of-charge-color)}@keyframes rotate-in{from{stroke-dashoffset:238.76104;stroke-dasharray:238.76104}}.card-actions{display:flex;justify-content:space-between;align-items:center}.card-actions a{text-decoration:none}.home-circle-sections{pointer-events:none}.pointer-events-none{pointer-events:none}`;const ni=window,ri=ni.ShadowRoot&&(void 0===ni.ShadyCSS||ni.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,si=Symbol(),li=new WeakMap;let ci=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==si)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ri&&void 0===e){const o=void 0!==t&&1===t.length;o&&(e=li.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&li.set(t,e))}return e}toString(){return this.cssText}};const di=(e,...t)=>{const o=1===e.length?e[0]:t.reduce((t,o,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[i+1],e[0]);return new ci(o,e,si)},ui=ri?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const o of e.cssRules)t+=o.cssText;return(e=>new ci("string"==typeof e?e:e+"",void 0,si))(t)})(e):e;var hi;const pi=window,_i=pi.trustedTypes,mi=_i?_i.emptyScript:"",fi=pi.reactiveElementPolyfillSupport,gi={toAttribute(e,t){switch(t){case Boolean:e=e?mi:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let o=e;switch(t){case Boolean:o=null!==e;break;case Number:o=null===e?null:Number(e);break;case Object:case Array:try{o=JSON.parse(e)}catch(e){o=null}}return o}},yi=(e,t)=>t!==e&&(t==t||e==e),vi={attribute:!0,type:String,converter:gi,reflect:!1,hasChanged:yi},bi="finalized";let wi=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,o)=>{const i=this._$Ep(o,t);void 0!==i&&(this._$Ev.set(i,o),e.push(i))}),e}static createProperty(e,t=vi){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const o="symbol"==typeof e?Symbol():"__"+e,i=this.getPropertyDescriptor(e,o,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,o){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdate(e,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||vi}static finalize(){if(this.hasOwnProperty(bi))return!1;this[bi]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const o of t)this.createProperty(o,e[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const o=new Set(e.flat(1/0).reverse());for(const e of o)t.unshift(ui(e))}else void 0!==e&&t.push(ui(e));return t}static _$Ep(e,t){const o=t.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach(e=>e(this))}addController(e){var t,o;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(o=e.hostConnected)||void 0===o||o.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{ri?e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(t=>{const o=document.createElement("style"),i=ni.litNonce;void 0!==i&&o.setAttribute("nonce",i),o.textContent=t.cssText,e.appendChild(o)})})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)})}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)})}attributeChangedCallback(e,t,o){this._$AK(e,o)}_$EO(e,t,o=vi){var i;const a=this.constructor._$Ep(e,o);if(void 0!==a&&!0===o.reflect){const n=(void 0!==(null===(i=o.converter)||void 0===i?void 0:i.toAttribute)?o.converter:gi).toAttribute(t,o.type);this._$El=e,null==n?this.removeAttribute(a):this.setAttribute(a,n),this._$El=null}}_$AK(e,t){var o;const i=this.constructor,a=i._$Ev.get(e);if(void 0!==a&&this._$El!==a){const e=i.getPropertyOptions(a),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(o=e.converter)||void 0===o?void 0:o.fromAttribute)?e.converter:gi;this._$El=a,this[a]=n.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,o){let i=!0;void 0!==e&&(((o=o||this.constructor.getPropertyOptions(e)).hasChanged||yi)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===o.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,o))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((e,t)=>this[t]=e),this._$Ei=void 0);let t=!1;const o=this._$AL;try{t=this.shouldUpdate(o),t?(this.willUpdate(o),null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)}),this.update(o)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(o)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach(e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach((e,t)=>this._$EO(t,this[t],e)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};var ki;wi[bi]=!0,wi.elementProperties=new Map,wi.elementStyles=[],wi.shadowRootOptions={mode:"open"},null==fi||fi({ReactiveElement:wi}),(null!==(hi=pi.reactiveElementVersions)&&void 0!==hi?hi:pi.reactiveElementVersions=[]).push("1.6.3");const xi=window,Si=xi.trustedTypes,$i=Si?Si.createPolicy("lit-html",{createHTML:e=>e}):void 0,Ei="$lit$",Ci=`lit$${(Math.random()+"").slice(9)}$`,Ai="?"+Ci,Di=`<${Ai}>`,Pi=document,Mi=()=>Pi.createComment(""),Ti=e=>null===e||"object"!=typeof e&&"function"!=typeof e,zi=Array.isArray,Oi="[ \t\n\f\r]",Ni=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ii=/-->/g,ji=/>/g,Bi=RegExp(`>|${Oi}(?:([^\\s"'>=/]+)(${Oi}*=${Oi}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Li=/'/g,Ri=/"/g,Hi=/^(?:script|style|textarea|title)$/i,Ui=(e=>(t,...o)=>({_$litType$:e,strings:t,values:o}))(1),Fi=Symbol.for("lit-noChange"),Gi=Symbol.for("lit-nothing"),Vi=new WeakMap,Wi=Pi.createTreeWalker(Pi,129,null,!1);function Zi(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$i?$i.createHTML(t):t}const Yi=(e,t)=>{const o=e.length-1,i=[];let a,n=2===t?"<svg>":"",r=Ni;for(let t=0;t<o;t++){const o=e[t];let s,l,c=-1,d=0;for(;d<o.length&&(r.lastIndex=d,l=r.exec(o),null!==l);)d=r.lastIndex,r===Ni?"!--"===l[1]?r=Ii:void 0!==l[1]?r=ji:void 0!==l[2]?(Hi.test(l[2])&&(a=RegExp("</"+l[2],"g")),r=Bi):void 0!==l[3]&&(r=Bi):r===Bi?">"===l[0]?(r=null!=a?a:Ni,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,s=l[1],r=void 0===l[3]?Bi:'"'===l[3]?Ri:Li):r===Ri||r===Li?r=Bi:r===Ii||r===ji?r=Ni:(r=Bi,a=void 0);const u=r===Bi&&e[t+1].startsWith("/>")?" ":"";n+=r===Ni?o+Di:c>=0?(i.push(s),o.slice(0,c)+Ei+o.slice(c)+Ci+u):o+Ci+(-2===c?(i.push(void 0),t):u)}return[Zi(e,n+(e[o]||"<?>")+(2===t?"</svg>":"")),i]};class Xi{constructor({strings:e,_$litType$:t},o){let i;this.parts=[];let a=0,n=0;const r=e.length-1,s=this.parts,[l,c]=Yi(e,t);if(this.el=Xi.createElement(l,o),Wi.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(i=Wi.nextNode())&&s.length<r;){if(1===i.nodeType){if(i.hasAttributes()){const e=[];for(const t of i.getAttributeNames())if(t.endsWith(Ei)||t.startsWith(Ci)){const o=c[n++];if(e.push(t),void 0!==o){const e=i.getAttribute(o.toLowerCase()+Ei).split(Ci),t=/([.?@])?(.*)/.exec(o);s.push({type:1,index:a,name:t[2],strings:e,ctor:"."===t[1]?ea:"?"===t[1]?oa:"@"===t[1]?ia:Qi})}else s.push({type:6,index:a})}for(const t of e)i.removeAttribute(t)}if(Hi.test(i.tagName)){const e=i.textContent.split(Ci),t=e.length-1;if(t>0){i.textContent=Si?Si.emptyScript:"";for(let o=0;o<t;o++)i.append(e[o],Mi()),Wi.nextNode(),s.push({type:2,index:++a});i.append(e[t],Mi())}}}else if(8===i.nodeType)if(i.data===Ai)s.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(Ci,e+1));)s.push({type:7,index:a}),e+=Ci.length-1}a++}}static createElement(e,t){const o=Pi.createElement("template");return o.innerHTML=e,o}}function qi(e,t,o=e,i){var a,n,r,s;if(t===Fi)return t;let l=void 0!==i?null===(a=o._$Co)||void 0===a?void 0:a[i]:o._$Cl;const c=Ti(t)?void 0:t._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===c?l=void 0:(l=new c(e),l._$AT(e,o,i)),void 0!==i?(null!==(r=(s=o)._$Co)&&void 0!==r?r:s._$Co=[])[i]=l:o._$Cl=l),void 0!==l&&(t=qi(e,l._$AS(e,t.values),l,i)),t}let Ki=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:o},parts:i}=this._$AD,a=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:Pi).importNode(o,!0);Wi.currentNode=a;let n=Wi.nextNode(),r=0,s=0,l=i[0];for(;void 0!==l;){if(r===l.index){let t;2===l.type?t=new Ji(n,n.nextSibling,this,e):1===l.type?t=new l.ctor(n,l.name,l.strings,this,e):6===l.type&&(t=new aa(n,this,e)),this._$AV.push(t),l=i[++s]}r!==(null==l?void 0:l.index)&&(n=Wi.nextNode(),r++)}return Wi.currentNode=Pi,a}v(e){let t=0;for(const o of this._$AV)void 0!==o&&(void 0!==o.strings?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}};class Ji{constructor(e,t,o,i){var a;this.type=2,this._$AH=Gi,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=i,this._$Cp=null===(a=null==i?void 0:i.isConnected)||void 0===a||a}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=qi(this,e,t),Ti(e)?e===Gi||null==e||""===e?(this._$AH!==Gi&&this._$AR(),this._$AH=Gi):e!==this._$AH&&e!==Fi&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):(e=>zi(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]))(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Gi&&Ti(this._$AH)?this._$AA.nextSibling.data=e:this.$(Pi.createTextNode(e)),this._$AH=e}g(e){var t;const{values:o,_$litType$:i}=e,a="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=Xi.createElement(Zi(i.h,i.h[0]),this.options)),i);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===a)this._$AH.v(o);else{const e=new Ki(a,this),t=e.u(this.options);e.v(o),this.$(t),this._$AH=e}}_$AC(e){let t=Vi.get(e.strings);return void 0===t&&Vi.set(e.strings,t=new Xi(e)),t}T(e){zi(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let o,i=0;for(const a of e)i===t.length?t.push(o=new Ji(this.k(Mi()),this.k(Mi()),this,this.options)):o=t[i],o._$AI(a),i++;i<t.length&&(this._$AR(o&&o._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var o;for(null===(o=this._$AP)||void 0===o||o.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class Qi{constructor(e,t,o,i,a){this.type=1,this._$AH=Gi,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=Gi}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,o,i){const a=this.strings;let n=!1;if(void 0===a)e=qi(this,e,t,0),n=!Ti(e)||e!==this._$AH&&e!==Fi,n&&(this._$AH=e);else{const i=e;let r,s;for(e=a[0],r=0;r<a.length-1;r++)s=qi(this,i[o+r],t,r),s===Fi&&(s=this._$AH[r]),n||(n=!Ti(s)||s!==this._$AH[r]),s===Gi?e=Gi:e!==Gi&&(e+=(null!=s?s:"")+a[r+1]),this._$AH[r]=s}n&&!i&&this.j(e)}j(e){e===Gi?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class ea extends Qi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Gi?void 0:e}}const ta=Si?Si.emptyScript:"";class oa extends Qi{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Gi?this.element.setAttribute(this.name,ta):this.element.removeAttribute(this.name)}}class ia extends Qi{constructor(e,t,o,i,a){super(e,t,o,i,a),this.type=5}_$AI(e,t=this){var o;if((e=null!==(o=qi(this,e,t,0))&&void 0!==o?o:Gi)===Fi)return;const i=this._$AH,a=e===Gi&&i!==Gi||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Gi&&(i===Gi||a);a&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,o;"function"==typeof this._$AH?this._$AH.call(null!==(o=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==o?o:this.element,e):this._$AH.handleEvent(e)}}class aa{constructor(e,t,o){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(e){qi(this,e)}}const na=xi.litHtmlPolyfillSupport;null==na||na(Xi,Ji),(null!==(ki=xi.litHtmlVersions)&&void 0!==ki?ki:xi.litHtmlVersions=[]).push("2.8.0");var ra,sa;let la=class extends wi{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const o=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=o.firstChild),o}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,o)=>{var i,a;const n=null!==(i=null==o?void 0:o.renderBefore)&&void 0!==i?i:t;let r=n._$litPart$;if(void 0===r){const e=null!==(a=null==o?void 0:o.renderBefore)&&void 0!==a?a:null;n._$litPart$=r=new Ji(t.insertBefore(Mi(),e),e,void 0,null!=o?o:{})}return r._$AI(e),r})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return Fi}};la.finalized=!0,la._$litElement$=!0,null===(ra=globalThis.litElementHydrateSupport)||void 0===ra||ra.call(globalThis,{LitElement:la});const ca=globalThis.litElementPolyfillSupport;null==ca||ca({LitElement:la}),(null!==(sa=globalThis.litElementVersions)&&void 0!==sa?sa:globalThis.litElementVersions=[]).push("3.3.3");const da=e=>t=>"function"==typeof t?((e,t)=>(customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:o,elements:i}=t;return{kind:o,elements:i,finisher(t){customElements.define(e,t)}}})(e,t),ua=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(o){o.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(o){o.createProperty(t.key,e)}};function ha(e){return(t,o)=>void 0!==o?((e,t,o)=>{t.constructor.createProperty(o,e)})(e,t,o):ua(e,t)}function pa(e){return ha({...e,state:!0})}function _a(e,t){return(({finisher:e,descriptor:t})=>(o,i)=>{var a;if(void 0===i){const i=null!==(a=o.originalKey)&&void 0!==a?a:o.key,n=null!=t?{kind:"method",placement:"prototype",key:i,descriptor:t(o.key)}:{...o,key:i};return null!=e&&(n.finisher=function(t){e(t,i)}),n}{const a=o.constructor;void 0!==t&&Object.defineProperty(o,i,t(i)),null==e||e(a,i)}})({descriptor:t=>{const o={get(){var t,o;return null!==(o=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(e))&&void 0!==o?o:null},enumerable:!0,configurable:!0};return o}})}var ma;null===(ma=window.HTMLSlotElement)||void 0===ma||ma.prototype.assignedElements;!function(e){const t=`https://github.com/flixlix/${e.type}`,o=window;var i;o.customCards=o.customCards||[],o.customCards.push({...e,preview:!0,documentationURL:t}),i={name:e.name,version:e.version,readme:t},et=i,console.groupCollapsed(`%c⚡ ${et.name} v${et.version} is installed`,"color: #488fc2; font-weight: bold"),console.log("Readme:",et.readme),console.groupEnd()}({type:"power-flow-card-plus",name:"Power Flow Card Plus",description:"An extended version of the power flow card with richer options, advanced features and a few small UI enhancements. Inspired by the Energy Dashboard.",version:"0.3.7"});let fa=class extends la{constructor(){super(...arguments),this._config={},this._templateResults={},this._unsubRenderTemplates=new Map,this._width=0,this.wideEnoughForFourIndividuals=359,this._handleVisibilityChange=()=>{"undefined"!=typeof document&&"visible"===document.visibilityState&&this.requestUpdate()},this.previousDur={},this._pendingTapTimeouts=new WeakMap,this._holdTimeouts=new WeakMap,this._holdTriggered=new WeakMap,this._doubleTapDelay=250,this._holdDelay=500}setConfig(e){if(e.entities.individual1||e.entities.individual2)throw new Error("You are using an outdated configuration. Please update your configuration to the latest version. The individual1 and individual2 properties are now just a single individual array property. The easiest way to do this is to remove the individual1 and individual2 properties and replace them in the UI Editor.");if(!e.entities||!e.entities?.battery?.entity&&!e.entities?.grid?.entity&&!e.entities?.solar?.entity)throw new Error("At least one entity for battery, grid or solar must be defined");this._config={...e,min_flow_rate:_(e.min_flow_rate,u.minFlowRate),max_flow_rate:_(e.max_flow_rate,u.maxFlowRate),base_decimals:_(e.base_decimals,u.baseDecimals),kilo_decimals:_(e.kilo_decimals,u.kiloDecimals),kilo_threshold:_(e.kilo_threshold,u.kiloThreshold),max_expected_power:_(e.max_expected_power,u.maxExpectedPower),min_expected_power:_(e.min_expected_power,u.minExpectedPower),display_zero_lines:{mode:e.display_zero_lines?.mode??u.displayZeroLines.mode,transparency:_(e.display_zero_lines?.transparency,u.displayZeroLines.transparency),grey_color:e.display_zero_lines?.grey_color??u.displayZeroLines.grey_color}}}connectedCallback(){super.connectedCallback(),"undefined"!=typeof document&&document.addEventListener("visibilitychange",this._handleVisibilityChange),this._tryConnectAll()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=void 0,"undefined"!=typeof document&&document.removeEventListener("visibilitychange",this._handleVisibilityChange),this._tryDisconnectAll(),super.disconnectedCallback()}static async getConfigElement(){return await Promise.resolve().then(function(){return Nr}),document.createElement("power-flow-card-plus-editor")}static getStubConfig(e){return function(e,t="power"){function o(t,o){const i=d(t),a=e.states[i]?.attributes.friendly_name;return o.some(e=>i.includes(e)||a?.includes(e))}let i;i="energy"===t?Object.keys(e.states).filter(t=>{const o=e.states[d(t)];return o?.state&&o.attributes&&"energy"===o.attributes.device_class||o?.entity_id.includes("energy")}):Object.keys(e.states).filter(t=>{const o=e.states[d(t)];return o?.state&&o.attributes&&"power"===o.attributes.device_class||o?.entity_id.includes("power")});const a=["grid","utility","net","meter"],n=["solar","pv","photovoltaic","inverter"],r=["battery"],s=["battery_percent","battery_level","state_of_charge","soc","percentage"],l=i.filter(e=>o(e,a))[0],c=i.filter(e=>o(e,n))[0];return{entities:{battery:{entity:i.filter(e=>o(e,r))[0]??"",state_of_charge:Object.keys(e.states).filter(t=>{const o=e.states[t];return o&&o.state&&o.attributes&&"%"===o.attributes.unit_of_measurement}).filter(e=>o(e,s))[0]??""},grid:l?{entity:l}:void 0,solar:c?{entity:c,display_zero_state:!0}:void 0},clickable_entities:!0,display_zero_lines:!0,use_new_flow_rate_model:!0,base_decimals:u.baseDecimals,kilo_decimals:u.kiloDecimals,min_flow_rate:u.minFlowRate,max_flow_rate:u.maxFlowRate,max_expected_power:u.maxExpectedPower,min_expected_power:u.minExpectedPower,kilo_threshold:u.kiloThreshold,mega_threshold:u.megaThreshold,transparency_zero_lines:u.transparencyZeroLines,sort_individual_devices:!1}}(e,"power")}getCardSize(){return 3}_normalizeActionConfig(e){if(e)return"tap_action"in e||"hold_action"in e||"double_tap_action"in e?e:{tap_action:{action:"more-info"}}}openDetails(e,t,o,i="tap"){e.stopPropagation();const a=this._normalizeActionConfig(t);if(!!!(a?.tap_action||a?.hold_action||a?.double_tap_action)){if(!o||!this._config.clickable_entities)return;if(!((e,t)=>{const o=c(t);for(const t of o)if(!(t in e.states))return!1;return!0})(this.hass,o))return;const e=new CustomEvent("hass-more-info",{composed:!0,detail:{entityId:o}});return void this.dispatchEvent(e)}ct(e.target,this.hass,{entity:o,tap_action:a?.tap_action,hold_action:a?.hold_action,double_tap_action:a?.double_tap_action},i)}onEntityClick(e,t,o){e.stopPropagation();const i=e.currentTarget,a=this._normalizeActionConfig(t);if(i)if(this._holdTriggered.get(i))this._holdTriggered.set(i,!1);else{if(a?.double_tap_action){const t=this._pendingTapTimeouts.get(i);t&&clearTimeout(t);const n=setTimeout(()=>{this.openDetails({stopPropagation:()=>e.stopPropagation(),target:i},a,o,"tap"),this._pendingTapTimeouts.delete(i)},this._doubleTapDelay);return void this._pendingTapTimeouts.set(i,n)}this.openDetails({stopPropagation:()=>e.stopPropagation(),target:i},a,o,"tap")}}onEntityDoubleClick(e,t,o){const i=e.currentTarget,a=this._normalizeActionConfig(t);if(!i)return;const n=this._pendingTapTimeouts.get(i);n&&(clearTimeout(n),this._pendingTapTimeouts.delete(i)),a?.double_tap_action&&this.openDetails({stopPropagation:()=>e.stopPropagation(),target:i},a,o,"double_tap")}onEntityPointerDown(e,t,o){const i=e.currentTarget,a=this._normalizeActionConfig(t);if(!i||!a?.hold_action)return;const n=this._holdTimeouts.get(i);n&&clearTimeout(n),this._holdTriggered.set(i,!1);const r=setTimeout(()=>{this._holdTriggered.set(i,!0),this.openDetails({stopPropagation:()=>e.stopPropagation(),target:i},a,o,"hold"),this._holdTimeouts.delete(i)},this._holdDelay);this._holdTimeouts.set(i,r)}onEntityPointerUp(e){const t=e.currentTarget;if(!t)return;const o=this._holdTimeouts.get(t);o&&(clearTimeout(o),this._holdTimeouts.delete(t))}render(){if(!this._config||!this.hass)return Gi;const e=this._renderData??this._computeRenderData(),{entities:t,grid:o,solar:i,battery:a,home:n,nonFossil:r,individualObjs:s,newDur:l,templatesObj:c,homeBatteryCircumference:d,homeGridCircumference:u,homeNonFossilCircumference:h,homeSolarCircumference:_,homeUsageToDisplay:f,individualFieldLeftTop:g,individualFieldLeftBottom:y,individualFieldRightTop:v,individualFieldRightBottom:b}=e,w=e=>e?void 0===e?.state?"":m(this.hass,this._config,e?.state,{decimals:e?.decimals,unit:e?.unit,unitWhiteSpace:e?.unit_white_space}):"";return Ui`<ha-card .header="${this._config.title}" class="${this._config.full_size?"full-size":""}" style="${this._config.style_ha_card?this._config.style_ha_card:""}"><div class="card-content ${this._config.full_size?"full-size":""} ${this._config.no_labels?"no-labels":""}" id="power-flow-card-plus" style="${this._config.style_card_content?this._config.style_card_content:""}">${i.has||s?.some(e=>e?.has)||r.hasPercentage?Ui`<div class="row">${((e,t,{nonFossil:o,entities:i,templatesObj:a,grid:n,newDur:r,fossilEnergyConsumption:s})=>{const l=!1===t.clickable_entities;return o.hasPercentage?ne`<div class="circle-container low-carbon"><span class="label">${o.name}</span><div class="circle ${l?"pointer-events-none":""}" @click="${t=>{e.onEntityClick(t,i.fossil_fuel_percentage,i.fossil_fuel_percentage?.entity)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,i.fossil_fuel_percentage,i.fossil_fuel_percentage?.entity)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,i.fossil_fuel_percentage,i.fossil_fuel_percentage?.entity)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,i.fossil_fuel_percentage,i.fossil_fuel_percentage?.entity,"tap")}}"><ha-ripple .disabled="${l}"></ha-ripple>${Ye(e.hass,e,t,a,o,"nonFossilFuel")} ${" "!==o.icon?ne`<ha-icon id="low-carbon-icon" .icon="${o.icon}"></ha-icon>`:le} ${!1!==i.fossil_fuel_percentage?.display_zero_state||(o.state.power||0)>(i.fossil_fuel_percentage?.display_zero_tolerance||0)?ne`<span class="low-carbon">${st(e.hass,t,i.fossil_fuel_percentage.entity,n.state.fromGrid,s)}</span>`:le}</div>${ze(t,o.state.power||0)?ne`<svg width="80" height="30"><path d="M40 -10 v40" class="low-carbon ${Oe(o.state.power||0,t)}" id="low-carbon"/>${Ee(t)&&o.has&&o.state.power>0?re`<circle r="1.75" class="low-carbon" vector-effect="non-scaling-stroke"><animateMotion dur="${qe(i.fossil_fuel_percentage?.calculate_flow_rate,r.nonFossil)}s" repeatCount="indefinite" calcMode="paced"><mpath xlink:href="#low-carbon"></animateMotion></circle>`:le}</svg>`:le}</div>`:Ke})(this,this._config,{entities:t,grid:o,newDur:l,nonFossil:r,templatesObj:c})} ${i.has?((e,t,{entities:o,solar:i,templatesObj:a})=>{const n=!1===t.clickable_entities,r=a.solarSecondary,s=o.solar?.secondary_info?.sum_total,l=t.entities.solar?.secondary_info?.entity,c=l?Math.max(nt(e.hass,l),0):0,d=s?i.state.total-c:i.state.total;return ne`<div class="circle-container solar"><span class="label">${i.name}</span><div class="circle ${n?"pointer-events-none":""}" @click="${t=>{e.onEntityClick(t,i,i.entity)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,i,i.entity)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,i,i.entity)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,i,i.entity,"tap")}}"><ha-ripple .disabled="${n}"></ha-ripple>${(()=>{if(r)return!0;if(!0===t.entities.solar?.secondary_info?.display_zero)return!0;if(!i?.secondary?.state)return!1;if(!p(i?.secondary?.state))return!0;const e=t.entities.solar?.secondary_info?.display_zero_tolerance??0;return Number(i.secondary.state)>=e||t.entities.solar?.secondary_info?.accept_negative&&"number"==typeof Number(+i.secondary.state)})()?Ye(e.hass,e,t,a,i,"solar"):le} ${" "!==i.icon?ne`<ha-icon id="solar-icon" .icon="${i.icon}"></ha-icon>`:le} ${!1!==o.solar?.display_zero_state||(d||0)>0?ne`<span class="solar">${m(e.hass,t,d,{unit:i.state.unit,unitWhiteSpace:i.state.unit_white_space,decimals:i.state.decimals})}</span>`:le}</div></div>`})(this,this._config,{entities:t,solar:i,templatesObj:c}):s?.some(e=>e?.has)?Ke:Gi} ${g?((e,t,{individualObj:o,templatesObj:i,displayState:a,newDur:n})=>{if(!o)return Ke;const r=!1===t.clickable_entities,s=t?.entities?.individual?.findIndex(e=>e.entity===o.entity)||0,l=n.individual[s]||0;return ne`<div class="circle-container individual-top"><span class="label">${o.name}</span><div class="circle ${r?"pointer-events-none":""}" @click="${t=>{e.onEntityClick(t,o?.field,o?.entity)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,o?.field,o?.entity)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,o?.field,o?.entity)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,o?.field,o?.entity,"tap")}}"><ha-ripple .disabled="${r}"></ha-ripple>${Je(e.hass,e,t,i,o,s,"left-top")} ${" "!==o.icon?ne`<ha-icon id="individual-left-top-icon" .icon="${o.icon}"></ha-icon>`:le} ${!1!==o?.field?.display_zero_state||(o.state||0)>(o.displayZeroTolerance??0)?ne`<span class="individual-top individual-left-top">${o?.showDirection?ne`<ha-icon class="small" .icon="${o.invertAnimation?"mdi:arrow-down":"mdi:arrow-up"}"></ha-icon>`:le}${a}</span>`:le}</div>${ze(t,o.state||0)&&!t.entities.home?.hide?ne`<svg width="80" height="30"><path d="M40 -10 v50" id="individual-top" class="${Oe(o.state||0,t)}"/>${Ee(t)&&o.state&&o.state>=(o.displayZeroTolerance??0)?re`<circle r="1.75" class="individual-top" vector-effect="non-scaling-stroke"><animateMotion dur="${qe(o?.field?.calculate_flow_rate,l)}s" repeatCount="indefinite" calcMode="paced" keyPoints="${o.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-top"></animateMotion></circle>`:le}</svg>`:le}</div>`})(this,this._config,{individualObj:g,displayState:w(g),newDur:l,templatesObj:c}):Ke} ${Me(s)?((e,t,{individualObj:o,templatesObj:i,displayState:a,newDur:n,battery:r,individualObjs:s})=>{if(!o)return Ke;const l=!1===t.clickable_entities,c=t?.entities?.individual?.findIndex(e=>e.entity===o.entity);if(-1===c||void 0===c)return Ke;const d=n.individual[c]||1.66,u=!!r?.has||Te(s);return ne`<div class="circle-container individual-top individual-right individual-right-top"><span class="label">${o.name}</span><div class="circle ${l?"pointer-events-none":""}" @click="${t=>{e.onEntityClick(t,o?.field,o?.entity)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,o?.field,o?.entity)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,o?.field,o?.entity)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,o?.field,o?.entity,"tap")}}"><ha-ripple .disabled="${l}"></ha-ripple>${Je(e.hass,e,t,i,o,c,"right-top")} ${" "!==o.icon?ne`<ha-icon id="individual-right-top-icon" .icon="${o.icon}"></ha-icon>`:le} ${!1!==o?.field?.display_zero_state||(o.state||0)>(o.displayZeroTolerance??0)?ne`<span class="individual-top individual-right-top">${o?.showDirection?ne`<ha-icon class="small" .icon="${o.invertAnimation?"mdi:arrow-down":"mdi:arrow-up"}"></ha-icon>`:le}${a}</span>`:le}</div>${ze(t,o.state||0)&&!t.entities.home?.hide?ne`<div class="right-individual-flow-container"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" class="right-individual-flow"><path id="individual-top-right-home" class="${Oe(o.state||0,t)}" d="M${u?45:47},0 v15 c0,${u?"30 -10,30 -30,30":"35 -10,35 -30,35"} h-20" vector-effect="non-scaling-stroke"/>${Ee(t)&&o.state&&o.state>=(o.displayZeroTolerance??0)?re`<circle r="1" class="individual-top" vector-effect="non-scaling-stroke"><animateMotion dur="${qe(o?.field?.calculate_flow_rate,d)}s" repeatCount="indefinite" calcMode="paced" keyPoints="${o.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-top-right-home"></animateMotion></circle>`:le}</svg></div>`:le}</div>`})(this,this._config,{displayState:w(v),individualObj:v,newDur:l,templatesObj:c,battery:a,individualObjs:s}):Gi}</div>`:Gi}<div class="row">${o.has?((e,t,{entities:o,grid:i,templatesObj:a})=>{const n=!1===t.clickable_entities;return ne`<div class="circle-container grid"><div class="circle ${n?"pointer-events-none":""}" @click="${t=>{const a=i.powerOutage?.entityGenerator??o.grid?.power_outage?.entity,n=i.powerOutage?.isOutage&&a?a:"string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.onEntityClick(t,i,n)}}" @dblclick="${t=>{const a=i.powerOutage?.entityGenerator??o.grid?.power_outage?.entity,n=i.powerOutage?.isOutage&&a?a:"string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.onEntityDoubleClick(t,i,n)}}" @pointerdown="${t=>{const a=i.powerOutage?.entityGenerator??o.grid?.power_outage?.entity,n=i.powerOutage?.isOutage&&a?a:"string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.onEntityPointerDown(t,o.grid,n)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{if("Enter"===t.key){const a=i.powerOutage?.entityGenerator??o.grid?.power_outage?.entity,n=i.powerOutage?.isOutage&&a?a:"string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.openDetails(t,o.grid,n,"tap")}}}"><ha-ripple .disabled="${n}"></ha-ripple>${Ye(e.hass,e,t,a,i,"grid")} ${" "!==i.icon?ne`<ha-icon id="grid-icon" .icon="${i.icon}"></ha-icon>`:le} ${("two_way"===o.grid?.display_state||void 0===o.grid?.display_state||"one_way_no_zero"===o.grid?.display_state&&(i.state.toGrid??0)>0||"one_way"===o.grid?.display_state&&(null===i.state.fromGrid||0===i.state.fromGrid)&&0!==i.state.toGrid)&&null!==i.state.toGrid&&!i.powerOutage.isOutage?ne`<span class="return" @click="${t=>{const a="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.production;e.onEntityClick(t,i,a)}}" @dblclick="${t=>{const a="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.production;e.onEntityDoubleClick(t,i,a)}}" @pointerdown="${t=>{const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.production;e.onEntityPointerDown(t,o.grid,i)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{if("Enter"===t.key){const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.production;e.openDetails(t,o.grid,i,"tap")}}}"><ha-icon class="small" .icon="${"mdi:arrow-left"}"></ha-icon>${m(e.hass,t,i.state.toGrid,{unit:i.unit,unitWhiteSpace:i.unit_white_space,decimals:i.decimals})}</span>`:le} ${("two_way"===o.grid?.display_state||void 0===o.grid?.display_state||"one_way_no_zero"===o.grid?.display_state&&i.state.fromGrid>0||"one_way"===o.grid?.display_state&&(null===i.state.toGrid||0===i.state.toGrid))&&null!==i.state.fromGrid&&!i.powerOutage.isOutage||i.powerOutage.isOutage&&i.powerOutage.entityGenerator?ne`<span class="consumption" @click="${t=>{const a="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.onEntityClick(t,i,a)}}" @dblclick="${t=>{const a="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.onEntityDoubleClick(t,i,a)}}" @pointerdown="${t=>{const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.onEntityPointerDown(t,o.grid,i)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{if("Enter"===t.key){const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.openDetails(t,o.grid,i,"tap")}}}"><ha-icon class="small" .icon="${"mdi:arrow-right"}"></ha-icon>${m(e.hass,t,i.state.fromGrid,{unit:i.unit,unitWhiteSpace:i.unit_white_space,decimals:i.decimals})}</span>`:le} ${i.powerOutage?.isOutage&&!i.powerOutage?.entityGenerator?ne`<span class="grid power-outage">${i.powerOutage.name}</span>`:le}</div><span class="label">${i.name}</span></div>`})(this,this._config,{entities:t,grid:o,templatesObj:c}):Ke} ${Ke} ${t.home?.hide?Ke:((e,t,{home:o,entities:i,templatesObj:a,homeUsageToDisplay:n,homeSolarCircumference:r,CIRCLE_CIRCUMFERENCE:s,homeBatteryCircumference:l,homeNonFossilCircumference:c,homeGridCircumference:d,individual:u})=>{const h=u.filter(e=>e.has).length<=1,p=void 0!==i.home?.entity,_=["none",void 0],m=!_.includes(i.home?.tap_action?.action)||!_.includes(i.home?.hold_action?.action)||!_.includes(i.home?.double_tap_action?.action),f=p||m,g=!1===t.clickable_entities||!f;return ne`<div class="circle-container home"><div class="circle ${g?"pointer-events-none":""}" id="home-circle" @click="${t=>{e.onEntityClick(t,i.home,i.home?.entity)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,i.home,i.home?.entity)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,i.home,i.home?.entity)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,i.home,i.home?.entity,"tap")}}"><ha-ripple .disabled="${g}"></ha-ripple>${Ye(e.hass,e,t,a,o,"home")} ${" "!==o.icon?ne`<ha-icon id="home-icon" .icon="${o.icon}"></ha-icon>`:le} ${n} <svg class="home-circle-sections">${void 0!==r?re`<circle class="solar" cx="40" cy="40" r="38" stroke-dasharray="${r} ${s-r}" shape-rendering="geometricPrecision" stroke-dashoffset="-${s-r}">`:le} ${l?re`<circle class="battery" cx="40" cy="40" r="38" stroke-dasharray="${l} ${s-l}" stroke-dashoffset="-${s-l-(r||0)}" shape-rendering="geometricPrecision">`:le} ${void 0!==c?re`<circle class="low-carbon" cx="40" cy="40" r="38" stroke-dasharray="${c} ${s-c}" stroke-dashoffset="-${s-c-(l||0)-(r||0)}" shape-rendering="geometricPrecision">`:le}<circle class="grid" cx="40" cy="40" r="38" stroke-dasharray="${d??s-r-(l||0)} ${void 0!==d?s-d:r+(l||0)}" stroke-dashoffset="0" shape-rendering="geometricPrecision"/></svg></div>${h?ne`<span class="label">${o.name}</span>`:ne`<span class="label"></span>`}</div>`})(this,this._config,{CIRCLE_CIRCUMFERENCE:lt,entities:t,home:n,homeBatteryCircumference:d,homeGridCircumference:u,homeNonFossilCircumference:h,homeSolarCircumference:_,templatesObj:c,homeUsageToDisplay:f,individual:s})} ${Me(s)?Ke:Gi}</div>${a.has||Te(s)?Ui`<div class="row">${Ke} ${a.has?((e,t,{battery:o,entities:i})=>{const a=!1===t.clickable_entities;return ne`<div class="circle-container battery"><div class="circle ${a?"pointer-events-none":""}" @click="${t=>{const a=i.battery?.state_of_charge?i.battery?.state_of_charge:"string"==typeof i.battery?.entity?i.battery?.entity:i.battery?.entity.production;e.onEntityClick(t,o,a)}}" @dblclick="${t=>{const a=i.battery?.state_of_charge?i.battery?.state_of_charge:"string"==typeof i.battery?.entity?i.battery?.entity:i.battery?.entity.production;e.onEntityDoubleClick(t,o,a)}}" @pointerdown="${t=>{const a=i.battery?.state_of_charge?i.battery?.state_of_charge:"string"==typeof i.battery?.entity?i.battery?.entity:i.battery?.entity.production;e.onEntityPointerDown(t,o,a)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{if("Enter"===t.key){const a=i.battery?.state_of_charge?i.battery?.state_of_charge:"string"==typeof i.battery?.entity?i.battery.entity:i.battery?.entity.production;e.openDetails(t,o,a,"tap")}}}"><ha-ripple .disabled="${a}"></ha-ripple>${null!==o.state_of_charge.state&&!1!==i.battery?.show_state_of_charge?ne`<span @click="${t=>{e.onEntityClick(t,o,i.battery?.state_of_charge)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,o,i.battery?.state_of_charge)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,o,i.battery?.state_of_charge)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,o,i.battery?.state_of_charge,"tap")}}" id="battery-state-of-charge-text">${m(e.hass,t,o.state_of_charge.state,{unit:o.state_of_charge.unit??"%",unitWhiteSpace:o.state_of_charge.unit_white_space,decimals:o.state_of_charge.decimals,accept_negative:!0})}</span>`:le} ${" "!==o.icon?ne`<ha-icon id="battery-icon" .icon="${o.icon}" @click="${t=>{e.onEntityClick(t,o,i.battery?.state_of_charge)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,o,i.battery?.state_of_charge)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,o,i.battery?.state_of_charge)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,o,i.battery?.state_of_charge,"tap")}}"></ha-icon>`:le} ${"two_way"===i.battery?.display_state||void 0===i.battery?.display_state||"one_way_no_zero"===i.battery?.display_state&&o.state.toBattery>0||"one_way"===i.battery?.display_state&&0!==o.state.toBattery?ne`<span class="battery-in" @click="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.production;e.onEntityClick(t,i.battery,o)}}" @dblclick="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.production;e.onEntityDoubleClick(t,i.battery,o)}}" @pointerdown="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.production;e.onEntityPointerDown(t,i.battery,o)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{if("Enter"===t.key){const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.production;e.openDetails(t,i.battery,o,"tap")}}}"><ha-icon class="small" .icon="${"mdi:arrow-down"}"></ha-icon>${m(e.hass,t,o.state.toBattery,{unit:o.unit,unitWhiteSpace:o.unit_white_space,decimals:o.decimals})}</span>`:le} ${"two_way"===i.battery?.display_state||void 0===i.battery?.display_state||"one_way_no_zero"===i.battery?.display_state&&o.state.fromBattery>0||"one_way"===i.battery?.display_state&&(0===o.state.toBattery||0!==o.state.fromBattery)?ne`<span class="battery-out" @click="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.consumption;e.onEntityClick(t,i.battery,o)}}" @dblclick="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.consumption;e.onEntityDoubleClick(t,i.battery,o)}}" @pointerdown="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.consumption;e.onEntityPointerDown(t,i.battery,o)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{if("Enter"===t.key){const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.consumption;e.openDetails(t,i.battery,o,"tap")}}}"><ha-icon class="small" .icon="${"mdi:arrow-up"}"></ha-icon>${m(e.hass,t,o.state.fromBattery,{unit:o.unit,unitWhiteSpace:o.unit_white_space,decimals:o.decimals})}</span>`:le}</div><span class="label">${o.name}</span></div>`})(this,this._config,{battery:a,entities:t}):Ke} ${y?((e,t,{individualObj:o,templatesObj:i,displayState:a,newDur:n})=>{if(!o)return Ke;const r=!1===t.clickable_entities,s=t?.entities?.individual?.findIndex(e=>e.entity===o.entity)||0,l=n.individual[s]||0;return ne`<div class="circle-container individual-bottom bottom">${ze(t,o?.state||0)&&!t.entities.home?.hide?ne`<svg width="80" height="30"><path d="M40 40 v-40" id="individual-bottom" class="${Oe(o?.state||0,t)}"/>${Ee(t)&&o?.state&&o.state>=(o.displayZeroTolerance??0)?re`<circle r="1.75" class="individual-bottom" vector-effect="non-scaling-stroke"><animateMotion dur="${qe(!1!==o.field?.calculate_flow_rate,l)}s" repeatCount="indefinite" calcMode="paced" keyPoints="${o.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-bottom"></animateMotion></circle>`:le}</svg>`:ne`<svg width="80" height="30"></svg>`}<div class="circle ${r?"pointer-events-none":""}" @click="${t=>{e.onEntityClick(t,o?.field,o?.entity)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,o?.field,o?.entity)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,o?.field,o?.entity)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,o?.field,o?.entity,"tap")}}"><ha-ripple .disabled="${r}"></ha-ripple>${Je(e.hass,e,t,i,o,s,"left-bottom")} ${" "!==o?.icon?ne`<ha-icon id="individual-left-bottom-icon" .icon="${o?.icon}"></ha-icon>`:le} ${!1!==o?.field?.display_zero_state||(o?.state||0)>(o.displayZeroTolerance??0)?ne`<span class="individual-bottom individual-left-bottom">${o?.showDirection?ne`<ha-icon class="small" .icon="${o?.invertAnimation?"mdi:arrow-up":"mdi:arrow-down"}"></ha-icon>`:le}${a}</span>`:le}</div><span class="label">${o?.name}</span></div>`})(this,this._config,{displayState:w(y),individualObj:y,newDur:l,templatesObj:c}):Ke} ${Me(s)?((e,t,{individualObj:o,templatesObj:i,displayState:a,newDur:n})=>{if(!o)return Ke;const r=!1===t.clickable_entities,s=t?.entities?.individual?.findIndex(e=>e.entity===o.entity);if(-1===s||void 0===s)return Ke;const l=n.individual[s]||1.66;return ne`<div class="circle-container individual-bottom individual-right individual-right-bottom"><div class="circle ${r?"pointer-events-none":""}" @click="${t=>{e.onEntityClick(t,o?.field,o?.entity)}}" @dblclick="${t=>{e.onEntityDoubleClick(t,o?.field,o?.entity)}}" @pointerdown="${t=>{e.onEntityPointerDown(t,o?.field,o?.entity)}}" @pointerup="${t=>{e.onEntityPointerUp(t)}}" @pointercancel="${t=>{e.onEntityPointerUp(t)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,o?.field,o?.entity,"tap")}}"><ha-ripple .disabled="${r}"></ha-ripple>${Je(e.hass,e,t,i,o,s,"right-bottom")} ${" "!==o.icon?ne`<ha-icon id="individual-right-bottom-icon" .icon="${o.icon}"></ha-icon>`:le} ${!1!==o?.field?.display_zero_state||(o.state||0)>(o.displayZeroTolerance??0)?ne`<span class="individual-bottom individual-right-bottom">${o?.showDirection?ne`<ha-icon class="small" .icon="${o.invertAnimation?"mdi:arrow-down":"mdi:arrow-up"}"></ha-icon>`:le}${a}</span>`:le}</div><span class="label">${o.name}</span> ${ze(t,o.state||0)&&!t.entities.home?.hide?ne`<div class="right-individual-flow-container"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" class="right-individual-flow"><path id="individual-bottom-right-home" class="${Oe(o.state||0,t)}" d="M45,100 v-15 c0,-30 -10,-30 -30,-30 h-20" vector-effect="non-scaling-stroke"/>${Ee(t)&&o.state&&o.state>=(o.displayZeroTolerance??0)?re`<circle r="1" class="individual-bottom" vector-effect="non-scaling-stroke"><animateMotion dur="${qe(o?.field?.calculate_flow_rate,l)}s" repeatCount="indefinite" calcMode="paced" keyPoints="${o.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-bottom-right-home"></animateMotion></circle>`:le}</svg></div>`:le}</div>`})(this,this._config,{displayState:w(b),individualObj:b,newDur:l,templatesObj:c}):Gi}</div>`:Ke} ${((e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>ne`${Ge(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})} ${Fe(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})} ${Ve(e,{battery:t,individual:i,solar:a,newDur:n})} ${Ue(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})} ${He(e,{battery:t,grid:o,individual:i,newDur:n})} ${Re(e,{battery:t,grid:o,individual:i,newDur:n})}`)(this._config,{battery:a,grid:o,individual:s,newDur:l,solar:i})}</div>${k=this._config,x=this.hass,k.dashboard_link||k.second_dashboard_link?ne`<div class="card-actions">${k.dashboard_link?ne`<ha-button appearance="plain" size="small" href="${k.dashboard_link}">${k.dashboard_link_label||x.localize("ui.panel.lovelace.cards.energy.energy_distribution.go_to_energy_dashboard")}</ha-button>`:le} ${k.second_dashboard_link?ne`<ha-button appearance="plain" size="small" href="${k.second_dashboard_link}">${k.second_dashboard_link_label||x.localize("ui.panel.lovelace.cards.energy.energy_distribution.go_to_energy_dashboard")}</ha-button>`:le}</div>`:le}</ha-card>`;var k,x}updated(e){if(super.updated(e),!this._config||!this.hass)return;const t=this.shadowRoot?.querySelector("#power-flow-card-plus");if(t){this._resizeObserver||(this._resizeObserver=new ResizeObserver(e=>{const t=e[0];if(!t)return;const o=Math.round(t.contentRect.width);o!==this._width&&(this._width=o)})),this._resizeObserver.observe(t);const e=Math.round(t.getBoundingClientRect().width);e!==this._width&&(this._width=e)}this._tryConnectAll()}willUpdate(e){super.willUpdate(e),this._config&&this.hass&&(e.has("hass")||e.has("_config")||e.has("_templateResults")||e.has("_width")||void 0===this._renderData)&&(this.style.setProperty("--clickable-cursor",!1!==this._config.clickable_entities?"pointer":"default"),this._renderData=this._computeRenderData())}_computeRenderData(){const{entities:e}=this._config,t=null,o={entity:e.grid?.entity,has:void 0!==e?.grid?.entity,hasReturnToGrid:"string"==typeof e.grid?.entity||!!e.grid?.entity?.production,state:{fromGrid:Io(this.hass,this._config),toGrid:(i=this.hass,a=this._config,Mo(i,a,"grid")),toBattery:t,toHome:t},powerOutage:{has:void 0!==e.grid?.power_outage?.entity,isOutage:(e.grid&&this.hass.states[e.grid.power_outage?.entity]?.state)===(e.grid?.power_outage?.state_alert??"on"),icon:e.grid?.power_outage?.icon_alert||"mdi:transmission-tower-off",name:e.grid?.power_outage?.label_alert??Ui`Power<br>Outage`,entityGenerator:e.grid?.power_outage?.entity_generator},icon:Ro(this.hass,e.grid,"mdi:transmission-tower"),name:Ho(this.hass,e.grid,this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.grid")),mainEntity:"object"==typeof e.grid?.entity?e.grid.entity.consumption||e.grid.entity.production:e.grid?.entity,color:{fromGrid:e.grid?.color?.consumption,toGrid:e.grid?.color?.production,icon_type:e.grid?.color_icon,circle_type:e.grid?.color_circle},tap_action:e.grid?.tap_action,hold_action:e.grid?.hold_action,double_tap_action:e.grid?.double_tap_action,secondary:{entity:e.grid?.secondary_info?.entity,decimals:e.grid?.secondary_info?.decimals,template:e.grid?.secondary_info?.template,has:void 0!==e.grid?.secondary_info?.entity,state:jo(this.hass,this._config),icon:e.grid?.secondary_info?.icon,unit:e.grid?.secondary_info?.unit_of_measurement,unit_white_space:e.grid?.secondary_info?.unit_white_space,accept_negative:e.grid?.secondary_info?.accept_negative||!1,color:{type:e.grid?.secondary_info?.color_value},tap_action:e.grid?.secondary_info?.tap_action,hold_action:e.grid?.secondary_info?.hold_action,double_tap_action:e.grid?.secondary_info?.double_tap_action}};var i,a;const n=void 0!==e.solar?.entity,r=(Qo(this.hass,this._config)??0)>0,s=!1!==e.solar?.display_zero||r,l={entity:e.solar?.entity,has:n&&s,state:{total:Qo(this.hass,this._config),toHome:t,toGrid:t,toBattery:t},icon:Ro(this.hass,e.solar,"mdi:solar-power"),name:Ho(this.hass,e.solar,this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.solar")),tap_action:e.solar?.tap_action,hold_action:e.solar?.hold_action,double_tap_action:e.solar?.double_tap_action,secondary:{entity:e.solar?.secondary_info?.entity,decimals:e.solar?.secondary_info?.decimals,template:e.solar?.secondary_info?.template,has:void 0!==e.solar?.secondary_info?.entity,accept_negative:e.solar?.secondary_info?.accept_negative||!1,state:ei(this.hass,this._config),icon:e.solar?.secondary_info?.icon,unit:e.solar?.secondary_info?.unit_of_measurement,unit_white_space:e.solar?.secondary_info?.unit_white_space,tap_action:e.solar?.secondary_info?.tap_action,hold_action:e.solar?.secondary_info?.hold_action,double_tap_action:e.solar?.secondary_info?.double_tap_action}},c={entity:e.battery?.entity,has:!!e.battery?.entity&&("object"==typeof e.battery?.entity?e.battery?.entity.consumption||e.battery?.entity.production:void 0!==e.battery?.entity),mainEntity:"object"==typeof e.battery?.entity?e.battery.entity.consumption:e.battery?.entity,name:Ho(this.hass,e.battery,this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.battery")),icon:Ro(this.hass,e.battery,"mdi:battery-high"),state_of_charge:{state:zo(this.hass,this._config),unit:e?.battery?.state_of_charge_unit??"%",unit_white_space:e?.battery?.state_of_charge_unit_white_space??!0,decimals:e?.battery?.state_of_charge_decimals||0},state:{toBattery:Oo(this.hass,this._config),fromBattery:No(this.hass,this._config),toGrid:0,toHome:0},tap_action:e.battery?.tap_action,hold_action:e.battery?.hold_action,double_tap_action:e.battery?.double_tap_action,color:{fromBattery:e.battery?.color?.consumption,toBattery:e.battery?.color?.production,icon_type:void 0,circle_type:e.battery?.color_circle}},d={entity:e.home?.entity,has:void 0!==e?.home?.entity,state:t,icon:Ro(this.hass,e?.home,"mdi:home"),name:Ho(this.hass,e?.home,Eo("editor.home")),tap_action:e.home?.tap_action,hold_action:e.home?.hold_action,double_tap_action:e.home?.double_tap_action,secondary:{entity:e.home?.secondary_info?.entity,template:e.home?.secondary_info?.template,has:void 0!==e.home?.secondary_info?.entity,state:Bo(this.hass,this._config),accept_negative:e.home?.secondary_info?.accept_negative||!1,unit:e.home?.secondary_info?.unit_of_measurement,unit_white_space:e.home?.secondary_info?.unit_white_space,icon:e.home?.secondary_info?.icon,decimals:e.home?.secondary_info?.decimals,tap_action:e.home?.secondary_info?.tap_action,hold_action:e.home?.secondary_info?.hold_action,double_tap_action:e.home?.secondary_info?.double_tap_action}},u=e.individual?.map(e=>Xo({hass:this.hass,config:this._config,field:e}))||[],h={entity:e.fossil_fuel_percentage?.entity,name:Ho(this.hass,e.fossil_fuel_percentage,this.hass.localize("card.label.non_fossil_fuel_percentage")),icon:Ro(this.hass,e.fossil_fuel_percentage,"mdi:leaf"),has:qo(this.hass,this._config),hasPercentage:Ko(this.hass,this._config),state:{power:t},color:e.fossil_fuel_percentage?.color,color_value:e.fossil_fuel_percentage?.color_value,tap_action:e.fossil_fuel_percentage?.tap_action,hold_action:e.fossil_fuel_percentage?.hold_action,double_tap_action:e.fossil_fuel_percentage?.double_tap_action,secondary:{entity:e.fossil_fuel_percentage?.secondary_info?.entity,decimals:e.fossil_fuel_percentage?.secondary_info?.decimals,template:e.fossil_fuel_percentage?.secondary_info?.template,has:void 0!==e.fossil_fuel_percentage?.secondary_info?.entity,state:Jo(this.hass,this._config),accept_negative:e.fossil_fuel_percentage?.secondary_info?.accept_negative||!1,icon:e.fossil_fuel_percentage?.secondary_info?.icon,unit:e.fossil_fuel_percentage?.secondary_info?.unit_of_measurement,unit_white_space:e.fossil_fuel_percentage?.secondary_info?.unit_white_space,color_value:e.fossil_fuel_percentage?.secondary_info?.color_value,tap_action:e.fossil_fuel_percentage?.secondary_info?.tap_action,hold_action:e.fossil_fuel_percentage?.secondary_info?.hold_action,double_tap_action:e.fossil_fuel_percentage?.secondary_info?.double_tap_action}};o.state.fromGrid=Zo(o.state.fromGrid,e.grid?.display_zero_tolerance),o.state.toGrid=Zo(o.state.toGrid,e.grid?.display_zero_tolerance);const p=0!==(o.state.fromGrid??0)||0!==(o.state.toGrid??0);!1!==e.grid?.display_zero||p||(o.has=!1),l.state.total=Zo(l.state.total,e.solar?.display_zero_tolerance),c.state.fromBattery=Zo(c.state.fromBattery,e.battery?.display_zero_tolerance),c.state.toBattery=Zo(c.state.toBattery,e.battery?.display_zero_tolerance);const _=0!==(c.state.fromBattery??0)||0!==(c.state.toBattery??0);!1!==e.battery?.display_zero||_||(c.has=!1),0===o.state.fromGrid&&(o.state.toHome=0,o.state.toBattery=0),0===l.state.total&&(l.state.toGrid=0,l.state.toBattery=0,l.state.toHome=0),0===c.state.fromBattery&&(c.state.toGrid=0,c.state.toHome=0),function(e){const{entities:t,grid:o,solar:i,battery:a,nonFossil:n,getEntityStateWatts:r,getEntityState:s}=e;i.has&&(i.state.toHome=(i.state.total??0)-(o.state.toGrid??0)-(a.state.toBattery??0));const l=Math.max(t.grid?.display_zero_tolerance??0,t.battery?.display_zero_tolerance??0);if(null!==i.state.toHome&&i.state.toHome<0?(a.has&&(o.state.toBattery=Math.abs(i.state.toHome),o.state.toBattery>(o.state.fromGrid??0)&&(a.state.toGrid=Math.min(o.state.toBattery-(o.state.fromGrid??0),0),o.state.toBattery=o.state.fromGrid)),i.state.toHome=0):null!==a.state.toBattery&&a.state.toBattery>0?(i.state.toBattery=(i.state.total??0)-(i.state.toHome||0)-(o.state.toGrid||0),o.state.toBattery=(a.state.toBattery??0)-i.state.toBattery):o.state.toBattery=0,o.state.toBattery=(o.state.toBattery??0)>l?o.state.toBattery:0,a.has&&(i.has?(a.state.toGrid||(a.state.toGrid=Math.max(0,(o.state.toGrid||0)-(i.state.total||0)-(a.state.toBattery||0)-(o.state.toBattery||0))),i.state.toBattery=(a.state.toBattery??0)-(o.state.toBattery||0),t.solar?.display_zero_tolerance&&t.solar.display_zero_tolerance>=(i.state.total||0)&&(i.state.toBattery=0)):a.state.toGrid=o.state.toGrid||0,a.state.toGrid=(a.state.toGrid||0)>l&&a.state.toGrid||0,a.state.toHome=(a.state.fromBattery??0)-(a.state.toGrid??0)),o.state.toHome=Math.max((o.state.fromGrid??0)-(o.state.toBattery??0),0),i.has&&o.state.toGrid&&(i.state.toGrid=o.state.toGrid-(a.state.toGrid??0)),o.powerOutage.isOutage&&(o.state.fromGrid=o.powerOutage.entityGenerator?Math.max(r(o.powerOutage.entityGenerator),0):0,o.state.toHome=Math.max((o.state.fromGrid??0)-(o.state.toBattery??0),0),o.state.toGrid=0,a.state.toGrid=0,i.state.toGrid=0,o.icon=o.powerOutage.icon,n.has=!1,n.hasPercentage=!1),n.has){const e=1-(s(t.fossil_fuel_percentage?.entity)??0)/100;n.state.power=(o.state.toHome??0)*e}}({entities:{grid:e.grid,battery:e.battery,solar:e.solar,fossil_fuel_percentage:e.fossil_fuel_percentage},grid:o,solar:l,battery:c,nonFossil:h,getEntityStateWatts:e=>nt(this.hass,e),getEntityState:e=>it(this.hass,e)}),o.has||(o.state.fromGrid=0,o.state.toGrid=0,o.state.toHome=0,o.state.toBattery=0,l.state.toGrid=0,c.state.toGrid=0,h.has=!1,h.hasPercentage=!1,h.state.power=0);const f=u?.reduce((e,t)=>e+(t.has&&t.state||0),0)||0,g=Math.max((o.state.toHome??0)+(l.state.toHome??0)+(c.state.toHome??0),0),y=c.state.toHome?lt*(c.state.toHome/g):0,v=l.state.toHome?lt*(l.state.toHome/g):0,b=h.state.power?lt*(h.state.power/g):0,w=lt*((g-(h.state.power??0)-(c.state.toHome??0)-(l.state.toHome??0))/g),k=e.home?.override_state&&e.home.entity?e.home?.subtract_individual?m(this.hass,this._config,nt(this.hass,e.home.entity)-f,{unit:e.home?.unit_of_measurement,unitWhiteSpace:e.home?.unit_white_space}):m(this.hass,this._config,nt(this.hass,e.home.entity),{unit:e.home?.unit_of_measurement,unitWhiteSpace:e.home?.unit_white_space}):e.home?.subtract_individual?m(this.hass,this._config,g-f||0,{unit:e.home?.unit_of_measurement,unitWhiteSpace:e.home?.unit_white_space}):m(this.hass,this._config,g,{unit:e.home?.unit_of_measurement,unitWhiteSpace:e.home?.unit_white_space}),x=(o.state.toHome??0)+(l.state.toHome??0)+(l.state.toGrid??0)+(l.state.toBattery??0)+(c.state.toHome??0)+(o.state.toBattery??0)+(c.state.toGrid??0);null===c.state_of_charge.state?c.icon="mdi:battery":c.state_of_charge.state<=72&&c.state_of_charge.state>44?c.icon="mdi:battery-medium":c.state_of_charge.state<=44&&c.state_of_charge.state>16?c.icon="mdi:battery-low":c.state_of_charge.state<=16&&(c.icon="mdi:battery-outline"),void 0!==e.battery?.icon&&(c.icon=e.battery?.icon);const S=e.battery?.use_metadata;if(S){const t=Ro(this.hass,e.battery,"NO_ICON_METADATA");"NO_ICON_METADATA"!==t&&(c.icon=t)}const $={batteryGrid:Xe(this._config,Math.max(o.state.toBattery??0,c.state.toGrid??0,0),x),batteryToHome:Xe(this._config,c.state.toHome??0,x),gridToHome:Xe(this._config,o.state.toHome??0,x),solarToBattery:Xe(this._config,l.state.toBattery??0,x),solarToGrid:Xe(this._config,l.state.toGrid??0,x),solarToHome:Xe(this._config,l.state.toHome??0,x),individual:u?.map(e=>Xe(this._config,e.state??0,f))||[],nonFossil:Xe(this._config,h.state.power??0,x)};if(Ee(this._config)){["batteryGrid","batteryToHome","gridToHome","solarToBattery","solarToGrid","solarToHome"].forEach(e=>{const t=this[`${e}Flow`];t&&this.previousDur[e]&&this.previousDur[e]!==$[e]&&(t.pauseAnimations(),t.setCurrentTime(t.getCurrentTime()*($[e]/this.previousDur[e])),t.unpauseAnimations()),this.previousDur[e]=$[e]})}else this.previousDur={};const E={battery:{value:y,color:"var(--energy-battery-out-color)"},solar:{value:v,color:"var(--energy-solar-color)"},grid:{value:w,color:"var(--energy-grid-consumption-color)"},gridNonFossil:{value:b,color:"var(--energy-non-fossil-color)"}},C=Object.keys(E).reduce((e,t)=>E[e].value>E[t].value?e:t),A=["left-top","left-bottom","right-top","right-bottom"],D={gridSecondary:this._templateResults.gridSecondary?.result,solarSecondary:this._templateResults.solarSecondary?.result,homeSecondary:this._templateResults.homeSecondary?.result,nonFossilFuelSecondary:this._templateResults.nonFossilFuelSecondary?.result,individual:u?.map((e,t)=>this._templateResults[`${A[t]}Secondary`]?.result)||[]},P=this._width>420,M=this._config.sort_individual_devices?(e=>e.map((e,t)=>({obj:e,index:t})).sort((e,t)=>{const o=(t.obj.state||0)-(e.obj.state||0);if(0!==o)return o;const i=e.obj.entity.localeCompare(t.obj.entity);return 0!==i?i:e.index-t.index}).map(({obj:e})=>e))(u):u,T=this._config.allow_layout_break||this._width>=this.wideEnoughForFourIndividuals?4:2,z=M.filter(e=>e.has).slice(0,T),O=(e=>Ce(e,0))(z),N=Ae(z),I=De(z),j=Pe(z);return((e,t)=>{const{grid:o,solar:i,entities:a,individual:n,battery:r,homeSources:s,homeLargestSource:l,nonFossil:c,display_zero_lines_transparency:d,display_zero_lines_grey_color:u,isCardWideEnough:h}=t;if(e.style.setProperty("--icon-grid-color","consumption"===o.color.icon_type?"var(--energy-grid-consumption-color)":"production"===o.color.icon_type?"var(--energy-grid-return-color)":"color_dynamically"===o.color.icon_type?(o.state.fromGrid??0)>=(o.state.toGrid??0)?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)":"var(--primary-text-color)"),e.style.setProperty("--circle-grid-color","consumption"===o.color.circle_type?"var(--energy-grid-consumption-color)":"production"===o.color.circle_type?"var(--energy-grid-return-color)":"no_color"!==o.color.circle_type?(o.state.fromGrid??0)>=(o.state.toGrid??0)?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)":"var(--energy-grid-consumption-color)"),void 0!==o.color.fromGrid&&("object"==typeof o.color.fromGrid&&(o.color.fromGrid=ii(o.color.fromGrid)),e.style.setProperty("--energy-grid-consumption-color",o.color.fromGrid||"#a280db")),void 0!==o.color.toGrid&&("object"==typeof o.color.toGrid&&(o.color.toGrid=ii(o.color.toGrid)),e.style.setProperty("--energy-grid-return-color",o.color.toGrid||"#a280db")),e.style.setProperty("--secondary-text-grid-color","consumption"===o.secondary.color.type?"var(--energy-grid-consumption-color)":"production"===o.secondary.color.type?"var(--energy-grid-return-color)":!0===o.secondary.color.type?(o.state.fromGrid??0)>=(o.state.toGrid??0)?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)":"var(--primary-text-color)"),!1===a.grid?.color_value?(e.style.setProperty("--text-grid-consumption-color","var(--primary-text-color)"),e.style.setProperty("--text-grid-return-color","var(--primary-text-color)")):(e.style.setProperty("--text-grid-consumption-color","var(--energy-grid-consumption-color)"),e.style.setProperty("--text-grid-return-color","var(--energy-grid-return-color)")),e.style.setProperty("--text-solar-color",a.solar?.color_value?"var(--energy-solar-color)":"var(--primary-text-color)"),e.style.setProperty("--secondary-text-solar-color",a.solar?.secondary_info?.color_value?"var(--energy-solar-color)":"var(--primary-text-color)"),void 0!==a.solar?.color){let t=a.solar.color;"object"==typeof t&&(t=ii(t)),e.style.setProperty("--energy-solar-color",t||"#ff9800")}e.style.setProperty("--icon-solar-color",a.solar?.color_icon?"var(--energy-solar-color)":"var(--primary-text-color)"),void 0!==r.color.fromBattery&&("object"==typeof r.color.fromBattery&&(r.color.fromBattery=ii(r.color.fromBattery)),e.style.setProperty("--energy-battery-out-color",r.color.fromBattery||"#4db6ac")),void 0!==r.color.toBattery&&("object"==typeof r.color.toBattery&&(r.color.toBattery=ii(r.color.toBattery)),e.style.setProperty("--energy-battery-in-color",r.color.toBattery||"#a280db")),r.color.icon_type=a.battery?.color_icon,e.style.setProperty("--icon-battery-color","consumption"===r.color.icon_type?"var(--energy-battery-in-color)":"production"===r.color.icon_type?"var(--energy-battery-out-color)":"color_dynamically"===r.color.icon_type?r.state.fromBattery>=r.state.toBattery?"var(--energy-battery-out-color)":"var(--energy-battery-in-color)":"var(--primary-text-color)");const p=a.battery?.color_state_of_charge_value;if(e.style.setProperty("--text-battery-state-of-charge-color","consumption"===p?"var(--energy-battery-in-color)":"production"===p?"var(--energy-battery-out-color)":"color_dynamically"===p?r.state.fromBattery>=r.state.toBattery?"var(--energy-battery-out-color)":"var(--energy-battery-in-color)":"var(--primary-text-color)"),e.style.setProperty("--circle-battery-color","consumption"===r.color.circle_type?"var(--energy-battery-in-color)":"production"===r.color.circle_type||"no_color"!==r.color.circle_type&&r.state.fromBattery>=r.state.toBattery?"var(--energy-battery-out-color)":"var(--energy-battery-in-color)"),!1===a.battery?.color_value?(e.style.setProperty("--text-battery-in-color","var(--primary-text-color)"),e.style.setProperty("--text-battery-out-color","var(--primary-text-color)")):(e.style.setProperty("--text-battery-in-color","var(--energy-battery-in-color)"),e.style.setProperty("--text-battery-out-color","var(--energy-battery-out-color)")),void 0!==c.color&&("object"==typeof c.color&&(c.color=ii(c.color)),e.style.setProperty("--non-fossil-color",c.color||"var(--energy-non-fossil-color)")),e.style.setProperty("--icon-non-fossil-color",a.fossil_fuel_percentage?.color_icon?"var(--non-fossil-color)":"var(--primary-text-color)"),e.style.setProperty("--text-non-fossil-color",a.fossil_fuel_percentage?.color_value?"var(--non-fossil-color)":"var(--primary-text-color)"),e.style.setProperty("--secondary-text-non-fossil-color",a.fossil_fuel_percentage?.secondary_info?.color_value?"var(--non-fossil-color)":"var(--primary-text-color)"),e.style.setProperty("--secondary-text-home-color",a.home?.secondary_info?.color_value?"var(--text-home-color)":"var(--primary-text-color)"),e.style.setProperty("--icon-home-color",oi(a.home?.color_icon,s,l)),e.style.setProperty("--text-home-color",oi(a.home?.color_value,s,l)),!1===a.home?.circle_animation&&e.style.setProperty("--home-circle-animation","none"),e.style.setProperty("--battery-grid-line",o.state.toBattery?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)"),e.style.setProperty("--transparency-unused-lines",d?d.toString():"0"),void 0!==u){let t=u;"object"==typeof t&&(t=ii(t)),e.style.setProperty("--greyed-out--line-color",t)}if(i.has&&(r.has?(e.style.setProperty("--lines-svg-not-flat-line-height","106%"),e.style.setProperty("--lines-svg-not-flat-line-top","-3%"),e.style.setProperty("--lines-svg-flat-width","calc(100% - 160px)"),e.style.setProperty("--lines-svg-flat-left","0"),e.style.setProperty("--lines-svg-not-flat-left","0")):(e.style.setProperty("--lines-svg-not-flat-line-top","-2%"),e.style.setProperty("--lines-svg-flat-width",h?"calc(100% - 154px)":"calc(100% - 157px)"),e.style.setProperty("--lines-svg-not-flat-width",h?"calc(103% - 172px)":"calc(103% - 169px)"),e.style.setProperty("--lines-svg-not-flat-left","3px"),e.style.setProperty("--lines-svg-flat-left","-3px"))),n?.some(e=>e.has)){const t=(t,o)=>{const i=["left-top","left-bottom","right-top","right-bottom"][o]||"left-top";let a=t?.color;"object"==typeof a&&(a=ii(a)),e.style.setProperty(`--individual-${i}-color`,a||["#d0cc5b","#964cb5","#b54c9d","#5bd0cc"][o]||"#d0cc5b"),e.style.setProperty(`--icon-individual-${i}-color`,!1!==t?.color_icon?`var(--individual-${i}-color)`:"var(--primary-text-color)"),e.style.setProperty(`--text-individual-${i}-color`,t?.color_value?`var(--individual-${i}-color)`:"var(--primary-text-color)"),e.style.setProperty(`--secondary-text-individual-${i}-color`,t?.secondary_info?.color_value?`var(--individual-${i}-color)`:"var(--primary-text-color)")},o=n.filter(e=>e?.has);for(let e=0;e<(o.length<4?o.length:4);e++){const i=o[e];i&&t(i.field||{},e)}}})(this,{grid:o,solar:l,battery:c,display_zero_lines_grey_color:"grey_out"===this._config.display_zero_lines?.mode?this._config.display_zero_lines?.grey_color:"",display_zero_lines_transparency:"transparency"===this._config.display_zero_lines?.mode?this._config.display_zero_lines?.transparency:void 0,entities:e,homeLargestSource:C,homeSources:E,individual:M,nonFossil:h,isCardWideEnough:P}),{entities:e,grid:o,solar:l,battery:c,home:d,nonFossil:h,individualObjs:z,newDur:$,templatesObj:D,homeBatteryCircumference:y,homeSolarCircumference:v,homeNonFossilCircumference:b,homeGridCircumference:w,homeUsageToDisplay:k,sortedIndividualObjects:z,individualFieldLeftTop:O,individualFieldLeftBottom:N,individualFieldRightTop:I,individualFieldRightBottom:j}}_tryConnectAll(){const{entities:e}=this._config,t={gridSecondary:e.grid?.secondary_info?.template,solarSecondary:e.solar?.secondary_info?.template,homeSecondary:e.home?.secondary_info?.template,individualSecondary:e.individual?.map(e=>e.secondary_info?.template),nonFossilFuelSecondary:e.fossil_fuel_percentage?.secondary_info?.template};for(const[e,o]of Object.entries(t))if(o)if(Array.isArray(o)){const e=["left-top","left-bottom","right-top","right-bottom"];o.forEach((t,o)=>{t&&this._tryConnect(t,`${e[o]}Secondary`)})}else this._tryConnect(o,e)}async _tryConnect(e,t){var o,i,a;if(this.hass&&this._config&&void 0===this._unsubRenderTemplates?.get(t)&&""!==e)try{const n=this._config.entity_id,r="string"==typeof n||Array.isArray(n)&&n.every(e=>"string"==typeof e)?n:void 0,s=(o=this.hass.connection,i=e=>{this._templateResults[t]=e},a={template:e,entity_ids:r,variables:{config:this._config,user:this.hass.user.name},strict:!0},o.subscribeMessage(e=>i(e),{type:"render_template",...a}));this._unsubRenderTemplates?.set(t,s),await s}catch{this._templateResults={...this._templateResults,[t]:{result:e,listeners:{all:!1,domains:[],entities:[],time:!1}}},this._unsubRenderTemplates?.delete(t)}}async _tryDisconnectAll(){const{entities:e}=this._config,t={gridSecondary:e.grid?.secondary_info?.template,solarSecondary:e.solar?.secondary_info?.template,homeSecondary:e.home?.secondary_info?.template,individualSecondary:e.individual?.map(e=>e.secondary_info?.template)};for(const[e,o]of Object.entries(t))o&&this._tryDisconnect(e)}async _tryDisconnect(e){const t=this._unsubRenderTemplates?.get(e);if(t)try{(await t)(),this._unsubRenderTemplates?.delete(e)}catch(e){if("not_found"!==e.code&&"template_error"!==e.code)throw e}}};fa.styles=ai,e([ha({attribute:!1}),t("design:type",Object)],fa.prototype,"hass",void 0),e([pa(),t("design:type",Object)],fa.prototype,"_config",void 0),e([pa(),t("design:type",Object)],fa.prototype,"_templateResults",void 0),e([pa(),t("design:type",Map)],fa.prototype,"_unsubRenderTemplates",void 0),e([pa(),t("design:type",Object)],fa.prototype,"_width",void 0),e([_a("#battery-grid-flow"),t("design:type",SVGSVGElement)],fa.prototype,"batteryGridFlow",void 0),e([_a("#battery-home-flow"),t("design:type",SVGSVGElement)],fa.prototype,"batteryToHomeFlow",void 0),e([_a("#grid-home-flow"),t("design:type",SVGSVGElement)],fa.prototype,"gridToHomeFlow",void 0),e([_a("#solar-battery-flow"),t("design:type",SVGSVGElement)],fa.prototype,"solarToBatteryFlow",void 0),e([_a("#solar-grid-flow"),t("design:type",SVGSVGElement)],fa.prototype,"solarToGridFlow",void 0),e([_a("#solar-home-flow"),t("design:type",SVGSVGElement)],fa.prototype,"solarToHomeFlow",void 0),fa=e([da("power-flow-card-plus")],fa);const ga="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,ya=(e,t,o=null)=>{for(;t!==o;){const o=t.nextSibling;e.removeChild(t),t=o}},va=`{{lit-${String(Math.random()).slice(2)}}}`,ba=`\x3c!--${va}--\x3e`,wa=new RegExp(`${va}|${ba}`),ka="$lit$";class xa{constructor(e,t){this.parts=[],this.element=t;const o=[],i=[],a=document.createTreeWalker(t.content,133,null,!1);let n=0,r=-1,s=0;const{strings:l,values:{length:c}}=e;for(;s<c;){const e=a.nextNode();if(null!==e){if(r++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:o}=t;let i=0;for(let e=0;e<o;e++)Sa(t[e].name,ka)&&i++;for(;i-- >0;){const t=l[s],o=Ca.exec(t)[2],i=o.toLowerCase()+ka,a=e.getAttribute(i);e.removeAttribute(i);const n=a.split(wa);this.parts.push({type:"attribute",index:r,name:o,strings:n}),s+=n.length-1}}"TEMPLATE"===e.tagName&&(i.push(e),a.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(va)>=0){const i=e.parentNode,a=t.split(wa),n=a.length-1;for(let t=0;t<n;t++){let o,n=a[t];if(""===n)o=Ea();else{const e=Ca.exec(n);null!==e&&Sa(e[2],ka)&&(n=n.slice(0,e.index)+e[1]+e[2].slice(0,-5)+e[3]),o=document.createTextNode(n)}i.insertBefore(o,e),this.parts.push({type:"node",index:++r})}""===a[n]?(i.insertBefore(Ea(),e),o.push(e)):e.data=a[n],s+=n}}else if(8===e.nodeType)if(e.data===va){const t=e.parentNode;null!==e.previousSibling&&r!==n||(r++,t.insertBefore(Ea(),e)),n=r,this.parts.push({type:"node",index:r}),null===e.nextSibling?e.data="":(o.push(e),r--),s++}else{let t=-1;for(;-1!==(t=e.data.indexOf(va,t+1));)this.parts.push({type:"node",index:-1}),s++}}else a.currentNode=i.pop()}for(const e of o)e.parentNode.removeChild(e)}}const Sa=(e,t)=>{const o=e.length-t.length;return o>=0&&e.slice(o)===t},$a=e=>-1!==e.index,Ea=()=>document.createComment(""),Ca=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Aa(e,t){const{element:{content:o},parts:i}=e,a=document.createTreeWalker(o,133,null,!1);let n=Pa(i),r=i[n],s=-1,l=0;const c=[];let d=null;for(;a.nextNode();){s++;const e=a.currentNode;for(e.previousSibling===d&&(d=null),t.has(e)&&(c.push(e),null===d&&(d=e)),null!==d&&l++;void 0!==r&&r.index===s;)r.index=null!==d?-1:r.index-l,n=Pa(i,n),r=i[n]}c.forEach(e=>e.parentNode.removeChild(e))}const Da=e=>{let t=11===e.nodeType?0:1;const o=document.createTreeWalker(e,133,null,!1);for(;o.nextNode();)t++;return t},Pa=(e,t=-1)=>{for(let o=t+1;o<e.length;o++){const t=e[o];if($a(t))return o}return-1};const Ma=new WeakMap,Ta=e=>"function"==typeof e&&Ma.has(e),za={},Oa={};class Na{constructor(e,t,o){this.__parts=[],this.template=e,this.processor=t,this.options=o}update(e){let t=0;for(const o of this.__parts)void 0!==o&&o.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=ga?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let a,n=0,r=0,s=i.nextNode();for(;n<o.length;)if(a=o[n],$a(a)){for(;r<a.index;)r++,"TEMPLATE"===s.nodeName&&(t.push(s),i.currentNode=s.content),null===(s=i.nextNode())&&(i.currentNode=t.pop(),s=i.nextNode());if("node"===a.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(s.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(s,a.name,a.strings,this.options));n++}else this.__parts.push(void 0),n++;return ga&&(document.adoptNode(e),customElements.upgrade(e)),e}}const Ia=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),ja=` ${va} `;class Ba{constructor(e,t,o,i){this.strings=e,this.values=t,this.type=o,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",o=!1;for(let i=0;i<e;i++){const e=this.strings[i],a=e.lastIndexOf("\x3c!--");o=(a>-1||o)&&-1===e.indexOf("--\x3e",a+1);const n=Ca.exec(e);t+=null===n?e+(o?ja:ba):e.substr(0,n.index)+n[1]+n[2]+ka+n[3]+va}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==Ia&&(t=Ia.createHTML(t)),e.innerHTML=t,e}}class La{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Ea()),this.endNode=e.appendChild(Ea())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Ea()),e.__insert(this.endNode=Ea())}insertAfterPart(e){e.__insert(this.startNode=Ea()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;Ta(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=za,e(this)}const e=this.__pendingValue;e!==za&&((e=>null===e||!("object"==typeof e||"function"==typeof e))(e)?e!==this.value&&this.__commitText(e):e instanceof Ba?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):(e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]))(e)?this.__commitIterable(e):e===Oa?(this.value=Oa,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,o="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof Na&&this.value.template===t)this.value.update(e.values);else{const o=new Na(t,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let o,i=0;for(const a of e)o=t[i],void 0===o&&(o=new La(this.options),t.push(o),0===i?o.appendIntoPart(this):o.insertAfterPart(t[i-1])),o.setValue(a),o.commit(),i++;i<t.length&&(t.length=i,this.clear(o&&o.endNode))}clear(e=this.startNode){ya(this.startNode.parentNode,e.nextSibling,this.endNode)}}let Ra=!1;function Ha(e){let t=Ua.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},Ua.set(e.type,t));let o=t.stringsArray.get(e.strings);if(void 0!==o)return o;const i=e.strings.join(va);return o=t.keyString.get(i),void 0===o&&(o=new xa(e,e.getTemplateElement()),t.keyString.set(i,o)),t.stringsArray.set(e.strings,o),o}(()=>{try{const e={get capture(){return Ra=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();const Ua=new Map,Fa=new WeakMap;"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const Ga=(e,t)=>`${e}--${t}`;let Va=!0;void 0===window.ShadyCSS?Va=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Va=!1);const Wa=e=>t=>{const o=Ga(t.type,e);let i=Ua.get(o);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},Ua.set(o,i));let a=i.stringsArray.get(t.strings);if(void 0!==a)return a;const n=t.strings.join(va);if(a=i.keyString.get(n),void 0===a){const o=t.getTemplateElement();Va&&window.ShadyCSS.prepareTemplateDom(o,e),a=new xa(t,o),i.keyString.set(n,a)}return i.stringsArray.set(t.strings,a),a},Za=["html","svg"],Ya=new Set,Xa=(e,t,o)=>{Ya.add(e);const i=o?o.element:document.createElement("template"),a=t.querySelectorAll("style"),{length:n}=a;if(0===n)return void window.ShadyCSS.prepareTemplateStyles(i,e);const r=document.createElement("style");for(let e=0;e<n;e++){const t=a[e];t.parentNode.removeChild(t),r.textContent+=t.textContent}(e=>{Za.forEach(t=>{const o=Ua.get(Ga(t,e));void 0!==o&&o.keyString.forEach(e=>{const{element:{content:t}}=e,o=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{o.add(e)}),Aa(e,o)})})})(e);const s=i.content;o?function(e,t,o=null){const{element:{content:i},parts:a}=e;if(null==o)return void i.appendChild(t);const n=document.createTreeWalker(i,133,null,!1);let r=Pa(a),s=0,l=-1;for(;n.nextNode();)for(l++,n.currentNode===o&&(s=Da(t),o.parentNode.insertBefore(t,o));-1!==r&&a[r].index===l;){if(s>0){for(;-1!==r;)a[r].index+=s,r=Pa(a,r);return}r=Pa(a,r)}}(o,r,s.firstChild):s.insertBefore(r,s.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(o){s.insertBefore(r,s.firstChild);const e=new Set;e.add(r),Aa(o,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const qa={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Ka=(e,t)=>t!==e&&(t==t||e==e),Ja={attribute:!0,type:String,converter:qa,reflect:!1,hasChanged:Ka},Qa="finalized";class en extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,o)=>{const i=this._attributeNameForProperty(o,t);void 0!==i&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=Ja){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const o="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,o){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdateInternal(e,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Ja}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Qa)||e.finalize(),this[Qa]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const o of t)this.createProperty(o,e[o])}}static _attributeNameForProperty(e,t){const o=t.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,o=Ka){return o(e,t)}static _propertyValueFromAttribute(e,t){const o=t.type,i=t.converter||qa,a="function"==typeof i?i:i.fromAttribute;return a?a(e,o):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const o=t.type,i=t.converter;return(i&&i.toAttribute||qa.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,o){t!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,t,o=Ja){const i=this.constructor,a=i._attributeNameForProperty(e,o);if(void 0!==a){const e=i._propertyValueToAttribute(t,o);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(a):this.setAttribute(a,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const o=this.constructor,i=o._attributeToPropertyMap.get(e);if(void 0!==i){const e=o.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=o._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,o){let i=!0;if(void 0!==e){const a=this.constructor;o=o||a.getPropertyOptions(e),a._valueHasChanged(this[e],t,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==o.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}en[Qa]=!0;const tn=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(o){o.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(o){o.createProperty(t.key,e)}};function on(e){return(t,o)=>void 0!==o?((e,t,o)=>{t.constructor.createProperty(o,e)})(e,t,o):tn(e,t)}const an=e=>on({attribute:!1,hasChanged:void 0});const nn=(e,t,o)=>{Object.defineProperty(t,o,e)},rn=(e,t)=>({kind:"method",placement:"prototype",key:t.key,descriptor:e}),sn=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ln=Symbol();class cn{constructor(e,t){if(t!==ln)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(sn?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const dn={};class un extends en{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,o)=>e.reduceRight((e,o)=>Array.isArray(o)?t(o,e):(e.add(o),e),o),o=t(e,new Set),i=[];o.forEach(e=>i.unshift(e)),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!sn){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return new cn(String(t),ln)}return e})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?sn?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==dn&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return dn}}un.finalized=!0,un.render=(e,t,o)=>{if(!o||"object"!=typeof o||!o.scopeName)throw new Error("The `scopeName` option is required.");const i=o.scopeName,a=Fa.has(t),n=Va&&11===t.nodeType&&!!t.host,r=n&&!Ya.has(i),s=r?document.createDocumentFragment():t;if(((e,t,o)=>{let i=Fa.get(t);void 0===i&&(ya(t,t.firstChild),Fa.set(t,i=new La(Object.assign({templateFactory:Ha},o))),i.appendInto(t)),i.setValue(e),i.commit()})(e,s,Object.assign({templateFactory:Wa(i)},o)),r){const e=Fa.get(s);Fa.delete(s);const o=e.value instanceof Na?e.value.template:void 0;Xa(i,s,o),ya(t,t.firstChild),t.appendChild(s),Fa.set(t,e)}!a&&n&&window.ShadyCSS.styleElement(t.host)},un.shadowRootOptions={mode:"open"};var hn="M16 20H8V6H16M16.67 4H15V2H9V4H7.33C6.6 4 6 4.6 6 5.33V20.67C6 21.4 6.6 22 7.33 22H16.67C17.41 22 18 21.41 18 20.67V5.33C18 4.6 17.4 4 16.67 4M15 16H9V19H15V16M15 7H9V10H15V7M15 11.5H9V14.5H15V11.5Z",pn="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",_n="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",mn="M17,8C8,10 5.9,16.17 3.82,21.34L5.71,22L6.66,19.7C7.14,19.87 7.64,20 8,20C19,20 22,3 22,3C21,5 14,5.25 9,6.25C4,7.25 2,11.5 2,13.5C2,15.5 3.75,17.25 3.75,17.25C7,8 17,8 17,8Z",fn="M8.28,5.45L6.5,4.55L7.76,2H16.23L17.5,4.55L15.72,5.44L15,4H9L8.28,5.45M18.62,8H14.09L13.3,5H10.7L9.91,8H5.38L4.1,10.55L5.89,11.44L6.62,10H17.38L18.1,11.45L19.89,10.56L18.62,8M17.77,22H15.7L15.46,21.1L12,15.9L8.53,21.1L8.3,22H6.23L9.12,11H11.19L10.83,12.35L12,14.1L13.16,12.35L12.81,11H14.88L17.77,22M11.4,15L10.5,13.65L9.32,18.13L11.4,15M14.68,18.12L13.5,13.64L12.6,15L14.68,18.12Z",gn="M12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,2L14.39,5.42C13.65,5.15 12.84,5 12,5C11.16,5 10.35,5.15 9.61,5.42L12,2M3.34,7L7.5,6.65C6.9,7.16 6.36,7.78 5.94,8.5C5.5,9.24 5.25,10 5.11,10.79L3.34,7M3.36,17L5.12,13.23C5.26,14 5.53,14.78 5.95,15.5C6.37,16.24 6.91,16.86 7.5,17.37L3.36,17M20.65,7L18.88,10.79C18.74,10 18.47,9.23 18.05,8.5C17.63,7.78 17.1,7.15 16.5,6.64L20.65,7M20.64,17L16.5,17.36C17.09,16.85 17.62,16.22 18.04,15.5C18.46,14.77 18.73,14 18.87,13.21L20.64,17M12,22L9.59,18.56C10.33,18.83 11.14,19 12,19C12.82,19 13.63,18.83 14.37,18.56L12,22Z",yn=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function vn(e,t){return e===t||!(!yn(e)||!yn(t))}function bn(e,t){if(e.length!==t.length)return!1;for(var o=0;o<e.length;o++)if(!vn(e[o],t[o]))return!1;return!0}function wn(e,t){void 0===t&&(t=bn);var o=null;function i(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];if(o&&o.lastThis===this&&t(i,o.lastArgs))return o.lastResult;var n=e.apply(this,i);return o={lastResult:n,lastArgs:i,lastThis:this},n}return i.clear=function(){o=null},i}class kn extends TypeError{constructor(e,t){let o;const{message:i,explanation:a,...n}=e,{path:r}=e,s=0===r.length?i:`At path: ${r.join(".")} -- ${i}`;super(a??s),null!=a&&(this.cause=s),Object.assign(this,n),this.name=this.constructor.name,this.failures=()=>o??(o=[e,...t()])}}function xn(e){return"object"==typeof e&&null!=e}function Sn(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function $n(e,t,o,i){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:a,branch:n}=t,{type:r}=o,{refinement:s,message:l=`Expected a value of type \`${r}\`${s?` with refinement \`${s}\``:""}, but received: \`${Sn(i)}\``}=e;return{value:i,type:r,refinement:s,key:a[a.length-1],path:a,branch:n,...e,message:l}}function*En(e,t,o,i){(function(e){return xn(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const a of e){const e=$n(a,t,o,i);e&&(yield e)}}function*Cn(e,t,o={}){const{path:i=[],branch:a=[e],coerce:n=!1,mask:r=!1}=o,s={path:i,branch:a};if(n&&(e=t.coercer(e,s),r&&"type"!==t.type&&xn(t.schema)&&xn(e)&&!Array.isArray(e)))for(const o in e)void 0===t.schema[o]&&delete e[o];let l="valid";for(const i of t.validator(e,s))i.explanation=o.message,l="not_valid",yield[i,void 0];for(let[c,d,u]of t.entries(e,s)){const t=Cn(d,u,{path:void 0===c?i:[...i,c],branch:void 0===c?a:[...a,d],coerce:n,mask:r,message:o.message});for(const o of t)o[0]?(l=null!=o[0].refinement?"not_refined":"not_valid",yield[o[0],void 0]):n&&(d=o[1],void 0===c?e=d:e instanceof Map?e.set(c,d):e instanceof Set?e.add(d):xn(e)&&(void 0!==d||c in e)&&(e[c]=d))}if("not_valid"!==l)for(const i of t.refiner(e,s))i.explanation=o.message,l="not_refined",yield[i,void 0];"valid"===l&&(yield[void 0,e])}class An{constructor(e){const{type:t,schema:o,validator:i,refiner:a,coercer:n=e=>e,entries:r=function*(){}}=e;this.type=t,this.schema=o,this.entries=r,this.coercer=n,this.validator=i?(e,t)=>En(i(e,t),t,this,e):()=>[],this.refiner=a?(e,t)=>En(a(e,t),t,this,e):()=>[]}assert(e,t){return Dn(e,this,t)}create(e,t){return function(e,t,o){const i=Pn(e,t,{coerce:!0,message:o});if(i[0])throw i[0];return i[1]}(e,this,t)}is(e){return function(e,t){const o=Pn(e,t);return!o[0]}(e,this)}mask(e,t){return function(e,t,o){const i=Pn(e,t,{coerce:!0,mask:!0,message:o});if(i[0])throw i[0];return i[1]}(e,this,t)}validate(e,t={}){return Pn(e,this,t)}}function Dn(e,t,o){const i=Pn(e,t,{message:o});if(i[0])throw i[0]}function Pn(e,t,o={}){const i=Cn(e,t,o),a=function(e){const{done:t,value:o}=e.next();return t?void 0:o}(i);if(a[0]){const e=new kn(a[0],function*(){for(const e of i)e[0]&&(yield e[0])});return[e,void 0]}return[void 0,a[1]]}function Mn(...e){const t="type"===e[0].type,o=e.map(e=>e.schema),i=Object.assign({},...o);return t?function(e){const t=Object.keys(e);return new An({type:"type",schema:e,*entries(o){if(xn(o))for(const i of t)yield[i,o[i],e[i]]},validator:e=>xn(e)||`Expected an object, but received: ${Sn(e)}`,coercer:e=>xn(e)?{...e}:e})}(i):jn(i)}function Tn(e,t){return new An({type:e,schema:null,validator:t})}function zn(){return Tn("any",()=>!0)}function On(){return Tn("boolean",e=>"boolean"==typeof e)}function Nn(){return Tn("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Sn(e)}`)}function In(){return Tn("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${Sn(e)}`)}function jn(e){const t=e?Object.keys(e):[],o=Tn("never",()=>!1);return new An({type:"object",schema:e||null,*entries(i){if(e&&xn(i)){const a=new Set(Object.keys(i));for(const o of t)a.delete(o),yield[o,i[o],e[o]];for(const e of a)yield[e,i[e],o]}},validator:e=>xn(e)||`Expected an object, but received: ${Sn(e)}`,coercer:e=>xn(e)?{...e}:e})}function Bn(e){return new An({...e,validator:(t,o)=>void 0===t||e.validator(t,o),refiner:(t,o)=>void 0===t||e.refiner(t,o)})}function Ln(){return Tn("string",e=>"string"==typeof e||`Expected a string, but received: ${Sn(e)}`)}function Rn(){return{type:"expandable",title:Eo("editor.combined"),schema:[{name:"entity",selector:{entity:{}}}]}}function Hn(){return{type:"expandable",title:Eo("editor.separated"),name:"entity",schema:[{name:"consumption",label:"Consumption Entity",selector:{entity:{}}},{name:"production",label:"Production Entity",selector:{entity:{}}}]}}const Un={name:"color",title:Eo("editor.custom_colors"),type:"expandable",schema:[{type:"grid",column_min_width:"200px",schema:[{name:"consumption",label:"Consumption",selector:{color_rgb:{}}},{name:"production",label:"Production",selector:{color_rgb:{}}}]}]},Fn=[{name:"tap_action",selector:{ui_action:{}}},{name:"hold_action",selector:{ui_action:{}}},{name:"double_tap_action",selector:{ui_action:{}}}],Gn=[{name:"entity",selector:{entity:{}}},{name:"template",label:"Template (overrides entity, save to update)",selector:{template:{}}},{type:"grid",column_min_width:"200px",schema:[{name:"icon",selector:{icon:{}}},{name:"unit_of_measurement",label:"Unit of Measurement",selector:{text:{}}},{name:"decimals",label:"Decimals",selector:{number:{mode:"box",min:0,max:10,step:1}}},{name:"color_value",label:"Color Value",selector:{boolean:{}}},{name:"unit_white_space",label:"Unit White Space",default:!0,selector:{boolean:{}}},{name:"display_zero",label:"Display Zero",selector:{boolean:{}}},{name:"accept_negative",label:"Accept Negative",selector:{boolean:{}}},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}}]},{title:Eo("editor.action"),name:"",type:"expandable",schema:Fn}],Vn=[{name:"color_icon",label:"Color of Icon",selector:{select:{options:[{value:"no_color",label:Eo("editor.no_color")},{value:"color_dynamically",label:Eo("editor.color_dynamically")},{value:"production",label:Eo("editor.production")},{value:"consumption",label:Eo("editor.consumption")}],mode:"dropdown"}}},{name:"color_circle",label:"Color of Circle",selector:{select:{options:[{value:"color_dynamically",label:"Color dynamically"},{value:"consumption",label:"Consumption"},{value:"production",label:"Production"}],mode:"dropdown"}}},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{min:0,max:1e6,step:1,mode:"box"}}},{name:"display_state",label:"Display State",selector:{select:{options:[{value:"two_way",label:"Two Way"},{value:"one_way_no_zero",label:"One Way"},{value:"one_way",label:"One Way (Show Zero)"}],mode:"dropdown"}}}];function Wn(e){const t={type:"grid",column_min_width:"200px",schema:[{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]};return"battery"!==e&&"grid"!==e||t.schema.push(...Vn),t}const Zn={...Wn("battery"),schema:[...Wn("battery").schema,{name:"invert_state",label:"Invert State",selector:{boolean:{}}},{name:"color_value",label:"Color of Value",selector:{boolean:{}}},{name:"display_zero",label:"Display Zero",selector:{boolean:{}},default:!0},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]},Yn=[{name:"state_of_charge",label:"State of Charge Entity",selector:{entity:{}}},{name:"",type:"grid",column_min_width:"200px",schema:[{name:"state_of_charge_unit",label:"Unit",selector:{text:{}}},{name:"state_of_charge_unit_white_space",label:"Unit White Space",default:!0,selector:{boolean:{}}},{name:"state_of_charge_decimals",label:"Decimals",selector:{number:{mode:"box",min:0,max:4,step:1}}},{name:"show_state_of_charge",label:"Show State of Charge",selector:{boolean:{}}},{name:"color_state_of_charge_value",label:"Color of Value",selector:{select:{options:[{value:"no_color",label:Eo("editor.no_color")},{value:"color_dynamically",label:Eo("editor.color_dynamically")},{value:"production",label:Eo("editor.production")},{value:"consumption",label:Eo("editor.consumption")}],mode:"dropdown"}}}]}],Xn=[Rn(),Hn(),{title:Eo("editor.state_of_charge"),name:"",type:"expandable",schema:Yn},Zn,Un,{title:Eo("editor.action"),name:"",type:"expandable",schema:Fn}],qn={name:"grey_color",selector:{color_rgb:{}}},Kn={name:"transparency",selector:{number:{min:0,max:100,step:1,mode:"box"}}},Jn={name:"",type:"grid",column_min_width:"200px",schema:[Kn,qn]},Qn=e=>{switch(e){case"grey_out":return qn;case"transparency":return Kn;case"custom":return Jn;default:return[]}},er=wn((e,t)=>[{name:"display_zero_lines",type:"grid",column_min_width:"400px",schema:[{name:"mode",selector:{select:{mode:"dropdown",options:[{value:"show",label:e("editor.show")},{value:"hide",label:e("editor.hide")},{value:"transparency",label:e("editor.transparency")},{value:"grey_out",label:e("editor.grey_out")},{value:"custom",label:e("editor.custom")}]}}},Qn(t)]}]),tr=[{name:"entity",selector:{entity:{}}},{...Wn(),schema:[...Wn().schema,{name:"state_type",label:"State Type",selector:{select:{options:[{value:"power",label:"Power"},{value:"percentage",label:"Percentage"}],mode:"dropdown"}}},{name:"color_value",label:"Color Value",selector:{boolean:{}}},{name:"color_icon",label:"Color Icon",selector:{boolean:{}}},{name:"display_zero",label:"Display Zero",selector:{boolean:{}},default:!0},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}},{name:"display_zero_state",label:"Display Zero State",selector:{boolean:{}},default:!0},{name:"unit_white_space",label:"Unit White Space",selector:{boolean:{}},default:!0},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]},{name:"color",label:"Color",selector:{color_rgb:{}}},{title:Eo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Gn},{title:Eo("editor.action"),name:"",type:"expandable",schema:Fn}],or={...Wn("grid"),schema:[...Wn("grid").schema,{name:"invert_state",label:"Invert State",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}},{name:"color_value",label:"Color of Value",selector:{boolean:{}},default:!0},{name:"display_zero",label:"Display Zero",selector:{boolean:{}},default:!0}]},ir=[Rn(),Hn(),or,Un,{title:Eo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Gn},{title:Eo("editor.power_outage"),name:"power_outage",type:"expandable",schema:[{type:"grid",column_min_width:"200px",schema:[{name:"entity",selector:{entity:{}}},{name:"entity_generator",label:"Generator Entity",selector:{entity:{}}},{name:"label_alert",label:"Outage Label",selector:{text:{}}},{name:"icon_alert",label:"Outage Icon",selector:{icon:{}}},{name:"state_alert",label:"Outage State",selector:{text:{}}}]}]},{title:Eo("editor.action"),name:"",type:"expandable",schema:Fn}],ar=[{name:"entity",selector:{entity:{}}},{...Wn(),schema:[...Wn().schema,{name:"color_value",label:"Color Value",selector:{select:{options:[{value:!0,label:"Color dynamically"},{value:!1,label:"Do Not Color"},{value:"solar",label:"Solar"},{value:"grid",label:"Grid"},{value:"battery",label:"Battery"}],mode:"dropdown"}}},{name:"color_icon",label:"Color Icon",selector:{select:{options:[{value:!0,label:"Color dynamically"},{value:!1,label:"Do Not Color"},{value:"solar",label:"Solar"},{value:"grid",label:"Grid"},{value:"battery",label:"Battery"}],mode:"dropdown"}}},{name:"circle_animation",label:"Circle Animation",default:!0,selector:{boolean:{}}},{name:"subtract_individual",label:"Subtract Individual",selector:{boolean:{}}},{name:"override_state",label:"Override State (With Home Entity)",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}},{name:"hide",label:"Hide Home",selector:{boolean:{}}}]},{title:Eo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Gn},{title:Eo("editor.action"),name:"",type:"expandable",schema:Fn}],nr=[{name:"entity",selector:{entity:{}}},{...Wn(),schema:[...Wn().schema,{name:"color_value",label:"Color Value",selector:{boolean:{}},default:!0},{name:"color_icon",label:"Color Icon",selector:{boolean:{}},default:!0},{name:"display_zero",label:"Display Zero",selector:{boolean:{}},default:!0},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}},{name:"display_zero_state",label:"Display Zero State",selector:{boolean:{}},default:!0},{name:"unit_of_measurement",label:"Unit of Measurement",selector:{text:{}}},{name:"calculate_flow_rate",label:"Calculate Flow Rate",selector:{boolean:{}}},{name:"decimals",label:"Decimals",selector:{number:{mode:"box",min:0,max:4,step:1}}},{name:"inverted_animation",label:"Invert Animation",selector:{boolean:{}}},{name:"show_direction",label:"Show Direction",selector:{boolean:{}}},{name:"unit_white_space",label:"Unit White Space",default:!0,selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]},{name:"color",label:"Color",selector:{color_rgb:{}}},{title:Eo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Gn},{title:Eo("editor.action"),name:"",type:"expandable",schema:Fn}],rr=[{name:"entity",selector:{entity:{}}},{...Wn(),schema:[...Wn().schema,{name:"color_value",label:"Color Value",selector:{boolean:{}}},{name:"color_icon",label:"Color Icon",selector:{boolean:{}}},{name:"display_zero",label:"Display Zero",selector:{boolean:{}},default:!0},{name:"display_zero_state",label:"Display State When Zero?",selector:{boolean:{}},default:!0},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}},{name:"invert_state",label:"Invert State",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]},{name:"color",label:"Color",selector:{color_rgb:{}}},{title:Eo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:[...Gn,{name:"sum_total",label:"Sum Total",selector:{boolean:{}}}]},{title:Eo("editor.action"),name:"",type:"expandable",schema:Fn}];Mn(jn({type:Ln(),view_layout:zn(),layout_options:zn(),grid_options:zn(),visibility:zn(),disabled:Bn(On())}),jn({title:Bn(Ln()),theme:Bn(Ln()),dashboard_link:Bn(Ln()),dashboard_link_label:Bn(Ln()),second_dashboard_link:Bn(Ln()),second_dashboard_link_label:Bn(Ln()),inverted_entities:Bn(zn()),base_decimals:Bn(Nn()),kilo_decimals:Bn(Nn()),mega_decimals:Bn(Nn()),mega_threshold:Bn(In()),min_flow_rate:Bn(In()),max_flow_rate:Bn(In()),min_expected_power:Bn(In()),max_expected_power:Bn(In()),kilo_threshold:Bn(In()),clickable_entities:Bn(On()),transparency_zero_lines:Bn(In()),greyout_zero_lines:Bn(On()),display_zero_lines:Bn(zn()),use_new_flow_rate_model:Bn(On()),full_size:Bn(On()),style_ha_card:Bn(zn()),style_card_content:Bn(zn()),disable_dots:Bn(On()),no_labels:Bn(On()),entities:jn({battery:Bn(zn()),grid:Bn(zn()),solar:Bn(zn()),home:Bn(zn()),fossil_fuel_percentage:Bn(zn()),individual:Bn(zn()),individual1:Bn(zn()),individual2:Bn(zn())}),sort_individual_devices:Bn(On()),allow_layout_break:Bn(On()),watt_threshold:Bn(In()),w_decimals:Bn(In()),kw_decimals:Bn(In())})),wn(e=>[{name:"entities",type:"grid",column_min_width:"400px",schema:[{title:e("editor.grid"),name:"grid",type:"expandable",iconPath:fn,schema:ir},{title:e("editor.solar"),name:"solar",type:"expandable",iconPath:gn,schema:rr},{title:e("editor.battery"),name:"battery",type:"expandable",iconPath:hn,schema:Xn},{title:e("editor.fossil_fuel_percentage"),name:"fossil_fuel_percentage",type:"expandable",iconPath:mn,schema:tr},{title:e("editor.home"),name:"home",type:"expandable",iconPath:_n,schema:ar}]}]);const sr=wn(e=>[{name:"entities",type:"grid",column_min_width:"400px",schema:[{title:`${e("editor.individual")} 1`,name:"individual1",type:"expandable",schema:nr},{title:`${e("editor.individual")} 2`,name:"individual2",type:"expandable",schema:nr}]}]);wn((e,t)=>[{type:"grid",column_min_width:"200px",schema:[{name:"dashboard_link",label:"Dashboard Link",selector:{navigation:{}}},{name:"dashboard_link_label",label:"Dashboard Link Label",selector:{text:{}}},{name:"base_decimals",label:"Watt Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"kilo_decimals",label:"kW Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"mega_decimals",label:"MW Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"max_flow_rate",label:"Max Flow Rate (Sec/Dot)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"min_flow_rate",label:"Min Flow Rate (Sec/Dot)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"max_expected_power",label:"Max Expected Power (in Watts)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"min_expected_power",label:"Min Expected Power (in Watts)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"kilo_threshold",label:"Kilowatt Threshold",selector:{number:{mode:"box",min:0,max:1e6,step:1}}},{name:"mega_threshold",label:"Megawatt Threshold",selector:{number:{mode:"box",min:0,max:1e7,step:1}}},{name:"clickable_entities",label:"Clickable Entities",selector:{boolean:{}},default:!0},{name:"disable_dots",label:"Disable Moving Dots",selector:{boolean:{}}},{name:"no_labels",label:e("editor.no_labels"),selector:{boolean:{}}},{name:"use_new_flow_rate_model",label:"New Flow Model?",selector:{boolean:{}},default:!0},{name:"sort_individual_devices",label:"Sort individual devices by usage",selector:{boolean:{}},default:!0},{name:"allow_layout_break",label:"Allow Layout Break",selector:{boolean:{}}}]},{type:"expandable",title:e("editor.display_zero_lines"),schema:[...er(e,t)]}]);const lr=(e,t,o,i)=>{i=i||{},o=null==o?{}:o;const a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return a.detail=o,e.dispatchEvent(a),a},cr=async()=>{if(customElements.get("ha-form")||customElements.get("hui-button-card")?.getConfigElement(),customElements.get("ha-entity-picker")||customElements.get("hui-entities-card")?.getConfigElement(),customElements.get("ha-form"))return;await(window.loadCardHelpers?.())},dr=w`#sortable a:nth-of-type(2n) paper-icon-item{animation-name:keyframes1;animation-iteration-count:infinite;transform-origin:50% 10%;animation-delay:-.75s;animation-duration:.25s}#sortable a:nth-of-type(2n-1) paper-icon-item{animation-name:keyframes2;animation-iteration-count:infinite;animation-direction:alternate;transform-origin:30% 5%;animation-delay:-.5s;animation-duration:.33s}#sortable a{height:48px;display:flex}#sortable{outline:0;display:block!important}.hidden-panel{display:flex!important}.sortable-fallback{display:none}.sortable-ghost{opacity:.4}.sortable-fallback{opacity:0}@keyframes keyframes1{0%{transform:rotate(-1deg);animation-timing-function:ease-in}50%{transform:rotate(1.5deg);animation-timing-function:ease-out}}@keyframes keyframes2{0%{transform:rotate(1deg);animation-timing-function:ease-in}50%{transform:rotate(-1.5deg);animation-timing-function:ease-out}}.hide-panel,.show-panel{display:none;position:absolute;top:0;right:4px;--mdc-icon-button-size:40px}:host([rtl]) .show-panel{right:initial;left:4px}.hide-panel{top:4px;right:8px}:host([rtl]) .hide-panel{right:initial;left:8px}:host([expanded]) .hide-panel{display:block}:host([expanded]) .show-panel{display:inline-flex}paper-icon-item.hidden-panel,paper-icon-item.hidden-panel ha-icon[slot=item-icon],paper-icon-item.hidden-panel span{color:var(--secondary-text-color);cursor:pointer}`;let ur;const hr={attribute:!0,type:String,converter:O,reflect:!1,hasChanged:N},pr=(e=hr,t,o)=>{const{kind:i,metadata:a}=o;let n=globalThis.litPropertyMetadata.get(a);if(void 0===n&&globalThis.litPropertyMetadata.set(a,n=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),n.set(o.name,e),"accessor"===i){const{name:i}=o;return{set(o){const a=t.get.call(this);t.set.call(this,o),this.requestUpdate(i,a,e,!0,o)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=o;return function(o){const a=this[i];t.call(this,o),this.requestUpdate(i,a,e,!0,o)}}throw Error("Unsupported decorator location: "+i)};function _r(e){return(t,o)=>"object"==typeof o?pr(e,t,o):((e,t,o)=>{const i=t.hasOwnProperty(o);return t.constructor.createProperty(o,e),i?Object.getOwnPropertyDescriptor(t,o):void 0})(e,t,o)}const{I:mr}=we,fr=e=>e,gr=()=>document.createComment(""),yr=(e,t,o)=>{const i=e._$AA.parentNode,a=void 0===t?e._$AB:t._$AA;if(void 0===o){const t=i.insertBefore(gr(),a),n=i.insertBefore(gr(),a);o=new mr(t,n,e,e.options)}else{const t=o._$AB.nextSibling,n=o._$AM,r=n!==e;if(r){let t;o._$AQ?.(e),o._$AM=e,void 0!==o._$AP&&(t=e._$AU)!==n._$AU&&o._$AP(t)}if(t!==a||r){let e=o._$AA;for(;e!==t;){const t=fr(e).nextSibling;fr(i).insertBefore(e,a),e=t}}}return o},vr=(e,t,o=e)=>(e._$AI(t,o),e),br={},wr=(e,t=br)=>e._$AH=t,kr=e=>{e._$AR(),e._$AA.remove()},xr=(e,t,o)=>{const i=new Map;for(let a=t;a<=o;a++)i.set(e[a],a);return i},Sr=je(class extends Be{constructor(e){if(super(e),e.type!==Ie)throw Error("repeat() can only be used in text expressions")}dt(e,t,o){let i;void 0===o?o=t:void 0!==t&&(i=t);const a=[],n=[];let r=0;for(const t of e)a[r]=i?i(t,r):r,n[r]=o(t,r),r++;return{values:n,keys:a}}render(e,t,o){return this.dt(e,t,o).values}update(e,[t,o,i]){const a=(e=>e._$AH)(e),{values:n,keys:r}=this.dt(t,o,i);if(!Array.isArray(a))return this.ut=r,n;const s=this.ut??(this.ut=[]),l=[];let c,d,u=0,h=a.length-1,p=0,_=n.length-1;for(;u<=h&&p<=_;)if(null===a[u])u++;else if(null===a[h])h--;else if(s[u]===r[p])l[p]=vr(a[u],n[p]),u++,p++;else if(s[h]===r[_])l[_]=vr(a[h],n[_]),h--,_--;else if(s[u]===r[_])l[_]=vr(a[u],n[_]),yr(e,l[_+1],a[u]),u++,_--;else if(s[h]===r[p])l[p]=vr(a[h],n[p]),yr(e,a[u],a[h]),h--,p++;else if(void 0===c&&(c=xr(r,p,_),d=xr(s,u,h)),c.has(s[u]))if(c.has(s[h])){const t=d.get(r[p]),o=void 0!==t?a[t]:null;if(null===o){const t=yr(e,a[u]);vr(t,n[p]),l[p]=t}else l[p]=vr(o,n[p]),yr(e,a[u],o),a[t]=null;p++}else kr(a[h]),h--;else kr(a[u]),u++;for(;p<=_;){const t=yr(e,l[_+1]);vr(t,n[p]),l[p++]=t}for(;u<=h;){const e=a[u++];null!==e&&kr(e)}return this.ut=r,wr(e,l),se}});class $r extends Se{constructor(){super(...arguments),this._indexBeingEdited=-1,this._entityKeys=new WeakMap,this._computeLabelCallback=e=>this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e?.name}`)||Eo(`editor.${e?.name}`)}connectedCallback(){super.connectedCallback(),cr()}disconnectedCallback(){super.disconnectedCallback(),this._destroySortable()}_editRowElement(e){this._indexBeingEdited=e}_getKey(e){return this._entityKeys.has(e)||this._entityKeys.set(e,Math.random().toString()),this._entityKeys.get(e)}render(){return this.entities&&this.hass?-1!==this._indexBeingEdited?ne`<div class="individual-header"><h4>${this._indexBeingEdited+1} / ${this.entities.length} ${Eo("editor.individual")}</h4><ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.clear")}" .path="${pn}" class="remove-icon" @click="${()=>this._indexBeingEdited=-1}"></ha-icon-button></div><ha-form .hass="${this.hass}" .data="${this.entities[this._indexBeingEdited]}" .schema="${nr}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._configChanged}"></ha-form>`:ne`<div class="entities">${Sr(this.entities,e=>this._getKey(e),(e,t)=>ne`<div class="entity"><div class="handle"><ha-svg-icon .path="${"M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z"}"></ha-svg-icon></div>${e.type?ne`<div class="special-row"><div><span>${this.hass.localize(`ui.panel.lovelace.editor.card.entities.entity_row.${e.type}`)} </span><span class="secondary">${this.hass.localize("ui.panel.lovelace.editor.card.entities.edit_special_row")}</span></div></div>`:ne`<ha-entity-picker allow-custom-entity hideClearIcon .hass="${this.hass}" .value="${e.entity}" .index="${t}" @value-changed="${this._valueChanged}"></ha-entity-picker>`}<ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.clear")}" .path="${pn}" class="remove-icon" .index="${t}" @click="${this._removeRow}"></ha-icon-button><ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.edit")}" .path="${"M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"}" class="edit-icon" .index="${t}" @click="${()=>this._editRowElement(t)}"></ha-icon-button></div>`)}</div><ha-entity-picker class="add-entity" .hass="${this.hass}" @value-changed="${this._addEntity}"></ha-entity-picker>`:ne`<p>No entities configured.</p>`}_configChanged(e){const t=e.detail.value||"";if(!this.config||!this.hass)return;Array.isArray(this.config.entities.individual)||(this.config.entities.individual=[]);const o=[...this.config.entities.individual];if(!o)return;o[this._indexBeingEdited]=t;const i={...this.config,entities:{...this.config.entities,individual:o}};lr(this,"config-changed",{config:i})}firstUpdated(){this._createSortable()}async _createSortable(){const e=await(async()=>(ur||(ur=(await Promise.resolve().then(function(){return Fd})).default),ur))();this._sortable=new e(this.shadowRoot.querySelector(".entities"),{animation:150,fallbackClass:"sortable-fallback",handle:".handle",onChoose:e=>{e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder)},onEnd:e=>{e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder),this._rowMoved(e)}})}_destroySortable(){this._sortable?.destroy(),this._sortable=void 0}async _addEntity(e){const t=e.detail.value;if(""===t)return;const o=this.entities.concat({entity:t});e.target.value="",lr(this,"entities-changed",{entities:o})}_rowMoved(e){if(e.oldIndex===e.newIndex)return;if(null==e.oldIndex||null==e.newIndex)return;const t=this.entities.concat(),[o]=t.splice(e.oldIndex,1);o&&(t.splice(e.newIndex,0,o),lr(this,"entities-changed",{entities:t}))}_removeRow(e){const t=e.currentTarget.index,o=this.entities.concat();o.splice(t,1),lr(this,"entities-changed",{entities:o})}_valueChanged(e){const t=e.detail.value,o=e.target.index,i=this.entities.concat();""===t||void 0===t?i.splice(o,1):i[o]={...i[o],entity:t},lr(this,"entities-changed",{entities:i})}_editRow(e){const t=e.currentTarget.index;lr(this,"edit-detail-element",{subElementConfig:{index:t,type:"row",elementConfig:this.entities[t]}})}static get styles(){return[dr,w`ha-entity-picker{margin-top:8px}.individual-header{display:flex;justify-content:space-between;align-items:center;margin-inline:.2rem;margin-bottom:1rem}.add-entity{display:block;margin-left:31px;margin-right:71px;margin-inline-start:31px;margin-inline-end:71px;direction:var(--direction)}.entity{display:flex;align-items:center}.entity .handle{padding-right:8px;cursor:move;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.entity .handle>*{pointer-events:none}.entity ha-entity-picker{flex-grow:1;min-width:0}.special-row{height:60px;font-size:16px;display:flex;align-items:center;justify-content:space-between;flex-grow:1}.special-row div{display:flex;flex-direction:column}.edit-icon,.remove-icon{--mdc-icon-button-size:36px;color:var(--secondary-text-color)}.secondary{font-size:12px;color:var(--secondary-text-color)}`]}}e([_r({attribute:!1}),t("design:type",Object)],$r.prototype,"hass",void 0),e([_r({attribute:!1}),t("design:type",Object)],$r.prototype,"config",void 0),e([_r({attribute:!1}),t("design:type",Array)],$r.prototype,"entities",void 0),e([_r(),t("design:type",String)],$r.prototype,"label",void 0),e([function(e){return _r({...e,state:!0,attribute:!1})}(),t("design:type",Number)],$r.prototype,"_indexBeingEdited",void 0),customElements.get("individual-row-editor")||customElements.define("individual-row-editor",$r);class Er extends Se{constructor(){super(...arguments),this._computeLabelCallback=e=>this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e?.name}`)||Eo(`editor.${e?.name}`)}render(){return this.config&&this.hass?(this._configEntities=this.config.entities.individual,this._subElementEditorConfig?ne`<ha-form .hass="${this.hass}" @value-changed="${this._valueChanged}" .data="${this.config}" .schema="${sr(this.hass)}" .computeLabel="${this._computeLabelCallback}"></ha-form>`:ne`<individual-row-editor .hass="${this.hass}" .config="${this.config}" .entities="${this._configEntities||[]}" @open-sub-element-editor="${this._editDetailElement}" @entities-changed="${this._entitiesChanged}" style="width:100%"></individual-row-editor>`):ne`<div>no config</div>`}_valueChanged(e){const t=e.detail.value||"";this.config&&this.hass&&l(this,"config-changed",{config:t})}_entitiesChanged(e){let t=this.config;t={...t,entities:{...t.entities,individual:e.detail.entities}},this._configEntities=(t.entities.individual??[]).map(e=>"string"==typeof e?{entity:e}:e),l(this,"config-changed",{config:t})}_editDetailElement(e){this._subElementEditorConfig=e.detail.subElementConfig}static get styles(){return w``}}e([on({attribute:!1}),t("design:type",Object)],Er.prototype,"config",void 0),e([an(),t("design:type",Object)],Er.prototype,"_subElementEditorConfig",void 0),e([an(),t("design:type",Array)],Er.prototype,"_configEntities",void 0),customElements.get("individual-devices-editor")||customElements.define("individual-devices-editor",Er);class Cr extends Se{constructor(){super(...arguments),this.outlined=!1,this.leftChevron=!1,this.icon="mdi:format-list-bulleted-type"}render(){return ne`<div class="link-subpage" @click="${this._openSubElementPage}" @keydown="${this._openSubElementPage}" @focus="${this._focusChanged}" @blur="${this._focusChanged}" role="button"><ha-icon icon="${this.icon}" class="summary-icon"></ha-icon><slot name="header"><div class="header">${this.header}<slot class="secondary" name="secondary">${this.secondary}</slot></div></slot><ha-svg-icon .path="${"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}" class="summary-icon-right"></ha-svg-icon></div>`}_focusChanged(e){this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}_openSubElementPage(){l(this,"open-sub-element-editor",{open:!0})}static get styles(){return w`:host{display:block}:host([outlined]){box-shadow:none;border-width:1px;border-style:solid;border-color:var(--ha-card-border-color,var(--divider-color,#e0e0e0));border-radius:var(--ha-card-border-radius,12px)}:host([leftchevron]) .summary-icon{margin-left:0;margin-right:8px}.link-subpage{width:100%;display:flex;gap:1rem;padding:var(--expansion-panel-summary-padding,0 8px);min-height:48px;align-items:center;cursor:pointer;overflow:hidden;font-weight:500;outline:0}.summary-icon{transition:transform 150ms cubic-bezier(.4,0,.2,1);direction:var(--direction);color:var(--secondary-text-color)}.header,::slotted([slot=header]){flex:1}.container{padding:var(--expansion-panel-content-padding,0 8px);overflow:hidden;transition:height .3s cubic-bezier(.4,0,.2,1);height:0}.container.expanded{height:auto}.secondary{display:block;color:var(--secondary-text-color);font-size:12px}`}}var Ar;e([on({type:String}),t("design:type",String)],Cr.prototype,"path",void 0),e([on({type:Boolean,reflect:!0}),t("design:type",Object)],Cr.prototype,"outlined",void 0),e([on({type:Boolean,reflect:!0}),t("design:type",Object)],Cr.prototype,"leftChevron",void 0),e([on(),t("design:type",String)],Cr.prototype,"header",void 0),e([on({type:String}),t("design:type",Object)],Cr.prototype,"icon",void 0),e([on(),t("design:type",String)],Cr.prototype,"secondary",void 0),e([(Ar=".container",(e,t)=>{const o={get(){return this.renderRoot.querySelector(Ar)},enumerable:!0,configurable:!0};return void 0!==t?nn(o,e,t):rn(o,e)}),t("design:type",HTMLDivElement)],Cr.prototype,"_container",void 0),customElements.get("link-subpage")||customElements.define("link-subpage",Cr);class Dr extends Se{render(){return ne`<div class="header"><div class="back-title"><ha-icon-button .label="${"Go Back"}" .path="${"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"}" @click="${this._goBack}"></ha-icon-button><span>${Eo(`editor.${this.page}`)}</span></div></div>`}_goBack(){l(this,"go-back")}static get styles(){return w`.header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.back-title{display:flex;align-items:center;font-size:18px}`}}e([on({attribute:!1}),t("design:type",Object)],Dr.prototype,"config",void 0),e([on(),t("design:type",Object)],Dr.prototype,"page",void 0),customElements.get("subpage-header")||customElements.define("subpage-header",Dr);const Pr=Mn(jn({type:Ln(),view_layout:zn(),layout_options:zn(),grid_options:zn(),visibility:zn(),disabled:Bn(On())}),jn({title:Bn(Ln()),theme:Bn(Ln()),dashboard_link:Bn(Ln()),dashboard_link_label:Bn(Ln()),second_dashboard_link:Bn(Ln()),second_dashboard_link_label:Bn(Ln()),inverted_entities:Bn(zn()),base_decimals:Bn(Nn()),kilo_decimals:Bn(Nn()),mega_decimals:Bn(Nn()),mega_threshold:Bn(In()),min_flow_rate:Bn(In()),max_flow_rate:Bn(In()),min_expected_power:Bn(In()),max_expected_power:Bn(In()),kilo_threshold:Bn(In()),clickable_entities:Bn(On()),transparency_zero_lines:Bn(In()),greyout_zero_lines:Bn(On()),display_zero_lines:Bn(zn()),use_new_flow_rate_model:Bn(On()),full_size:Bn(On()),style_ha_card:Bn(zn()),style_card_content:Bn(zn()),disable_dots:Bn(On()),no_labels:Bn(On()),entities:jn({battery:Bn(zn()),grid:Bn(zn()),solar:Bn(zn()),home:Bn(zn()),fossil_fuel_percentage:Bn(zn()),individual:Bn(zn()),individual1:Bn(zn()),individual2:Bn(zn())}),sort_individual_devices:Bn(On()),allow_layout_break:Bn(On()),watt_threshold:Bn(In()),w_decimals:Bn(In()),kw_decimals:Bn(In())})),Mr=[{name:"title",label:"Title",selector:{text:{}}}];wn(e=>[{name:"entities",type:"grid",column_min_width:"400px",schema:[{title:e("editor.grid"),name:"grid",type:"expandable",iconPath:fn,schema:ir},{title:e("editor.solar"),name:"solar",type:"expandable",iconPath:gn,schema:rr},{title:e("editor.battery"),name:"battery",type:"expandable",iconPath:hn,schema:Xn},{title:e("editor.fossil_fuel_percentage"),name:"fossil_fuel_percentage",type:"expandable",iconPath:mn,schema:tr},{title:e("editor.home"),name:"home",type:"expandable",iconPath:_n,schema:ar}]}]),wn(e=>[{name:"entities",type:"grid",column_min_width:"400px",schema:[{title:`${e("editor.individual")} 1`,name:"individual1",type:"expandable",schema:nr},{title:`${e("editor.individual")} 2`,name:"individual2",type:"expandable",schema:nr}]}]);const Tr=wn((e,t)=>[{type:"grid",column_min_width:"200px",schema:[{name:"dashboard_link",label:"Dashboard Link",selector:{navigation:{}}},{name:"dashboard_link_label",label:"Dashboard Link Label",selector:{text:{}}},{name:"base_decimals",label:"Watt Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"kilo_decimals",label:"kW Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"mega_decimals",label:"MW Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"max_flow_rate",label:"Max Flow Rate (Sec/Dot)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"min_flow_rate",label:"Min Flow Rate (Sec/Dot)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"max_expected_power",label:"Max Expected Power (in Watts)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"min_expected_power",label:"Min Expected Power (in Watts)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"kilo_threshold",label:"Kilowatt Threshold",selector:{number:{mode:"box",min:0,max:1e6,step:1}}},{name:"mega_threshold",label:"Megawatt Threshold",selector:{number:{mode:"box",min:0,max:1e7,step:1}}},{name:"clickable_entities",label:"Clickable Entities",selector:{boolean:{}},default:!0},{name:"disable_dots",label:"Disable Moving Dots",selector:{boolean:{}}},{name:"no_labels",label:e("editor.no_labels"),selector:{boolean:{}}},{name:"use_new_flow_rate_model",label:"New Flow Model?",selector:{boolean:{}},default:!0},{name:"sort_individual_devices",label:"Sort individual devices by usage",selector:{boolean:{}},default:!0},{name:"allow_layout_break",label:"Allow Layout Break",selector:{boolean:{}}}]},{type:"expandable",title:e("editor.display_zero_lines"),schema:[...er(e,t)]}]),zr=[{page:"grid",icon:"mdi:transmission-tower",schema:ir},{page:"solar",icon:"mdi:solar-power",schema:rr},{page:"battery",icon:"mdi:battery-high",schema:Xn},{page:"fossil_fuel_percentage",icon:"mdi:leaf",schema:tr},{page:"home",icon:"mdi:home",schema:ar},{page:"individual",icon:"mdi:dots-horizontal-circle-outline"},{page:"advanced",icon:"mdi:cog",schema:Tr}];let Or=class extends la{constructor(){super(...arguments),this._configEntities=[],this._currentConfigPage=null,this._computeLabelCallback=e=>this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e?.name}`)||Eo(`editor.${e?.name}`)||e?.label}async setConfig(e){Dn(e,Pr),this._config=e}connectedCallback(){super.connectedCallback(),cr()}_editDetailElement(e){this._currentConfigPage=e}_goBack(){this._currentConfigPage=null}_hasLegacyFields(){return!!this._config&&(void 0!==this._config.watt_threshold||void 0!==this._config.w_decimals||void 0!==this._config.kw_decimals)}_migrateLegacyFields(){if(!this._config)return;const e={...this._config};"number"==typeof e.watt_threshold&&void 0===e.kilo_threshold&&(e.kilo_threshold=e.watt_threshold),"number"==typeof e.w_decimals&&void 0===e.base_decimals&&(e.base_decimals=e.w_decimals),"number"==typeof e.kw_decimals&&void 0===e.kilo_decimals&&(e.kilo_decimals=e.kw_decimals),delete e.watt_threshold,delete e.w_decimals,delete e.kw_decimals,this._config=e,l(this,"config-changed",{config:e})}_renderLegacyFieldsAlert(){return this._hasLegacyFields()?Ui`<ha-alert class="legacy-fields-alert" alert-type="warning">Legacy config fields detected. Field names changed: w_decimals -> base_decimals, kw_decimals -> kilo_decimals, watt_threshold -> kilo_threshold.<br>More info: https://github.com/flixlix/power-flow-card-plus/releases/tag/v0.3.5 <button class="legacy-fields-alert-button" slot="action" @click="${this._migrateLegacyFields}">Convert automatically</button></ha-alert>`:Gi}_hasLegacyIndividualFields(){if(!this._config)return!1;const e=this._config.entities;return void 0!==e.individual1||void 0!==e.individual2}_migrateLegacyIndividualFields(){if(!this._config)return;const e={...this._config,entities:{...this._config.entities}},t=Array.isArray(e.entities.individual)?[...e.entities.individual]:[],o=e=>{Array.isArray(e)?t.push(...e):void 0!==e&&t.push(e)};o(e.entities.individual1),o(e.entities.individual2),e.entities.individual=t,delete e.entities.individual1,delete e.entities.individual2,this._config=e,l(this,"config-changed",{config:e})}_renderLegacyIndividualFieldsAlert(){return this._hasLegacyIndividualFields()?Ui`<ha-alert class="legacy-fields-alert" alert-type="warning">Legacy individual fields detected. Field names changed: entities.individual1/individual2 -> entities.individual[]. <button class="legacy-fields-alert-button" slot="action" @click="${this._migrateLegacyIndividualFields}">Convert automatically</button></ha-alert>`:Gi}render(){if(!this.hass||!this._config)return Gi;const e={...this._config,display_zero_lines:{mode:this._config.display_zero_lines?.mode??u.displayZeroLines.mode,transparency:this._config.display_zero_lines?.transparency??u.displayZeroLines.transparency,grey_color:this._config.display_zero_lines?.grey_color??u.displayZeroLines.grey_color}};if(null!==this._currentConfigPage){if("individual"===this._currentConfigPage)return Ui`${this._renderLegacyFieldsAlert()}${this._renderLegacyIndividualFieldsAlert()}<subpage-header @go-back="${this._goBack}" page="${this._currentConfigPage}"></subpage-header><individual-devices-editor .hass="${this.hass}" .config="${this._config}" @config-changed="${this._valueChanged}"></individual-devices-editor>`;const t=this._currentConfigPage,o="advanced"===t?Tr(Eo,this._config.display_zero_lines?.mode??u.displayZeroLines.mode):zr.find(e=>e.page===t)?.schema,i="advanced"===t?e:e.entities[t];return Ui`${this._renderLegacyFieldsAlert()}${this._renderLegacyIndividualFieldsAlert()}<subpage-header @go-back="${this._goBack}" page="${this._currentConfigPage}"></subpage-header><ha-form .hass="${this.hass}" .data="${i}" .schema="${o}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form>`}const t=(e,t="mdi:dots-horizontal-circle-outline")=>{if(null===e)return Gi;const o=(()=>{if("individual"===e||"advanced"===e)return t;const o=this?._config?.entities[e];return o?.icon||t})();return Ui`<link-subpage path="${e}" header="${Eo(`editor.${e}`)}" @open-sub-element-editor="${()=>this._editDetailElement(e)}" icon="${o}"></link-subpage>`};return Ui`<div class="card-config">${this._renderLegacyFieldsAlert()}${this._renderLegacyIndividualFieldsAlert()}<ha-form .hass="${this.hass}" .data="${e}" .schema="${Mr}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form>${zr.map(e=>t(e.page,e.icon))}</div>`}_valueChanged(e){let t=e.detail.value||"";this._config&&this.hass&&(null!==this._currentConfigPage&&"advanced"!==this._currentConfigPage&&"individual"!==this._currentConfigPage&&(t={...this._config,entities:{...this._config.entities,[this._currentConfigPage]:t}}),l(this,"config-changed",{config:t}))}static get styles(){return di`ha-form{width:100%}ha-icon-button{align-self:center}.entities-section *{background-color:red}.card-config{display:flex;flex-direction:column;gap:1.5rem;margin-bottom:10px}.legacy-fields-alert{margin-bottom:8px}.legacy-fields-alert-button{border:none;background:var(--warning-color);border-radius:99px;color:var(--card-background-color);cursor:pointer;font:inherit;padding:4px 8px}.config-header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;width:100%}.config-header.sub-header{margin-top:24px}ha-icon{padding-bottom:2px;position:relative;top:-4px;right:1px}`}};e([ha({attribute:!1}),t("design:type",Object)],Or.prototype,"hass",void 0),e([pa(),t("design:type",Object)],Or.prototype,"_config",void 0),e([pa(),t("design:type",Array)],Or.prototype,"_configEntities",void 0),e([pa(),t("design:type",Object)],Or.prototype,"_currentConfigPage",void 0),Or=e([da("power-flow-card-plus-editor")],Or);var Nr=Object.freeze({__proto__:null,get PowerFlowCardPlusEditor(){return Or}});function Ir(e,t,o){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var i=o.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function jr(){return jr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)({}).hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},jr.apply(null,arguments)}function Br(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,i)}return o}function Lr(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?Br(Object(o),!0).forEach(function(t){Ir(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Br(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function Rr(e){return Rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rr(e)}function Hr(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var Ur=Hr(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Fr=Hr(/Edge/i),Gr=Hr(/firefox/i),Vr=Hr(/safari/i)&&!Hr(/chrome/i)&&!Hr(/android/i),Wr=Hr(/iP(ad|od|hone)/i),Zr=Hr(/chrome/i)&&Hr(/android/i),Yr={capture:!1,passive:!1};function Xr(e,t,o){e.addEventListener(t,o,!Ur&&Yr)}function qr(e,t,o){e.removeEventListener(t,o,!Ur&&Yr)}function Kr(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function Jr(e){return e.host&&e!==document&&e.host.nodeType&&e.host!==e?e.host:e.parentNode}function Qr(e,t,o,i){if(e){o=o||document;do{if(null!=t&&(">"===t[0]?e.parentNode===o&&Kr(e,t):Kr(e,t))||i&&e===o)return e;if(e===o)break}while(e=Jr(e))}return null}var es,ts=/\s+/g;function os(e,t,o){if(e&&t)if(e.classList)e.classList[o?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(ts," ").replace(" "+t+" "," ");e.className=(i+(o?" "+t:"")).replace(ts," ")}}function is(e,t,o){var i=e&&e.style;if(i){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(o=e.currentStyle),void 0===t?o:o[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=o+("string"==typeof o?"":"px")}}function as(e,t){var o="";if("string"==typeof e)o=e;else do{var i=is(e,"transform");i&&"none"!==i&&(o=i+" "+o)}while(!t&&(e=e.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(o)}function ns(e,t,o){if(e){var i=e.getElementsByTagName(t),a=0,n=i.length;if(o)for(;a<n;a++)o(i[a],a);return i}return[]}function rs(){var e=document.scrollingElement;return e||document.documentElement}function ss(e,t,o,i,a){if(e.getBoundingClientRect||e===window){var n,r,s,l,c,d,u;if(e!==window&&e.parentNode&&e!==rs()?(r=(n=e.getBoundingClientRect()).top,s=n.left,l=n.bottom,c=n.right,d=n.height,u=n.width):(r=0,s=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(t||o)&&e!==window&&(a=a||e.parentNode,!Ur))do{if(a&&a.getBoundingClientRect&&("none"!==is(a,"transform")||o&&"static"!==is(a,"position"))){var h=a.getBoundingClientRect();r-=h.top+parseInt(is(a,"border-top-width")),s-=h.left+parseInt(is(a,"border-left-width")),l=r+n.height,c=s+n.width;break}}while(a=a.parentNode);if(i&&e!==window){var p=as(a||e),_=p&&p.a,m=p&&p.d;p&&(l=(r/=m)+(d/=m),c=(s/=_)+(u/=_))}return{top:r,left:s,bottom:l,right:c,width:u,height:d}}}function ls(e,t,o){for(var i=ps(e,!0),a=ss(e)[t];i;){if(!(a>=ss(i)[o]))return i;if(i===rs())break;i=ps(i,!1)}return!1}function cs(e,t,o,i){for(var a=0,n=0,r=e.children;n<r.length;){if("none"!==r[n].style.display&&r[n]!==gl.ghost&&(i||r[n]!==gl.dragged)&&Qr(r[n],o.draggable,e,!1)){if(a===t)return r[n];a++}n++}return null}function ds(e,t){for(var o=e.lastElementChild;o&&(o===gl.ghost||"none"===is(o,"display")||t&&!Kr(o,t));)o=o.previousElementSibling;return o||null}function us(e,t){var o=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===gl.clone||t&&!Kr(e,t)||o++;return o}function hs(e){var t=0,o=0,i=rs();if(e)do{var a=as(e),n=a.a,r=a.d;t+=e.scrollLeft*n,o+=e.scrollTop*r}while(e!==i&&(e=e.parentNode));return[t,o]}function ps(e,t){if(!e||!e.getBoundingClientRect)return rs();var o=e,i=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var a=is(o);if(o.clientWidth<o.scrollWidth&&("auto"==a.overflowX||"scroll"==a.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==a.overflowY||"scroll"==a.overflowY)){if(!o.getBoundingClientRect||o===document.body)return rs();if(i||t)return o;i=!0}}}while(o=o.parentNode);return rs()}function _s(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function ms(e,t){return function(){if(!es){var o=arguments;1===o.length?e.call(this,o[0]):e.apply(this,o),es=setTimeout(function(){es=void 0},t)}}}function fs(e,t,o){e.scrollLeft+=t,e.scrollTop+=o}function gs(e){var t=window.Polymer,o=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):o?o(e).clone(!0)[0]:e.cloneNode(!0)}function ys(e,t,o){var i={};return Array.from(e.children).forEach(function(a){var n,r,s,l;if(Qr(a,t.draggable,e,!1)&&!a.animated&&a!==o){var c=ss(a);i.left=Math.min(null!==(n=i.left)&&void 0!==n?n:1/0,c.left),i.top=Math.min(null!==(r=i.top)&&void 0!==r?r:1/0,c.top),i.right=Math.max(null!==(s=i.right)&&void 0!==s?s:-1/0,c.right),i.bottom=Math.max(null!==(l=i.bottom)&&void 0!==l?l:-1/0,c.bottom)}}),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}var vs="Sortable"+(new Date).getTime();function bs(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach(function(e){if("none"!==is(e,"display")&&e!==gl.ghost){t.push({target:e,rect:ss(e)});var o=Lr({},t[t.length-1].rect);if(e.thisAnimationDuration){var i=as(e,!0);i&&(o.top-=i.f,o.left-=i.e)}e.fromRect=o}})},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var o in e)if(e.hasOwnProperty(o))for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e[o][i])return Number(o);return-1}(t,{target:e}),1)},animateAll:function(o){var i=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof o&&o());var a=!1,n=0;t.forEach(function(e){var t=0,o=e.target,r=o.fromRect,s=ss(o),l=o.prevFromRect,c=o.prevToRect,d=e.rect,u=as(o,!0);u&&(s.top-=u.f,s.left-=u.e),o.toRect=s,o.thisAnimationDuration&&_s(l,s)&&!_s(r,s)&&(d.top-s.top)/(d.left-s.left)===(r.top-s.top)/(r.left-s.left)&&(t=function(e,t,o,i){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-o.top,2)+Math.pow(t.left-o.left,2))*i.animation}(d,l,c,i.options)),_s(s,r)||(o.prevFromRect=r,o.prevToRect=s,t||(t=i.options.animation),i.animate(o,d,s,t)),t&&(a=!0,n=Math.max(n,t),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout(function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null},t),o.thisAnimationDuration=t)}),clearTimeout(e),a?e=setTimeout(function(){"function"==typeof o&&o()},n):"function"==typeof o&&o(),t=[]},animate:function(e,t,o,i){if(i){is(e,"transition",""),is(e,"transform","");var a=as(this.el),n=a&&a.a,r=a&&a.d,s=(t.left-o.left)/(n||1),l=(t.top-o.top)/(r||1);e.animatingX=!!s,e.animatingY=!!l,is(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),is(e,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),is(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout(function(){is(e,"transition",""),is(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1},i)}}}}var ws=[],ks={initializeByDefault:!0},xs={mount:function(e){for(var t in ks)ks.hasOwnProperty(t)&&!(t in e)&&(e[t]=ks[t]);ws.forEach(function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),ws.push(e)},pluginEvent:function(e,t,o){var i=this;this.eventCanceled=!1,o.cancel=function(){i.eventCanceled=!0};var a=e+"Global";ws.forEach(function(i){t[i.pluginName]&&(t[i.pluginName][a]&&t[i.pluginName][a](Lr({sortable:t},o)),t.options[i.pluginName]&&t[i.pluginName][e]&&t[i.pluginName][e](Lr({sortable:t},o)))})},initializePlugins:function(e,t,o,i){for(var a in ws.forEach(function(i){var a=i.pluginName;if(e.options[a]||i.initializeByDefault){var n=new i(e,t,e.options);n.sortable=e,n.options=e.options,e[a]=n,jr(o,n.defaults)}}),e.options)if(e.options.hasOwnProperty(a)){var n=this.modifyOption(e,a,e.options[a]);void 0!==n&&(e.options[a]=n)}},getEventProperties:function(e,t){var o={};return ws.forEach(function(i){"function"==typeof i.eventProperties&&jr(o,i.eventProperties.call(t[i.pluginName],e))}),o},modifyOption:function(e,t,o){var i;return ws.forEach(function(a){e[a.pluginName]&&a.optionListeners&&"function"==typeof a.optionListeners[t]&&(i=a.optionListeners[t].call(e[a.pluginName],o))}),i}};var Ss=["evt"],$s=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=o.evt,a=function(e,t){if(null==e)return{};var o,i,a=function(e,t){if(null==e)return{};var o={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;o[i]=e[i]}return o}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i<n.length;i++)o=n[i],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}(o,Ss);xs.pluginEvent.bind(gl)(e,t,Lr({dragEl:Cs,parentEl:As,ghostEl:Ds,rootEl:Ps,nextEl:Ms,lastDownEl:Ts,cloneEl:zs,cloneHidden:Os,dragStarted:Zs,putSortable:Rs,activeSortable:gl.active,originalEvent:i,oldIndex:Ns,oldDraggableIndex:js,newIndex:Is,newDraggableIndex:Bs,hideGhostForTarget:pl,unhideGhostForTarget:_l,cloneNowHidden:function(){Os=!0},cloneNowShown:function(){Os=!1},dispatchSortableEvent:function(e){Es({sortable:t,name:e,originalEvent:i})}},a))};function Es(e){!function(e){var t=e.sortable,o=e.rootEl,i=e.name,a=e.targetEl,n=e.cloneEl,r=e.toEl,s=e.fromEl,l=e.oldIndex,c=e.newIndex,d=e.oldDraggableIndex,u=e.newDraggableIndex,h=e.originalEvent,p=e.putSortable,_=e.extraEventProperties;if(t=t||o&&o[vs]){var m,f=t.options,g="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||Ur||Fr?(m=document.createEvent("Event")).initEvent(i,!0,!0):m=new CustomEvent(i,{bubbles:!0,cancelable:!0}),m.to=r||o,m.from=s||o,m.item=a||o,m.clone=n,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var y=Lr(Lr({},_),xs.getEventProperties(i,t));for(var v in y)m[v]=y[v];o&&o.dispatchEvent(m),f[g]&&f[g].call(t,m)}}(Lr({putSortable:Rs,cloneEl:zs,targetEl:Cs,rootEl:Ps,oldIndex:Ns,oldDraggableIndex:js,newIndex:Is,newDraggableIndex:Bs},e))}var Cs,As,Ds,Ps,Ms,Ts,zs,Os,Ns,Is,js,Bs,Ls,Rs,Hs,Us,Fs,Gs,Vs,Ws,Zs,Ys,Xs,qs,Ks,Js=!1,Qs=!1,el=[],tl=!1,ol=!1,il=[],al=!1,nl=[],rl="undefined"!=typeof document,sl=Wr,ll=Fr||Ur?"cssFloat":"float",cl=rl&&!Zr&&!Wr&&"draggable"in document.createElement("div"),dl=function(){if(rl){if(Ur)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),ul=function(e,t){var o=is(e),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),a=cs(e,0,t),n=cs(e,1,t),r=a&&is(a),s=n&&is(n),l=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+ss(a).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+ss(n).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&r.float&&"none"!==r.float){var d="left"===r.float?"left":"right";return!n||"both"!==s.clear&&s.clear!==d?"horizontal":"vertical"}return a&&("block"===r.display||"flex"===r.display||"table"===r.display||"grid"===r.display||l>=i&&"none"===o[ll]||n&&"none"===o[ll]&&l+c>i)?"vertical":"horizontal"},hl=function(e){function t(e,o){return function(i,a,n,r){var s=i.options.group.name&&a.options.group.name&&i.options.group.name===a.options.group.name;if(null==e&&(o||s))return!0;if(null==e||!1===e)return!1;if(o&&"clone"===e)return e;if("function"==typeof e)return t(e(i,a,n,r),o)(i,a,n,r);var l=(o?i:a).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var o={},i=e.group;i&&"object"==Rr(i)||(i={name:i}),o.name=i.name,o.checkPull=t(i.pull,!0),o.checkPut=t(i.put),o.revertClone=i.revertClone,e.group=o},pl=function(){!dl&&Ds&&is(Ds,"display","none")},_l=function(){!dl&&Ds&&is(Ds,"display","")};rl&&!Zr&&document.addEventListener("click",function(e){if(Qs)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Qs=!1,!1},!0);var ml=function(e){if(Cs){var t=function(e,t){var o;return el.some(function(i){var a=i[vs].options.emptyInsertThreshold;if(a&&!ds(i)){var n=ss(i),r=e>=n.left-a&&e<=n.right+a,s=t>=n.top-a&&t<=n.bottom+a;return r&&s?o=i:void 0}}),o}((e=e.touches?e.touches[0]:e).clientX,e.clientY);if(t){var o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[vs]._onDragOver(o)}}},fl=function(e){Cs&&Cs.parentNode[vs]._isOutsideThisEl(e.target)};function gl(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=jr({},t),e[vs]=this;var o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ul(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==gl.supportPointer&&"PointerEvent"in window&&(!Vr||Wr),emptyInsertThreshold:5};for(var i in xs.initializePlugins(this,e,o),o)!(i in t)&&(t[i]=o[i]);for(var a in hl(t),this)"_"===a.charAt(0)&&"function"==typeof this[a]&&(this[a]=this[a].bind(this));this.nativeDraggable=!t.forceFallback&&cl,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Xr(e,"pointerdown",this._onTapStart):(Xr(e,"mousedown",this._onTapStart),Xr(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Xr(e,"dragover",this),Xr(e,"dragenter",this)),el.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),jr(this,bs())}function yl(e,t,o,i,a,n,r,s){var l,c,d=e[vs],u=d.options.onMove;return!window.CustomEvent||Ur||Fr?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=o,l.draggedRect=i,l.related=a||t,l.relatedRect=n||ss(t),l.willInsertAfter=s,l.originalEvent=r,e.dispatchEvent(l),u&&(c=u.call(d,l,r)),c}function vl(e){e.draggable=!1}function bl(){al=!1}function wl(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,o=t.length,i=0;o--;)i+=t.charCodeAt(o);return i.toString(36)}function kl(e){return setTimeout(e,0)}function xl(e){return clearTimeout(e)}gl.prototype={constructor:gl,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Ys=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Cs):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,i=this.options,a=i.preventOnFilter,n=e.type,r=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(r||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,c=i.filter;if(function(e){nl.length=0;var t=e.getElementsByTagName("input"),o=t.length;for(;o--;){var i=t[o];i.checked&&nl.push(i)}}(o),!Cs&&!(/mousedown|pointerdown/.test(n)&&0!==e.button||i.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Vr||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Qr(s,i.draggable,o,!1))&&s.animated||Ts===s)){if(Ns=us(s),js=us(s,i.draggable),"function"==typeof c){if(c.call(this,e,s,this))return Es({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:o,fromEl:o}),$s("filter",t,{evt:e}),void(a&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(i){if(i=Qr(l,i.trim(),o,!1))return Es({sortable:t,rootEl:i,name:"filter",targetEl:s,fromEl:o,toEl:o}),$s("filter",t,{evt:e}),!0})))return void(a&&e.preventDefault());i.handle&&!Qr(l,i.handle,o,!1)||this._prepareDragStart(e,r,s)}}},_prepareDragStart:function(e,t,o){var i,a=this,n=a.el,r=a.options,s=n.ownerDocument;if(o&&!Cs&&o.parentNode===n){var l=ss(o);if(Ps=n,As=(Cs=o).parentNode,Ms=Cs.nextSibling,Ts=o,Ls=r.group,gl.dragged=Cs,Hs={target:Cs,clientX:(t||e).clientX,clientY:(t||e).clientY},Vs=Hs.clientX-l.left,Ws=Hs.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Cs.style["will-change"]="all",i=function(){$s("delayEnded",a,{evt:e}),gl.eventCanceled?a._onDrop():(a._disableDelayedDragEvents(),!Gr&&a.nativeDraggable&&(Cs.draggable=!0),a._triggerDragStart(e,t),Es({sortable:a,name:"choose",originalEvent:e}),os(Cs,r.chosenClass,!0))},r.ignore.split(",").forEach(function(e){ns(Cs,e.trim(),vl)}),Xr(s,"dragover",ml),Xr(s,"mousemove",ml),Xr(s,"touchmove",ml),r.supportPointer?(Xr(s,"pointerup",a._onDrop),!this.nativeDraggable&&Xr(s,"pointercancel",a._onDrop)):(Xr(s,"mouseup",a._onDrop),Xr(s,"touchend",a._onDrop),Xr(s,"touchcancel",a._onDrop)),Gr&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Cs.draggable=!0),$s("delayStart",this,{evt:e}),!r.delay||r.delayOnTouchOnly&&!t||this.nativeDraggable&&(Fr||Ur))i();else{if(gl.eventCanceled)return void this._onDrop();r.supportPointer?(Xr(s,"pointerup",a._disableDelayedDrag),Xr(s,"pointercancel",a._disableDelayedDrag)):(Xr(s,"mouseup",a._disableDelayedDrag),Xr(s,"touchend",a._disableDelayedDrag),Xr(s,"touchcancel",a._disableDelayedDrag)),Xr(s,"mousemove",a._delayedDragTouchMoveHandler),Xr(s,"touchmove",a._delayedDragTouchMoveHandler),r.supportPointer&&Xr(s,"pointermove",a._delayedDragTouchMoveHandler),a._dragStartTimer=setTimeout(i,r.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Cs&&vl(Cs),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;qr(e,"mouseup",this._disableDelayedDrag),qr(e,"touchend",this._disableDelayedDrag),qr(e,"touchcancel",this._disableDelayedDrag),qr(e,"pointerup",this._disableDelayedDrag),qr(e,"pointercancel",this._disableDelayedDrag),qr(e,"mousemove",this._delayedDragTouchMoveHandler),qr(e,"touchmove",this._delayedDragTouchMoveHandler),qr(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?Xr(document,"pointermove",this._onTouchMove):Xr(document,t?"touchmove":"mousemove",this._onTouchMove):(Xr(Cs,"dragend",this),Xr(Ps,"dragstart",this._onDragStart));try{document.selection?kl(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Js=!1,Ps&&Cs){$s("dragStarted",this,{evt:t}),this.nativeDraggable&&Xr(document,"dragover",fl);var o=this.options;!e&&os(Cs,o.dragClass,!1),os(Cs,o.ghostClass,!0),gl.active=this,e&&this._appendGhost(),Es({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Us){this._lastX=Us.clientX,this._lastY=Us.clientY,pl();for(var e=document.elementFromPoint(Us.clientX,Us.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Us.clientX,Us.clientY))!==t;)t=e;if(Cs.parentNode[vs]._isOutsideThisEl(e),t)do{if(t[vs]){if(t[vs]._onDragOver({clientX:Us.clientX,clientY:Us.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=Jr(t));_l()}},_onTouchMove:function(e){if(Hs){var t=this.options,o=t.fallbackTolerance,i=t.fallbackOffset,a=e.touches?e.touches[0]:e,n=Ds&&as(Ds,!0),r=Ds&&n&&n.a,s=Ds&&n&&n.d,l=sl&&Ks&&hs(Ks),c=(a.clientX-Hs.clientX+i.x)/(r||1)+(l?l[0]-il[0]:0)/(r||1),d=(a.clientY-Hs.clientY+i.y)/(s||1)+(l?l[1]-il[1]:0)/(s||1);if(!gl.active&&!Js){if(o&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(Ds){n?(n.e+=c-(Fs||0),n.f+=d-(Gs||0)):n={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")");is(Ds,"webkitTransform",u),is(Ds,"mozTransform",u),is(Ds,"msTransform",u),is(Ds,"transform",u),Fs=c,Gs=d,Us=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Ds){var e=this.options.fallbackOnBody?document.body:Ps,t=ss(Cs,!0,sl,!0,e),o=this.options;if(sl){for(Ks=e;"static"===is(Ks,"position")&&"none"===is(Ks,"transform")&&Ks!==document;)Ks=Ks.parentNode;Ks!==document.body&&Ks!==document.documentElement?(Ks===document&&(Ks=rs()),t.top+=Ks.scrollTop,t.left+=Ks.scrollLeft):Ks=rs(),il=hs(Ks)}os(Ds=Cs.cloneNode(!0),o.ghostClass,!1),os(Ds,o.fallbackClass,!0),os(Ds,o.dragClass,!0),is(Ds,"transition",""),is(Ds,"transform",""),is(Ds,"box-sizing","border-box"),is(Ds,"margin",0),is(Ds,"top",t.top),is(Ds,"left",t.left),is(Ds,"width",t.width),is(Ds,"height",t.height),is(Ds,"opacity","0.8"),is(Ds,"position",sl?"absolute":"fixed"),is(Ds,"zIndex","100000"),is(Ds,"pointerEvents","none"),gl.ghost=Ds,e.appendChild(Ds),is(Ds,"transform-origin",Vs/parseInt(Ds.style.width)*100+"% "+Ws/parseInt(Ds.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,i=e.dataTransfer,a=o.options;$s("dragStart",this,{evt:e}),gl.eventCanceled?this._onDrop():($s("setupClone",this),gl.eventCanceled||((zs=gs(Cs)).removeAttribute("id"),zs.draggable=!1,zs.style["will-change"]="",this._hideClone(),os(zs,this.options.chosenClass,!1),gl.clone=zs),o.cloneId=kl(function(){$s("clone",o),gl.eventCanceled||(o.options.removeCloneOnHide||Ps.insertBefore(zs,Cs),o._hideClone(),Es({sortable:o,name:"clone"}))}),!t&&os(Cs,a.dragClass,!0),t?(Qs=!0,o._loopId=setInterval(o._emulateDragOver,50)):(qr(document,"mouseup",o._onDrop),qr(document,"touchend",o._onDrop),qr(document,"touchcancel",o._onDrop),i&&(i.effectAllowed="move",a.setData&&a.setData.call(o,i,Cs)),Xr(document,"drop",o),is(Cs,"transform","translateZ(0)")),Js=!0,o._dragStartId=kl(o._dragStarted.bind(o,t,e)),Xr(document,"selectstart",o),Zs=!0,window.getSelection().removeAllRanges(),Vr&&is(document.body,"user-select","none"))},_onDragOver:function(e){var t,o,i,a,n=this.el,r=e.target,s=this.options,l=s.group,c=gl.active,d=Ls===l,u=s.sort,h=Rs||c,p=this,_=!1;if(!al){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),r=Qr(r,s.draggable,n,!0),D("dragOver"),gl.eventCanceled)return _;if(Cs.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||p._ignoreWhileAnimating===r)return M(!1);if(Qs=!1,c&&!s.disabled&&(d?u||(i=As!==Ps):Rs===this||(this.lastPutMode=Ls.checkPull(this,c,Cs,e))&&l.checkPut(this,c,Cs,e))){if(a="vertical"===this._getDirection(e,r),t=ss(Cs),D("dragOverValid"),gl.eventCanceled)return _;if(i)return As=Ps,P(),this._hideClone(),D("revert"),gl.eventCanceled||(Ms?Ps.insertBefore(Cs,Ms):Ps.appendChild(Cs)),M(!0);var m=ds(n,s.draggable);if(!m||function(e,t,o){var i=ss(ds(o.el,o.options.draggable)),a=ys(o.el,o.options,Ds),n=10;return t?e.clientX>a.right+n||e.clientY>i.bottom&&e.clientX>i.left:e.clientY>a.bottom+n||e.clientX>i.right&&e.clientY>i.top}(e,a,this)&&!m.animated){if(m===Cs)return M(!1);if(m&&n===e.target&&(r=m),r&&(o=ss(r)),!1!==yl(Ps,n,Cs,t,r,o,e,!!r))return P(),m&&m.nextSibling?n.insertBefore(Cs,m.nextSibling):n.appendChild(Cs),As=n,T(),M(!0)}else if(m&&function(e,t,o){var i=ss(cs(o.el,0,o.options,!0)),a=ys(o.el,o.options,Ds),n=10;return t?e.clientX<a.left-n||e.clientY<i.top&&e.clientX<i.right:e.clientY<a.top-n||e.clientY<i.bottom&&e.clientX<i.left}(e,a,this)){var f=cs(n,0,s,!0);if(f===Cs)return M(!1);if(o=ss(r=f),!1!==yl(Ps,n,Cs,t,r,o,e,!1))return P(),n.insertBefore(Cs,f),As=n,T(),M(!0)}else if(r.parentNode===n){o=ss(r);var g,y,v,b=Cs.parentNode!==n,w=!function(e,t,o){var i=o?e.left:e.top,a=o?e.right:e.bottom,n=o?e.width:e.height,r=o?t.left:t.top,s=o?t.right:t.bottom,l=o?t.width:t.height;return i===r||a===s||i+n/2===r+l/2}(Cs.animated&&Cs.toRect||t,r.animated&&r.toRect||o,a),k=a?"top":"left",x=ls(r,"top","top")||ls(Cs,"top","top"),S=x?x.scrollTop:void 0;if(Ys!==r&&(y=o[k],tl=!1,ol=!w&&s.invertSwap||b),g=function(e,t,o,i,a,n,r,s){var l=i?e.clientY:e.clientX,c=i?o.height:o.width,d=i?o.top:o.left,u=i?o.bottom:o.right,h=!1;if(!r)if(s&&qs<c*a){if(!tl&&(1===Xs?l>d+c*n/2:l<u-c*n/2)&&(tl=!0),tl)h=!0;else if(1===Xs?l<d+qs:l>u-qs)return-Xs}else if(l>d+c*(1-a)/2&&l<u-c*(1-a)/2)return function(e){return us(Cs)<us(e)?1:-1}(t);if((h=h||r)&&(l<d+c*n/2||l>u-c*n/2))return l>d+c/2?1:-1;return 0}(e,r,o,a,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,ol,Ys===r),0!==g){var $=us(Cs);do{$-=g,v=As.children[$]}while(v&&("none"===is(v,"display")||v===Ds))}if(0===g||v===r)return M(!1);Ys=r,Xs=g;var E=r.nextElementSibling,C=!1,A=yl(Ps,n,Cs,t,r,o,e,C=1===g);if(!1!==A)return 1!==A&&-1!==A||(C=1===A),al=!0,setTimeout(bl,30),P(),C&&!E?n.appendChild(Cs):r.parentNode.insertBefore(Cs,C?E:r),x&&fs(x,0,S-x.scrollTop),As=Cs.parentNode,void 0===y||ol||(qs=Math.abs(y-ss(r)[k])),T(),M(!0)}if(n.contains(Cs))return M(!1)}return!1}function D(s,l){$s(s,p,Lr({evt:e,isOwner:d,axis:a?"vertical":"horizontal",revert:i,dragRect:t,targetRect:o,canSort:u,fromSortable:h,target:r,completed:M,onMove:function(o,i){return yl(Ps,n,Cs,t,o,ss(o),e,i)},changed:T},l))}function P(){D("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function M(t){return D("dragOverCompleted",{insertion:t}),t&&(d?c._hideClone():c._showClone(p),p!==h&&(os(Cs,Rs?Rs.options.ghostClass:c.options.ghostClass,!1),os(Cs,s.ghostClass,!0)),Rs!==p&&p!==gl.active?Rs=p:p===gl.active&&Rs&&(Rs=null),h===p&&(p._ignoreWhileAnimating=r),p.animateAll(function(){D("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(r===Cs&&!Cs.animated||r===n&&!r.animated)&&(Ys=null),s.dragoverBubble||e.rootEl||r===document||(Cs.parentNode[vs]._isOutsideThisEl(e.target),!t&&ml(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),_=!0}function T(){Is=us(Cs),Bs=us(Cs,s.draggable),Es({sortable:p,name:"change",toEl:n,newIndex:Is,newDraggableIndex:Bs,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){qr(document,"mousemove",this._onTouchMove),qr(document,"touchmove",this._onTouchMove),qr(document,"pointermove",this._onTouchMove),qr(document,"dragover",ml),qr(document,"mousemove",ml),qr(document,"touchmove",ml)},_offUpEvents:function(){var e=this.el.ownerDocument;qr(e,"mouseup",this._onDrop),qr(e,"touchend",this._onDrop),qr(e,"pointerup",this._onDrop),qr(e,"pointercancel",this._onDrop),qr(e,"touchcancel",this._onDrop),qr(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;Is=us(Cs),Bs=us(Cs,o.draggable),$s("drop",this,{evt:e}),As=Cs&&Cs.parentNode,Is=us(Cs),Bs=us(Cs,o.draggable),gl.eventCanceled||(Js=!1,ol=!1,tl=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),xl(this.cloneId),xl(this._dragStartId),this.nativeDraggable&&(qr(document,"drop",this),qr(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Vr&&is(document.body,"user-select",""),is(Cs,"transform",""),e&&(Zs&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),Ds&&Ds.parentNode&&Ds.parentNode.removeChild(Ds),(Ps===As||Rs&&"clone"!==Rs.lastPutMode)&&zs&&zs.parentNode&&zs.parentNode.removeChild(zs),Cs&&(this.nativeDraggable&&qr(Cs,"dragend",this),vl(Cs),Cs.style["will-change"]="",Zs&&!Js&&os(Cs,Rs?Rs.options.ghostClass:this.options.ghostClass,!1),os(Cs,this.options.chosenClass,!1),Es({sortable:this,name:"unchoose",toEl:As,newIndex:null,newDraggableIndex:null,originalEvent:e}),Ps!==As?(Is>=0&&(Es({rootEl:As,name:"add",toEl:As,fromEl:Ps,originalEvent:e}),Es({sortable:this,name:"remove",toEl:As,originalEvent:e}),Es({rootEl:As,name:"sort",toEl:As,fromEl:Ps,originalEvent:e}),Es({sortable:this,name:"sort",toEl:As,originalEvent:e})),Rs&&Rs.save()):Is!==Ns&&Is>=0&&(Es({sortable:this,name:"update",toEl:As,originalEvent:e}),Es({sortable:this,name:"sort",toEl:As,originalEvent:e})),gl.active&&(null!=Is&&-1!==Is||(Is=Ns,Bs=js),Es({sortable:this,name:"end",toEl:As,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){$s("nulling",this),Ps=Cs=As=Ds=Ms=zs=Ts=Os=Hs=Us=Zs=Is=Bs=Ns=js=Ys=Xs=Rs=Ls=gl.dragged=gl.ghost=gl.clone=gl.active=null;var e=this.el;nl.forEach(function(t){e.contains(t)&&(t.checked=!0)}),nl.length=Fs=Gs=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Cs&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],o=this.el.children,i=0,a=o.length,n=this.options;i<a;i++)Qr(e=o[i],n.draggable,this.el,!1)&&t.push(e.getAttribute(n.dataIdAttr)||wl(e));return t},sort:function(e,t){var o={},i=this.el;this.toArray().forEach(function(e,t){var a=i.children[t];Qr(a,this.options.draggable,i,!1)&&(o[e]=a)},this),t&&this.captureAnimationState(),e.forEach(function(e){o[e]&&(i.removeChild(o[e]),i.appendChild(o[e]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return Qr(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(void 0===t)return o[e];var i=xs.modifyOption(this,e,t);o[e]=void 0!==i?i:t,"group"===e&&hl(o)},destroy:function(){$s("destroy",this);var e=this.el;e[vs]=null,qr(e,"mousedown",this._onTapStart),qr(e,"touchstart",this._onTapStart),qr(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(qr(e,"dragover",this),qr(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),el.splice(el.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Os){if($s("hideClone",this),gl.eventCanceled)return;is(zs,"display","none"),this.options.removeCloneOnHide&&zs.parentNode&&zs.parentNode.removeChild(zs),Os=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Os){if($s("showClone",this),gl.eventCanceled)return;Cs.parentNode!=Ps||this.options.group.revertClone?Ms?Ps.insertBefore(zs,Ms):Ps.appendChild(zs):Ps.insertBefore(zs,Cs),this.options.group.revertClone&&this.animate(Cs,zs),is(zs,"display",""),Os=!1}}else this._hideClone()}},rl&&Xr(document,"touchmove",function(e){(gl.active||Js)&&e.cancelable&&e.preventDefault()}),gl.utils={on:Xr,off:qr,css:is,find:ns,is:function(e,t){return!!Qr(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);return e},throttle:ms,closest:Qr,toggleClass:os,clone:gs,index:us,nextTick:kl,cancelNextTick:xl,detectDirection:ul,getChild:cs,expando:vs},gl.get=function(e){return e[vs]},gl.mount=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];t[0].constructor===Array&&(t=t[0]),t.forEach(function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(gl.utils=Lr(Lr({},gl.utils),e.utils)),xs.mount(e)})},gl.create=function(e,t){return new gl(e,t)},gl.version="1.15.7";var Sl,$l,El,Cl,Al,Dl,Pl=[],Ml=!1;function Tl(){Pl.forEach(function(e){clearInterval(e.pid)}),Pl=[]}function zl(){clearInterval(Dl)}var Ol=ms(function(e,t,o,i){if(t.scroll){var a,n=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,c=rs(),d=!1;$l!==o&&($l=o,Tl(),Sl=t.scroll,a=t.scrollFn,!0===Sl&&(Sl=ps(o,!0)));var u=0,h=Sl;do{var p=h,_=ss(p),m=_.top,f=_.bottom,g=_.left,y=_.right,v=_.width,b=_.height,w=void 0,k=void 0,x=p.scrollWidth,S=p.scrollHeight,$=is(p),E=p.scrollLeft,C=p.scrollTop;p===c?(w=v<x&&("auto"===$.overflowX||"scroll"===$.overflowX||"visible"===$.overflowX),k=b<S&&("auto"===$.overflowY||"scroll"===$.overflowY||"visible"===$.overflowY)):(w=v<x&&("auto"===$.overflowX||"scroll"===$.overflowX),k=b<S&&("auto"===$.overflowY||"scroll"===$.overflowY));var A=w&&(Math.abs(y-n)<=s&&E+v<x)-(Math.abs(g-n)<=s&&!!E),D=k&&(Math.abs(f-r)<=s&&C+b<S)-(Math.abs(m-r)<=s&&!!C);if(!Pl[u])for(var P=0;P<=u;P++)Pl[P]||(Pl[P]={});Pl[u].vx==A&&Pl[u].vy==D&&Pl[u].el===p||(Pl[u].el=p,Pl[u].vx=A,Pl[u].vy=D,clearInterval(Pl[u].pid),0==A&&0==D||(d=!0,Pl[u].pid=setInterval(function(){i&&0===this.layer&&gl.active._onTouchMove(Al);var t=Pl[this.layer].vy?Pl[this.layer].vy*l:0,o=Pl[this.layer].vx?Pl[this.layer].vx*l:0;"function"==typeof a&&"continue"!==a.call(gl.dragged.parentNode[vs],o,t,e,Al,Pl[this.layer].el)||fs(Pl[this.layer].el,o,t)}.bind({layer:u}),24))),u++}while(t.bubbleScroll&&h!==c&&(h=ps(h,!1)));Ml=d}},30),Nl=function(e){var t=e.originalEvent,o=e.putSortable,i=e.dragEl,a=e.activeSortable,n=e.dispatchSortableEvent,r=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=o||a;r();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(c.clientX,c.clientY);s(),l&&!l.el.contains(d)&&(n("spill"),this.onSpill({dragEl:i,putSortable:o}))}};function Il(){}function jl(){}function Bl(e,t,o){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var i=o.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function Ll(){return Ll=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)({}).hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},Ll.apply(null,arguments)}function Rl(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,i)}return o}function Hl(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?Rl(Object(o),!0).forEach(function(t){Bl(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Rl(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function Ul(e){return Ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ul(e)}Il.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var i=cs(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:Nl},jr(Il,{pluginName:"revertOnSpill"}),jl.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable||this.sortable;o.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),o.animateAll()},drop:Nl},jr(jl,{pluginName:"removeOnSpill"}),gl.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?Xr(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Xr(document,"pointermove",this._handleFallbackAutoScroll):t.touches?Xr(document,"touchmove",this._handleFallbackAutoScroll):Xr(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?qr(document,"dragover",this._handleAutoScroll):(qr(document,"pointermove",this._handleFallbackAutoScroll),qr(document,"touchmove",this._handleFallbackAutoScroll),qr(document,"mousemove",this._handleFallbackAutoScroll)),zl(),Tl(),clearTimeout(es),es=void 0},nulling:function(){Al=$l=Sl=Ml=Dl=El=Cl=null,Pl.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var o=this,i=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,n=document.elementFromPoint(i,a);if(Al=e,t||this.options.forceAutoScrollFallback||Fr||Ur||Vr){Ol(e,this.options,n,t);var r=ps(n,!0);!Ml||Dl&&i===El&&a===Cl||(Dl&&zl(),Dl=setInterval(function(){var n=ps(document.elementFromPoint(i,a),!0);n!==r&&(r=n,Tl()),Ol(e,o.options,n,t)},10),El=i,Cl=a)}else{if(!this.options.bubbleScroll||ps(n,!0)===rs())return void Tl();Ol(e,this.options,ps(n,!1),!1)}}},jr(e,{pluginName:"scroll",initializeByDefault:!0})}),gl.mount(jl,Il);function Fl(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var Gl=Fl(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Vl=Fl(/Edge/i),Wl=Fl(/firefox/i),Zl=Fl(/safari/i)&&!Fl(/chrome/i)&&!Fl(/android/i),Yl=Fl(/iP(ad|od|hone)/i),Xl=Fl(/chrome/i)&&Fl(/android/i),ql={capture:!1,passive:!1};function Kl(e,t,o){e.addEventListener(t,o,!Gl&&ql)}function Jl(e,t,o){e.removeEventListener(t,o,!Gl&&ql)}function Ql(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function ec(e){return e.host&&e!==document&&e.host.nodeType&&e.host!==e?e.host:e.parentNode}function tc(e,t,o,i){if(e){o=o||document;do{if(null!=t&&(">"===t[0]?e.parentNode===o&&Ql(e,t):Ql(e,t))||i&&e===o)return e;if(e===o)break}while(e=ec(e))}return null}var oc,ic=/\s+/g;function ac(e,t,o){if(e&&t)if(e.classList)e.classList[o?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(ic," ").replace(" "+t+" "," ");e.className=(i+(o?" "+t:"")).replace(ic," ")}}function nc(e,t,o){var i=e&&e.style;if(i){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(o=e.currentStyle),void 0===t?o:o[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=o+("string"==typeof o?"":"px")}}function rc(e,t){var o="";if("string"==typeof e)o=e;else do{var i=nc(e,"transform");i&&"none"!==i&&(o=i+" "+o)}while(!t&&(e=e.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(o)}function sc(e,t,o){if(e){var i=e.getElementsByTagName(t),a=0,n=i.length;if(o)for(;a<n;a++)o(i[a],a);return i}return[]}function lc(){var e=document.scrollingElement;return e||document.documentElement}function cc(e,t,o,i,a){if(e.getBoundingClientRect||e===window){var n,r,s,l,c,d,u;if(e!==window&&e.parentNode&&e!==lc()?(r=(n=e.getBoundingClientRect()).top,s=n.left,l=n.bottom,c=n.right,d=n.height,u=n.width):(r=0,s=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(t||o)&&e!==window&&(a=a||e.parentNode,!Gl))do{if(a&&a.getBoundingClientRect&&("none"!==nc(a,"transform")||o&&"static"!==nc(a,"position"))){var h=a.getBoundingClientRect();r-=h.top+parseInt(nc(a,"border-top-width")),s-=h.left+parseInt(nc(a,"border-left-width")),l=r+n.height,c=s+n.width;break}}while(a=a.parentNode);if(i&&e!==window){var p=rc(a||e),_=p&&p.a,m=p&&p.d;p&&(l=(r/=m)+(d/=m),c=(s/=_)+(u/=_))}return{top:r,left:s,bottom:l,right:c,width:u,height:d}}}function dc(e,t,o){for(var i=mc(e,!0),a=cc(e)[t];i;){if(!(a>=cc(i)[o]))return i;if(i===lc())break;i=mc(i,!1)}return!1}function uc(e,t,o,i){for(var a=0,n=0,r=e.children;n<r.length;){if("none"!==r[n].style.display&&r[n]!==vd.ghost&&(i||r[n]!==vd.dragged)&&tc(r[n],o.draggable,e,!1)){if(a===t)return r[n];a++}n++}return null}function hc(e,t){for(var o=e.lastElementChild;o&&(o===vd.ghost||"none"===nc(o,"display")||t&&!Ql(o,t));)o=o.previousElementSibling;return o||null}function pc(e,t){var o=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===vd.clone||t&&!Ql(e,t)||o++;return o}function _c(e){var t=0,o=0,i=lc();if(e)do{var a=rc(e),n=a.a,r=a.d;t+=e.scrollLeft*n,o+=e.scrollTop*r}while(e!==i&&(e=e.parentNode));return[t,o]}function mc(e,t){if(!e||!e.getBoundingClientRect)return lc();var o=e,i=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var a=nc(o);if(o.clientWidth<o.scrollWidth&&("auto"==a.overflowX||"scroll"==a.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==a.overflowY||"scroll"==a.overflowY)){if(!o.getBoundingClientRect||o===document.body)return lc();if(i||t)return o;i=!0}}}while(o=o.parentNode);return lc()}function fc(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function gc(e,t){return function(){if(!oc){var o=arguments;1===o.length?e.call(this,o[0]):e.apply(this,o),oc=setTimeout(function(){oc=void 0},t)}}}function yc(e,t,o){e.scrollLeft+=t,e.scrollTop+=o}function vc(e){var t=window.Polymer,o=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):o?o(e).clone(!0)[0]:e.cloneNode(!0)}function bc(e,t,o){var i={};return Array.from(e.children).forEach(function(a){var n,r,s,l;if(tc(a,t.draggable,e,!1)&&!a.animated&&a!==o){var c=cc(a);i.left=Math.min(null!==(n=i.left)&&void 0!==n?n:1/0,c.left),i.top=Math.min(null!==(r=i.top)&&void 0!==r?r:1/0,c.top),i.right=Math.max(null!==(s=i.right)&&void 0!==s?s:-1/0,c.right),i.bottom=Math.max(null!==(l=i.bottom)&&void 0!==l?l:-1/0,c.bottom)}}),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}var wc="Sortable"+(new Date).getTime();function kc(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach(function(e){if("none"!==nc(e,"display")&&e!==vd.ghost){t.push({target:e,rect:cc(e)});var o=Hl({},t[t.length-1].rect);if(e.thisAnimationDuration){var i=rc(e,!0);i&&(o.top-=i.f,o.left-=i.e)}e.fromRect=o}})},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var o in e)if(e.hasOwnProperty(o))for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e[o][i])return Number(o);return-1}(t,{target:e}),1)},animateAll:function(o){var i=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof o&&o());var a=!1,n=0;t.forEach(function(e){var t=0,o=e.target,r=o.fromRect,s=cc(o),l=o.prevFromRect,c=o.prevToRect,d=e.rect,u=rc(o,!0);u&&(s.top-=u.f,s.left-=u.e),o.toRect=s,o.thisAnimationDuration&&fc(l,s)&&!fc(r,s)&&(d.top-s.top)/(d.left-s.left)===(r.top-s.top)/(r.left-s.left)&&(t=function(e,t,o,i){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-o.top,2)+Math.pow(t.left-o.left,2))*i.animation}(d,l,c,i.options)),fc(s,r)||(o.prevFromRect=r,o.prevToRect=s,t||(t=i.options.animation),i.animate(o,d,s,t)),t&&(a=!0,n=Math.max(n,t),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout(function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null},t),o.thisAnimationDuration=t)}),clearTimeout(e),a?e=setTimeout(function(){"function"==typeof o&&o()},n):"function"==typeof o&&o(),t=[]},animate:function(e,t,o,i){if(i){nc(e,"transition",""),nc(e,"transform","");var a=rc(this.el),n=a&&a.a,r=a&&a.d,s=(t.left-o.left)/(n||1),l=(t.top-o.top)/(r||1);e.animatingX=!!s,e.animatingY=!!l,nc(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),nc(e,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),nc(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout(function(){nc(e,"transition",""),nc(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1},i)}}}}var xc=[],Sc={initializeByDefault:!0},$c={mount:function(e){for(var t in Sc)Sc.hasOwnProperty(t)&&!(t in e)&&(e[t]=Sc[t]);xc.forEach(function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),xc.push(e)},pluginEvent:function(e,t,o){var i=this;this.eventCanceled=!1,o.cancel=function(){i.eventCanceled=!0};var a=e+"Global";xc.forEach(function(i){t[i.pluginName]&&(t[i.pluginName][a]&&t[i.pluginName][a](Hl({sortable:t},o)),t.options[i.pluginName]&&t[i.pluginName][e]&&t[i.pluginName][e](Hl({sortable:t},o)))})},initializePlugins:function(e,t,o,i){for(var a in xc.forEach(function(i){var a=i.pluginName;if(e.options[a]||i.initializeByDefault){var n=new i(e,t,e.options);n.sortable=e,n.options=e.options,e[a]=n,Ll(o,n.defaults)}}),e.options)if(e.options.hasOwnProperty(a)){var n=this.modifyOption(e,a,e.options[a]);void 0!==n&&(e.options[a]=n)}},getEventProperties:function(e,t){var o={};return xc.forEach(function(i){"function"==typeof i.eventProperties&&Ll(o,i.eventProperties.call(t[i.pluginName],e))}),o},modifyOption:function(e,t,o){var i;return xc.forEach(function(a){e[a.pluginName]&&a.optionListeners&&"function"==typeof a.optionListeners[t]&&(i=a.optionListeners[t].call(e[a.pluginName],o))}),i}};var Ec=["evt"],Cc=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=o.evt,a=function(e,t){if(null==e)return{};var o,i,a=function(e,t){if(null==e)return{};var o={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;o[i]=e[i]}return o}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i<n.length;i++)o=n[i],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}(o,Ec);$c.pluginEvent.bind(vd)(e,t,Hl({dragEl:Dc,parentEl:Pc,ghostEl:Mc,rootEl:Tc,nextEl:zc,lastDownEl:Oc,cloneEl:Nc,cloneHidden:Ic,dragStarted:Xc,putSortable:Uc,activeSortable:vd.active,originalEvent:i,oldIndex:jc,oldDraggableIndex:Lc,newIndex:Bc,newDraggableIndex:Rc,hideGhostForTarget:md,unhideGhostForTarget:fd,cloneNowHidden:function(){Ic=!0},cloneNowShown:function(){Ic=!1},dispatchSortableEvent:function(e){Ac({sortable:t,name:e,originalEvent:i})}},a))};function Ac(e){!function(e){var t=e.sortable,o=e.rootEl,i=e.name,a=e.targetEl,n=e.cloneEl,r=e.toEl,s=e.fromEl,l=e.oldIndex,c=e.newIndex,d=e.oldDraggableIndex,u=e.newDraggableIndex,h=e.originalEvent,p=e.putSortable,_=e.extraEventProperties;if(t=t||o&&o[wc]){var m,f=t.options,g="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||Gl||Vl?(m=document.createEvent("Event")).initEvent(i,!0,!0):m=new CustomEvent(i,{bubbles:!0,cancelable:!0}),m.to=r||o,m.from=s||o,m.item=a||o,m.clone=n,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var y=Hl(Hl({},_),$c.getEventProperties(i,t));for(var v in y)m[v]=y[v];o&&o.dispatchEvent(m),f[g]&&f[g].call(t,m)}}(Hl({putSortable:Uc,cloneEl:Nc,targetEl:Dc,rootEl:Tc,oldIndex:jc,oldDraggableIndex:Lc,newIndex:Bc,newDraggableIndex:Rc},e))}var Dc,Pc,Mc,Tc,zc,Oc,Nc,Ic,jc,Bc,Lc,Rc,Hc,Uc,Fc,Gc,Vc,Wc,Zc,Yc,Xc,qc,Kc,Jc,Qc,ed=!1,td=!1,od=[],id=!1,ad=!1,nd=[],rd=!1,sd=[],ld="undefined"!=typeof document,cd=Yl,dd=Vl||Gl?"cssFloat":"float",ud=ld&&!Xl&&!Yl&&"draggable"in document.createElement("div"),hd=function(){if(ld){if(Gl)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),pd=function(e,t){var o=nc(e),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),a=uc(e,0,t),n=uc(e,1,t),r=a&&nc(a),s=n&&nc(n),l=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+cc(a).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+cc(n).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&r.float&&"none"!==r.float){var d="left"===r.float?"left":"right";return!n||"both"!==s.clear&&s.clear!==d?"horizontal":"vertical"}return a&&("block"===r.display||"flex"===r.display||"table"===r.display||"grid"===r.display||l>=i&&"none"===o[dd]||n&&"none"===o[dd]&&l+c>i)?"vertical":"horizontal"},_d=function(e){function t(e,o){return function(i,a,n,r){var s=i.options.group.name&&a.options.group.name&&i.options.group.name===a.options.group.name;if(null==e&&(o||s))return!0;if(null==e||!1===e)return!1;if(o&&"clone"===e)return e;if("function"==typeof e)return t(e(i,a,n,r),o)(i,a,n,r);var l=(o?i:a).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var o={},i=e.group;i&&"object"==Ul(i)||(i={name:i}),o.name=i.name,o.checkPull=t(i.pull,!0),o.checkPut=t(i.put),o.revertClone=i.revertClone,e.group=o},md=function(){!hd&&Mc&&nc(Mc,"display","none")},fd=function(){!hd&&Mc&&nc(Mc,"display","")};ld&&!Xl&&document.addEventListener("click",function(e){if(td)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),td=!1,!1},!0);var gd=function(e){if(Dc){var t=function(e,t){var o;return od.some(function(i){var a=i[wc].options.emptyInsertThreshold;if(a&&!hc(i)){var n=cc(i),r=e>=n.left-a&&e<=n.right+a,s=t>=n.top-a&&t<=n.bottom+a;return r&&s?o=i:void 0}}),o}((e=e.touches?e.touches[0]:e).clientX,e.clientY);if(t){var o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[wc]._onDragOver(o)}}},yd=function(e){Dc&&Dc.parentNode[wc]._isOutsideThisEl(e.target)};function vd(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=Ll({},t),e[wc]=this;var o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return pd(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==vd.supportPointer&&"PointerEvent"in window&&(!Zl||Yl),emptyInsertThreshold:5};for(var i in $c.initializePlugins(this,e,o),o)!(i in t)&&(t[i]=o[i]);for(var a in _d(t),this)"_"===a.charAt(0)&&"function"==typeof this[a]&&(this[a]=this[a].bind(this));this.nativeDraggable=!t.forceFallback&&ud,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Kl(e,"pointerdown",this._onTapStart):(Kl(e,"mousedown",this._onTapStart),Kl(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Kl(e,"dragover",this),Kl(e,"dragenter",this)),od.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),Ll(this,kc())}function bd(e,t,o,i,a,n,r,s){var l,c,d=e[wc],u=d.options.onMove;return!window.CustomEvent||Gl||Vl?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=o,l.draggedRect=i,l.related=a||t,l.relatedRect=n||cc(t),l.willInsertAfter=s,l.originalEvent=r,e.dispatchEvent(l),u&&(c=u.call(d,l,r)),c}function wd(e){e.draggable=!1}function kd(){rd=!1}function xd(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,o=t.length,i=0;o--;)i+=t.charCodeAt(o);return i.toString(36)}function Sd(e){return setTimeout(e,0)}function $d(e){return clearTimeout(e)}vd.prototype={constructor:vd,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(qc=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Dc):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,i=this.options,a=i.preventOnFilter,n=e.type,r=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(r||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,c=i.filter;if(function(e){sd.length=0;var t=e.getElementsByTagName("input"),o=t.length;for(;o--;){var i=t[o];i.checked&&sd.push(i)}}(o),!Dc&&!(/mousedown|pointerdown/.test(n)&&0!==e.button||i.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Zl||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=tc(s,i.draggable,o,!1))&&s.animated||Oc===s)){if(jc=pc(s),Lc=pc(s,i.draggable),"function"==typeof c){if(c.call(this,e,s,this))return Ac({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:o,fromEl:o}),Cc("filter",t,{evt:e}),void(a&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(i){if(i=tc(l,i.trim(),o,!1))return Ac({sortable:t,rootEl:i,name:"filter",targetEl:s,fromEl:o,toEl:o}),Cc("filter",t,{evt:e}),!0})))return void(a&&e.preventDefault());i.handle&&!tc(l,i.handle,o,!1)||this._prepareDragStart(e,r,s)}}},_prepareDragStart:function(e,t,o){var i,a=this,n=a.el,r=a.options,s=n.ownerDocument;if(o&&!Dc&&o.parentNode===n){var l=cc(o);if(Tc=n,Pc=(Dc=o).parentNode,zc=Dc.nextSibling,Oc=o,Hc=r.group,vd.dragged=Dc,Fc={target:Dc,clientX:(t||e).clientX,clientY:(t||e).clientY},Zc=Fc.clientX-l.left,Yc=Fc.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Dc.style["will-change"]="all",i=function(){Cc("delayEnded",a,{evt:e}),vd.eventCanceled?a._onDrop():(a._disableDelayedDragEvents(),!Wl&&a.nativeDraggable&&(Dc.draggable=!0),a._triggerDragStart(e,t),Ac({sortable:a,name:"choose",originalEvent:e}),ac(Dc,r.chosenClass,!0))},r.ignore.split(",").forEach(function(e){sc(Dc,e.trim(),wd)}),Kl(s,"dragover",gd),Kl(s,"mousemove",gd),Kl(s,"touchmove",gd),r.supportPointer?(Kl(s,"pointerup",a._onDrop),!this.nativeDraggable&&Kl(s,"pointercancel",a._onDrop)):(Kl(s,"mouseup",a._onDrop),Kl(s,"touchend",a._onDrop),Kl(s,"touchcancel",a._onDrop)),Wl&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Dc.draggable=!0),Cc("delayStart",this,{evt:e}),!r.delay||r.delayOnTouchOnly&&!t||this.nativeDraggable&&(Vl||Gl))i();else{if(vd.eventCanceled)return void this._onDrop();r.supportPointer?(Kl(s,"pointerup",a._disableDelayedDrag),Kl(s,"pointercancel",a._disableDelayedDrag)):(Kl(s,"mouseup",a._disableDelayedDrag),Kl(s,"touchend",a._disableDelayedDrag),Kl(s,"touchcancel",a._disableDelayedDrag)),Kl(s,"mousemove",a._delayedDragTouchMoveHandler),Kl(s,"touchmove",a._delayedDragTouchMoveHandler),r.supportPointer&&Kl(s,"pointermove",a._delayedDragTouchMoveHandler),a._dragStartTimer=setTimeout(i,r.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Dc&&wd(Dc),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Jl(e,"mouseup",this._disableDelayedDrag),Jl(e,"touchend",this._disableDelayedDrag),Jl(e,"touchcancel",this._disableDelayedDrag),Jl(e,"pointerup",this._disableDelayedDrag),Jl(e,"pointercancel",this._disableDelayedDrag),Jl(e,"mousemove",this._delayedDragTouchMoveHandler),Jl(e,"touchmove",this._delayedDragTouchMoveHandler),Jl(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?Kl(document,"pointermove",this._onTouchMove):Kl(document,t?"touchmove":"mousemove",this._onTouchMove):(Kl(Dc,"dragend",this),Kl(Tc,"dragstart",this._onDragStart));try{document.selection?Sd(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(ed=!1,Tc&&Dc){Cc("dragStarted",this,{evt:t}),this.nativeDraggable&&Kl(document,"dragover",yd);var o=this.options;!e&&ac(Dc,o.dragClass,!1),ac(Dc,o.ghostClass,!0),vd.active=this,e&&this._appendGhost(),Ac({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Gc){this._lastX=Gc.clientX,this._lastY=Gc.clientY,md();for(var e=document.elementFromPoint(Gc.clientX,Gc.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Gc.clientX,Gc.clientY))!==t;)t=e;if(Dc.parentNode[wc]._isOutsideThisEl(e),t)do{if(t[wc]){if(t[wc]._onDragOver({clientX:Gc.clientX,clientY:Gc.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=ec(t));fd()}},_onTouchMove:function(e){if(Fc){var t=this.options,o=t.fallbackTolerance,i=t.fallbackOffset,a=e.touches?e.touches[0]:e,n=Mc&&rc(Mc,!0),r=Mc&&n&&n.a,s=Mc&&n&&n.d,l=cd&&Qc&&_c(Qc),c=(a.clientX-Fc.clientX+i.x)/(r||1)+(l?l[0]-nd[0]:0)/(r||1),d=(a.clientY-Fc.clientY+i.y)/(s||1)+(l?l[1]-nd[1]:0)/(s||1);if(!vd.active&&!ed){if(o&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(Mc){n?(n.e+=c-(Vc||0),n.f+=d-(Wc||0)):n={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")");nc(Mc,"webkitTransform",u),nc(Mc,"mozTransform",u),nc(Mc,"msTransform",u),nc(Mc,"transform",u),Vc=c,Wc=d,Gc=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Mc){var e=this.options.fallbackOnBody?document.body:Tc,t=cc(Dc,!0,cd,!0,e),o=this.options;if(cd){for(Qc=e;"static"===nc(Qc,"position")&&"none"===nc(Qc,"transform")&&Qc!==document;)Qc=Qc.parentNode;Qc!==document.body&&Qc!==document.documentElement?(Qc===document&&(Qc=lc()),t.top+=Qc.scrollTop,t.left+=Qc.scrollLeft):Qc=lc(),nd=_c(Qc)}ac(Mc=Dc.cloneNode(!0),o.ghostClass,!1),ac(Mc,o.fallbackClass,!0),ac(Mc,o.dragClass,!0),nc(Mc,"transition",""),nc(Mc,"transform",""),nc(Mc,"box-sizing","border-box"),nc(Mc,"margin",0),nc(Mc,"top",t.top),nc(Mc,"left",t.left),nc(Mc,"width",t.width),nc(Mc,"height",t.height),nc(Mc,"opacity","0.8"),nc(Mc,"position",cd?"absolute":"fixed"),nc(Mc,"zIndex","100000"),nc(Mc,"pointerEvents","none"),vd.ghost=Mc,e.appendChild(Mc),nc(Mc,"transform-origin",Zc/parseInt(Mc.style.width)*100+"% "+Yc/parseInt(Mc.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,i=e.dataTransfer,a=o.options;Cc("dragStart",this,{evt:e}),vd.eventCanceled?this._onDrop():(Cc("setupClone",this),vd.eventCanceled||((Nc=vc(Dc)).removeAttribute("id"),Nc.draggable=!1,Nc.style["will-change"]="",this._hideClone(),ac(Nc,this.options.chosenClass,!1),vd.clone=Nc),o.cloneId=Sd(function(){Cc("clone",o),vd.eventCanceled||(o.options.removeCloneOnHide||Tc.insertBefore(Nc,Dc),o._hideClone(),Ac({sortable:o,name:"clone"}))}),!t&&ac(Dc,a.dragClass,!0),t?(td=!0,o._loopId=setInterval(o._emulateDragOver,50)):(Jl(document,"mouseup",o._onDrop),Jl(document,"touchend",o._onDrop),Jl(document,"touchcancel",o._onDrop),i&&(i.effectAllowed="move",a.setData&&a.setData.call(o,i,Dc)),Kl(document,"drop",o),nc(Dc,"transform","translateZ(0)")),ed=!0,o._dragStartId=Sd(o._dragStarted.bind(o,t,e)),Kl(document,"selectstart",o),Xc=!0,window.getSelection().removeAllRanges(),Zl&&nc(document.body,"user-select","none"))},_onDragOver:function(e){var t,o,i,a,n=this.el,r=e.target,s=this.options,l=s.group,c=vd.active,d=Hc===l,u=s.sort,h=Uc||c,p=this,_=!1;if(!rd){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),r=tc(r,s.draggable,n,!0),D("dragOver"),vd.eventCanceled)return _;if(Dc.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||p._ignoreWhileAnimating===r)return M(!1);if(td=!1,c&&!s.disabled&&(d?u||(i=Pc!==Tc):Uc===this||(this.lastPutMode=Hc.checkPull(this,c,Dc,e))&&l.checkPut(this,c,Dc,e))){if(a="vertical"===this._getDirection(e,r),t=cc(Dc),D("dragOverValid"),vd.eventCanceled)return _;if(i)return Pc=Tc,P(),this._hideClone(),D("revert"),vd.eventCanceled||(zc?Tc.insertBefore(Dc,zc):Tc.appendChild(Dc)),M(!0);var m=hc(n,s.draggable);if(!m||function(e,t,o){var i=cc(hc(o.el,o.options.draggable)),a=bc(o.el,o.options,Mc),n=10;return t?e.clientX>a.right+n||e.clientY>i.bottom&&e.clientX>i.left:e.clientY>a.bottom+n||e.clientX>i.right&&e.clientY>i.top}(e,a,this)&&!m.animated){if(m===Dc)return M(!1);if(m&&n===e.target&&(r=m),r&&(o=cc(r)),!1!==bd(Tc,n,Dc,t,r,o,e,!!r))return P(),m&&m.nextSibling?n.insertBefore(Dc,m.nextSibling):n.appendChild(Dc),Pc=n,T(),M(!0)}else if(m&&function(e,t,o){var i=cc(uc(o.el,0,o.options,!0)),a=bc(o.el,o.options,Mc),n=10;return t?e.clientX<a.left-n||e.clientY<i.top&&e.clientX<i.right:e.clientY<a.top-n||e.clientY<i.bottom&&e.clientX<i.left}(e,a,this)){var f=uc(n,0,s,!0);if(f===Dc)return M(!1);if(o=cc(r=f),!1!==bd(Tc,n,Dc,t,r,o,e,!1))return P(),n.insertBefore(Dc,f),Pc=n,T(),M(!0)}else if(r.parentNode===n){o=cc(r);var g,y,v,b=Dc.parentNode!==n,w=!function(e,t,o){var i=o?e.left:e.top,a=o?e.right:e.bottom,n=o?e.width:e.height,r=o?t.left:t.top,s=o?t.right:t.bottom,l=o?t.width:t.height;return i===r||a===s||i+n/2===r+l/2}(Dc.animated&&Dc.toRect||t,r.animated&&r.toRect||o,a),k=a?"top":"left",x=dc(r,"top","top")||dc(Dc,"top","top"),S=x?x.scrollTop:void 0;if(qc!==r&&(y=o[k],id=!1,ad=!w&&s.invertSwap||b),g=function(e,t,o,i,a,n,r,s){var l=i?e.clientY:e.clientX,c=i?o.height:o.width,d=i?o.top:o.left,u=i?o.bottom:o.right,h=!1;if(!r)if(s&&Jc<c*a){if(!id&&(1===Kc?l>d+c*n/2:l<u-c*n/2)&&(id=!0),id)h=!0;else if(1===Kc?l<d+Jc:l>u-Jc)return-Kc}else if(l>d+c*(1-a)/2&&l<u-c*(1-a)/2)return function(e){return pc(Dc)<pc(e)?1:-1}(t);if((h=h||r)&&(l<d+c*n/2||l>u-c*n/2))return l>d+c/2?1:-1;return 0}(e,r,o,a,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,ad,qc===r),0!==g){var $=pc(Dc);do{$-=g,v=Pc.children[$]}while(v&&("none"===nc(v,"display")||v===Mc))}if(0===g||v===r)return M(!1);qc=r,Kc=g;var E=r.nextElementSibling,C=!1,A=bd(Tc,n,Dc,t,r,o,e,C=1===g);if(!1!==A)return 1!==A&&-1!==A||(C=1===A),rd=!0,setTimeout(kd,30),P(),C&&!E?n.appendChild(Dc):r.parentNode.insertBefore(Dc,C?E:r),x&&yc(x,0,S-x.scrollTop),Pc=Dc.parentNode,void 0===y||ad||(Jc=Math.abs(y-cc(r)[k])),T(),M(!0)}if(n.contains(Dc))return M(!1)}return!1}function D(s,l){Cc(s,p,Hl({evt:e,isOwner:d,axis:a?"vertical":"horizontal",revert:i,dragRect:t,targetRect:o,canSort:u,fromSortable:h,target:r,completed:M,onMove:function(o,i){return bd(Tc,n,Dc,t,o,cc(o),e,i)},changed:T},l))}function P(){D("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function M(t){return D("dragOverCompleted",{insertion:t}),t&&(d?c._hideClone():c._showClone(p),p!==h&&(ac(Dc,Uc?Uc.options.ghostClass:c.options.ghostClass,!1),ac(Dc,s.ghostClass,!0)),Uc!==p&&p!==vd.active?Uc=p:p===vd.active&&Uc&&(Uc=null),h===p&&(p._ignoreWhileAnimating=r),p.animateAll(function(){D("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(r===Dc&&!Dc.animated||r===n&&!r.animated)&&(qc=null),s.dragoverBubble||e.rootEl||r===document||(Dc.parentNode[wc]._isOutsideThisEl(e.target),!t&&gd(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),_=!0}function T(){Bc=pc(Dc),Rc=pc(Dc,s.draggable),Ac({sortable:p,name:"change",toEl:n,newIndex:Bc,newDraggableIndex:Rc,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Jl(document,"mousemove",this._onTouchMove),Jl(document,"touchmove",this._onTouchMove),Jl(document,"pointermove",this._onTouchMove),Jl(document,"dragover",gd),Jl(document,"mousemove",gd),Jl(document,"touchmove",gd)},_offUpEvents:function(){var e=this.el.ownerDocument;Jl(e,"mouseup",this._onDrop),Jl(e,"touchend",this._onDrop),Jl(e,"pointerup",this._onDrop),Jl(e,"pointercancel",this._onDrop),Jl(e,"touchcancel",this._onDrop),Jl(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;Bc=pc(Dc),Rc=pc(Dc,o.draggable),Cc("drop",this,{evt:e}),Pc=Dc&&Dc.parentNode,Bc=pc(Dc),Rc=pc(Dc,o.draggable),vd.eventCanceled||(ed=!1,ad=!1,id=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),$d(this.cloneId),$d(this._dragStartId),this.nativeDraggable&&(Jl(document,"drop",this),Jl(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Zl&&nc(document.body,"user-select",""),nc(Dc,"transform",""),e&&(Xc&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),Mc&&Mc.parentNode&&Mc.parentNode.removeChild(Mc),(Tc===Pc||Uc&&"clone"!==Uc.lastPutMode)&&Nc&&Nc.parentNode&&Nc.parentNode.removeChild(Nc),Dc&&(this.nativeDraggable&&Jl(Dc,"dragend",this),wd(Dc),Dc.style["will-change"]="",Xc&&!ed&&ac(Dc,Uc?Uc.options.ghostClass:this.options.ghostClass,!1),ac(Dc,this.options.chosenClass,!1),Ac({sortable:this,name:"unchoose",toEl:Pc,newIndex:null,newDraggableIndex:null,originalEvent:e}),Tc!==Pc?(Bc>=0&&(Ac({rootEl:Pc,name:"add",toEl:Pc,fromEl:Tc,originalEvent:e}),Ac({sortable:this,name:"remove",toEl:Pc,originalEvent:e}),Ac({rootEl:Pc,name:"sort",toEl:Pc,fromEl:Tc,originalEvent:e}),Ac({sortable:this,name:"sort",toEl:Pc,originalEvent:e})),Uc&&Uc.save()):Bc!==jc&&Bc>=0&&(Ac({sortable:this,name:"update",toEl:Pc,originalEvent:e}),Ac({sortable:this,name:"sort",toEl:Pc,originalEvent:e})),vd.active&&(null!=Bc&&-1!==Bc||(Bc=jc,Rc=Lc),Ac({sortable:this,name:"end",toEl:Pc,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Cc("nulling",this),Tc=Dc=Pc=Mc=zc=Nc=Oc=Ic=Fc=Gc=Xc=Bc=Rc=jc=Lc=qc=Kc=Uc=Hc=vd.dragged=vd.ghost=vd.clone=vd.active=null;var e=this.el;sd.forEach(function(t){e.contains(t)&&(t.checked=!0)}),sd.length=Vc=Wc=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Dc&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],o=this.el.children,i=0,a=o.length,n=this.options;i<a;i++)tc(e=o[i],n.draggable,this.el,!1)&&t.push(e.getAttribute(n.dataIdAttr)||xd(e));return t},sort:function(e,t){var o={},i=this.el;this.toArray().forEach(function(e,t){var a=i.children[t];tc(a,this.options.draggable,i,!1)&&(o[e]=a)},this),t&&this.captureAnimationState(),e.forEach(function(e){o[e]&&(i.removeChild(o[e]),i.appendChild(o[e]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return tc(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(void 0===t)return o[e];var i=$c.modifyOption(this,e,t);o[e]=void 0!==i?i:t,"group"===e&&_d(o)},destroy:function(){Cc("destroy",this);var e=this.el;e[wc]=null,Jl(e,"mousedown",this._onTapStart),Jl(e,"touchstart",this._onTapStart),Jl(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(Jl(e,"dragover",this),Jl(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),od.splice(od.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Ic){if(Cc("hideClone",this),vd.eventCanceled)return;nc(Nc,"display","none"),this.options.removeCloneOnHide&&Nc.parentNode&&Nc.parentNode.removeChild(Nc),Ic=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Ic){if(Cc("showClone",this),vd.eventCanceled)return;Dc.parentNode!=Tc||this.options.group.revertClone?zc?Tc.insertBefore(Nc,zc):Tc.appendChild(Nc):Tc.insertBefore(Nc,Dc),this.options.group.revertClone&&this.animate(Dc,Nc),nc(Nc,"display",""),Ic=!1}}else this._hideClone()}},ld&&Kl(document,"touchmove",function(e){(vd.active||ed)&&e.cancelable&&e.preventDefault()}),vd.utils={on:Kl,off:Jl,css:nc,find:sc,is:function(e,t){return!!tc(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);return e},throttle:gc,closest:tc,toggleClass:ac,clone:vc,index:pc,nextTick:Sd,cancelNextTick:$d,detectDirection:pd,getChild:uc,expando:wc},vd.get=function(e){return e[wc]},vd.mount=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];t[0].constructor===Array&&(t=t[0]),t.forEach(function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(vd.utils=Hl(Hl({},vd.utils),e.utils)),$c.mount(e)})},vd.create=function(e,t){return new vd(e,t)},vd.version="1.15.7";var Ed,Cd,Ad,Dd,Pd,Md,Td=[],zd=!1;function Od(){Td.forEach(function(e){clearInterval(e.pid)}),Td=[]}function Nd(){clearInterval(Md)}var Id=gc(function(e,t,o,i){if(t.scroll){var a,n=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,c=lc(),d=!1;Cd!==o&&(Cd=o,Od(),Ed=t.scroll,a=t.scrollFn,!0===Ed&&(Ed=mc(o,!0)));var u=0,h=Ed;do{var p=h,_=cc(p),m=_.top,f=_.bottom,g=_.left,y=_.right,v=_.width,b=_.height,w=void 0,k=void 0,x=p.scrollWidth,S=p.scrollHeight,$=nc(p),E=p.scrollLeft,C=p.scrollTop;p===c?(w=v<x&&("auto"===$.overflowX||"scroll"===$.overflowX||"visible"===$.overflowX),k=b<S&&("auto"===$.overflowY||"scroll"===$.overflowY||"visible"===$.overflowY)):(w=v<x&&("auto"===$.overflowX||"scroll"===$.overflowX),k=b<S&&("auto"===$.overflowY||"scroll"===$.overflowY));var A=w&&(Math.abs(y-n)<=s&&E+v<x)-(Math.abs(g-n)<=s&&!!E),D=k&&(Math.abs(f-r)<=s&&C+b<S)-(Math.abs(m-r)<=s&&!!C);if(!Td[u])for(var P=0;P<=u;P++)Td[P]||(Td[P]={});Td[u].vx==A&&Td[u].vy==D&&Td[u].el===p||(Td[u].el=p,Td[u].vx=A,Td[u].vy=D,clearInterval(Td[u].pid),0==A&&0==D||(d=!0,Td[u].pid=setInterval(function(){i&&0===this.layer&&vd.active._onTouchMove(Pd);var t=Td[this.layer].vy?Td[this.layer].vy*l:0,o=Td[this.layer].vx?Td[this.layer].vx*l:0;"function"==typeof a&&"continue"!==a.call(vd.dragged.parentNode[wc],o,t,e,Pd,Td[this.layer].el)||yc(Td[this.layer].el,o,t)}.bind({layer:u}),24))),u++}while(t.bubbleScroll&&h!==c&&(h=mc(h,!1)));zd=d}},30),jd=function(e){var t=e.originalEvent,o=e.putSortable,i=e.dragEl,a=e.activeSortable,n=e.dispatchSortableEvent,r=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=o||a;r();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(c.clientX,c.clientY);s(),l&&!l.el.contains(d)&&(n("spill"),this.onSpill({dragEl:i,putSortable:o}))}};function Bd(){}function Ld(){}Bd.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var i=uc(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:jd},Ll(Bd,{pluginName:"revertOnSpill"}),Ld.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable||this.sortable;o.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),o.animateAll()},drop:jd},Ll(Ld,{pluginName:"removeOnSpill"});var Rd=[Ld,Bd];const Hd=globalThis,Ud=e=>{try{gl.mount(e)}catch(e){const t=e instanceof Error?e.message:String(e);if(!t.includes("Cannot mount plugin")||!t.includes("more than once"))throw e}};Hd.__flixlixCardsSortablePluginsMounted||(Ud(Rd),Ud(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?Kl(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Kl(document,"pointermove",this._handleFallbackAutoScroll):t.touches?Kl(document,"touchmove",this._handleFallbackAutoScroll):Kl(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?Jl(document,"dragover",this._handleAutoScroll):(Jl(document,"pointermove",this._handleFallbackAutoScroll),Jl(document,"touchmove",this._handleFallbackAutoScroll),Jl(document,"mousemove",this._handleFallbackAutoScroll)),Nd(),Od(),clearTimeout(oc),oc=void 0},nulling:function(){Pd=Cd=Ed=zd=Md=Ad=Dd=null,Td.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var o=this,i=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,n=document.elementFromPoint(i,a);if(Pd=e,t||this.options.forceAutoScrollFallback||Vl||Gl||Zl){Id(e,this.options,n,t);var r=mc(n,!0);!zd||Md&&i===Ad&&a===Dd||(Md&&Nd(),Md=setInterval(function(){var n=mc(document.elementFromPoint(i,a),!0);n!==r&&(r=n,Od()),Id(e,o.options,n,t)},10),Ad=i,Dd=a)}else{if(!this.options.bubbleScroll||mc(n,!0)===lc())return void Od();Id(e,this.options,mc(n,!1),!1)}}},Ll(e,{pluginName:"scroll",initializeByDefault:!0})}),Hd.__flixlixCardsSortablePluginsMounted=!0);var Fd=Object.freeze({__proto__:null,default:gl});export{fa as PowerFlowCardPlus};
|