@mxtommy/kip 4.8.4 → 4.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/plugin/history-series.service.js +637 -0
- package/plugin/index.js +1322 -0
- package/plugin/kip-series-contract.js +31 -0
- package/plugin/openApi.json +855 -0
- package/plugin/sqlite-history-storage.service.js +1124 -0
- package/public/assets/help-docs/ais-radar.md +261 -0
- package/public/assets/help-docs/dashboards.md +1 -1
- package/public/assets/help-docs/menu.json +17 -2
- package/public/{chunk-Co2wVrD6.js → chunk-0ijGpqkR.js} +1 -1
- package/public/{chunk-JhFkJS7i.js → chunk-6MiGh2Ts.js} +1 -1
- package/public/{chunk-DIl1k00y.js → chunk-7QXXQf2h.js} +1 -1
- package/public/{chunk-CYYBxjrc.js → chunk-B4Wxwb2y.js} +1 -1
- package/public/{chunk-q9NoPvcx.js → chunk-BAVmyVwG.js} +1 -1
- package/public/{chunk-BfiyH3nV.js → chunk-BOlUTHo6.js} +1 -1
- package/public/{chunk-x7L6DXVK.js → chunk-BTv5PhTr.js} +1 -1
- package/public/{chunk-BeM64etA.js → chunk-BZG04c3j.js} +1 -1
- package/public/{chunk-0z3nIRXw.js → chunk-BaGEtCmz.js} +1 -1
- package/public/{chunk-otzyItXL.js → chunk-Bbyk4dOu.js} +1 -1
- package/public/{chunk-CCfhzpE8.js → chunk-Be5KcT7R.js} +1 -1
- package/public/{chunk-BFpzxIIT.js → chunk-Bp1YVCJL.js} +1 -1
- package/public/{chunk-CLs_NL1y.js → chunk-BwYOFdBA.js} +1 -1
- package/public/{chunk-D-_-GUVr.js → chunk-Bx77STup.js} +1 -1
- package/public/{chunk-COI6IBXH.js → chunk-ByC_hFSP.js} +1 -1
- package/public/{chunk-CIGP2YJm.js → chunk-ByFzHU1s.js} +1 -1
- package/public/{chunk-CXvWM_vF.js → chunk-BzH86te1.js} +1 -1
- package/public/{chunk-CxPx4NZv.js → chunk-C7ax8Sqz.js} +1 -1
- package/public/{chunk-CoCQ3DW2.js → chunk-C89yhdsn.js} +1 -1
- package/public/{chunk-BTOTKeBo.js → chunk-CJhkckXA.js} +1 -1
- package/public/{chunk-BUguZ7cK.js → chunk-CLIWxVhS.js} +1 -1
- package/public/{chunk-eQ1pa34Q.js → chunk-CQtqkz1Y.js} +1 -1
- package/public/{chunk-BIb-xYiS.js → chunk-CRy9Da7a.js} +1 -1
- package/public/{chunk-Do8wqING.js → chunk-CcaPRVAZ.js} +1 -1
- package/public/{chunk-BjINKQ03.js → chunk-CdNfAZ0G.js} +1 -1
- package/public/{chunk-CLTHuhlN.js → chunk-Cj0AJQ8U.js} +1 -1
- package/public/{chunk-B9nVBlGj.js → chunk-CkFpNfxN.js} +1 -1
- package/public/{chunk-B09jfNia.js → chunk-Cn9j0-tJ.js} +1 -1
- package/public/{chunk-_zRMMvCu.js → chunk-Co8V0LUu.js} +1 -1
- package/public/{chunk-ibauGmSP.js → chunk-CteyWXZ_.js} +1 -1
- package/public/{chunk-C6b8CVno.js → chunk-CuPmfpgh.js} +1 -1
- package/public/{chunk-DmkAKXR1.js → chunk-CwGTKplC.js} +1 -1
- package/public/{chunk-DPnbM-aB.js → chunk-CzEDfe2A.js} +1 -1
- package/public/{chunk-DUEKoZhd.js → chunk-D1Yncgg5.js} +1 -1
- package/public/{chunk-DTN-sa1K.js → chunk-D63LEt5t.js} +1 -1
- package/public/{chunk-BpcNrtxJ.js → chunk-DN39qO63.js} +1 -1
- package/public/{chunk-szQs8fiq.js → chunk-DNbLx4NZ.js} +1 -1
- package/public/{chunk-D1HYfaL_.js → chunk-DRPjASjZ.js} +1 -1
- package/public/{chunk-CyVRpGoJ.js → chunk-Dddd8rAh.js} +1 -1
- package/public/{chunk-C_OZJltF.js → chunk-DiDkZnhZ.js} +1 -1
- package/public/{chunk-CHAFm_nM.js → chunk-DonRL_4T.js} +1 -1
- package/public/{chunk-BJ-wyixK.js → chunk-DufX2AHa.js} +1 -1
- package/public/{chunk-07zHjmg-.js → chunk-DxS7HN4G.js} +1 -1
- package/public/{chunk-BLEZOsfR.js → chunk-Fy40z1B2.js} +1 -1
- package/public/{chunk-OeQDZKFO.js → chunk-MO2v041V.js} +1 -1
- package/public/{chunk-BuvyF0y5.js → chunk-MakCt36b.js} +1 -1
- package/public/{chunk-BZx964-p.js → chunk-TdI_E-cf.js} +1 -1
- package/public/{chunk-B0D54iJs.js → chunk-TneLdWrI.js} +1 -1
- package/public/{chunk-BN7A4g6c.js → chunk-YZWhRxa9.js} +1 -1
- package/public/{chunk-CQMVIDcp.js → chunk-_toW-rHA.js} +1 -1
- package/public/{chunk-B0eE4udE.js → chunk-tbyiK3Ur.js} +1 -1
- package/public/{chunk-D2953Rfp.js → chunk-urAQA4U_.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-YKDNK5VZ.js → main-F7NMHHV4.js} +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import {C,e as e$1}from'./chunk-DPnbM-aB.js';import {g as ge$1}from'./chunk-TakPRI3t.js';import {e9 as a,d1 as Hj,w,du as p,aS as De,bu as ut,aY as xe,$ as $j,v as vt,D as Dt,F as Fa,dn as ge,a_ as Gp,cv as G,cw as z,dx as n$1,J as JD,dC as x,c as $h,cn as wd,_ as _w,B as Bh,e as EE,M as Mw,f as eg,K as Kw,P as Pi,T as TT,u as ul}from'./main-YKDNK5VZ.js';import {c,e}from'./chunk-BIb-xYiS.js';var re=["inverterSvg"];function ie(c,e){c&1&&(Pi(0,"div",3)(1,"div",4),TT(2,"No inverters detected"),ul(),Pi(3,"div",5),TT(4,"Check Signal K inverter paths or select inverters in widget settings."),ul()());}function ne(c){return c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Z=class c$1{static INVERTER_DESCRIPTOR=a("widget-inverter");static SELF_ROOT_PATH=(()=>{let e=c$1.INVERTER_DESCRIPTOR?.selfRootPath;if(!e)throw new Error("[WidgetInverterComponent] Descriptor missing or selfRootPath not set; check widget registration.");return e})();static ROOT_PATTERN=`${c$1.SELF_ROOT_PATH}.*`;static PATH_REGEX=new RegExp(`^${ne(c$1.SELF_ROOT_PATH)}\\.([^.]+)\\.(.+)$`);static VIEWBOX_WIDTH=200;static CARD_HEIGHT=100;static COMPACT_CARD_HEIGHT=100;static CARD_GAP=8;static PATH_BATCH_WINDOW_MS=500;static DEFAULT_CONFIG={color:"contrast",ignoreZones:false,inverter:{trackedDevices:[],optionsById:{}}};id=Hj.required();type=Hj.required();theme=Hj.required();renderMode=Hj(null);runtime=w(p);data=w(De);units=w(ut);destroyRef=w(xe);svgRef=$j.required("inverterSvg");svg;layer;pendingPathUpdates=new Map;pathBatchTimerId=null;initialPathPaintDone=false;renderFrameId=null;pendingRenderSnapshot=null;discoveredInverterIds=vt([]);trackedDevices=vt([]);optionsById=vt({});cardMode=vt({displayMode:"full",metrics:["dcVoltage","dcCurrent","acVoltage","acFrequency"]});invertersByKey=vt({});visibleInverterKeys=Dt(()=>{let e=this.trackedDevices();if(e.length)return e.map(i=>i.key);let r=this.invertersByKey(),t=new Set(this.discoveredInverterIds());return Object.keys(r).filter(i=>{let o=r[i];return !!o&&t.has(o.id)}).sort((i,o)=>i.localeCompare(o))});visibleInverters=Dt(()=>{let e=this.visibleInverterKeys(),r=this.invertersByKey();return e.map(t=>r[t]).filter(t=>!!t)});hasInverters=Dt(()=>this.visibleInverters().length>0);activeDisplayMode=Dt(()=>this.renderMode()??this.cardMode().displayMode??"full");isCompactCardMode=Dt(()=>this.activeDisplayMode()==="compact");colorRole=Dt(()=>this.runtime.options()?.color??"contrast");ignoreZones=Dt(()=>this.runtime.options()?.ignoreZones??false);displayLabel=Dt(()=>{let e=this.visibleInverters();return e.length!==1?"Inverters":this.resolveTitleText(e[0])});labelColor=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e).dim:"var(--kip-contrast-dim-color)"});widgetColors=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e):null});displayModels=Dt(()=>{let e$1=this.visibleInverters(),r=this.theme(),t=this.widgetColors(),i=this.ignoreZones(),o=new Map;e$1.forEach(n=>o.set(n.id,(o.get(n.id)??0)+1));let d=new Set([...o.entries()].filter(([,n])=>n>1).map(([n])=>n)),s={};for(let n of e$1){let l=n.deviceKey??n.id,a=!!n.source&&d.has(n.id),h=this.resolveMostSevereState(n.dcVoltageState??null,n.dcCurrentState??null,n.acVoltageState??null,n.acCurrentState??null,n.acFrequencyState??null,n.temperatureState??null,n.inverterModeState??null),M=this.resolveMostSevereState(n.dcVoltageState??null,n.dcCurrentState??null),b=this.resolveMostSevereState(n.acVoltageState??null,n.acCurrentState??null,n.acFrequencyState??null),[u,x]=this.buildMetricRows(n);s[l]={id:n.id,source:n.source??null,deviceKey:n.deviceKey,titleText:this.resolveTitleText(n),modeText:this.isCompactCardMode()?"":n.inverterMode?`Mode ${n.inverterMode}`:"Mode -",busText:this.isCompactCardMode()?"":a?n.source??"-":n.associatedBus||n.location||"-",metricsLineOne:u,metricsLineTwo:x,stateBarColor:e(h,t?.dim??"var(--kip-contrast-color)",r,i),titleTextColor:e(h,"var(--kip-contrast-color)",r,i),metaTextColor:e(n.inverterModeState??null,"var(--kip-contrast-dim-color)",r,i),primaryMetricsTextColor:e(M,"var(--kip-contrast-color)",r,i),secondaryMetricsTextColor:e(b,"var(--kip-contrast-color)",r,i)};}return s});constructor(){Fa(()=>{let t=this.runtime.options();t&&ge(()=>this.applyConfig(t));}),Fa(()=>{let t=this.displayModels(),i=this.visibleInverters(),o=this.widgetColors();!this.svg||!o||this.requestRender({inverters:i,displayModels:t,widgetColors:o});});let e=[this.data.subscribePathTreeWithInitial(c$1.ROOT_PATTERN)],r=false;for(let t of e)if(t.initial.length){r=true;for(let i of t.initial)this.enqueuePathUpdate(i,true);}r&&(this.flushPendingPathUpdates(),this.initialPathPaintDone=true);for(let t of e)t.live$.pipe(Gp(this.destroyRef)).subscribe(i=>this.enqueuePathUpdate(i));}ngAfterViewInit(){this.initializeSvg(),this.requestRender();}ngOnDestroy(){this.pathBatchTimerId!==null&&(clearTimeout(this.pathBatchTimerId),this.pathBatchTimerId=null),this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.pendingRenderSnapshot=null;}initializeSvg(){this.svg=ge$1(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${c$1.VIEWBOX_WIDTH} ${c$1.CARD_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Inverter View"),this.layer=this.svg.append("g").attr("class","inverter-layer");}applyConfig(e){let r=this.resolveInverterConfig(e);this.trackedDevices.set(r.trackedDevices??[]),this.reprojectSnapshotsToDeviceKeys(r.trackedDevices??[]),this.optionsById.set(r.optionsById),this.cardMode.set(this.normalizeCardMode(r.cardMode));}reprojectSnapshotsToDeviceKeys(e){if(!e.length)return;let r=new Map;e.forEach(t=>{let i=r.get(t.id)??[];i.push(t.key),r.set(t.id,i);}),this.invertersByKey.update(t=>{let i=t,o=false;return r.forEach((d,s)=>{let n=t[s];if(n){for(let l of d){if(t[l])continue;let a=e.find(h=>h.key===l);o||(i=G({},t),o=true),i[l]=z(G({},n),{source:a?.source??null,deviceKey:l});}o&&i[s]?.deviceKey===void 0&&delete i[s];}}),o?i:t});}resolveInverterConfig(e){let r=e.inverter;return {trackedDevices:this.normalizeTrackedDevices(r?.trackedDevices),optionsById:this.normalizeOptionsById(r?.optionsById),cardMode:this.normalizeCardMode(r?.cardMode)}}normalizeTrackedDevices(e){if(!Array.isArray(e))return [];let r=new Map;return e.forEach(t=>{if(!t||typeof t!="object")return;let i=t,o=this.normalizeOptionalString(i.id),d=this.normalizeOptionalString(i.source);if(!o||!d)return;let s=this.normalizeOptionalString(i.key)??`${o}||${d}`;r.set(s,{id:o,source:d,key:s});}),[...r.values()].sort((t,i)=>t.key.localeCompare(i.key))}buildIdToDeviceKeysMap(){let e=new Map;return this.trackedDevices().forEach(r=>{let t=e.get(r.id)??[];t.push(r.key),e.set(r.id,t);}),e}normalizeCardMode(e){let r=e&&typeof e=="object"?e:null,t=this.normalizeStringList(r?.metrics);return {displayMode:r?.displayMode==="compact"?"compact":"full",metrics:t.length?t:["dcVoltage","dcCurrent","acVoltage","acFrequency"]}}normalizeStringList(e){if(!Array.isArray(e))return [];let r=new Set;return e.forEach(t=>{if(typeof t!="string")return;let i=t.trim();i.length>0&&r.add(i);}),[...r].sort((t,i)=>t.localeCompare(i))}normalizeOptionsById(e){if(!e||typeof e!="object")return {};let r={};return Object.entries(e).forEach(([t])=>{let i=this.normalizeOptionalString(t);i&&(r[i]={});}),r}normalizeOptionalString(e){if(typeof e!="string")return null;let r=e.trim();return r.length>0?r:null}enqueuePathUpdate(e,r=false){let t=this.parsePath(e.path);if(!t)return;let i=e.update?.data?.value??null,o=e.update?.state??null;if(this.pendingPathUpdates.set(`${t.id}::${t.key}`,{id:t.id,key:t.key,value:i,state:o}),!r){if(!this.initialPathPaintDone){this.initialPathPaintDone=true,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates();},c$1.PATH_BATCH_WINDOW_MS));}}parsePath(e){let r=e.match(c$1.PATH_REGEX);return r?{id:r[1],key:r[2]}:null}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let e=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(e.map(i=>i.id)).forEach(i=>this.trackDiscoveredInverter(i));let t=this.buildIdToDeviceKeysMap();this.invertersByKey.update(i=>{let o=i,d=false;for(let s of e){let n=t.get(s.id),l=n?.length?n:[s.id];for(let a of l){let h=!!n?.length,M=h?this.trackedDevices().find(I=>I.key===a):null,b=o[a]??{id:s.id,source:M?.source??null,deviceKey:h?a:void 0},u=G({},b);if(this.applyValue(u,s.key,s.value,s.state)){if(u.dcVoltage!=null&&u.dcCurrent!=null){let I=u.dcVoltage*u.dcCurrent;u.dcPower=Number.isFinite(I)?I:null,u.dcPowerState=this.resolveMostSevereState(u.dcVoltageState??null,u.dcCurrentState??null);}else u.dcPower=null,u.dcPowerState=null;d||(o=G({},o),d=true),o[a]=u;}}}return d?o:i});}trackDiscoveredInverter(e){let r=this.discoveredInverterIds();r.includes(e)||this.discoveredInverterIds.set([...r,e].sort((t,i)=>t.localeCompare(i)));}applyValue(e,r,t,i){switch(r){case "name":return this.setValue(e,"name",this.toStringValue(t));case "location":return this.setValue(e,"location",this.toStringValue(t));case "associatedBus":return this.setValue(e,"associatedBus",this.toStringValue(t));case "dc.voltage":return this.setMetricValue(e,"dcVoltage","dcVoltageState",this.toNumber(t,"V"),i);case "dc.current":return this.setMetricValue(e,"dcCurrent","dcCurrentState",this.toNumber(t,"A"),i);case "acin.voltage":return this.setMetricValue(e,"acInVoltage","acInVoltageState",this.toNumber(t,"V"),i);case "acin.current":return this.setMetricValue(e,"acInCurrent","acInCurrentState",this.toNumber(t,"A"),i);case "acin.frequency":return this.setMetricValue(e,"acInFrequency","acInFrequencyState",this.toNumber(t,"Hz"),i);case "acin.power":return this.setMetricValue(e,"acInPower","acInPowerState",this.toNumber(t,"W"),i);case "acin.1.currentLimit":return this.setMetricValue(e,"acIn1CurrentLimit","acIn1CurrentLimitState",this.toNumber(t,"A"),i);case "acin.currentLimit":return this.setMetricValue(e,"acInCurrentLimit","acInCurrentLimitState",this.toNumber(t,"A"),i);case "acState.acIn1Available":return this.setMetricValue(e,"acIn1Available","acIn1AvailableState",this.toBoolean(t),i);case "acState.ignoreAcIn1.state":return this.setMetricValue(e,"ignoreAcIn1","ignoreAcIn1State",this.toBoolean(t),i);case "ac.voltage":return this.setMetricValue(e,"acVoltage","acVoltageState",this.toNumber(t,"V"),i);case "ac.current":return this.setMetricValue(e,"acCurrent","acCurrentState",this.toNumber(t,"A"),i);case "ac.frequency":return this.setMetricValue(e,"acFrequency","acFrequencyState",this.toNumber(t,"Hz"),i);case "acout.voltage":return this.setMetricValue(e,"acOutVoltage","acOutVoltageState",this.toNumber(t,"V"),i);case "acout.current":return this.setMetricValue(e,"acOutCurrent","acOutCurrentState",this.toNumber(t,"A"),i);case "acout.frequency":return this.setMetricValue(e,"acOutFrequency","acOutFrequencyState",this.toNumber(t,"Hz"),i);case "acout.power":return this.setMetricValue(e,"acOutPower","acOutPowerState",this.toNumber(t,"W"),i);case "inverterMode":return this.setMetricValue(e,"inverterMode","inverterModeState",this.toStringValue(t),i);case "inverterModeNumber":return this.setMetricValue(e,"inverterModeNumber","inverterModeNumberState",this.toNumber(t,""),i);case "preferRenewableEnergy":return this.setMetricValue(e,"preferRenewableEnergy","preferRenewableEnergyState",this.toBoolean(t),i);case "preferRenewableEnergyActive":return this.setMetricValue(e,"preferRenewableEnergyActive","preferRenewableEnergyActiveState",this.toBoolean(t),i);case "temperature":return this.setMetricValue(e,"temperature","temperatureState",this.toNumber(t,this.units.getDefaults().Temperature),i);default:return false}}setValue(e,r,t){return Object.is(e[r],t)?false:(e[r]=t,true)}setMetricValue(e,r,t,i,o){let d=!Object.is(e[r],i),s=!Object.is(e[t],o);return !d&&!s?false:(e[r]=i,e[t]=o,true)}requestRender(e){let r=this.widgetColors();!this.svg||!r||(this.pendingRenderSnapshot=e??{inverters:this.visibleInverters(),displayModels:this.displayModels(),widgetColors:r},this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let t=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,t&&this.render(t);})));}render(e){if(!this.layer||!this.svg)return;let r=this.isCompactCardMode(),t=r?C:e$1,i=r?c$1.COMPACT_CARD_HEIGHT:c$1.CARD_HEIGHT,o=e.inverters.map((a,h)=>({key:a.deviceKey??a.id,inverter:a,y:h*(i+c$1.CARD_GAP)})),d=o.length?o[o.length-1].y+i:i;this.svg.attr("viewBox",`0 0 ${c$1.VIEWBOX_WIDTH} ${d}`);let s=this.layer.selectAll("g.inverter-card").data(o,a=>a.key),n=s.enter().append("g").attr("class","inverter-card");n.append("rect").attr("class","inverter-card-bg"),n.append("rect").attr("class","inverter-state-bar"),n.append("text").attr("class","inverter-title"),n.append("text").attr("class","inverter-id"),n.append("text").attr("class","inverter-mode"),n.append("text").attr("class","inverter-bus"),n.append("text").attr("class","inverter-metrics-1"),n.append("text").attr("class","inverter-metrics-2");let l=n.merge(s);l.attr("transform",a=>`translate(0, ${a.y})`),l.select("rect.inverter-card-bg").attr("x",.5).attr("y",.5).attr("rx",t.cardCornerRadius).attr("ry",t.cardCornerRadius).attr("width",c$1.VIEWBOX_WIDTH-1).attr("height",i-1).attr("stroke","var(--mat-sys-outline-variant)").attr("stroke-width",.5).attr("fill","none"),l.select("rect.inverter-state-bar").attr("x",1.5).attr("y",1.5).attr("rx",t.stateBarCornerRadius).attr("ry",t.stateBarCornerRadius).attr("width",3).attr("height",i-3).attr("fill",a=>e.displayModels[a.key]?.stateBarColor??e.widgetColors.dim),e.inverters.length>1?l.select("text.inverter-title").attr("x",t.titleX).attr("y",t.titleY).attr("font-size",t.titleFontSize).attr("fill",a=>e.displayModels[a.key]?.titleTextColor??"var(--kip-contrast-color)").text(a=>e.displayModels[a.key]?.titleText??this.resolveTitleText(a.inverter)):l.select("text.inverter-title").text(""),l.select("text.inverter-id").attr("x",t.idX).attr("y",t.idY).attr("text-anchor","end").attr("font-size",t.idFontSize).attr("fill","var(--kip-contrast-dim-color)").text(a=>a.inverter.id),l.select("text.inverter-mode").attr("x",t.metaLeftX).attr("y",t.metaY).attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",a=>e.displayModels[a.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(a=>e.displayModels[a.key]?.modeText??""),l.select("text.inverter-bus").attr("x",t.metaRightX).attr("y",t.metaY).attr("text-anchor","end").attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",a=>e.displayModels[a.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(a=>e.displayModels[a.key]?.busText??""),l.select("text.inverter-metrics-1").attr("x",t.lineOneX).attr("y",t.lineOneY).attr("font-size",t.lineOneFontSize).attr("fill",a=>e.displayModels[a.key]?.primaryMetricsTextColor??"var(--kip-contrast-color)").text(a=>e.displayModels[a.key]?.metricsLineOne??""),l.select("text.inverter-metrics-2").attr("x",t.lineTwoX).attr("y",t.lineTwoY).attr("font-size",t.lineTwoFontSize).attr("opacity",.85).attr("fill",a=>e.displayModels[a.key]?.secondaryMetricsTextColor??"var(--kip-contrast-color)").text(a=>e.displayModels[a.key]?.metricsLineTwo??""),s.exit().remove();}displayName(e){return e.name?.trim()||e.id}resolveTitleText(e){return e.name||`Inverter ${e.id}`}buildMetricRows(e){let r=this.cardMode();if(this.activeDisplayMode()==="full"){let i=e.acInVoltage!=null||e.acInCurrent!=null,o=this.formatValue(e.acInVoltage,"V"),d=this.formatValue(e.acInCurrent,"A"),s=this.formatValue(e.acOutVoltage??e.acVoltage,"V"),n=this.formatValue(e.acOutFrequency??e.acFrequency,"Hz");return [`DC ${this.formatValue(e.dcVoltage,"V")} ${this.formatValue(e.dcCurrent,"A")}`,i?`ACin ${o} ${d}`:`AC ${s} ${n}`]}let t=r.metrics.map(i=>this.toMetricLabel(i,e)).filter(i=>!!i);return t.length?[t.slice(0,2).join(" ")||" ",t.slice(2,4).join(" ")||" "]:["DC - -","AC - -"]}toMetricLabel(e,r){switch(e){case "dcVoltage":return `DC V ${this.formatValue(r.dcVoltage,"V")}`;case "dcCurrent":return `DC A ${this.formatValue(r.dcCurrent,"A")}`;case "dcPower":return `DC P ${this.formatValue(r.dcPower,"W")}`;case "acVoltage":return `AC V ${this.formatValue(r.acVoltage,"V")}`;case "acCurrent":return `AC A ${this.formatValue(r.acCurrent,"A")}`;case "acFrequency":return `Hz ${this.formatValue(r.acFrequency,"Hz")}`;case "acInVoltage":return `ACin V ${this.formatValue(r.acInVoltage,"V")}`;case "acInCurrent":return `ACin A ${this.formatValue(r.acInCurrent,"A")}`;case "acInFrequency":return `ACin Hz ${this.formatValue(r.acInFrequency,"Hz")}`;case "acInPower":return `ACin P ${this.formatValue(r.acInPower,"W")}`;case "acOutVoltage":return `ACout V ${this.formatValue(r.acOutVoltage,"V")}`;case "acOutCurrent":return `ACout A ${this.formatValue(r.acOutCurrent,"A")}`;case "acOutFrequency":return `ACout Hz ${this.formatValue(r.acOutFrequency,"Hz")}`;case "acOutPower":return `ACout P ${this.formatValue(r.acOutPower,"W")}`;case "acIn1CurrentLimit":return `ACin1 Lim ${this.formatValue(r.acIn1CurrentLimit,"A")}`;case "acInCurrentLimit":return `ACin Lim ${this.formatValue(r.acInCurrentLimit,"A")}`;case "temperature":return `T ${this.formatTemperature(r.temperature)}`;case "inverterModeNumber":return `Mode# ${r.inverterModeNumber?.toString()??"-"}`;default:return null}}formatValue(e,r){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${r}`}formatTemperature(e){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${this.units.getDefaults().Temperature==="celsius"?"\xB0C":"\xB0F"}`}toStringValue(e){return typeof e=="string"?e:null}resolveMostSevereState(...e){return e.some(r=>r===n$1.Alert)?n$1.Alert:e.some(r=>r===n$1.Alarm)?n$1.Alarm:e.some(r=>r===n$1.Warn)?n$1.Warn:e.some(r=>r===n$1.Normal)?n$1.Normal:null}toNumber(e,r){if(e==null||typeof e=="boolean")return null;let t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return null;let i=this.units.convertToUnit(r,t);return typeof i=="number"&&Number.isFinite(i)?i:null}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return true;if(e===0)return false}if(typeof e=="string"){let r=e.trim().toLowerCase();if(r==="true"||r==="1"||r==="on")return true;if(r==="false"||r==="0"||r==="off")return false}return null}static \u0275fac=function(r){return new(r||c$1)};static \u0275cmp=JD({type:c$1,selectors:[["widget-inverter"]],viewQuery:function(r,t){r&1&&eg(t.svgRef,re,5),r&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],renderMode:[1,"renderMode"]},decls:4,vars:3,consts:[["inverterSvg",""],[3,"text","color"],["aria-hidden","false",1,"inverter-svg"],[1,"inverter-empty"],[1,"inverter-empty-title"],[1,"inverter-empty-sub"]],template:function(r,t){r&1&&($h(0,"widget-title",1),wd(),$h(1,"svg",2,0),_w(3,ie,5,0,"div",3)),r&2&&(Bh("text",t.displayLabel())("color",t.labelColor()),EE(3),Mw(t.hasInverters()?-1:3));},dependencies:[x],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.inverter-svg[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20;padding:0 10px 10px}.inverter-empty[_ngcontent-%COMP%]{position:absolute;inset:0;margin:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--kip-widget-card-background-color) 92%,transparent)}.inverter-empty-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600}.inverter-empty-sub[_ngcontent-%COMP%]{font-size:14px;opacity:.8}"]})};export{Z as WidgetInverterComponent};
|
|
1
|
+
import {C,e as e$1}from'./chunk-CzEDfe2A.js';import {g as ge$1}from'./chunk-TakPRI3t.js';import {e9 as a,d1 as Hj,w,du as p,aS as De,bu as ut,aY as xe,$ as $j,v as vt,D as Dt,F as Fa,dn as ge,a_ as Gp,cv as G,cw as z,dx as n$1,J as JD,dC as x,c as $h,cn as wd,_ as _w,B as Bh,e as EE,M as Mw,f as eg,K as Kw,P as Pi,T as TT,u as ul}from'./main-F7NMHHV4.js';import {c,e}from'./chunk-CRy9Da7a.js';var re=["inverterSvg"];function ie(c,e){c&1&&(Pi(0,"div",3)(1,"div",4),TT(2,"No inverters detected"),ul(),Pi(3,"div",5),TT(4,"Check Signal K inverter paths or select inverters in widget settings."),ul()());}function ne(c){return c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Z=class c$1{static INVERTER_DESCRIPTOR=a("widget-inverter");static SELF_ROOT_PATH=(()=>{let e=c$1.INVERTER_DESCRIPTOR?.selfRootPath;if(!e)throw new Error("[WidgetInverterComponent] Descriptor missing or selfRootPath not set; check widget registration.");return e})();static ROOT_PATTERN=`${c$1.SELF_ROOT_PATH}.*`;static PATH_REGEX=new RegExp(`^${ne(c$1.SELF_ROOT_PATH)}\\.([^.]+)\\.(.+)$`);static VIEWBOX_WIDTH=200;static CARD_HEIGHT=100;static COMPACT_CARD_HEIGHT=100;static CARD_GAP=8;static PATH_BATCH_WINDOW_MS=500;static DEFAULT_CONFIG={color:"contrast",ignoreZones:false,inverter:{trackedDevices:[],optionsById:{}}};id=Hj.required();type=Hj.required();theme=Hj.required();renderMode=Hj(null);runtime=w(p);data=w(De);units=w(ut);destroyRef=w(xe);svgRef=$j.required("inverterSvg");svg;layer;pendingPathUpdates=new Map;pathBatchTimerId=null;initialPathPaintDone=false;renderFrameId=null;pendingRenderSnapshot=null;discoveredInverterIds=vt([]);trackedDevices=vt([]);optionsById=vt({});cardMode=vt({displayMode:"full",metrics:["dcVoltage","dcCurrent","acVoltage","acFrequency"]});invertersByKey=vt({});visibleInverterKeys=Dt(()=>{let e=this.trackedDevices();if(e.length)return e.map(i=>i.key);let r=this.invertersByKey(),t=new Set(this.discoveredInverterIds());return Object.keys(r).filter(i=>{let o=r[i];return !!o&&t.has(o.id)}).sort((i,o)=>i.localeCompare(o))});visibleInverters=Dt(()=>{let e=this.visibleInverterKeys(),r=this.invertersByKey();return e.map(t=>r[t]).filter(t=>!!t)});hasInverters=Dt(()=>this.visibleInverters().length>0);activeDisplayMode=Dt(()=>this.renderMode()??this.cardMode().displayMode??"full");isCompactCardMode=Dt(()=>this.activeDisplayMode()==="compact");colorRole=Dt(()=>this.runtime.options()?.color??"contrast");ignoreZones=Dt(()=>this.runtime.options()?.ignoreZones??false);displayLabel=Dt(()=>{let e=this.visibleInverters();return e.length!==1?"Inverters":this.resolveTitleText(e[0])});labelColor=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e).dim:"var(--kip-contrast-dim-color)"});widgetColors=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e):null});displayModels=Dt(()=>{let e$1=this.visibleInverters(),r=this.theme(),t=this.widgetColors(),i=this.ignoreZones(),o=new Map;e$1.forEach(n=>o.set(n.id,(o.get(n.id)??0)+1));let d=new Set([...o.entries()].filter(([,n])=>n>1).map(([n])=>n)),s={};for(let n of e$1){let l=n.deviceKey??n.id,a=!!n.source&&d.has(n.id),h=this.resolveMostSevereState(n.dcVoltageState??null,n.dcCurrentState??null,n.acVoltageState??null,n.acCurrentState??null,n.acFrequencyState??null,n.temperatureState??null,n.inverterModeState??null),M=this.resolveMostSevereState(n.dcVoltageState??null,n.dcCurrentState??null),b=this.resolveMostSevereState(n.acVoltageState??null,n.acCurrentState??null,n.acFrequencyState??null),[u,x]=this.buildMetricRows(n);s[l]={id:n.id,source:n.source??null,deviceKey:n.deviceKey,titleText:this.resolveTitleText(n),modeText:this.isCompactCardMode()?"":n.inverterMode?`Mode ${n.inverterMode}`:"Mode -",busText:this.isCompactCardMode()?"":a?n.source??"-":n.associatedBus||n.location||"-",metricsLineOne:u,metricsLineTwo:x,stateBarColor:e(h,t?.dim??"var(--kip-contrast-color)",r,i),titleTextColor:e(h,"var(--kip-contrast-color)",r,i),metaTextColor:e(n.inverterModeState??null,"var(--kip-contrast-dim-color)",r,i),primaryMetricsTextColor:e(M,"var(--kip-contrast-color)",r,i),secondaryMetricsTextColor:e(b,"var(--kip-contrast-color)",r,i)};}return s});constructor(){Fa(()=>{let t=this.runtime.options();t&&ge(()=>this.applyConfig(t));}),Fa(()=>{let t=this.displayModels(),i=this.visibleInverters(),o=this.widgetColors();!this.svg||!o||this.requestRender({inverters:i,displayModels:t,widgetColors:o});});let e=[this.data.subscribePathTreeWithInitial(c$1.ROOT_PATTERN)],r=false;for(let t of e)if(t.initial.length){r=true;for(let i of t.initial)this.enqueuePathUpdate(i,true);}r&&(this.flushPendingPathUpdates(),this.initialPathPaintDone=true);for(let t of e)t.live$.pipe(Gp(this.destroyRef)).subscribe(i=>this.enqueuePathUpdate(i));}ngAfterViewInit(){this.initializeSvg(),this.requestRender();}ngOnDestroy(){this.pathBatchTimerId!==null&&(clearTimeout(this.pathBatchTimerId),this.pathBatchTimerId=null),this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.pendingRenderSnapshot=null;}initializeSvg(){this.svg=ge$1(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${c$1.VIEWBOX_WIDTH} ${c$1.CARD_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Inverter View"),this.layer=this.svg.append("g").attr("class","inverter-layer");}applyConfig(e){let r=this.resolveInverterConfig(e);this.trackedDevices.set(r.trackedDevices??[]),this.reprojectSnapshotsToDeviceKeys(r.trackedDevices??[]),this.optionsById.set(r.optionsById),this.cardMode.set(this.normalizeCardMode(r.cardMode));}reprojectSnapshotsToDeviceKeys(e){if(!e.length)return;let r=new Map;e.forEach(t=>{let i=r.get(t.id)??[];i.push(t.key),r.set(t.id,i);}),this.invertersByKey.update(t=>{let i=t,o=false;return r.forEach((d,s)=>{let n=t[s];if(n){for(let l of d){if(t[l])continue;let a=e.find(h=>h.key===l);o||(i=G({},t),o=true),i[l]=z(G({},n),{source:a?.source??null,deviceKey:l});}o&&i[s]?.deviceKey===void 0&&delete i[s];}}),o?i:t});}resolveInverterConfig(e){let r=e.inverter;return {trackedDevices:this.normalizeTrackedDevices(r?.trackedDevices),optionsById:this.normalizeOptionsById(r?.optionsById),cardMode:this.normalizeCardMode(r?.cardMode)}}normalizeTrackedDevices(e){if(!Array.isArray(e))return [];let r=new Map;return e.forEach(t=>{if(!t||typeof t!="object")return;let i=t,o=this.normalizeOptionalString(i.id),d=this.normalizeOptionalString(i.source);if(!o||!d)return;let s=this.normalizeOptionalString(i.key)??`${o}||${d}`;r.set(s,{id:o,source:d,key:s});}),[...r.values()].sort((t,i)=>t.key.localeCompare(i.key))}buildIdToDeviceKeysMap(){let e=new Map;return this.trackedDevices().forEach(r=>{let t=e.get(r.id)??[];t.push(r.key),e.set(r.id,t);}),e}normalizeCardMode(e){let r=e&&typeof e=="object"?e:null,t=this.normalizeStringList(r?.metrics);return {displayMode:r?.displayMode==="compact"?"compact":"full",metrics:t.length?t:["dcVoltage","dcCurrent","acVoltage","acFrequency"]}}normalizeStringList(e){if(!Array.isArray(e))return [];let r=new Set;return e.forEach(t=>{if(typeof t!="string")return;let i=t.trim();i.length>0&&r.add(i);}),[...r].sort((t,i)=>t.localeCompare(i))}normalizeOptionsById(e){if(!e||typeof e!="object")return {};let r={};return Object.entries(e).forEach(([t])=>{let i=this.normalizeOptionalString(t);i&&(r[i]={});}),r}normalizeOptionalString(e){if(typeof e!="string")return null;let r=e.trim();return r.length>0?r:null}enqueuePathUpdate(e,r=false){let t=this.parsePath(e.path);if(!t)return;let i=e.update?.data?.value??null,o=e.update?.state??null;if(this.pendingPathUpdates.set(`${t.id}::${t.key}`,{id:t.id,key:t.key,value:i,state:o}),!r){if(!this.initialPathPaintDone){this.initialPathPaintDone=true,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates();},c$1.PATH_BATCH_WINDOW_MS));}}parsePath(e){let r=e.match(c$1.PATH_REGEX);return r?{id:r[1],key:r[2]}:null}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let e=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(e.map(i=>i.id)).forEach(i=>this.trackDiscoveredInverter(i));let t=this.buildIdToDeviceKeysMap();this.invertersByKey.update(i=>{let o=i,d=false;for(let s of e){let n=t.get(s.id),l=n?.length?n:[s.id];for(let a of l){let h=!!n?.length,M=h?this.trackedDevices().find(I=>I.key===a):null,b=o[a]??{id:s.id,source:M?.source??null,deviceKey:h?a:void 0},u=G({},b);if(this.applyValue(u,s.key,s.value,s.state)){if(u.dcVoltage!=null&&u.dcCurrent!=null){let I=u.dcVoltage*u.dcCurrent;u.dcPower=Number.isFinite(I)?I:null,u.dcPowerState=this.resolveMostSevereState(u.dcVoltageState??null,u.dcCurrentState??null);}else u.dcPower=null,u.dcPowerState=null;d||(o=G({},o),d=true),o[a]=u;}}}return d?o:i});}trackDiscoveredInverter(e){let r=this.discoveredInverterIds();r.includes(e)||this.discoveredInverterIds.set([...r,e].sort((t,i)=>t.localeCompare(i)));}applyValue(e,r,t,i){switch(r){case "name":return this.setValue(e,"name",this.toStringValue(t));case "location":return this.setValue(e,"location",this.toStringValue(t));case "associatedBus":return this.setValue(e,"associatedBus",this.toStringValue(t));case "dc.voltage":return this.setMetricValue(e,"dcVoltage","dcVoltageState",this.toNumber(t,"V"),i);case "dc.current":return this.setMetricValue(e,"dcCurrent","dcCurrentState",this.toNumber(t,"A"),i);case "acin.voltage":return this.setMetricValue(e,"acInVoltage","acInVoltageState",this.toNumber(t,"V"),i);case "acin.current":return this.setMetricValue(e,"acInCurrent","acInCurrentState",this.toNumber(t,"A"),i);case "acin.frequency":return this.setMetricValue(e,"acInFrequency","acInFrequencyState",this.toNumber(t,"Hz"),i);case "acin.power":return this.setMetricValue(e,"acInPower","acInPowerState",this.toNumber(t,"W"),i);case "acin.1.currentLimit":return this.setMetricValue(e,"acIn1CurrentLimit","acIn1CurrentLimitState",this.toNumber(t,"A"),i);case "acin.currentLimit":return this.setMetricValue(e,"acInCurrentLimit","acInCurrentLimitState",this.toNumber(t,"A"),i);case "acState.acIn1Available":return this.setMetricValue(e,"acIn1Available","acIn1AvailableState",this.toBoolean(t),i);case "acState.ignoreAcIn1.state":return this.setMetricValue(e,"ignoreAcIn1","ignoreAcIn1State",this.toBoolean(t),i);case "ac.voltage":return this.setMetricValue(e,"acVoltage","acVoltageState",this.toNumber(t,"V"),i);case "ac.current":return this.setMetricValue(e,"acCurrent","acCurrentState",this.toNumber(t,"A"),i);case "ac.frequency":return this.setMetricValue(e,"acFrequency","acFrequencyState",this.toNumber(t,"Hz"),i);case "acout.voltage":return this.setMetricValue(e,"acOutVoltage","acOutVoltageState",this.toNumber(t,"V"),i);case "acout.current":return this.setMetricValue(e,"acOutCurrent","acOutCurrentState",this.toNumber(t,"A"),i);case "acout.frequency":return this.setMetricValue(e,"acOutFrequency","acOutFrequencyState",this.toNumber(t,"Hz"),i);case "acout.power":return this.setMetricValue(e,"acOutPower","acOutPowerState",this.toNumber(t,"W"),i);case "inverterMode":return this.setMetricValue(e,"inverterMode","inverterModeState",this.toStringValue(t),i);case "inverterModeNumber":return this.setMetricValue(e,"inverterModeNumber","inverterModeNumberState",this.toNumber(t,""),i);case "preferRenewableEnergy":return this.setMetricValue(e,"preferRenewableEnergy","preferRenewableEnergyState",this.toBoolean(t),i);case "preferRenewableEnergyActive":return this.setMetricValue(e,"preferRenewableEnergyActive","preferRenewableEnergyActiveState",this.toBoolean(t),i);case "temperature":return this.setMetricValue(e,"temperature","temperatureState",this.toNumber(t,this.units.getDefaults().Temperature),i);default:return false}}setValue(e,r,t){return Object.is(e[r],t)?false:(e[r]=t,true)}setMetricValue(e,r,t,i,o){let d=!Object.is(e[r],i),s=!Object.is(e[t],o);return !d&&!s?false:(e[r]=i,e[t]=o,true)}requestRender(e){let r=this.widgetColors();!this.svg||!r||(this.pendingRenderSnapshot=e??{inverters:this.visibleInverters(),displayModels:this.displayModels(),widgetColors:r},this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let t=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,t&&this.render(t);})));}render(e){if(!this.layer||!this.svg)return;let r=this.isCompactCardMode(),t=r?C:e$1,i=r?c$1.COMPACT_CARD_HEIGHT:c$1.CARD_HEIGHT,o=e.inverters.map((a,h)=>({key:a.deviceKey??a.id,inverter:a,y:h*(i+c$1.CARD_GAP)})),d=o.length?o[o.length-1].y+i:i;this.svg.attr("viewBox",`0 0 ${c$1.VIEWBOX_WIDTH} ${d}`);let s=this.layer.selectAll("g.inverter-card").data(o,a=>a.key),n=s.enter().append("g").attr("class","inverter-card");n.append("rect").attr("class","inverter-card-bg"),n.append("rect").attr("class","inverter-state-bar"),n.append("text").attr("class","inverter-title"),n.append("text").attr("class","inverter-id"),n.append("text").attr("class","inverter-mode"),n.append("text").attr("class","inverter-bus"),n.append("text").attr("class","inverter-metrics-1"),n.append("text").attr("class","inverter-metrics-2");let l=n.merge(s);l.attr("transform",a=>`translate(0, ${a.y})`),l.select("rect.inverter-card-bg").attr("x",.5).attr("y",.5).attr("rx",t.cardCornerRadius).attr("ry",t.cardCornerRadius).attr("width",c$1.VIEWBOX_WIDTH-1).attr("height",i-1).attr("stroke","var(--mat-sys-outline-variant)").attr("stroke-width",.5).attr("fill","none"),l.select("rect.inverter-state-bar").attr("x",1.5).attr("y",1.5).attr("rx",t.stateBarCornerRadius).attr("ry",t.stateBarCornerRadius).attr("width",3).attr("height",i-3).attr("fill",a=>e.displayModels[a.key]?.stateBarColor??e.widgetColors.dim),e.inverters.length>1?l.select("text.inverter-title").attr("x",t.titleX).attr("y",t.titleY).attr("font-size",t.titleFontSize).attr("fill",a=>e.displayModels[a.key]?.titleTextColor??"var(--kip-contrast-color)").text(a=>e.displayModels[a.key]?.titleText??this.resolveTitleText(a.inverter)):l.select("text.inverter-title").text(""),l.select("text.inverter-id").attr("x",t.idX).attr("y",t.idY).attr("text-anchor","end").attr("font-size",t.idFontSize).attr("fill","var(--kip-contrast-dim-color)").text(a=>a.inverter.id),l.select("text.inverter-mode").attr("x",t.metaLeftX).attr("y",t.metaY).attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",a=>e.displayModels[a.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(a=>e.displayModels[a.key]?.modeText??""),l.select("text.inverter-bus").attr("x",t.metaRightX).attr("y",t.metaY).attr("text-anchor","end").attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",a=>e.displayModels[a.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(a=>e.displayModels[a.key]?.busText??""),l.select("text.inverter-metrics-1").attr("x",t.lineOneX).attr("y",t.lineOneY).attr("font-size",t.lineOneFontSize).attr("fill",a=>e.displayModels[a.key]?.primaryMetricsTextColor??"var(--kip-contrast-color)").text(a=>e.displayModels[a.key]?.metricsLineOne??""),l.select("text.inverter-metrics-2").attr("x",t.lineTwoX).attr("y",t.lineTwoY).attr("font-size",t.lineTwoFontSize).attr("opacity",.85).attr("fill",a=>e.displayModels[a.key]?.secondaryMetricsTextColor??"var(--kip-contrast-color)").text(a=>e.displayModels[a.key]?.metricsLineTwo??""),s.exit().remove();}displayName(e){return e.name?.trim()||e.id}resolveTitleText(e){return e.name||`Inverter ${e.id}`}buildMetricRows(e){let r=this.cardMode();if(this.activeDisplayMode()==="full"){let i=e.acInVoltage!=null||e.acInCurrent!=null,o=this.formatValue(e.acInVoltage,"V"),d=this.formatValue(e.acInCurrent,"A"),s=this.formatValue(e.acOutVoltage??e.acVoltage,"V"),n=this.formatValue(e.acOutFrequency??e.acFrequency,"Hz");return [`DC ${this.formatValue(e.dcVoltage,"V")} ${this.formatValue(e.dcCurrent,"A")}`,i?`ACin ${o} ${d}`:`AC ${s} ${n}`]}let t=r.metrics.map(i=>this.toMetricLabel(i,e)).filter(i=>!!i);return t.length?[t.slice(0,2).join(" ")||" ",t.slice(2,4).join(" ")||" "]:["DC - -","AC - -"]}toMetricLabel(e,r){switch(e){case "dcVoltage":return `DC V ${this.formatValue(r.dcVoltage,"V")}`;case "dcCurrent":return `DC A ${this.formatValue(r.dcCurrent,"A")}`;case "dcPower":return `DC P ${this.formatValue(r.dcPower,"W")}`;case "acVoltage":return `AC V ${this.formatValue(r.acVoltage,"V")}`;case "acCurrent":return `AC A ${this.formatValue(r.acCurrent,"A")}`;case "acFrequency":return `Hz ${this.formatValue(r.acFrequency,"Hz")}`;case "acInVoltage":return `ACin V ${this.formatValue(r.acInVoltage,"V")}`;case "acInCurrent":return `ACin A ${this.formatValue(r.acInCurrent,"A")}`;case "acInFrequency":return `ACin Hz ${this.formatValue(r.acInFrequency,"Hz")}`;case "acInPower":return `ACin P ${this.formatValue(r.acInPower,"W")}`;case "acOutVoltage":return `ACout V ${this.formatValue(r.acOutVoltage,"V")}`;case "acOutCurrent":return `ACout A ${this.formatValue(r.acOutCurrent,"A")}`;case "acOutFrequency":return `ACout Hz ${this.formatValue(r.acOutFrequency,"Hz")}`;case "acOutPower":return `ACout P ${this.formatValue(r.acOutPower,"W")}`;case "acIn1CurrentLimit":return `ACin1 Lim ${this.formatValue(r.acIn1CurrentLimit,"A")}`;case "acInCurrentLimit":return `ACin Lim ${this.formatValue(r.acInCurrentLimit,"A")}`;case "temperature":return `T ${this.formatTemperature(r.temperature)}`;case "inverterModeNumber":return `Mode# ${r.inverterModeNumber?.toString()??"-"}`;default:return null}}formatValue(e,r){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${r}`}formatTemperature(e){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${this.units.getDefaults().Temperature==="celsius"?"\xB0C":"\xB0F"}`}toStringValue(e){return typeof e=="string"?e:null}resolveMostSevereState(...e){return e.some(r=>r===n$1.Alert)?n$1.Alert:e.some(r=>r===n$1.Alarm)?n$1.Alarm:e.some(r=>r===n$1.Warn)?n$1.Warn:e.some(r=>r===n$1.Normal)?n$1.Normal:null}toNumber(e,r){if(e==null||typeof e=="boolean")return null;let t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return null;let i=this.units.convertToUnit(r,t);return typeof i=="number"&&Number.isFinite(i)?i:null}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return true;if(e===0)return false}if(typeof e=="string"){let r=e.trim().toLowerCase();if(r==="true"||r==="1"||r==="on")return true;if(r==="false"||r==="0"||r==="off")return false}return null}static \u0275fac=function(r){return new(r||c$1)};static \u0275cmp=JD({type:c$1,selectors:[["widget-inverter"]],viewQuery:function(r,t){r&1&&eg(t.svgRef,re,5),r&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],renderMode:[1,"renderMode"]},decls:4,vars:3,consts:[["inverterSvg",""],[3,"text","color"],["aria-hidden","false",1,"inverter-svg"],[1,"inverter-empty"],[1,"inverter-empty-title"],[1,"inverter-empty-sub"]],template:function(r,t){r&1&&($h(0,"widget-title",1),wd(),$h(1,"svg",2,0),_w(3,ie,5,0,"div",3)),r&2&&(Bh("text",t.displayLabel())("color",t.labelColor()),EE(3),Mw(t.hasInverters()?-1:3));},dependencies:[x],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.inverter-svg[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20;padding:0 10px 10px}.inverter-empty[_ngcontent-%COMP%]{position:absolute;inset:0;margin:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--kip-widget-card-background-color) 92%,transparent)}.inverter-empty-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600}.inverter-empty-sub[_ngcontent-%COMP%]{font-size:14px;opacity:.8}"]})};export{Z as WidgetInverterComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d1 as Hj,w,du as p$1,aZ as R,$ as $j,v as vt,F as Fa,dn as ge,J as JD,cp as Uh,f as eg,K as Kw}from'./main-
|
|
1
|
+
import {d1 as Hj,w,du as p$1,aZ as R,$ as $j,v as vt,F as Fa,dn as ge,J as JD,cp as Uh,f as eg,K as Kw}from'./main-F7NMHHV4.js';var p=["canvasMainRef"],M=(()=>{class s{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p$1);canvas=w(R);static DEFAULT_CONFIG={displayName:"Static Label",color:"green",bgColor:"grey",noColor:false,noBgColor:true};canvasRef=$j.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;maxTextWidth=0;maxTextHeight=0;disposed=false;fgColor=vt("");bgColor=vt("");constructor(){Fa(()=>{let t=this.runtime.options(),e=this.theme();!t||!e||ge(()=>{this.fgColor.set(this.mapColor(t.color??"contrast",e)),this.bgColor.set(this.mapColor(t.bgColor??"grey",e)),this.draw();});}),Fa(()=>{let t=this.runtime.options()?.displayName;ge(()=>{t!==void 0&&this.draw();});});}mapColor(t,e){switch(t){case "contrast":return e.contrast;case "blue":return e.blue;case "green":return e.green;case "pink":return e.pink;case "orange":return e.orange;case "purple":return e.purple;case "grey":return e.grey;case "yellow":return e.yellow;default:return e.contrast}}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,this.draw();}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.draw();}draw(){if(!this.ctx||!this.canvasElement)return;let t=this.runtime.options();if(!t)return;this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),t.noBgColor||this.canvas.drawRectangle(this.ctx,0,0,this.canvasElement.width,this.canvasElement.height,this.bgColor());let e=t.displayName||"";this.canvas.drawText(this.ctx,e,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2+10),this.cssWidth-40,this.cssHeight-40,"bold",this.fgColor());}ngOnDestroy(){this.disposed=true;try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement);}catch(t){}}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=JD({type:s,selectors:[["widget-label"]],viewQuery:function(e,c){e&1&&eg(c.canvasRef,p,5),e&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"label-canvas"]],template:function(e,c){e&1&&Uh(0,"canvas",1,0);},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.label-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block;border-radius:var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium))}"]})}return s})();export{M as WidgetLabelComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d1 as Hj,w,du as p,dv as rt$1,cu as T,a as G,aZ as R,aY as xe,$ as $j,v as vt,bG as Bj,D as Dt,F as Fa,dn as ge,a_ as Gp,J as JD,b2 as Ln,b4 as Xe,b5 as Pn,b9 as rn,O as Op,bh as xp,y as yt,b as wt,cR as zt,bg as mt$1,bd as an,P as Pi,c as $h,u as ul,k as Qh,cn as wd,T as TT,_ as _w,e as EE,M as Mw,f as eg,K as Kw,g as qw,bp as gl,h as Fw,cV as Td,bi as Eg,bk as cD,bm as Ig,bo as lD,l as ud,m as dd,bj as ST}from'./main-YKDNK5VZ.js';import {c}from'./chunk-BIb-xYiS.js';var at=["canvasMainRef"];function ot(o,v){if(o&1&&(Pi(0,"div",8),wd(),Pi(1,"svg",11)(2,"text",12),TT(3),ul()()()),o&2){let t=qw();EE(3),gl("@ ",t.startAtTime());}}function st(o,v){if(o&1){let t=Fw();Pi(0,"button",13),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("start"))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",6)(3,"text",14),TT(4,"Start"),ul()()()(),Td(),Pi(5,"button",15),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-60))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",6)(8,"text",14),TT(9,"-1m"),ul()()()(),Td(),Pi(10,"button",16),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(60))}),Pi(11,"mat-icon",5),wd(),Pi(12,"svg",6)(13,"text",14),TT(14,"+1m"),ul()()()();}}function rt(o,v){if(o&1){let t=Fw();Pi(0,"button",17),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("sync"))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",18)(3,"text",19),TT(4,"Sync"),ul()()()(),Td(),Pi(5,"button",20),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("reset"))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",18)(8,"text",19),TT(9,"Reset"),ul()()()();}}function lt(o,v){if(o&1){let t=Fw();Pi(0,"button",21),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-60))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",22)(3,"text",23),TT(4,"-1m"),ul()()()(),Td(),Pi(5,"button",24),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-1))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",22)(8,"text",23),TT(9,"-1s"),ul()()()(),Td(),Pi(10,"button",25),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(1))}),Pi(11,"mat-icon",5),wd(),Pi(12,"svg",22)(13,"text",23),TT(14,"+1s"),ul()()()(),Td(),Pi(15,"button",26),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(60))}),Pi(16,"mat-icon",5),wd(),Pi(17,"svg",22)(18,"text",23),TT(19,"+1m"),ul()()()();}}function mt(o,v){if(o&1){let t=Fw();Pi(0,"input",27),Eg("ngModelChange",function(i){ud(t);let a=qw();return ST(a.startAtTimeEdit,i)||(a.startAtTimeEdit=i),dd(i)}),Qh("change",function(){ud(t);let i=qw();return dd(i.setStartTime())}),ul(),cD();}if(o&2){let t=qw();Ig("ngModel",t.startAtTimeEdit),lD();}}function ct(o,v){o&1&&$h(0,"div",10);}var Et=(()=>{class o{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:false,displayName:"TTS",nextDashboard:0,playBeeps:true,filterSelfPaths:true,paths:{ttsPath:{description:"Time to the Start in seconds",path:"self.navigation.racing.timeToStart",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:false,convertUnitTo:"s",showConvertUnitTo:false,showPathSkUnitsFilter:false,pathSkUnitsFilter:"s",sampleTime:500},startTimePath:{description:"Time of the start",path:"self.navigation.racing.startTime",source:"default",pathType:"Date",pathRequired:false,isPathConfigurable:false,sampleTime:500},dtsPath:{description:"Distance to Start Line path, used to determine OCS",path:"self.navigation.racing.distanceStartline",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:false,convertUnitTo:"m",showPathSkUnitsFilter:false,pathSkUnitsFilter:"m",sampleTime:500}},color:"contrast",enableTimeout:false,dataTimeout:5,ignoreZones:true};runtime=w(p);streams=w(rt$1);signalk=w(T);dashboard=w(G);canvas=w(R);destroyRef=w(xe);canvasRef=$j.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;labelColor=vt("");mode=vt(1);ttsValue=null;dtsValue=null;valueColor="";valueStateColor="";startAtTime=vt("00:00:00");startAtTimeEdit=Bj("");normalizedConfig=Dt(()=>this.runtime.options()??o.DEFAULT_CONFIG);constructor(){Fa(()=>{let t=this.normalizedConfig(),e=this.theme();e&&ge(()=>{let i=c(t.color??"contrast",e);this.labelColor.set(i.dim),this.valueColor=i.color,this.valueStateColor=i.color,this.draw();});}),Fa(()=>{let t=this.normalizedConfig();t.paths?.ttsPath?.path&&ge(()=>this.streams.observe("ttsPath",a=>{let s=this.ttsValue;this.ttsValue=a?.data?.value??null,this.updateValueColor(),this.draw(),this.shouldBeep(s,this.ttsValue)&&this.beepForValue(this.ttsValue),(t.nextDashboard??-1)>=0&&s===1&&this.ttsValue===0&&(!this.dtsValue||this.dtsValue>=0);}));}),Fa(()=>{this.normalizedConfig().paths?.startTimePath?.path&&ge(()=>this.streams.observe("startTimePath",a=>{let s=a?.data?.value;if(!s)this.startAtTime.set("HH:MM:SS"),this.startAtTimeEdit.set("HH:MM:SS"),this.mode()===2&&this.mode.set(1);else {let l=new Date(s);this.startAtTimeEdit.set(l.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})),this.startAtTime.set(this.startAtTimeEdit());}this.draw();}));}),Fa(()=>{this.normalizedConfig().paths?.dtsPath?.path&&ge(()=>this.streams.observe("dtsPath",a=>{this.dtsValue=a?.data?.value??null;}));}),this.signalk.subscribeRequest().pipe(Gp(this.destroyRef)).subscribe(t=>{t.widgetUUID===this.id()&&t.statusCode===200&&this.beep(600,20);});}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,this.draw();}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.draw();}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement);}catch(t){}}toggleMode(){this.mode.update(e=>(e+1)%5);let t=this.ttsValue;this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2),this.mode()===2&&t!==0&&!this.isStartTimerRunning()&&this.mode.set(3),this.draw();}sendStartTimerCommand(t){this.signalk.putRequest("navigation.racing.setStartTime",{command:t},this.id()),t==="start"&&this.mode.set(0),t==="reset"&&(this.startAtTime.set("HH:MM:SS"),this.mode.set(1));}adjustStartTime(t){this.signalk.putRequest("navigation.racing.setStartTime",{command:"adjust",delta:t},this.id());}setStartTime(){let t=new Date,e=this.startAtTimeEdit().split(":").map(Number),i=e[0],a=e[1],s=e.length>=3?e[2]:0,l=new Date(t);l.setHours(i,a,s,0),l<=t&&l.setDate(l.getDate()+1),this.mode.set(0),this.signalk.putRequest("navigation.racing.setStartTime",{command:"set",startTime:l.toISOString()},this.id());}isStartTimerRunning(){return (this.ttsValue??0)>0&&this.startAtTime()!==null&&this.startAtTime()!=="HH:MM:SS"}shouldBeep(t,e){return e==null||this.startAtTime()==="HH:MM:SS"||!this.runtime.options()?.playBeeps?false:e===0&&t!==0||e<10&&e>=0||e<60&&e%10===0?true:e%60===0}beepForValue(t){t===0?this.beep(500,1e3):t<10?this.beep(450,100):t<60&&t%10===0?this.beep(400,150):t%60===0&&this.beep(350,200);}updateValueColor(){let t=this.theme(),e=this.normalizedConfig();t&&(e.ignoreZones?this.ttsValue?this.ttsValue===0?this.valueStateColor=this.valueColor:this.ttsValue<10?this.valueStateColor=(this.dtsValue??0)<0?t.zoneAlarm:t.zoneWarn:this.ttsValue<60?this.valueStateColor=t.zoneAlert:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor,this.ttsValue===0?(this.mode.set(2),(this.dtsValue??0)<0&&(this.valueStateColor=t.zoneAlarm)):this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2));}toHHMMSS(t){if(t==null||isNaN(t))return "-:--";let e=t<0;e&&(t=-t);let i=Math.floor(t/3600),a=Math.floor(t%3600/60),s=Math.floor(t%60),l=e?"-":"";return i===0?`${l}${a.toString().padStart(1,"0")}:${s.toString().padStart(2,"0")}`:`${l}${i.toString().padStart(1,"0")}:${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}getValueText(){return this.toHHMMSS(this.ttsValue??0)}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options()?.displayName||"TTS",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==e||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(e,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=e,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.getValueText(),Math.floor(this.cssWidth*.5),Math.floor(this.cssHeight*.55),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.9),"bold",this.valueStateColor,"center","middle");}beep(t=440,e=100){if(!this.runtime.options()?.playBeeps)return;let i=window.AudioContext||window.webkitAudioContext,a=new i,s=a.createOscillator(),l=a.createGain();s.connect(l),l.connect(a.destination),s.type="sine",s.frequency.value=t,l.gain.value=.1,s.start(),s.stop(a.currentTime+e/1e3);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=JD({type:o,selectors:[["widget-racer-timer"]],viewQuery:function(e,i){e&1&&eg(i.canvasRef,at,5),e&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],startAtTimeEdit:[1,"startAtTimeEdit"]},outputs:{startAtTimeEdit:"startAtTimeEditChange"},decls:15,vars:2,consts:[["canvasMainRef",""],[1,"filler"],[1,"timer-canvas"],[1,"buttons-container"],["mat-flat-button","","matTooltip","Select the control mode",1,"button","select-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 80 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","40","y","9"],[1,"start-at"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModel"],[1,"widgetOverlay"],["width","100%","height","100%","viewBox","0 0 80 12","preserveAspectRatio","xMidYMid meet",1,"svg-content","svg-start-at"],["x","40","y","10"],["mat-flat-button","","matTooltip","Start the race timer",1,"button","main-button",3,"click"],["x","40","y","11"],["mat-flat-button","","matTooltip","Remove 1 minute from the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Add 1 minute to the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Sync the timer to nearest minute",1,"button","main-button",3,"click"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","50","y","11"],["mat-flat-button","","matTooltip","Stop and reset the timer",1,"button","other-button",3,"click"],["mat-flat-button","","matTooltip","Reduce the timer by 1 minute",1,"button","main-small-button",3,"click"],["width","100%","height","100%","viewBox","0 0 50 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","25","y","11"],["mat-flat-button","","matTooltip","Reduce the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 minute",1,"button","main-small-button",3,"click"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModelChange","change","ngModel"]],template:function(e,i){if(e&1&&(Pi(0,"div",1),$h(1,"canvas",2,0),ul(),Pi(3,"div",3)(4,"button",4),Qh("click",function(){return i.toggleMode()}),Pi(5,"mat-icon",5),wd(),Pi(6,"svg",6)(7,"text",7),TT(8,"\u22EE"),ul()()()(),_w(9,ot,4,1,"div",8)(10,st,15,0)(11,rt,10,0)(12,lt,20,0)(13,mt,1,1,"input",9),ul(),_w(14,ct,1,0,"div",10)),e&2){let a;EE(9),Mw((a=i.mode())===0?9:a===1?10:a===2?11:a===3?12:a===4?13:-1),EE(5),Mw(i.dashboard.isDashboardStatic()?-1:14);}},dependencies:[Ln,Xe,Pn,rn,Op,xp,yt,wt,zt,mt$1,an],styles:["[_nghost-%COMP%]{overflow:clip;display:block;height:100%;width:100%}.timer-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.timer-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}.filler[_ngcontent-%COMP%]{width:100%;height:76%}.buttons-container[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;justify-content:space-between;column-gap:2%;position:relative;height:24%;width:100%;padding:0 10px 14px;z-index:20;pointer-events:auto;align-items:center}.button[_ngcontent-%COMP%]{min-width:0px;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.select-button[_ngcontent-%COMP%]{flex:none;width:18%;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.set-start-at[_ngcontent-%COMP%]{flex:1 1 auto;background-color:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%]{height:100%;width:100%;flex:1 1 auto}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:9px;font-weight:400;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.svg-start-at[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color)}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"]})}return o})();export{Et as WidgetRacerTimerComponent};
|
|
1
|
+
import {d1 as Hj,w,du as p,dv as rt$1,cu as T,a as G,aZ as R,aY as xe,$ as $j,v as vt,bG as Bj,D as Dt,F as Fa,dn as ge,a_ as Gp,J as JD,b2 as Ln,b4 as Xe,b5 as Pn,b9 as rn,O as Op,bh as xp,y as yt,b as wt,cR as zt,bg as mt$1,bd as an,P as Pi,c as $h,u as ul,k as Qh,cn as wd,T as TT,_ as _w,e as EE,M as Mw,f as eg,K as Kw,g as qw,bp as gl,h as Fw,cV as Td,bi as Eg,bk as cD,bm as Ig,bo as lD,l as ud,m as dd,bj as ST}from'./main-F7NMHHV4.js';import {c}from'./chunk-CRy9Da7a.js';var at=["canvasMainRef"];function ot(o,v){if(o&1&&(Pi(0,"div",8),wd(),Pi(1,"svg",11)(2,"text",12),TT(3),ul()()()),o&2){let t=qw();EE(3),gl("@ ",t.startAtTime());}}function st(o,v){if(o&1){let t=Fw();Pi(0,"button",13),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("start"))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",6)(3,"text",14),TT(4,"Start"),ul()()()(),Td(),Pi(5,"button",15),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-60))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",6)(8,"text",14),TT(9,"-1m"),ul()()()(),Td(),Pi(10,"button",16),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(60))}),Pi(11,"mat-icon",5),wd(),Pi(12,"svg",6)(13,"text",14),TT(14,"+1m"),ul()()()();}}function rt(o,v){if(o&1){let t=Fw();Pi(0,"button",17),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("sync"))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",18)(3,"text",19),TT(4,"Sync"),ul()()()(),Td(),Pi(5,"button",20),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("reset"))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",18)(8,"text",19),TT(9,"Reset"),ul()()()();}}function lt(o,v){if(o&1){let t=Fw();Pi(0,"button",21),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-60))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",22)(3,"text",23),TT(4,"-1m"),ul()()()(),Td(),Pi(5,"button",24),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-1))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",22)(8,"text",23),TT(9,"-1s"),ul()()()(),Td(),Pi(10,"button",25),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(1))}),Pi(11,"mat-icon",5),wd(),Pi(12,"svg",22)(13,"text",23),TT(14,"+1s"),ul()()()(),Td(),Pi(15,"button",26),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(60))}),Pi(16,"mat-icon",5),wd(),Pi(17,"svg",22)(18,"text",23),TT(19,"+1m"),ul()()()();}}function mt(o,v){if(o&1){let t=Fw();Pi(0,"input",27),Eg("ngModelChange",function(i){ud(t);let a=qw();return ST(a.startAtTimeEdit,i)||(a.startAtTimeEdit=i),dd(i)}),Qh("change",function(){ud(t);let i=qw();return dd(i.setStartTime())}),ul(),cD();}if(o&2){let t=qw();Ig("ngModel",t.startAtTimeEdit),lD();}}function ct(o,v){o&1&&$h(0,"div",10);}var Et=(()=>{class o{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:false,displayName:"TTS",nextDashboard:0,playBeeps:true,filterSelfPaths:true,paths:{ttsPath:{description:"Time to the Start in seconds",path:"self.navigation.racing.timeToStart",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:false,convertUnitTo:"s",showConvertUnitTo:false,showPathSkUnitsFilter:false,pathSkUnitsFilter:"s",sampleTime:500},startTimePath:{description:"Time of the start",path:"self.navigation.racing.startTime",source:"default",pathType:"Date",pathRequired:false,isPathConfigurable:false,sampleTime:500},dtsPath:{description:"Distance to Start Line path, used to determine OCS",path:"self.navigation.racing.distanceStartline",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:false,convertUnitTo:"m",showPathSkUnitsFilter:false,pathSkUnitsFilter:"m",sampleTime:500}},color:"contrast",enableTimeout:false,dataTimeout:5,ignoreZones:true};runtime=w(p);streams=w(rt$1);signalk=w(T);dashboard=w(G);canvas=w(R);destroyRef=w(xe);canvasRef=$j.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;labelColor=vt("");mode=vt(1);ttsValue=null;dtsValue=null;valueColor="";valueStateColor="";startAtTime=vt("00:00:00");startAtTimeEdit=Bj("");normalizedConfig=Dt(()=>this.runtime.options()??o.DEFAULT_CONFIG);constructor(){Fa(()=>{let t=this.normalizedConfig(),e=this.theme();e&&ge(()=>{let i=c(t.color??"contrast",e);this.labelColor.set(i.dim),this.valueColor=i.color,this.valueStateColor=i.color,this.draw();});}),Fa(()=>{let t=this.normalizedConfig();t.paths?.ttsPath?.path&&ge(()=>this.streams.observe("ttsPath",a=>{let s=this.ttsValue;this.ttsValue=a?.data?.value??null,this.updateValueColor(),this.draw(),this.shouldBeep(s,this.ttsValue)&&this.beepForValue(this.ttsValue),(t.nextDashboard??-1)>=0&&s===1&&this.ttsValue===0&&(!this.dtsValue||this.dtsValue>=0);}));}),Fa(()=>{this.normalizedConfig().paths?.startTimePath?.path&&ge(()=>this.streams.observe("startTimePath",a=>{let s=a?.data?.value;if(!s)this.startAtTime.set("HH:MM:SS"),this.startAtTimeEdit.set("HH:MM:SS"),this.mode()===2&&this.mode.set(1);else {let l=new Date(s);this.startAtTimeEdit.set(l.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})),this.startAtTime.set(this.startAtTimeEdit());}this.draw();}));}),Fa(()=>{this.normalizedConfig().paths?.dtsPath?.path&&ge(()=>this.streams.observe("dtsPath",a=>{this.dtsValue=a?.data?.value??null;}));}),this.signalk.subscribeRequest().pipe(Gp(this.destroyRef)).subscribe(t=>{t.widgetUUID===this.id()&&t.statusCode===200&&this.beep(600,20);});}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,this.draw();}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.draw();}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement);}catch(t){}}toggleMode(){this.mode.update(e=>(e+1)%5);let t=this.ttsValue;this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2),this.mode()===2&&t!==0&&!this.isStartTimerRunning()&&this.mode.set(3),this.draw();}sendStartTimerCommand(t){this.signalk.putRequest("navigation.racing.setStartTime",{command:t},this.id()),t==="start"&&this.mode.set(0),t==="reset"&&(this.startAtTime.set("HH:MM:SS"),this.mode.set(1));}adjustStartTime(t){this.signalk.putRequest("navigation.racing.setStartTime",{command:"adjust",delta:t},this.id());}setStartTime(){let t=new Date,e=this.startAtTimeEdit().split(":").map(Number),i=e[0],a=e[1],s=e.length>=3?e[2]:0,l=new Date(t);l.setHours(i,a,s,0),l<=t&&l.setDate(l.getDate()+1),this.mode.set(0),this.signalk.putRequest("navigation.racing.setStartTime",{command:"set",startTime:l.toISOString()},this.id());}isStartTimerRunning(){return (this.ttsValue??0)>0&&this.startAtTime()!==null&&this.startAtTime()!=="HH:MM:SS"}shouldBeep(t,e){return e==null||this.startAtTime()==="HH:MM:SS"||!this.runtime.options()?.playBeeps?false:e===0&&t!==0||e<10&&e>=0||e<60&&e%10===0?true:e%60===0}beepForValue(t){t===0?this.beep(500,1e3):t<10?this.beep(450,100):t<60&&t%10===0?this.beep(400,150):t%60===0&&this.beep(350,200);}updateValueColor(){let t=this.theme(),e=this.normalizedConfig();t&&(e.ignoreZones?this.ttsValue?this.ttsValue===0?this.valueStateColor=this.valueColor:this.ttsValue<10?this.valueStateColor=(this.dtsValue??0)<0?t.zoneAlarm:t.zoneWarn:this.ttsValue<60?this.valueStateColor=t.zoneAlert:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor,this.ttsValue===0?(this.mode.set(2),(this.dtsValue??0)<0&&(this.valueStateColor=t.zoneAlarm)):this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2));}toHHMMSS(t){if(t==null||isNaN(t))return "-:--";let e=t<0;e&&(t=-t);let i=Math.floor(t/3600),a=Math.floor(t%3600/60),s=Math.floor(t%60),l=e?"-":"";return i===0?`${l}${a.toString().padStart(1,"0")}:${s.toString().padStart(2,"0")}`:`${l}${i.toString().padStart(1,"0")}:${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}getValueText(){return this.toHHMMSS(this.ttsValue??0)}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options()?.displayName||"TTS",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==e||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(e,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=e,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.getValueText(),Math.floor(this.cssWidth*.5),Math.floor(this.cssHeight*.55),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.9),"bold",this.valueStateColor,"center","middle");}beep(t=440,e=100){if(!this.runtime.options()?.playBeeps)return;let i=window.AudioContext||window.webkitAudioContext,a=new i,s=a.createOscillator(),l=a.createGain();s.connect(l),l.connect(a.destination),s.type="sine",s.frequency.value=t,l.gain.value=.1,s.start(),s.stop(a.currentTime+e/1e3);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=JD({type:o,selectors:[["widget-racer-timer"]],viewQuery:function(e,i){e&1&&eg(i.canvasRef,at,5),e&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],startAtTimeEdit:[1,"startAtTimeEdit"]},outputs:{startAtTimeEdit:"startAtTimeEditChange"},decls:15,vars:2,consts:[["canvasMainRef",""],[1,"filler"],[1,"timer-canvas"],[1,"buttons-container"],["mat-flat-button","","matTooltip","Select the control mode",1,"button","select-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 80 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","40","y","9"],[1,"start-at"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModel"],[1,"widgetOverlay"],["width","100%","height","100%","viewBox","0 0 80 12","preserveAspectRatio","xMidYMid meet",1,"svg-content","svg-start-at"],["x","40","y","10"],["mat-flat-button","","matTooltip","Start the race timer",1,"button","main-button",3,"click"],["x","40","y","11"],["mat-flat-button","","matTooltip","Remove 1 minute from the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Add 1 minute to the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Sync the timer to nearest minute",1,"button","main-button",3,"click"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","50","y","11"],["mat-flat-button","","matTooltip","Stop and reset the timer",1,"button","other-button",3,"click"],["mat-flat-button","","matTooltip","Reduce the timer by 1 minute",1,"button","main-small-button",3,"click"],["width","100%","height","100%","viewBox","0 0 50 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","25","y","11"],["mat-flat-button","","matTooltip","Reduce the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 minute",1,"button","main-small-button",3,"click"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModelChange","change","ngModel"]],template:function(e,i){if(e&1&&(Pi(0,"div",1),$h(1,"canvas",2,0),ul(),Pi(3,"div",3)(4,"button",4),Qh("click",function(){return i.toggleMode()}),Pi(5,"mat-icon",5),wd(),Pi(6,"svg",6)(7,"text",7),TT(8,"\u22EE"),ul()()()(),_w(9,ot,4,1,"div",8)(10,st,15,0)(11,rt,10,0)(12,lt,20,0)(13,mt,1,1,"input",9),ul(),_w(14,ct,1,0,"div",10)),e&2){let a;EE(9),Mw((a=i.mode())===0?9:a===1?10:a===2?11:a===3?12:a===4?13:-1),EE(5),Mw(i.dashboard.isDashboardStatic()?-1:14);}},dependencies:[Ln,Xe,Pn,rn,Op,xp,yt,wt,zt,mt$1,an],styles:["[_nghost-%COMP%]{overflow:clip;display:block;height:100%;width:100%}.timer-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.timer-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}.filler[_ngcontent-%COMP%]{width:100%;height:76%}.buttons-container[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;justify-content:space-between;column-gap:2%;position:relative;height:24%;width:100%;padding:0 10px 14px;z-index:20;pointer-events:auto;align-items:center}.button[_ngcontent-%COMP%]{min-width:0px;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.select-button[_ngcontent-%COMP%]{flex:none;width:18%;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.set-start-at[_ngcontent-%COMP%]{flex:1 1 auto;background-color:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%]{height:100%;width:100%;flex:1 1 auto}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:9px;font-weight:400;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.svg-start-at[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color)}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"]})}return o})();export{Et as WidgetRacerTimerComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d1 as Hj,w,du as p,dv as rt,aZ as R,$ as $j,v as vt,D as Dt,F as Fa,dn as ge,J as JD,cp as Uh,f as eg,K as Kw}from'./main-
|
|
1
|
+
import {d1 as Hj,w,du as p,dv as rt,aZ as R,$ as $j,v as vt,D as Dt,F as Fa,dn as ge,J as JD,cp as Uh,f as eg,K as Kw}from'./main-F7NMHHV4.js';import {c}from'./chunk-CRy9Da7a.js';var P=["canvasMainRef"],B=(()=>{class s{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);streams=w(rt);canvas=w(R);canvasRef=$j.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;maxTextWidth=0;maxTextHeight=0;middle=0;center=0;fontSizeOffset=0;latPos="";longPos="";labelColor=vt("");valueColor="";normalizedConfig=Dt(()=>this.runtime.options()??s.DEFAULT_CONFIG);positionPaths=Dt(()=>this.normalizedConfig().paths??{});static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:false,displayName:"Position",filterSelfPaths:true,paths:{longPath:{description:"Longitude",path:"self.navigation.position.longitude",source:"default",pathType:"number",isPathConfigurable:true,convertUnitTo:"longitudeMin",showPathSkUnitsFilter:true,pathSkUnitsFilter:null,sampleTime:500},latPath:{description:"Latitude",path:"self.navigation.position.latitude",source:"default",pathType:"number",isPathConfigurable:true,convertUnitTo:"latitudeMin",showPathSkUnitsFilter:true,pathSkUnitsFilter:null,sampleTime:500}},color:"contrast",enableTimeout:false,dataTimeout:5};constructor(){Fa(()=>{let e=this.normalizedConfig(),t=this.theme();t&&ge(()=>{let i=c(e.color??"contrast",t);this.labelColor.set(i.dim),this.valueColor=i.color,this.draw();});}),Fa(()=>{let e=this.positionPaths().longPath;e?.path&&ge(()=>this.streams.observe("longPath",t=>{let i=t?.data?.value;i==null?this.longPos="":e.convertUnitTo==="pdeg"?this.longPos=i.toFixed(6)+"\xB0":this.longPos=String(i),this.calculateFontSizeAndPositions(),this.draw();}));}),Fa(()=>{let e=this.positionPaths().latPath;e?.path&&ge(()=>this.streams.observe("latPath",t=>{let i=t?.data?.value;i==null?this.latPos="":e.convertUnitTo==="pdeg"?this.latPos=i.toFixed(7)+"\xB0":this.latPos=String(i),this.calculateFontSizeAndPositions(),this.draw();}));});}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.calculateFontSizeAndPositions(),this.draw();}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.calculateFontSizeAndPositions(),this.draw();}calculateFontSizeAndPositions(){if(!this.cssWidth||!this.cssHeight)return;this.maxTextHeight=Math.floor(this.cssHeight*.6/2),this.maxTextWidth=Math.floor(this.cssWidth*.85),this.center=this.cssWidth/2,this.middle=this.cssHeight*.57;let e=this.latPos.length>this.longPos.length?this.latPos:this.longPos;if(this.ctx){let t=this.canvas.calculateOptimalFontSize(this.ctx,e,this.maxTextWidth,this.maxTextHeight,"bold");this.fontSizeOffset=Math.floor(t*5e-4);}}draw(){if(!this.ctx||!this.canvasElement)return;let t=this.normalizedConfig().displayName||"Position",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==t||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.latPos,this.center,this.middle-this.fontSizeOffset,this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor,"center","bottom"),this.canvas.drawText(this.ctx,this.longPos,this.center,this.middle+this.fontSizeOffset,this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor,"center","top");}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement);}catch(e){}}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=JD({type:s,selectors:[["widget-position"]],viewQuery:function(t,i){t&1&&eg(i.canvasRef,P,5),t&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"position-canvas"]],template:function(t,i){t&1&&Uh(0,"canvas",1,0);},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.position-canvas[_ngcontent-%COMP%]{display:block;width:100%!important;height:100%!important;min-height:1px}"]})}return s})();export{B as WidgetPositionComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {O}from'./chunk-x7L6DXVK.js';import {w,aS as De,aY as xe$1,a7 as Gj,i as ir,aR as lt$1,ab as te,$ as $j,cN as Wl,a_ as Gp,W as Wp,E as Em,F as Fa,cO as eu,cP as Z,as as ke,J as JD,cQ as ce,bb as rt$1,bc as ae$1,bH as ln$1,bd as an$1,O as Op,o as eu$1,y as yt,b as wt,cR as zt,bg as mt,c as $h,P as Pi$1,T as TT,u as ul,k as Qh,cS as pl,cf as xh,cT as hl,B as Bh,e as EE,f as eg,K as Kw,aB as gr,aF as Pr,ac as Mr,cU as $n,az as Yj,ad as Qe$1,aa as N,bA as Ft,bB as F,al as Zj,_ as _w,cn as wd,cV as Td,M as Mw,bp as gl,an as Hh,cW as Ur,ak as nw,ay as lv,cX as Xt,aq as Bn$1,cY as Io,aj as zm,cZ as Tm,c_ as Fm,c2 as bh,c3 as Qs,c4 as Fn$1,c8 as Sv,c9 as Sh,bV as Gw,bW as zw,am as LT,s as sg,c$ as Wh,bI as Lt,bQ as Dn$1,a6 as Lr,d0 as dh,bR as ot$1,v as vt,aD as Ce,bS as oa,ci as dl,cj as fl,bu as ut,aQ as ee,d1 as Hj,bh as xp,aA as gg,h as Fw,l as ud,g as qw,m as dd,X as xw,Y as Aw,bl as Jw,d2 as wt$1,d3 as ib,a9 as ru,cl as G,aC as L,ae as be,d4 as gi,bT as Lg,ag as bu,d5 as jt,d6 as _,d7 as Ce$1,d8 as Y$1,d9 as Cm,da as Qm,aJ as wm,db as Dm,ca as Kh,c0 as Zw,c1 as Yw,ap as Ki$1,co as Mr$1,dc as O$1,dd as $e$1,de as Nt,df as Vt,dg as pt,dh as zt$1,di as jt$1,bi as Eg,bj as ST,dj as Nw,bm as Ig,dk as Vh,at as Tp,cp as Uh}from'./main-YKDNK5VZ.js';var Vi=[[["caption"]],[["colgroup"],["col"]],"*"],Ui=["caption","colgroup, col","*"];function $i(i,o){i&1&&zw(0,2);}function Qi(i,o){i&1&&(Pi$1(0,"thead",0),Wh(1,1),ul(),Pi$1(2,"tbody",0),Wh(3,2)(4,3),ul(),Pi$1(5,"tfoot",0),Wh(6,4),ul());}function Wi(i,o){i&1&&Wh(0,1)(1,2)(2,3)(3,4);}var A=new N("CDK_TABLE");var Ue=(()=>{class i{template=w(Mr$1);static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkCellDef",""]]})}return i})(),$e=(()=>{class i{template=w(Mr$1);static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkHeaderCellDef",""]]})}return i})(),Ci=(()=>{class i{template=w(Mr$1);static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkFooterCellDef",""]]})}return i})(),Y=(()=>{class i{_table=w(A,{optional:true});_hasStickyChanged=false;get name(){return this._name}set name(e){this._setNameInput(e);}_name;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=true);}_sticky=false;get stickyEnd(){return this._stickyEnd}set stickyEnd(e){e!==this._stickyEnd&&(this._stickyEnd=e,this._hasStickyChanged=true);}_stickyEnd=false;cell;headerCell;footerCell;cssClassFriendlyName;_columnCssClassName;hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=false;}_updateColumnCssClassName(){this._columnCssClassName=[`cdk-column-${this.cssClassFriendlyName}`];}_setNameInput(e){e&&(this._name=e,this.cssClassFriendlyName=e.replace(/[^a-z0-9_-]/gi,"-"),this._updateColumnCssClassName());}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkColumnDef",""]],contentQueries:function(t,n,a){if(t&1&&Kh(a,Ue,5)(a,$e,5)(a,Ci,5),t&2){let r;Zw(r=Yw())&&(n.cell=r.first),Zw(r=Yw())&&(n.headerCell=r.first),Zw(r=Yw())&&(n.footerCell=r.first);}},inputs:{name:[0,"cdkColumnDef","name"],sticky:[2,"sticky","sticky",Zj],stickyEnd:[2,"stickyEnd","stickyEnd",Zj]}})}return i})(),Ve=class{constructor(o,e){e.nativeElement.classList.add(...o._columnCssClassName);}},bi=(()=>{class i extends Ve{constructor(){super(w(Y),w(Lr));}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["cdk-header-cell"],["th","cdk-header-cell",""]],hostAttrs:["role","columnheader",1,"cdk-header-cell"],features:[Sh]})}return i})();var Di=(()=>{class i extends Ve{constructor(){let e=w(Y),t=w(Lr);super(e,t);let n=e._table?._getCellRole();n&&t.nativeElement.setAttribute("role",n);}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["cdk-cell"],["td","cdk-cell",""]],hostAttrs:[1,"cdk-cell"],features:[Sh]})}return i})();var tt=(()=>{class i{template=w(Mr$1);_differs=w(ib);columns;_columnsDiffer;ngOnChanges(e){if(!this._columnsDiffer){let t=e.columns&&e.columns.currentValue||[];this._columnsDiffer=this._differs.find(t).create(),this._columnsDiffer.diff(t);}}getColumnsDiff(){return this._columnsDiffer.diff(this.columns)}extractCellTemplate(e){return this instanceof Me?e.headerCell.template:this instanceof it?e.footerCell.template:e.cell.template}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,features:[lv]})}return i})(),Me=(()=>{class i extends tt{_table=w(A,{optional:true});_hasStickyChanged=false;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=true);}_sticky=false;ngOnChanges(e){super.ngOnChanges(e);}hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=false;}static \u0275fac=(()=>{let e;return function(n){return (e||(e=Sv(i)))(n||i)}})();static \u0275dir=nw({type:i,selectors:[["","cdkHeaderRowDef",""]],inputs:{columns:[0,"cdkHeaderRowDef","columns"],sticky:[2,"cdkHeaderRowDefSticky","sticky",Zj]},features:[Sh,lv]})}return i})(),it=(()=>{class i extends tt{_table=w(A,{optional:true});_hasStickyChanged=false;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=true);}_sticky=false;ngOnChanges(e){super.ngOnChanges(e);}hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=false;}static \u0275fac=(()=>{let e;return function(n){return (e||(e=Sv(i)))(n||i)}})();static \u0275dir=nw({type:i,selectors:[["","cdkFooterRowDef",""]],inputs:{columns:[0,"cdkFooterRowDef","columns"],sticky:[2,"cdkFooterRowDefSticky","sticky",Zj]},features:[Sh,lv]})}return i})(),Qe=(()=>{class i extends tt{_table=w(A,{optional:true});when;static \u0275fac=(()=>{let e;return function(n){return (e||(e=Sv(i)))(n||i)}})();static \u0275dir=nw({type:i,selectors:[["","cdkRowDef",""]],inputs:{columns:[0,"cdkRowDefColumns","columns"],when:[0,"cdkRowDefWhen","when"]},features:[Sh]})}return i})(),ae=(()=>{class i{_viewContainer=w(Ki$1);cells;context;static mostRecentCellOutlet=null;constructor(){i.mostRecentCellOutlet=this;}ngOnDestroy(){i.mostRecentCellOutlet===this&&(i.mostRecentCellOutlet=null);}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkCellOutlet",""]]})}return i})(),nt=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275cmp=JD({type:i,selectors:[["cdk-header-row"],["tr","cdk-header-row",""]],hostAttrs:["role","row",1,"cdk-header-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,n){t&1&&Wh(0,0);},dependencies:[ae],encapsulation:2,changeDetection:1})}return i})();var ot=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275cmp=JD({type:i,selectors:[["cdk-row"],["tr","cdk-row",""]],hostAttrs:["role","row",1,"cdk-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,n){t&1&&Wh(0,0);},dependencies:[ae],encapsulation:2,changeDetection:1})}return i})(),We=(()=>{class i{templateRef=w(Mr$1);_contentClassNames=["cdk-no-data-row","cdk-row"];_cellClassNames=["cdk-cell","cdk-no-data-cell"];_cellSelector="td, cdk-cell, [cdk-cell], .cdk-cell";static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["ng-template","cdkNoDataRow",""]]})}return i})(),yi=["top","bottom","left","right"],et=class{_isNativeHtmlTable;_stickCellCss;_isBrowser;_needsPositionStickyOnElement;direction;_positionListener;_tableInjector;_elemSizeCache=new WeakMap;_resizeObserver=globalThis?.ResizeObserver?new globalThis.ResizeObserver(o=>this._updateCachedSizes(o)):null;_updatedStickyColumnsParamsToReplay=[];_stickyColumnsReplayTimeout=null;_cachedCellWidths=[];_borderCellCss;_destroyed=false;constructor(o,e,t=true,n=true,a,r,l){this._isNativeHtmlTable=o,this._stickCellCss=e,this._isBrowser=t,this._needsPositionStickyOnElement=n,this.direction=a,this._positionListener=r,this._tableInjector=l,this._borderCellCss={top:`${e}-border-elem-top`,bottom:`${e}-border-elem-bottom`,left:`${e}-border-elem-left`,right:`${e}-border-elem-right`};}clearStickyPositioning(o,e){(e.includes("left")||e.includes("right"))&&this._removeFromStickyColumnReplayQueue(o);let t=[];for(let n of o)n.nodeType===n.ELEMENT_NODE&&t.push(n,...Array.from(n.children));Tp({write:()=>{for(let n of t)this._removeStickyStyle(n,e);}},{injector:this._tableInjector});}updateStickyColumns(o,e,t,n=true,a=true){if(!o.length||!this._isBrowser||!(e.some(P=>P)||t.some(P=>P))){this._positionListener?.stickyColumnsUpdated({sizes:[]}),this._positionListener?.stickyEndColumnsUpdated({sizes:[]});return}let r=o[0],l=r.children.length,u=this.direction==="rtl",p=u?"right":"left",g=u?"left":"right",w=e.lastIndexOf(true),S=t.indexOf(true),R,mt,ut;a&&this._updateStickyColumnReplayQueue({rows:[...o],stickyStartStates:[...e],stickyEndStates:[...t]}),Tp({earlyRead:()=>{R=this._getCellWidths(r,n),mt=this._getStickyStartColumnPositions(R,e),ut=this._getStickyEndColumnPositions(R,t);},write:()=>{for(let P of o)for(let I=0;I<l;I++){let ft=P.children[I];e[I]&&this._addStickyStyle(ft,p,mt[I],I===w),t[I]&&this._addStickyStyle(ft,g,ut[I],I===S);}this._positionListener&&R.some(P=>!!P)&&(this._positionListener.stickyColumnsUpdated({sizes:w===-1?[]:R.slice(0,w+1).map((P,I)=>e[I]?P:null)}),this._positionListener.stickyEndColumnsUpdated({sizes:S===-1?[]:R.slice(S).map((P,I)=>t[I+S]?P:null).reverse()}));}},{injector:this._tableInjector});}stickRows(o,e,t){if(!this._isBrowser)return;let n=t==="bottom"?o.slice().reverse():o,a=t==="bottom"?e.slice().reverse():e,r=[],l=[],u=[];Tp({earlyRead:()=>{for(let p=0,g=0;p<n.length;p++){if(!a[p])continue;r[p]=g;let w=n[p];u[p]=this._isNativeHtmlTable?Array.from(w.children):[w];let S=this._retrieveElementSize(w).height;g+=S,l[p]=S;}},write:()=>{let p=a.lastIndexOf(true);for(let g=0;g<n.length;g++){if(!a[g])continue;let w=r[g],S=g===p;for(let R of u[g])this._addStickyStyle(R,t,w,S);}t==="top"?this._positionListener?.stickyHeaderRowsUpdated({sizes:l,offsets:r,elements:u}):this._positionListener?.stickyFooterRowsUpdated({sizes:l,offsets:r,elements:u});}},{injector:this._tableInjector});}updateStickyFooterContainer(o,e){this._isNativeHtmlTable&&Tp({write:()=>{let t=o.querySelector("tfoot");t&&(e.some(n=>!n)?this._removeStickyStyle(t,["bottom"]):this._addStickyStyle(t,"bottom",0,false));}},{injector:this._tableInjector});}destroy(){this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._resizeObserver?.disconnect(),this._destroyed=true;}_removeStickyStyle(o,e){if(!o.classList.contains(this._stickCellCss))return;for(let n of e)o.style[n]="",o.classList.remove(this._borderCellCss[n]);yi.some(n=>e.indexOf(n)===-1&&o.style[n])?o.style.zIndex=this._getCalculatedZIndex(o):(o.style.zIndex="",this._needsPositionStickyOnElement&&(o.style.position=""),o.classList.remove(this._stickCellCss));}_addStickyStyle(o,e,t,n){o.classList.add(this._stickCellCss),n&&o.classList.add(this._borderCellCss[e]),o.style[e]=`${t}px`,o.style.zIndex=this._getCalculatedZIndex(o),this._needsPositionStickyOnElement&&(o.style.cssText+="position: -webkit-sticky; position: sticky; ");}_getCalculatedZIndex(o){let e={top:100,bottom:10,left:1,right:1},t=0;for(let n of yi)o.style[n]&&(t+=e[n]);return t?`${t}`:""}_getCellWidths(o,e=true){if(!e&&this._cachedCellWidths.length)return this._cachedCellWidths;let t=[],n=o.children;for(let a=0;a<n.length;a++){let r=n[a];t.push(this._retrieveElementSize(r).width);}return this._cachedCellWidths=t,t}_getStickyStartColumnPositions(o,e){let t=[],n=0;for(let a=0;a<o.length;a++)e[a]&&(t[a]=n,n+=o[a]);return t}_getStickyEndColumnPositions(o,e){let t=[],n=0;for(let a=o.length;a>0;a--)e[a]&&(t[a]=n,n+=o[a]);return t}_retrieveElementSize(o){let e=this._elemSizeCache.get(o);if(e)return e;let t=o.getBoundingClientRect(),n={width:t.width,height:t.height};return this._resizeObserver&&(this._elemSizeCache.set(o,n),this._resizeObserver.observe(o,{box:"border-box"})),n}_updateStickyColumnReplayQueue(o){this._removeFromStickyColumnReplayQueue(o.rows),this._stickyColumnsReplayTimeout||this._updatedStickyColumnsParamsToReplay.push(o);}_removeFromStickyColumnReplayQueue(o){let e=new Set(o);for(let t of this._updatedStickyColumnsParamsToReplay)t.rows=t.rows.filter(n=>!e.has(n));this._updatedStickyColumnsParamsToReplay=this._updatedStickyColumnsParamsToReplay.filter(t=>!!t.rows.length);}_updateCachedSizes(o){let e=false;for(let t of o){let n=t.borderBoxSize?.length?{width:t.borderBoxSize[0].inlineSize,height:t.borderBoxSize[0].blockSize}:{width:t.contentRect.width,height:t.contentRect.height};n.width!==this._elemSizeCache.get(t.target)?.width&&qi(t.target)&&(e=true),this._elemSizeCache.set(t.target,n);}e&&this._updatedStickyColumnsParamsToReplay.length&&(this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._stickyColumnsReplayTimeout=setTimeout(()=>{if(!this._destroyed){for(let t of this._updatedStickyColumnsParamsToReplay)this.updateStickyColumns(t.rows,t.stickyStartStates,t.stickyEndStates,true,false);this._updatedStickyColumnsParamsToReplay=[],this._stickyColumnsReplayTimeout=null;}},0));}};function qi(i){return ["cdk-cell","cdk-header-cell","cdk-footer-cell"].some(o=>i.classList.contains(o))}var xe=new N("STICKY_POSITIONING_LISTENER");var at=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._rowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","rowOutlet",""]]})}return i})(),rt=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._headerRowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","headerRowOutlet",""]]})}return i})(),st=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._footerRowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","footerRowOutlet",""]]})}return i})(),lt=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._noDataRowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","noDataRowOutlet",""]]})}return i})(),ct=(()=>{class i{_differs=w(ib);_changeDetectorRef=w(Gj);_elementRef=w(Lr);_dir=w(ru,{optional:true});_platform=w(G);_viewRepeater;_viewportRuler=w(L);_injector=w(be);_virtualScrollViewport=w(gi,{optional:true,host:true});_positionListener=w(xe,{optional:true})||w(xe,{optional:true,skipSelf:true});_document=w(gr);_data;_renderedRange;_onDestroy=new te;_renderRows;_renderChangeSubscription=null;_columnDefsByName=new Map;_rowDefs;_headerRowDefs;_footerRowDefs;_dataDiffer;_defaultRowDef=null;_customColumnDefs=new Set;_customRowDefs=new Set;_customHeaderRowDefs=new Set;_customFooterRowDefs=new Set;_customNoDataRow=null;_headerRowDefChanged=true;_footerRowDefChanged=true;_stickyColumnStylesNeedReset=true;_forceRecalculateCellWidths=true;_cachedRenderRowsMap=new Map;_isNativeHtmlTable;_stickyStyler;stickyCssClass="cdk-table-sticky";needsPositionStickyOnElement=true;_isServer;_isShowingNoDataRow=false;_hasAllOutlets=false;_hasInitialized=false;_headerRowStickyUpdates=new te;_footerRowStickyUpdates=new te;_disableVirtualScrolling=false;_getCellRole(){if(this._cellRoleInternal===void 0){let e=this._elementRef.nativeElement.getAttribute("role");return e==="grid"||e==="treegrid"?"gridcell":"cell"}return this._cellRoleInternal}_cellRoleInternal=void 0;get trackBy(){return this._trackByFn}set trackBy(e){this._trackByFn=e;}_trackByFn;get dataSource(){return this._dataSource}set dataSource(e){this._dataSource!==e&&(this._switchDataSource(e),this._changeDetectorRef.markForCheck());}_dataSource;_dataSourceChanges=new te;_dataStream=new te;get multiTemplateDataRows(){return this._multiTemplateDataRows}set multiTemplateDataRows(e){this._multiTemplateDataRows=e,this._rowOutlet&&this._rowOutlet.viewContainer.length&&(this._forceRenderDataRows(),this.updateStickyColumnStyles());}_multiTemplateDataRows=false;get fixedLayout(){return this._virtualScrollEnabled()?true:this._fixedLayout}set fixedLayout(e){this._fixedLayout=e,this._forceRecalculateCellWidths=true,this._stickyColumnStylesNeedReset=true;}_fixedLayout=false;recycleRows=false;contentChanged=new Qe$1;viewChange=new Bn$1({start:0,end:Number.MAX_VALUE});_rowOutlet;_headerRowOutlet;_footerRowOutlet;_noDataRowOutlet;_contentColumnDefs;_contentRowDefs;_contentHeaderRowDefs;_contentFooterRowDefs;_noDataRow;get renderedRows(){return this._renderRows}constructor(){w(new Lg("role"),{optional:true})||this._elementRef.nativeElement.setAttribute("role","table"),this._isServer=!this._platform.isBrowser,this._isNativeHtmlTable=this._elementRef.nativeElement.nodeName==="TABLE",this._dataDiffer=this._differs.find([]).create((t,n)=>this.trackBy?this.trackBy(n.dataIndex,n.data):n);}ngOnInit(){this._setupStickyStyler(),this._viewportRuler.change().pipe(bu(this._onDestroy)).subscribe(()=>{this._forceRecalculateCellWidths=true;});}ngAfterContentInit(){this._viewRepeater=this.recycleRows||this._virtualScrollEnabled()?new jt:new _,this._virtualScrollEnabled()&&this._setupVirtualScrolling(this._virtualScrollViewport),this._hasInitialized=true;}ngAfterContentChecked(){this._canRender()&&this._render();}ngOnDestroy(){this._stickyStyler?.destroy(),[this._rowOutlet?.viewContainer,this._headerRowOutlet?.viewContainer,this._footerRowOutlet?.viewContainer,this._cachedRenderRowsMap,this._customColumnDefs,this._customRowDefs,this._customHeaderRowDefs,this._customFooterRowDefs,this._columnDefsByName].forEach(e=>{e?.clear();}),this._headerRowDefs=[],this._footerRowDefs=[],this._defaultRowDef=null,this._headerRowStickyUpdates.complete(),this._footerRowStickyUpdates.complete(),this._onDestroy.next(),this._onDestroy.complete(),Ce$1(this.dataSource)&&this.dataSource.disconnect(this);}renderRows(){this._renderRows=this._getAllRenderRows();let e=this._dataDiffer.diff(this._renderRows);if(!e){this._updateNoDataRow(),this.contentChanged.next();return}let t=this._rowOutlet.viewContainer;this._viewRepeater.applyChanges(e,t,(n,a,r)=>this._getEmbeddedViewArgs(n.item,r),n=>n.item.data,n=>{n.operation===Y$1.INSERTED&&n.context&&this._renderCellTemplateForItem(n.record.item.rowDef,n.context);}),this._updateRowIndexContext(),e.forEachIdentityChange(n=>{let a=t.get(n.currentIndex);a.context.$implicit=n.item.data;}),this._updateNoDataRow(),this.contentChanged.next(),this.updateStickyColumnStyles();}addColumnDef(e){this._customColumnDefs.add(e);}removeColumnDef(e){this._customColumnDefs.delete(e);}addRowDef(e){this._customRowDefs.add(e);}removeRowDef(e){this._customRowDefs.delete(e);}addHeaderRowDef(e){this._customHeaderRowDefs.add(e),this._headerRowDefChanged=true;}removeHeaderRowDef(e){this._customHeaderRowDefs.delete(e),this._headerRowDefChanged=true;}addFooterRowDef(e){this._customFooterRowDefs.add(e),this._footerRowDefChanged=true;}removeFooterRowDef(e){this._customFooterRowDefs.delete(e),this._footerRowDefChanged=true;}setNoDataRow(e){this._customNoDataRow=e;}updateStickyHeaderRowStyles(){let e=this._getRenderedRows(this._headerRowOutlet);if(this._isNativeHtmlTable){let n=wi(this._headerRowOutlet,"thead");n&&(n.style.display=e.length?"":"none");}let t=this._headerRowDefs.map(n=>n.sticky);this._stickyStyler.clearStickyPositioning(e,["top"]),this._stickyStyler.stickRows(e,t,"top"),this._headerRowDefs.forEach(n=>n.resetStickyChanged());}updateStickyFooterRowStyles(){let e=this._getRenderedRows(this._footerRowOutlet);if(this._isNativeHtmlTable){let n=wi(this._footerRowOutlet,"tfoot");n&&(n.style.display=e.length?"":"none");}let t=this._footerRowDefs.map(n=>n.sticky);this._stickyStyler.clearStickyPositioning(e,["bottom"]),this._stickyStyler.stickRows(e,t,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,t),this._footerRowDefs.forEach(n=>n.resetStickyChanged());}updateStickyColumnStyles(){let e=this._getRenderedRows(this._headerRowOutlet),t=this._getRenderedRows(this._rowOutlet),n=this._getRenderedRows(this._footerRowOutlet);(this._isNativeHtmlTable&&!this.fixedLayout||this._stickyColumnStylesNeedReset)&&(this._stickyStyler.clearStickyPositioning([...e,...t,...n],["left","right"]),this._stickyColumnStylesNeedReset=false),e.forEach((a,r)=>{this._addStickyColumnStyles([a],this._headerRowDefs[r]);}),this._rowDefs.forEach(a=>{let r=[];for(let l=0;l<t.length;l++)this._renderRows[l].rowDef===a&&r.push(t[l]);this._addStickyColumnStyles(r,a);}),n.forEach((a,r)=>{this._addStickyColumnStyles([a],this._footerRowDefs[r]);}),Array.from(this._columnDefsByName.values()).forEach(a=>a.resetStickyChanged());}stickyColumnsUpdated(e){this._positionListener?.stickyColumnsUpdated(e);}stickyEndColumnsUpdated(e){this._positionListener?.stickyEndColumnsUpdated(e);}stickyHeaderRowsUpdated(e){this._headerRowStickyUpdates.next(e),this._positionListener?.stickyHeaderRowsUpdated(e);}stickyFooterRowsUpdated(e){this._footerRowStickyUpdates.next(e),this._positionListener?.stickyFooterRowsUpdated(e);}_outletAssigned(){!this._hasAllOutlets&&this._rowOutlet&&this._headerRowOutlet&&this._footerRowOutlet&&this._noDataRowOutlet&&(this._hasAllOutlets=true,this._canRender()&&this._render());}_canRender(){return this._hasAllOutlets&&this._hasInitialized}_render(){this._cacheRowDefs(),this._cacheColumnDefs(),!this._headerRowDefs.length&&!this._footerRowDefs.length&&this._rowDefs.length;let t=this._renderUpdatedColumns()||this._headerRowDefChanged||this._footerRowDefChanged;this._stickyColumnStylesNeedReset=this._stickyColumnStylesNeedReset||t,this._forceRecalculateCellWidths=t,this._headerRowDefChanged&&(this._forceRenderHeaderRows(),this._headerRowDefChanged=false),this._footerRowDefChanged&&(this._forceRenderFooterRows(),this._footerRowDefChanged=false),this.dataSource&&this._rowDefs.length>0&&!this._renderChangeSubscription?this._observeRenderChanges():this._stickyColumnStylesNeedReset&&this.updateStickyColumnStyles(),this._checkStickyStates();}_getAllRenderRows(){if(!Array.isArray(this._data)||!this._renderedRange)return [];let e=[],t=Math.min(this._data.length,this._renderedRange.end),n=this._cachedRenderRowsMap;this._cachedRenderRowsMap=new Map;for(let a=this._renderedRange.start;a<t;a++){let r=this._data[a],l=this._getRenderRowsForData(r,a,n.get(r));this._cachedRenderRowsMap.has(r)||this._cachedRenderRowsMap.set(r,new WeakMap);for(let u=0;u<l.length;u++){let p=l[u],g=this._cachedRenderRowsMap.get(p.data);g.has(p.rowDef)?g.get(p.rowDef).push(p):g.set(p.rowDef,[p]),e.push(p);}}return e}_getRenderRowsForData(e,t,n){return this._getRowDefs(e,t).map(r=>{let l=n&&n.has(r)?n.get(r):[];if(l.length){let u=l.shift();return u.dataIndex=t,u}else return {data:e,rowDef:r,dataIndex:t}})}_cacheColumnDefs(){this._columnDefsByName.clear(),je(this._getOwnDefs(this._contentColumnDefs),this._customColumnDefs).forEach(t=>{this._columnDefsByName.has(t.name),this._columnDefsByName.set(t.name,t);});}_cacheRowDefs(){this._headerRowDefs=je(this._getOwnDefs(this._contentHeaderRowDefs),this._customHeaderRowDefs),this._footerRowDefs=je(this._getOwnDefs(this._contentFooterRowDefs),this._customFooterRowDefs),this._rowDefs=je(this._getOwnDefs(this._contentRowDefs),this._customRowDefs);let e=this._rowDefs.filter(t=>!t.when);this._defaultRowDef=e[0];}_renderUpdatedColumns(){let e=(r,l)=>{let u=!!l.getColumnsDiff();return r||u},t=this._rowDefs.reduce(e,false);t&&this._forceRenderDataRows();let n=this._headerRowDefs.reduce(e,false);n&&this._forceRenderHeaderRows();let a=this._footerRowDefs.reduce(e,false);return a&&this._forceRenderFooterRows(),t||n||a}_switchDataSource(e){this._data=[],Ce$1(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),e||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet&&this._rowOutlet.viewContainer.clear()),this._dataSource=e;}_observeRenderChanges(){if(!this.dataSource)return;let e;Ce$1(this.dataSource)?e=this.dataSource.connect(this):Cm(this.dataSource)?e=this.dataSource:Array.isArray(this.dataSource)&&(e=Tm(this.dataSource)),this._renderChangeSubscription=Fm([e,this.viewChange]).pipe(bu(this._onDestroy)).subscribe(([t,n])=>{this._data=t||[],this._renderedRange=n,this._dataStream.next(t),this.renderRows();});}_forceRenderHeaderRows(){this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach((e,t)=>this._renderRow(this._headerRowOutlet,e,t)),this.updateStickyHeaderRowStyles();}_forceRenderFooterRows(){this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach((e,t)=>this._renderRow(this._footerRowOutlet,e,t)),this.updateStickyFooterRowStyles();}_addStickyColumnStyles(e,t){let n=Array.from(t?.columns||[]).map(l=>{let u=this._columnDefsByName.get(l);return u}),a=n.map(l=>l.sticky),r=n.map(l=>l.stickyEnd);this._stickyStyler.updateStickyColumns(e,a,r,!this.fixedLayout||this._forceRecalculateCellWidths);}_getRenderedRows(e){let t=[];for(let n=0;n<e.viewContainer.length;n++){let a=e.viewContainer.get(n);t.push(a.rootNodes[0]);}return t}_getRowDefs(e,t){if(this._rowDefs.length===1)return [this._rowDefs[0]];let n=[];if(this.multiTemplateDataRows)n=this._rowDefs.filter(a=>!a.when||a.when(t,e));else {let a=this._rowDefs.find(r=>r.when&&r.when(t,e))||this._defaultRowDef;a&&n.push(a);}return n.length,n}_getEmbeddedViewArgs(e,t){let n=e.rowDef,a={$implicit:e.data};return {templateRef:n.template,context:a,index:t}}_renderRow(e,t,n,a={}){let r=e.viewContainer.createEmbeddedView(t.template,a,n);return this._renderCellTemplateForItem(t,a),r}_renderCellTemplateForItem(e,t){for(let n of this._getCellTemplates(e))ae.mostRecentCellOutlet&&ae.mostRecentCellOutlet._viewContainer.createEmbeddedView(n,t);this._changeDetectorRef.markForCheck();}_updateRowIndexContext(){let e=this._rowOutlet.viewContainer;for(let t=0,n=e.length;t<n;t++){let r=e.get(t).context;r.count=n,r.first=t===0,r.last=t===n-1,r.even=t%2===0,r.odd=!r.even,this.multiTemplateDataRows?(r.dataIndex=this._renderRows[t].dataIndex,r.renderIndex=t):r.index=this._renderRows[t].dataIndex;}}_getCellTemplates(e){return !e||!e.columns?[]:Array.from(e.columns,t=>{let n=this._columnDefsByName.get(t);return e.extractCellTemplate(n)})}_forceRenderDataRows(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows();}_checkStickyStates(){let e=(t,n)=>t||n.hasStickyChanged();this._headerRowDefs.reduce(e,false)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(e,false)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(e,false)&&(this._stickyColumnStylesNeedReset=true,this.updateStickyColumnStyles());}_setupStickyStyler(){let e=this._dir?this._dir.value:"ltr",t=this._injector;this._stickyStyler=new et(this._isNativeHtmlTable,this.stickyCssClass,this._platform.isBrowser,this.needsPositionStickyOnElement,e,this,t),(this._dir?this._dir.change:Tm()).pipe(bu(this._onDestroy)).subscribe(n=>{this._stickyStyler.direction=n,this.updateStickyColumnStyles();});}_setupVirtualScrolling(e){let t=typeof requestAnimationFrame<"u"?wm:Dm;this.viewChange.next({start:0,end:0}),e.renderedRangeStream.pipe(Qm(0,t),bu(this._onDestroy)).subscribe(this.viewChange),e.attach({dataStream:this._dataStream,measureRangeSize:(n,a)=>this._measureRangeSize(n,a)}),Fm([e.renderedContentOffset,this._headerRowStickyUpdates]).pipe(bu(this._onDestroy)).subscribe(([n,a])=>{if(!(!a.sizes||!a.offsets||!a.elements))for(let r=0;r<a.elements.length;r++){let l=a.elements[r];if(l){let u=a.offsets[r],p=n!==0?Math.max(n-u,u):-u;for(let g of l)g.style.top=`${-p}px`;}}}),Fm([e.renderedContentOffset,this._footerRowStickyUpdates]).pipe(bu(this._onDestroy)).subscribe(([n,a])=>{if(!(!a.sizes||!a.offsets||!a.elements))for(let r=0;r<a.elements.length;r++){let l=a.elements[r];if(l)for(let u of l)u.style.bottom=`${n+a.offsets[r]}px`;}});}_getOwnDefs(e){return e.filter(t=>!t._table||t._table===this)}_updateNoDataRow(){let e=this._customNoDataRow||this._noDataRow;if(!e)return;let t=this._rowOutlet.viewContainer.length===0;if(t===this._isShowingNoDataRow)return;let n=this._noDataRowOutlet.viewContainer;if(t){let a=n.createEmbeddedView(e.templateRef),r=a.rootNodes[0];if(a.rootNodes.length===1&&r?.nodeType===this._document.ELEMENT_NODE){r.setAttribute("role","row"),r.classList.add(...e._contentClassNames);let l=r.querySelectorAll(e._cellSelector);for(let u=0;u<l.length;u++)l[u].classList.add(...e._cellClassNames);}}else n.clear();this._isShowingNoDataRow=t,this._changeDetectorRef.markForCheck();}_measureRangeSize(e,t){if(e.start>=e.end||t!=="vertical")return 0;let n=this.viewChange.value,a=this._rowOutlet.viewContainer;e.start<n.start||e.end>n.end;let r=e.start-n.start,l=e.end-e.start,u,p;for(let S=0;S<l;S++){let R=a.get(S+r);if(R&&R.rootNodes.length){u=p=R.rootNodes[0];break}}for(let S=l-1;S>-1;S--){let R=a.get(S+r);if(R&&R.rootNodes.length){p=R.rootNodes[R.rootNodes.length-1];break}}let g=u?.getBoundingClientRect?.(),w=p?.getBoundingClientRect?.();return g&&w?w.bottom-g.top:0}_virtualScrollEnabled(){return !this._disableVirtualScrolling&&this._virtualScrollViewport!=null}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=JD({type:i,selectors:[["cdk-table"],["table","cdk-table",""]],contentQueries:function(t,n,a){if(t&1&&Kh(a,We,5)(a,Y,5)(a,Qe,5)(a,Me,5)(a,it,5),t&2){let r;Zw(r=Yw())&&(n._noDataRow=r.first),Zw(r=Yw())&&(n._contentColumnDefs=r),Zw(r=Yw())&&(n._contentRowDefs=r),Zw(r=Yw())&&(n._contentHeaderRowDefs=r),Zw(r=Yw())&&(n._contentFooterRowDefs=r);}},hostAttrs:[1,"cdk-table"],hostVars:2,hostBindings:function(t,n){t&2&&sg("cdk-table-fixed-layout",n.fixedLayout);},inputs:{trackBy:"trackBy",dataSource:"dataSource",multiTemplateDataRows:[2,"multiTemplateDataRows","multiTemplateDataRows",Zj],fixedLayout:[2,"fixedLayout","fixedLayout",Zj],recycleRows:[2,"recycleRows","recycleRows",Zj]},outputs:{contentChanged:"contentChanged"},exportAs:["cdkTable"],features:[LT([{provide:A,useExisting:i},{provide:xe,useValue:null}])],ngContentSelectors:Ui,decls:5,vars:2,consts:[["role","rowgroup"],["headerRowOutlet",""],["rowOutlet",""],["noDataRowOutlet",""],["footerRowOutlet",""]],template:function(t,n){t&1&&(Gw(Vi),zw(0),zw(1,1),_w(2,$i,1,0),_w(3,Qi,7,0)(4,Wi,4,0)),t&2&&(EE(2),Mw(n._isServer?2:-1),EE(),Mw(n._isNativeHtmlTable?3:4));},dependencies:[rt,at,lt,st],styles:[`.cdk-table-fixed-layout {
|
|
1
|
+
import {O}from'./chunk-BTv5PhTr.js';import {w,aS as De,aY as xe$1,a7 as Gj,i as ir,aR as lt$1,ab as te,$ as $j,cN as Wl,a_ as Gp,W as Wp,E as Em,F as Fa,cO as eu,cP as Z,as as ke,J as JD,cQ as ce,bb as rt$1,bc as ae$1,bH as ln$1,bd as an$1,O as Op,o as eu$1,y as yt,b as wt,cR as zt,bg as mt,c as $h,P as Pi$1,T as TT,u as ul,k as Qh,cS as pl,cf as xh,cT as hl,B as Bh,e as EE,f as eg,K as Kw,aB as gr,aF as Pr,ac as Mr,cU as $n,az as Yj,ad as Qe$1,aa as N,bA as Ft,bB as F,al as Zj,_ as _w,cn as wd,cV as Td,M as Mw,bp as gl,an as Hh,cW as Ur,ak as nw,ay as lv,cX as Xt,aq as Bn$1,cY as Io,aj as zm,cZ as Tm,c_ as Fm,c2 as bh,c3 as Qs,c4 as Fn$1,c8 as Sv,c9 as Sh,bV as Gw,bW as zw,am as LT,s as sg,c$ as Wh,bI as Lt,bQ as Dn$1,a6 as Lr,d0 as dh,bR as ot$1,v as vt,aD as Ce,bS as oa,ci as dl,cj as fl,bu as ut,aQ as ee,d1 as Hj,bh as xp,aA as gg,h as Fw,l as ud,g as qw,m as dd,X as xw,Y as Aw,bl as Jw,d2 as wt$1,d3 as ib,a9 as ru,cl as G,aC as L,ae as be,d4 as gi,bT as Lg,ag as bu,d5 as jt,d6 as _,d7 as Ce$1,d8 as Y$1,d9 as Cm,da as Qm,aJ as wm,db as Dm,ca as Kh,c0 as Zw,c1 as Yw,ap as Ki$1,co as Mr$1,dc as O$1,dd as $e$1,de as Nt,df as Vt,dg as pt,dh as zt$1,di as jt$1,bi as Eg,bj as ST,dj as Nw,bm as Ig,dk as Vh,at as Tp,cp as Uh}from'./main-F7NMHHV4.js';var Vi=[[["caption"]],[["colgroup"],["col"]],"*"],Ui=["caption","colgroup, col","*"];function $i(i,o){i&1&&zw(0,2);}function Qi(i,o){i&1&&(Pi$1(0,"thead",0),Wh(1,1),ul(),Pi$1(2,"tbody",0),Wh(3,2)(4,3),ul(),Pi$1(5,"tfoot",0),Wh(6,4),ul());}function Wi(i,o){i&1&&Wh(0,1)(1,2)(2,3)(3,4);}var A=new N("CDK_TABLE");var Ue=(()=>{class i{template=w(Mr$1);static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkCellDef",""]]})}return i})(),$e=(()=>{class i{template=w(Mr$1);static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkHeaderCellDef",""]]})}return i})(),Ci=(()=>{class i{template=w(Mr$1);static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkFooterCellDef",""]]})}return i})(),Y=(()=>{class i{_table=w(A,{optional:true});_hasStickyChanged=false;get name(){return this._name}set name(e){this._setNameInput(e);}_name;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=true);}_sticky=false;get stickyEnd(){return this._stickyEnd}set stickyEnd(e){e!==this._stickyEnd&&(this._stickyEnd=e,this._hasStickyChanged=true);}_stickyEnd=false;cell;headerCell;footerCell;cssClassFriendlyName;_columnCssClassName;hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=false;}_updateColumnCssClassName(){this._columnCssClassName=[`cdk-column-${this.cssClassFriendlyName}`];}_setNameInput(e){e&&(this._name=e,this.cssClassFriendlyName=e.replace(/[^a-z0-9_-]/gi,"-"),this._updateColumnCssClassName());}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkColumnDef",""]],contentQueries:function(t,n,a){if(t&1&&Kh(a,Ue,5)(a,$e,5)(a,Ci,5),t&2){let r;Zw(r=Yw())&&(n.cell=r.first),Zw(r=Yw())&&(n.headerCell=r.first),Zw(r=Yw())&&(n.footerCell=r.first);}},inputs:{name:[0,"cdkColumnDef","name"],sticky:[2,"sticky","sticky",Zj],stickyEnd:[2,"stickyEnd","stickyEnd",Zj]}})}return i})(),Ve=class{constructor(o,e){e.nativeElement.classList.add(...o._columnCssClassName);}},bi=(()=>{class i extends Ve{constructor(){super(w(Y),w(Lr));}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["cdk-header-cell"],["th","cdk-header-cell",""]],hostAttrs:["role","columnheader",1,"cdk-header-cell"],features:[Sh]})}return i})();var Di=(()=>{class i extends Ve{constructor(){let e=w(Y),t=w(Lr);super(e,t);let n=e._table?._getCellRole();n&&t.nativeElement.setAttribute("role",n);}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["cdk-cell"],["td","cdk-cell",""]],hostAttrs:[1,"cdk-cell"],features:[Sh]})}return i})();var tt=(()=>{class i{template=w(Mr$1);_differs=w(ib);columns;_columnsDiffer;ngOnChanges(e){if(!this._columnsDiffer){let t=e.columns&&e.columns.currentValue||[];this._columnsDiffer=this._differs.find(t).create(),this._columnsDiffer.diff(t);}}getColumnsDiff(){return this._columnsDiffer.diff(this.columns)}extractCellTemplate(e){return this instanceof Me?e.headerCell.template:this instanceof it?e.footerCell.template:e.cell.template}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,features:[lv]})}return i})(),Me=(()=>{class i extends tt{_table=w(A,{optional:true});_hasStickyChanged=false;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=true);}_sticky=false;ngOnChanges(e){super.ngOnChanges(e);}hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=false;}static \u0275fac=(()=>{let e;return function(n){return (e||(e=Sv(i)))(n||i)}})();static \u0275dir=nw({type:i,selectors:[["","cdkHeaderRowDef",""]],inputs:{columns:[0,"cdkHeaderRowDef","columns"],sticky:[2,"cdkHeaderRowDefSticky","sticky",Zj]},features:[Sh,lv]})}return i})(),it=(()=>{class i extends tt{_table=w(A,{optional:true});_hasStickyChanged=false;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=true);}_sticky=false;ngOnChanges(e){super.ngOnChanges(e);}hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=false;}static \u0275fac=(()=>{let e;return function(n){return (e||(e=Sv(i)))(n||i)}})();static \u0275dir=nw({type:i,selectors:[["","cdkFooterRowDef",""]],inputs:{columns:[0,"cdkFooterRowDef","columns"],sticky:[2,"cdkFooterRowDefSticky","sticky",Zj]},features:[Sh,lv]})}return i})(),Qe=(()=>{class i extends tt{_table=w(A,{optional:true});when;static \u0275fac=(()=>{let e;return function(n){return (e||(e=Sv(i)))(n||i)}})();static \u0275dir=nw({type:i,selectors:[["","cdkRowDef",""]],inputs:{columns:[0,"cdkRowDefColumns","columns"],when:[0,"cdkRowDefWhen","when"]},features:[Sh]})}return i})(),ae=(()=>{class i{_viewContainer=w(Ki$1);cells;context;static mostRecentCellOutlet=null;constructor(){i.mostRecentCellOutlet=this;}ngOnDestroy(){i.mostRecentCellOutlet===this&&(i.mostRecentCellOutlet=null);}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","cdkCellOutlet",""]]})}return i})(),nt=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275cmp=JD({type:i,selectors:[["cdk-header-row"],["tr","cdk-header-row",""]],hostAttrs:["role","row",1,"cdk-header-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,n){t&1&&Wh(0,0);},dependencies:[ae],encapsulation:2,changeDetection:1})}return i})();var ot=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275cmp=JD({type:i,selectors:[["cdk-row"],["tr","cdk-row",""]],hostAttrs:["role","row",1,"cdk-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,n){t&1&&Wh(0,0);},dependencies:[ae],encapsulation:2,changeDetection:1})}return i})(),We=(()=>{class i{templateRef=w(Mr$1);_contentClassNames=["cdk-no-data-row","cdk-row"];_cellClassNames=["cdk-cell","cdk-no-data-cell"];_cellSelector="td, cdk-cell, [cdk-cell], .cdk-cell";static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["ng-template","cdkNoDataRow",""]]})}return i})(),yi=["top","bottom","left","right"],et=class{_isNativeHtmlTable;_stickCellCss;_isBrowser;_needsPositionStickyOnElement;direction;_positionListener;_tableInjector;_elemSizeCache=new WeakMap;_resizeObserver=globalThis?.ResizeObserver?new globalThis.ResizeObserver(o=>this._updateCachedSizes(o)):null;_updatedStickyColumnsParamsToReplay=[];_stickyColumnsReplayTimeout=null;_cachedCellWidths=[];_borderCellCss;_destroyed=false;constructor(o,e,t=true,n=true,a,r,l){this._isNativeHtmlTable=o,this._stickCellCss=e,this._isBrowser=t,this._needsPositionStickyOnElement=n,this.direction=a,this._positionListener=r,this._tableInjector=l,this._borderCellCss={top:`${e}-border-elem-top`,bottom:`${e}-border-elem-bottom`,left:`${e}-border-elem-left`,right:`${e}-border-elem-right`};}clearStickyPositioning(o,e){(e.includes("left")||e.includes("right"))&&this._removeFromStickyColumnReplayQueue(o);let t=[];for(let n of o)n.nodeType===n.ELEMENT_NODE&&t.push(n,...Array.from(n.children));Tp({write:()=>{for(let n of t)this._removeStickyStyle(n,e);}},{injector:this._tableInjector});}updateStickyColumns(o,e,t,n=true,a=true){if(!o.length||!this._isBrowser||!(e.some(P=>P)||t.some(P=>P))){this._positionListener?.stickyColumnsUpdated({sizes:[]}),this._positionListener?.stickyEndColumnsUpdated({sizes:[]});return}let r=o[0],l=r.children.length,u=this.direction==="rtl",p=u?"right":"left",g=u?"left":"right",w=e.lastIndexOf(true),S=t.indexOf(true),R,mt,ut;a&&this._updateStickyColumnReplayQueue({rows:[...o],stickyStartStates:[...e],stickyEndStates:[...t]}),Tp({earlyRead:()=>{R=this._getCellWidths(r,n),mt=this._getStickyStartColumnPositions(R,e),ut=this._getStickyEndColumnPositions(R,t);},write:()=>{for(let P of o)for(let I=0;I<l;I++){let ft=P.children[I];e[I]&&this._addStickyStyle(ft,p,mt[I],I===w),t[I]&&this._addStickyStyle(ft,g,ut[I],I===S);}this._positionListener&&R.some(P=>!!P)&&(this._positionListener.stickyColumnsUpdated({sizes:w===-1?[]:R.slice(0,w+1).map((P,I)=>e[I]?P:null)}),this._positionListener.stickyEndColumnsUpdated({sizes:S===-1?[]:R.slice(S).map((P,I)=>t[I+S]?P:null).reverse()}));}},{injector:this._tableInjector});}stickRows(o,e,t){if(!this._isBrowser)return;let n=t==="bottom"?o.slice().reverse():o,a=t==="bottom"?e.slice().reverse():e,r=[],l=[],u=[];Tp({earlyRead:()=>{for(let p=0,g=0;p<n.length;p++){if(!a[p])continue;r[p]=g;let w=n[p];u[p]=this._isNativeHtmlTable?Array.from(w.children):[w];let S=this._retrieveElementSize(w).height;g+=S,l[p]=S;}},write:()=>{let p=a.lastIndexOf(true);for(let g=0;g<n.length;g++){if(!a[g])continue;let w=r[g],S=g===p;for(let R of u[g])this._addStickyStyle(R,t,w,S);}t==="top"?this._positionListener?.stickyHeaderRowsUpdated({sizes:l,offsets:r,elements:u}):this._positionListener?.stickyFooterRowsUpdated({sizes:l,offsets:r,elements:u});}},{injector:this._tableInjector});}updateStickyFooterContainer(o,e){this._isNativeHtmlTable&&Tp({write:()=>{let t=o.querySelector("tfoot");t&&(e.some(n=>!n)?this._removeStickyStyle(t,["bottom"]):this._addStickyStyle(t,"bottom",0,false));}},{injector:this._tableInjector});}destroy(){this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._resizeObserver?.disconnect(),this._destroyed=true;}_removeStickyStyle(o,e){if(!o.classList.contains(this._stickCellCss))return;for(let n of e)o.style[n]="",o.classList.remove(this._borderCellCss[n]);yi.some(n=>e.indexOf(n)===-1&&o.style[n])?o.style.zIndex=this._getCalculatedZIndex(o):(o.style.zIndex="",this._needsPositionStickyOnElement&&(o.style.position=""),o.classList.remove(this._stickCellCss));}_addStickyStyle(o,e,t,n){o.classList.add(this._stickCellCss),n&&o.classList.add(this._borderCellCss[e]),o.style[e]=`${t}px`,o.style.zIndex=this._getCalculatedZIndex(o),this._needsPositionStickyOnElement&&(o.style.cssText+="position: -webkit-sticky; position: sticky; ");}_getCalculatedZIndex(o){let e={top:100,bottom:10,left:1,right:1},t=0;for(let n of yi)o.style[n]&&(t+=e[n]);return t?`${t}`:""}_getCellWidths(o,e=true){if(!e&&this._cachedCellWidths.length)return this._cachedCellWidths;let t=[],n=o.children;for(let a=0;a<n.length;a++){let r=n[a];t.push(this._retrieveElementSize(r).width);}return this._cachedCellWidths=t,t}_getStickyStartColumnPositions(o,e){let t=[],n=0;for(let a=0;a<o.length;a++)e[a]&&(t[a]=n,n+=o[a]);return t}_getStickyEndColumnPositions(o,e){let t=[],n=0;for(let a=o.length;a>0;a--)e[a]&&(t[a]=n,n+=o[a]);return t}_retrieveElementSize(o){let e=this._elemSizeCache.get(o);if(e)return e;let t=o.getBoundingClientRect(),n={width:t.width,height:t.height};return this._resizeObserver&&(this._elemSizeCache.set(o,n),this._resizeObserver.observe(o,{box:"border-box"})),n}_updateStickyColumnReplayQueue(o){this._removeFromStickyColumnReplayQueue(o.rows),this._stickyColumnsReplayTimeout||this._updatedStickyColumnsParamsToReplay.push(o);}_removeFromStickyColumnReplayQueue(o){let e=new Set(o);for(let t of this._updatedStickyColumnsParamsToReplay)t.rows=t.rows.filter(n=>!e.has(n));this._updatedStickyColumnsParamsToReplay=this._updatedStickyColumnsParamsToReplay.filter(t=>!!t.rows.length);}_updateCachedSizes(o){let e=false;for(let t of o){let n=t.borderBoxSize?.length?{width:t.borderBoxSize[0].inlineSize,height:t.borderBoxSize[0].blockSize}:{width:t.contentRect.width,height:t.contentRect.height};n.width!==this._elemSizeCache.get(t.target)?.width&&qi(t.target)&&(e=true),this._elemSizeCache.set(t.target,n);}e&&this._updatedStickyColumnsParamsToReplay.length&&(this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._stickyColumnsReplayTimeout=setTimeout(()=>{if(!this._destroyed){for(let t of this._updatedStickyColumnsParamsToReplay)this.updateStickyColumns(t.rows,t.stickyStartStates,t.stickyEndStates,true,false);this._updatedStickyColumnsParamsToReplay=[],this._stickyColumnsReplayTimeout=null;}},0));}};function qi(i){return ["cdk-cell","cdk-header-cell","cdk-footer-cell"].some(o=>i.classList.contains(o))}var xe=new N("STICKY_POSITIONING_LISTENER");var at=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._rowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","rowOutlet",""]]})}return i})(),rt=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._headerRowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","headerRowOutlet",""]]})}return i})(),st=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._footerRowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","footerRowOutlet",""]]})}return i})(),lt=(()=>{class i{viewContainer=w(Ki$1);elementRef=w(Lr);constructor(){let e=w(A);e._noDataRowOutlet=this,e._outletAssigned();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=nw({type:i,selectors:[["","noDataRowOutlet",""]]})}return i})(),ct=(()=>{class i{_differs=w(ib);_changeDetectorRef=w(Gj);_elementRef=w(Lr);_dir=w(ru,{optional:true});_platform=w(G);_viewRepeater;_viewportRuler=w(L);_injector=w(be);_virtualScrollViewport=w(gi,{optional:true,host:true});_positionListener=w(xe,{optional:true})||w(xe,{optional:true,skipSelf:true});_document=w(gr);_data;_renderedRange;_onDestroy=new te;_renderRows;_renderChangeSubscription=null;_columnDefsByName=new Map;_rowDefs;_headerRowDefs;_footerRowDefs;_dataDiffer;_defaultRowDef=null;_customColumnDefs=new Set;_customRowDefs=new Set;_customHeaderRowDefs=new Set;_customFooterRowDefs=new Set;_customNoDataRow=null;_headerRowDefChanged=true;_footerRowDefChanged=true;_stickyColumnStylesNeedReset=true;_forceRecalculateCellWidths=true;_cachedRenderRowsMap=new Map;_isNativeHtmlTable;_stickyStyler;stickyCssClass="cdk-table-sticky";needsPositionStickyOnElement=true;_isServer;_isShowingNoDataRow=false;_hasAllOutlets=false;_hasInitialized=false;_headerRowStickyUpdates=new te;_footerRowStickyUpdates=new te;_disableVirtualScrolling=false;_getCellRole(){if(this._cellRoleInternal===void 0){let e=this._elementRef.nativeElement.getAttribute("role");return e==="grid"||e==="treegrid"?"gridcell":"cell"}return this._cellRoleInternal}_cellRoleInternal=void 0;get trackBy(){return this._trackByFn}set trackBy(e){this._trackByFn=e;}_trackByFn;get dataSource(){return this._dataSource}set dataSource(e){this._dataSource!==e&&(this._switchDataSource(e),this._changeDetectorRef.markForCheck());}_dataSource;_dataSourceChanges=new te;_dataStream=new te;get multiTemplateDataRows(){return this._multiTemplateDataRows}set multiTemplateDataRows(e){this._multiTemplateDataRows=e,this._rowOutlet&&this._rowOutlet.viewContainer.length&&(this._forceRenderDataRows(),this.updateStickyColumnStyles());}_multiTemplateDataRows=false;get fixedLayout(){return this._virtualScrollEnabled()?true:this._fixedLayout}set fixedLayout(e){this._fixedLayout=e,this._forceRecalculateCellWidths=true,this._stickyColumnStylesNeedReset=true;}_fixedLayout=false;recycleRows=false;contentChanged=new Qe$1;viewChange=new Bn$1({start:0,end:Number.MAX_VALUE});_rowOutlet;_headerRowOutlet;_footerRowOutlet;_noDataRowOutlet;_contentColumnDefs;_contentRowDefs;_contentHeaderRowDefs;_contentFooterRowDefs;_noDataRow;get renderedRows(){return this._renderRows}constructor(){w(new Lg("role"),{optional:true})||this._elementRef.nativeElement.setAttribute("role","table"),this._isServer=!this._platform.isBrowser,this._isNativeHtmlTable=this._elementRef.nativeElement.nodeName==="TABLE",this._dataDiffer=this._differs.find([]).create((t,n)=>this.trackBy?this.trackBy(n.dataIndex,n.data):n);}ngOnInit(){this._setupStickyStyler(),this._viewportRuler.change().pipe(bu(this._onDestroy)).subscribe(()=>{this._forceRecalculateCellWidths=true;});}ngAfterContentInit(){this._viewRepeater=this.recycleRows||this._virtualScrollEnabled()?new jt:new _,this._virtualScrollEnabled()&&this._setupVirtualScrolling(this._virtualScrollViewport),this._hasInitialized=true;}ngAfterContentChecked(){this._canRender()&&this._render();}ngOnDestroy(){this._stickyStyler?.destroy(),[this._rowOutlet?.viewContainer,this._headerRowOutlet?.viewContainer,this._footerRowOutlet?.viewContainer,this._cachedRenderRowsMap,this._customColumnDefs,this._customRowDefs,this._customHeaderRowDefs,this._customFooterRowDefs,this._columnDefsByName].forEach(e=>{e?.clear();}),this._headerRowDefs=[],this._footerRowDefs=[],this._defaultRowDef=null,this._headerRowStickyUpdates.complete(),this._footerRowStickyUpdates.complete(),this._onDestroy.next(),this._onDestroy.complete(),Ce$1(this.dataSource)&&this.dataSource.disconnect(this);}renderRows(){this._renderRows=this._getAllRenderRows();let e=this._dataDiffer.diff(this._renderRows);if(!e){this._updateNoDataRow(),this.contentChanged.next();return}let t=this._rowOutlet.viewContainer;this._viewRepeater.applyChanges(e,t,(n,a,r)=>this._getEmbeddedViewArgs(n.item,r),n=>n.item.data,n=>{n.operation===Y$1.INSERTED&&n.context&&this._renderCellTemplateForItem(n.record.item.rowDef,n.context);}),this._updateRowIndexContext(),e.forEachIdentityChange(n=>{let a=t.get(n.currentIndex);a.context.$implicit=n.item.data;}),this._updateNoDataRow(),this.contentChanged.next(),this.updateStickyColumnStyles();}addColumnDef(e){this._customColumnDefs.add(e);}removeColumnDef(e){this._customColumnDefs.delete(e);}addRowDef(e){this._customRowDefs.add(e);}removeRowDef(e){this._customRowDefs.delete(e);}addHeaderRowDef(e){this._customHeaderRowDefs.add(e),this._headerRowDefChanged=true;}removeHeaderRowDef(e){this._customHeaderRowDefs.delete(e),this._headerRowDefChanged=true;}addFooterRowDef(e){this._customFooterRowDefs.add(e),this._footerRowDefChanged=true;}removeFooterRowDef(e){this._customFooterRowDefs.delete(e),this._footerRowDefChanged=true;}setNoDataRow(e){this._customNoDataRow=e;}updateStickyHeaderRowStyles(){let e=this._getRenderedRows(this._headerRowOutlet);if(this._isNativeHtmlTable){let n=wi(this._headerRowOutlet,"thead");n&&(n.style.display=e.length?"":"none");}let t=this._headerRowDefs.map(n=>n.sticky);this._stickyStyler.clearStickyPositioning(e,["top"]),this._stickyStyler.stickRows(e,t,"top"),this._headerRowDefs.forEach(n=>n.resetStickyChanged());}updateStickyFooterRowStyles(){let e=this._getRenderedRows(this._footerRowOutlet);if(this._isNativeHtmlTable){let n=wi(this._footerRowOutlet,"tfoot");n&&(n.style.display=e.length?"":"none");}let t=this._footerRowDefs.map(n=>n.sticky);this._stickyStyler.clearStickyPositioning(e,["bottom"]),this._stickyStyler.stickRows(e,t,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,t),this._footerRowDefs.forEach(n=>n.resetStickyChanged());}updateStickyColumnStyles(){let e=this._getRenderedRows(this._headerRowOutlet),t=this._getRenderedRows(this._rowOutlet),n=this._getRenderedRows(this._footerRowOutlet);(this._isNativeHtmlTable&&!this.fixedLayout||this._stickyColumnStylesNeedReset)&&(this._stickyStyler.clearStickyPositioning([...e,...t,...n],["left","right"]),this._stickyColumnStylesNeedReset=false),e.forEach((a,r)=>{this._addStickyColumnStyles([a],this._headerRowDefs[r]);}),this._rowDefs.forEach(a=>{let r=[];for(let l=0;l<t.length;l++)this._renderRows[l].rowDef===a&&r.push(t[l]);this._addStickyColumnStyles(r,a);}),n.forEach((a,r)=>{this._addStickyColumnStyles([a],this._footerRowDefs[r]);}),Array.from(this._columnDefsByName.values()).forEach(a=>a.resetStickyChanged());}stickyColumnsUpdated(e){this._positionListener?.stickyColumnsUpdated(e);}stickyEndColumnsUpdated(e){this._positionListener?.stickyEndColumnsUpdated(e);}stickyHeaderRowsUpdated(e){this._headerRowStickyUpdates.next(e),this._positionListener?.stickyHeaderRowsUpdated(e);}stickyFooterRowsUpdated(e){this._footerRowStickyUpdates.next(e),this._positionListener?.stickyFooterRowsUpdated(e);}_outletAssigned(){!this._hasAllOutlets&&this._rowOutlet&&this._headerRowOutlet&&this._footerRowOutlet&&this._noDataRowOutlet&&(this._hasAllOutlets=true,this._canRender()&&this._render());}_canRender(){return this._hasAllOutlets&&this._hasInitialized}_render(){this._cacheRowDefs(),this._cacheColumnDefs(),!this._headerRowDefs.length&&!this._footerRowDefs.length&&this._rowDefs.length;let t=this._renderUpdatedColumns()||this._headerRowDefChanged||this._footerRowDefChanged;this._stickyColumnStylesNeedReset=this._stickyColumnStylesNeedReset||t,this._forceRecalculateCellWidths=t,this._headerRowDefChanged&&(this._forceRenderHeaderRows(),this._headerRowDefChanged=false),this._footerRowDefChanged&&(this._forceRenderFooterRows(),this._footerRowDefChanged=false),this.dataSource&&this._rowDefs.length>0&&!this._renderChangeSubscription?this._observeRenderChanges():this._stickyColumnStylesNeedReset&&this.updateStickyColumnStyles(),this._checkStickyStates();}_getAllRenderRows(){if(!Array.isArray(this._data)||!this._renderedRange)return [];let e=[],t=Math.min(this._data.length,this._renderedRange.end),n=this._cachedRenderRowsMap;this._cachedRenderRowsMap=new Map;for(let a=this._renderedRange.start;a<t;a++){let r=this._data[a],l=this._getRenderRowsForData(r,a,n.get(r));this._cachedRenderRowsMap.has(r)||this._cachedRenderRowsMap.set(r,new WeakMap);for(let u=0;u<l.length;u++){let p=l[u],g=this._cachedRenderRowsMap.get(p.data);g.has(p.rowDef)?g.get(p.rowDef).push(p):g.set(p.rowDef,[p]),e.push(p);}}return e}_getRenderRowsForData(e,t,n){return this._getRowDefs(e,t).map(r=>{let l=n&&n.has(r)?n.get(r):[];if(l.length){let u=l.shift();return u.dataIndex=t,u}else return {data:e,rowDef:r,dataIndex:t}})}_cacheColumnDefs(){this._columnDefsByName.clear(),je(this._getOwnDefs(this._contentColumnDefs),this._customColumnDefs).forEach(t=>{this._columnDefsByName.has(t.name),this._columnDefsByName.set(t.name,t);});}_cacheRowDefs(){this._headerRowDefs=je(this._getOwnDefs(this._contentHeaderRowDefs),this._customHeaderRowDefs),this._footerRowDefs=je(this._getOwnDefs(this._contentFooterRowDefs),this._customFooterRowDefs),this._rowDefs=je(this._getOwnDefs(this._contentRowDefs),this._customRowDefs);let e=this._rowDefs.filter(t=>!t.when);this._defaultRowDef=e[0];}_renderUpdatedColumns(){let e=(r,l)=>{let u=!!l.getColumnsDiff();return r||u},t=this._rowDefs.reduce(e,false);t&&this._forceRenderDataRows();let n=this._headerRowDefs.reduce(e,false);n&&this._forceRenderHeaderRows();let a=this._footerRowDefs.reduce(e,false);return a&&this._forceRenderFooterRows(),t||n||a}_switchDataSource(e){this._data=[],Ce$1(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),e||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet&&this._rowOutlet.viewContainer.clear()),this._dataSource=e;}_observeRenderChanges(){if(!this.dataSource)return;let e;Ce$1(this.dataSource)?e=this.dataSource.connect(this):Cm(this.dataSource)?e=this.dataSource:Array.isArray(this.dataSource)&&(e=Tm(this.dataSource)),this._renderChangeSubscription=Fm([e,this.viewChange]).pipe(bu(this._onDestroy)).subscribe(([t,n])=>{this._data=t||[],this._renderedRange=n,this._dataStream.next(t),this.renderRows();});}_forceRenderHeaderRows(){this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach((e,t)=>this._renderRow(this._headerRowOutlet,e,t)),this.updateStickyHeaderRowStyles();}_forceRenderFooterRows(){this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach((e,t)=>this._renderRow(this._footerRowOutlet,e,t)),this.updateStickyFooterRowStyles();}_addStickyColumnStyles(e,t){let n=Array.from(t?.columns||[]).map(l=>{let u=this._columnDefsByName.get(l);return u}),a=n.map(l=>l.sticky),r=n.map(l=>l.stickyEnd);this._stickyStyler.updateStickyColumns(e,a,r,!this.fixedLayout||this._forceRecalculateCellWidths);}_getRenderedRows(e){let t=[];for(let n=0;n<e.viewContainer.length;n++){let a=e.viewContainer.get(n);t.push(a.rootNodes[0]);}return t}_getRowDefs(e,t){if(this._rowDefs.length===1)return [this._rowDefs[0]];let n=[];if(this.multiTemplateDataRows)n=this._rowDefs.filter(a=>!a.when||a.when(t,e));else {let a=this._rowDefs.find(r=>r.when&&r.when(t,e))||this._defaultRowDef;a&&n.push(a);}return n.length,n}_getEmbeddedViewArgs(e,t){let n=e.rowDef,a={$implicit:e.data};return {templateRef:n.template,context:a,index:t}}_renderRow(e,t,n,a={}){let r=e.viewContainer.createEmbeddedView(t.template,a,n);return this._renderCellTemplateForItem(t,a),r}_renderCellTemplateForItem(e,t){for(let n of this._getCellTemplates(e))ae.mostRecentCellOutlet&&ae.mostRecentCellOutlet._viewContainer.createEmbeddedView(n,t);this._changeDetectorRef.markForCheck();}_updateRowIndexContext(){let e=this._rowOutlet.viewContainer;for(let t=0,n=e.length;t<n;t++){let r=e.get(t).context;r.count=n,r.first=t===0,r.last=t===n-1,r.even=t%2===0,r.odd=!r.even,this.multiTemplateDataRows?(r.dataIndex=this._renderRows[t].dataIndex,r.renderIndex=t):r.index=this._renderRows[t].dataIndex;}}_getCellTemplates(e){return !e||!e.columns?[]:Array.from(e.columns,t=>{let n=this._columnDefsByName.get(t);return e.extractCellTemplate(n)})}_forceRenderDataRows(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows();}_checkStickyStates(){let e=(t,n)=>t||n.hasStickyChanged();this._headerRowDefs.reduce(e,false)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(e,false)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(e,false)&&(this._stickyColumnStylesNeedReset=true,this.updateStickyColumnStyles());}_setupStickyStyler(){let e=this._dir?this._dir.value:"ltr",t=this._injector;this._stickyStyler=new et(this._isNativeHtmlTable,this.stickyCssClass,this._platform.isBrowser,this.needsPositionStickyOnElement,e,this,t),(this._dir?this._dir.change:Tm()).pipe(bu(this._onDestroy)).subscribe(n=>{this._stickyStyler.direction=n,this.updateStickyColumnStyles();});}_setupVirtualScrolling(e){let t=typeof requestAnimationFrame<"u"?wm:Dm;this.viewChange.next({start:0,end:0}),e.renderedRangeStream.pipe(Qm(0,t),bu(this._onDestroy)).subscribe(this.viewChange),e.attach({dataStream:this._dataStream,measureRangeSize:(n,a)=>this._measureRangeSize(n,a)}),Fm([e.renderedContentOffset,this._headerRowStickyUpdates]).pipe(bu(this._onDestroy)).subscribe(([n,a])=>{if(!(!a.sizes||!a.offsets||!a.elements))for(let r=0;r<a.elements.length;r++){let l=a.elements[r];if(l){let u=a.offsets[r],p=n!==0?Math.max(n-u,u):-u;for(let g of l)g.style.top=`${-p}px`;}}}),Fm([e.renderedContentOffset,this._footerRowStickyUpdates]).pipe(bu(this._onDestroy)).subscribe(([n,a])=>{if(!(!a.sizes||!a.offsets||!a.elements))for(let r=0;r<a.elements.length;r++){let l=a.elements[r];if(l)for(let u of l)u.style.bottom=`${n+a.offsets[r]}px`;}});}_getOwnDefs(e){return e.filter(t=>!t._table||t._table===this)}_updateNoDataRow(){let e=this._customNoDataRow||this._noDataRow;if(!e)return;let t=this._rowOutlet.viewContainer.length===0;if(t===this._isShowingNoDataRow)return;let n=this._noDataRowOutlet.viewContainer;if(t){let a=n.createEmbeddedView(e.templateRef),r=a.rootNodes[0];if(a.rootNodes.length===1&&r?.nodeType===this._document.ELEMENT_NODE){r.setAttribute("role","row"),r.classList.add(...e._contentClassNames);let l=r.querySelectorAll(e._cellSelector);for(let u=0;u<l.length;u++)l[u].classList.add(...e._cellClassNames);}}else n.clear();this._isShowingNoDataRow=t,this._changeDetectorRef.markForCheck();}_measureRangeSize(e,t){if(e.start>=e.end||t!=="vertical")return 0;let n=this.viewChange.value,a=this._rowOutlet.viewContainer;e.start<n.start||e.end>n.end;let r=e.start-n.start,l=e.end-e.start,u,p;for(let S=0;S<l;S++){let R=a.get(S+r);if(R&&R.rootNodes.length){u=p=R.rootNodes[0];break}}for(let S=l-1;S>-1;S--){let R=a.get(S+r);if(R&&R.rootNodes.length){p=R.rootNodes[R.rootNodes.length-1];break}}let g=u?.getBoundingClientRect?.(),w=p?.getBoundingClientRect?.();return g&&w?w.bottom-g.top:0}_virtualScrollEnabled(){return !this._disableVirtualScrolling&&this._virtualScrollViewport!=null}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=JD({type:i,selectors:[["cdk-table"],["table","cdk-table",""]],contentQueries:function(t,n,a){if(t&1&&Kh(a,We,5)(a,Y,5)(a,Qe,5)(a,Me,5)(a,it,5),t&2){let r;Zw(r=Yw())&&(n._noDataRow=r.first),Zw(r=Yw())&&(n._contentColumnDefs=r),Zw(r=Yw())&&(n._contentRowDefs=r),Zw(r=Yw())&&(n._contentHeaderRowDefs=r),Zw(r=Yw())&&(n._contentFooterRowDefs=r);}},hostAttrs:[1,"cdk-table"],hostVars:2,hostBindings:function(t,n){t&2&&sg("cdk-table-fixed-layout",n.fixedLayout);},inputs:{trackBy:"trackBy",dataSource:"dataSource",multiTemplateDataRows:[2,"multiTemplateDataRows","multiTemplateDataRows",Zj],fixedLayout:[2,"fixedLayout","fixedLayout",Zj],recycleRows:[2,"recycleRows","recycleRows",Zj]},outputs:{contentChanged:"contentChanged"},exportAs:["cdkTable"],features:[LT([{provide:A,useExisting:i},{provide:xe,useValue:null}])],ngContentSelectors:Ui,decls:5,vars:2,consts:[["role","rowgroup"],["headerRowOutlet",""],["rowOutlet",""],["noDataRowOutlet",""],["footerRowOutlet",""]],template:function(t,n){t&1&&(Gw(Vi),zw(0),zw(1,1),_w(2,$i,1,0),_w(3,Qi,7,0)(4,Wi,4,0)),t&2&&(EE(2),Mw(n._isServer?2:-1),EE(),Mw(n._isNativeHtmlTable?3:4));},dependencies:[rt,at,lt,st],styles:[`.cdk-table-fixed-layout {
|
|
2
2
|
table-layout: fixed;
|
|
3
3
|
}
|
|
4
4
|
`],encapsulation:2,changeDetection:1})}return i})();function je(i,o){return i.concat(Array.from(o))}function wi(i,o){let e=o.toUpperCase(),t=i.viewContainer.element.nativeElement;for(;t;){let n=t.nodeType===1?t.nodeName:null;if(n===e)return t;if(n==="TABLE")break;t=t.parentNode;}return null}var vi=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=bh({type:i});static \u0275inj=Qs({imports:[wt$1]})}return i})();var Gi=[[["caption"]],[["colgroup"],["col"]],"*"],Ki=["caption","colgroup, col","*"];function Yi(i,o){i&1&&zw(0,2);}function Zi(i,o){i&1&&(Pi$1(0,"thead",0),Wh(1,1),ul(),Pi$1(2,"tbody",2),Wh(3,3)(4,4),ul(),Pi$1(5,"tfoot",0),Wh(6,5),ul());}function Xi(i,o){i&1&&Wh(0,1)(1,3)(2,4)(3,5);}var Si=(()=>{class i extends ct{stickyCssClass="mat-mdc-table-sticky";needsPositionStickyOnElement=false;static \u0275fac=(()=>{let e;return function(n){return (e||(e=Sv(i)))(n||i)}})();static \u0275cmp=JD({type:i,selectors:[["mat-table"],["table","mat-table",""]],hostAttrs:[1,"mat-mdc-table","mdc-data-table__table"],hostVars:2,hostBindings:function(t,n){t&2&&sg("mat-table-fixed-layout",n.fixedLayout);},exportAs:["matTable"],features:[LT([{provide:ct,useExisting:i},{provide:A,useExisting:i},{provide:xe,useValue:null}]),Sh],ngContentSelectors:Ki,decls:5,vars:2,consts:[["role","rowgroup"],["headerRowOutlet",""],["role","rowgroup",1,"mdc-data-table__content"],["rowOutlet",""],["noDataRowOutlet",""],["footerRowOutlet",""]],template:function(t,n){t&1&&(Gw(Gi),zw(0),zw(1,1),_w(2,Yi,1,0),_w(3,Zi,7,0)(4,Xi,4,0)),t&2&&(EE(2),Mw(n._isServer?2:-1),EE(),Mw(n._isNativeHtmlTable?3:4));},dependencies:[rt,at,lt,st],styles:[`.mat-mdc-table-sticky {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {w,dc as O,dd as $e,J as JD,b2 as Ln,b3 as Gn,b4 as Xe,b5 as Pn,b6 as kn,b7 as ft,b9 as rn,ba as Qt,de as Nt,df as Vt,bb as rt,bc as ae,bd as an,be as It,bt as u,dh as zt,bh as xp,di as jt,h as Fw,P as Pi,k as Qh,T as TT,u as ul,_ as _w,c as $h,bi as Eg,l as ud,bj as ST,m as dd,bk as cD,bl as Jw,e as EE,aA as gg,M as Mw,bm as Ig,B as Bh,bn as FT,bo as lD,g as qw,bp as gl}from'./main-
|
|
1
|
+
import {w,dc as O,dd as $e,J as JD,b2 as Ln,b3 as Gn,b4 as Xe,b5 as Pn,b6 as kn,b7 as ft,b9 as rn,ba as Qt,de as Nt,df as Vt,bb as rt,bc as ae,bd as an,be as It,bt as u,dh as zt,bh as xp,di as jt,h as Fw,P as Pi,k as Qh,T as TT,u as ul,_ as _w,c as $h,bi as Eg,l as ud,bj as ST,m as dd,bk as cD,bl as Jw,e as EE,aA as gg,M as Mw,bm as Ig,B as Bh,bn as FT,bo as lD,g as qw,bp as gl}from'./main-F7NMHHV4.js';var X=()=>({standalone:false});function Z(a,$){if(a&1&&(Pi(0,"div",3),$h(1,"i",10),TT(2),ul()),a&2){let p=qw();EE(2),gl(" ",p.data.error," ");}}var me=(()=>{class a{dialogRef=w(O);data=w($e);titleDialog="Sign in to Signal K";saveCredential(){this.data.error=null,this.dialogRef.close(this.data);}static \u0275fac=function(d){return new(d||a)};static \u0275cmp=JD({type:a,selectors:[["app-modal-user-credential"]],decls:26,vars:10,consts:[["login","ngForm"],["name","login",3,"ngSubmit"],["mat-dialog-title",""],[1,"errorMsgBox"],[1,"login-grid"],[1,"userLoginInput"],["type","text","autocomplete","username","id","username","matInput","","placeholder","User ID","name","username","required","",3,"ngModelChange","ngModel","ngModelOptions"],["type","password","autocomplete","current-password","autocapitalize","off","autocorrect","off","spellcheck","false","id","current-password","matInput","","placeholder","Password","name","current-password","required","",3,"ngModelChange","ngModel","ngModelOptions"],["mat-flat-button","","type","button",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"],["aria-hidden","true",1,"fa-solid","fa-times-circle",2,"color","red","padding-right","5px"]],template:function(d,i){if(d&1){let s=Fw();Pi(0,"form",1,0),Qh("ngSubmit",function(){return i.saveCredential()}),Pi(2,"span",2),TT(3),ul(),Pi(4,"mat-dialog-content"),_w(5,Z,3,1,"div",3),$h(6,"br"),Pi(7,"div",4)(8,"mat-form-field",5)(9,"mat-label"),TT(10,"User ID"),ul(),Pi(11,"input",6),Eg("ngModelChange",function(r){return ud(s),ST(i.data.user,r)||(i.data.user=r),dd(r)}),ul(),cD(),Pi(12,"mat-error"),TT(13," You must enter a User ID value "),ul()(),Pi(14,"mat-form-field",5)(15,"mat-label"),TT(16,"Password"),ul(),Pi(17,"input",7),Eg("ngModelChange",function(r){return ud(s),ST(i.data.password,r)||(i.data.password=r),dd(r)}),ul(),cD(),Pi(18,"mat-error"),TT(19," You must enter a password value "),ul()()()(),$h(20,"mat-divider"),Pi(21,"mat-dialog-actions")(22,"button",8),TT(23,"Cancel"),ul(),Pi(24,"button",9),TT(25,"Sign in"),ul()()();}if(d&2){let s=Jw(1);EE(3),gg(i.titleDialog),EE(2),Mw(i.data.error?5:-1),EE(6),Ig("ngModel",i.data.user),Bh("ngModelOptions",FT(8,X)),lD(),EE(6),Ig("ngModel",i.data.password),Bh("ngModelOptions",FT(9,X)),lD(),EE(5),Bh("mat-dialog-close",false),EE(2),Bh("disabled",!s.valid);}},dependencies:[Ln,Gn,Xe,Pn,kn,ft,rn,Qt,Nt,Vt,rt,ae,an,It,u,zt,xp,jt],styles:[".errorMsgBox[_ngcontent-%COMP%]{background-color:#fff8dc;color:#2f4f4f;display:flex;padding:5px;font-family:Arial,Times,serif;font-size:14px}.login-grid[_ngcontent-%COMP%]{display:grid;gap:10px;padding-left:10px;padding-right:10px}.userLoginInput[_ngcontent-%COMP%]{margin-bottom:10px}"]})}return a})();export{me as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d1 as Hj,w,du as p,dv as rt,$ as $j,aZ as R$1,v as vt,D as Dt,F as Fa,dn as ge,dS as Da,J as JD,cp as Uh,f as eg,K as Kw}from'./main-
|
|
1
|
+
import {d1 as Hj,w,du as p,dv as rt,$ as $j,aZ as R$1,v as vt,D as Dt,F as Fa,dn as ge,dS as Da,J as JD,cp as Uh,f as eg,K as Kw}from'./main-F7NMHHV4.js';import {c}from'./chunk-CRy9Da7a.js';var x=["canvasMainRef"],R=(()=>{class s{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);streams=w(rt);static DEFAULT_CONFIG={displayName:"Time Label",filterSelfPaths:true,paths:{gaugePath:{description:"Date / Time",path:null,source:null,pathType:"Date",isPathConfigurable:true,sampleTime:1e3}},dateFormat:"dd/MM/yyyy HH:mm:ss",dateTimezone:"Atlantic/Azores",color:"contrast",enableTimeout:false,dataTimeout:5};canvasMainRef=$j.required("canvasMainRef");canvasElement;canvasCtx=null;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;canvas=w(R$1);cssWidth=0;cssHeight=0;dataValue=vt(null);_timeZoneGTM="";isDestroyed=false;labelColor=vt("");valueColor="";maxTextWidth=0;maxTextHeight=0;displayName=Dt(()=>this.runtime.options()?.displayName??"Time Label");dateFormat=Dt(()=>this.runtime.options()?.dateFormat??"dd/MM/yyyy HH:mm:ss");dateTimezone=Dt(()=>this.runtime.options()?.dateTimezone??"System Timezone -");constructor(){Fa(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||ge(()=>{this.applyColors(),e.paths?.gaugePath?.path&&(this._timeZoneGTM=this.getGMTOffset(this.dateTimezone()),this.streams.observe("gaugePath",a=>{this.dataValue.set(a?.data?.value??null),this.drawWidget();}));});}),Fa(()=>{let e=this.theme(),t=this.runtime.options();!e||!t||ge(()=>{this.applyColors(),this.drawWidget();});});}ngAfterViewInit(){this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.maxTextWidth=Math.floor(this.cssWidth*.85),this.maxTextHeight=Math.floor(this.cssHeight*.7),this.drawWidget();}}),!this.isDestroyed&&(this.cssHeight=Math.floor(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.floor(this.canvasElement.getBoundingClientRect().width),this.maxTextWidth=Math.floor(this.canvasElement.width*.85),this.maxTextHeight=Math.floor(this.canvasElement.height*.7),this.applyColors(),this.drawWidget());}getGMTOffset(e){try{if(e==="System Timezone -")return "";let a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"}).formatToParts(new Date).find(M=>M.type==="timeZoneName");return a?a.value:"GMT"}catch(t){return console.error(`Error getting GMT offset for timezone "${e}":`,t),"GMT"}}applyColors(){let e=this.runtime.options(),t=this.theme();!e||!t||(this.labelColor.set(c(e.color??"contrast",t).dim),this.valueColor=c(e.color??"contrast",t).color);}ngOnDestroy(){this.isDestroyed=true;try{this.canvas.unregisterCanvas(this.canvasElement);}catch(e){}}drawWidget(){if(!this.canvasCtx)return;let e=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==`${this.displayName()}-${this.runtime.options()?.color??"contrast"}`||this.titleBitmapColor!==e)&&(this.titleBitmap=this.canvas.createTitleBitmap(this.displayName(),e,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=`${this.displayName()}-${this.runtime.options()?.color??"contrast"}`,this.titleBitmapColor=e),this.canvas.clearCanvas(this.canvasCtx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.canvasCtx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight);let t,i=this.dataValue();if(!i||isNaN(Date.parse(i)))t="--";else try{t=Da(i,this.dateFormat(),"en-US",this._timeZoneGTM);}catch(a){t=String(a),console.log("[Date Time Widget]: "+String(a));}this.canvas.drawText(this.canvasCtx,t,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2*1.15),this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor);}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=JD({type:s,selectors:[["widget-datetime"]],viewQuery:function(t,i){t&1&&eg(i.canvasMainRef,x,5),t&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"date-canvas"]],template:function(t,i){t&1&&Uh(0,"canvas",1,0);},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.date-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;min-height:1px;display:block}"]})}return s})();export{R as WidgetDatetimeComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-BTOTKeBo.js';import {d1 as Hj,w,du as p,dy as K,ao as ue,aZ as R,bu as ut,dw as S,$ as $j,a6 as Lr,D as Dt,F as Fa,dn as ge,b0 as Wl,J as JD,_ as _w,M as Mw,f as eg,K as Kw,cp as Uh,ci as dl,T as TT,cj as fl}from'./main-YKDNK5VZ.js';var _=["widgetDataChart"];function E(m,t){m&1&&Uh(0,"canvas",1,0);}function I(m,t){m&1&&(dl(0,"div",2)(1,"p"),TT(2,"Ready to configure"),fl(),dl(3,"p",3),TT(4,"Double-tap to begin"),fl()());}var U=class m{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);dsService=w(K);ngZone=w(ue);canvasService=w(R);unitsService=w(ut);datasetLifecycle=w(S);widgetDataChart=$j("widgetDataChart",{read:Lr});static DEFAULT_CONFIG={displayName:"Chart Label",color:"contrast",filterSelfPaths:true,datachartPath:null,datachartSource:null,convertUnitTo:null,timeScale:"minute",period:10,numDecimal:1,inverseYAxis:false,datasetAverageArray:"sma",showDataPoints:false,showAverageData:true,trackAgainstAverage:false,showDatasetMinimumValueLine:false,showDatasetMaximumValueLine:false,showDatasetAverageValueLine:true,showDatasetAngleAverageValueLine:false,showLabel:true,showTimeScale:false,startScaleAtZero:false,verticalChart:false,showYScale:false,yScaleSuggestedMin:void 0,yScaleSuggestedMax:void 0,enableMinMaxScaleLimit:false,yScaleMin:void 0,yScaleMax:void 0};lineChartData={datasets:[]};lineChartOptions={parsing:false,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.4}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart=null;dsServiceSub=null;datasetConfig=null;dataSourceInfo=null;lastVerticalChart=null;lastAverageValue=null;lastMinimumValue=null;lastMaximumValue=null;hasPath=Dt(()=>!!this.runtime.options()?.datachartPath);pathSignature=Dt(()=>{let t=this.runtime.options();if(t?.datachartPath)return [t.datachartPath,t.convertUnitTo,t.datachartSource,t.timeScale,t.period].join("|")});previousPathSignature=void 0;constructor(){Fa(()=>{let t=this.pathSignature();ge(()=>{t!==this.previousPathSignature&&ge(()=>{this.previousPathSignature=t;let e=this.runtime.options();e&&this.rebuildForDataset(e);});});}),Fa(()=>{let t=this.runtime.options(),e=this.theme();!t||!e||ge(()=>{this.lastVerticalChart!==null&&this.lastVerticalChart!==t.verticalChart?(this.lastVerticalChart=t.verticalChart??false,this.rebuildForDataset(t)):this.chart&&(this.ensureAverageDatasetPresence(),this.updateAnnotationVisibility(),this.applyDynamicTrackAverageStyling(),this.setChartOptions(t),this.setDatasetsColors(),this.ngZone.runOutsideAngular(()=>this.chart?.update("none")));});}),Fa(()=>{let t=this.runtime.options(),e=this.widgetDataChart(),a=this.hasPath();!t||!a||!e||this.chart||ge(()=>this.rebuildForDataset(t));});}rebuildForDataset(t){if(!t.datachartPath||!this.widgetDataChart()||(this.dsServiceSub?.unsubscribe(),this.lineChartData.datasets=[],this.datasetLifecycle.syncDataChartDataset(this.id(),t,this.pathSignature()),this.datasetConfig=this.dsService.getDatasetConfig(this.id())??null,this.dataSourceInfo=this.dsService.getDataSourceInfo(this.id())??null,!this.datasetConfig))return;this.createDatasets(t),this.setChartOptions(t),this.chart?.destroy();let a=this.widgetDataChart()?.nativeElement?.getContext("2d");a&&(this.chart=new Wl(a,{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.startStreaming(),this.ngZone.runOutsideAngular(()=>this.chart?.update()));}setChartOptions(t){let e=this.datasetConfig;e&&(this.lineChartOptions.maintainAspectRatio=false,this.lineChartOptions.animation=false,this.lineChartOptions.indexAxis=t.verticalChart?"y":"x",t.verticalChart?this.lineChartOptions.scales={y:{type:"realtime",display:t.showTimeScale,position:t.verticalChart?"right":"left",suggestedMin:void 0,suggestedMax:void 0,title:{display:true,text:`Last ${e.period} ${e.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:e.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:true,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}},x:{type:"linear",display:t.showYScale,position:t.verticalChart?"top":"bottom",suggestedMin:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMin,suggestedMax:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMax,min:t.enableMinMaxScaleLimit?t.yScaleMin:void 0,max:t.enableMinMaxScaleLimit?t.yScaleMax:void 0,beginAtZero:t.startScaleAtZero,reverse:t.inverseYAxis,title:{display:false,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:t.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}}}:this.lineChartOptions.scales={x:{type:"realtime",display:t.showTimeScale,title:{display:true,text:`Last ${e.period} ${e.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:e.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:true,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}},y:{display:t.showYScale,position:"right",suggestedMin:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMin,suggestedMax:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMax,min:t.enableMinMaxScaleLimit?t.yScaleMin:void 0,max:t.enableMinMaxScaleLimit?t.yScaleMax:void 0,beginAtZero:t.startScaleAtZero,reverse:t.inverseYAxis,title:{display:false,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:t.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}}},this.lineChartOptions.plugins={title:{display:true,align:"end",padding:{top:3,bottom:0},text:"",font:{size:32},color:this.getThemeColors().chartValue},subtitle:{display:t.showLabel,align:"start",padding:{top:-35,bottom:20},text:` ${t.displayName}`,font:{size:22},color:this.getThemeColors().chartLabel},annotation:{annotations:{minimumLine:{type:"line",scaleID:t.verticalChart?"x":"y",display:t.showDatasetMinimumValueLine&&this.lastMinimumValue!==null,value:this.lastMinimumValue??0,drawTime:"afterDatasetsDraw",label:{display:t.showDatasetMinimumValueLine&&this.lastMinimumValue!==null,content:this.lastMinimumValue!==null?`${this.lastMinimumValue.toFixed(t.numDecimal??1)}`:"",position:"start",yAdjust:12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},maximumLine:{type:"line",scaleID:t.verticalChart?"x":"y",display:t.showDatasetMaximumValueLine&&this.lastMaximumValue!==null,value:this.lastMaximumValue??0,drawTime:"afterDatasetsDraw",label:{display:t.showDatasetMaximumValueLine&&this.lastMaximumValue!==null,content:this.lastMaximumValue!==null?`${this.lastMaximumValue.toFixed(t.numDecimal??1)}`:"",position:"start",yAdjust:-12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},averageLine:{type:"line",scaleID:t.verticalChart?"x":"y",display:t.showDatasetAverageValueLine&&this.lastAverageValue!==null,value:this.lastAverageValue??0,borderDash:[6,6],borderColor:this.getThemeColors().averageChartLine,drawTime:"afterDatasetsDraw",label:{display:t.showDatasetAverageValueLine&&this.lastAverageValue!==null,content:this.lastAverageValue!==null?`${this.lastAverageValue.toFixed(t.numDecimal??1)}`:"",position:"start",padding:4,color:this.getThemeColors().chartValue,backgroundColor:"rgba(63,63,63,0.7)"}}}},legend:{display:false},streaming:{duration:(this.dataSourceInfo?.maxDataPoints??0)*(this.dataSourceInfo?.sampleTime??0),delay:this.dataSourceInfo?.sampleTime??0,frameRate:e.timeScaleFormat==="day"?5:e.timeScaleFormat==="hour"?8:e.timeScaleFormat==="minute"?15:30}});}createDatasets(t){let e,a;t.inverseYAxis&&t.trackAgainstAverage?(e="start",a=false):t.inverseYAxis&&!t.trackAgainstAverage?(e=false,a="start"):!t.inverseYAxis&&t.trackAgainstAverage?(e=true,a=false):(e=false,a=true),this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:t.trackAgainstAverage?1:0,parsing:false,tension:0,pointRadius:t.showDataPoints?t.trackAgainstAverage?0:1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:t.trackAgainstAverage||t.showDataPoints?0:3,fill:e}),t.showAverageData&&this.lineChartData.datasets.push({label:"Average",data:[],order:t.trackAgainstAverage?0:1,parsing:false,tension:.4,pointRadius:t.showDataPoints&&t.trackAgainstAverage?1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:t.trackAgainstAverage?t.showDataPoints?0:3:0,fill:a}),this.setDatasetsColors();}setDatasetsColors(){this.lineChartData.datasets.forEach(t=>{t.label==="Value"?(t.borderColor=this.getThemeColors().valueLine,t.backgroundColor=this.getThemeColors().valueFill):t.label==="Average"&&(t.borderColor=this.getThemeColors().averageLine,t.backgroundColor=this.getThemeColors().averageFill);});}ensureAverageDatasetPresence(){let t=this.runtime.options();if(!t||!this.chart)return;let e=this.lineChartData.datasets.some(a=>a.label==="Average");if(t.showAverageData&&!e){if(this.lineChartData.datasets.findIndex(n=>n.label==="Value")>=0){let n=t.inverseYAxis?t.trackAgainstAverage?false:"start":!t.trackAgainstAverage;this.lineChartData.datasets.push({label:"Average",data:[],order:t.trackAgainstAverage?0:1,parsing:false,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:t.trackAgainstAverage?3:0,fill:n});}}else !t.showAverageData&&e&&(this.lineChartData.datasets=this.lineChartData.datasets.filter(a=>a.label!=="Average"));}applyDynamicTrackAverageStyling(){let t=this.runtime.options();if(!t)return;let e=this.lineChartData.datasets.find(l=>l.label==="Value"),a=this.lineChartData.datasets.find(l=>l.label==="Average"),n,r;t.inverseYAxis&&t.trackAgainstAverage?(n="start",r=false):t.inverseYAxis&&!t.trackAgainstAverage?(n=false,r="start"):!t.inverseYAxis&&t.trackAgainstAverage?(n=true,r=false):(n=false,r=true),e&&(e.order=t.trackAgainstAverage?1:0,e.borderWidth=t.trackAgainstAverage?0:3,e.fill=n),a&&(a.order=t.trackAgainstAverage?0:1,a.borderWidth=t.trackAgainstAverage?3:0,a.fill=r);}updateAnnotationVisibility(){let t=this.runtime.options();if(!t||!this.chart)return;let e=this.chart.options.plugins.annotation?.annotations;if(e){if(e.minimumLine){let a=t.showDatasetMinimumValueLine&&this.lastMinimumValue!==null;e.minimumLine.display=a,e.minimumLine.label&&(e.minimumLine.label.display=a);}if(e.maximumLine){let a=t.showDatasetMaximumValueLine&&this.lastMaximumValue!==null;e.maximumLine.display=a,e.maximumLine.label&&(e.maximumLine.label.display=a);}if(e.averageLine){let a=t.showDatasetAverageValueLine&&this.lastAverageValue!==null;e.averageLine.display=a,e.averageLine.label&&(e.averageLine.label.display=a);}}}getThemeColors(){let t=this.runtime.options()?.color,e={valueLine:"",valueFill:"",averageLine:"",averageFill:"",averageChartLine:"",chartLabel:"",chartValue:""};switch(t){case "contrast":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().contrastDimmer,e.valueFill=this.theme().contrastDimmer,e.averageLine=this.theme().contrast,e.averageFill=this.theme().contrast,e.chartValue=e.averageLine):(e.valueLine=this.theme().contrast,e.valueFill=this.theme().contrast,e.averageLine=this.theme().contrastDimmer,e.averageFill=this.theme().contrastDimmer,e.chartValue=this.theme().contrast),e.averageChartLine=this.theme().contrastDim,e.chartLabel=this.theme().contrastDim;break;case "blue":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().blueDimmer,e.valueFill=this.theme().blueDimmer,e.averageLine=this.theme().blue,e.averageFill=this.theme().blue,e.chartValue=e.averageLine):(e.valueLine=this.theme().blue,e.valueFill=this.theme().blue,e.averageLine=this.theme().blueDimmer,e.averageFill=this.theme().blueDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().blueDim,e.chartLabel=this.theme().contrastDim;break;case "green":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().greenDimmer,e.valueFill=this.theme().greenDimmer,e.averageLine=this.theme().green,e.averageFill=this.theme().green,e.chartValue=e.averageLine):(e.valueLine=this.theme().green,e.valueFill=this.theme().green,e.averageLine=this.theme().greenDimmer,e.averageFill=this.theme().greenDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().greenDim,e.chartLabel=this.theme().contrastDim;break;case "pink":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().pinkDimmer,e.valueFill=this.theme().pinkDimmer,e.averageLine=this.theme().pink,e.averageFill=this.theme().pink,e.chartValue=e.averageLine):(e.valueLine=this.theme().pink,e.valueFill=this.theme().pink,e.averageLine=this.theme().pinkDimmer,e.averageFill=this.theme().pinkDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().pinkDim,e.chartLabel=this.theme().contrastDim;break;case "orange":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().orangeDimmer,e.valueFill=this.theme().orangeDimmer,e.averageLine=this.theme().orange,e.averageFill=this.theme().orange,e.chartValue=e.averageLine):(e.valueLine=this.theme().orange,e.valueFill=this.theme().orange,e.averageLine=this.theme().orangeDimmer,e.averageFill=this.theme().orangeDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().orangeDim,e.chartLabel=this.theme().contrastDim;break;case "purple":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().purpleDimmer,e.valueFill=this.theme().purpleDimmer,e.averageLine=this.theme().purple,e.averageFill=this.theme().purple,e.chartValue=e.averageLine):(e.valueLine=this.theme().purple,e.valueFill=this.theme().purple,e.averageLine=this.theme().purpleDimmer,e.averageFill=this.theme().purpleDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().purpleDim,e.chartLabel=this.theme().contrastDim;break;case "grey":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().greyDimmer,e.valueFill=this.theme().greyDimmer,e.averageLine=this.theme().grey,e.averageFill=this.theme().grey,e.chartValue=e.averageLine):(e.valueLine=this.theme().grey,e.valueFill=this.theme().grey,e.averageLine=this.theme().greyDimmer,e.averageFill=this.theme().greyDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().greyDim,e.chartLabel=this.theme().contrastDim;break;case "yellow":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().yellowDimmer,e.valueFill=this.theme().yellowDimmer,e.averageLine=this.theme().yellow,e.averageFill=this.theme().yellow,e.chartValue=e.averageLine):(e.valueLine=this.theme().yellow,e.valueFill=this.theme().yellow,e.averageLine=this.theme().yellowDimmer,e.averageFill=this.theme().yellowDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().yellowDim,e.chartLabel=this.theme().contrastDim;break}return e}getUnitsLabel(){let t="",e=this.runtime.options()?.convertUnitTo??"";switch(e){case "percent":case "percentraw":t="%";break;case "latitudeMin":t="latitude in minutes";break;case "latitudeSec":t="latitude in secondes";break;case "longitudeMin":t="longitude in minutes";break;case "longitudeSec":t="longitude in secondes";break;default:t=e;break}return t}startStreaming(){let t=this.runtime.options();if(!t?.datachartPath)return;this.dsServiceSub?.unsubscribe();let e=this.dsService.getDatasetBatchThenLiveObservable(this.id());e&&(this.dsServiceSub=e.subscribe(a=>{if(this.chart){if(Array.isArray(a)){let n=this.transformDatasetRows(a,0);if(this.chart.data.datasets[0].data.push(...n),t.showAverageData&&this.lineChartData.datasets[1]){let l=t.datasetAverageArray??"sma",s=this.transformDatasetRows(a,l);this.chart.data.datasets[1].data.push(...s);}let r=a[a.length-1];r&&this.applyTitleAndAnnotationValues(r,t);}else {let n=this.transformDatasetRows([a],0)[0];if(this.chart.data.datasets[0].data.push(n),t.showAverageData&&this.lineChartData.datasets[1]){let r=t.datasetAverageArray??"sma",l=this.transformDatasetRows([a],r)[0];this.chart.data.datasets[1].data.push(l);}this.applyTitleAndAnnotationValues(a,t);}this.ngZone.runOutsideAngular(()=>this.chart?.update("none"));}}));}applyTitleAndAnnotationValues(t,e){if(!this.chart)return;let a=e.convertUnitTo??"",n=e.numDecimal??1,r=e.trackAgainstAverage?t.data.sma??t.data.value:t.data.value,l=this.unitsService.convertToUnit(a,r);if(l!=null&&Number.isFinite(l)){let y=this.chart.options.plugins;y?.title&&(y.title.text=`${l.toFixed(n)} ${this.getUnitsLabel()} `);}let s=t.data.lastAverage!=null?this.unitsService.convertToUnit(a,t.data.lastAverage)??void 0:void 0,h=t.data.lastMinimum!=null?this.unitsService.convertToUnit(a,t.data.lastMinimum)??void 0:void 0,g=t.data.lastMaximum!=null?this.unitsService.convertToUnit(a,t.data.lastMaximum)??void 0:void 0,i=this.chart.options.plugins.annotation?.annotations;i&&(this.lastAverageValue=s!=null&&Number.isFinite(s)?s:null,this.lastMinimumValue=h!=null&&Number.isFinite(h)?h:null,this.lastMaximumValue=g!=null&&Number.isFinite(g)?g:null,i.averageLine&&(this.lastAverageValue!==null?(i.averageLine.value=this.lastAverageValue,i.averageLine.display=e.showDatasetAverageValueLine,i.averageLine.label&&(i.averageLine.label.display=e.showDatasetAverageValueLine,i.averageLine.label.content=`${this.lastAverageValue.toFixed(n)}`)):(i.averageLine.display=false,i.averageLine.label&&(i.averageLine.label.display=false,i.averageLine.label.content=""))),i.minimumLine&&(this.lastMinimumValue!==null?(i.minimumLine.value=this.lastMinimumValue,i.minimumLine.display=e.showDatasetMinimumValueLine,i.minimumLine.label&&(i.minimumLine.label.display=e.showDatasetMinimumValueLine,i.minimumLine.label.content=`${this.lastMinimumValue.toFixed(n)}`)):(i.minimumLine.display=false,i.minimumLine.label&&(i.minimumLine.label.display=false,i.minimumLine.label.content=""))),i.maximumLine&&(this.lastMaximumValue!==null?(i.maximumLine.value=this.lastMaximumValue,i.maximumLine.display=e.showDatasetMaximumValueLine,i.maximumLine.label&&(i.maximumLine.label.display=e.showDatasetMaximumValueLine,i.maximumLine.label.content=`${this.lastMaximumValue.toFixed(n)}`)):(i.maximumLine.display=false,i.maximumLine.label&&(i.maximumLine.label.display=false,i.maximumLine.label.content=""))));}transformDatasetRows(t,e){let a=this.runtime.options();if(!a)return [];let n=s=>this.unitsService.convertToUnit(a.convertUnitTo??"",s)??s,r=a.verticalChart===true,l=a.datasetAverageArray;return t.map(s=>{if(r){if(e===0)return {x:n(s.data.value),y:s.timestamp};{let h={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return {x:n(h[l]??s.data.value),y:s.timestamp}}}else {if(e===0)return {x:s.timestamp,y:n(s.data.value)};{let h={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return {x:s.timestamp,y:n(h[l]??s.data.value)}}}})}ngOnDestroy(){this.dsServiceSub?.unsubscribe(),this.chart?.destroy();let t=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(t,{clear:true,removeFromDom:true});}static \u0275fac=function(e){return new(e||m)};static \u0275cmp=JD({type:m,selectors:[["widget-data-chart"]],viewQuery:function(e,a){e&1&&eg(a.widgetDataChart,_,5,Lr),e&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:1,consts:[["widgetDataChart",""],[2,"z-index","inherit"],[1,"empty-state"],[1,"hint"]],template:function(e,a){e&1&&_w(0,E,2,0,"canvas",1)(1,I,5,0,"div",2),e&2&&Mw(a.hasPath()?0:1);},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;width:100%;text-align:center;color:var(--mat-sys-on-surface-variant)}.empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:4px 0;padding:0 16px}.empty-state[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{font-size:.85em;opacity:.7}"]})};export{U as WidgetDataChartComponent};
|
|
1
|
+
import'./chunk-CJhkckXA.js';import {d1 as Hj,w,du as p,dy as K,ao as ue,aZ as R,bu as ut,dw as S,$ as $j,a6 as Lr,D as Dt,F as Fa,dn as ge,b0 as Wl,J as JD,_ as _w,M as Mw,f as eg,K as Kw,cp as Uh,ci as dl,T as TT,cj as fl}from'./main-F7NMHHV4.js';var _=["widgetDataChart"];function E(m,t){m&1&&Uh(0,"canvas",1,0);}function I(m,t){m&1&&(dl(0,"div",2)(1,"p"),TT(2,"Ready to configure"),fl(),dl(3,"p",3),TT(4,"Double-tap to begin"),fl()());}var U=class m{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);dsService=w(K);ngZone=w(ue);canvasService=w(R);unitsService=w(ut);datasetLifecycle=w(S);widgetDataChart=$j("widgetDataChart",{read:Lr});static DEFAULT_CONFIG={displayName:"Chart Label",color:"contrast",filterSelfPaths:true,datachartPath:null,datachartSource:null,convertUnitTo:null,timeScale:"minute",period:10,numDecimal:1,inverseYAxis:false,datasetAverageArray:"sma",showDataPoints:false,showAverageData:true,trackAgainstAverage:false,showDatasetMinimumValueLine:false,showDatasetMaximumValueLine:false,showDatasetAverageValueLine:true,showDatasetAngleAverageValueLine:false,showLabel:true,showTimeScale:false,startScaleAtZero:false,verticalChart:false,showYScale:false,yScaleSuggestedMin:void 0,yScaleSuggestedMax:void 0,enableMinMaxScaleLimit:false,yScaleMin:void 0,yScaleMax:void 0};lineChartData={datasets:[]};lineChartOptions={parsing:false,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.4}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart=null;dsServiceSub=null;datasetConfig=null;dataSourceInfo=null;lastVerticalChart=null;lastAverageValue=null;lastMinimumValue=null;lastMaximumValue=null;hasPath=Dt(()=>!!this.runtime.options()?.datachartPath);pathSignature=Dt(()=>{let t=this.runtime.options();if(t?.datachartPath)return [t.datachartPath,t.convertUnitTo,t.datachartSource,t.timeScale,t.period].join("|")});previousPathSignature=void 0;constructor(){Fa(()=>{let t=this.pathSignature();ge(()=>{t!==this.previousPathSignature&&ge(()=>{this.previousPathSignature=t;let e=this.runtime.options();e&&this.rebuildForDataset(e);});});}),Fa(()=>{let t=this.runtime.options(),e=this.theme();!t||!e||ge(()=>{this.lastVerticalChart!==null&&this.lastVerticalChart!==t.verticalChart?(this.lastVerticalChart=t.verticalChart??false,this.rebuildForDataset(t)):this.chart&&(this.ensureAverageDatasetPresence(),this.updateAnnotationVisibility(),this.applyDynamicTrackAverageStyling(),this.setChartOptions(t),this.setDatasetsColors(),this.ngZone.runOutsideAngular(()=>this.chart?.update("none")));});}),Fa(()=>{let t=this.runtime.options(),e=this.widgetDataChart(),a=this.hasPath();!t||!a||!e||this.chart||ge(()=>this.rebuildForDataset(t));});}rebuildForDataset(t){if(!t.datachartPath||!this.widgetDataChart()||(this.dsServiceSub?.unsubscribe(),this.lineChartData.datasets=[],this.datasetLifecycle.syncDataChartDataset(this.id(),t,this.pathSignature()),this.datasetConfig=this.dsService.getDatasetConfig(this.id())??null,this.dataSourceInfo=this.dsService.getDataSourceInfo(this.id())??null,!this.datasetConfig))return;this.createDatasets(t),this.setChartOptions(t),this.chart?.destroy();let a=this.widgetDataChart()?.nativeElement?.getContext("2d");a&&(this.chart=new Wl(a,{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.startStreaming(),this.ngZone.runOutsideAngular(()=>this.chart?.update()));}setChartOptions(t){let e=this.datasetConfig;e&&(this.lineChartOptions.maintainAspectRatio=false,this.lineChartOptions.animation=false,this.lineChartOptions.indexAxis=t.verticalChart?"y":"x",t.verticalChart?this.lineChartOptions.scales={y:{type:"realtime",display:t.showTimeScale,position:t.verticalChart?"right":"left",suggestedMin:void 0,suggestedMax:void 0,title:{display:true,text:`Last ${e.period} ${e.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:e.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:true,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}},x:{type:"linear",display:t.showYScale,position:t.verticalChart?"top":"bottom",suggestedMin:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMin,suggestedMax:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMax,min:t.enableMinMaxScaleLimit?t.yScaleMin:void 0,max:t.enableMinMaxScaleLimit?t.yScaleMax:void 0,beginAtZero:t.startScaleAtZero,reverse:t.inverseYAxis,title:{display:false,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:t.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}}}:this.lineChartOptions.scales={x:{type:"realtime",display:t.showTimeScale,title:{display:true,text:`Last ${e.period} ${e.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:e.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:true,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}},y:{display:t.showYScale,position:"right",suggestedMin:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMin,suggestedMax:t.enableMinMaxScaleLimit?void 0:t.yScaleSuggestedMax,min:t.enableMinMaxScaleLimit?t.yScaleMin:void 0,max:t.enableMinMaxScaleLimit?t.yScaleMax:void 0,beginAtZero:t.startScaleAtZero,reverse:t.inverseYAxis,title:{display:false,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:t.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:true,color:this.theme().contrastDimmer}}},this.lineChartOptions.plugins={title:{display:true,align:"end",padding:{top:3,bottom:0},text:"",font:{size:32},color:this.getThemeColors().chartValue},subtitle:{display:t.showLabel,align:"start",padding:{top:-35,bottom:20},text:` ${t.displayName}`,font:{size:22},color:this.getThemeColors().chartLabel},annotation:{annotations:{minimumLine:{type:"line",scaleID:t.verticalChart?"x":"y",display:t.showDatasetMinimumValueLine&&this.lastMinimumValue!==null,value:this.lastMinimumValue??0,drawTime:"afterDatasetsDraw",label:{display:t.showDatasetMinimumValueLine&&this.lastMinimumValue!==null,content:this.lastMinimumValue!==null?`${this.lastMinimumValue.toFixed(t.numDecimal??1)}`:"",position:"start",yAdjust:12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},maximumLine:{type:"line",scaleID:t.verticalChart?"x":"y",display:t.showDatasetMaximumValueLine&&this.lastMaximumValue!==null,value:this.lastMaximumValue??0,drawTime:"afterDatasetsDraw",label:{display:t.showDatasetMaximumValueLine&&this.lastMaximumValue!==null,content:this.lastMaximumValue!==null?`${this.lastMaximumValue.toFixed(t.numDecimal??1)}`:"",position:"start",yAdjust:-12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},averageLine:{type:"line",scaleID:t.verticalChart?"x":"y",display:t.showDatasetAverageValueLine&&this.lastAverageValue!==null,value:this.lastAverageValue??0,borderDash:[6,6],borderColor:this.getThemeColors().averageChartLine,drawTime:"afterDatasetsDraw",label:{display:t.showDatasetAverageValueLine&&this.lastAverageValue!==null,content:this.lastAverageValue!==null?`${this.lastAverageValue.toFixed(t.numDecimal??1)}`:"",position:"start",padding:4,color:this.getThemeColors().chartValue,backgroundColor:"rgba(63,63,63,0.7)"}}}},legend:{display:false},streaming:{duration:(this.dataSourceInfo?.maxDataPoints??0)*(this.dataSourceInfo?.sampleTime??0),delay:this.dataSourceInfo?.sampleTime??0,frameRate:e.timeScaleFormat==="day"?5:e.timeScaleFormat==="hour"?8:e.timeScaleFormat==="minute"?15:30}});}createDatasets(t){let e,a;t.inverseYAxis&&t.trackAgainstAverage?(e="start",a=false):t.inverseYAxis&&!t.trackAgainstAverage?(e=false,a="start"):!t.inverseYAxis&&t.trackAgainstAverage?(e=true,a=false):(e=false,a=true),this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:t.trackAgainstAverage?1:0,parsing:false,tension:0,pointRadius:t.showDataPoints?t.trackAgainstAverage?0:1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:t.trackAgainstAverage||t.showDataPoints?0:3,fill:e}),t.showAverageData&&this.lineChartData.datasets.push({label:"Average",data:[],order:t.trackAgainstAverage?0:1,parsing:false,tension:.4,pointRadius:t.showDataPoints&&t.trackAgainstAverage?1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:t.trackAgainstAverage?t.showDataPoints?0:3:0,fill:a}),this.setDatasetsColors();}setDatasetsColors(){this.lineChartData.datasets.forEach(t=>{t.label==="Value"?(t.borderColor=this.getThemeColors().valueLine,t.backgroundColor=this.getThemeColors().valueFill):t.label==="Average"&&(t.borderColor=this.getThemeColors().averageLine,t.backgroundColor=this.getThemeColors().averageFill);});}ensureAverageDatasetPresence(){let t=this.runtime.options();if(!t||!this.chart)return;let e=this.lineChartData.datasets.some(a=>a.label==="Average");if(t.showAverageData&&!e){if(this.lineChartData.datasets.findIndex(n=>n.label==="Value")>=0){let n=t.inverseYAxis?t.trackAgainstAverage?false:"start":!t.trackAgainstAverage;this.lineChartData.datasets.push({label:"Average",data:[],order:t.trackAgainstAverage?0:1,parsing:false,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:t.trackAgainstAverage?3:0,fill:n});}}else !t.showAverageData&&e&&(this.lineChartData.datasets=this.lineChartData.datasets.filter(a=>a.label!=="Average"));}applyDynamicTrackAverageStyling(){let t=this.runtime.options();if(!t)return;let e=this.lineChartData.datasets.find(l=>l.label==="Value"),a=this.lineChartData.datasets.find(l=>l.label==="Average"),n,r;t.inverseYAxis&&t.trackAgainstAverage?(n="start",r=false):t.inverseYAxis&&!t.trackAgainstAverage?(n=false,r="start"):!t.inverseYAxis&&t.trackAgainstAverage?(n=true,r=false):(n=false,r=true),e&&(e.order=t.trackAgainstAverage?1:0,e.borderWidth=t.trackAgainstAverage?0:3,e.fill=n),a&&(a.order=t.trackAgainstAverage?0:1,a.borderWidth=t.trackAgainstAverage?3:0,a.fill=r);}updateAnnotationVisibility(){let t=this.runtime.options();if(!t||!this.chart)return;let e=this.chart.options.plugins.annotation?.annotations;if(e){if(e.minimumLine){let a=t.showDatasetMinimumValueLine&&this.lastMinimumValue!==null;e.minimumLine.display=a,e.minimumLine.label&&(e.minimumLine.label.display=a);}if(e.maximumLine){let a=t.showDatasetMaximumValueLine&&this.lastMaximumValue!==null;e.maximumLine.display=a,e.maximumLine.label&&(e.maximumLine.label.display=a);}if(e.averageLine){let a=t.showDatasetAverageValueLine&&this.lastAverageValue!==null;e.averageLine.display=a,e.averageLine.label&&(e.averageLine.label.display=a);}}}getThemeColors(){let t=this.runtime.options()?.color,e={valueLine:"",valueFill:"",averageLine:"",averageFill:"",averageChartLine:"",chartLabel:"",chartValue:""};switch(t){case "contrast":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().contrastDimmer,e.valueFill=this.theme().contrastDimmer,e.averageLine=this.theme().contrast,e.averageFill=this.theme().contrast,e.chartValue=e.averageLine):(e.valueLine=this.theme().contrast,e.valueFill=this.theme().contrast,e.averageLine=this.theme().contrastDimmer,e.averageFill=this.theme().contrastDimmer,e.chartValue=this.theme().contrast),e.averageChartLine=this.theme().contrastDim,e.chartLabel=this.theme().contrastDim;break;case "blue":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().blueDimmer,e.valueFill=this.theme().blueDimmer,e.averageLine=this.theme().blue,e.averageFill=this.theme().blue,e.chartValue=e.averageLine):(e.valueLine=this.theme().blue,e.valueFill=this.theme().blue,e.averageLine=this.theme().blueDimmer,e.averageFill=this.theme().blueDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().blueDim,e.chartLabel=this.theme().contrastDim;break;case "green":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().greenDimmer,e.valueFill=this.theme().greenDimmer,e.averageLine=this.theme().green,e.averageFill=this.theme().green,e.chartValue=e.averageLine):(e.valueLine=this.theme().green,e.valueFill=this.theme().green,e.averageLine=this.theme().greenDimmer,e.averageFill=this.theme().greenDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().greenDim,e.chartLabel=this.theme().contrastDim;break;case "pink":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().pinkDimmer,e.valueFill=this.theme().pinkDimmer,e.averageLine=this.theme().pink,e.averageFill=this.theme().pink,e.chartValue=e.averageLine):(e.valueLine=this.theme().pink,e.valueFill=this.theme().pink,e.averageLine=this.theme().pinkDimmer,e.averageFill=this.theme().pinkDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().pinkDim,e.chartLabel=this.theme().contrastDim;break;case "orange":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().orangeDimmer,e.valueFill=this.theme().orangeDimmer,e.averageLine=this.theme().orange,e.averageFill=this.theme().orange,e.chartValue=e.averageLine):(e.valueLine=this.theme().orange,e.valueFill=this.theme().orange,e.averageLine=this.theme().orangeDimmer,e.averageFill=this.theme().orangeDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().orangeDim,e.chartLabel=this.theme().contrastDim;break;case "purple":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().purpleDimmer,e.valueFill=this.theme().purpleDimmer,e.averageLine=this.theme().purple,e.averageFill=this.theme().purple,e.chartValue=e.averageLine):(e.valueLine=this.theme().purple,e.valueFill=this.theme().purple,e.averageLine=this.theme().purpleDimmer,e.averageFill=this.theme().purpleDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().purpleDim,e.chartLabel=this.theme().contrastDim;break;case "grey":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().greyDimmer,e.valueFill=this.theme().greyDimmer,e.averageLine=this.theme().grey,e.averageFill=this.theme().grey,e.chartValue=e.averageLine):(e.valueLine=this.theme().grey,e.valueFill=this.theme().grey,e.averageLine=this.theme().greyDimmer,e.averageFill=this.theme().greyDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().greyDim,e.chartLabel=this.theme().contrastDim;break;case "yellow":this.runtime.options()?.trackAgainstAverage?(e.valueLine=this.theme().yellowDimmer,e.valueFill=this.theme().yellowDimmer,e.averageLine=this.theme().yellow,e.averageFill=this.theme().yellow,e.chartValue=e.averageLine):(e.valueLine=this.theme().yellow,e.valueFill=this.theme().yellow,e.averageLine=this.theme().yellowDimmer,e.averageFill=this.theme().yellowDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().yellowDim,e.chartLabel=this.theme().contrastDim;break}return e}getUnitsLabel(){let t="",e=this.runtime.options()?.convertUnitTo??"";switch(e){case "percent":case "percentraw":t="%";break;case "latitudeMin":t="latitude in minutes";break;case "latitudeSec":t="latitude in secondes";break;case "longitudeMin":t="longitude in minutes";break;case "longitudeSec":t="longitude in secondes";break;default:t=e;break}return t}startStreaming(){let t=this.runtime.options();if(!t?.datachartPath)return;this.dsServiceSub?.unsubscribe();let e=this.dsService.getDatasetBatchThenLiveObservable(this.id());e&&(this.dsServiceSub=e.subscribe(a=>{if(this.chart){if(Array.isArray(a)){let n=this.transformDatasetRows(a,0);if(this.chart.data.datasets[0].data.push(...n),t.showAverageData&&this.lineChartData.datasets[1]){let l=t.datasetAverageArray??"sma",s=this.transformDatasetRows(a,l);this.chart.data.datasets[1].data.push(...s);}let r=a[a.length-1];r&&this.applyTitleAndAnnotationValues(r,t);}else {let n=this.transformDatasetRows([a],0)[0];if(this.chart.data.datasets[0].data.push(n),t.showAverageData&&this.lineChartData.datasets[1]){let r=t.datasetAverageArray??"sma",l=this.transformDatasetRows([a],r)[0];this.chart.data.datasets[1].data.push(l);}this.applyTitleAndAnnotationValues(a,t);}this.ngZone.runOutsideAngular(()=>this.chart?.update("none"));}}));}applyTitleAndAnnotationValues(t,e){if(!this.chart)return;let a=e.convertUnitTo??"",n=e.numDecimal??1,r=e.trackAgainstAverage?t.data.sma??t.data.value:t.data.value,l=this.unitsService.convertToUnit(a,r);if(l!=null&&Number.isFinite(l)){let y=this.chart.options.plugins;y?.title&&(y.title.text=`${l.toFixed(n)} ${this.getUnitsLabel()} `);}let s=t.data.lastAverage!=null?this.unitsService.convertToUnit(a,t.data.lastAverage)??void 0:void 0,h=t.data.lastMinimum!=null?this.unitsService.convertToUnit(a,t.data.lastMinimum)??void 0:void 0,g=t.data.lastMaximum!=null?this.unitsService.convertToUnit(a,t.data.lastMaximum)??void 0:void 0,i=this.chart.options.plugins.annotation?.annotations;i&&(this.lastAverageValue=s!=null&&Number.isFinite(s)?s:null,this.lastMinimumValue=h!=null&&Number.isFinite(h)?h:null,this.lastMaximumValue=g!=null&&Number.isFinite(g)?g:null,i.averageLine&&(this.lastAverageValue!==null?(i.averageLine.value=this.lastAverageValue,i.averageLine.display=e.showDatasetAverageValueLine,i.averageLine.label&&(i.averageLine.label.display=e.showDatasetAverageValueLine,i.averageLine.label.content=`${this.lastAverageValue.toFixed(n)}`)):(i.averageLine.display=false,i.averageLine.label&&(i.averageLine.label.display=false,i.averageLine.label.content=""))),i.minimumLine&&(this.lastMinimumValue!==null?(i.minimumLine.value=this.lastMinimumValue,i.minimumLine.display=e.showDatasetMinimumValueLine,i.minimumLine.label&&(i.minimumLine.label.display=e.showDatasetMinimumValueLine,i.minimumLine.label.content=`${this.lastMinimumValue.toFixed(n)}`)):(i.minimumLine.display=false,i.minimumLine.label&&(i.minimumLine.label.display=false,i.minimumLine.label.content=""))),i.maximumLine&&(this.lastMaximumValue!==null?(i.maximumLine.value=this.lastMaximumValue,i.maximumLine.display=e.showDatasetMaximumValueLine,i.maximumLine.label&&(i.maximumLine.label.display=e.showDatasetMaximumValueLine,i.maximumLine.label.content=`${this.lastMaximumValue.toFixed(n)}`)):(i.maximumLine.display=false,i.maximumLine.label&&(i.maximumLine.label.display=false,i.maximumLine.label.content=""))));}transformDatasetRows(t,e){let a=this.runtime.options();if(!a)return [];let n=s=>this.unitsService.convertToUnit(a.convertUnitTo??"",s)??s,r=a.verticalChart===true,l=a.datasetAverageArray;return t.map(s=>{if(r){if(e===0)return {x:n(s.data.value),y:s.timestamp};{let h={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return {x:n(h[l]??s.data.value),y:s.timestamp}}}else {if(e===0)return {x:s.timestamp,y:n(s.data.value)};{let h={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return {x:s.timestamp,y:n(h[l]??s.data.value)}}}})}ngOnDestroy(){this.dsServiceSub?.unsubscribe(),this.chart?.destroy();let t=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(t,{clear:true,removeFromDom:true});}static \u0275fac=function(e){return new(e||m)};static \u0275cmp=JD({type:m,selectors:[["widget-data-chart"]],viewQuery:function(e,a){e&1&&eg(a.widgetDataChart,_,5,Lr),e&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:1,consts:[["widgetDataChart",""],[2,"z-index","inherit"],[1,"empty-state"],[1,"hint"]],template:function(e,a){e&1&&_w(0,E,2,0,"canvas",1)(1,I,5,0,"div",2),e&2&&Mw(a.hasPath()?0:1);},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;width:100%;text-align:center;color:var(--mat-sys-on-surface-variant)}.empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:4px 0;padding:0 16px}.empty-state[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{font-size:.85em;opacity:.7}"]})};export{U as WidgetDataChartComponent};
|