UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 16.7 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[34686],{3690:function(t,e,n){n(15823)("Uint16",function(t){return function(e,n,r){return t(this,e,n,r)}})},13611:function(t,e,n){var r=n(46518),a=n(44576),i=n(62106),o=n(43724),s=TypeError,d=Object.defineProperty,u=a.self!==a;try{if(o){var l=Object.getOwnPropertyDescriptor(a,"self");!u&&l&&l.get&&l.enumerable||i(a,"self",{get:function(){return a},set:function(t){if(this!==a)throw new s("Illegal invocation");d(a,"self",{value:t,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else r({global:!0,simple:!0,forced:u},{self:a})}catch(c){}},37297:function(t,e,n){n.d(e,{i:function(){return i}});var r=n(52577),a=n(45287);function i(t,e,n){var i=t.get("borderRadius");if(null==i)return n?{cornerRadius:0}:null;(0,r.isArray)(i)||(i=[i,i,i,i]);var o=Math.abs(e.r||0-e.r0||0);return{cornerRadius:(0,r.map)(i,function(t){return(0,a.lo)(t,o)})}}},60686:function(t,e,n){n.r(e),n.d(e,{install:function(){return Z}});n(44114),n(46058);var r=n(40445),a=n(52577),i=n(27275),o=n(47263),s=n(52557),d=n(95769),u=n(9078),l=n(79825),c=n(90057),h=n(37297),p=n(80915),f=n(61184),g=n(88877),v=function(t){function e(e,n,r,a){var i=t.call(this)||this;i.z2=2,i.textConfig={inside:!0},(0,c.z)(i).seriesIndex=n.seriesIndex;var s=new o.Ay({z2:4,silent:e.getModel().get(["label","silent"])});return i.setTextContent(s),i.updateData(!0,e,n,r,a),i}return(0,r.C6)(e,t),e.prototype.updateData=function(t,e,n,r,i){this.node=e,e.piece=this,n=n||this._seriesModel,r=r||this._ecModel;var o=this;(0,c.z)(o).dataIndex=e.dataIndex;var d=e.getModel(),l=d.getModel("emphasis"),f=e.getLayout(),g=a.extend({},f);g.label=null;var v=e.getVisual("style");v.lineJoin="bevel";var y=e.getVisual("decal");y&&(v.decal=(0,p.w)(y,i));var I=(0,h.i)(d.getModel("itemStyle"),g,!0);a.extend(g,I),a.each(u.BV,function(t){var e=o.ensureState(t),n=d.getModel([t,"itemStyle"]);e.style=n.getItemStyle();var r=(0,h.i)(n,g);r&&(e.shape=r)}),t?(o.setShape(g),o.shape.r=f.r0,s.LW(o,{shape:{r:f.r}},n,e.dataIndex)):(s.oi(o,{shape:g},n),(0,s.ap)(o)),o.useStyle(v),this._updateLabel(n);var m=d.getShallow("cursor");m&&o.attr("cursor",m),this._seriesModel=n||this._seriesModel,this._ecModel=r||this._ecModel;var x=l.get("focus"),M="relative"===x?a.concatArray(e.getAncestorsIndices(),e.getDescendantIndices()):"ancestor"===x?e.getAncestorsIndices():"descendant"===x?e.getDescendantIndices():x;(0,u.Lm)(this,M,l.get("blurScope"),l.get("disabled"))},e.prototype._updateLabel=function(t){var e=this,n=this.node.getModel(),r=n.getModel("label"),i=this.node.getLayout(),o=i.endAngle-i.startAngle,s=(i.startAngle+i.endAngle)/2,d=Math.cos(s),c=Math.sin(s),h=this,p=h.getTextContent(),v=this.node.dataIndex,y=r.get("minAngle")/180*Math.PI,I=r.get("show")&&!(null!=y&&Math.abs(o)<y);function m(t,e){var n=t.get(e);return null==n?r.get(e):n}p.ignore=!I,a.each(u.wV,function(r){var u="normal"===r?n.getModel("label"):n.getModel([r,"label"]),y="normal"===r,I=y?p:p.ensureState(r),x=t.getFormattedLabel(v,r);y&&(x=x||e.node.name),I.style=(0,l.VB)(u,{},null,"normal"!==r,!0),x&&(I.style.text=x);var M=u.get("show");null==M||y||(I.ignore=!M);var w,A=m(u,"position"),D=y?h:h.states[r],N=D.style.fill;D.textConfig={outsideFill:"inherit"===u.get("color")?N:null,inside:"outside"!==A};var b=m(u,"distance")||0,T=m(u,"align"),V=m(u,"rotate"),_=.5*Math.PI,S=1.5*Math.PI,P=(0,f.n)("tangential"===V?Math.PI/2-s:s),L=P>_&&!(0,g.dh)(P-_)&&P<S;"outside"===A?(w=i.r+b,T=L?"right":"left"):T&&"center"!==T?"left"===T?(w=i.r0+b,T=L?"right":"left"):"right"===T&&(w=i.r-b,T=L?"left":"right"):(w=0===i.r0&&(0,g.dh)(o-2*Math.PI)?0:(i.r+i.r0)/2,T="center"),I.style.align=T,I.style.verticalAlign=m(u,"verticalAlign")||"middle",I.x=w*d+i.cx,I.y=w*c+i.cy;var R=0;"radial"===V?R=(0,f.n)(-s)+(L?Math.PI:0):"tangential"===V?R=(0,f.n)(Math.PI/2-s)+(L?Math.PI:0):a.isNumber(V)&&(R=V*Math.PI/180),I.rotation=(0,f.n)(R)}),p.dirtyStyle()},e}(d.A),y=n(30112),I=n(5990),m=(n(94490),n(7770)),x=n(56145),M=n(6166),w=n(6471),A=function(){function t(t,e){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=t||"",this.hostTree=e}return t.prototype.isRemoved=function(){return this.dataIndex<0},t.prototype.eachNode=function(t,e,n){a.isFunction(t)&&(n=e,e=t,t=null),t=t||{},a.isString(t)&&(t={order:t});var r,i=t.order||"preorder",o=this[t.attr||"children"];"preorder"===i&&(r=e.call(n,this));for(var s=0;!r&&s<o.length;s++)o[s].eachNode(t,e,n);"postorder"===i&&e.call(n,this)},t.prototype.updateDepthAndHeight=function(t){var e=0;this.depth=t;for(var n=0;n<this.children.length;n++){var r=this.children[n];r.updateDepthAndHeight(t+1),r.height>e&&(e=r.height)}this.height=e+1},t.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var e=0,n=this.children,r=n.length;e<r;e++){var a=n[e].getNodeById(t);if(a)return a}},t.prototype.contains=function(t){if(t===this)return!0;for(var e=0,n=this.children,r=n.length;e<r;e++){var a=n[e].contains(t);if(a)return a}},t.prototype.getAncestors=function(t){for(var e=[],n=t?this:this.parentNode;n;)e.push(n),n=n.parentNode;return e.reverse(),e},t.prototype.getAncestorsIndices=function(){for(var t=[],e=this;e;)t.push(e.dataIndex),e=e.parentNode;return t.reverse(),t},t.prototype.getDescendantIndices=function(){var t=[];return this.eachNode(function(e){t.push(e.dataIndex)}),t},t.prototype.getValue=function(t){var e=this.hostTree.data;return e.getStore().get(e.getDimensionIndex(t||"value"),this.dataIndex)},t.prototype.setLayout=function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,e)},t.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},t.prototype.getModel=function(t){if(!(this.dataIndex<0))return this.hostTree.data.getItemModel(this.dataIndex).getModel(t)},t.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},t.prototype.setVisual=function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,e)},t.prototype.getVisual=function(t){return this.hostTree.data.getItemVisual(this.dataIndex,t)},t.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},t.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},t.prototype.getChildIndex=function(){if(this.parentNode){for(var t=this.parentNode.children,e=0;e<t.length;++e)if(t[e]===this)return e;return-1}return-1},t.prototype.isAncestorOf=function(t){for(var e=t.parentNode;e;){if(e===this)return!0;e=e.parentNode}return!1},t.prototype.isDescendantOf=function(t){return t!==this&&t.isAncestorOf(this)},t}();var D=function(){function t(t){this.type="tree",this._nodes=[],this.hostModel=t}return t.prototype.eachNode=function(t,e,n){this.root.eachNode(t,e,n)},t.prototype.getNodeByDataIndex=function(t){var e=this.data.getRawIndex(t);return this._nodes[e]},t.prototype.getNodeById=function(t){return this.root.getNodeById(t)},t.prototype.update=function(){for(var t=this.data,e=this._nodes,n=0,r=e.length;n<r;n++)e[n].dataIndex=-1;for(n=0,r=t.count();n<r;n++)e[t.getRawIndex(n)].dataIndex=n},t.prototype.clearLayouts=function(){this.data.clearItemLayouts()},t.createTree=function(e,n,r){var i=new t(n),o=[],s=1;!function t(e,n){var r=e.value;s=Math.max(s,a.isArray(r)?r.length:1),o.push(e);var d=new A((0,w.vS)(e.name,""),i);n?function(t,e){var n=e.children;if(t.parentNode===e)return;n.push(t),t.parentNode=e}(d,n):i.root=d,i._nodes.push(d);var u=e.children;if(u)for(var l=0;l<u.length;l++)t(u[l],d)}(e),i.root.updateDepthAndHeight(0);var d=(0,M.A)(o,{coordDimensions:["value"],dimensionsCount:s}).dimensions,u=new x.A(d,n);return u.initData(o),r&&r(u),(0,m.A)({mainData:u,struct:i,structAttr:"tree"}),i.update(),i},t}();function N(t,e,n){if(t&&a.indexOf(e,t.type)>=0){var r=n.getData().tree.root,i=t.targetNode;if(a.isString(i)&&(i=r.getNodeById(i)),i&&r.contains(i))return{node:i};var o=t.targetNodeId;if(null!=o&&(i=r.getNodeById(o)))return{node:i}}}var b=n(99904),T=n(41022);var V="sunburst",_=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.ignoreStyleOnData=!0,n}return(0,r.C6)(e,t),e.prototype.getInitialData=function(t,e){var n={name:t.name,children:t.data};S(n);var r=this._levelModels=a.map(t.levels||[],function(t){return new b.A(t,this,e)},this),i=D.createTree(n,this,function(t){t.wrapMethod("getItemModel",function(t,e){var n=i.getNodeByDataIndex(e),a=r[n.depth];return a&&(t.parentModel=a),t})});return i.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.getDataParams=function(e){var n=t.prototype.getDataParams.apply(this,arguments),r=this.getData().tree.getNodeByDataIndex(e);return n.treePathInfo=function(t,e){for(var n=[];t;){var r=t.dataIndex;n.push({name:t.name,dataIndex:r,value:e.getRawValue(r)}),t=t.parentNode}return n.reverse(),n}(r,this),n},e.prototype.getLevelModel=function(t){return this._levelModels&&this._levelModels[t.depth]},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getRawData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)},e.prototype.enableAriaDecal=function(){var t,e,n;e=(t=this).getData().tree,n={},e.eachNode(function(e){for(var r=e;r&&r.depth>1;)r=r.parentNode;var a=(0,T.x)(t.ecModel,r.name||r.dataIndex+"",n);e.setVisual("decal",a)})},e.type="series."+V,e.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"},e}(I.A);function S(t){var e=0;a.each(t.children,function(t){S(t);var n=t.value;a.isArray(n)&&(n=n[0]),e+=n});var n=t.value;a.isArray(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=e),n<0&&(n=0),a.isArray(t.value)?t.value[0]=n:t.value=n}var P=_,L="sunburstRootToNode",R="sunburstHighlight",C="sunburstUnhighlight";function k(t){t.registerAction({type:L,update:"updateView"},function(t,e){e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e,n){var r=N(t,[L],e);if(r){var i=e.getViewRoot();i&&(t.direction=(o=i,s=r.node,d=function(t){for(var e=[];t;)(t=t.parentNode)&&e.push(t);return e.reverse()}(o),a.indexOf(d,s)>=0?"rollUp":"drillDown")),e.resetViewRoot(r.node)}var o,s,d})}),t.registerAction({type:R,update:"none"},function(t,e,n){t=(0,a.extend)({},t),e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e){var n=N(t,[R],e);n&&(t.dataIndex=n.node.dataIndex)}),n.dispatchAction((0,a.extend)(t,{type:"highlight"}))}),t.registerAction({type:C,update:"updateView"},function(t,e,n){t=(0,a.extend)({},t),n.dispatchAction((0,a.extend)(t,{type:"downplay"}))})}var B=n(95259),O=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=V,e}return(0,r.C6)(e,t),e.prototype.render=function(t,e,n,r){var i=this;this.seriesModel=t,this.api=n,this.ecModel=e;var o=t.getData(),s=o.tree.root,d=t.getViewRoot(),u=this.group,l=t.get("renderLabelForZeroData"),c=[];d.eachNode(function(t){c.push(t)});var h=this._oldChildren||[];!function(r,i){if(0===r.length&&0===i.length)return;function d(t){return t.getId()}function c(a,d){!function(r,a){l||!r||r.getValue()||(r=null);if(r!==s&&a!==s)if(a&&a.piece)r?(a.piece.updateData(!1,r,t,e,n),o.setItemGraphicEl(r.dataIndex,a.piece)):function(t){if(!t)return;t.piece&&(u.remove(t.piece),t.piece=null)}(a);else if(r){var i=new v(r,t,e,n);u.add(i),o.setItemGraphicEl(r.dataIndex,i)}}(null==a?null:r[a],null==d?null:i[d])}new y.A(i,r,d,d).add(c).update(c).remove(a.curry(c,null)).execute()}(c,h),function(r,a){a.depth>0?(i.virtualPiece?i.virtualPiece.updateData(!1,r,t,e,n):(i.virtualPiece=new v(r,t,e,n),u.add(i.virtualPiece)),a.piece.off("click"),i.virtualPiece.on("click",function(t){i._rootToNode(a.parentNode)})):i.virtualPiece&&(u.remove(i.virtualPiece),i.virtualPiece=null)}(s,d),this._initEvents(),this._oldChildren=c},e.prototype._initEvents=function(){var t=this;this.group.off("click"),this.group.on("click",function(e){var n=!1;t.seriesModel.getViewRoot().eachNode(function(r){if(!n&&r.piece&&r.piece===e.target){var a=r.getModel().get("nodeClick");if("rootToNode"===a)t._rootToNode(r);else if("link"===a){var i=r.getModel(),o=i.get("link");if(o){var s=i.get("target",!0)||"_blank";(0,B.JW)(o,s)}}n=!0}})})},e.prototype._rootToNode=function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:L,from:this.uid,seriesId:this.seriesModel.id,targetNode:t})},e.prototype.containPoint=function(t,e){var n=e.getData().getItemLayout(0);if(n){var r=t[0]-n.cx,a=t[1]-n.cy,i=Math.sqrt(r*r+a*a);return i<=n.r&&i>=n.r0}},e.type=V,e}(i.A),E=O,F=n(85767),H=n(16418),U=(0,w.O9)(V,function(t){var e={};t.eachSeriesByType(V,function(t){var n=t.getData(),r=n.tree;r.eachNode(function(i){var o=i.getModel().getModel("itemStyle").getItemStyle();o.fill||(o.fill=function(t,n,r){if(0===t.depth)return H.A.color.neutral50;for(var i=t;i&&i.depth>1;)i=i.parentNode;var o=n.getColorFromPalette(i.name||i.dataIndex+"",e);return t.depth>1&&(0,a.isString)(o)&&(o=(0,F.lift)(o,(t.depth-1)/(r-1)*.5)),o}(i,t,r.root.height));var s=n.ensureUniqueItemVisual(i.dataIndex,"style");(0,a.extend)(s,o)})})});n(26910);var z=Math.PI/180,q=(0,w.O9)(V,function(t,e){t.eachSeriesByType(V,function(t){var n=t.get("center"),r=t.get("radius");a.isArray(r)||(r=[0,r]),a.isArray(n)||(n=[n,n]);var i=e.getWidth(),o=e.getHeight(),s=Math.min(i,o),d=(0,g.lo)(n[0],i),u=(0,g.lo)(n[1],o),l=(0,g.lo)(r[0],s/2),c=(0,g.lo)(r[1],s/2),h=-t.get("startAngle")*z,p=t.get("minAngle")*z,f=t.getData().tree.root,v=t.getViewRoot(),y=v.depth,I=t.get("sort");null!=I&&W(v,I);var m=0;a.each(v.children,function(t){!isNaN(t.getValue())&&m++});var x=v.getValue(),M=Math.PI/(x||m)*2,w=v.depth>0,A=v.height-(w?-1:1),D=(c-l)/(A||1),N=t.get("clockwise"),b=t.get("stillShowZeroSum"),T=N?1:-1,V=function(e,n){if(e){var r=n;if(e!==f){var i=e.getValue(),o=0===x&&b?M:i*M;o<p&&(o=p),r=n+T*o;var c=e.depth-y-(w?-1:1),h=l+D*c,v=l+D*(c+1),I=t.getLevelModel(e);if(I){var m=I.get("r0",!0),A=I.get("r",!0),_=I.get("radius",!0);null!=_&&(m=_[0],A=_[1]),null!=m&&(h=(0,g.lo)(m,s/2)),null!=A&&(v=(0,g.lo)(A,s/2))}e.setLayout({angle:o,startAngle:n,endAngle:r,clockwise:N,cx:d,cy:u,r0:h,r:v})}if(e.children&&e.children.length){var S=0;a.each(e.children,function(t){S+=V(t,n+S)})}return r-n}};if(w){var _=l,S=l+D,P=2*Math.PI;f.setLayout({angle:P,startAngle:h,endAngle:h+P,clockwise:N,cx:d,cy:u,r0:_,r:S})}V(v,h)})});function W(t,e){var n=t.children||[];t.children=function(t,e){if(a.isFunction(e)){var n=a.map(t,function(t,e){var n=t.getValue();return{params:{depth:t.depth,height:t.height,dataIndex:t.dataIndex,getValue:function(){return n}},index:e}});return n.sort(function(t,n){return e(t.params,n.params)}),a.map(n,function(e){return t[e.index]})}var r="asc"===e;return t.sort(function(t,e){var n=(t.getValue()-e.getValue())*(r?1:-1);return 0===n?(t.dataIndex-e.dataIndex)*(r?-1:1):n})}(n,e),n.length&&a.each(t.children,function(t){W(t,e)})}function Z(t){t.registerChartView(E),t.registerSeriesModel(P),t.registerLayout(q),t.registerVisual(U),k(t)}},7770:function(t,e,n){var r=n(52577),a=(0,n(6471).$r)();function i(t,e){if(a(i=this).mainData===i){var n=(0,r.extend)({},a(this).datas);n[this.dataType]=e,l(e,n,t)}else c(e,this.dataType,a(this).mainData,t);var i;return e}function o(t,e){return t.struct&&t.struct.update(),e}function s(t,e){return(0,r.each)(a(e).datas,function(n,r){n!==e&&c(n.cloneShallow(),r,e,t)}),e}function d(t){var e=a(this).mainData;return null==t||null==e?e:a(e).datas[t]}function u(){var t=a(this).mainData;return null==t?[{data:t}]:(0,r.map)((0,r.keys)(a(t).datas),function(e){return{type:e,data:a(t).datas[e]}})}function l(t,e,n){a(t).datas={},(0,r.each)(e,function(e,r){c(e,r,t,n)})}function c(t,e,n,r){a(n).datas[e]=t,a(t).mainData=n,t.dataType=e,r.struct&&(t[r.structAttr]=r.struct,r.struct[r.datasAttr[e]]=t),t.getLinkedData=d,t.getLinkedDataAll=u}e.A=function(t){var e=t.mainData,n=t.datas;n||(n={main:e},t.datasAttr={main:"data"}),t.datas=t.mainData=null,l(e,n,t),(0,r.each)(n,function(n){(0,r.each)(e.TRANSFERABLE_METHODS,function(e){n.wrapMethod(e,(0,r.curry)(i,t))})}),e.wrapMethod("cloneShallow",(0,r.curry)(s,t)),(0,r.each)(e.CHANGABLE_METHODS,function(n){e.wrapMethod(n,(0,r.curry)(o,t))}),(0,r.assert)(n[e.dataType]===e)}}}]);