function e(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function t(e,t,n,a){var l,s=arguments.length,i=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,a);else for(var o=e.length-1;o>=0;o--)(l=e[o])&&(i=(s<3?l(i):s>3?l(t,n,i):l(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i}"function"==typeof SuppressedError&&SuppressedError; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const n=globalThis,a=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),s=new WeakMap;let i=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==l)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(a&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&s.set(t,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>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.")})(n)+e[a+1]),e[0]);return new i(n,e,l)},r=a?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new i("string"==typeof e?e:e+"",void 0,l))(t)})(e):e /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */,{is:c,defineProperty:_,getOwnPropertyDescriptor:h,getOwnPropertyNames:d,getOwnPropertySymbols:g,getPrototypeOf:p}=Object,m=globalThis,u=m.trustedTypes,v=u?u.emptyScript:"",f=m.reactiveElementPolyfillSupport,b=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},w=(e,t)=>!c(e,t),C={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let x=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){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 n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&_(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:l}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:a,set(t){const s=a?.call(this);l?.call(this,t),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=p(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...d(e),...g(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(r(e))}else void 0!==e&&t.push(r(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"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??=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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(a)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const a of t){const t=document.createElement("style"),l=n.litNonce;void 0!==l&&t.setAttribute("nonce",l),t.textContent=a.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){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,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const l=(void 0!==n.converter?.toAttribute?n.converter:y).toAttribute(t,n.type);this._$Em=e,null==l?this.removeAttribute(a):this.setAttribute(a,l),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),l="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=a,this[a]=l.fromAttribute(t,e.type)??this._$Ej?.get(a)??null,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const a=this.constructor,l=this[e];if(n??=a.getPropertyOptions(e),!((n.hasChanged??w)(l,t)||n.useDefault&&n.reflect&&l===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:a,wrapped:l},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==l||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===a&&this._$Em!==e&&(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.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,n]of e){const{wrapped:e}=n,a=this[t];!0!==e||this._$AL.has(t)||void 0===a||this.C(t,void 0,n,a)}}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.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[b("elementProperties")]=new Map,x[b("finalized")]=new Map,f?.({ReactiveElement:x}),(m.reactiveElementVersions??=[]).push("2.1.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const S=globalThis,k=S.trustedTypes,A=k?k.createPolicy("lit-html",{createHTML:e=>e}):void 0,M="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,V="?"+$,T=`<${V}>`,E=document,O=()=>E.createComment(""),z=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,N="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,B=/>/g,P=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,L=/"/g,H=/^(?:script|style|textarea|title)$/i,I=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),F=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),J=new WeakMap,q=E.createTreeWalker(E,129);function W(e,t){if(!D(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(t):t}const Z=(e,t)=>{const n=e.length-1,a=[];let l,s=2===t?"":3===t?"":"",i=U;for(let t=0;t"===r[0]?(i=l??U,c=-1):void 0===r[1]?c=-2:(c=i.lastIndex-r[2].length,o=r[1],i=void 0===r[3]?P:'"'===r[3]?L:j):i===L||i===j?i=P:i===R||i===B?i=U:(i=P,l=void 0);const h=i===P&&e[t+1].startsWith("/>")?" ":"";s+=i===U?n+T:c>=0?(a.push(o),n.slice(0,c)+M+n.slice(c)+$+h):n+$+(-2===c?t:h)}return[W(e,s+(e[n]||"")+(2===t?"":3===t?"":"")),a]};class G{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let l=0,s=0;const i=e.length-1,o=this.parts,[r,c]=Z(e,t);if(this.el=G.createElement(r,n),q.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=q.nextNode())&&o.length0){a.textContent=k?k.emptyScript:"";for(let n=0;nD(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!==K&&z(this._$AH)?this._$AA.nextSibling.data=e:this.T(E.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=G.createElement(W(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new Q(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=J.get(e.strings);return void 0===t&&J.set(e.strings,t=new G(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const l of e)a===t.length?t.push(n=new X(this.O(O()),this.O(O()),this,this.options)):n=t[a],n._$AI(l),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=K}_$AI(e,t=this,n,a){const l=this.strings;let s=!1;if(void 0===l)e=Y(this,e,t,0),s=!z(e)||e!==this._$AH&&e!==F,s&&(this._$AH=e);else{const a=e;let i,o;for(e=l[0],i=0;i{const a=n?.renderBefore??t;let l=a._$litPart$;if(void 0===l){const e=n?.renderBefore??null;a._$litPart$=l=new X(t.insertBefore(O(),e),e,void 0,n??{})}return l._$AI(e),l})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}}oe._$litElement$=!0,oe.finalized=!0,ie.litElementHydrateSupport?.({LitElement:oe});const re=ie.litElementPolyfillSupport;re?.({LitElement:oe}),(ie.litElementVersions??=[]).push("4.2.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const ce=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */,_e={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:w},he=(e=_e,t,n)=>{const{kind:a,metadata:l}=n;let s=globalThis.litPropertyMetadata.get(l);if(void 0===s&&globalThis.litPropertyMetadata.set(l,s=new Map),"setter"===a&&((e=Object.create(e)).wrapped=!0),s.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const l=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,l,e)},init(t){return void 0!==t&&this.C(a,void 0,e,t),t}}}if("setter"===a){const{name:a}=n;return function(n){const l=this[a];t.call(this,n),this.requestUpdate(a,l,e)}}throw Error("Unsupported decorator location: "+a)};function de(e){return(t,n)=>"object"==typeof n?he(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */}const ge="jk-bms-content-card-editor",pe="jk-bms-card";var me;!function(e){e.delta_cell_voltage="delta_cell_voltage",e.balancing="balancing",e.balancing_current="balancing_current",e.power="power",e.balance_trigger_voltage="balance_trigger_voltage",e.balance_starting_voltage="balance_starting_voltage",e.total_runtime_formatted="total_runtime_formatted",e.charging="charging",e.charging_power="charging_power",e.discharging="discharging",e.discharging_power="discharging_power",e.balancer="balancer",e.heater="heater",e.total_voltage="total_voltage",e.total_battery_capacity_setting="total_battery_capacity_setting",e.total_charging_cycle_capacity="total_charging_cycle_capacity",e.average_cell_voltage="average_cell_voltage",e.current="current",e.state_of_charge="state_of_charge",e.capacity_remaining="capacity_remaining",e.charging_cycles="charging_cycles",e.power_tube_temperature="power_tube_temperature",e.min_voltage_cell="min_voltage_cell",e.max_voltage_cell="max_voltage_cell",e.min_cell_voltage="min_cell_voltage",e.max_cell_voltage="max_cell_voltage",e.errors="errors",e.software_version="software_version",e.hardware_version="hardware_version",e.cell_voltage_1="cell_voltage_1",e.cell_voltage_2="cell_voltage_2",e.cell_voltage_3="cell_voltage_3",e.cell_voltage_4="cell_voltage_4",e.cell_voltage_5="cell_voltage_5",e.cell_voltage_6="cell_voltage_6",e.cell_voltage_7="cell_voltage_7",e.cell_voltage_8="cell_voltage_8",e.cell_voltage_9="cell_voltage_9",e.cell_voltage_10="cell_voltage_10",e.cell_voltage_11="cell_voltage_11",e.cell_voltage_12="cell_voltage_12",e.cell_voltage_13="cell_voltage_13",e.cell_voltage_14="cell_voltage_14",e.cell_voltage_15="cell_voltage_15",e.cell_voltage_16="cell_voltage_16",e.cell_voltage_17="cell_voltage_17",e.cell_voltage_18="cell_voltage_18",e.cell_voltage_19="cell_voltage_19",e.cell_voltage_20="cell_voltage_20",e.cell_voltage_21="cell_voltage_21",e.cell_voltage_22="cell_voltage_22",e.cell_voltage_23="cell_voltage_23",e.cell_voltage_24="cell_voltage_24",e.cell_voltage_25="cell_voltage_25",e.cell_voltage_26="cell_voltage_26",e.cell_voltage_27="cell_voltage_27",e.cell_voltage_28="cell_voltage_28",e.cell_voltage_29="cell_voltage_29",e.cell_voltage_30="cell_voltage_30",e.cell_voltage_31="cell_voltage_31",e.cell_voltage_32="cell_voltage_32",e.cell_voltage_33="cell_voltage_33",e.cell_voltage_34="cell_voltage_34",e.cell_voltage_35="cell_voltage_35",e.cell_voltage_36="cell_voltage_36",e.cell_voltage_37="cell_voltage_37",e.cell_voltage_38="cell_voltage_38",e.cell_voltage_39="cell_voltage_39",e.cell_voltage_40="cell_voltage_40",e.cell_voltage_41="cell_voltage_41",e.cell_voltage_42="cell_voltage_42",e.cell_voltage_43="cell_voltage_43",e.cell_voltage_44="cell_voltage_44",e.cell_voltage_45="cell_voltage_45",e.cell_voltage_46="cell_voltage_46",e.cell_voltage_47="cell_voltage_47",e.cell_voltage_48="cell_voltage_48",e.cell_voltage_49="cell_voltage_49",e.cell_voltage_50="cell_voltage_50",e.cell_voltage_51="cell_voltage_51",e.cell_voltage_52="cell_voltage_52",e.cell_voltage_53="cell_voltage_53",e.cell_voltage_54="cell_voltage_54",e.cell_voltage_55="cell_voltage_55",e.cell_voltage_56="cell_voltage_56",e.cell_voltage_57="cell_voltage_57",e.cell_voltage_58="cell_voltage_58",e.cell_voltage_59="cell_voltage_59",e.cell_voltage_60="cell_voltage_60",e.cell_voltage_61="cell_voltage_61",e.cell_voltage_62="cell_voltage_62",e.cell_voltage_63="cell_voltage_63",e.cell_voltage_64="cell_voltage_64",e.cell_voltage_65="cell_voltage_65",e.cell_voltage_66="cell_voltage_66",e.cell_voltage_67="cell_voltage_67",e.cell_voltage_68="cell_voltage_68",e.cell_voltage_69="cell_voltage_69",e.cell_voltage_70="cell_voltage_70",e.cell_voltage_71="cell_voltage_71",e.cell_voltage_72="cell_voltage_72",e.cell_voltage_73="cell_voltage_73",e.cell_voltage_74="cell_voltage_74",e.cell_voltage_75="cell_voltage_75",e.cell_voltage_76="cell_voltage_76",e.cell_voltage_77="cell_voltage_77",e.cell_voltage_78="cell_voltage_78",e.cell_voltage_79="cell_voltage_79",e.cell_voltage_80="cell_voltage_80",e.cell_voltage_81="cell_voltage_81",e.cell_voltage_82="cell_voltage_82",e.cell_voltage_83="cell_voltage_83",e.cell_voltage_84="cell_voltage_84",e.cell_voltage_85="cell_voltage_85",e.cell_voltage_86="cell_voltage_86",e.cell_voltage_87="cell_voltage_87",e.cell_voltage_88="cell_voltage_88",e.cell_voltage_89="cell_voltage_89",e.cell_voltage_90="cell_voltage_90",e.cell_voltage_91="cell_voltage_91",e.cell_voltage_92="cell_voltage_92",e.cell_voltage_93="cell_voltage_93",e.cell_voltage_94="cell_voltage_94",e.cell_voltage_95="cell_voltage_95",e.cell_voltage_96="cell_voltage_96",e.cell_resistance_1="cell_resistance_1",e.cell_resistance_2="cell_resistance_2",e.cell_resistance_3="cell_resistance_3",e.cell_resistance_4="cell_resistance_4",e.cell_resistance_5="cell_resistance_5",e.cell_resistance_6="cell_resistance_6",e.cell_resistance_7="cell_resistance_7",e.cell_resistance_8="cell_resistance_8",e.cell_resistance_9="cell_resistance_9",e.cell_resistance_10="cell_resistance_10",e.cell_resistance_11="cell_resistance_11",e.cell_resistance_12="cell_resistance_12",e.cell_resistance_13="cell_resistance_13",e.cell_resistance_14="cell_resistance_14",e.cell_resistance_15="cell_resistance_15",e.cell_resistance_16="cell_resistance_16",e.cell_resistance_17="cell_resistance_17",e.cell_resistance_18="cell_resistance_18",e.cell_resistance_19="cell_resistance_19",e.cell_resistance_20="cell_resistance_20",e.cell_resistance_21="cell_resistance_21",e.cell_resistance_22="cell_resistance_22",e.cell_resistance_23="cell_resistance_23",e.cell_resistance_24="cell_resistance_24",e.cell_resistance_25="cell_resistance_25",e.cell_resistance_26="cell_resistance_26",e.cell_resistance_27="cell_resistance_27",e.cell_resistance_28="cell_resistance_28",e.cell_resistance_29="cell_resistance_29",e.cell_resistance_30="cell_resistance_30",e.cell_resistance_31="cell_resistance_31",e.cell_resistance_32="cell_resistance_32",e.cell_resistance_33="cell_resistance_33",e.cell_resistance_34="cell_resistance_34",e.cell_resistance_35="cell_resistance_35",e.cell_resistance_36="cell_resistance_36",e.cell_resistance_37="cell_resistance_37",e.cell_resistance_38="cell_resistance_38",e.cell_resistance_39="cell_resistance_39",e.cell_resistance_40="cell_resistance_40",e.cell_resistance_41="cell_resistance_41",e.cell_resistance_42="cell_resistance_42",e.cell_resistance_43="cell_resistance_43",e.cell_resistance_44="cell_resistance_44",e.cell_resistance_45="cell_resistance_45",e.cell_resistance_46="cell_resistance_46",e.cell_resistance_47="cell_resistance_47",e.cell_resistance_48="cell_resistance_48",e.cell_resistance_49="cell_resistance_49",e.cell_resistance_50="cell_resistance_50",e.cell_resistance_51="cell_resistance_51",e.cell_resistance_52="cell_resistance_52",e.cell_resistance_53="cell_resistance_53",e.cell_resistance_54="cell_resistance_54",e.cell_resistance_55="cell_resistance_55",e.cell_resistance_56="cell_resistance_56",e.cell_resistance_57="cell_resistance_57",e.cell_resistance_58="cell_resistance_58",e.cell_resistance_59="cell_resistance_59",e.cell_resistance_60="cell_resistance_60",e.cell_resistance_61="cell_resistance_61",e.cell_resistance_62="cell_resistance_62",e.cell_resistance_63="cell_resistance_63",e.cell_resistance_64="cell_resistance_64",e.cell_resistance_65="cell_resistance_65",e.cell_resistance_66="cell_resistance_66",e.cell_resistance_67="cell_resistance_67",e.cell_resistance_68="cell_resistance_68",e.cell_resistance_69="cell_resistance_69",e.cell_resistance_70="cell_resistance_70",e.cell_resistance_71="cell_resistance_71",e.cell_resistance_72="cell_resistance_72",e.cell_resistance_73="cell_resistance_73",e.cell_resistance_74="cell_resistance_74",e.cell_resistance_75="cell_resistance_75",e.cell_resistance_76="cell_resistance_76",e.cell_resistance_77="cell_resistance_77",e.cell_resistance_78="cell_resistance_78",e.cell_resistance_79="cell_resistance_79",e.cell_resistance_80="cell_resistance_80",e.cell_resistance_81="cell_resistance_81",e.cell_resistance_82="cell_resistance_82",e.cell_resistance_83="cell_resistance_83",e.cell_resistance_84="cell_resistance_84",e.cell_resistance_85="cell_resistance_85",e.cell_resistance_86="cell_resistance_86",e.cell_resistance_87="cell_resistance_87",e.cell_resistance_88="cell_resistance_88",e.cell_resistance_89="cell_resistance_89",e.cell_resistance_90="cell_resistance_90",e.cell_resistance_91="cell_resistance_91",e.cell_resistance_92="cell_resistance_92",e.cell_resistance_93="cell_resistance_93",e.cell_resistance_94="cell_resistance_94",e.cell_resistance_95="cell_resistance_95",e.cell_resistance_96="cell_resistance_96",e.temperature_sensor_1="temperature_sensor_1",e.temperature_sensor_2="temperature_sensor_2",e.temperature_sensor_3="temperature_sensor_3",e.temperature_sensor_4="temperature_sensor_4"}(me||(me={}));var ue={title:"JK BMS Card",description:"A customizable Home Assistant card to emulate the JK BMS screen",version:"Version"},ve={language:"Language",title:"Title",prefix:"Prefix of the sensors",batteryName:"Battery name",cellCount:"Number of cells",cellColumns:"Number of columns",cellLayout:"Cell Layout",layout:"Layout",deltaVoltageUnit:"Delta Voltage Unit",resistanceUnit:"Resistance Unit",cellColorMode:"Cell Color Mode",cellOrientation:"Cell Orientation",minCellVoltage:"Min Cell Voltage (V)",maxCellVoltage:"Max Cell Voltage (V)",manualAssignment:"Manual entity assignment",tempSensorsCount:"No. of temp. sensors available",hasHeater:"Heater option is used",socDecimals:"SoC Decimals",customDecimals:"Custom Decimals",titleShowHide:"Show / Hide zones",showTitle:"Title",showButtons:"Buttons",showMain:"Main",showCondensed:"Condensed",showMainStats:"Stats",showCells:"Cells",showResistances:"Cell R.",showCardVersion:"Version"},fe={charge:"Charge",discharge:"Discharge",balance:"Balance",heater:"Heater"},be={power:"Power:",capacity:"Capacity:",cycleCapacity:"Cycle Cap:",averageCellV:"Avg Cell V:",balanceCurrent:"Balance Cur:",stateOfCharge:"SOC:",remainingAmps:"Remaining:",cycles:"Cycles:",delta:"Delta Voltage:",mosfetTemp:"MOS Temp:",minCellV:"Min Cell V:",maxCellV:"Max Cell V:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},ye={capacity:"Capacity",time:"Time","grid-solar":"Grid/Solar",load:"Load","total-voltage":"Total Voltage",current:"Current",mosfetTemp:"MOS Temp",delta:"Delta",temperature_sensor:"Temp",balancing:"Balancing",volt:"V",charge:"Charge",discharge:"Discharge",remaining:"Remaining"},we={common:ue,config:ve,switches:fe,stats:be,html_texts:ye},Ce={title:"Карта JK BMS",description:"Налаштовувана картка Home Assistant для емуляції екрану JK BMS",version:"Версія"},xe={language:"Мова",title:"Заголовок",prefix:"Префікс сенсорів",batteryName:"Назва батареї",cellCount:"Кількість комірок",cellColumns:"Кількість стовпців",cellLayout:"Розташування комірок",layout:"Макет",deltaVoltageUnit:"Одиниця дельта напруги",resistanceUnit:"Одиниця вимірювання опору",cellColorMode:"Режим кольору комірок",cellOrientation:"Орієнтація комірок",minCellVoltage:"Мін. напруга комірки (В)",maxCellVoltage:"Макс. напруга комірки (В)",manualAssignment:"Ручне призначення сутності",tempSensorsCount:"Кількість доступних датчиків температури",hasHeater:"Використовується опція підігріву",socDecimals:"знаки від коми",customDecimals:"Власні десяткові дроби",titleShowHide:"Показати / Сховати зони",showTitle:"Заголовок",showButtons:"Кнопки",showMain:"Панель",showCondensed:"Компактно",showMainStats:"Стат.",showCells:"Елементи",showResistances:"Опір ел",showCardVersion:"Версія"},Se={charge:"Заряд",discharge:"Розряд",balance:"Баланс",heater:"Підігрів"},ke={power:"Потужн.:",capacity:"Ємн.:",cycleCapacity:"Цикл. ємн.:",averageCellV:"Сер V ком.:",balanceCurrent:"Бал. струм:",stateOfCharge:"SOC:",remainingAmps:"Залишок:",cycles:"Цикли:",delta:"Δ напруга:",mosfetTemp:"Темп MOS:",minCellV:"Мін V ком.:",maxCellV:"Макс V ком.:",temperature_sensor_1:"Темп. 1:",temperature_sensor_2:"Темп. 2:",temperature_sensor_3:"Темп. 3:",temperature_sensor_4:"Темп. 4:"},Ae={capacity:"Ємність",time:"Час","grid-solar":"Мережа/Сонячна",load:"Навантаження","total-voltage":"Загальна напруга",current:"Струм",mosfetTemp:"Темп. MOS",delta:"Дельта",temperature_sensor:"Темп",balancing:"Балансування",volt:"В",charge:"Заряд",discharge:"Розряд",remaining:"Залишок"},Me={common:Ce,config:xe,switches:Se,stats:ke,html_texts:Ae},$e={title:"Card JK BMS",description:"Un card Home Assistant personalizabil care imită ecranul JK BMS",version:"Versiune"},Ve={language:"Limba",title:"Titlu",prefix:"Prefixul senzorilor",batteryName:"Numele bateriei",cellCount:"Număr de celule",cellColumns:"Număr de coloane",cellLayout:"Aranjament celule",layout:"Aranjament general",deltaVoltageUnit:"UM pentru diferență tensiune",resistanceUnit:"UM pentru rezistență",cellColorMode:"Mod colorare celule",cellOrientation:"Orientare celule",minCellVoltage:"Tensiune minimă celulă (V)",maxCellVoltage:"Tensiune maximă celulă (V)",manualAssignment:"Atribuire manuală entități",tempSensorsCount:"Număr senzori temperatură",hasHeater:"Opțiunea încălzitor este utilizată",socDecimals:"Zecimale SoC",customDecimals:"Zecimale alte controale",titleShowHide:"Afișează / Ascunde zone",showTitle:"Titlul",showButtons:"Butoane",showMain:"Principală",showCondensed:"Compact",showMainStats:"Stat.",showCells:"Celule",showResistances:"Rezist.",showCardVersion:"Versiune"},Te={charge:"Încărcare",discharge:"Descărcare",balance:"Echilibrare",heater:"Încălzitor"},Ee={power:"Putere:",capacity:"Capac.:",cycleCapacity:"Cap. Ciclu:",averageCellV:"V Cel. Med:",balanceCurrent:"Cur. Bal:",stateOfCharge:"SOC:",remainingAmps:"Rămas:",cycles:"Cicluri:",delta:"Δ Tensiune:",mosfetTemp:"Temp MOS:",minCellV:"Min V Cel.:",maxCellV:"Max V Cel.:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},Oe={capacity:"Capacitate",time:"Timp","grid-solar":"Rețea/Solar",load:"Consum","total-voltage":"Tensiune totală",current:"Curent",mosfetTemp:"Temp. MOSFET",delta:"Diferență",temperature_sensor:"Temp",balancing:"Echilibrare",volt:"V",charge:"Încărcare",discharge:"Descărcare",remaining:"Rămas"},ze={common:$e,config:Ve,switches:Te,stats:Ee,html_texts:Oe},De={title:"JK BMS Karte",description:"Eine anpassbare Home Assistant Karte, die den JK BMS Bildschirm nachbildet",version:"Version"},Ne={language:"Sprache",title:"Titel",prefix:"Präfix der Sensoren",batteryName:"Batteriename",cellCount:"Anzahl der Zellen",cellColumns:"Anzahl der Spalten",cellLayout:"Zellen-Layout",layout:"Layout",deltaVoltageUnit:"Einheit der Spannungsdifferenz",resistanceUnit:"Einheit des elektrischen Widerstands",cellColorMode:"Zellen-Farbmodus",cellOrientation:"Zellen-Ausrichtung",minCellVoltage:"Min. Zellspannung (V)",maxCellVoltage:"Max. Zellspannung (V)",manualAssignment:"Manuelle Entitäten-Zuweisung",tempSensorsCount:"Anzahl verfügbarer Temperatursensoren",hasHeater:"Heizungs-Option wird verwendet",socDecimals:"SOC Dezimalstellen",customDecimals:"Benutzerdefinierte Dezimalzahlen",titleShowHide:"Zonen ein-/ausblenden",showTitle:"Titel",showButtons:"Schaltfl.",showMain:"Hauptteil",showCondensed:"Kompakt",showMainStats:"Stats",showCells:"Zellen",showResistances:"Zellen R.",showCardVersion:"Kartenvers."},Ue={charge:"Laden",discharge:"Entladen",balance:"Balancing",heater:"Heizung"},Re={power:"Leistung:",capacity:"Kapaz.:",cycleCapacity:"Zykl. Kap.:",averageCellV:"Ø Zell V:",balanceCurrent:"Bal. Strom:",stateOfCharge:"SOC:",remainingAmps:"Rest:",cycles:"Zyklen:",delta:"Δ Spannung:",mosfetTemp:"MOS Temp:",minCellV:"Min Zell V:",maxCellV:"Max Zell V:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},Be={capacity:"Kapazität",time:"Zeit","grid-solar":"Netz/Solar",load:"Last","total-voltage":"Gesamtspannung",current:"Stromstärke",mosfetTemp:"MOS Temp",delta:"Differenz",temperature_sensor:"Temp",balancing:"Balancing",volt:"V",charge:"Laden",discharge:"Entladen",remaining:"Restzeit"},Pe={common:De,config:Ne,switches:Ue,stats:Re,html_texts:Be},je={title:"Карта JK BMS",description:"Настраиваемая карточка Home Assistant для эмуляции экрана JK BMS",version:"Версия"},Le={language:"Язык",title:"Заголовок",prefix:"Префикс датчиков",batteryName:"Название батареи",cellCount:"Количество ячеек",cellColumns:"Количество столбцов",cellLayout:"Расположение ячеек",layout:"Макет",deltaVoltageUnit:"Единица дельта-напряжения",resistanceUnit:"Единица измерения сопротивления",cellColorMode:"Режим цвета ячеек",cellOrientation:"Ориентация ячеек",minCellVoltage:"Мин. напряжение ячейки (В)",maxCellVoltage:"Макс. напряжение ячейки (В)",manualAssignment:"Ручное назначение сущностей",tempSensorsCount:"Количество доступных датчиков температуры",hasHeater:"Используется подогрев",socDecimals:"Знаков после запятой",customDecimals:"Пользовательские десятичные",titleShowHide:"Показать / Скрыть зоны",showTitle:"Заголовок",showButtons:"Кнопки",showMain:"Панель",showCondensed:"Компактно",showMainStats:"Стат.",showCells:"Ячейки",showResistances:"Сопр. яч.",showCardVersion:"Версия"},He={charge:"Заряд",discharge:"Разряд",balance:"Балансировка",heater:"Подогрев"},Ie={power:"Мощн.:",capacity:"Ёмк.:",cycleCapacity:"Цикл. ёмк.:",averageCellV:"Ср V яч.:",balanceCurrent:"Бал. ток:",stateOfCharge:"SOC:",remainingAmps:"Остаток:",cycles:"Циклы:",delta:"Δ напр.:",mosfetTemp:"Темп MOS:",minCellV:"Мин V яч.:",maxCellV:"Макс V яч.:",temperature_sensor_1:"Темп. 1:",temperature_sensor_2:"Темп. 2:",temperature_sensor_3:"Темп. 3:",temperature_sensor_4:"Темп. 4:"},Fe={capacity:"Ёмкость",time:"Время","grid-solar":"Сеть/Солнце",load:"Нагрузка","total-voltage":"Общее напряжение",current:"Ток",mosfetTemp:"Темп. MOS",delta:"Дельта",temperature_sensor:"Темп",balancing:"Балансировка",volt:"В",charge:"Заряд",discharge:"Разряд",remaining:"Остаток"},Ke={common:je,config:Le,switches:He,stats:Ie,html_texts:Fe},Je={title:"JK 电池管理系统",description:"用于显示 JK-BMS 实时状态 de 自定义卡片",version:"版本"},qe={language:"语言",title:"标题",prefix:"实体前缀",batteryName:"电池名称",cellCount:"电芯数量",cellColumns:"每行电芯数",cellLayout:"电芯布局方式",layout:"布局",deltaVoltageUnit:"电压差单位",resistanceUnit:"电阻单位",cellColorMode:"电池颜色模式",cellOrientation:"电池方向",minCellVoltage:"最小电池电压 (V)",maxCellVoltage:"最大电池电压 (V)",manualAssignment:"手动分配实体",tempSensorsCount:"温度传感器数量",hasHeater:"是否有加热器",socDecimals:"SOC 小数位数",customDecimals:"自定义小数位",titleShowHide:"显示 / 隐藏区域",showTitle:"标题",showButtons:"按钮",showMain:"主面板",showCondensed:"紧凑",showMainStats:"统计",showCells:"电池",showResistances:"电池 R.",showCardVersion:"版本"},We={charge:"充电",discharge:"放电",balance:"均衡",heater:"加热"},Ze={power:"功率:",capacity:"容量:",cycleCapacity:"循环:",averageCellV:"平均V:",balanceCurrent:"均衡:",stateOfCharge:"SOC:",remainingAmps:"剩余:",cycles:"循环数:",delta:"ΔV:",mosfetTemp:"MOS温:",minCellV:"最低V:",maxCellV:"最高V:",temperature_sensor_1:"温度1:",temperature_sensor_2:"温度2:",temperature_sensor_3:"温度3:",temperature_sensor_4:"温度4:"},Ge={capacity:"总容量设定",time:"运行时长","grid-solar":"电网/太阳能",load:"负载","total-voltage":"总电压",current:"实时电流",mosfetTemp:"功率管温度",delta:"单体电池压差",temperature_sensor:"温度传感器",balancing:"均衡状态",volt:"V",charge:"充电状态",discharge:"放电状态",remaining:"剩余容量"},Ye={common:Je,config:qe,switches:We,stats:Ze,html_texts:Ge},Qe={title:"JK BMS Karta",description:"Konfigurowalna karta Home Assistant do emulacji ekranu JK BMS",version:"Wersja"},Xe={language:"Język",title:"Tytuł",prefix:"Prefiks sensorów",batteryName:"Nazwa baterii",cellCount:"Liczba ogniw",cellColumns:"Liczba kolumn",cellLayout:"Układ ogniw",layout:"Układ",deltaVoltageUnit:"Jednostka różnicy napięcia",resistanceUnit:"Jednostka miary rezystancji",cellColorMode:"Tryb koloru ogniw",cellOrientation:"Orientacja ogniw",minCellVoltage:"Minimalne napięcie ogniwa (V)",maxCellVoltage:"Maksymalne napięcie ogniwa (V)",manualAssignment:"Ręczne przypisanie encji",tempSensorsCount:"Liczba dostępnych czujników temperatury",hasHeater:"Opcja grzałki włączona",socDecimals:"Miejsca po przecinku SOC",customDecimals:"Własne miejsca po przecinku",titleShowHide:"Pokaż / Ukryj strefy",showTitle:"Tytuł",showButtons:"Przyciski",showMain:"Panel",showCondensed:"Zwarte",showMainStats:"Stat.",showCells:"Ogniwa",showResistances:"R. ogniwa",showCardVersion:"Wersja"},et={charge:"Ładowanie",discharge:"Rozładowanie",balance:"Balansowanie",heater:"Grzałka"},tt={power:"Moc:",capacity:"Pojem.:",cycleCapacity:"Poj. Cykl:",averageCellV:"Śr V Ogniwa:",balanceCurrent:"Prąd Bal:",stateOfCharge:"SOC:",remainingAmps:"Pozostało:",cycles:"Cykle:",delta:"Δ Napięcie:",mosfetTemp:"Temp MOS:",minCellV:"Min V Ogniwa:",maxCellV:"Max V Ogniwa:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},nt={capacity:"Pojemność",time:"Czas","grid-solar":"Sieć/Solar",load:"Obciążenie","total-voltage":"Całkowite napięcie",current:"Prąd",mosfetTemp:"Temp. MOSFET",delta:"Delta",temperature_sensor:"Temp",balancing:"Balansowanie",volt:"V",charge:"Ładowanie",discharge:"Rozładowanie",remaining:"Pozostałe"},at={common:Qe,config:Xe,switches:et,stats:tt,html_texts:nt},lt={title:"Tarjeta JK BMS",description:"Una tarjeta personalizable de Home Assistant para emular la pantalla JK BMS",version:"Versión"},st={language:"Idioma",title:"Título",prefix:"Prefijo de los sensores",batteryName:"Nombre de la batería",cellCount:"Número de celdas",cellColumns:"Número de columnas",cellLayout:"Diseño de celdas",layout:"Diseño",deltaVoltageUnit:"Unidad de medida de voltaje delta",resistanceUnit:"Unidad de medida de la resistencia",cellColorMode:"Modo de color de celdas",cellOrientation:"Orientación de celdas",minCellVoltage:"Voltaje mínimo de celda (V)",maxCellVoltage:"Voltaje máximo de celda (V)",manualAssignment:"Asignación manual de entidades",tempSensorsCount:"Número de sensores de temperatura disponibles",hasHeater:"Opción de calefactor activada",socDecimals:"Decimales de SOC",customDecimals:"Decimales personalizados",titleShowHide:"Mostrar / Ocultar zonas",showTitle:"Título",showButtons:"Botones",showMain:"Principal",showCondensed:"Condensado",showMainStats:"Stats",showCells:"Celdas",showResistances:"R. celda",showCardVersion:"Versión"},it={charge:"Cargar",discharge:"Descargar",balance:"Balancear",heater:"Calefactor"},ot={power:"Potencia:",capacity:"Capac.:",cycleCapacity:"Cap. Ciclo:",averageCellV:"V Celda Prom:",balanceCurrent:"Bal. Corr:",stateOfCharge:"SOC:",remainingAmps:"Restante:",cycles:"Ciclos:",delta:"Δ Voltaje:",mosfetTemp:"Temp MOS:",minCellV:"Min V Celda:",maxCellV:"Max V Celda:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},rt={capacity:"Capacidad",time:"Tiempo","grid-solar":"Red/Solar",load:"Carga","total-voltage":"Voltaje total",current:"Corriente",mosfetTemp:"Temp MOSFET",delta:"Delta",temperature_sensor:"Temp",balancing:"Balanceo",volt:"V",charge:"Cargar",discharge:"Descargar",remaining:"Restante"},ct={common:lt,config:st,switches:it,stats:ot,html_texts:rt},_t={title:"Carte JK BMS",description:"Une carte Home Assistant personnalisable pour émuler l'écran JK BMS",version:"Version"},ht={language:"Langue",title:"Titre",prefix:"Préfixe des capteurs",batteryName:"Nom de la batterie",cellCount:"Nombre de cellules",cellColumns:"Nombre de colonnes",cellLayout:"Disposition des cellules",layout:"Disposition",deltaVoltageUnit:"Unité de mesure de tension delta",resistanceUnit:"Unité de mesure de la résistance",cellColorMode:"Mode couleur des cellules",cellOrientation:"Orientation des cellules",minCellVoltage:"Tension minimale de la cellule (V)",maxCellVoltage:"Tension maximale de la cellule (V)",manualAssignment:"Attribution manuelle des entités",tempSensorsCount:"Nombre de capteurs de température disponibles",hasHeater:"Option chauffage activée",socDecimals:"Décimales SOC",customDecimals:"Décimales personnalisées",titleShowHide:"Afficher / Masquer les zones",showTitle:"Titre",showButtons:"Boutons",showMain:"Principal",showCondensed:"Condensé",showMainStats:"Stats",showCells:"Cellules",showResistances:"R. cellule",showCardVersion:"Version"},dt={charge:"Charge",discharge:"Décharge",balance:"Équilibrage",heater:"Chauffage"},gt={power:"Puiss.:",capacity:"Capac.:",cycleCapacity:"Cap. Cycle:",averageCellV:"V Cell Moy:",balanceCurrent:"Cour. Bal:",stateOfCharge:"SOC:",remainingAmps:"Restant:",cycles:"Cycles:",delta:"Δ Tension:",mosfetTemp:"Temp MOS:",minCellV:"Min V Cell:",maxCellV:"Max V Cell:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},pt={capacity:"Capacité",time:"Temps","grid-solar":"Réseau/Solaire",load:"Charge","total-voltage":"Tension totale",current:"Courant",mosfetTemp:"Temp MOSFET",delta:"Delta",temperature_sensor:"Temp",balancing:"Équilibrage",volt:"V",charge:"Charge",discharge:"Décharge",remaining:"Restant"},mt={common:_t,config:ht,switches:dt,stats:gt,html_texts:pt};const ut={hass:null},vt={en:Object.freeze({__proto__:null,common:ue,config:ve,default:we,html_texts:ye,stats:be,switches:fe}),uk:Object.freeze({__proto__:null,common:Ce,config:xe,default:Me,html_texts:Ae,stats:ke,switches:Se}),ro:Object.freeze({__proto__:null,common:$e,config:Ve,default:ze,html_texts:Oe,stats:Ee,switches:Te}),de:Object.freeze({__proto__:null,common:De,config:Ne,default:Pe,html_texts:Be,stats:Re,switches:Ue}),ru:Object.freeze({__proto__:null,common:je,config:Le,default:Ke,html_texts:Fe,stats:Ie,switches:He}),zh:Object.freeze({__proto__:null,common:Je,config:qe,default:Ye,html_texts:Ge,stats:Ze,switches:We}),pl:Object.freeze({__proto__:null,common:Qe,config:Xe,default:at,html_texts:nt,stats:tt,switches:et}),es:Object.freeze({__proto__:null,common:lt,config:st,default:ct,html_texts:rt,stats:ot,switches:it}),fr:Object.freeze({__proto__:null,common:_t,config:ht,default:mt,html_texts:pt,stats:gt,switches:dt})};function ft(e,t="",n=""){try{let a=ut.cardConfig?.language,l=localStorage.getItem("selectedLanguage");null===l&&(l=localStorage.getItem("assist_debug_language")),null===l&&(l=localStorage.getItem("editor-language")),null===l&&(l="en"),l=l.replace(/['"]+/g,"").replace("-","_");const s=ut.hass?.selectedLanguage||ut.hass?.locale?.language||ut.hass?.language,i=a&&"auto"!==a?a:s||l;let o;try{o=e?.split(".").reduce(((e,t)=>e[t]),vt[i])}catch(t){o=e?.split(".")?.reduce(((e,t)=>e[t]),vt.en)}return void 0===o&&(o=e?.split(".")?.reduce(((e,t)=>e[t]),vt.en)),""!==t&&""!==n&&(o=o.replace(t,n)),o}catch(t){return e}}var bt="1.2.20";function yt(e,t,n,a){a=a||{},n=null==n?{}:n;const l=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return l.detail=n,e.dispatchEvent(l),l}const wt=(e,t)=>{const n=e?.entities[t]?.toString()?.trim();return n&&n.length>1?n:t?.toString()},Ct=(e,t,n,a="sensor")=>{if(!e)return;e.stopPropagation();const l=wt(t,n),s=l.includes("sensor.")||l.includes("switch.")||l.includes("number.")||l.includes("binary_sensor.")?l:a+"."+t?.prefix+"_"+l;let i=new CustomEvent("hass-more-info",{detail:{entityId:s},composed:!0});e.target.dispatchEvent(i)},xt=(e,t,n,a="sensor")=>{const l=wt(t,n);if(!l)return null;const s=l.includes(".")?l:"".concat(a,".").concat(t.prefix,"_").concat(l);return e?.states[s]??null},St=(e,t,n,a=2,l="",s="sensor")=>{const i=xt(e,t,n,s);if(!i)return l;const o=i.state,r=Number(o);return isNaN(r)?o??l:r.toFixed(a)},kt=(e,t,n,a="sensor")=>{const l=xt(e,t,n,a);return l?.attributes?.unit_of_measurement??""},At=e=>{if(!e)return null;switch(e.trim().toLowerCase()){case"v":return"V";case"mv":return"mV";case"ω":case"ohm":case"ohms":return"Ω";case"mω":case"mohm":case"mohms":return"mΩ";default:return null}},Mt={V:{toBase:1},mV:{toBase:.001},"Ω":{toBase:1},"mΩ":{toBase:.001}},$t=(e,t,n)=>{const a="string"==typeof n?parseFloat(n):n;if(isNaN(a))return"-";const l=At(e),s=At(t);if(!l||!s)return"".concat(a," ").concat(t??"").trim();const i=a*Mt[l].toBase/Mt[s].toBase,o=s.startsWith("m")?0:3,r=i.toLocaleString("en-US",{minimumFractionDigits:o,maximumFractionDigits:o});return"".concat(r," ").concat(s)};var Vt,Tt,Et,Ot,zt,Dt,Nt,Ut,Rt,Bt,Pt,jt,Lt,Ht,It,Ft,Kt,Jt,qt,Wt,Zt,Gt,Yt,Qt,Xt;let en=class extends oe{constructor(){super(...arguments),this.minCellId="",this.maxCellId="",this.deltaV=0,this.shouldBalance=!1,this.VERSION=bt}_navigate(e,t,n="sensor"){Ct(e,this.config,t,n)}getState(e,t=2,n="",a="sensor"){return St(this.hass,this.config,e,t,n,a)}getUnit(e){return kt(this.hass,this.config,e)}_renderSwitch(t,n){const a=this.getState(t,0,"","switch"),l="on"===a?"status-on":"status-off";return I(Vt||(Vt=e(['\n
',"\n
\n "])),(e=>this._navigate(e,t,"switch")),ft("switches."+n),l,a.toUpperCase())}configOrEnum(e){return wt(this.config,e)}render(){if(ut.hass=this.hass,!this.hass||!this.config)return I(Tt||(Tt=e([""])));const t=this.getState(me.hardware_version),n=this.getState(me.software_version),a=this.getState(me.total_runtime_formatted),l=a&&"unknown"!=a?I(Et||(Et=e(["",': ',""])),ft("html_texts.time"),a.toUpperCase()):"",s=this.config.batteryName||"",i=this.config.title&&this.config.title.toLocaleLowerCase()!=ft("config.title").toLocaleLowerCase()?this.config.title:I(Ot||(Ot=e(["","",": "," Ah
\n HW: "," | SW: "," | ",""])),""===s?"":s+" | ",ft("html_texts.capacity"),this.getState(me.total_battery_capacity_setting),t,n,l);this.deltaV=parseFloat(this.getState(me.delta_cell_voltage,3,"0"));const o=parseFloat(this.getState(me.balancing_current,2,"0")),r=parseFloat(this.getState(me.power,2,"0"));this.shouldBalance=0!=o;const c=r>0?"power-positive":r<0?"power-negative":"power-even",_=o>0?"balance-positive":o<0?"balance-negative":"balance-even",h=this.shouldBalance?"delta-needs-balancing":"delta-ok",d=this.config.socDecimals??0,g=this.config.customDecimals??0,p=this.config.showTitle,m=this.config.showButtons,u=this.config.showMain,v=this.config.showCondensed,f=this.config.showCells,b=this.config.showResistances,y=this.config.showCardVersion,w=v?"stats data-row":"stats data-row split";this.minCellId=this.getState(me.min_voltage_cell,0),this.maxCellId=this.getState(me.max_voltage_cell,0);const C=e=>{if(null==e||""===e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>=0},x=C(this.minCellId)&&C(this.maxCellId),S=(e=>{if(null==e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>0})(this.deltaV);return x&&S||this.calculateDynamicMinMaxCellId(this.config?.cellCount??16),I(zt||(zt=e(['\n \n
\n
\n ',"\n ","\n ","\n ","\n
\n "])),"1"==this.config.hasHeater?"4":"3",this._renderSwitch(me.charging,"charge"),this._renderSwitch(me.discharging,"discharge"),this._renderSwitch(me.balancer,"balance"),"1"==this.config.hasHeater?this._renderSwitch(me.heater,"heater"):""):I(Nt||(Nt=e([""]))),this._renderError(),u?I(Ut||(Ut=e(['\n
\n
\n
\n '," ",'\n
\n
','
\n
','
\n
','
\n
',' ',' '," A
\n ",'\n
\n\n
\n
\n ',' A\n
\n
','
\n
','
\n
','
\n
',' ',' ',' ',' \n \n ']))):""):I(jt||(jt=e([""]))),f?I(Lt||(Lt=e(['\n
\n ',"\n
\n "])),this.config.cellColumns??2,this._renderCells("bankMode"==this.config.cellLayout,b)):I(Ht||(Ht=e([""]))),y?I(It||(It=e(['\n
\n \n v.',"\n \n
\n "])),this.VERSION):I(Ft||(Ft=e([""]))))}updated(){requestAnimationFrame((()=>this._updateFlowLine()))}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._updateFlowLine.bind(this))}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._updateFlowLine.bind(this))}_renderError(){const t=this.getState(me.errors,0);return t.trim().length<=1||"0"==t?I(Kt||(Kt=e([""]))):I(Jt||(Jt=e(['',""])),t)}_renderTemps(t){const n=[],a=this.config?.tempSensorsCount??0,l=this.config.showCondensed?"data-row":"data-row split";for(let s=t;s<=a;s+=2)n.push(I(qt||(qt=e(['\n
',' \n
\n
\n ','\n ',"","\n ","\n
\n
\n
\n "])),t,t,n>4||n>3&&!0===h?"multi-line":"single-line",(e=>this._navigate(e,me["cell_voltage_".concat(t)])),t.toString().padStart(2,"0"),_,l,h?d:"",g)}_updateFlowLine(){const e=parseFloat(this.getState(me.balancing_current,3,"0")),t=this.renderRoot.querySelector(".cell-div-".concat(this.minCellId)),n=this.renderRoot.querySelector(".cell-div-".concat(this.maxCellId)),a=this.renderRoot.querySelector("#flow-path");if(!a||!t||!n)return;if(!this.shouldBalance&&0===e)return a.setAttribute("d",""),void(a.style.display="none");a.style.display="inline";const l=(this.renderRoot instanceof ShadowRoot?this.renderRoot.host:this).getBoundingClientRect(),s=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=this.config?.cellColumns??2,r=l.width/o,c=Math.floor((i.left+i.width/2-l.left)/r),_=Math.floor((s.left+s.width/2-l.left)/r),h=(e,t)=>({x:"right"===t?e.right-l.left:e.left-l.left,y:e.top+e.height/2-l.top});let d,g;if(Math.abs(i.top-s.top)<10)d=i.leftthis.fetchHistory()),6e4)}_navigate(e,t,n="sensor"){Ct(e,this.config,t,n)}updated(e){e.has("hass")&&this._updateRealtimeHistory()}_updateRealtimeHistory(){if(!this.hass||!this.config)return;const e=[me.total_voltage,me.current,me.power_tube_temperature,me.delta_cell_voltage],t=Date.now()-36e5;e.forEach((e=>{const n=this._resolveEntityId(e);if(!n)return;const a=this.hass.states[n];if(!a)return;const l=parseFloat(a.state),s=new Date(a.last_updated).getTime();if(isNaN(l))return;const i=this.historyData[n]||[],o=i.length>0?i[i.length-1]:null;if(!o||s>o.time){const e=[...i,{state:l,time:s}];for(;e.length>0&&e[0].timee)),t=[...new Set(e)];if(0===t.length)return;const n=new Date,a=new Date(n.getTime()-36e5);try{const e=await this.hass.callWS({type:"history/history_during_period",start_time:a.toISOString(),end_time:n.toISOString(),entity_ids:t,minimal_response:!0,no_attributes:!0});if(e){const t={};Object.keys(e).forEach((n=>{const a=e[n];Array.isArray(a)&&(t[n]=a.map((e=>({state:parseFloat(e.s||e.state),time:1e3*(e.lu||new Date(e.last_updated).getTime()/1e3)}))).filter((e=>!isNaN(e.state))))})),this.historyData={...this.historyData,...t}}}catch(e){console.warn("JK BMS Card: Failed to fetch history via WS",e)}}configOrEnum(e){return wt(this.config,e)}_resolveEntityId(e){const t=this.configOrEnum(e);if(t)return t.includes(".")?t:"sensor.".concat(this.config.prefix,"_").concat(t)}_renderSparkline(t,n){const a=this._resolveEntityId(t);if(!a||!this.historyData[a]||this.historyData[a].length<2)return I(tn||(tn=e([""])));const l=this.historyData[a];let s=1/0,i=-1/0;l.forEach((e=>{const t=Number(Number(e.state).toFixed(3));ti&&(i=t)}));let o=i-s;if(o<1){const e=(s+i)/2;s=e-.5,i=e+.5}else s-=.05*o,i+=.05*o;const r=l[0].time,c=l[l.length-1].time-r;if(c<=0)return I(nn||(nn=e([""])));let _="";return l.forEach(((e,t)=>{const n=(e.time-r)/c*100,a=100-(e.state-s)/(i-s)*100;_+="".concat(0===t?"M":"L"," ").concat(n.toFixed(1),",").concat(a.toFixed(1)," ")})),I(an||(an=e(['\n
\n \n \n \n \n
\n '])),_,n,_,n)}getState(e,t=2,n="",a="sensor"){return St(this.hass,this.config,e,t,n,a)}getUnit(e){return kt(this.hass,this.config,e)}render(){if(ut.hass=this.hass,!this.hass||!this.config)return I(ln||(ln=e([""])));const t=this.config.socDecimals??0,n=this.getState(me.state_of_charge,t),a=this.config.customDecimals??0,l=this.getState(me.hardware_version),s=this.getState(me.software_version),i=this.getState(me.total_battery_capacity_setting,a),o=this.getState(me.total_runtime_formatted),r=o&&"unknown"!=o?I(sn||(sn=e([" | ",": ",""])),ft("html_texts.time"),o.toUpperCase()):"",c=this.config.batteryName||"",_=this.config.title&&this.config.title.toLocaleLowerCase()!=ft("config.title").toLocaleLowerCase()?this.config.title:I(on||(on=e(["","",": "," Ah
\n HW: "," | SW: ","",""])),""===c?"":c+" | ",ft("html_texts.capacity"),i,l,s,r),h=parseFloat(this.getState(me.current)),d=this.getState(me.charging_power,a),g=this.getState(me.discharging_power,a),p=h>0,m=h<0,u="on"===this.getState(me.charging,0,"","switch"),v="on"===this.getState(me.discharging,0,"","switch"),f="on"===this.getState(me.balancing,0,"","binary_sensor"),b=parseFloat(this.getState(me.balancing_current)),y=this.getState(me.total_voltage),w=this.getState(me.power_tube_temperature),C=this.getUnit(me.power_tube_temperature),x=this.getState(me.total_charging_cycle_capacity,a),S=parseFloat(this.getState(me.charging_cycles)).toFixed(0).toString();this.tempSensorsCount=this.config.tempSensorsCount;const k=this.config.showTitle,A=this.config.showButtons,M=this.config.showMain,$=this.config.showCells,V=this.config.showResistances,T=this.config.showCardVersion;this.minCellId=this.getState(me.min_voltage_cell,0),this.maxCellId=this.getState(me.max_voltage_cell,0),this.deltaV=parseFloat(this.getState(me.delta_cell_voltage,3,"0"));const E=e=>{if(null==e||""===e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>=0},O=E(this.minCellId)&&E(this.maxCellId),z=(e=>{if(null==e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>0})(this.deltaV);O&&z||this.calculateDynamicMinMax();const D=this.config.showMainStats;return I(rn||(rn=e(['\n \n ',"\n \n ","\n \n \x3c!-- Cells --\x3e\n ","\n ","\n \n "])),k?I(cn||(cn=e(['\n
\n \x3c!-- Solar/Grid Node --\x3e\n
\n
\n \n
\n
',"
\n ",'\n
\n
\n
\n
\n\n \x3c!-- Reactor (SOC) --\x3e\n
\n
\n
SoC:
\n
',"%
\n ",'\n
\n
\n\n \x3c!-- Load Node --\x3e\n
\n
\n \n
\n
',"
\n ",'\n \n
\n
\n
\n
\n\n \x3c!-- SVG Flow Lines --\x3e\n \n \x3c!-- Left path (Charge) - Rough coordinates for now, will refine --\x3e\n \n \x3c!-- Right path (Discharge) --\x3e\n \n\n \n \n \n \n \n \n
\n \n \x3c!-- Stats Panels --\x3e\n ',"\n \n "])),A?" clickable":"",A?e=>this._navigate(e,me.charging,"switch"):void 0,p?"var(--solar-color)":"#444",ft("html_texts.grid-solar"),A?I(hn||(hn=e(['\n
\n ',': ',"\n
\n "])),ft("html_texts.charge"),u?"status-on":"status-off",u?"ON":"OFF"):I(dn||(dn=e([""]))),(e=>this._navigate(e,me.charging_power)),d,f&&0!=b?"reactor-ring-balancing":"reactor-ring-base",(e=>this._navigate(e,me.state_of_charge)),n,f&&0!=b?I(gn||(gn=e(['
\n ',': ',"\n
\n "])),ft("html_texts.discharge"),v?"status-on":"status-off",v?"ON":"OFF"):I(un||(un=e([""]))),(e=>this._navigate(e,me.discharging_power)),g,p?"path-charge":"path-inactive",m?"path-discharge":"path-inactive",v?"#3090c7":"#444",D?I(vn||(vn=e(['\n
\n
\n
\n ','\n
',':
\n
\n
\n\n
\n ','\n
',':
\n
\n
\n
\n\n
\n
\n ','\n
',':
\n
\n
\n\n
\n ','\n
'," ",':
\n
\n
\n
','
\n
\n
\n \n
\n
\n
\n
\n
\n \n \x3c!-- Add number of cycles --\x3e\n
\n
\n
','
\n
\n
\n \n
\n
\n ',"\n
"])),this.config.cellColumns??2,this._renderCells(V)):I(wn||(wn=e([""]))),T?I(Cn||(Cn=e(['\n
\n \n v.',"\n \n
\n "])),this.VERSION):I(xn||(xn=e([""]))))}calculateDynamicMinMax(){let e=1/0,t=-1/0,n=-1,a=-1;const l=this.config.cellCount||16;for(let s=1;s<=l;s++){const l=this.getState(me["cell_voltage_".concat(s)],3,""),i=parseFloat(l);isNaN(i)||(it&&(t=i,a=s))}e===1/0||t===-1/0?(this.deltaV=0,this.minCellId="",this.maxCellId=""):(this.minCellId=n.toString(),this.maxCellId=a.toString(),this.deltaV=parseFloat((t-e).toFixed(3)))}getTemperatureColor(e,t="°C"){("°F"===t||"F"===t)&&(e=5*(e-32)/9);const n=[{temp:-10,color:"#0000FF"},{temp:0,color:"#00BFFF"},{temp:20,color:"#41CD52"},{temp:30,color:"#FFD700"},{temp:40,color:"#FF8C00"},{temp:50,color:"#FF4500"},{temp:60,color:"#DC143C"}];for(let t=0;t=l.temp)continue;const s=(e-a.temp)/(l.temp-a.temp),i=parseInt(a.color.slice(1,3),16),o=parseInt(a.color.slice(3,5),16),r=parseInt(a.color.slice(5,7),16),c=parseInt(l.color.slice(1,3),16),_=parseInt(l.color.slice(3,5),16),h=parseInt(l.color.slice(5,7),16),d=Math.round(i+s*(c-i)),g=Math.round(o+s*(_-o)),p=Math.round(r+s*(h-r));return"#".concat(d.toString(16).padStart(2,"0")).concat(g.toString(16).padStart(2,"0")).concat(p.toString(16).padStart(2,"0"))}return n[n.length-1].color}renderTemperatureSensors(){if(!this.tempSensorsCount||0===this.tempSensorsCount)return I(Sn||(Sn=e([""])));const t=this.tempSensorsCount>=1,n=this.tempSensorsCount>=2,a=this.tempSensorsCount>=3,l=this.tempSensorsCount>=4,s=(t,n)=>{const a=this.getState(t,1,"—"),l=this.getUnit(t)||"°C",s=parseFloat(a),i=isNaN(s)?"#777777":this.getTemperatureColor(s,l);return I(kn||(kn=e(['\n
\n ','\n
\n '," ",'\n
\n
\n ',"\n ",'\n
\n\n \x3c!-- Right column (2 and 4) --\x3e\n
\n ',"\n ","\n
\n "])),t?s(me.temperature_sensor_1,1):"",a?s(me.temperature_sensor_3,3):"",n?s(me.temperature_sensor_2,2):"",l?s(me.temperature_sensor_4,4):"")}_renderCells(e){const t=[],n="bankMode"===this.config.cellLayout,a=this.config.cellColumns||2,l=this.config.cellCount||16,s=Math.floor(l/a),i=n?Math.ceil(l/a):l,o=l%a;for(let r=1;r<=i;r++){const c=[];if(n)if(o&&r===i)c.push(l);else for(let e=0;e100&&(p=100));const m=parseFloat(o),u=!isNaN(m)&&m>0&&a,v=$t(s,i,m).replace(" ",""),f=this.config.cellColorMode||"progress";let b="";if("gradient"===f){const e=[{r:180,g:60,b:60},{r:180,g:180,b:50},{r:60,g:180,b:60},{r:60,g:120,b:200},{r:90,g:60,b:200}];let t=Math.floor(p/25);t>=4&&(t=3);const n=p%25/25,a=e[t],l=e[t+1],s=Math.round(a.r+(l.r-a.r)*n),i=Math.round(a.g+(l.g-a.g)*n),o=Math.round(a.b+(l.b-a.b)*n);b="background: rgba(".concat(s,", ").concat(i,", ").concat(o,", 0.85);")}const y="gradient"===f?"background: rgba(0, 0, 0, 0.25); padding: 1px 3px; border-radius: 3px;":"",w=this.config.cellColumns>4||!0===this.config.showResistances&&this.config.cellColumns>3?"vertical":this.config.cellOrientation||"horizontal",C="vertical"===w?"cell-item cell-item-vertical":"cell-item",x=ft("html_texts.volt");t.push(I(Mn||(Mn=e(['\n
\n ',"\n ","\n
\n "])),C,b,"progress"===f?I($n||($n=e(['\n
'])),p):"","vertical"===w?I(Vn||(Vn=e(['\n ','\n \n ','\n ',"","\n \n ","\n "])),(e=>this._navigate(e,me["cell_voltage_".concat(n)])),String(n).padStart(2,"0"),_,y,l,u?x:"",u?I(On||(On=e(['\n .icon-circle {\n display: flex;\n align-items: center;\n justify-content: center;\n width: clamp(20px, round(4cqi + 4px, 2px), 30px);\n height: clamp(20px, round(4cqi + 4px, 2px), 30px);\n justify-self: start;\n }\n\n .icon-stats > :nth-child(2) {\n justify-self: end;\n padding-right: 5px;\n }\n\n .icon-stats > .stat-value {\n white-space: nowrap;\n font-size: clamp(0.8em, round(8cqi + 0.25rem, 0.1em), 1.2em);\n font-weight: bold;\n }\n\n /* Cell Grid */\n\n .cell-grid {\n display: grid;\n gap: 6px;\n }\n\n .grid-1 {\n grid-template-columns: 1fr;\n }\n\n .grid-2 {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .grid-3 {\n grid-template-columns: repeat(3, 1fr);\n }\n\n .grid-4 {\n grid-template-columns: repeat(4, 1fr);\n }\n\n .grid-5 {\n grid-template-columns: repeat(5, 1fr);\n }\n\n .grid-6 {\n grid-template-columns: repeat(6, 1fr);\n }\n\n .grid-7 {\n grid-template-columns: repeat(7, 1fr);\n }\n\n .grid-8 {\n grid-template-columns: repeat(8, 1fr);\n }\n\n .cell-item {\n container-type: inline-size;\n background: var(--secondary-background-color, #2a2a2a);\n border-radius: 8px;\n padding: 3px 2px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 4px;\n position: relative;\n z-index: 0;\n overflow: hidden;\n white-space: nowrap;\n }\n\n .cell-item-vertical {\n container-type: inline-size;\n flex-direction: column;\n justify-content: center;\n padding: 2px 3px;\n gap: 3px;\n white-space: nowrap;\n }\n\n .cell-item-vertical .cell-id {\n padding-top: 2px;\n }\n\n .cell-item-bg {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background: rgba(48, 144, 199, 0.2);\n z-index: -1;\n transition: width 0.5s ease-out;\n }\n\n .cell-id {\n display: inline-block;\n padding: 0.2rem 0.5rem;\n background-color: #195569;\n color: #e4f3f8;\n border-radius: 999px;\n font-weight: 600;\n font-size: clamp(0.8rem, round(14cqi, 0.05rem), 1rem) !important;\n min-width: 1.2rem;\n text-align: center;\n margin-right: 3px;\n flex-shrink: 0;\n }\n\n .cell-volts {\n color: var(--primary-text-color);\n font-family: monospace;\n font-size: clamp(0.9rem, round(14cqi, 0.05rem), 1.2rem) !important;\n white-space: nowrap;\n }\n\n .cell-res {\n color: var(--secondary-text-color);\n font-family: monospace;\n font-size: clamp(0.6rem, round(12cqi, 0.05rem), 0.8rem) !important;\n white-space: nowrap;\n }\n\n .cell-low {\n color: #FFA500;\n }\n\n /* Example warning color */\n\n .cell-high {\n color: var(--discharge-color);\n }\n\n .status-on {\n color: var(--accent-color);\n font-weight: bold;\n }\n\n .status-off {\n color: var(--disabled-text-color, #666);\n font-weight: bold;\n }\n\n .clickable {\n cursor: pointer;\n }\n\n /* SVG Overlay for Lines */\n\n .flow-svg {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 1;\n }\n\n .flow-svg path {\n fill: none;\n stroke-width: 2;\n stroke-dasharray: 8;\n }\n\n .path-charge {\n stroke: var(--solar-color);\n animation: flow 1s linear infinite;\n }\n\n .path-discharge {\n stroke: var(--discharge-color);\n animation: flow 1s linear infinite;\n }\n\n .path-inactive {\n stroke: #444;\n stroke-dasharray: 0;\n animation: none;\n }\n\n @keyframes flow {\n from {\n stroke-dashoffset: 16;\n }\n to {\n stroke-dashoffset: 0;\n }\n }\n\n /* Sparkline CSS */\n /* Sparkline CSS */\n\n .metric-group {\n position: relative;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 1;\n }\n\n .sparkline-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n opacity: 0.3;\n z-index: -1;\n pointer-events: none;\n }\n\n .sparkline-svg {\n width: 100%;\n height: 100%;\n }\n\n .spark-line {\n fill: none;\n stroke-width: 2;\n vector-effect: non-scaling-stroke;\n }\n\n .spark-area {\n fill-opacity: 0.2;\n stroke: none;\n }\n \n .cardVersion {\n text-align: right;\n margin-right: 5px;\n }\n \n .version {\n font-style: italic;\n font-size: 0.8rem;\n }\n "]))),t([de()],Dn.prototype,"hass",void 0),t([de()],Dn.prototype,"config",void 0),t([de()],Dn.prototype,"historyData",void 0),Dn=t([ce("jk-bms-core-reactor-layout")],Dn);const Pn=bt;console.groupCollapsed("%c🔋 JK-BMS Battery Card%c ready! 🚀 (v".concat(Pn,")"),"background: linear-gradient(to right, #41cd52, #3090c7); color: white; font-weight: bold; padding: 2px 8px; border-radius: 6px;","background: none; color: #AAA; font-style: italic;"),console.log("%c📖 Docs:","color: #41cd52; font-weight: bold;","https://github.com/Pho3niX90/jk-bms-card"),console.groupEnd();let jn=Bn=class extends oe{setConfig(e){this._config=Bn.getStubConfig(),this._config={...this._config,...e},ut.cardConfig=this._config}static getStubConfig(){return{language:"auto",title:ft("title"),prefix:"jk_bms",batteryName:"",cellCount:16,cellColumns:2,cellLayout:"bankMode",deltaVoltageUnit:"V",resistanceUnit:"Ω",tempSensorsCount:0,hasHeater:0,socDecimals:2,customDecimals:2,showTitle:!0,showButtons:!0,showMain:!0,showCondensed:!0,showMainStats:!0,showCells:!0,showResistances:!0,showCardVersion:!1,entities:Object.keys(me).reduce(((e,t)=>(e[t]="",e)),{})}}static async getConfigElement(){return await Promise.resolve().then((function(){return qn})),document.createElement(ge)}getCardSize(){return 3}render(){return ut.hass=this.hass,this.hass&&this._config?"core-reactor"===this._config.layout?I(Un||(Un=e([""])),this.hass,this._config):I(Rn||(Rn=e(["\n \n "])),this.hass,this._config):I(Nn||(Nn=e([""])))}};var Ln,Hn,In,Fn,Kn;t([de()],jn.prototype,"hass",void 0),t([de()],jn.prototype,"_config",void 0),jn=Bn=t([ce(pe)],jn),window.customCards.push({type:pe,name:"JK BMS Card",preview:!0,description:ft("common.description"),configurable:!0});let Jn=class extends oe{constructor(){super(...arguments),this._dynamicEntitySchema=[],this._fixedEntities=Object.values(me).filter((e=>!e.startsWith("cell_voltage_")&&!e.startsWith("cell_resistance_"))),this._computeLabelCallback=e=>ft("config.".concat(e.name))??e.name}static get styles(){return o(Ln||(Ln=e(["\n .boolean-wrapper {\n display: block;\n padding: 12px 0;\n }\n .boolean-row {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-bottom: 16px;\n gap: 6px;\n }\n .label {\n font-size: 14px;\n color: var(--primary-text-color);\n line-height: 1.3;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n max-height: 2.6em;\n word-break: break-word;\n }\n "])))}setConfig(e){this._config={...e},this._updateDynamicEntitySchema()}_updateDynamicEntitySchema(){const e=Math.min(this._config?.cellCount??16,96),t=[];for(let n=1;n<=e;n++){const e="cell_voltage_".concat(n);e in me&&t.push({name:e,selector:{entity:{}}})}for(let n=1;n<=e;n++){const e="cell_resistance_".concat(n);e in me&&t.push({name:e,selector:{entity:{}}})}this._dynamicEntitySchema=t}willUpdate(e){if(super.willUpdate(e),e.has("_config")){const t=e.get("_config");t?.cellCount!==this._config?.cellCount&&this._updateDynamicEntitySchema()}}renderBoolean(t,n){return I(Hn||(Hn=e(['\n
\n ',"\n \n
\n "])),t,Boolean(this._config?.[n]??!1),(e=>this._handleSwitchChange(n,e)))}_handleSwitchChange(e,t){const n=!!t.target.checked,a={...this._config};a[e]=n;const l=!0===a.showMain&&"core-reactor"===a.layout;l||void 0===a.showMainStats||delete a.showMainStats,l&&void 0===a.showMainStats&&(a.showMainStats=!0),this._config=a,yt(this,"config-changed",{config:this._config})}render(){if(!this._config||!this.hass)return I(In||(In=e([""])));const t=[...this._fixedEntities.map((e=>({name:e,selector:{entity:{}}}))),...this._dynamicEntitySchema];return I(Fn||(Fn=e(["\n\t\t\t\n\n ","\n\t\t"])),this.hass,this._config,this._computeLabelCallback.bind(this),[{type:"grid",title:ft("config.language"),schema:[{type:"grid",schema:[{name:"language",selector:{select:{options:[{label:"Auto (follow HA)",value:"auto"},{label:"English",value:"en"},{label:"Română",value:"ro"},{label:"Українська",value:"uk"},{label:"German",value:"de"},{label:"Русский",value:"ru"},{label:"Polski",value:"pl"},{label:"Français",value:"fr"},{label:"Español",value:"es"},{label:"中文",value:"zh"}],mode:"dropdown"}}}]}]},{type:"grid",title:ft("config.title"),schema:[{type:"grid",schema:[{name:"title",selector:{text:{}}}]}]},{type:"grid",title:ft("config.prefix"),schema:[{type:"grid",column_min_width:"200px",schema:[{name:"prefix",selector:{text:{}}},{name:"batteryName",selector:{text:{}}}]}]},{type:"grid",title:ft("config.layout"),schema:[{type:"grid",schema:[{name:"layout",selector:{select:{options:[{label:"Default",value:"default"},{label:"Core Reactor",value:"core-reactor"}]}}},{name:"deltaVoltageUnit",selector:{select:{options:[{label:"Volts (V)",value:"V"},{label:"Millivolts (mV)",value:"mV"}]}}},{name:"resistanceUnit",selector:{select:{options:[{label:"Ohms (Ω)",value:"Ω"},{label:"MilliOhms (mΩ)",value:"mΩ"}]}}}]},{type:"grid",column_min_width:"200px",schema:[{name:"cellColorMode",selector:{select:{options:[{label:"Progress Bar",value:"progress"},{label:"Voltage Gradient",value:"gradient"}]}}},{name:"cellOrientation",selector:{select:{options:[{label:"Vertical",value:"vertical"},{label:"Horizontal",value:"horizontal"}]}}}]}]},{type:"grid",schema:[{type:"grid",column_min_width:"200px",schema:[{name:"minCellVoltage",selector:{number:{min:2,max:4,step:.01,mode:"box"}}},{name:"maxCellVoltage",selector:{number:{min:2,max:4,step:.01,mode:"box"}}}]}]},{type:"grid",title:ft("config.cellCount"),schema:[{type:"grid",schema:[{name:"cellCount",selector:{number:{min:2,max:48,step:2}}},{name:"cellColumns",selector:{number:{min:1,max:8,step:1}}}]}]},{type:"grid",schema:[{name:"cellLayout",selector:{select:{options:[{label:"Incremental",value:"incremental"},{label:"Bank Mode",value:"bankMode"}]}}},{name:"socDecimals",title:ft("config.socDecimals"),selector:{number:{min:0,max:2,step:1}}}]},{type:"grid",title:ft("config.tempSensorsCount"),schema:[{type:"grid",schema:[{name:"tempSensorsCount",selector:{number:{min:0,max:4,step:2}}},{name:"customDecimals",title:ft("config.customDecimals"),selector:{number:{min:0,max:2,step:1}}}]}]},{type:"grid",title:ft("config.hasHeater"),schema:[{type:"grid",schema:[{name:"hasHeater",selector:{select:{multiple:!1,mode:"list",options:[{label:"Yes",value:"1"},{label:"No",value:"0"}]}}}]}]},{type:"expandable",title:ft("config.manualAssignment"),schema:[{name:"entities",type:"grid",schema:t}]}],this._valueChanged.bind(this),I(Kn||(Kn=e(['\n \n
\n ','\n
\n
\n ',"\n ","\n ","\n ","\n ","\n\n ","\n ","\n ","\n
\n
\n "])),ft("config.titleShowHide"),this.renderBoolean(ft("config.showTitle"),"showTitle"),!0===this._config?.showMain&&"core-reactor"===this._config?.layout||"default"===this._config?.layout?this.renderBoolean(ft("config.showButtons"),"showButtons"):"",this.renderBoolean(ft("config.showMain"),"showMain"),!0===this._config?.showMain&&"default"===this._config?.layout?this.renderBoolean(ft("config.showCondensed"),"showCondensed"):"",!0===this._config?.showMain&&"core-reactor"===this._config?.layout?this.renderBoolean(ft("config.showMainStats"),"showMainStats"):"",this.renderBoolean(ft("config.showCells"),"showCells"),!0===this._config?.showCells?this.renderBoolean(ft("config.showResistances"),"showResistances"):"",this.renderBoolean(ft("config.showCardVersion"),"showCardVersion")))}_valueChanged(e){const t={...this._config};Object.assign(t,e.detail.value),this._config=t,"cellCount"in e.detail.value&&this._updateDynamicEntitySchema();const n=!0===t?.showMain&&"core-reactor"===t?.layout,a=!0===t?.showCells;n||void 0===t.showMainStats||delete t.showMainStats,n&&void 0===t.showMainStats&&(t.showMainStats=!0),a||void 0===t.showResistances||delete t.showResistances,a&&void 0===t.showResistances&&(t.showResistances=!0),yt(this,"config-changed",{config:this._config})}};t([de()],Jn.prototype,"hass",void 0),t([de()],Jn.prototype,"_config",void 0),t([de()],Jn.prototype,"lovelace",void 0),t([function(e){return de({...e,state:!0,attribute:!1})}()],Jn.prototype,"_dynamicEntitySchema",void 0),Jn=t([ce(ge)],Jn);var qn=Object.freeze({__proto__:null,get JkBmsCardEditor(){return Jn}});export{Pn as CARD_VERSION,jn as JkBmsCard};