@mxtommy/kip 4.8.2 → 4.8.4

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/package.json +27 -4
  3. package/public/{chunk-BIYHVfJl.js → chunk-07zHjmg-.js} +1 -1
  4. package/public/{chunk-NnB8OYZt.js → chunk-0z3nIRXw.js} +1 -1
  5. package/public/{chunk-CCiqU2uY.js → chunk-B09jfNia.js} +1 -1
  6. package/public/{chunk-Bq-eHuZV.js → chunk-B0D54iJs.js} +1 -1
  7. package/public/{chunk-DfGLo6Tb.js → chunk-B0eE4udE.js} +1 -1
  8. package/public/{chunk-CkfPr-c5.js → chunk-B9nVBlGj.js} +1 -1
  9. package/public/{chunk-B8zRhoG8.js → chunk-BFpzxIIT.js} +1 -1
  10. package/public/{chunk-D_wrJJxl.js → chunk-BIb-xYiS.js} +1 -1
  11. package/public/{chunk-CSpA60X7.js → chunk-BJ-wyixK.js} +1 -1
  12. package/public/{chunk-Bb1mO304.js → chunk-BLEZOsfR.js} +1 -1
  13. package/public/{chunk-7lulvsGI.js → chunk-BN7A4g6c.js} +1 -1
  14. package/public/{chunk-h2q_pbbF.js → chunk-BTOTKeBo.js} +1 -1
  15. package/public/{chunk-DjavLLpP.js → chunk-BUguZ7cK.js} +1 -1
  16. package/public/{chunk-B8gfh4xf.js → chunk-BZx964-p.js} +1 -1
  17. package/public/{chunk-CcvYOops.js → chunk-BeM64etA.js} +1 -1
  18. package/public/{chunk-DSvdWjO4.js → chunk-BfiyH3nV.js} +1 -1
  19. package/public/{chunk-B_PiPxb4.js → chunk-BjINKQ03.js} +1 -1
  20. package/public/{chunk-BdBWqZzL.js → chunk-BpcNrtxJ.js} +1 -1
  21. package/public/{chunk-C4FGoLDg.js → chunk-BuvyF0y5.js} +1 -1
  22. package/public/{chunk-DGOvRnAo.js → chunk-C6b8CVno.js} +1 -1
  23. package/public/{chunk-BgyxBAyq.js → chunk-CCfhzpE8.js} +1 -1
  24. package/public/{chunk-CoEM_FqS.js → chunk-CHAFm_nM.js} +1 -1
  25. package/public/{chunk-D0MyVrEL.js → chunk-CIGP2YJm.js} +1 -1
  26. package/public/{chunk-Bhah8DNM.js → chunk-CLTHuhlN.js} +1 -1
  27. package/public/{chunk-B6XxnPxk.js → chunk-CLs_NL1y.js} +1 -1
  28. package/public/{chunk-Cr34s2uQ.js → chunk-COI6IBXH.js} +1 -1
  29. package/public/{chunk-BxV0O2fU.js → chunk-CQMVIDcp.js} +1 -1
  30. package/public/{chunk-CHKQxw6E.js → chunk-CXvWM_vF.js} +1 -1
  31. package/public/{chunk-Di5pPpU7.js → chunk-CYYBxjrc.js} +1 -1
  32. package/public/{chunk-BW4m3O2L.js → chunk-C_OZJltF.js} +1 -1
  33. package/public/{chunk-CjsnWLUr.js → chunk-Co2wVrD6.js} +1 -1
  34. package/public/{chunk-DMhuBqKs.js → chunk-CoCQ3DW2.js} +1 -1
  35. package/public/{chunk-DMoEBcor.js → chunk-CxPx4NZv.js} +1 -1
  36. package/public/{chunk-CdSWuWKr.js → chunk-CyVRpGoJ.js} +1 -1
  37. package/public/{chunk-Dv77RFHm.js → chunk-D-_-GUVr.js} +1 -1
  38. package/public/{chunk-CU8RPnsi.js → chunk-D1HYfaL_.js} +1 -1
  39. package/public/{chunk-DBA0eRqb.js → chunk-D2953Rfp.js} +1 -1
  40. package/public/{chunk-Cu9FE8cB.js → chunk-DIl1k00y.js} +1 -1
  41. package/public/{chunk-CyURmwWh.js → chunk-DPnbM-aB.js} +1 -1
  42. package/public/{chunk-8hkXyEzG.js → chunk-DTN-sa1K.js} +1 -1
  43. package/public/{chunk-C3CwUYvD.js → chunk-DUEKoZhd.js} +1 -1
  44. package/public/{chunk-COMZv7NY.js → chunk-DmkAKXR1.js} +1 -1
  45. package/public/{chunk-zg7II0hz.js → chunk-Do8wqING.js} +1 -1
  46. package/public/{chunk-oPq9Nexl.js → chunk-JhFkJS7i.js} +1 -1
  47. package/public/{chunk-CJIxuzvd.js → chunk-OeQDZKFO.js} +1 -1
  48. package/public/{chunk-Bz9bswDl.js → chunk-_zRMMvCu.js} +1 -1
  49. package/public/{chunk-D-xDPCf7.js → chunk-eQ1pa34Q.js} +1 -1
  50. package/public/{chunk-DVB9tiW3.js → chunk-ibauGmSP.js} +1 -1
  51. package/public/{chunk-oZiyAw_P.js → chunk-otzyItXL.js} +1 -1
  52. package/public/{chunk-B6AwCAvV.js → chunk-q9NoPvcx.js} +1 -1
  53. package/public/{chunk-B15lj2T8.js → chunk-szQs8fiq.js} +1 -1
  54. package/public/{chunk-o977r5_s.js → chunk-x7L6DXVK.js} +1 -1
  55. package/public/index.html +1 -1
  56. package/public/{main-BNR44HGB.js → main-YKDNK5VZ.js} +4 -4
  57. package/plugin/history-series.service.js +0 -637
  58. package/plugin/index.js +0 -1322
  59. package/plugin/kip-series-contract.js +0 -31
  60. package/plugin/openApi.json +0 -855
  61. package/plugin/sqlite-history-storage.service.js +0 -1124
  62. package/plugin/src/history-series.service.js +0 -634
  63. package/plugin/src/index.js +0 -1322
  64. package/plugin/src/kip-series-contract.js +0 -31
  65. package/plugin/src/openApi.json +0 -855
  66. package/plugin/src/sqlite-history-storage.service.js +0 -1122
@@ -6425,7 +6425,7 @@ div.mat-mdc-select-panel {
6425
6425
  opacity: 0.1;
6426
6426
  }
6427
6427
  `],encapsulation:2,changeDetection:1})}return o})(),bt$2=new N$7("mat-snack-bar-default-options",{providedIn:"root",factory:()=>new y$1}),et$4=(()=>{class o{_live=w$4(Bc$1);_injector=w$4(be$5);_breakpointObserver=w$4(ir$4);_parentSnackBar=w$4(o,{optional:true,skipSelf:true});_defaultConfig=w$4(bt$2);_animationsDisabled=ot$e();_snackBarRefAtThisLevel=null;simpleSnackBarComponent=mt$4;snackBarContainerComponent=St$2;handsetCssClass="mat-mdc-snack-bar-handset";get _openedSnackBarRef(){let e=this._parentSnackBar;return e?e._openedSnackBarRef:this._snackBarRefAtThisLevel}set _openedSnackBarRef(e){this._parentSnackBar?this._parentSnackBar._openedSnackBarRef=e:this._snackBarRefAtThisLevel=e;}openFromComponent(e,t){return this._attach(e,t)}openFromTemplate(e,t){return this._attach(e,t)}open(e,t="",i){let n=G$b(G$b({},this._defaultConfig),i);return n.data={message:e,action:t},n.announcementMessage===e&&(n.announcementMessage=void 0),this.openFromComponent(this.simpleSnackBarComponent,n)}dismiss(){this._openedSnackBarRef&&this._openedSnackBarRef.dismiss();}ngOnDestroy(){this._snackBarRefAtThisLevel&&this._snackBarRefAtThisLevel.dismiss();}_attachSnackBarContainer(e,t){let i=t&&t.viewContainerRef&&t.viewContainerRef.injector,n=be$5.create({parent:i||this._injector,providers:[{provide:y$1,useValue:t}]}),a=new bt$8(this.snackBarContainerComponent,t.viewContainerRef,n),s=e.attach(a);return s.instance.snackBarConfig=t,s.instance}_attach(e,t){let i=G$b(G$b(G$b({},new y$1),this._defaultConfig),t),n=this._createOverlay(i),a=this._attachSnackBarContainer(n,i),s=new P$4(a,n);if(e instanceof Mr$5){let r=new N$6(e,null,{$implicit:i.data,snackBarRef:s});s.instance=a.attachTemplatePortal(r);}else {let r=this._createInjector(i,s),c=new bt$8(e,void 0,r),d=a.attachComponentPortal(c);s.instance=d.instance;}return this._breakpointObserver.observe(Em.HandsetPortrait).pipe(bu(n.detachments())).subscribe(r=>{n.overlayElement.classList.toggle(this.handsetCssClass,r.matches);}),i.announcementMessage&&a._onAnnounce.subscribe(()=>{this._live.announce(i.announcementMessage,i.politeness);}),this._animateSnackBar(s,i),this._openedSnackBarRef=s,this._openedSnackBarRef}_animateSnackBar(e,t){e.afterDismissed().subscribe(()=>{this._openedSnackBarRef==e&&(this._openedSnackBarRef=null),t.announcementMessage&&this._live.clear();}),t.duration&&t.duration>0&&e.afterOpened().subscribe(()=>e._dismissAfter(t.duration)),this._openedSnackBarRef?(this._openedSnackBarRef.afterDismissed().subscribe(()=>{e.containerInstance.enter();}),this._openedSnackBarRef.dismiss()):e.containerInstance.enter();}_createOverlay(e){let t=new Z$7;t.direction=e.direction;let i=le$7(this._injector),n=e.direction==="rtl",a=e.horizontalPosition==="left"||e.horizontalPosition==="start"&&!n||e.horizontalPosition==="end"&&n,s=!a&&e.horizontalPosition!=="center";return a?i.left("0"):s?i.right("0"):i.centerHorizontally(),e.verticalPosition==="top"?i.top("0"):i.bottom("0"),t.positionStrategy=i,t.disableAnimations=this._animationsDisabled,Mt$9(this._injector,t)}_createInjector(e,t){let i=e&&e.viewContainerRef&&e.viewContainerRef.injector;return be$5.create({parent:i||this._injector,providers:[{provide:P$4,useValue:t},{provide:Ye$3,useValue:e.data}]})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=Pr$5({token:o,factory:o.\u0275fac})}return o})();var vt$2="",Ct$3=11,I$4=12,Gi$3=(()=>{class o{storage=w$4(Ge$3);snackBar=w$4(et$4);server=w$4(T$2);unitDefaults=new Bn$5({});themeName=new Bn$5(vt$2);kipKNotificationConfig=new Bn$5(E$2);autoNightMode=new Bn$5(false);redNightMode=new Bn$5(false);nightModeBrightness=new Bn$5(1);isRemoteControl=new Bn$5(false);instanceName=new Bn$5("");splitShellEnabled=new Bn$5(false);splitShellSide=new Bn$5("left");splitShellSwipeDisabled=new Bn$5(false);splitShellWidth=new Bn$5(.5);widgetHistoryDisabled=new Bn$5(false);proxyEnabled=false;signalKSubscribeAll=false;useDeviceToken=false;loginName="";loginPassword="";useSharedConfig=true;sharedConfigName="default";activeConfig={app:null,theme:null,dashboards:[]};kipUUID="";signalkUrl;widgets=[];_dashboards=[];dataSets=[];configUpgrade=vt$9(false);configVersion;disablePathValidation=false;constructor(){console.log("[AppSettings Service] Service startup..."),this.storage.activeConfigFileVersion=Ct$3,window.localStorage?(this.loadConnectionConfig(),this.startup()):console.error(`[AppSettings Service] LocalStorage NOT SUPPORTED by browser
6428
- This is a requirement to run Kip. See browser documentation to enable this feature.`);}startup(){return Zr$4(this,null,function*(){if(this.useSharedConfig){if(!this.storage.isRemoteContextBootstrapped()||this.storage.initConfig===null){console.warn("[AppSettings Service] Shared configuration enabled but remote bootstrap handoff is missing. Waiting for explicit recovery action.");return}this.configVersion=this.storage.initConfig?.app?.configVersion,this.checkConfigUpgradeRequired(false,this.storage.initConfig?.app?.configVersion),this.activeConfig=this.storage.initConfig,this.pushSettings();}else {console.log("[AppSettings Service] LocalStorage enabled");let e={app:null,theme:null,dashboards:[]};e.app=this.loadConfigFromLocalStorage("appConfig"),this.configVersion=e.app?.configVersion,this.checkConfigUpgradeRequired(true,e.app?.configVersion),e.dashboards=this.loadConfigFromLocalStorage("dashboardsConfig"),e.theme=this.loadConfigFromLocalStorage("themeConfig"),this.activeConfig=e,this.pushSettings();}})}loadConnectionConfig(){let e=this.loadConfigFromLocalStorage("connectionConfig");switch(e.configVersion){case 11:break;case 12:break;default:console.error(`[AppSettings Service] Invalid connectionConfig version ${e.configVersion}. Resetting and loading connection configuration default`),this.resetConnection();break}this.signalkUrl={url:e.signalKUrl,new:false},this.proxyEnabled=e.proxyEnabled,this.signalKSubscribeAll=e.signalKSubscribeAll,this.useDeviceToken=e.useDeviceToken,this.loginName=e.loginName,this.loginPassword=e.loginPassword,this.useSharedConfig=e.useSharedConfig,this.sharedConfigName=e.sharedConfigName,this.kipUUID=e.kipUUID;}resetConnection(){localStorage.setItem("connectionConfig",JSON.stringify(this.getDefaultConnectionConfig())),this.reloadApp();}checkConfigUpgradeRequired(e,t){t!==I$4&&this.configUpgrade.set(true);}loadConfigFromLocalStorage(e){let t=JSON.parse(localStorage.getItem(e)??"null");if(t===null)switch(console.log(`[AppSettings Service] Error loading ${e} config. Force loading ${e} defaults`),e){case "appConfig":t=this.getDefaultAppConfig();break;case "connectionConfig":t=this.getDefaultConnectionConfig();break;case "dashboardsConfig":t=this.getDefaultDashboardsConfig();break;case "themeConfig":t=this.getDefaultThemeConfig();break;default:console.error(`[AppSettings Service] Invalid ${e} default config requested`);break}return e==="connectionConfig"&&t.configVersion!==I$4&&(console.log(`[AppSettings Service] Invalid ${e} version. Force loading defaults`),e==="connectionConfig"&&(t=this.getDefaultConnectionConfig())),t}pushSettings(){let e=this.activeConfig.app??this.getDefaultAppConfig();this.activeConfig.app=e,this.activeConfig.theme&&this.themeName.next(this.activeConfig.theme.themeName),this.dataSets=e.dataSets,this.unitDefaults.next(e.unitDefaults),this.kipKNotificationConfig.next(e.notificationConfig),e.autoNightMode===void 0?this.setAutoNightMode(false):this.autoNightMode.next(e.autoNightMode),e.redNightMode===void 0?this.setRedNightMode(false):this.redNightMode.next(e.redNightMode),e.nightModeBrightness===void 0?this.setNightModeBrightness(.2):this.nightModeBrightness.next(e.nightModeBrightness),this.activeConfig.dashboards===void 0?this._dashboards=[]:this._dashboards=this.activeConfig.dashboards,e.isRemoteControl===void 0?this.setIsRemoteControl(false):this.isRemoteControl.next(e.isRemoteControl),e.instanceName===void 0?this.setInstanceName(""):this.instanceName.next(e.instanceName),e.splitShellEnabled===void 0?this.setSplitShellEnabled(false):this.splitShellEnabled.next(e.splitShellEnabled),e.splitShellSide===void 0?this.setSplitShellSide("left"):this.splitShellSide.next(e.splitShellSide),e.splitShellSwipeDisabled===void 0?this.setSplitShellSwipeDisabled(false):this.splitShellSwipeDisabled.next(e.splitShellSwipeDisabled),e.splitShellWidth===void 0?this.setSplitShellWidth(.5):this.splitShellWidth.next(e.splitShellWidth);let t=this.server.serverVersion$.getValue(),i=typeof t=="string"&&t.trim().length>0?U$2(t,"2.22.1",">="):false;e.widgetHistoryDisabled===void 0?this.setWidgetHistoryDisabled(!i):this.widgetHistoryDisabled.next(i?e.widgetHistoryDisabled:true);}getDefaultUnitsAsO(){return this.unitDefaults.asObservable()}getDefaultUnits(){return this.unitDefaults.getValue()}setDefaultUnits(e){this.unitDefaults.next(e),this.useSharedConfig?this.storage.patchConfig("Array<IUnitDefaults>",e):this.saveAppConfigToLocalStorage();}getConfigVersion(){return this.activeConfig.app?.configVersion??void 0}getAppConfig(){return this.buildAppStorageObject()}getConnectionConfig(){return this.buildConnectionStorageObject()}setConnectionConfig(e){this.loginName=e.loginName,this.loginPassword=e.loginPassword,this.useSharedConfig=e.useSharedConfig,this.proxyEnabled=e.proxyEnabled,this.signalKSubscribeAll=e.signalKSubscribeAll,this.signalkUrl&&(this.signalkUrl.url=e.signalKUrl),e.useSharedConfig?this.useDeviceToken=false:this.useDeviceToken=true,this.saveConnectionConfigToLocalStorage();}setUseDeviceToken(e){this.useDeviceToken=e,this.saveConnectionConfigToLocalStorage();}getDashboardConfig(){return this.buildDashboardStorageObject()}getThemeConfig(){return this.buildThemeStorageObject()}get KipUUID(){return this.kipUUID}getThemeNameAsO(){return this.themeName.asObservable()}setThemeName(e){if(this.themeName.next(e),this.useSharedConfig){let t={themeName:e};this.storage.patchConfig("IThemeConfig",t);}else this.saveThemeConfigToLocalStorage();}getThemeName(){return this.themeName.getValue()}getAutoNightModeAsO(){return this.autoNightMode.asObservable()}setAutoNightMode(e){this.autoNightMode.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getAutoNightMode(){return this.autoNightMode.getValue()}getRedNightModeAsO(){return this.redNightMode.asObservable()}getRedNightMode(){return this.redNightMode.getValue()}setRedNightMode(e){this.redNightMode.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getIsRemoteControlAsO(){return this.isRemoteControl.asObservable()}getIsRemoteControl(){return this.isRemoteControl.getValue()}setIsRemoteControl(e){this.isRemoteControl.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getInstanceNameAsO(){return this.instanceName.asObservable()}getInstanceName(){return this.instanceName.getValue()}setInstanceName(e){this.instanceName.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getDisablePathValidation(){return this.disablePathValidation}setDisablePathValidation(e){this.disablePathValidation=e;}getSplitShellEnabledAsO(){return this.splitShellEnabled.asObservable()}getSplitShellEnabled(){return this.splitShellEnabled.getValue()}setSplitShellEnabled(e){this.splitShellEnabled.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getSplitShellSideAsO(){return this.splitShellSide.asObservable()}getSplitShellSide(){return this.splitShellSide.getValue()}setSplitShellSide(e){this.splitShellSide.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getWidgetHistoryDisabledAsO(){return this.widgetHistoryDisabled.asObservable()}getWidgetHistoryDisabled(){return this.widgetHistoryDisabled.getValue()}setWidgetHistoryDisabled(e){this.widgetHistoryDisabled.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getSplitShellSwipeDisabledAsO(){return this.splitShellSwipeDisabled.asObservable()}getSplitShellSwipeDisabled(){return this.splitShellSwipeDisabled.getValue()}setSplitShellSwipeDisabled(e){this.splitShellSwipeDisabled.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getSplitShellWidthAsO(){return this.splitShellWidth.asObservable()}getSplitShellWidth(){return this.splitShellWidth.getValue()}setSplitShellWidth(e){let t=Math.min(.9,Math.max(.1,e));this.splitShellWidth.next(t);let i=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",i):this.saveAppConfigToLocalStorage();}getNightModeBrightness(){return this.nightModeBrightness.getValue()}setNightModeBrightness(e){this.nightModeBrightness.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getWidgets(){return this.widgets}saveDashboards(e){this.useSharedConfig?this.storage.storageServiceReady$.getValue()&&this.storage.patchConfig("Dashboards",e):this.saveLDashboardsConfigToLocalStorage(e),this._dashboards=e;}saveDataSets(e){this.dataSets=e,this.useSharedConfig?this.storage.patchConfig("Array<IDatasetDef>",e):this.saveAppConfigToLocalStorage();}getDataSets(){return this.dataSets}getNotificationServiceConfigAsO(){return this.kipKNotificationConfig.asObservable()}getNotificationConfig(){return this.kipKNotificationConfig.getValue()}setNotificationConfig(e){this.kipKNotificationConfig.next(e),this.useSharedConfig?this.storage.patchConfig("INotificationConfig",e):this.saveAppConfigToLocalStorage();}resetSettings(){let e={app:null,theme:null,dashboards:[]};e.app=this.getDefaultAppConfig(),e.theme=this.getDefaultThemeConfig(),e.dashboards=this.getDefaultDashboardsConfig(),this.useSharedConfig?this.storage.storageServiceReady$.getValue()&&this.storage.setConfig("user",this.sharedConfigName,e).then(()=>{console.log("[AppSettings Service] Replaced server config name: "+this.sharedConfigName+", with default configuration values"),this.reloadApp();}).catch(t=>{console.error("[AppSettings Service] Error replacing server config name: "+this.sharedConfigName+", with default configuration values",t),this.snackBar.open("Problem saving configuration to the server. Resolve this issue before KIP can be used reliably.","Close",{duration:0,verticalPosition:"top"});}):this.reloadApp();}replaceConfig(e,t,i){let n=JSON.stringify(t);localStorage.setItem(e,n),i&&this.reloadApp();}loadDemoConfig(){if(this.useSharedConfig){let e={app:ie,dashboards:ne$3,theme:oe$1};console.log("[AppSettings Service] Loading Demo configuration settings as remote config: "+this.useSharedConfig+" and reloading app."),this.storage.storageServiceReady$.getValue()&&this.storage.setConfig("user",this.sharedConfigName,e).then(()=>{this.reloadApp();}).catch(t=>{console.error("[AppSettings Service] Error saving demo configuration to the server",t),this.snackBar.open("Problem saving configuration to the server. Resolve this issue before KIP can be used reliably.","Close",{duration:0,verticalPosition:"top"});});}else console.log("[AppSettings Service] Loading Demo configuration settings to LocalStorage"),this.replaceConfig("appConfig",ie),this.replaceConfig("dashboardsConfig",ne$3),this.replaceConfig("themeConfig",oe$1,true);}reloadApp(){console.log("[AppSettings Service] Reload app"),!window.__KIP_TEST__&&location.replace("./");}buildAppStorageObject(){return {configVersion:this.configVersion??I$4,autoNightMode:this.autoNightMode.getValue(),redNightMode:this.redNightMode.getValue(),nightModeBrightness:this.nightModeBrightness.getValue(),isRemoteControl:this.isRemoteControl.getValue(),instanceName:this.instanceName.getValue(),dataSets:this.dataSets,unitDefaults:this.unitDefaults.getValue(),notificationConfig:this.kipKNotificationConfig.getValue(),splitShellEnabled:this.splitShellEnabled.getValue(),splitShellSide:this.splitShellSide.getValue()??"right",splitShellWidth:this.splitShellWidth.getValue()??.5,splitShellSwipeDisabled:this.splitShellSwipeDisabled.getValue(),widgetHistoryDisabled:this.widgetHistoryDisabled.getValue()}}buildConnectionStorageObject(){return {configVersion:this.configVersion??I$4,kipUUID:this.kipUUID,signalKUrl:this.signalkUrl?.url??"",proxyEnabled:this.proxyEnabled,signalKSubscribeAll:this.signalKSubscribeAll,useDeviceToken:this.useDeviceToken,loginName:this.loginName,loginPassword:this.loginPassword,useSharedConfig:this.useSharedConfig,sharedConfigName:this.sharedConfigName}}buildDashboardStorageObject(){return this._dashboards}buildThemeStorageObject(){return {themeName:this.themeName.getValue()}}saveAppConfigToLocalStorage(){console.log("[AppSettings Service] Saving Application config to LocalStorage"),localStorage.setItem("appConfig",JSON.stringify(this.buildAppStorageObject()));}saveConnectionConfigToLocalStorage(){console.log("[AppSettings Service] Saving Connection config to LocalStorage"),localStorage.setItem("connectionConfig",JSON.stringify(this.buildConnectionStorageObject()));}saveLDashboardsConfigToLocalStorage(e){console.log("[AppSettings Service] Saving Dashboard config to LocalStorage"),localStorage.setItem("dashboardsConfig",JSON.stringify(e));}saveThemeConfigToLocalStorage(){console.log("[AppSettings Service] Saving Theme config to LocalStorage"),localStorage.setItem("themeConfig",JSON.stringify(this.buildThemeStorageObject()));}getDefaultAppConfig(){let e=Ze$1;return e.notificationConfig=E$2,e.unitDefaults=$$3,e.configVersion=I$4,localStorage.setItem("appConfig",JSON.stringify(e)),e}getDefaultConnectionConfig(){let e=Xe$1;return e.kipUUID=b.create(),e.signalKUrl=window.location.origin,localStorage.setItem("connectionConfig",JSON.stringify(e)),e}getDefaultDashboardsConfig(){let e=[];return localStorage.setItem("dashboardsConfig",JSON.stringify(e)),e}getDefaultThemeConfig(){let e=Qe$2;return localStorage.setItem("themeConfig",JSON.stringify(e)),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=Q$6({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();var P$3={listSupported:true,detailSupported:true,saveConfigSupported:true,detailFallbackToList:false},y=new Set(["oneOf","anyOf","allOf","if","then","else","dependencies","dependentRequired","dependentSchemas","$ref","not","patternProperties","contains"]),w$2=(()=>{class c{http=w$4(yr$5);connection=w$4(T$2);kipRuntimeModeCache=null;kipRuntimeModePromise=null;capabilities=vt$9(P$3);detectCapabilities(){return Zr$4(this,null,function*(){let e=yield this.listPlugins();if(!e.ok)return e.capabilities;let t=e.data;return t.length===0?e.capabilities:(yield this.getPlugin(t[0].id)).capabilities})}listPlugins(){return Zr$4(this,null,function*(){try{let t=(yield lm(this.http.get(this.toServerUrl("/plugins")))).map(i=>this.normalizePlugin(i));return this.success(t,z$5(G$b({},this.capabilities()),{listSupported:!0}))}catch(e){return this.handleHttpError(e,this.capabilities(),{listSupported:false})}})}getPlugin(e){return Zr$4(this,null,function*(){try{let t=yield lm(this.http.get(this.toServerUrl(`/plugins/${encodeURIComponent(e)}`))),i=yield this.findPluginFromList(e);return i?this.success(z$5(G$b({},i),{state:z$5(G$b({},i.state),{enabled:t.enabled})}),z$5(G$b({},this.capabilities()),{detailSupported:!0})):this.success({id:t.id,name:t.name,packageName:t.id,version:t.version,description:"",keywords:[],statusMessage:null,schema:null,state:{configuration:{},enabled:t.enabled,enableDebug:!1,enableLogging:!1}},z$5(G$b({},this.capabilities()),{detailSupported:!0}))}catch(t){if(this.isHttpStatus(t,404)){let i=yield this.findPluginFromList(e);if(i)return this.success(i,z$5(G$b({},this.capabilities()),{detailSupported:false,detailFallbackToList:true}))}return this.handleHttpError(t,this.capabilities(),{detailSupported:false})}})}getPluginConfig(e){return Zr$4(this,null,function*(){let t=yield this.getPlugin(e);return this.isFailure(t)?this.failure(t):this.success(t.data.state,t.capabilities)})}resolveKipRuntimeModeConfig(e="kip"){return Zr$4(this,null,function*(){let t={historySeriesServiceEnabled:true,registerAsHistoryApiProvider:true},i=yield this.getPluginConfig(e);if(this.isFailure(i))return t;let s=i.data.configuration??{};return {historySeriesServiceEnabled:this.resolveBooleanConfig(s,"historySeriesServiceEnabled",t.historySeriesServiceEnabled),registerAsHistoryApiProvider:this.resolveBooleanConfig(s,"registerAsHistoryApiProvider",t.registerAsHistoryApiProvider)}})}getKipRuntimeModeConfigCached(e="kip",t=false){return Zr$4(this,null,function*(){return t&&(this.kipRuntimeModeCache=null,this.kipRuntimeModePromise=null),this.kipRuntimeModeCache?this.kipRuntimeModeCache:this.kipRuntimeModePromise?this.kipRuntimeModePromise:(this.kipRuntimeModePromise=this.resolveKipRuntimeModeConfig(e).then(i=>(this.kipRuntimeModeCache=i,i)).finally(()=>{this.kipRuntimeModePromise=null;}),this.kipRuntimeModePromise)})}savePluginConfig(e,t){return Zr$4(this,null,function*(){let i=yield this.getPlugin(e);if(this.isFailure(i))return this.failure(i);let s=i.data,n={configuration:G$b(G$b({},s.state.configuration||{}),t.configuration||{}),enabled:t.enabled??s.state.enabled,enableDebug:t.enableDebug??s.state.enableDebug,enableLogging:t.enableLogging??s.state.enableLogging};try{return yield lm(this.http.post(this.toServerUrl(`/plugins/${encodeURIComponent(e)}/config`),n)),this.success({pluginId:e,state:n},z$5(G$b({},i.capabilities),{saveConfigSupported:!0}))}catch(o){return this.handleHttpError(o,i.capabilities,{saveConfigSupported:false})}})}setPluginEnabled(e,t){return Zr$4(this,null,function*(){return this.savePluginConfig(e,{configuration:{},enabled:t})})}validateDependency(e){return Zr$4(this,null,function*(){let t=yield this.getPlugin(e.pluginId);if(this.isFailure(t))return t.error.reason==="not-found"?this.success({status:"missing",pluginId:e.pluginId},t.capabilities):this.failure(t);let i=t.data;if((e.requireEnabled??true)&&!i.state.enabled)return this.success({status:"disabled",pluginId:e.pluginId,plugin:i},t.capabilities);let n=this.getConfigMismatchKeys(e.requiredConfig,i.state.configuration);return n.length>0?this.success({status:"config-mismatch",pluginId:e.pluginId,plugin:i,missingKeys:n},t.capabilities):this.success({status:"ready",pluginId:e.pluginId,plugin:i},t.capabilities)})}normalizePluginSchema(e){if(!e||typeof e!="object")return {hasSchema:false,supported:false,fields:[],unsupportedKeywords:[]};let t=e,i=Object.keys(t).filter(u=>y.has(u)),s=new Set(Array.isArray(t.required)?t.required.filter(u=>typeof u=="string"):[]),n=t.properties&&typeof t.properties=="object"?t.properties:{},o=Object.entries(n).map(([u,S])=>this.toSchemaField(u,S,s.has(u)));return {hasSchema:true,supported:i.length===0,fields:o,unsupportedKeywords:i}}findPluginFromList(e){return Zr$4(this,null,function*(){let t=yield this.listPlugins();return t.ok?t.data.find(i=>i.id===e)??null:null})}normalizePlugin(e){return {id:e.id,name:e.name,packageName:e.packageName,version:e.version,description:e.description,keywords:e.keywords??[],statusMessage:e.statusMessage??null,schema:e.schema??null,state:{configuration:e.data?.configuration??{},enabled:e.data?.enabled??false,enableLogging:e.data?.enableLogging??false,enableDebug:e.data?.enableDebug??false}}}toSchemaField(e,t,i){if(!t||typeof t!="object")return {key:e,type:"unknown",required:i,unsupportedKeywords:[]};let s=t,n=typeof s.type=="string"?s.type:"unknown",o=Object.keys(s).filter(u=>y.has(u));return {key:e,type:this.normalizeSchemaType(n),required:i,title:typeof s.title=="string"?s.title:void 0,description:typeof s.description=="string"?s.description:void 0,enumValues:Array.isArray(s.enum)?s.enum:void 0,defaultValue:s.default,minimum:typeof s.minimum=="number"?s.minimum:void 0,maximum:typeof s.maximum=="number"?s.maximum:void 0,pattern:typeof s.pattern=="string"?s.pattern:void 0,unsupportedKeywords:o}}normalizeSchemaType(e){return e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="array"||e==="object"?e:"unknown"}toServerUrl(e){let t=this.connection.signalKURL?.url?.trim();return t?`${t.endsWith("/")?t.slice(0,-1):t}${e}`:e}resolveBooleanConfig(e,t,i){let s=e[t];return typeof s=="boolean"?s:i}getConfigMismatchKeys(e,t){return e?Object.entries(e).filter(([i,s])=>!this.deepEquals(t?.[i],s)).map(([i])=>i):[]}deepEquals(e,t){if(e===t)return true;if(typeof e!=typeof t)return false;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?false:e.every((i,s)=>this.deepEquals(i,t[s]));if(e&&t&&typeof e=="object"&&typeof t=="object"){let i=e,s=t,n=new Set([...Object.keys(i),...Object.keys(s)]);for(let o of n)if(!this.deepEquals(i[o],s[o]))return false;return true}return false}success(e,t){return this.capabilities.set(t),{ok:true,data:e,capabilities:t}}failure(e){return {ok:false,error:e.error,capabilities:e.capabilities}}isFailure(e){return e.ok===false}handleHttpError(e,t,i={}){let s=G$b(G$b({},t),i),n=this.mapError(e);return this.capabilities.set(s),{ok:false,error:n,capabilities:s}}mapError(e){return e instanceof ue$6?e.status===0?{reason:"network-failure",statusCode:e.status,message:"[Plugin Config Service] Network error while calling plugin API"}:e.status===401?{reason:"auth-required",statusCode:401,message:"[Plugin Config Service] Authentication required"}:e.status===403?{reason:"forbidden",statusCode:403,message:"[Plugin Config Service] Access forbidden for plugin API"}:e.status===404?{reason:"not-found",statusCode:404,message:"[Plugin Config Service] Plugin endpoint or resource not found"}:e.status===405||e.status===501?{reason:"capability-unsupported",statusCode:e.status,message:"[Plugin Config Service] Plugin API capability is not supported by this server"}:e.status>=500?{reason:"server-error",statusCode:e.status,message:"[Plugin Config Service] Server error while calling plugin API"}:{reason:"unknown",statusCode:e.status,message:"[Plugin Config Service] Unexpected plugin API error"}:{reason:"unknown",message:"[Plugin Config Service] Unknown error while calling plugin API"}}isHttpStatus(e,t){return e instanceof ue$6&&e.status===t}static \u0275fac=function(t){return new(t||c)};static \u0275prov=Q$6({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})();var W$2=["Core","Gauge","Component","Racing"];var v=(()=>{class r{_pluginConfig=w$4(w$2);_widgetCategories=[...W$2];_componentTypePromise=new Map;_defaultConfigCache=new Map;_componentTypeMap={WidgetNumericComponent:()=>import('./chunk-Cr34s2uQ.js').then(e=>e.WidgetNumericComponent),WidgetTextComponent:()=>import('./chunk-B_PiPxb4.js').then(e=>e.WidgetTextComponent),WidgetWindTrendsChartComponent:()=>import('./chunk-DMhuBqKs.js').then(e=>e.WidgetWindTrendsChartComponent),WidgetWindComponent:()=>import('./chunk-Bz9bswDl.js').then(e=>e.WidgetWindComponent),WidgetTutorialComponent:()=>import('./chunk-oPq9Nexl.js').then(e=>e.WidgetTutorialComponent),WidgetSliderComponent:()=>import('./chunk-Bq-eHuZV.js').then(e=>e.WidgetSliderComponent),WidgetSimpleLinearComponent:()=>import('./chunk-CCiqU2uY.js').then(e=>e.WidgetSimpleLinearComponent),WidgetRacesteerComponent:()=>import('./chunk-BdBWqZzL.js').then(e=>e.WidgetRacesteerComponent),WidgetRacerTimerComponent:()=>import('./chunk-BW4m3O2L.js').then(e=>e.WidgetRacerTimerComponent),WidgetRacerLineComponent:()=>import('./chunk-Dv77RFHm.js').then(e=>e.WidgetRacerLineComponent),WidgetRaceTimerComponent:()=>import('./chunk-B15lj2T8.js').then(e=>e.WidgetRaceTimerComponent),WidgetPositionComponent:()=>import('./chunk-CoEM_FqS.js').then(e=>e.WidgetPositionComponent),WidgetAisRadarComponent:()=>import('./chunk-DSvdWjO4.js').then(e=>e.WidgetAisRadarComponent),WidgetLabelComponent:()=>import('./chunk-CdSWuWKr.js').then(e=>e.WidgetLabelComponent),WidgetIframeComponent:()=>import('./chunk-CjsnWLUr.js').then(e=>e.WidgetIframeComponent),WidgetHorizonComponent:()=>import('./chunk-B8gfh4xf.js').then(e=>e.WidgetHorizonComponent),WidgetHeelGaugeComponent:()=>import('./chunk-DjavLLpP.js').then(e=>e.WidgetHeelGaugeComponent),WidgetSteelGaugeComponent:()=>import('./chunk-zg7II0hz.js').then(e=>e.WidgetSteelGaugeComponent),WidgetGaugeNgRadialComponent:()=>import('./chunk-DMoEBcor.js').then(e=>e.WidgetGaugeNgRadialComponent),WidgetGaugeNgLinearComponent:()=>import('./chunk-COMZv7NY.js').then(e=>e.WidgetGaugeNgLinearComponent),WidgetGaugeNgCompassComponent:()=>import('./chunk-B6XxnPxk.js').then(e=>e.WidgetGaugeNgCompassComponent),WidgetFreeboardskComponent:()=>import('./chunk-Di5pPpU7.js').then(e=>e.WidgetFreeboardskComponent),WidgetAnchorAlarmComponent:()=>import('./chunk-CkfPr-c5.js').then(e=>e.WidgetAnchorAlarmComponent),WidgetDatetimeComponent:()=>import('./chunk-Bb1mO304.js').then(e=>e.WidgetDatetimeComponent),WidgetDataChartComponent:()=>import('./chunk-CJIxuzvd.js').then(e=>e.WidgetDataChartComponent),WidgetBooleanSwitchComponent:()=>import('./chunk-BxV0O2fU.js').then(e=>e.WidgetBooleanSwitchComponent),WidgetMultiStateSwitchComponent:()=>import('./chunk-CcvYOops.js').then(e=>e.WidgetMultiStateSwitchComponent),WidgetZonesStatePanelComponent:()=>import('./chunk-C3CwUYvD.js').then(e=>e.WidgetZonesStatePanelComponent),WidgetAutopilotComponent:()=>import('./chunk-oZiyAw_P.js').then(e=>e.WidgetAutopilotComponent),WidgetBmsComponent:()=>import('./chunk-DBA0eRqb.js').then(e=>e.WidgetBmsComponent),WidgetSolarChargerComponent:()=>import('./chunk-D-xDPCf7.js').then(e=>e.WidgetSolarChargerComponent),WidgetChargerComponent:()=>import('./chunk-B8zRhoG8.js').then(e=>e.WidgetChargerComponent),WidgetInverterComponent:()=>import('./chunk-CU8RPnsi.js').then(e=>e.WidgetInverterComponent),WidgetAlternatorComponent:()=>import('./chunk-DGOvRnAo.js').then(e=>e.WidgetAlternatorComponent),WidgetAcComponent:()=>import('./chunk-CHKQxw6E.js').then(e=>e.WidgetAcComponent)};_widgetDefinition=[{name:"Numeric",description:"Displays numeric data in a clear and concise format, with options to show minimum and/or maximum recorded values. Includes an optional background minichart for quick visual trend insights.",icon:"numericWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-numeric",componentClassName:"WidgetNumericComponent"},{name:"Text",description:"Displays text data with a customizable color formatting option.",icon:"textWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-text",componentClassName:"WidgetTextComponent"},{name:"Date & Time",description:"Displays date and time data with fully custom formatting options and timezone correction.",icon:"datetimeWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-datetime",componentClassName:"WidgetDatetimeComponent"},{name:"Position",description:"Displays latitude and longitude for location tracking and navigation.",icon:"positionWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-position",componentClassName:"WidgetPositionComponent"},{name:"Static Label",description:"A static text widget that allows you to add customizable labels to your dashboard, helping to organize and clarify your layout effectively.",icon:"labelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-label",componentClassName:"WidgetLabelComponent"},{name:"Switch Panel",description:"A Digital Switching panel group with multiple controls including toggle switches, indicator lights, and press buttons to send Signal K paths values and other operations.",icon:"switchpanelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-boolean-switch",componentClassName:"WidgetBooleanSwitchComponent"},{name:"Multi-State Switch",description:"Lists all available device/path operating modes/states (e.g., On, Off, Charge Only, Invert Only), highlights the current state, and lets you select a new state to send to the device and see the result.",icon:"multiStateSwitchWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-multi-state-switch",componentClassName:"WidgetMultiStateSwitchComponent"},{name:"Zones State Panel",description:"Displays the data state (severity and message) of the path's Zones (based on Signal K path metadata configuration).",icon:"zonesStatePanel",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-zones-state-panel",componentClassName:"WidgetZonesStatePanelComponent"},{name:"Slider",description:"A Digital Switching range slider that allows users to adjust values, such as controlling lighting intensity or audio volume from 0% to 100%.",icon:"sliderWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-slider",componentClassName:"WidgetSliderComponent"},{name:"Compact Linear",description:"A simple horizontal linear gauge with a large value label offering a clean, compact modern look.",icon:"simpleLinearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-simple-linear",componentClassName:"WidgetSimpleLinearComponent"},{name:"Linear",description:"A horizontal or vertical linear gauge that supports zone highlighting.",icon:"linearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-linear",componentClassName:"WidgetGaugeNgLinearComponent"},{name:"Radial",description:"A radial gauge with configurable capacity and measurement dials plus zone highlighting.",icon:"radialGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-radial",componentClassName:"WidgetGaugeNgRadialComponent"},{name:"Compass",description:"A faceplate or card-style rotating compass gauge with multiple cardinal point indicator options.",icon:"compassGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-compass",componentClassName:"WidgetGaugeNgCompassComponent"},{name:"Level Gauge",description:"Dual-scale heel angle indicator combining a high\u2011precision \xB15\xB0 fine level with a wide \xB140\xB0 coarse arc for fast trim tuning and broader heel / sea\u2011state monitoring.",icon:"level",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-heel-gauge",componentClassName:"WidgetHeelGaugeComponent"},{name:"Pitch & Roll",description:"Horizon-style attitude indicator showing live pitch and roll degrees with smooth animation\u2014ideal for monitoring trim, heel, and sea-state response.",icon:"pitchRollGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-horizon",componentClassName:"WidgetHorizonComponent"},{name:"Classic Steel",description:"A traditional steel looking linear & radial gauges replica that supports range sizes and zones highlights.",icon:"steelGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-steel",componentClassName:"WidgetSteelGaugeComponent"},{name:"Battery Monitor",description:"Displays battery banks and individual batteries with aggregated bank totals plus per-battery detail cards. See key BMS values such as state of charge, current, voltage, power, temperature, capacity, and time remaining for a clearer view of overall bank health and individual battery status.",icon:"battery_charging",minWidth:2,minHeight:2,defaultWidth:6,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-bms",componentClassName:"WidgetBmsComponent"},{name:"Solar Charger",description:"Track solar generation and charging performance at a glance with live panel output, battery-side metrics, and clear charger and relay status indicators.",icon:"solar_charger",minWidth:2,minHeight:2,defaultWidth:6,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-solar-charger",componentClassName:"WidgetSolarChargerComponent"},{name:"AC/DC Charger",description:"Track charger output and charging state with voltage, current, power, and temperature monitoring, including real-time charging stage indicators.",icon:"charger",minWidth:2,minHeight:2,defaultWidth:6,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-charger",componentClassName:"WidgetChargerComponent"},{name:"Windsteer",description:"A wind steering display that combines wind, wind sectors, heading, course over ground and next waypoint information.",icon:"windsteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-wind-steer",componentClassName:"WidgetWindComponent"},{name:"Freeboard-SK",description:"Adds the Freeboard-SK chart plotter as a widget with automatic sign-in to your dashboard.",icon:"freeboardWidget",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["freeboard-sk","tracks","resources-provider","course-provider"],selector:"widget-freeboardsk",componentClassName:"WidgetFreeboardskComponent"},{name:"Autopilot Head",description:"Provides typical autopilot controls for Signal K v1 & v2 Autopilot API devices. Requires a compatible hardware-specific Autopilot plugin for full functionality.",icon:"autopilotWidget",minWidth:3,minHeight:9,defaultWidth:4,defaultHeight:10,category:"Component",requiredPlugins:[],anyOfPlugins:["autopilot","pypilot-autopilot-provider"],selector:"widget-autopilot",componentClassName:"WidgetAutopilotComponent"},{name:"Realtime Data Chart",description:"Visualizes data on a real-time chart with multiple preconfigured series including actuals, SMA and period overall averages and Min/Max. Requires the KIP Dataset to be configured.",icon:"datachartWidget",minWidth:2,minHeight:3,defaultWidth:6,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-data-chart",componentClassName:"WidgetDataChartComponent"},{name:"Anchor Watch",description:"Monitors your anchor position and triggers an alarm if you drift outside a configured radius (anchor drag). Set the anchor point, watch radius, and alarm behavior (sound/notification) in the widget config. Requires internet connectivity to view map.",icon:"anchorWatch",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["anchoralarm"],selector:"widget-anchor-alarm",componentClassName:"WidgetAnchorAlarmComponent"},{name:"AIS Radar",description:"Displays AIS targets with range rings, interactive target details, and quick zoom and filtering controls.",icon:"aisradar",minWidth:4,minHeight:4,defaultWidth:5,defaultHeight:8,category:"Component",requiredPlugins:[],selector:"widget-ais-radar",componentClassName:"WidgetAisRadarComponent"},{name:"Embed Webpage Viewer",description:"Embeds external web-based applications\u2014such as Grafana graphs or other Signal K apps\u2014into your dashboard for seamless integration. Interaction is disabled by default but can be enabled.",icon:"embedWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-iframe",componentClassName:"WidgetIframeComponent"},{name:"Tutorial",description:"An instructional widget that guides new users through basic navigation, gestures, and dashboard editing steps.",icon:"helpWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-tutorial",componentClassName:"WidgetTutorialComponent"},{name:"Racesteer (BETA)",description:"A dynamic race steering display that fuses polar performance data with live conditions to guide optimal steering, tacking, and gybing angles for maximum speed. Instantly compare performance against competition polars for smarter tactical decisions.",icon:"racesteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Racing",requiredPlugins:["signalk-polar-performance-plugin"],selector:"widget-racesteer",componentClassName:"WidgetRacesteerComponent"},{name:"Racer - Start Line Insight",description:"Gain a tactical advantage for racing starts: set and adjust the port and starboard ends of the start line, see your distance to the line, the favored end, and how much the line is favored or unfavored. Includes visual integration with Freeboard SK for interactive line adjustment and display.",icon:"racerlineWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-line",componentClassName:"WidgetRacerLineComponent"},{name:"Racer - Start Timer",description:"An advanced racing countdown timer that indicates OCS (On Course Side) status. Set the start line, choose or adjust the duration, or specify the exact start time. Automatically switches to the target dashboard at the start unless over early.",icon:"racertimerWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-timer",componentClassName:"WidgetRacerTimerComponent"},{name:"Countdown Timer",description:"A simple race start countdown timer that can be started, paused, synced, reset, and configured for duration.",icon:"racetimerWidget",minWidth:4,minHeight:4,defaultWidth:6,defaultHeight:7,category:"Racing",requiredPlugins:[],selector:"widget-racetimer",componentClassName:"WidgetRaceTimerComponent"},{name:"Wind Trends",description:"A real-time wind trends graph with dual axes for direction and speed. Displays live values and simple moving averages over the current period\u2019s average.",icon:"windtrendsWidget",minWidth:8,minHeight:6,defaultWidth:10,defaultHeight:8,category:"Racing",requiredPlugins:[],selector:"widget-windtrends-chart",componentClassName:"WidgetWindTrendsChartComponent"}];get kipWidgets(){return this._widgetDefinition}get categories(){return this._widgetCategories}getComponentType(e){let o=this._componentTypePromise.get(e);if(o)return o;let t=this._widgetDefinition.find(i=>i.selector===e);if(!t)return Promise.resolve(void 0);let a=this._componentTypeMap[t.componentClassName];if(!a)return Promise.resolve(void 0);let d=a().then(i=>(this._defaultConfigCache.set(e,i.DEFAULT_CONFIG),i)).catch(i=>{this._componentTypePromise.delete(e),console.error("[WidgetService] Failed to load component for",t.componentClassName,i);});return this._componentTypePromise.set(e,d),d}getDefaultConfig(e){return this._defaultConfigCache.get(e)}getKipWidgetsWithStatus(){return Zr$4(this,null,function*(){let e={},o=Array.from(new Set(this._widgetDefinition.flatMap(t=>[...t.requiredPlugins||[],...t.anyOfPlugins||[]])));return yield Promise.all(o.map(t=>Zr$4(this,null,function*(){let a=yield this._pluginConfig.getPlugin(t);e[t]=a.ok;}))),this._widgetDefinition.map(t=>{let a=t.requiredPlugins||[],d=t.anyOfPlugins||[],i=a.map(n=>({name:n,enabled:e[n],required:true})),l=d.map(n=>({name:n,enabled:e[n],required:false})),C=[...i,...l],s=i.every(n=>n.enabled);return s&&d.length>0&&(s=l.some(n=>n.enabled)),z$5(G$b({},t),{isDependencyValid:s,pluginsStatus:C})})})}static \u0275fac=function(o){return new(o||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var g=["*"];var p$1=new N$7("MAT_CARD_CONFIG"),I$3=(()=>{class t{appearance;constructor(){let e=w$4(p$1,{optional:true});this.appearance=e?.appearance||"raised";}static \u0275fac=function(a){return new(a||t)};static \u0275cmp=JD({type:t,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:8,hostBindings:function(a,r){a&2&&sg("mat-mdc-card-outlined",r.appearance==="outlined")("mdc-card--outlined",r.appearance==="outlined")("mat-mdc-card-filled",r.appearance==="filled")("mdc-card--filled",r.appearance==="filled");},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:g,decls:1,vars:0,template:function(a,r){a&1&&(Gw(),zw(0));},styles:[`.mat-mdc-card {
6428
+ This is a requirement to run Kip. See browser documentation to enable this feature.`);}startup(){return Zr$4(this,null,function*(){if(this.useSharedConfig){if(!this.storage.isRemoteContextBootstrapped()||this.storage.initConfig===null){console.warn("[AppSettings Service] Shared configuration enabled but remote bootstrap handoff is missing. Waiting for explicit recovery action.");return}this.configVersion=this.storage.initConfig?.app?.configVersion,this.checkConfigUpgradeRequired(false,this.storage.initConfig?.app?.configVersion),this.activeConfig=this.storage.initConfig,this.pushSettings();}else {console.log("[AppSettings Service] LocalStorage enabled");let e={app:null,theme:null,dashboards:[]};e.app=this.loadConfigFromLocalStorage("appConfig"),this.configVersion=e.app?.configVersion,this.checkConfigUpgradeRequired(true,e.app?.configVersion),e.dashboards=this.loadConfigFromLocalStorage("dashboardsConfig"),e.theme=this.loadConfigFromLocalStorage("themeConfig"),this.activeConfig=e,this.pushSettings();}})}loadConnectionConfig(){let e=this.loadConfigFromLocalStorage("connectionConfig");switch(e.configVersion){case 11:break;case 12:break;default:console.error(`[AppSettings Service] Invalid connectionConfig version ${e.configVersion}. Resetting and loading connection configuration default`),this.resetConnection();break}this.signalkUrl={url:e.signalKUrl,new:false},this.proxyEnabled=e.proxyEnabled,this.signalKSubscribeAll=e.signalKSubscribeAll,this.useDeviceToken=e.useDeviceToken,this.loginName=e.loginName,this.loginPassword=e.loginPassword,this.useSharedConfig=e.useSharedConfig,this.sharedConfigName=e.sharedConfigName,this.kipUUID=e.kipUUID;}resetConnection(){localStorage.setItem("connectionConfig",JSON.stringify(this.getDefaultConnectionConfig())),this.reloadApp();}checkConfigUpgradeRequired(e,t){t!==I$4&&this.configUpgrade.set(true);}loadConfigFromLocalStorage(e){let t=JSON.parse(localStorage.getItem(e)??"null");if(t===null)switch(console.log(`[AppSettings Service] Error loading ${e} config. Force loading ${e} defaults`),e){case "appConfig":t=this.getDefaultAppConfig();break;case "connectionConfig":t=this.getDefaultConnectionConfig();break;case "dashboardsConfig":t=this.getDefaultDashboardsConfig();break;case "themeConfig":t=this.getDefaultThemeConfig();break;default:console.error(`[AppSettings Service] Invalid ${e} default config requested`);break}return e==="connectionConfig"&&t.configVersion!==I$4&&(console.log(`[AppSettings Service] Invalid ${e} version. Force loading defaults`),e==="connectionConfig"&&(t=this.getDefaultConnectionConfig())),t}pushSettings(){let e=this.activeConfig.app??this.getDefaultAppConfig();this.activeConfig.app=e,this.activeConfig.theme&&this.themeName.next(this.activeConfig.theme.themeName),this.dataSets=e.dataSets,this.unitDefaults.next(e.unitDefaults),this.kipKNotificationConfig.next(e.notificationConfig),e.autoNightMode===void 0?this.setAutoNightMode(false):this.autoNightMode.next(e.autoNightMode),e.redNightMode===void 0?this.setRedNightMode(false):this.redNightMode.next(e.redNightMode),e.nightModeBrightness===void 0?this.setNightModeBrightness(.2):this.nightModeBrightness.next(e.nightModeBrightness),this.activeConfig.dashboards===void 0?this._dashboards=[]:this._dashboards=this.activeConfig.dashboards,e.isRemoteControl===void 0?this.setIsRemoteControl(false):this.isRemoteControl.next(e.isRemoteControl),e.instanceName===void 0?this.setInstanceName(""):this.instanceName.next(e.instanceName),e.splitShellEnabled===void 0?this.setSplitShellEnabled(false):this.splitShellEnabled.next(e.splitShellEnabled),e.splitShellSide===void 0?this.setSplitShellSide("left"):this.splitShellSide.next(e.splitShellSide),e.splitShellSwipeDisabled===void 0?this.setSplitShellSwipeDisabled(false):this.splitShellSwipeDisabled.next(e.splitShellSwipeDisabled),e.splitShellWidth===void 0?this.setSplitShellWidth(.5):this.splitShellWidth.next(e.splitShellWidth);let t=this.server.serverVersion$.getValue(),i=typeof t=="string"&&t.trim().length>0?U$2(t,"2.22.1",">="):false;e.widgetHistoryDisabled===void 0?this.setWidgetHistoryDisabled(!i):this.widgetHistoryDisabled.next(i?e.widgetHistoryDisabled:true);}getDefaultUnitsAsO(){return this.unitDefaults.asObservable()}getDefaultUnits(){return this.unitDefaults.getValue()}setDefaultUnits(e){this.unitDefaults.next(e),this.useSharedConfig?this.storage.patchConfig("Array<IUnitDefaults>",e):this.saveAppConfigToLocalStorage();}getConfigVersion(){return this.activeConfig.app?.configVersion??void 0}getAppConfig(){return this.buildAppStorageObject()}getConnectionConfig(){return this.buildConnectionStorageObject()}setConnectionConfig(e){this.loginName=e.loginName,this.loginPassword=e.loginPassword,this.useSharedConfig=e.useSharedConfig,this.proxyEnabled=e.proxyEnabled,this.signalKSubscribeAll=e.signalKSubscribeAll,this.signalkUrl&&(this.signalkUrl.url=e.signalKUrl),e.useSharedConfig?this.useDeviceToken=false:this.useDeviceToken=true,this.saveConnectionConfigToLocalStorage();}setUseDeviceToken(e){this.useDeviceToken=e,this.saveConnectionConfigToLocalStorage();}getDashboardConfig(){return this.buildDashboardStorageObject()}getThemeConfig(){return this.buildThemeStorageObject()}get KipUUID(){return this.kipUUID}getThemeNameAsO(){return this.themeName.asObservable()}setThemeName(e){if(this.themeName.next(e),this.useSharedConfig){let t={themeName:e};this.storage.patchConfig("IThemeConfig",t);}else this.saveThemeConfigToLocalStorage();}getThemeName(){return this.themeName.getValue()}getAutoNightModeAsO(){return this.autoNightMode.asObservable()}setAutoNightMode(e){this.autoNightMode.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getAutoNightMode(){return this.autoNightMode.getValue()}getRedNightModeAsO(){return this.redNightMode.asObservable()}getRedNightMode(){return this.redNightMode.getValue()}setRedNightMode(e){this.redNightMode.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getIsRemoteControlAsO(){return this.isRemoteControl.asObservable()}getIsRemoteControl(){return this.isRemoteControl.getValue()}setIsRemoteControl(e){this.isRemoteControl.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getInstanceNameAsO(){return this.instanceName.asObservable()}getInstanceName(){return this.instanceName.getValue()}setInstanceName(e){this.instanceName.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getDisablePathValidation(){return this.disablePathValidation}setDisablePathValidation(e){this.disablePathValidation=e;}getSplitShellEnabledAsO(){return this.splitShellEnabled.asObservable()}getSplitShellEnabled(){return this.splitShellEnabled.getValue()}setSplitShellEnabled(e){this.splitShellEnabled.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getSplitShellSideAsO(){return this.splitShellSide.asObservable()}getSplitShellSide(){return this.splitShellSide.getValue()}setSplitShellSide(e){this.splitShellSide.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getWidgetHistoryDisabledAsO(){return this.widgetHistoryDisabled.asObservable()}getWidgetHistoryDisabled(){return this.widgetHistoryDisabled.getValue()}setWidgetHistoryDisabled(e){this.widgetHistoryDisabled.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getSplitShellSwipeDisabledAsO(){return this.splitShellSwipeDisabled.asObservable()}getSplitShellSwipeDisabled(){return this.splitShellSwipeDisabled.getValue()}setSplitShellSwipeDisabled(e){this.splitShellSwipeDisabled.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getSplitShellWidthAsO(){return this.splitShellWidth.asObservable()}getSplitShellWidth(){return this.splitShellWidth.getValue()}setSplitShellWidth(e){let t=Math.min(.9,Math.max(.1,e));this.splitShellWidth.next(t);let i=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",i):this.saveAppConfigToLocalStorage();}getNightModeBrightness(){return this.nightModeBrightness.getValue()}setNightModeBrightness(e){this.nightModeBrightness.next(e);let t=this.buildAppStorageObject();this.useSharedConfig?this.storage.patchConfig("IAppConfig",t):this.saveAppConfigToLocalStorage();}getWidgets(){return this.widgets}saveDashboards(e){this.useSharedConfig?this.storage.storageServiceReady$.getValue()&&this.storage.patchConfig("Dashboards",e):this.saveLDashboardsConfigToLocalStorage(e),this._dashboards=e;}saveDataSets(e){this.dataSets=e,this.useSharedConfig?this.storage.patchConfig("Array<IDatasetDef>",e):this.saveAppConfigToLocalStorage();}getDataSets(){return this.dataSets}getNotificationServiceConfigAsO(){return this.kipKNotificationConfig.asObservable()}getNotificationConfig(){return this.kipKNotificationConfig.getValue()}setNotificationConfig(e){this.kipKNotificationConfig.next(e),this.useSharedConfig?this.storage.patchConfig("INotificationConfig",e):this.saveAppConfigToLocalStorage();}resetSettings(){let e={app:null,theme:null,dashboards:[]};e.app=this.getDefaultAppConfig(),e.theme=this.getDefaultThemeConfig(),e.dashboards=this.getDefaultDashboardsConfig(),this.useSharedConfig?this.storage.storageServiceReady$.getValue()&&this.storage.setConfig("user",this.sharedConfigName,e).then(()=>{console.log("[AppSettings Service] Replaced server config name: "+this.sharedConfigName+", with default configuration values"),this.reloadApp();}).catch(t=>{console.error("[AppSettings Service] Error replacing server config name: "+this.sharedConfigName+", with default configuration values",t),this.snackBar.open("Problem saving configuration to the server. Resolve this issue before KIP can be used reliably.","Close",{duration:0,verticalPosition:"top"});}):this.reloadApp();}replaceConfig(e,t,i){let n=JSON.stringify(t);localStorage.setItem(e,n),i&&this.reloadApp();}loadDemoConfig(){if(this.useSharedConfig){let e={app:ie,dashboards:ne$3,theme:oe$1};console.log("[AppSettings Service] Loading Demo configuration settings as remote config: "+this.useSharedConfig+" and reloading app."),this.storage.storageServiceReady$.getValue()&&this.storage.setConfig("user",this.sharedConfigName,e).then(()=>{this.reloadApp();}).catch(t=>{console.error("[AppSettings Service] Error saving demo configuration to the server",t),this.snackBar.open("Problem saving configuration to the server. Resolve this issue before KIP can be used reliably.","Close",{duration:0,verticalPosition:"top"});});}else console.log("[AppSettings Service] Loading Demo configuration settings to LocalStorage"),this.replaceConfig("appConfig",ie),this.replaceConfig("dashboardsConfig",ne$3),this.replaceConfig("themeConfig",oe$1,true);}reloadApp(){console.log("[AppSettings Service] Reload app"),!window.__KIP_TEST__&&location.replace("./");}buildAppStorageObject(){return {configVersion:this.configVersion??I$4,autoNightMode:this.autoNightMode.getValue(),redNightMode:this.redNightMode.getValue(),nightModeBrightness:this.nightModeBrightness.getValue(),isRemoteControl:this.isRemoteControl.getValue(),instanceName:this.instanceName.getValue(),dataSets:this.dataSets,unitDefaults:this.unitDefaults.getValue(),notificationConfig:this.kipKNotificationConfig.getValue(),splitShellEnabled:this.splitShellEnabled.getValue(),splitShellSide:this.splitShellSide.getValue()??"right",splitShellWidth:this.splitShellWidth.getValue()??.5,splitShellSwipeDisabled:this.splitShellSwipeDisabled.getValue(),widgetHistoryDisabled:this.widgetHistoryDisabled.getValue()}}buildConnectionStorageObject(){return {configVersion:this.configVersion??I$4,kipUUID:this.kipUUID,signalKUrl:this.signalkUrl?.url??"",proxyEnabled:this.proxyEnabled,signalKSubscribeAll:this.signalKSubscribeAll,useDeviceToken:this.useDeviceToken,loginName:this.loginName,loginPassword:this.loginPassword,useSharedConfig:this.useSharedConfig,sharedConfigName:this.sharedConfigName}}buildDashboardStorageObject(){return this._dashboards}buildThemeStorageObject(){return {themeName:this.themeName.getValue()}}saveAppConfigToLocalStorage(){console.log("[AppSettings Service] Saving Application config to LocalStorage"),localStorage.setItem("appConfig",JSON.stringify(this.buildAppStorageObject()));}saveConnectionConfigToLocalStorage(){console.log("[AppSettings Service] Saving Connection config to LocalStorage"),localStorage.setItem("connectionConfig",JSON.stringify(this.buildConnectionStorageObject()));}saveLDashboardsConfigToLocalStorage(e){console.log("[AppSettings Service] Saving Dashboard config to LocalStorage"),localStorage.setItem("dashboardsConfig",JSON.stringify(e));}saveThemeConfigToLocalStorage(){console.log("[AppSettings Service] Saving Theme config to LocalStorage"),localStorage.setItem("themeConfig",JSON.stringify(this.buildThemeStorageObject()));}getDefaultAppConfig(){let e=Ze$1;return e.notificationConfig=E$2,e.unitDefaults=$$3,e.configVersion=I$4,localStorage.setItem("appConfig",JSON.stringify(e)),e}getDefaultConnectionConfig(){let e=Xe$1;return e.kipUUID=b.create(),e.signalKUrl=window.location.origin,localStorage.setItem("connectionConfig",JSON.stringify(e)),e}getDefaultDashboardsConfig(){let e=[];return localStorage.setItem("dashboardsConfig",JSON.stringify(e)),e}getDefaultThemeConfig(){let e=Qe$2;return localStorage.setItem("themeConfig",JSON.stringify(e)),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=Q$6({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();var P$3={listSupported:true,detailSupported:true,saveConfigSupported:true,detailFallbackToList:false},y=new Set(["oneOf","anyOf","allOf","if","then","else","dependencies","dependentRequired","dependentSchemas","$ref","not","patternProperties","contains"]),w$2=(()=>{class c{http=w$4(yr$5);connection=w$4(T$2);kipRuntimeModeCache=null;kipRuntimeModePromise=null;capabilities=vt$9(P$3);detectCapabilities(){return Zr$4(this,null,function*(){let e=yield this.listPlugins();if(!e.ok)return e.capabilities;let t=e.data;return t.length===0?e.capabilities:(yield this.getPlugin(t[0].id)).capabilities})}listPlugins(){return Zr$4(this,null,function*(){try{let t=(yield lm(this.http.get(this.toServerUrl("/plugins")))).map(i=>this.normalizePlugin(i));return this.success(t,z$5(G$b({},this.capabilities()),{listSupported:!0}))}catch(e){return this.handleHttpError(e,this.capabilities(),{listSupported:false})}})}getPlugin(e){return Zr$4(this,null,function*(){try{let t=yield lm(this.http.get(this.toServerUrl(`/plugins/${encodeURIComponent(e)}`))),i=yield this.findPluginFromList(e);return i?this.success(z$5(G$b({},i),{state:z$5(G$b({},i.state),{enabled:t.enabled})}),z$5(G$b({},this.capabilities()),{detailSupported:!0})):this.success({id:t.id,name:t.name,packageName:t.id,version:t.version,description:"",keywords:[],statusMessage:null,schema:null,state:{configuration:{},enabled:t.enabled,enableDebug:!1,enableLogging:!1}},z$5(G$b({},this.capabilities()),{detailSupported:!0}))}catch(t){if(this.isHttpStatus(t,404)){let i=yield this.findPluginFromList(e);if(i)return this.success(i,z$5(G$b({},this.capabilities()),{detailSupported:false,detailFallbackToList:true}))}return this.handleHttpError(t,this.capabilities(),{detailSupported:false})}})}getPluginConfig(e){return Zr$4(this,null,function*(){let t=yield this.getPlugin(e);return this.isFailure(t)?this.failure(t):this.success(t.data.state,t.capabilities)})}resolveKipRuntimeModeConfig(e="kip"){return Zr$4(this,null,function*(){let t={historySeriesServiceEnabled:true,registerAsHistoryApiProvider:true},i=yield this.getPluginConfig(e);if(this.isFailure(i))return t;let s=i.data.configuration??{};return {historySeriesServiceEnabled:this.resolveBooleanConfig(s,"historySeriesServiceEnabled",t.historySeriesServiceEnabled),registerAsHistoryApiProvider:this.resolveBooleanConfig(s,"registerAsHistoryApiProvider",t.registerAsHistoryApiProvider)}})}getKipRuntimeModeConfigCached(e="kip",t=false){return Zr$4(this,null,function*(){return t&&(this.kipRuntimeModeCache=null,this.kipRuntimeModePromise=null),this.kipRuntimeModeCache?this.kipRuntimeModeCache:this.kipRuntimeModePromise?this.kipRuntimeModePromise:(this.kipRuntimeModePromise=this.resolveKipRuntimeModeConfig(e).then(i=>(this.kipRuntimeModeCache=i,i)).finally(()=>{this.kipRuntimeModePromise=null;}),this.kipRuntimeModePromise)})}savePluginConfig(e,t){return Zr$4(this,null,function*(){let i=yield this.getPlugin(e);if(this.isFailure(i))return this.failure(i);let s=i.data,n={configuration:G$b(G$b({},s.state.configuration||{}),t.configuration||{}),enabled:t.enabled??s.state.enabled,enableDebug:t.enableDebug??s.state.enableDebug,enableLogging:t.enableLogging??s.state.enableLogging};try{return yield lm(this.http.post(this.toServerUrl(`/plugins/${encodeURIComponent(e)}/config`),n)),this.success({pluginId:e,state:n},z$5(G$b({},i.capabilities),{saveConfigSupported:!0}))}catch(o){return this.handleHttpError(o,i.capabilities,{saveConfigSupported:false})}})}setPluginEnabled(e,t){return Zr$4(this,null,function*(){return this.savePluginConfig(e,{configuration:{},enabled:t})})}validateDependency(e){return Zr$4(this,null,function*(){let t=yield this.getPlugin(e.pluginId);if(this.isFailure(t))return t.error.reason==="not-found"?this.success({status:"missing",pluginId:e.pluginId},t.capabilities):this.failure(t);let i=t.data;if((e.requireEnabled??true)&&!i.state.enabled)return this.success({status:"disabled",pluginId:e.pluginId,plugin:i},t.capabilities);let n=this.getConfigMismatchKeys(e.requiredConfig,i.state.configuration);return n.length>0?this.success({status:"config-mismatch",pluginId:e.pluginId,plugin:i,missingKeys:n},t.capabilities):this.success({status:"ready",pluginId:e.pluginId,plugin:i},t.capabilities)})}normalizePluginSchema(e){if(!e||typeof e!="object")return {hasSchema:false,supported:false,fields:[],unsupportedKeywords:[]};let t=e,i=Object.keys(t).filter(u=>y.has(u)),s=new Set(Array.isArray(t.required)?t.required.filter(u=>typeof u=="string"):[]),n=t.properties&&typeof t.properties=="object"?t.properties:{},o=Object.entries(n).map(([u,S])=>this.toSchemaField(u,S,s.has(u)));return {hasSchema:true,supported:i.length===0,fields:o,unsupportedKeywords:i}}findPluginFromList(e){return Zr$4(this,null,function*(){let t=yield this.listPlugins();return t.ok?t.data.find(i=>i.id===e)??null:null})}normalizePlugin(e){return {id:e.id,name:e.name,packageName:e.packageName,version:e.version,description:e.description,keywords:e.keywords??[],statusMessage:e.statusMessage??null,schema:e.schema??null,state:{configuration:e.data?.configuration??{},enabled:e.data?.enabled??false,enableLogging:e.data?.enableLogging??false,enableDebug:e.data?.enableDebug??false}}}toSchemaField(e,t,i){if(!t||typeof t!="object")return {key:e,type:"unknown",required:i,unsupportedKeywords:[]};let s=t,n=typeof s.type=="string"?s.type:"unknown",o=Object.keys(s).filter(u=>y.has(u));return {key:e,type:this.normalizeSchemaType(n),required:i,title:typeof s.title=="string"?s.title:void 0,description:typeof s.description=="string"?s.description:void 0,enumValues:Array.isArray(s.enum)?s.enum:void 0,defaultValue:s.default,minimum:typeof s.minimum=="number"?s.minimum:void 0,maximum:typeof s.maximum=="number"?s.maximum:void 0,pattern:typeof s.pattern=="string"?s.pattern:void 0,unsupportedKeywords:o}}normalizeSchemaType(e){return e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="array"||e==="object"?e:"unknown"}toServerUrl(e){let t=this.connection.signalKURL?.url?.trim();return t?`${t.endsWith("/")?t.slice(0,-1):t}${e}`:e}resolveBooleanConfig(e,t,i){let s=e[t];return typeof s=="boolean"?s:i}getConfigMismatchKeys(e,t){return e?Object.entries(e).filter(([i,s])=>!this.deepEquals(t?.[i],s)).map(([i])=>i):[]}deepEquals(e,t){if(e===t)return true;if(typeof e!=typeof t)return false;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?false:e.every((i,s)=>this.deepEquals(i,t[s]));if(e&&t&&typeof e=="object"&&typeof t=="object"){let i=e,s=t,n=new Set([...Object.keys(i),...Object.keys(s)]);for(let o of n)if(!this.deepEquals(i[o],s[o]))return false;return true}return false}success(e,t){return this.capabilities.set(t),{ok:true,data:e,capabilities:t}}failure(e){return {ok:false,error:e.error,capabilities:e.capabilities}}isFailure(e){return e.ok===false}handleHttpError(e,t,i={}){let s=G$b(G$b({},t),i),n=this.mapError(e);return this.capabilities.set(s),{ok:false,error:n,capabilities:s}}mapError(e){return e instanceof ue$6?e.status===0?{reason:"network-failure",statusCode:e.status,message:"[Plugin Config Service] Network error while calling plugin API"}:e.status===401?{reason:"auth-required",statusCode:401,message:"[Plugin Config Service] Authentication required"}:e.status===403?{reason:"forbidden",statusCode:403,message:"[Plugin Config Service] Access forbidden for plugin API"}:e.status===404?{reason:"not-found",statusCode:404,message:"[Plugin Config Service] Plugin endpoint or resource not found"}:e.status===405||e.status===501?{reason:"capability-unsupported",statusCode:e.status,message:"[Plugin Config Service] Plugin API capability is not supported by this server"}:e.status>=500?{reason:"server-error",statusCode:e.status,message:"[Plugin Config Service] Server error while calling plugin API"}:{reason:"unknown",statusCode:e.status,message:"[Plugin Config Service] Unexpected plugin API error"}:{reason:"unknown",message:"[Plugin Config Service] Unknown error while calling plugin API"}}isHttpStatus(e,t){return e instanceof ue$6&&e.status===t}static \u0275fac=function(t){return new(t||c)};static \u0275prov=Q$6({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})();var W$2=["Core","Gauge","Component","Racing"];var v=(()=>{class r{_pluginConfig=w$4(w$2);_widgetCategories=[...W$2];_componentTypePromise=new Map;_defaultConfigCache=new Map;_componentTypeMap={WidgetNumericComponent:()=>import('./chunk-COI6IBXH.js').then(e=>e.WidgetNumericComponent),WidgetTextComponent:()=>import('./chunk-BjINKQ03.js').then(e=>e.WidgetTextComponent),WidgetWindTrendsChartComponent:()=>import('./chunk-CoCQ3DW2.js').then(e=>e.WidgetWindTrendsChartComponent),WidgetWindComponent:()=>import('./chunk-_zRMMvCu.js').then(e=>e.WidgetWindComponent),WidgetTutorialComponent:()=>import('./chunk-JhFkJS7i.js').then(e=>e.WidgetTutorialComponent),WidgetSliderComponent:()=>import('./chunk-B0D54iJs.js').then(e=>e.WidgetSliderComponent),WidgetSimpleLinearComponent:()=>import('./chunk-B09jfNia.js').then(e=>e.WidgetSimpleLinearComponent),WidgetRacesteerComponent:()=>import('./chunk-BpcNrtxJ.js').then(e=>e.WidgetRacesteerComponent),WidgetRacerTimerComponent:()=>import('./chunk-C_OZJltF.js').then(e=>e.WidgetRacerTimerComponent),WidgetRacerLineComponent:()=>import('./chunk-D-_-GUVr.js').then(e=>e.WidgetRacerLineComponent),WidgetRaceTimerComponent:()=>import('./chunk-szQs8fiq.js').then(e=>e.WidgetRaceTimerComponent),WidgetPositionComponent:()=>import('./chunk-CHAFm_nM.js').then(e=>e.WidgetPositionComponent),WidgetAisRadarComponent:()=>import('./chunk-BfiyH3nV.js').then(e=>e.WidgetAisRadarComponent),WidgetLabelComponent:()=>import('./chunk-CyVRpGoJ.js').then(e=>e.WidgetLabelComponent),WidgetIframeComponent:()=>import('./chunk-Co2wVrD6.js').then(e=>e.WidgetIframeComponent),WidgetHorizonComponent:()=>import('./chunk-BZx964-p.js').then(e=>e.WidgetHorizonComponent),WidgetHeelGaugeComponent:()=>import('./chunk-BUguZ7cK.js').then(e=>e.WidgetHeelGaugeComponent),WidgetSteelGaugeComponent:()=>import('./chunk-Do8wqING.js').then(e=>e.WidgetSteelGaugeComponent),WidgetGaugeNgRadialComponent:()=>import('./chunk-CxPx4NZv.js').then(e=>e.WidgetGaugeNgRadialComponent),WidgetGaugeNgLinearComponent:()=>import('./chunk-DmkAKXR1.js').then(e=>e.WidgetGaugeNgLinearComponent),WidgetGaugeNgCompassComponent:()=>import('./chunk-CLs_NL1y.js').then(e=>e.WidgetGaugeNgCompassComponent),WidgetFreeboardskComponent:()=>import('./chunk-CYYBxjrc.js').then(e=>e.WidgetFreeboardskComponent),WidgetAnchorAlarmComponent:()=>import('./chunk-B9nVBlGj.js').then(e=>e.WidgetAnchorAlarmComponent),WidgetDatetimeComponent:()=>import('./chunk-BLEZOsfR.js').then(e=>e.WidgetDatetimeComponent),WidgetDataChartComponent:()=>import('./chunk-OeQDZKFO.js').then(e=>e.WidgetDataChartComponent),WidgetBooleanSwitchComponent:()=>import('./chunk-CQMVIDcp.js').then(e=>e.WidgetBooleanSwitchComponent),WidgetMultiStateSwitchComponent:()=>import('./chunk-BeM64etA.js').then(e=>e.WidgetMultiStateSwitchComponent),WidgetZonesStatePanelComponent:()=>import('./chunk-DUEKoZhd.js').then(e=>e.WidgetZonesStatePanelComponent),WidgetAutopilotComponent:()=>import('./chunk-otzyItXL.js').then(e=>e.WidgetAutopilotComponent),WidgetBmsComponent:()=>import('./chunk-D2953Rfp.js').then(e=>e.WidgetBmsComponent),WidgetSolarChargerComponent:()=>import('./chunk-eQ1pa34Q.js').then(e=>e.WidgetSolarChargerComponent),WidgetChargerComponent:()=>import('./chunk-BFpzxIIT.js').then(e=>e.WidgetChargerComponent),WidgetInverterComponent:()=>import('./chunk-D1HYfaL_.js').then(e=>e.WidgetInverterComponent),WidgetAlternatorComponent:()=>import('./chunk-C6b8CVno.js').then(e=>e.WidgetAlternatorComponent),WidgetAcComponent:()=>import('./chunk-CXvWM_vF.js').then(e=>e.WidgetAcComponent)};_widgetDefinition=[{name:"Numeric",description:"Displays numeric data in a clear and concise format, with options to show minimum and/or maximum recorded values. Includes an optional background minichart for quick visual trend insights.",icon:"numericWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-numeric",componentClassName:"WidgetNumericComponent"},{name:"Text",description:"Displays text data with a customizable color formatting option.",icon:"textWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-text",componentClassName:"WidgetTextComponent"},{name:"Date & Time",description:"Displays date and time data with fully custom formatting options and timezone correction.",icon:"datetimeWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-datetime",componentClassName:"WidgetDatetimeComponent"},{name:"Position",description:"Displays latitude and longitude for location tracking and navigation.",icon:"positionWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-position",componentClassName:"WidgetPositionComponent"},{name:"Static Label",description:"A static text widget that allows you to add customizable labels to your dashboard, helping to organize and clarify your layout effectively.",icon:"labelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-label",componentClassName:"WidgetLabelComponent"},{name:"Switch Panel",description:"A Digital Switching panel group with multiple controls including toggle switches, indicator lights, and press buttons to send Signal K paths values and other operations.",icon:"switchpanelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-boolean-switch",componentClassName:"WidgetBooleanSwitchComponent"},{name:"Multi-State Switch",description:"Lists all available device/path operating modes/states (e.g., On, Off, Charge Only, Invert Only), highlights the current state, and lets you select a new state to send to the device and see the result.",icon:"multiStateSwitchWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-multi-state-switch",componentClassName:"WidgetMultiStateSwitchComponent"},{name:"Zones State Panel",description:"Displays the data state (severity and message) of the path's Zones (based on Signal K path metadata configuration).",icon:"zonesStatePanel",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-zones-state-panel",componentClassName:"WidgetZonesStatePanelComponent"},{name:"Slider",description:"A Digital Switching range slider that allows users to adjust values, such as controlling lighting intensity or audio volume from 0% to 100%.",icon:"sliderWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-slider",componentClassName:"WidgetSliderComponent"},{name:"Compact Linear",description:"A simple horizontal linear gauge with a large value label offering a clean, compact modern look.",icon:"simpleLinearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-simple-linear",componentClassName:"WidgetSimpleLinearComponent"},{name:"Linear",description:"A horizontal or vertical linear gauge that supports zone highlighting.",icon:"linearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-linear",componentClassName:"WidgetGaugeNgLinearComponent"},{name:"Radial",description:"A radial gauge with configurable capacity and measurement dials plus zone highlighting.",icon:"radialGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-radial",componentClassName:"WidgetGaugeNgRadialComponent"},{name:"Compass",description:"A faceplate or card-style rotating compass gauge with multiple cardinal point indicator options.",icon:"compassGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-compass",componentClassName:"WidgetGaugeNgCompassComponent"},{name:"Level Gauge",description:"Dual-scale heel angle indicator combining a high\u2011precision \xB15\xB0 fine level with a wide \xB140\xB0 coarse arc for fast trim tuning and broader heel / sea\u2011state monitoring.",icon:"level",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-heel-gauge",componentClassName:"WidgetHeelGaugeComponent"},{name:"Pitch & Roll",description:"Horizon-style attitude indicator showing live pitch and roll degrees with smooth animation\u2014ideal for monitoring trim, heel, and sea-state response.",icon:"pitchRollGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-horizon",componentClassName:"WidgetHorizonComponent"},{name:"Classic Steel",description:"A traditional steel looking linear & radial gauges replica that supports range sizes and zones highlights.",icon:"steelGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-steel",componentClassName:"WidgetSteelGaugeComponent"},{name:"Battery Monitor",description:"Displays battery banks and individual batteries with aggregated bank totals plus per-battery detail cards. See key BMS values such as state of charge, current, voltage, power, temperature, capacity, and time remaining for a clearer view of overall bank health and individual battery status.",icon:"battery_charging",minWidth:2,minHeight:2,defaultWidth:6,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-bms",componentClassName:"WidgetBmsComponent"},{name:"Solar Charger",description:"Track solar generation and charging performance at a glance with live panel output, battery-side metrics, and clear charger and relay status indicators.",icon:"solar_charger",minWidth:2,minHeight:2,defaultWidth:6,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-solar-charger",componentClassName:"WidgetSolarChargerComponent"},{name:"AC/DC Charger",description:"Track charger output and charging state with voltage, current, power, and temperature monitoring, including real-time charging stage indicators.",icon:"charger",minWidth:2,minHeight:2,defaultWidth:6,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-charger",componentClassName:"WidgetChargerComponent"},{name:"Windsteer",description:"A wind steering display that combines wind, wind sectors, heading, course over ground and next waypoint information.",icon:"windsteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-wind-steer",componentClassName:"WidgetWindComponent"},{name:"Freeboard-SK",description:"Adds the Freeboard-SK chart plotter as a widget with automatic sign-in to your dashboard.",icon:"freeboardWidget",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["freeboard-sk","tracks","resources-provider","course-provider"],selector:"widget-freeboardsk",componentClassName:"WidgetFreeboardskComponent"},{name:"Autopilot Head",description:"Provides typical autopilot controls for Signal K v1 & v2 Autopilot API devices. Requires a compatible hardware-specific Autopilot plugin for full functionality.",icon:"autopilotWidget",minWidth:3,minHeight:9,defaultWidth:4,defaultHeight:10,category:"Component",requiredPlugins:[],anyOfPlugins:["autopilot","pypilot-autopilot-provider"],selector:"widget-autopilot",componentClassName:"WidgetAutopilotComponent"},{name:"Realtime Data Chart",description:"Visualizes data on a real-time chart with multiple preconfigured series including actuals, SMA and period overall averages and Min/Max. Requires the KIP Dataset to be configured.",icon:"datachartWidget",minWidth:2,minHeight:3,defaultWidth:6,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-data-chart",componentClassName:"WidgetDataChartComponent"},{name:"Anchor Watch",description:"Monitors your anchor position and triggers an alarm if you drift outside a configured radius (anchor drag). Set the anchor point, watch radius, and alarm behavior (sound/notification) in the widget config. Requires internet connectivity to view map.",icon:"anchorWatch",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["anchoralarm"],selector:"widget-anchor-alarm",componentClassName:"WidgetAnchorAlarmComponent"},{name:"AIS Radar",description:"Displays AIS targets with range rings, interactive target details, and quick zoom and filtering controls.",icon:"aisradar",minWidth:4,minHeight:4,defaultWidth:5,defaultHeight:8,category:"Component",requiredPlugins:[],selector:"widget-ais-radar",componentClassName:"WidgetAisRadarComponent"},{name:"Embed Webpage Viewer",description:"Embeds external web-based applications\u2014such as Grafana graphs or other Signal K apps\u2014into your dashboard for seamless integration. Interaction is disabled by default but can be enabled.",icon:"embedWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-iframe",componentClassName:"WidgetIframeComponent"},{name:"Tutorial",description:"An instructional widget that guides new users through basic navigation, gestures, and dashboard editing steps.",icon:"helpWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-tutorial",componentClassName:"WidgetTutorialComponent"},{name:"Racesteer (BETA)",description:"A dynamic race steering display that fuses polar performance data with live conditions to guide optimal steering, tacking, and gybing angles for maximum speed. Instantly compare performance against competition polars for smarter tactical decisions.",icon:"racesteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Racing",requiredPlugins:["signalk-polar-performance-plugin"],selector:"widget-racesteer",componentClassName:"WidgetRacesteerComponent"},{name:"Racer - Start Line Insight",description:"Gain a tactical advantage for racing starts: set and adjust the port and starboard ends of the start line, see your distance to the line, the favored end, and how much the line is favored or unfavored. Includes visual integration with Freeboard SK for interactive line adjustment and display.",icon:"racerlineWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-line",componentClassName:"WidgetRacerLineComponent"},{name:"Racer - Start Timer",description:"An advanced racing countdown timer that indicates OCS (On Course Side) status. Set the start line, choose or adjust the duration, or specify the exact start time. Automatically switches to the target dashboard at the start unless over early.",icon:"racertimerWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-timer",componentClassName:"WidgetRacerTimerComponent"},{name:"Countdown Timer",description:"A simple race start countdown timer that can be started, paused, synced, reset, and configured for duration.",icon:"racetimerWidget",minWidth:4,minHeight:4,defaultWidth:6,defaultHeight:7,category:"Racing",requiredPlugins:[],selector:"widget-racetimer",componentClassName:"WidgetRaceTimerComponent"},{name:"Wind Trends",description:"A real-time wind trends graph with dual axes for direction and speed. Displays live values and simple moving averages over the current period\u2019s average.",icon:"windtrendsWidget",minWidth:8,minHeight:6,defaultWidth:10,defaultHeight:8,category:"Racing",requiredPlugins:[],selector:"widget-windtrends-chart",componentClassName:"WidgetWindTrendsChartComponent"}];get kipWidgets(){return this._widgetDefinition}get categories(){return this._widgetCategories}getComponentType(e){let o=this._componentTypePromise.get(e);if(o)return o;let t=this._widgetDefinition.find(i=>i.selector===e);if(!t)return Promise.resolve(void 0);let a=this._componentTypeMap[t.componentClassName];if(!a)return Promise.resolve(void 0);let d=a().then(i=>(this._defaultConfigCache.set(e,i.DEFAULT_CONFIG),i)).catch(i=>{this._componentTypePromise.delete(e),console.error("[WidgetService] Failed to load component for",t.componentClassName,i);});return this._componentTypePromise.set(e,d),d}getDefaultConfig(e){return this._defaultConfigCache.get(e)}getKipWidgetsWithStatus(){return Zr$4(this,null,function*(){let e={},o=Array.from(new Set(this._widgetDefinition.flatMap(t=>[...t.requiredPlugins||[],...t.anyOfPlugins||[]])));return yield Promise.all(o.map(t=>Zr$4(this,null,function*(){let a=yield this._pluginConfig.getPlugin(t);e[t]=a.ok;}))),this._widgetDefinition.map(t=>{let a=t.requiredPlugins||[],d=t.anyOfPlugins||[],i=a.map(n=>({name:n,enabled:e[n],required:true})),l=d.map(n=>({name:n,enabled:e[n],required:false})),C=[...i,...l],s=i.every(n=>n.enabled);return s&&d.length>0&&(s=l.some(n=>n.enabled)),z$5(G$b({},t),{isDependencyValid:s,pluginsStatus:C})})})}static \u0275fac=function(o){return new(o||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var g=["*"];var p$1=new N$7("MAT_CARD_CONFIG"),I$3=(()=>{class t{appearance;constructor(){let e=w$4(p$1,{optional:true});this.appearance=e?.appearance||"raised";}static \u0275fac=function(a){return new(a||t)};static \u0275cmp=JD({type:t,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:8,hostBindings:function(a,r){a&2&&sg("mat-mdc-card-outlined",r.appearance==="outlined")("mdc-card--outlined",r.appearance==="outlined")("mat-mdc-card-filled",r.appearance==="filled")("mdc-card--filled",r.appearance==="filled");},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:g,decls:1,vars:0,template:function(a,r){a&1&&(Gw(),zw(0));},styles:[`.mat-mdc-card {
6429
6429
  display: flex;
6430
6430
  flex-direction: column;
6431
6431
  box-sizing: border-box;
@@ -6631,7 +6631,7 @@ This is a requirement to run Kip. See browser documentation to enable this featu
6631
6631
  .mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mat-icon {
6632
6632
  margin: auto;
6633
6633
  }
6634
- `],encapsulation:2})}return i})(),yt$3=(()=>{class i{static \u0275fac=function(e){return new(e||i)};static \u0275mod=bh$1({type:i});static \u0275inj=Qs$2({imports:[Fn$5]})}return i})();var n$1=(function(r){return r.Normal="normal",r.Nominal="nominal",r.Alert="alert",r.Warn="warn",r.Alarm="alarm",r.Emergency="emergency",r})(n$1||{});var o=(function(r){return r.Visual="visual",r.Sound="sound",r})(o||{});var G$5={url:"",deserializer:r=>JSON.parse(r.data),serializer:r=>JSON.stringify(r)},H$2="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",W$1=class r extends eo$4{constructor(c,e){if(super(),this._socket=null,c instanceof S$5)this.destination=e,this.source=c;else {let t=this._config=Object.assign({},G$5);if(this._output=new te$9,typeof c=="string")t.url=c;else for(let i in c)c.hasOwnProperty(i)&&(t[i]=c[i]);if(!t.WebSocketCtor&&WebSocket)t.WebSocketCtor=WebSocket;else if(!t.WebSocketCtor)throw new Error("no WebSocket constructor can be found");this.destination=new $n$4;}}lift(c){let e=new r(this._config,this.destination);return e.operator=c,e.source=this,e}_resetState(){this._socket=null,this.source||(this.destination=new $n$4),this._output=new te$9;}multiplex(c,e,t){let i=this;return new S$5(s=>{try{i.next(c());}catch(n){s.error(n);}let a=i.subscribe({next:n=>{try{t(n)&&s.next(n);}catch(o){s.error(o);}},error:n=>s.error(n),complete:()=>s.complete()});return ()=>{try{i.next(e());}catch(n){s.error(n);}a.unsubscribe();}})}_connectSocket(){let{WebSocketCtor:c,protocol:e,url:t,binaryType:i}=this._config,s=this._output,a=null;try{a=e?new c(t,e):new c(t),this._socket=a,i&&(this._socket.binaryType=i);}catch(o){s.error(o);return}let n=new j$5(()=>{this._socket=null,a&&a.readyState===1&&a.close();});a.onopen=o=>{let{_socket:l}=this;if(!l){a.close(),this._resetState();return}let{openObserver:d}=this._config;d&&d.next(o);let S=this.destination;this.destination=bt$a.create(h=>{if(a.readyState===1)try{let{serializer:f}=this._config;a.send(f(h));}catch(f){this.destination.error(f);}},h=>{let{closingObserver:f}=this._config;f&&f.next(void 0),h&&h.code?a.close(h.code,h.reason):s.error(new TypeError(H$2)),this._resetState();},()=>{let{closingObserver:h}=this._config;h&&h.next(void 0),a.close(),this._resetState();}),S&&S instanceof $n$4&&n.add(S.subscribe(this.destination));},a.onerror=o=>{this._resetState(),s.error(o);},a.onclose=o=>{a===this._socket&&this._resetState();let{closeObserver:l}=this._config;l&&l.next(o),o.wasClean?s.complete():s.error(o);},a.onmessage=o=>{try{let{deserializer:l}=this._config;s.next(l(o));}catch(l){s.error(l);}};}_subscribe(c){let{source:e}=this;return e?e.subscribe(c):(this._socket||this._connectSocket(),this._output.subscribe(c),c.add(()=>{let{_socket:t}=this;this._output.observers.length===0&&(t&&(t.readyState===1||t.readyState===0)&&t.close(),this._resetState());}),c)}unsubscribe(){let{_socket:c}=this;c&&(c.readyState===1||c.readyState===0)&&c.close(),this._resetState(),super.unsubscribe();}};function x$3(r){return new W$1(r)}var I$2=(()=>{class r{_destroyRef=w$4(xe$3);_skRequests$=new te$9;_skNotificationsMsg$=new te$9;_skValue$=new te$9;_skMetadata$=new te$9;_vesselSelfUrn$=new te$9;_selfUrn;streamEndpoint={operation:0,message:"Not connected",hasToken:false};streamEndpoint$=new Bn$5(this.streamEndpoint);endpointWS=null;SubscriptionType="self";WS_CONNECTION_SUBSCRIBE="?subscribe=";WS_CONNECTION_META="&sendMeta=all";socketWS$=null;socketWSCloseEvent$=new te$9;socketWSOpenEvent$=new te$9;authToken=null;server=w$4(T$2);auth=w$4(He$4);connectionStateMachine=w$4(We$3);FLATTEN_CONFIG={maxDepth:3,maxObjectSize:20,enableFlattening:true};DO_NOT_FLATTEN_PATHS=["displays."];constructor(){this.connectionStateMachine.setWebSocketRetryCallback(()=>{console.log("[Delta Service] Executing WebSocket retry via callback"),this.retryWebSocketConnection();}),this.server.serverServiceEndpoint$.pipe(Gp(this._destroyRef)).subscribe(e=>{e.operation===2&&(this.endpointWS=e.WsServiceUrl,e.subscribeAll?this.SubscriptionType="all":this.SubscriptionType="self");}),this.connectionStateMachine.state$.pipe(Gp(this._destroyRef)).subscribe(e=>{switch(e){case l$1.WebSocketConnecting:this.handleWebSocketConnecting();break;case l$1.Connected:break;case l$1.Disconnected:case l$1.WebSocketError:case l$1.PermanentFailure:this.handleDisconnection();break}}),this.auth.authToken$.pipe(Gp(this._destroyRef)).subscribe(e=>{this.authToken!=e&&(this.authToken=e,this.socketWS$&&this.connectionStateMachine.isFullyConnected()&&(this.closeWS("Token changed"),this.connectionStateMachine.startWebSocketConnection()));}),this.socketWSOpenEvent$.pipe(Gp(this._destroyRef)).subscribe(()=>{this.streamEndpoint.message="Connected",this.streamEndpoint.operation=2,this.authToken?console.log("[Delta Service] WebSocket connected with Authorization Token"):console.log("[Delta Service] WebSocket connected without Authorization Token"),this.streamEndpoint$.next(this.streamEndpoint),this.connectionStateMachine.onWebSocketConnected();}),this.socketWSCloseEvent$.pipe(Gp(this._destroyRef)).subscribe(e=>{e.wasClean?(console.log("[Delta Service] WebSocket closed cleanly"),this.streamEndpoint.message="WebSocket closed",this.streamEndpoint.operation=0):(console.log("[Delta Service] WebSocket terminated due to socket error"),this.streamEndpoint.message="WebSocket error",this.streamEndpoint.operation=3,this.connectionStateMachine.onWebSocketError("WebSocket connection lost")),this.streamEndpoint$.next(this.streamEndpoint);}),Ds$3(document,"visibilitychange").pipe(Gp(this._destroyRef)).subscribe(()=>{document.visibilityState==="visible"?(console.log("[Delta Service] App resumed, checking WebSocket connection..."),this.checkAndReconnect("App resumed")):document.visibilityState==="hidden"&&console.log("[Delta Service] App suspended");});}connectWS(e){this.streamEndpoint.message="Connecting",this.streamEndpoint.operation=1,console.log(`[Delta Service] ${e}: WebSocket opening...`),this.streamEndpoint$.next(this.streamEndpoint),this.socketWS$=this.getNewWebSocket(),this.socketWS$.pipe(Gp(this._destroyRef)).subscribe({next:t=>this.processWebsocketMessage(t),error:t=>{console.error("[Delta Service] WebSocket error:",t);}});}retryWebSocketConnection(){if(console.log("[Delta Service] Retrying WebSocket connection"),!this.endpointWS){console.warn("[Delta Service] No WebSocket endpoint available for retry"),this.connectionStateMachine.onWebSocketError("No WebSocket endpoint available");return}this.socketWS$&&this.closeWS("Retrying connection"),this.connectWS("WebSocket retry attempt");}handleWebSocketConnecting(){if(!this.endpointWS){console.warn("[Delta Service] No WebSocket endpoint available"),this.connectionStateMachine.onWebSocketError("No WebSocket endpoint available");return}this.socketWS$&&this.closeWS("Starting new connection"),this.connectWS("ConnectionStateMachine request");}handleDisconnection(){this.socketWS$&&this.closeWS("ConnectionStateMachine disconnection"),this.streamEndpoint.message="Not connected",this.streamEndpoint.operation=0,this.streamEndpoint$.next(this.streamEndpoint);}getNewWebSocket(){let e=this.WS_CONNECTION_SUBSCRIBE+this.SubscriptionType+this.WS_CONNECTION_META;return this.authToken!=null?(e+="&token="+this.authToken.token,this.streamEndpoint.hasToken=true):this.streamEndpoint.hasToken=false,x$3({url:this.endpointWS+e,closeObserver:this.socketWSCloseEvent$,openObserver:this.socketWSOpenEvent$})}closeWS(e){this.socketWS$&&(this.streamEndpoint.operation=4,console.log("[Delta Service] "+e+": WebSocket closing..."),this.socketWS$.complete());}publishDelta(e){this.socketWS$?this.socketWS$.next(e):console.log("[Delta Service] No WebSocket present to send message - dropping message");}processWebsocketMessage(e){if(e.updates){this.parseUpdates(e.updates,e.context);return}if(e.requestId){this._skRequests$.next(e);return}if(e.errorMessage){console.warn("[Delta Service] Service received stream error message: "+e.errorMessage);return}if(e.self){this._selfUrn=e.self,this._vesselSelfUrn$.next(e.self),this.server.setServerInfo(e.name,e.version,e.roles??[]);return}console.warn("[Delta Service] Unknown message type. Message content:"+e);}parseUpdates(e,t){e.forEach(i=>{i.meta!==void 0&&i.meta.forEach(s=>this.parseSkMeta(s,t)),i.values!==void 0&&i.values.forEach(s=>{if(s.path.startsWith("notifications."))this._skNotificationsMsg$.next(s);else if(typeof s.value=="object"&&s.value!==null)if(this.DO_NOT_FLATTEN_PATHS.some(a=>s.path.includes(a))){let a={context:this.resolveContext(t),path:s.path,source:i.$source,timestamp:i.timestamp,value:s.value};this._skValue$.next(a);}else this.FLATTEN_CONFIG.enableFlattening&&this.canFlattenCompletely(s.value,this.FLATTEN_CONFIG.maxDepth,this.FLATTEN_CONFIG.maxObjectSize)?this.flattenObjectValue(s.value,s.path).forEach(n=>{let o={context:this.resolveContext(t),path:n.path,source:i.$source,timestamp:i.timestamp,value:n.value};this._skValue$.next(o);}):Object.keys(s.value).forEach(a=>{let n={context:this.resolveContext(t),path:`${s.path}.${a}`,source:i.$source,timestamp:i.timestamp,value:s.value[a]};this._skValue$.next(n);});else {let a={context:this.resolveContext(t),path:s.path,source:i.$source,timestamp:i.timestamp,value:s.value};this._skValue$.next(a);}});});}canFlattenCompletely(e,t,i,s=0){if(s>=t)return false;if(typeof e!="object"||e===null)return true;let a=Object.keys(e);if(a.length>i)return false;for(let n of a)if(!this.canFlattenCompletely(e[n],t,i,s+1))return false;return true}flattenObjectValue(e,t,i=0){let s=[];if(typeof e!="object"||e===null||i>=this.FLATTEN_CONFIG.maxDepth)return [{path:t,value:e}];let a=Object.keys(e);for(let n of a){let o=t?`${t}.${n}`:n,l=this.flattenObjectValue(e[n],o,i+1);s.push(...l);}return s}parseSkMeta(e,t){if(e.value.properties!==void 0){let i=e.value.properties;Object.keys(i).forEach(s=>{this._skMetadata$.next({context:this.resolveContext(t),path:`${e.path}.${s}`,meta:i[s]});});}else this._skMetadata$.next({context:this.resolveContext(t),path:e.path,meta:e.value});}resolveContext(e){return e??this._selfUrn??"vessels.self"}getDataStreamStatusAsO(){return this.streamEndpoint$.asObservable()}subscribeRequestUpdates(){return this._skRequests$.asObservable()}subscribeNotificationsUpdates(){return this._skNotificationsMsg$.asObservable()}subscribeDataPathsUpdates(){return this._skValue$.asObservable()}subscribeMetadataUpdates(){return this._skMetadata$.asObservable()}subscribeSelfUpdates(){return this._vesselSelfUrn$.asObservable()}checkAndReconnect(e){this.connectionStateMachine.isFullyConnected()?console.log(`[Delta Service] ${e}: Connection is active.`):this.connectionStateMachine.isHTTPConnected()&&this.connectionStateMachine.currentState!==l$1.WebSocketRetrying?(console.log(`[Delta Service] ${e}: WebSocket disconnected, requesting reconnection...`),this.connectionStateMachine.startWebSocketConnection()):console.log(`[Delta Service] ${e}: HTTP not connected, cannot start WebSocket`);}ngOnDestroy(){this.closeWS("App terminated"),this._skRequests$.complete(),this._skNotificationsMsg$.complete(),this._skValue$.complete(),this._skMetadata$.complete(),this._vesselSelfUrn$.complete(),this.streamEndpoint$.complete(),this.socketWSOpenEvent$.complete(),this.socketWSCloseEvent$.complete(),this.socketWS$?.complete();}static \u0275fac=function(t){return new(t||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var Z$1="self",V$1=r=>isFinite(+(r instanceof Date?r:new Date(r)))?!!new RegExp("^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))$").test(r):false,z$1=r=>{if(r)return r==="RFC 3339 (UTC)"?"Date":"number"},L$2=(r,c)=>{let e;return {value:r,get timestamp(){return e===void 0&&(e=c?new Date(c):null),e}}},De$2=(()=>{class r{delta=w$4(I$2);_destroyRef=w$4(xe$3);_deltaUpdatesCounter=0;_deltaUpdatesSubject=new $n$4(10);_isSkDataFullTreeActive=false;_skDataSubject$=new Bn$5([]);_skDataEmitTimer=null;_skDataEmitIntervalMs=200;_dataServiceMeta=[];_dataServiceMetaByPath=new Map;_isSkMetaFullTreeActive=false;_dataServiceMetaSubject$=new Bn$5([]);_skNotificationMsg$=new te$9;_skNotificationMeta$=new te$9;_isReset=new te$9;_pathUpdates$=new te$9;_selfUrn="self";_skData=new Map;_pendingPathStates=new Map;_skDataArrayCache=[];_skDataIndexByPath=new Map;_pathRegister=[];_pathRegisterByPath=new Map;constructor(){ms$4(1e3).pipe(Gp(this._destroyRef)).subscribe(()=>{let e={timestamp:Date.now(),value:this._deltaUpdatesCounter};this._deltaUpdatesSubject.next(e),this._deltaUpdatesCounter=0;}),this.delta.subscribeDataPathsUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{this.updatePathData(e);}),this.delta.subscribeMetadataUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{this.setMeta(e);}),this.delta.subscribeNotificationsUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{let t=e.path.replace("notifications.","self."),i=e.value.state,s=this._skData.get(t);if(s&&s.state!==i){s.state=i,this._pathUpdates$.next({fullPath:t,kind:"state"});let a=this._pathRegisterByPath.get(t);if(a?.length)for(let n of a)n._pathState$.next(s.state);}else s||this._pendingPathStates.set(t,i);this._skNotificationMsg$.next(e);}),this.delta.subscribeSelfUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{this.setSelfUrn(e);});}getSignalkDeltaUpdateStatistics(){return this._deltaUpdatesSubject.asObservable()}resetSignalKData(){this._skData=new Map,this._pendingPathStates.clear(),this._skDataArrayCache=[],this._skDataIndexByPath.clear(),this._selfUrn="self",this._isReset.next(true);}unsubscribePath(e){let t=this._pathRegister.findIndex(i=>i.path===e);if(t!==-1){let i=this._pathRegister[t];i.combinedSub?.unsubscribe(),i._pathData$?.complete(),i._pathState$?.complete(),i.pathDataUpdate$?.complete(),i.pathMeta$?.complete(),this._pathRegister.splice(t,1);let s=this._pathRegisterByPath.get(e);if(s){let a=s.filter(n=>n!==i);a.length?this._pathRegisterByPath.set(e,a):this._pathRegisterByPath.delete(e);}}}subscribePath(e,t){let i=this._pathRegisterByPath.get(e),s=i?.find(k=>k.path===e&&k.source===t);if(s)return s.pathDataUpdate$;let a=null,n=null,o=null,l=n$1.Normal,d={data:{value:null,timestamp:null},state:l},S=null,h=this._skData.get(e);h&&(a=t==="default"?h.pathValue:h.sources?.[t]?.sourceValue??null,n=t==="default"?h.pathTimestamp:h.sources?.[t]?.sourceTimestamp??null,o=n?new Date(n):null,d={data:{value:a,timestamp:o},state:h.state||l},l=h.state||l,S=h.meta||null);let f={path:e,source:t,_pathData$:new Bn$5(d.data),_pathState$:new Bn$5(d.state),pathDataUpdate$:new Bn$5(d),pathMeta$:new Bn$5(S?dp(S):null)},q=Fm([f._pathData$,f._pathState$]).pipe(ke$3(([k,K])=>({data:k,state:K})));return f.combinedSub=q.subscribe(k=>f.pathDataUpdate$.next(k)),this._pathRegister.push(f),i?i.push(f):this._pathRegisterByPath.set(e,[f]),f.pathDataUpdate$}subscribePathTree(e,t="default"){let i=this.subscribePathTreeWithInitial(e,t);return new S$5(s=>{for(let n of i.initial)s.next(n);let a=i.live$.subscribe(s);return ()=>a.unsubscribe()}).pipe(Gp(this._destroyRef))}subscribePathTreeWithInitial(e,t="default"){let i=this.normalizePathPrefix(e),s=[];for(let n of this._skData.values())n.path.startsWith(i)&&s.push({path:n.path,update:this.buildPathUpdate(n,t)});let a=this._pathUpdates$.pipe(fn$7(n=>n.fullPath.startsWith(i)),ke$3(n=>{let o=this._skData.get(n.fullPath);return o?{path:o.path,update:this.buildPathUpdate(o,t)}:null}),fn$7(n=>n!==null),Gp(this._destroyRef));return {initial:s,live$:a}}updatePathData(e){this._deltaUpdatesCounter++;let t=this.setPathContext(e.context,e.path),i=this._pendingPathStates.get(t),s=this._skData.get(t);if(s)s.defaultSource===void 0&&(s.defaultSource=e.source),s.type===void 0&&e.value!==null&&(s.type=typeof e.value,s.type==="string"&&V$1(e.value)&&(s.type="Date")),s.pathValue=e.value,s.pathTimestamp=e.timestamp,s.sources[e.source]={sourceTimestamp:e.timestamp,sourceValue:e.value};else {let n=e.value===null?void 0:typeof e.value;n==="string"&&V$1(e.value)&&(n="Date"),s={path:t,pathValue:e.value,pathTimestamp:e.timestamp,defaultSource:e.source,type:n,state:i??n$1.Normal,sources:{[e.source]:{sourceTimestamp:e.timestamp,sourceValue:e.value}}},this._skData.set(t,s),i!==void 0&&this._pendingPathStates.delete(t);}let a=this._pathRegisterByPath.get(t)??[];if(a.length){let n=L$2(s.pathValue,s.pathTimestamp),o=a.find(d=>d.source==="default");o&&o._pathData$.next(n);let l=a.find(d=>d.source===e.source);l&&l._pathData$.next(n);}this._isSkDataFullTreeActive&&(this.upsertSkDataCache(s),this.scheduleSkDataFullTreeEmit()),this._pathUpdates$.next({fullPath:t,kind:"data",update:e});}setMeta(e){if(e.path.startsWith("notifications."))this._skNotificationMeta$.next(e);else {let t=this.setPathContext(e.context,e.path),i=this._pendingPathStates.get(t),s=this._skData.get(t);if(s?(s.type==="object"&&e.meta.units&&(s.type=z$1(e.meta.units)),s.meta=Ap({},s.meta,e.meta)):(s={path:t,pathValue:void 0,pathTimestamp:void 0,type:z$1(e.meta.units),state:i??n$1.Normal,defaultSource:void 0,sources:{},meta:e.meta?dp(e.meta):void 0},this._skData.set(t,s),i!==void 0&&this._pendingPathStates.delete(t),this._isSkDataFullTreeActive&&(this.upsertSkDataCache(s),this.scheduleSkDataFullTreeEmit())),!s)return;let a=this._pathRegisterByPath.get(t);if(a?.length)for(let n of a)n.pathMeta$.next(s.meta?dp(s.meta):null);this._isSkMetaFullTreeActive&&(this._dataServiceMetaByPath.set(t,{path:t,meta:s.meta}),this._dataServiceMeta=Array.from(this._dataServiceMetaByPath.values()),this._dataServiceMetaSubject$.next(this._dataServiceMeta));}}startSkMetaFullTree(){this._isSkMetaFullTreeActive=true,this._dataServiceMetaByPath.clear();for(let e of this.getSkDataArray())e.meta!==void 0&&e.path.startsWith("self.")&&this._dataServiceMetaByPath.set(e.path,{path:e.path,meta:e.meta});return this._dataServiceMeta=Array.from(this._dataServiceMetaByPath.values()),this._dataServiceMetaSubject$.next(this._dataServiceMeta),this._dataServiceMetaSubject$}stopSkMetaFullTree(){this._isSkMetaFullTreeActive=false,this._dataServiceMetaSubject$.next([]),this._dataServiceMeta=[],this._dataServiceMetaByPath.clear();}startSkDataFullTree(){return this._isSkDataFullTreeActive=true,this.refreshSkDataCache(),this.emitSkDataFullTree(),this._skDataSubject$}getSkDataArray(){return this._isSkDataFullTreeActive?this._skDataArrayCache:Array.from(this._skData.values())}observePathUpdates(){return this._pathUpdates$.asObservable()}stopSkDataFullTree(){this._isSkDataFullTreeActive=false,this._skDataEmitTimer&&(clearTimeout(this._skDataEmitTimer),this._skDataEmitTimer=null),this._skDataArrayCache=[],this._skDataIndexByPath.clear();}scheduleSkDataFullTreeEmit(){!this._isSkDataFullTreeActive||this._skDataEmitTimer||(this._skDataEmitTimer=setTimeout(()=>{this._skDataEmitTimer=null,this.emitSkDataFullTree();},this._skDataEmitIntervalMs));}emitSkDataFullTree(){this._isSkDataFullTreeActive&&this._skDataSubject$.next(this._skDataArrayCache);}refreshSkDataCache(){this._skDataArrayCache=Array.from(this._skData.values()),this._skDataIndexByPath.clear(),this._skDataArrayCache.forEach((e,t)=>this._skDataIndexByPath.set(e.path,t));}upsertSkDataCache(e){let t=this._skDataIndexByPath.get(e.path);t===void 0?(this._skDataIndexByPath.set(e.path,this._skDataArrayCache.length),this._skDataArrayCache.push(e)):this._skDataArrayCache[t]=e;}setSelfUrn(e){e!==""&&e!==null?(console.debug("[Signal K Data Service] Setting self to: "+e),this._selfUrn=e):console.error("[Signal K Data Service] Invalid self URN: "+e);}setPathContext(e,t){return e!==this._selfUrn?`${e}.${t}`:`${Z$1}.${t}`}normalizePathPrefix(e){let t=e?.trim()??"";return (t.endsWith(".*")||t.endsWith(":*")||t.endsWith("*"))&&(t=t.slice(0,-1)),t&&!t.endsWith(".")&&!t.endsWith(":")&&(t=`${t}.`),t}buildPathUpdate(e,t){let i=t==="default",s=i?e.pathValue:e.sources?.[t]?.sourceValue??null,a=i?e.pathTimestamp:e.sources?.[t]?.sourceTimestamp??null;return {data:L$2(s,a),state:e.state||n$1.Normal}}getPathsByType(e,t){return this.getSkDataArray().filter(i=>i.type===e&&(!t||i.path.startsWith("self"))).map(i=>i.path)}getCachedPaths(e=false){return this.getSkDataArray().map(t=>t.path).filter(t=>!e||t.startsWith("self."))}getPathsAndMetaByType(e,t=false,i=false,s=true){return this.getSkDataArray().filter(a=>{let o=["string","number","boolean","object","undefined","function","symbol","bigint","Date"].includes(e)?a.type===e:a.meta?.type===e,l=!s||a.path.startsWith("self"),d=t===true?a.meta?.supportsPut===true:true,S=i===true?Array.isArray(a.meta?.zones)&&a.meta.zones.length>0:true;return o&&l&&d&&S}).map(a=>({path:a.path,meta:a.meta}))}getPathObject(e){return dp(this._skData.get(e))||null}getPathUnitType(e){return this._skData.get(e)?.meta?.units||null}timeoutPathObservable(e,t){let i=this._pathRegister.find(s=>s.path==e);if(i){let s={data:{value:null,timestamp:null},state:n$1.Normal};["string","Date","number","multiple"].includes(t)&&i.pathDataUpdate$.next(s);}}getNotificationMsgObservable(){return this._skNotificationMsg$.asObservable()}getNotificationMetaObservable(){return this._skNotificationMeta$.asObservable()}getPathMetaObservable(e){return this._pathRegisterByPath.get(e)?.[0]?.pathMeta$.asObservable()||Tm(null)}getPathMeta(e){return this._skData.get(e)?.meta||null}isResetService(){return this._isReset.asObservable()}ngOnDestroy(){this._skDataEmitTimer&&(clearTimeout(this._skDataEmitTimer),this._skDataEmitTimer=null),this._deltaUpdatesSubject?.complete(),this._skNotificationMsg$?.complete(),this._skNotificationMeta$?.complete(),this._isReset?.complete(),this._skDataSubject$?.complete(),this._dataServiceMetaSubject$?.complete(),this._pathUpdates$?.complete();}static \u0275fac=function(t){return new(t||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var h$1={version:"4.8.2"};var N$1=(()=>{class r{static EMPTY_THEME={blue:"",blueDim:"",blueDimmer:"",green:"",greenDim:"",greenDimmer:"",purple:"",purpleDim:"",purpleDimmer:"",yellow:"",yellowDim:"",yellowDimmer:"",pink:"",pinkDim:"",pinkDimmer:"",orange:"",orangeDim:"",orangeDimmer:"",contrast:"",contrastDim:"",contrastDimmer:"",grey:"",greyDim:"",greyDimmer:"",port:"",starboard:"",zoneNominal:"",zoneAlert:"",zoneWarn:"",zoneAlarm:"",zoneEmergency:"",background:"",cardColor:""};MODE_PATH="self.environment.mode";configurableThemeColors=[{label:"Contrast",value:"contrast"},{label:"Blue",value:"blue"},{label:"Green",value:"green"},{label:"Orange",value:"orange"},{label:"Yellow",value:"yellow"},{label:"Pink",value:"pink"},{label:"Purple",value:"purple"},{label:"Grey",value:"grey"}];cssThemeColorRoles$=new Bn$5(r.EMPTY_THEME);_cssThemeColorRoles=r.EMPTY_THEME;_settings=w$4(Gi$3);_data=w$4(De$2);_iconRegistry=w$4(K$4);_sanitizer=w$4(Dr$4);isNightMode=vt$9(false);_useAutoNightMode=Wp(this._settings.getAutoNightModeAsO(),{requireSync:true});_theme=Wp(this._settings.getThemeNameAsO(),{requireSync:true});_redNightMode=Wp(this._settings.getRedNightModeAsO(),{requireSync:true});_environmentMode=Wp(this._data.subscribePath(this.MODE_PATH,"default"));previousEnvironmentMode=null;appVersion=vt$9(h$1.version);browserVersion=vt$9("Unknown");osVersion=vt$9("Unknown");constructor(){this._iconRegistry.addSvgIconSet(this._sanitizer.bypassSecurityTrustResourceUrl("assets/svg/icons.svg")),Fa$5(()=>{this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme");}),Fa$5(()=>{let t=this._environmentMode()?.data?.value;ge$5(()=>{typeof t=="string"&&this.previousEnvironmentMode!==t&&(this.previousEnvironmentMode=t,this._useAutoNightMode()&&(this.isNightMode.set(t==="night"),this.toggleDayNightMode()));});}),Fa$5(()=>{let t=this._redNightMode();ge$5(()=>{t?this.toggleDayNightMode():this.toggleDayNightMode();});}),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue(),this.browserVersion.set(this.getBrowserVersion()),this.osVersion.set(this.getOSVersion()),console.log("*********** KIP Version Information ***********"),console.log(`** App Version: ${this.appVersion()}`),console.log(`** Browser Version: ${this.browserVersion()}`),console.log(`** OS Version: ${this.osVersion()}`),console.log("***********************************************");}readThemeCssRoleVariables(){let t=document.body,e=getComputedStyle(t),n={background:e.getPropertyValue("--mat-sys-background").trim(),cardColor:e.getPropertyValue("--kip-widget-card-background-color").trim(),blue:e.getPropertyValue("--kip-blue-color").trim(),blueDim:e.getPropertyValue("--kip-blue-dim-color").trim(),blueDimmer:e.getPropertyValue("--kip-blue-dimmer-color").trim(),green:e.getPropertyValue("--kip-green-color").trim(),greenDim:e.getPropertyValue("--kip-green-dim-color").trim(),greenDimmer:e.getPropertyValue("--kip-green-dimmer-color").trim(),grey:e.getPropertyValue("--kip-grey-color").trim(),greyDim:e.getPropertyValue("--kip-grey-dim-color").trim(),greyDimmer:e.getPropertyValue("--kip-grey-dimmer-color").trim(),orange:e.getPropertyValue("--kip-orange-color").trim(),orangeDim:e.getPropertyValue("--kip-orange-dim-color").trim(),orangeDimmer:e.getPropertyValue("--kip-orange-dimmer-color").trim(),pink:e.getPropertyValue("--kip-pink-color").trim(),pinkDim:e.getPropertyValue("--kip-pink-dim-color").trim(),pinkDimmer:e.getPropertyValue("--kip-pink-dimmer-color").trim(),purple:e.getPropertyValue("--kip-purple-color").trim(),purpleDim:e.getPropertyValue("--kip-purple-dim-color").trim(),purpleDimmer:e.getPropertyValue("--kip-purple-dimmer-color").trim(),contrast:e.getPropertyValue("--kip-contrast-color").trim(),contrastDim:e.getPropertyValue("--kip-contrast-dim-color").trim(),contrastDimmer:e.getPropertyValue("--kip-contrast-dimmer-color").trim(),yellow:e.getPropertyValue("--kip-yellow-color").trim(),yellowDim:e.getPropertyValue("--kip-yellow-dim-color").trim(),yellowDimmer:e.getPropertyValue("--kip-yellow-dimmer-color").trim(),port:e.getPropertyValue("--kip-port-color").trim(),starboard:e.getPropertyValue("--kip-starboard-color").trim(),zoneNominal:e.getPropertyValue("--kip-zone-nominal-color").trim(),zoneAlert:e.getPropertyValue("--kip-zone-alert-color").trim(),zoneWarn:e.getPropertyValue("--kip-zone-warn-color").trim(),zoneAlarm:e.getPropertyValue("--kip-zone-alarm-color").trim(),zoneEmergency:e.getPropertyValue("--kip-zone-emergency-color").trim()};this.cssThemeColorRoles$.next(n);}get cssThemeColors(){return this._cssThemeColorRoles}setBrightness(t,e=false){let n=document.body;n.style.setProperty("--kip-nightModeBrightness",`${t}`);let y=e?" sepia(0.5) hue-rotate(-30deg)":"";n.style.setProperty("--kip-nightModeFilters",y);}toggleDayNightMode(){this.isNightMode()?this._redNightMode()?(document.body.classList.toggle("night-theme",true),this.setBrightness(1,false)):(this.setBrightness(this._settings.getNightModeBrightness(),true),document.body.classList.remove("night-theme"),this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme")):(document.body.classList.remove("night-theme"),this._theme()==="light-theme"&&document.body.classList.toggle("light-theme",this._theme()==="light-theme"),this.setBrightness(1,false)),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue();}getBrowserVersion(){let t=navigator.userAgent,e="Unknown";return t.includes("Edg")?e=`Edge ${t.match(/Edg\/(\d+)/)?.[1]}`:t.includes("Chrome")&&!t.includes("Edg")&&!t.includes("Chromium")?e=`Chrome ${t.match(/Chrome\/(\d+)/)?.[1]}`:t.includes("Chromium")?e=`Chromium ${t.match(/Chromium\/(\d+)/)?.[1]}`:t.includes("Firefox")?e=`Firefox ${t.match(/Firefox\/(\d+)/)?.[1]}`:t.includes("Safari")&&!t.includes("Chrome")&&!t.includes("Chromium")?e=`Safari ${t.match(/Version\/(\d+)/)?.[1]}`:(t.includes("Opera")||t.includes("OPR"))&&(e=`Opera ${t.match(/(Opera|OPR)\/(\d+)/)?.[2]}`),e}getOSVersion(){let t=navigator.platform,e=navigator.userAgent;return t.startsWith("Mac")?"macOS":t.startsWith("Win")?"Windows":/Linux/.test(t)?e.includes("ARM")||e.includes("aarch64")||e.includes("Raspberry")||t.includes("armv7l")||t.includes("armv8l")?"Raspberry Pi":"Linux":"Unknown OS"}static \u0275fac=function(e){return new(e||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var E$1=(()=>{class a{http=w$4(yr$5);connection=w$4(T$2);destroyRef=w$4(xe$3);historyServiceUrl=null;constructor(){this.connection.serverServiceEndpoint$.pipe(Gp(this.destroyRef)).subscribe(t=>{let e=t?.httpServiceUrl||null;this.historyServiceUrl=e?e.replace("/v1/","/v2/"):null,this.historyServiceUrl||console.warn("[HistoryApiClientService] History API endpoint not available; history service is disabled");});}getPaths(t){return Zr$4(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let e=`${this.historyServiceUrl}history/paths`,i=new de$8;t?.from&&(i=i.set("from",t.from)),t?.to&&(i=i.set("to",t.to)),t?.duration&&(i=i.set("duration",t.duration.toString()));let s=`${e}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${s}`);let r=yield _m(this.http.get(e,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available paths`),r}catch(e){return console.error("[HistoryApiClientService] History API /paths request failed:",e),null}})}getContexts(t){return Zr$4(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let e=`${this.historyServiceUrl}history/contexts`,i=new de$8;t?.from&&(i=i.set("from",t.from)),t?.to&&(i=i.set("to",t.to)),t?.duration&&(i=i.set("duration",t.duration.toString()));let s=`${e}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${s}`);let r=yield _m(this.http.get(e,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available contexts`),r}catch(e){return console.error("[HistoryApiClientService] History API /contexts request failed:",e),null}})}getValues(t){return Zr$4(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let e=`${this.historyServiceUrl}history/values`,i=new de$8;i=i.set("paths",t.paths),t.context&&(i=i.set("context",t.context)),t.from&&(i=i.set("from",t.from)),t.to&&(i=i.set("to",t.to)),t.duration&&(i=i.set("duration",t.duration.toString())),t.resolution!==void 0&&t.resolution!==null&&(i=i.set("resolution",t.resolution.toString()));let s=`${e}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${s}`);let r=yield _m(this.http.get(e,{params:i}));return console.log(`[HistoryApiClientService] History fetch successful, received ${r.data?.length??0} data points`),r}catch(e){return console.error("[HistoryApiClientService] History API request failed:",e),null}})}getProviders(){return Zr$4(this,null,function*(){let t=`${this.historyServiceUrl}history/_providers`;return yield _m(this.http.get(t)),["kip"]})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=Q$6({token:a,factory:a.\u0275fac,providedIn:"root"})}return a})();var G$4=(()=>{class a{mapValuesToChartDatapoints(t,e){let i=t?.data;if(!i||i.length===0)return [];let s=-1,r=-1;if(t.values&&Array.isArray(t.values)){for(let n=0;n<t.values.length;n++){let c=t.values[n]?.method,l=typeof c=="string"?c.toLowerCase():c;if(!l)continue;let o=n+1;l==="sma"?s=o:(l==="avg"||l==="average")&&(r=o);}r<0&&t.values.length===1&&(r=1);}else i[0]?.length>1&&(r=1);let h=e.unit==="rad",f=h?e.domain==="signed"?this.normalizeToSigned.bind(this):this.normalizeToDirection.bind(this):null,m=[],T=0,I=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,x=0,b=0,H=0,d=[];for(let n of i){if(!Array.isArray(n)||n.length===0)continue;let c=Date.parse(n[0]),l=s>=0?n[s]:null,o=r>=0?n[r]:null;if(h?(l=Number.isFinite(l)?f(l):null,o=Number.isFinite(o)?f(o):null):(l=Number.isFinite(l)?l:null,o=Number.isFinite(o)?o:null),Number.isFinite(o)){let u=o;h?(d.push(u),b+=Math.sin(u),H+=Math.cos(u)):(x++,T+=u,u<I&&(I=u),u>A&&(A=u));}m.push({timestamp:c,data:{value:o,sma:l,ema:null,doubleEma:null,lastAverage:null,lastMinimum:null,lastMaximum:null}});}if(m.length>0){let n=null,c=null,l=null;if(h&&d.length>0){n=Math.atan2(b/d.length,H/d.length);let{min:o,max:u}=this.circularMinMaxRad(d);e.domain==="signed"?(n=this.normalizeToSigned(n),c=this.normalizeToSigned(o),l=this.normalizeToSigned(u)):(n=this.normalizeToDirection(n),c=this.normalizeToDirection(o),l=this.normalizeToDirection(u));}else !h&&x>0&&(n=T/x,c=I,l=A);if(n!==null&&c!==null&&l!==null){let o=m[m.length-1];o.data.lastAverage=n,o.data.lastMinimum=c,o.data.lastMaximum=l;}}return m}circularMinMaxRad(t){if(t.length===0)return {min:0,max:0};let e=t.map(r=>(r*180/Math.PI+360)%360).sort((r,h)=>r-h),i=0,s=0;for(let r=0;r<e.length;r++){let h=(r+1)%e.length,f=(e[h]-e[r]+360)%360;f>i&&(i=f,s=h);}return {min:e[s]*Math.PI/180,max:e[(s-1+e.length)%e.length]*Math.PI/180}}mod(t,e){return (t%e+e)%e}normalizeToDirection(t){let e=2*Math.PI;return this.mod(t,e)}normalizeToSigned(t){let e=2*Math.PI;return this.mod(t+Math.PI,e)-Math.PI}static \u0275fac=function(e){return new(e||a)};static \u0275prov=Q$6({token:a,factory:a.\u0275fac,providedIn:"root"})}return a})();var K$3=(()=>{class g{appSettings=w$4(Gi$3);data=w$4(De$2);history=w$4(E$1);historyChartAdapter=w$4(G$4);historyMinSampleTimeMs=1e3;_svcDatasetConfigs=[];_svcDataSource=[];_svcSubjectObserverRegistry=[];_startAllPromise;signedAnglePaths=new Set(["self.navigation.attitude.roll","self.navigation.attitude.pitch","self.navigation.attitude.yaw","self.environment.wind.angleApparent","self.environment.wind.angleTrueGround","self.environment.wind.angleTrueWater","self.steering.rudderAngle","self.environment.wind.directionTrue.trend.shift"]);constructor(){this._svcDatasetConfigs=this.appSettings.getDataSets(),this.cleanupDatasets(),this._startAllPromise=this.startAll();}cleanupDatasets(){if(this.appSettings.configUpgrade()||this.appSettings.getAppConfig().configVersion<12)return;let e=this.appSettings.getDashboardConfig(),s=new Set;e.forEach(i=>{i.configuration?.length&&i.configuration?.forEach(o=>{o?.id&&s.add(o.id);});});function a(i){let o=i.match(/^(windtrends|speedtrends)-(.+)$/);return o?o[2]:null}let r=[],h=[];for(let i of this._svcDatasetConfigs){let o=i.label||"",n=false;if(o.startsWith("windtrends-")||o.startsWith("speedtrends-")){let c=a(o);n=!!(c&&s.has(c));}else (o.startsWith("simple-chart-")||(o.match(/\|/g)||[]).length===4)&&(n=s.has(i.uuid));n?h.push(i):r.push(i);}r.length&&(r.forEach(i=>{console.warn(`[DatasetStreamService] Cleaned dataset: uuid=${i.uuid}, label="${i.label}"`);}),this._svcDatasetConfigs=h,this.appSettings.saveDataSets(this._svcDatasetConfigs));}setupServiceSubjectRegistry(t,e){let s=this._svcSubjectObserverRegistry.findIndex(a=>a.datasetUuid==t);s>=0&&(this._svcSubjectObserverRegistry[s].rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(s,1)),this._svcSubjectObserverRegistry.push({datasetUuid:t,rxjsSubject:new $n$4(e)});}createDataSourceConfiguration(t){let r=c(t.timeScaleFormat,t.period),h=r>0?Math.max(100,Math.round(r/120)):1e3,i=Math.max(1,Math.ceil(r/h)),o=Math.max(1,Math.floor(i*.25)),n={uuid:t.uuid,pathObserverSubscription:null,sampleTime:h,maxDataPoints:i,smoothingPeriod:o,historicalData:[]};return (!n.maxDataPoints||n.maxDataPoints<1)&&(n.maxDataPoints=1),(!n.sampleTime||n.sampleTime<1)&&(n.sampleTime=1),n;function c(u,l){switch(u){case "Last Minute":return 6e4;case "Last 5 Minutes":return 5*6e4;case "Last 30 Minutes":return 30*6e4;case "day":return Math.max(0,l)*24*60*6e4;case "hour":return Math.max(0,l)*60*6e4;case "minute":return Math.max(0,l)*6e4;case "second":return Math.max(0,l)*1e3;default:return 0}}}waitUntilReady(){return Zr$4(this,null,function*(){return this._startAllPromise})}startAll(){return Zr$4(this,null,function*(){console.log("[DatasetStreamService] Auto Starting "+this._svcDatasetConfigs.length.toString()+" Datasets");for(let t of this._svcDatasetConfigs)yield this.start(t.uuid);})}start(t){return Zr$4(this,null,function*(){let e=this._svcDatasetConfigs.find(c=>c.uuid==t);if(!e){console.warn(`[DatasetStreamService] Dataset UUID:${t} not found`);return}let s=this.createDataSourceConfiguration(e);this.setupServiceSubjectRegistry(s.uuid,s.maxDataPoints);let a=this._svcDataSource[this._svcDataSource.push(s)-1];console.log(`[DatasetStreamService] Starting recording process: ${e.path}, Scale: ${e.timeScaleFormat}, Period: ${e.period}, Datapoints: ${s.maxDataPoints}`);let r=this.resolveAngleDomain(e.path,e.baseUnit),h=Math.max(1,Math.round(s.sampleTime/1e3));this.shouldSeedHistory(s.sampleTime)&&(yield this.seedHistoryData(a,e,h,r));let i=this.data.subscribePath(e.path,e.pathSource).pipe(fn$7(c=>c?.data?.value!==null),Du({bufferSize:1,refCount:true})),o=i.pipe(_t$9(1)),n=We$9(s.sampleTime,s.sampleTime).pipe(iy(i,(c,u)=>u));a.pathObserverSubscription=zm(o,n).subscribe(c=>{a.maxDataPoints>0&&a.historicalData.length>=a.maxDataPoints&&a.historicalData.shift(),a.historicalData.push(c.data.value);let u=this.updateDataset(a,e.baseUnit,r);this._svcSubjectObserverRegistry.find(m=>m.datasetUuid===a.uuid)?.rxjsSubject.next(u);});})}seedHistoryData(t,e,s,a){return Zr$4(this,null,function*(){try{let r=this.buildHistoryPathString(e.path,t.smoothingPeriod),h=(()=>{switch(e.timeScaleFormat){case "Last Minute":return 6e4;case "Last 5 Minutes":return 5*6e4;case "Last 30 Minutes":return 30*6e4;case "day":return Math.max(0,e.period)*24*60*6e4;case "hour":return Math.max(0,e.period)*60*6e4;case "minute":return Math.max(0,e.period)*6e4;case "second":return Math.max(0,e.period)*1e3;default:return 0}})(),i=new Date,o={paths:r,from:new Date(i.getTime()-h).toISOString(),resolution:s},n=yield this.history.getValues(o);if(!n||!n.data||n.data.length===0){console.log(`[DatasetStreamService] No history data available for ${e.path}`);return}let c=this.convertHistoryToDatapoints(n,e.baseUnit,a),u=this._svcSubjectObserverRegistry.find(l=>l.datasetUuid===t.uuid)?.rxjsSubject;if(u&&c.length>0){let l=[];t.historicalData=[],c.forEach(m=>{let d=m.data.value;if(!Number.isFinite(d))return;t.maxDataPoints>0&&t.historicalData.length>=t.maxDataPoints&&t.historicalData.shift(),t.historicalData.push(d);let D=this.updateDataset(t,e.baseUnit,a);D.timestamp=m.timestamp,l.push(D);}),l.forEach(m=>u.next(m)),console.log(`[DatasetStreamService] Seeded ${l.length} history datapoints for ${e.path}`);}}catch(r){console.warn(`[DatasetStreamService] Failed to seed history data for ${e.path}:`,r);}})}stop(t){let e=this._svcDataSource.findIndex(s=>s.uuid==t);e!==-1&&(console.log(`[DatasetStreamService] Stopping Dataset ${t} data capture`),this._svcDataSource[e].pathObserverSubscription?.unsubscribe(),this._svcDataSource.splice(e,1));}list(){return dp(this._svcDatasetConfigs)}getDatasetConfig(t){return this._svcDatasetConfigs.find(e=>e.uuid===t)}getDataSourceInfo(t){return this._svcDataSource.find(e=>e.uuid===t)}create(t,e,s,a,r,h=true,i=true,o){if(!t||!e||!s||!a||!r)return null;let n=o||b.create(),c={uuid:n,path:t,pathSource:e,baseUnit:this.data.getPathUnitType(t)??"",timeScaleFormat:s,period:a,label:r,editable:i};return console.log(`[DatasetStreamService] Creating ${h?"":"non-"}persistent ${i?"":"hidden "}dataset: ${c.uuid}, Path: ${c.path}, Source: ${c.pathSource} Scale: ${c.timeScaleFormat}, Period: ${c.period}`),this._svcDatasetConfigs.push(c),this.start(n),h===true&&this.appSettings.saveDataSets(this._svcDatasetConfigs),n}edit(t,e=true){let s=this._svcDatasetConfigs.find(a=>a.uuid===t.uuid);return s?JSON.stringify(s)===JSON.stringify(t)?(console.log(`[DatasetStreamService] No changes detected for Dataset ${t.uuid}.`),false):(this.stop(t.uuid),console.log(`[DatasetStreamService] Updating Dataset: ${t.uuid}`),t.baseUnit=this.data.getPathUnitType(t.path)??"",this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(a=>a.uuid===t.uuid),1,t),this.start(t.uuid),e===true&&this.appSettings.saveDataSets(this._svcDatasetConfigs),true):false}remove(t,e=true){return !t||t===""||this._svcDatasetConfigs.findIndex(a=>a.uuid===t)===-1?false:(this.stop(t),console.log(`[DatasetStreamService] Removing ${e?"":"non-"}persistent Dataset: ${t}`),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(a=>a.uuid===t),1),this._svcSubjectObserverRegistry.find(a=>a.datasetUuid===t)?.rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(this._svcSubjectObserverRegistry.findIndex(a=>a.datasetUuid===t),1),e===true&&this.appSettings.saveDataSets(this._svcDatasetConfigs),true)}getDatasetObservable(t){let e=this._svcSubjectObserverRegistry.find(s=>s.datasetUuid==t);return e?e.rxjsSubject.asObservable():null}getDatasetBatchThenLiveObservable(t){let e=this._svcSubjectObserverRegistry.find(i=>i.datasetUuid==t);if(!e)return null;let s=e.rxjsSubject,a=s._buffer?s._buffer.slice():[],r=Pe$4([a]),h=s.pipe(wu(a.length));return dn$7(r,h)}updateDataset(t,e,s="scalar"){let a,r,h,i;if(e==="rad"){a=this.circularMeanRad(t.historicalData);let u=t.historicalData.slice(-t.smoothingPeriod);r=this.circularMeanRad(u);let{min:l,max:m}=this.circularMinMaxRad(t.historicalData);s==="direction"?(a=this.normalizeToDirection(a),r=this.normalizeToDirection(r),h=this.normalizeToDirection(l),i=this.normalizeToDirection(m)):s==="signed"?(a=this.normalizeToSigned(a),r=this.normalizeToSigned(r),h=this.normalizeToSigned(l),i=this.normalizeToSigned(m)):(h=l,i=m);}else a=n(t.historicalData),r=c(t.historicalData,t.smoothingPeriod),h=Math.min(...t.historicalData),i=Math.max(...t.historicalData);return {timestamp:Date.now(),data:{value:e==="rad"?s==="signed"?this.normalizeToSigned(t.historicalData[t.historicalData.length-1]):this.normalizeToDirection(t.historicalData[t.historicalData.length-1]):t.historicalData[t.historicalData.length-1],sma:r,lastAverage:a,lastMinimum:h,lastMaximum:i}};function n(u){return u.length===0?void 0:u.reduce((m,d)=>m+d,0)/u.length}function c(u,l){u.length<l&&(l=u.length);let m=0;for(let d=u.length-l;d<u.length;d++)m+=u[d];return m/l}}circularMeanRad(t){if(t.length===0)return 0;let e=t.reduce((a,r)=>a+Math.sin(r),0),s=t.reduce((a,r)=>a+Math.cos(r),0);return Math.atan2(e/t.length,s/t.length)}circularMinMaxRad(t){if(t.length===0)return {min:0,max:0};let e=t.map(i=>(i*180/Math.PI+360)%360).sort((i,o)=>i-o),s=0,a=0;for(let i=0;i<e.length;i++){let o=(i+1)%e.length,n=(e[o]-e[i]+360)%360;n>s&&(s=n,a=o);}let r=e[a]*Math.PI/180,h=e[(a-1+e.length)%e.length]*Math.PI/180;return {min:r,max:h}}resolveAngleDomain(t,e){if(e!=="rad")return "scalar";let s=this.normalizePathKey(t);for(let a of this.signedAnglePaths)if(s===this.normalizePathKey(a))return "signed";return "direction"}normalizePathKey(t){return t.replace(/^vessels\.self\./,"").replace(/^self\./,"")}mod(t,e){return (t%e+e)%e}normalizeToDirection(t){let e=2*Math.PI;return this.mod(t,e)}normalizeToSigned(t){let e=2*Math.PI;return this.mod(t+Math.PI,e)-Math.PI}removeIfExists(t,e=true){return !t||this._svcDatasetConfigs.findIndex(s=>s.uuid===t)===-1?false:this.remove(t,e)}shouldSeedHistory(t){return t>=this.historyMinSampleTimeMs}buildHistoryPathString(t,e){let s=t.replace(/^(vessels\.)?self\./,"");return [`${s}:sma:${e}`,`${s}:avg`,`${s}:min`,`${s}:max`].join(",")}convertHistoryToDatapoints(t,e,s){return this.historyChartAdapter.mapValuesToChartDatapoints(t,{unit:e,domain:s})}ngOnDestroy(){[...this._svcDataSource].forEach(t=>{try{this.stop(t.uuid);}catch(e){}}),this._svcSubjectObserverRegistry.forEach(t=>t.rxjsSubject.complete()),this._svcSubjectObserverRegistry=[];}static \u0275fac=function(e){return new(e||g)};static \u0275prov=Q$6({token:g,factory:g.\u0275fac,providedIn:"root"})}return g})();var f$1="primary",Ve$3=Symbol("RouteTitle"),tr$2=class tr{params;constructor(n){this.params=n||{};}has(n){return Object.prototype.hasOwnProperty.call(this.params,n)}get(n){if(this.has(n)){let e=this.params[n];return Array.isArray(e)?e[0]:e}return null}getAll(n){if(this.has(n)){let e=this.params[n];return Array.isArray(e)?e:[e]}return []}get keys(){return Object.keys(this.params)}};function ue$2(t){return new tr$2(t)}function Zt$3(t,n,e){for(let r=0;r<t.length;r++){let i=t[r],o=n[r];if(i[0]===":")e[i.substring(1)]=o;else if(i!==o.path)return false}return true}function Sn$3(t,n,e){let r=e.path.split("/"),i=r.indexOf("**");if(i===-1){if(r.length>t.length||e.pathMatch==="full"&&(n.hasChildren()||r.length<t.length))return null;let s={},u=t.slice(0,r.length);return Zt$3(r,u,s)?{consumed:u,posParams:s}:null}if(i!==r.lastIndexOf("**"))return null;let o=r.slice(0,i),a=r.slice(i+1);if(o.length+a.length>t.length||e.pathMatch==="full"&&n.hasChildren()&&e.path!=="**")return null;let c={};return !Zt$3(o,t.slice(0,o.length),c)||!Zt$3(a,t.slice(t.length-a.length),c)?null:{consumed:t,posParams:c}}function ht$2(t){return new Promise((n,e)=>{t.pipe(Jm()).subscribe({next:r=>n(r),error:r=>e(r)});})}function Ci$4(t,n){if(t.length!==n.length)return false;for(let e=0;e<t.length;++e)if(!q$1(t[e],n[e]))return false;return true}function q$1(t,n){let e=t?rr$3(t):void 0,r=n?rr$3(n):void 0;if(!e||!r||e.length!=r.length)return false;let i;for(let o=0;o<e.length;o++)if(i=e[o],!Cn$3(t[i],n[i]))return false;return true}function rr$3(t){return [...Object.keys(t),...Object.getOwnPropertySymbols(t)]}function Cn$3(t,n){if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return false;let e=[...t].sort(),r=[...n].sort();return e.every((i,o)=>r[o]===i)}else return t===n}function wi$2(t){return t.length>0?t[t.length-1]:null}function he$3(t){return Cm(t)?t:il$2(t)?Pe$4(Promise.resolve(t)):Tm(t)}function wn$3(t){return Cm(t)?ht$2(t):Promise.resolve(t)}var bi$4={exact:An$2,subset:En$2},bn$3={exact:Ii$2,subset:Ai$2,ignored:()=>true},In$3={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},nr$3={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"};function dn$3(t,n,e){return bi$4[e.paths](t.root,n.root,e.matrixParams)&&bn$3[e.queryParams](t.queryParams,n.queryParams)&&!(e.fragment==="exact"&&t.fragment!==n.fragment)}function Ii$2(t,n){return q$1(t,n)}function An$2(t,n,e){if(!ce$2(t.segments,n.segments)||!ct$2(t.segments,n.segments,e)||t.numberOfChildren!==n.numberOfChildren)return false;for(let r in n.children)if(!t.children[r]||!An$2(t.children[r],n.children[r],e))return false;return true}function Ai$2(t,n){return Object.keys(n).length<=Object.keys(t).length&&Object.keys(n).every(e=>Cn$3(t[e],n[e]))}function En$2(t,n,e){return Tn$2(t,n,n.segments,e)}function Tn$2(t,n,e,r){if(t.segments.length>e.length){let i=t.segments.slice(0,e.length);return !(!ce$2(i,e)||n.hasChildren()||!ct$2(i,e,r))}else if(t.segments.length===e.length){if(!ce$2(t.segments,e)||!ct$2(t.segments,e,r))return false;for(let i in n.children)if(!t.children[i]||!En$2(t.children[i],n.children[i],r))return false;return true}else {let i=e.slice(0,t.segments.length),o=e.slice(t.segments.length);return !ce$2(t.segments,i)||!ct$2(t.segments,i,r)||!t.children[f$1]?false:Tn$2(t.children[f$1],n,o,r)}}function ct$2(t,n,e){return n.every((r,i)=>bn$3[e](t[i].parameters,r.parameters))}var U$1=class U{root;queryParams;fragment;_queryParamMap;constructor(n=new m$1([],{}),e={},r=null){this.root=n,this.queryParams=e,this.fragment=r;}get queryParamMap(){return this._queryParamMap??=ue$2(this.queryParams),this._queryParamMap}toString(){return Ni$2.serialize(this)}},m$1=class m{segments;children;parent=null;constructor(n,e){this.segments=n,this.children=e,Object.values(e).forEach(r=>r.parent=this);}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return ut$3(this)}},X$1=class X{path;parameters;_parameterMap;constructor(n,e){this.path=n,this.parameters=e;}get parameterMap(){return this._parameterMap??=ue$2(this.parameters),this._parameterMap}toString(){return Mn$3(this)}};function Ei$3(t,n){return ce$2(t,n)&&t.every((e,r)=>q$1(e.parameters,n[r].parameters))}function ce$2(t,n){return t.length!==n.length?false:t.every((e,r)=>e.path===n[r].path)}function Ti$3(t,n){let e=[];return Object.entries(t.children).forEach(([r,i])=>{r===f$1&&(e=e.concat(n(i,r)));}),Object.entries(t.children).forEach(([r,i])=>{r!==f$1&&(e=e.concat(n(i,r)));}),e}var re$1=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>new K$2})}return t})(),K$2=class K{parse(n){let e=new or$3(n);return new U$1(e.parseRootSegment(),e.parseQueryParams(),e.parseFragment())}serialize(n){let e=`/${Pe(n.root,true)}`,r=_i$2(n.queryParams),i=typeof n.fragment=="string"?`#${Mi$2(n.fragment)}`:"";return `${e}${r}${i}`}},Ni$2=new K$2;function ut$3(t){return t.segments.map(n=>Mn$3(n)).join("/")}function Pe(t,n){if(!t.hasChildren())return ut$3(t);if(n){let e=t.children[f$1]?Pe(t.children[f$1],false):"",r=[];return Object.entries(t.children).forEach(([i,o])=>{i!==f$1&&r.push(`${i}:${Pe(o,false)}`);}),r.length>0?`${e}(${r.join("//")})`:e}else {let e=Ti$3(t,(r,i)=>i===f$1?[Pe(t.children[f$1],false)]:[`${i}:${Pe(r,false)}`]);return Object.keys(t.children).length===1&&t.children[f$1]!=null?`${ut$3(t)}/${e[0]}`:`${ut$3(t)}/(${e.join("//")})`}}function Nn$1(t){return encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function at$2(t){return Nn$1(t).replace(/%3B/gi,";")}function Mi$2(t){return encodeURI(t)}function ir$2(t){return Nn$1(t).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function lt$4(t){return decodeURIComponent(t)}function fn$3(t){return lt$4(t.replace(/\+/g,"%20"))}function Mn$3(t){return `${ir$2(t.path)}${Di$3(t.parameters)}`}function Di$3(t){return Object.entries(t).map(([n,e])=>`;${ir$2(n)}=${ir$2(e)}`).join("")}function _i$2(t){let n=Object.entries(t).map(([e,r])=>Array.isArray(r)?r.map(i=>`${at$2(e)}=${at$2(i)}`).join("&"):`${at$2(e)}=${at$2(r)}`).filter(e=>e);return n.length?`?${n.join("&")}`:""}var Ui$2=/^[^\/()?;#]+/;function Jt$4(t){let n=t.match(Ui$2);return n?n[0]:""}var Oi$2=/^[^\/()?;=#]+/;function Pi$2(t){let n=t.match(Oi$2);return n?n[0]:""}var Li$2=/^[^=?&#]+/;function xi$3(t){let n=t.match(Li$2);return n?n[0]:""}var ji$2=/^[^&#]+/;function ki$3(t){let n=t.match(ji$2);return n?n[0]:""}var or$3=class or{url;remaining;constructor(n){this.url=n,this.remaining=n;}parseRootSegment(){for(;this.consumeOptional("/"););return this.remaining===""||this.peekStartsWith("?")||this.peekStartsWith("#")?new m$1([],{}):new m$1([],this.parseChildren())}parseQueryParams(){let n={};if(this.consumeOptional("?"))do this.parseQueryParam(n);while(this.consumeOptional("&"));return n}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(n=0){if(n>50)throw new b$2(4010,false);if(this.remaining==="")return {};this.consumeOptional("/");let e=[];for(this.peekStartsWith("(")||e.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),e.push(this.parseSegment());let r={};this.peekStartsWith("/(")&&(this.capture("/"),r=this.parseParens(true,n));let i={};return this.peekStartsWith("(")&&(i=this.parseParens(false,n)),(e.length>0||Object.keys(r).length>0)&&(i[f$1]=new m$1(e,r)),i}parseSegment(){let n=Jt$4(this.remaining);if(n===""&&this.peekStartsWith(";"))throw new b$2(4009,false);return this.capture(n),new X$1(lt$4(n),this.parseMatrixParams())}parseMatrixParams(){let n={};for(;this.consumeOptional(";");)this.parseParam(n);return n}parseParam(n){let e=Pi$2(this.remaining);if(!e)return;this.capture(e);let r="";if(this.consumeOptional("=")){let i=Jt$4(this.remaining);i&&(r=i,this.capture(r));}n[lt$4(e)]=lt$4(r);}parseQueryParam(n){let e=xi$3(this.remaining);if(!e)return;this.capture(e);let r="";if(this.consumeOptional("=")){let a=ki$3(this.remaining);a&&(r=a,this.capture(r));}let i=fn$3(e),o=fn$3(r);if(n.hasOwnProperty(i)){let a=n[i];Array.isArray(a)||(a=[a],n[i]=a),a.push(o);}else n[i]=o;}parseParens(n,e){let r={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){let i=Jt$4(this.remaining),o=this.remaining[i.length];if(o!=="/"&&o!==")"&&o!==";")throw new b$2(4010,false);let a;i.indexOf(":")>-1?(a=i.slice(0,i.indexOf(":")),this.capture(a),this.capture(":")):n&&(a=f$1);let c=this.parseChildren(e+1);r[a??f$1]=Object.keys(c).length===1&&c[f$1]?c[f$1]:new m$1([],c),this.consumeOptional("//");}return r}peekStartsWith(n){return this.remaining.startsWith(n)}consumeOptional(n){return this.peekStartsWith(n)?(this.remaining=this.remaining.substring(n.length),true):false}capture(n){if(!this.consumeOptional(n))throw new b$2(4011,false)}};function Dn$2(t){return t.segments.length>0?new m$1([],{[f$1]:t}):t}function _n$3(t){let n={};for(let[r,i]of Object.entries(t.children)){let o=_n$3(i);if(r===f$1&&o.segments.length===0&&o.hasChildren())for(let[a,c]of Object.entries(o.children))n[a]=c;else (o.segments.length>0||o.hasChildren())&&(n[r]=o);}let e=new m$1(t.segments,n);return $i$2(e)}function $i$2(t){if(t.numberOfChildren===1&&t.children[f$1]){let n=t.children[f$1];return new m$1(t.segments.concat(n.segments),n.children)}return t}function ee$3(t){return t instanceof U$1}function Un$2(t,n,e=null,r=null,i=new K$2){let o=On$2(t);return Pn$3(o,n,e,r,i)}function On$2(t){let n;function e(o){let a={};for(let s of o.children){let u=e(s);a[s.outlet]=u;}let c=new m$1(o.url,a);return o===t&&(n=c),c}let r=e(t.root),i=Dn$2(r);return n??i}function Pn$3(t,n,e,r,i){let o=t;for(;o.parent;)o=o.parent;if(n.length===0)return Xt$1(o,o,o,e,r,i);let a=zi$2(n);if(a.toRoot())return Xt$1(o,o,new m$1([],{}),e,r,i);let c=Hi$2(a,o,t),s=c.processChildren?xe$1(c.segmentGroup,c.index,a.commands):xn$3(c.segmentGroup,c.index,a.commands);return Xt$1(o,c.segmentGroup,s,e,r,i)}function dt$2(t){return typeof t=="object"&&t!=null&&!t.outlets&&!t.segmentPath}function ke$1(t){return typeof t=="object"&&t!=null&&t.outlets}function pn$3(t,n,e){t||="\u0275";let r=new U$1;return r.queryParams={[t]:n},e.parse(e.serialize(r)).queryParams[t]}function Xt$1(t,n,e,r,i,o){let a={};for(let[u,h]of Object.entries(r??{}))a[u]=Array.isArray(h)?h.map(v=>pn$3(u,v,o)):pn$3(u,h,o);let c;t===n?c=e:c=Ln$1(t,n,e);let s=Dn$2(_n$3(c));return new U$1(s,a,i)}function Ln$1(t,n,e){let r={};return Object.entries(t.children).forEach(([i,o])=>{o===n?r[i]=e:r[i]=Ln$1(o,n,e);}),new m$1(t.segments,r)}var ft$2=class ft{isAbsolute;numberOfDoubleDots;commands;constructor(n,e,r){if(this.isAbsolute=n,this.numberOfDoubleDots=e,this.commands=r,n&&r.length>0&&dt$2(r[0]))throw new b$2(4003,false);let i=r.find(ke$1);if(i&&i!==wi$2(r))throw new b$2(4004,false)}toRoot(){return this.isAbsolute&&this.commands.length===1&&this.commands[0]=="/"}};function zi$2(t){if(typeof t[0]=="string"&&t.length===1&&t[0]==="/")return new ft$2(true,0,t);let n=0,e=false,r=t.reduce((i,o,a)=>{if(typeof o=="object"&&o!=null){if(o.outlets){let c={};return Object.entries(o.outlets).forEach(([s,u])=>{c[s]=typeof u=="string"?u.split("/"):u;}),[...i,{outlets:c}]}if(o.segmentPath)return [...i,o.segmentPath]}return typeof o!="string"?[...i,o]:a===0?(o.split("/").forEach((c,s)=>{s==0&&c==="."||(s==0&&c===""?e=true:c===".."?n++:c!=""&&i.push(c));}),i):[...i,o]},[]);return new ft$2(e,n,r)}var Se=class{segmentGroup;processChildren;index;constructor(n,e,r){this.segmentGroup=n,this.processChildren=e,this.index=r;}};function Hi$2(t,n,e){if(t.isAbsolute)return new Se(n,true,0);if(!e)return new Se(n,false,NaN);if(e.parent===null)return new Se(e,true,0);let r=dt$2(t.commands[0])?0:1,i=e.segments.length-1+r;return Fi$2(e,i,t.numberOfDoubleDots)}function Fi$2(t,n,e){let r=t,i=n,o=e;for(;o>i;){if(o-=i,r=r.parent,!r)throw new b$2(4005,false);i=r.segments.length;}return new Se(r,false,i-o)}function qi$2(t){return ke$1(t[0])?t[0].outlets:{[f$1]:t}}function xn$3(t,n,e){if(t??=new m$1([],{}),t.segments.length===0&&t.hasChildren())return xe$1(t,n,e);let r=Bi$2(t,n,e),i=e.slice(r.commandIndex);if(r.match&&r.pathIndex<t.segments.length){let o=new m$1(t.segments.slice(0,r.pathIndex),{});return o.children[f$1]=new m$1(t.segments.slice(r.pathIndex),t.children),xe$1(o,0,i)}else return r.match&&i.length===0?new m$1(t.segments,{}):r.match&&!t.hasChildren()?ar$3(t,n,e):r.match?xe$1(t,0,i):ar$3(t,n,e)}function xe$1(t,n,e){if(e.length===0)return new m$1(t.segments,{});{let r=qi$2(e),i={};if(Object.keys(r).some(o=>o!==f$1)&&t.children[f$1]&&t.numberOfChildren===1&&t.children[f$1].segments.length===0){let o=xe$1(t.children[f$1],n,e);return new m$1(t.segments,o.children)}return Object.entries(r).forEach(([o,a])=>{typeof a=="string"&&(a=[a]),a!==null&&(i[o]=xn$3(t.children[o],n,a));}),Object.entries(t.children).forEach(([o,a])=>{r[o]===void 0&&(i[o]=a);}),new m$1(t.segments,i)}}function Bi$2(t,n,e){let r=0,i=n,o={match:false,pathIndex:0,commandIndex:0};for(;i<t.segments.length;){if(r>=e.length)return o;let a=t.segments[i],c=e[r];if(ke$1(c))break;let s=`${c}`,u=r<e.length-1?e[r+1]:null;if(i>0&&s===void 0)break;if(s&&u&&typeof u=="object"&&u.outlets===void 0){if(!vn$2(s,u,a))return o;r+=2;}else {if(!vn$2(s,{},a))return o;r++;}i++;}return {match:true,pathIndex:i,commandIndex:r}}function ar$3(t,n,e){let r=t.segments.slice(0,n),i=0;for(;i<e.length;){let o=e[i];if(ke$1(o)){let s=Vi$2(o.outlets);return new m$1(r,s)}if(i===0&&dt$2(e[0])){let s=t.segments[n];r.push(new X$1(s.path,gn$2(e[0]))),i++;continue}let a=ke$1(o)?o.outlets[f$1]:`${o}`,c=i<e.length-1?e[i+1]:null;a&&c&&dt$2(c)?(r.push(new X$1(a,gn$2(c))),i+=2):(r.push(new X$1(a,{})),i++);}return new m$1(r,{})}function Vi$2(t){let n={};return Object.entries(t).forEach(([e,r])=>{typeof r=="string"&&(r=[r]),r!==null&&(n[e]=ar$3(new m$1([],{}),0,r));}),n}function gn$2(t){let n={};return Object.entries(t).forEach(([e,r])=>n[e]=`${r}`),n}function vn$2(t,n,e){return t==e.path&&q$1(n,e.parameters)}var Ce$2="imperative",S$1=(function(t){return t[t.NavigationStart=0]="NavigationStart",t[t.NavigationEnd=1]="NavigationEnd",t[t.NavigationCancel=2]="NavigationCancel",t[t.NavigationError=3]="NavigationError",t[t.RoutesRecognized=4]="RoutesRecognized",t[t.ResolveStart=5]="ResolveStart",t[t.ResolveEnd=6]="ResolveEnd",t[t.GuardsCheckStart=7]="GuardsCheckStart",t[t.GuardsCheckEnd=8]="GuardsCheckEnd",t[t.RouteConfigLoadStart=9]="RouteConfigLoadStart",t[t.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",t[t.ChildActivationStart=11]="ChildActivationStart",t[t.ChildActivationEnd=12]="ChildActivationEnd",t[t.ActivationStart=13]="ActivationStart",t[t.ActivationEnd=14]="ActivationEnd",t[t.Scroll=15]="Scroll",t[t.NavigationSkipped=16]="NavigationSkipped",t})(S$1||{}),O$3=class O{id;url;constructor(n,e){this.id=n,this.url=e;}},te$3=class te extends O$3{type=S$1.NavigationStart;navigationTrigger;restoredState;constructor(n,e,r="imperative",i=null){super(n,e),this.navigationTrigger=r,this.restoredState=i;}toString(){return `NavigationStart(id: ${this.id}, url: '${this.url}')`}},$$2=class $ extends O$3{urlAfterRedirects;type=S$1.NavigationEnd;constructor(n,e,r){super(n,e),this.urlAfterRedirects=r;}toString(){return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}},I$1=(function(t){return t[t.Redirect=0]="Redirect",t[t.SupersededByNewNavigation=1]="SupersededByNewNavigation",t[t.NoDataFromResolver=2]="NoDataFromResolver",t[t.GuardRejected=3]="GuardRejected",t[t.Aborted=4]="Aborted",t})(I$1||{}),be$1=(function(t){return t[t.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",t[t.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",t})(be$1||{}),k$1=class k extends O$3{reason;code;type=S$1.NavigationCancel;constructor(n,e,r,i){super(n,e),this.reason=r,this.code=i;}toString(){return `NavigationCancel(id: ${this.id}, url: '${this.url}')`}};function jn$2(t){return t instanceof k$1&&(t.code===I$1.Redirect||t.code===I$1.SupersededByNewNavigation)}var B$2=class B extends O$3{reason;code;type=S$1.NavigationSkipped;constructor(n,e,r,i){super(n,e),this.reason=r,this.code=i;}},le$1=class le extends O$3{error;target;type=S$1.NavigationError;constructor(n,e,r,i){super(n,e),this.error=r,this.target=i;}toString(){return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}},$e$3=class $e extends O$3{urlAfterRedirects;state;type=S$1.RoutesRecognized;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},pt$2=class pt extends O$3{urlAfterRedirects;state;type=S$1.GuardsCheckStart;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},gt$1=class gt extends O$3{urlAfterRedirects;state;shouldActivate;type=S$1.GuardsCheckEnd;constructor(n,e,r,i,o){super(n,e),this.urlAfterRedirects=r,this.state=i,this.shouldActivate=o;}toString(){return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}},vt$1=class vt extends O$3{urlAfterRedirects;state;type=S$1.ResolveStart;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},mt$3=class mt extends O$3{urlAfterRedirects;state;type=S$1.ResolveEnd;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},yt$2=class yt{route;type=S$1.RouteConfigLoadStart;constructor(n){this.route=n;}toString(){return `RouteConfigLoadStart(path: ${this.route.path})`}},Rt$2=class Rt{route;type=S$1.RouteConfigLoadEnd;constructor(n){this.route=n;}toString(){return `RouteConfigLoadEnd(path: ${this.route.path})`}},St$1=class St{snapshot;type=S$1.ChildActivationStart;constructor(n){this.snapshot=n;}toString(){return `ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ct$2=class Ct{snapshot;type=S$1.ChildActivationEnd;constructor(n){this.snapshot=n;}toString(){return `ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},wt$2=class wt{snapshot;type=S$1.ActivationStart;constructor(n){this.snapshot=n;}toString(){return `ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},bt$1=class bt{snapshot;type=S$1.ActivationEnd;constructor(n){this.snapshot=n;}toString(){return `ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ie$1=class Ie{routerEvent;position;anchor;scrollBehavior;type=S$1.Scroll;constructor(n,e,r,i){this.routerEvent=n,this.position=e,this.anchor=r,this.scrollBehavior=i;}toString(){let n=this.position?`${this.position[0]}, ${this.position[1]}`:null;return `Scroll(anchor: '${this.anchor}', position: '${n}')`}},Ae$1=class Ae{},ze$1=class ze{},Ee$1=class Ee{url;navigationBehaviorOptions;constructor(n,e){this.url=n,this.navigationBehaviorOptions=e;}};function Gi$2(t){return !(t instanceof Ae$1)&&!(t instanceof Ee$1)&&!(t instanceof ze$1)}var It$1=class It{rootInjector;outlet=null;route=null;children;attachRef=null;get injector(){return this.route?.snapshot._environmentInjector??this.rootInjector}constructor(n){this.rootInjector=n,this.children=new de$2(this.rootInjector);}},de$2=(()=>{class t{rootInjector;contexts=new Map;constructor(e){this.rootInjector=e;}onChildOutletCreated(e,r){let i=this.getOrCreateContext(e);i.outlet=r,this.contexts.set(e,i);}onChildOutletDestroyed(e){let r=this.getContext(e);r&&(r.outlet=null,r.attachRef=null);}onOutletDeactivated(){let e=this.contexts;return this.contexts=new Map,e}onOutletReAttached(e){this.contexts=e;}getOrCreateContext(e){let r=this.getContext(e);return r||(r=new It$1(this.rootInjector),this.contexts.set(e,r)),r}getContext(e){return this.contexts.get(e)||null}static \u0275fac=function(r){return new(r||t)(se$8(me$5))};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),At$2=class At{_root;constructor(n){this._root=n;}get root(){return this._root.value}parent(n){let e=this.pathFromRoot(n);return e.length>1?e[e.length-2]:null}children(n){let e=sr$3(n,this._root);return e?e.children.map(r=>r.value):[]}firstChild(n){let e=sr$3(n,this._root);return e&&e.children.length>0?e.children[0].value:null}siblings(n){let e=cr$3(n,this._root);return e.length<2?[]:e[e.length-2].children.map(i=>i.value).filter(i=>i!==n)}pathFromRoot(n){return cr$3(n,this._root).map(e=>e.value)}};function sr$3(t,n){if(t===n.value)return n;for(let e of n.children){let r=sr$3(t,e);if(r)return r}return null}function cr$3(t,n){if(t===n.value)return [n];for(let e of n.children){let r=cr$3(t,e);if(r.length)return r.unshift(n),r}return []}var _$1=class _{value;children;constructor(n,e){this.value=n,this.children=e;}toString(){return `TreeNode(${this.value})`}};function Re$1(t){let n={};return t&&t.children.forEach(e=>n[e.value.outlet]=e),n}var He$3=class He extends At$2{snapshot;constructor(n,e){super(n),this.snapshot=e,mr$3(this,n);}toString(){return this.snapshot.toString()}};function kn$3(t,n){let e=Wi$2(t,n),r=new Bn$5([new X$1("",{})]),i=new Bn$5({}),o=new Bn$5({}),a=new Bn$5({}),c=new Bn$5(""),s=new V(r,i,a,c,o,f$1,t,e.root);return s.snapshot=e.root,new He$3(new _$1(s,[]),e)}function Wi$2(t,n){let e={},r={},i={},a=new Te$1([],e,i,"",r,f$1,t,null,{},n);return new Fe$2("",new _$1(a,[]))}var V=class{urlSubject;paramsSubject;queryParamsSubject;fragmentSubject;dataSubject;outlet;component;snapshot;_futureSnapshot;_routerState;_paramMap;_queryParamMap;title;url;params;queryParams;fragment;data;_localInjector;constructor(n,e,r,i,o,a,c,s){this.urlSubject=n,this.paramsSubject=e,this.queryParamsSubject=r,this.fragmentSubject=i,this.dataSubject=o,this.outlet=a,this.component=c,this._futureSnapshot=s,this.title=this.dataSubject?.pipe(ke$3(u=>u[Ve$3]))??Tm(void 0),this.url=n,this.params=e,this.queryParams=r,this.fragment=i,this.data=o;}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=this.params.pipe(ke$3(n=>ue$2(n))),this._paramMap}get queryParamMap(){return this._queryParamMap??=this.queryParams.pipe(ke$3(n=>ue$2(n))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}},Qi$2="always";function vr$3(t,n,e){let r,{routeConfig:i}=t;return n!==null&&(e==="always"||i?.path===""||!n.component&&!n.routeConfig?.loadComponent)?r={params:G$b(G$b({},n.params),t.params),data:G$b(G$b({},n.data),t.data),resolve:G$b(G$b(G$b(G$b({},t.data),n.data),i?.data),t._resolvedData)}:r={params:G$b({},t.params),data:G$b({},t.data),resolve:G$b(G$b({},t.data),t._resolvedData??{})},i&&zn$2(i)&&(r.resolve[Ve$3]=i.title),r}var Te$1=class Te{url;params;queryParams;fragment;data;outlet;component;routeConfig;_resolve;_resolvedData;_routerState;_paramMap;_queryParamMap;_environmentInjector;get title(){return this.data?.[Ve$3]}constructor(n,e,r,i,o,a,c,s,u,h){this.url=n,this.params=e,this.queryParams=r,this.fragment=i,this.data=o,this.outlet=a,this.component=c,this.routeConfig=s,this._resolve=u,this._environmentInjector=h;}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=ue$2(this.params),this._paramMap}get queryParamMap(){return this._queryParamMap??=ue$2(this.queryParams),this._queryParamMap}toString(){let n=this.url.map(r=>r.toString()).join("/"),e=this.routeConfig?this.routeConfig.path:"";return `Route(url:'${n}', path:'${e}')`}},Fe$2=class Fe extends At$2{url;constructor(n,e){super(e),this.url=n,mr$3(this,e);}toString(){return $n$2(this._root)}};function mr$3(t,n){n.value._routerState=t,n.children.forEach(e=>mr$3(t,e));}function $n$2(t){let n=t.children.length>0?` { ${t.children.map($n$2).join(", ")} } `:"";return `${t.value}${n}`}function er$2(t){if(t.snapshot){let n=t.snapshot,e=t._futureSnapshot;t.snapshot=e,q$1(n.queryParams,e.queryParams)||t.queryParamsSubject.next(e.queryParams),n.fragment!==e.fragment&&t.fragmentSubject.next(e.fragment),q$1(n.params,e.params)||t.paramsSubject.next(e.params),Ci$4(n.url,e.url)||t.urlSubject.next(e.url),q$1(n.data,e.data)||t.dataSubject.next(e.data);}else t.snapshot=t._futureSnapshot,t.dataSubject.next(t._futureSnapshot.data);}function ur$3(t,n){let e=q$1(t.params,n.params)&&Ei$3(t.url,n.url),r=!t.parent!=!n.parent;return e&&!r&&(!t.parent||ur$3(t.parent,n.parent))}function zn$2(t){return typeof t.title=="string"||t.title===null}var Hn$2=new N$7(""),yr$3=(()=>{class t{activated=null;get activatedComponentRef(){return this.activated}_activatedRoute=null;name=f$1;activateEvents=new Qe$a;deactivateEvents=new Qe$a;attachEvents=new Qe$a;detachEvents=new Qe$a;routerOutletData=Hj();parentContexts=w$4(de$2);location=w$4(Ki$5);changeDetector=w$4(Gj);inputBinder=w$4(Ge$2,{optional:true});supportsBindingToComponentInputs=true;ngOnChanges(e){if(e.name){let{firstChange:r,previousValue:i}=e.name;if(r)return;this.isTrackedInParentContexts(i)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(i)),this.initializeOutletWithName();}}ngOnDestroy(){this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),this.inputBinder?.unsubscribeFromRouteData(this);}isTrackedInParentContexts(e){return this.parentContexts.getContext(e)?.outlet===this}ngOnInit(){this.initializeOutletWithName();}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;let e=this.parentContexts.getContext(this.name);e?.route&&(e.attachRef?this.attach(e.attachRef,e.route):this.activateWith(e.route,e.injector));}get isActivated(){return !!this.activated}get component(){if(!this.activated)throw new b$2(4012,false);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new b$2(4012,false);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new b$2(4012,false);this.location.detach();let e=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(e.instance),e}attach(e,r){this.activated=e,this._activatedRoute=r,this.location.insert(e.hostView),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(e.instance);}deactivate(){if(this.activated){let e=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(e);}}activateWith(e,r){if(this.isActivated)throw new b$2(4013,false);this._activatedRoute=e;let i=this.location,a=e.snapshot.component,c=this.parentContexts.getOrCreateContext(this.name).children,s=new lr$3(e,c,i.injector,this.routerOutletData);this.activated=i.createComponent(a,{index:i.length,injector:s,environmentInjector:r}),this.changeDetector.markForCheck(),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance);}static \u0275fac=function(r){return new(r||t)};static \u0275dir=nw({type:t,selectors:[["router-outlet"]],inputs:{name:"name",routerOutletData:[1,"routerOutletData"]},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],features:[lv]})}return t})(),lr$3=class lr{route;childContexts;parent;outletData;constructor(n,e,r,i){this.route=n,this.childContexts=e,this.parent=r,this.outletData=i;}get(n,e){return n===V?this.route:n===de$2?this.childContexts:n===Hn$2?this.outletData:this.parent.get(n,e)}},Ge$2=new N$7(""),Fn$2=(()=>{class t{options;outletDataSubscriptions=new Map;outletSeenKeys=new Map;constructor(e){this.options=e,this.options.queryParams??=true;}bindActivatedRouteToOutletComponent(e){this.unsubscribeFromRouteData(e),this.subscribeToRouteData(e);}unsubscribeFromRouteData(e){this.outletDataSubscriptions.get(e)?.unsubscribe(),this.outletDataSubscriptions.delete(e),this.outletSeenKeys.delete(e);}subscribeToRouteData(e){let{activatedRoute:r}=e,i=Fm([this.options.queryParams?r.queryParams:Tm({}),r.params,r.data]).pipe(ry(([o,a,c],s)=>(c=G$b(G$b(G$b({},o),a),c),s===0?Tm(c):Promise.resolve(c)))).subscribe(o=>{if(!e.isActivated||!e.activatedComponentRef||e.activatedRoute!==r||r.component===null){this.unsubscribeFromRouteData(e);return}let a=Xj(r.component);if(!a){this.unsubscribeFromRouteData(e);return}let c=this.outletSeenKeys.get(e);c||(c=new Set,this.outletSeenKeys.set(e,c));for(let u of Object.keys(o))c.add(u);let s=this.options.unmatchedInputBehavior??"alwaysUndefined";for(let{templateName:u}of a.inputs){let h=o[u];(h!==void 0||s==="alwaysUndefined"||c.has(u))&&e.activatedComponentRef.setInput(u,h);}});this.outletDataSubscriptions.set(e,i);}static \u0275fac=function(r){gD();};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})(),Rr$3=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275cmp=JD({type:t,selectors:[["ng-component"]],exportAs:["emptyRouterOutlet"],decls:1,vars:0,template:function(r,i){r&1&&$h(0,"router-outlet");},dependencies:[yr$3],encapsulation:2,changeDetection:1})}return t})();function Sr$3(t){let n=t.children&&t.children.map(Sr$3),e=n?z$5(G$b({},t),{children:n}):G$b({},t);return !e.component&&!e.loadComponent&&(n||e.loadChildren)&&e.outlet&&e.outlet!==f$1&&(e.component=Rr$3),e}function Ki$2(t,n,e){let r=new Set,i=qe$3(t,n._root,e?e._root:void 0,r);return {newlyCreatedRoutes:r,state:new He$3(i,n)}}function qe$3(t,n,e,r){if(e&&t.shouldReuseRoute(n.value,e.value.snapshot)){let i=e.value;i._futureSnapshot=n.value;let o=Yi$2(t,n,e,r);return new _$1(i,o)}else {if(t.shouldAttach(n.value)){let a=t.retrieve(n.value);if(a!==null){let c=a.route;return c.value._futureSnapshot=n.value,c.children=n.children.map(s=>qe$3(t,s,void 0,r)),c}}let i=Zi$2(n.value);r.add(i);let o=n.children.map(a=>qe$3(t,a,void 0,r));return new _$1(i,o)}}function Yi$2(t,n,e,r){return n.children.map(i=>{for(let o of e.children)if(t.shouldReuseRoute(i.value,o.value.snapshot))return qe$3(t,i,o,r);return qe$3(t,i,void 0,r)})}function Zi$2(t){return new V(new Bn$5(t.url),new Bn$5(t.params),new Bn$5(t.queryParams),new Bn$5(t.fragment),new Bn$5(t.data),t.outlet,t.component,t)}var Ne$1=class Ne{redirectTo;navigationBehaviorOptions;constructor(n,e){this.redirectTo=n,this.navigationBehaviorOptions=e;}},qn$2="ngNavigationCancelingError";function Et$2(t,n){let{redirectTo:e,navigationBehaviorOptions:r}=ee$3(n)?{redirectTo:n,navigationBehaviorOptions:void 0}:n,i=Bn$2(false,I$1.Redirect);return i.url=e,i.navigationBehaviorOptions=r,i}function Bn$2(t,n){let e=new Error(`NavigationCancelingError: ${""}`);return e[qn$2]=true,e.cancellationCode=n,e}function Ji$2(t){return Vn$2(t)&&ee$3(t.url)}function Vn$2(t){return !!t&&t[qn$2]}var hr$3=class hr{routeReuseStrategy;futureState;currState;forwardEvent;inputBindingEnabled;constructor(n,e,r,i,o){this.routeReuseStrategy=n,this.futureState=e,this.currState=r,this.forwardEvent=i,this.inputBindingEnabled=o;}activate(n){let e=this.futureState._root,r=this.currState?this.currState._root:null;this.deactivateChildRoutes(e,r,n),er$2(this.futureState.root),this.activateChildRoutes(e,r,n);}deactivateChildRoutes(n,e,r){let i=Re$1(e);n.children.forEach(o=>{let a=o.value.outlet;this.deactivateRoutes(o,i[a],r),delete i[a];}),Object.values(i).forEach(o=>{this.deactivateRouteAndItsChildren(o,r);});}deactivateRoutes(n,e,r){let i=n.value,o=e?e.value:null;if(i===o)if(i.component){let a=r.getContext(i.outlet);a&&this.deactivateChildRoutes(n,e,a.children);}else this.deactivateChildRoutes(n,e,r);else o&&this.deactivateRouteAndItsChildren(e,r);}deactivateRouteAndItsChildren(n,e){n.value.component&&this.routeReuseStrategy.shouldDetach(n.value.snapshot)?this.detachAndStoreRouteSubtree(n,e):this.deactivateRouteAndOutlet(n,e);}detachAndStoreRouteSubtree(n,e){let r=e.getContext(n.value.outlet),i=r&&n.value.component?r.children:e,o=Re$1(n);for(let a of Object.values(o))this.deactivateRouteAndItsChildren(a,i);if(r&&r.outlet){let a=r.outlet.detach(),c=r.children.onOutletDeactivated();this.routeReuseStrategy.store(n.value.snapshot,{componentRef:a,route:n,contexts:c});}}deactivateRouteAndOutlet(n,e){let r=e.getContext(n.value.outlet),i=r&&n.value.component?r.children:e,o=Re$1(n);for(let a of Object.values(o))this.deactivateRouteAndItsChildren(a,i);r&&(r.outlet&&(r.outlet.deactivate(),r.children.onOutletDeactivated()),r.attachRef=null,r.route=null),n.value._localInjector?.destroy();}activateChildRoutes(n,e,r){let i=Re$1(e);n.children.forEach(o=>{this.activateRoutes(o,i[o.value.outlet],r),this.forwardEvent(new bt$1(o.value.snapshot));}),n.children.length&&this.forwardEvent(new Ct$2(n.value.snapshot));}activateRoutes(n,e,r){let i=n.value,o=e?e.value:null;if(er$2(i),i===o)if(i.component){let a=r.getOrCreateContext(i.outlet);this.activateChildRoutes(n,e,a.children);}else this.activateChildRoutes(n,e,r);else if(i.component){let a=r.getOrCreateContext(i.outlet);if(this.routeReuseStrategy.shouldAttach(i.snapshot)){let c=this.routeReuseStrategy.retrieve(i.snapshot);this.routeReuseStrategy.store(i.snapshot,null),a.children.onOutletReAttached(c.contexts),a.attachRef=c.componentRef,a.route=c.route.value,a.outlet&&a.outlet.attach(c.componentRef,c.route.value),er$2(c.route.value),this.activateChildRoutes(n,null,a.children);}else a.attachRef=null,a.route=i,a.outlet&&a.outlet.activateWith(i,a.injector),this.activateChildRoutes(n,null,a.children);}else this.activateChildRoutes(n,null,r);}},Tt$1=class Tt{path;route;constructor(n){this.path=n,this.route=this.path[this.path.length-1];}},we$1=class we{component;route;constructor(n,e){this.component=n,this.route=e;}};function Xi$2(t,n,e){let r=t._root,i=n?n._root:null;return Le$1(r,i,e,[r.value])}function eo$1(t){let n=t.routeConfig?t.routeConfig.canActivateChild:null;return !n||n.length===0?null:{node:t,guards:n}}function De$1(t,n){let e=Symbol(),r=n.get(t,e);return r===e?typeof t=="function"&&!gy(t)?t:n.get(t):r}function Le$1(t,n,e,r,i={canDeactivateChecks:[],canActivateChecks:[]}){let o=Re$1(n);return t.children.forEach(a=>{to$1(a,o[a.value.outlet],e,r.concat([a.value]),i),delete o[a.value.outlet];}),Object.entries(o).forEach(([a,c])=>je$2(c,e.getContext(a),i)),i}function to$1(t,n,e,r,i={canDeactivateChecks:[],canActivateChecks:[]}){let o=t.value,a=n?n.value:null,c=e?e.getContext(t.value.outlet):null;if(a&&o.routeConfig===a.routeConfig){let s=ro$1(a,o,o.routeConfig.runGuardsAndResolvers);s?i.canActivateChecks.push(new Tt$1(r)):(o.data=a.data,o._resolvedData=a._resolvedData),o.component?Le$1(t,n,c?c.children:null,r,i):Le$1(t,n,e,r,i),s&&c&&c.outlet&&c.outlet.isActivated&&i.canDeactivateChecks.push(new we$1(c.outlet.component,a));}else a&&je$2(n,c,i),i.canActivateChecks.push(new Tt$1(r)),o.component?Le$1(t,null,c?c.children:null,r,i):Le$1(t,null,e,r,i);return i}function ro$1(t,n,e){if(typeof e=="function")return $o$4(n._environmentInjector,()=>e(t,n));switch(e){case "pathParamsChange":return !ce$2(t.url,n.url);case "pathParamsOrQueryParamsChange":return !ce$2(t.url,n.url)||!q$1(t.queryParams,n.queryParams);case "always":return true;case "paramsOrQueryParamsChange":return !ur$3(t,n)||!q$1(t.queryParams,n.queryParams);default:return !ur$3(t,n)}}function je$2(t,n,e){let r=Re$1(t),i=t.value;Object.entries(r).forEach(([o,a])=>{i.component?n?je$2(a,n.children.getContext(o),e):je$2(a,null,e):je$2(a,n,e);}),i.component?n&&n.outlet&&n.outlet.isActivated?e.canDeactivateChecks.push(new we$1(n.outlet.component,i)):e.canDeactivateChecks.push(new we$1(null,i)):e.canDeactivateChecks.push(new we$1(null,i));}function We$2(t){return typeof t=="function"}function no$1(t){return typeof t=="boolean"}function io$1(t){return t&&We$2(t.canLoad)}function oo$1(t){return t&&We$2(t.canActivate)}function ao$1(t){return t&&We$2(t.canActivateChild)}function so$1(t){return t&&We$2(t.canDeactivate)}function co$1(t){return t&&We$2(t.canMatch)}function Gn$2(t){return t instanceof qe$a||t?.name==="EmptyError"}var st$2=Symbol("INITIAL_VALUE");function Me$1(){return ry(t=>Fm(t.map(n=>n.pipe(_t$9(1),Tu(st$2)))).pipe(ke$3(n=>{for(let e of n)if(e!==true){if(e===st$2)return st$2;if(e===false||uo$1(e))return e}return true}),fn$7(n=>n!==st$2),_t$9(1)))}function uo$1(t){return ee$3(t)||t instanceof Ne$1}function Wn$2(t){return t.aborted?Tm(void 0).pipe(_t$9(1)):new S$5(n=>{let e=()=>{n.next(),n.complete();};return t.addEventListener("abort",e),()=>t.removeEventListener("abort",e)})}function Qn$2(t){return bu(Wn$2(t))}function lo$1(t){return Te$5(n=>{let{targetSnapshot:e,currentSnapshot:r,guards:{canActivateChecks:i,canDeactivateChecks:o}}=n;return o.length===0&&i.length===0?Tm(z$5(G$b({},n),{guardsResult:true})):ho$1(o,e,r).pipe(Te$5(a=>a&&no$1(a)?fo$1(e,i,t):Tm(a)),ke$3(a=>z$5(G$b({},n),{guardsResult:a})))})}function ho$1(t,n,e){return Pe$4(t).pipe(Te$5(r=>yo$1(r.component,r.route,e,n)),Jm(r=>r!==true,true))}function fo$1(t,n,e){return Pe$4(n).pipe(mu(r=>dn$7(go$1(r.route.parent,e),po$1(r.route,e),mo$1(t,r.path),vo$1(t,r.route))),Jm(r=>r!==true,true))}function po$1(t,n){return t!==null&&n&&n(new wt$2(t)),Tm(true)}function go$1(t,n){return t!==null&&n&&n(new St$1(t)),Tm(true)}function vo$1(t,n){let e=n.routeConfig?n.routeConfig.canActivate:null;if(!e||e.length===0)return Tm(true);let r=e.map(i=>Vm(()=>{let o=n._environmentInjector,a=De$1(i,o),c=oo$1(a)?a.canActivate(n,t):$o$4(o,()=>a(n,t));return he$3(c).pipe(Jm())}));return Tm(r).pipe(Me$1())}function mo$1(t,n){let e=n[n.length-1],i=n.slice(0,n.length-1).reverse().map(o=>eo$1(o)).filter(o=>o!==null).map(o=>Vm(()=>{let a=o.guards.map(c=>{let s=o.node._environmentInjector,u=De$1(c,s),h=ao$1(u)?u.canActivateChild(e,t):$o$4(s,()=>u(e,t));return he$3(h).pipe(Jm())});return Tm(a).pipe(Me$1())}));return Tm(i).pipe(Me$1())}function yo$1(t,n,e,r){let i=n&&n.routeConfig?n.routeConfig.canDeactivate:null;if(!i||i.length===0)return Tm(true);let o=i.map(a=>{let c=n._environmentInjector,s=De$1(a,c),u=so$1(s)?s.canDeactivate(t,n,e,r):$o$4(c,()=>s(t,n,e,r));return he$3(u).pipe(Jm())});return Tm(o).pipe(Me$1())}function Ro$1(t,n,e,r,i){let o=n.canLoad;if(o===void 0||o.length===0)return Tm(true);let a=o.map(c=>{let s=De$1(c,t),u=io$1(s)?s.canLoad(n,e):$o$4(t,()=>s(n,e)),h=he$3(u);return i?h.pipe(Qn$2(i)):h});return Tm(a).pipe(Me$1(),Kn$2(r))}function Kn$2(t){return sm(Cu(n=>{if(typeof n!="boolean")throw Et$2(t,n)}),ke$3(n=>n===true))}function So$1(t,n,e,r,i,o){let a=n.canMatch;if(!a||a.length===0)return Tm(true);let c=a.map(s=>{let u=De$1(s,t),h=co$1(u)?u.canMatch(n,e,i):$o$4(t,()=>u(n,e,i));return he$3(h).pipe(Qn$2(o))});return Tm(c).pipe(Me$1(),Kn$2(r))}var Q$1=class t extends Error{segmentGroup;constructor(n){super(),this.segmentGroup=n||null,Object.setPrototypeOf(this,t.prototype);}},Be$2=class t extends Error{urlTree;constructor(n){super(),this.urlTree=n,Object.setPrototypeOf(this,t.prototype);}};function Co$1(t){throw new b$2(4e3,false)}function wo$1(t){throw Bn$2(false,I$1.GuardRejected)}var dr$3=class dr{urlSerializer;urlTree;constructor(n,e){this.urlSerializer=n,this.urlTree=e;}lineralizeSegments(n,e){return Zr$4(this,null,function*(){let r=[],i=e.root;for(;;){if(r=r.concat(i.segments),i.numberOfChildren===0)return r;if(i.numberOfChildren>1||!i.children[f$1])throw Co$1(`${n.redirectTo}`);i=i.children[f$1];}})}applyRedirectCommands(n,e,r,i,o){return Zr$4(this,null,function*(){let a=yield bo$1(e,i,o);if(a instanceof U$1)throw new Be$2(a);let c=this.applyRedirectCreateUrlTree(a,this.urlSerializer.parse(a),n,r);if(a[0]==="/")throw new Be$2(c);return c})}applyRedirectCreateUrlTree(n,e,r,i){let o=this.createSegmentGroup(n,e.root,r,i);return new U$1(o,this.createQueryParams(e.queryParams,this.urlTree.queryParams),e.fragment)}createQueryParams(n,e){let r={};return Object.entries(n).forEach(([i,o])=>{if(typeof o=="string"&&o[0]===":"){let c=o.substring(1);r[i]=e[c];}else r[i]=o;}),r}createSegmentGroup(n,e,r,i){let o=this.createSegments(n,e.segments,r,i),a={};return Object.entries(e.children).forEach(([c,s])=>{a[c]=this.createSegmentGroup(n,s,r,i);}),new m$1(o,a)}createSegments(n,e,r,i){return e.map(o=>o.path[0]===":"?this.findPosParam(n,o,i):this.findOrReturn(o,r))}findPosParam(n,e,r){let i=r[e.path.substring(1)];if(!i)throw new b$2(4001,false);return i}findOrReturn(n,e){let r=0;for(let i of e){if(i.path===n.path)return e.splice(r),i;r++;}return n}};function bo$1(t,n,e){if(typeof t=="string")return Promise.resolve(t);let r=t;return ht$2(he$3($o$4(e,()=>r(n))))}function Io$1(t,n){return t.providers&&!t._injector&&(t._injector=Th(t.providers,n,`Route: ${t.path}`)),t._injector??n}function H$1(t){return t.outlet||f$1}function Ao$1(t,n){let e=t.filter(r=>H$1(r)===n);return e.push(...t.filter(r=>H$1(r)!==n)),e}var fr$3={matched:false,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function Yn$2(t){return {routeConfig:t.routeConfig,url:t.url,params:t.params,queryParams:t.queryParams,fragment:t.fragment,data:t.data,outlet:t.outlet,title:t.title,paramMap:t.paramMap,queryParamMap:t.queryParamMap}}function Eo$1(t,n,e,r,i,o,a){let c=Zn$2(t,n,e);if(!c.matched)return Tm(c);let s=Yn$2(o(c));return r=Io$1(n,r),So$1(r,n,e,i,s,a).pipe(ke$3(u=>u===true?c:G$b({},fr$3)))}function Zn$2(t,n,e){if(n.path==="")return n.pathMatch==="full"&&(t.hasChildren()||e.length>0)?G$b({},fr$3):{matched:true,consumedSegments:[],remainingSegments:e,parameters:{},positionalParamSegments:{}};let i=(n.matcher||Sn$3)(e,t,n);if(!i)return G$b({},fr$3);let o={};Object.entries(i.posParams??{}).forEach(([c,s])=>{o[c]=s.path;});let a=i.consumed.length>0?G$b(G$b({},o),i.consumed[i.consumed.length-1].parameters):o;return {matched:true,consumedSegments:i.consumed,remainingSegments:e.slice(i.consumed.length),parameters:a,positionalParamSegments:i.posParams??{}}}function mn$3(t,n,e,r,i){return e.length>0&&Mo$1(t,e,r,i)?{segmentGroup:new m$1(n,No$1(r,new m$1(e,t.children))),slicedSegments:[]}:e.length===0&&Do$1(t,e,r)?{segmentGroup:new m$1(t.segments,To$1(t,e,r,t.children)),slicedSegments:e}:{segmentGroup:new m$1(t.segments,t.children),slicedSegments:e}}function To$1(t,n,e,r){let i={};for(let o of e)if(Mt$2(t,n,o)&&!r[H$1(o)]){let a=new m$1([],{});i[H$1(o)]=a;}return G$b(G$b({},r),i)}function No$1(t,n){let e={};e[f$1]=n;for(let r of t)if(r.path===""&&H$1(r)!==f$1){let i=new m$1([],{});e[H$1(r)]=i;}return e}function Mo$1(t,n,e,r){return e.some(i=>!Mt$2(t,n,i)||!(H$1(i)!==f$1)?false:!(r!==void 0&&H$1(i)===r))}function Do$1(t,n,e){return e.some(r=>Mt$2(t,n,r))}function Mt$2(t,n,e){return (t.hasChildren()||n.length>0)&&e.pathMatch==="full"?false:e.path===""}function _o$1(t,n,e){return n.length===0&&!t.children[e]}var pr$3=class pr{};function Uo$1(t,n,e,r,i,o,a,c){return Zr$4(this,null,function*(){return new gr$3(t,n,e,r,i,a,o,c).recognize()})}var Oo$1=31,gr$3=class gr{injector;configLoader;rootComponentType;config;urlTree;paramsInheritanceStrategy;urlSerializer;abortSignal;applyRedirects;absoluteRedirectCount=0;allowRedirects=true;constructor(n,e,r,i,o,a,c,s){this.injector=n,this.configLoader=e,this.rootComponentType=r,this.config=i,this.urlTree=o,this.paramsInheritanceStrategy=a,this.urlSerializer=c,this.abortSignal=s,this.applyRedirects=new dr$3(this.urlSerializer,this.urlTree);}noMatchError(n){return new b$2(4002,`'${n.segmentGroup}'`)}recognize(){return Zr$4(this,null,function*(){let n=mn$3(this.urlTree.root,[],[],this.config).segmentGroup,{children:e,rootSnapshot:r}=yield this.match(n),i=new _$1(r,e),o=new Fe$2("",i),a=Un$2(r,[],this.urlTree.queryParams,this.urlTree.fragment);return a.queryParams=this.urlTree.queryParams,o.url=this.urlSerializer.serialize(a),{state:o,tree:a}})}match(n){return Zr$4(this,null,function*(){let e=new Te$1([],Object.freeze({}),Object.freeze(G$b({},this.urlTree.queryParams)),this.urlTree.fragment,Object.freeze({}),f$1,this.rootComponentType,null,{},this.injector);try{return {children:yield this.processSegmentGroup(this.injector,this.config,n,f$1,e),rootSnapshot:e}}catch(r){if(r instanceof Be$2)return this.urlTree=r.urlTree,this.match(r.urlTree.root);throw r instanceof Q$1?this.noMatchError(r):r}})}processSegmentGroup(n,e,r,i,o){return Zr$4(this,null,function*(){if(r.segments.length===0&&r.hasChildren())return this.processChildren(n,e,r,o);let a=yield this.processSegment(n,e,r,r.segments,i,true,o);return a instanceof _$1?[a]:[]})}processChildren(n,e,r,i){return Zr$4(this,null,function*(){let o=[];for(let s of Object.keys(r.children))s==="primary"?o.unshift(s):o.push(s);let a=[];for(let s of o){let u=r.children[s],h=Ao$1(e,s),v=yield this.processSegmentGroup(n,h,u,s,i);a.push(...v);}let c=Jn$2(a);return Po$1(c),c})}processSegment(n,e,r,i,o,a,c){return Zr$4(this,null,function*(){for(let s of e)try{return yield this.processSegmentAgainstRoute(s._injector??n,e,s,r,i,o,a,c)}catch(u){if(u instanceof Q$1||Gn$2(u))continue;throw u}if(_o$1(r,i,o))return new pr$3;throw new Q$1(r)})}processSegmentAgainstRoute(n,e,r,i,o,a,c,s){return Zr$4(this,null,function*(){if(H$1(r)!==a&&(a===f$1||!Mt$2(i,o,r)))throw new Q$1(i);if(r.redirectTo===void 0)return this.matchSegmentAgainstRoute(n,i,r,o,a,s);if(this.allowRedirects&&c)return this.expandSegmentAgainstRouteUsingRedirect(n,i,e,r,o,a,s);throw new Q$1(i)})}expandSegmentAgainstRouteUsingRedirect(n,e,r,i,o,a,c){return Zr$4(this,null,function*(){let{matched:s,parameters:u,consumedSegments:h,positionalParamSegments:v,remainingSegments:g}=Zn$2(e,i,o);if(!s)throw new Q$1(e);typeof i.redirectTo=="string"&&i.redirectTo[0]==="/"&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>Oo$1&&(this.allowRedirects=false));let T=this.createSnapshot(n,i,o,u,c);if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let z=yield this.applyRedirects.applyRedirectCommands(h,i.redirectTo,v,Yn$2(T),n),ie=yield this.applyRedirects.lineralizeSegments(i,z);return this.processSegment(n,r,e,ie.concat(g),a,false,c)})}createSnapshot(n,e,r,i,o){let a=new Te$1(r,i,Object.freeze(G$b({},this.urlTree.queryParams)),this.urlTree.fragment,xo$1(e),H$1(e),e.component??e._loadedComponent??null,e,jo$1(e),n),c=vr$3(a,o,this.paramsInheritanceStrategy);return a.params=Object.freeze(c.params),a.data=Object.freeze(c.data),a}matchSegmentAgainstRoute(n,e,r,i,o,a){return Zr$4(this,null,function*(){if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let c=oe=>this.createSnapshot(n,r,oe.consumedSegments,oe.parameters,a),s=yield ht$2(Eo$1(e,r,i,n,this.urlSerializer,c,this.abortSignal));if(r.path==="**"&&(e.children={}),!s?.matched)throw new Q$1(e);n=r._injector??n;let{routes:u}=yield this.getChildConfig(n,r,i),h=r._loadedInjector??n,{parameters:v,consumedSegments:g,remainingSegments:T}=s,z=this.createSnapshot(n,r,g,v,a),{segmentGroup:ie,slicedSegments:Ue}=mn$3(e,g,T,u,o);if(Ue.length===0&&ie.hasChildren()){let oe=yield this.processChildren(h,u,ie,z);return new _$1(z,oe)}if(u.length===0&&Ue.length===0)return new _$1(z,[]);let Lt=H$1(r)===o,Ke=yield this.processSegment(h,u,ie,Ue,Lt?f$1:o,true,z);return new _$1(z,Ke instanceof _$1?[Ke]:[])})}getChildConfig(n,e,r){return Zr$4(this,null,function*(){if(e.children)return {routes:e.children,injector:n};if(e.loadChildren){if(e._loadedRoutes!==void 0){let o=e._loadedNgModuleFactory;return o&&!e._loadedInjector&&(e._loadedInjector=o.create(n).injector),{routes:e._loadedRoutes,injector:e._loadedInjector}}if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);if(yield ht$2(Ro$1(n,e,r,this.urlSerializer,this.abortSignal))){let o=yield this.configLoader.loadChildren(n,e);return e._loadedRoutes=o.routes,e._loadedInjector=o.injector,e._loadedNgModuleFactory=o.factory,o}throw wo$1()}return {routes:[],injector:n}})}};function Po$1(t){t.sort((n,e)=>n.value.outlet===f$1?-1:e.value.outlet===f$1?1:n.value.outlet.localeCompare(e.value.outlet));}function Lo$1(t){let n=t.value.routeConfig;return n&&n.path===""}function Jn$2(t){let n=[],e=new Set;for(let r of t){if(!Lo$1(r)){n.push(r);continue}let i=n.find(o=>r.value.routeConfig===o.value.routeConfig);i!==void 0?(i.children.push(...r.children),e.add(i)):n.push(r);}for(let r of e){let i=Jn$2(r.children);n.push(new _$1(r.value,i));}return n.filter(r=>!e.has(r))}function xo$1(t){return t.data||{}}function jo$1(t){return t.resolve||{}}function ko$1(t,n,e,r,i,o,a){return Te$5(c=>Zr$4(null,null,function*(){let{state:s,tree:u}=yield Uo$1(t,n,e,r,c.extractedUrl,i,o,a);return z$5(G$b({},c),{targetSnapshot:s,urlAfterRedirects:u})}))}function $o$1(t){return Te$5(n=>{let{targetSnapshot:e,guards:{canActivateChecks:r}}=n;if(!r.length)return Tm(n);let i=new Set(r.map(c=>c.route)),o=new Set;for(let c of i)if(!o.has(c))for(let s of Xn$2(c))o.add(s);let a=0;return Pe$4(o).pipe(mu(c=>i.has(c)?zo$1(c,e,t):(c.data=vr$3(c,c.parent,t).resolve,Tm(void 0))),Cu(()=>a++),Xm(1),Te$5(c=>a===o.size?Tm(n):Ct$b))})}function Xn$2(t){let n=t.children.map(e=>Xn$2(e)).flat();return [t,...n]}function zo$1(t,n,e){let r=t.routeConfig,i=t._resolve;return r?.title!==void 0&&!zn$2(r)&&(i[Ve$3]=r.title),Vm(()=>(t.data=vr$3(t,t.parent,e).resolve,Ho$1(i,t,n).pipe(ke$3(o=>(t._resolvedData=o,t.data=G$b(G$b({},t.data),o),null)))))}function Ho$1(t,n,e){let r=rr$3(t);if(r.length===0)return Tm({});let i={};return Pe$4(r).pipe(Te$5(o=>Fo$1(t[o],n,e).pipe(Jm(),Cu(a=>{if(a instanceof Ne$1)throw Et$2(new K$2,a);i[o]=a;}))),Xm(1),ke$3(()=>i),ws$4(o=>Gn$2(o)?Ct$b:bm(o)))}function Fo$1(t,n,e){let r=n._environmentInjector,i=De$1(t,r),o=i.resolve?i.resolve(n,e):$o$4(r,()=>i(n,e));return he$3(o)}function yn$3(t){return ry(n=>{let e=t(n);return e?Pe$4(e).pipe(ke$3(()=>n)):Tm(n)})}var Cr$3=(()=>{class t{buildTitle(e){let r,i=e.root;for(;i!==void 0;)r=this.getResolvedTitleForRoute(i)??r,i=i.children.find(o=>o.outlet===f$1);return r}getResolvedTitleForRoute(e){return e.data[Ve$3]}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(ei$3)})}return t})(),ei$3=(()=>{class t extends Cr$3{title;constructor(e){super(),this.title=e;}updateTitle(e){let r=this.buildTitle(e);r!==void 0&&this.title.setTitle(r);}static \u0275fac=function(r){return new(r||t)(se$8(ym))};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),ne$2=new N$7("",{factory:()=>({})}),fe$2=new N$7(""),Dt$1=(()=>{class t{componentLoaders=new WeakMap;childrenLoaders=new WeakMap;onLoadStartListener;onLoadEndListener;compiler=w$4(GT);loadComponent(e,r){return Zr$4(this,null,function*(){if(this.componentLoaders.get(r))return this.componentLoaders.get(r);if(r._loadedComponent)return Promise.resolve(r._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(r);let i=Zr$4(this,null,function*(){try{let o=yield wn$3($o$4(e,()=>r.loadComponent())),a=yield ri$2(jj(o));return this.onLoadEndListener&&this.onLoadEndListener(r),r._loadedComponent=a,a}finally{this.componentLoaders.delete(r);}});return this.componentLoaders.set(r,i),i})}loadChildren(e,r){if(this.childrenLoaders.get(r))return this.childrenLoaders.get(r);if(r._loadedRoutes)return Promise.resolve({routes:r._loadedRoutes,injector:r._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(r);let i=Zr$4(this,null,function*(){try{let o=yield ti$1(r,this.compiler,e,this.onLoadEndListener);return r._loadedRoutes=o.routes,r._loadedInjector=o.injector,r._loadedNgModuleFactory=o.factory,o}finally{this.childrenLoaders.delete(r);}});return this.childrenLoaders.set(r,i),i}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function ti$1(t,n,e,r){return Zr$4(this,null,function*(){let i=yield wn$3($o$4(e,()=>t.loadChildren())),o=yield ri$2(jj(i)),a;o instanceof wh$2||Array.isArray(o)?a=o:a=yield n.compileModuleAsync(o),r&&r(t);let c,s,h;return Array.isArray(a)?(s=a,true):(c=a.create(e).injector,h=a,s=c.get(fe$2,[],{optional:true,self:true}).flat()),{routes:s.map(Sr$3),injector:c,factory:h}})}function ri$2(t){return Zr$4(this,null,function*(){return t})}var _t$2=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(qo$2)})}return t})(),qo$2=(()=>{class t{shouldProcessUrl(e){return true}extract(e){return e}merge(e,r){return e}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})(),wr$3=new N$7(""),br$3=new N$7("");function ni$2(t,n,e){let r=t.get(br$3),i=t.get(gr$6);if(!i.startViewTransition||r.skipNextTransition)return r.skipNextTransition=false,new Promise(u=>setTimeout(u));let o,a=new Promise(u=>{o=u;}),c=i.startViewTransition(()=>(o(),Bo$1(t)));c.updateCallbackDone.catch(u=>{}),c.ready.catch(u=>{}),c.finished.catch(u=>{});let{onViewTransitionCreated:s}=r;return s&&$o$4(t,()=>s({transition:c,from:n,to:e})),a}function Bo$1(t){return new Promise(n=>{Tp$1({read:()=>setTimeout(n)},{injector:t});})}var ii$2=new N$7(""),Vo$1=()=>{},Ir$3=new N$7(""),Ut$2=(()=>{class t{currentNavigation=vt$9(null,{equal:()=>false});currentTransition=null;lastSuccessfulNavigation=vt$9(null);events=new te$9;transitionAbortWithErrorSubject=new te$9;configLoader=w$4(Dt$1);environmentInjector=w$4(me$5);destroyRef=w$4(xe$3);urlSerializer=w$4(re$1);rootContexts=w$4(de$2);location=w$4(Fi$4);inputBindingEnabled=w$4(Ge$2,{optional:true})!==null;titleStrategy=w$4(Cr$3);options=w$4(ne$2,{optional:true})||{};paramsInheritanceStrategy=this.options.paramsInheritanceStrategy||Qi$2;urlHandlingStrategy=w$4(_t$2);createViewTransition=w$4(wr$3,{optional:true});navigationErrorHandler=w$4(Ir$3,{optional:true});activatedRouteInjectorFeature=w$4(ii$2,{optional:true});navigationId=0;get hasRequestedNavigation(){return this.navigationId!==0}transitions;afterPreactivation=()=>Tm(void 0);rootComponentType=null;destroyed=false;constructor(){let e=i=>this.events.next(new yt$2(i)),r=i=>this.events.next(new Rt$2(i));this.configLoader.onLoadEndListener=r,this.configLoader.onLoadStartListener=e,this.destroyRef.onDestroy(()=>{this.destroyed=true;});}complete(){this.transitions?.complete();}handleNavigationRequest(e){let r=++this.navigationId;ge$5(()=>{this.transitions?.next(z$5(G$b({},e),{extractedUrl:this.urlHandlingStrategy.extract(e.rawUrl),targetSnapshot:null,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null,id:r,routesRecognizeHandler:{},beforeActivateHandler:{}}));});}setupNavigations(e){return this.transitions=new Bn$5(null),this.transitions.pipe(fn$7(r=>r!==null),ry(r=>{let i=true,o=false,a=new AbortController,c=()=>!o&&this.currentTransition?.id===r.id;return Tm(r).pipe(ry(s=>{if(this.navigationId>r.id)return this.cancelNavigationTransition(r,"",I$1.SupersededByNewNavigation),Ct$b;this.currentTransition=r;let u=this.lastSuccessfulNavigation();this.currentNavigation.set({id:s.id,initialUrl:s.rawUrl,extractedUrl:s.extractedUrl,targetBrowserUrl:typeof s.extras.browserUrl=="string"?this.urlSerializer.parse(s.extras.browserUrl):s.extras.browserUrl,trigger:s.source,extras:s.extras,previousNavigation:u?z$5(G$b({},u),{previousNavigation:null}):null,abort:()=>a.abort(),routesRecognizeHandler:s.routesRecognizeHandler,beforeActivateHandler:s.beforeActivateHandler});let h=!e.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl(),v=s.extras.onSameUrlNavigation??e.onSameUrlNavigation;if(!h&&v!=="reload")return this.events.next(new B$2(s.id,this.urlSerializer.serialize(s.rawUrl),"",be$1.IgnoredSameUrlNavigation)),s.resolve(false),Ct$b;if(this.urlHandlingStrategy.shouldProcessUrl(s.rawUrl))return Tm(s).pipe(ry(g=>(this.events.next(new te$3(g.id,this.urlSerializer.serialize(g.extractedUrl),g.source,g.restoredState)),g.id!==this.navigationId?Ct$b:Promise.resolve(g))),ko$1(this.environmentInjector,this.configLoader,this.rootComponentType,e.config,this.urlSerializer,this.paramsInheritanceStrategy,a.signal),Cu(g=>{r.targetSnapshot=g.targetSnapshot,r.urlAfterRedirects=g.urlAfterRedirects,this.currentNavigation.update(T=>(T.finalUrl=g.urlAfterRedirects,T)),this.events.next(new ze$1);}),ry(g=>Pe$4(r.routesRecognizeHandler.deferredHandle??Tm(void 0)).pipe(ke$3(()=>g))),Cu(()=>{let g=new $e$3(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);this.events.next(g);}));if(h&&this.urlHandlingStrategy.shouldProcessUrl(s.currentRawUrl)){let{id:g,extractedUrl:T,source:z,restoredState:ie,extras:Ue}=s,Lt=new te$3(g,this.urlSerializer.serialize(T),z,ie);this.events.next(Lt);let Ke=kn$3(this.rootComponentType,this.environmentInjector).snapshot;return this.currentTransition=r=z$5(G$b({},s),{targetSnapshot:Ke,urlAfterRedirects:T,extras:z$5(G$b({},Ue),{skipLocationChange:false,replaceUrl:false})}),this.currentNavigation.update(oe=>(oe.finalUrl=T,oe)),Tm(r)}else return this.events.next(new B$2(s.id,this.urlSerializer.serialize(s.extractedUrl),"",be$1.IgnoredByUrlHandlingStrategy)),s.resolve(false),Ct$b}),ke$3(s=>{let u=new pt$2(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);return this.events.next(u),this.currentTransition=r=z$5(G$b({},s),{guards:Xi$2(s.targetSnapshot,s.currentSnapshot,this.rootContexts)}),r}),lo$1(s=>this.events.next(s)),ry(s=>{if(r.guardsResult=s.guardsResult,s.guardsResult&&typeof s.guardsResult!="boolean")throw Et$2(this.urlSerializer,s.guardsResult);let u=new gt$1(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot,!!s.guardsResult);if(this.events.next(u),!c())return Ct$b;if(!s.guardsResult)return this.cancelNavigationTransition(s,"",I$1.GuardRejected),Ct$b;if(s.guards.canActivateChecks.length===0)return Tm(s);let h=new vt$1(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);if(this.events.next(h),!c())return Ct$b;let v=false;return Tm(s).pipe($o$1(this.paramsInheritanceStrategy),Cu({next:()=>{v=true;let g=new mt$3(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);this.events.next(g);},complete:()=>{v||this.cancelNavigationTransition(s,"",I$1.NoDataFromResolver);}}))}),yn$3(s=>{let u=v=>{let g=[];if(v.routeConfig?._loadedComponent)v.component=v.routeConfig?._loadedComponent;else if(v.routeConfig?.loadComponent){let T=v._environmentInjector;g.push(this.configLoader.loadComponent(T,v.routeConfig).then(z=>{v.component=z;}));}for(let T of v.children)g.push(...u(T));return g},h=u(s.targetSnapshot.root);return h.length===0?Tm(s):Pe$4(Promise.all(h).then(()=>s))}),ry(s=>{let{newlyCreatedRoutes:u,state:h}=Ki$2(e.routeReuseStrategy,s.targetSnapshot,s.currentRouterState);return this.currentTransition=r=s=z$5(G$b({},s),{targetRouterState:h,newlyCreatedRoutes:u}),this.currentNavigation.update(v=>(v.targetRouterState=h,v)),Tm(s)}),this.activatedRouteInjectorFeature?.operator()??(s=>s),yn$3(()=>this.afterPreactivation()),ry(()=>{let{currentSnapshot:s,targetSnapshot:u}=r,h=this.createViewTransition?.(this.environmentInjector,s.root,u.root);return h?Pe$4(h).pipe(ke$3(()=>r)):Tm(r)}),_t$9(1),ry(s=>{i=false,this.events.next(new Ae$1);let u=r.beforeActivateHandler.deferredHandle;return u?Pe$4(u.then(()=>s)):Tm(s)}),Cu(s=>{new hr$3(e.routeReuseStrategy,r.targetRouterState,r.currentRouterState,u=>this.events.next(u),this.inputBindingEnabled).activate(this.rootContexts),s.newlyCreatedRoutes?.clear(),c()&&(o=true,this.currentNavigation.update(u=>(u.abort=Vo$1,u)),this.lastSuccessfulNavigation.set(ge$5(this.currentNavigation)),this.events.next(new $$2(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects))),this.titleStrategy?.updateTitle(s.targetRouterState.snapshot),s.resolve(true));}),bu(Wn$2(a.signal).pipe(fn$7(()=>!o&&i),Cu(()=>{this.cancelNavigationTransition(r,a.signal.reason+"",I$1.Aborted);}))),Cu({complete:()=>{o=true;}}),bu(this.transitionAbortWithErrorSubject.pipe(Cu(s=>{throw s}))),zl$2(()=>{a.abort(),o||this.cancelNavigationTransition(r,"",I$1.SupersededByNewNavigation),this.currentTransition?.id===r.id&&(this.currentNavigation.set(null),this.currentTransition=null);}),ws$4(s=>{if(o=true,Rn$2(r),this.destroyed)return r.resolve(false),Ct$b;if(Vn$2(s))this.events.next(new k$1(r.id,this.urlSerializer.serialize(r.extractedUrl),s.message,s.cancellationCode)),Ji$2(s)?this.events.next(new Ee$1(s.url,s.navigationBehaviorOptions)):r.resolve(false);else {let u=new le$1(r.id,this.urlSerializer.serialize(r.extractedUrl),s,r.targetSnapshot??void 0);try{let h=$o$4(this.environmentInjector,()=>this.navigationErrorHandler?.(u));if(h instanceof Ne$1){let{message:v,cancellationCode:g}=Et$2(this.urlSerializer,h);this.events.next(new k$1(r.id,this.urlSerializer.serialize(r.extractedUrl),v,g)),this.events.next(new Ee$1(h.redirectTo,h.navigationBehaviorOptions));}else throw this.events.next(u),s}catch(h){this.options.resolveNavigationPromiseOnError?r.resolve(false):r.reject(h);}}return Ct$b}))}))}cancelNavigationTransition(e,r,i){Rn$2(e);let o=new k$1(e.id,this.urlSerializer.serialize(e.extractedUrl),r,i);this.events.next(o),e.resolve(false);}isUpdatingInternalState(){return this.currentTransition?.extractedUrl.toString()!==this.currentTransition?.currentUrlTree.toString()}isUpdatedBrowserUrl(){let e=this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true))),r=ge$5(this.currentNavigation),i=r?.targetBrowserUrl??r?.extractedUrl;return e.toString()!==i?.toString()&&!r?.extras.skipLocationChange}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function Go$1(t){return t!==Ce$2}function Rn$2(t){if(t.newlyCreatedRoutes)for(let n of t.newlyCreatedRoutes)n._localInjector?.destroy();}var oi$2=new N$7("");var ai$2=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(Wo$1)})}return t})(),Nt$3=class Nt{shouldDetach(n){return false}store(n,e){}shouldAttach(n){return false}retrieve(n){return null}shouldReuseRoute(n,e){return n.routeConfig===e.routeConfig}shouldDestroyInjector(n){return true}},Wo$1=(()=>{class t extends Nt$3{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})(),Ot$2=(()=>{class t{urlSerializer=w$4(re$1);options=w$4(ne$2,{optional:true})||{};canceledNavigationResolution=this.options.canceledNavigationResolution||"replace";location=w$4(Fi$4);urlHandlingStrategy=w$4(_t$2);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";currentUrlTree=new U$1;getCurrentUrlTree(){return this.currentUrlTree}rawUrlTree=this.currentUrlTree;getRawUrlTree(){return this.rawUrlTree}createBrowserPath({finalUrl:e,initialUrl:r,targetBrowserUrl:i}){let o=e!==void 0?this.urlHandlingStrategy.merge(e,r):r,a=i??o;return a instanceof U$1?this.urlSerializer.serialize(a):a}routerUrlState(e){return e?.targetBrowserUrl===void 0||e?.finalUrl===void 0?{}:{\u0275routerUrl:this.urlSerializer.serialize(e.finalUrl)}}commitTransition({targetRouterState:e,finalUrl:r,initialUrl:i}){r&&e?(this.currentUrlTree=r,this.rawUrlTree=this.urlHandlingStrategy.merge(r,i),this.routerState=e):this.rawUrlTree=i;}routerState=kn$3(null,w$4(me$5));getRouterState(){return this.routerState}_stateMemento=this.createStateMemento();get stateMemento(){return this._stateMemento}updateStateMemento(){this._stateMemento=this.createStateMemento();}createStateMemento(){return {rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}restoredState(){return this.location.getState()}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(Qo$2)})}return t})(),Qo$2=(()=>{class t extends Ot$2{currentPageId=0;lastSuccessfulId=-1;get browserPageId(){return this.canceledNavigationResolution!=="computed"?this.currentPageId:this.restoredState()?.\u0275routerPageId??this.currentPageId}registerNonRouterCurrentEntryChangeListener(e){return this.location.subscribe(r=>{r.type==="popstate"&&setTimeout(()=>{e(r.url,r.state,"popstate",{replaceUrl:true});});})}handleRouterEvent(e,r){e instanceof te$3?this.updateStateMemento():e instanceof B$2?this.commitTransition(r):e instanceof $e$3?this.urlUpdateStrategy==="eager"&&(r.extras.skipLocationChange||this.setBrowserUrl(this.createBrowserPath(r),r)):e instanceof Ae$1?(this.commitTransition(r),this.urlUpdateStrategy==="deferred"&&!r.extras.skipLocationChange&&this.setBrowserUrl(this.createBrowserPath(r),r)):e instanceof k$1&&!jn$2(e)?this.restoreHistory(r):e instanceof le$1?this.restoreHistory(r,true):e instanceof $$2&&(this.lastSuccessfulId=e.id,this.currentPageId=this.browserPageId);}setBrowserUrl(e,r){let{extras:i,id:o}=r,{replaceUrl:a,state:c}=i;if(this.location.isCurrentPathEqualTo(e)||a){let s=this.browserPageId,u=G$b(G$b({},c),this.generateNgRouterState(o,s,r));this.location.replaceState(e,"",u);}else {let s=G$b(G$b({},c),this.generateNgRouterState(o,this.browserPageId+1,r));this.location.go(e,"",s);}}restoreHistory(e,r=false){if(this.canceledNavigationResolution==="computed"){let i=this.browserPageId,o=this.currentPageId-i;o!==0?this.location.historyGo(o):this.getCurrentUrlTree()===e.finalUrl&&o===0&&(this.resetInternalState(e),this.resetUrlToCurrentUrlTree());}else this.canceledNavigationResolution==="replace"&&(r&&this.resetInternalState(e),this.resetUrlToCurrentUrlTree());}resetInternalState({finalUrl:e}){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,e??this.rawUrlTree);}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId));}generateNgRouterState(e,r,i){return this.canceledNavigationResolution==="computed"?G$b({navigationId:e,\u0275routerPageId:r},this.routerUrlState(i)):G$b({navigationId:e},this.routerUrlState(i))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function Pt$1(t,n){t.events.pipe(fn$7(e=>e instanceof $$2||e instanceof k$1||e instanceof le$1||e instanceof B$2),ke$3(e=>e instanceof $$2||e instanceof B$2?0:(e instanceof k$1?e.code===I$1.Redirect||e.code===I$1.SupersededByNewNavigation:false)?2:1),fn$7(e=>e!==2),_t$9(1)).subscribe(()=>{n();});}var G$3=(()=>{class t{get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}disposed=false;nonRouterCurrentEntryChangeSubscription;console=w$4(Iw);stateManager=w$4(Ot$2);options=w$4(ne$2,{optional:true})||{};pendingTasks=w$4(yt$b);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";navigationTransitions=w$4(Ut$2);urlSerializer=w$4(re$1);location=w$4(Fi$4);urlHandlingStrategy=w$4(_t$2);injector=w$4(me$5);_events=new te$9;get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}navigated=false;routeReuseStrategy=w$4(ai$2);injectorCleanup=w$4(oi$2,{optional:true});onSameUrlNavigation=this.options.onSameUrlNavigation||"ignore";config=w$4(fe$2,{optional:true})?.flat()??[];componentInputBindingEnabled=!!w$4(Ge$2,{optional:true});currentNavigation=this.navigationTransitions.currentNavigation.asReadonly();constructor(){this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this).subscribe({error:e=>{}}),this.subscribeToNavigationEvents();}eventsSubscription=new j$5;subscribeToNavigationEvents(){let e=this.navigationTransitions.events.subscribe(r=>{try{let i=this.navigationTransitions.currentTransition,o=ge$5(this.navigationTransitions.currentNavigation);if(i!==null&&o!==null){if(this.stateManager.handleRouterEvent(r,o),r instanceof k$1&&r.code!==I$1.Redirect&&r.code!==I$1.SupersededByNewNavigation)this.navigated=!0;else if(r instanceof $$2)this.navigated=!0,this.injectorCleanup?.(this.routeReuseStrategy,this.routerState,this.config);else if(r instanceof Ee$1){let a=r.navigationBehaviorOptions,c=this.urlHandlingStrategy.merge(r.url,i.currentRawUrl),s=G$b({scroll:i.extras.scroll,browserUrl:i.extras.browserUrl,info:i.extras.info,skipLocationChange:i.extras.skipLocationChange,replaceUrl:i.extras.replaceUrl||this.urlUpdateStrategy==="eager"||Go$1(i.source)},a);this.scheduleNavigation(c,Ce$2,null,s,{resolve:i.resolve,reject:i.reject,promise:i.promise});}}Gi$2(r)&&this._events.next(r);}catch(i){this.navigationTransitions.transitionAbortWithErrorSubject.next(i);}});this.eventsSubscription.add(e);}resetRootComponentType(e){this.routerState.root.component=e,this.navigationTransitions.rootComponentType=e;}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(true),Ce$2,this.stateManager.restoredState(),{replaceUrl:true});}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??=this.stateManager.registerNonRouterCurrentEntryChangeListener((e,r,i,o)=>{this.navigateToSyncWithBrowser(e,i,r,o);});}navigateToSyncWithBrowser(e,r,i,o){let a=i?.navigationId?i:null,c=i?.\u0275routerUrl??e;if(i?.\u0275routerUrl&&(o=z$5(G$b({},o),{browserUrl:e})),i){let u=G$b({},i);delete u.navigationId,delete u.\u0275routerPageId,delete u.\u0275routerUrl,Object.keys(u).length!==0&&(o.state=u);}let s=this.parseUrl(c);this.scheduleNavigation(s,r,a,o).catch(u=>{this.disposed||this.injector.get(qt$9)(u);});}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return ge$5(this.navigationTransitions.currentNavigation)}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(e){this.config=e.map(Sr$3),this.navigated=false;}ngOnDestroy(){this.dispose();}dispose(){this._events.unsubscribe(),this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription?.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0,this.disposed=true,this.eventsSubscription.unsubscribe();}createUrlTree(e,r={}){let{relativeTo:i,queryParams:o,fragment:a,queryParamsHandling:c,preserveFragment:s}=r,u=s?this.currentUrlTree.fragment:a,h=null;switch(c??this.options.defaultQueryParamsHandling){case "merge":h=G$b(G$b({},this.currentUrlTree.queryParams),o);break;case "preserve":h=this.currentUrlTree.queryParams;break;default:h=o||null;}h!==null&&(h=this.removeEmptyProps(h));let v;try{let g=i?i.snapshot:this.routerState.snapshot.root;v=On$2(g);}catch(g){(typeof e[0]!="string"||e[0][0]!=="/")&&(e=[]),v=this.currentUrlTree.root;}return Pn$3(v,e,h,u??null,this.urlSerializer)}navigateByUrl(e,r={skipLocationChange:false}){let i=ee$3(e)?e:this.parseUrl(e),o=this.urlHandlingStrategy.merge(i,this.rawUrlTree);return this.scheduleNavigation(o,Ce$2,null,r)}navigate(e,r={skipLocationChange:false}){return Ko$1(e),this.navigateByUrl(this.createUrlTree(e,r),r)}serializeUrl(e){return this.urlSerializer.serialize(e)}parseUrl(e){try{return this.urlSerializer.parse(e)}catch(r){return this.console.warn(er$5(4018,false)),this.urlSerializer.parse("/")}}isActive(e,r){let i;if(r===true?i=G$b({},In$3):r===false?i=G$b({},nr$3):i=G$b(G$b({},nr$3),r),ee$3(e))return dn$3(this.currentUrlTree,e,i);let o=this.parseUrl(e);return dn$3(this.currentUrlTree,o,i)}removeEmptyProps(e){return Object.entries(e).reduce((r,[i,o])=>(o!=null&&(r[i]=o),r),{})}scheduleNavigation(e,r,i,o,a){if(this.disposed)return Promise.resolve(false);let c,s,u;a?(c=a.resolve,s=a.reject,u=a.promise):u=new Promise((v,g)=>{c=v,s=g;});let h=this.pendingTasks.add();return Pt$1(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(h));}),this.navigationTransitions.handleNavigationRequest({source:r,restoredState:i,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:e,extras:o,resolve:c,reject:s,promise:u,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),u.catch(Promise.reject.bind(Promise))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function Ko$1(t){for(let n=0;n<t.length;n++)if(t[n]==null)throw new b$2(4008,false)}var Zo$2=(()=>{class t{router=w$4(G$3);stateManager=w$4(Ot$2);fragment=vt$9("");queryParams=vt$9({});path=vt$9("");serializer=w$4(re$1);constructor(){this.updateState(),this.router.events?.subscribe(e=>{e instanceof $$2&&this.updateState();});}updateState(){let{fragment:e,root:r,queryParams:i}=this.stateManager.getCurrentUrlTree();this.fragment.set(e),this.queryParams.set(i),this.path.set(this.serializer.serialize(new U$1(r)));}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})(),si$2=(()=>{class t{router;route;tabIndexAttribute;renderer;el;locationStrategy;hrefAttributeValue=w$4(new Lg("href"),{optional:true});reactiveHref=vl$2(()=>this.isAnchorElement?this.computeHref(this._urlTree()):this.hrefAttributeValue);get href(){return ge$5(this.reactiveHref)}set href(e){this.reactiveHref.set(e);}set target(e){this._target.set(e);}get target(){return ge$5(this._target)}_target=vt$9(void 0);set queryParams(e){this._queryParams.set(e);}get queryParams(){return ge$5(this._queryParams)}_queryParams=vt$9(void 0,{equal:()=>false});set fragment(e){this._fragment.set(e);}get fragment(){return ge$5(this._fragment)}_fragment=vt$9(void 0);set queryParamsHandling(e){this._queryParamsHandling.set(e);}get queryParamsHandling(){return ge$5(this._queryParamsHandling)}_queryParamsHandling=vt$9(void 0);set state(e){this._state.set(e);}get state(){return ge$5(this._state)}_state=vt$9(void 0,{equal:()=>false});set info(e){this._info.set(e);}get info(){return ge$5(this._info)}_info=vt$9(void 0,{equal:()=>false});set relativeTo(e){this._relativeTo.set(e);}get relativeTo(){return ge$5(this._relativeTo)}_relativeTo=vt$9(void 0);set preserveFragment(e){this._preserveFragment.set(e);}get preserveFragment(){return ge$5(this._preserveFragment)}_preserveFragment=vt$9(false);set skipLocationChange(e){this._skipLocationChange.set(e);}get skipLocationChange(){return ge$5(this._skipLocationChange)}_skipLocationChange=vt$9(false);set replaceUrl(e){this._replaceUrl.set(e);}get replaceUrl(){return ge$5(this._replaceUrl)}_replaceUrl=vt$9(false);browserUrl=Hj(void 0);isAnchorElement;onChanges=new te$9;applicationErrorHandler=w$4(qt$9);options=w$4(ne$2,{optional:true});reactiveRouterState=w$4(Zo$2);constructor(e,r,i,o,a,c){this.router=e,this.route=r,this.tabIndexAttribute=i,this.renderer=o,this.el=a,this.locationStrategy=c;let s=a.nativeElement.tagName?.toLowerCase();this.isAnchorElement=s==="a"||s==="area"||!!(typeof customElements=="object"&&customElements.get(s)?.observedAttributes?.includes?.("href"));}setTabIndexIfNotOnNativeEl(e){this.tabIndexAttribute!=null||this.isAnchorElement||this.applyAttributeValue("tabindex",e);}ngOnChanges(e){this.onChanges.next(this);}routerLinkInput=vt$9(null);set routerLink(e){e==null?(this.routerLinkInput.set(null),this.setTabIndexIfNotOnNativeEl(null)):(ee$3(e)?this.routerLinkInput.set(e):this.routerLinkInput.set(Array.isArray(e)?e:[e]),this.setTabIndexIfNotOnNativeEl("0"));}onClick(e,r,i,o,a){let c=this._urlTree();if(c===null||this.isAnchorElement&&(e!==0||r||i||o||a||typeof this.target=="string"&&this.target!="_self"))return true;let s=this.browserUrl(),u=G$b({skipLocationChange:this.skipLocationChange,replaceUrl:this.replaceUrl,state:this.state,info:this.info},s!==void 0&&{browserUrl:s});return this.router.navigateByUrl(c,u)?.catch(h=>{this.applicationErrorHandler(h);}),!this.isAnchorElement}ngOnDestroy(){}applyAttributeValue(e,r){let i=this.renderer,o=this.el.nativeElement;r!==null?i.setAttribute(o,e,r):i.removeAttribute(o,e);}_urlTree=Dt$9(()=>{this.reactiveRouterState.path(),this._preserveFragment()&&this.reactiveRouterState.fragment();let e=i=>i==="preserve"||i==="merge";(e(this._queryParamsHandling())||e(this.options?.defaultQueryParamsHandling))&&this.reactiveRouterState.queryParams();let r=this.routerLinkInput();return r===null||!this.router.createUrlTree?null:ee$3(r)?r:this.router.createUrlTree(r,{relativeTo:this._relativeTo()!==void 0?this._relativeTo():this.route,queryParams:this._queryParams(),fragment:this._fragment(),queryParamsHandling:this._queryParamsHandling(),preserveFragment:this._preserveFragment()})},{equal:(e,r)=>this.computeHref(e)===this.computeHref(r)});get urlTree(){return ge$5(this._urlTree)}computeHref(e){return e!==null&&this.locationStrategy?this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(e))??"":null}static \u0275fac=function(r){return new(r||t)(Ur$4(G$3),Ur$4(V),Bf$1("tabindex"),Ur$4(tD),Ur$4(Lr$5),Ur$4(et$e))};static \u0275dir=nw({type:t,selectors:[["","routerLink",""]],hostVars:2,hostBindings:function(r,i){r&1&&Qh("click",function(a){return i.onClick(a.button,a.ctrlKey,a.shiftKey,a.altKey,a.metaKey)}),r&2&&Hh("href",i.reactiveHref(),wI)("target",i._target());},inputs:{target:"target",queryParams:"queryParams",fragment:"fragment",queryParamsHandling:"queryParamsHandling",state:"state",info:"info",relativeTo:"relativeTo",preserveFragment:[2,"preserveFragment","preserveFragment",Zj],skipLocationChange:[2,"skipLocationChange","skipLocationChange",Zj],replaceUrl:[2,"replaceUrl","replaceUrl",Zj],browserUrl:[1,"browserUrl"],routerLink:"routerLink"},features:[lv]})}return t})();var Qe$1=class Qe{};var ci$3=(()=>{class t{router;injector;preloadingStrategy;loader;subscription;constructor(e,r,i,o){this.router=e,this.injector=r,this.preloadingStrategy=i,this.loader=o;}setUpPreloading(){this.subscription=this.router.events.pipe(fn$7(e=>e instanceof $$2),mu(()=>this.preload())).subscribe(()=>{});}preload(){return this.processRoutes(this.injector,this.router.config)}ngOnDestroy(){this.subscription?.unsubscribe();}processRoutes(e,r){let i=[];for(let o of r){o.providers&&!o._injector&&(o._injector=Th(o.providers,e,""));let a=o._injector??e;o._loadedNgModuleFactory&&!o._loadedInjector&&(o._loadedInjector=o._loadedNgModuleFactory.create(a).injector);let c=o._loadedInjector??a;(o.loadChildren&&!o._loadedRoutes&&o.canLoad===void 0||o.loadComponent&&!o._loadedComponent)&&i.push(this.preloadConfig(a,o)),(o.children||o._loadedRoutes)&&i.push(this.processRoutes(c,o.children??o._loadedRoutes));}return Pe$4(i).pipe(qn$5())}preloadConfig(e,r){return this.preloadingStrategy.preload(r,()=>{if(e.destroyed)return Tm(null);let i;r.loadChildren&&r.canLoad===void 0?i=Pe$4(this.loader.loadChildren(e,r)):i=Tm(null);let o=i.pipe(Te$5(a=>a===null?Tm(void 0):(r._loadedRoutes=a.routes,r._loadedInjector=a.injector,r._loadedNgModuleFactory=a.factory,this.processRoutes(a.injector??e,a.routes))));if(r.loadComponent&&!r._loadedComponent){let a=this.loader.loadComponent(e,r);return Pe$4([o,a]).pipe(qn$5())}else return o})}static \u0275fac=function(r){return new(r||t)(se$8(G$3),se$8(me$5),se$8(Qe$1),se$8(Dt$1))};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),ui$4=new N$7(""),Jo$2=(()=>{class t{options;routerEventsSubscription;scrollEventsSubscription;lastId=0;lastSource=Ce$2;restoredId=0;store={};isHydrating=w$4(Lv,{optional:true})??false;urlSerializer=w$4(re$1);zone=w$4(ue$7);viewportScroller=w$4(Rd);transitions=w$4(Ut$2);constructor(e){this.options=e,this.options.scrollPositionRestoration||="disabled",this.options.anchorScrolling||="disabled",this.isHydrating&&w$4(qr$4).whenStable().then(()=>{this.isHydrating=false;});}init(){this.options.scrollPositionRestoration!=="disabled"&&this.viewportScroller.setHistoryScrollRestoration("manual"),this.routerEventsSubscription=this.createScrollEvents(),this.scrollEventsSubscription=this.consumeScrollEvents();}createScrollEvents(){return this.transitions.events.subscribe(e=>{e instanceof te$3?(this.store[this.lastId]=this.viewportScroller.getScrollPosition(),this.lastSource=e.navigationTrigger,this.restoredId=e.restoredState?e.restoredState.navigationId:0):e instanceof $$2?(this.lastId=e.id,this.scheduleScrollEvent(e,this.urlSerializer.parse(e.urlAfterRedirects).fragment)):e instanceof B$2&&e.code===be$1.IgnoredSameUrlNavigation&&(this.lastSource=void 0,this.restoredId=0,this.scheduleScrollEvent(e,this.urlSerializer.parse(e.url).fragment));})}consumeScrollEvents(){return this.transitions.events.subscribe(e=>{if(!(e instanceof Ie$1)||e.scrollBehavior==="manual")return;let r={behavior:"instant"};e.position?this.options.scrollPositionRestoration==="top"?this.viewportScroller.scrollToPosition([0,0],r):this.options.scrollPositionRestoration==="enabled"&&this.viewportScroller.scrollToPosition(e.position,r):e.anchor&&this.options.anchorScrolling==="enabled"?this.viewportScroller.scrollToAnchor(e.anchor):this.options.scrollPositionRestoration!=="disabled"&&this.viewportScroller.scrollToPosition([0,0]);})}scheduleScrollEvent(e,r){if(this.isHydrating)return;let i=ge$5(this.transitions.currentNavigation)?.extras.scroll;this.zone.runOutsideAngular(()=>Zr$4(this,null,function*(){yield new Promise(o=>{setTimeout(o),typeof requestAnimationFrame<"u"&&requestAnimationFrame(o);}),this.zone.run(()=>{this.transitions.events.next(new Ie$1(e,this.lastSource==="popstate"?this.store[this.restoredId]:null,r,i));});}));}ngOnDestroy(){this.routerEventsSubscription?.unsubscribe(),this.scrollEventsSubscription?.unsubscribe();}static \u0275fac=function(r){gD();};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();function Xo$2(t,...n){return ar$6([{provide:fe$2,multi:true,useValue:t},{provide:V,useFactory:li$3},{provide:Fh$1,multi:true,useFactory:hi$4},n.map(e=>e.\u0275providers)])}function li$3(){return w$4(G$3).routerState.root}function _e$1(t,n){return {\u0275kind:t,\u0275providers:n}}function hi$4(){let t=w$4(be$5);return n=>{let e=t.get(qr$4);if(n!==e.components[0])return;let r=t.get(G$3),i=t.get(di$3);t.get(Er$3)===1&&r.initialNavigation(),t.get(gi$4,null,{optional:true})?.setUpPreloading(),t.get(ui$4,null,{optional:true})?.init(),r.resetRootComponentType(e.componentTypes[0]),i.closed||(i.next(),i.complete(),i.unsubscribe());}}var di$3=new N$7("",{factory:()=>new te$9}),Er$3=new N$7("",{factory:()=>1});function fi$4(){let t=[{provide:Fv,useValue:true},{provide:Er$3,useValue:0},iw(()=>{let n=w$4(be$5);return n.get(fa$4,Promise.resolve()).then(()=>new Promise(r=>{let i=n.get(G$3),o=n.get(di$3);Pt$1(i,()=>{r(true);}),n.get(Ut$2).afterPreactivation=()=>(r(true),o.closed?Tm(void 0):o),i.initialNavigation();}))})];return _e$1(2,t)}function pi$3(){let t=[iw(()=>{w$4(G$3).setUpLocationChangeListener();}),{provide:Er$3,useValue:2}];return _e$1(3,t)}var gi$4=new N$7("");function vi$4(t){return _e$1(0,[{provide:gi$4,useExisting:ci$3},{provide:Qe$1,useExisting:t}])}function ea$3(){return _e$1(6,[{provide:et$e,useClass:ba$4}])}function mi$3(t={}){return _e$1(8,[{provide:Ge$2,useFactory:()=>new Fn$2(t)}])}function yi$3(t){Re$7("NgRouterViewTransitions");let n=[{provide:wr$3,useValue:ni$2},{provide:br$3,useValue:G$b({skipNextTransition:false},t)}];return _e$1(9,n)}var Ri$3=[Fi$4,{provide:re$1,useClass:K$2},G$3,de$2,{provide:V,useFactory:li$3},Dt$1],ta$3=(()=>{class t{constructor(){}static forRoot(e,r){return {ngModule:t,providers:[Ri$3,[],{provide:fe$2,multi:true,useValue:e},[],r?.errorHandler?{provide:Ir$3,useValue:r.errorHandler}:[],{provide:ne$2,useValue:r||{}},r?.useHash?na$3():ia$3(),ra$3(),r?.preloadingStrategy?vi$4(r.preloadingStrategy).\u0275providers:[],r?.initialNavigation?oa$3(r):[],r?.bindToComponentInputs?mi$3(typeof r.bindToComponentInputs=="object"?r.bindToComponentInputs:{}).\u0275providers:[],r?.enableViewTransitions?yi$3().\u0275providers:[],aa$3()]}}static forChild(e){return {ngModule:t,providers:[{provide:fe$2,multi:true,useValue:e}]}}static \u0275fac=function(r){return new(r||t)};static \u0275mod=bh$1({type:t});static \u0275inj=Qs$2({})}return t})();function ra$3(){return {provide:ui$4,useFactory:()=>{let t=w$4(Rd),n=w$4(ne$2);return n.scrollOffset&&t.setOffset(n.scrollOffset),new Jo$2(n)}}}function na$3(){return {provide:et$e,useClass:ba$4}}function ia$3(){return {provide:et$e,useClass:xi$5}}function oa$3(t){return [t.initialNavigation==="disabled"?pi$3().\u0275providers:[],t.initialNavigation==="enabledBlocking"?fi$4().\u0275providers:[]]}var Ar$3=new N$7("");function aa$3(){return [{provide:Ar$3,useFactory:hi$4},{provide:Fh$1,multi:true,useExisting:Ar$3}]}
6634
+ `],encapsulation:2})}return i})(),yt$3=(()=>{class i{static \u0275fac=function(e){return new(e||i)};static \u0275mod=bh$1({type:i});static \u0275inj=Qs$2({imports:[Fn$5]})}return i})();var n$1=(function(r){return r.Normal="normal",r.Nominal="nominal",r.Alert="alert",r.Warn="warn",r.Alarm="alarm",r.Emergency="emergency",r})(n$1||{});var o=(function(r){return r.Visual="visual",r.Sound="sound",r})(o||{});var G$5={url:"",deserializer:r=>JSON.parse(r.data),serializer:r=>JSON.stringify(r)},H$2="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",W$1=class r extends eo$4{constructor(c,e){if(super(),this._socket=null,c instanceof S$5)this.destination=e,this.source=c;else {let t=this._config=Object.assign({},G$5);if(this._output=new te$9,typeof c=="string")t.url=c;else for(let i in c)c.hasOwnProperty(i)&&(t[i]=c[i]);if(!t.WebSocketCtor&&WebSocket)t.WebSocketCtor=WebSocket;else if(!t.WebSocketCtor)throw new Error("no WebSocket constructor can be found");this.destination=new $n$4;}}lift(c){let e=new r(this._config,this.destination);return e.operator=c,e.source=this,e}_resetState(){this._socket=null,this.source||(this.destination=new $n$4),this._output=new te$9;}multiplex(c,e,t){let i=this;return new S$5(s=>{try{i.next(c());}catch(n){s.error(n);}let a=i.subscribe({next:n=>{try{t(n)&&s.next(n);}catch(o){s.error(o);}},error:n=>s.error(n),complete:()=>s.complete()});return ()=>{try{i.next(e());}catch(n){s.error(n);}a.unsubscribe();}})}_connectSocket(){let{WebSocketCtor:c,protocol:e,url:t,binaryType:i}=this._config,s=this._output,a=null;try{a=e?new c(t,e):new c(t),this._socket=a,i&&(this._socket.binaryType=i);}catch(o){s.error(o);return}let n=new j$5(()=>{this._socket=null,a&&a.readyState===1&&a.close();});a.onopen=o=>{let{_socket:l}=this;if(!l){a.close(),this._resetState();return}let{openObserver:d}=this._config;d&&d.next(o);let S=this.destination;this.destination=bt$a.create(h=>{if(a.readyState===1)try{let{serializer:f}=this._config;a.send(f(h));}catch(f){this.destination.error(f);}},h=>{let{closingObserver:f}=this._config;f&&f.next(void 0),h&&h.code?a.close(h.code,h.reason):s.error(new TypeError(H$2)),this._resetState();},()=>{let{closingObserver:h}=this._config;h&&h.next(void 0),a.close(),this._resetState();}),S&&S instanceof $n$4&&n.add(S.subscribe(this.destination));},a.onerror=o=>{this._resetState(),s.error(o);},a.onclose=o=>{a===this._socket&&this._resetState();let{closeObserver:l}=this._config;l&&l.next(o),o.wasClean?s.complete():s.error(o);},a.onmessage=o=>{try{let{deserializer:l}=this._config;s.next(l(o));}catch(l){s.error(l);}};}_subscribe(c){let{source:e}=this;return e?e.subscribe(c):(this._socket||this._connectSocket(),this._output.subscribe(c),c.add(()=>{let{_socket:t}=this;this._output.observers.length===0&&(t&&(t.readyState===1||t.readyState===0)&&t.close(),this._resetState());}),c)}unsubscribe(){let{_socket:c}=this;c&&(c.readyState===1||c.readyState===0)&&c.close(),this._resetState(),super.unsubscribe();}};function x$3(r){return new W$1(r)}var I$2=(()=>{class r{_destroyRef=w$4(xe$3);_skRequests$=new te$9;_skNotificationsMsg$=new te$9;_skValue$=new te$9;_skMetadata$=new te$9;_vesselSelfUrn$=new te$9;_selfUrn;streamEndpoint={operation:0,message:"Not connected",hasToken:false};streamEndpoint$=new Bn$5(this.streamEndpoint);endpointWS=null;SubscriptionType="self";WS_CONNECTION_SUBSCRIBE="?subscribe=";WS_CONNECTION_META="&sendMeta=all";socketWS$=null;socketWSCloseEvent$=new te$9;socketWSOpenEvent$=new te$9;authToken=null;server=w$4(T$2);auth=w$4(He$4);connectionStateMachine=w$4(We$3);FLATTEN_CONFIG={maxDepth:3,maxObjectSize:20,enableFlattening:true};DO_NOT_FLATTEN_PATHS=["displays."];constructor(){this.connectionStateMachine.setWebSocketRetryCallback(()=>{console.log("[Delta Service] Executing WebSocket retry via callback"),this.retryWebSocketConnection();}),this.server.serverServiceEndpoint$.pipe(Gp(this._destroyRef)).subscribe(e=>{e.operation===2&&(this.endpointWS=e.WsServiceUrl,e.subscribeAll?this.SubscriptionType="all":this.SubscriptionType="self");}),this.connectionStateMachine.state$.pipe(Gp(this._destroyRef)).subscribe(e=>{switch(e){case l$1.WebSocketConnecting:this.handleWebSocketConnecting();break;case l$1.Connected:break;case l$1.Disconnected:case l$1.WebSocketError:case l$1.PermanentFailure:this.handleDisconnection();break}}),this.auth.authToken$.pipe(Gp(this._destroyRef)).subscribe(e=>{this.authToken!=e&&(this.authToken=e,this.socketWS$&&this.connectionStateMachine.isFullyConnected()&&(this.closeWS("Token changed"),this.connectionStateMachine.startWebSocketConnection()));}),this.socketWSOpenEvent$.pipe(Gp(this._destroyRef)).subscribe(()=>{this.streamEndpoint.message="Connected",this.streamEndpoint.operation=2,this.authToken?console.log("[Delta Service] WebSocket connected with Authorization Token"):console.log("[Delta Service] WebSocket connected without Authorization Token"),this.streamEndpoint$.next(this.streamEndpoint),this.connectionStateMachine.onWebSocketConnected();}),this.socketWSCloseEvent$.pipe(Gp(this._destroyRef)).subscribe(e=>{e.wasClean?(console.log("[Delta Service] WebSocket closed cleanly"),this.streamEndpoint.message="WebSocket closed",this.streamEndpoint.operation=0):(console.log("[Delta Service] WebSocket terminated due to socket error"),this.streamEndpoint.message="WebSocket error",this.streamEndpoint.operation=3,this.connectionStateMachine.onWebSocketError("WebSocket connection lost")),this.streamEndpoint$.next(this.streamEndpoint);}),Ds$3(document,"visibilitychange").pipe(Gp(this._destroyRef)).subscribe(()=>{document.visibilityState==="visible"?(console.log("[Delta Service] App resumed, checking WebSocket connection..."),this.checkAndReconnect("App resumed")):document.visibilityState==="hidden"&&console.log("[Delta Service] App suspended");});}connectWS(e){this.streamEndpoint.message="Connecting",this.streamEndpoint.operation=1,console.log(`[Delta Service] ${e}: WebSocket opening...`),this.streamEndpoint$.next(this.streamEndpoint),this.socketWS$=this.getNewWebSocket(),this.socketWS$.pipe(Gp(this._destroyRef)).subscribe({next:t=>this.processWebsocketMessage(t),error:t=>{console.error("[Delta Service] WebSocket error:",t);}});}retryWebSocketConnection(){if(console.log("[Delta Service] Retrying WebSocket connection"),!this.endpointWS){console.warn("[Delta Service] No WebSocket endpoint available for retry"),this.connectionStateMachine.onWebSocketError("No WebSocket endpoint available");return}this.socketWS$&&this.closeWS("Retrying connection"),this.connectWS("WebSocket retry attempt");}handleWebSocketConnecting(){if(!this.endpointWS){console.warn("[Delta Service] No WebSocket endpoint available"),this.connectionStateMachine.onWebSocketError("No WebSocket endpoint available");return}this.socketWS$&&this.closeWS("Starting new connection"),this.connectWS("ConnectionStateMachine request");}handleDisconnection(){this.socketWS$&&this.closeWS("ConnectionStateMachine disconnection"),this.streamEndpoint.message="Not connected",this.streamEndpoint.operation=0,this.streamEndpoint$.next(this.streamEndpoint);}getNewWebSocket(){let e=this.WS_CONNECTION_SUBSCRIBE+this.SubscriptionType+this.WS_CONNECTION_META;return this.authToken!=null?(e+="&token="+this.authToken.token,this.streamEndpoint.hasToken=true):this.streamEndpoint.hasToken=false,x$3({url:this.endpointWS+e,closeObserver:this.socketWSCloseEvent$,openObserver:this.socketWSOpenEvent$})}closeWS(e){this.socketWS$&&(this.streamEndpoint.operation=4,console.log("[Delta Service] "+e+": WebSocket closing..."),this.socketWS$.complete());}publishDelta(e){this.socketWS$?this.socketWS$.next(e):console.log("[Delta Service] No WebSocket present to send message - dropping message");}processWebsocketMessage(e){if(e.updates){this.parseUpdates(e.updates,e.context);return}if(e.requestId){this._skRequests$.next(e);return}if(e.errorMessage){console.warn("[Delta Service] Service received stream error message: "+e.errorMessage);return}if(e.self){this._selfUrn=e.self,this._vesselSelfUrn$.next(e.self),this.server.setServerInfo(e.name,e.version,e.roles??[]);return}console.warn("[Delta Service] Unknown message type. Message content:"+e);}parseUpdates(e,t){e.forEach(i=>{i.meta!==void 0&&i.meta.forEach(s=>this.parseSkMeta(s,t)),i.values!==void 0&&i.values.forEach(s=>{if(s.path.startsWith("notifications."))this._skNotificationsMsg$.next(s);else if(typeof s.value=="object"&&s.value!==null)if(this.DO_NOT_FLATTEN_PATHS.some(a=>s.path.includes(a))){let a={context:this.resolveContext(t),path:s.path,source:i.$source,timestamp:i.timestamp,value:s.value};this._skValue$.next(a);}else this.FLATTEN_CONFIG.enableFlattening&&this.canFlattenCompletely(s.value,this.FLATTEN_CONFIG.maxDepth,this.FLATTEN_CONFIG.maxObjectSize)?this.flattenObjectValue(s.value,s.path).forEach(n=>{let o={context:this.resolveContext(t),path:n.path,source:i.$source,timestamp:i.timestamp,value:n.value};this._skValue$.next(o);}):Object.keys(s.value).forEach(a=>{let n={context:this.resolveContext(t),path:`${s.path}.${a}`,source:i.$source,timestamp:i.timestamp,value:s.value[a]};this._skValue$.next(n);});else {let a={context:this.resolveContext(t),path:s.path,source:i.$source,timestamp:i.timestamp,value:s.value};this._skValue$.next(a);}});});}canFlattenCompletely(e,t,i,s=0){if(s>=t)return false;if(typeof e!="object"||e===null)return true;let a=Object.keys(e);if(a.length>i)return false;for(let n of a)if(!this.canFlattenCompletely(e[n],t,i,s+1))return false;return true}flattenObjectValue(e,t,i=0){let s=[];if(typeof e!="object"||e===null||i>=this.FLATTEN_CONFIG.maxDepth)return [{path:t,value:e}];let a=Object.keys(e);for(let n of a){let o=t?`${t}.${n}`:n,l=this.flattenObjectValue(e[n],o,i+1);s.push(...l);}return s}parseSkMeta(e,t){if(e.value.properties!==void 0){let i=e.value.properties;Object.keys(i).forEach(s=>{this._skMetadata$.next({context:this.resolveContext(t),path:`${e.path}.${s}`,meta:i[s]});});}else this._skMetadata$.next({context:this.resolveContext(t),path:e.path,meta:e.value});}resolveContext(e){return e??this._selfUrn??"vessels.self"}getDataStreamStatusAsO(){return this.streamEndpoint$.asObservable()}subscribeRequestUpdates(){return this._skRequests$.asObservable()}subscribeNotificationsUpdates(){return this._skNotificationsMsg$.asObservable()}subscribeDataPathsUpdates(){return this._skValue$.asObservable()}subscribeMetadataUpdates(){return this._skMetadata$.asObservable()}subscribeSelfUpdates(){return this._vesselSelfUrn$.asObservable()}checkAndReconnect(e){this.connectionStateMachine.isFullyConnected()?console.log(`[Delta Service] ${e}: Connection is active.`):this.connectionStateMachine.isHTTPConnected()&&this.connectionStateMachine.currentState!==l$1.WebSocketRetrying?(console.log(`[Delta Service] ${e}: WebSocket disconnected, requesting reconnection...`),this.connectionStateMachine.startWebSocketConnection()):console.log(`[Delta Service] ${e}: HTTP not connected, cannot start WebSocket`);}ngOnDestroy(){this.closeWS("App terminated"),this._skRequests$.complete(),this._skNotificationsMsg$.complete(),this._skValue$.complete(),this._skMetadata$.complete(),this._vesselSelfUrn$.complete(),this.streamEndpoint$.complete(),this.socketWSOpenEvent$.complete(),this.socketWSCloseEvent$.complete(),this.socketWS$?.complete();}static \u0275fac=function(t){return new(t||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var Z$1="self",V$1=r=>isFinite(+(r instanceof Date?r:new Date(r)))?!!new RegExp("^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))$").test(r):false,z$1=r=>{if(r)return r==="RFC 3339 (UTC)"?"Date":"number"},L$2=(r,c)=>{let e;return {value:r,get timestamp(){return e===void 0&&(e=c?new Date(c):null),e}}},De$2=(()=>{class r{delta=w$4(I$2);_destroyRef=w$4(xe$3);_deltaUpdatesCounter=0;_deltaUpdatesSubject=new $n$4(10);_isSkDataFullTreeActive=false;_skDataSubject$=new Bn$5([]);_skDataEmitTimer=null;_skDataEmitIntervalMs=200;_dataServiceMeta=[];_dataServiceMetaByPath=new Map;_isSkMetaFullTreeActive=false;_dataServiceMetaSubject$=new Bn$5([]);_skNotificationMsg$=new te$9;_skNotificationMeta$=new te$9;_isReset=new te$9;_pathUpdates$=new te$9;_selfUrn="self";_skData=new Map;_pendingPathStates=new Map;_skDataArrayCache=[];_skDataIndexByPath=new Map;_pathRegister=[];_pathRegisterByPath=new Map;constructor(){ms$4(1e3).pipe(Gp(this._destroyRef)).subscribe(()=>{let e={timestamp:Date.now(),value:this._deltaUpdatesCounter};this._deltaUpdatesSubject.next(e),this._deltaUpdatesCounter=0;}),this.delta.subscribeDataPathsUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{this.updatePathData(e);}),this.delta.subscribeMetadataUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{this.setMeta(e);}),this.delta.subscribeNotificationsUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{let t=e.path.replace("notifications.","self."),i=e.value.state,s=this._skData.get(t);if(s&&s.state!==i){s.state=i,this._pathUpdates$.next({fullPath:t,kind:"state"});let a=this._pathRegisterByPath.get(t);if(a?.length)for(let n of a)n._pathState$.next(s.state);}else s||this._pendingPathStates.set(t,i);this._skNotificationMsg$.next(e);}),this.delta.subscribeSelfUpdates().pipe(Gp(this._destroyRef)).subscribe(e=>{this.setSelfUrn(e);});}getSignalkDeltaUpdateStatistics(){return this._deltaUpdatesSubject.asObservable()}resetSignalKData(){this._skData=new Map,this._pendingPathStates.clear(),this._skDataArrayCache=[],this._skDataIndexByPath.clear(),this._selfUrn="self",this._isReset.next(true);}unsubscribePath(e){let t=this._pathRegister.findIndex(i=>i.path===e);if(t!==-1){let i=this._pathRegister[t];i.combinedSub?.unsubscribe(),i._pathData$?.complete(),i._pathState$?.complete(),i.pathDataUpdate$?.complete(),i.pathMeta$?.complete(),this._pathRegister.splice(t,1);let s=this._pathRegisterByPath.get(e);if(s){let a=s.filter(n=>n!==i);a.length?this._pathRegisterByPath.set(e,a):this._pathRegisterByPath.delete(e);}}}subscribePath(e,t){let i=this._pathRegisterByPath.get(e),s=i?.find(k=>k.path===e&&k.source===t);if(s)return s.pathDataUpdate$;let a=null,n=null,o=null,l=n$1.Normal,d={data:{value:null,timestamp:null},state:l},S=null,h=this._skData.get(e);h&&(a=t==="default"?h.pathValue:h.sources?.[t]?.sourceValue??null,n=t==="default"?h.pathTimestamp:h.sources?.[t]?.sourceTimestamp??null,o=n?new Date(n):null,d={data:{value:a,timestamp:o},state:h.state||l},l=h.state||l,S=h.meta||null);let f={path:e,source:t,_pathData$:new Bn$5(d.data),_pathState$:new Bn$5(d.state),pathDataUpdate$:new Bn$5(d),pathMeta$:new Bn$5(S?dp(S):null)},q=Fm([f._pathData$,f._pathState$]).pipe(ke$3(([k,K])=>({data:k,state:K})));return f.combinedSub=q.subscribe(k=>f.pathDataUpdate$.next(k)),this._pathRegister.push(f),i?i.push(f):this._pathRegisterByPath.set(e,[f]),f.pathDataUpdate$}subscribePathTree(e,t="default"){let i=this.subscribePathTreeWithInitial(e,t);return new S$5(s=>{for(let n of i.initial)s.next(n);let a=i.live$.subscribe(s);return ()=>a.unsubscribe()}).pipe(Gp(this._destroyRef))}subscribePathTreeWithInitial(e,t="default"){let i=this.normalizePathPrefix(e),s=[];for(let n of this._skData.values())n.path.startsWith(i)&&s.push({path:n.path,update:this.buildPathUpdate(n,t)});let a=this._pathUpdates$.pipe(fn$7(n=>n.fullPath.startsWith(i)),ke$3(n=>{let o=this._skData.get(n.fullPath);return o?{path:o.path,update:this.buildPathUpdate(o,t)}:null}),fn$7(n=>n!==null),Gp(this._destroyRef));return {initial:s,live$:a}}updatePathData(e){this._deltaUpdatesCounter++;let t=this.setPathContext(e.context,e.path),i=this._pendingPathStates.get(t),s=this._skData.get(t);if(s)s.defaultSource===void 0&&(s.defaultSource=e.source),s.type===void 0&&e.value!==null&&(s.type=typeof e.value,s.type==="string"&&V$1(e.value)&&(s.type="Date")),s.pathValue=e.value,s.pathTimestamp=e.timestamp,s.sources[e.source]={sourceTimestamp:e.timestamp,sourceValue:e.value};else {let n=e.value===null?void 0:typeof e.value;n==="string"&&V$1(e.value)&&(n="Date"),s={path:t,pathValue:e.value,pathTimestamp:e.timestamp,defaultSource:e.source,type:n,state:i??n$1.Normal,sources:{[e.source]:{sourceTimestamp:e.timestamp,sourceValue:e.value}}},this._skData.set(t,s),i!==void 0&&this._pendingPathStates.delete(t);}let a=this._pathRegisterByPath.get(t)??[];if(a.length){let n=L$2(s.pathValue,s.pathTimestamp),o=a.find(d=>d.source==="default");o&&o._pathData$.next(n);let l=a.find(d=>d.source===e.source);l&&l._pathData$.next(n);}this._isSkDataFullTreeActive&&(this.upsertSkDataCache(s),this.scheduleSkDataFullTreeEmit()),this._pathUpdates$.next({fullPath:t,kind:"data",update:e});}setMeta(e){if(e.path.startsWith("notifications."))this._skNotificationMeta$.next(e);else {let t=this.setPathContext(e.context,e.path),i=this._pendingPathStates.get(t),s=this._skData.get(t);if(s?(s.type==="object"&&e.meta.units&&(s.type=z$1(e.meta.units)),s.meta=Ap({},s.meta,e.meta)):(s={path:t,pathValue:void 0,pathTimestamp:void 0,type:z$1(e.meta.units),state:i??n$1.Normal,defaultSource:void 0,sources:{},meta:e.meta?dp(e.meta):void 0},this._skData.set(t,s),i!==void 0&&this._pendingPathStates.delete(t),this._isSkDataFullTreeActive&&(this.upsertSkDataCache(s),this.scheduleSkDataFullTreeEmit())),!s)return;let a=this._pathRegisterByPath.get(t);if(a?.length)for(let n of a)n.pathMeta$.next(s.meta?dp(s.meta):null);this._isSkMetaFullTreeActive&&(this._dataServiceMetaByPath.set(t,{path:t,meta:s.meta}),this._dataServiceMeta=Array.from(this._dataServiceMetaByPath.values()),this._dataServiceMetaSubject$.next(this._dataServiceMeta));}}startSkMetaFullTree(){this._isSkMetaFullTreeActive=true,this._dataServiceMetaByPath.clear();for(let e of this.getSkDataArray())e.meta!==void 0&&e.path.startsWith("self.")&&this._dataServiceMetaByPath.set(e.path,{path:e.path,meta:e.meta});return this._dataServiceMeta=Array.from(this._dataServiceMetaByPath.values()),this._dataServiceMetaSubject$.next(this._dataServiceMeta),this._dataServiceMetaSubject$}stopSkMetaFullTree(){this._isSkMetaFullTreeActive=false,this._dataServiceMetaSubject$.next([]),this._dataServiceMeta=[],this._dataServiceMetaByPath.clear();}startSkDataFullTree(){return this._isSkDataFullTreeActive=true,this.refreshSkDataCache(),this.emitSkDataFullTree(),this._skDataSubject$}getSkDataArray(){return this._isSkDataFullTreeActive?this._skDataArrayCache:Array.from(this._skData.values())}observePathUpdates(){return this._pathUpdates$.asObservable()}stopSkDataFullTree(){this._isSkDataFullTreeActive=false,this._skDataEmitTimer&&(clearTimeout(this._skDataEmitTimer),this._skDataEmitTimer=null),this._skDataArrayCache=[],this._skDataIndexByPath.clear();}scheduleSkDataFullTreeEmit(){!this._isSkDataFullTreeActive||this._skDataEmitTimer||(this._skDataEmitTimer=setTimeout(()=>{this._skDataEmitTimer=null,this.emitSkDataFullTree();},this._skDataEmitIntervalMs));}emitSkDataFullTree(){this._isSkDataFullTreeActive&&this._skDataSubject$.next(this._skDataArrayCache);}refreshSkDataCache(){this._skDataArrayCache=Array.from(this._skData.values()),this._skDataIndexByPath.clear(),this._skDataArrayCache.forEach((e,t)=>this._skDataIndexByPath.set(e.path,t));}upsertSkDataCache(e){let t=this._skDataIndexByPath.get(e.path);t===void 0?(this._skDataIndexByPath.set(e.path,this._skDataArrayCache.length),this._skDataArrayCache.push(e)):this._skDataArrayCache[t]=e;}setSelfUrn(e){e!==""&&e!==null?(console.debug("[Signal K Data Service] Setting self to: "+e),this._selfUrn=e):console.error("[Signal K Data Service] Invalid self URN: "+e);}setPathContext(e,t){return e!==this._selfUrn?`${e}.${t}`:`${Z$1}.${t}`}normalizePathPrefix(e){let t=e?.trim()??"";return (t.endsWith(".*")||t.endsWith(":*")||t.endsWith("*"))&&(t=t.slice(0,-1)),t&&!t.endsWith(".")&&!t.endsWith(":")&&(t=`${t}.`),t}buildPathUpdate(e,t){let i=t==="default",s=i?e.pathValue:e.sources?.[t]?.sourceValue??null,a=i?e.pathTimestamp:e.sources?.[t]?.sourceTimestamp??null;return {data:L$2(s,a),state:e.state||n$1.Normal}}getPathsByType(e,t){return this.getSkDataArray().filter(i=>i.type===e&&(!t||i.path.startsWith("self"))).map(i=>i.path)}getCachedPaths(e=false){return this.getSkDataArray().map(t=>t.path).filter(t=>!e||t.startsWith("self."))}getPathsAndMetaByType(e,t=false,i=false,s=true){return this.getSkDataArray().filter(a=>{let o=["string","number","boolean","object","undefined","function","symbol","bigint","Date"].includes(e)?a.type===e:a.meta?.type===e,l=!s||a.path.startsWith("self"),d=t===true?a.meta?.supportsPut===true:true,S=i===true?Array.isArray(a.meta?.zones)&&a.meta.zones.length>0:true;return o&&l&&d&&S}).map(a=>({path:a.path,meta:a.meta}))}getPathObject(e){return dp(this._skData.get(e))||null}getPathUnitType(e){return this._skData.get(e)?.meta?.units||null}timeoutPathObservable(e,t){let i=this._pathRegister.find(s=>s.path==e);if(i){let s={data:{value:null,timestamp:null},state:n$1.Normal};["string","Date","number","multiple"].includes(t)&&i.pathDataUpdate$.next(s);}}getNotificationMsgObservable(){return this._skNotificationMsg$.asObservable()}getNotificationMetaObservable(){return this._skNotificationMeta$.asObservable()}getPathMetaObservable(e){return this._pathRegisterByPath.get(e)?.[0]?.pathMeta$.asObservable()||Tm(null)}getPathMeta(e){return this._skData.get(e)?.meta||null}isResetService(){return this._isReset.asObservable()}ngOnDestroy(){this._skDataEmitTimer&&(clearTimeout(this._skDataEmitTimer),this._skDataEmitTimer=null),this._deltaUpdatesSubject?.complete(),this._skNotificationMsg$?.complete(),this._skNotificationMeta$?.complete(),this._isReset?.complete(),this._skDataSubject$?.complete(),this._dataServiceMetaSubject$?.complete(),this._pathUpdates$?.complete();}static \u0275fac=function(t){return new(t||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var h$1={version:"4.8.4"};var N$1=(()=>{class r{static EMPTY_THEME={blue:"",blueDim:"",blueDimmer:"",green:"",greenDim:"",greenDimmer:"",purple:"",purpleDim:"",purpleDimmer:"",yellow:"",yellowDim:"",yellowDimmer:"",pink:"",pinkDim:"",pinkDimmer:"",orange:"",orangeDim:"",orangeDimmer:"",contrast:"",contrastDim:"",contrastDimmer:"",grey:"",greyDim:"",greyDimmer:"",port:"",starboard:"",zoneNominal:"",zoneAlert:"",zoneWarn:"",zoneAlarm:"",zoneEmergency:"",background:"",cardColor:""};MODE_PATH="self.environment.mode";configurableThemeColors=[{label:"Contrast",value:"contrast"},{label:"Blue",value:"blue"},{label:"Green",value:"green"},{label:"Orange",value:"orange"},{label:"Yellow",value:"yellow"},{label:"Pink",value:"pink"},{label:"Purple",value:"purple"},{label:"Grey",value:"grey"}];cssThemeColorRoles$=new Bn$5(r.EMPTY_THEME);_cssThemeColorRoles=r.EMPTY_THEME;_settings=w$4(Gi$3);_data=w$4(De$2);_iconRegistry=w$4(K$4);_sanitizer=w$4(Dr$4);isNightMode=vt$9(false);_useAutoNightMode=Wp(this._settings.getAutoNightModeAsO(),{requireSync:true});_theme=Wp(this._settings.getThemeNameAsO(),{requireSync:true});_redNightMode=Wp(this._settings.getRedNightModeAsO(),{requireSync:true});_environmentMode=Wp(this._data.subscribePath(this.MODE_PATH,"default"));previousEnvironmentMode=null;appVersion=vt$9(h$1.version);browserVersion=vt$9("Unknown");osVersion=vt$9("Unknown");constructor(){this._iconRegistry.addSvgIconSet(this._sanitizer.bypassSecurityTrustResourceUrl("assets/svg/icons.svg")),Fa$5(()=>{this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme");}),Fa$5(()=>{let t=this._environmentMode()?.data?.value;ge$5(()=>{typeof t=="string"&&this.previousEnvironmentMode!==t&&(this.previousEnvironmentMode=t,this._useAutoNightMode()&&(this.isNightMode.set(t==="night"),this.toggleDayNightMode()));});}),Fa$5(()=>{let t=this._redNightMode();ge$5(()=>{t?this.toggleDayNightMode():this.toggleDayNightMode();});}),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue(),this.browserVersion.set(this.getBrowserVersion()),this.osVersion.set(this.getOSVersion()),console.log("*********** KIP Version Information ***********"),console.log(`** App Version: ${this.appVersion()}`),console.log(`** Browser Version: ${this.browserVersion()}`),console.log(`** OS Version: ${this.osVersion()}`),console.log("***********************************************");}readThemeCssRoleVariables(){let t=document.body,e=getComputedStyle(t),n={background:e.getPropertyValue("--mat-sys-background").trim(),cardColor:e.getPropertyValue("--kip-widget-card-background-color").trim(),blue:e.getPropertyValue("--kip-blue-color").trim(),blueDim:e.getPropertyValue("--kip-blue-dim-color").trim(),blueDimmer:e.getPropertyValue("--kip-blue-dimmer-color").trim(),green:e.getPropertyValue("--kip-green-color").trim(),greenDim:e.getPropertyValue("--kip-green-dim-color").trim(),greenDimmer:e.getPropertyValue("--kip-green-dimmer-color").trim(),grey:e.getPropertyValue("--kip-grey-color").trim(),greyDim:e.getPropertyValue("--kip-grey-dim-color").trim(),greyDimmer:e.getPropertyValue("--kip-grey-dimmer-color").trim(),orange:e.getPropertyValue("--kip-orange-color").trim(),orangeDim:e.getPropertyValue("--kip-orange-dim-color").trim(),orangeDimmer:e.getPropertyValue("--kip-orange-dimmer-color").trim(),pink:e.getPropertyValue("--kip-pink-color").trim(),pinkDim:e.getPropertyValue("--kip-pink-dim-color").trim(),pinkDimmer:e.getPropertyValue("--kip-pink-dimmer-color").trim(),purple:e.getPropertyValue("--kip-purple-color").trim(),purpleDim:e.getPropertyValue("--kip-purple-dim-color").trim(),purpleDimmer:e.getPropertyValue("--kip-purple-dimmer-color").trim(),contrast:e.getPropertyValue("--kip-contrast-color").trim(),contrastDim:e.getPropertyValue("--kip-contrast-dim-color").trim(),contrastDimmer:e.getPropertyValue("--kip-contrast-dimmer-color").trim(),yellow:e.getPropertyValue("--kip-yellow-color").trim(),yellowDim:e.getPropertyValue("--kip-yellow-dim-color").trim(),yellowDimmer:e.getPropertyValue("--kip-yellow-dimmer-color").trim(),port:e.getPropertyValue("--kip-port-color").trim(),starboard:e.getPropertyValue("--kip-starboard-color").trim(),zoneNominal:e.getPropertyValue("--kip-zone-nominal-color").trim(),zoneAlert:e.getPropertyValue("--kip-zone-alert-color").trim(),zoneWarn:e.getPropertyValue("--kip-zone-warn-color").trim(),zoneAlarm:e.getPropertyValue("--kip-zone-alarm-color").trim(),zoneEmergency:e.getPropertyValue("--kip-zone-emergency-color").trim()};this.cssThemeColorRoles$.next(n);}get cssThemeColors(){return this._cssThemeColorRoles}setBrightness(t,e=false){let n=document.body;n.style.setProperty("--kip-nightModeBrightness",`${t}`);let y=e?" sepia(0.5) hue-rotate(-30deg)":"";n.style.setProperty("--kip-nightModeFilters",y);}toggleDayNightMode(){this.isNightMode()?this._redNightMode()?(document.body.classList.toggle("night-theme",true),this.setBrightness(1,false)):(this.setBrightness(this._settings.getNightModeBrightness(),true),document.body.classList.remove("night-theme"),this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme")):(document.body.classList.remove("night-theme"),this._theme()==="light-theme"&&document.body.classList.toggle("light-theme",this._theme()==="light-theme"),this.setBrightness(1,false)),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue();}getBrowserVersion(){let t=navigator.userAgent,e="Unknown";return t.includes("Edg")?e=`Edge ${t.match(/Edg\/(\d+)/)?.[1]}`:t.includes("Chrome")&&!t.includes("Edg")&&!t.includes("Chromium")?e=`Chrome ${t.match(/Chrome\/(\d+)/)?.[1]}`:t.includes("Chromium")?e=`Chromium ${t.match(/Chromium\/(\d+)/)?.[1]}`:t.includes("Firefox")?e=`Firefox ${t.match(/Firefox\/(\d+)/)?.[1]}`:t.includes("Safari")&&!t.includes("Chrome")&&!t.includes("Chromium")?e=`Safari ${t.match(/Version\/(\d+)/)?.[1]}`:(t.includes("Opera")||t.includes("OPR"))&&(e=`Opera ${t.match(/(Opera|OPR)\/(\d+)/)?.[2]}`),e}getOSVersion(){let t=navigator.platform,e=navigator.userAgent;return t.startsWith("Mac")?"macOS":t.startsWith("Win")?"Windows":/Linux/.test(t)?e.includes("ARM")||e.includes("aarch64")||e.includes("Raspberry")||t.includes("armv7l")||t.includes("armv8l")?"Raspberry Pi":"Linux":"Unknown OS"}static \u0275fac=function(e){return new(e||r)};static \u0275prov=Q$6({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var E$1=(()=>{class a{http=w$4(yr$5);connection=w$4(T$2);destroyRef=w$4(xe$3);historyServiceUrl=null;constructor(){this.connection.serverServiceEndpoint$.pipe(Gp(this.destroyRef)).subscribe(t=>{let e=t?.httpServiceUrl||null;this.historyServiceUrl=e?e.replace("/v1/","/v2/"):null,this.historyServiceUrl||console.warn("[HistoryApiClientService] History API endpoint not available; history service is disabled");});}getPaths(t){return Zr$4(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let e=`${this.historyServiceUrl}history/paths`,i=new de$8;t?.from&&(i=i.set("from",t.from)),t?.to&&(i=i.set("to",t.to)),t?.duration&&(i=i.set("duration",t.duration.toString()));let s=`${e}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${s}`);let r=yield _m(this.http.get(e,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available paths`),r}catch(e){return console.error("[HistoryApiClientService] History API /paths request failed:",e),null}})}getContexts(t){return Zr$4(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let e=`${this.historyServiceUrl}history/contexts`,i=new de$8;t?.from&&(i=i.set("from",t.from)),t?.to&&(i=i.set("to",t.to)),t?.duration&&(i=i.set("duration",t.duration.toString()));let s=`${e}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${s}`);let r=yield _m(this.http.get(e,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available contexts`),r}catch(e){return console.error("[HistoryApiClientService] History API /contexts request failed:",e),null}})}getValues(t){return Zr$4(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let e=`${this.historyServiceUrl}history/values`,i=new de$8;i=i.set("paths",t.paths),t.context&&(i=i.set("context",t.context)),t.from&&(i=i.set("from",t.from)),t.to&&(i=i.set("to",t.to)),t.duration&&(i=i.set("duration",t.duration.toString())),t.resolution!==void 0&&t.resolution!==null&&(i=i.set("resolution",t.resolution.toString()));let s=`${e}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${s}`);let r=yield _m(this.http.get(e,{params:i}));return console.log(`[HistoryApiClientService] History fetch successful, received ${r.data?.length??0} data points`),r}catch(e){return console.error("[HistoryApiClientService] History API request failed:",e),null}})}getProviders(){return Zr$4(this,null,function*(){let t=`${this.historyServiceUrl}history/_providers`;return yield _m(this.http.get(t)),["kip"]})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=Q$6({token:a,factory:a.\u0275fac,providedIn:"root"})}return a})();var G$4=(()=>{class a{mapValuesToChartDatapoints(t,e){let i=t?.data;if(!i||i.length===0)return [];let s=-1,r=-1;if(t.values&&Array.isArray(t.values)){for(let n=0;n<t.values.length;n++){let c=t.values[n]?.method,l=typeof c=="string"?c.toLowerCase():c;if(!l)continue;let o=n+1;l==="sma"?s=o:(l==="avg"||l==="average")&&(r=o);}r<0&&t.values.length===1&&(r=1);}else i[0]?.length>1&&(r=1);let h=e.unit==="rad",f=h?e.domain==="signed"?this.normalizeToSigned.bind(this):this.normalizeToDirection.bind(this):null,m=[],T=0,I=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,x=0,b=0,H=0,d=[];for(let n of i){if(!Array.isArray(n)||n.length===0)continue;let c=Date.parse(n[0]),l=s>=0?n[s]:null,o=r>=0?n[r]:null;if(h?(l=Number.isFinite(l)?f(l):null,o=Number.isFinite(o)?f(o):null):(l=Number.isFinite(l)?l:null,o=Number.isFinite(o)?o:null),Number.isFinite(o)){let u=o;h?(d.push(u),b+=Math.sin(u),H+=Math.cos(u)):(x++,T+=u,u<I&&(I=u),u>A&&(A=u));}m.push({timestamp:c,data:{value:o,sma:l,ema:null,doubleEma:null,lastAverage:null,lastMinimum:null,lastMaximum:null}});}if(m.length>0){let n=null,c=null,l=null;if(h&&d.length>0){n=Math.atan2(b/d.length,H/d.length);let{min:o,max:u}=this.circularMinMaxRad(d);e.domain==="signed"?(n=this.normalizeToSigned(n),c=this.normalizeToSigned(o),l=this.normalizeToSigned(u)):(n=this.normalizeToDirection(n),c=this.normalizeToDirection(o),l=this.normalizeToDirection(u));}else !h&&x>0&&(n=T/x,c=I,l=A);if(n!==null&&c!==null&&l!==null){let o=m[m.length-1];o.data.lastAverage=n,o.data.lastMinimum=c,o.data.lastMaximum=l;}}return m}circularMinMaxRad(t){if(t.length===0)return {min:0,max:0};let e=t.map(r=>(r*180/Math.PI+360)%360).sort((r,h)=>r-h),i=0,s=0;for(let r=0;r<e.length;r++){let h=(r+1)%e.length,f=(e[h]-e[r]+360)%360;f>i&&(i=f,s=h);}return {min:e[s]*Math.PI/180,max:e[(s-1+e.length)%e.length]*Math.PI/180}}mod(t,e){return (t%e+e)%e}normalizeToDirection(t){let e=2*Math.PI;return this.mod(t,e)}normalizeToSigned(t){let e=2*Math.PI;return this.mod(t+Math.PI,e)-Math.PI}static \u0275fac=function(e){return new(e||a)};static \u0275prov=Q$6({token:a,factory:a.\u0275fac,providedIn:"root"})}return a})();var K$3=(()=>{class g{appSettings=w$4(Gi$3);data=w$4(De$2);history=w$4(E$1);historyChartAdapter=w$4(G$4);historyMinSampleTimeMs=1e3;_svcDatasetConfigs=[];_svcDataSource=[];_svcSubjectObserverRegistry=[];_startAllPromise;signedAnglePaths=new Set(["self.navigation.attitude.roll","self.navigation.attitude.pitch","self.navigation.attitude.yaw","self.environment.wind.angleApparent","self.environment.wind.angleTrueGround","self.environment.wind.angleTrueWater","self.steering.rudderAngle","self.environment.wind.directionTrue.trend.shift"]);constructor(){this._svcDatasetConfigs=this.appSettings.getDataSets(),this.cleanupDatasets(),this._startAllPromise=this.startAll();}cleanupDatasets(){if(this.appSettings.configUpgrade()||this.appSettings.getAppConfig().configVersion<12)return;let e=this.appSettings.getDashboardConfig(),s=new Set;e.forEach(i=>{i.configuration?.length&&i.configuration?.forEach(o=>{o?.id&&s.add(o.id);});});function a(i){let o=i.match(/^(windtrends|speedtrends)-(.+)$/);return o?o[2]:null}let r=[],h=[];for(let i of this._svcDatasetConfigs){let o=i.label||"",n=false;if(o.startsWith("windtrends-")||o.startsWith("speedtrends-")){let c=a(o);n=!!(c&&s.has(c));}else (o.startsWith("simple-chart-")||(o.match(/\|/g)||[]).length===4)&&(n=s.has(i.uuid));n?h.push(i):r.push(i);}r.length&&(r.forEach(i=>{console.warn(`[DatasetStreamService] Cleaned dataset: uuid=${i.uuid}, label="${i.label}"`);}),this._svcDatasetConfigs=h,this.appSettings.saveDataSets(this._svcDatasetConfigs));}setupServiceSubjectRegistry(t,e){let s=this._svcSubjectObserverRegistry.findIndex(a=>a.datasetUuid==t);s>=0&&(this._svcSubjectObserverRegistry[s].rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(s,1)),this._svcSubjectObserverRegistry.push({datasetUuid:t,rxjsSubject:new $n$4(e)});}createDataSourceConfiguration(t){let r=c(t.timeScaleFormat,t.period),h=r>0?Math.max(100,Math.round(r/120)):1e3,i=Math.max(1,Math.ceil(r/h)),o=Math.max(1,Math.floor(i*.25)),n={uuid:t.uuid,pathObserverSubscription:null,sampleTime:h,maxDataPoints:i,smoothingPeriod:o,historicalData:[]};return (!n.maxDataPoints||n.maxDataPoints<1)&&(n.maxDataPoints=1),(!n.sampleTime||n.sampleTime<1)&&(n.sampleTime=1),n;function c(u,l){switch(u){case "Last Minute":return 6e4;case "Last 5 Minutes":return 5*6e4;case "Last 30 Minutes":return 30*6e4;case "day":return Math.max(0,l)*24*60*6e4;case "hour":return Math.max(0,l)*60*6e4;case "minute":return Math.max(0,l)*6e4;case "second":return Math.max(0,l)*1e3;default:return 0}}}waitUntilReady(){return Zr$4(this,null,function*(){return this._startAllPromise})}startAll(){return Zr$4(this,null,function*(){console.log("[DatasetStreamService] Auto Starting "+this._svcDatasetConfigs.length.toString()+" Datasets");for(let t of this._svcDatasetConfigs)yield this.start(t.uuid);})}start(t){return Zr$4(this,null,function*(){let e=this._svcDatasetConfigs.find(c=>c.uuid==t);if(!e){console.warn(`[DatasetStreamService] Dataset UUID:${t} not found`);return}let s=this.createDataSourceConfiguration(e);this.setupServiceSubjectRegistry(s.uuid,s.maxDataPoints);let a=this._svcDataSource[this._svcDataSource.push(s)-1];console.log(`[DatasetStreamService] Starting recording process: ${e.path}, Scale: ${e.timeScaleFormat}, Period: ${e.period}, Datapoints: ${s.maxDataPoints}`);let r=this.resolveAngleDomain(e.path,e.baseUnit),h=Math.max(1,Math.round(s.sampleTime/1e3));this.shouldSeedHistory(s.sampleTime)&&(yield this.seedHistoryData(a,e,h,r));let i=this.data.subscribePath(e.path,e.pathSource).pipe(fn$7(c=>c?.data?.value!==null),Du({bufferSize:1,refCount:true})),o=i.pipe(_t$9(1)),n=We$9(s.sampleTime,s.sampleTime).pipe(iy(i,(c,u)=>u));a.pathObserverSubscription=zm(o,n).subscribe(c=>{a.maxDataPoints>0&&a.historicalData.length>=a.maxDataPoints&&a.historicalData.shift(),a.historicalData.push(c.data.value);let u=this.updateDataset(a,e.baseUnit,r);this._svcSubjectObserverRegistry.find(m=>m.datasetUuid===a.uuid)?.rxjsSubject.next(u);});})}seedHistoryData(t,e,s,a){return Zr$4(this,null,function*(){try{let r=this.buildHistoryPathString(e.path,t.smoothingPeriod),h=(()=>{switch(e.timeScaleFormat){case "Last Minute":return 6e4;case "Last 5 Minutes":return 5*6e4;case "Last 30 Minutes":return 30*6e4;case "day":return Math.max(0,e.period)*24*60*6e4;case "hour":return Math.max(0,e.period)*60*6e4;case "minute":return Math.max(0,e.period)*6e4;case "second":return Math.max(0,e.period)*1e3;default:return 0}})(),i=new Date,o={paths:r,from:new Date(i.getTime()-h).toISOString(),resolution:s},n=yield this.history.getValues(o);if(!n||!n.data||n.data.length===0){console.log(`[DatasetStreamService] No history data available for ${e.path}`);return}let c=this.convertHistoryToDatapoints(n,e.baseUnit,a),u=this._svcSubjectObserverRegistry.find(l=>l.datasetUuid===t.uuid)?.rxjsSubject;if(u&&c.length>0){let l=[];t.historicalData=[],c.forEach(m=>{let d=m.data.value;if(!Number.isFinite(d))return;t.maxDataPoints>0&&t.historicalData.length>=t.maxDataPoints&&t.historicalData.shift(),t.historicalData.push(d);let D=this.updateDataset(t,e.baseUnit,a);D.timestamp=m.timestamp,l.push(D);}),l.forEach(m=>u.next(m)),console.log(`[DatasetStreamService] Seeded ${l.length} history datapoints for ${e.path}`);}}catch(r){console.warn(`[DatasetStreamService] Failed to seed history data for ${e.path}:`,r);}})}stop(t){let e=this._svcDataSource.findIndex(s=>s.uuid==t);e!==-1&&(console.log(`[DatasetStreamService] Stopping Dataset ${t} data capture`),this._svcDataSource[e].pathObserverSubscription?.unsubscribe(),this._svcDataSource.splice(e,1));}list(){return dp(this._svcDatasetConfigs)}getDatasetConfig(t){return this._svcDatasetConfigs.find(e=>e.uuid===t)}getDataSourceInfo(t){return this._svcDataSource.find(e=>e.uuid===t)}create(t,e,s,a,r,h=true,i=true,o){if(!t||!e||!s||!a||!r)return null;let n=o||b.create(),c={uuid:n,path:t,pathSource:e,baseUnit:this.data.getPathUnitType(t)??"",timeScaleFormat:s,period:a,label:r,editable:i};return console.log(`[DatasetStreamService] Creating ${h?"":"non-"}persistent ${i?"":"hidden "}dataset: ${c.uuid}, Path: ${c.path}, Source: ${c.pathSource} Scale: ${c.timeScaleFormat}, Period: ${c.period}`),this._svcDatasetConfigs.push(c),this.start(n),h===true&&this.appSettings.saveDataSets(this._svcDatasetConfigs),n}edit(t,e=true){let s=this._svcDatasetConfigs.find(a=>a.uuid===t.uuid);return s?JSON.stringify(s)===JSON.stringify(t)?(console.log(`[DatasetStreamService] No changes detected for Dataset ${t.uuid}.`),false):(this.stop(t.uuid),console.log(`[DatasetStreamService] Updating Dataset: ${t.uuid}`),t.baseUnit=this.data.getPathUnitType(t.path)??"",this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(a=>a.uuid===t.uuid),1,t),this.start(t.uuid),e===true&&this.appSettings.saveDataSets(this._svcDatasetConfigs),true):false}remove(t,e=true){return !t||t===""||this._svcDatasetConfigs.findIndex(a=>a.uuid===t)===-1?false:(this.stop(t),console.log(`[DatasetStreamService] Removing ${e?"":"non-"}persistent Dataset: ${t}`),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(a=>a.uuid===t),1),this._svcSubjectObserverRegistry.find(a=>a.datasetUuid===t)?.rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(this._svcSubjectObserverRegistry.findIndex(a=>a.datasetUuid===t),1),e===true&&this.appSettings.saveDataSets(this._svcDatasetConfigs),true)}getDatasetObservable(t){let e=this._svcSubjectObserverRegistry.find(s=>s.datasetUuid==t);return e?e.rxjsSubject.asObservable():null}getDatasetBatchThenLiveObservable(t){let e=this._svcSubjectObserverRegistry.find(i=>i.datasetUuid==t);if(!e)return null;let s=e.rxjsSubject,a=s._buffer?s._buffer.slice():[],r=Pe$4([a]),h=s.pipe(wu(a.length));return dn$7(r,h)}updateDataset(t,e,s="scalar"){let a,r,h,i;if(e==="rad"){a=this.circularMeanRad(t.historicalData);let u=t.historicalData.slice(-t.smoothingPeriod);r=this.circularMeanRad(u);let{min:l,max:m}=this.circularMinMaxRad(t.historicalData);s==="direction"?(a=this.normalizeToDirection(a),r=this.normalizeToDirection(r),h=this.normalizeToDirection(l),i=this.normalizeToDirection(m)):s==="signed"?(a=this.normalizeToSigned(a),r=this.normalizeToSigned(r),h=this.normalizeToSigned(l),i=this.normalizeToSigned(m)):(h=l,i=m);}else a=n(t.historicalData),r=c(t.historicalData,t.smoothingPeriod),h=Math.min(...t.historicalData),i=Math.max(...t.historicalData);return {timestamp:Date.now(),data:{value:e==="rad"?s==="signed"?this.normalizeToSigned(t.historicalData[t.historicalData.length-1]):this.normalizeToDirection(t.historicalData[t.historicalData.length-1]):t.historicalData[t.historicalData.length-1],sma:r,lastAverage:a,lastMinimum:h,lastMaximum:i}};function n(u){return u.length===0?void 0:u.reduce((m,d)=>m+d,0)/u.length}function c(u,l){u.length<l&&(l=u.length);let m=0;for(let d=u.length-l;d<u.length;d++)m+=u[d];return m/l}}circularMeanRad(t){if(t.length===0)return 0;let e=t.reduce((a,r)=>a+Math.sin(r),0),s=t.reduce((a,r)=>a+Math.cos(r),0);return Math.atan2(e/t.length,s/t.length)}circularMinMaxRad(t){if(t.length===0)return {min:0,max:0};let e=t.map(i=>(i*180/Math.PI+360)%360).sort((i,o)=>i-o),s=0,a=0;for(let i=0;i<e.length;i++){let o=(i+1)%e.length,n=(e[o]-e[i]+360)%360;n>s&&(s=n,a=o);}let r=e[a]*Math.PI/180,h=e[(a-1+e.length)%e.length]*Math.PI/180;return {min:r,max:h}}resolveAngleDomain(t,e){if(e!=="rad")return "scalar";let s=this.normalizePathKey(t);for(let a of this.signedAnglePaths)if(s===this.normalizePathKey(a))return "signed";return "direction"}normalizePathKey(t){return t.replace(/^vessels\.self\./,"").replace(/^self\./,"")}mod(t,e){return (t%e+e)%e}normalizeToDirection(t){let e=2*Math.PI;return this.mod(t,e)}normalizeToSigned(t){let e=2*Math.PI;return this.mod(t+Math.PI,e)-Math.PI}removeIfExists(t,e=true){return !t||this._svcDatasetConfigs.findIndex(s=>s.uuid===t)===-1?false:this.remove(t,e)}shouldSeedHistory(t){return t>=this.historyMinSampleTimeMs}buildHistoryPathString(t,e){let s=t.replace(/^(vessels\.)?self\./,"");return [`${s}:sma:${e}`,`${s}:avg`,`${s}:min`,`${s}:max`].join(",")}convertHistoryToDatapoints(t,e,s){return this.historyChartAdapter.mapValuesToChartDatapoints(t,{unit:e,domain:s})}ngOnDestroy(){[...this._svcDataSource].forEach(t=>{try{this.stop(t.uuid);}catch(e){}}),this._svcSubjectObserverRegistry.forEach(t=>t.rxjsSubject.complete()),this._svcSubjectObserverRegistry=[];}static \u0275fac=function(e){return new(e||g)};static \u0275prov=Q$6({token:g,factory:g.\u0275fac,providedIn:"root"})}return g})();var f$1="primary",Ve$3=Symbol("RouteTitle"),tr$2=class tr{params;constructor(n){this.params=n||{};}has(n){return Object.prototype.hasOwnProperty.call(this.params,n)}get(n){if(this.has(n)){let e=this.params[n];return Array.isArray(e)?e[0]:e}return null}getAll(n){if(this.has(n)){let e=this.params[n];return Array.isArray(e)?e:[e]}return []}get keys(){return Object.keys(this.params)}};function ue$2(t){return new tr$2(t)}function Zt$3(t,n,e){for(let r=0;r<t.length;r++){let i=t[r],o=n[r];if(i[0]===":")e[i.substring(1)]=o;else if(i!==o.path)return false}return true}function Sn$3(t,n,e){let r=e.path.split("/"),i=r.indexOf("**");if(i===-1){if(r.length>t.length||e.pathMatch==="full"&&(n.hasChildren()||r.length<t.length))return null;let s={},u=t.slice(0,r.length);return Zt$3(r,u,s)?{consumed:u,posParams:s}:null}if(i!==r.lastIndexOf("**"))return null;let o=r.slice(0,i),a=r.slice(i+1);if(o.length+a.length>t.length||e.pathMatch==="full"&&n.hasChildren()&&e.path!=="**")return null;let c={};return !Zt$3(o,t.slice(0,o.length),c)||!Zt$3(a,t.slice(t.length-a.length),c)?null:{consumed:t,posParams:c}}function ht$2(t){return new Promise((n,e)=>{t.pipe(Jm()).subscribe({next:r=>n(r),error:r=>e(r)});})}function Ci$4(t,n){if(t.length!==n.length)return false;for(let e=0;e<t.length;++e)if(!q$1(t[e],n[e]))return false;return true}function q$1(t,n){let e=t?rr$3(t):void 0,r=n?rr$3(n):void 0;if(!e||!r||e.length!=r.length)return false;let i;for(let o=0;o<e.length;o++)if(i=e[o],!Cn$3(t[i],n[i]))return false;return true}function rr$3(t){return [...Object.keys(t),...Object.getOwnPropertySymbols(t)]}function Cn$3(t,n){if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return false;let e=[...t].sort(),r=[...n].sort();return e.every((i,o)=>r[o]===i)}else return t===n}function wi$2(t){return t.length>0?t[t.length-1]:null}function he$3(t){return Cm(t)?t:il$2(t)?Pe$4(Promise.resolve(t)):Tm(t)}function wn$3(t){return Cm(t)?ht$2(t):Promise.resolve(t)}var bi$4={exact:An$2,subset:En$2},bn$3={exact:Ii$2,subset:Ai$2,ignored:()=>true},In$3={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},nr$3={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"};function dn$3(t,n,e){return bi$4[e.paths](t.root,n.root,e.matrixParams)&&bn$3[e.queryParams](t.queryParams,n.queryParams)&&!(e.fragment==="exact"&&t.fragment!==n.fragment)}function Ii$2(t,n){return q$1(t,n)}function An$2(t,n,e){if(!ce$2(t.segments,n.segments)||!ct$2(t.segments,n.segments,e)||t.numberOfChildren!==n.numberOfChildren)return false;for(let r in n.children)if(!t.children[r]||!An$2(t.children[r],n.children[r],e))return false;return true}function Ai$2(t,n){return Object.keys(n).length<=Object.keys(t).length&&Object.keys(n).every(e=>Cn$3(t[e],n[e]))}function En$2(t,n,e){return Tn$2(t,n,n.segments,e)}function Tn$2(t,n,e,r){if(t.segments.length>e.length){let i=t.segments.slice(0,e.length);return !(!ce$2(i,e)||n.hasChildren()||!ct$2(i,e,r))}else if(t.segments.length===e.length){if(!ce$2(t.segments,e)||!ct$2(t.segments,e,r))return false;for(let i in n.children)if(!t.children[i]||!En$2(t.children[i],n.children[i],r))return false;return true}else {let i=e.slice(0,t.segments.length),o=e.slice(t.segments.length);return !ce$2(t.segments,i)||!ct$2(t.segments,i,r)||!t.children[f$1]?false:Tn$2(t.children[f$1],n,o,r)}}function ct$2(t,n,e){return n.every((r,i)=>bn$3[e](t[i].parameters,r.parameters))}var U$1=class U{root;queryParams;fragment;_queryParamMap;constructor(n=new m$1([],{}),e={},r=null){this.root=n,this.queryParams=e,this.fragment=r;}get queryParamMap(){return this._queryParamMap??=ue$2(this.queryParams),this._queryParamMap}toString(){return Ni$2.serialize(this)}},m$1=class m{segments;children;parent=null;constructor(n,e){this.segments=n,this.children=e,Object.values(e).forEach(r=>r.parent=this);}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return ut$3(this)}},X$1=class X{path;parameters;_parameterMap;constructor(n,e){this.path=n,this.parameters=e;}get parameterMap(){return this._parameterMap??=ue$2(this.parameters),this._parameterMap}toString(){return Mn$3(this)}};function Ei$3(t,n){return ce$2(t,n)&&t.every((e,r)=>q$1(e.parameters,n[r].parameters))}function ce$2(t,n){return t.length!==n.length?false:t.every((e,r)=>e.path===n[r].path)}function Ti$3(t,n){let e=[];return Object.entries(t.children).forEach(([r,i])=>{r===f$1&&(e=e.concat(n(i,r)));}),Object.entries(t.children).forEach(([r,i])=>{r!==f$1&&(e=e.concat(n(i,r)));}),e}var re$1=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>new K$2})}return t})(),K$2=class K{parse(n){let e=new or$3(n);return new U$1(e.parseRootSegment(),e.parseQueryParams(),e.parseFragment())}serialize(n){let e=`/${Pe(n.root,true)}`,r=_i$2(n.queryParams),i=typeof n.fragment=="string"?`#${Mi$2(n.fragment)}`:"";return `${e}${r}${i}`}},Ni$2=new K$2;function ut$3(t){return t.segments.map(n=>Mn$3(n)).join("/")}function Pe(t,n){if(!t.hasChildren())return ut$3(t);if(n){let e=t.children[f$1]?Pe(t.children[f$1],false):"",r=[];return Object.entries(t.children).forEach(([i,o])=>{i!==f$1&&r.push(`${i}:${Pe(o,false)}`);}),r.length>0?`${e}(${r.join("//")})`:e}else {let e=Ti$3(t,(r,i)=>i===f$1?[Pe(t.children[f$1],false)]:[`${i}:${Pe(r,false)}`]);return Object.keys(t.children).length===1&&t.children[f$1]!=null?`${ut$3(t)}/${e[0]}`:`${ut$3(t)}/(${e.join("//")})`}}function Nn$1(t){return encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function at$2(t){return Nn$1(t).replace(/%3B/gi,";")}function Mi$2(t){return encodeURI(t)}function ir$2(t){return Nn$1(t).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function lt$4(t){return decodeURIComponent(t)}function fn$3(t){return lt$4(t.replace(/\+/g,"%20"))}function Mn$3(t){return `${ir$2(t.path)}${Di$3(t.parameters)}`}function Di$3(t){return Object.entries(t).map(([n,e])=>`;${ir$2(n)}=${ir$2(e)}`).join("")}function _i$2(t){let n=Object.entries(t).map(([e,r])=>Array.isArray(r)?r.map(i=>`${at$2(e)}=${at$2(i)}`).join("&"):`${at$2(e)}=${at$2(r)}`).filter(e=>e);return n.length?`?${n.join("&")}`:""}var Ui$2=/^[^\/()?;#]+/;function Jt$4(t){let n=t.match(Ui$2);return n?n[0]:""}var Oi$2=/^[^\/()?;=#]+/;function Pi$2(t){let n=t.match(Oi$2);return n?n[0]:""}var Li$2=/^[^=?&#]+/;function xi$3(t){let n=t.match(Li$2);return n?n[0]:""}var ji$2=/^[^&#]+/;function ki$3(t){let n=t.match(ji$2);return n?n[0]:""}var or$3=class or{url;remaining;constructor(n){this.url=n,this.remaining=n;}parseRootSegment(){for(;this.consumeOptional("/"););return this.remaining===""||this.peekStartsWith("?")||this.peekStartsWith("#")?new m$1([],{}):new m$1([],this.parseChildren())}parseQueryParams(){let n={};if(this.consumeOptional("?"))do this.parseQueryParam(n);while(this.consumeOptional("&"));return n}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(n=0){if(n>50)throw new b$2(4010,false);if(this.remaining==="")return {};this.consumeOptional("/");let e=[];for(this.peekStartsWith("(")||e.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),e.push(this.parseSegment());let r={};this.peekStartsWith("/(")&&(this.capture("/"),r=this.parseParens(true,n));let i={};return this.peekStartsWith("(")&&(i=this.parseParens(false,n)),(e.length>0||Object.keys(r).length>0)&&(i[f$1]=new m$1(e,r)),i}parseSegment(){let n=Jt$4(this.remaining);if(n===""&&this.peekStartsWith(";"))throw new b$2(4009,false);return this.capture(n),new X$1(lt$4(n),this.parseMatrixParams())}parseMatrixParams(){let n={};for(;this.consumeOptional(";");)this.parseParam(n);return n}parseParam(n){let e=Pi$2(this.remaining);if(!e)return;this.capture(e);let r="";if(this.consumeOptional("=")){let i=Jt$4(this.remaining);i&&(r=i,this.capture(r));}n[lt$4(e)]=lt$4(r);}parseQueryParam(n){let e=xi$3(this.remaining);if(!e)return;this.capture(e);let r="";if(this.consumeOptional("=")){let a=ki$3(this.remaining);a&&(r=a,this.capture(r));}let i=fn$3(e),o=fn$3(r);if(n.hasOwnProperty(i)){let a=n[i];Array.isArray(a)||(a=[a],n[i]=a),a.push(o);}else n[i]=o;}parseParens(n,e){let r={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){let i=Jt$4(this.remaining),o=this.remaining[i.length];if(o!=="/"&&o!==")"&&o!==";")throw new b$2(4010,false);let a;i.indexOf(":")>-1?(a=i.slice(0,i.indexOf(":")),this.capture(a),this.capture(":")):n&&(a=f$1);let c=this.parseChildren(e+1);r[a??f$1]=Object.keys(c).length===1&&c[f$1]?c[f$1]:new m$1([],c),this.consumeOptional("//");}return r}peekStartsWith(n){return this.remaining.startsWith(n)}consumeOptional(n){return this.peekStartsWith(n)?(this.remaining=this.remaining.substring(n.length),true):false}capture(n){if(!this.consumeOptional(n))throw new b$2(4011,false)}};function Dn$2(t){return t.segments.length>0?new m$1([],{[f$1]:t}):t}function _n$3(t){let n={};for(let[r,i]of Object.entries(t.children)){let o=_n$3(i);if(r===f$1&&o.segments.length===0&&o.hasChildren())for(let[a,c]of Object.entries(o.children))n[a]=c;else (o.segments.length>0||o.hasChildren())&&(n[r]=o);}let e=new m$1(t.segments,n);return $i$2(e)}function $i$2(t){if(t.numberOfChildren===1&&t.children[f$1]){let n=t.children[f$1];return new m$1(t.segments.concat(n.segments),n.children)}return t}function ee$3(t){return t instanceof U$1}function Un$2(t,n,e=null,r=null,i=new K$2){let o=On$2(t);return Pn$3(o,n,e,r,i)}function On$2(t){let n;function e(o){let a={};for(let s of o.children){let u=e(s);a[s.outlet]=u;}let c=new m$1(o.url,a);return o===t&&(n=c),c}let r=e(t.root),i=Dn$2(r);return n??i}function Pn$3(t,n,e,r,i){let o=t;for(;o.parent;)o=o.parent;if(n.length===0)return Xt$1(o,o,o,e,r,i);let a=zi$2(n);if(a.toRoot())return Xt$1(o,o,new m$1([],{}),e,r,i);let c=Hi$2(a,o,t),s=c.processChildren?xe$1(c.segmentGroup,c.index,a.commands):xn$3(c.segmentGroup,c.index,a.commands);return Xt$1(o,c.segmentGroup,s,e,r,i)}function dt$2(t){return typeof t=="object"&&t!=null&&!t.outlets&&!t.segmentPath}function ke$1(t){return typeof t=="object"&&t!=null&&t.outlets}function pn$3(t,n,e){t||="\u0275";let r=new U$1;return r.queryParams={[t]:n},e.parse(e.serialize(r)).queryParams[t]}function Xt$1(t,n,e,r,i,o){let a={};for(let[u,h]of Object.entries(r??{}))a[u]=Array.isArray(h)?h.map(v=>pn$3(u,v,o)):pn$3(u,h,o);let c;t===n?c=e:c=Ln$1(t,n,e);let s=Dn$2(_n$3(c));return new U$1(s,a,i)}function Ln$1(t,n,e){let r={};return Object.entries(t.children).forEach(([i,o])=>{o===n?r[i]=e:r[i]=Ln$1(o,n,e);}),new m$1(t.segments,r)}var ft$2=class ft{isAbsolute;numberOfDoubleDots;commands;constructor(n,e,r){if(this.isAbsolute=n,this.numberOfDoubleDots=e,this.commands=r,n&&r.length>0&&dt$2(r[0]))throw new b$2(4003,false);let i=r.find(ke$1);if(i&&i!==wi$2(r))throw new b$2(4004,false)}toRoot(){return this.isAbsolute&&this.commands.length===1&&this.commands[0]=="/"}};function zi$2(t){if(typeof t[0]=="string"&&t.length===1&&t[0]==="/")return new ft$2(true,0,t);let n=0,e=false,r=t.reduce((i,o,a)=>{if(typeof o=="object"&&o!=null){if(o.outlets){let c={};return Object.entries(o.outlets).forEach(([s,u])=>{c[s]=typeof u=="string"?u.split("/"):u;}),[...i,{outlets:c}]}if(o.segmentPath)return [...i,o.segmentPath]}return typeof o!="string"?[...i,o]:a===0?(o.split("/").forEach((c,s)=>{s==0&&c==="."||(s==0&&c===""?e=true:c===".."?n++:c!=""&&i.push(c));}),i):[...i,o]},[]);return new ft$2(e,n,r)}var Se=class{segmentGroup;processChildren;index;constructor(n,e,r){this.segmentGroup=n,this.processChildren=e,this.index=r;}};function Hi$2(t,n,e){if(t.isAbsolute)return new Se(n,true,0);if(!e)return new Se(n,false,NaN);if(e.parent===null)return new Se(e,true,0);let r=dt$2(t.commands[0])?0:1,i=e.segments.length-1+r;return Fi$2(e,i,t.numberOfDoubleDots)}function Fi$2(t,n,e){let r=t,i=n,o=e;for(;o>i;){if(o-=i,r=r.parent,!r)throw new b$2(4005,false);i=r.segments.length;}return new Se(r,false,i-o)}function qi$2(t){return ke$1(t[0])?t[0].outlets:{[f$1]:t}}function xn$3(t,n,e){if(t??=new m$1([],{}),t.segments.length===0&&t.hasChildren())return xe$1(t,n,e);let r=Bi$2(t,n,e),i=e.slice(r.commandIndex);if(r.match&&r.pathIndex<t.segments.length){let o=new m$1(t.segments.slice(0,r.pathIndex),{});return o.children[f$1]=new m$1(t.segments.slice(r.pathIndex),t.children),xe$1(o,0,i)}else return r.match&&i.length===0?new m$1(t.segments,{}):r.match&&!t.hasChildren()?ar$3(t,n,e):r.match?xe$1(t,0,i):ar$3(t,n,e)}function xe$1(t,n,e){if(e.length===0)return new m$1(t.segments,{});{let r=qi$2(e),i={};if(Object.keys(r).some(o=>o!==f$1)&&t.children[f$1]&&t.numberOfChildren===1&&t.children[f$1].segments.length===0){let o=xe$1(t.children[f$1],n,e);return new m$1(t.segments,o.children)}return Object.entries(r).forEach(([o,a])=>{typeof a=="string"&&(a=[a]),a!==null&&(i[o]=xn$3(t.children[o],n,a));}),Object.entries(t.children).forEach(([o,a])=>{r[o]===void 0&&(i[o]=a);}),new m$1(t.segments,i)}}function Bi$2(t,n,e){let r=0,i=n,o={match:false,pathIndex:0,commandIndex:0};for(;i<t.segments.length;){if(r>=e.length)return o;let a=t.segments[i],c=e[r];if(ke$1(c))break;let s=`${c}`,u=r<e.length-1?e[r+1]:null;if(i>0&&s===void 0)break;if(s&&u&&typeof u=="object"&&u.outlets===void 0){if(!vn$2(s,u,a))return o;r+=2;}else {if(!vn$2(s,{},a))return o;r++;}i++;}return {match:true,pathIndex:i,commandIndex:r}}function ar$3(t,n,e){let r=t.segments.slice(0,n),i=0;for(;i<e.length;){let o=e[i];if(ke$1(o)){let s=Vi$2(o.outlets);return new m$1(r,s)}if(i===0&&dt$2(e[0])){let s=t.segments[n];r.push(new X$1(s.path,gn$2(e[0]))),i++;continue}let a=ke$1(o)?o.outlets[f$1]:`${o}`,c=i<e.length-1?e[i+1]:null;a&&c&&dt$2(c)?(r.push(new X$1(a,gn$2(c))),i+=2):(r.push(new X$1(a,{})),i++);}return new m$1(r,{})}function Vi$2(t){let n={};return Object.entries(t).forEach(([e,r])=>{typeof r=="string"&&(r=[r]),r!==null&&(n[e]=ar$3(new m$1([],{}),0,r));}),n}function gn$2(t){let n={};return Object.entries(t).forEach(([e,r])=>n[e]=`${r}`),n}function vn$2(t,n,e){return t==e.path&&q$1(n,e.parameters)}var Ce$2="imperative",S$1=(function(t){return t[t.NavigationStart=0]="NavigationStart",t[t.NavigationEnd=1]="NavigationEnd",t[t.NavigationCancel=2]="NavigationCancel",t[t.NavigationError=3]="NavigationError",t[t.RoutesRecognized=4]="RoutesRecognized",t[t.ResolveStart=5]="ResolveStart",t[t.ResolveEnd=6]="ResolveEnd",t[t.GuardsCheckStart=7]="GuardsCheckStart",t[t.GuardsCheckEnd=8]="GuardsCheckEnd",t[t.RouteConfigLoadStart=9]="RouteConfigLoadStart",t[t.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",t[t.ChildActivationStart=11]="ChildActivationStart",t[t.ChildActivationEnd=12]="ChildActivationEnd",t[t.ActivationStart=13]="ActivationStart",t[t.ActivationEnd=14]="ActivationEnd",t[t.Scroll=15]="Scroll",t[t.NavigationSkipped=16]="NavigationSkipped",t})(S$1||{}),O$3=class O{id;url;constructor(n,e){this.id=n,this.url=e;}},te$3=class te extends O$3{type=S$1.NavigationStart;navigationTrigger;restoredState;constructor(n,e,r="imperative",i=null){super(n,e),this.navigationTrigger=r,this.restoredState=i;}toString(){return `NavigationStart(id: ${this.id}, url: '${this.url}')`}},$$2=class $ extends O$3{urlAfterRedirects;type=S$1.NavigationEnd;constructor(n,e,r){super(n,e),this.urlAfterRedirects=r;}toString(){return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}},I$1=(function(t){return t[t.Redirect=0]="Redirect",t[t.SupersededByNewNavigation=1]="SupersededByNewNavigation",t[t.NoDataFromResolver=2]="NoDataFromResolver",t[t.GuardRejected=3]="GuardRejected",t[t.Aborted=4]="Aborted",t})(I$1||{}),be$1=(function(t){return t[t.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",t[t.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",t})(be$1||{}),k$1=class k extends O$3{reason;code;type=S$1.NavigationCancel;constructor(n,e,r,i){super(n,e),this.reason=r,this.code=i;}toString(){return `NavigationCancel(id: ${this.id}, url: '${this.url}')`}};function jn$2(t){return t instanceof k$1&&(t.code===I$1.Redirect||t.code===I$1.SupersededByNewNavigation)}var B$2=class B extends O$3{reason;code;type=S$1.NavigationSkipped;constructor(n,e,r,i){super(n,e),this.reason=r,this.code=i;}},le$1=class le extends O$3{error;target;type=S$1.NavigationError;constructor(n,e,r,i){super(n,e),this.error=r,this.target=i;}toString(){return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}},$e$3=class $e extends O$3{urlAfterRedirects;state;type=S$1.RoutesRecognized;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},pt$2=class pt extends O$3{urlAfterRedirects;state;type=S$1.GuardsCheckStart;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},gt$1=class gt extends O$3{urlAfterRedirects;state;shouldActivate;type=S$1.GuardsCheckEnd;constructor(n,e,r,i,o){super(n,e),this.urlAfterRedirects=r,this.state=i,this.shouldActivate=o;}toString(){return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}},vt$1=class vt extends O$3{urlAfterRedirects;state;type=S$1.ResolveStart;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},mt$3=class mt extends O$3{urlAfterRedirects;state;type=S$1.ResolveEnd;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i;}toString(){return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},yt$2=class yt{route;type=S$1.RouteConfigLoadStart;constructor(n){this.route=n;}toString(){return `RouteConfigLoadStart(path: ${this.route.path})`}},Rt$2=class Rt{route;type=S$1.RouteConfigLoadEnd;constructor(n){this.route=n;}toString(){return `RouteConfigLoadEnd(path: ${this.route.path})`}},St$1=class St{snapshot;type=S$1.ChildActivationStart;constructor(n){this.snapshot=n;}toString(){return `ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ct$2=class Ct{snapshot;type=S$1.ChildActivationEnd;constructor(n){this.snapshot=n;}toString(){return `ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},wt$2=class wt{snapshot;type=S$1.ActivationStart;constructor(n){this.snapshot=n;}toString(){return `ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},bt$1=class bt{snapshot;type=S$1.ActivationEnd;constructor(n){this.snapshot=n;}toString(){return `ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ie$1=class Ie{routerEvent;position;anchor;scrollBehavior;type=S$1.Scroll;constructor(n,e,r,i){this.routerEvent=n,this.position=e,this.anchor=r,this.scrollBehavior=i;}toString(){let n=this.position?`${this.position[0]}, ${this.position[1]}`:null;return `Scroll(anchor: '${this.anchor}', position: '${n}')`}},Ae$1=class Ae{},ze$1=class ze{},Ee$1=class Ee{url;navigationBehaviorOptions;constructor(n,e){this.url=n,this.navigationBehaviorOptions=e;}};function Gi$2(t){return !(t instanceof Ae$1)&&!(t instanceof Ee$1)&&!(t instanceof ze$1)}var It$1=class It{rootInjector;outlet=null;route=null;children;attachRef=null;get injector(){return this.route?.snapshot._environmentInjector??this.rootInjector}constructor(n){this.rootInjector=n,this.children=new de$2(this.rootInjector);}},de$2=(()=>{class t{rootInjector;contexts=new Map;constructor(e){this.rootInjector=e;}onChildOutletCreated(e,r){let i=this.getOrCreateContext(e);i.outlet=r,this.contexts.set(e,i);}onChildOutletDestroyed(e){let r=this.getContext(e);r&&(r.outlet=null,r.attachRef=null);}onOutletDeactivated(){let e=this.contexts;return this.contexts=new Map,e}onOutletReAttached(e){this.contexts=e;}getOrCreateContext(e){let r=this.getContext(e);return r||(r=new It$1(this.rootInjector),this.contexts.set(e,r)),r}getContext(e){return this.contexts.get(e)||null}static \u0275fac=function(r){return new(r||t)(se$8(me$5))};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),At$2=class At{_root;constructor(n){this._root=n;}get root(){return this._root.value}parent(n){let e=this.pathFromRoot(n);return e.length>1?e[e.length-2]:null}children(n){let e=sr$3(n,this._root);return e?e.children.map(r=>r.value):[]}firstChild(n){let e=sr$3(n,this._root);return e&&e.children.length>0?e.children[0].value:null}siblings(n){let e=cr$3(n,this._root);return e.length<2?[]:e[e.length-2].children.map(i=>i.value).filter(i=>i!==n)}pathFromRoot(n){return cr$3(n,this._root).map(e=>e.value)}};function sr$3(t,n){if(t===n.value)return n;for(let e of n.children){let r=sr$3(t,e);if(r)return r}return null}function cr$3(t,n){if(t===n.value)return [n];for(let e of n.children){let r=cr$3(t,e);if(r.length)return r.unshift(n),r}return []}var _$1=class _{value;children;constructor(n,e){this.value=n,this.children=e;}toString(){return `TreeNode(${this.value})`}};function Re$1(t){let n={};return t&&t.children.forEach(e=>n[e.value.outlet]=e),n}var He$3=class He extends At$2{snapshot;constructor(n,e){super(n),this.snapshot=e,mr$3(this,n);}toString(){return this.snapshot.toString()}};function kn$3(t,n){let e=Wi$2(t,n),r=new Bn$5([new X$1("",{})]),i=new Bn$5({}),o=new Bn$5({}),a=new Bn$5({}),c=new Bn$5(""),s=new V(r,i,a,c,o,f$1,t,e.root);return s.snapshot=e.root,new He$3(new _$1(s,[]),e)}function Wi$2(t,n){let e={},r={},i={},a=new Te$1([],e,i,"",r,f$1,t,null,{},n);return new Fe$2("",new _$1(a,[]))}var V=class{urlSubject;paramsSubject;queryParamsSubject;fragmentSubject;dataSubject;outlet;component;snapshot;_futureSnapshot;_routerState;_paramMap;_queryParamMap;title;url;params;queryParams;fragment;data;_localInjector;constructor(n,e,r,i,o,a,c,s){this.urlSubject=n,this.paramsSubject=e,this.queryParamsSubject=r,this.fragmentSubject=i,this.dataSubject=o,this.outlet=a,this.component=c,this._futureSnapshot=s,this.title=this.dataSubject?.pipe(ke$3(u=>u[Ve$3]))??Tm(void 0),this.url=n,this.params=e,this.queryParams=r,this.fragment=i,this.data=o;}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=this.params.pipe(ke$3(n=>ue$2(n))),this._paramMap}get queryParamMap(){return this._queryParamMap??=this.queryParams.pipe(ke$3(n=>ue$2(n))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}},Qi$2="always";function vr$3(t,n,e){let r,{routeConfig:i}=t;return n!==null&&(e==="always"||i?.path===""||!n.component&&!n.routeConfig?.loadComponent)?r={params:G$b(G$b({},n.params),t.params),data:G$b(G$b({},n.data),t.data),resolve:G$b(G$b(G$b(G$b({},t.data),n.data),i?.data),t._resolvedData)}:r={params:G$b({},t.params),data:G$b({},t.data),resolve:G$b(G$b({},t.data),t._resolvedData??{})},i&&zn$2(i)&&(r.resolve[Ve$3]=i.title),r}var Te$1=class Te{url;params;queryParams;fragment;data;outlet;component;routeConfig;_resolve;_resolvedData;_routerState;_paramMap;_queryParamMap;_environmentInjector;get title(){return this.data?.[Ve$3]}constructor(n,e,r,i,o,a,c,s,u,h){this.url=n,this.params=e,this.queryParams=r,this.fragment=i,this.data=o,this.outlet=a,this.component=c,this.routeConfig=s,this._resolve=u,this._environmentInjector=h;}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=ue$2(this.params),this._paramMap}get queryParamMap(){return this._queryParamMap??=ue$2(this.queryParams),this._queryParamMap}toString(){let n=this.url.map(r=>r.toString()).join("/"),e=this.routeConfig?this.routeConfig.path:"";return `Route(url:'${n}', path:'${e}')`}},Fe$2=class Fe extends At$2{url;constructor(n,e){super(e),this.url=n,mr$3(this,e);}toString(){return $n$2(this._root)}};function mr$3(t,n){n.value._routerState=t,n.children.forEach(e=>mr$3(t,e));}function $n$2(t){let n=t.children.length>0?` { ${t.children.map($n$2).join(", ")} } `:"";return `${t.value}${n}`}function er$2(t){if(t.snapshot){let n=t.snapshot,e=t._futureSnapshot;t.snapshot=e,q$1(n.queryParams,e.queryParams)||t.queryParamsSubject.next(e.queryParams),n.fragment!==e.fragment&&t.fragmentSubject.next(e.fragment),q$1(n.params,e.params)||t.paramsSubject.next(e.params),Ci$4(n.url,e.url)||t.urlSubject.next(e.url),q$1(n.data,e.data)||t.dataSubject.next(e.data);}else t.snapshot=t._futureSnapshot,t.dataSubject.next(t._futureSnapshot.data);}function ur$3(t,n){let e=q$1(t.params,n.params)&&Ei$3(t.url,n.url),r=!t.parent!=!n.parent;return e&&!r&&(!t.parent||ur$3(t.parent,n.parent))}function zn$2(t){return typeof t.title=="string"||t.title===null}var Hn$2=new N$7(""),yr$3=(()=>{class t{activated=null;get activatedComponentRef(){return this.activated}_activatedRoute=null;name=f$1;activateEvents=new Qe$a;deactivateEvents=new Qe$a;attachEvents=new Qe$a;detachEvents=new Qe$a;routerOutletData=Hj();parentContexts=w$4(de$2);location=w$4(Ki$5);changeDetector=w$4(Gj);inputBinder=w$4(Ge$2,{optional:true});supportsBindingToComponentInputs=true;ngOnChanges(e){if(e.name){let{firstChange:r,previousValue:i}=e.name;if(r)return;this.isTrackedInParentContexts(i)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(i)),this.initializeOutletWithName();}}ngOnDestroy(){this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),this.inputBinder?.unsubscribeFromRouteData(this);}isTrackedInParentContexts(e){return this.parentContexts.getContext(e)?.outlet===this}ngOnInit(){this.initializeOutletWithName();}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;let e=this.parentContexts.getContext(this.name);e?.route&&(e.attachRef?this.attach(e.attachRef,e.route):this.activateWith(e.route,e.injector));}get isActivated(){return !!this.activated}get component(){if(!this.activated)throw new b$2(4012,false);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new b$2(4012,false);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new b$2(4012,false);this.location.detach();let e=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(e.instance),e}attach(e,r){this.activated=e,this._activatedRoute=r,this.location.insert(e.hostView),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(e.instance);}deactivate(){if(this.activated){let e=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(e);}}activateWith(e,r){if(this.isActivated)throw new b$2(4013,false);this._activatedRoute=e;let i=this.location,a=e.snapshot.component,c=this.parentContexts.getOrCreateContext(this.name).children,s=new lr$3(e,c,i.injector,this.routerOutletData);this.activated=i.createComponent(a,{index:i.length,injector:s,environmentInjector:r}),this.changeDetector.markForCheck(),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance);}static \u0275fac=function(r){return new(r||t)};static \u0275dir=nw({type:t,selectors:[["router-outlet"]],inputs:{name:"name",routerOutletData:[1,"routerOutletData"]},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],features:[lv]})}return t})(),lr$3=class lr{route;childContexts;parent;outletData;constructor(n,e,r,i){this.route=n,this.childContexts=e,this.parent=r,this.outletData=i;}get(n,e){return n===V?this.route:n===de$2?this.childContexts:n===Hn$2?this.outletData:this.parent.get(n,e)}},Ge$2=new N$7(""),Fn$2=(()=>{class t{options;outletDataSubscriptions=new Map;outletSeenKeys=new Map;constructor(e){this.options=e,this.options.queryParams??=true;}bindActivatedRouteToOutletComponent(e){this.unsubscribeFromRouteData(e),this.subscribeToRouteData(e);}unsubscribeFromRouteData(e){this.outletDataSubscriptions.get(e)?.unsubscribe(),this.outletDataSubscriptions.delete(e),this.outletSeenKeys.delete(e);}subscribeToRouteData(e){let{activatedRoute:r}=e,i=Fm([this.options.queryParams?r.queryParams:Tm({}),r.params,r.data]).pipe(ry(([o,a,c],s)=>(c=G$b(G$b(G$b({},o),a),c),s===0?Tm(c):Promise.resolve(c)))).subscribe(o=>{if(!e.isActivated||!e.activatedComponentRef||e.activatedRoute!==r||r.component===null){this.unsubscribeFromRouteData(e);return}let a=Xj(r.component);if(!a){this.unsubscribeFromRouteData(e);return}let c=this.outletSeenKeys.get(e);c||(c=new Set,this.outletSeenKeys.set(e,c));for(let u of Object.keys(o))c.add(u);let s=this.options.unmatchedInputBehavior??"alwaysUndefined";for(let{templateName:u}of a.inputs){let h=o[u];(h!==void 0||s==="alwaysUndefined"||c.has(u))&&e.activatedComponentRef.setInput(u,h);}});this.outletDataSubscriptions.set(e,i);}static \u0275fac=function(r){gD();};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})(),Rr$3=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275cmp=JD({type:t,selectors:[["ng-component"]],exportAs:["emptyRouterOutlet"],decls:1,vars:0,template:function(r,i){r&1&&$h(0,"router-outlet");},dependencies:[yr$3],encapsulation:2,changeDetection:1})}return t})();function Sr$3(t){let n=t.children&&t.children.map(Sr$3),e=n?z$5(G$b({},t),{children:n}):G$b({},t);return !e.component&&!e.loadComponent&&(n||e.loadChildren)&&e.outlet&&e.outlet!==f$1&&(e.component=Rr$3),e}function Ki$2(t,n,e){let r=new Set,i=qe$3(t,n._root,e?e._root:void 0,r);return {newlyCreatedRoutes:r,state:new He$3(i,n)}}function qe$3(t,n,e,r){if(e&&t.shouldReuseRoute(n.value,e.value.snapshot)){let i=e.value;i._futureSnapshot=n.value;let o=Yi$2(t,n,e,r);return new _$1(i,o)}else {if(t.shouldAttach(n.value)){let a=t.retrieve(n.value);if(a!==null){let c=a.route;return c.value._futureSnapshot=n.value,c.children=n.children.map(s=>qe$3(t,s,void 0,r)),c}}let i=Zi$2(n.value);r.add(i);let o=n.children.map(a=>qe$3(t,a,void 0,r));return new _$1(i,o)}}function Yi$2(t,n,e,r){return n.children.map(i=>{for(let o of e.children)if(t.shouldReuseRoute(i.value,o.value.snapshot))return qe$3(t,i,o,r);return qe$3(t,i,void 0,r)})}function Zi$2(t){return new V(new Bn$5(t.url),new Bn$5(t.params),new Bn$5(t.queryParams),new Bn$5(t.fragment),new Bn$5(t.data),t.outlet,t.component,t)}var Ne$1=class Ne{redirectTo;navigationBehaviorOptions;constructor(n,e){this.redirectTo=n,this.navigationBehaviorOptions=e;}},qn$2="ngNavigationCancelingError";function Et$2(t,n){let{redirectTo:e,navigationBehaviorOptions:r}=ee$3(n)?{redirectTo:n,navigationBehaviorOptions:void 0}:n,i=Bn$2(false,I$1.Redirect);return i.url=e,i.navigationBehaviorOptions=r,i}function Bn$2(t,n){let e=new Error(`NavigationCancelingError: ${""}`);return e[qn$2]=true,e.cancellationCode=n,e}function Ji$2(t){return Vn$2(t)&&ee$3(t.url)}function Vn$2(t){return !!t&&t[qn$2]}var hr$3=class hr{routeReuseStrategy;futureState;currState;forwardEvent;inputBindingEnabled;constructor(n,e,r,i,o){this.routeReuseStrategy=n,this.futureState=e,this.currState=r,this.forwardEvent=i,this.inputBindingEnabled=o;}activate(n){let e=this.futureState._root,r=this.currState?this.currState._root:null;this.deactivateChildRoutes(e,r,n),er$2(this.futureState.root),this.activateChildRoutes(e,r,n);}deactivateChildRoutes(n,e,r){let i=Re$1(e);n.children.forEach(o=>{let a=o.value.outlet;this.deactivateRoutes(o,i[a],r),delete i[a];}),Object.values(i).forEach(o=>{this.deactivateRouteAndItsChildren(o,r);});}deactivateRoutes(n,e,r){let i=n.value,o=e?e.value:null;if(i===o)if(i.component){let a=r.getContext(i.outlet);a&&this.deactivateChildRoutes(n,e,a.children);}else this.deactivateChildRoutes(n,e,r);else o&&this.deactivateRouteAndItsChildren(e,r);}deactivateRouteAndItsChildren(n,e){n.value.component&&this.routeReuseStrategy.shouldDetach(n.value.snapshot)?this.detachAndStoreRouteSubtree(n,e):this.deactivateRouteAndOutlet(n,e);}detachAndStoreRouteSubtree(n,e){let r=e.getContext(n.value.outlet),i=r&&n.value.component?r.children:e,o=Re$1(n);for(let a of Object.values(o))this.deactivateRouteAndItsChildren(a,i);if(r&&r.outlet){let a=r.outlet.detach(),c=r.children.onOutletDeactivated();this.routeReuseStrategy.store(n.value.snapshot,{componentRef:a,route:n,contexts:c});}}deactivateRouteAndOutlet(n,e){let r=e.getContext(n.value.outlet),i=r&&n.value.component?r.children:e,o=Re$1(n);for(let a of Object.values(o))this.deactivateRouteAndItsChildren(a,i);r&&(r.outlet&&(r.outlet.deactivate(),r.children.onOutletDeactivated()),r.attachRef=null,r.route=null),n.value._localInjector?.destroy();}activateChildRoutes(n,e,r){let i=Re$1(e);n.children.forEach(o=>{this.activateRoutes(o,i[o.value.outlet],r),this.forwardEvent(new bt$1(o.value.snapshot));}),n.children.length&&this.forwardEvent(new Ct$2(n.value.snapshot));}activateRoutes(n,e,r){let i=n.value,o=e?e.value:null;if(er$2(i),i===o)if(i.component){let a=r.getOrCreateContext(i.outlet);this.activateChildRoutes(n,e,a.children);}else this.activateChildRoutes(n,e,r);else if(i.component){let a=r.getOrCreateContext(i.outlet);if(this.routeReuseStrategy.shouldAttach(i.snapshot)){let c=this.routeReuseStrategy.retrieve(i.snapshot);this.routeReuseStrategy.store(i.snapshot,null),a.children.onOutletReAttached(c.contexts),a.attachRef=c.componentRef,a.route=c.route.value,a.outlet&&a.outlet.attach(c.componentRef,c.route.value),er$2(c.route.value),this.activateChildRoutes(n,null,a.children);}else a.attachRef=null,a.route=i,a.outlet&&a.outlet.activateWith(i,a.injector),this.activateChildRoutes(n,null,a.children);}else this.activateChildRoutes(n,null,r);}},Tt$1=class Tt{path;route;constructor(n){this.path=n,this.route=this.path[this.path.length-1];}},we$1=class we{component;route;constructor(n,e){this.component=n,this.route=e;}};function Xi$2(t,n,e){let r=t._root,i=n?n._root:null;return Le$1(r,i,e,[r.value])}function eo$1(t){let n=t.routeConfig?t.routeConfig.canActivateChild:null;return !n||n.length===0?null:{node:t,guards:n}}function De$1(t,n){let e=Symbol(),r=n.get(t,e);return r===e?typeof t=="function"&&!gy(t)?t:n.get(t):r}function Le$1(t,n,e,r,i={canDeactivateChecks:[],canActivateChecks:[]}){let o=Re$1(n);return t.children.forEach(a=>{to$1(a,o[a.value.outlet],e,r.concat([a.value]),i),delete o[a.value.outlet];}),Object.entries(o).forEach(([a,c])=>je$2(c,e.getContext(a),i)),i}function to$1(t,n,e,r,i={canDeactivateChecks:[],canActivateChecks:[]}){let o=t.value,a=n?n.value:null,c=e?e.getContext(t.value.outlet):null;if(a&&o.routeConfig===a.routeConfig){let s=ro$1(a,o,o.routeConfig.runGuardsAndResolvers);s?i.canActivateChecks.push(new Tt$1(r)):(o.data=a.data,o._resolvedData=a._resolvedData),o.component?Le$1(t,n,c?c.children:null,r,i):Le$1(t,n,e,r,i),s&&c&&c.outlet&&c.outlet.isActivated&&i.canDeactivateChecks.push(new we$1(c.outlet.component,a));}else a&&je$2(n,c,i),i.canActivateChecks.push(new Tt$1(r)),o.component?Le$1(t,null,c?c.children:null,r,i):Le$1(t,null,e,r,i);return i}function ro$1(t,n,e){if(typeof e=="function")return $o$4(n._environmentInjector,()=>e(t,n));switch(e){case "pathParamsChange":return !ce$2(t.url,n.url);case "pathParamsOrQueryParamsChange":return !ce$2(t.url,n.url)||!q$1(t.queryParams,n.queryParams);case "always":return true;case "paramsOrQueryParamsChange":return !ur$3(t,n)||!q$1(t.queryParams,n.queryParams);default:return !ur$3(t,n)}}function je$2(t,n,e){let r=Re$1(t),i=t.value;Object.entries(r).forEach(([o,a])=>{i.component?n?je$2(a,n.children.getContext(o),e):je$2(a,null,e):je$2(a,n,e);}),i.component?n&&n.outlet&&n.outlet.isActivated?e.canDeactivateChecks.push(new we$1(n.outlet.component,i)):e.canDeactivateChecks.push(new we$1(null,i)):e.canDeactivateChecks.push(new we$1(null,i));}function We$2(t){return typeof t=="function"}function no$1(t){return typeof t=="boolean"}function io$1(t){return t&&We$2(t.canLoad)}function oo$1(t){return t&&We$2(t.canActivate)}function ao$1(t){return t&&We$2(t.canActivateChild)}function so$1(t){return t&&We$2(t.canDeactivate)}function co$1(t){return t&&We$2(t.canMatch)}function Gn$2(t){return t instanceof qe$a||t?.name==="EmptyError"}var st$2=Symbol("INITIAL_VALUE");function Me$1(){return ry(t=>Fm(t.map(n=>n.pipe(_t$9(1),Tu(st$2)))).pipe(ke$3(n=>{for(let e of n)if(e!==true){if(e===st$2)return st$2;if(e===false||uo$1(e))return e}return true}),fn$7(n=>n!==st$2),_t$9(1)))}function uo$1(t){return ee$3(t)||t instanceof Ne$1}function Wn$2(t){return t.aborted?Tm(void 0).pipe(_t$9(1)):new S$5(n=>{let e=()=>{n.next(),n.complete();};return t.addEventListener("abort",e),()=>t.removeEventListener("abort",e)})}function Qn$2(t){return bu(Wn$2(t))}function lo$1(t){return Te$5(n=>{let{targetSnapshot:e,currentSnapshot:r,guards:{canActivateChecks:i,canDeactivateChecks:o}}=n;return o.length===0&&i.length===0?Tm(z$5(G$b({},n),{guardsResult:true})):ho$1(o,e,r).pipe(Te$5(a=>a&&no$1(a)?fo$1(e,i,t):Tm(a)),ke$3(a=>z$5(G$b({},n),{guardsResult:a})))})}function ho$1(t,n,e){return Pe$4(t).pipe(Te$5(r=>yo$1(r.component,r.route,e,n)),Jm(r=>r!==true,true))}function fo$1(t,n,e){return Pe$4(n).pipe(mu(r=>dn$7(go$1(r.route.parent,e),po$1(r.route,e),mo$1(t,r.path),vo$1(t,r.route))),Jm(r=>r!==true,true))}function po$1(t,n){return t!==null&&n&&n(new wt$2(t)),Tm(true)}function go$1(t,n){return t!==null&&n&&n(new St$1(t)),Tm(true)}function vo$1(t,n){let e=n.routeConfig?n.routeConfig.canActivate:null;if(!e||e.length===0)return Tm(true);let r=e.map(i=>Vm(()=>{let o=n._environmentInjector,a=De$1(i,o),c=oo$1(a)?a.canActivate(n,t):$o$4(o,()=>a(n,t));return he$3(c).pipe(Jm())}));return Tm(r).pipe(Me$1())}function mo$1(t,n){let e=n[n.length-1],i=n.slice(0,n.length-1).reverse().map(o=>eo$1(o)).filter(o=>o!==null).map(o=>Vm(()=>{let a=o.guards.map(c=>{let s=o.node._environmentInjector,u=De$1(c,s),h=ao$1(u)?u.canActivateChild(e,t):$o$4(s,()=>u(e,t));return he$3(h).pipe(Jm())});return Tm(a).pipe(Me$1())}));return Tm(i).pipe(Me$1())}function yo$1(t,n,e,r){let i=n&&n.routeConfig?n.routeConfig.canDeactivate:null;if(!i||i.length===0)return Tm(true);let o=i.map(a=>{let c=n._environmentInjector,s=De$1(a,c),u=so$1(s)?s.canDeactivate(t,n,e,r):$o$4(c,()=>s(t,n,e,r));return he$3(u).pipe(Jm())});return Tm(o).pipe(Me$1())}function Ro$1(t,n,e,r,i){let o=n.canLoad;if(o===void 0||o.length===0)return Tm(true);let a=o.map(c=>{let s=De$1(c,t),u=io$1(s)?s.canLoad(n,e):$o$4(t,()=>s(n,e)),h=he$3(u);return i?h.pipe(Qn$2(i)):h});return Tm(a).pipe(Me$1(),Kn$2(r))}function Kn$2(t){return sm(Cu(n=>{if(typeof n!="boolean")throw Et$2(t,n)}),ke$3(n=>n===true))}function So$1(t,n,e,r,i,o){let a=n.canMatch;if(!a||a.length===0)return Tm(true);let c=a.map(s=>{let u=De$1(s,t),h=co$1(u)?u.canMatch(n,e,i):$o$4(t,()=>u(n,e,i));return he$3(h).pipe(Qn$2(o))});return Tm(c).pipe(Me$1(),Kn$2(r))}var Q$1=class t extends Error{segmentGroup;constructor(n){super(),this.segmentGroup=n||null,Object.setPrototypeOf(this,t.prototype);}},Be$2=class t extends Error{urlTree;constructor(n){super(),this.urlTree=n,Object.setPrototypeOf(this,t.prototype);}};function Co$1(t){throw new b$2(4e3,false)}function wo$1(t){throw Bn$2(false,I$1.GuardRejected)}var dr$3=class dr{urlSerializer;urlTree;constructor(n,e){this.urlSerializer=n,this.urlTree=e;}lineralizeSegments(n,e){return Zr$4(this,null,function*(){let r=[],i=e.root;for(;;){if(r=r.concat(i.segments),i.numberOfChildren===0)return r;if(i.numberOfChildren>1||!i.children[f$1])throw Co$1(`${n.redirectTo}`);i=i.children[f$1];}})}applyRedirectCommands(n,e,r,i,o){return Zr$4(this,null,function*(){let a=yield bo$1(e,i,o);if(a instanceof U$1)throw new Be$2(a);let c=this.applyRedirectCreateUrlTree(a,this.urlSerializer.parse(a),n,r);if(a[0]==="/")throw new Be$2(c);return c})}applyRedirectCreateUrlTree(n,e,r,i){let o=this.createSegmentGroup(n,e.root,r,i);return new U$1(o,this.createQueryParams(e.queryParams,this.urlTree.queryParams),e.fragment)}createQueryParams(n,e){let r={};return Object.entries(n).forEach(([i,o])=>{if(typeof o=="string"&&o[0]===":"){let c=o.substring(1);r[i]=e[c];}else r[i]=o;}),r}createSegmentGroup(n,e,r,i){let o=this.createSegments(n,e.segments,r,i),a={};return Object.entries(e.children).forEach(([c,s])=>{a[c]=this.createSegmentGroup(n,s,r,i);}),new m$1(o,a)}createSegments(n,e,r,i){return e.map(o=>o.path[0]===":"?this.findPosParam(n,o,i):this.findOrReturn(o,r))}findPosParam(n,e,r){let i=r[e.path.substring(1)];if(!i)throw new b$2(4001,false);return i}findOrReturn(n,e){let r=0;for(let i of e){if(i.path===n.path)return e.splice(r),i;r++;}return n}};function bo$1(t,n,e){if(typeof t=="string")return Promise.resolve(t);let r=t;return ht$2(he$3($o$4(e,()=>r(n))))}function Io$1(t,n){return t.providers&&!t._injector&&(t._injector=Th(t.providers,n,`Route: ${t.path}`)),t._injector??n}function H$1(t){return t.outlet||f$1}function Ao$1(t,n){let e=t.filter(r=>H$1(r)===n);return e.push(...t.filter(r=>H$1(r)!==n)),e}var fr$3={matched:false,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function Yn$2(t){return {routeConfig:t.routeConfig,url:t.url,params:t.params,queryParams:t.queryParams,fragment:t.fragment,data:t.data,outlet:t.outlet,title:t.title,paramMap:t.paramMap,queryParamMap:t.queryParamMap}}function Eo$1(t,n,e,r,i,o,a){let c=Zn$2(t,n,e);if(!c.matched)return Tm(c);let s=Yn$2(o(c));return r=Io$1(n,r),So$1(r,n,e,i,s,a).pipe(ke$3(u=>u===true?c:G$b({},fr$3)))}function Zn$2(t,n,e){if(n.path==="")return n.pathMatch==="full"&&(t.hasChildren()||e.length>0)?G$b({},fr$3):{matched:true,consumedSegments:[],remainingSegments:e,parameters:{},positionalParamSegments:{}};let i=(n.matcher||Sn$3)(e,t,n);if(!i)return G$b({},fr$3);let o={};Object.entries(i.posParams??{}).forEach(([c,s])=>{o[c]=s.path;});let a=i.consumed.length>0?G$b(G$b({},o),i.consumed[i.consumed.length-1].parameters):o;return {matched:true,consumedSegments:i.consumed,remainingSegments:e.slice(i.consumed.length),parameters:a,positionalParamSegments:i.posParams??{}}}function mn$3(t,n,e,r,i){return e.length>0&&Mo$1(t,e,r,i)?{segmentGroup:new m$1(n,No$1(r,new m$1(e,t.children))),slicedSegments:[]}:e.length===0&&Do$1(t,e,r)?{segmentGroup:new m$1(t.segments,To$1(t,e,r,t.children)),slicedSegments:e}:{segmentGroup:new m$1(t.segments,t.children),slicedSegments:e}}function To$1(t,n,e,r){let i={};for(let o of e)if(Mt$2(t,n,o)&&!r[H$1(o)]){let a=new m$1([],{});i[H$1(o)]=a;}return G$b(G$b({},r),i)}function No$1(t,n){let e={};e[f$1]=n;for(let r of t)if(r.path===""&&H$1(r)!==f$1){let i=new m$1([],{});e[H$1(r)]=i;}return e}function Mo$1(t,n,e,r){return e.some(i=>!Mt$2(t,n,i)||!(H$1(i)!==f$1)?false:!(r!==void 0&&H$1(i)===r))}function Do$1(t,n,e){return e.some(r=>Mt$2(t,n,r))}function Mt$2(t,n,e){return (t.hasChildren()||n.length>0)&&e.pathMatch==="full"?false:e.path===""}function _o$1(t,n,e){return n.length===0&&!t.children[e]}var pr$3=class pr{};function Uo$1(t,n,e,r,i,o,a,c){return Zr$4(this,null,function*(){return new gr$3(t,n,e,r,i,a,o,c).recognize()})}var Oo$1=31,gr$3=class gr{injector;configLoader;rootComponentType;config;urlTree;paramsInheritanceStrategy;urlSerializer;abortSignal;applyRedirects;absoluteRedirectCount=0;allowRedirects=true;constructor(n,e,r,i,o,a,c,s){this.injector=n,this.configLoader=e,this.rootComponentType=r,this.config=i,this.urlTree=o,this.paramsInheritanceStrategy=a,this.urlSerializer=c,this.abortSignal=s,this.applyRedirects=new dr$3(this.urlSerializer,this.urlTree);}noMatchError(n){return new b$2(4002,`'${n.segmentGroup}'`)}recognize(){return Zr$4(this,null,function*(){let n=mn$3(this.urlTree.root,[],[],this.config).segmentGroup,{children:e,rootSnapshot:r}=yield this.match(n),i=new _$1(r,e),o=new Fe$2("",i),a=Un$2(r,[],this.urlTree.queryParams,this.urlTree.fragment);return a.queryParams=this.urlTree.queryParams,o.url=this.urlSerializer.serialize(a),{state:o,tree:a}})}match(n){return Zr$4(this,null,function*(){let e=new Te$1([],Object.freeze({}),Object.freeze(G$b({},this.urlTree.queryParams)),this.urlTree.fragment,Object.freeze({}),f$1,this.rootComponentType,null,{},this.injector);try{return {children:yield this.processSegmentGroup(this.injector,this.config,n,f$1,e),rootSnapshot:e}}catch(r){if(r instanceof Be$2)return this.urlTree=r.urlTree,this.match(r.urlTree.root);throw r instanceof Q$1?this.noMatchError(r):r}})}processSegmentGroup(n,e,r,i,o){return Zr$4(this,null,function*(){if(r.segments.length===0&&r.hasChildren())return this.processChildren(n,e,r,o);let a=yield this.processSegment(n,e,r,r.segments,i,true,o);return a instanceof _$1?[a]:[]})}processChildren(n,e,r,i){return Zr$4(this,null,function*(){let o=[];for(let s of Object.keys(r.children))s==="primary"?o.unshift(s):o.push(s);let a=[];for(let s of o){let u=r.children[s],h=Ao$1(e,s),v=yield this.processSegmentGroup(n,h,u,s,i);a.push(...v);}let c=Jn$2(a);return Po$1(c),c})}processSegment(n,e,r,i,o,a,c){return Zr$4(this,null,function*(){for(let s of e)try{return yield this.processSegmentAgainstRoute(s._injector??n,e,s,r,i,o,a,c)}catch(u){if(u instanceof Q$1||Gn$2(u))continue;throw u}if(_o$1(r,i,o))return new pr$3;throw new Q$1(r)})}processSegmentAgainstRoute(n,e,r,i,o,a,c,s){return Zr$4(this,null,function*(){if(H$1(r)!==a&&(a===f$1||!Mt$2(i,o,r)))throw new Q$1(i);if(r.redirectTo===void 0)return this.matchSegmentAgainstRoute(n,i,r,o,a,s);if(this.allowRedirects&&c)return this.expandSegmentAgainstRouteUsingRedirect(n,i,e,r,o,a,s);throw new Q$1(i)})}expandSegmentAgainstRouteUsingRedirect(n,e,r,i,o,a,c){return Zr$4(this,null,function*(){let{matched:s,parameters:u,consumedSegments:h,positionalParamSegments:v,remainingSegments:g}=Zn$2(e,i,o);if(!s)throw new Q$1(e);typeof i.redirectTo=="string"&&i.redirectTo[0]==="/"&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>Oo$1&&(this.allowRedirects=false));let T=this.createSnapshot(n,i,o,u,c);if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let z=yield this.applyRedirects.applyRedirectCommands(h,i.redirectTo,v,Yn$2(T),n),ie=yield this.applyRedirects.lineralizeSegments(i,z);return this.processSegment(n,r,e,ie.concat(g),a,false,c)})}createSnapshot(n,e,r,i,o){let a=new Te$1(r,i,Object.freeze(G$b({},this.urlTree.queryParams)),this.urlTree.fragment,xo$1(e),H$1(e),e.component??e._loadedComponent??null,e,jo$1(e),n),c=vr$3(a,o,this.paramsInheritanceStrategy);return a.params=Object.freeze(c.params),a.data=Object.freeze(c.data),a}matchSegmentAgainstRoute(n,e,r,i,o,a){return Zr$4(this,null,function*(){if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let c=oe=>this.createSnapshot(n,r,oe.consumedSegments,oe.parameters,a),s=yield ht$2(Eo$1(e,r,i,n,this.urlSerializer,c,this.abortSignal));if(r.path==="**"&&(e.children={}),!s?.matched)throw new Q$1(e);n=r._injector??n;let{routes:u}=yield this.getChildConfig(n,r,i),h=r._loadedInjector??n,{parameters:v,consumedSegments:g,remainingSegments:T}=s,z=this.createSnapshot(n,r,g,v,a),{segmentGroup:ie,slicedSegments:Ue}=mn$3(e,g,T,u,o);if(Ue.length===0&&ie.hasChildren()){let oe=yield this.processChildren(h,u,ie,z);return new _$1(z,oe)}if(u.length===0&&Ue.length===0)return new _$1(z,[]);let Lt=H$1(r)===o,Ke=yield this.processSegment(h,u,ie,Ue,Lt?f$1:o,true,z);return new _$1(z,Ke instanceof _$1?[Ke]:[])})}getChildConfig(n,e,r){return Zr$4(this,null,function*(){if(e.children)return {routes:e.children,injector:n};if(e.loadChildren){if(e._loadedRoutes!==void 0){let o=e._loadedNgModuleFactory;return o&&!e._loadedInjector&&(e._loadedInjector=o.create(n).injector),{routes:e._loadedRoutes,injector:e._loadedInjector}}if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);if(yield ht$2(Ro$1(n,e,r,this.urlSerializer,this.abortSignal))){let o=yield this.configLoader.loadChildren(n,e);return e._loadedRoutes=o.routes,e._loadedInjector=o.injector,e._loadedNgModuleFactory=o.factory,o}throw wo$1()}return {routes:[],injector:n}})}};function Po$1(t){t.sort((n,e)=>n.value.outlet===f$1?-1:e.value.outlet===f$1?1:n.value.outlet.localeCompare(e.value.outlet));}function Lo$1(t){let n=t.value.routeConfig;return n&&n.path===""}function Jn$2(t){let n=[],e=new Set;for(let r of t){if(!Lo$1(r)){n.push(r);continue}let i=n.find(o=>r.value.routeConfig===o.value.routeConfig);i!==void 0?(i.children.push(...r.children),e.add(i)):n.push(r);}for(let r of e){let i=Jn$2(r.children);n.push(new _$1(r.value,i));}return n.filter(r=>!e.has(r))}function xo$1(t){return t.data||{}}function jo$1(t){return t.resolve||{}}function ko$1(t,n,e,r,i,o,a){return Te$5(c=>Zr$4(null,null,function*(){let{state:s,tree:u}=yield Uo$1(t,n,e,r,c.extractedUrl,i,o,a);return z$5(G$b({},c),{targetSnapshot:s,urlAfterRedirects:u})}))}function $o$1(t){return Te$5(n=>{let{targetSnapshot:e,guards:{canActivateChecks:r}}=n;if(!r.length)return Tm(n);let i=new Set(r.map(c=>c.route)),o=new Set;for(let c of i)if(!o.has(c))for(let s of Xn$2(c))o.add(s);let a=0;return Pe$4(o).pipe(mu(c=>i.has(c)?zo$1(c,e,t):(c.data=vr$3(c,c.parent,t).resolve,Tm(void 0))),Cu(()=>a++),Xm(1),Te$5(c=>a===o.size?Tm(n):Ct$b))})}function Xn$2(t){let n=t.children.map(e=>Xn$2(e)).flat();return [t,...n]}function zo$1(t,n,e){let r=t.routeConfig,i=t._resolve;return r?.title!==void 0&&!zn$2(r)&&(i[Ve$3]=r.title),Vm(()=>(t.data=vr$3(t,t.parent,e).resolve,Ho$1(i,t,n).pipe(ke$3(o=>(t._resolvedData=o,t.data=G$b(G$b({},t.data),o),null)))))}function Ho$1(t,n,e){let r=rr$3(t);if(r.length===0)return Tm({});let i={};return Pe$4(r).pipe(Te$5(o=>Fo$1(t[o],n,e).pipe(Jm(),Cu(a=>{if(a instanceof Ne$1)throw Et$2(new K$2,a);i[o]=a;}))),Xm(1),ke$3(()=>i),ws$4(o=>Gn$2(o)?Ct$b:bm(o)))}function Fo$1(t,n,e){let r=n._environmentInjector,i=De$1(t,r),o=i.resolve?i.resolve(n,e):$o$4(r,()=>i(n,e));return he$3(o)}function yn$3(t){return ry(n=>{let e=t(n);return e?Pe$4(e).pipe(ke$3(()=>n)):Tm(n)})}var Cr$3=(()=>{class t{buildTitle(e){let r,i=e.root;for(;i!==void 0;)r=this.getResolvedTitleForRoute(i)??r,i=i.children.find(o=>o.outlet===f$1);return r}getResolvedTitleForRoute(e){return e.data[Ve$3]}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(ei$3)})}return t})(),ei$3=(()=>{class t extends Cr$3{title;constructor(e){super(),this.title=e;}updateTitle(e){let r=this.buildTitle(e);r!==void 0&&this.title.setTitle(r);}static \u0275fac=function(r){return new(r||t)(se$8(ym))};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),ne$2=new N$7("",{factory:()=>({})}),fe$2=new N$7(""),Dt$1=(()=>{class t{componentLoaders=new WeakMap;childrenLoaders=new WeakMap;onLoadStartListener;onLoadEndListener;compiler=w$4(GT);loadComponent(e,r){return Zr$4(this,null,function*(){if(this.componentLoaders.get(r))return this.componentLoaders.get(r);if(r._loadedComponent)return Promise.resolve(r._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(r);let i=Zr$4(this,null,function*(){try{let o=yield wn$3($o$4(e,()=>r.loadComponent())),a=yield ri$2(jj(o));return this.onLoadEndListener&&this.onLoadEndListener(r),r._loadedComponent=a,a}finally{this.componentLoaders.delete(r);}});return this.componentLoaders.set(r,i),i})}loadChildren(e,r){if(this.childrenLoaders.get(r))return this.childrenLoaders.get(r);if(r._loadedRoutes)return Promise.resolve({routes:r._loadedRoutes,injector:r._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(r);let i=Zr$4(this,null,function*(){try{let o=yield ti$1(r,this.compiler,e,this.onLoadEndListener);return r._loadedRoutes=o.routes,r._loadedInjector=o.injector,r._loadedNgModuleFactory=o.factory,o}finally{this.childrenLoaders.delete(r);}});return this.childrenLoaders.set(r,i),i}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function ti$1(t,n,e,r){return Zr$4(this,null,function*(){let i=yield wn$3($o$4(e,()=>t.loadChildren())),o=yield ri$2(jj(i)),a;o instanceof wh$2||Array.isArray(o)?a=o:a=yield n.compileModuleAsync(o),r&&r(t);let c,s,h;return Array.isArray(a)?(s=a,true):(c=a.create(e).injector,h=a,s=c.get(fe$2,[],{optional:true,self:true}).flat()),{routes:s.map(Sr$3),injector:c,factory:h}})}function ri$2(t){return Zr$4(this,null,function*(){return t})}var _t$2=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(qo$2)})}return t})(),qo$2=(()=>{class t{shouldProcessUrl(e){return true}extract(e){return e}merge(e,r){return e}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})(),wr$3=new N$7(""),br$3=new N$7("");function ni$2(t,n,e){let r=t.get(br$3),i=t.get(gr$6);if(!i.startViewTransition||r.skipNextTransition)return r.skipNextTransition=false,new Promise(u=>setTimeout(u));let o,a=new Promise(u=>{o=u;}),c=i.startViewTransition(()=>(o(),Bo$1(t)));c.updateCallbackDone.catch(u=>{}),c.ready.catch(u=>{}),c.finished.catch(u=>{});let{onViewTransitionCreated:s}=r;return s&&$o$4(t,()=>s({transition:c,from:n,to:e})),a}function Bo$1(t){return new Promise(n=>{Tp$1({read:()=>setTimeout(n)},{injector:t});})}var ii$2=new N$7(""),Vo$1=()=>{},Ir$3=new N$7(""),Ut$2=(()=>{class t{currentNavigation=vt$9(null,{equal:()=>false});currentTransition=null;lastSuccessfulNavigation=vt$9(null);events=new te$9;transitionAbortWithErrorSubject=new te$9;configLoader=w$4(Dt$1);environmentInjector=w$4(me$5);destroyRef=w$4(xe$3);urlSerializer=w$4(re$1);rootContexts=w$4(de$2);location=w$4(Fi$4);inputBindingEnabled=w$4(Ge$2,{optional:true})!==null;titleStrategy=w$4(Cr$3);options=w$4(ne$2,{optional:true})||{};paramsInheritanceStrategy=this.options.paramsInheritanceStrategy||Qi$2;urlHandlingStrategy=w$4(_t$2);createViewTransition=w$4(wr$3,{optional:true});navigationErrorHandler=w$4(Ir$3,{optional:true});activatedRouteInjectorFeature=w$4(ii$2,{optional:true});navigationId=0;get hasRequestedNavigation(){return this.navigationId!==0}transitions;afterPreactivation=()=>Tm(void 0);rootComponentType=null;destroyed=false;constructor(){let e=i=>this.events.next(new yt$2(i)),r=i=>this.events.next(new Rt$2(i));this.configLoader.onLoadEndListener=r,this.configLoader.onLoadStartListener=e,this.destroyRef.onDestroy(()=>{this.destroyed=true;});}complete(){this.transitions?.complete();}handleNavigationRequest(e){let r=++this.navigationId;ge$5(()=>{this.transitions?.next(z$5(G$b({},e),{extractedUrl:this.urlHandlingStrategy.extract(e.rawUrl),targetSnapshot:null,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null,id:r,routesRecognizeHandler:{},beforeActivateHandler:{}}));});}setupNavigations(e){return this.transitions=new Bn$5(null),this.transitions.pipe(fn$7(r=>r!==null),ry(r=>{let i=true,o=false,a=new AbortController,c=()=>!o&&this.currentTransition?.id===r.id;return Tm(r).pipe(ry(s=>{if(this.navigationId>r.id)return this.cancelNavigationTransition(r,"",I$1.SupersededByNewNavigation),Ct$b;this.currentTransition=r;let u=this.lastSuccessfulNavigation();this.currentNavigation.set({id:s.id,initialUrl:s.rawUrl,extractedUrl:s.extractedUrl,targetBrowserUrl:typeof s.extras.browserUrl=="string"?this.urlSerializer.parse(s.extras.browserUrl):s.extras.browserUrl,trigger:s.source,extras:s.extras,previousNavigation:u?z$5(G$b({},u),{previousNavigation:null}):null,abort:()=>a.abort(),routesRecognizeHandler:s.routesRecognizeHandler,beforeActivateHandler:s.beforeActivateHandler});let h=!e.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl(),v=s.extras.onSameUrlNavigation??e.onSameUrlNavigation;if(!h&&v!=="reload")return this.events.next(new B$2(s.id,this.urlSerializer.serialize(s.rawUrl),"",be$1.IgnoredSameUrlNavigation)),s.resolve(false),Ct$b;if(this.urlHandlingStrategy.shouldProcessUrl(s.rawUrl))return Tm(s).pipe(ry(g=>(this.events.next(new te$3(g.id,this.urlSerializer.serialize(g.extractedUrl),g.source,g.restoredState)),g.id!==this.navigationId?Ct$b:Promise.resolve(g))),ko$1(this.environmentInjector,this.configLoader,this.rootComponentType,e.config,this.urlSerializer,this.paramsInheritanceStrategy,a.signal),Cu(g=>{r.targetSnapshot=g.targetSnapshot,r.urlAfterRedirects=g.urlAfterRedirects,this.currentNavigation.update(T=>(T.finalUrl=g.urlAfterRedirects,T)),this.events.next(new ze$1);}),ry(g=>Pe$4(r.routesRecognizeHandler.deferredHandle??Tm(void 0)).pipe(ke$3(()=>g))),Cu(()=>{let g=new $e$3(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);this.events.next(g);}));if(h&&this.urlHandlingStrategy.shouldProcessUrl(s.currentRawUrl)){let{id:g,extractedUrl:T,source:z,restoredState:ie,extras:Ue}=s,Lt=new te$3(g,this.urlSerializer.serialize(T),z,ie);this.events.next(Lt);let Ke=kn$3(this.rootComponentType,this.environmentInjector).snapshot;return this.currentTransition=r=z$5(G$b({},s),{targetSnapshot:Ke,urlAfterRedirects:T,extras:z$5(G$b({},Ue),{skipLocationChange:false,replaceUrl:false})}),this.currentNavigation.update(oe=>(oe.finalUrl=T,oe)),Tm(r)}else return this.events.next(new B$2(s.id,this.urlSerializer.serialize(s.extractedUrl),"",be$1.IgnoredByUrlHandlingStrategy)),s.resolve(false),Ct$b}),ke$3(s=>{let u=new pt$2(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);return this.events.next(u),this.currentTransition=r=z$5(G$b({},s),{guards:Xi$2(s.targetSnapshot,s.currentSnapshot,this.rootContexts)}),r}),lo$1(s=>this.events.next(s)),ry(s=>{if(r.guardsResult=s.guardsResult,s.guardsResult&&typeof s.guardsResult!="boolean")throw Et$2(this.urlSerializer,s.guardsResult);let u=new gt$1(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot,!!s.guardsResult);if(this.events.next(u),!c())return Ct$b;if(!s.guardsResult)return this.cancelNavigationTransition(s,"",I$1.GuardRejected),Ct$b;if(s.guards.canActivateChecks.length===0)return Tm(s);let h=new vt$1(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);if(this.events.next(h),!c())return Ct$b;let v=false;return Tm(s).pipe($o$1(this.paramsInheritanceStrategy),Cu({next:()=>{v=true;let g=new mt$3(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);this.events.next(g);},complete:()=>{v||this.cancelNavigationTransition(s,"",I$1.NoDataFromResolver);}}))}),yn$3(s=>{let u=v=>{let g=[];if(v.routeConfig?._loadedComponent)v.component=v.routeConfig?._loadedComponent;else if(v.routeConfig?.loadComponent){let T=v._environmentInjector;g.push(this.configLoader.loadComponent(T,v.routeConfig).then(z=>{v.component=z;}));}for(let T of v.children)g.push(...u(T));return g},h=u(s.targetSnapshot.root);return h.length===0?Tm(s):Pe$4(Promise.all(h).then(()=>s))}),ry(s=>{let{newlyCreatedRoutes:u,state:h}=Ki$2(e.routeReuseStrategy,s.targetSnapshot,s.currentRouterState);return this.currentTransition=r=s=z$5(G$b({},s),{targetRouterState:h,newlyCreatedRoutes:u}),this.currentNavigation.update(v=>(v.targetRouterState=h,v)),Tm(s)}),this.activatedRouteInjectorFeature?.operator()??(s=>s),yn$3(()=>this.afterPreactivation()),ry(()=>{let{currentSnapshot:s,targetSnapshot:u}=r,h=this.createViewTransition?.(this.environmentInjector,s.root,u.root);return h?Pe$4(h).pipe(ke$3(()=>r)):Tm(r)}),_t$9(1),ry(s=>{i=false,this.events.next(new Ae$1);let u=r.beforeActivateHandler.deferredHandle;return u?Pe$4(u.then(()=>s)):Tm(s)}),Cu(s=>{new hr$3(e.routeReuseStrategy,r.targetRouterState,r.currentRouterState,u=>this.events.next(u),this.inputBindingEnabled).activate(this.rootContexts),s.newlyCreatedRoutes?.clear(),c()&&(o=true,this.currentNavigation.update(u=>(u.abort=Vo$1,u)),this.lastSuccessfulNavigation.set(ge$5(this.currentNavigation)),this.events.next(new $$2(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects))),this.titleStrategy?.updateTitle(s.targetRouterState.snapshot),s.resolve(true));}),bu(Wn$2(a.signal).pipe(fn$7(()=>!o&&i),Cu(()=>{this.cancelNavigationTransition(r,a.signal.reason+"",I$1.Aborted);}))),Cu({complete:()=>{o=true;}}),bu(this.transitionAbortWithErrorSubject.pipe(Cu(s=>{throw s}))),zl$2(()=>{a.abort(),o||this.cancelNavigationTransition(r,"",I$1.SupersededByNewNavigation),this.currentTransition?.id===r.id&&(this.currentNavigation.set(null),this.currentTransition=null);}),ws$4(s=>{if(o=true,Rn$2(r),this.destroyed)return r.resolve(false),Ct$b;if(Vn$2(s))this.events.next(new k$1(r.id,this.urlSerializer.serialize(r.extractedUrl),s.message,s.cancellationCode)),Ji$2(s)?this.events.next(new Ee$1(s.url,s.navigationBehaviorOptions)):r.resolve(false);else {let u=new le$1(r.id,this.urlSerializer.serialize(r.extractedUrl),s,r.targetSnapshot??void 0);try{let h=$o$4(this.environmentInjector,()=>this.navigationErrorHandler?.(u));if(h instanceof Ne$1){let{message:v,cancellationCode:g}=Et$2(this.urlSerializer,h);this.events.next(new k$1(r.id,this.urlSerializer.serialize(r.extractedUrl),v,g)),this.events.next(new Ee$1(h.redirectTo,h.navigationBehaviorOptions));}else throw this.events.next(u),s}catch(h){this.options.resolveNavigationPromiseOnError?r.resolve(false):r.reject(h);}}return Ct$b}))}))}cancelNavigationTransition(e,r,i){Rn$2(e);let o=new k$1(e.id,this.urlSerializer.serialize(e.extractedUrl),r,i);this.events.next(o),e.resolve(false);}isUpdatingInternalState(){return this.currentTransition?.extractedUrl.toString()!==this.currentTransition?.currentUrlTree.toString()}isUpdatedBrowserUrl(){let e=this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true))),r=ge$5(this.currentNavigation),i=r?.targetBrowserUrl??r?.extractedUrl;return e.toString()!==i?.toString()&&!r?.extras.skipLocationChange}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function Go$1(t){return t!==Ce$2}function Rn$2(t){if(t.newlyCreatedRoutes)for(let n of t.newlyCreatedRoutes)n._localInjector?.destroy();}var oi$2=new N$7("");var ai$2=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(Wo$1)})}return t})(),Nt$3=class Nt{shouldDetach(n){return false}store(n,e){}shouldAttach(n){return false}retrieve(n){return null}shouldReuseRoute(n,e){return n.routeConfig===e.routeConfig}shouldDestroyInjector(n){return true}},Wo$1=(()=>{class t extends Nt$3{static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})(),Ot$2=(()=>{class t{urlSerializer=w$4(re$1);options=w$4(ne$2,{optional:true})||{};canceledNavigationResolution=this.options.canceledNavigationResolution||"replace";location=w$4(Fi$4);urlHandlingStrategy=w$4(_t$2);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";currentUrlTree=new U$1;getCurrentUrlTree(){return this.currentUrlTree}rawUrlTree=this.currentUrlTree;getRawUrlTree(){return this.rawUrlTree}createBrowserPath({finalUrl:e,initialUrl:r,targetBrowserUrl:i}){let o=e!==void 0?this.urlHandlingStrategy.merge(e,r):r,a=i??o;return a instanceof U$1?this.urlSerializer.serialize(a):a}routerUrlState(e){return e?.targetBrowserUrl===void 0||e?.finalUrl===void 0?{}:{\u0275routerUrl:this.urlSerializer.serialize(e.finalUrl)}}commitTransition({targetRouterState:e,finalUrl:r,initialUrl:i}){r&&e?(this.currentUrlTree=r,this.rawUrlTree=this.urlHandlingStrategy.merge(r,i),this.routerState=e):this.rawUrlTree=i;}routerState=kn$3(null,w$4(me$5));getRouterState(){return this.routerState}_stateMemento=this.createStateMemento();get stateMemento(){return this._stateMemento}updateStateMemento(){this._stateMemento=this.createStateMemento();}createStateMemento(){return {rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}restoredState(){return this.location.getState()}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:()=>w$4(Qo$2)})}return t})(),Qo$2=(()=>{class t extends Ot$2{currentPageId=0;lastSuccessfulId=-1;get browserPageId(){return this.canceledNavigationResolution!=="computed"?this.currentPageId:this.restoredState()?.\u0275routerPageId??this.currentPageId}registerNonRouterCurrentEntryChangeListener(e){return this.location.subscribe(r=>{r.type==="popstate"&&setTimeout(()=>{e(r.url,r.state,"popstate",{replaceUrl:true});});})}handleRouterEvent(e,r){e instanceof te$3?this.updateStateMemento():e instanceof B$2?this.commitTransition(r):e instanceof $e$3?this.urlUpdateStrategy==="eager"&&(r.extras.skipLocationChange||this.setBrowserUrl(this.createBrowserPath(r),r)):e instanceof Ae$1?(this.commitTransition(r),this.urlUpdateStrategy==="deferred"&&!r.extras.skipLocationChange&&this.setBrowserUrl(this.createBrowserPath(r),r)):e instanceof k$1&&!jn$2(e)?this.restoreHistory(r):e instanceof le$1?this.restoreHistory(r,true):e instanceof $$2&&(this.lastSuccessfulId=e.id,this.currentPageId=this.browserPageId);}setBrowserUrl(e,r){let{extras:i,id:o}=r,{replaceUrl:a,state:c}=i;if(this.location.isCurrentPathEqualTo(e)||a){let s=this.browserPageId,u=G$b(G$b({},c),this.generateNgRouterState(o,s,r));this.location.replaceState(e,"",u);}else {let s=G$b(G$b({},c),this.generateNgRouterState(o,this.browserPageId+1,r));this.location.go(e,"",s);}}restoreHistory(e,r=false){if(this.canceledNavigationResolution==="computed"){let i=this.browserPageId,o=this.currentPageId-i;o!==0?this.location.historyGo(o):this.getCurrentUrlTree()===e.finalUrl&&o===0&&(this.resetInternalState(e),this.resetUrlToCurrentUrlTree());}else this.canceledNavigationResolution==="replace"&&(r&&this.resetInternalState(e),this.resetUrlToCurrentUrlTree());}resetInternalState({finalUrl:e}){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,e??this.rawUrlTree);}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId));}generateNgRouterState(e,r,i){return this.canceledNavigationResolution==="computed"?G$b({navigationId:e,\u0275routerPageId:r},this.routerUrlState(i)):G$b({navigationId:e},this.routerUrlState(i))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function Pt$1(t,n){t.events.pipe(fn$7(e=>e instanceof $$2||e instanceof k$1||e instanceof le$1||e instanceof B$2),ke$3(e=>e instanceof $$2||e instanceof B$2?0:(e instanceof k$1?e.code===I$1.Redirect||e.code===I$1.SupersededByNewNavigation:false)?2:1),fn$7(e=>e!==2),_t$9(1)).subscribe(()=>{n();});}var G$3=(()=>{class t{get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}disposed=false;nonRouterCurrentEntryChangeSubscription;console=w$4(Iw);stateManager=w$4(Ot$2);options=w$4(ne$2,{optional:true})||{};pendingTasks=w$4(yt$b);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";navigationTransitions=w$4(Ut$2);urlSerializer=w$4(re$1);location=w$4(Fi$4);urlHandlingStrategy=w$4(_t$2);injector=w$4(me$5);_events=new te$9;get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}navigated=false;routeReuseStrategy=w$4(ai$2);injectorCleanup=w$4(oi$2,{optional:true});onSameUrlNavigation=this.options.onSameUrlNavigation||"ignore";config=w$4(fe$2,{optional:true})?.flat()??[];componentInputBindingEnabled=!!w$4(Ge$2,{optional:true});currentNavigation=this.navigationTransitions.currentNavigation.asReadonly();constructor(){this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this).subscribe({error:e=>{}}),this.subscribeToNavigationEvents();}eventsSubscription=new j$5;subscribeToNavigationEvents(){let e=this.navigationTransitions.events.subscribe(r=>{try{let i=this.navigationTransitions.currentTransition,o=ge$5(this.navigationTransitions.currentNavigation);if(i!==null&&o!==null){if(this.stateManager.handleRouterEvent(r,o),r instanceof k$1&&r.code!==I$1.Redirect&&r.code!==I$1.SupersededByNewNavigation)this.navigated=!0;else if(r instanceof $$2)this.navigated=!0,this.injectorCleanup?.(this.routeReuseStrategy,this.routerState,this.config);else if(r instanceof Ee$1){let a=r.navigationBehaviorOptions,c=this.urlHandlingStrategy.merge(r.url,i.currentRawUrl),s=G$b({scroll:i.extras.scroll,browserUrl:i.extras.browserUrl,info:i.extras.info,skipLocationChange:i.extras.skipLocationChange,replaceUrl:i.extras.replaceUrl||this.urlUpdateStrategy==="eager"||Go$1(i.source)},a);this.scheduleNavigation(c,Ce$2,null,s,{resolve:i.resolve,reject:i.reject,promise:i.promise});}}Gi$2(r)&&this._events.next(r);}catch(i){this.navigationTransitions.transitionAbortWithErrorSubject.next(i);}});this.eventsSubscription.add(e);}resetRootComponentType(e){this.routerState.root.component=e,this.navigationTransitions.rootComponentType=e;}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(true),Ce$2,this.stateManager.restoredState(),{replaceUrl:true});}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??=this.stateManager.registerNonRouterCurrentEntryChangeListener((e,r,i,o)=>{this.navigateToSyncWithBrowser(e,i,r,o);});}navigateToSyncWithBrowser(e,r,i,o){let a=i?.navigationId?i:null,c=i?.\u0275routerUrl??e;if(i?.\u0275routerUrl&&(o=z$5(G$b({},o),{browserUrl:e})),i){let u=G$b({},i);delete u.navigationId,delete u.\u0275routerPageId,delete u.\u0275routerUrl,Object.keys(u).length!==0&&(o.state=u);}let s=this.parseUrl(c);this.scheduleNavigation(s,r,a,o).catch(u=>{this.disposed||this.injector.get(qt$9)(u);});}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return ge$5(this.navigationTransitions.currentNavigation)}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(e){this.config=e.map(Sr$3),this.navigated=false;}ngOnDestroy(){this.dispose();}dispose(){this._events.unsubscribe(),this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription?.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0,this.disposed=true,this.eventsSubscription.unsubscribe();}createUrlTree(e,r={}){let{relativeTo:i,queryParams:o,fragment:a,queryParamsHandling:c,preserveFragment:s}=r,u=s?this.currentUrlTree.fragment:a,h=null;switch(c??this.options.defaultQueryParamsHandling){case "merge":h=G$b(G$b({},this.currentUrlTree.queryParams),o);break;case "preserve":h=this.currentUrlTree.queryParams;break;default:h=o||null;}h!==null&&(h=this.removeEmptyProps(h));let v;try{let g=i?i.snapshot:this.routerState.snapshot.root;v=On$2(g);}catch(g){(typeof e[0]!="string"||e[0][0]!=="/")&&(e=[]),v=this.currentUrlTree.root;}return Pn$3(v,e,h,u??null,this.urlSerializer)}navigateByUrl(e,r={skipLocationChange:false}){let i=ee$3(e)?e:this.parseUrl(e),o=this.urlHandlingStrategy.merge(i,this.rawUrlTree);return this.scheduleNavigation(o,Ce$2,null,r)}navigate(e,r={skipLocationChange:false}){return Ko$1(e),this.navigateByUrl(this.createUrlTree(e,r),r)}serializeUrl(e){return this.urlSerializer.serialize(e)}parseUrl(e){try{return this.urlSerializer.parse(e)}catch(r){return this.console.warn(er$5(4018,false)),this.urlSerializer.parse("/")}}isActive(e,r){let i;if(r===true?i=G$b({},In$3):r===false?i=G$b({},nr$3):i=G$b(G$b({},nr$3),r),ee$3(e))return dn$3(this.currentUrlTree,e,i);let o=this.parseUrl(e);return dn$3(this.currentUrlTree,o,i)}removeEmptyProps(e){return Object.entries(e).reduce((r,[i,o])=>(o!=null&&(r[i]=o),r),{})}scheduleNavigation(e,r,i,o,a){if(this.disposed)return Promise.resolve(false);let c,s,u;a?(c=a.resolve,s=a.reject,u=a.promise):u=new Promise((v,g)=>{c=v,s=g;});let h=this.pendingTasks.add();return Pt$1(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(h));}),this.navigationTransitions.handleNavigationRequest({source:r,restoredState:i,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:e,extras:o,resolve:c,reject:s,promise:u,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),u.catch(Promise.reject.bind(Promise))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})();function Ko$1(t){for(let n=0;n<t.length;n++)if(t[n]==null)throw new b$2(4008,false)}var Zo$2=(()=>{class t{router=w$4(G$3);stateManager=w$4(Ot$2);fragment=vt$9("");queryParams=vt$9({});path=vt$9("");serializer=w$4(re$1);constructor(){this.updateState(),this.router.events?.subscribe(e=>{e instanceof $$2&&this.updateState();});}updateState(){let{fragment:e,root:r,queryParams:i}=this.stateManager.getCurrentUrlTree();this.fragment.set(e),this.queryParams.set(i),this.path.set(this.serializer.serialize(new U$1(r)));}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Pr$5({token:t,factory:t.\u0275fac})}return t})(),si$2=(()=>{class t{router;route;tabIndexAttribute;renderer;el;locationStrategy;hrefAttributeValue=w$4(new Lg("href"),{optional:true});reactiveHref=vl$2(()=>this.isAnchorElement?this.computeHref(this._urlTree()):this.hrefAttributeValue);get href(){return ge$5(this.reactiveHref)}set href(e){this.reactiveHref.set(e);}set target(e){this._target.set(e);}get target(){return ge$5(this._target)}_target=vt$9(void 0);set queryParams(e){this._queryParams.set(e);}get queryParams(){return ge$5(this._queryParams)}_queryParams=vt$9(void 0,{equal:()=>false});set fragment(e){this._fragment.set(e);}get fragment(){return ge$5(this._fragment)}_fragment=vt$9(void 0);set queryParamsHandling(e){this._queryParamsHandling.set(e);}get queryParamsHandling(){return ge$5(this._queryParamsHandling)}_queryParamsHandling=vt$9(void 0);set state(e){this._state.set(e);}get state(){return ge$5(this._state)}_state=vt$9(void 0,{equal:()=>false});set info(e){this._info.set(e);}get info(){return ge$5(this._info)}_info=vt$9(void 0,{equal:()=>false});set relativeTo(e){this._relativeTo.set(e);}get relativeTo(){return ge$5(this._relativeTo)}_relativeTo=vt$9(void 0);set preserveFragment(e){this._preserveFragment.set(e);}get preserveFragment(){return ge$5(this._preserveFragment)}_preserveFragment=vt$9(false);set skipLocationChange(e){this._skipLocationChange.set(e);}get skipLocationChange(){return ge$5(this._skipLocationChange)}_skipLocationChange=vt$9(false);set replaceUrl(e){this._replaceUrl.set(e);}get replaceUrl(){return ge$5(this._replaceUrl)}_replaceUrl=vt$9(false);browserUrl=Hj(void 0);isAnchorElement;onChanges=new te$9;applicationErrorHandler=w$4(qt$9);options=w$4(ne$2,{optional:true});reactiveRouterState=w$4(Zo$2);constructor(e,r,i,o,a,c){this.router=e,this.route=r,this.tabIndexAttribute=i,this.renderer=o,this.el=a,this.locationStrategy=c;let s=a.nativeElement.tagName?.toLowerCase();this.isAnchorElement=s==="a"||s==="area"||!!(typeof customElements=="object"&&customElements.get(s)?.observedAttributes?.includes?.("href"));}setTabIndexIfNotOnNativeEl(e){this.tabIndexAttribute!=null||this.isAnchorElement||this.applyAttributeValue("tabindex",e);}ngOnChanges(e){this.onChanges.next(this);}routerLinkInput=vt$9(null);set routerLink(e){e==null?(this.routerLinkInput.set(null),this.setTabIndexIfNotOnNativeEl(null)):(ee$3(e)?this.routerLinkInput.set(e):this.routerLinkInput.set(Array.isArray(e)?e:[e]),this.setTabIndexIfNotOnNativeEl("0"));}onClick(e,r,i,o,a){let c=this._urlTree();if(c===null||this.isAnchorElement&&(e!==0||r||i||o||a||typeof this.target=="string"&&this.target!="_self"))return true;let s=this.browserUrl(),u=G$b({skipLocationChange:this.skipLocationChange,replaceUrl:this.replaceUrl,state:this.state,info:this.info},s!==void 0&&{browserUrl:s});return this.router.navigateByUrl(c,u)?.catch(h=>{this.applicationErrorHandler(h);}),!this.isAnchorElement}ngOnDestroy(){}applyAttributeValue(e,r){let i=this.renderer,o=this.el.nativeElement;r!==null?i.setAttribute(o,e,r):i.removeAttribute(o,e);}_urlTree=Dt$9(()=>{this.reactiveRouterState.path(),this._preserveFragment()&&this.reactiveRouterState.fragment();let e=i=>i==="preserve"||i==="merge";(e(this._queryParamsHandling())||e(this.options?.defaultQueryParamsHandling))&&this.reactiveRouterState.queryParams();let r=this.routerLinkInput();return r===null||!this.router.createUrlTree?null:ee$3(r)?r:this.router.createUrlTree(r,{relativeTo:this._relativeTo()!==void 0?this._relativeTo():this.route,queryParams:this._queryParams(),fragment:this._fragment(),queryParamsHandling:this._queryParamsHandling(),preserveFragment:this._preserveFragment()})},{equal:(e,r)=>this.computeHref(e)===this.computeHref(r)});get urlTree(){return ge$5(this._urlTree)}computeHref(e){return e!==null&&this.locationStrategy?this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(e))??"":null}static \u0275fac=function(r){return new(r||t)(Ur$4(G$3),Ur$4(V),Bf$1("tabindex"),Ur$4(tD),Ur$4(Lr$5),Ur$4(et$e))};static \u0275dir=nw({type:t,selectors:[["","routerLink",""]],hostVars:2,hostBindings:function(r,i){r&1&&Qh("click",function(a){return i.onClick(a.button,a.ctrlKey,a.shiftKey,a.altKey,a.metaKey)}),r&2&&Hh("href",i.reactiveHref(),wI)("target",i._target());},inputs:{target:"target",queryParams:"queryParams",fragment:"fragment",queryParamsHandling:"queryParamsHandling",state:"state",info:"info",relativeTo:"relativeTo",preserveFragment:[2,"preserveFragment","preserveFragment",Zj],skipLocationChange:[2,"skipLocationChange","skipLocationChange",Zj],replaceUrl:[2,"replaceUrl","replaceUrl",Zj],browserUrl:[1,"browserUrl"],routerLink:"routerLink"},features:[lv]})}return t})();var Qe$1=class Qe{};var ci$3=(()=>{class t{router;injector;preloadingStrategy;loader;subscription;constructor(e,r,i,o){this.router=e,this.injector=r,this.preloadingStrategy=i,this.loader=o;}setUpPreloading(){this.subscription=this.router.events.pipe(fn$7(e=>e instanceof $$2),mu(()=>this.preload())).subscribe(()=>{});}preload(){return this.processRoutes(this.injector,this.router.config)}ngOnDestroy(){this.subscription?.unsubscribe();}processRoutes(e,r){let i=[];for(let o of r){o.providers&&!o._injector&&(o._injector=Th(o.providers,e,""));let a=o._injector??e;o._loadedNgModuleFactory&&!o._loadedInjector&&(o._loadedInjector=o._loadedNgModuleFactory.create(a).injector);let c=o._loadedInjector??a;(o.loadChildren&&!o._loadedRoutes&&o.canLoad===void 0||o.loadComponent&&!o._loadedComponent)&&i.push(this.preloadConfig(a,o)),(o.children||o._loadedRoutes)&&i.push(this.processRoutes(c,o.children??o._loadedRoutes));}return Pe$4(i).pipe(qn$5())}preloadConfig(e,r){return this.preloadingStrategy.preload(r,()=>{if(e.destroyed)return Tm(null);let i;r.loadChildren&&r.canLoad===void 0?i=Pe$4(this.loader.loadChildren(e,r)):i=Tm(null);let o=i.pipe(Te$5(a=>a===null?Tm(void 0):(r._loadedRoutes=a.routes,r._loadedInjector=a.injector,r._loadedNgModuleFactory=a.factory,this.processRoutes(a.injector??e,a.routes))));if(r.loadComponent&&!r._loadedComponent){let a=this.loader.loadComponent(e,r);return Pe$4([o,a]).pipe(qn$5())}else return o})}static \u0275fac=function(r){return new(r||t)(se$8(G$3),se$8(me$5),se$8(Qe$1),se$8(Dt$1))};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),ui$4=new N$7(""),Jo$2=(()=>{class t{options;routerEventsSubscription;scrollEventsSubscription;lastId=0;lastSource=Ce$2;restoredId=0;store={};isHydrating=w$4(Lv,{optional:true})??false;urlSerializer=w$4(re$1);zone=w$4(ue$7);viewportScroller=w$4(Rd);transitions=w$4(Ut$2);constructor(e){this.options=e,this.options.scrollPositionRestoration||="disabled",this.options.anchorScrolling||="disabled",this.isHydrating&&w$4(qr$4).whenStable().then(()=>{this.isHydrating=false;});}init(){this.options.scrollPositionRestoration!=="disabled"&&this.viewportScroller.setHistoryScrollRestoration("manual"),this.routerEventsSubscription=this.createScrollEvents(),this.scrollEventsSubscription=this.consumeScrollEvents();}createScrollEvents(){return this.transitions.events.subscribe(e=>{e instanceof te$3?(this.store[this.lastId]=this.viewportScroller.getScrollPosition(),this.lastSource=e.navigationTrigger,this.restoredId=e.restoredState?e.restoredState.navigationId:0):e instanceof $$2?(this.lastId=e.id,this.scheduleScrollEvent(e,this.urlSerializer.parse(e.urlAfterRedirects).fragment)):e instanceof B$2&&e.code===be$1.IgnoredSameUrlNavigation&&(this.lastSource=void 0,this.restoredId=0,this.scheduleScrollEvent(e,this.urlSerializer.parse(e.url).fragment));})}consumeScrollEvents(){return this.transitions.events.subscribe(e=>{if(!(e instanceof Ie$1)||e.scrollBehavior==="manual")return;let r={behavior:"instant"};e.position?this.options.scrollPositionRestoration==="top"?this.viewportScroller.scrollToPosition([0,0],r):this.options.scrollPositionRestoration==="enabled"&&this.viewportScroller.scrollToPosition(e.position,r):e.anchor&&this.options.anchorScrolling==="enabled"?this.viewportScroller.scrollToAnchor(e.anchor):this.options.scrollPositionRestoration!=="disabled"&&this.viewportScroller.scrollToPosition([0,0]);})}scheduleScrollEvent(e,r){if(this.isHydrating)return;let i=ge$5(this.transitions.currentNavigation)?.extras.scroll;this.zone.runOutsideAngular(()=>Zr$4(this,null,function*(){yield new Promise(o=>{setTimeout(o),typeof requestAnimationFrame<"u"&&requestAnimationFrame(o);}),this.zone.run(()=>{this.transitions.events.next(new Ie$1(e,this.lastSource==="popstate"?this.store[this.restoredId]:null,r,i));});}));}ngOnDestroy(){this.routerEventsSubscription?.unsubscribe(),this.scrollEventsSubscription?.unsubscribe();}static \u0275fac=function(r){gD();};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();function Xo$2(t,...n){return ar$6([{provide:fe$2,multi:true,useValue:t},{provide:V,useFactory:li$3},{provide:Fh$1,multi:true,useFactory:hi$4},n.map(e=>e.\u0275providers)])}function li$3(){return w$4(G$3).routerState.root}function _e$1(t,n){return {\u0275kind:t,\u0275providers:n}}function hi$4(){let t=w$4(be$5);return n=>{let e=t.get(qr$4);if(n!==e.components[0])return;let r=t.get(G$3),i=t.get(di$3);t.get(Er$3)===1&&r.initialNavigation(),t.get(gi$4,null,{optional:true})?.setUpPreloading(),t.get(ui$4,null,{optional:true})?.init(),r.resetRootComponentType(e.componentTypes[0]),i.closed||(i.next(),i.complete(),i.unsubscribe());}}var di$3=new N$7("",{factory:()=>new te$9}),Er$3=new N$7("",{factory:()=>1});function fi$4(){let t=[{provide:Fv,useValue:true},{provide:Er$3,useValue:0},iw(()=>{let n=w$4(be$5);return n.get(fa$4,Promise.resolve()).then(()=>new Promise(r=>{let i=n.get(G$3),o=n.get(di$3);Pt$1(i,()=>{r(true);}),n.get(Ut$2).afterPreactivation=()=>(r(true),o.closed?Tm(void 0):o),i.initialNavigation();}))})];return _e$1(2,t)}function pi$3(){let t=[iw(()=>{w$4(G$3).setUpLocationChangeListener();}),{provide:Er$3,useValue:2}];return _e$1(3,t)}var gi$4=new N$7("");function vi$4(t){return _e$1(0,[{provide:gi$4,useExisting:ci$3},{provide:Qe$1,useExisting:t}])}function ea$3(){return _e$1(6,[{provide:et$e,useClass:ba$4}])}function mi$3(t={}){return _e$1(8,[{provide:Ge$2,useFactory:()=>new Fn$2(t)}])}function yi$3(t){Re$7("NgRouterViewTransitions");let n=[{provide:wr$3,useValue:ni$2},{provide:br$3,useValue:G$b({skipNextTransition:false},t)}];return _e$1(9,n)}var Ri$3=[Fi$4,{provide:re$1,useClass:K$2},G$3,de$2,{provide:V,useFactory:li$3},Dt$1],ta$3=(()=>{class t{constructor(){}static forRoot(e,r){return {ngModule:t,providers:[Ri$3,[],{provide:fe$2,multi:true,useValue:e},[],r?.errorHandler?{provide:Ir$3,useValue:r.errorHandler}:[],{provide:ne$2,useValue:r||{}},r?.useHash?na$3():ia$3(),ra$3(),r?.preloadingStrategy?vi$4(r.preloadingStrategy).\u0275providers:[],r?.initialNavigation?oa$3(r):[],r?.bindToComponentInputs?mi$3(typeof r.bindToComponentInputs=="object"?r.bindToComponentInputs:{}).\u0275providers:[],r?.enableViewTransitions?yi$3().\u0275providers:[],aa$3()]}}static forChild(e){return {ngModule:t,providers:[{provide:fe$2,multi:true,useValue:e}]}}static \u0275fac=function(r){return new(r||t)};static \u0275mod=bh$1({type:t});static \u0275inj=Qs$2({})}return t})();function ra$3(){return {provide:ui$4,useFactory:()=>{let t=w$4(Rd),n=w$4(ne$2);return n.scrollOffset&&t.setOffset(n.scrollOffset),new Jo$2(n)}}}function na$3(){return {provide:et$e,useClass:ba$4}}function ia$3(){return {provide:et$e,useClass:xi$5}}function oa$3(t){return [t.initialNavigation==="disabled"?pi$3().\u0275providers:[],t.initialNavigation==="enabledBlocking"?fi$4().\u0275providers:[]]}var Ar$3=new N$7("");function aa$3(){return [{provide:Ar$3,useFactory:hi$4},{provide:Fh$1,multi:true,useExisting:Ar$3}]}
6635
6635
  var we=yb(($,Q)=>{(function(f,R){typeof $=="object"&&typeof Q<"u"?Q.exports=R():typeof define=="function"&&define.amd?define(R):(f=typeof globalThis<"u"?globalThis:f||self,f.Qty=R());})($,function(){"use strict";function f(e){return typeof e=="string"||e instanceof String}var R=Number.isFinite||window.isFinite;function n(e){return R(e)}function l(e){return e}function p(e){var t={};return e.filter(function(r){return t.hasOwnProperty(r)?!1:t[r]=!0})}function c(e,t){if(t.length!==e.length)return !1;for(var r=0;r<e.length;r++)if(t[r].compareArray&&!t[r].compareArray(e[r])||t[r]!==e[r])return !1;return !0}function y(e,t){Object.keys(t).forEach(function(r){e[r]=t[r];});}function h(){for(var e=1,t=0,r=0;r<arguments.length;r++){var i=arguments[r];t=t+ee(i),e*=i;}return t!==0?F(e,t):e}function x(e,t){if(t===0)throw new Error("Divide by zero");var r=Math.pow(10,ee(t)),i=r/(r*t);return h(e,i)}function F(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}function ee(e){if(!isFinite(e))return 0;for(var t=0;e%1!==0;)e*=10,t++;return t}function m(){var e;if(!this)return e=Object.create(m.prototype),m.apply(e,arguments),e;e=Error.apply(this,arguments),this.name="QtyError",this.message=e.message,this.stack=e.stack;}m.prototype=Object.create(Error.prototype,{constructor:{value:m}});function z(e,t){throw new m("Incompatible units: "+e+" and "+t)}var S={"<googol>":[["googol"],1e100,"prefix"],"<kibi>":[["Ki","Kibi","kibi"],Math.pow(2,10),"prefix"],"<mebi>":[["Mi","Mebi","mebi"],Math.pow(2,20),"prefix"],"<gibi>":[["Gi","Gibi","gibi"],Math.pow(2,30),"prefix"],"<tebi>":[["Ti","Tebi","tebi"],Math.pow(2,40),"prefix"],"<pebi>":[["Pi","Pebi","pebi"],Math.pow(2,50),"prefix"],"<exi>":[["Ei","Exi","exi"],Math.pow(2,60),"prefix"],"<zebi>":[["Zi","Zebi","zebi"],Math.pow(2,70),"prefix"],"<yebi>":[["Yi","Yebi","yebi"],Math.pow(2,80),"prefix"],"<yotta>":[["Y","Yotta","yotta"],1e24,"prefix"],"<zetta>":[["Z","Zetta","zetta"],1e21,"prefix"],"<exa>":[["E","Exa","exa"],1e18,"prefix"],"<peta>":[["P","Peta","peta"],1e15,"prefix"],"<tera>":[["T","Tera","tera"],1e12,"prefix"],"<giga>":[["G","Giga","giga"],1e9,"prefix"],"<mega>":[["M","Mega","mega"],1e6,"prefix"],"<kilo>":[["k","kilo"],1e3,"prefix"],"<hecto>":[["h","Hecto","hecto"],100,"prefix"],"<deca>":[["da","Deca","deca","deka"],10,"prefix"],"<deci>":[["d","Deci","deci"],.1,"prefix"],"<centi>":[["c","Centi","centi"],.01,"prefix"],"<milli>":[["m","Milli","milli"],.001,"prefix"],"<micro>":[["u","\u03BC","\xB5","Micro","mc","micro"],1e-6,"prefix"],"<nano>":[["n","Nano","nano"],1e-9,"prefix"],"<pico>":[["p","Pico","pico"],1e-12,"prefix"],"<femto>":[["f","Femto","femto"],1e-15,"prefix"],"<atto>":[["a","Atto","atto"],1e-18,"prefix"],"<zepto>":[["z","Zepto","zepto"],1e-21,"prefix"],"<yocto>":[["y","Yocto","yocto"],1e-24,"prefix"],"<1>":[["1","<1>"],1,""],"<meter>":[["m","meter","meters","metre","metres"],1,"length",["<meter>"]],"<inch>":[["in","inch","inches",'"'],.0254,"length",["<meter>"]],"<foot>":[["ft","foot","feet","'"],.3048,"length",["<meter>"]],"<yard>":[["yd","yard","yards"],.9144,"length",["<meter>"]],"<mile>":[["mi","mile","miles"],1609.344,"length",["<meter>"]],"<naut-mile>":[["nmi","naut-mile"],1852,"length",["<meter>"]],"<league>":[["league","leagues"],4828,"length",["<meter>"]],"<furlong>":[["furlong","furlongs"],201.2,"length",["<meter>"]],"<rod>":[["rd","rod","rods"],5.029,"length",["<meter>"]],"<mil>":[["mil","mils"],254e-7,"length",["<meter>"]],"<angstrom>":[["ang","angstrom","angstroms"],1e-10,"length",["<meter>"]],"<fathom>":[["fathom","fathoms"],1.829,"length",["<meter>"]],"<pica>":[["pica","picas"],.00423333333,"length",["<meter>"]],"<point>":[["pt","point","points"],.000352777778,"length",["<meter>"]],"<redshift>":[["z","red-shift","redshift"],1302773e20,"length",["<meter>"]],"<AU>":[["AU","astronomical-unit"],1495979e5,"length",["<meter>"]],"<light-second>":[["ls","light-second"],299792500,"length",["<meter>"]],"<light-minute>":[["lmin","light-minute"],1798755e4,"length",["<meter>"]],"<light-year>":[["ly","light-year"],9460528e9,"length",["<meter>"]],"<parsec>":[["pc","parsec","parsecs"],3085678e10,"length",["<meter>"]],"<datamile>":[["DM","datamile"],1828.8,"length",["<meter>"]],"<kilogram>":[["kg","kilogram","kilograms"],1,"mass",["<kilogram>"]],"<AMU>":[["u","AMU","amu"],1660538921e-36,"mass",["<kilogram>"]],"<dalton>":[["Da","Dalton","Daltons","dalton","daltons"],1660538921e-36,"mass",["<kilogram>"]],"<slug>":[["slug","slugs"],14.5939029,"mass",["<kilogram>"]],"<short-ton>":[["tn","ton","short-ton"],907.18474,"mass",["<kilogram>"]],"<metric-ton>":[["t","tonne","metric-ton"],1e3,"mass",["<kilogram>"]],"<carat>":[["ct","carat","carats"],2e-4,"mass",["<kilogram>"]],"<pound>":[["lbs","lb","pound","pounds","#"],.45359237,"mass",["<kilogram>"]],"<ounce>":[["oz","ounce","ounces"],.0283495231,"mass",["<kilogram>"]],"<gram>":[["g","gram","grams","gramme","grammes"],.001,"mass",["<kilogram>"]],"<grain>":[["grain","grains","gr"],6479891e-11,"mass",["<kilogram>"]],"<dram>":[["dram","drams","dr"],.0017718452,"mass",["<kilogram>"]],"<stone>":[["stone","stones","st"],6.35029318,"mass",["<kilogram>"]],"<hectare>":[["hectare"],1e4,"area",["<meter>","<meter>"]],"<acre>":[["acre","acres"],4046.85642,"area",["<meter>","<meter>"]],"<sqft>":[["sqft"],1,"area",["<foot>","<foot>"]],"<liter>":[["l","L","liter","liters","litre","litres"],.001,"volume",["<meter>","<meter>","<meter>"]],"<gallon>":[["gal","gallon","gallons"],.0037854118,"volume",["<meter>","<meter>","<meter>"]],"<gallon-imp>":[["galimp","gallon-imp","gallons-imp"],.00454609,"volume",["<meter>","<meter>","<meter>"]],"<quart>":[["qt","quart","quarts"],.00094635295,"volume",["<meter>","<meter>","<meter>"]],"<pint>":[["pt","pint","pints"],.000473176475,"volume",["<meter>","<meter>","<meter>"]],"<pint-imp>":[["ptimp","pint-imp","pints-imp"],.00056826125,"volume",["<meter>","<meter>","<meter>"]],"<cup>":[["cu","cup","cups"],.000236588238,"volume",["<meter>","<meter>","<meter>"]],"<fluid-ounce>":[["floz","fluid-ounce","fluid-ounces"],295735297e-13,"volume",["<meter>","<meter>","<meter>"]],"<fluid-ounce-imp>":[["flozimp","floz-imp","fluid-ounce-imp","fluid-ounces-imp"],284130625e-13,"volume",["<meter>","<meter>","<meter>"]],"<tablespoon>":[["tb","tbsp","tbs","tablespoon","tablespoons"],147867648e-13,"volume",["<meter>","<meter>","<meter>"]],"<teaspoon>":[["tsp","teaspoon","teaspoons"],492892161e-14,"volume",["<meter>","<meter>","<meter>"]],"<bushel>":[["bu","bsh","bushel","bushels"],.035239072,"volume",["<meter>","<meter>","<meter>"]],"<oilbarrel>":[["bbl","oilbarrel","oilbarrels","oil-barrel","oil-barrels"],.158987294928,"volume",["<meter>","<meter>","<meter>"]],"<beerbarrel>":[["bl","bl-us","beerbarrel","beerbarrels","beer-barrel","beer-barrels"],.1173477658,"volume",["<meter>","<meter>","<meter>"]],"<beerbarrel-imp>":[["blimp","bl-imp","beerbarrel-imp","beerbarrels-imp","beer-barrel-imp","beer-barrels-imp"],.16365924,"volume",["<meter>","<meter>","<meter>"]],"<kph>":[["kph"],.277777778,"speed",["<meter>"],["<second>"]],"<mph>":[["mph"],.44704,"speed",["<meter>"],["<second>"]],"<knot>":[["kt","kn","kts","knot","knots"],.514444444,"speed",["<meter>"],["<second>"]],"<fps>":[["fps"],.3048,"speed",["<meter>"],["<second>"]],"<gee>":[["gee"],9.80665,"acceleration",["<meter>"],["<second>","<second>"]],"<Gal>":[["Gal"],.01,"acceleration",["<meter>"],["<second>","<second>"]],"<kelvin>":[["degK","kelvin"],1,"temperature",["<kelvin>"]],"<celsius>":[["degC","celsius","celsius","centigrade"],1,"temperature",["<kelvin>"]],"<fahrenheit>":[["degF","fahrenheit"],5/9,"temperature",["<kelvin>"]],"<rankine>":[["degR","rankine"],5/9,"temperature",["<kelvin>"]],"<temp-K>":[["tempK","temp-K"],1,"temperature",["<temp-K>"]],"<temp-C>":[["tempC","temp-C"],1,"temperature",["<temp-K>"]],"<temp-F>":[["tempF","temp-F"],5/9,"temperature",["<temp-K>"]],"<temp-R>":[["tempR","temp-R"],5/9,"temperature",["<temp-K>"]],"<second>":[["s","sec","secs","second","seconds"],1,"time",["<second>"]],"<minute>":[["min","mins","minute","minutes"],60,"time",["<second>"]],"<hour>":[["h","hr","hrs","hour","hours"],3600,"time",["<second>"]],"<day>":[["d","day","days"],3600*24,"time",["<second>"]],"<week>":[["wk","week","weeks"],7*3600*24,"time",["<second>"]],"<fortnight>":[["fortnight","fortnights"],1209600,"time",["<second>"]],"<year>":[["y","yr","year","years","annum"],31556926,"time",["<second>"]],"<decade>":[["decade","decades"],315569260,"time",["<second>"]],"<century>":[["century","centuries"],3155692600,"time",["<second>"]],"<pascal>":[["Pa","pascal","Pascal"],1,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<bar>":[["bar","bars"],1e5,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<mmHg>":[["mmHg"],133.322368,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<inHg>":[["inHg"],3386.3881472,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<torr>":[["torr"],133.322368,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<atm>":[["atm","ATM","atmosphere","atmospheres"],101325,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<psi>":[["psi"],6894.76,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<cmh2o>":[["cmH2O","cmh2o"],98.0638,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<inh2o>":[["inH2O","inh2o"],249.082052,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<poise>":[["P","poise"],.1,"viscosity",["<kilogram>"],["<meter>","<second>"]],"<stokes>":[["St","stokes"],1e-4,"viscosity",["<meter>","<meter>"],["<second>"]],"<mole>":[["mol","mole"],1,"substance",["<mole>"]],"<molar>":[["M","molar"],1e3,"molar_concentration",["<mole>"],["<meter>","<meter>","<meter>"]],"<wtpercent>":[["wt%","wtpercent"],10,"molar_concentration",["<kilogram>"],["<meter>","<meter>","<meter>"]],"<katal>":[["kat","katal","Katal"],1,"activity",["<mole>"],["<second>"]],"<unit>":[["U","enzUnit","unit"],16667e-19,"activity",["<mole>"],["<second>"]],"<farad>":[["F","farad","Farad"],1,"capacitance",["<second>","<second>","<second>","<second>","<ampere>","<ampere>"],["<meter>","<meter>","<kilogram>"]],"<coulomb>":[["C","coulomb","Coulomb"],1,"charge",["<ampere>","<second>"]],"<Ah>":[["Ah"],3600,"charge",["<ampere>","<second>"]],"<ampere>":[["A","Ampere","ampere","amp","amps"],1,"current",["<ampere>"]],"<siemens>":[["S","Siemens","siemens"],1,"conductance",["<second>","<second>","<second>","<ampere>","<ampere>"],["<kilogram>","<meter>","<meter>"]],"<henry>":[["H","Henry","henry"],1,"inductance",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>","<ampere>"]],"<volt>":[["V","Volt","volt","volts"],1,"potential",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<second>","<ampere>"]],"<ohm>":[["Ohm","ohm","\u03A9","\u2126"],1,"resistance",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<second>","<ampere>","<ampere>"]],"<weber>":[["Wb","weber","webers"],1,"magnetism",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>"]],"<tesla>":[["T","tesla","teslas"],1,"magnetism",["<kilogram>"],["<second>","<second>","<ampere>"]],"<gauss>":[["G","gauss"],1e-4,"magnetism",["<kilogram>"],["<second>","<second>","<ampere>"]],"<maxwell>":[["Mx","maxwell","maxwells"],1e-8,"magnetism",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>"]],"<oersted>":[["Oe","oersted","oersteds"],250/Math.PI,"magnetism",["<ampere>"],["<meter>"]],"<joule>":[["J","joule","Joule","joules","Joules"],1,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<erg>":[["erg","ergs"],1e-7,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<btu>":[["BTU","btu","BTUs"],1055.056,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<calorie>":[["cal","calorie","calories"],4.184,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<Calorie>":[["Cal","Calorie","Calories"],4184,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<therm-US>":[["th","therm","therms","Therm","therm-US"],105480400,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<Wh>":[["Wh"],3600,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<electronvolt>":[["eV","electronvolt","electronvolts"],1602176634e-28,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<newton>":[["N","Newton","newton"],1,"force",["<kilogram>","<meter>"],["<second>","<second>"]],"<dyne>":[["dyn","dyne"],1e-5,"force",["<kilogram>","<meter>"],["<second>","<second>"]],"<pound-force>":[["lbf","pound-force"],4.448222,"force",["<kilogram>","<meter>"],["<second>","<second>"]],"<hertz>":[["Hz","hertz","Hertz"],1,"frequency",["<1>"],["<second>"]],"<radian>":[["rad","radian","radians"],1,"angle",["<radian>"]],"<degree>":[["deg","degree","degrees"],Math.PI/180,"angle",["<radian>"]],"<arcminute>":[["arcmin","arcminute","arcminutes"],Math.PI/10800,"angle",["<radian>"]],"<arcsecond>":[["arcsec","arcsecond","arcseconds"],Math.PI/648e3,"angle",["<radian>"]],"<gradian>":[["gon","grad","gradian","grads"],Math.PI/200,"angle",["<radian>"]],"<steradian>":[["sr","steradian","steradians"],1,"solid_angle",["<steradian>"]],"<rotation>":[["rotation"],2*Math.PI,"angle",["<radian>"]],"<rpm>":[["rpm"],2*Math.PI/60,"angular_velocity",["<radian>"],["<second>"]],"<byte>":[["B","byte","bytes"],1,"information",["<byte>"]],"<bit>":[["b","bit","bits"],.125,"information",["<byte>"]],"<Bps>":[["Bps"],1,"information_rate",["<byte>"],["<second>"]],"<bps>":[["bps"],.125,"information_rate",["<byte>"],["<second>"]],"<dollar>":[["USD","dollar"],1,"currency",["<dollar>"]],"<cents>":[["cents"],.01,"currency",["<dollar>"]],"<candela>":[["cd","candela"],1,"luminosity",["<candela>"]],"<lumen>":[["lm","lumen"],1,"luminous_power",["<candela>","<steradian>"]],"<lux>":[["lux"],1,"illuminance",["<candela>","<steradian>"],["<meter>","<meter>"]],"<watt>":[["W","watt","watts"],1,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<volt-ampere>":[["VA","volt-ampere"],1,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<volt-ampere-reactive>":[["var","Var","VAr","VAR","volt-ampere-reactive"],1,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<horsepower>":[["hp","horsepower"],745.699872,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<gray>":[["Gy","gray","grays"],1,"radiation",["<meter>","<meter>"],["<second>","<second>"]],"<roentgen>":[["R","roentgen"],.00933,"radiation",["<meter>","<meter>"],["<second>","<second>"]],"<sievert>":[["Sv","sievert","sieverts"],1,"radiation",["<meter>","<meter>"],["<second>","<second>"]],"<becquerel>":[["Bq","becquerel","becquerels"],1,"radiation",["<1>"],["<second>"]],"<curie>":[["Ci","curie","curies"],37e9,"radiation",["<1>"],["<second>"]],"<cpm>":[["cpm"],1/60,"rate",["<count>"],["<second>"]],"<dpm>":[["dpm"],1/60,"rate",["<count>"],["<second>"]],"<bpm>":[["bpm"],1/60,"rate",["<count>"],["<second>"]],"<dot>":[["dot","dots"],1,"resolution",["<each>"]],"<pixel>":[["pixel","px"],1,"resolution",["<each>"]],"<ppi>":[["ppi"],1,"resolution",["<pixel>"],["<inch>"]],"<dpi>":[["dpi"],1,"typography",["<dot>"],["<inch>"]],"<cell>":[["cells","cell"],1,"counting",["<each>"]],"<each>":[["each"],1,"counting",["<each>"]],"<count>":[["count"],1,"counting",["<each>"]],"<base-pair>":[["bp","base-pair"],1,"counting",["<each>"]],"<nucleotide>":[["nt","nucleotide"],1,"counting",["<each>"]],"<molecule>":[["molecule","molecules"],1,"counting",["<1>"]],"<dozen>":[["doz","dz","dozen"],12,"prefix_only",["<each>"]],"<percent>":[["%","percent"],.01,"prefix_only",["<1>"]],"<ppm>":[["ppm"],1e-6,"prefix_only",["<1>"]],"<ppb>":[["ppb"],1e-9,"prefix_only",["<1>"]],"<ppt>":[["ppt"],1e-12,"prefix_only",["<1>"]],"<ppq>":[["ppq"],1e-15,"prefix_only",["<1>"]],"<gross>":[["gr","gross"],144,"prefix_only",["<dozen>","<dozen>"]],"<decibel>":[["dB","decibel","decibels"],1,"logarithmic",["<decibel>"]]},ke=["<meter>","<kilogram>","<second>","<mole>","<ampere>","<radian>","<kelvin>","<temp-K>","<byte>","<dollar>","<candela>","<each>","<steradian>","<decibel>"],K="<1>",b=[K];function Ce(e,t){var r=t[1],i=t[3]||[],s=t[4]||[];if(!n(r))throw new m(e+": Invalid unit definition. 'scalar' must be a number");i.forEach(function(a){if(S[a]===void 0)throw new m(e+": Invalid unit definition. Unit "+a+" in 'numerator' is not recognized")}),s.forEach(function(a){if(S[a]===void 0)throw new m(e+": Invalid unit definition. Unit "+a+" in 'denominator' is not recognized")});}var U={},N={},k={},P={},I={};for(var _ in S)if(S.hasOwnProperty(_)){var M=S[_];if(M[2]==="prefix"){U[_]=M[1];for(var G=0;G<M[0].length;G++)N[M[0][G]]=_;}else {Ce(_,M),k[_]={scalar:M[1],numerator:M[3],denominator:M[4]};for(var O=0;O<M[0].length;O++)P[M[0][O]]=_;}I[_]=M[0][0];}function Se(e){var t,r=[],i=Object.keys(S);if(typeof e>"u")for(t=0;t<i.length;t++)["","prefix"].indexOf(S[i[t]][2])===-1&&r.push(i[t].substr(1,i[t].length-2));else {if(this.getKinds().indexOf(e)===-1)throw new m("Kind not recognized");for(t=0;t<i.length;t++)S[i[t]][2]===e&&r.push(i[t].substr(1,i[t].length-2));}return r.sort(function(s,a){return s.toLowerCase()<a.toLowerCase()?-1:s.toLowerCase()>a.toLowerCase()?1:0})}function Me(e){if(!P[e])throw new m("Unit not recognized");return S[P[e]][0]}var L=["length","time","temperature","mass","current","substance","luminosity","currency","information","angle"];function Te(){if(this.signature)return this.signature;for(var e=te.call(this),t=0;t<e.length;t++)e[t]*=Math.pow(20,t);return e.reduce(function(r,i){return r+i},0)}function te(){if(!this.isBase())return te.call(this.toBase());for(var e=new Array(L.length),t=0;t<e.length;t++)e[t]=0;for(var r,i,s=0;s<this.numerator.length;s++)(r=S[this.numerator[s]])&&(i=L.indexOf(r[2]),i>=0&&(e[i]=e[i]+1));for(var a=0;a<this.denominator.length;a++)(r=S[this.denominator[a]])&&(i=L.indexOf(r[2]),i>=0&&(e[i]=e[i]-1));return e}var re="[+-]",W="\\d+",qe=re+"?"+W,ne="\\."+W,xe="(?:"+W+"(?:"+ne+")?)|(?:"+ne+")",Ue="[Ee]"+qe,_e="(?:"+xe+")(?:"+Ue+")?",Ee=re+"?\\s*"+_e,Ae="("+Ee+")?\\s*([^/]*)(?:/(.+))?",Pe=new RegExp("^"+Ae+"$"),ie="\\^|\\*{2}",se="[01234]",De=new RegExp("([^ \\*\\d]+?)(?:"+ie+")?(-?"+se+"(?![a-zA-Z]))"),Re=new RegExp("([^ \\*\\d]+?)(?:"+ie+")?("+se+"(?![a-zA-Z]))");function ae(e){f(e)||(e=e.toString()),e=e.trim();var t=Pe.exec(e);if(!t)throw new m(e+": Quantity not recognized");var r=t[1];r?(r=r.replace(/\s/g,""),this.scalar=parseFloat(r)):this.scalar=1;for(var i=t[2],s=t[3],a,g,d;t=De.exec(i);){if(a=parseFloat(t[2]),isNaN(a))throw new m("Unit exponent is not a number");if(a===0&&!J.test(t[1]))throw new m("Unit not recognized");g=t[1]+" ",d="";for(var v=0;v<Math.abs(a);v++)d+=g;a>=0?i=i.replace(t[0],d):(s=s?s+d:d,i=i.replace(t[0],""));}for(;t=Re.exec(s);){if(a=parseFloat(t[2]),isNaN(a))throw new m("Unit exponent is not a number");if(a===0&&!J.test(t[1]))throw new m("Unit not recognized");g=t[1]+" ",d="";for(var C=0;C<a;C++)d+=g;s=s.replace(t[0],d);}i&&(this.numerator=me(i.trim())),s&&(this.denominator=me(s.trim()));}var ze=Object.keys(N).sort(function(e,t){return t.length-e.length}).join("|"),Fe=Object.keys(P).sort(function(e,t){return t.length-e.length}).join("|"),Ke="\\b|$",oe="("+ze+")??("+Fe+")(?:"+Ke+")",J=new RegExp("^\\s*("+oe+"[\\s\\*]*)+$"),Ne=new RegExp(oe,"g"),ue={};function me(e){var t=ue[e];if(t)return t;var r,i=[];if(!J.test(e))throw new m("Unit not recognized");for(;r=Ne.exec(e);)i.push(r.slice(1));return i=i.map(function(s){return N[s[0]]?[N[s[0]],P[s[1]]]:[P[s[1]]]}),i=i.reduce(function(s,a){return s.concat(a)},[]),i=i.filter(function(s){return s}),ue[e]=i,i}function Ie(e){if(!f(e))throw new m("Argument should be a string");try{return this(e)}catch(t){return null}}function H(e){return e instanceof o}function o(e,t){if(He.apply(null,arguments),!H(this))return new o(e,t);if(this.scalar=null,this.baseScalar=null,this.signature=null,this._conversionCache={},this.numerator=b,this.denominator=b,ce(e)?(this.scalar=e.scalar,this.numerator=e.numerator&&e.numerator.length!==0?e.numerator:b,this.denominator=e.denominator&&e.denominator.length!==0?e.denominator:b):t?(ae.call(this,t),this.scalar=e):ae.call(this,e),this.denominator.join("*").indexOf("temp")>=0)throw new m("Cannot divide with temperatures");if(this.numerator.join("*").indexOf("temp")>=0){if(this.numerator.length>1)throw new m("Cannot multiply by temperatures");if(!c(this.denominator,b))throw new m("Cannot divide with temperatures")}if(this.initValue=e,Be.call(this),this.isTemperature()&&this.baseScalar<0)throw new m("Temperatures must not be less than absolute zero")}o.prototype={constructor:o};function He(e,t){if(t){if(!(n(e)&&f(t)))throw new m("Only number accepted as initialization value when units are explicitly provided")}else if(!(f(e)||n(e)||H(e)||ce(e)))throw new m("Only string, number or quantity accepted as single initialization value")}function ce(e){return e&&typeof e=="object"&&e.hasOwnProperty("scalar")}function Be(){if(this.baseScalar)return this.baseScalar;if(this.isBase())this.baseScalar=this.scalar,this.signature=Te.call(this);else {var e=this.toBase();this.baseScalar=e.scalar,this.signature=e.signature;}}var V={"-312078":"elastance","-312058":"resistance","-312038":"inductance","-152058":"potential","-152040":"magnetism","-152038":"magnetism","-7997":"specific_volume","-79":"snap","-59":"jolt","-39":"acceleration","-38":"radiation","-20":"frequency","-19":"speed","-18":"viscosity","-17":"volumetric_flow","-1":"wavenumber",0:"unitless",1:"length",2:"area",3:"volume",20:"time",400:"temperature",7941:"yank",7942:"power",7959:"pressure",7961:"force",7962:"energy",7979:"viscosity",7981:"momentum",7982:"angular_momentum",7997:"density",7998:"area_density",8e3:"mass",152020:"radiation_exposure",159999:"magnetism",16e4:"current",160020:"charge",312058:"conductance",312078:"capacitance",3199980:"activity",3199997:"molar_concentration",32e5:"substance",63999998:"illuminance",64e6:"luminous_power",128e7:"currency","25599999980":"information_rate","25600000000":"information","511999999980":"angular_velocity","512000000000":"angle"};function Ge(){return p(Object.keys(V).map(function(e){return V[e]}))}o.prototype.kind=function(){return V[this.signature.toString()]},y(o.prototype,{isDegrees:function(){return (this.signature===null||this.signature===400)&&this.numerator.length===1&&c(this.denominator,b)&&(this.numerator[0].match(/<temp-[CFRK]>/)||this.numerator[0].match(/<(kelvin|celsius|rankine|fahrenheit)>/))},isTemperature:function(){return this.isDegrees()&&this.numerator[0].match(/<temp-[CFRK]>/)}});function Oe(e,t){var r=e.units(),i=t.to(r),s=o(j(r));return o({scalar:e.scalar-i.scalar,numerator:s.numerator,denominator:s.denominator})}function Le(e,t){var r=t.to(j(e.units()));return o({scalar:e.scalar-r.scalar,numerator:e.numerator,denominator:e.denominator})}function le(e,t){var r=t.to(j(e.units()));return o({scalar:e.scalar+r.scalar,numerator:e.numerator,denominator:e.denominator})}function j(e){if(e==="tempK")return "degK";if(e==="tempC")return "degC";if(e==="tempF")return "degF";if(e==="tempR")return "degR";throw new m("Unknown type for temp conversion from: "+e)}function We(e,t){var r=Je(e),i=t.units(),s;if(i==="degK")s=r.scalar;else if(i==="degC")s=r.scalar;else if(i==="degF")s=r.scalar*9/5;else if(i==="degR")s=r.scalar*9/5;else throw new m("Unknown type for degree conversion to: "+i);return o({scalar:s,numerator:t.numerator,denominator:t.denominator})}function Je(e){var t=e.units(),r;if(t.match(/(deg)[CFRK]/))r=e.baseScalar;else if(t==="tempK")r=e.scalar;else if(t==="tempC")r=e.scalar;else if(t==="tempF")r=e.scalar*5/9;else if(t==="tempR")r=e.scalar*5/9;else throw new m("Unknown type for temp conversion from: "+t);return o({scalar:r,numerator:["<kelvin>"],denominator:b})}function Ve(e,t){var r=t.units(),i;if(r==="tempK")i=e.baseScalar;else if(r==="tempC")i=e.baseScalar-273.15;else if(r==="tempF")i=e.baseScalar*9/5-459.67;else if(r==="tempR")i=e.baseScalar*9/5;else throw new m("Unknown type for temp conversion to: "+r);return o({scalar:i,numerator:t.numerator,denominator:t.denominator})}function je(e){var t=e.units(),r;if(t.match(/(deg)[CFRK]/))r=e.baseScalar;else if(t==="tempK")r=e.scalar;else if(t==="tempC")r=e.scalar+273.15;else if(t==="tempF")r=(e.scalar+459.67)*5/9;else if(t==="tempR")r=e.scalar*5/9;else throw new m("Unknown type for temp conversion from: "+t);return o({scalar:r,numerator:["<temp-K>"],denominator:b})}y(o.prototype,{to:function(e){var t,r;if(e==null)return this;if(!f(e))return this.to(e.units());if(t=this._conversionCache[e],t)return t;if(r=o(e),r.units()===this.units())return this;if(!this.isCompatible(r))this.isInverse(r)?r=this.inverse().to(e):z(this.units(),r.units());else if(r.isTemperature())r=Ve(this,r);else if(r.isDegrees())r=We(this,r);else {var i=x(this.baseScalar,r.baseScalar);r=o({scalar:i,numerator:r.numerator,denominator:r.denominator});}return this._conversionCache[e]=r,r},toBase:function(){if(this.isBase())return this;if(this.isTemperature())return je(this);var e=pe[this.units()];return e||(e=Ye(this.numerator,this.denominator),pe[this.units()]=e),e.mul(this.scalar)},toFloat:function(){if(this.isUnitless())return this.scalar;throw new m("Can't convert to Float unless unitless. Use Unit#scalar")},toPrec:function(e){if(f(e)&&(e=o(e)),n(e)&&(e=o(e+" "+this.units())),this.isUnitless()?e.isUnitless()||z(this.units(),e.units()):e=e.to(this.units()),e.scalar===0)throw new m("Divide by zero");var t=h(Math.round(this.scalar/e.scalar),e.scalar);return o(t+this.units())}});function Xe(e,t){var r=o(e),i=o(t);if(r.eq(i))return l;var s;return r.isTemperature()?s=function(a){return r.mul(a).to(i).scalar}:s=function(a){return a*r.baseScalar/i.baseScalar},function(g){var d,v,C;if(Array.isArray(g)){for(v=g.length,C=[],d=0;d<v;d++)C.push(s(g[d]));return C}else return s(g)}}var pe={};function Ye(e,t){for(var r=[],i=[],s=1,a,g=0;g<e.length;g++)a=e[g],U[a]?s=h(s,U[a]):k[a]&&(s*=k[a].scalar,k[a].numerator&&r.push(k[a].numerator),k[a].denominator&&i.push(k[a].denominator));for(var d=0;d<t.length;d++)a=t[d],U[a]?s/=U[a]:k[a]&&(s/=k[a].scalar,k[a].numerator&&i.push(k[a].numerator),k[a].denominator&&r.push(k[a].denominator));return r=r.reduce(function(v,C){return v.concat(C)},[]),i=i.reduce(function(v,C){return v.concat(C)},[]),o({scalar:s,numerator:r,denominator:i})}o.parse=Ie,o.getUnits=Se,o.getAliases=Me,o.mulSafe=h,o.divSafe=x,o.getKinds=Ge,o.swiftConverter=Xe,o.Error=m,y(o.prototype,{add:function(e){if(f(e)&&(e=o(e)),this.isCompatible(e)||z(this.units(),e.units()),this.isTemperature()&&e.isTemperature())throw new m("Cannot add two temperatures");return this.isTemperature()?le(this,e):e.isTemperature()?le(e,this):o({scalar:this.scalar+e.to(this).scalar,numerator:this.numerator,denominator:this.denominator})},sub:function(e){if(f(e)&&(e=o(e)),this.isCompatible(e)||z(this.units(),e.units()),this.isTemperature()&&e.isTemperature())return Oe(this,e);if(this.isTemperature())return Le(this,e);if(e.isTemperature())throw new m("Cannot subtract a temperature from a differential degree unit");return o({scalar:this.scalar-e.to(this).scalar,numerator:this.numerator,denominator:this.denominator})},mul:function(e){if(n(e))return o({scalar:h(this.scalar,e),numerator:this.numerator,denominator:this.denominator});if(f(e)&&(e=o(e)),(this.isTemperature()||e.isTemperature())&&!(this.isUnitless()||e.isUnitless()))throw new m("Cannot multiply by temperatures");var t=this,r=e;t.isCompatible(r)&&t.signature!==400&&(r=r.to(t));var i=de(t.numerator,t.denominator,r.numerator,r.denominator);return o({scalar:h(t.scalar,r.scalar,i[2]),numerator:i[0],denominator:i[1]})},div:function(e){if(n(e)){if(e===0)throw new m("Divide by zero");return o({scalar:this.scalar/e,numerator:this.numerator,denominator:this.denominator})}else f(e)&&(e=o(e));if(e.scalar===0)throw new m("Divide by zero");if(e.isTemperature())throw new m("Cannot divide with temperatures");if(this.isTemperature()&&!e.isUnitless())throw new m("Cannot divide with temperatures");var t=this,r=e;t.isCompatible(r)&&t.signature!==400&&(r=r.to(t));var i=de(t.numerator,t.denominator,r.denominator,r.numerator);return o({scalar:h(t.scalar,i[2])/r.scalar,numerator:i[0],denominator:i[1]})},inverse:function(){if(this.isTemperature())throw new m("Cannot divide with temperatures");if(this.scalar===0)throw new m("Divide by zero");return o({scalar:1/this.scalar,numerator:this.denominator,denominator:this.numerator})}});function de(e,t,r,i){function s(T){return T!==K}e=e.filter(s),r=r.filter(s),t=t.filter(s),i=i.filter(s);var a={};function g(T,E){for(var q,B,Y,A=0;A<T.length;A++)if(U[T[A]]?(q=T[A+1],B=T[A],Y=U[B],A++):(q=T[A],B=null,Y=1),q&&q!==K)if(a[q]){a[q][0]+=E;var et=a[q][2]?U[a[q][2]]:1;a[q][E===1?3:4]*=x(Y,et);}else a[q]=[E,q,B,1,1];}g(e,1),g(t,-1),g(r,1),g(i,-1);var d=[],v=[],C=1;for(var ge in a)if(a.hasOwnProperty(ge)){var w=a[ge],D;if(w[0]>0)for(D=0;D<w[0];D++)d.push(w[2]===null?w[1]:[w[2],w[1]]);else if(w[0]<0)for(D=0;D<-w[0];D++)v.push(w[2]===null?w[1]:[w[2],w[1]]);C*=x(w[3],w[4]);}return d.length===0&&(d=b),v.length===0&&(v=b),d=d.reduce(function(T,E){return T.concat(E)},[]),v=v.reduce(function(T,E){return T.concat(E)},[]),[d,v,C]}y(o.prototype,{eq:function(e){return this.compareTo(e)===0},lt:function(e){return this.compareTo(e)===-1},lte:function(e){return this.eq(e)||this.lt(e)},gt:function(e){return this.compareTo(e)===1},gte:function(e){return this.eq(e)||this.gt(e)},compareTo:function(e){if(f(e))return this.compareTo(o(e));if(this.isCompatible(e)||z(this.units(),e.units()),this.baseScalar<e.baseScalar)return -1;if(this.baseScalar===e.baseScalar)return 0;if(this.baseScalar>e.baseScalar)return 1},same:function(e){return this.scalar===e.scalar&&this.units()===e.units()}}),y(o.prototype,{isUnitless:function(){return [this.numerator,this.denominator].every(function(e){return c(e,b)})},isCompatible:function(e){return f(e)?this.isCompatible(o(e)):H(e)&&e.signature!==void 0?this.signature===e.signature:!1},isInverse:function(e){return this.inverse().isCompatible(e)},isBase:function(){return this._isBase!==void 0?this._isBase:this.isDegrees()&&this.numerator[0].match(/<(kelvin|temp-K)>/)?(this._isBase=!0,this._isBase):(this.numerator.concat(this.denominator).forEach(function(e){e!==K&&ke.indexOf(e)===-1&&(this._isBase=!1);},this),this._isBase===!1?this._isBase:(this._isBase=!0,this._isBase))}});function X(){}X.prototype.get=function(e){return arguments.length>1&&(e=Array.apply(null,arguments)),e.reduce(function(t,r,i){if(t){var s=t[r];return i===e.length-1?s?s.data:void 0:s}},this)},X.prototype.set=function(e,t){return arguments.length>2&&(e=Array.prototype.slice.call(arguments,0,-1),t=arguments[arguments.length-1]),e.reduce(function(r,i,s){var a=r[i];return a===void 0&&(a=r[i]={}),s===e.length-1?(a.data=t,t):a},this)};function Ze(e,t){return (e+" "+t).trim()}o.formatter=Ze,y(o.prototype,{units:function(){if(this._units!==void 0)return this._units;var e=c(this.numerator,b),t=c(this.denominator,b);if(e&&t)return this._units="",this._units;var r=he(this.numerator),i=he(this.denominator);return this._units=r+(t?"":"/"+i),this._units},toString:function(e,t){var r;if(n(e))r=this.units(),t=e;else if(f(e))r=e;else if(H(e))return this.toPrec(e).toString(t);var i=this.to(r),s=t!==void 0?F(i.scalar,t):i.scalar;return i=(s+" "+i.units()).trim(),i},format:function(e,t){arguments.length===1&&typeof e=="function"&&(t=e,e=void 0),t=t||o.formatter;var r=this.to(e);return t.call(this,r.scalar,r.units())}});var fe=new X;function he(e){var t=fe.get(e);if(t)return t;var r=c(e,b);return r?t="1":t=Qe($e(e)).join("*"),fe.set(e,t),t}function $e(e){for(var t=[],r,i,s=0;s<e.length;s++)r=e[s],i=e[s+1],U[r]?(t.push(I[r]+I[i]),s++):t.push(I[r]);return t}function Qe(e){var t=e.reduce(function(r,i){var s=r[i];return s||r.push(s=r[i]=[i,0]),s[1]++,r},[]);return t.map(function(r){return r[0]+(r[1]>1?r[1]:"")})}return o.version="1.8.0",o});});var u$2=vb(we());var ut$2=(()=>{class f{SettingsService=w$4(Gi$3);data=w$4(De$2);_defaultUnitsSub;_conversionList=[{group:"Unitless",units:[{measure:"unitless",description:"As-Is numeric value"},{measure:" ",description:"No unit label - As-Is numeric value"}]},{group:"Speed",units:[{measure:"knots",description:"Knots - Nautical miles per hour"},{measure:"kph",description:"kph - Kilometers per hour"},{measure:"mph",description:"mph - Miles per hour"},{measure:"m/s",description:"m/s - Meters per second (base)"}]},{group:"Flow",units:[{measure:"m3/s",description:"Cubic meters per second (base)"},{measure:"l/min",description:"Liters per minute"},{measure:"l/h",description:"Liters per hour"},{measure:"g/min",description:"Gallons per minute"},{measure:"g/h",description:"Gallons per hour"}]},{group:"Fuel Distance",units:[{measure:"m/m3",description:"Meters per cubic meter (base)"},{measure:"nm/l",description:"Nautical Miles per liter"},{measure:"nm/g",description:"Nautical Miles per gallon"},{measure:"km/l",description:"Kilometers per liter"},{measure:"mpg",description:"Miles per Gallon"}]},{group:"Energy Distance",units:[{measure:"m/J",description:"Meters per Joule (base)"},{measure:"nm/J",description:"Nautical Miles per Joule"},{measure:"km/J",description:"Kilometers per Joule"},{measure:"nm/kWh",description:"Nautical Miles per Kilowatt-hour"},{measure:"km/kWh",description:"Kilometers per Kilowatt-hour"}]},{group:"Temperature",units:[{measure:"K",description:"Kelvin (base)"},{measure:"celsius",description:"Celsius"},{measure:"fahrenheit",description:"Fahrenheit"}]},{group:"Length",units:[{measure:"m",description:"Meters (base)"},{measure:"mm",description:"Millimeters"},{measure:"fathom",description:"Fathoms"},{measure:"nm",description:"Nautical Miles"},{measure:"km",description:"Kilometers"},{measure:"mi",description:"Miles"},{measure:"feet",description:"Feet"},{measure:"inch",description:"Inches"}]},{group:"Volume",units:[{measure:"liter",description:"Liters (base)"},{measure:"m3",description:"Cubic Meters"},{measure:"gallon",description:"Gallons"}]},{group:"Current",units:[{measure:"A",description:"Amperes (base)"},{measure:"mA",description:"Milliamperes"}]},{group:"Potential",units:[{measure:"V",description:"Volts (base)"},{measure:"mV",description:"Millivolts"}]},{group:"Charge",units:[{measure:"C",description:"Coulomb (base)"},{measure:"Ah",description:"Ampere*Hours"}]},{group:"Power",units:[{measure:"W",description:"Watts (base)"},{measure:"mW",description:"Milliwatts"}]},{group:"Energy",units:[{measure:"J",description:"Joules (base)"},{measure:"kWh",description:"Kilowatt*Hours"}]},{group:"Resistance",units:[{measure:"ohm",description:"\u2126 (base)"},{measure:"kiloohm",description:"k\u2126"}]},{group:"Pressure",units:[{measure:"Pa",description:"Pa (base)"},{measure:"kPa",description:"kPa"},{measure:"hPa",description:"hPa"},{measure:"mbar",description:"mbar"},{measure:"bar",description:"Bars"},{measure:"psi",description:"psi"},{measure:"mmHg",description:"mmHg"},{measure:"inHg",description:"inHg"}]},{group:"Density",units:[{measure:"kg/m3",description:"Air density - kg/cubic meter (base)"}]},{group:"Time",units:[{measure:"s",description:"Seconds (base)"},{measure:"Minutes",description:"Minutes"},{measure:"Hours",description:"Hours"},{measure:"Days",description:"Days"},{measure:"D HH:MM:SS",description:"Day Hour:Minute:sec"}]},{group:"Angular Velocity",units:[{measure:"rad/s",description:"Radians per second (base)"},{measure:"deg/s",description:"Degrees per second"},{measure:"deg/min",description:"Degrees per minute"}]},{group:"Angle",units:[{measure:"rad",description:"Radians (base)"},{measure:"deg",description:"Degrees"},{measure:"grad",description:"Gradians"}]},{group:"Frequency",units:[{measure:"rpm",description:"RPM - Rotations per minute"},{measure:"Hz",description:"Hz - Hertz (base)"},{measure:"KHz",description:"KHz - Kilohertz"},{measure:"MHz",description:"MHz - Megahertz"},{measure:"GHz",description:"GHz - Gigahertz"}]},{group:"Ratio",units:[{measure:"percent",description:"As percentage value"},{measure:"percentraw",description:"As ratio 0-1 with % sign"},{measure:"ratio",description:"Ratio 0-1 (base)"}]},{group:"Position",units:[{measure:"pdeg",description:"Position Degrees"},{measure:"latitudeMin",description:"Latitude in minutes"},{measure:"latitudeSec",description:"Latitude in seconds"},{measure:"longitudeMin",description:"Longitude in minutes"},{measure:"longitudeSec",description:"Longitude in seconds"}]}];skBaseUnits=[{unit:"s",properties:{display:"s",quantity:"Time",quantityDisplay:"t",description:"Elapsed time (interval) in seconds"}},{unit:"Hz",properties:{display:"Hz",quantity:"Frequency",quantityDisplay:"f",description:"Frequency in Hertz"}},{unit:"m3",properties:{display:"m\xB3",quantity:"Volume",quantityDisplay:"V",description:"Volume in cubic meters"}},{unit:"m3/s",properties:{display:"m\xB3/s",quantity:"Flow",quantityDisplay:"Q",description:"Liquid or gas flow in cubic meters per second"}},{unit:"kg/s",properties:{display:"kg/s",quantity:"Mass flow rate",quantityDisplay:"\u1E41",description:"Liquid or gas flow in kilograms per second"}},{unit:"kg/m3",properties:{display:"kg/m\xB3",quantity:"Density",quantityDisplay:"\u03C1",description:"Density in kg per cubic meter"}},{unit:"deg",properties:{display:"Position",quantity:"Angle",quantityDisplay:"\u2220",description:"Latitude or longitude in decimal degrees"}},{unit:"rad",properties:{display:"\xB0",quantity:"Angle",quantityDisplay:"\u2220",description:"Angular arc in radians"}},{unit:"rad/s",properties:{display:"\u33AD/s",quantity:"Rotation",quantityDisplay:"\u03C9",description:"Angular rate in radians per second"}},{unit:"A",properties:{display:"A",quantity:"Current",quantityDisplay:"I",description:"Electrical current in ampere"}},{unit:"C",properties:{display:"C",quantity:"Charge",quantityDisplay:"Q",description:"Electrical charge in Coulomb"}},{unit:"V",properties:{display:"V",quantity:"Voltage",quantityDisplay:"V",description:"Electrical potential in volt"}},{unit:"W",properties:{display:"W",quantity:"Power",quantityDisplay:"P",description:"Power in watt"}},{unit:"Nm",properties:{display:"Nm",quantity:"Torque",quantityDisplay:"\u03C4",description:"Torque in Newton meter"}},{unit:"J",properties:{display:"J",quantity:"Energy",quantityDisplay:"E",description:"Electrical energy in joule"}},{unit:"ohm",properties:{display:"\u2126",quantity:"Resistance",quantityDisplay:"R",description:"Electrical resistance in ohm"}},{unit:"m",properties:{display:"m",quantity:"Distance",quantityDisplay:"d",description:"Distance in meters"}},{unit:"m/s",properties:{display:"m/s",quantity:"Speed",quantityDisplay:"v",description:"Speed in meters per second"}},{unit:"m2",properties:{display:"\u33A1",quantity:"Area",quantityDisplay:"A",description:"(Surface) area in square meters"}},{unit:"K",properties:{display:"K",quantity:"Temperature",quantityDisplay:"T",description:"Temperature in kelvin"}},{unit:"Pa",properties:{display:"Pa",quantity:"Pressure",quantityDisplay:"P",description:"Pressure in pascal"}},{unit:"kg",properties:{display:"kg",quantity:"Mass",quantityDisplay:"m",description:"Mass in kilogram"}},{unit:"ratio",properties:{display:"",quantity:"Ratio",quantityDisplay:"\u03C6",description:"Relative value compared to reference or normal value. 0 = 0%, 1 = 100%, 1e-3 = 1 ppt"}},{unit:"m/s2",properties:{display:"m/s\xB2",quantity:"Acceleration",quantityDisplay:"a",description:"Acceleration in meters per second squared"}},{unit:"rad/s2",properties:{display:"rad/s\xB2",quantity:"Angular acceleration",quantityDisplay:"a",description:"Angular acceleration in radians per second squared"}},{unit:"N",properties:{display:"N",quantity:"Force",quantityDisplay:"F",description:"Force in newton"}},{unit:"T",properties:{display:"T",quantity:"Magnetic field",quantityDisplay:"B",description:"Magnetic field strength in tesla"}},{unit:"Lux",properties:{display:"lx",quantity:"Light Intensity",quantityDisplay:"Ev",description:"Light Intensity in lux"}},{unit:"Pa/s",properties:{display:"Pa/s",quantity:"Pressure rate",quantityDisplay:"R",description:"Pressure change rate in pascal per second"}},{unit:"Pa.s",properties:{display:"Pa s",quantity:"Viscosity",quantityDisplay:"\u03BC",description:"Viscosity in pascal seconds"}}];_defaultUnits={};constructor(){this._defaultUnitsSub=this.SettingsService.getDefaultUnitsAsO().subscribe(n=>{this._defaultUnits=n;});}unitConversionFunctions={unitless:function(n){return n}," ":function(n){return n},knots:u$2.default.swiftConverter("m/s","kn"),kph:u$2.default.swiftConverter("m/s","kph"),"m/s":function(n){return n},mph:u$2.default.swiftConverter("m/s","mph"),liter:u$2.default.swiftConverter("m^3","liter"),gallon:u$2.default.swiftConverter("m^3","gallon"),m3:function(n){return n},"m3/s":function(n){return n},"l/min":u$2.default.swiftConverter("m^3/s","liter/minute"),"l/h":u$2.default.swiftConverter("m^3/s","liter/hour"),"g/min":u$2.default.swiftConverter("m^3/s","gallon/minute"),"g/h":u$2.default.swiftConverter("m^3/s","gallon/hour"),"m/m3":function(n){return n},"nm/l":u$2.default.swiftConverter("m/m^3","naut-mile/liter"),"nm/g":u$2.default.swiftConverter("m/m^3","naut-mile/gallon"),"km/l":u$2.default.swiftConverter("m/m^3","km/liter"),mpg:u$2.default.swiftConverter("m/m^3","mile/gallon"),"m/J":function(n){return n},"nm/J":u$2.default.swiftConverter("m/J","naut-mile/J"),"km/J":u$2.default.swiftConverter("km/J","km/J"),"nm/kWh":u$2.default.swiftConverter("m/J","naut-mile/kWh"),"km/kWh":u$2.default.swiftConverter("m/J","km/kWh"),K:function(n){return n},celsius:u$2.default.swiftConverter("tempK","tempC"),fahrenheit:u$2.default.swiftConverter("tempK","tempF"),m:function(n){return n},mm:function(n){return n*1e3},fathom:u$2.default.swiftConverter("m","fathom"),feet:u$2.default.swiftConverter("m","foot"),inch:u$2.default.swiftConverter("m","in"),km:u$2.default.swiftConverter("m","km"),nm:u$2.default.swiftConverter("m","nmi"),mi:u$2.default.swiftConverter("m","mi"),V:function(n){return n},mV:function(n){return n*1e3},A:function(n){return n},mA:function(n){return n*1e3},C:function(n){return n},Ah:u$2.default.swiftConverter("C","Ah"),W:function(n){return n},mW:function(n){return n*1e3},J:function(n){return n},kWh:u$2.default.swiftConverter("J","kWh"),ohm:function(n){return n},kiloohm:function(n){return n/1e3},Pa:function(n){return n},bar:u$2.default.swiftConverter("Pa","bar"),psi:u$2.default.swiftConverter("Pa","psi"),mmHg:u$2.default.swiftConverter("Pa","mmHg"),inHg:u$2.default.swiftConverter("Pa","inHg"),hPa:u$2.default.swiftConverter("Pa","hPa"),kPa:u$2.default.swiftConverter("Pa","kPa"),mbar:u$2.default.swiftConverter("Pa","millibar"),"kg/m3":function(n){return n},s:function(n){return n},Minutes:u$2.default.swiftConverter("s","minutes"),Hours:u$2.default.swiftConverter("s","hours"),Days:u$2.default.swiftConverter("s","days"),"D HH:MM:SS":function(n){n=parseInt(n,10);let l=n<0;n=Math.abs(n);let p=Math.floor(n/86400),c=Math.floor(n%86400/3600),y=Math.floor(n%3600/60),h=Math.floor(n%60),x=l?"-":"";return p>0?x+=p+"d "+c.toString()+":"+y.toString().padStart(2,"0")+":"+h.toString().padStart(2,"0"):x+=c.toString()+":"+y.toString().padStart(2,"0")+":"+h.toString().padStart(2,"0"),x},"rad/s":function(n){return n},"deg/s":u$2.default.swiftConverter("rad/s","deg/s"),"deg/min":u$2.default.swiftConverter("rad/s","deg/min"),rpm:function(n){return n*60},Hz:function(n){return n},KHz:function(n){return n/1e3},MHz:function(n){return n/1e6},GHz:function(n){return n/1e9},rad:function(n){return n},deg:u$2.default.swiftConverter("rad","deg"),grad:u$2.default.swiftConverter("rad","grad"),percent:function(n){return n*100},percentraw:function(n){return n},ratio:function(n){return n},pdeg:function(n){return n},latitudeMin:function(n){let l=Math.trunc(n),p="N";n<0&&(p="S",l=l*-1);let c=n%1*60;return p=="S"&&(c=c*-1),l+"\xB0 "+c.toFixed(2).padStart(5,"0")+"' "+p},latitudeSec:function(n){let l=Math.trunc(n),p="N";n<0&&(p="S",l=l*-1);let c=n%1*60;p=="S"&&(c=c*-1);let y=Math.trunc(c),h=c%1*60;return l+"\xB0 "+y+"' "+h.toFixed(2).padStart(5,"0")+'" '+p},longitudeMin:function(n){let l=Math.trunc(n),p="E";n<0&&(p="W",l=l*-1);let c=n%1*60;return p=="W"&&(c=c*-1),l+"\xB0 "+c.toFixed(2).padStart(5,"0")+"' "+p},longitudeSec:function(n){let l=Math.trunc(n),p="E";n<0&&(p="W",l=l*-1);let c=n%1*60;p=="W"&&(c=c*-1);let y=Math.trunc(c),h=c%1*60;return l+"\xB0 "+y+"' "+h.toFixed(2).padStart(5,"0")+'" '+p}};convertToUnit(n,l){if(!(n in this.unitConversionFunctions)||l===null)return null;let p=+l;return this.unitConversionFunctions[n](p)}getDefaults(){return this._defaultUnits}getConversions(){return this._conversionList}getConversionsForPath(n){let l=this.data.getPathUnitType(n),p="unitless",c="unitless";if(l===null||l==="RFC 3339 (UTC)")return {base:p,conversions:this._conversionList};{let y=this._conversionList.filter(h=>h.group=="Position"&&(n.includes("position.latitude")||n.includes("position.longitude"))?true:h.units.find(F=>F.measure==l)?(c=this._defaultUnits[h.group],true):false);return y.length>0?{base:c,conversions:y}:(console.log("[Units Service] Unit type: "+l+", found for path: "+n+`
6636
6636
  but Kip does not support it.`),{base:p,conversions:this._conversionList})}}ngOnDestroy(){this._defaultUnitsSub?.unsubscribe();}static \u0275fac=function(l){return new(l||f)};static \u0275prov=Q$6({token:f,factory:f.\u0275fac})}return f})();var Zo$1={fill:"#b1b1b1",stroke:"#50505f"},Vn$1=24,Rn$1=1.6,Un$1="#e6e6e6",Bn$1=.15,Wn$1=1,$n$1=1,qn$1=15e3,zn$1=25e3,jn$1=.9,Kn$1=1.25;function Jo$1(t){let s=t.baseSizePx??Vn$1,e=t.unconfirmedFill??Un$1,o=t.unconfirmedOpacity??Bn$1,a=t.targetState==="confirmed",c=a?Hn$1(t.collisionRiskRating):"none",d=s,u,v,M,S,T,U,Z;return a||(u=e,M=o,S=o),a&&t.isStationary&&(M=0),t.targetKind==="moving"&&c!=="none"?(U=c==="high"?"red":"yellow",Z=jn$1,{fill:u,stroke:v,auraColor:U,auraOpacity:Z,fillOpacity:M,strokeOpacity:S,strokeWidth:T,sizePx:Math.round(s*Kn$1)}):{fill:u,stroke:v,auraColor:U,auraOpacity:Z,fillOpacity:M,strokeOpacity:S,strokeWidth:T,sizePx:d}}function Xo$1(t,s){let e=Zn$1(t,s),o=Yn$1(t,s.sizePx),a=s.auraColor?ea$2(o):o;return ia$2(a,Qn$1(e))}function fi$3(t){return `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t).replace(/%0A/g,"").replace(/%0D/g,"")}`}function Hn$1(t){return typeof t!="number"||!Number.isFinite(t)?"none":t<qn$1?"high":t<zn$1?"low":"none"}function Yn$1(t,s){let e=`${s}px`;return /<svg[^>]*\bwidth=/.test(t)?t=t.replace(/\bwidth="[^"]*"/i,`width="${e}"`):t=t.replace(/<svg\b/i,`<svg width="${e}"`),/<svg[^>]*\bheight=/.test(t)?t=t.replace(/\bheight="[^"]*"/i,`height="${e}"`):t=t.replace(/<svg\b/i,`<svg height="${e}"`),t}function Zn$1(t,s){let e=Jn$1(t);return {fill:He$2(s.fill,e.fill,Zo$1.fill),stroke:He$2(s.stroke,e.stroke,Zo$1.stroke),strokeDasharray:He$2(s.strokeStyle,e.strokeStyle,"solid"),auraColor:He$2(s.auraColor,e.auraColor,"transparent"),auraOpacity:He$2(s.auraOpacity,e.auraOpacity,0),strokeWidth:He$2(s.strokeWidth,e.strokeWidth,Rn$1),fillOpacity:He$2(s.fillOpacity,e.fillOpacity,Wn$1),strokeOpacity:He$2(s.strokeOpacity,e.strokeOpacity,$n$1)}}function Jn$1(t){return {fill:Ot$1(t,"--icon-fill"),stroke:Ot$1(t,"--icon-stroke"),strokeStyle:Ot$1(t,"--icon-stroke-dasharray"),auraColor:Ot$1(t,"--icon-aura-color"),auraOpacity:Jt$3(t,"--icon-aura-opacity"),strokeWidth:Jt$3(t,"--icon-stroke-width"),fillOpacity:Jt$3(t,"--icon-fill-opacity"),strokeOpacity:Jt$3(t,"--icon-stroke-opacity")}}function Ot$1(t,s){let e=t.match(new RegExp(`${Xn$1(s)}:\\s*([^;]+);`,"i"));return e?e[1].trim():void 0}function Jt$3(t,s){let e=Ot$1(t,s);if(!e)return;let o=Number(e);return Number.isFinite(o)?o:void 0}function Xn$1(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function He$2(t,s,e){return t!==void 0?t:s!==void 0?s:e}function Qn$1(t){return [":root {",`--icon-fill: ${t.fill};`,`--icon-fill-opacity: ${ui$3(t.fillOpacity)};`,`--icon-stroke: ${t.stroke};`,`--icon-stroke-dasharray: ${t.strokeDasharray};`,`--icon-aura-color: ${t.auraColor};`,`--icon-aura-opacity: ${ui$3(t.auraOpacity)};`,`--icon-stroke-width: ${t.strokeWidth};`,`--icon-stroke-opacity: ${ui$3(t.strokeOpacity)};`,"}"].join("")}function ea$2(t){if(t.includes('id="icon-aura"')||t.includes("id='icon-aura'"))return t;let s=ta$2(t)??{minX:0,minY:0,width:24,height:24},e=s.minX+s.width/2,o=s.minY+s.height/2,a=Math.min(s.width,s.height)/2,c=["<defs>",'<radialGradient id="icon-aura" cx="50%" cy="50%" r="50%">','<stop offset="0%" stop-color="var(--icon-aura-color)" stop-opacity="var(--icon-aura-opacity)" />','<stop offset="100%" stop-color="var(--icon-aura-color)" stop-opacity="0" />',"</radialGradient>","</defs>"].join(""),d=`<circle class="icon-aura" cx="${e}" cy="${o}" r="${a}" fill="url(#icon-aura)" />`;return t.replace(/<svg[^>]*>/i,u=>`${u}${c}${d}`)}function ta$2(t){let s=t.match(/viewBox="([^"]+)"/i);if(!s)return null;let e=s[1].trim().split(/\s+/).map(o=>Number(o));return e.length!==4||e.some(o=>!Number.isFinite(o))?null:{minX:e[0],minY:e[1],width:e[2],height:e[3]}}function ia$2(t,s){let e=t.match(/(<style[^>]*>)([\s\S]*?)(<\/style>)/i);if(e){let[,o,,a]=e;return t.replace(e[0],`${o}${s}${a}`)}return t.replace(/<svg[^>]*>/i,o=>`${o}<style>${s}</style>`)}function ui$3(t){return Number.isFinite(t)?Math.min(1,Math.max(0,t)):1}var Qo$1=new Map,gi$3=new Map,en$1=new Map,tn$1=new Map,on$1=new Map,nn$1='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="#12f802" stroke="#fb05eb" stroke-width="1.4"/></svg>',oa$2={"aton/other":"assets/svg/AtoN/other/aton.svg","aton/basestation":"assets/svg/AtoN/other/basestation.svg","aton/east-beacon":"assets/svg/AtoN/cardinal/east_beacon.svg","aton/east-mark":"assets/svg/AtoN/cardinal/east_mark.svg","aton/west-beacon":"assets/svg/AtoN/cardinal/west_beacon.svg","aton/west-mark":"assets/svg/AtoN/cardinal/west_mark.svg","aton/north-beacon":"assets/svg/AtoN/cardinal/north_beacon.svg","aton/north-mark":"assets/svg/AtoN/cardinal/north_mark.svg","aton/south-beacon":"assets/svg/AtoN/cardinal/south_beacon.svg","aton/south-mark":"assets/svg/AtoN/cardinal/south_mark.svg","aton/port-beacon":"assets/svg/AtoN/lateral/port_beacon.svg","aton/starboard-beacon":"assets/svg/AtoN/lateral/starboard_beacon.svg","aton/port-preferred-beacon":"assets/svg/AtoN/lateral/port_preferred_beacon.svg","aton/starboard-preferred-beacon":"assets/svg/AtoN/lateral/starboard_preferred_beacon.svg","aton/port-mark":"assets/svg/AtoN/lateral/port_mark.svg","aton/starboard-mark":"assets/svg/AtoN/lateral/starboard_mark.svg","aton/port-preferred-mark":"assets/svg/AtoN/lateral/port_preferred_mark.svg","aton/starboard-preferred-mark":"assets/svg/AtoN/lateral/starboard_preferred_mark.svg","aton/special-beacon":"assets/svg/AtoN/special/special_beacon.svg","aton/special-mark":"assets/svg/AtoN/special/special_mark.svg","aton/safewater-beacon":"assets/svg/AtoN/dangerSafe/safewater_beacon.svg","aton/safewater-mark":"assets/svg/AtoN/dangerSafe/safewater_mark.svg","aton/isolateddanger-beacon":"assets/svg/AtoN/dangerSafe/isolateddanger_beacon.svg","aton/isolateddanger-mark":"assets/svg/AtoN/dangerSafe/isolateddanger_mark.svg","aton/unknown":"assets/svg/AtoN/other/unknown.svg"},an$1={"vessel/fishing":"assets/svg/vessel/fishing.svg","vessel/diving":"assets/svg/vessel/diving-ops.svg","vessel/military":"assets/svg/vessel/military-ops.svg","vessel/sailing":"assets/svg/vessel/sailing.svg","vessel/pleasurecraft":"assets/svg/vessel/pleasurecraft.svg","vessel/highspeed":"assets/svg/vessel/highspeed.svg","vessel/pilot":"assets/svg/vessel/pilot.svg","vessel/sar":"assets/svg/vessel/sar.svg","vessel/tug":"assets/svg/vessel/tug.svg","vessel/law":"assets/svg/vessel/law-enforcement.svg","vessel/spare":"assets/svg/vessel/other.svg","vessel/passenger":"assets/svg/vessel/passenger.svg","vessel/cargo":"assets/svg/vessel/cargo.svg","vessel/tanker":"assets/svg/vessel/tanker.svg","vessel/other":"assets/svg/vessel/other.svg","vessel/unknown":"assets/svg/vessel/unknown.svg","vessel/self":"assets/svg/vessel/self.svg"},rn$1=Object.keys(an$1),na$2={"beacon/sart":"assets/svg/sar-distress-device/sart-eprib-mob.svg","beacon/mob":"assets/svg/sar-distress-device/sart-eprib-mob.svg","beacon/epirb":"assets/svg/sar-distress-device/sart-eprib-mob.svg"},aa$2=G$b(G$b(G$b({},oa$2),an$1),na$2),ra$2=[{code:0,key:"aton/other"},{code:1,key:"aton/other"},{code:2,key:"aton/other"},{code:3,key:"aton/other"},{code:4,key:"aton/other"},{code:5,key:"aton/other"},{code:6,key:"aton/other"},{code:7,key:"aton/other"},{code:8,key:"aton/other"},{code:9,key:"aton/north-beacon"},{code:10,key:"aton/east-beacon"},{code:11,key:"aton/south-beacon"},{code:12,key:"aton/west-beacon"},{code:13,key:"aton/port-beacon"},{code:14,key:"aton/starboard-beacon"},{code:15,key:"aton/port-preferred-beacon"},{code:16,key:"aton/starboard-preferred-beacon"},{code:17,key:"aton/isolateddanger-beacon"},{code:18,key:"aton/safewater-beacon"},{code:19,key:"aton/special-beacon"},{code:20,key:"aton/north-mark"},{code:21,key:"aton/east-mark"},{code:22,key:"aton/south-mark"},{code:23,key:"aton/west-mark"},{code:24,key:"aton/port-mark"},{code:25,key:"aton/starboard-mark"},{code:26,key:"aton/port-preferred-mark"},{code:27,key:"aton/starboard-preferred-mark"},{code:28,key:"aton/isolateddanger-mark"},{code:29,key:"aton/safewater-mark"},{code:30,key:"aton/special-mark"},{code:31,key:"aton/other"}],la$2=[{min:0,max:9,key:"vessel/other"},{min:10,max:19,key:"vessel/other"},{min:20,max:29,key:"vessel/highspeed"},{min:30,max:30,key:"vessel/fishing"},{min:31,max:31,key:"vessel/tug"},{min:32,max:32,key:"vessel/tug"},{min:33,max:33,key:"vessel/tug"},{min:34,max:34,key:"vessel/diving"},{min:35,max:35,key:"vessel/military"},{min:36,max:36,key:"vessel/sailing"},{min:37,max:37,key:"vessel/pleasurecraft"},{min:38,max:39,key:"vessel/other"},{min:40,max:49,key:"vessel/highspeed"},{min:50,max:50,key:"vessel/pilot"},{min:51,max:51,key:"vessel/sar"},{min:52,max:52,key:"vessel/tug"},{min:53,max:53,key:"vessel/tug"},{min:54,max:54,key:"vessel/tug"},{min:55,max:55,key:"vessel/law"},{min:56,max:56,key:"vessel/other"},{min:57,max:57,key:"vessel/other"},{min:58,max:58,key:"vessel/tug"},{min:59,max:59,key:"vessel/tug"},{min:60,max:69,key:"vessel/passenger"},{min:70,max:79,key:"vessel/cargo"},{min:80,max:89,key:"vessel/tanker"},{min:90,max:99,key:"vessel/other"}];function nc$1(t){return Zr$4(this,null,function*(){let s=Jo$1(Ca$2(t));return da$2(pa$2(t),s)})}function ac$1(){return Zr$4(this,null,function*(){return sa$2("vessel/self")})}function ln$2(t){return Zr$4(this,null,function*(){let s=Qo$1.get(t);if(s)return s;let e=gi$3.get(t);if(e)return e;let o=aa$2[t],a=fetch(o).then(c=>c.ok?c.text():nn$1).catch(c=>(console.warn("[ais-icon-registry] Icon fetch error, using fallback.",{key:t,url:o,error:c}),nn$1)).then(c=>(Qo$1.set(t,c),gi$3.delete(t),c));return gi$3.set(t,a),a})}function sa$2(t){return Zr$4(this,null,function*(){let s=en$1.get(t);if(s)return s;let e=yield ln$2(t),o=fi$3(e);return en$1.set(t,o),o})}function ca$2(t,s){return Zr$4(this,null,function*(){let e=sn$1(t,s),o=tn$1.get(e);if(o)return o;let a=yield ln$2(t),c=Xo$1(a,s);return tn$1.set(e,c),c})}function da$2(t,s){return Zr$4(this,null,function*(){let e=sn$1(t,s),o=on$1.get(e);if(o)return o;let a=yield ca$2(t,s),c=fi$3(a);return on$1.set(e,c),c})}function sn$1(t,s){return `${t}|${ma$2(s)}`}function ma$2(t){return [hi$3(t.fill),hi$3(t.stroke),hi$3(t.auraColor),Nt$2(t.fillOpacity),Nt$2(t.strokeOpacity),Nt$2(t.auraOpacity),Nt$2(t.strokeWidth),Nt$2(t.sizePx)].join("|")}function hi$3(t){return t??""}function Nt$2(t){return t===void 0||!Number.isFinite(t)?"":t.toFixed(4)}function pa$2(t){let s=fa$2(ua$2(t.mmsi));if(s)return s;switch(t.type){case "aton":return ga$2(t.atonTypeId??null);case "basestation":return "aton/basestation";case "sar":return "vessel/sar";case "vessel":return ha$2(t.aisShipTypeId??null);default:return "vessel/unknown"}}function ua$2(t){if(t==null)return null;let s=typeof t=="number"?String(t):t;return s.length?s:null}function fa$2(t){return t?t.startsWith("970")?"beacon/sart":t.startsWith("972")?"beacon/mob":t.startsWith("974")?"beacon/epirb":null:null}function ga$2(t){let s=typeof t=="number"&&Number.isFinite(t)?t:null,o=(s===null?void 0:ra$2.find(a=>a.code===s))?.key??"aton/unknown";return o}function ha$2(t){if(t!==null){for(let s of la$2)if(t>=s.min&&t<=s.max)return s.key}return "vessel/other"}function Ca$2(t){let s=ba$2(t.navState),e=t.targetKind??(s?"fixed":va$2(t.type)),o=t.status==="unconfirmed"||t.status==="lost"?"unconfirmed":"confirmed";return G$b({targetKind:e,targetState:o,isStationary:s,collisionRiskRating:t.collisionRiskRating},t.themeOverrides)}function va$2(t){switch(t){case "aton":case "basestation":return "fixed";default:return "moving"}}function ba$2(t){let s=_a$2(t);if(s!==void 0)return s===1||s===5;let e=ya$2(t);return e?e.includes("moored")||e.includes("anchored")||e.includes("at anchor"):false}function _a$2(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){let s=t.trim();if(!s.length)return;let e=Number(s);return Number.isFinite(e)?e:void 0}}function ya$2(t){if(typeof t!="string")return;let s=t.trim().toLowerCase();return s.length?s.replace(/\s+/g," "):void 0}function xa$2(t,s){if(t&1&&(Pi$5(0,"div",3)(1,"span",13),TT(2),ul$2()()),t&2){qw();let e=xT(0),o=xT(1);EE(2),mg("",o," ",e);}}function Sa$2(t,s){if(t&1&&(Pi$5(0,"div",4)(1,"span",7),TT(2,"State"),ul$2(),Pi$5(3,"span",10),TT(4),HT(5,"titlecase"),ul$2()()),t&2){let e=qw(4);EE(4),mg("",$T(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`);}}function Ma$2(t,s){t&1&&(Pi$5(0,"div",5),$h(1,"mat-divider"),ul$2());}function Ta$2(t,s){if(t&1&&(Pi$5(0,"div",6)(1,"span",7),TT(2,"Bearing"),ul$2(),Pi$5(3,"span",8),TT(4),ul$2()(),Pi$5(5,"div",6)(6,"span",7),TT(7,"Range"),ul$2(),Pi$5(8,"span",8),TT(9),ul$2()(),Pi$5(10,"div",6)(11,"span",7),TT(12,"CPA"),ul$2(),Pi$5(13,"span",8),TT(14),ul$2()(),Pi$5(15,"div",6)(16,"span",7),TT(17,"TCPA"),ul$2(),Pi$5(18,"span",8),TT(19),ul$2()(),Pi$5(20,"div",3),$h(21,"mat-divider"),ul$2()),t&2){let e=qw(4);EE(4),gg(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),EE(5),gg(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),EE(5),gg(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),EE(5),gg(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo));}}function Aa$2(t,s){if(t&1&&(Pi$5(0,"div",3)(1,"span",7),TT(2,"ETA"),ul$2(),Pi$5(3,"span",8),TT(4),ul$2()()),t&2){let e=qw(4);EE(4),gg(e.formatText(e.target.eta));}}function Ea$2(t,s){if(t&1&&(wg(0)(1),_w(2,xa$2,3,2,"div",3),_w(3,Sa$2,6,4,"div",4),_w(4,Ma$2,2,0,"div",5),_w(5,Ta$2,22,4),Pi$5(6,"div",6)(7,"span",7),TT(8,"COG"),ul$2(),Pi$5(9,"span",8),TT(10),Pi$5(11,"span",9),TT(12,"T"),ul$2()()(),Pi$5(13,"div",6)(14,"span",7),TT(15,"SOG"),ul$2(),Pi$5(16,"span",8),TT(17),HT(18,"number"),ul$2()(),Pi$5(19,"div",6)(20,"span",7),TT(21,"HDG"),ul$2(),Pi$5(22,"span",8),TT(23),Pi$5(24,"span",9),TT(25,"T"),ul$2()()(),Pi$5(26,"div",6)(27,"span",7),TT(28,"ROT"),ul$2(),Pi$5(29,"span",8),TT(30),ul$2()(),Pi$5(31,"div",3),$h(32,"mat-divider"),ul$2(),Pi$5(33,"div",6)(34,"span",7),TT(35,"IMO"),ul$2(),Pi$5(36,"span",8),TT(37),ul$2()(),Pi$5(38,"div",6)(39,"span",7),TT(40,"MMSI"),ul$2(),Pi$5(41,"span",8),TT(42),ul$2()(),Pi$5(43,"div",6)(44,"span",7),TT(45,"VHF Callsign"),ul$2(),Pi$5(46,"span",8),TT(47),ul$2()(),Pi$5(48,"div",6)(49,"span",7),TT(50,"AIS Class"),ul$2(),Pi$5(51,"span",8),TT(52),ul$2()(),Pi$5(53,"div",4)(54,"span",7),TT(55,"Destination"),ul$2(),Pi$5(56,"span",10),TT(57),ul$2()(),_w(58,Aa$2,5,1,"div",3),Pi$5(59,"div",3),$h(60,"mat-divider"),ul$2(),Pi$5(61,"div",6)(62,"span",7),TT(63,"Latitude"),ul$2(),Pi$5(64,"span",8),TT(65),ul$2()(),Pi$5(66,"div",6)(67,"span",7),TT(68,"Longitude"),ul$2(),Pi$5(69,"span",8),TT(70),ul$2()(),Pi$5(71,"div",11)(72,"span",12),TT(73),ul$2()()),t&2){let e=qw(3),o=NT(e.target.design?.aisShipType?.name?`${e.target.design.aisShipType.name}`:""),a=e.target.design?.length?.overall?`${e.target.design.length.overall}m`:"?m",c=e.target.design?.beam?`${e.target.design.beam}m`:"?m";EE(),NT(a&&c?`${a} x ${c}`:""),EE(),Mw(e.target.design?.length?.overall||e.target.design?.beam||o?2:-1),EE(),Mw(e.target.navState||e.target.specialManeuver?3:-1),EE(),Mw(e.target.design?.length?.overall||e.target.design?.beam||o||e.target.navState||e.target.specialManeuver?4:-1),EE(),Mw(e.hasClosestApproach(e.target.closestApproach)?5:-1),EE(5),gl$2("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),EE(7),gl$2("",UT(18,19,e.target.speedOverGround,"1.1-1")," kn"),EE(6),gl$2("",e.formatDirection(e.target.headingTrue),"\xB0 "),EE(7),gg(e.formatRateOfTurn(e.target.rateOfTurn)),EE(7),gg(e.formatText(e.target.imo)),EE(5),gg(e.formatText(e.target.mmsi)),EE(5),gg(e.formatText(e.target.callsign)),EE(5),gg(e.formatText(e.target.ais.class)),EE(5),gg(e.formatText(e.target.destination)),EE(),Mw(e.target.eta?58:-1),EE(7),gg(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),EE(5),gg(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),EE(3),gl$2("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago");}}function wa$2(t,s){if(t&1&&_w(0,Ea$2,74,22),t&2){let e=qw(2);Mw(e.isVesselLike(e.target)?0:-1);}}function ka$2(t,s){if(t&1&&(Pi$5(0,"div",3)(1,"span",13),TT(2),ul$2()()),t&2){qw();let e=xT(0),o=xT(1);EE(2),mg("",o," ",e);}}function Ga$2(t,s){if(t&1&&(Pi$5(0,"div",4)(1,"span",7),TT(2,"State"),ul$2(),Pi$5(3,"span",10),TT(4),HT(5,"titlecase"),ul$2()()),t&2){let e=qw(4);EE(4),mg("",$T(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`);}}function Da$2(t,s){t&1&&(Pi$5(0,"div",5),$h(1,"mat-divider"),ul$2());}function Pa$2(t,s){if(t&1&&(Pi$5(0,"div",6)(1,"span",7),TT(2,"Bearing"),ul$2(),Pi$5(3,"span",8),TT(4),ul$2()(),Pi$5(5,"div",6)(6,"span",7),TT(7,"Range"),ul$2(),Pi$5(8,"span",8),TT(9),ul$2()(),Pi$5(10,"div",6)(11,"span",7),TT(12,"CPA"),ul$2(),Pi$5(13,"span",8),TT(14),ul$2()(),Pi$5(15,"div",6)(16,"span",7),TT(17,"TCPA"),ul$2(),Pi$5(18,"span",8),TT(19),ul$2()(),Pi$5(20,"div",3),$h(21,"mat-divider"),ul$2()),t&2){let e=qw(4);EE(4),gg(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),EE(5),gg(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),EE(5),gg(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),EE(5),gg(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo));}}function Ia$2(t,s){if(t&1&&(Pi$5(0,"div",3)(1,"span",7),TT(2,"ETA"),ul$2(),Pi$5(3,"span",8),TT(4),ul$2()()),t&2){let e=qw(4);EE(4),gg(e.formatText(e.target.eta));}}function Fa$2(t,s){if(t&1&&(wg(0)(1),_w(2,ka$2,3,2,"div",3),_w(3,Ga$2,6,4,"div",4),_w(4,Da$2,2,0,"div",5),_w(5,Pa$2,22,4),Pi$5(6,"div",6)(7,"span",7),TT(8,"COG"),ul$2(),Pi$5(9,"span",8),TT(10),Pi$5(11,"span",9),TT(12,"T"),ul$2()()(),Pi$5(13,"div",6)(14,"span",7),TT(15,"SOG"),ul$2(),Pi$5(16,"span",8),TT(17),HT(18,"number"),ul$2()(),Pi$5(19,"div",6)(20,"span",7),TT(21,"HDG"),ul$2(),Pi$5(22,"span",8),TT(23),Pi$5(24,"span",9),TT(25,"T"),ul$2()()(),Pi$5(26,"div",6)(27,"span",7),TT(28,"ROT"),ul$2(),Pi$5(29,"span",8),TT(30),ul$2()(),Pi$5(31,"div",3),$h(32,"mat-divider"),ul$2(),Pi$5(33,"div",6)(34,"span",7),TT(35,"IMO"),ul$2(),Pi$5(36,"span",8),TT(37),ul$2()(),Pi$5(38,"div",6)(39,"span",7),TT(40,"MMSI"),ul$2(),Pi$5(41,"span",8),TT(42),ul$2()(),Pi$5(43,"div",6)(44,"span",7),TT(45,"VHF Callsign"),ul$2(),Pi$5(46,"span",8),TT(47),ul$2()(),Pi$5(48,"div",6)(49,"span",7),TT(50,"AIS Class"),ul$2(),Pi$5(51,"span",8),TT(52),ul$2()(),Pi$5(53,"div",4)(54,"span",7),TT(55,"Destination"),ul$2(),Pi$5(56,"span",10),TT(57),ul$2()(),_w(58,Ia$2,5,1,"div",3),Pi$5(59,"div",3),$h(60,"mat-divider"),ul$2(),Pi$5(61,"div",6)(62,"span",7),TT(63,"Latitude"),ul$2(),Pi$5(64,"span",8),TT(65),ul$2()(),Pi$5(66,"div",6)(67,"span",7),TT(68,"Longitude"),ul$2(),Pi$5(69,"span",8),TT(70),ul$2()(),Pi$5(71,"div",11)(72,"span",12),TT(73),ul$2()()),t&2){let e=qw(3),o=NT(e.target.design?.aisShipType?.name?`${e.target.design.aisShipType.name}`:""),a=e.target.design?.length?.overall?`${e.target.design.length.overall}m`:"?m",c=e.target.design?.beam?`${e.target.design.beam}m`:"?m";EE(),NT(a&&c?`${a} x ${c}`:""),EE(),Mw(e.target.design?.length?.overall||e.target.design?.beam||o?2:-1),EE(),Mw(e.target.navState||e.target.specialManeuver?3:-1),EE(),Mw(e.target.design?.length?.overall||e.target.design?.beam||o||e.target.navState||e.target.specialManeuver?4:-1),EE(),Mw(e.hasClosestApproach(e.target.closestApproach)?5:-1),EE(5),gl$2("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),EE(7),gl$2("",UT(18,19,e.target.speedOverGround,"1.1-1")," kn"),EE(6),gl$2("",e.formatDirection(e.target.headingTrue),"\xB0 "),EE(7),gg(e.formatRateOfTurn(e.target.rateOfTurn)),EE(7),gg(e.formatText(e.target.imo)),EE(5),gg(e.formatText(e.target.mmsi)),EE(5),gg(e.formatText(e.target.callsign)),EE(5),gg(e.formatText(e.target.ais.class)),EE(5),gg(e.formatText(e.target.destination)),EE(),Mw(e.target.eta?58:-1),EE(7),gg(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),EE(5),gg(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),EE(3),gl$2("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago");}}function Oa$2(t,s){if(t&1&&_w(0,Fa$2,74,22),t&2){let e=qw(2);Mw(e.isVesselLike(e.target)?0:-1);}}function Na$2(t,s){if(t&1&&(Pi$5(0,"div",3)(1,"span",13),TT(2),ul$2()(),Pi$5(3,"div",4)(4,"span",7),TT(5,"Off Position"),ul$2(),Pi$5(6,"span",8),TT(7),ul$2()(),Pi$5(8,"div",6)(9,"span",7),TT(10,"Type"),ul$2(),Pi$5(11,"span",8),TT(12,"Aid to Navigation"),ul$2()(),Pi$5(13,"div",6)(14,"span",7),TT(15,"Type ID"),ul$2(),Pi$5(16,"span",8),TT(17),ul$2()(),Pi$5(18,"div",3),$h(19,"mat-divider"),ul$2(),Pi$5(20,"div",6)(21,"span",7),TT(22,"MMSI"),ul$2(),Pi$5(23,"span",8),TT(24),ul$2()(),Pi$5(25,"div",6)(26,"span",7),TT(27,"Status"),ul$2(),Pi$5(28,"span",8),TT(29),HT(30,"titlecase"),ul$2()(),Pi$5(31,"div",3),$h(32,"mat-divider"),ul$2(),Pi$5(33,"div",6)(34,"span",7),TT(35,"Latitude"),ul$2(),Pi$5(36,"span",8),TT(37),ul$2()(),Pi$5(38,"div",6)(39,"span",7),TT(40,"Longitude"),ul$2(),Pi$5(41,"span",8),TT(42),ul$2()(),Pi$5(43,"div",11)(44,"span",12),TT(45),ul$2()()),t&2){let e=qw(3);EE(2),gg(e.formatText(e.target.name)),EE(5),gg(e.target.offPosition?"Yes":"No"),EE(10),gg(e.formatText(e.target.typeId==null?null:e.target.typeId.toString())),EE(7),gg(e.formatText(e.target.mmsi)),EE(5),gg($T(30,8,e.target.ais.status)),EE(8),gg(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),EE(5),gg(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),EE(3),gl$2("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago");}}function La$2(t,s){if(t&1&&_w(0,Na$2,46,10),t&2){let e=qw(2);Mw(e.isAton(e.target)?0:-1);}}function Va$2(t,s){if(t&1&&(Pi$5(0,"div",6)(1,"span",7),TT(2,"Name"),ul$2(),Pi$5(3,"span",8),TT(4),ul$2()(),Pi$5(5,"div",6)(6,"span",7),TT(7,"MMSI"),ul$2(),Pi$5(8,"span",8),TT(9),ul$2()(),Pi$5(10,"div",6)(11,"span",7),TT(12,"Status"),ul$2(),Pi$5(13,"span",8),TT(14),HT(15,"titlecase"),ul$2()(),Pi$5(16,"div",6)(17,"span",7),TT(18,"AIS Class"),ul$2(),Pi$5(19,"span",8),TT(20),ul$2()(),Pi$5(21,"div",3),$h(22,"mat-divider"),ul$2(),Pi$5(23,"div",6)(24,"span",7),TT(25,"Latitude"),ul$2(),Pi$5(26,"span",8),TT(27),ul$2()(),Pi$5(28,"div",6)(29,"span",7),TT(30,"Longitude"),ul$2(),Pi$5(31,"span",8),TT(32),ul$2()(),Pi$5(33,"div",11)(34,"span",12),TT(35),ul$2()()),t&2){let e=qw(3);EE(4),gg(e.formatText(e.target.name)),EE(5),gg(e.formatText(e.target.mmsi)),EE(5),gg($T(15,7,e.target.ais.status)),EE(6),gg(e.formatText(e.target.ais.class)),EE(7),gg(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),EE(5),gg(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),EE(3),gl$2("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago");}}function Ra$2(t,s){if(t&1&&_w(0,Va$2,36,9),t&2){let e=qw(2);Mw(e.isBasestation(e.target)?0:-1);}}function Ua$2(t,s){if(t&1&&(Pi$5(0,"div",0)(1,"div",2),_w(2,wa$2,1,1)(3,Oa$2,1,1)(4,La$2,1,1)(5,Ra$2,1,1),ul$2()()),t&2){let e,o=qw();EE(2),Mw((e=o.target.type)==="vessel"?2:e==="sar"?3:e==="aton"?4:e==="basestation"?5:-1);}}function Ba$2(t,s){t&1&&(Pi$5(0,"div",1),TT(1,"No AIS target selected."),ul$2());}var cn$1=(()=>{class t{static CLOCK_INTERVAL_MS=1e3;data=w$4($e$8);units=w$4(ut$2);ngZone=w$4(ue$7);now=vt$9(Date.now());nowTimer=null;ngOnInit(){this.startClock();}get payload(){return this.data?.payload??null}get target(){return this.payload?.target??null}formatDirection(e){return e==null||!Number.isFinite(e)?"--":this.units.convertToUnit("deg",e)?.toFixed(0)??"--"}formatNauticalMilesWithUnit(e){return e==null||!Number.isFinite(e)?"--":`${this.units.convertToUnit("nm",e)?.toFixed(1)} nm`}formatAngleWithUnit(e){return e==null||!Number.isFinite(e)?"--":`${e.toFixed(0)}\xB0`}formatRemainingTime(e){if(e==null||!Number.isFinite(e))return "--";let o=Math.max(0,Math.round(e)),a=Math.floor(o/3600),c=Math.floor(o%3600/60),d=o%60;return a>0?`${a}:${String(c).padStart(2,"0")}:${String(d).padStart(2,"0")}`:`${c}:${String(d).padStart(2,"0")}`}formatSinceTimestamp(e){if(e==null||!Number.isFinite(e))return "--";let o=Math.max(0,Math.floor((this.now()-e)/1e3)),a=Math.floor(o/3600),c=Math.floor(o%3600/60),d=o%60;return a>0?`${a}:${String(c).padStart(2,"0")}:${String(d).padStart(2,"0")}`:`${c}:${String(d).padStart(2,"0")}`}formatRateOfTurn(e){if(e==null||!Number.isFinite(e))return "--";let o=e>=0?"Stb":"Port",a=Math.abs(e)*(180/Math.PI)*60;return `${o} ${a.toFixed(0)}\xB0/min`}formatLatLon(e,o){return e==null||!Number.isFinite(e)?"--":this.units.convertToUnit(o,e)?.toString()??"--"}formatText(e){return e&&e.length?e:"--"}hasClosestApproach(e){return e?typeof e.bearing=="number"||typeof e.range=="number"||typeof e.distance=="number"||typeof e.timeTo=="number":false}isVesselLike(e){return e.type==="vessel"||e.type==="sar"}isAton(e){return e.type==="aton"}isBasestation(e){return e.type==="basestation"}startClock(){this.ngZone.runOutsideAngular(()=>{this.nowTimer=window.setInterval(()=>{this.ngZone.run(()=>{this.now.set(Date.now());});},t.CLOCK_INTERVAL_MS);});}ngOnDestroy(){this.nowTimer!==null&&(clearInterval(this.nowTimer),this.nowTimer=null);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["dialog-ais-target"]],decls:2,vars:1,consts:[[1,"ais-dialog","mat-typography"],[1,"ais-dialog-empty"],[1,"ais-dialog-grid"],[1,"ais-dialog-item","ais-dialog-item-span"],[1,"ais-dialog-long-item","ais-dialog-item-span"],[1,"ais-dialog-item","ais-dialog-item-span","ais-divider"],[1,"ais-dialog-item"],[1,"ais-dialog-key","mat-subtitle-2"],[1,"ais-dialog-value","mat-body-2"],[2,"font-size","10px"],[1,"ais-dialog-long-value","mat-body-2"],[1,"ais-dialog-item",2,"grid-column","span 2"],[1,"ais-dialog-value","mat-body-4",2,"grid-column","span 2","text-align","center"],[1,"ais-vessel-description"]],template:function(o,a){o&1&&_w(0,Ua$2,6,1,"div",0)(1,Ba$2,2,0,"div",1),o&2&&Mw(a.target?0:1);},dependencies:[Ht$6,f$2,u$3,Xa$4,es$3],styles:[".ais-dialog-panel .mat-mdc-dialog-container{--mat-dialog-content-padding: 0px 24px 20px 24px}.ais-dialog[_ngcontent-%COMP%]{display:grid;gap:8px;color:var(--kip-contrast-color)}.ais-dialog-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 14px}.ais-vessel-description[_ngcontent-%COMP%]{grid-column:span 2;font-size:var(--mat-sys-body-large-size)}.ais-dialog-long-item[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 1fr 1fr;align-items:baseline;gap:6px}.ais-dialog-long-value[_ngcontent-%COMP%]{grid-column:span 3;color:var(--kip-contrast-color)}.ais-dialog-item[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;align-items:baseline;gap:6px}.ais-divider[_ngcontent-%COMP%]{margin-top:6px}.ais-dialog-item[_ngcontent-%COMP%] mat-divider[_ngcontent-%COMP%]{grid-column:1/-1}.ais-dialog-item-span[_ngcontent-%COMP%]{grid-column:span 2}.ais-dialog-key[_ngcontent-%COMP%]{color:var(--kip-contrast-dim-color);letter-spacing:.04em}.ais-dialog-value[_ngcontent-%COMP%], .ais-dialog-empty[_ngcontent-%COMP%]{color:var(--kip-contrast-color)}"]})}return t})();function Wa$2(t,s){if(t&1&&$h(0,"img",3),t&2){let e=qw();Bh("src",e.data.iconHref,fp$1);}}function $a$2(t,s){t&1&&Wh(0);}var Ci$3=(()=>{class t{data=w$4($e$8);static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["dialog-frame"]],decls:10,vars:4,consts:[[1,"dialogue-header"],[1,"dialog-title"],["mat-dialog-title",""],["alt","","aria-hidden","true",1,"dialog-title-icon",3,"src"],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"dialog-content-padding"],[4,"ngComponentOutlet"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"div",1)(2,"h5",2),_w(3,Wa$2,1,1,"img",3),TT(4),ul$2()(),Pi$5(5,"button",4)(6,"mat-icon"),TT(7,"close"),ul$2()()(),Pi$5(8,"mat-dialog-content",5),xh$1(9,$a$2,1,0,"ng-container",6),ul$2()),o&2&&(EE(3),Mw(a.data.iconHref?3:-1),EE(),gl$2(" ",a.data.title),EE(),Bh("mat-dialog-close",false),EE(4),Bh("ngComponentOutlet",a.data.componentType??null));},dependencies:[wt$3,Ht$6,jt$7,Nt$8,Vt$6,Op,eu,$a$4],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.dialog-title[_ngcontent-%COMP%]{display:flex;align-items:center}.dialog-title-icon[_ngcontent-%COMP%]{position:relative;top:12px;width:42px;height:42px;object-fit:contain}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}"]})}return t})();function qa$2(t,s){if(t&1&&(Pi$5(0,"button",4),TT(1),ul$2()),t&2){let e=qw();Bh("mat-dialog-close",true),EE(),gg(e.data.confirmBtnText);}}var dn$2=(()=>{class t{data=w$4($e$8);static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["dialog-confirmation"]],decls:12,vars:6,consts:[[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"h5",1),TT(2),ul$2(),Pi$5(3,"button",2)(4,"mat-icon"),TT(5,"close"),ul$2()()(),Pi$5(6,"mat-dialog-content"),TT(7),ul$2(),Pi$5(8,"mat-dialog-actions",3)(9,"button",4),TT(10),ul$2(),_w(11,qa$2,2,2,"button",4),ul$2()),o&2&&(EE(2),gg(a.data.title),EE(),Bh("mat-dialog-close",false),EE(4),gl$2(" ",a.data.message,`
6637
6637
  `),EE(2),Bh("mat-dialog-close",false),EE(),gg(a.data.cancelBtnText),EE(),Mw(a.data.confirmBtnText?11:-1));},dependencies:[wt$3,Ht$6,jt$7,Nt$8,zt$6,Vt$6,Op,xp$1,eu],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}"]})}return t})();function za$2(t,s){if(t&1&&(Pi$5(0,"button",9),TT(1),ul$2()),t&2){let e=qw(),o=Jw(1);Bh("disabled",!o.valid),EE(),gg(e.data.confirmBtnText);}}var mn$2=(()=>{class t{dialogRef=w$4(O$6);data=w$4($e$8);saveName(){this.dialogRef.close(this.data);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["dialog-name"]],decls:19,vars:6,consts:[["name","ngForm"],["name","name",3,"ngSubmit"],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"field-margin"],["matInput","","type","text","id","name","placeholder","Name","name","name","required","","cdkFocusInitial","",3,"ngModelChange","ngModel"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"]],template:function(o,a){if(o&1){let c=Fw();Pi$5(0,"form",1,0),Qh("ngSubmit",function(){return a.saveName()}),Pi$5(2,"div",2)(3,"h5",3),TT(4),ul$2(),Pi$5(5,"button",4)(6,"mat-icon"),TT(7,"close"),ul$2()()(),Pi$5(8,"mat-dialog-content")(9,"mat-form-field",5)(10,"mat-label"),TT(11,"Name"),ul$2(),Pi$5(12,"input",6),Eg("ngModelChange",function(u){return ud(c),ST(a.data.name,u)||(a.data.name=u),dd(u)}),ul$2(),cD(),Pi$5(13,"mat-error"),TT(14," A name is required "),ul$2()()(),Pi$5(15,"mat-dialog-actions",7)(16,"button",8),TT(17),ul$2(),_w(18,za$2,2,2,"button",9),ul$2()();}o&2&&(EE(4),gg(a.data.title),EE(),Bh("mat-dialog-close",false),EE(7),Ig("ngModel",a.data.name),lD(),EE(4),Bh("mat-dialog-close",false),EE(),gg(a.data.cancelBtnText),EE(),Mw(a.data.confirmBtnText?18:-1));},dependencies:[Ht$6,jt$7,Nt$8,zt$6,Vt$6,yt$3,wt$3,ce$4,rt$7,ae$3,It$4,ln$4,an$4,Op,xp$1,eu,Ln$3,Gn$4,Xe$5,Pn$5,kn$5,ft$6,rn$3,Qt$6],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.field-margin[_ngcontent-%COMP%]{margin-left:15px;margin-bottom:15px}"]})}return t})();function ja$2(t,s){t&1&&(Pi$5(0,"mat-option",19),TT(1,"Toggle"),ul$2(),Pi$5(2,"mat-option",20),TT(3,"Push"),ul$2(),Pi$5(4,"mat-option",21),TT(5,"Indicator"),ul$2());}function Ka$2(t,s){t&1&&(Pi$5(0,"mat-option",8),TT(1,"Zone State"),ul$2());}function Ha$2(t,s){if(t&1&&(Pi$5(0,"mat-option",10),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",AT(e.value)),EE(),gg(e.label);}}function Ya$2(t,s){t&1&&(Pi$5(0,"mat-checkbox",12),TT(1," Use numeric path "),ul$2(),cD()),t&2&&lD();}function Za$2(t,s){if(t&1){let e=Fw();Pi$5(0,"button",22),Qh("click",function(){ud(e);let a=qw();return dd(a.moveCtrlUp())}),Pi$5(1,"mat-icon"),TT(2,"arrow_drop_up"),ul$2()();}}function Ja$2(t,s){if(t&1){let e=Fw();Pi$5(0,"button",23),Qh("click",function(){ud(e);let a=qw();return dd(a.moveCtrlDown())}),Pi$5(1,"mat-icon"),TT(2,"arrow_drop_down"),ul$2()();}}var pn$2=(()=>{class t{app=w$4(N$1);ctrlFormGroup=Hj.required();controlIndex=Hj.required();arrayLength=Hj.required();deleteCtrl=Vj();moveUp=Vj();moveDown=Vj();colors=[];ngOnInit(){this.colors=this.app.configurableThemeColors;}deleteControl(){let e=this.ctrlFormGroup().get("pathID")?.value,o={ctrlIndex:this.controlIndex(),pathID:typeof e=="string"?e:""};this.deleteCtrl.emit(o);}moveCtrlUp(){this.moveUp.emit(this.controlIndex());}moveCtrlDown(){this.moveDown.emit(this.controlIndex());}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["boolean-control-config"]],inputs:{ctrlFormGroup:[1,"ctrlFormGroup"],controlIndex:[1,"controlIndex"],arrayLength:[1,"arrayLength"]},outputs:{deleteCtrl:"deleteCtrl",moveUp:"moveUp",moveDown:"moveDown"},decls:31,vars:5,consts:[[1,"ctrl-grid","rounded-card","rounded-card-color",3,"formGroup"],[1,"controls","flex-container"],[1,"flex-label"],[1,"full-width"],["matInput","","type","string","placeholder","Enter a display label...","formControlName","ctrlLabel"],[1,"flex-settings"],[1,"settings"],["placeholder","Select Type...","formControlName","type","name","type","required",""],["value","4"],["placeholder","Select Color...","formControlName","color","name","color","required",""],[3,"value"],[1,"flex-full-width"],["formControlName","isNumeric"],[1,"actions"],[1,"flex-actions"],[1,"btn-grid"],["mat-icon-button","","type","button","aria-label","Move control up in the list",1,"up"],["mat-icon-button","","type","button","aria-label","Move control down in the list",1,"down"],["mat-icon-button","","type","button","aria-label","Delete control",1,"delete",3,"click"],["value","1"],["value","2"],["value","3"],["mat-icon-button","","type","button","aria-label","Move control up in the list",1,"up",3,"click"],["mat-icon-button","","type","button","aria-label","Move control down in the list",1,"down",3,"click"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-form-field",3)(4,"mat-label"),TT(5,"Label"),ul$2(),$h(6,"input",4),cD(),ul$2()(),Pi$5(7,"div",5)(8,"mat-form-field",6)(9,"mat-label"),TT(10,"Type"),ul$2(),Pi$5(11,"mat-select",7),_w(12,ja$2,6,0)(13,Ka$2,2,0,"mat-option",8),ul$2(),cD(),ul$2()(),Pi$5(14,"div",5)(15,"mat-form-field",6)(16,"mat-label"),TT(17,"Color"),ul$2(),Pi$5(18,"mat-select",9),xw(19,Ha$2,2,3,"mat-option",10,Sw),ul$2(),cD(),ul$2()(),Pi$5(21,"div",11),_w(22,Ya$2,2,0,"mat-checkbox",12),ul$2()(),Pi$5(23,"div",13)(24,"div",14)(25,"div",15),_w(26,Za$2,3,0,"button",16),_w(27,Ja$2,3,0,"button",17),Pi$5(28,"button",18),Qh("click",function(){return a.deleteControl()}),Pi$5(29,"mat-icon"),TT(30,"delete"),ul$2()()()()()()),o&2&&(Bh("formGroup",a.ctrlFormGroup()),EE(6),lD(),EE(5),lD(),EE(),Mw(a.ctrlFormGroup().value.type!=="4"?12:13),EE(6),lD(),EE(),Aw(a.colors),EE(3),Mw(a.ctrlFormGroup().value.type!=="4"?22:-1),EE(4),Mw(a.controlIndex()!==0?26:-1),EE(),Mw(a.controlIndex()!==a.arrayLength()-1?27:-1));},dependencies:[Ln$3,Xe$5,Pn$5,kn$5,ft$6,Wn$4,gn$4,hn$3,rt$7,ae$3,an$4,Ft$2,F$2,eu,Jn$4,Kt$3,yt$3,wt$3],styles:['.ctrl-grid[_ngcontent-%COMP%]{display:grid;width:auto;height:auto;margin:0 0 10px;grid-template-columns:[col-start] calc(100% - 90px) [col1-end] 80px [col2-end];grid-template-areas:"controls actions";row-gap:0px;column-gap:10px;justify-items:center;align-items:center;justify-content:center;align-content:center;padding-top:20px}.controls[_ngcontent-%COMP%]{grid-area:controls;width:100%}.actions[_ngcontent-%COMP%]{grid-area:actions}.btn-grid[_ngcontent-%COMP%]{display:grid;width:80px;height:80px;margin:0;grid-template-columns:[col-start] 50% [col1-end] 50% [col2-end];grid-template-rows:[row-start] 50% [row1-end] 50% [row2-end];grid-template-areas:"up delete" "down delete";row-gap:0px;column-gap:0px;justify-items:center;align-items:center;justify-content:center;align-content:center}.up[_ngcontent-%COMP%]{grid-area:up}.down[_ngcontent-%COMP%]{grid-area:down}.delete[_ngcontent-%COMP%]{grid-area:delete}.flex-label[_ngcontent-%COMP%]{flex-grow:2;flex-shrink:2}.flex-settings[_ngcontent-%COMP%]{flex-grow:1;flex-shrink:1}.settings[_ngcontent-%COMP%]{min-width:100px}.flex-actions[_ngcontent-%COMP%]{flex-grow:0;flex-shrink:0}.flex-full-width[_ngcontent-%COMP%]{width:100%}']})}return t})();function Xa$2(t,s){if(t&1){let e=Fw();Pi$5(0,"boolean-control-config",4),Qh("moveUp",function(a){ud(e);let c=qw();return dd(c.moveUp(a))})("moveDown",function(a){ud(e);let c=qw();return dd(c.moveDown(a))})("deleteCtrl",function(a){ud(e);let c=qw();return dd(c.deletePath(a))}),ul$2();}if(t&2){let e=s.$implicit,o=s.$index,a=qw();Bh("ctrlFormGroup",a.getFormGroup(e))("controlIndex",o)("arrayLength",a.arrayLength);}}var un$2=(()=>{class t{fb=w$4(Hn$4);multiCtrlArray=Hj.required();zonesOnlyPaths=Hj.required();addPath=Vj();updatePath=Vj();delPath=Vj();multiFormGroup;arrayLength=0;multiCtrlArraySubscription;ngOnInit(){this.arrayLength=this.multiCtrlArray().length,this.multiFormGroup=new M$3({multiCtrlArray:this.multiCtrlArray()}),this.multiCtrlArraySubscription=this.multiCtrlArray().valueChanges.pipe(Wl$2(350)).subscribe(e=>{this.updatePath.emit(e);});}addCtrlGroup(){let e=b.create();this.multiCtrlArray().push(this.fb.group({ctrlLabel:[null,ve$2.required],type:[this.zonesOnlyPaths()?"4":"1",ve$2.required],pathID:[e],color:["contrast"],isNumeric:[!!this.zonesOnlyPaths()],value:[null]})),this.arrayLength=this.multiCtrlArray().length;let o={path:{description:null,path:null,pathID:e,source:"default",pathType:this.zonesOnlyPaths()?"number":"boolean",zonesOnlyPaths:this.zonesOnlyPaths(),supportsPut:!this.zonesOnlyPaths(),isPathConfigurable:true,showPathSkUnitsFilter:false,pathSkUnitsFilter:null,convertUnitTo:void 0,sampleTime:500},ctrlType:this.zonesOnlyPaths()?4:3};this.addPath.emit(o);}moveUp(e){let o=this.multiCtrlArray().at(e);this.multiCtrlArray().removeAt(e,{emitEvent:false}),this.multiCtrlArray().insert(e-1,o,{emitEvent:false});}moveDown(e){let o=this.multiCtrlArray().at(e);this.multiCtrlArray().removeAt(e,{emitEvent:false}),this.multiCtrlArray().insert(e+1,o,{emitEvent:false});}deletePath(e){this.delPath.emit(e),this.arrayLength=this.multiCtrlArray().length;}getFormGroup(e){return e}ngOnDestroy(){this.multiCtrlArraySubscription?.unsubscribe();}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["boolean-multicontrol-options"]],inputs:{multiCtrlArray:[1,"multiCtrlArray"],zonesOnlyPaths:[1,"zonesOnlyPaths"]},outputs:{addPath:"addPath",updatePath:"updatePath",delPath:"delPath"},decls:7,vars:1,consts:[[3,"formGroup"],["formArrayName","multiCtrlArray"],[1,"full-width",3,"ctrlFormGroup","controlIndex","arrayLength"],["type","button","mat-mini-fab","","color","primary","aria-label","Add control down in the list",1,"add-btn",3,"click"],[1,"full-width",3,"moveUp","moveDown","deleteCtrl","ctrlFormGroup","controlIndex","arrayLength"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"div",1),xw(2,Xa$2,1,3,"boolean-control-config",2,Nw),Pi$5(4,"button",3),Qh("click",function(){return a.addCtrlGroup()}),Pi$5(5,"mat-icon"),TT(6,"add"),ul$2()()()()),o&2&&(Bh("formGroup",a.multiFormGroup),EE(2),Aw(a.multiCtrlArray().controls));},dependencies:[Ln$3,kn$5,Wn$4,gn$4,yt$7,pn$2,Op,Rp,yt$3,wt$3],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;padding-top:15px;padding-bottom:15px}.add-btn[_ngcontent-%COMP%]{margin-left:calc(50% - 20px)}"]})}return t})();function Qa$2(t,s){if(t&1&&(Pi$5(0,"mat-option",8),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",AT(e.value)),EE(),gg(e.label);}}var fn$2=(()=>{class t{app=w$4(N$1);displayName=Hj.required();showLabel=Hj.required();convertUnitTo=Hj.required();datasetUUID=Hj.required();datasetAverageArray=Hj.required();showAverageData=Hj.required();showDataPoints=Hj.required();trackAgainstAverage=Hj.required();showDatasetMinimumValueLine=Hj.required();showDatasetMaximumValueLine=Hj.required();showDatasetAverageValueLine=Hj.required();showDatasetAngleAverageValueLine=Hj.required();verticalChart=Hj.required();inverseYAxis=Hj.required();showTimeScale=Hj.required();showYScale=Hj.required();startScaleAtZero=Hj.required();yScaleSuggestedMin=Hj.required();yScaleSuggestedMax=Hj.required();enableMinMaxScaleLimit=Hj.required();yScaleMin=Hj.required();yScaleMax=Hj.required();numDecimal=Hj.required();color=Hj.required();colors=[];ngOnInit(){this.colors=this.app.configurableThemeColors,this.showAverageData()&&!this.showAverageData()?.value&&this.trackAgainstAverage().disable(),this.enableMinMaxScaleLimit()&&this.setValueScaleOptionsControls(this.enableMinMaxScaleLimit().value);}setValueScaleOptionsControls(e){e?(this.yScaleMin()?.enable(),this.yScaleMax()?.enable(),this.yScaleSuggestedMin()?.disable(),this.yScaleSuggestedMax()?.disable()):(this.yScaleMin()?.disable(),this.yScaleMax()?.disable(),this.yScaleSuggestedMin()?.enable(),this.yScaleSuggestedMax()?.enable());}setScaleControls(e){this.setValueScaleOptionsControls(e.value);}enableTrackAgainstMovingAverage(e){e.checked?this.trackAgainstAverage().enable():(this.trackAgainstAverage().setValue(e.checked),this.trackAgainstAverage().disable());}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["config-display-chart-options"]],inputs:{displayName:[1,"displayName"],showLabel:[1,"showLabel"],convertUnitTo:[1,"convertUnitTo"],datasetUUID:[1,"datasetUUID"],datasetAverageArray:[1,"datasetAverageArray"],showAverageData:[1,"showAverageData"],showDataPoints:[1,"showDataPoints"],trackAgainstAverage:[1,"trackAgainstAverage"],showDatasetMinimumValueLine:[1,"showDatasetMinimumValueLine"],showDatasetMaximumValueLine:[1,"showDatasetMaximumValueLine"],showDatasetAverageValueLine:[1,"showDatasetAverageValueLine"],showDatasetAngleAverageValueLine:[1,"showDatasetAngleAverageValueLine"],verticalChart:[1,"verticalChart"],inverseYAxis:[1,"inverseYAxis"],showTimeScale:[1,"showTimeScale"],showYScale:[1,"showYScale"],startScaleAtZero:[1,"startScaleAtZero"],yScaleSuggestedMin:[1,"yScaleSuggestedMin"],yScaleSuggestedMax:[1,"yScaleSuggestedMax"],enableMinMaxScaleLimit:[1,"enableMinMaxScaleLimit"],yScaleMin:[1,"yScaleMin"],yScaleMax:[1,"yScaleMax"],numDecimal:[1,"numDecimal"],color:[1,"color"]},decls:85,vars:21,consts:[["minLine",""],[1,"tab-content"],[1,"chart-flex-container"],[1,"chart-panel-group"],[1,"full-width"],["matInput","","placeholder","Enter a label to display","name","displayName",3,"formControl"],["name","showLabel",1,"full-width",3,"formControl"],["placeholder","Select Color...","name","color","required","",3,"formControl"],[3,"value"],[1,"flex-item-rounded-card","rounded-card-color"],[2,"margin-left","10px"],["matInput","","type","number","min","0","max","5","placeholder","Enter or select number...","name","numDecimal","required","",3,"formControl"],["name","showDataPoints",1,"full-width",2,"margin-top","10px",3,"formControl"],["name","showAverageData",1,"full-width",3,"change","formControl"],["name","trackAgainstAverage",1,"full-width",2,"margin-left","25px",3,"formControl"],["name","verticalChart",3,"formControl"],[1,"no-margin"],[1,"mat-caption"],["aria-label","Select an option","name","enableMinMaxScaleLimit",1,"chart-option-radio-group",3,"formControl"],[1,"chart-option-radio-button",3,"change","value"],[1,"chart-option-radio-button-config"],[1,"chart-option-radio-button-config-form-field"],["matInput","","type","number","name","yScaleSuggestedMin",3,"formControl"],["matInput","","type","number","name","yScaleSuggestedMax",3,"formControl"],[1,"chart-option-radio-button-config-item"],["matInput","","type","number","name","yScaleMin","required","",3,"formControl"],["matInput","","type","number","name","yScaleMax","required","",3,"formControl"],["name","showYScale",1,"full-width",3,"formControl"],["name","inverseYAxis",3,"formControl"],["name","showTimeScale",1,"full-width",3,"formControl"],["name","showDatasetMaximumValueLine",1,"full-width",3,"formControl"],["name","showDatasetAverageValueLine",1,"full-width",3,"formControl"],["name","showDatasetMinimumValueLine",1,"full-width",3,"formControl"]],template:function(o,a){o&1&&(Pi$5(0,"div",1)(1,"div",2)(2,"div",3)(3,"mat-form-field",4)(4,"mat-label"),TT(5,"Widget Label"),ul$2(),$h(6,"input",5),cD(),ul$2()(),Pi$5(7,"div",3)(8,"mat-checkbox",6),TT(9," Show Label "),ul$2(),cD(),ul$2()(),Pi$5(10,"div",2)(11,"mat-form-field",4)(12,"mat-label"),TT(13,"Color"),ul$2(),Pi$5(14,"mat-select",7),xw(15,Qa$2,2,3,"mat-option",8,Sw),ul$2(),cD(),ul$2()(),Pi$5(17,"div",2)(18,"div",9)(19,"p"),TT(20,"Series"),ul$2(),Pi$5(21,"mat-form-field",10)(22,"mat-label"),TT(23,"Value Decimal Places"),ul$2(),$h(24,"input",11),cD(),ul$2(),Pi$5(25,"mat-checkbox",12),TT(26," Display Data Points "),ul$2(),cD(),Pi$5(27,"mat-checkbox",13),Qh("change",function(d){return a.enableTrackAgainstMovingAverage(d)}),TT(28," Display Moving Average "),ul$2(),cD(),Pi$5(29,"mat-checkbox",14),TT(30," Track Against Moving Average "),ul$2(),cD(),Pi$5(31,"mat-checkbox",15),TT(32," Vertical Data Graph "),ul$2(),cD(),ul$2(),Pi$5(33,"div",9)(34,"div")(35,"p",16),TT(36,"Data Scale"),ul$2(),Pi$5(37,"span",17),TT(38,"(Default node is automatic scale)"),ul$2(),Pi$5(39,"mat-radio-group",18)(40,"mat-radio-button",19),Qh("change",function(d){return a.setScaleControls(d)}),TT(41,"Auto Scale"),ul$2(),Pi$5(42,"div",20)(43,"mat-form-field",21)(44,"mat-label"),TT(45,"Suggested Min"),ul$2(),$h(46,"input",22),cD(),ul$2(),Pi$5(47,"mat-form-field",21)(48,"mat-label"),TT(49,"Suggested Max"),ul$2(),$h(50,"input",23),cD(),ul$2()(),Pi$5(51,"mat-radio-button",19),Qh("change",function(d){return a.setScaleControls(d)}),TT(52," Fixed Scale "),ul$2(),Pi$5(53,"div",20)(54,"div",24)(55,"mat-form-field",21)(56,"mat-label"),TT(57,"Min"),ul$2(),$h(58,"input",25),cD(),ul$2()(),Pi$5(59,"div",24)(60,"mat-form-field",21)(61,"mat-label"),TT(62,"Max"),ul$2(),$h(63,"input",26),cD(),ul$2()()()(),cD(),Pi$5(64,"mat-checkbox",27),TT(65," Show Scale Ticks "),ul$2(),cD(),Pi$5(66,"mat-checkbox",28),TT(67," Inverse Scale "),ul$2(),cD(),ul$2()(),Pi$5(68,"div",9)(69,"div")(70,"p",16),TT(71,"Time Scale"),ul$2(),Pi$5(72,"mat-checkbox",29),TT(73," Show Scale Ticks "),ul$2(),cD(),ul$2()(),Pi$5(74,"div",9)(75,"div")(76,"p",16),TT(77,"Dataset"),ul$2(),Pi$5(78,"mat-checkbox",30),TT(79," Show Maximum Line "),ul$2(),cD(),Pi$5(80,"mat-checkbox",31),TT(81," Show Average Line "),ul$2(),cD(),Pi$5(82,"mat-checkbox",32,0),TT(84," Show Minimum Line "),ul$2(),cD(),ul$2()()()()),o&2&&(EE(6),Bh("formControl",a.displayName()),lD(),EE(2),Bh("formControl",a.showLabel()),lD(),EE(6),Bh("formControl",a.color()),lD(),EE(),Aw(a.colors),EE(9),Bh("formControl",a.numDecimal()),lD(),EE(),Bh("formControl",a.showDataPoints()),lD(),EE(2),Bh("formControl",a.showAverageData()),lD(),EE(2),Bh("formControl",a.trackAgainstAverage()),lD(),EE(2),Bh("formControl",a.verticalChart()),lD(),EE(8),Bh("formControl",a.enableMinMaxScaleLimit()),lD(),EE(),Bh("value",false),EE(6),Bh("formControl",a.yScaleSuggestedMin()),lD(),EE(4),Bh("formControl",a.yScaleSuggestedMax()),lD(),EE(),Bh("value",true),EE(7),Bh("formControl",a.yScaleMin()),lD(),EE(5),Bh("formControl",a.yScaleMax()),lD(),EE(),Bh("formControl",a.showYScale()),lD(),EE(2),Bh("formControl",a.inverseYAxis()),lD(),EE(6),Bh("formControl",a.showTimeScale()),lD(),EE(6),Bh("formControl",a.showDatasetMaximumValueLine()),lD(),EE(2),Bh("formControl",a.showDatasetAverageValueLine()),lD(),EE(2),Bh("formControl",a.showDatasetMinimumValueLine()),lD());},dependencies:[_$2,ce$4,rt$7,ae$3,Jn$4,Kt$3,Lt$4,Ft$2,F$2,ht$8,ln$4,an$4,va$4,an$3,ft$5,Wn$4,Xe$5,on$3,Pn$5,ft$6,Bt$4,Tt$5,ln$5],styles:[".chart-flex-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;margin:15px 0;gap:15px;align-items:stretch}.chart-panel-group[_ngcontent-%COMP%]{min-width:250px;flex-grow:1}.no-margin[_ngcontent-%COMP%]{margin:0}.chart-option-radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:0;align-items:flex-start}.chart-option-radio-button[_ngcontent-%COMP%]{margin:0}.chart-option-radio-button-config[_ngcontent-%COMP%]{margin-left:35px;display:flex;flex-direction:row;flex-wrap:wrap;gap:10px;align-items:flex-start}.chart-option-radio-button-config-item[_ngcontent-%COMP%]{flex-grow:0;flex-shrink:1;min-width:50px}.chart-option-radio-button-config-form-field[_ngcontent-%COMP%]{display:block;max-width:118px}"]})}return t})();var or$2=["panel"],nr$2=["*"];function ar$2(t,s){if(t&1&&(dl$2(0,"div",1,0),zw(2),fl$2()),t&2){let e=s.id,o=qw();pT(o._classList),sg("mat-mdc-autocomplete-visible",o.showPanel)("mat-mdc-autocomplete-hidden",!o.showPanel)("mat-autocomplete-panel-animations-enabled",!o._animationsDisabled)("mat-primary",o._color==="primary")("mat-accent",o._color==="accent")("mat-warn",o._color==="warn"),Gh("id",o.id),Hh("aria-label",o.ariaLabel||null)("aria-labelledby",o._getPanelAriaLabelledby(e));}}var vi$3=class vi{source;option;constructor(s,e){this.source=s,this.option=e;}},Cn$2=new N$7("mat-autocomplete-default-options",{providedIn:"root",factory:()=>({autoActiveFirstOption:false,autoSelectActiveOption:false,hideSingleSelectionIndicator:false,requireSelection:false,hasBackdrop:false})}),yt$1=(()=>{class t{_changeDetectorRef=w$4(Gj);_elementRef=w$4(Lr$5);_defaults=w$4(Cn$2);_animationsDisabled=ot$e();_activeOptionChanges=j$5.EMPTY;_keyManager;showPanel=false;get isOpen(){return this._isOpen&&this.showPanel}_isOpen=false;_latestOpeningTrigger;_setColor(e){this._color=e,this._changeDetectorRef.markForCheck();}_color;template;panel;options;optionGroups;ariaLabel;ariaLabelledby;displayWith=null;autoActiveFirstOption;autoSelectActiveOption;requireSelection;panelWidth;disableRipple=false;optionSelected=new Qe$a;opened=new Qe$a;closed=new Qe$a;optionActivated=new Qe$a;set classList(e){this._classList=e,this._elementRef.nativeElement.className="";}_classList;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._syncParentProperties();}_hideSingleSelectionIndicator;_syncParentProperties(){if(this.options)for(let e of this.options)e._changeDetectorRef.markForCheck();}id=w$4(Mr$4).getId("mat-autocomplete-");inertGroups;constructor(){let e=w$4(G$a);this.inertGroups=e?.SAFARI||false,this.autoActiveFirstOption=!!this._defaults.autoActiveFirstOption,this.autoSelectActiveOption=!!this._defaults.autoSelectActiveOption,this.requireSelection=!!this._defaults.requireSelection,this._hideSingleSelectionIndicator=this._defaults.hideSingleSelectionIndicator??false;}ngAfterContentInit(){this._keyManager=new Sr$5(this.options).withWrap().skipPredicate(this._skipPredicate),this._activeOptionChanges=this._keyManager.change.subscribe(e=>{this.isOpen&&this.optionActivated.emit({source:this,option:this.options.toArray()[e]||null});}),this._setVisibility();}ngOnDestroy(){this._keyManager?.destroy(),this._activeOptionChanges.unsubscribe();}_setScrollTop(e){this.panel&&(this.panel.nativeElement.scrollTop=e);}_getScrollTop(){return this.panel?this.panel.nativeElement.scrollTop:0}_setVisibility(){this.showPanel=!!this.options?.length,this._changeDetectorRef.markForCheck();}_emitSelectEvent(e){let o=new vi$3(this,e);this.optionSelected.emit(o);}_getPanelAriaLabelledby(e){if(this.ariaLabel)return null;let o=e?e+" ":"";return this.ariaLabelledby?o+this.ariaLabelledby:e}_skipPredicate(){return false}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["mat-autocomplete"]],contentQueries:function(o,a,c){if(o&1&&Kh$1(c,F$2,5)(c,P$6,5),o&2){let d;Zw(d=Yw())&&(a.options=d),Zw(d=Yw())&&(a.optionGroups=d);}},viewQuery:function(o,a){if(o&1&&Jh(Mr$5,7)(or$2,5),o&2){let c;Zw(c=Yw())&&(a.template=c.first),Zw(c=Yw())&&(a.panel=c.first);}},hostAttrs:[1,"mat-mdc-autocomplete"],inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],displayWith:"displayWith",autoActiveFirstOption:[2,"autoActiveFirstOption","autoActiveFirstOption",Zj],autoSelectActiveOption:[2,"autoSelectActiveOption","autoSelectActiveOption",Zj],requireSelection:[2,"requireSelection","requireSelection",Zj],panelWidth:"panelWidth",disableRipple:[2,"disableRipple","disableRipple",Zj],classList:[0,"class","classList"],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",Zj]},outputs:{optionSelected:"optionSelected",opened:"opened",closed:"closed",optionActivated:"optionActivated"},exportAs:["matAutocomplete"],features:[LT([{provide:N$4,useExisting:t}])],ngContentSelectors:nr$2,decls:1,vars:0,consts:[["panel",""],["role","listbox",1,"mat-mdc-autocomplete-panel","mdc-menu-surface","mdc-menu-surface--open",3,"id"]],template:function(o,a){o&1&&(Gw(),Ah(0,ar$2,3,17,"ng-template"));},styles:[`div.mat-mdc-autocomplete-panel {
@@ -6691,7 +6691,7 @@ mat-autocomplete {
6691
6691
  `],encapsulation:2})}return t})();var rr$2={provide:L$4,useExisting:Po$4(()=>ot$4),multi:true};var lr$2=new N$7("mat-autocomplete-scroll-strategy",{providedIn:"root",factory:()=>{let t=w$4(be$5);return ()=>Ot$9(t)}}),ot$4=(()=>{class t{_environmentInjector=w$4(me$5);_element=w$4(Lr$5);_injector=w$4(be$5);_viewContainerRef=w$4(Ki$5);_zone=w$4(ue$7);_changeDetectorRef=w$4(Gj);_dir=w$4(ru,{optional:true});_formField=w$4(Y$5,{optional:true,host:true});_viewportRuler=w$4(L$7);_scrollStrategy=w$4(lr$2);_renderer=w$4(tD);_animationsDisabled=ot$e();_defaults=w$4(Cn$2,{optional:true});_overlayRef=null;_portal;_componentDestroyed=false;_initialized=new te$9;_keydownSubscription;_outsideClickSubscription;_cleanupWindowBlur;_previousValue=null;_valueOnAttach=null;_valueOnLastKeydown=null;_positionStrategy;_manuallyFloatingLabel=false;_closingActionsSubscription;_viewportSubscription=j$5.EMPTY;_breakpointObserver=w$4(ir$4);_handsetLandscapeSubscription=j$5.EMPTY;_canOpenOnNextFocus=true;_valueBeforeAutoSelection;_pendingAutoselectedOption=null;_closeKeyEventStream=new te$9;_overlayPanelClass=nn$6(this._defaults?.overlayPanelClass||[]);_windowBlurHandler=()=>{this._canOpenOnNextFocus=this.panelOpen||!this._hasFocus();};_onChange=()=>{};_onTouched=()=>{};autocomplete;position="auto";connectedTo;autocompleteAttribute="off";autocompleteDisabled=false;_aboveClass="mat-mdc-autocomplete-panel-above";ngAfterViewInit(){this._initialized.next(),this._initialized.complete(),this._cleanupWindowBlur=this._renderer.listen("window","blur",this._windowBlurHandler);}ngOnChanges(e){e.position&&this._positionStrategy&&(this._setStrategyPositions(this._positionStrategy),this.panelOpen&&this._overlayRef.updatePosition());}ngOnDestroy(){this._cleanupWindowBlur?.(),this._handsetLandscapeSubscription.unsubscribe(),this._viewportSubscription.unsubscribe(),this._componentDestroyed=true,this._destroyPanel(),this._closeKeyEventStream.complete();}get panelOpen(){return this._overlayAttached&&this.autocomplete.showPanel}_overlayAttached=false;openPanel(){this._openPanelInternal();}closePanel(){this._resetLabel(),this._overlayAttached&&(this.panelOpen&&this._zone.run(()=>{this.autocomplete.closed.emit();}),this.autocomplete._latestOpeningTrigger===this&&(this.autocomplete._isOpen=false,this.autocomplete._latestOpeningTrigger=null),this._overlayAttached=false,this._pendingAutoselectedOption=null,this._overlayRef&&this._overlayRef.hasAttached()&&(this._overlayRef.detach(),this._closingActionsSubscription.unsubscribe()),this._updatePanelState(),this._componentDestroyed||this._changeDetectorRef.detectChanges());}updatePosition(){this._overlayAttached&&this._overlayRef.updatePosition();}get panelClosingActions(){return zm(this.optionSelections,this.autocomplete._keyManager.tabOut.pipe(fn$7(()=>this._overlayAttached)),this._closeKeyEventStream,this._getOutsideClickStream(),this._overlayRef?this._overlayRef.detachments().pipe(fn$7(()=>this._overlayAttached)):Tm()).pipe(ke$3(e=>e instanceof M$4?e:null))}optionSelections=Vm(()=>{let e=this.autocomplete?this.autocomplete.options:null;return e?e.changes.pipe(Tu(e),ry(()=>zm(...e.map(o=>o.onSelectionChange)))):this._initialized.pipe(ry(()=>this.optionSelections))});get activeOption(){return this.autocomplete&&this.autocomplete._keyManager?this.autocomplete._keyManager.activeItem:null}_getOutsideClickStream(){return new S$5(e=>{let o=c=>{let d=me$4(c),u=this._formField?this._formField.getConnectedOverlayOrigin().nativeElement:null,v=this.connectedTo?this.connectedTo.elementRef.nativeElement:null;this._overlayAttached&&d!==this._element.nativeElement&&!this._hasFocus()&&(!u||!u.contains(d))&&(!v||!v.contains(d))&&this._overlayRef&&!this._overlayRef.overlayElement.contains(d)&&e.next(c);},a=[this._renderer.listen("document","click",o),this._renderer.listen("document","auxclick",o),this._renderer.listen("document","touchend",o)];return ()=>{a.forEach(c=>c());}})}writeValue(e){Promise.resolve(null).then(()=>this._assignOptionValue(e));}registerOnChange(e){this._onChange=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this._element.nativeElement.disabled=e;}_handleKeydown(e){let o=e,a=o.keyCode,c=Wo$3(o);if(a===27&&!c&&o.preventDefault(),this._valueOnLastKeydown=this._element.nativeElement.value,this.activeOption&&a===13&&this.panelOpen&&!c)this.activeOption._selectViaInteraction(),this._resetActiveItem(),o.preventDefault();else if(this.autocomplete){let d=this.autocomplete._keyManager.activeItem,u=a===38||a===40;a===9||u&&!c&&this.panelOpen?this.autocomplete._keyManager.onKeydown(o):u&&this._canOpen()&&this._openPanelInternal(this._valueOnLastKeydown),(u||this.autocomplete._keyManager.activeItem!==d)&&(this._scrollToOption(this.autocomplete._keyManager.activeItemIndex||0),this.autocomplete.autoSelectActiveOption&&this.activeOption&&(this._pendingAutoselectedOption||(this._valueBeforeAutoSelection=this._valueOnLastKeydown),this._pendingAutoselectedOption=this.activeOption,this._assignOptionValue(this.activeOption.value)));}}_handleInput(e){let o=e.target,a=o.value;if(o.type==="number"&&(a=a==""?null:parseFloat(a)),this._previousValue!==a){if(this._previousValue=a,this._pendingAutoselectedOption=null,(!this.autocomplete||!this.autocomplete.requireSelection)&&this._onChange(a),!a)this._clearPreviousSelectedOption(null,false);else if(this.panelOpen&&!this.autocomplete.requireSelection){let c=this.autocomplete.options?.find(d=>d.selected);if(c){let d=this._getDisplayValue(c.value);a!==d&&c.deselect(false);}}if(this._canOpen()&&this._hasFocus()){let c=this._valueOnLastKeydown??this._element.nativeElement.value;this._valueOnLastKeydown=null,this._openPanelInternal(c);}}}_handleFocus(){this._canOpenOnNextFocus?this._canOpen()&&(this._previousValue=this._element.nativeElement.value,this._attachOverlay(this._previousValue),this._floatLabel(true)):this._canOpenOnNextFocus=true;}_handleClick(){this._canOpen()&&!this.panelOpen&&this._openPanelInternal();}_hasFocus(){return Dc$1()===this._element.nativeElement}_floatLabel(e=false){this._formField&&this._formField.floatLabel==="auto"&&(e?this._formField._animateAndLockLabel():this._formField.floatLabel="always",this._manuallyFloatingLabel=true);}_resetLabel(){this._manuallyFloatingLabel&&(this._formField&&(this._formField.floatLabel="auto"),this._manuallyFloatingLabel=false);}_subscribeToClosingActions(){let e=new S$5(a=>{Tp$1(()=>{a.next();},{injector:this._environmentInjector});}),o=this.autocomplete.options?.changes.pipe(Cu(()=>this._positionStrategy.reapplyLastPosition()),Ym(0))??Tm();return zm(e,o).pipe(ry(()=>this._zone.run(()=>{let a=this.panelOpen;return this._resetActiveItem(),this._updatePanelState(),this._changeDetectorRef.detectChanges(),this.panelOpen&&this._overlayRef.updatePosition(),a!==this.panelOpen&&(this.panelOpen?this._emitOpened():this.autocomplete.closed.emit()),this.panelClosingActions})),_t$9(1)).subscribe(a=>this._setValueAndClose(a))}_emitOpened(){this.autocomplete.opened.emit();}_destroyPanel(){this._overlayRef&&(this.closePanel(),this._overlayRef.dispose(),this._overlayRef=null);}_getDisplayValue(e){let o=this.autocomplete;return o&&o.displayWith?o.displayWith(e):e}_assignOptionValue(e){let o=this._getDisplayValue(e);e==null&&this._clearPreviousSelectedOption(null,false),this._updateNativeInputValue(o??"");}_updateNativeInputValue(e){this._formField?this._formField._control.value=e:this._element.nativeElement.value=e,this._previousValue=e;}_setValueAndClose(e){let o=this.autocomplete,a=e?e.source:this._pendingAutoselectedOption;a?(this._clearPreviousSelectedOption(a),this._assignOptionValue(a.value),this._onChange(a.value),o._emitSelectEvent(a),this._element.nativeElement.focus()):o.requireSelection&&this._element.nativeElement.value!==this._valueOnAttach&&(this._clearPreviousSelectedOption(null),this._assignOptionValue(null),this._onChange(null)),this.closePanel();}_clearPreviousSelectedOption(e,o){this.autocomplete?.options?.forEach(a=>{a!==e&&a.selected&&a.deselect(o);});}_openPanelInternal(e=this._element.nativeElement.value){this._attachOverlay(e),this._floatLabel();}_attachOverlay(e){if(!this.autocomplete)return;let o=this._overlayRef;o?(this._positionStrategy.setOrigin(this._getConnectedElement()),o.updateSize({width:this._getPanelWidth()})):(this._portal=new N$6(this.autocomplete.template,this._viewContainerRef,{id:this._formField?.getLabelId()}),o=Mt$9(this._injector,this._getOverlayConfig()),this._overlayRef=o,this._viewportSubscription=this._viewportRuler.change().subscribe(()=>{this.panelOpen&&o&&o.updateSize({width:this._getPanelWidth()});}),this._handsetLandscapeSubscription=this._breakpointObserver.observe(Em.HandsetLandscape).subscribe(c=>{c.matches?this._positionStrategy.withFlexibleDimensions(true).withGrowAfterOpen(true).withViewportMargin(8):this._positionStrategy.withFlexibleDimensions(false).withGrowAfterOpen(false).withViewportMargin(0);})),o&&!o.hasAttached()&&(o.attach(this._portal),this._valueOnAttach=e,this._valueOnLastKeydown=null,this._closingActionsSubscription=this._subscribeToClosingActions());let a=this.panelOpen;this.autocomplete._isOpen=this._overlayAttached=true,this.autocomplete._latestOpeningTrigger=this,this.autocomplete._setColor(this._formField?.color),this._updatePanelState(),this.panelOpen&&a!==this.panelOpen&&this._emitOpened();}_handlePanelKeydown=e=>{(e.keyCode===27&&!Wo$3(e)||e.keyCode===38&&Wo$3(e,"altKey"))&&(this._pendingAutoselectedOption&&(this._updateNativeInputValue(this._valueBeforeAutoSelection??""),this._pendingAutoselectedOption=null),this._closeKeyEventStream.next(),this._resetActiveItem(),e.stopPropagation(),e.preventDefault());};_updatePanelState(){if(this.autocomplete._setVisibility(),this.panelOpen){let e=this._overlayRef;this._keydownSubscription||(this._keydownSubscription=e.keydownEvents().subscribe(this._handlePanelKeydown)),this._outsideClickSubscription||(this._outsideClickSubscription=e.outsidePointerEvents().subscribe());}else this._keydownSubscription?.unsubscribe(),this._outsideClickSubscription?.unsubscribe(),this._keydownSubscription=this._outsideClickSubscription=void 0;}_getOverlayConfig(){return new Z$7({positionStrategy:this._getOverlayPosition(),scrollStrategy:this._scrollStrategy(),width:this._getPanelWidth(),direction:this._dir??void 0,hasBackdrop:this._defaults?.hasBackdrop,backdropClass:this._defaults?.backdropClass||"cdk-overlay-transparent-backdrop",panelClass:this._overlayPanelClass,disableAnimations:this._animationsDisabled})}_getOverlayPosition(){let e=Pt$7(this._injector,this._getConnectedElement()).withFlexibleDimensions(false).withPush(false).withPopoverLocation("inline");return this._setStrategyPositions(e),this._positionStrategy=e,e}_setStrategyPositions(e){let o=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"}],a=this._aboveClass,c=[{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom",panelClass:a},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom",panelClass:a}],d;this.position==="above"?d=c:this.position==="below"?d=o:d=[...o,...c],e.withPositions(d);}_getConnectedElement(){return this.connectedTo?this.connectedTo.elementRef:this._formField?this._formField.getConnectedOverlayOrigin():this._element}_getPanelWidth(){return this.autocomplete.panelWidth||this._getHostWidth()}_getHostWidth(){return this._getConnectedElement().nativeElement.getBoundingClientRect().width}_resetActiveItem(){let e=this.autocomplete;if(e.autoActiveFirstOption){let o=-1;for(let a=0;a<e.options.length;a++)if(!e.options.get(a).disabled){o=a;break}e._keyManager.setActiveItem(o);}else e._keyManager.setActiveItem(-1);}_canOpen(){let e=this._element.nativeElement;return !e.readOnly&&!e.disabled&&!this.autocompleteDisabled}_scrollToOption(e){let o=this.autocomplete,a=ut$9(e,o.options,o.optionGroups);if(e===0&&a===1)o._setScrollTop(0);else if(o.panel){let c=o.options.toArray()[e];if(c){let d=c._getHostElement(),u=ft$7(d.offsetTop,d.offsetHeight,o._getScrollTop(),o.panel.nativeElement.offsetHeight);o._setScrollTop(u);}}}static \u0275fac=function(o){return new(o||t)};static \u0275dir=nw({type:t,selectors:[["input","matAutocomplete",""],["textarea","matAutocomplete",""]],hostAttrs:[1,"mat-mdc-autocomplete-trigger"],hostVars:7,hostBindings:function(o,a){o&1&&Qh("focusin",function(){return a._handleFocus()})("blur",function(){return a._onTouched()})("input",function(d){return a._handleInput(d)})("keydown",function(d){return a._handleKeydown(d)})("click",function(){return a._handleClick()}),o&2&&Hh("autocomplete",a.autocompleteAttribute)("role",a.autocompleteDisabled?null:"combobox")("aria-autocomplete",a.autocompleteDisabled?null:"list")("aria-activedescendant",a.panelOpen&&a.activeOption?a.activeOption.id:null)("aria-expanded",a.autocompleteDisabled?null:a.panelOpen.toString())("aria-controls",a.autocompleteDisabled||!a.panelOpen?null:a.autocomplete?.id)("aria-haspopup",a.autocompleteDisabled?null:"listbox");},inputs:{autocomplete:[0,"matAutocomplete","autocomplete"],position:[0,"matAutocompletePosition","position"],connectedTo:[0,"matAutocompleteConnectedTo","connectedTo"],autocompleteAttribute:[0,"autocomplete","autocompleteAttribute"],autocompleteDisabled:[2,"matAutocompleteDisabled","autocompleteDisabled",Zj]},exportAs:["matAutocompleteTrigger"],features:[LT([rr$2]),lv]})}return t})(),Qt$3=(()=>{class t{static \u0275fac=function(o){return new(o||t)};static \u0275mod=bh$1({type:t});static \u0275inj=Qs$2({imports:[we$5,ht$8,yt$9,ht$8,Fn$5]})}return t})();var sr$2=(t,s)=>s.path;function cr$2(t,s){if(t&1){let e=Fw();Pi$5(0,"button",24),Qh("click",function(){ud(e);let a=qw();return dd(a.clearPathInputField())}),Pi$5(1,"mat-icon"),TT(2,"close"),ul$2()();}}function dr$2(t,s){t&1&&(Pi$5(0,"mat-error"),TT(1," Path is required. Please enter a valid Signal K path. "),ul$2());}function mr$2(t,s){t&1&&(Pi$5(0,"mat-error"),TT(1," Path not recognized. Please enter a path from the server's published list. "),ul$2());}function pr$2(t,s){if(t&1&&(Pi$5(0,"span"),TT(1),ul$2(),$h(2,"br"),Pi$5(3,"small",25),TT(4),ul$2()),t&2){let e=qw().$implicit;EE(),gg(e.path),EE(3),gg(e.meta.description);}}function ur$2(t,s){if(t&1&&TT(0),t&2){let e=qw().$implicit;gl$2(" ",e.path," ");}}function fr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",8),_w(1,pr$2,5,2)(2,ur$2,1,1),ul$2()),t&2){let e=s.$implicit;Bh("value",e.path),EE(),Mw(e.meta!==void 0?1:2);}}function gr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",12),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gl$2(" ",e," ");}}function hr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",12),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e.measure),EE(),gl$2(" ",e.description," ");}}function Cr$2(t,s){if(t&1&&(Pi$5(0,"mat-optgroup",14),xw(1,hr$2,2,2,"mat-option",12,Sw),ul$2()),t&2){let e=s.$implicit;Bh("label",e.group),EE(),Aw(e.units);}}function vr$2(t){return s=>{let e=s.parent?.value?.pathRequired!==false,o=s.value;return e?o===null||o===""?{requireMatch:true}:t().some(d=>d.path===o)?null:{requireMatch:true}:o===null||o===""||t().some(d=>d.path===o)?null:{requireMatch:true}}}var bn$2=(()=>{class t{convertUnitTo=Hj.required();filterSelfPaths=Hj.required();datachartPath=Hj.required();datachartSource=Hj.required();timeScale=Hj.required();period=Hj.required();data=w$4(De$2);units=w$4(ut$2);_destroyRef=w$4(xe$3);numericPaths=vt$9([]);filteredNumericPaths=vt$9([]);unitList=vt$9({});pathSources=vt$9([]);maxDuration=Dt$9(()=>this.timeScale().value==="day"?365:60);ngOnInit(){if(this.numericPaths.set(this.data.getPathsAndMetaByType("number",false,false,this.filterSelfPaths().value).sort()),this.filteredNumericPaths.set(this.numericPaths()),this.datachartPath().valueChanges.pipe(Wl$2(300),Gp(this._destroyRef)).subscribe(e=>{let o=(e||"").toLowerCase().trim();o?this.filteredNumericPaths.set(this.numericPaths().filter(a=>a.path.toLowerCase().includes(o))):this.filteredNumericPaths.set(this.numericPaths());}),this.datachartPath().setValidators([vr$2(()=>this.getPaths())]),this.datachartPath()?.value){let e=this.data.getPathObject(this.datachartPath().value);this.setPathSources(e),this.unitList.set(this.units.getConversionsForPath(this.datachartPath().value));}this.setInitFormState();}setInitFormState(e=false){this.datachartSource().value&&!e?this.datachartSource().enable():(this.datachartSource().reset(),this.datachartSource().disable()),this.convertUnitTo().value&&!e?this.convertUnitTo().enable():(this.convertUnitTo().reset(),this.convertUnitTo().disable()),this.timeScale().value?this.timeScale().enable():this.timeScale().disable(),this.period().value?this.period().enable():this.period().disable();}getPaths(){return this.data.getPathsAndMetaByType("number",false,false,this.filterSelfPaths().value).sort()}clearPathInputField(){this.datachartPath().setValue(""),this.setInitFormState(true);}changePath(e){let o=this.data.getPathObject(e.option.value);if(o===null){this.pathSources.set([]),this.datachartSource().reset(),this.datachartSource().disable(),this.convertUnitTo().reset(),this.convertUnitTo().disable(),this.setPathUnits();return}this.setPathSources(o),this.setPathUnits(o.path);}setPathSources(e){if(!e){this.pathSources.set([]),this.datachartSource().reset(),this.datachartSource().disable();return}Object.keys(e.sources).length==1?(this.pathSources.set(["default"]),this.datachartSource().setValue("default"),this.datachartSource().enable()):Object.keys(e.sources).length>1&&(this.pathSources.set(Object.keys(e.sources).sort()),this.datachartSource().value?this.datachartSource().setValue(this.datachartSource().value):this.datachartSource().reset(),this.datachartSource().enable());}setPathUnits(e){e?(this.unitList.set(this.units.getConversionsForPath(e)),this.convertUnitTo().reset(),this.convertUnitTo()?.enable()):(this.unitList.set(this.units.getConversionsForPath("")),this.convertUnitTo().reset(),this.convertUnitTo()?.disable());}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["config-dataset-chart-options"]],inputs:{convertUnitTo:[1,"convertUnitTo"],filterSelfPaths:[1,"filterSelfPaths"],datachartPath:[1,"datachartPath"],datachartSource:[1,"datachartSource"],timeScale:[1,"timeScale"],period:[1,"period"]},decls:60,vars:10,consts:[["pathInput",""],["pathAutoComplete","matAutocomplete"],[1,"display-content","tab-content"],[1,"flex-container",2,"margin-top","10px"],[1,"full-width"],["type","text","matInput","","placeholder","Type to use autocomplete or select from list","required","",3,"formControl","matAutocomplete"],["mat-icon-button","","matIconSuffix","","aria-label","Clear"],[3,"optionSelected"],[2,"min-height","48px","line-height","1.15","height","auto","padding","8px 16px","white-space","normal",3,"value"],[3,"formControl"],[1,"flex-field-50"],["placeholder","Select data source","name","sourceControl","required","",3,"formControl"],[3,"value"],["placeholder","Select unit...","name","convertUnitTo","required","",3,"formControl"],[3,"label"],[2,"margin-top","10px"],["placeholder","Select dataset time scale","name","timeScaleFormat","required","",3,"formControl"],["value","day"],["value","hour"],["value","minute"],["value","second"],["matInput","","type","number","min","1","step","1","placeholder","Enter or select number...","required","",3,"max","formControl"],[2,"grid-column","1 / -1","font-size","0.9em","color","var(--mat-sys-outline)"],["routerLink","/help/history-data-charts",2,"color","var(--kip-blue-color)","cursor","pointer","text-decoration","underline"],["mat-icon-button","","matIconSuffix","","aria-label","Clear",3,"click"],[1,"pathMetaDescription"]],template:function(o,a){if(o&1&&(Pi$5(0,"div",2)(1,"div",3)(2,"mat-form-field",4)(3,"mat-label"),TT(4," Signal K Path "),ul$2(),$h(5,"input",5,0),cD(),_w(7,cr$2,3,0,"button",6),_w(8,dr$2,2,0,"mat-error")(9,mr$2,2,0,"mat-error"),Pi$5(10,"mat-autocomplete",7,1),Qh("optionSelected",function(d){return a.changePath(d)}),xw(12,fr$2,3,2,"mat-option",8,sr$2),ul$2()()(),Pi$5(14,"div",3)(15,"mat-checkbox",9),TT(16," Restrict to own vessel "),ul$2(),cD(),ul$2(),Pi$5(17,"div",3)(18,"div",10)(19,"mat-form-field",4)(20,"mat-label"),TT(21,"Source"),ul$2(),Pi$5(22,"mat-select",11),xw(23,gr$2,2,2,"mat-option",12,Nw),ul$2(),cD(),ul$2()(),Pi$5(25,"div",10)(26,"mat-form-field",4)(27,"mat-label"),TT(28,"Display Format"),ul$2(),Pi$5(29,"mat-select",13),xw(30,Cr$2,3,1,"mat-optgroup",14,Sw),ul$2(),cD(),ul$2()()(),$h(32,"br"),Pi$5(33,"p",15),TT(34," Time scale and duration set how much history the chart shows (the chart window). Data is sampled to keep roughly 120 points across the window; very short windows may show fewer points for performance. "),ul$2(),Pi$5(35,"div",3)(36,"div",10)(37,"mat-form-field",4)(38,"mat-label"),TT(39,"Time Scale"),ul$2(),Pi$5(40,"mat-select",16)(41,"mat-option",17),TT(42,"Days"),ul$2(),Pi$5(43,"mat-option",18),TT(44,"Hours"),ul$2(),Pi$5(45,"mat-option",19),TT(46,"Minutes"),ul$2(),Pi$5(47,"mat-option",20),TT(48,"Seconds"),ul$2()(),cD(),ul$2()(),Pi$5(49,"div",10)(50,"mat-form-field",4)(51,"mat-label"),TT(52,"Duration"),ul$2(),$h(53,"input",21),cD(),ul$2()(),Pi$5(54,"div",22)(55,"strong"),TT(56,"History API:"),ul$2(),TT(57," When the time scale is minutes or longer, the Data Chart can be pre-filled with historical data. "),Pi$5(58,"a",23),TT(59,"Learn more"),ul$2()()()()),o&2){let c=Jw(6),d=Jw(11);EE(5),Bh("formControl",a.datachartPath())("matAutocomplete",d),lD(),EE(2),Mw(c.value?7:-1),EE(),Mw(c.validity.valueMissing?8:a.datachartPath().errors?9:-1),EE(4),Aw(a.filteredNumericPaths()),EE(3),Bh("formControl",a.filterSelfPaths()),lD(),EE(7),Bh("formControl",a.datachartSource()),lD(),EE(),Aw(a.pathSources()),EE(6),Bh("formControl",a.convertUnitTo()),lD(),EE(),Aw(a.unitList().conversions),EE(10),Bh("formControl",a.timeScale()),lD(),EE(13),Bh("max",a.maxDuration())("formControl",a.period()),lD();}},dependencies:[yt$3,wt$3,Qt$3,yt$1,F$2,pt$8,ot$4,Jn$4,Kt$3,ce$4,rt$7,ae$3,It$4,Pt$4,Lt$4,Ft$2,ln$4,an$4,Op,eu,Wn$4,Xe$5,on$3,Pn$5,ft$6,Bt$4,Tt$5,ln$5,si$2],styles:[".display-content[_ngcontent-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:10px}"]})}return t})();var br$2=(t,s)=>s.path;function _r$2(t,s){t&1&&$h(0,"i",18);}function yr$2(t,s){t&1&&$h(0,"i",19);}function xr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",16),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),mg("",e.properties.quantity,": ",e.properties.display);}}function Sr$2(t,s){if(t&1){let e=Fw();Pi$5(0,"div",5)(1,"mat-form-field",17)(2,"mat-label"),_w(3,_r$2,1,0,"i",18)(4,yr$2,1,0,"i",19),TT(5," Filter"),ul$2(),Pi$5(6,"mat-select",20,2),Qh("selectionChange",function(){ud(e),qw();let a=Jw(11),c=qw();return dd(c.pathFormGroup().controls.path.setValue(a.value))}),Pi$5(8,"mat-option"),TT(9,"All"),ul$2(),xw(10,xr$2,2,3,"mat-option",16,Sw),ul$2(),cD(),ul$2()();}if(t&2){let e=Jw(7),o=qw(2);EE(3),Mw(e.value?4:3),EE(3),Bh("formControl",o.pathSkUnitsFilterControl),lD(),EE(4),Aw(o.pathSkUnitsFiltersList);}}function Mr$2(t,s){t&1&&(Pi$5(0,"span",8),TT(1,"(optional)"),ul$2());}function Tr$2(t,s){t&1&&(Pi$5(0,"mat-hint"),TT(1,"Leave blank to disable this path."),ul$2());}function Ar$2(t,s){if(t&1){let e=Fw();Pi$5(0,"button",21),Qh("click",function(){ud(e);let a=qw(2);return dd(a.pathFormGroup().controls.path.setValue(""))}),Pi$5(1,"mat-icon"),TT(2,"close"),ul$2()();}}function Er$2(t,s){t&1&&(Pi$5(0,"mat-error"),TT(1," Path is required. Please enter a valid Signal K path. "),ul$2());}function wr$2(t,s){t&1&&(Pi$5(0,"mat-error"),TT(1," Path not recognized. Please enter a path from the server's published list. "),ul$2());}function kr$2(t,s){if(t&1&&(Pi$5(0,"span"),TT(1),ul$2(),$h(2,"br"),Pi$5(3,"small",22),TT(4),ul$2()),t&2){let e=qw().$implicit;EE(),gg(e.path),EE(3),gg(e.meta.description);}}function Gr$2(t,s){if(t&1&&TT(0),t&2){let e=qw().$implicit;gl$2(" ",e.path," ");}}function Dr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",11),_w(1,kr$2,5,2)(2,Gr$2,1,1),ul$2()),t&2){let e=s.$implicit;Bh("value",e.path),EE(),Mw(e.meta!==void 0?1:2);}}function Pr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",16),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gl$2(" ",e," ");}}function Ir$2(t,s){if(t&1&&(Pi$5(0,"mat-option",16),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e.measure),EE(),gl$2(" ",e.description," ");}}function Fr$2(t,s){if(t&1&&(Pi$5(0,"mat-optgroup",28),xw(1,Ir$2,2,2,"mat-option",16,Sw),ul$2()),t&2){let e=s.$implicit;Bh("label",e.group),EE(),Aw(e.units);}}function Or$2(t,s){if(t&1&&(Pi$5(0,"mat-form-field",26)(1,"mat-label"),TT(2,"Display Format"),ul$2(),Pi$5(3,"mat-select",27),xw(4,Fr$2,3,1,"mat-optgroup",28,Sw),ul$2(),cD(),ul$2()),t&2){let e=qw(3);EE(3),lD(),EE(),Aw(e.unitList.conversions);}}function Nr$2(t,s){if(t&1&&(Pi$5(0,"div",23)(1,"mat-form-field",14)(2,"mat-label"),TT(3,"Sample Time"),ul$2(),$h(4,"input",24),cD(),ul$2()(),Pi$5(5,"div",25),_w(6,Or$2,6,0,"mat-form-field",26),ul$2()),t&2){let e=qw(2);EE(4),lD(),EE(2),Mw(e.pathFormGroup().value.pathType==="number"&&e.pathFormGroup().value.showConvertUnitTo===void 0||e.pathFormGroup().value.pathType==="number"&&e.pathFormGroup().value.showConvertUnitTo===true?6:-1);}}function Lr$2(t,s){if(t&1&&(Pi$5(0,"div",3)(1,"div",4)(2,"span"),TT(3),ul$2()(),_w(4,Sr$2,12,2,"div",5),Pi$5(5,"div",6)(6,"mat-form-field",7)(7,"mat-label"),TT(8," Signal K Path "),_w(9,Mr$2,2,0,"span",8),ul$2(),$h(10,"input",9,0),cD(),_w(12,Tr$2,2,0,"mat-hint"),_w(13,Ar$2,3,0,"button",10),_w(14,Er$2,2,0,"mat-error")(15,wr$2,2,0,"mat-error"),Pi$5(16,"mat-autocomplete",null,1),xw(18,Dr$2,3,2,"mat-option",11,br$2),HT(20,"async"),ul$2()()(),Pi$5(21,"div",12)(22,"div",13)(23,"mat-form-field",14)(24,"mat-label"),TT(25,"Data Source"),ul$2(),Pi$5(26,"mat-select",15),xw(27,Pr$2,2,2,"mat-option",16,Sw),ul$2(),cD(),ul$2()(),_w(29,Nr$2,7,1),ul$2()()),t&2){let e=Jw(17),o=qw();Bh("formGroup",o.pathFormGroup()),EE(2),ig("color",o.pathFormGroup().enabled?"":"rgba(255,255,255,0.5)"),EE(),gg(o.pathFormGroup().value.description),EE(),Mw(o.pathFormGroup().value.pathType==="number"&&o.showPathSkUnitsFilter?4:-1),EE(5),Mw(o.pathFormGroup().value.pathRequired===false?9:-1),EE(),Bh("matAutocomplete",e),lD(),EE(2),Mw(o.pathFormGroup().value.pathRequired===false?12:-1),EE(),Mw(o.pathFormGroup().value.path?13:-1),EE(),Mw(o.pathFormGroup().controls.path.errors?.required?14:o.pathFormGroup().controls.path.errors?.requireMatch?15:-1),EE(4),Aw($T(20,11,o.filteredPaths)),EE(8),lD(),EE(),Aw(o.availableSources),EE(2),Mw(o.pathFormGroup().value.zonesOnlyPaths?-1:29);}}function Vr$2(t){return s=>{let e=s.parent?.value?.pathRequired!==false,o=s.value;return e?o===null||o===""?{requireMatch:true}:t().some(d=>d.path===o)?null:{requireMatch:true}:o===null||o===""||t().some(d=>d.path===o)?null:{requireMatch:true}}}var _n$2=(()=>{class t{_data=w$4(De$2);_units=w$4(ut$2);_settings=w$4(Gi$3);_connection=w$4(T$2);_destroyRef=w$4(xe$3);pathFormGroup=Hj.required();multiCTRLArray=Hj.required();filterSelfPaths=Hj.required();availablePaths=[];filteredPaths=new Bn$5(null);availableSources=[];unitList={base:"",conversions:[]};showPathSkUnitsFilter=false;pathSkUnitsFilterControl=new I$6(null);pathSkUnitsFiltersList=[];unitlessUnit={unit:"unitless",properties:{display:"(null)",quantity:"Unitless",quantityDisplay:"(null)",description:""}};ngOnInit(){let e=this.pathFormGroup();if(e.controls.path.disabled)return;let o=[...this._units.skBaseUnits].sort((a,c)=>{let d=a.properties.quantity.localeCompare(c.properties.quantity);return d!==0?d:a.properties.display.localeCompare(c.properties.display)});this.pathSkUnitsFiltersList=[this.unitlessUnit,...o],e.value.pathSkUnitsFilter&&this.pathSkUnitsFilterControl.setValue(this.pathSkUnitsFiltersList.find(a=>a.unit===this.pathFormGroup().value.pathSkUnitsFilter)??null,{onlySelf:true}),e.value.showPathSkUnitsFilter&&(this.showPathSkUnitsFilter=e.value.showPathSkUnitsFilter),this._settings.getDisablePathValidation()||e.controls.path.setValidators([Vr$2(()=>this.getPaths())]),e.controls.path.updateValueAndValidity({onlySelf:true,emitEvent:false}),e.controls.pathRequired&&e.controls.pathRequired.valueChanges.pipe(Gp(this._destroyRef)).subscribe(()=>{this.pathFormGroup().controls.path.updateValueAndValidity();}),e.controls.path.valid?this.enableFormFields(false):this.disablePathFields(),e.controls.sampleTime||(e.addControl("sampleTime",new Bn$4("500",ve$2.required)),e.controls.sampleTime.updateValueAndValidity({onlySelf:true,emitEvent:false})),e.controls.path.valueChanges.pipe(Zm(a=>a===""?We$9(0):We$9(350)),Tu(""),ke$3(a=>this.filterPaths(a||""))).pipe(Gp(this._destroyRef)).subscribe(()=>{let a=this.pathFormGroup();a.controls.path.pristine||(a.controls.path.valid?(this.enableFormFields(true),this.updatePathMetaBoundDisplayName(a.controls.path.value),this.updatePathMetaBoundDisplayScale(a.controls.path.value)):this.disablePathFields());}),e.controls.pathType.valueChanges.pipe(Gp(this._destroyRef)).subscribe(()=>{let a=this.pathFormGroup();a.value.showPathSkUnitsFilter?this.pathSkUnitsFilterControl.setValue(this.unitlessUnit):this.pathSkUnitsFilterControl.setValue(null),a.controls.path.updateValueAndValidity();});}ngOnChanges(e){e.filterSelfPaths&&!e.filterSelfPaths.firstChange&&this.pathFormGroup().controls.path.updateValueAndValidity();}getPaths(){let e=this.pathFormGroup().controls.pathType.value,o=this.filterSelfPaths(),a=false,c=this.pathFormGroup();if(c.value.supportsPut){let u=false;this.multiCTRLArray().length>0&&(u=this.multiCTRLArray().some(v=>v.pathID===this.pathFormGroup().value.pathID&&v.type==="3")),u?a=false:a=U$2(this._connection.skServerVersion,"2.12.0",">=")?c.value.supportsPut:false;}let d=c.value.zonesOnlyPaths??false;return this._data.getPathsAndMetaByType(e,a,d,o).sort()}filterPaths(e){let o=e.toLowerCase(),a=this.getPaths();if(this.pathSkUnitsFilterControl.value){let c=this.pathSkUnitsFilterControl.value.unit;a=a.filter(d=>{let u=!!d.meta&&!!d.meta.units,v=c==="unitless";return u&&d.meta?.units===c||!u&&v});}a=a.filter(c=>c.path.toLowerCase().includes(o)),this.filteredPaths.next(a);}enableFormFields(e){let o=this._data.getPathObject(this.pathFormGroup().controls.path.value);if(o!=null){this.pathFormGroup().controls.sampleTime.enable({onlySelf:false});let a=this.pathFormGroup();a.controls.pathType.value=="number"&&(this.unitList=this._units.getConversionsForPath(a.controls.path.value),e&&a.controls.convertUnitTo.setValue(this.unitList.base,{onlySelf:true}),a.controls.convertUnitTo.enable({onlySelf:false})),Object.keys(o.sources).length==1?(this.availableSources=["default"],e?a.controls.source.value!="default"&&a.controls.source.setValue("default",{onlySelf:true}):a.controls.source.value!="default"&&a.controls.source.setValue("",{onlySelf:true})):Object.keys(o.sources).length>1&&(this.availableSources=Object.keys(o.sources),a.controls.source.value=="default"&&a.controls.source.reset()),a.controls.source.enable({onlySelf:false});}else this.disablePathFields();}disablePathFields(){this.pathFormGroup().controls.source.reset("",{onlySelf:true}),this.pathFormGroup().controls.source.disable({onlySelf:false}),this.pathFormGroup().controls.sampleTime.disable({onlySelf:false});let e=this.pathFormGroup();e.controls.pathType.value=="number"&&(e.controls.convertUnitTo.reset("",{onlySelf:true}),e.controls.convertUnitTo.disable({onlySelf:false}));}updatePathMetaBoundDisplayName(e){let o=this.pathFormGroup();if(!o.parent?.parent?.value||!Object.prototype.hasOwnProperty.call(o.parent.parent.value,"displayName"))return;let a=this._data.getPathMeta(e);a?.displayName&&"displayName"in o.parent.parent.controls&&o.parent.parent.get("displayName")?.setValue(a.displayName);}updatePathMetaBoundDisplayScale(e){let o=this.pathFormGroup();if(!o.parent?.parent?.value||!Object.prototype.hasOwnProperty.call(o.parent.parent.value,"displayScale"))return;let a=this._data.getPathMeta(e);if(a?.displayScale){let c=o.parent.parent.get("displayScale");if(!c)return;let d=o.controls.convertUnitTo.value;a.displayScale.lower!==null&&a.displayScale.lower!==void 0&&c.controls.lower.setValue(this._units.convertToUnit(d,a.displayScale.lower)),a.displayScale.upper!==null&&a.displayScale.upper!==void 0&&c.controls.upper.setValue(this._units.convertToUnit(d,a.displayScale.upper)),a.displayScale.type!==null&&a.displayScale.type!==void 0&&c.controls.type.setValue(a.displayScale.type),a.displayScale.power!==null&&a.displayScale.power!==void 0&&c.controls.power.setValue(a.displayScale.power);}}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["path-control-config"]],inputs:{pathFormGroup:[1,"pathFormGroup"],multiCTRLArray:[1,"multiCTRLArray"],filterSelfPaths:[1,"filterSelfPaths"]},features:[lv],decls:1,vars:1,consts:[["pathInput",""],["pathAutoComplete","matAutocomplete"],["pathUnitsFilter",""],[1,"flex-container","rounded-card","rounded-card-color",3,"formGroup"],[1,"flex-field-100"],[1,"flex-field-fixed"],[1,"flex-field-to-100"],["floatLabel","auto","appearance","fill",1,"pathField"],[1,"optional-label"],["type","text","matInput","","placeholder","Type to use autocomplete or select from list","formControlName","path",3,"matAutocomplete"],["mat-icon-button","","type","button","matIconSuffix","","aria-label","Clear"],[2,"min-height","48px","line-height","1.15","height","auto","padding","8px 16px","white-space","normal",3,"value"],[1,"pathProperties"],[1,"sourceField"],["appearance","outline","floatLabel","always",1,"fields"],["placeholder","Select source","formControlName","source","required",""],[3,"value"],["floatLabel","auto","appearance","fill",1,"filter-path"],[1,"fa-solid","fa-filter"],[1,"fa-solid","fa-filter-circle-xmark"],["panelWidth","",3,"selectionChange","formControl"],["mat-icon-button","","type","button","matIconSuffix","","aria-label","Clear",3,"click"],[1,"pathMetaDescription"],[1,"sampleTimeField"],["matInput","","type","number","placeholder","Sample time in milliseconds","formControlName","sampleTime","required",""],[1,"unitField"],[1,"fields"],["placeholder","Select unit","formControlName","convertUnitTo","required",""],[3,"label"]],template:function(o,a){o&1&&_w(0,Lr$2,30,13,"div",3),o&2&&Mw(a.pathFormGroup().value.isPathConfigurable?0:-1);},dependencies:[Ln$3,Xe$5,on$3,Pn$5,kn$5,ft$6,Wn$4,ln$5,gn$4,hn$3,rt$7,ae$3,an$4,Qt$3,yt$1,F$2,pt$8,ot$4,eu,Pt$4,It$4,Ft$2,yt$3,wt$3,le$4,Za$4],styles:[".pathGroup[_ngcontent-%COMP%]{width:100%}.pathGroupFields[_ngcontent-%COMP%]{display:block;width:calc(100% - 5px)}.pathField[_ngcontent-%COMP%]{width:100%}.pathProperties[_ngcontent-%COMP%]{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:center;align-content:flex-start;gap:10px}.fields[_ngcontent-%COMP%]{width:100%}.sourceField[_ngcontent-%COMP%]{flex:3 1}.sampleTimeField[_ngcontent-%COMP%]{flex:1 3}.unitField[_ngcontent-%COMP%]{flex:3 1}"]})}return t})();function Rr$2(t,s){if(t&1&&$h(0,"path-control-config",6),t&2){let e=s.$implicit,o=qw(2);Bh("pathFormGroup",o.getPathFormGroup(e))("filterSelfPaths",o.filterSelfPaths().value)("multiCTRLArray",o.multiCTRLArray);}}function Ur$2(t,s){if(t&1&&xw(0,Rr$2,1,3,"path-control-config",6,Sw),t&2){let e=qw();Aw(e.arrayPathControls);}}function Br$2(t,s){if(t&1&&$h(0,"path-control-config",6),t&2){let e=s.$implicit,o=qw(2);Bh("pathFormGroup",o.getPathFormGroup(e))("filterSelfPaths",o.filterSelfPaths().value)("multiCTRLArray",o.multiCTRLArray);}}function Wr$2(t,s){if(t&1&&(pl$2(0,4),xw(1,Br$2,1,3,"path-control-config",6,Sw),hl$2()),t&2){let e=qw();Bh("formGroup",e.pathControlsGroup),EE(),Aw(e.groupPathKeys);}}var yn$2=(()=>{class t{rootFormGroup=w$4(gn$4);fb=w$4(Hn$4);formGroupName=Hj.required();isArray=Hj.required();enableTimeout=Hj.required();dataTimeout=Hj.required();filterSelfPaths=Hj.required();addPathEvent=Hj();delPathEvent=Hj();updatePathEvent=Hj();pathsFormArray;pathControlsGroup;multiCTRLArray=[];ngOnInit(){this.isArray()?(this.pathsFormArray=this.rootFormGroup.control.get(this.formGroupName()),this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls")?.value??[]):this.pathControlsGroup=this.rootFormGroup.control.get(this.formGroupName());}addPath(e){this.pathsFormArray&&(this.pathsFormArray.push(this.fb.group({description:[e.path.description],path:[e.path.path,ve$2.required],pathID:[e.path.pathID],source:[e.path.source,ve$2.required],pathType:[e.path.pathType],zonesOnlyPaths:[e.path.zonesOnlyPaths??false],isPathConfigurable:[e.path.isPathConfigurable],showPathSkUnitsFilter:[e.path.showPathSkUnitsFilter],pathSkUnitsFilter:[e.path.pathSkUnitsFilter],convertUnitTo:[e.path.convertUnitTo],sampleTime:[e.path.sampleTime],supportsPut:[e.path.supportsPut]})),this.pathsFormArray.updateValueAndValidity(),this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls")?.value??[]);}delPath(){this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls")?.value??[];}updatePath(e){this.multiCTRLArray=e;}get arrayPathControls(){return this.pathsFormArray?.controls??[]}get groupPathKeys(){return this.pathControlsGroup?Object.keys(this.pathControlsGroup.controls):[]}getPathFormGroup(e){return typeof e=="string"?this.pathControlsGroup?.get(e):e}ngOnChanges(e){e.addPathEvent&&!e.addPathEvent.firstChange&&this.addPath(e.addPathEvent.currentValue),e.delPathEvent&&!e.delPathEvent.firstChange&&this.delPath(),e.updatePathEvent&&!e.updatePathEvent.firstChange&&this.updatePath(e.updatePathEvent.currentValue);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["paths-options"]],inputs:{formGroupName:[1,"formGroupName"],isArray:[1,"isArray"],enableTimeout:[1,"enableTimeout"],dataTimeout:[1,"dataTimeout"],filterSelfPaths:[1,"filterSelfPaths"],addPathEvent:[1,"addPathEvent"],delPathEvent:[1,"delPathEvent"],updatePathEvent:[1,"updatePathEvent"]},features:[lv],decls:13,vars:4,consts:[[1,"widget-options-grid"],["name","enableTimeout",3,"formControl"],["type","number","matNativeControl","","placeholder","Time in seconds...","name","dataTimeout","min","2","required","",3,"formControl"],["matTextSuffix",""],[3,"formGroup"],["name","filterSelfPaths",3,"formControl"],[2,"display","block",3,"pathFormGroup","filterSelfPaths","multiCTRLArray"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"mat-checkbox",1),TT(2," Enable Widget Data TTL "),ul$2(),cD(),Pi$5(3,"mat-form-field")(4,"mat-label"),TT(5,"TTL Timeout For Paths"),ul$2(),$h(6,"input",2),cD(),Pi$5(7,"span",3),TT(8,"Seconds"),ul$2()()(),_w(9,Ur$2,2,0)(10,Wr$2,3,1,"ng-container",4),Pi$5(11,"mat-checkbox",5),TT(12,` Restrict to own vessel
6692
6692
  `),ul$2(),cD()),o&2&&(EE(),Bh("formControl",a.enableTimeout()),lD(),EE(5),Bh("formControl",a.dataTimeout()),lD(),EE(3),Mw(a.isArray()?9:a.pathControlsGroup?10:-1),EE(2),Bh("formControl",a.filterSelfPaths()),lD());},dependencies:[Kt$3,Ln$3,Xe$5,on$3,Pn$5,kn$5,ft$6,Bt$4,Wn$4,ln$5,gn$4,rt$7,ae$3,an$4,Pt$4,_n$2],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:5px}"]})}return t})();function $r$2(t,s){if(t&1){let e=Fw();Pi$5(0,"button",7),Qh("click",function(){ud(e);let a=qw();return dd(a.dateTimezone().setValue(""))}),$h(1,"span",8),ul$2();}}function qr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",6),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e.label),EE(),mg(" ",e.offset," - ",e.label," ");}}function zr$2(t){return s=>t.some(o=>o.label===s.value)?null:{requireMatch:true}}var jr$2=()=>{let t=Intl.supportedValuesOf("timeZone"),s=new Date;return t.map(e=>({offset:new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(s).find(d=>d.type==="timeZoneName")?.value||"",label:e}))},xn$2=(()=>{class t{_destroyRef=w$4(xe$3);dateFormat=Hj.required();dateTimezone=Hj.required();tz=[];filteredTZ=Tm([]);filteredTZSubscription;constructor(){}ngOnInit(){typeof Intl.supportedValuesOf<"u"?this.tz=jr$2().sort((e,o)=>this.compareOffsets(e.offset,o.offset)):(console.log("[Widget Options] Feature not supported. Using static Time Zone list"),this.tz=[{offset:"GMT",label:"Africa/Abidjan"},{offset:"GMT",label:"Africa/Accra"},{offset:"GMT+3",label:"Africa/Addis_Ababa"},{offset:"GMT+1",label:"Africa/Algiers"},{offset:"GMT+3",label:"Africa/Asmera"},{offset:"GMT",label:"Africa/Bamako"},{offset:"GMT+1",label:"Africa/Bangui"},{offset:"GMT",label:"Africa/Banjul"},{offset:"GMT",label:"Africa/Bissau"},{offset:"GMT+2",label:"Africa/Blantyre"},{offset:"GMT+1",label:"Africa/Brazzaville"},{offset:"GMT+2",label:"Africa/Bujumbura"},{offset:"GMT+2",label:"Africa/Cairo"},{offset:"GMT",label:"Africa/Casablanca"},{offset:"GMT+2",label:"Africa/Ceuta"},{offset:"GMT",label:"Africa/Conakry"},{offset:"GMT",label:"Africa/Dakar"},{offset:"GMT+3",label:"Africa/Dar_es_Salaam"},{offset:"GMT+3",label:"Africa/Djibouti"},{offset:"GMT+1",label:"Africa/Douala"},{offset:"GMT",label:"Africa/El_Aaiun"},{offset:"GMT",label:"Africa/Freetown"},{offset:"GMT+2",label:"Africa/Gaborone"},{offset:"GMT+2",label:"Africa/Harare"},{offset:"GMT+2",label:"Africa/Johannesburg"},{offset:"GMT+2",label:"Africa/Juba"},{offset:"GMT+3",label:"Africa/Kampala"},{offset:"GMT+2",label:"Africa/Khartoum"},{offset:"GMT+2",label:"Africa/Kigali"},{offset:"GMT+1",label:"Africa/Kinshasa"},{offset:"GMT+1",label:"Africa/Lagos"},{offset:"GMT+1",label:"Africa/Libreville"},{offset:"GMT",label:"Africa/Lome"},{offset:"GMT+1",label:"Africa/Luanda"},{offset:"GMT+2",label:"Africa/Lubumbashi"},{offset:"GMT+2",label:"Africa/Lusaka"},{offset:"GMT+1",label:"Africa/Malabo"},{offset:"GMT+2",label:"Africa/Maputo"},{offset:"GMT+2",label:"Africa/Maseru"},{offset:"GMT+2",label:"Africa/Mbabane"},{offset:"GMT+3",label:"Africa/Mogadishu"},{offset:"GMT",label:"Africa/Monrovia"},{offset:"GMT+3",label:"Africa/Nairobi"},{offset:"GMT+1",label:"Africa/Ndjamena"},{offset:"GMT+1",label:"Africa/Niamey"},{offset:"GMT",label:"Africa/Nouakchott"},{offset:"GMT",label:"Africa/Ouagadougou"},{offset:"GMT+1",label:"Africa/Porto-Novo"},{offset:"GMT",label:"Africa/Sao_Tome"},{offset:"GMT+2",label:"Africa/Tripoli"},{offset:"GMT+1",label:"Africa/Tunis"},{offset:"GMT+2",label:"Africa/Windhoek"},{offset:"GMT-9",label:"America/Adak"},{offset:"GMT-8",label:"America/Anchorage"},{offset:"GMT-4",label:"America/Anguilla"},{offset:"GMT-4",label:"America/Antigua"},{offset:"GMT-3",label:"America/Araguaina"},{offset:"GMT-3",label:"America/Argentina/La_Rioja"},{offset:"GMT-3",label:"America/Argentina/Rio_Gallegos"},{offset:"GMT-3",label:"America/Argentina/Salta"},{offset:"GMT-3",label:"America/Argentina/San_Juan"},{offset:"GMT-3",label:"America/Argentina/San_Luis"},{offset:"GMT-3",label:"America/Argentina/Tucuman"},{offset:"GMT-3",label:"America/Argentina/Ushuaia"},{offset:"GMT-4",label:"America/Aruba"},{offset:"GMT-3",label:"America/Asuncion"},{offset:"GMT-3",label:"America/Bahia"},{offset:"GMT-6",label:"America/Bahia_Banderas"},{offset:"GMT-4",label:"America/Barbados"},{offset:"GMT-3",label:"America/Belem"},{offset:"GMT-6",label:"America/Belize"},{offset:"GMT-4",label:"America/Blanc-Sablon"},{offset:"GMT-4",label:"America/Boa_Vista"},{offset:"GMT-5",label:"America/Bogota"},{offset:"GMT-6",label:"America/Boise"},{offset:"GMT-3",label:"America/Buenos_Aires"},{offset:"GMT-6",label:"America/Cambridge_Bay"},{offset:"GMT-4",label:"America/Campo_Grande"},{offset:"GMT-5",label:"America/Cancun"},{offset:"GMT-4",label:"America/Caracas"},{offset:"GMT-3",label:"America/Catamarca"},{offset:"GMT-3",label:"America/Cayenne"},{offset:"GMT-5",label:"America/Cayman"},{offset:"GMT-5",label:"America/Chicago"},{offset:"GMT-6",label:"America/Chihuahua"},{offset:"GMT-6",label:"America/Ciudad_Juarez"},{offset:"GMT-5",label:"America/Coral_Harbour"},{offset:"GMT-3",label:"America/Cordoba"},{offset:"GMT-6",label:"America/Costa_Rica"},{offset:"GMT-7",label:"America/Creston"},{offset:"GMT-4",label:"America/Cuiaba"},{offset:"GMT-4",label:"America/Curacao"},{offset:"GMT",label:"America/Danmarkshavn"},{offset:"GMT-7",label:"America/Dawson"},{offset:"GMT-7",label:"America/Dawson_Creek"},{offset:"GMT-6",label:"America/Denver"},{offset:"GMT-4",label:"America/Detroit"},{offset:"GMT-4",label:"America/Dominica"},{offset:"GMT-6",label:"America/Edmonton"},{offset:"GMT-5",label:"America/Eirunepe"},{offset:"GMT-6",label:"America/El_Salvador"},{offset:"GMT-7",label:"America/Fort_Nelson"},{offset:"GMT-3",label:"America/Fortaleza"},{offset:"GMT-3",label:"America/Glace_Bay"},{offset:"GMT-1",label:"America/Godthab"},{offset:"GMT-3",label:"America/Goose_Bay"},{offset:"GMT-4",label:"America/Grand_Turk"},{offset:"GMT-4",label:"America/Grenada"},{offset:"GMT-4",label:"America/Guadeloupe"},{offset:"GMT-6",label:"America/Guatemala"},{offset:"GMT-5",label:"America/Guayaquil"},{offset:"GMT-4",label:"America/Guyana"},{offset:"GMT-3",label:"America/Halifax"},{offset:"GMT-4",label:"America/Havana"},{offset:"GMT-7",label:"America/Hermosillo"},{offset:"GMT-5",label:"America/Indiana/Knox"},{offset:"GMT-4",label:"America/Indiana/Marengo"},{offset:"GMT-4",label:"America/Indiana/Petersburg"},{offset:"GMT-5",label:"America/Indiana/Tell_City"},{offset:"GMT-4",label:"America/Indiana/Vevay"},{offset:"GMT-4",label:"America/Indiana/Vincennes"},{offset:"GMT-4",label:"America/Indiana/Winamac"},{offset:"GMT-4",label:"America/Indianapolis"},{offset:"GMT-6",label:"America/Inuvik"},{offset:"GMT-4",label:"America/Iqaluit"},{offset:"GMT-5",label:"America/Jamaica"},{offset:"GMT-3",label:"America/Jujuy"},{offset:"GMT-8",label:"America/Juneau"},{offset:"GMT-4",label:"America/Kentucky/Monticello"},{offset:"GMT-4",label:"America/Kralendijk"},{offset:"GMT-4",label:"America/La_Paz"},{offset:"GMT-5",label:"America/Lima"},{offset:"GMT-7",label:"America/Los_Angeles"},{offset:"GMT-4",label:"America/Louisville"},{offset:"GMT-4",label:"America/Lower_Princes"},{offset:"GMT-3",label:"America/Maceio"},{offset:"GMT-6",label:"America/Managua"},{offset:"GMT-4",label:"America/Manaus"},{offset:"GMT-4",label:"America/Marigot"},{offset:"GMT-4",label:"America/Martinique"},{offset:"GMT-5",label:"America/Matamoros"},{offset:"GMT-7",label:"America/Mazatlan"},{offset:"GMT-3",label:"America/Mendoza"},{offset:"GMT-5",label:"America/Menominee"},{offset:"GMT-6",label:"America/Merida"},{offset:"GMT-8",label:"America/Metlakatla"},{offset:"GMT-6",label:"America/Mexico_City"},{offset:"GMT-2",label:"America/Miquelon"},{offset:"GMT-3",label:"America/Moncton"},{offset:"GMT-6",label:"America/Monterrey"},{offset:"GMT-3",label:"America/Montevideo"},{offset:"GMT-4",label:"America/Montserrat"},{offset:"GMT-4",label:"America/Nassau"},{offset:"GMT-4",label:"America/New_York"},{offset:"GMT-8",label:"America/Nome"},{offset:"GMT-2",label:"America/Noronha"},{offset:"GMT-5",label:"America/North_Dakota/Beulah"},{offset:"GMT-5",label:"America/North_Dakota/Center"},{offset:"GMT-5",label:"America/North_Dakota/New_Salem"},{offset:"GMT-5",label:"America/Ojinaga"},{offset:"GMT-5",label:"America/Panama"},{offset:"GMT-3",label:"America/Paramaribo"},{offset:"GMT-7",label:"America/Phoenix"},{offset:"GMT-4",label:"America/Port-au-Prince"},{offset:"GMT-4",label:"America/Port_of_Spain"},{offset:"GMT-4",label:"America/Porto_Velho"},{offset:"GMT-4",label:"America/Puerto_Rico"},{offset:"GMT-3",label:"America/Punta_Arenas"},{offset:"GMT-5",label:"America/Rankin_Inlet"},{offset:"GMT-3",label:"America/Recife"},{offset:"GMT-6",label:"America/Regina"},{offset:"GMT-5",label:"America/Resolute"},{offset:"GMT-5",label:"America/Rio_Branco"},{offset:"GMT-3",label:"America/Santarem"},{offset:"GMT-3",label:"America/Santiago"},{offset:"GMT-4",label:"America/Santo_Domingo"},{offset:"GMT-3",label:"America/Sao_Paulo"},{offset:"GMT-1",label:"America/Scoresbysund"},{offset:"GMT-8",label:"America/Sitka"},{offset:"GMT-4",label:"America/St_Barthelemy"},{offset:"GMT-2:30",label:"America/St_Johns"},{offset:"GMT-4",label:"America/St_Kitts"},{offset:"GMT-4",label:"America/St_Lucia"},{offset:"GMT-4",label:"America/St_Thomas"},{offset:"GMT-4",label:"America/St_Vincent"},{offset:"GMT-6",label:"America/Swift_Current"},{offset:"GMT-6",label:"America/Tegucigalpa"},{offset:"GMT-3",label:"America/Thule"},{offset:"GMT-7",label:"America/Tijuana"},{offset:"GMT-4",label:"America/Toronto"},{offset:"GMT-4",label:"America/Tortola"},{offset:"GMT-7",label:"America/Vancouver"},{offset:"GMT-7",label:"America/Whitehorse"},{offset:"GMT-5",label:"America/Winnipeg"},{offset:"GMT-8",label:"America/Yakutat"},{offset:"GMT+8",label:"Antarctica/Casey"},{offset:"GMT+7",label:"Antarctica/Davis"},{offset:"GMT+10",label:"Antarctica/DumontDUrville"},{offset:"GMT+11",label:"Antarctica/Macquarie"},{offset:"GMT+5",label:"Antarctica/Mawson"},{offset:"GMT+13",label:"Antarctica/McMurdo"},{offset:"GMT-3",label:"Antarctica/Palmer"},{offset:"GMT-3",label:"Antarctica/Rothera"},{offset:"GMT+3",label:"Antarctica/Syowa"},{offset:"GMT+2",label:"Antarctica/Troll"},{offset:"GMT+5",label:"Antarctica/Vostok"},{offset:"GMT+2",label:"Arctic/Longyearbyen"},{offset:"GMT+3",label:"Asia/Aden"},{offset:"GMT+5",label:"Asia/Almaty"},{offset:"GMT+3",label:"Asia/Amman"},{offset:"GMT+12",label:"Asia/Anadyr"},{offset:"GMT+5",label:"Asia/Aqtau"},{offset:"GMT+5",label:"Asia/Aqtobe"},{offset:"GMT+5",label:"Asia/Ashgabat"},{offset:"GMT+5",label:"Asia/Atyrau"},{offset:"GMT+3",label:"Asia/Baghdad"},{offset:"GMT+3",label:"Asia/Bahrain"},{offset:"GMT+4",label:"Asia/Baku"},{offset:"GMT+7",label:"Asia/Bangkok"},{offset:"GMT+7",label:"Asia/Barnaul"},{offset:"GMT+3",label:"Asia/Beirut"},{offset:"GMT+6",label:"Asia/Bishkek"},{offset:"GMT+8",label:"Asia/Brunei"},{offset:"GMT+5:30",label:"Asia/Calcutta"},{offset:"GMT+9",label:"Asia/Chita"},{offset:"GMT+5:30",label:"Asia/Colombo"},{offset:"GMT+3",label:"Asia/Damascus"},{offset:"GMT+6",label:"Asia/Dhaka"},{offset:"GMT+9",label:"Asia/Dili"},{offset:"GMT+4",label:"Asia/Dubai"},{offset:"GMT+5",label:"Asia/Dushanbe"},{offset:"GMT+3",label:"Asia/Famagusta"},{offset:"GMT+2",label:"Asia/Gaza"},{offset:"GMT+2",label:"Asia/Hebron"},{offset:"GMT+8",label:"Asia/Hong_Kong"},{offset:"GMT+7",label:"Asia/Hovd"},{offset:"GMT+8",label:"Asia/Irkutsk"},{offset:"GMT+7",label:"Asia/Jakarta"},{offset:"GMT+9",label:"Asia/Jayapura"},{offset:"GMT+3",label:"Asia/Jerusalem"},{offset:"GMT+4:30",label:"Asia/Kabul"},{offset:"GMT+12",label:"Asia/Kamchatka"},{offset:"GMT+5",label:"Asia/Karachi"},{offset:"GMT+5:45",label:"Asia/Katmandu"},{offset:"GMT+9",label:"Asia/Khandyga"},{offset:"GMT+7",label:"Asia/Krasnoyarsk"},{offset:"GMT+8",label:"Asia/Kuala_Lumpur"},{offset:"GMT+8",label:"Asia/Kuching"},{offset:"GMT+3",label:"Asia/Kuwait"},{offset:"GMT+8",label:"Asia/Macau"},{offset:"GMT+11",label:"Asia/Magadan"},{offset:"GMT+8",label:"Asia/Makassar"},{offset:"GMT+8",label:"Asia/Manila"},{offset:"GMT+4",label:"Asia/Muscat"},{offset:"GMT+3",label:"Asia/Nicosia"},{offset:"GMT+7",label:"Asia/Novokuznetsk"},{offset:"GMT+7",label:"Asia/Novosibirsk"},{offset:"GMT+6",label:"Asia/Omsk"},{offset:"GMT+5",label:"Asia/Oral"},{offset:"GMT+7",label:"Asia/Phnom_Penh"},{offset:"GMT+7",label:"Asia/Pontianak"},{offset:"GMT+9",label:"Asia/Pyongyang"},{offset:"GMT+3",label:"Asia/Qatar"},{offset:"GMT+5",label:"Asia/Qostanay"},{offset:"GMT+5",label:"Asia/Qyzylorda"},{offset:"GMT+6:30",label:"Asia/Rangoon"},{offset:"GMT+3",label:"Asia/Riyadh"},{offset:"GMT+7",label:"Asia/Saigon"},{offset:"GMT+11",label:"Asia/Sakhalin"},{offset:"GMT+5",label:"Asia/Samarkand"},{offset:"GMT+9",label:"Asia/Seoul"},{offset:"GMT+8",label:"Asia/Shanghai"},{offset:"GMT+8",label:"Asia/Singapore"},{offset:"GMT+11",label:"Asia/Srednekolymsk"},{offset:"GMT+8",label:"Asia/Taipei"},{offset:"GMT+5",label:"Asia/Tashkent"},{offset:"GMT+4",label:"Asia/Tbilisi"},{offset:"GMT+3:30",label:"Asia/Tehran"},{offset:"GMT+6",label:"Asia/Thimphu"},{offset:"GMT+9",label:"Asia/Tokyo"},{offset:"GMT+7",label:"Asia/Tomsk"},{offset:"GMT+8",label:"Asia/Ulaanbaatar"},{offset:"GMT+6",label:"Asia/Urumqi"},{offset:"GMT+10",label:"Asia/Ust-Nera"},{offset:"GMT+7",label:"Asia/Vientiane"},{offset:"GMT+10",label:"Asia/Vladivostok"},{offset:"GMT+9",label:"Asia/Yakutsk"},{offset:"GMT+5",label:"Asia/Yekaterinburg"},{offset:"GMT+4",label:"Asia/Yerevan"},{offset:"GMT",label:"Atlantic/Azores"},{offset:"GMT-3",label:"Atlantic/Bermuda"},{offset:"GMT+1",label:"Atlantic/Canary"},{offset:"GMT-1",label:"Atlantic/Cape_Verde"},{offset:"GMT+1",label:"Atlantic/Faeroe"},{offset:"GMT+1",label:"Atlantic/Madeira"},{offset:"GMT",label:"Atlantic/Reykjavik"},{offset:"GMT-2",label:"Atlantic/South_Georgia"},{offset:"GMT",label:"Atlantic/St_Helena"},{offset:"GMT-3",label:"Atlantic/Stanley"},{offset:"GMT+10:30",label:"Australia/Adelaide"},{offset:"GMT+10",label:"Australia/Brisbane"},{offset:"GMT+10:30",label:"Australia/Broken_Hill"},{offset:"GMT+9:30",label:"Australia/Darwin"},{offset:"GMT+8:45",label:"Australia/Eucla"},{offset:"GMT+11",label:"Australia/Hobart"},{offset:"GMT+10",label:"Australia/Lindeman"},{offset:"GMT+11",label:"Australia/Lord_Howe"},{offset:"GMT+11",label:"Australia/Melbourne"},{offset:"GMT+8",label:"Australia/Perth"},{offset:"GMT+11",label:"Australia/Sydney"},{offset:"GMT+2",label:"Europe/Amsterdam"},{offset:"GMT+2",label:"Europe/Andorra"},{offset:"GMT+4",label:"Europe/Astrakhan"},{offset:"GMT+3",label:"Europe/Athens"},{offset:"GMT+2",label:"Europe/Belgrade"},{offset:"GMT+2",label:"Europe/Berlin"},{offset:"GMT+2",label:"Europe/Bratislava"},{offset:"GMT+2",label:"Europe/Brussels"},{offset:"GMT+3",label:"Europe/Bucharest"},{offset:"GMT+2",label:"Europe/Budapest"},{offset:"GMT+2",label:"Europe/Busingen"},{offset:"GMT+3",label:"Europe/Chisinau"},{offset:"GMT+2",label:"Europe/Copenhagen"},{offset:"GMT+1",label:"Europe/Dublin"},{offset:"GMT+2",label:"Europe/Gibraltar"},{offset:"GMT+1",label:"Europe/Guernsey"},{offset:"GMT+3",label:"Europe/Helsinki"},{offset:"GMT+1",label:"Europe/Isle_of_Man"},{offset:"GMT+3",label:"Europe/Istanbul"},{offset:"GMT+1",label:"Europe/Jersey"},{offset:"GMT+2",label:"Europe/Kaliningrad"},{offset:"GMT+3",label:"Europe/Kiev"},{offset:"GMT+3",label:"Europe/Kirov"},{offset:"GMT+1",label:"Europe/Lisbon"},{offset:"GMT+2",label:"Europe/Ljubljana"},{offset:"GMT+1",label:"Europe/London"},{offset:"GMT+2",label:"Europe/Luxembourg"},{offset:"GMT+2",label:"Europe/Madrid"},{offset:"GMT+2",label:"Europe/Malta"},{offset:"GMT+3",label:"Europe/Mariehamn"},{offset:"GMT+3",label:"Europe/Minsk"},{offset:"GMT+2",label:"Europe/Monaco"},{offset:"GMT+3",label:"Europe/Moscow"},{offset:"GMT+2",label:"Europe/Oslo"},{offset:"GMT+2",label:"Europe/Paris"},{offset:"GMT+2",label:"Europe/Podgorica"},{offset:"GMT+2",label:"Europe/Prague"},{offset:"GMT+3",label:"Europe/Riga"},{offset:"GMT+2",label:"Europe/Rome"},{offset:"GMT+4",label:"Europe/Samara"},{offset:"GMT+2",label:"Europe/San_Marino"},{offset:"GMT+2",label:"Europe/Sarajevo"},{offset:"GMT+4",label:"Europe/Saratov"},{offset:"GMT+3",label:"Europe/Simferopol"},{offset:"GMT+2",label:"Europe/Skopje"},{offset:"GMT+3",label:"Europe/Sofia"},{offset:"GMT+2",label:"Europe/Stockholm"},{offset:"GMT+3",label:"Europe/Tallinn"},{offset:"GMT+2",label:"Europe/Tirane"},{offset:"GMT+4",label:"Europe/Ulyanovsk"},{offset:"GMT+2",label:"Europe/Vaduz"},{offset:"GMT+2",label:"Europe/Vatican"},{offset:"GMT+2",label:"Europe/Vienna"},{offset:"GMT+3",label:"Europe/Vilnius"},{offset:"GMT+3",label:"Europe/Volgograd"},{offset:"GMT+2",label:"Europe/Warsaw"},{offset:"GMT+2",label:"Europe/Zagreb"},{offset:"GMT+2",label:"Europe/Zurich"},{offset:"GMT+3",label:"Indian/Antananarivo"},{offset:"GMT+6",label:"Indian/Chagos"},{offset:"GMT+7",label:"Indian/Christmas"},{offset:"GMT+6:30",label:"Indian/Cocos"},{offset:"GMT+3",label:"Indian/Comoro"},{offset:"GMT+5",label:"Indian/Kerguelen"},{offset:"GMT+4",label:"Indian/Mahe"},{offset:"GMT+5",label:"Indian/Maldives"},{offset:"GMT+4",label:"Indian/Mauritius"},{offset:"GMT+3",label:"Indian/Mayotte"},{offset:"GMT+4",label:"Indian/Reunion"},{offset:"GMT+13",label:"Pacific/Apia"},{offset:"GMT+13",label:"Pacific/Auckland"},{offset:"GMT+11",label:"Pacific/Bougainville"},{offset:"GMT+13:45",label:"Pacific/Chatham"},{offset:"GMT-5",label:"Pacific/Easter"},{offset:"GMT+11",label:"Pacific/Efate"},{offset:"GMT+13",label:"Pacific/Enderbury"},{offset:"GMT+13",label:"Pacific/Fakaofo"},{offset:"GMT+12",label:"Pacific/Fiji"},{offset:"GMT+12",label:"Pacific/Funafuti"},{offset:"GMT-6",label:"Pacific/Galapagos"},{offset:"GMT-9",label:"Pacific/Gambier"},{offset:"GMT+11",label:"Pacific/Guadalcanal"},{offset:"GMT+10",label:"Pacific/Guam"},{offset:"GMT-10",label:"Pacific/Honolulu"},{offset:"GMT+14",label:"Pacific/Kiritimati"},{offset:"GMT+11",label:"Pacific/Kosrae"},{offset:"GMT+12",label:"Pacific/Kwajalein"},{offset:"GMT+12",label:"Pacific/Majuro"},{offset:"GMT-9:30",label:"Pacific/Marquesas"},{offset:"GMT-11",label:"Pacific/Midway"},{offset:"GMT+12",label:"Pacific/Nauru"},{offset:"GMT-11",label:"Pacific/Niue"},{offset:"GMT+12",label:"Pacific/Norfolk"},{offset:"GMT+11",label:"Pacific/Noumea"},{offset:"GMT-11",label:"Pacific/Pago_Pago"},{offset:"GMT+9",label:"Pacific/Palau"},{offset:"GMT-8",label:"Pacific/Pitcairn"},{offset:"GMT+11",label:"Pacific/Ponape"},{offset:"GMT+10",label:"Pacific/Port_Moresby"},{offset:"GMT-10",label:"Pacific/Rarotonga"},{offset:"GMT+10",label:"Pacific/Saipan"},{offset:"GMT-10",label:"Pacific/Tahiti"},{offset:"GMT+12",label:"Pacific/Tarawa"},{offset:"GMT+13",label:"Pacific/Tongatapu"},{offset:"GMT+10",label:"Pacific/Truk"},{offset:"GMT+12",label:"Pacific/Wake"},{offset:"GMT+12",label:"Pacific/Wallis"}].sort((e,o)=>this.compareOffsets(e.offset,o.offset))),this.tz.unshift({offset:"",label:"System Timezone -"}),this.dateTimezone().setValidators([ve$2.required,zr$2(this.tz)]),this.filteredTZ=this.dateTimezone().valueChanges.pipe(Wl$2(500),Tu(""),ke$3(e=>this.filterTZ(e||""))),this.filteredTZSubscription=this.filteredTZ.pipe(Gp(this._destroyRef)).subscribe();}filterTZ(e){let o=e.toLowerCase();return this.tz.filter(a=>a.label.toLowerCase().includes(o))}compareOffsets(e,o){let a=c=>{let d=c.match(/([+-]?)(\d+)(?::(\d+))?/);if(!d)return 0;let u=d[1]==="-"?-1:1,v=parseInt(d[2],10),M=d[3]?parseInt(d[3],10):0;return u*(v*60+M)};return a(e)-a(o)}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["display-datetime-options"]],inputs:{dateFormat:[1,"dateFormat"],dateTimezone:[1,"dateTimezone"]},decls:15,vars:6,consts:[["timeZoneAutoComplete","matAutocomplete"],[1,"widget-options-grid"],[1,"options-grid-span2"],["matInput","","placeholder","dd/MM/yyyy HH:mm:ss","name","dateFormat","required","",3,"formControl"],["type","text","matInput","","placeholder","Type to use autocomplete","name","dateTimezone","required","",3,"formControl","matAutocomplete"],["mat-icon-button","","matSuffix","","aria-label","Clear"],[3,"value"],["mat-icon-button","","matSuffix","","aria-label","Clear",3,"click"],[1,"fa-solid","fa-close"]],template:function(o,a){if(o&1&&(Pi$5(0,"div",1)(1,"mat-form-field",2)(2,"mat-label"),TT(3,"Date & Time Format"),ul$2(),$h(4,"input",3),cD(),ul$2(),Pi$5(5,"mat-form-field",2)(6,"mat-label"),TT(7,"Adjust Value to Time Zone"),ul$2(),$h(8,"input",4),cD(),_w(9,$r$2,2,0,"button",5),Pi$5(10,"mat-autocomplete",null,0),xw(12,qr$2,2,3,"mat-option",6,Nw),HT(14,"async"),ul$2()()()),o&2){let c=Jw(11);EE(4),Bh("formControl",a.dateFormat()),lD(),EE(4),Bh("formControl",a.dateTimezone())("matAutocomplete",c),lD(),EE(),Mw(a.dateTimezone().value?9:-1),EE(3),Aw($T(14,4,a.filteredTZ));}},dependencies:[rt$7,ae$3,an$4,Ln$3,Xe$5,Pn$5,ft$6,Wn$4,ln$5,ot$4,eu,Pt$4,yt$1,F$2,Za$4],encapsulation:2})}return t})();function Kr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",6),TT(1),HT(2,"titlecase"),ul$2()),t&2){let e=s.$implicit;Bh("value",AT(e)),EE(),gg($T(2,3,e));}}var bi$3={V1_PLUGIN:"autopilot",V2_BASE:"/signalk/v2/api",V2_AUTOPILOTS:"/signalk/v2/api/vessels/self/autopilots",V2_DEFAULT_AUTOPILOT_ID:"/signalk/v2/api/vessels/self/autopilots/_providers/_default"},Sn$2={options:{modes:[],states:[]},state:null,mode:"off-line",target:null,engaged:false},Mn$2=(()=>{class t{formGroupName=Hj.required();_pluginConfig=w$4(w$2);_destroyRef=w$4(xe$3);http=w$4(yr$5);rootFormGroup=w$4(gn$4);autopilotFormGroup;apiVersion=vt$9(null);availableAutopilots=vt$9({});autopilotPlugin=vt$9(null);discoveryInProgress=vt$9(false);apiDetectionError=vt$9(null);apInstances=Dt$9(()=>{let e=this.availableAutopilots();return e?Object.keys(e):[]});modes=vt$9(null);pluginId=vt$9(null);currentRequests=new Set;constructor(){Fa$5(()=>{this.autopilotFormGroup?.get("apiVersion")?.setValue(this.apiVersion(),{emitEvent:false});});}ngOnInit(){this.autopilotFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.modes.set(this.autopilotFormGroup.value.modes||null),this.detectAutopilotApi();}detectAutopilotApi(){return Zr$4(this,null,function*(){this.discoveryInProgress.set(true),console.log("[Autopilot Options] Starting API detection...");try{if(yield this.checkV2Api())if(this.apiVersion.set("v2"),this.autopilotFormGroup.get("apiVersion")?.setValue("v2",{emitEvent:!1}),this.availableAutopilots()&&Object.keys(this.availableAutopilots()).length>0){this.pluginId.set(Object.values(this.availableAutopilots())[0]?.provider??null),this.autopilotFormGroup.get("pluginId")?.setValue(this.pluginId(),{emitEvent:!1}),this.discoveryInProgress.set(!1);return}else console.warn("[Autopilot Options] No V2 autopilot provider found");}catch(e){console.error("[Autopilot Options] Error checking V2 API, checking V1...",e);}try{let e=yield this._pluginConfig.getPlugin(bi$3.V1_PLUGIN);if(e.ok&&e.data.state.enabled){this.apiVersion.set("v1"),this.autopilotFormGroup.get("apiVersion")?.setValue("v1",{emitEvent:!1}),this.availableAutopilots.set({"Default Autopilot":{provider:"Signal K Autopilot",isDefault:!0}}),this.pluginId.set("Signal K Autopilot"),this.autopilotFormGroup.get("pluginId")?.setValue("Signal K Autopilot",{emitEvent:!1}),console.log("[Autopilot Options] V1 API Signal K Autopilot plugin detected"),this.discoveryInProgress.set(!1);return}console.log("[Autopilot Options] V1 API plugin (signalk-autopilot) not found");}catch(e){console.error("[Autopilot Options] V1 plugin detection failed:",e);}console.warn("[Autopilot Options] No Autopilot detected"),this.discoveryInProgress.set(false);})}checkV2Api(){return Zr$4(this,null,function*(){try{let e=yield _m(this.makeHttpRequest(this.http.get(bi$3.V2_AUTOPILOTS,{observe:"response",responseType:"json"})));return e&&e.body&&Object.keys(e.body).length>0?(this.availableAutopilots.set(e.body),console.log("[Autopilot Options] Discovered V2 API autopilot providers:",JSON.stringify(e.body))):(this.availableAutopilots.set({}),console.warn("[Autopilot Options] No V2 autopilot provider plugin found.")),e?.status===200}catch(e){if(e&&typeof e=="object"&&"status"in e){let o=e;o.status===404?console.log("[Autopilot Options] V2 API endpoint not found (404)"):o.status>=500?console.warn("[Autopilot Options] V2 API server error:",o.status,o.statusText):console.log("[Autopilot Options] V2 API call to discover Autopilot Providers failed:",o.status,o.statusText);}else console.log("[Autopilot Options] V2 API network error:",e);return false}})}discoverV2AutopilotOptions(e){return Zr$4(this,null,function*(){let o;try{try{this.discoveryInProgress.set(!0),o=yield _m(this.makeHttpRequest(this.http.get(`${bi$3.V2_AUTOPILOTS}/${e}`))),console.log("[Autopilot Options] V2 Autopilot Options response:",JSON.stringify(o));}catch(a){o=Sn$2,console.log(`[Autopilot Options] Default AP discovery endpoint error for instance '${e}'`);}return this.discoveryInProgress.set(!1),o}catch(a){return console.error("[Autopilot Options] Failed to discover V2 endpoints:",a),console.log(`[Autopilot Options] Using fallback V2 endpoints for instance '${e}'`),Sn$2}})}onAutopilotInstanceIdChange(e){let o=e.value;if(e.value===""){this.modes.set(""),this.autopilotFormGroup.get("modes")?.setValue("",{emitEvent:false});return}console.log("[Autopilot Options] Selected Autopilot Instance ID:",o),this.apiVersion()==="v2"?this.discoverV2AutopilotOptions(o).then(a=>{let c=a.options.modes||[];this.modes.set(c.join(", ")),this.autopilotFormGroup.get("modes")?.setValue(c,{emitEvent:false}),console.log("[Autopilot Options] Autopilot plugin supported modes :",c.join(", "));}).catch(a=>{console.error("[Autopilot Options] Error requesting autopilot modes:",a),this.autopilotFormGroup.get("modes")?.setValue([],{emitEvent:false});}):this.apiVersion()==="v1"&&(this.modes.set("standby, auto, wind, route"),this.autopilotFormGroup.get("modes")?.setValue("standby, auto, wind, route",{emitEvent:false}),console.log("[Autopilot Options] Autopilot mode set to Raymarine v1 API modes: standby, auto, wind, route"));}makeHttpRequest(e){let o=e.pipe(Gp(this._destroyRef));return this.currentRequests.add(o),o.pipe(zl$2(()=>this.currentRequests.delete(o)))}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["select-autopilot"]],inputs:{formGroupName:[1,"formGroupName"]},decls:30,vars:4,consts:[[1,"display-content","tab-content"],[1,"autopilot-options",3,"formGroup"],[1,"flex-item-rounded-card","rounded-card-color",2,"margin-block","10px"],[2,"margin-block-start","0px"],["placeholder","Select autopilot...","formControlName","instanceId","name","instanceId","required","",3,"selectionChange"],["value",""],[3,"value"],[1,"flex-item-rounded-card","rounded-card-color",2,"margin-block","10px","margin-left","10px","margin-right","10px"],["name","headingDirectionTrue","formControlName","headingDirectionTrue"],["name","invertRudder","formControlName","invertRudder"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),TT(4,"Signal K Service Discovery"),ul$2(),Pi$5(5,"ul")(6,"li")(7,"b"),TT(8,"API Version:"),ul$2(),TT(9),ul$2(),Pi$5(10,"li")(11,"b"),TT(12,"Plugin:"),ul$2(),TT(13),ul$2()()(),Pi$5(14,"mat-form-field")(15,"mat-label"),TT(16,"Target Autopilot"),ul$2(),Pi$5(17,"mat-select",4),Qh("selectionChange",function(d){return a.onAutopilotInstanceIdChange(d)}),Pi$5(18,"mat-option",5),TT(19,"No autopilot"),ul$2(),xw(20,Kr$2,3,5,"mat-option",6,Sw),ul$2(),cD(),ul$2(),Pi$5(22,"div",7)(23,"b"),TT(24,"Supported modes:"),ul$2(),TT(25),ul$2(),Pi$5(26,"mat-checkbox",8),TT(27," Display True Heading "),ul$2(),cD(),Pi$5(28,"mat-checkbox",9),TT(29," Invert Rudder Angle Indicator "),ul$2(),cD(),ul$2()()),o&2&&(EE(),Bh("formGroup",a.autopilotFormGroup),EE(8),gl$2(" ",a.apiVersion()),EE(4),gl$2(" ",a.pluginId()),EE(4),lD(),EE(3),Aw(a.apInstances()),EE(5),gl$2(" ",a.modes()," "),EE(),lD(),EE(2),lD());},dependencies:[Wn$4,Pn$5,kn$5,ft$6,gn$4,hn$3,ce$4,rt$7,ae$3,Jn$4,Kt$3,Lt$4,Ft$2,F$2,ln$4,Xa$4],styles:[".autopilot-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px}"]})}return t})();var xt$2=(()=>{class t{data=w$4(De$2);destroyRef=w$4(xe$3);allPaths=new Set;registrations=new Map;constructor(){this.seedFromDataCache(),this.data.observePathUpdates().pipe(Gp(this.destroyRef)).subscribe(e=>this.applyPathUpdate(e)),this.data.isResetService().pipe(Gp(this.destroyRef)).subscribe(()=>this.reset());}seedFromDataCache(){for(let e of this.data.getCachedPaths())this.addPath(e);}register(e){this.assertHasCriteria(e);let o=this.createToken(e.id),a=this.compileCriteria(e),c=new Set;for(let d of this.allPaths)this.matchesCriteria(d,a)&&c.add(d);return this.registrations.set(o,{criteria:a,matches:c,changes$:new te$9}),o}unregister(e){let o=this.registrations.get(e);o&&(o.changes$.complete(),this.registrations.delete(e));}changes(e){return this.registrations.get(e)?.changes$.asObservable()??Ct$b}activePaths(e){return this.registrations.get(e)?.matches??new Set}match(e){this.assertHasCriteria(e);let o=this.compileCriteria(e);return Array.from(this.allPaths).filter(a=>this.matchesCriteria(a,o))}applyPathUpdate(e){let o=e?.fullPath;o&&(e.kind==="data"&&e.update?.value===null||this.addPath(o));}addPath(e){if(!this.allPaths.has(e)){this.allPaths.add(e);for(let o of this.registrations.values())this.matchesCriteria(e,o.criteria)&&(o.matches.add(e),o.changes$.next({type:"add",path:e}));}}removePath(e){if(this.allPaths.delete(e))for(let o of this.registrations.values())o.matches.delete(e)&&o.changes$.next({type:"remove",path:e});}reset(){for(let e of this.registrations.values()){for(let o of e.matches)e.changes$.next({type:"remove",path:o});e.matches.clear();}this.allPaths.clear();}compileCriteria(e){let o=e.patterns?.length?e.patterns:[];return z$5(G$b({},e),{patterns:o,compiled:{patterns:o.map(a=>this.globToRegex(a)),contextTypes:e.contextTypes??[],prefixGuards:e.pathPrefixes??[],suffixGuards:e.pathSuffixes??[]}})}matchesCriteria(e,o){let a=o.compiled,c=this.getContextType(e);if(a.contextTypes.length&&(!c||!a.contextTypes.includes(c)))return false;let d=this.getPathPart(e,c);return a.prefixGuards.length&&!a.prefixGuards.some(u=>d.startsWith(u))||a.suffixGuards.length&&!this.matchesSuffix(d,a.suffixGuards)?false:a.patterns.length?a.patterns.some(u=>u.test(e)):true}getPathPart(e,o){if(o==="self"){let c=e.indexOf(".");return c===-1?e:e.slice(c+1)}if(o==="vessels"||o==="atons"){let c=`${o}.urn:mrn:imo:mmsi:`;if(!e.startsWith(c))return e;let d=e.indexOf(".",c.length);return d===-1?"":e.slice(d+1)}let a=e.indexOf(".");return a===-1?e:e.slice(a+1)}getContextType(e){return e.startsWith("self.")?"self":e.startsWith("vessels.urn:mrn:imo:mmsi:")?"vessels":e.startsWith("atons.urn:mrn:imo:mmsi:")?"atons":null}globToRegex(e){let a="^"+e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$";return new RegExp(a)}matchesSuffix(e,o){if(!o.length)return true;let a=e.lastIndexOf("."),c=a===-1?`.${e}`:e.slice(a);return o.some(d=>e.endsWith(d)||c===d)}createToken(e){let o=e??"token",a=`${o}-${Math.random().toString(36).slice(2,10)}`;for(;this.registrations.has(a);)a=`${o}-${Math.random().toString(36).slice(2,10)}`;return a}assertHasCriteria(e){let o=Array.isArray(e.patterns)&&e.patterns.length>0,a=Array.isArray(e.contextTypes)&&e.contextTypes.length>0,c=Array.isArray(e.pathPrefixes)&&e.pathPrefixes.length>0,d=Array.isArray(e.pathSuffixes)&&e.pathSuffixes.length>0;if(!o&&!a&&!c&&!d)throw new Error("PathDiscoveryService.register requires at least one criteria (pattern or guard).")}ngOnDestroy(){for(let e of this.registrations.values())e.changes$.complete();this.registrations.clear(),this.allPaths.clear();}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Hr$2=(t,s)=>s.key;function Yr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",4),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gg(e.id);}}function Zr$2(t,s){t&1&&(Pi$5(0,"div",5),TT(1,"No banks configured yet."),ul$2());}function Jr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",4),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gg(e);}}function Xr$2(t,s){if(t&1&&(Pi$5(0,"mat-option",4),TT(1),HT(2,"titlecase"),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gg($T(2,2,e));}}function Qr$2(t,s){if(t&1){let e=Fw();Pi$5(0,"div",9)(1,"div",10)(2,"mat-form-field",11)(3,"mat-label"),TT(4,"Bank Name"),ul$2(),$h(5,"input",12),cD(),ul$2(),Pi$5(6,"button",13),Qh("click",function(){let a=ud(e).$index,c=qw();return dd(c.removeBank(a))}),Pi$5(7,"mat-icon"),TT(8,"delete"),ul$2()()(),Pi$5(9,"mat-form-field",2)(10,"mat-label"),TT(11,"Battery Members"),ul$2(),Pi$5(12,"mat-select",14),xw(13,Jr$2,2,2,"mat-option",4,Sw),ul$2(),cD(),ul$2(),Pi$5(15,"mat-form-field",2)(16,"mat-label"),TT(17,"Connection Mode"),ul$2(),Pi$5(18,"mat-select",15),xw(19,Xr$2,3,4,"mat-option",4,Nw),ul$2(),cD(),ul$2()();}if(t&2){let e=s.$index,o=qw();Bh("formGroupName",e),EE(5),lD(),EE(7),lD(),EE(),Aw(o.discoveredBatteryIds()),EE(5),lD(),EE(),Aw(o.connectionModes);}}var Tn$1=(()=>{class t{connectionModes=["parallel","series"];formGroupName=Hj.required();rootFormGroup=w$4(gn$4);discovery=w$4(xt$2);destroyRef=w$4(xe$3);bmsFormGroup;groupsFormArray;trackedDevicesControl;discoveredBatteryIds=vt$9([]);discoveredTrackedDevices=Dt$9(()=>this.discoveredBatteryIds().map(e=>({id:e,source:"default",key:`${e}||default`})));hasGroups=Dt$9(()=>this.groupsFormArray?.length>0);discoveryToken;ngOnInit(){this.bmsFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.bmsFormGroup&&(this.ensureTrackedControl(),this.ensureBanksArray(),this.initializeDiscovery());}addBank(){let e={id:`bank-${Date.now()}`,name:"New Bank",memberIds:[],connectionMode:"parallel"};this.groupsFormArray.push(this.createGroup(e)),this.groupsFormArray.markAsDirty();}removeBank(e){this.groupsFormArray.removeAt(e),this.groupsFormArray.markAsDirty();}ngOnDestroy(){this.discoveryToken&&this.discovery.unregister(this.discoveryToken);}ensureTrackedControl(){let e=this.bmsFormGroup.get("trackedDevices");if(e instanceof Bn$4){this.trackedDevicesControl=e,this.trackedDevicesControl.setValue(this.normalizeTrackedDeviceArray(this.trackedDevicesControl.value),{emitEvent:false});return}this.trackedDevicesControl=new Bn$4([]),this.bmsFormGroup.addControl("trackedDevices",this.trackedDevicesControl);}compareTrackedDevice(e,o){return !e||!o?e===o:e.key===o.key}normalizeTrackedDeviceArray(e){if(!Array.isArray(e))return [];let o=new Map;return e.forEach(a=>{if(!a||typeof a!="object")return;let c=a,d=typeof c.id=="string"?c.id.trim():"",u=typeof c.source=="string"?c.source.trim():"default";if(!d||!u)return;let v=typeof c.key=="string"&&c.key.trim().length>0?c.key.trim():`${d}||${u}`;o.set(v,{id:d,source:u,key:v});}),[...o.values()].sort((a,c)=>a.key.localeCompare(c.key))}ensureBanksArray(){let e=this.bmsFormGroup.get("groups")??this.bmsFormGroup.get("banks");if(e instanceof oe$3||e instanceof Un$4){this.groupsFormArray=e,this.bmsFormGroup.get("groups")||this.bmsFormGroup.setControl("groups",this.groupsFormArray);return}let o=Array.isArray(e?.value)?e.value:[];this.groupsFormArray=new Un$4(o.map(a=>this.createGroup(a))),this.bmsFormGroup.setControl("groups",this.groupsFormArray);}createGroup(e){let o=Array.isArray(e.memberIds)?e.memberIds:Array.isArray(e.batteryIds)?e.batteryIds:[];return new Tn$4({id:new Bn$4(e.id,ve$2.required),name:new Bn$4(e.name,ve$2.required),memberIds:new Bn$4(o),connectionMode:new Bn$4(e.connectionMode??"parallel",ve$2.required)})}initializeDiscovery(){this.discoveryToken=this.discovery.register({id:"bms-batteries",patterns:["self.electrical.batteries.*"],contextTypes:["self"],pathPrefixes:["electrical.batteries."]}),this.updateDiscoveredBatteryIds(),this.discovery.changes(this.discoveryToken).pipe(Gp(this.destroyRef)).subscribe(()=>this.updateDiscoveredBatteryIds());}updateDiscoveredBatteryIds(){if(!this.discoveryToken)return;let e=Array.from(this.discovery.activePaths(this.discoveryToken)).map(o=>this.extractBatteryId(o)).filter(o=>!!o);this.discoveredBatteryIds.set([...new Set(e)].sort());}extractBatteryId(e){let o=e.match(/self\.electrical\.batteries\.([^.]+)\./);return o?o[1]:null}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["bms-bank-setup"]],inputs:{formGroupName:[1,"formGroupName"]},decls:23,vars:3,consts:[[1,"bms-config",3,"formGroup"],[1,"bms-config-section"],["appearance","outline",1,"full-width"],["formControlName","trackedDevices","multiple","",3,"compareWith"],[3,"value"],[1,"hint"],[1,"section-header"],["mat-stroked-button","","color","primary","type","button",3,"click"],["formArrayName","groups",1,"bank-list"],[1,"bank-card",3,"formGroupName"],[1,"bank-row"],["appearance","outline",1,"bank-name"],["matInput","","formControlName","name"],["mat-icon-button","","type","button","aria-label","Remove bank",3,"click"],["formControlName","memberIds","multiple",""],["formControlName","connectionMode"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"div",1)(2,"h3"),TT(3,"Tracked Batteries"),ul$2(),Pi$5(4,"mat-form-field",2)(5,"mat-label"),TT(6,"Battery Instances"),ul$2(),Pi$5(7,"mat-select",3),xw(8,Yr$2,2,2,"mat-option",4,Hr$2),ul$2(),cD(),ul$2(),Pi$5(10,"div",5),TT(11," Leave empty to display all discovered batteries. "),ul$2()(),$h(12,"mat-divider"),Pi$5(13,"div",1)(14,"div",6)(15,"h3"),TT(16,"Battery Banks"),ul$2(),Pi$5(17,"button",7),Qh("click",function(){return a.addBank()}),TT(18," Add Bank "),ul$2()(),Pi$5(19,"div",8),_w(20,Zr$2,2,0,"div",5),xw(21,Qr$2,21,1,"div",9,Sw),ul$2()()()),o&2&&(Bh("formGroup",a.bmsFormGroup),EE(7),Bh("compareWith",a.compareTrackedDevice),lD(),EE(),Aw(a.discoveredTrackedDevices()),EE(12),Mw(a.hasGroups()?-1:20),EE(),Aw(a.groupsFormArray.controls));},dependencies:[Wn$4,Xe$5,Pn$5,kn$5,gn$4,hn$3,_t$6,yt$7,ce$4,rt$7,ae$3,ln$4,an$4,Lt$4,Ft$2,F$2,Op,xp$1,eu,yt$3,wt$3,f$2,u$3,Xa$4],styles:["[_nghost-%COMP%]{display:block;width:100%}.bms-config[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;padding:12px 4px}.bms-config-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.section-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.full-width[_ngcontent-%COMP%]{width:100%}.bank-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.bank-card[_ngcontent-%COMP%]{border:1px solid var(--kip-widget-card-border-color);border-radius:12px;padding:12px;background:var(--kip-contrast-dimmer-color);display:flex;flex-direction:column;gap:10px}.bank-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.bank-name[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{font-size:12px;opacity:.7}"]})}return t})();function el$1(t,s){if(t&1){let e=Fw();Pi$5(0,"mat-checkbox",8),Qh("change",function(){let a=ud(e).$implicit,c=qw(2);return dd(c.toggleVesselType(a))}),TT(1),ul$2();}if(t&2){let e=s.$implicit,o=qw(2);Bh("checked",o.isVesselTypeSelected(e)),EE(),gl$2(" ",o.formatVesselTypeLabel(e)," ");}}function tl$1(t,s){if(t&1&&(Pi$5(0,"div",0)(1,"p",1),TT(2,"Categories"),ul$2(),Pi$5(3,"mat-checkbox",2),TT(4,"Anchored/Moored"),ul$2(),cD(),Pi$5(5,"mat-checkbox",3),TT(6,"All AtoN"),ul$2(),cD(),Pi$5(7,"mat-checkbox",4),TT(8,"All but SAR"),ul$2(),cD(),Pi$5(9,"mat-checkbox",5),TT(10,"All Vessels"),ul$2(),cD(),$h(11,"mat-divider",6),Pi$5(12,"p",1),TT(13,"Types of vessels"),ul$2(),xw(14,el$1,2,2,"mat-checkbox",7,Nw),ul$2()),t&2){let e=qw();Bh("formGroup",e.filtersGroup),EE(3),lD(),EE(2),lD(),EE(2),lD(),EE(2),lD(),EE(5),Aw(e.vesselTypeFilters);}}var An$1=(()=>{class t{formGroupName=Hj.required();rootFormGroup=w$4(gn$4);fb=w$4(Hn$4);aisFormGroup=null;filtersGroup=null;vesselTypeFilters=rn$1.filter(e=>e!=="vessel/self"&&e!=="vessel/unknown"&&e!=="vessel/spare");ngOnInit(){if(this.aisFormGroup=this.rootFormGroup.control.get(this.formGroupName()),!this.aisFormGroup){console.warn(`AIS form group "${this.formGroupName()}" not found for target options.`);return}this.filtersGroup=this.ensureFiltersGroup(this.aisFormGroup);}isVesselTypeSelected(e){let o=this.vesselTypesControl();if(!o)return false;let a=o.value;return Array.isArray(a)&&a.includes(e)}toggleVesselType(e){let o=this.vesselTypesControl();if(!o)return;let a=Array.isArray(o.value)?o.value:[],c=new Set(a);c.has(e)?c.delete(e):c.add(e),o.setValue(Array.from(c));}formatVesselTypeLabel(e){let o=e.replace("vessel/","");switch(o){case "pleasurecraft":return "Pleasure Craft";case "highspeed":return "High Speed";case "sar":return "SAR";case "law":return "Law Enforcement";default:return `${o.charAt(0).toUpperCase()}${o.slice(1)}`}}ensureFiltersGroup(e){let o=e.get("filters");if(!o)return o=this.buildDefaultFiltersGroup(),e.addControl("filters",o),o;this.ensureControl(o,"anchoredMoored",false),this.ensureControl(o,"noCollisionRisk",false),this.ensureControl(o,"allAton",false),this.ensureControl(o,"allButSar",false),this.ensureControl(o,"allVessels",false);let a=this.ensureControl(o,"vesselTypes",[]);return Array.isArray(a.value)||a.setValue([]),o}buildDefaultFiltersGroup(){return this.fb.group({anchoredMoored:new Bn$4(false),noCollisionRisk:new Bn$4(false),allAton:new Bn$4(false),allButSar:new Bn$4(false),allVessels:new Bn$4(false),vesselTypes:new Bn$4([])})}ensureControl(e,o,a){let c=e.get(o);return c||(c=new Bn$4(a),e.addControl(o,c)),c}vesselTypesControl(){return this.filtersGroup?.get("vesselTypes")}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["ais-target-options"]],inputs:{formGroupName:[1,"formGroupName"]},decls:1,vars:1,consts:[[1,"vessel-type-grid",3,"formGroup"],[1,"span-all"],["formControlName","anchoredMoored"],["formControlName","allAton"],["formControlName","allButSar"],["formControlName","allVessels"],[1,"span-all","ais-target-divider"],[3,"checked"],[3,"change","checked"]],template:function(o,a){o&1&&_w(0,tl$1,16,1,"div",0),o&2&&Mw(a.filtersGroup?0:-1);},dependencies:[Wn$4,Pn$5,kn$5,gn$4,hn$3,Jn$4,Kt$3,f$2,u$3],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;overflow:hidden}.ais-target-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.vessel-type-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:0px 12px}.span-all[_ngcontent-%COMP%]{grid-column:1/-1}.ais-target-divider[_ngcontent-%COMP%]{margin:4px 0}"]})}return t})();var il$1=(t,s)=>s.key;function ol$1(t,s){if(t&1&&(Pi$5(0,"mat-option",4),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),mg("",e.id," (",e.source,")");}}function nl$1(t,s){t&1&&(Pi$5(0,"div",5),TT(1,"No chargers discovered yet."),ul$2());}function al$1(t,s){if(t&1&&(Pi$5(0,"div",8)(1,"div",9),TT(2),ul$2(),Pi$5(3,"mat-form-field",2)(4,"mat-label"),TT(5,"Array Rated Power (W)"),ul$2(),$h(6,"input",10),cD(),ul$2()()),t&2){let e=s.$implicit;Bh("formGroupName",e),EE(2),gg(e),EE(4),lD();}}function rl$1(t,s){t&1&&(Pi$5(0,"div",5),TT(1,"No groups configured yet."),ul$2());}function ll$1(t,s){if(t&1&&(Pi$5(0,"mat-option",4),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gg(e);}}function sl$1(t,s){if(t&1&&(Pi$5(0,"mat-option",4),TT(1),HT(2,"titlecase"),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gg($T(2,2,e));}}function cl$1(t,s){if(t&1){let e=Fw();Pi$5(0,"div",14)(1,"div",15)(2,"mat-form-field",16)(3,"mat-label"),TT(4,"Group Name"),ul$2(),$h(5,"input",17),cD(),ul$2(),Pi$5(6,"button",18),Qh("click",function(){let a=ud(e).$index,c=qw(2);return dd(c.removeGroup(a))}),Pi$5(7,"mat-icon"),TT(8,"delete"),ul$2()()(),Pi$5(9,"mat-form-field",2)(10,"mat-label"),TT(11,"Group Members"),ul$2(),Pi$5(12,"mat-select",19),xw(13,ll$1,2,2,"mat-option",4,Nw),ul$2(),cD(),ul$2(),Pi$5(15,"mat-form-field",2)(16,"mat-label"),TT(17,"Connection Mode"),ul$2(),Pi$5(18,"mat-select",20),xw(19,sl$1,3,4,"mat-option",4,Nw),ul$2(),cD(),ul$2()();}if(t&2){let e=s.$index,o=qw(2);Bh("formGroupName",e),EE(5),lD(),EE(7),lD(),EE(),Aw(o.discoveredSolarIds()),EE(5),lD(),EE(),Aw(o.connectionModes);}}function dl$1(t,s){if(t&1){let e=Fw();$h(0,"mat-divider"),Pi$5(1,"div",1)(2,"div",11)(3,"h3"),TT(4,"Charger Groups"),ul$2(),Pi$5(5,"button",12),Qh("click",function(){ud(e);let a=qw();return dd(a.addGroup())}),TT(6," Add Group "),ul$2()(),Pi$5(7,"div",13),_w(8,rl$1,2,0,"div",5),xw(9,cl$1,21,1,"div",14,Sw),ul$2()();}if(t&2){let e=qw();EE(8),Mw(e.hasGroups()?-1:8),EE(),Aw(e.groupsFormArray.controls);}}var En$1=(()=>{class t{connectionModes=["parallel","series"];formGroupName=Hj.required();rootFormGroup=w$4(gn$4);discovery=w$4(xt$2);data=w$4(De$2);destroyRef=w$4(xe$3);solarFormGroup;trackedDevicesControl;groupsFormArray;optionsByIdGroup;discoveredSolarIds=vt$9([]);discoveredTrackedDevices=vt$9([]);selectedTrackedDeviceIds=vt$9([]);hasGroups=Dt$9(()=>(this.groupsFormArray?.length??0)>0);supportsGroups=Dt$9(()=>!!this.groupsFormArray);optionIds=Dt$9(()=>{let e=this.selectedTrackedDeviceIds(),o=this.discoveredSolarIds(),a=Object.keys(this.optionsByIdGroup?.controls??{});return e.length?[...new Set([...e,...a.filter(c=>e.includes(c))])].sort():[...new Set([...a,...o])].sort()});discoveryToken;ngOnInit(){this.solarFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.solarFormGroup&&(this.ensureOptionsGroup(),this.ensureTrackedControl(),this.ensureGroupsArray(),this.initializeDiscovery());}ngOnDestroy(){this.discoveryToken&&this.discovery.unregister(this.discoveryToken);}ensureSolarOption(e){this.optionsByIdGroup.get(e)||this.optionsByIdGroup.addControl(e,this.createOptionGroup({arrayRatedPowerW:null}));}compareTrackedDevice(e,o){return !e||!o?e===o:e.key===o.key}ensureTrackedControl(){let e=this.solarFormGroup.get("trackedDevices");if(e instanceof Bn$4){this.trackedDevicesControl=e,this.trackedDevicesControl.setValue(this.normalizeTrackedDeviceArray(this.trackedDevicesControl.value),{emitEvent:false}),this.syncSelectedTrackedDeviceIds(this.trackedDevicesControl.value),this.trackedDevicesControl.valueChanges.pipe(Gp(this.destroyRef)).subscribe(o=>this.syncSelectedTrackedDeviceIds(o));return}this.trackedDevicesControl=new Bn$4([]),this.solarFormGroup.addControl("trackedDevices",this.trackedDevicesControl),this.syncSelectedTrackedDeviceIds(this.trackedDevicesControl.value),this.trackedDevicesControl.valueChanges.pipe(Gp(this.destroyRef)).subscribe(o=>this.syncSelectedTrackedDeviceIds(o));}ensureGroupsArray(){let e=this.solarFormGroup.get("groups")??this.solarFormGroup.get("banks");if(!e)return;if(e instanceof oe$3||e instanceof Un$4){this.groupsFormArray=e,this.solarFormGroup.get("groups")||this.solarFormGroup.setControl("groups",this.groupsFormArray);return}let o=Array.isArray(e?.value)?e.value:[];this.groupsFormArray=new Un$4(o.map(a=>this.createGroup(a))),this.solarFormGroup.setControl("groups",this.groupsFormArray);}ensureOptionsGroup(){let e=this.solarFormGroup.get("optionsById");if(e instanceof Tn$4){this.optionsByIdGroup=e,this.syncOptionControlStates();return}this.optionsByIdGroup=new Tn$4({}),this.solarFormGroup.addControl("optionsById",this.optionsByIdGroup),this.syncOptionControlStates();}addGroup(){if(!this.groupsFormArray)return;let e={id:`solar-bank-${Date.now()}`,name:"New Group",memberIds:[],connectionMode:"parallel"};this.groupsFormArray.push(this.createGroup(e)),this.groupsFormArray.markAsDirty();}removeGroup(e){this.groupsFormArray&&(this.groupsFormArray.removeAt(e),this.groupsFormArray.markAsDirty());}createGroup(e){return new Tn$4({id:new Bn$4(e.id,ve$2.required),name:new Bn$4(e.name,ve$2.required),memberIds:new Bn$4(e.memberIds??[]),connectionMode:new Bn$4(e.connectionMode??"parallel",ve$2.required)})}createOptionGroup(e){return new Tn$4({arrayRatedPowerW:new Bn$4(e.arrayRatedPowerW)})}initializeDiscovery(){this.discoveryToken=this.discovery.register({id:"solar-chargers",patterns:["self.electrical.solar.*"],contextTypes:["self"],pathPrefixes:["electrical.solar."]}),this.updateDiscoveredSolarIds(),this.discovery.changes(this.discoveryToken).pipe(Gp(this.destroyRef)).subscribe(()=>this.updateDiscoveredSolarIds());}updateDiscoveredSolarIds(){if(!this.discoveryToken)return;let e=new Set([...Array.from(this.discovery.activePaths(this.discoveryToken)),...this.data.getCachedPaths(true)]),o=Array.from(e).map(u=>this.extractSolarId(u)).filter(u=>!!u),a=[...new Set(o)].sort(),c=new Map;Array.from(e).forEach(u=>{let v=this.extractSolarId(u);if(!v)return;let M=this.data.getPathObject(u),S=Object.keys(M?.sources??{});c.has(v)||c.set(v,new Set);let T=c.get(v);T&&S.forEach(U=>{let Z=U.trim();Z&&T.add(Z);});});let d=new Map;a.forEach(u=>{let v=c.get(u);(v&&v.size>0?[...v].sort((S,T)=>S.localeCompare(T)):["default"]).forEach(S=>{let T=`${u}||${S}`;d.set(T,{id:u,source:S,key:T});});});for(let u of a)this.ensureSolarOption(u);this.discoveredSolarIds.set(a),this.discoveredTrackedDevices.set([...d.values()].sort((u,v)=>u.key.localeCompare(v.key))),this.syncOptionControlStates();}syncSelectedTrackedDeviceIds(e){let o=[...new Set(this.normalizeTrackedDeviceArray(e).map(a=>a.id))].sort();o.forEach(a=>this.ensureSolarOption(a)),this.selectedTrackedDeviceIds.set(o),this.syncOptionControlStates();}syncOptionControlStates(){if(!this.optionsByIdGroup)return;let e=new Set(this.optionIds());Object.entries(this.optionsByIdGroup.controls).forEach(([o,a])=>{let c=a.get("arrayRatedPowerW");c instanceof Bn$4&&(e.has(o)?(c.setValidators([ve$2.required,ve$2.min(0)]),c.enable({emitEvent:false})):(c.clearValidators(),c.disable({emitEvent:false})),c.updateValueAndValidity({emitEvent:false}));}),this.optionsByIdGroup.updateValueAndValidity({emitEvent:false}),this.solarFormGroup.updateValueAndValidity({emitEvent:false});}extractSolarId(e){let o=e.match(/^self\.electrical\.solar\.([^.]+)(?:\.|$)/);return o?o[1]:null}normalizeTrackedDeviceArray(e){if(!Array.isArray(e))return [];let o=new Map;return e.forEach(a=>{if(typeof a=="string"){let M=a.trim();if(!M)return;let S=`${M}||default`;o.set(S,{id:M,source:"default",key:S});return}if(!a||typeof a!="object")return;let c=a,d=typeof c.id=="string"?c.id.trim():"",u=typeof c.source=="string"?c.source.trim():"default";if(!d||!u)return;let v=typeof c.key=="string"&&c.key.trim().length>0?c.key.trim():`${d}||${u}`;o.set(v,{id:d,source:u,key:v});}),[...o.values()].sort((a,c)=>a.key.localeCompare(c.key))}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["solar-charger-setup"]],inputs:{formGroupName:[1,"formGroupName"]},decls:23,vars:4,consts:[[1,"solar-config",3,"formGroup"],[1,"solar-config-section"],["appearance","outline",1,"full-width"],["formControlName","trackedDevices","multiple","",3,"compareWith"],[3,"value"],[1,"hint"],["formGroupName","optionsById",1,"solar-config-section"],[1,"option-list"],[1,"option-card",3,"formGroupName"],[1,"option-title"],["matInput","","type","number","required","","min","0","formControlName","arrayRatedPowerW","placeholder","e.g. 800"],[1,"section-header"],["mat-stroked-button","","type","button",3,"click"],["formArrayName","groups",1,"bank-list"],[1,"bank-card",3,"formGroupName"],[1,"bank-row"],["appearance","outline",1,"bank-name"],["matInput","","formControlName","name"],["mat-icon-button","","type","button","aria-label","Remove group",3,"click"],["formControlName","memberIds","multiple",""],["formControlName","connectionMode"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"div",1)(2,"h3"),TT(3,"Tracked Solar Chargers"),ul$2(),Pi$5(4,"mat-form-field",2)(5,"mat-label"),TT(6,"Charger Instances"),ul$2(),Pi$5(7,"mat-select",3),xw(8,ol$1,2,3,"mat-option",4,il$1),ul$2(),cD(),ul$2(),Pi$5(10,"div",5),TT(11,"Leave empty to display all discovered chargers."),ul$2()(),$h(12,"mat-divider"),Pi$5(13,"div",6)(14,"h3"),TT(15,"Solar Array Rated Power"),ul$2(),Pi$5(16,"div",5),TT(17,"Set each charger's panel/array rated capacity in watts (W)."),ul$2(),Pi$5(18,"div",7),_w(19,nl$1,2,0,"div",5),xw(20,al$1,7,2,"div",8,Nw),ul$2()(),_w(22,dl$1,11,1),ul$2()),o&2&&(Bh("formGroup",a.solarFormGroup),EE(7),Bh("compareWith",a.compareTrackedDevice),lD(),EE(),Aw(a.discoveredTrackedDevices()),EE(11),Mw(a.optionIds().length?-1:19),EE(),Aw(a.optionIds()),EE(2),Mw(a.supportsGroups()?22:-1));},dependencies:[Wn$4,Xe$5,on$3,Pn$5,kn$5,ft$6,Bt$4,gn$4,hn$3,_t$6,yt$7,ce$4,rt$7,ae$3,ln$4,an$4,Lt$4,Ft$2,F$2,f$2,u$3,Op,xp$1,eu,yt$3,wt$3,Xa$4],styles:["[_nghost-%COMP%]{display:block;width:100%}.solar-config[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;padding:12px 4px}.solar-config-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.full-width[_ngcontent-%COMP%]{width:100%}.option-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.option-card[_ngcontent-%COMP%]{border:1px solid var(--kip-widget-card-border-color);border-radius:12px;padding:12px;background:var(--kip-contrast-dimmer-color);display:flex;flex-direction:column;gap:10px}.option-title[_ngcontent-%COMP%]{font-weight:600;font-size:14px}.hint[_ngcontent-%COMP%]{font-size:12px;opacity:.7}"]})}return t})();var ml$1=(t,s)=>s.key,pl$1=(t,s)=>s.value;function ul$1(t,s){if(t&1&&(Pi$5(0,"mat-option",3),TT(1),ul$2()),t&2){let e=s.$implicit,o=qw();Bh("value",e),EE(),gg(o.isSourceAwareFamily()?e.id+" ("+e.source+")":e.id);}}function fl$1(t,s){t&1&&(Pi$5(0,"div",4),TT(1,"No groups configured."),ul$2());}function gl$1(t,s){if(t&1&&(Pi$5(0,"mat-option",3),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gg(e);}}function hl$1(t,s){if(t&1&&(Pi$5(0,"mat-option",3),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e.value),EE(),gg(e.label);}}function Cl$1(t,s){if(t&1){let e=Fw();Pi$5(0,"div",7)(1,"div",8)(2,"mat-form-field")(3,"mat-label"),TT(4,"Group id"),ul$2(),$h(5,"input",9),cD(),ul$2(),Pi$5(6,"mat-form-field")(7,"mat-label"),TT(8,"Name"),ul$2(),$h(9,"input",10),cD(),ul$2(),Pi$5(10,"mat-form-field")(11,"mat-label"),TT(12,"Connection"),ul$2(),Pi$5(13,"mat-select",11),xw(14,gl$1,2,2,"mat-option",3,Nw),ul$2(),cD(),ul$2(),Pi$5(16,"button",12),Qh("click",function(){let a=ud(e).$index,c=qw(2);return dd(c.removeGroup(a))}),Pi$5(17,"mat-icon"),TT(18,"delete"),ul$2()()(),Pi$5(19,"mat-form-field",1)(20,"mat-label"),TT(21,"Members"),ul$2(),Pi$5(22,"mat-select",13),xw(23,hl$1,2,2,"mat-option",3,pl$1),ul$2(),cD(),ul$2()();}if(t&2){let e=s.$implicit,o=qw(2);Bh("formGroup",e),EE(5),lD(),EE(4),lD(),EE(4),lD(),EE(),Aw(o.connectionModes),EE(8),lD(),EE(),Aw(o.memberOptions());}}function vl$1(t,s){if(t&1){let e=Fw();$h(0,"mat-divider",1),Pi$5(1,"div",5)(2,"h3"),TT(3),ul$2(),Pi$5(4,"button",6),Qh("click",function(){ud(e);let a=qw();return dd(a.addGroup())}),Pi$5(5,"mat-icon"),TT(6,"add"),ul$2(),TT(7," Add group "),ul$2()(),_w(8,fl$1,2,0,"div",4),xw(9,Cl$1,25,1,"div",7,Sw);}if(t&2){let e=qw();EE(3),gl$2("",e.setupLabel()," Groups"),EE(5),Mw(e.hasGroups()?-1:8),EE(),Aw(e.groupsFormArray.controls);}}var ei$2=class t{connectionModes=["parallel","series"];formGroupName=Hj.required();setupLabel=Hj.required();discoveryId=Hj.required();discoveryPattern=Hj.required();familyRegex=Hj.required();pathPrefix=Hj.required();rootFormGroup=w$4(gn$4);discovery=w$4(xt$2);data=w$4(De$2);destroyRef=w$4(xe$3);static SOURCE_AWARE_FAMILIES=new Set(["charger","inverter","alternator","ac"]);familyFormGroup;trackedDevicesControl;groupsFormArray;discoveredIds=vt$9([]);discoveredTrackedDevices=vt$9([]);isSourceAwareFamily=Dt$9(()=>t.SOURCE_AWARE_FAMILIES.has(this.formGroupName().trim()));memberOptions=Dt$9(()=>this.isSourceAwareFamily()?this.discoveredTrackedDevices().map(s=>({value:s.key,label:`${s.id} (${s.source})`})):this.discoveredIds().map(s=>({value:s,label:s})));hasGroups=Dt$9(()=>(this.groupsFormArray?.length??0)>0);supportsGroups=Dt$9(()=>!!this.groupsFormArray);discoveryToken;static FAMILY_CRITERIA={charger:{patterns:["self.electrical.charger*"],pathPrefixes:["electrical.charger"],idRegex:/self\.electrical\.chargers?\.([^.]+)(?:\.|$)/},inverter:{patterns:["self.electrical.inverter*"],pathPrefixes:["electrical.inverter"],idRegex:/self\.electrical\.inverters?\.([^.]+)(?:\.|$)/},alternator:{patterns:["self.electrical.alternator*"],pathPrefixes:["electrical.alternator"],idRegex:/self\.electrical\.alternators?\.([^.]+)(?:\.|$)/},ac:{patterns:["self.electrical.ac*"],pathPrefixes:["electrical.ac."],idRegex:/self\.electrical\.ac\.([^.]+)(?:\.|$)/}};ngOnInit(){this.familyFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.familyFormGroup&&(this.ensureTrackedControl(),this.ensureGroupsArray(),this.initializeDiscovery());}ngOnDestroy(){this.discoveryToken&&this.discovery.unregister(this.discoveryToken);}addGroup(){if(!this.groupsFormArray)return;let e={id:`${this.setupLabel().toLowerCase().replace(/\s+/g,"-")}-group-${Date.now()}`,name:`${this.setupLabel()} Group`,memberIds:[],connectionMode:"parallel"};this.groupsFormArray.push(this.createGroup(e)),this.groupsFormArray.markAsDirty();}removeGroup(s){this.groupsFormArray&&(this.groupsFormArray.removeAt(s),this.groupsFormArray.markAsDirty());}compareTrackedDevice(s,e){return !s&&!e?true:!s||!e?false:s.key===e.key}ensureTrackedControl(){let s=this.familyFormGroup.get("trackedDevices");if(s instanceof Bn$4){this.trackedDevicesControl=s,this.trackedDevicesControl.setValue(this.normalizeTrackedDeviceArray(this.trackedDevicesControl.value),{emitEvent:false});return}this.trackedDevicesControl=new Bn$4([]),this.familyFormGroup.addControl("trackedDevices",this.trackedDevicesControl),this.trackedDevicesControl.setValue(this.normalizeTrackedDeviceArray(this.trackedDevicesControl.value),{emitEvent:false});}ensureGroupsArray(){let s=this.familyFormGroup.get("groups")??this.familyFormGroup.get("banks");if(!s)return;if(s instanceof oe$3||s instanceof Un$4){this.groupsFormArray=s,this.familyFormGroup.get("groups")||this.familyFormGroup.setControl("groups",this.groupsFormArray);return}let e=Array.isArray(s?.value)?s.value:[];this.groupsFormArray=new Un$4(e.map(o=>this.createGroup(o))),this.familyFormGroup.setControl("groups",this.groupsFormArray);}createGroup(s){return new Tn$4({id:new Bn$4(s.id,ve$2.required),name:new Bn$4(s.name,ve$2.required),memberIds:new Bn$4(s.memberIds??[]),connectionMode:new Bn$4(s.connectionMode??"parallel",ve$2.required)})}initializeDiscovery(){let s=this.resolveCriteria();this.discoveryToken=this.discovery.register({id:this.discoveryId(),patterns:s.patterns,contextTypes:["self"],pathPrefixes:s.pathPrefixes}),this.updateDiscoveredIds(),this.discovery.changes(this.discoveryToken).pipe(Gp(this.destroyRef)).subscribe(()=>this.updateDiscoveredIds()),this.isSourceAwareFamily()&&this.data.observePathUpdates().pipe(Gp(this.destroyRef)).subscribe(e=>{e.kind!=="data"||!this.matchesDiscoveryPath(e.fullPath)||this.updateDiscoveredIds();});}matchesDiscoveryPath(s){return s?this.resolveCriteria().idRegex.test(s):false}updateDiscoveredIds(){if(!this.discoveryToken)return;let s=this.resolveCriteria().idRegex,e=new Set([...Array.from(this.discovery.activePaths(this.discoveryToken)),...this.data.getCachedPaths(true)]),o=new Set,a=new Map;Array.from(e).forEach(d=>{let u=s.exec(d),v=u?u[1]:null;if(!v)return;o.add(v),a.has(v)||a.set(v,new Set);let M=this.data.getPathObject(d),S=Object.keys(M?.sources??{}),T=a.get(v);T&&S.forEach(U=>{let Z=U.trim();Z&&T.add(Z);});});let c=[...o].sort((d,u)=>d.localeCompare(u));if(this.discoveredIds.set(c),this.isSourceAwareFamily()){let d=new Map;c.forEach(u=>{let v=a.get(u);(v&&v.size>0?[...v].sort((S,T)=>S.localeCompare(T)):["default"]).forEach(S=>{let T=`${u}||${S}`;d.set(T,{id:u,source:S,key:T});});}),this.discoveredTrackedDevices.set([...d.values()].sort((u,v)=>u.key.localeCompare(v.key)));return}this.discoveredTrackedDevices.set(c.map(d=>({id:d,source:"default",key:`${d}||default`})).sort((d,u)=>d.key.localeCompare(u.key)));}normalizeTrackedDeviceArray(s){if(!Array.isArray(s))return [];let e=new Map;return s.forEach(o=>{if(typeof o=="string"){let v=o.trim();if(!v)return;let M=`${v}||default`;e.set(M,{id:v,source:"default",key:M});return}if(!o||typeof o!="object")return;let a=o,c=typeof a.id=="string"?a.id.trim():"",d=typeof a.source=="string"?a.source.trim():"default";if(!c||!d)return;let u=typeof a.key=="string"&&a.key.trim().length>0?a.key.trim():`${c}||${d}`;e.set(u,{id:c,source:d,key:u});}),[...e.values()].sort((o,a)=>o.key.localeCompare(a.key))}resolveCriteria(){let s=this.formGroupName().trim(),e=t.FAMILY_CRITERIA[s];return e||{patterns:[this.discoveryPattern()],pathPrefixes:[this.pathPrefix()],idRegex:new RegExp(this.familyRegex())}}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=JD({type:t,selectors:[["electrical-family-setup"]],inputs:{formGroupName:[1,"formGroupName"],setupLabel:[1,"setupLabel"],discoveryId:[1,"discoveryId"],discoveryPattern:[1,"discoveryPattern"],familyRegex:[1,"familyRegex"],pathPrefix:[1,"pathPrefix"]},decls:12,vars:6,consts:[[1,"family-setup-grid"],[1,"span-2"],["multiple","",3,"formControl","compareWith"],[3,"value"],[1,"hint","span-2"],[1,"groups-header","span-2"],["mat-stroked-button","","type","button",3,"click"],[1,"group-card","span-2",3,"formGroup"],[1,"group-grid"],["matInput","","formControlName","id"],["matInput","","formControlName","name"],["formControlName","connectionMode"],["mat-icon-button","","type","button","color","warn","aria-label","Remove group",3,"click"],["formControlName","memberIds","multiple",""]],template:function(e,o){e&1&&(Pi$5(0,"div",0)(1,"h3"),TT(2),ul$2(),Pi$5(3,"mat-form-field",1)(4,"mat-label"),TT(5),ul$2(),Pi$5(6,"mat-select",2),xw(7,ul$1,2,2,"mat-option",3,ml$1),ul$2(),cD(),ul$2(),Pi$5(9,"div",4),TT(10),ul$2(),_w(11,vl$1,11,2),ul$2()),e&2&&(EE(2),gl$2("Tracked ",o.setupLabel()),EE(3),gl$2("",o.setupLabel()," Instances"),EE(),Bh("formControl",o.trackedDevicesControl)("compareWith",o.compareTrackedDevice),lD(),EE(),Aw(o.discoveredTrackedDevices()),EE(3),gl$2(" Leave empty to display all discovered ",o.setupLabel().toLowerCase(),". "),EE(),Mw(o.supportsGroups()?11:-1));},dependencies:[Wn$4,Xe$5,Pn$5,kn$5,ln$5,gn$4,hn$3,ce$4,rt$7,ae$3,ln$4,an$4,Lt$4,Ft$2,F$2,f$2,u$3,Op,xp$1,eu,yt$3,wt$3],styles:["[_nghost-%COMP%]{display:block;width:100%}.family-setup-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:12px 4px}.span-2[_ngcontent-%COMP%]{grid-column:span 2}.hint[_ngcontent-%COMP%]{color:var(--kip-contrast-dim-color);font-size:.8rem}.groups-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.groups-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;color:var(--kip-contrast-color);font-size:.95rem}.group-card[_ngcontent-%COMP%]{border:1px solid var(--kip-widget-card-border-color);border-radius:8px;padding:10px;background:var(--kip-widget-card-background-color)}.group-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) auto;gap:8px}"]})};var wn$2=()=>["measuring","capacity"],bl$1=()=>["marineCompass","baseplateCompass"],_l$1=()=>["measuring"];function yl$1(t,s){if(t&1&&$h(0,"config-display-chart-options",5),t&2){let e=qw();Bh("displayName",e.displayNameToControl)("datasetUUID",e.datasetUUIDToControl)("convertUnitTo",e.convertUnitToControl)("showDataPoints",e.showDataPointsToControl)("showAverageData",e.showAverageDataToControl)("trackAgainstAverage",e.trackAgainstAverageToControl)("datasetAverageArray",e.datasetAverageArrayToControl)("showDatasetMinimumValueLine",e.showDatasetMinimumValueLineToControl)("showDatasetMaximumValueLine",e.showDatasetMaximumValueLineToControl)("showDatasetAverageValueLine",e.showDatasetAverageValueLineToControl)("showDatasetAngleAverageValueLine",e.showDatasetAngleAverageValueLineToControl)("startScaleAtZero",e.startScaleAtZeroToControl)("showLabel",e.showLabelToControl)("showTimeScale",e.showTimeScaleToControl)("showYScale",e.showYScaleToControl)("yScaleSuggestedMin",e.yScaleSuggestedMinToControl)("yScaleSuggestedMax",e.yScaleSuggestedMaxToControl)("enableMinMaxScaleLimit",e.enableMinMaxScaleLimitToControl)("yScaleMin",e.yScaleMinToControl)("yScaleMax",e.yScaleMaxToControl)("numDecimal",e.numDecimalToControl)("verticalChart",e.verticalChartToControl)("inverseYAxis",e.inverseYAxisToControl)("color",e.colorToControl);}}function xl$1(t,s){t&1&&$h(0,"select-autopilot",6);}function Sl$1(t,s){t&1&&(Pi$5(0,"mat-form-field",23)(1,"mat-label"),TT(2,"URL"),ul$2(),$h(3,"input",48),cD(),ul$2()),t&2&&(EE(3),lD());}function Ml$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",24),TT(1," Allow pointer events on embedded content. WARNING: this may prevent swipe gestures over the Embed widget or keyboard events, while the focus is in the embed, from triggering normal KIP interactions. "),ul$2(),cD()),t&2&&lD();}function Tl$1(t,s){t&1&&(Pi$5(0,"div",49)(1,"div",50)(2,"mat-form-field",51)(3,"mat-label"),TT(4,"Widget Label"),ul$2(),$h(5,"input",52),cD(),ul$2()(),Pi$5(6,"div",50)(7,"mat-checkbox",53),TT(8," Show Label "),ul$2(),cD(),ul$2()()),t&2&&(EE(5),lD(),EE(2),lD());}function Al$1(t,s){t&1&&(Pi$5(0,"mat-form-field",23)(1,"mat-label"),TT(2,"Widget Label"),ul$2(),$h(3,"input",52),cD(),ul$2()),t&2&&(EE(3),lD());}function El$1(t,s){if(t&1&&_w(0,Tl$1,9,0,"div",49)(1,Al$1,4,0,"mat-form-field",23),t&2){let e=qw(2);Mw((e.widgetConfig==null?null:e.widgetConfig.showLabel)!==void 0?0:1);}}function wl$1(t,s){t&1&&(Pi$5(0,"mat-form-field",54)(1,"mat-label"),TT(2,"Scale Start"),ul$2(),$h(3,"input",55),cD(),ul$2(),Pi$5(4,"mat-form-field",54)(5,"mat-label"),TT(6,"Scale End"),ul$2(),$h(7,"input",56),cD(),ul$2()),t&2&&(EE(3),lD(),EE(4),lD());}function kl$1(t,s){t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Integer Places"),ul$2(),$h(3,"input",57),cD(),ul$2()),t&2&&(EE(3),lD());}function Gl$1(t,s){if(t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Decimal Places"),ul$2(),$h(3,"input",58),cD(),ul$2()),t&2){let e=qw(2);pT(e.widgetConfig.showMiniChart!==void 0?"options-grid-span2":""),EE(3),lD();}}function Dl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",26),TT(1," Show Min recorded value "),ul$2(),cD()),t&2&&lD();}function Pl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",27),TT(1," Show Max recorded value "),ul$2(),cD()),t&2&&lD();}function Il$1(t,s){if(t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Next Dashboard after start"),ul$2(),$h(3,"input",59),cD(),ul$2()),t&2){let e=qw(2);sg("options-grid-span2",!e.widgetConfig.numInt),EE(3),lD();}}function Fl$1(t,s){if(t&1&&(Pi$5(0,"mat-option",62),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e.measure),EE(),gl$2(" ",e.description," ");}}function Ol$1(t,s){if(t&1&&(Pi$5(0,"mat-optgroup",61),xw(1,Fl$1,2,2,"mat-option",62,Sw),ul$2()),t&2){let e=qw().$implicit;Bh("label",e.group),EE(),Aw(e.units);}}function Nl$1(t,s){if(t&1&&_w(0,Ol$1,3,1,"mat-optgroup",61),t&2){let e=s.$implicit,o=qw(3);Mw(!o.widgetConfig.convertUnitToGroup||o.widgetConfig.convertUnitToGroup===""||o.widgetConfig.convertUnitToGroup===e.group?0:-1);}}function Ll$1(t,s){if(t&1&&(Pi$5(0,"mat-form-field",29)(1,"mat-label"),TT(2,"Display Units"),ul$2(),Pi$5(3,"mat-select",60),xw(4,Nl$1,1,1,null,null,Sw),ul$2(),cD(),ul$2()),t&2){let e=qw(2);EE(3),lD(),EE(),Aw(e.unitList.conversions);}}function Vl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",30),TT(1," Enable beeps on count down "),ul$2(),cD()),t&2&&lD();}function Rl$1(t,s){if(t&1&&$h(0,"display-datetime-options",31),t&2){let e=qw(2);Bh("dateFormat",e.dateFormatToControl)("dateTimezone",e.dateTimezoneToControl);}}function Ul$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",32),TT(1," Enable Advanced Compass Mode "),ul$2(),cD()),t&2&&lD();}function Bl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",33),TT(1," Close-hauled Lines "),ul$2(),cD()),t&2&&lD();}function Wl$1(t,s){t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Optimal Close-hauled Angle"),ul$2(),$h(3,"input",63),cD(),ul$2()),t&2&&(EE(3),lD());}function $l$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",34),TT(1," Wind Sectors "),ul$2(),cD()),t&2&&lD();}function ql$1(t,s){t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Sector Duration (sec)"),ul$2(),$h(3,"input",64),cD(),ul$2()),t&2&&(EE(3),lD());}function zl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",35),TT(1," Apparent Wind Speed Value "),ul$2(),cD()),t&2&&lD();}function jl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",36),TT(1," True Wind Speed Value "),ul$2(),cD()),t&2&&lD();}function Kl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",37),TT(1," Course Over Ground "),ul$2(),cD()),t&2&&lD();}function Hl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",38),TT(1," True Wind Angle Indicator "),ul$2(),cD()),t&2&&lD();}function Yl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",39),TT(1," Next Waypoint "),ul$2(),cD()),t&2&&lD();}function Zl$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",40),TT(1," Drift "),ul$2(),cD()),t&2&&lD();}function Jl$1(t,s){t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Minimum Value"),ul$2(),$h(3,"input",65),cD(),ul$2()),t&2&&(EE(3),lD());}function Xl$1(t,s){t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Maximum Value"),ul$2(),$h(3,"input",66),cD(),ul$2()),t&2&&(EE(3),lD());}function Ql$1(t,s){t&1&&(Pi$5(0,"mat-checkbox",41),TT(1," Ignore Zones configuration "),ul$2(),cD()),t&2&&lD();}function es$2(t,s){t&1&&(Pi$5(0,"div",67)(1,"mat-checkbox",68),TT(2," Show Heeling Side Label "),ul$2(),cD(),ul$2(),Pi$5(3,"div",67)(4,"mat-checkbox",69),TT(5," Reverse Angle "),ul$2(),cD(),ul$2()),t&2&&(EE(),lD(),EE(3),lD());}function ts$2(t,s){t&1&&(Pi$5(0,"div",67)(1,"mat-checkbox",72),TT(2," Show Progress Bar "),ul$2(),cD(),ul$2(),Pi$5(3,"div",42)(4,"mat-checkbox",73),TT(5," Show Ticks "),ul$2(),cD(),ul$2()),t&2&&(EE(),lD(),EE(3),lD());}function is$2(t,s){t&1&&(Pi$5(0,"div",67)(1,"mat-checkbox",73),TT(2," Show Ticks "),ul$2(),cD(),ul$2()),t&2&&(EE(),lD());}function os$2(t,s){if(t&1&&(Pi$5(0,"mat-form-field",67)(1,"mat-label"),TT(2,"Highlights Width"),ul$2(),$h(3,"input",70),cD(),ul$2(),Pi$5(4,"div",67)(5,"mat-checkbox",71),TT(6," Show Needle Indicator "),ul$2(),cD(),ul$2(),_w(7,ts$2,6,0)(8,is$2,3,0,"div",67)),t&2){let e=qw(2);EE(3),lD(),EE(2),lD(),EE(2),Mw(e.widgetConfig?.gauge?.type==="ngRadial"?7:8);}}function ns$2(t,s){t&1&&(Pi$5(0,"mat-form-field",42)(1,"mat-label"),TT(2,"Rotation Element"),ul$2(),Pi$5(3,"mat-select",74)(4,"mat-option",75),TT(5,"Dial (Marine Compass)"),ul$2(),Pi$5(6,"mat-option",76),TT(7,"Needle (Base plate compass)"),ul$2()(),cD(),ul$2(),Pi$5(8,"div",67)(9,"mat-checkbox",77),TT(10," Show value box "),ul$2(),cD(),ul$2(),Pi$5(11,"div",67)(12,"mat-checkbox",78),TT(13," Show cardinal degrees "),ul$2(),cD(),ul$2()),t&2&&(EE(3),lD(),EE(6),lD(),EE(3),lD());}function as$2(t,s){t&1&&(Pi$5(0,"mat-form-field",67)(1,"mat-label"),TT(2,"Progress Bar Start Position"),ul$2(),Pi$5(3,"mat-select",81)(4,"mat-option",82),TT(5,"Left"),ul$2(),Pi$5(6,"mat-option",83),TT(7,"Middle"),ul$2(),Pi$5(8,"mat-option",84),TT(9,"Right"),ul$2()(),cD(),ul$2()),t&2&&(EE(3),lD());}function rs$2(t,s){t&1&&(Pi$5(0,"mat-form-field",67)(1,"mat-label"),TT(2,"Progress Bar Start Angle"),ul$2(),$h(3,"input",85),cD(),ul$2()),t&2&&(EE(3),lD());}function ls$2(t,s){if(t&1&&(Pi$5(0,"mat-form-field",67)(1,"mat-label"),TT(2,"Gauge Type"),ul$2(),Pi$5(3,"mat-select",74)(4,"mat-option",79),TT(5,"Measuring"),ul$2(),Pi$5(6,"mat-option",80),TT(7,"Capacity"),ul$2()(),cD(),ul$2(),_w(8,as$2,10,0,"mat-form-field",67),_w(9,rs$2,4,0,"mat-form-field",67)),t&2){let e=qw(3);EE(3),lD(),EE(5),Mw(e.widgetConfig?.gauge?.type==="ngRadial"&&FT(2,_l$1).includes(e.formMaster.value.gauge.subType)?8:-1),EE(),Mw(e.formMaster.value.gauge.subType==="capacity"?9:-1);}}function ss$2(t,s){if(t&1&&_w(0,ns$2,14,0)(1,ls$2,10,3),t&2){let e=qw(2);Mw(FT(1,bl$1).indexOf(e.formMaster.value.gauge.subType)>-1?0:FT(2,wn$2).indexOf(e.formMaster.value.gauge.subType)>-1?1:-1);}}function cs$2(t,s){t&1&&(Pi$5(0,"mat-form-field",42)(1,"mat-label"),TT(2,"Orientation"),ul$2(),Pi$5(3,"mat-select",86)(4,"mat-option",87),TT(5,"Vertical"),ul$2(),Pi$5(6,"mat-option",88),TT(7,"Horizontal"),ul$2()(),cD(),ul$2()),t&2&&(EE(3),lD());}function ds$2(t,s){t&1&&(Pi$5(0,"mat-form-field",42)(1,"mat-label"),TT(2,"Unit Label"),ul$2(),Pi$5(3,"mat-select",89)(4,"mat-option",90),TT(5,"Full Label"),ul$2(),Pi$5(6,"mat-option",91),TT(7,"First Letter Only"),ul$2()(),cD(),ul$2()),t&2&&(EE(3),lD());}function ms$2(t,s){if(t&1&&(Pi$5(0,"mat-option",62),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",AT(e.value)),EE(),gg(e.label);}}function ps$2(t,s){if(t&1&&(Pi$5(0,"mat-form-field",23)(1,"mat-label"),TT(2,"Color"),ul$2(),Pi$5(3,"mat-select",92),xw(4,ms$2,2,3,"mat-option",62,Sw),ul$2(),cD(),ul$2()),t&2){let e=qw(2);EE(3),lD(),EE(),Aw(e.colors);}}function us$2(t,s){t&1&&(Pi$5(0,"mat-form-field",23)(1,"mat-label"),TT(2,"Scale Span"),ul$2(),Pi$5(3,"mat-select",93)(4,"mat-option",94),TT(5,"1 Minute"),ul$2(),Pi$5(6,"mat-option",95),TT(7,"5 Minutes"),ul$2(),Pi$5(8,"mat-option",96),TT(9,"30 Minutes"),ul$2()(),cD(),ul$2(),Pi$5(10,"div",97)(11,"strong"),TT(12,"History API:"),ul$2(),TT(13," Wind Trends can be pre-filled with historical data from the Signal K History API. "),Pi$5(14,"a",98),TT(15,"Learn more"),ul$2()()),t&2&&(EE(3),lD());}function fs$2(t,s){t&1&&(Pi$5(0,"mat-checkbox",43),TT(1," Show Background Graph "),Pi$5(2,"i"),TT(3,"(Too many graphs may affect performance)"),ul$2()(),cD()),t&2&&lD();}function gs$2(t,s){t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Suggested Scale Start"),ul$2(),$h(3,"input",99),cD(),ul$2()),t&2&&(EE(3),lD());}function hs$2(t,s){t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Suggested Scale End"),ul$2(),$h(3,"input",100),cD(),ul$2()),t&2&&(EE(3),lD());}function Cs$2(t,s){t&1&&(Pi$5(0,"mat-checkbox",44),TT(1," Inverse Scale Axis "),ul$2(),cD()),t&2&&lD();}function vs$2(t,s){t&1&&(Pi$5(0,"mat-checkbox",45),TT(1," Vertical Data Graph "),ul$2(),cD()),t&2&&lD();}function bs$2(t,s){t&1&&(Pi$5(0,"mat-checkbox",46),TT(1," Disable background color "),ul$2(),cD()),t&2&&lD();}function _s$2(t,s){if(t&1&&(Pi$5(0,"mat-option",62),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",AT(e.value)),EE(),gg(e.label);}}function ys$2(t,s){if(t&1&&(Pi$5(0,"mat-form-field")(1,"mat-label"),TT(2,"Background Color"),ul$2(),Pi$5(3,"mat-select",101),xw(4,_s$2,2,3,"mat-option",62,Sw),ul$2(),cD(),ul$2()),t&2){let e=qw(2);EE(3),lD(),EE(),Aw(e.colors);}}function xs$2(t,s){t&1&&(pl$2(0,47),Pi$5(1,"mat-form-field")(2,"mat-label"),TT(3,"View Mode"),ul$2(),Pi$5(4,"mat-select",102)(5,"mat-option",103),TT(6,"North Up"),ul$2(),Pi$5(7,"mat-option",104),TT(8,"Course Up"),ul$2()(),cD(),ul$2(),Pi$5(9,"mat-form-field")(10,"mat-label"),TT(11,"Fully Visible Rings Range"),ul$2(),Pi$5(12,"mat-select",105)(13,"mat-option",106),TT(14,"1 miles"),ul$2(),Pi$5(15,"mat-option",107),TT(16,"3 miles"),ul$2(),Pi$5(17,"mat-option",108),TT(18,"6 miles"),ul$2(),Pi$5(19,"mat-option",109),TT(20,"12 miles"),ul$2(),Pi$5(21,"mat-option",110),TT(22,"24 miles"),ul$2(),Pi$5(23,"mat-option",111),TT(24,"48 miles"),ul$2()(),cD(),ul$2(),Pi$5(25,"mat-checkbox",112),TT(26," Plot target COG vector "),ul$2(),cD(),Pi$5(27,"mat-form-field")(28,"mat-label"),TT(29,"COG plot length (minutes)"),ul$2(),$h(30,"input",113),cD(),ul$2(),Pi$5(31,"mat-checkbox",114),TT(32," Show unconfirmed targets "),ul$2(),cD(),Pi$5(33,"mat-checkbox",115),TT(34," Show lost targets "),ul$2(),cD(),Pi$5(35,"mat-checkbox",116),TT(36," Show own ship icon "),ul$2(),cD(),hl$2()),t&2&&(EE(4),lD(),EE(8),lD(),EE(13),lD(),EE(5),lD(),EE(),lD(),EE(2),lD(),EE(2),lD());}function Ss$2(t,s){t&1&&(Pi$5(0,"mat-form-field",67)(1,"mat-label"),TT(2,"Background Style"),ul$2(),Pi$5(3,"mat-select",129)(4,"mat-option",130),TT(5,"Dark Gray"),ul$2(),Pi$5(6,"mat-option",131),TT(7,"Satin Gray"),ul$2(),Pi$5(8,"mat-option",132),TT(9,"Light Gray"),ul$2(),Pi$5(10,"mat-option",133),TT(11,"White"),ul$2(),Pi$5(12,"mat-option",134),TT(13,"Black"),ul$2(),Pi$5(14,"mat-option",135),TT(15,"Beige"),ul$2(),Pi$5(16,"mat-option",136),TT(17,"Brown"),ul$2(),Pi$5(18,"mat-option",137),TT(19,"Red"),ul$2(),Pi$5(20,"mat-option",138),TT(21,"Green"),ul$2(),Pi$5(22,"mat-option",139),TT(23,"Blue"),ul$2(),Pi$5(24,"mat-option",125),TT(25,"Anthracite"),ul$2(),Pi$5(26,"mat-option",140),TT(27,"Mud"),ul$2(),Pi$5(28,"mat-option",141),TT(29,"Punched Sheet"),ul$2(),Pi$5(30,"mat-option",142),TT(31,"Carbon"),ul$2(),Pi$5(32,"mat-option",143),TT(33,"Stainless"),ul$2(),Pi$5(34,"mat-option",144),TT(35,"Brushed Metal"),ul$2(),Pi$5(36,"mat-option",145),TT(37,"Brushed Stainless"),ul$2(),Pi$5(38,"mat-option",146),TT(39,"Turned"),ul$2()(),cD(),ul$2()),t&2&&(EE(3),lD());}function Ms$2(t,s){t&1&&(Pi$5(0,"div",67)(1,"mat-checkbox",147),TT(2," Reverse Pitch Axis "),ul$2(),cD(),ul$2(),Pi$5(3,"div",67)(4,"mat-checkbox",148),TT(5," Reverse Roll Axis "),ul$2(),cD(),ul$2(),Pi$5(6,"div",67)(7,"mat-checkbox",149),TT(8," Show Frame "),ul$2(),cD(),ul$2()),t&2&&(EE(),lD(),EE(3),lD(),EE(3),lD());}function Ts$1(t,s){if(t&1&&(_w(0,Ss$2,40,0,"mat-form-field",67),_w(1,Ms$2,9,0),Pi$5(2,"mat-form-field",67)(3,"mat-label"),TT(4,"Frame Style"),ul$2(),Pi$5(5,"mat-select",117)(6,"mat-option",118),TT(7,"Black Metal"),ul$2(),Pi$5(8,"mat-option",119),TT(9,"Metal"),ul$2(),Pi$5(10,"mat-option",120),TT(11,"Shiny Metal"),ul$2(),Pi$5(12,"mat-option",121),TT(13,"Brass"),ul$2(),Pi$5(14,"mat-option",122),TT(15,"Steel"),ul$2(),Pi$5(16,"mat-option",123),TT(17,"Chrome"),ul$2(),Pi$5(18,"mat-option",124),TT(19,"Gold"),ul$2(),Pi$5(20,"mat-option",125),TT(21,"Anthracite"),ul$2(),Pi$5(22,"mat-option",126),TT(23,"Tilted Gray"),ul$2(),Pi$5(24,"mat-option",127),TT(25,"Tilted Black"),ul$2(),Pi$5(26,"mat-option",128),TT(27,"Glossy Metal"),ul$2()(),cD(),ul$2()),t&2){let e=qw(2);Mw(e.widgetConfig?.gauge?.type!=="horizon"?0:-1),EE(),Mw(e.widgetConfig?.gauge?.type==="horizon"?1:-1),EE(4),lD();}}function As$1(t,s){if(t&1&&(Pi$5(0,"div",7)(1,"div",22),_w(2,Sl$1,4,0,"mat-form-field",23),_w(3,Ml$1,2,0,"mat-checkbox",24),_w(4,El$1,2,1),_w(5,wl$1,8,0),_w(6,kl$1,4,0,"mat-form-field"),_w(7,Gl$1,4,2,"mat-form-field",25),_w(8,Dl$1,2,0,"mat-checkbox",26),_w(9,Pl$1,2,0,"mat-checkbox",27),_w(10,Il$1,4,2,"mat-form-field",28),_w(11,Ll$1,6,0,"mat-form-field",29),_w(12,Vl$1,2,0,"mat-checkbox",30),_w(13,Rl$1,1,2,"display-datetime-options",31),_w(14,Ul$1,2,0,"mat-checkbox",32),_w(15,Bl$1,2,0,"mat-checkbox",33),_w(16,Wl$1,4,0,"mat-form-field"),_w(17,$l$1,2,0,"mat-checkbox",34),_w(18,ql$1,4,0,"mat-form-field"),_w(19,zl$1,2,0,"mat-checkbox",35),_w(20,jl$1,2,0,"mat-checkbox",36),_w(21,Kl$1,2,0,"mat-checkbox",37),_w(22,Hl$1,2,0,"mat-checkbox",38),_w(23,Yl$1,2,0,"mat-checkbox",39),_w(24,Zl$1,2,0,"mat-checkbox",40),_w(25,Jl$1,4,0,"mat-form-field"),_w(26,Xl$1,4,0,"mat-form-field"),_w(27,Ql$1,2,0,"mat-checkbox",41),_w(28,es$2,6,0),_w(29,os$2,9,1),_w(30,ss$2,2,3),_w(31,cs$2,8,0,"mat-form-field",42),_w(32,ds$2,8,0,"mat-form-field",42),_w(33,ps$2,6,0,"mat-form-field",23),_w(34,us$2,16,0),_w(35,fs$2,4,0,"mat-checkbox",43),_w(36,gs$2,4,0,"mat-form-field"),_w(37,hs$2,4,0,"mat-form-field"),_w(38,Cs$2,2,0,"mat-checkbox",44),_w(39,vs$2,2,0,"mat-checkbox",45),_w(40,bs$2,2,0,"mat-checkbox",46),_w(41,ys$2,6,0,"mat-form-field"),_w(42,xs$2,37,0,"ng-container",47),_w(43,Ts$1,28,2),ul$2()()),t&2){let e=qw();EE(2),Mw((e.widgetConfig==null?null:e.widgetConfig.widgetUrl)!==void 0?2:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.allowInput)!==void 0?3:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.displayName)!==void 0?4:-1),EE(),Mw(e.formMaster.get("displayScale")?5:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.numInt)!==void 0?6:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.numDecimal)!==void 0?7:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.showMin)!==void 0?8:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.showMax)!==void 0?9:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.nextDashboard)!==void 0?10:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.convertUnitTo)!==void 0?11:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.playBeeps)!==void 0?12:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.dateFormat)!==void 0?13:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.compassModeEnabled)!==void 0?14:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?15:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?16:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?17:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?18:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.awsEnable)!==void 0?19:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.twsEnable)!==void 0?20:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.courseOverGroundEnable)!==void 0?21:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.twaEnable)!==void 0?22:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.waypointEnable)!==void 0?23:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.driftEnable)!==void 0?24:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.minValue)!==void 0&&!e.formMaster.get("displayScale")?25:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.maxValue)!==void 0&&!e.formMaster.get("displayScale")?26:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.ignoreZones)!==void 0?27:-1),EE(),Mw(e.widgetConfig?.gauge?.type==="angle"?28:-1),EE(),Mw(e.widgetConfig?.gauge?.type==="ngRadial"&&FT(42,wn$2).includes(e.formMaster.value.gauge.subType)||e.widgetConfig?.gauge?.type==="ngLinear"?29:-1),EE(),Mw(e.widgetConfig?.gauge?.type==="ngRadial"?30:-1),EE(),Mw(e.widgetConfig?.gauge?.type==="ngLinear"?31:-1),EE(),Mw(e.widgetConfig?.gauge?.type==="simpleLinear"?32:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.color)!==void 0?33:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.timeScale)!==void 0?34:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.showMiniChart)!==void 0?35:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.yScaleMin)!==void 0?36:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.yScaleMax)!==void 0?37:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.inverseYAxis)!==void 0?38:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.verticalChart)!==void 0?39:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.noBgColor)!==void 0?40:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.bgColor)!==void 0?41:-1),EE(),Mw((e.widgetConfig==null?null:e.widgetConfig.ais)!==void 0?42:-1),EE(),Mw(e.widgetConfig?.gauge?.type==="steel"||e.widgetConfig?.gauge?.type==="horizon"?43:-1);}}function Es$1(t,s){t&1&&(Pi$5(0,"mat-tab",8),$h(1,"ais-target-options",47),ul$2());}function ws$2(t,s){if(t&1&&(Pi$5(0,"span",153),TT(1," error "),ul$2(),TT(2,"\xA0Controls ")),t&2){let e=qw(2);dT(e.formMaster.controls.multiChildCtrls.valid?"display: none":"display: block");}}function ks$2(t,s){if(t&1){let e=Fw();Pi$5(0,"mat-tab",9)(1,"div",150)(2,"div"),xh$1(3,ws$2,3,2,"ng-template",151),ul$2(),Pi$5(4,"boolean-multicontrol-options",152),Qh("addPath",function(a){ud(e);let c=qw();return dd(c.addPathGroup(a))})("updatePath",function(a){ud(e);let c=qw();return dd(c.updatePath(a))})("delPath",function(a){ud(e);let c=qw();return dd(c.deletePath(a))}),ul$2()()();}if(t&2){let e=qw();EE(4),Bh("multiCtrlArray",e.multiChildCtrlsToControl)("zonesOnlyPaths",e.widgetConfig?.zonesOnlyPaths??false);}}function Gs$1(t,s){if(t&1&&(Pi$5(0,"span",153),TT(1," error "),ul$2(),TT(2," \xA0Paths ")),t&2){let e=qw(2);dT(e.formMaster.controls.paths.valid||e.formMaster.controls.paths.disabled?"display: none":"display: block");}}function Ds$1(t,s){if(t&1&&(Pi$5(0,"mat-tab",10)(1,"div",150)(2,"div"),xh$1(3,Gs$1,3,2,"ng-template",151),ul$2(),$h(4,"paths-options",154),ul$2()()),t&2){let e=qw();EE(4),Bh("isArray",e.isPathArray)("enableTimeout",e.enableTimeoutToControl)("dataTimeout",e.dataTimeoutToControl)("filterSelfPaths",e.filterSelfPathsToControl)("addPathEvent",e.addPathEvent)("delPathEvent",e.delPathEvent)("updatePathEvent",e.updatePathEvent);}}function Ps$1(t,s){t&1&&(Pi$5(0,"p")(1,"mat-checkbox",157),TT(2," Digital display "),ul$2(),cD(),ul$2()),t&2&&(EE(),lD());}function Is$1(t,s){t&1&&(Pi$5(0,"mat-form-field",23)(1,"mat-label"),TT(2,"Dial Size"),ul$2(),Pi$5(3,"mat-select",158)(4,"mat-option",159),TT(5,"1/4"),ul$2(),Pi$5(6,"mat-option",160),TT(7,"1/2"),ul$2(),Pi$5(8,"mat-option",161),TT(9,"3/4"),ul$2(),Pi$5(10,"mat-option",90),TT(11,"Full"),ul$2()(),cD(),ul$2()),t&2&&(EE(3),lD());}function Fs$1(t,s){if(t&1&&(Pi$5(0,"mat-tab",11)(1,"div",7)(2,"mat-form-field",23)(3,"mat-label"),TT(4,"Gauge Type"),ul$2(),Pi$5(5,"mat-select",86)(6,"mat-option",155),TT(7,"Linear"),ul$2(),Pi$5(8,"mat-option",156),TT(9,"Radial"),ul$2()(),cD(),ul$2(),_w(10,Ps$1,3,0,"p"),_w(11,Is$1,12,0,"mat-form-field",23),ul$2()()),t&2){let e=qw();EE(5),lD(),EE(5),Mw(e.formMaster.value.gauge.subType==="linear"?10:-1),EE(),Mw(e.formMaster.value.gauge.subType==="radial"?11:-1);}}function Os$1(t,s){t&1&&(Pi$5(0,"p")(1,"mat-checkbox",164),TT(2," Value to send on button push (checked = on, unchecked = off) "),ul$2(),cD(),ul$2()),t&2&&(EE(),lD());}function Ns$1(t,s){if(t&1&&(Pi$5(0,"mat-tab",12)(1,"div",150)(2,"p")(3,"mat-checkbox",162),TT(4," Enable Put Requests "),ul$2(),cD(),ul$2(),Pi$5(5,"p")(6,"mat-checkbox",163),TT(7," Momentary mode (instead of switching between on/off) "),ul$2(),cD(),ul$2(),_w(8,Os$1,3,0,"p"),ul$2()()),t&2){let e=qw();EE(3),lD(),EE(3),lD(),EE(2),Mw(e.formMaster.controls.putMomentary.value?8:-1);}}function Ls$1(t,s){t&1&&$h(0,"span",166);}function Vs$1(t,s){if(t&1&&(_w(0,Ls$1,1,0,"span",166),TT(1," Dataset ")),t&2){let e=qw(2);Mw(e.formMaster.controls.datachartPath.valid?-1:0);}}function Rs$1(t,s){if(t&1&&(Pi$5(0,"mat-tab",13),xh$1(1,Vs$1,2,1,"ng-template",151),$h(2,"config-dataset-chart-options",165),ul$2()),t&2){let e=qw();EE(2),Bh("filterSelfPaths",e.filterSelfPathsToControl)("datachartPath",e.datachartPathControl)("datachartSource",e.datachartSourceControl)("convertUnitTo",e.convertUnitToControl)("timeScale",e.timeScaleControl)("period",e.periodControl);}}function Us$1(t,s){t&1&&(Pi$5(0,"mat-tab",14),$h(1,"bms-bank-setup",167),ul$2());}function Bs$1(t,s){if(t&1&&(Pi$5(0,"span",153),TT(1," error "),ul$2(),TT(2,"\xA0Solar Chargers ")),t&2){let e=qw(2);dT(e.formMaster.controls.solarCharger.valid?"display: none":"display: block");}}function Ws$1(t,s){t&1&&(Pi$5(0,"mat-tab",15)(1,"div",150)(2,"div"),xh$1(3,Bs$1,3,2,"ng-template",151),ul$2(),$h(4,"solar-charger-setup",168),ul$2()());}function $s$1(t,s){t&1&&(Pi$5(0,"mat-tab",16),$h(1,"electrical-family-setup",169),ul$2());}function qs$1(t,s){t&1&&(Pi$5(0,"mat-tab",17),$h(1,"electrical-family-setup",170),ul$2());}function zs$1(t,s){t&1&&(Pi$5(0,"mat-tab",18),$h(1,"electrical-family-setup",171),ul$2());}function js$1(t,s){t&1&&(Pi$5(0,"mat-tab",19),$h(1,"electrical-family-setup",172),ul$2());}var kn$2=(()=>{class t{static KEY_MULTI_CHILD_CTRLS="multiChildCtrls";static KEY_DISPLAY_SCALE="displayScale";static KEY_GAUGE="gauge";static KEY_AUTOPILOT="autopilot";static KEY_PATHS="paths";static KEY_AIS="ais";static KEY_CONVERT_UNIT_TO="convertUnitTo";dialogRef=w$4(O$6);fb=w$4(Hn$4);DatasetStreamService=w$4(K$3);units=w$4(ut$2);app=w$4(N$1);destroyRef=w$4(xe$3);widgetConfig=w$4($e$8);titleDialog="Widget Options";formMaster;availableDataSets=[];unitList={};isPathArray=false;addPathEvent;delPathEvent;updatePathEvent;colors=[];saveDisabled=vt$9(true);ngOnInit(){if(!this.widgetConfig){console.error("Widget configuration data is missing. Closing dialog."),this.dialogRef.close();return}this.availableDataSets=this.DatasetStreamService.list().sort((e,o)=>{let a=e.label||"",c=o.label||"";return a.localeCompare(c,void 0,{sensitivity:"base"})}),this.unitList=this.units.getConversionsForPath(""),this.formMaster=this.generateFormGroups(this.widgetConfig),this.setupWindsteerControlState(),this.formMaster.statusChanges.pipe(Gp(this.destroyRef)).subscribe(()=>this.saveDisabled.set(this.formMaster.invalid)),queueMicrotask(()=>this.saveDisabled.set(this.formMaster.invalid)),this.colors=this.app.configurableThemeColors;}setupWindsteerControlState(){let e=this.formMaster.get("compassModeEnabled"),o=this.formMaster.get("courseOverGroundEnable"),a=this.formMaster.get("waypointEnable"),c=this.formMaster.get("driftEnable");if(!e||!o||!a||!c)return;let d=u=>{if(u===true){o.enable({emitEvent:false}),a.enable({emitEvent:false}),c.enable({emitEvent:false});return}o.disable({emitEvent:false}),a.disable({emitEvent:false}),c.disable({emitEvent:false});};d(e.value),e.valueChanges.pipe(Gp(this.destroyRef)).subscribe(u=>d(u));}isPlainObject(e){return Object.prototype.toString.call(e)==="[object Object]"}generateFormGroups(e,o){let a=this.fb.group({});return Object.keys(e).forEach(c=>{let d=e[c];if(d!==null&&(Array.isArray(d)||this.isPlainObject(d))){if(c===t.KEY_MULTI_CHILD_CTRLS){a.addControl(c,this.fb.array([]));let u=a.get(c);d.forEach(v=>{u.push(this.generateCtrlArray(v));});}else if(c===t.KEY_DISPLAY_SCALE)a.addControl(c,this.generateFormGroups(d,c));else if(c===t.KEY_GAUGE)a.addControl(c,this.generateFormGroups(d,c));else if(c===t.KEY_AUTOPILOT)a.addControl(c,this.generateFormGroups(d,c));else if(c===t.KEY_AIS)a.addControl(c,this.generateFormGroups(d,c));else if(c===t.KEY_PATHS){let u=d;if(this.widgetConfig.multiChildCtrls!==void 0){this.isPathArray=true,a.addControl(c,this.fb.array([]));let v=a.get(c);Object.keys(u).forEach(M=>{let S=u[M];if(S){let T=this.generatePathArray(M,S);S.isPathConfigurable===false&&T.disable(),v.push(T);}});}else {let v=this.fb.group({});Object.keys(u).forEach(M=>{let S=u[M];if(S){let T=this.generateFormGroups(S,M);S.isPathConfigurable===false&&T.disable(),v.addControl(M,T);}}),a.addControl(c,v);}}else Array.isArray(d)?a.addControl(c,new Bn$4(d)):a.addControl(c,this.generateFormGroups(d,c));o===t.KEY_PATHS&&a.addControl(c,this.generateFormGroups(d,c));}else if(o===t.KEY_CONVERT_UNIT_TO){let u=e[c];(u&&u.pathType=="number"||"datasetUUID"in this.widgetConfig)&&a.addControl(c,new Bn$4(d));}else switch(c){case "path":a.addControl(c,new Bn$4(d));break;case "datasetUUID":a.addControl(c,new Bn$4(d,ve$2.required));break;case "dataTimeout":a.addControl(c,new Bn$4(d,ve$2.required));break;default:a.addControl(c,new Bn$4(d));break}}),a}generatePathArray(e,o){let a=new Tn$4({});return Object.keys(o).forEach(c=>{let d=c;a.addControl(c,this.generatePathFields(d,o[d]));}),a}generatePathFields(e,o){let a=new Bn$4(o);switch(e){case "path":a=new Bn$4(o);break;case "source":a=new Bn$4(o,ve$2.required);break;case "sampleTime":a=new Bn$4(o,ve$2.required);break;default:a=new Bn$4(o);break}return a}generateCtrlArray(e){let o=this.fb.group(e);return o.get("ctrlLabel")?.addValidators(ve$2.required),o}addPathGroup(e){this.addPathEvent=e;}updatePath(e){e.forEach(o=>{this.formMaster.get("paths").controls.forEach(c=>{let d=c;d.get("pathID").value==o.pathID&&(d.controls.description.setValue(o.ctrlLabel),d.controls.pathType.setValue(o.isNumeric?"number":"boolean"),this.updatePathEvent=e);});});}deletePath(e){let o=this.formMaster.get("paths"),a=0;o.controls.forEach(d=>{d.get("pathID").value==e.pathID?o.removeAt(a):a++;}),this.formMaster.get("multiChildCtrls").removeAt(e.ctrlIndex),this.delPathEvent=e.pathID,this.formMaster.updateValueAndValidity();}get datachartPathControl(){return this.formMaster.get("datachartPath")}get datachartSourceControl(){return this.formMaster.get("datachartSource")}get convertUnitToControl(){return this.formMaster.get("convertUnitTo")}get timeScaleControl(){return this.formMaster.get("timeScale")}get periodControl(){return this.formMaster.get("period")}get datasetUUIDToControl(){return this.formMaster.get("datasetUUID")}get filterSelfPathsToControl(){return this.formMaster.get("filterSelfPaths")}get dataTimeoutToControl(){return this.formMaster.get("dataTimeout")}get enableTimeoutToControl(){return this.formMaster.get("enableTimeout")}get dateTimezoneToControl(){return this.formMaster.get("dateTimezone")}get yScaleSuggestedMaxToControl(){return this.formMaster.get("yScaleSuggestedMax")}get enableMinMaxScaleLimitToControl(){return this.formMaster.get("enableMinMaxScaleLimit")}get showDatasetMinimumValueLineToControl(){return this.formMaster.get("showDatasetMinimumValueLine")}get showDatasetMaximumValueLineToControl(){return this.formMaster.get("showDatasetMaximumValueLine")}get showDatasetAverageValueLineToControl(){return this.formMaster.get("showDatasetAverageValueLine")}get showDatasetAngleAverageValueLineToControl(){return this.formMaster.get("showDatasetAngleAverageValueLine")}get startScaleAtZeroToControl(){return this.formMaster.get("startScaleAtZero")}get showLabelToControl(){return this.formMaster.get("showLabel")}get showTimeScaleToControl(){return this.formMaster.get("showTimeScale")}get showYScaleToControl(){return this.formMaster.get("showYScale")}get yScaleSuggestedMinToControl(){return this.formMaster.get("yScaleSuggestedMin")}get yScaleMinToControl(){return this.formMaster.get("yScaleMin")}get yScaleMaxToControl(){return this.formMaster.get("yScaleMax")}get datasetAverageArrayToControl(){return this.formMaster.get("datasetAverageArray")}get trackAgainstAverageToControl(){return this.formMaster.get("trackAgainstAverage")}get showDataPointsToControl(){return this.formMaster.get("showDataPoints")}get showAverageDataToControl(){return this.formMaster.get("showAverageData")}get displayNameToControl(){return this.formMaster.get("displayName")}get numDecimalToControl(){return this.formMaster.get("numDecimal")}get verticalChartToControl(){return this.formMaster.get("verticalChart")}get inverseYAxisToControl(){return this.formMaster.get("inverseYAxis")}get colorToControl(){return this.formMaster.get("color")}get dateFormatToControl(){return this.formMaster.get("dateFormat")}get multiChildCtrlsToControl(){return this.formMaster.get("multiChildCtrls")}submitConfig(){let e=this.formMaster.getRawValue();this.normalizeElectricalTrackedDevices(e),this.dialogRef.close(e);}normalizeElectricalTrackedDevices(e){[e.charger,e.inverter,e.alternator,e.ac,e.solarCharger,e.bms].forEach(a=>{if(!a)return;let c=Array.isArray(a.trackedDevices)?a.trackedDevices:[],d=new Map;c.forEach(u=>{if(!u||typeof u!="object")return;let v=u,M=typeof v.id=="string"?v.id.trim():"",S=typeof v.source=="string"?v.source.trim():"default";if(!M||!S)return;let T=typeof v.key=="string"&&v.key.trim().length>0?v.key.trim():`${M}||${S}`;d.set(T,{id:M,source:S,key:T});}),a.trackedDevices=[...d.values()].sort((u,v)=>u.key.localeCompare(v.key));});}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["modal-widget-config"]],decls:27,vars:16,consts:[[3,"ngSubmit","formGroup"],["mat-dialog-title",""],[1,"widget-config-dialog-content"],[1,"tab-group-content"],["label","Display"],[1,"tab-content",3,"displayName","datasetUUID","convertUnitTo","showDataPoints","showAverageData","trackAgainstAverage","datasetAverageArray","showDatasetMinimumValueLine","showDatasetMaximumValueLine","showDatasetAverageValueLine","showDatasetAngleAverageValueLine","startScaleAtZero","showLabel","showTimeScale","showYScale","yScaleSuggestedMin","yScaleSuggestedMax","enableMinMaxScaleLimit","yScaleMin","yScaleMax","numDecimal","verticalChart","inverseYAxis","color"],["formGroupName","autopilot",1,"tab-content"],[1,"display-content","tab-content"],["label","Filter"],["label","Controls"],["label","Paths"],["label","Settings","formGroupName","gauge"],["label","Put Request"],["label","Dataset"],["label","BMS"],["label","Solar Chargers"],["label","Chargers"],["label","Inverters"],["label","Alternators"],["label","AC"],["type","button","mat-dialog-close","","mat-flat-button",""],["mat-flat-button","","type","submit",3,"disabled"],[1,"widget-options-grid"],[1,"options-grid-span2"],["name","allowInput","formControlName","allowInput",1,"options-grid-span2"],[3,"class"],["name","showMin","formControlName","showMin"],["name","showMax","formControlName","showMax"],[3,"options-grid-span2"],[1,"fields"],["name","playBeeps","formControlName","playBeeps"],[1,"options-grid-span2",3,"dateFormat","dateTimezone"],["name","compassModeEnabled","formControlName","compassModeEnabled",1,"fields","options-grid-span2"],["name","laylineEnable","formControlName","laylineEnable",1,"fields"],["name","windSectorEnable","formControlName","windSectorEnable"],["name","awsEnable","formControlName","awsEnable"],["name","twsEnable","formControlName","twsEnable"],["name","courseOverGroundEnable","formControlName","courseOverGroundEnable"],["name","twaEnable","formControlName","twaEnable"],["name","waypointEnable","formControlName","waypointEnable"],["name","driftEnable","formControlName","driftEnable"],["name","ignoreZones","formControlName","ignoreZones"],["formGroupName","gauge",1,"options-grid-span2"],["name","showMiniChart","formControlName","showMiniChart",1,"options-grid-span2"],["name","inverseYAxis","formControlName","inverseYAxis"],["name","verticalChart","formControlName","verticalChart"],["name","noBgColor","formControlName","noBgColor"],["formGroupName","ais"],["type","url","matInput","","placeholder","Enter URL to page/resource","name","widgetUrl","formControlName","widgetUrl"],[1,"flex-container","options-grid-span2"],[1,"panel-group"],[1,"full-width"],["matInput","","placeholder","Enter a label to display","name","displayName","formControlName","displayName"],["name","showLabel","formControlName","showLabel",1,"full-width"],["formGroupName","displayScale","appearance","outline"],["matNativeControl","","type","number","name","lower","formControlName","lower","placeholder","Enter number..."],["matInput","","type","number","name","upper","formControlName","upper","placeholder","Enter number..."],["type","number","min","1","max","5","matInput","","placeholder","Enter or select number...","name","numInt","formControlName","numInt","required",""],["type","number","min","0","max","5","matInput","","placeholder","Enter or select number...","name","numDecimal","formControlName","numDecimal","required",""],["type","number","min","0","max","99","matInput","","placeholder","Enter or select number...","name","nextDashboard","formControlName","nextDashboard"],["placeholder","Select unit","formControlName","convertUnitTo","required",""],[3,"label"],[3,"value"],["type","number","min","10","max","90","matInput","","placeholder","Select angle...","name","laylineAngle","formControlName","laylineAngle"],["type","number","min","1","max","90","matInput","","placeholder","Select or enter duration...","name","windSectorWindowSeconds","formControlName","windSectorWindowSeconds"],["matInput","","type","number","name","minValue","formControlName","minValue","placeholder","Enter or select number..."],["matInput","","type","number","name","maxValue","formControlName","maxValue","placeholder","Enter or select number..."],["formGroupName","gauge"],["name","sideLabel","formControlName","sideLabel"],["name","invertAngle","formControlName","invertAngle"],["type","number","min","0","max","25","matInput","","placeholder","Enter or select number...","name","highlightsWidth","formControlName","highlightsWidth","required",""],["name","enableNeedle","formControlName","enableNeedle"],["name","enableProgressbar","formControlName","enableProgressbar"],["name","enableTicks","formControlName","enableTicks"],["placeholder","Select Gauge Type...","formControlName","subType","name","subType"],["value","marineCompass"],["value","baseplateCompass"],["name","showValueBox","formControlName","showValueBox"],["name","compassUseNumbers","formControlName","compassUseNumbers"],["value","measuring"],["value","capacity"],["placeholder","Select start position...","formControlName","barStartPosition","name","barStartPosition"],["value","left"],["value","middle"],["value","right"],["type","number","min","1","max","360","matInput","","placeholder","Enter or select number...","name","scaleStart","formControlName","scaleStart","required",""],["placeholder","Select type...","formControlName","subType","name","subType"],["value","vertical"],["value","horizontal"],["placeholder","Select label format","formControlName","unitLabelFormat","name","unitLabelFormat"],["value","full"],["value","abr"],["placeholder","Select Color...","formControlName","color","name","color","required",""],["placeholder","Select span duration...","formControlName","timeScale","name","timeScale","required",""],["value","Last Minute"],["value","Last 5 Minutes"],["value","Last 30 Minutes"],[2,"grid-column","1 / -1","font-size","0.9em","color","var(--mat-sys-outline)"],["routerLink","/help",2,"color","var(--kip-blue-color)","cursor","pointer","text-decoration","underline"],["type","number","matInput","","placeholder","Enter or select number...","name","yScaleMin","formControlName","yScaleMin","required",""],["type","number","matInput","","placeholder","Enter or select number...","name","yScaleMax","formControlName","yScaleMax","required",""],["placeholder","Select Color...","formControlName","bgColor","name","bgColor","required",""],["placeholder","Select view mode...","formControlName","viewMode","name","viewMode","required",""],["value","north-up"],["value","course-up"],["placeholder","Select AIS range...","formControlName","rangeIndex","name","rangeIndex","required",""],["value","0"],["value","1"],["value","2"],["value","3"],["value","4"],["value","5"],["name","showCogVectors","formControlName","showCogVectors"],["type","number","min","1","max","120","matInput","","placeholder","Enter or select duration...","name","cogVectorsMinutes","formControlName","cogVectorsMinutes"],["name","showUnconfirmedTargets","formControlName","showUnconfirmedTargets"],["name","showLostTargets","formControlName","showLostTargets"],["name","showSelf","formControlName","showSelf"],["placeholder","Select style...","formControlName","faceColor","name","faceColor"],["value","blackMetal"],["value","metal"],["value","shinyMetal"],["value","brass"],["value","steel"],["value","chrome"],["value","gold"],["value","anthracite"],["value","tiltedGray"],["value","tiltedBlack"],["value","glossyMetal"],["placeholder","Select style...","formControlName","backgroundColor","name","backgroundColor"],["value","darkGray"],["value","satinGray"],["value","lightGray"],["value","white"],["value","black"],["value","beige"],["value","brown"],["value","red"],["value","green"],["value","blue"],["value","mud"],["value","punchedSheet"],["value","carbon"],["value","stainless"],["value","brushedMetal"],["value","brushedStainless"],["value","turned"],["name","invertPitch","formControlName","invertPitch"],["name","invertRoll","formControlName","invertRoll"],["name","noFrameVisible","formControlName","noFrameVisible"],[1,"tab-content"],["mat-tab-label",""],[3,"addPath","updatePath","delPath","multiCtrlArray","zonesOnlyPaths"],[1,"warning","material-icons"],["formGroupName","paths",3,"isArray","enableTimeout","dataTimeout","filterSelfPaths","addPathEvent","delPathEvent","updatePathEvent"],["value","linear"],["value","radial"],["formControlName","digitalMeter","name","digitalMeter"],["placeholder","Select size...","formControlName","radialSize","name","radialSize"],["value","quarter"],["value","half"],["value","three-quarter"],["formControlName","putEnable","name","putEnable"],["formControlName","putMomentary","name","putMomentary"],["formControlName","putMomentaryValue","name","putMomentaryValue"],[3,"filterSelfPaths","datachartPath","datachartSource","convertUnitTo","timeScale","period"],[1,"warning","fa","fa-exclamation-circle"],["formGroupName","bms",1,"tab-content"],["formGroupName","solarCharger",1,"tab-content"],["formGroupName","charger","setupLabel","Charger","discoveryId","electrical-chargers","discoveryPattern","self.electrical.charger*","familyRegex","self\\\\.electrical\\\\.chargers?\\\\.([^.]+)(?:\\\\.|$)","pathPrefix","electrical.charger",1,"tab-content"],["formGroupName","inverter","setupLabel","Inverter","discoveryId","electrical-inverters","discoveryPattern","self.electrical.inverter*","familyRegex","self\\\\.electrical\\\\.inverters?\\\\.([^.]+)(?:\\\\.|$)","pathPrefix","electrical.inverter",1,"tab-content"],["formGroupName","alternator","setupLabel","Alternator","discoveryId","electrical-alternators","discoveryPattern","self.electrical.alternator*","familyRegex","self\\\\.electrical\\\\.alternators?\\\\.([^.]+)(?:\\\\.|$)","pathPrefix","electrical.alternator",1,"tab-content"],["formGroupName","ac","setupLabel","AC","discoveryId","electrical-ac","discoveryPattern","self.electrical.ac*","familyRegex","self\\\\.electrical\\\\.ac\\\\.([^.]+)(?:\\\\.|$)","pathPrefix","electrical.ac.",1,"tab-content"]],template:function(o,a){o&1&&(Pi$5(0,"form",0),Qh("ngSubmit",function(){return a.submitConfig()}),Pi$5(1,"h6",1),TT(2),ul$2(),Pi$5(3,"mat-dialog-content",2)(4,"mat-tab-group",3)(5,"mat-tab",4),_w(6,yl$1,1,24,"config-display-chart-options",5)(7,xl$1,1,0,"select-autopilot",6)(8,As$1,44,43,"div",7),ul$2(),_w(9,Es$1,2,0,"mat-tab",8),_w(10,ks$2,5,2,"mat-tab",9),_w(11,Ds$1,5,7,"mat-tab",10),_w(12,Fs$1,12,2,"mat-tab",11),_w(13,Ns$1,9,1,"mat-tab",12),_w(14,Rs$1,3,6,"mat-tab",13),_w(15,Us$1,2,0,"mat-tab",14),_w(16,Ws$1,5,0,"mat-tab",15),_w(17,$s$1,2,0,"mat-tab",16),_w(18,qs$1,2,0,"mat-tab",17),_w(19,zs$1,2,0,"mat-tab",18),_w(20,js$1,2,0,"mat-tab",19),ul$2()(),$h(21,"mat-divider"),Pi$5(22,"mat-dialog-actions")(23,"button",20),TT(24,"Cancel"),ul$2(),Pi$5(25,"button",21),TT(26," Save "),ul$2()()()),o&2&&(Bh("formGroup",a.formMaster),EE(2),gg(a.titleDialog),EE(4),Mw((a.widgetConfig==null?null:a.widgetConfig.datachartPath)!==void 0?6:a.widgetConfig?.autopilot?7:8),EE(3),Mw((a.widgetConfig==null?null:a.widgetConfig.ais)!==void 0?9:-1),EE(),Mw((a.widgetConfig==null?null:a.widgetConfig.multiChildCtrls)!==void 0?10:-1),EE(),Mw((a.widgetConfig==null?null:a.widgetConfig.paths)!==void 0?11:-1),EE(),Mw(a.widgetConfig?.gauge?.type==="steel"?12:-1),EE(),Mw((a.widgetConfig==null?null:a.widgetConfig.putEnable)!==void 0&&(a.widgetConfig==null?null:a.widgetConfig.multiChildCtrls)===void 0?13:-1),EE(),Mw((a.widgetConfig==null?null:a.widgetConfig.datachartPath)!==void 0?14:-1),EE(),Mw(a.widgetConfig?.bms?15:-1),EE(),Mw(a.widgetConfig?.solarCharger?16:-1),EE(),Mw(a.widgetConfig?.charger?17:-1),EE(),Mw(a.widgetConfig?.inverter?18:-1),EE(),Mw(a.widgetConfig?.alternator?19:-1),EE(),Mw(a.widgetConfig?.ac?20:-1),EE(5),Bh("disabled",a.saveDisabled()));},dependencies:[Ln$3,Gn$4,Xe$5,on$3,Pn$5,kn$5,ft$6,Bt$4,Tt$5,Wn$4,gn$4,hn$3,_t$6,Ht$6,jt$7,Nt$8,zt$6,Vt$6,ce$4,rt$7,ae$3,ln$4,an$4,Fn$4,Ht$3,Nt$5,Sn$5,Jn$4,Kt$3,Lt$4,Ft$2,F$2,pt$8,f$2,u$3,Op,xp$1,xn$2,fn$2,bn$2,un$2,yn$2,Mn$2,An$1,Tn$1,En$1,ei$2],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}.widget-config-dialog-content[_ngcontent-%COMP%]{height:100%}.display-content[_ngcontent-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:10px}.warning[_ngcontent-%COMP%]{color:var(--mat-sys-error-container)}.tab-group-content[_ngcontent-%COMP%]{overflow:hidden;width:100%}.flex-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;margin:15px 0;gap:15px;align-items:stretch}.panel-group[_ngcontent-%COMP%]{min-width:250px;flex-grow:1}"]})}return t})();function Ks$1(t,s){t&1&&(Pi$5(0,"span"),TT(1,", "),ul$2());}function Hs$1(t,s){if(t&1&&(Pi$5(0,"span",8),TT(1),Pi$5(2,"span",9),TT(3),ul$2()(),_w(4,Ks$1,2,0,"span")),t&2){let e=s.$implicit,o=s.$index,a=s.$count,c=qw(2);Bh("ngClass",c.pluginDependencyValid()?e.required?"dependency-required-ok":e.enabled?"dependency-optional-ok":"dependency-optional-missing-met":e.enabled?e.required?"dependency-required-ok":"dependency-optional-ok":e.required?"dependency-required-error":"dependency-optional-error"),Hh("title",e.required?"Required":"Optional"),EE(),mg(" ",e.enabled?"\u2714":"\u2716"," ",e.name," "),EE(2),gg(e.required?"":"(optional)"),EE(),Mw(o!==a-1?4:-1);}}function Ys$1(t,s){if(t&1&&(Pi$5(0,"div",7)(1,"span"),TT(2,"Plugins:"),ul$2(),xw(3,Hs$1,5,6,null,null,Sw),ul$2()),t&2){let e=qw();dT(e.pluginsStatus().length>0?"margin-bottom: 8px;margin-top: 4px;":""),EE(),pT(e.pluginDependencyValid()?"":"dependency-error"),EE(2),Aw(e.pluginsStatus());}}var Gn$1=(()=>{class t{svgIcon=Hj.required();iconSize=Hj.required();name=Hj.required();description=Hj.required();pluginsStatus=Hj.required();pluginDependencyValid=Hj.required();onKeydown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.target.click());}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["widget-list-card"]],hostBindings:function(o,a){o&1&&Qh("keydown",function(d){return a.onKeydown(d)});},inputs:{svgIcon:[1,"svgIcon"],iconSize:[1,"iconSize"],name:[1,"name"],description:[1,"description"],pluginsStatus:[1,"pluginsStatus"],pluginDependencyValid:[1,"pluginDependencyValid"]},decls:9,vars:11,consts:[["role","button","tabindex","0",1,"item-container"],[1,"item-icon"],["aria-hidden","false",3,"svgIcon"],[1,"item-label"],[1,"title","no-text-select"],[1,"dependency","no-text-select",3,"style"],[1,"description","no-text-select"],[1,"dependency","no-text-select"],[3,"ngClass"],[1,"plugin-type-label"]],template:function(o,a){o&1&&(Pi$5(0,"div",0)(1,"div",1),$h(2,"mat-icon",2),ul$2(),Pi$5(3,"div",3)(4,"p",4),TT(5),ul$2(),_w(6,Ys$1,5,4,"div",5),Pi$5(7,"span",6),TT(8),ul$2()()()),o&2&&(Hh("aria-disabled",a.pluginDependencyValid()?null:"true"),EE(2),ig("width",a.iconSize(),"px")("height",a.iconSize(),"px"),Bh("svgIcon",a.svgIcon()),EE(2),dT(a.pluginsStatus().length>0?"margin-bottom:0px; margin-top: 4px":""),EE(),gg(a.name()),EE(),Mw(a.pluginsStatus().length>0?6:-1),EE(2),gg(a.description()));},dependencies:[Qn$4,za$4,yt$3,wt$3],styles:["[_nghost-%COMP%]{display:block;text-align:center;-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer;padding:0}.item-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;width:100%;height:100%;margin:0;padding:15px;border:solid 1px var(--mat-sys-outline);cursor:pointer}.item-container[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-inverse-on-surface)}.item-container[_ngcontent-%COMP%]:focus-visible{background-color:var(--mat-sys-surface-bright);outline:-webkit-focus-ring-color auto 0px}.item-icon[_ngcontent-%COMP%]{width:48px}.item-label[_ngcontent-%COMP%]{width:calc(100% - 48px);text-align:left;padding-left:15px}.title[_ngcontent-%COMP%]{font-size:var(--mat-sys-label-medium-line-height)}.description[_ngcontent-%COMP%]{color:var(--mat-sys-outline)}.dependency[_ngcontent-%COMP%]{color:var(--mat-sys-outline);text-align:start;font-style:italic;font-size:var(--mat-sys-label-large-size)}.dependency-error[_ngcontent-%COMP%]{color:var(--kip-port-color);font-weight:700}.dependency-required-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color);font-weight:700}.dependency-required-error[_ngcontent-%COMP%]{color:var(--kip-port-color);font-weight:700;text-decoration:underline}.dependency-optional-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color)}.dependency-optional-error[_ngcontent-%COMP%]{color:var(--kip-port-color)}.dependency-optional-missing-met[_ngcontent-%COMP%]{color:var(--mat-sys-outline);text-decoration:line-through}.dependency-optional-present-met[_ngcontent-%COMP%]{color:var(--mat-sys-outline)}.plugin-type-label[_ngcontent-%COMP%]{font-size:.8em;margin-left:2px;opacity:.7}.dependency-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color)}.no-text-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}"]})}return t})();var Zs$1=(t,s)=>s.selector;function Js$1(t,s){if(t&1&&(Pi$5(0,"mat-button-toggle",1),TT(1),ul$2()),t&2){let e=s.$implicit;Bh("value",e),EE(),gl$2(" ",e," ");}}function Xs$1(t,s){if(t&1){let e=Fw();Pi$5(0,"widget-list-card",3),Qh("click",function(){let a=ud(e).$implicit,c=qw();return dd(c.onSelectWidget(a))}),ul$2();}if(t&2){let e=s.$implicit;sg("dependency-missing",!e.isDependencyValid),Bh("svgIcon",e.icon)("iconSize",48)("name",e.name)("description",e.description)("pluginDependencyValid",e.isDependencyValid)("pluginsStatus",e.pluginsStatus);}}var Dn$1=(()=>{class t{_dialogRef=w$4(O$6);_widgets=w$4(v);_widgetsList=[];filteredWidgetsList=vt$9([]);_widgetCategory=vt$9("Core");isDependencyValid=vt$9(true);ngOnInit(){this.loadWidgets();}loadWidgets(){return Zr$4(this,null,function*(){this._widgetsList=yield this._widgets.getKipWidgetsWithStatus(),this.filteredWidgetsList.set(this._widgetsList.filter(e=>e.category===this._widgetCategory()));})}onCategoryChange(e){this.filteredWidgetsList.set(this._widgetsList.filter(o=>o.category===e.value)),this._widgetCategory.set(e.value);}onSelectWidget(e){if(!e.isDependencyValid)return;let{name:o,description:a,icon:c,minWidth:d,minHeight:u,defaultWidth:v,defaultHeight:M,category:S,requiredPlugins:T,anyOfPlugins:U,selector:Z,componentClassName:nt}=e,Ze=z$5(G$b({name:o,description:a,icon:c,minWidth:d,minHeight:u,defaultWidth:v,defaultHeight:M,category:S,requiredPlugins:T},U?{anyOfPlugins:U}:{}),{selector:Z,componentClassName:nt});this._dialogRef.close(Ze);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["widgets-list"]],decls:7,vars:1,consts:[["name","widgetCategories","aria-label","Widget categories",1,"list-filter",3,"change","value"],[3,"value"],[3,"dependency-missing","svgIcon","iconSize","name","description","pluginDependencyValid","pluginsStatus"],[3,"click","svgIcon","iconSize","name","description","pluginDependencyValid","pluginsStatus"]],template:function(o,a){o&1&&(Pi$5(0,"div")(1,"mat-button-toggle-group",0),Qh("change",function(d){return a.onCategoryChange(d)}),xw(2,Js$1,2,2,"mat-button-toggle",1,Sw),ul$2(),Pi$5(4,"div"),xw(5,Xs$1,1,8,"widget-list-card",2,Zs$1),ul$2()()),o&2&&(EE(),Bh("value",a._widgetCategory()),EE(),Aw(a._widgets.categories),EE(3),Aw(a.filteredWidgetsList()));},dependencies:[Ot$6,bt$5,nt$9,Gn$1],styles:[".list-filter[_ngcontent-%COMP%]{margin-bottom:20px}.dependency-missing[_ngcontent-%COMP%]{pointer-events:none;opacity:.8;background-color:var(--mat-sys-neutral10)}"]})}return t})();var Pn$2=(()=>{class t{_storage=w$4(Ge$3);_settings=w$4(Gi$3);upgrading=vt$9(false);error=vt$9(null);messages=vt$9([]);legacyFileVersion=9;legacyConfigVersion=10;targetConfigVersion=12;static widgetTypeToSelectorMap={WidgetNumeric:"widget-numeric",WidgetTextGeneric:"widget-text",WidgetDateGeneric:"widget-datetime",WidgetBooleanSwitch:"widget-boolean-switch",WidgetBlank:"widget-blank",WidgetStateComponent:"widget-button",WidgetSimpleLinearComponent:"widget-simple-linear",WidgetGaugeNgLinearComponent:"widget-gauge-ng-linear",WidgetGaugeNgRadialComponent:"widget-gauge-ng-radial",WidgetGaugeNgCompassComponent:"widget-gauge-ng-compass",WidgetGaugeComponent:"widget-gauge-steel",WidgetWindComponent:"widget-wind-steer",WidgetFreeboardskComponent:"widget-freeboardsk",WidgetAutopilotComponent:"widget-autopilot",WidgetDataChart:"widget-data-chart",WidgetRaceTimerComponent:"widget-racetimer",WidgetIframeComponent:"widget-iframe",WidgetTutorial:"widget-tutorial"};runUpgrade(e){return Zr$4(this,null,function*(){if(this.error.set(null),this.upgrading.set(true),this.messages.set([]),e===void 0)try{let o=yield this._storage.listConfigs(this.legacyFileVersion);for(let a of o){let c=yield this.transformConfig(a);if(c)try{yield this._storage.setConfig(c.scope,c.name,c.newConfiguration),yield this._storage.setConfig(c.scope,c.name,c.oldConfiguration,this.legacyFileVersion),this.pushMsg(`[Upgrade] Configuration ${c.scope}/${c.name} upgraded to version ${this.targetConfigVersion}. Old configuration patched to version 0.`);}catch(d){this.pushError(`[Upgrade] Error saving configuration for ${a.name}: ${d.message}`);}}setTimeout(()=>this._settings.reloadApp(),1500);}catch(o){this.pushError("Error fetching configuration data: "+o.message);}else if(e===11&&this._settings.useSharedConfig)try{let o=yield this._storage.listConfigs(11);for(let a of o)try{let c=yield this._storage.getConfig(a.scope,a.name,11),d=dp(c);this.pushMsg(`[Upgrade] Saving configuration backup to file ${a.scope}/${a.name}...`),yield this._storage.setConfig(a.scope,a.name,d,11.99),this.pushMsg(`[Upgrade] ${a.scope}/${a.name} -> v${this.targetConfigVersion}.`);let u=this.upgradeConfig(c);if(!u)continue;this.pushMsg("[Upgrade] Saving upgraded configurations..."),yield this._storage.setConfig(a.scope,a.name,u);}catch(c){this.pushError(`[Upgrade] Error upgrading ${a.scope}/${a.name}: ${c.message}`);}this.pushMsg("[Upgrade] Reloading app to finalize upgrade..."),setTimeout(()=>this._settings.reloadApp(),1500);}catch(o){this.pushError("Error fetching configuration data. Aborting upgrade. Details: "+o.message);}else if(e===11&&!this._settings.useSharedConfig){let o={app:null,dashboards:[],theme:null};o.app=this._settings.getAppConfig(),o.dashboards=this._settings.getDashboardConfig(),o.theme=this._settings.getThemeConfig(),o.app.configVersion=this.targetConfigVersion,this.addSplitShellConfigKeys(o.app);let a=this.extractAppDatasets(o.app);this.upgradeDashboardWidgets(o.dashboards),this.migrateDatasetsToDataCharts(a,o.dashboards),this.migrateUseNeedleToEnableNeedle(o.dashboards),localStorage.setItem("appConfig",JSON.stringify(o.app)),localStorage.setItem("dashboardsConfig",JSON.stringify(o.dashboards)),localStorage.setItem("themeConfig",JSON.stringify(o.theme)),setTimeout(()=>this._settings.reloadApp(),1500),this.upgrading.set(false);}else {let o={};o.app=this._settings.loadConfigFromLocalStorage("appConfig"),o.widget=this._settings.loadConfigFromLocalStorage("widgetConfig"),o.layout=this._settings.loadConfigFromLocalStorage("layoutConfig"),o.theme=this._settings.loadConfigFromLocalStorage("themeConfig");let a=this.transformApp(o.app);if(!a){this.pushError("[Upgrade] Invalid local app configuration. Aborting migration."),this.upgrading.set(false);return}let c=this.extractAppDatasets(a),d=this.transformTheme(o.theme),u=o.layout?.rootSplits||[],v=o.layout?.splitSets||[],M=o.widget?.widgets||[],S=u.map((T,U)=>{let Z=this.extractWidgetsFromSplitSets(v,M,T);return {id:T,name:`Dashboard ${U+1}`,configuration:Z}});this.migrateDatasetsToDataCharts(c,S),this.migrateUseNeedleToEnableNeedle(S),localStorage.setItem("appConfig",JSON.stringify(a)),localStorage.setItem("dashboardsConfig",JSON.stringify(S)),localStorage.setItem("themeConfig",JSON.stringify(d)),setTimeout(()=>this._settings.reloadApp(),1500),this.upgrading.set(false);}})}startFresh(){if(this.error.set(null),this.upgrading.set(true),this._storage.initConfig===null)this._storage.listConfigs(this.legacyFileVersion).then(e=>Zr$4(this,null,function*(){for(let o of e){let a=yield this._storage.getConfig(o.scope,o.name,this.legacyFileVersion);a.app&&(a.app.configVersion=0);try{yield this._storage.setConfig(o.scope,o.name,a,this.legacyFileVersion),this.pushMsg(`[Retired] Configuration ${o.scope}/${o.name} patched to version 0.`);}catch(c){this.pushError(`[Upgrade] Error saving configuration for ${o.name}.`);}}})).catch(e=>this.pushError("Error fetching configuration data: "+e.message)).finally(()=>{this.upgrading.set(false),this._settings.resetSettings();});else {let e={app:null,theme:null};e.app=this._settings.loadConfigFromLocalStorage("appConfig"),e.theme=this._settings.loadConfigFromLocalStorage("themeConfig"),e.app&&(e.app.configVersion=this.targetConfigVersion,e.app.nightModeBrightness=.27),e.theme&&(e.theme.themeName=""),localStorage.setItem("appConfig",JSON.stringify(e.app)),localStorage.setItem("themeConfig",JSON.stringify(e.theme)),localStorage.removeItem("widgetConfig"),localStorage.removeItem("layoutConfig"),this.upgrading.set(false);}}transformConfig(e){return Zr$4(this,null,function*(){let o=yield this._storage.getConfig(e.scope,e.name,this.legacyFileVersion);if(!o.app)return this.pushError(`[Upgrade Service] ${e.scope}/${e.name} is missing app config. Skipping.`),null;if(o.app.configVersion!==this.legacyConfigVersion)return this.pushError(`[Upgrade Service] ${e.scope}/${e.name} is not an upgradable version ${this.legacyConfigVersion} config. Skipping.`),null;let a=this.transformApp(o.app);if(!a)return this.pushError(`[Upgrade Service] ${e.scope}/${e.name} failed to transform app config. Skipping.`),null;let c=this.extractAppDatasets(a),d=this.transformTheme(o.theme),u=o.layout?.rootSplits||[],v=o.layout?.splitSets||[],M=o.widget?.widgets||[],S=u.map((U,Z)=>{let nt=this.extractWidgetsFromSplitSets(v,M,U);return {id:U,name:`Dashboard ${Z+1}`,configuration:nt}});this.migrateDatasetsToDataCharts(c,S),this.migrateUseNeedleToEnableNeedle(S);let T=dp(o);return T.app.configVersion=0,{scope:e.scope,name:e.name,newConfiguration:{app:a,theme:d,dashboards:S},oldConfiguration:T}})}extractAppDatasets(e){if(!e||!Array.isArray(e.dataSets))return [];let o=0,a=[],c=[];e.dataSets.forEach((d,u)=>{(d.editable===true||d.editable===void 0)&&(c.push({period:d.period,datachartPath:d.path,datachartSource:d.pathSource,timeScale:d.timeScaleFormat,datasetUUID:d.uuid}),a.push(u),o++);});for(let d=a.length-1;d>=0;d--)e.dataSets.splice(a[d],1);return o&&this.pushMsg(`[Upgrade] Retired ${o} Dataset(s).`),c}migrateDatasetsToDataCharts(e,o){!Array.isArray(e)||e.length===0||Array.isArray(o)&&o.forEach(a=>{let c=0;a&&Array.isArray(a.configuration)&&(a.configuration.forEach(d=>{let v=d?.input?.widgetProperties?.config;if(d&&typeof d=="object"&&v){let M=e.find(S=>S.datasetUUID===v.datasetUUID);M&&(Object.entries(M).forEach(([S,T])=>{S!=="datasetUUID"&&(v[S]=T);}),delete v.datasetUUID,delete v.timeScaleFormat,c++);}}),c&&this.pushMsg(`[Upgrade] Migrated ${c} Realtime Data Chart widget(s).`));});}transformWidget(e,o){if(e.color==="white"&&(e.color="contrast"),e.textColor){switch(e.textColor){case "text":e.color="contrast";break;case "primary":e.color="blue";break;case "accent":e.color="yellow";break;case "warn":e.color="purple";break;case "nobar":o==="WidgetGaugeNgLinearComponent"&&(e.color="blue",e.gauge=e.gauge||{},e.gauge.useNeedle=false);break;default:e.color=e.textColor;}delete e.textColor;}return e}transformApp(e){if(!e)return null;let o=dp(e);return o.configVersion=this.targetConfigVersion,o.nightModeBrightness=.27,o.splitShellEnabled=false,o.splitShellSide="left",o.splitShellWidth=.2,o.splitShellSwipeDisabled=false,o}transformTheme(e){return e?{themeName:""}:null}upgradeConfig(e){try{if(!e.app)return this.pushError("[Upgrade Service] Missing app config. Skipping..."),null;if(e.app.configVersion!==11)return this.pushError(`[Upgrade Service] Config version ${e.app.configVersion} upgrade is not supported. Skipping...`),null;this.addSplitShellConfigKeys(e.app);let o=this.extractAppDatasets(e.app);this.migrateDatasetsToDataCharts(o,e.dashboards),this.migrateUseNeedleToEnableNeedle(e.dashboards);let a=0,c=0;if(Array.isArray(e.dashboards)){for(let d of e.dashboards)if(d&&Array.isArray(d.configuration)){for(let u of d.configuration)if(u&&typeof u=="object"){u.selector!=="widget-host2"&&(u.selector="widget-host2",a++);let v=S=>{let T=u,U=T[S],Z=typeof U=="string"?Number(U):U;Number.isFinite(Z)&&Z!==0&&(T[S]=Z*2,c++);};v("w"),v("h"),v("x"),v("y");let M=u;if(M.w===void 0||M.w===null){let S=M.minW,T=S||2;M.w=T,c++;}if(M.h===void 0||M.h===null){let S=M.minH,T=S||2;M.h=T,c++;}}}}return a&&this.pushMsg(`[Upgrade] Updated ${a} widget selector(s) to 'widget-host2'.`),c&&this.pushMsg(`[Upgrade] Doubled widget grid metrics for ${c} non-zero (w/h/x/y) entries.`),e.app.configVersion=12,{app:e.app,theme:e.theme,dashboards:e.dashboards}}catch(o){return this.pushError(`[Upgrade Service] Error upgrading ${e}: ${o.message}`),null}}migrateUseNeedleToEnableNeedle(e){if(!Array.isArray(e))return;let o=0;for(let a of e)if(!(!a||!Array.isArray(a.configuration)))for(let c of a.configuration){let v=c.input?.widgetProperties?.config?.gauge;!v||typeof v!="object"||Object.prototype.hasOwnProperty.call(v,"useNeedle")&&(v.enableNeedle===void 0?v.enableNeedle=!!v.useNeedle:v.enableNeedle=!!v.enableNeedle,delete v.useNeedle,o++);}o&&this.pushMsg(`[Upgrade] Renamed gauge.useNeedle -> gauge.enableNeedle on ${o} widget(s).`);}addSplitShellConfigKeys(e){e&&(e.splitShellEnabled===void 0&&(e.splitShellEnabled=false),e.splitShellSide===void 0&&(e.splitShellSide="left"),e.splitShellWidth===void 0&&(e.splitShellWidth=.2),e.splitShellSwipeDisabled===void 0&&(e.splitShellSwipeDisabled=false));}upgradeDashboardWidgets(e){let o=0,a=0;if(Array.isArray(e)){for(let c of e)if(!(!c||!Array.isArray(c.configuration)))for(let d of c.configuration){if(!d||typeof d!="object")continue;d.selector!=="widget-host2"&&(d.selector="widget-host2",o++);let u=M=>{let S=d,T=S[M],U=typeof T=="string"?Number(T):T;Number.isFinite(U)&&U!==0&&(S[M]=U*2,a++);};u("w"),u("h"),u("x"),u("y");let v=d;if(v.w===void 0||v.w===null){let M=v.minW,S=typeof M=="string"?Number(M):M,T=Number.isFinite(S)&&S>0?S:2;v.w=T*2,a++;}if(v.h===void 0||v.h===null){let M=v.minH,S=typeof M=="string"?Number(M):M,T=Number.isFinite(S)&&S>0?S:2;v.h=T*2,a++;}}}o&&this.pushMsg(`[Upgrade] Updated ${o} localStorage widget selector(s) to 'widget-host2'.`),a&&this.pushMsg(`[Upgrade] Doubled grid metrics for ${a} non-zero (w/h/x/y) entries.`);}extractWidgetsFromSplitSets(e,o,a){let c=new Map(o.map(Ze=>[Ze.uuid,Ze])),d=[],u=[],v=0,M=0,S=24,T=24,U=3,Z=3,nt=Ze=>{let _i=e.find(Je=>Je.uuid===Ze);if(!_i){u.push(`Missing splitSet with UUID: ${Ze}`);return}_i.splitAreas.forEach(Je=>{if(Je.type==="widget"){let Re=c.get(Je.uuid);if(Re){if(Re.type==="WidgetBlank")return;if(M+Z>T){u.push(`No space left for widget: ${Re.uuid}`);return}let Nn=t.widgetTypeToSelectorMap[Re.type]||"widget-unknown",Ln=this.transformWidget(Re.config,Re.type);d.push({id:Re.uuid,selector:"widget-host2",input:{widgetProperties:{type:Nn,uuid:Re.uuid,config:Ln}},x:v,y:M,w:U,h:Z}),v+=U,v>=S&&(v=0,M+=Z);}else u.push(`Missing widget with UUID: ${Je.uuid}`);}else Je.type==="splitSet"&&nt(Je.uuid);});};return nt(a),u.length&&this.pushMsg("Transformation Issues: "+u.join("; ")),d}pushMsg(e){this.messages.update(o=>[...o,e]);}pushError(e){this.error.set(e),this.pushMsg(e);}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var In$2=(()=>{class t{dialogRef=w$4(O$6);upgradeSvc=w$4(Pn$2);upgrade(){this.upgradeSvc.runUpgrade(void 0);}startFresh(){this.upgradeSvc.startFresh(),this.dialogRef.close();}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["upgrade-config"]],decls:193,vars:0,consts:[[1,"warning"],[1,"nav-table"],[2,"font-size","x-large"],["href","https://discord.gg/AMDYT2DQga","target","_blank"],[1,"button-group"],["mat-flat-button","",3,"click"],["mat-flat-button","",2,"margin-left","20px",3,"click"]],template:function(o,a){o&1&&(Pi$5(0,"h2"),TT(1,"All New Touch, Mouse, and Keyboard Navigation"),ul$2(),Pi$5(2,"p",0)(3,"strong"),TT(4,"Heads up:"),ul$2(),TT(5," The new version introduces a completely redesigned fullscreen interface with no navigation bar. Please review the input modes table below to get an understanding of the new ways to operate KIP before upgrading. After the upgrade, give yourself time to get comfortable with the changes."),ul$2(),Pi$5(6,"table",1)(7,"thead")(8,"tr")(9,"th"),TT(10,"Actions"),ul$2(),Pi$5(11,"th"),TT(12,"Touch"),ul$2(),Pi$5(13,"th"),TT(14,"Mouse"),ul$2(),Pi$5(15,"th"),TT(16,"Keyboard Shortcuts"),ul$2()()(),Pi$5(17,"tbody")(18,"tr")(19,"td"),TT(20,"Open Actions menu"),ul$2(),Pi$5(21,"td"),TT(22,"Swipe left"),ul$2(),Pi$5(23,"td"),TT(24,"Click, drag left, and release"),ul$2(),Pi$5(25,"td")(26,"kbd"),TT(27,"Shift"),ul$2(),TT(28," + "),Pi$5(29,"kbd"),TT(30,"Ctrl"),ul$2(),TT(31," + "),Pi$5(32,"kbd",2),TT(33,"\u2190"),ul$2(),TT(34," (Left Arrow)"),ul$2()(),Pi$5(35,"tr")(36,"td"),TT(37,"Open Notification menu"),ul$2(),Pi$5(38,"td"),TT(39,"Swipe right"),ul$2(),Pi$5(40,"td"),TT(41,"Click, drag right, and release"),ul$2(),Pi$5(42,"td")(43,"kbd"),TT(44,"Shift"),ul$2(),TT(45," + "),Pi$5(46,"kbd"),TT(47,"Ctrl"),ul$2(),TT(48," + "),Pi$5(49,"kbd",2),TT(50,"\u2192"),ul$2(),TT(51," (Right Arrow)"),ul$2()(),Pi$5(52,"tr")(53,"td"),TT(54,"Cycle through dashboards"),ul$2(),Pi$5(55,"td"),TT(56,"Swipe up/down"),ul$2(),Pi$5(57,"td"),TT(58,"Click, drag up/down, and release"),ul$2(),Pi$5(59,"td")(60,"kbd"),TT(61,"Shift"),ul$2(),TT(62," + "),Pi$5(63,"kbd"),TT(64,"Ctrl"),ul$2(),TT(65," + "),Pi$5(66,"kbd",2),TT(67,"\u2191"),ul$2(),TT(68,"/"),Pi$5(69,"kbd",2),TT(70,"\u2193"),ul$2(),TT(71," (Up/Down Arrow)"),ul$2()(),Pi$5(72,"tr")(73,"td"),TT(74,"Toggle Fullscreen"),ul$2(),Pi$5(75,"td"),TT(76,"N/A"),ul$2(),Pi$5(77,"td"),TT(78,"N/A"),ul$2(),Pi$5(79,"td")(80,"kbd"),TT(81,"Shift"),ul$2(),TT(82," + "),Pi$5(83,"kbd"),TT(84,"Ctrl"),ul$2(),TT(85," + "),Pi$5(86,"kbd"),TT(87,"F"),ul$2()()(),Pi$5(88,"tr")(89,"td"),TT(90,"Toggle Night mode"),ul$2(),Pi$5(91,"td"),TT(92,"N/A"),ul$2(),Pi$5(93,"td"),TT(94,"N/A"),ul$2(),Pi$5(95,"td")(96,"kbd"),TT(97,"Shift"),ul$2(),TT(98," + "),Pi$5(99,"kbd"),TT(100,"Ctrl"),ul$2(),TT(101," + "),Pi$5(102,"kbd"),TT(103,"N"),ul$2()()(),Pi$5(104,"tr")(105,"td"),TT(106,"Toggle dashboard edit mode"),ul$2(),Pi$5(107,"td"),TT(108,"N/A"),ul$2(),Pi$5(109,"td"),TT(110,"N/A"),ul$2(),Pi$5(111,"td")(112,"kbd"),TT(113,"Shift"),ul$2(),TT(114," + "),Pi$5(115,"kbd"),TT(116,"Ctrl"),ul$2(),TT(117," + "),Pi$5(118,"kbd"),TT(119,"E"),ul$2()()()()(),Pi$5(120,"i"),TT(121,"Note that the words Touch and Tap are synonymous with mouse click."),ul$2(),$h(122,"br")(123,"br"),Pi$5(124,"h2"),TT(125,"Migration Limitations"),ul$2(),Pi$5(126,"p")(127,"span",0),TT(128,"Important:"),ul$2(),TT(129," The new widget layout engine is "),Pi$5(130,"strong"),TT(131,"completely different"),ul$2(),TT(132," from the previous version. When you upgrade, your configuration will be migrated, but "),Pi$5(133,"strong"),TT(134,"the way dashboards and widgets are arranged will change significantly"),ul$2(),TT(135,`.
6693
6693
  `),ul$2(),Pi$5(136,"ul")(137,"li"),TT(138,"All KIP configuration settings will be migrated."),ul$2(),Pi$5(139,"li"),TT(140,"Each v2 Page layout will become a v3 Dashboard."),ul$2(),Pi$5(141,"li"),TT(142,"All widgets and their settings will appear in their new dashboards."),ul$2(),Pi$5(143,"li")(144,"span",0)(145,"strong"),TT(146,"Note:"),ul$2(),TT(147," Widget positions, order, and sizes "),Pi$5(148,"strong"),TT(149,"WILL BE LOST"),ul$2(),TT(150,". After upgrading, dashboards will contain small widgets that you must reposition and resize manually."),ul$2()()(),Pi$5(151,"p"),TT(152,"To upgrade your configuration, follow these steps:"),ul$2(),Pi$5(153,"ol")(154,"li"),TT(155," As a safety measure, if you are using Signal K authentication, manually back up your configuration. Make a copy of the "),Pi$5(156,"code"),TT(157,"9.0.0.json"),ul$2(),TT(158," files found on the Signal K server in the following folders: "),Pi$5(159,"ul")(160,"li")(161,"code"),TT(162,"~/.signalk/applicationData/users/(username)/kip/"),ul$2()(),Pi$5(163,"li")(164,"code"),TT(165,"~/.signalk/applicationData/global/kip/"),ul$2()()()(),Pi$5(166,"li"),TT(167,"Click the "),Pi$5(168,"strong"),TT(169,"Upgrade"),ul$2(),TT(170," button below."),ul$2(),Pi$5(171,"li"),TT(172,"Once the upgrade is complete, KIP will restart and display the migrated dashboards."),ul$2(),Pi$5(173,"li"),TT(174,"Reposition and resize your widgets as needed."),ul$2(),Pi$5(175,"li"),TT(176,"Once satisfied, delete the "),Pi$5(177,"code"),TT(178,"9.0.0.json"),ul$2(),TT(179," configuration files located in the previously mentioned folders. They are not needed any more."),ul$2()(),Pi$5(180,"p"),TT(181," For tips and guidance, consult KIP\u2019s in-app "),Pi$5(182,"strong"),TT(183,"Help"),ul$2(),TT(184," section. Most common questions are answered there. If you need support, join the "),Pi$5(185,"a",3),TT(186,"Signal K #kip Discord channel"),ul$2(),TT(187,`.
6694
- `),ul$2(),Pi$5(188,"div",4)(189,"button",5),Qh("click",function(){return a.upgrade()}),TT(190,"Upgrade"),ul$2(),Pi$5(191,"button",6),Qh("click",function(){return a.startFresh()}),TT(192,"Start Fresh"),ul$2()());},dependencies:[Ht$6,Op,xp$1],styles:[".button-group[_ngcontent-%COMP%]{display:flex;justify-content:center}.nav-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;margin-bottom:2em}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .nav-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #bbb;padding:.5em 1em;text-align:center}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#ddd;color:#222;font-weight:700}.nav-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background:#242424}.warning[_ngcontent-%COMP%]{color:#b71c1c}.button-group[_ngcontent-%COMP%]{margin-top:2em;display:flex;gap:20px}"]})}return t})();var Qs$1=(t,s)=>s.id;function ec$1(t,s){if(t&1){let e=Fw();Pi$5(0,"div",2),Qh("click",function(){let a=ud(e).$implicit,c=qw();return dd(c.selectIcon(a.id))})("keydown.enter",function(){let a=ud(e).$implicit,c=qw();return dd(c.selectIcon(a.id))})("keydown.space",function(a){let c=ud(e).$implicit;return qw().selectIcon(c.id),dd(a.preventDefault())}),Pi$5(1,"div",3),$h(2,"mat-icon",4),ul$2()();}if(t&2){let e=s.$implicit,o=qw();sg("selected",o.selected()===e.id),Hh("aria-label","Select "+e.id+" icon"),EE(2),ig("width",64,"px")("height",64,"px"),Bh("svgIcon",e.id);}}var Fn$1=(()=>{class t{iconFile=Hj("assets/svg/icons.svg");currentIcon=Hj(void 0);selectedIcon=Vj();icons=vt$9([]);selected=vt$9("");constructor(){this.loadIcons(),Fa$5(()=>{let e=this.currentIcon();ge$5(()=>{e&&this.selected()!==e&&this.selected.set(e);});});}loadIcons(){return Zr$4(this,null,function*(){try{let o=yield (yield fetch(this.iconFile())).text(),d=new DOMParser().parseFromString(o,"image/svg+xml").querySelector("defs");if(!d)return;let u=d.querySelectorAll("svg"),v=[];u.forEach(S=>{let T=S.getAttribute("id");T&&T.startsWith("dashboard-")&&v.push({id:T});}),this.icons.set(v);let M=this.currentIcon();M&&this.selected.set(M);}catch(e){console.error("Error loading icons:",e);}})}selectIcon(e){this.selected.set(e),this.selectedIcon.emit(e);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["select-icon"]],inputs:{iconFile:[1,"iconFile"],currentIcon:[1,"currentIcon"]},outputs:{selectedIcon:"selectedIcon"},decls:3,vars:0,consts:[[1,"icon-grid"],["tabindex","0",1,"icon-item",3,"selected"],["tabindex","0",1,"icon-item",3,"click","keydown.enter","keydown.space"],[1,"icon-container"],["aria-hidden","false",3,"svgIcon"]],template:function(o,a){o&1&&(Pi$5(0,"div",0),xw(1,ec$1,3,8,"div",1,Qs$1),ul$2()),o&2&&(EE(),Aw(a.icons()));},dependencies:[yt$3,wt$3],styles:[".icon-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(80px,1fr));gap:16px;padding:16px;max-height:400px;overflow-y:auto}.icon-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:8px;border:2px solid transparent;border-radius:8px;cursor:pointer;transition:border-color .2s ease;background-color:var(--mat-sys-surface-container-low)}.icon-item[_ngcontent-%COMP%]:hover{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-item.selected[_ngcontent-%COMP%]{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px;background-color:var(--mat-sys-primary-container)}.icon-item[_ngcontent-%COMP%]:focus{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-container[_ngcontent-%COMP%]{width:64px;height:64px;display:flex;align-items:center;justify-content:center;overflow:hidden}.icon-container[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:100%;height:100%;fill:currentColor}"]})}return t})();function tc$1(t,s){if(t&1&&(Pi$5(0,"button",15),TT(1),ul$2()),t&2){let e=qw(),o=Jw(1);Bh("disabled",!o.valid),EE(),gg(e.data.confirmBtnText);}}var On$1=(()=>{class t{dialogRef=w$4(O$6);data=w$4($e$8);_settings=w$4(Gi$3);isSplitShellEnabled=vt$9(true);constructor(){this.data.icon||(this.data.icon="dashboard-dashboard"),this.isSplitShellEnabled.set(this._settings.getSplitShellEnabled());}save(){this.dialogRef.close(this.data);}onIconSelected(e){this.data.icon=e;}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["dialog-dashboard-page-editor"]],decls:27,vars:10,consts:[["name","ngForm"],["name","name",3,"ngSubmit"],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"field-wrapper","field-margin"],[1,"field-flex"],["matInput","","type","text","id","name","placeholder","Name","name","name","required","","cdkFocusInitial","",3,"ngModelChange","ngModel"],["placeholder","collapseSplitShell","name","collapseSplitShell",1,"field-flex",3,"ngModelChange","ngModel","disabled"],[1,"field-margin","icon-section"],[2,"font-size","1.2em"],[1,"icon-selector"],[3,"selectedIcon","iconFile","currentIcon"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"]],template:function(o,a){if(o&1){let c=Fw();Pi$5(0,"form",1,0),Qh("ngSubmit",function(){return a.save()}),Pi$5(2,"div",2)(3,"h5",3),TT(4),ul$2(),Pi$5(5,"button",4)(6,"mat-icon"),TT(7,"close"),ul$2()()(),Pi$5(8,"mat-dialog-content")(9,"div",5)(10,"mat-form-field",6)(11,"mat-label"),TT(12,"Display Name"),ul$2(),Pi$5(13,"input",7),Eg("ngModelChange",function(u){return ud(c),ST(a.data.name,u)||(a.data.name=u),dd(u)}),ul$2(),cD(),Pi$5(14,"mat-error"),TT(15," A name is required "),ul$2()(),Pi$5(16,"mat-checkbox",8),Eg("ngModelChange",function(u){return ud(c),ST(a.data.collapseSplitShell,u)||(a.data.collapseSplitShell=u),dd(u)}),TT(17," Auto-collapse Freeboard-SK panel when displaying this dashboard. "),ul$2(),cD(),ul$2(),Pi$5(18,"div",9)(19,"span",10),TT(20,"Icon Gallery"),ul$2(),Pi$5(21,"div",11)(22,"select-icon",12),Qh("selectedIcon",function(u){return a.onIconSelected(u)}),ul$2()()()(),Pi$5(23,"mat-dialog-actions",13)(24,"button",14),TT(25),ul$2(),_w(26,tc$1,2,2,"button",15),ul$2()();}o&2&&(EE(4),gg(a.data.title),EE(),Bh("mat-dialog-close",false),EE(8),Ig("ngModel",a.data.name),lD(),EE(3),Ig("ngModel",a.data.collapseSplitShell),Bh("disabled",!a.isSplitShellEnabled()),lD(),EE(6),Bh("iconFile","assets/svg/icons.svg")("currentIcon",a.data.icon),EE(2),Bh("mat-dialog-close",false),EE(),gg(a.data.cancelBtnText),EE(),Mw(a.data.confirmBtnText?26:-1));},dependencies:[Ht$6,jt$7,Nt$8,zt$6,Vt$6,yt$3,wt$3,ce$4,rt$7,ae$3,It$4,ln$4,an$4,Op,xp$1,eu,Ln$3,Gn$4,Xe$5,Pn$5,kn$5,ft$6,rn$3,Qt$6,Fn$1,Jn$4,Kt$3],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.field-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;align-content:center}.field-margin[_ngcontent-%COMP%]{margin-left:15px;margin-bottom:15px}.field-flex[_ngcontent-%COMP%]{flex:auto}.icon-selector[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-outline);border-radius:4px}.icon-section[_ngcontent-%COMP%] .mat-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:var(--mat-sys-on-surface);font-size:14px;font-weight:400}"]})}return t})();var Ff=(()=>{class t{dialog=w$4(ee$7);openFrameDialog(e,o){switch(e.component){case "select-widget":e.componentType=Dn$1;break;case "upgrade-config":e.componentType=In$2;break;case "ais-target":e.componentType=cn$1;break}return this.dialog.open(Ci$3,{data:e,height:o?"calc(100% - 30px)":"",width:o?"calc(100% - 30px)":"",maxWidth:o?"100%":"",maxHeight:o?"100%":""}).afterClosed()}openAisDetailDialog(e){return this.dialog.open(Ci$3,{panelClass:"ais-dialog-panel",data:e,height:"",width:"",maxWidth:"",maxHeight:""}).afterClosed()}openConfirmationDialog(e){return this.dialog.open(dn$2,{data:e,minWidth:"35vw",minHeight:"25vh"}).afterClosed()}openNameDialog(e){return this.dialog.open(mn$2,{data:e,minWidth:"20vw",minHeight:"20vh",disableClose:false})}openDashboardPageEditorDialog(e){return this.dialog.open(On$1,{data:e,minWidth:"60vw",maxWidth:"90vw",maxHeight:"95vh",disableClose:false})}openWidgetOptions(e){return this.dialog.open(kn$2,{data:e.config,minWidth:"50vw",maxWidth:"90vw",closeOnNavigation:true})}openWidgetHistoryDialog(e){return Zr$4(this,null,function*(){let{WidgetHistoryChartDialogComponent:o}=yield import('./chunk-C4FGoLDg.js');return this.dialog.open(o,{data:e,minWidth:"70vw",maxWidth:"95vw",maxHeight:"95vh",disableClose:false})})}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var S=(()=>{class i{dataset=w$4(K$3);syncDataChartDataset(e,t,a){let r=typeof t?.datachartPath=="string"?t.datachartPath.trim():"";if(!r)return;let o=typeof t?.datachartSource=="string"&&t.datachartSource.trim().length>0?t.datachartSource.trim():"default",s=t?.timeScale,h=Number(t?.period??0),f=a??"";this.upsertDataset({uuid:e,path:r,source:o,timeScale:s,period:h,label:f,serialize:true,editable:false});}syncNumericMiniChartDataset(e,t,a){let r=typeof t=="string"?t.trim():"";if(!r)return;let o=typeof a=="string"&&a.trim().length>0?a.trim():"default";this.upsertDataset({uuid:e,path:r,source:o,timeScale:"minute",period:.2,label:`simple-chart-${e}`,serialize:false,editable:false});}syncWindTrendsDatasets(e,t){!t||String(t).trim().length===0||(this.upsertDataset({uuid:`${e}-twd`,path:"self.environment.wind.directionTrue",source:"default",timeScale:t,period:30,label:`windtrends-${e}`,serialize:true,editable:false}),this.upsertDataset({uuid:`${e}-tws`,path:"self.environment.wind.speedTrue",source:"default",timeScale:t,period:30,label:`speedtrends-${e}`,serialize:true,editable:false}));}removeDatasetIfExists(e,t=false){this.dataset.removeIfExists(e,t);}removeOwnedDatasets(e,t=true){let a=typeof e=="string"?e.trim():"";if(!a)return;this.dataset.list().filter(s=>s.uuid===a||s.uuid?.startsWith(`${a}-`)).forEach(s=>{this.dataset.removeIfExists(s.uuid,t);});}upsertDataset(e){let t=this.dataset.getDatasetConfig(e.uuid);if(!t){this.dataset.create(e.path,e.source,e.timeScale,e.period,e.label,e.serialize,e.editable,e.uuid);return}if(!(t.path!==e.path||t.pathSource!==e.source||t.timeScaleFormat!==e.timeScale||t.period!==e.period||t.label!==e.label))return;let r=z$5(G$b({},t),{path:e.path,pathSource:e.source,timeScaleFormat:e.timeScale,period:e.period,label:e.label,editable:e.editable});this.dataset.edit(r,e.serialize);}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Q$6({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var R$4=(()=>{class c{DEFAULT_FONT="Roboto";EDGE_BUFFER=10;debug=false;scaleFactor=window.devicePixelRatio||1;fontsReadyPromise;sharedResizeObserver=null;observedCanvases=new Map;dprMediaQuery=null;resizeCallbacks=new WeakMap;pendingResize=new Map;resizeRafId=null;_fontSizeCache=new Map;static FONT_SIZE_CACHE_LIMIT=600;constructor(){this.fontsReadyPromise=this.createFontsReadyPromise(),this.fontsReadyPromise.then(()=>this._fontSizeCache.clear()).catch(()=>this._fontSizeCache.clear());}getDocumentFonts(){return typeof document<"u"&&"fonts"in document?document.fonts:null}createFontsReadyPromise(){let e=this.getDocumentFonts();return e?e.ready.then(()=>{}):Promise.resolve()}areFontsLoaded(){let e=this.getDocumentFonts();return !e||e.status==="loaded"}registerCanvas(e,t={}){if(t=G$b({autoRelease:true},t),!e)return;e.style.width="100%",e.style.height="100%";let s=t.onResize;if(s){let r=(n,a)=>{n===0||a===0||s(n,a);};this.resizeCallbacks.set(e,r);}this.sharedResizeObserver||(this.debug&&console.log("[CanvasService] Creating shared ResizeObserver for all canvases"),this.sharedResizeObserver=new ResizeObserver(r=>{for(let n of r)this.pendingResize.set(n.target,n.contentRect);this.scheduleResizeFlush();})),this.sharedResizeObserver.observe(e),this.debug&&console.log("[CanvasService] Started observing canvas (shared observer)",{tag:e.tagName,id:e.id,class:e.className,selector:e.getAttribute("ng-reflect-ng-if")||"",parent:e.parentElement?{tag:e.parentElement.tagName,class:e.parentElement.className,id:e.parentElement.id}:null}),this.observedCanvases.set(e,t||{}),this.setHighDPISize(e,e.getBoundingClientRect());let i=this.resizeCallbacks.get(e);if(i){let r=e.getBoundingClientRect();i(Math.round(r.width),Math.round(r.height));}}unregisterCanvas(e){if(!e||!this.observedCanvases.has(e))return;this.sharedResizeObserver&&(this.sharedResizeObserver.unobserve(e),this.observedCanvases.size<=1&&(this.sharedResizeObserver.disconnect(),this.sharedResizeObserver=null,this.debug&&console.log("[CanvasService] Shared ResizeObserver disconnected (no canvases left)"))),this.resizeCallbacks.delete(e),this.observedCanvases.get(e)?.autoRelease&&this.releaseCanvas(e,{clear:true,removeFromDom:true}),this.observedCanvases.delete(e),this.observedCanvases.size===0&&this.cleanupDPRListener();}onDPRChange=()=>{let e=window.devicePixelRatio||1;e!==this.scaleFactor&&(this.scaleFactor=e,this.observedCanvases.forEach((t,s)=>{try{this.setHighDPISize(s,s.getBoundingClientRect());}catch(i){console.warn("[CanvasService] onDPRChange failed for canvas",i);}}),this.cleanupDPRListener(),this.setupDPRListener());};setupDPRListener(){try{this.cleanupDPRListener();let e=`(resolution: ${window.devicePixelRatio||1}dppx)`;this.dprMediaQuery=window.matchMedia(e),this.dprMediaQuery&&((s,i)=>{"addEventListener"in s?s.addEventListener("change",i):"addListener"in s&&s.addListener(i);})(this.dprMediaQuery,this.onDPRChange);}catch(e){console.warn("[CanvasService] setupDPRListener failed",e);}}cleanupDPRListener(){if(this.dprMediaQuery){try{((t,s)=>{"removeEventListener"in t?t.removeEventListener("change",s):"removeListener"in t&&t.removeListener(s);})(this.dprMediaQuery,this.onDPRChange);}catch(e){}this.dprMediaQuery=null;}}scheduleResizeFlush(){this.resizeRafId===null&&(this.resizeRafId=requestAnimationFrame(()=>this.flushResizes()));}flushResizes(){this.resizeRafId=null;let e=8,t=performance.now();for(let[s,i]of this.pendingResize){this.pendingResize.delete(s),this.setHighDPISize(s,i);let r=this.resizeCallbacks.get(s);if(r&&r(Math.round(i.width),Math.round(i.height)),this.pendingResize.size>0&&performance.now()-t>e){this.scheduleResizeFlush();return}}}setHighDPISize(e,t){let s=Math.round(t.width),i=Math.round(t.height),r=Math.round(s*this.scaleFactor),n=Math.round(i*this.scaleFactor);if(!(e.width===r&&e.height===n)){e.width=r,e.height=n,e.style.width=`${s}px`,e.style.height=`${i}px`;try{let a=e.getContext("2d");a&&(a.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),a.clearRect(0,0,e.width,e.height));}catch(a){console.warn("[CanvasService] setHighDPISize: failed to set context transform",a);}}}drawTitle(e,t,s,i="normal",r,n,a=.1){if(!e)return;let o=()=>{let h=false;try{let l=e;if(typeof l.getTransform=="function"){let d=l.getTransform(),f=d&&d.a?d.a:1;Math.abs(f-this.scaleFactor)>1e-6&&(e.save(),e.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),h=!0);}else try{e.save(),e.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),h=!0;}catch(d){}this.drawTitleInternal(e,t,s,i,r,n,a),h&&e.restore();}catch(l){console.warn("[CanvasService] drawTitle failed",l);try{this.drawTitleInternal(e,t,s,i,r,n,a);}catch(d){}}};this.areFontsLoaded()?this.fontsReadyPromise.then(()=>requestAnimationFrame(o)).catch(()=>requestAnimationFrame(o)):this.fontsReadyPromise.then(()=>requestAnimationFrame(o)).catch(h=>{console.warn(`[CanvasService] Font readiness failed: ${h}`),requestAnimationFrame(o);});}drawTitleInternal(e,t,s,i="normal",r,n,a){if(!e)return;let o=r-2*this.EDGE_BUFFER,h=Math.round(n*a),l=this.calculateOptimalFontSize(e,t,o,h,i);e.clearRect(0,0,r,n),e.font=`${i} ${l}px ${this.DEFAULT_FONT}`,e.fillStyle=s,e.textAlign="left",e.textBaseline="top",e.fillText(t,this.EDGE_BUFFER,this.EDGE_BUFFER,o);}clearCanvas(e,t,s){e.clearRect(0,0,t,s);}drawText(e,t,s=this.EDGE_BUFFER,i=this.EDGE_BUFFER,r,n,a="normal",o="#000",h="center",l="middle"){if(!e)return;let d=()=>{try{e.save(),e.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),this.drawTextInternal(e,t,s,i,r,n,a,o,h,l);}finally{try{e.restore();}catch(f){}}};this.areFontsLoaded()?d():this.fontsReadyPromise.then(d).catch(f=>{console.warn(`[Canvas Service] Font readiness failed: ${f}`),d();});}drawTextInternal(e,t,s=this.EDGE_BUFFER,i=this.EDGE_BUFFER,r,n,a="normal",o="#000",h="center",l="middle"){let d=this.calculateOptimalFontSize(e,t,r,n,a);e.font=`${a} ${d}px ${this.DEFAULT_FONT}`,e.fillStyle=o,e.textAlign=h,e.textBaseline=l,e.fillText(t,s,i,r);}calculateOptimalFontSize(e,t,s,i,r="normal"){let n=`${r}|${Math.round(s)}|${Math.round(i)}|${t}`,a=this._fontSizeCache.get(n);if(a!==void 0)return a;let o=1,h=i,l=h;for(;o<=h;)l=Math.round((o+h)/2),e.font=`${r} ${l}px ${this.DEFAULT_FONT}`,e.measureText(t).width>s?h=l-1:o=l+1;return this._fontSizeCache.size>=c.FONT_SIZE_CACHE_LIMIT&&this._fontSizeCache.clear(),this._fontSizeCache.set(n,h),h}createTitleBitmap(e,t,s,i,r,n=.1){let a=document.createElement("canvas");a.width=Math.round(i*this.scaleFactor),a.height=Math.round(r*this.scaleFactor),a.style.width=`${i}px`,a.style.height=`${r}px`;let o=a.getContext("2d");return o&&(o.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),this.drawTitleInternal(o,e,t,s,i,r,n),this.areFontsLoaded()||this.fontsReadyPromise.then(()=>{try{o.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),this.drawTitleInternal(o,e,t,s,i,r,n);}catch(h){}}).catch(()=>{})),a}renderStaticToBitmap(e,t,s,i){let r=document.createElement("canvas");r.width=t*this.scaleFactor,r.height=s*this.scaleFactor;let n=r.getContext("2d");return n&&(n.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),i(n)),r}drawRectangle(e,t,s,i,r,n){e.fillStyle=n,e.fillRect(t,s,i,r);}releaseCanvas(e,t={removeFromDom:true,clear:true}){if(!e)return;let{removeFromDom:s=true,clear:i=true}=t;try{let r=e.getContext("2d");i&&r&&r.clearRect(0,0,e.width,e.height),e.width=0,e.height=0,s&&e.parentNode&&e.parentNode.removeChild(e);}catch(r){console.warn("[CanvasService] releaseCanvas failed",r);}}releaseCanvases(e,t){e.forEach(s=>this.releaseCanvas(s,t));}static \u0275fac=function(t){return new(t||c)};static \u0275prov=Q$6({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})();var u$1=["canvas"],x$2=(()=>{class i{text=Hj.required();color=Hj.required();canvasRef=$j.required("canvas");canvas=w$4(R$4);canvasElement=null;canvasCtx=null;isReady=false;cssWidth=0;cssHeight=0;constructor(){}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvasCtx&&(this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,this.drawTitle();}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.isReady=true,this.drawTitle());}ngOnChanges(t){(t.text||t.color)&&this.drawTitle();}drawTitle(){!this.isReady||!this.canvasCtx||this.canvas.drawTitle(this.canvasCtx,this.text(),this.color(),"normal",this.cssWidth,this.cssHeight);}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement);}catch(t){}this.canvasCtx=null,this.canvasElement=null;}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=JD({type:i,selectors:[["widget-title"]],viewQuery:function(e,s){e&1&&eg(s.canvasRef,u$1,5),e&2&&Kw();},inputs:{text:[1,"text"],color:[1,"color"]},features:[lv],decls:3,vars:0,consts:[["canvas",""],[1,"title-wrapper"],[1,"title-canvas"]],template:function(e,s){e&1&&(dl$2(0,"div",1),Uh(1,"canvas",2,0),fl$2());},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;z-index:10}.title-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.title-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}"]})}return i})();function K$1(e,C){if(e&1&&(Pi$5(0,"mat-icon",1),TT(1),ul$2()),e&2){let t=qw();EE(),gg(t.icon());}}function L$1(e,C){if(e&1&&(Pi$5(0,"div",3),TT(1),ul$2()),e&2){let t=qw();EE(),gg(t.title());}}function $$1(e,C){if(e&1){let t=Fw();Pi$5(0,"div",5)(1,"button",7),Qh("click",function(){ud(t);let n=qw();return dd(n.onActionClick())}),TT(2),ul$2(),Pi$5(3,"button",7),Qh("click",function(){ud(t);let n=qw();return dd(n.dismiss())}),TT(4,"Cancel"),ul$2()();}if(e&2){let t=qw();EE(2),gg(t.data.action);}}function q(e,C){if(e&1){let t=Fw();Pi$5(0,"div",6)(1,"button",8),Qh("click",function(){ud(t);let n=qw();return dd(n.dismiss())}),Pi$5(2,"mat-icon"),TT(3,"close"),ul$2()()();}}var x$1=(()=>{class e{ref=w$4(P$4);data=w$4(Ye$3);severity=Dt$9(()=>this.data.severity??"message");hasAction=Dt$9(()=>!!this.data.action);title=Dt$9(()=>this.data.title??this.titleForSeverity(this.severity()));icon=Dt$9(()=>this.iconForSeverity(this.severity()));hostClass=Dt$9(()=>`toast-${this.severity()}`);onActionClick(){this.ref.dismissWithAction();}dismiss(){this.ref.dismiss();}titleForSeverity(t){switch(t){case "success":return "Success";case "warn":return "Warning";case "error":return "Error";case "info":return "Info";default:return "Message"}}iconForSeverity(t){switch(t){case "success":return "check";case "warn":return "warning";case "error":return "error";case "info":return "info";default:return "message"}}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=JD({type:e,selectors:[["toast-snackbar"]],hostVars:2,hostBindings:function(o,n){o&2&&pT(n.hostClass());},decls:8,vars:6,consts:[[1,"toast"],[1,"icon"],[1,"toast-body"],[1,"toast-title"],["matSnackBarLabel",""],[1,"button-group"],["matSnackBarActions","",1,"toast-body"],["matButton","tonal","matSnackBarAction","",3,"click"],["matIconButton","","matSnackBarAction","","aria-label","Dismiss notification",1,"toast-close",3,"click"]],template:function(o,n){o&1&&(Pi$5(0,"section",0),_w(1,K$1,2,1,"mat-icon",1),Pi$5(2,"div",2),_w(3,L$1,2,1,"div",3),Pi$5(4,"div",4),TT(5),ul$2(),_w(6,$$1,5,1,"div",5),ul$2(),_w(7,q,4,0,"div",6),ul$2()),o&2&&(Hh("data-severity",n.severity()),EE(),Mw(n.severity()!=="message"?1:-1),EE(2),Mw(n.severity()!=="message"?3:-1),EE(2),gg(n.data.message),EE(),Mw(n.hasAction()?6:-1),EE(),Mw(n.hasAction()?-1:7));},dependencies:[Op,xp$1,eu,yt$3,wt$3],styles:["[_nghost-%COMP%]{display:block;width:100%}.toast[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:flex-start;gap:10px}.toast[data-severity=message][_ngcontent-%COMP%]{align-items:center}.toast[data-severity=info][_ngcontent-%COMP%]{--toast-color: var(--mat-sys-inverse-primary)}.toast[data-severity=warn][_ngcontent-%COMP%]{--toast-color: var(--mat-sys-tertiary)}.toast[data-severity=error][_ngcontent-%COMP%]{--toast-color: var(--mat-sys-error-container)}.toast[data-severity=success][_ngcontent-%COMP%]{--toast-color: var(--kip-starboard-color)}.toast[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{display:inline-flex;width:36px;height:36px;font-size:36px;flex:0 0 auto;align-items:center;justify-content:center;--mat-icon-color: var(--toast-color)}.toast-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;gap:2px;flex:1 1 auto;min-width:0}.toast-title[_ngcontent-%COMP%]{font-weight:600;font-size:15px}.button-group[_ngcontent-%COMP%]{margin-top:10px;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-end;gap:8px}.toast-action[_ngcontent-%COMP%]{--mat-button-text-label-text-color: var(--mat-sys-primary)}.toast-close[_ngcontent-%COMP%]{align-self:flex-end;--mat-icon-button-icon-color: var(--mat-sys-inverse-on-surface);--mat-icon-button-icon-size: 32px}.toast-close[_ngcontent-%COMP%] icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}"]})}return e})();var lt$3=(()=>{class e{snackBar=w$4(et$4);app=w$4(Gi$3);soundDisabled=Wp(this.app.getNotificationServiceConfigAsO().pipe(ke$3(t=>t.sound.disableSound)),{initialValue:this.app.getNotificationConfig().sound.disableSound});toastAudio=null;audioBlockedNotificationShown=false;lastSnack=vt$9(null);show(t,o=1500,n=true,b="message",h){let z={message:t,duration:o,silent:n,action:h,severity:b},R={message:t,action:h,severity:b},k=this.snackBar.openFromComponent(x$1,{duration:o,verticalPosition:"top",data:R});return this.lastSnack.set(z),n||this.soundDisabled()||(this.toastAudio||(this.toastAudio=new Audio("assets/notification.mp3"),this.toastAudio.preload="auto",this.toastAudio.volume=.3),this.toastAudio.currentTime=0,this.toastAudio.play().catch(W=>{console.debug("Toast audio playback blocked:",W.message),this.audioBlockedNotificationShown||(this.audioBlockedNotificationShown=true,this.snackBar.openFromComponent(x$1,{duration:0,verticalPosition:"top",data:{message:"Sound notifications blocked by browser. Closing this message will enable audio.",severity:"warn"}}).afterDismissed().subscribe(()=>{this.audioBlockedNotificationShown=false;}));})),k}static \u0275fac=function(o){return new(o||e)};static \u0275prov=Q$6({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var k=[{id:"",name:"Dashboard 1",icon:"dashboard-dashboard",configuration:[{w:24,h:24,id:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc",selector:"widget-host2",input:{widgetProperties:{type:"widget-tutorial",uuid:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc"}},x:0,y:0}],collapseSplitShell:false}];var G$2=(()=>{class n{_settings=w$4(Gi$3);_router=w$4(G$3);_destroyRef=w$4(xe$3);dashboards=vt$9([],{equal:ln$3});activeDashboard=vt$9(null);_widgetAction=new Bn$5(null);widgetAction$=this._widgetAction.asObservable();isDashboardStatic=vt$9(true);widgetClipboard=vt$9(null);layoutEditSaved=vt$9(0);layoutEditCanceled=vt$9(0);constructor(){let t=this._settings.getDashboardConfig();if(!t||t.length===0){console.warn("[Dashboard Service] No dashboards found in settings, creating blank dashboard");let e=k.map(i=>z$5(G$b({},i),{id:b.create()}));this.dashboards.set([...e]);}else this.dashboards.set(t);this.applyDashboardParam(this.getRouteParam("id"),false);let a=this._router.events.pipe(fn$7(e=>e instanceof $$2),Du({bufferSize:1,refCount:true}),Gp(this._destroyRef));a.pipe(_t$9(1),ke$3(()=>this.getRouteParam("id"))).subscribe(e=>this.applyDashboardParam(e,true)),a.pipe(wu(1),ke$3(()=>this.getRouteParam("id")),Gl$2()).subscribe(e=>this.applyDashboardParam(e,false)),Fa$5(()=>{let e=this.dashboards();ge$5(()=>{this._settings.saveDashboards(e);});});}getRouteParam(t){let a=this._router.routerState.snapshot.root;for(;a;){if(a.paramMap.has(t))return a.paramMap.get(t);a=a.firstChild??null;}return null}applyDashboardParam(t,a){if(t===null||t===""){a&&this.setActiveDashboardIndex(0);return}let e=Number(t);if(Number.isNaN(e)){a&&this.setActiveDashboardIndex(0);return}this.setActiveDashboardIndex(e);}setActiveDashboardIndex(t){t!==this.activeDashboard()&&(t>=0&&t<this.dashboards().length?this.activeDashboard.set(t):console.error(`[Dashboard Service] Invalid dashboard ID: ${t}`));}toggleStaticDashboard(){this.isDashboardStatic.set(!this.isDashboardStatic());}add(t,a,e,i){let r=0;return this.dashboards.update(s=>{let d=[...s,{id:b.create(),name:t,icon:e??"dashboard-dashboard",configuration:a,collapseSplitShell:i??false}];return r=d.length-1,d}),r}update(t,a,e,i){this.dashboards.update(r=>r.map((s,d)=>d===t?z$5(G$b({},s),{name:a,icon:e??"dashboard-dashboard",collapseSplitShell:i??false}):s));}delete(t){this.dashboards.update(a=>a.filter((e,i)=>i!==t)),this.dashboards().length===0?(this.add("Dashboard "+(this.dashboards().length+1),[]),this.activeDashboard.set(0)):(this.activeDashboard()??-1)>this.dashboards().length-1&&this.activeDashboard.set(this.dashboards().length-1);}duplicate(t,a,e,i){if(t<0||t>=this.dashboards().length)return console.error(`[Dashboard Service] Invalid itemIndex: ${t}`),-1;let r=this.dashboards()[t],s=dp(r);s.id=b.create(),s.name=a,s.icon=e||"dashboard-dashboard",s.collapseSplitShell=i??false,Array.isArray(s.configuration)?s.configuration.forEach(o=>{o&&o.input?.widgetProperties?(o.id=b.create(),o.input.widgetProperties.uuid=o.id):console.error("Dashboard Service] Widget configuration is missing required properties:",o);}):(console.error("Dashboard Service] Dashboard configuration is not an array:",s.configuration),s.configuration=[]);let d=-1;return this.dashboards.update(o=>{let D=[...o,s];return d=D.length-1,D}),d}updateConfiguration(t,a){let e=dp(a??[]);this.dashboards.update(i=>i.map((r,s)=>s===t?ln$3(r.configuration,e)?r:z$5(G$b({},r),{configuration:e}):r));}previousDashboard(){let t=this.activeDashboard();if(t===null){this.activeDashboard.set(0);return}t+1>this.dashboards().length-1?this.activeDashboard.set(0):this.activeDashboard.set(t+1);}nextDashboard(){let t=this.activeDashboard();if(t===null){this.activeDashboard.set(0);return}t-1<0?this.activeDashboard.set(this.dashboards().length-1):this.activeDashboard.set(t-1);}navigateToActive(){this._router.navigate(["/dashboard",this.activeDashboard()]);}navigateTo(t){t>=0&&t<this.dashboards().length?this._router.navigate(["/dashboard",t]):console.error(`[Dashboard Service] Invalid dashboard ID: ${t}`);}navigateToNextDashboard(){let t=this.activeDashboard()??0,a=0;t-1<0?a=this.dashboards().length-1:a=t-1,this._router.navigate(["/dashboard",a]);}navigateToPreviousDashboard(){let t=this.activeDashboard()??0,a=0;t+1>=this.dashboards().length?a=0:a=t+1,this._router.navigate(["/dashboard",a]);}deleteWidget(t){this._widgetAction.next({id:t,operation:"delete"});}duplicateWidget(t){this._widgetAction.next({id:t,operation:"duplicate"});}copyWidget(t){this._widgetAction.next({id:t,operation:"copy"});}cutWidget(t){this._widgetAction.next({id:t,operation:"cut"});}setWidgetClipboardFromNode(t){let a=t?.input?.widgetProperties,e=a?.type;e&&this.widgetClipboard.set({w:t.w,h:t.h,selector:t.selector,input:{widgetProperties:{type:e,uuid:"clipboard",config:dp(a.config)}}});}clearWidgetClipboard(){this.widgetClipboard.set(null);}setStaticDashboard(t){this.isDashboardStatic.set(t);}notifyLayoutEditSaved(){this.layoutEditSaved.update(t=>t+1);}notifyLayoutEditCanceled(){this.layoutEditCanceled.update(t=>t+1);}static \u0275fac=function(a){return new(a||n)};static \u0275prov=Q$6({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var _=(()=>{class n{resolvePathConfig(e,t){let i=e.paths;if(!i)return;if(Array.isArray(i)){if(typeof t=="string"){let r=i.find(c=>typeof c.pathID=="string"&&c.pathID.trim()===t);if(r)return r;let u=Number(t);if(Number.isInteger(u)&&u>=0)return i[u]}return i[0]}let s=t??Object.keys(i)[0];return s?i[s]:void 0}metaWidget=Hj();dataService=w$4(De$2);destroyRef=w$4(xe$3);_metaConfig=vt$9(void 0);_meta=vt$9(null);reset$=new te$9;currentSub;pathSignature;zones=Dt$9(()=>this._meta()?.zones||[]);possibleValues=Dt$9(()=>this._meta()?.possibleValues||[]);supportsPut=Dt$9(()=>this._meta()?.supportsPut||false);observe(e){let t=this._metaConfig();if(!t?.paths)return;let s=this.resolvePathConfig(t,e)?.path;if(!s)return;let r=s;this.pathSignature!==r&&(this.pathSignature=r,this.subscribePathMeta(s));}subscribePathMeta(e){this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0);let t=this.dataService.getPathMetaObservable(e).pipe(bu(this.reset$),Gp(this.destroyRef)).subscribe(i=>{this._meta.set(i);});this.currentSub=t;}setMetaConfig(e){this._metaConfig.set(e);}applyMetaConfigDiff(e){this._metaConfig.set(e),this.pathSignature&&this.observe();}reset(){this.reset$.next(),this.reset$.complete(),this.reset$=new te$9,this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0),this.pathSignature=void 0,this._meta.set(null);}static \u0275fac=function(t){return new(t||n)};static \u0275dir=nw({type:n,selectors:[["","widget-metadata",""]],inputs:{metaWidget:[1,"metaWidget"]},exportAs:["widgetMetadata"]})}return n})();var rt$3=(()=>{class g{_streamsConfig=vt$9(void 0);dataService=w$4(De$2);unitsService=w$4(ut$2);destroyRef=w$4(xe$3);streams;registrations=[];subscriptions=new Map;baseSignatures=new Map;reset$=new te$9;rootSignature;buildObserver(t,e){return {next:r=>e(r),error:r=>console.error("[Widget] Observer got an error: "+r),complete:()=>{}}}computePathSignature(t){let e=this.normalizePath(t.path)??"",r=t.source?.trim()||"default";return [e,t.pathType??"",t.sampleTime,t.convertUnitTo,r,t.suppressBootstrapNull?"1":"0"].join("|")}computeBaseKey(t,e){let r=this.normalizePath(t)??"",i=e?.trim()||"default";return `${r}|${i}`}normalizePath(t){if(typeof t!="string")return;let e=t.trim();return e.length?e:void 0}computeRootSignature(t){return t?`timeout:${t.enableTimeout?"1":"0"}:${t.dataTimeout??""}`:"none"}getPathKeys(t){return t?Array.isArray(t)?t.map((e,r)=>(typeof e.pathID=="string"?e.pathID.trim():"")||String(r)):Object.keys(t):[]}getPathConfig(t,e){if(t){if(Array.isArray(t)){let r=t.find(o=>typeof o.pathID=="string"&&o.pathID.trim()===e);if(r)return r;let i=Number(e);return Number.isInteger(i)&&i>=0?t[i]:void 0}return t[e]}}ensureStreamsMap(){this.streams||(this.streams=new Map);}buildAndSubscribe(t,e,r,i){let o=this.normalizePath(i.path);if(!o){let u=this.subscriptions.get(t);u&&u.sub.unsubscribe(),this.subscriptions.delete(t),this.streams?.delete(t),this.baseSignatures.delete(t);return}this.ensureStreamsMap();let l=this.computeBaseKey(o,i.source),b=this.baseSignatures.get(t);(!this.streams.has(t)||b!==l)&&(this.streams.set(t,this.dataService.subscribePath(o,i.source?.trim()||"default")),this.baseSignatures.set(t,l));let m=this.streams.get(t),s=!!r.enableTimeout,n=(r.dataTimeout??5)*1e3,c=5e3,p=`[Widget] ${r.displayName} - ${n/1e3} second data update timeout reached for `,P=`[Widget] ${r.displayName} - Retrying in ${c/1e3} seconds`,d=i.pathType??"",h=i.convertUnitTo,T=!!i.suppressBootstrapNull,f=Number(i.sampleTime);(!Number.isFinite(f)||f<=0)&&(f=1e3);let q=u=>h?this.unitsService.convertToUnit(h,u):u,a=m;if(T){let u=false;a=a.pipe(fn$7(X=>(X?.data?.value!=null&&(u=true),u)));}let G=a.pipe(_t$9(1)),H=a.pipe(ny(f));a=zm(G,H),d==="number"&&(a=a.pipe(ke$3(u=>({data:{value:u.data.value==null?null:q(u.data.value),timestamp:u.data.timestamp},state:u.state})))),s&&(a=a.pipe(Sm({each:n,with:()=>bm(()=>{console.log(p+o),this.dataService.timeoutPathObservable(o,d);})}),ty(u=>u.pipe(Cu(()=>console.log(P)),wo$4(()=>We$9(c))))));let J=this.buildObserver(t,e),L=a.pipe(bu(this.reset$),Gp(this.destroyRef)).subscribe(J),Q=z$5(G$b({},i),{path:o}),V=this.computePathSignature(Q),z=this.subscriptions.get(t);z&&z.sub.unsubscribe(),this.subscriptions.set(t,{sub:L,signature:V});}setStreamsConfig(t){this._streamsConfig.set(t),this.rootSignature=this.computeRootSignature(t);}applyStreamsConfigDiff(t){let e=this._streamsConfig(),r=this.rootSignature,i=this.computeRootSignature(t);if(this._streamsConfig.set(t),this.rootSignature=i,!e||!e.paths||!this.getPathKeys(e.paths).length)return;if(!t||!t.paths){this.subscriptions.forEach(s=>s.sub.unsubscribe()),this.subscriptions.clear(),this.streams=void 0,this.baseSignatures.clear(),this.registrations=[];return}let o=this.getPathKeys(e.paths),l=this.getPathKeys(t.paths),b=o.filter(s=>!l.includes(s));for(let s of b){let n=this.subscriptions.get(s);n&&n.sub.unsubscribe(),this.subscriptions.delete(s),this.streams?.delete(s),this.baseSignatures.delete(s),this.registrations=this.registrations.filter(c=>c.pathName!==s);}let m=r!==i;for(let s of l){let n=this.getPathConfig(t.paths,s),c=this.normalizePath(n?.path);if(!c){let h=this.subscriptions.get(s);h&&h.sub.unsubscribe(),this.subscriptions.delete(s),this.streams?.delete(s),this.baseSignatures.delete(s);continue}let p=z$5(G$b({},n),{path:c}),P=this.computePathSignature(p),d=this.subscriptions.get(s);if(!d||d.signature!==P||m){d&&(d.sub.unsubscribe(),this.subscriptions.delete(s));let h=this.registrations.find(T=>T.pathName===s);h&&this.buildAndSubscribe(s,h.next,t,p);}}}observe(t,e){let r=this.registrations.find(n=>n.pathName===t)?.next;this.registrations=this.registrations.filter(n=>n.pathName!==t),this.registrations.push({pathName:t,next:e});let i=this._streamsConfig(),o=this.getPathConfig(i?.paths,t);if(!i||!o){let n=this.subscriptions.get(t);n&&(n.sub.unsubscribe(),this.subscriptions.delete(t),this.streams?.delete(t),this.baseSignatures.delete(t));return}let l=this.normalizePath(o?.path);if(!l){let n=this.subscriptions.get(t);n&&(n.sub.unsubscribe(),this.subscriptions.delete(t),this.streams?.delete(t),this.baseSignatures.delete(t)),this.registrations=this.registrations.filter(c=>c.pathName!==t);return}let b=z$5(G$b({},o),{path:l}),m=this.computePathSignature(b),s=this.subscriptions.get(t);s&&s.signature===m&&r===e||this.buildAndSubscribe(t,e,i,b);}static \u0275fac=function(e){return new(e||g)};static \u0275dir=nw({type:g,selectors:[["","widget-streams",""]],exportAs:["widgetStreams"]})}return g})();var p=(()=>{class s{config=Hj();defaultConfig=vt$9(void 0);_runtimeConfig=vt$9(void 0);lastBaseRef;lastUserRef;lastMergedRef;options=Dt$9(()=>{let e=this.defaultConfig(),t=this._runtimeConfig();if(this.lastMergedRef&&e===this.lastBaseRef&&t===this.lastUserRef)return this.lastMergedRef;let i;return e&&t?i=Ap(dp(e),dp(t)):e&&!t?i=dp(e):!e&&t?i=dp(t):i=void 0,this.lastBaseRef=e,this.lastUserRef=t,this.lastMergedRef=i,i});firstPathKey=Dt$9(()=>{let e=this.options();if(!e?.paths)return;let t=Object.keys(e.paths);return t.length?t[0]:void 0});constructor(){Fa$5(()=>{let e=this.config();ge$5(()=>{e&&this.setRuntimeConfig(e);});});}getPathCfg(e){let i=this.options()?.paths;if(!(!i||Array.isArray(i)))return i[e]}setRuntimeConfig(e){this._runtimeConfig.set(e);}initialize(e,t){e&&this.defaultConfig.set(e),t&&this._runtimeConfig.set(t);}static \u0275fac=function(t){return new(t||s)};static \u0275dir=nw({type:s,selectors:[["","widget-runtime",""]],inputs:{config:[1,"config"]},exportAs:["widgetRuntime"]})}return s})();var h=class l{static getElements(o,e=document){if(typeof o=="string"){let t="getElementById"in e?e:void 0;if(t&&!isNaN(+o[0])){let s=t.getElementById(o);return s?[s]:[]}let i=e.querySelectorAll(o);if(!i.length&&o[0]!=="."&&o[0]!=="#"&&(i=e.querySelectorAll("."+o),i.length||(i=e.querySelectorAll("#"+o)),!i.length)){let s=e.querySelector(`[gs-id="${o}"]`);return s?[s]:[]}return Array.from(i)}return [o]}static getElement(o,e=document){if(typeof o=="string"){let t="getElementById"in e?e:void 0;if(!o.length)return null;if(t&&o[0]==="#")return t.getElementById(o.substring(1));if(o[0]==="#"||o[0]==="."||o[0]==="[")return e.querySelector(o);if(t&&!isNaN(+o[0]))return t.getElementById(o);let i=e.querySelector(o);return t&&!i&&(i=t.getElementById(o)),i||(i=e.querySelector("."+o)),i}return o}static lazyLoad(o){return o.lazyLoad||o.grid?.opts?.lazyLoad&&o.lazyLoad!==false}static createDiv(o,e){let t=document.createElement("div");return o.forEach(i=>{i&&t.classList.add(i);}),e?.appendChild(t),t}static shouldSizeToContent(o,e=false){return o?.grid&&(e?o.sizeToContent===true||o.grid.opts.sizeToContent===true&&o.sizeToContent===void 0:!!o.sizeToContent||o.grid.opts.sizeToContent&&o.sizeToContent!==false)}static isIntercepted(o,e){return !(o.y>=e.y+e.h||o.y+o.h<=e.y||o.x+o.w<=e.x||o.x>=e.x+e.w)}static isTouching(o,e){return l.isIntercepted(o,{x:e.x-.5,y:e.y-.5,w:e.w+1,h:e.h+1})}static areaIntercept(o,e){let t=o.x>e.x?o.x:e.x,i=o.x+o.w<e.x+e.w?o.x+o.w:e.x+e.w;if(i<=t)return 0;let s=o.y>e.y?o.y:e.y,r=o.y+o.h<e.y+e.h?o.y+o.h:e.y+e.h;return r<=s?0:(i-t)*(r-s)}static area(o){return o.w*o.h}static sort(o,e=1){return o.sort((i,s)=>{let r=e*((i.y??1e4)-(s.y??1e4));return r===0?e*((i.x??1e4)-(s.x??1e4)):r})}static find(o,e){return e?o.find(t=>t.id===e):void 0}static toBool(o){return typeof o=="boolean"?o:typeof o=="string"?(o=o.toLowerCase(),!(o===""||o==="no"||o==="false"||o==="0")):!!o}static toNumber(o){return o===null||o.length===0?void 0:Number(o)}static parseHeight(o){let e,t="px";if(typeof o=="string")if(o==="auto"||o==="")e=0;else {let i=o.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${o}`);t=i[2]||"px",e=parseFloat(i[1]);}else e=o;return {h:e,unit:t}}static defaults(o,...e){return e.forEach(t=>{for(let i in t){if(!t.hasOwnProperty(i))return;o[i]===null||o[i]===void 0?o[i]=t[i]:typeof t[i]=="object"&&typeof o[i]=="object"&&l.defaults(o[i],t[i]);}}),o}static same(o,e){if(typeof o!="object")return o==e;if(typeof o!=typeof e||Object.keys(o).length!==Object.keys(e).length)return false;for(let t in o)if(o[t]!==e[t])return false;return true}static copyPos(o,e,t=false){return e.x!==void 0&&(o.x=e.x),e.y!==void 0&&(o.y=e.y),e.w!==void 0&&(o.w=e.w),e.h!==void 0&&(o.h=e.h),t&&(e.minW&&(o.minW=e.minW),e.minH&&(o.minH=e.minH),e.maxW&&(o.maxW=e.maxW),e.maxH&&(o.maxH=e.maxH)),o}static samePos(o,e){return o&&e&&o.x===e.x&&o.y===e.y&&(o.w||1)===(e.w||1)&&(o.h||1)===(e.h||1)}static sanitizeMinMax(o){o.minW||delete o.minW,o.minH||delete o.minH,o.maxW||delete o.maxW,o.maxH||delete o.maxH;}static removeInternalAndSame(o,e){if(!(typeof o!="object"||typeof e!="object")&&!(Array.isArray(o)||Array.isArray(e)))for(let t in o){let i=o[t],s=e[t];t[0]==="_"||i===s?delete o[t]:i&&typeof i=="object"&&s!==void 0&&(l.removeInternalAndSame(i,s),Object.keys(i).length||delete o[t]);}}static removeInternalForSave(o,e=true){for(let t in o)(t[0]==="_"||o[t]===null||o[t]===void 0)&&delete o[t];delete o.grid,e&&delete o.el,o.autoPosition||delete o.autoPosition,o.noResize||delete o.noResize,o.noMove||delete o.noMove,o.locked||delete o.locked,(o.w===1||o.w===o.minW)&&delete o.w,(o.h===1||o.h===o.minH)&&delete o.h;}static throttle(o,e){let t=false;return (...i)=>{t||(t=true,setTimeout(()=>{o(...i),t=false;},e));}}static removePositioningStyles(o){let e=o.style;e.position&&e.removeProperty("position"),e.left&&e.removeProperty("left"),e.top&&e.removeProperty("top"),e.width&&e.removeProperty("width"),e.height&&e.removeProperty("height");}static getScrollElement(o){if(!o)return document.scrollingElement||document.documentElement;let e=getComputedStyle(o).overflowY;return (e==="auto"||e==="scroll")&&o.scrollHeight>o.clientHeight?o:l.getScrollElement(o.parentElement)}static updateScrollResize(o,e,t){let i=l.getScrollElement(e),s=i.clientHeight,r=i===l.getScrollElement()?0:i.getBoundingClientRect().top,n=o.clientY-r,a=n<t,u=n>s-t;a?i.scrollBy({behavior:"smooth",top:n-t}):u&&i.scrollBy({behavior:"smooth",top:t-(s-n)});}static clone(o){return o==null||typeof o!="object"?o:o instanceof Array?[...o]:G$b({},o)}static cloneDeep(o){let e=["parentGrid","el","grid","subGrid","engine"],t=l.clone(o);for(let i in t)t.hasOwnProperty(i)&&typeof t[i]=="object"&&i.substring(0,2)!=="__"&&!e.find(s=>s===i)&&(t[i]=l.cloneDeep(o[i]));return t}static cloneNode(o){let e=o.cloneNode(true);return e.removeAttribute("id"),e}static appendTo(o,e){let t;typeof e=="string"?t=l.getElement(e):t=e,t&&t.appendChild(o);}static addElStyles(o,e){if(e instanceof Object)for(let t in e)e.hasOwnProperty(t)&&(Array.isArray(e[t])?e[t].forEach(i=>{o.style[t]=i;}):o.style[t]=e[t]);}static initEvent(o,e){let t={type:e.type},i={button:0,which:0,buttons:1,bubbles:true,cancelable:true,target:e.target?e.target:o.target};return ["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>t[s]=o[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>t[s]=o[s]),G$b(G$b({},t),i)}static simulateMouseEvent(o,e,t){let i=o,s=new MouseEvent(e,{bubbles:true,composed:true,cancelable:true,view:window,detail:1,screenX:o.screenX,screenY:o.screenY,clientX:o.clientX,clientY:o.clientY,ctrlKey:i.ctrlKey??false,altKey:i.altKey??false,shiftKey:i.shiftKey??false,metaKey:i.metaKey??false,button:0,relatedTarget:o.target});(t||o.target).dispatchEvent(s);}static getValuesFromTransformedElement(o){let e=document.createElement("div");l.addElStyles(e,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),o.appendChild(e);let t=e.getBoundingClientRect();return o.removeChild(e),e.remove(),{xScale:1/t.width,yScale:1/t.height,xOffset:t.left,yOffset:t.top}}static swap(o,e,t){if(!o)return;let i=o[e];o[e]=o[t],o[t]=i;}static canBeRotated(o){return !(!o||o.w===o.h||o.locked||o.noResize||o.grid?.opts.disableResize||o.minW&&o.minW===o.maxW||o.minH&&o.minH===o.maxH)}};var rt$2=(()=>{class l{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange;}batchUpdate(e=true,t=true){return !!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=true,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return (!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,s={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return false;if(e._moving&&!s.nested&&!this.float&&this.swap(e,i))return true;let r=t;!this._loading&&this._useEntireRowArea(e,t)&&(r={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,r,s.skip));let n=false,a={nested:true,pack:false},u=0;for(;i=i||this.collide(e,r,s.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,z$5(G$b({},i),{y:e.y}),e)||!this.collide(i,z$5(G$b({},i),{y:t.y-i.h}),e))){e._skipDown=e._skipDown||t.y>e.y;let d=G$b(z$5(G$b({},t),{y:i.y+i.h}),a);c=this._loading&&h.samePos(e,d)?true:this.moveNode(e,d),(i.locked||this._loading)&&c?h.copyPos(t,e):!i.locked&&c&&s.pack&&(this._packNodes(),t.y=i.y+i.h,h.copyPos(e,t)),n=n||c;}else c=this.moveNode(i,G$b(z$5(G$b({},i),{y:t.y+t.h,skip:e}),a));if(!c)return n;i=void 0;}return n}collide(e,t=e,i){let s=e._id,r=i?._id;return this.nodes.find(n=>n._id!==s&&n._id!==r&&h.isIntercepted(n,t))}collideAll(e,t=e,i){let s=e._id,r=i?._id;return this.nodes.filter(n=>n._id!==s&&n._id!==r&&h.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;let s=e._rect,r=G$b({},t.rect);r.y>s.y?(r.h+=r.y-s.y,r.y=s.y):r.h+=s.y-r.y,r.x>s.x?(r.w+=r.x-s.x,r.x=s.x):r.w+=s.x-r.x;let n,a=.5;for(let u of i){if(u.locked||!u._rect)break;let c=u._rect,d=Number.MAX_VALUE,p=Number.MAX_VALUE;s.y<c.y?d=(r.y+r.h-c.y)/c.h:s.y+s.h>c.y+c.h&&(d=(c.y+c.h-r.y)/c.h),s.x<c.x?p=(r.x+r.w-c.x)/c.w:s.x+s.w>c.x+c.w&&(p=(c.x+c.w-r.x)/c.w);let g=Math.min(p,d);g>a&&(a=g,n=u);}return t.collide=n,n}cacheRects(e,t,i,s,r,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-s,h:a.h*t-i-r}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return false;function i(){let r=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=r,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=r,e.y=n),e._dirty=t._dirty=true,true}let s;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(s=h.isTouching(e,t)))return i();if(s!==false){if(e.w===t.w&&e.x===t.x&&(s||(s=h.isTouching(e,t)))){if(t.y<e.y){let r=e;e=t,t=r;}return i()}if(s!==false){if(e.h===t.h&&e.y===t.y&&(s||(s=h.isTouching(e,t)))){if(t.x<e.x){let r=e;e=t,t=r;}return i()}return false}}}isAreaEmpty(e,t,i,s){let r={x:e||0,y:t||0,w:i||1,h:s||1};return !this.collide(r)}compact(e="compact",t=true){if(this.nodes.length===0)return this;t&&this.sortNodes();let i=this.batchMode;i||this.batchUpdate();let s=this._inColumnResize;s||(this._inColumnResize=true);let r=this.nodes;return this.nodes=[],r.forEach((n,a,u)=>{let c;n.locked||(n.autoPosition=true,e==="list"&&a&&(c=u[a-1])),this.addNode(n,false,c);}),s||delete this._inColumnResize,i||this.batchUpdate(false),this}set float(e){this._float!==e&&(this._float=e||false,e||this._packNodes()._notify());}get float(){return this._float||false}sortNodes(e=1){return this.nodes=h.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=true,e.y=t);}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){let i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i;}}),this)}prepareNode(e,t){e._id=e._id??l._idSeq++;let i=e.id;if(i){let r=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+r++;}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=true);let s={x:0,y:0,w:1,h:1};return h.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,h.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=s.x,e.autoPosition=true),isNaN(e.y)&&(e.y=s.y,e.autoPosition=true),isNaN(e.w)&&(e.w=s.w),isNaN(e.h)&&(e.h=s.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){let i=e._orig||h.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){let r=G$b({},e);r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,this.defaultColumn);}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),h.samePos(e,i)||(e._dirty=true),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!h.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;let t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried;}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=h.copyPos({},e),delete e._dirty;}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||h.samePos(e,e._orig)||(h.copyPos(e,e._orig),e._dirty=true);}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){let r=s?s.y*i+(s.x+s.w):0,n=false;for(let a=r;!n;++a){let u=a%i,c=Math.floor(a/i);if(u+e.w>i)continue;let d={x:u,y:c,w:e.w,h:e.h};t.find(p=>h.isIntercepted(d,p))||((e.x!==u||e.y!==c)&&(e._dirty=true),e.x=u,e.y=c,delete e.autoPosition,n=true);}return n}addNode(e,t=false,i){let s=this.nodes.find(n=>n._id===e._id);if(s)return s;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,r=true),this.nodes.push(e),t&&this.addedNodes.push(e),r||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=true,i=false){return this.nodes.find(s=>s._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=true),this.nodes=this.nodes.filter(s=>s._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=true,t=true){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(s=>s._removeDOM=true);let i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return false;if(t.pack=true,!this.maxRow)return this.moveNode(e,t);let i,s=new l({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i=G$b({},n),i):G$b({},n))});if(!i)return false;let r=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!t.resizing&&t.collide){let n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),true}return r?(s.nodes.filter(n=>n._dirty).forEach(n=>{let a=this.nodes.find(u=>u._id===n._id);a&&(h.copyPos(a,n),a._dirty=true);}),this._notify(),true):false}willItFit(e){if(delete e._willFitPos,!this.maxRow)return true;let t=new l({column:this.column,float:this.float,nodes:this.nodes.map(s=>G$b({},s))}),i=G$b({},e);return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=h.copyPos({},i),true):false}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?true:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return false;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=true),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);let s=e.w!==t.w||e.h!==t.h,r=h.copyPos({},e,true);if(h.copyPos(r,t),this.nodeBoundFix(r,s),h.copyPos(t,r),!t.forceCollide&&h.samePos(e,t))return false;let n=h.copyPos({},e),a=this.collideAll(e,r,t.skip),u=true;if(a.length){let c=e._moving&&!t.nested,d=c?this.directionCollideCoverage(e,t,a):a[0];if(c&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){let p=h.areaIntercept(t.rect,d._rect),g=h.area(t.rect),C=h.area(d._rect);p/(g<C?g:C)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0);}d?u=!this._fixCollisions(e,r,d,t):(u=false,i&&delete t.pack);}return u&&!h.samePos(e,r)&&(e._dirty=true,h.copyPos(e,r)),t.pack&&this._packNodes()._notify(),!h.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=true,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){let e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=true,t,i){let s=this._layouts?.length||0,r;s&&(i?i!==this.column&&(r=this._layouts[i]):this.column!==s-1&&(r=this._layouts[s-1]));let n=[];return this.sortNodes(),this.nodes.forEach(a=>{let u=r?.find(d=>d._id===a._id),c=G$b(G$b({},a),u||{});h.removeInternalForSave(c,!e),t&&t(a,c),n.push(c);}),n}layoutsNodesChange(e){return !this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else {let s=i/this.column;e.forEach(r=>{if(!r._orig)return;let n=t.find(a=>a._id===r._id);n&&(n.y>=0&&r.y!==r._orig.y&&(n.y+=r.y-r._orig.y,n.y<0&&(n.y=0)),r.x!==r._orig.x&&(n.x=Math.round(r.x*s),n.x<0&&(n.x=0)),r.w!==r._orig.w&&(n.w=Math.round(r.w*s),n.w<1&&(n.w=1)));});}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;let s=i==="compact"||i==="list";s&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let r=[],n=s?this.nodes:h.sort(this.nodes,-1);if(t>e&&this._layouts){let a=this._layouts[t]||[],u=this._layouts.length-1;!a.length&&e!==u&&this._layouts[u]?.length&&(e=u,this._layouts[u].forEach(c=>{let d=n.find(p=>p._id===c._id);d&&(!s&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=true));})),a.forEach(c=>{let d=n.findIndex(p=>p._id===c._id);if(d!==-1){let p=n[d];if(s){p.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,r),c.autoPosition||(p.x=c.x??p.x,p.y=c.y??p.y,p.w=c.w??p.w,r.push(p)),n.splice(d,1);}});}if(s)this.compact(i,false);else {if(n.length)if(typeof i=="function")i(t,e,r,n);else {let a=s||i==="none"?1:t/e,u=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";n.forEach(d=>{d.x=t===1?0:u?Math.round(d.x*a):Math.min(d.x,t-1),d.w=t===1||e===1?1:c?Math.round(d.w*a)||1:Math.min(d.w,t),r.push(d);}),n=[];}r=h.sort(r,-1),this._inColumnResize=true,this.nodes=[],r.forEach(a=>{this.addNode(a,false),delete a._orig;});}return this.nodes.forEach(a=>delete a._orig),this.batchUpdate(false,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=false){let s=[];return e.forEach((r,n)=>{if(r._id===void 0){let a=r.id?this.nodes.find(u=>u.id===r.id):void 0;r._id=a?._id??l._idSeq++;}s[n]={x:r.x,y:r.y,w:r.w,_id:r._id};}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??l._idSeq++;let i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=true)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];let s=this.findCacheLayout(e,t);return s===-1?this._layouts[t].push(i):this._layouts[t][s]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){let i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1);}}cleanupNode(e){for(let t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}return l._idSeq=0,l})();var P$2={alwaysShowResizeHandle:"mobile",animate:true,auto:true,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:true},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};var f=class{};var M$1=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),R$3=class R{};function Ue$1(l,o){l.touches.length>1||(l.cancelable&&l.preventDefault(),h.simulateMouseEvent(l.changedTouches[0],o));}function Gt$1(l,o){l.cancelable&&l.preventDefault(),h.simulateMouseEvent(l,o);}function de$1(l){R$3.touchHandled||(R$3.touchHandled=true,Ue$1(l,"mousedown"));}function he$2(l){R$3.touchHandled&&Ue$1(l,"mousemove");}function ce$1(l){if(!R$3.touchHandled)return;R$3.pointerLeaveTimeout&&(window.clearTimeout(R$3.pointerLeaveTimeout),delete R$3.pointerLeaveTimeout);let o=!!f.dragElement;Ue$1(l,"mouseup"),o||Ue$1(l,"click"),R$3.touchHandled=false;}function ue$1(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId);}function ot$3(l){f.dragElement&&l.pointerType!=="mouse"&&Gt$1(l,"mouseenter");}function nt$3(l){f.dragElement&&l.pointerType!=="mouse"&&(R$3.pointerLeaveTimeout=window.setTimeout(()=>{delete R$3.pointerLeaveTimeout,Gt$1(l,"mouseleave");},10));}var Ut$1=(()=>{class l{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=false,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init();}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element);}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e);}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${l.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),M$1&&(this.el.addEventListener("touchstart",de$1),this.el.addEventListener("pointerdown",ue$1)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),M$1&&(this.el.removeEventListener("touchstart",de$1),this.el.removeEventListener("pointerdown",ue$1)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:true,passive:true}),document.addEventListener("mouseup",this._mouseUp,true),M$1&&(this.el.addEventListener("touchmove",he$2),this.el.addEventListener("touchend",ce$1)),e.stopPropagation(),e.preventDefault();}_mouseMove(e){let t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=true,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation();}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,true),document.removeEventListener("mouseup",this._mouseUp,true),M$1&&(this.el.removeEventListener("touchmove",he$2),this.el.removeEventListener("touchend",ce$1)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault();}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent));}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}return l.prefix="ui-resizable-",l})();var j$1=class j{constructor(){this._eventRegister={};}get disabled(){return this._disabled}on(o,e){this._eventRegister[o]=e;}off(o){delete this._eventRegister[o];}enable(){this._disabled=false;}disable(){this._disabled=true;}destroy(){delete this._eventRegister;}triggerEvent(o,e){if(!this.disabled&&this._eventRegister&&this._eventRegister[o])return this._eventRegister[o](e)}};var $t$1=(()=>{class l extends j$1{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{let s=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},n=this.temporalRect||r;return {position:{left:this.option.rtl?(s.right-n.right)*this.rectScale.x:(n.left-s.left)*this.rectScale.x,top:(n.top-s.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers();}on(e,t){super.on(e,t);}off(e){super.off(e);}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide);}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(false);}destroy(){this._removeHandlers(),this._setupAutoHide(false),delete this.el,super.destroy();}updateOption(e){let t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(s=>this.option[s]=e[s]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),f.overResizeElement===this&&delete f.overResizeElement),this}_mouseOver(e){f.overResizeElement||f.dragElement||(f.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"));}_mouseOut(e){f.overResizeElement===this&&(delete f.overResizeElement,this.el.classList.add("ui-resizable-autohide"));}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ut$1(this.el,e,{element:this.option.element,start:t=>this._resizeStart(t),stop:t=>this._resizeStop(t),move:t=>this._resizing(t,e)})),this}_resizeStart(e){this.sizeToContent=h.shouldSizeToContent(this.el.gridstackNode,true),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=h.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();let t=h.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();let i=h.initEvent(e,{type:"resize",target:this.el});return i.resizeDir=t,i.hasMovedX=this.option.rtl?t.includes("e"):t.includes("w"),i.hasMovedY=t.includes("n"),this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){let t=h.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=l._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;let e=this.el.parentElement,t=h.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return l._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null;}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){let i=this.startEvent,s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},r=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY,a,u,c=this.option.rtl;!c&&t.indexOf("e")>-1?s.width+=r:c&&t.indexOf("w")>-1?s.width-=r:!c&&t.indexOf("w")>-1?(s.width-=r,s.left+=r,a=true):c&&t.indexOf("e")>-1&&(s.width+=r,s.right+=r,a=true),t.indexOf("s")>-1?s.height+=n:t.indexOf("n")>-1&&(s.height-=n,s.top+=n,u=true);let d=this._constrainSize(s.width,s.height,a,u);return Math.round(s.width)!==Math.round(d.width)&&(!c&&t.indexOf("w")>-1?s.left+=s.width-d.width:c&&t.indexOf("e")>-1&&(s.right-=s.width-d.width),s.width=d.width),Math.round(s.height)!==Math.round(d.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-d.height),s.height=d.height),s}_constrainSize(e,t,i,s){let r=this.option,n=(i?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,a=r.minWidth/this.rectScale.x||e,u=(s?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,c=r.minHeight/this.rectScale.y||t,d=Math.min(n,Math.max(a,e)),p=Math.min(u,Math.max(c,t));return {width:d,height:p}}_applyChange(){let e={left:0,right:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){let t=this.el.parentElement,{left:i,right:s,top:r}=t.getBoundingClientRect();e={left:i,right:s,top:r,width:0,height:0};}return this.temporalRect?(Object.entries(this.temporalRect).forEach(([t,i])=>{if(this.option.rtl?t==="left":t==="right")return;let s=t==="width"||t==="left"||t==="right"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1,r;t==="right"?r=(e.right-i)*this.rectScale.x+"px":r=(i-e[t])*s+"px",this.el.style[t]=r;}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}return l._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"],l})();var si$1='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',qt$1=(()=>{class l extends j$1{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},this._autoScrollTick=()=>{let r=this.helper,n=this._autoScrollContainer;if(!r||!n){this._stopScrolling();return}let a=this._getClipping(r,n);if(a===0){this._stopScrolling();return}if(!this._autoScrollMaxSpeed){let g=window.innerHeight||document.documentElement.clientHeight;this._autoScrollMaxSpeed=Math.max(g/150,4);}let u=Math.abs(a),c=Math.min(u*.5,this._autoScrollMaxSpeed),d=a>0?c:-c,p=n.scrollTop;if(n.scrollTop+=d,n.scrollTop===p){this._stopScrolling();return}this.dragging&&this.lastDrag&&(this._dragFollow(this.lastDrag),this._callDrag(this.lastDrag)),this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick);};let i=t?.handle?.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s?.subGrid?[e.querySelector(t.handle)||e]:this.getAllHandles(),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable();}getAllHandles(){return Array.from(this.el.querySelectorAll(this.option.handle)).filter(e=>{if(!(e instanceof HTMLElement))return false;let t=e.closest(".grid-stack-item");return t===this.el||!t})}on(e,t){super.on(e,t);}off(e){super.off(e);}enable(){this.disabled!==false&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),M$1&&(e.addEventListener("touchstart",de$1),e.addEventListener("pointerdown",ue$1));}),this.el.classList.remove("ui-draggable-disabled"));}disable(e=false){this.disabled!==true&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),M$1&&(t.removeEventListener("touchstart",de$1),t.removeEventListener("pointerdown",ue$1));}),e||this.el.classList.add("ui-draggable-disabled"));}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(true),delete this.el,delete this.helper,delete this.option,super.destroy();}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(R$3.touchHandled&&e.isTrusted&&(R$3.touchHandled=false),!f.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(si$1)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete f.dragElement,delete f.dropElement,delete this._autoScrollMaxSpeed,delete this._autoScrollContainer,document.addEventListener("mousemove",this._mouseMove,{capture:true,passive:true}),document.addEventListener("mouseup",this._mouseUp,true),M$1&&(e.currentTarget.addEventListener("touchmove",he$2),e.currentTarget.addEventListener("touchend",ce$1)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),f.mouseHandled=true),true}_callDrag(e){if(!this.dragging)return;let t=h.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t);}_mouseMove(e){let t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),f.pauseDrag){let i=Number.isInteger(f.pauseDrag)?f.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i);}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=true,f.dragElement=this;let i=this.el.gridstackNode?.grid;i?f.dropElement=i.el.ddElement.ddDroppable:delete f.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=h.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);let s=h.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent);}return true}_mouseUp(e){if(this._stopScrolling(),document.removeEventListener("mousemove",this._mouseMove,true),document.removeEventListener("mouseup",this._mouseUp,true),M$1&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",he$2,true),e.currentTarget.removeEventListener("touchend",ce$1,true)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),f.dropElement?.el===this.el.parentElement&&delete f.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();let t=h.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),f.dropElement&&f.dropElement.drop(e);}delete this.helper,delete this.mouseDownEvent,delete f.dragElement,delete f.dropElement,delete f.mouseHandled,e.preventDefault();}_keyEvent(e){let t=this.el.gridstackNode,i=t?.grid||f.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!h.canBeRotated(t))return;t._origRotate=t._origRotate||G$b({},t._orig),delete t._moving,i.setAnimation(false).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetX}).setAnimation(),t._moving=true,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",h.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag);}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=h.cloneNode(this.el)),e.parentElement||h.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=l.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");let t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, right, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null);},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){let t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",l.originStyleProp.forEach(s=>t.style[s]=this.dragElementOriginStyle[s]||null),setTimeout(()=>t.style.transition=i,50);}return delete this.dragElementOriginStyle,this}_dragFollow(e){let t=this.helper.style,i=this.dragOffset;this.option.rtl?(t.right=(window.innerWidth-e.clientX+i.offsetX)*this.dragTransform.xScale+"px",t.left&&(t.left="")):(t.left=(e.clientX+i.offsetX)*this.dragTransform.xScale+"px",t.right&&(t.right="")),t.top=(e.clientY+i.offsetTop)*this.dragTransform.yScale+"px";}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let s=0,r=0;i&&(s=this.dragTransform.xOffset,r=this.dragTransform.yOffset);let n=t.getBoundingClientRect(),a=this.option.rtl?n.right:n.left,u=this.option.rtl?e.clientX-n.right+s:-e.clientX+n.left-s;return {x:a,top:n.top,offsetX:u,offsetTop:-e.clientY+n.top-r,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}updateScrollPosition(e){this._autoScrollContainer=h.getScrollElement(e),this._getClipping(this.helper,this._autoScrollContainer)===0?this._stopScrolling():this._autoScrollAnimId||(this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick));}_getClipping(e,t){let i=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight;if(i.bottom<s.top||i.top>s.bottom)return 0;let n=i.bottom-Math.min(s.bottom,r),a=i.top-Math.max(s.top,0);return a<0?a:n>0?n:0}_stopScrolling(){this._autoScrollAnimId&&(cancelAnimationFrame(this._autoScrollAnimId),delete this._autoScrollAnimId);}ui(){let t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect(),s=this.option.rtl?(t.right-i.right)*this.dragTransform.xScale:(i.left-t.left)*this.dragTransform.xScale;return {position:{top:(i.top-t.top)*this.dragTransform.yScale,left:s}}}}return l.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"],l})();var $e$2=class $e extends j$1{constructor(o,e={}){super(),this.el=o,this.option=e,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept();}on(o,e){super.on(o,e);}off(o){super.off(o);}enable(){this.disabled!==false&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),M$1&&(this.el.addEventListener("pointerenter",ot$3),this.el.addEventListener("pointerleave",nt$3)));}disable(o=false){this.disabled!==true&&(super.disable(),this.el.classList.remove("ui-droppable"),o||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),M$1&&(this.el.removeEventListener("pointerenter",ot$3),this.el.removeEventListener("pointerleave",nt$3)));}destroy(){this.disable(true),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy();}updateOption(o){return Object.keys(o).forEach(e=>this.option[e]=o[e]),this._setupAccept(),this}_mouseEnter(o){if(!f.dragElement||R$3.touchHandled&&o.isTrusted||!this._canDrop(f.dragElement.el))return;o.preventDefault(),o.stopPropagation(),f.dragElement._stopScrolling(),f.dropElement&&f.dropElement!==this&&f.dropElement._mouseLeave(o,true),f.dropElement=this;let e=h.initEvent(o,{target:this.el,type:"dropover"});this.option.over&&this.option.over(e,this._ui(f.dragElement)),this.triggerEvent("dropover",e),this.el.classList.add("ui-droppable-over");}_mouseLeave(o,e=false){if(!f.dragElement||f.dropElement!==this)return;o.preventDefault(),o.stopPropagation(),e&&f.dragElement._stopScrolling();let t=h.initEvent(o,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(t,this._ui(f.dragElement)),this.triggerEvent("dropout",t),f.dropElement===this&&(delete f.dropElement,!e)){let i,s=this.el.parentElement;for(;!i&&s;)i=s.ddElement?.ddDroppable,s=s.parentElement;i&&i._mouseEnter(o);}}drop(o){o.preventDefault();let e=h.initEvent(o,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(e,this._ui(f.dragElement)),this.triggerEvent("drop",e);}_canDrop(o){return o&&(!this.accept||this.accept(o))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=o=>o.classList.contains(this.option.accept)||o.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(o){return G$b({draggable:o.el},o.ui())}};var qe$2=class l{static init(o){return o.ddElement||(o.ddElement=new l(o)),o.ddElement}constructor(o){this.el=o;}on(o,e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(o)>-1?this.ddDraggable.on(o,e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(o)>-1?this.ddDroppable.on(o,e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(o)>-1&&this.ddResizable.on(o,e),this}off(o){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(o)>-1?this.ddDraggable.off(o):this.ddDroppable&&["drop","dropover","dropout"].indexOf(o)>-1?this.ddDroppable.off(o):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(o)>-1&&this.ddResizable.off(o),this}setupDraggable(o){return this.ddDraggable?this.ddDraggable.updateOption(o):this.ddDraggable=new qt$1(this.el,o),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(o){return this.ddResizable?this.ddResizable.updateOption(o):this.ddResizable=new $t$1(this.el,o),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(o){return this.ddDroppable?this.ddDroppable.updateOption(o):this.ddDroppable=new $e$2(this.el,o),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}};var Ve$2=class Ve{resizable(o,e,t,i){return this._getDDElements(o,e).forEach(s=>{if(e==="disable"||e==="enable")s.ddResizable&&s.ddResizable[e]();else if(e==="destroy")s.ddResizable&&s.cleanResizable();else if(e==="option")s.setupResizable({[t]:i});else {let n=s.el.gridstackNode.grid,a=s.el.getAttribute("gs-resize-handles")||n.opts.resizable.handles||"e,s,se";a==="all"&&(a="n,e,s,w,se,sw,ne,nw");let u=!n.opts.alwaysShowResizeHandle;s.setupResizable(z$5(G$b({},n.opts.resizable),{handles:a,autoHide:u,start:e.start,stop:e.stop,resize:e.resize,rtl:e.rtl}));}}),this}draggable(o,e,t,i){return this._getDDElements(o,e).forEach(s=>{if(e==="disable"||e==="enable")s.ddDraggable&&s.ddDraggable[e]();else if(e==="destroy")s.ddDraggable&&s.cleanDraggable();else if(e==="option")s.setupDraggable({[t]:i});else {let r=s.el.gridstackNode.grid;s.setupDraggable(z$5(G$b({},r.opts.draggable),{start:e.start,stop:e.stop,drag:e.drag,rtl:e.rtl}));}}),this}dragIn(o,e){return this._getDDElements(o).forEach(t=>t.setupDraggable(e)),this}droppable(o,e,t,i){return typeof e.accept=="function"&&!e._accept&&(e._accept=e.accept,e.accept=s=>e._accept(s)),this._getDDElements(o,e).forEach(s=>{e==="disable"||e==="enable"?s.ddDroppable&&s.ddDroppable[e]():e==="destroy"?s.ddDroppable&&s.cleanDroppable():e==="option"?s.setupDroppable({[t]:i}):s.setupDroppable(e);}),this}isDroppable(o){return !!(o?.ddElement?.ddDroppable&&!o.ddElement.ddDroppable.disabled)}isDraggable(o){return !!(o?.ddElement?.ddDraggable&&!o.ddElement.ddDraggable.disabled)}isResizable(o){return !!(o?.ddElement?.ddResizable&&!o.ddElement.ddResizable.disabled)}on(o,e,t){return this._getDDElements(o).forEach(i=>i.on(e,s=>{t(s,f.dragElement?f.dragElement.el:s.target,f.dragElement?f.dragElement.helper:null);})),this}off(o,e){return this._getDDElements(o).forEach(t=>t.off(e)),this}_getDDElements(o,e){let t=o.gridstack||e!=="destroy"&&e!=="disable",i=h.getElements(o);return i.length?i.map(r=>r.ddElement||(t?qe$2.init(r):null)).filter(r=>r):[]}};var O$2=new Ve$2,Y$1=(()=>{class l{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;let i=l.getGridElement(t);return i?(i.gridstack||(i.gridstack=new l(i,h.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
6694
+ `),ul$2(),Pi$5(188,"div",4)(189,"button",5),Qh("click",function(){return a.upgrade()}),TT(190,"Upgrade"),ul$2(),Pi$5(191,"button",6),Qh("click",function(){return a.startFresh()}),TT(192,"Start Fresh"),ul$2()());},dependencies:[Ht$6,Op,xp$1],styles:[".button-group[_ngcontent-%COMP%]{display:flex;justify-content:center}.nav-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;margin-bottom:2em}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .nav-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #bbb;padding:.5em 1em;text-align:center}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#ddd;color:#222;font-weight:700}.nav-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background:#242424}.warning[_ngcontent-%COMP%]{color:#b71c1c}.button-group[_ngcontent-%COMP%]{margin-top:2em;display:flex;gap:20px}"]})}return t})();var Qs$1=(t,s)=>s.id;function ec$1(t,s){if(t&1){let e=Fw();Pi$5(0,"div",2),Qh("click",function(){let a=ud(e).$implicit,c=qw();return dd(c.selectIcon(a.id))})("keydown.enter",function(){let a=ud(e).$implicit,c=qw();return dd(c.selectIcon(a.id))})("keydown.space",function(a){let c=ud(e).$implicit;return qw().selectIcon(c.id),dd(a.preventDefault())}),Pi$5(1,"div",3),$h(2,"mat-icon",4),ul$2()();}if(t&2){let e=s.$implicit,o=qw();sg("selected",o.selected()===e.id),Hh("aria-label","Select "+e.id+" icon"),EE(2),ig("width",64,"px")("height",64,"px"),Bh("svgIcon",e.id);}}var Fn$1=(()=>{class t{iconFile=Hj("assets/svg/icons.svg");currentIcon=Hj(void 0);selectedIcon=Vj();icons=vt$9([]);selected=vt$9("");constructor(){this.loadIcons(),Fa$5(()=>{let e=this.currentIcon();ge$5(()=>{e&&this.selected()!==e&&this.selected.set(e);});});}loadIcons(){return Zr$4(this,null,function*(){try{let o=yield (yield fetch(this.iconFile())).text(),d=new DOMParser().parseFromString(o,"image/svg+xml").querySelector("defs");if(!d)return;let u=d.querySelectorAll("svg"),v=[];u.forEach(S=>{let T=S.getAttribute("id");T&&T.startsWith("dashboard-")&&v.push({id:T});}),this.icons.set(v);let M=this.currentIcon();M&&this.selected.set(M);}catch(e){console.error("Error loading icons:",e);}})}selectIcon(e){this.selected.set(e),this.selectedIcon.emit(e);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["select-icon"]],inputs:{iconFile:[1,"iconFile"],currentIcon:[1,"currentIcon"]},outputs:{selectedIcon:"selectedIcon"},decls:3,vars:0,consts:[[1,"icon-grid"],["tabindex","0",1,"icon-item",3,"selected"],["tabindex","0",1,"icon-item",3,"click","keydown.enter","keydown.space"],[1,"icon-container"],["aria-hidden","false",3,"svgIcon"]],template:function(o,a){o&1&&(Pi$5(0,"div",0),xw(1,ec$1,3,8,"div",1,Qs$1),ul$2()),o&2&&(EE(),Aw(a.icons()));},dependencies:[yt$3,wt$3],styles:[".icon-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(80px,1fr));gap:16px;padding:16px;max-height:400px;overflow-y:auto}.icon-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:8px;border:2px solid transparent;border-radius:8px;cursor:pointer;transition:border-color .2s ease;background-color:var(--mat-sys-surface-container-low)}.icon-item[_ngcontent-%COMP%]:hover{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-item.selected[_ngcontent-%COMP%]{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px;background-color:var(--mat-sys-primary-container)}.icon-item[_ngcontent-%COMP%]:focus{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-container[_ngcontent-%COMP%]{width:64px;height:64px;display:flex;align-items:center;justify-content:center;overflow:hidden}.icon-container[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:100%;height:100%;fill:currentColor}"]})}return t})();function tc$1(t,s){if(t&1&&(Pi$5(0,"button",15),TT(1),ul$2()),t&2){let e=qw(),o=Jw(1);Bh("disabled",!o.valid),EE(),gg(e.data.confirmBtnText);}}var On$1=(()=>{class t{dialogRef=w$4(O$6);data=w$4($e$8);_settings=w$4(Gi$3);isSplitShellEnabled=vt$9(true);constructor(){this.data.icon||(this.data.icon="dashboard-dashboard"),this.isSplitShellEnabled.set(this._settings.getSplitShellEnabled());}save(){this.dialogRef.close(this.data);}onIconSelected(e){this.data.icon=e;}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["dialog-dashboard-page-editor"]],decls:27,vars:10,consts:[["name","ngForm"],["name","name",3,"ngSubmit"],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"field-wrapper","field-margin"],[1,"field-flex"],["matInput","","type","text","id","name","placeholder","Name","name","name","required","","cdkFocusInitial","",3,"ngModelChange","ngModel"],["placeholder","collapseSplitShell","name","collapseSplitShell",1,"field-flex",3,"ngModelChange","ngModel","disabled"],[1,"field-margin","icon-section"],[2,"font-size","1.2em"],[1,"icon-selector"],[3,"selectedIcon","iconFile","currentIcon"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"]],template:function(o,a){if(o&1){let c=Fw();Pi$5(0,"form",1,0),Qh("ngSubmit",function(){return a.save()}),Pi$5(2,"div",2)(3,"h5",3),TT(4),ul$2(),Pi$5(5,"button",4)(6,"mat-icon"),TT(7,"close"),ul$2()()(),Pi$5(8,"mat-dialog-content")(9,"div",5)(10,"mat-form-field",6)(11,"mat-label"),TT(12,"Display Name"),ul$2(),Pi$5(13,"input",7),Eg("ngModelChange",function(u){return ud(c),ST(a.data.name,u)||(a.data.name=u),dd(u)}),ul$2(),cD(),Pi$5(14,"mat-error"),TT(15," A name is required "),ul$2()(),Pi$5(16,"mat-checkbox",8),Eg("ngModelChange",function(u){return ud(c),ST(a.data.collapseSplitShell,u)||(a.data.collapseSplitShell=u),dd(u)}),TT(17," Auto-collapse Freeboard-SK panel when displaying this dashboard. "),ul$2(),cD(),ul$2(),Pi$5(18,"div",9)(19,"span",10),TT(20,"Icon Gallery"),ul$2(),Pi$5(21,"div",11)(22,"select-icon",12),Qh("selectedIcon",function(u){return a.onIconSelected(u)}),ul$2()()()(),Pi$5(23,"mat-dialog-actions",13)(24,"button",14),TT(25),ul$2(),_w(26,tc$1,2,2,"button",15),ul$2()();}o&2&&(EE(4),gg(a.data.title),EE(),Bh("mat-dialog-close",false),EE(8),Ig("ngModel",a.data.name),lD(),EE(3),Ig("ngModel",a.data.collapseSplitShell),Bh("disabled",!a.isSplitShellEnabled()),lD(),EE(6),Bh("iconFile","assets/svg/icons.svg")("currentIcon",a.data.icon),EE(2),Bh("mat-dialog-close",false),EE(),gg(a.data.cancelBtnText),EE(),Mw(a.data.confirmBtnText?26:-1));},dependencies:[Ht$6,jt$7,Nt$8,zt$6,Vt$6,yt$3,wt$3,ce$4,rt$7,ae$3,It$4,ln$4,an$4,Op,xp$1,eu,Ln$3,Gn$4,Xe$5,Pn$5,kn$5,ft$6,rn$3,Qt$6,Fn$1,Jn$4,Kt$3],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.field-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;align-content:center}.field-margin[_ngcontent-%COMP%]{margin-left:15px;margin-bottom:15px}.field-flex[_ngcontent-%COMP%]{flex:auto}.icon-selector[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-outline);border-radius:4px}.icon-section[_ngcontent-%COMP%] .mat-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:var(--mat-sys-on-surface);font-size:14px;font-weight:400}"]})}return t})();var Ff=(()=>{class t{dialog=w$4(ee$7);openFrameDialog(e,o){switch(e.component){case "select-widget":e.componentType=Dn$1;break;case "upgrade-config":e.componentType=In$2;break;case "ais-target":e.componentType=cn$1;break}return this.dialog.open(Ci$3,{data:e,height:o?"calc(100% - 30px)":"",width:o?"calc(100% - 30px)":"",maxWidth:o?"100%":"",maxHeight:o?"100%":""}).afterClosed()}openAisDetailDialog(e){return this.dialog.open(Ci$3,{panelClass:"ais-dialog-panel",data:e,height:"",width:"",maxWidth:"",maxHeight:""}).afterClosed()}openConfirmationDialog(e){return this.dialog.open(dn$2,{data:e,minWidth:"35vw",minHeight:"25vh"}).afterClosed()}openNameDialog(e){return this.dialog.open(mn$2,{data:e,minWidth:"20vw",minHeight:"20vh",disableClose:false})}openDashboardPageEditorDialog(e){return this.dialog.open(On$1,{data:e,minWidth:"60vw",maxWidth:"90vw",maxHeight:"95vh",disableClose:false})}openWidgetOptions(e){return this.dialog.open(kn$2,{data:e.config,minWidth:"50vw",maxWidth:"90vw",closeOnNavigation:true})}openWidgetHistoryDialog(e){return Zr$4(this,null,function*(){let{WidgetHistoryChartDialogComponent:o}=yield import('./chunk-BuvyF0y5.js');return this.dialog.open(o,{data:e,minWidth:"70vw",maxWidth:"95vw",maxHeight:"95vh",disableClose:false})})}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var S=(()=>{class i{dataset=w$4(K$3);syncDataChartDataset(e,t,a){let r=typeof t?.datachartPath=="string"?t.datachartPath.trim():"";if(!r)return;let o=typeof t?.datachartSource=="string"&&t.datachartSource.trim().length>0?t.datachartSource.trim():"default",s=t?.timeScale,h=Number(t?.period??0),f=a??"";this.upsertDataset({uuid:e,path:r,source:o,timeScale:s,period:h,label:f,serialize:true,editable:false});}syncNumericMiniChartDataset(e,t,a){let r=typeof t=="string"?t.trim():"";if(!r)return;let o=typeof a=="string"&&a.trim().length>0?a.trim():"default";this.upsertDataset({uuid:e,path:r,source:o,timeScale:"minute",period:.2,label:`simple-chart-${e}`,serialize:false,editable:false});}syncWindTrendsDatasets(e,t){!t||String(t).trim().length===0||(this.upsertDataset({uuid:`${e}-twd`,path:"self.environment.wind.directionTrue",source:"default",timeScale:t,period:30,label:`windtrends-${e}`,serialize:true,editable:false}),this.upsertDataset({uuid:`${e}-tws`,path:"self.environment.wind.speedTrue",source:"default",timeScale:t,period:30,label:`speedtrends-${e}`,serialize:true,editable:false}));}removeDatasetIfExists(e,t=false){this.dataset.removeIfExists(e,t);}removeOwnedDatasets(e,t=true){let a=typeof e=="string"?e.trim():"";if(!a)return;this.dataset.list().filter(s=>s.uuid===a||s.uuid?.startsWith(`${a}-`)).forEach(s=>{this.dataset.removeIfExists(s.uuid,t);});}upsertDataset(e){let t=this.dataset.getDatasetConfig(e.uuid);if(!t){this.dataset.create(e.path,e.source,e.timeScale,e.period,e.label,e.serialize,e.editable,e.uuid);return}if(!(t.path!==e.path||t.pathSource!==e.source||t.timeScaleFormat!==e.timeScale||t.period!==e.period||t.label!==e.label))return;let r=z$5(G$b({},t),{path:e.path,pathSource:e.source,timeScaleFormat:e.timeScale,period:e.period,label:e.label,editable:e.editable});this.dataset.edit(r,e.serialize);}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Q$6({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var R$4=(()=>{class c{DEFAULT_FONT="Roboto";EDGE_BUFFER=10;debug=false;scaleFactor=window.devicePixelRatio||1;fontsReadyPromise;sharedResizeObserver=null;observedCanvases=new Map;dprMediaQuery=null;resizeCallbacks=new WeakMap;pendingResize=new Map;resizeRafId=null;_fontSizeCache=new Map;static FONT_SIZE_CACHE_LIMIT=600;constructor(){this.fontsReadyPromise=this.createFontsReadyPromise(),this.fontsReadyPromise.then(()=>this._fontSizeCache.clear()).catch(()=>this._fontSizeCache.clear());}getDocumentFonts(){return typeof document<"u"&&"fonts"in document?document.fonts:null}createFontsReadyPromise(){let e=this.getDocumentFonts();return e?e.ready.then(()=>{}):Promise.resolve()}areFontsLoaded(){let e=this.getDocumentFonts();return !e||e.status==="loaded"}registerCanvas(e,t={}){if(t=G$b({autoRelease:true},t),!e)return;e.style.width="100%",e.style.height="100%";let s=t.onResize;if(s){let r=(n,a)=>{n===0||a===0||s(n,a);};this.resizeCallbacks.set(e,r);}this.sharedResizeObserver||(this.debug&&console.log("[CanvasService] Creating shared ResizeObserver for all canvases"),this.sharedResizeObserver=new ResizeObserver(r=>{for(let n of r)this.pendingResize.set(n.target,n.contentRect);this.scheduleResizeFlush();})),this.sharedResizeObserver.observe(e),this.debug&&console.log("[CanvasService] Started observing canvas (shared observer)",{tag:e.tagName,id:e.id,class:e.className,selector:e.getAttribute("ng-reflect-ng-if")||"",parent:e.parentElement?{tag:e.parentElement.tagName,class:e.parentElement.className,id:e.parentElement.id}:null}),this.observedCanvases.set(e,t||{}),this.setHighDPISize(e,e.getBoundingClientRect());let i=this.resizeCallbacks.get(e);if(i){let r=e.getBoundingClientRect();i(Math.round(r.width),Math.round(r.height));}}unregisterCanvas(e){if(!e||!this.observedCanvases.has(e))return;this.sharedResizeObserver&&(this.sharedResizeObserver.unobserve(e),this.observedCanvases.size<=1&&(this.sharedResizeObserver.disconnect(),this.sharedResizeObserver=null,this.debug&&console.log("[CanvasService] Shared ResizeObserver disconnected (no canvases left)"))),this.resizeCallbacks.delete(e),this.observedCanvases.get(e)?.autoRelease&&this.releaseCanvas(e,{clear:true,removeFromDom:true}),this.observedCanvases.delete(e),this.observedCanvases.size===0&&this.cleanupDPRListener();}onDPRChange=()=>{let e=window.devicePixelRatio||1;e!==this.scaleFactor&&(this.scaleFactor=e,this.observedCanvases.forEach((t,s)=>{try{this.setHighDPISize(s,s.getBoundingClientRect());}catch(i){console.warn("[CanvasService] onDPRChange failed for canvas",i);}}),this.cleanupDPRListener(),this.setupDPRListener());};setupDPRListener(){try{this.cleanupDPRListener();let e=`(resolution: ${window.devicePixelRatio||1}dppx)`;this.dprMediaQuery=window.matchMedia(e),this.dprMediaQuery&&((s,i)=>{"addEventListener"in s?s.addEventListener("change",i):"addListener"in s&&s.addListener(i);})(this.dprMediaQuery,this.onDPRChange);}catch(e){console.warn("[CanvasService] setupDPRListener failed",e);}}cleanupDPRListener(){if(this.dprMediaQuery){try{((t,s)=>{"removeEventListener"in t?t.removeEventListener("change",s):"removeListener"in t&&t.removeListener(s);})(this.dprMediaQuery,this.onDPRChange);}catch(e){}this.dprMediaQuery=null;}}scheduleResizeFlush(){this.resizeRafId===null&&(this.resizeRafId=requestAnimationFrame(()=>this.flushResizes()));}flushResizes(){this.resizeRafId=null;let e=8,t=performance.now();for(let[s,i]of this.pendingResize){this.pendingResize.delete(s),this.setHighDPISize(s,i);let r=this.resizeCallbacks.get(s);if(r&&r(Math.round(i.width),Math.round(i.height)),this.pendingResize.size>0&&performance.now()-t>e){this.scheduleResizeFlush();return}}}setHighDPISize(e,t){let s=Math.round(t.width),i=Math.round(t.height),r=Math.round(s*this.scaleFactor),n=Math.round(i*this.scaleFactor);if(!(e.width===r&&e.height===n)){e.width=r,e.height=n,e.style.width=`${s}px`,e.style.height=`${i}px`;try{let a=e.getContext("2d");a&&(a.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),a.clearRect(0,0,e.width,e.height));}catch(a){console.warn("[CanvasService] setHighDPISize: failed to set context transform",a);}}}drawTitle(e,t,s,i="normal",r,n,a=.1){if(!e)return;let o=()=>{let h=false;try{let l=e;if(typeof l.getTransform=="function"){let d=l.getTransform(),f=d&&d.a?d.a:1;Math.abs(f-this.scaleFactor)>1e-6&&(e.save(),e.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),h=!0);}else try{e.save(),e.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),h=!0;}catch(d){}this.drawTitleInternal(e,t,s,i,r,n,a),h&&e.restore();}catch(l){console.warn("[CanvasService] drawTitle failed",l);try{this.drawTitleInternal(e,t,s,i,r,n,a);}catch(d){}}};this.areFontsLoaded()?this.fontsReadyPromise.then(()=>requestAnimationFrame(o)).catch(()=>requestAnimationFrame(o)):this.fontsReadyPromise.then(()=>requestAnimationFrame(o)).catch(h=>{console.warn(`[CanvasService] Font readiness failed: ${h}`),requestAnimationFrame(o);});}drawTitleInternal(e,t,s,i="normal",r,n,a){if(!e)return;let o=r-2*this.EDGE_BUFFER,h=Math.round(n*a),l=this.calculateOptimalFontSize(e,t,o,h,i);e.clearRect(0,0,r,n),e.font=`${i} ${l}px ${this.DEFAULT_FONT}`,e.fillStyle=s,e.textAlign="left",e.textBaseline="top",e.fillText(t,this.EDGE_BUFFER,this.EDGE_BUFFER,o);}clearCanvas(e,t,s){e.clearRect(0,0,t,s);}drawText(e,t,s=this.EDGE_BUFFER,i=this.EDGE_BUFFER,r,n,a="normal",o="#000",h="center",l="middle"){if(!e)return;let d=()=>{try{e.save(),e.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),this.drawTextInternal(e,t,s,i,r,n,a,o,h,l);}finally{try{e.restore();}catch(f){}}};this.areFontsLoaded()?d():this.fontsReadyPromise.then(d).catch(f=>{console.warn(`[Canvas Service] Font readiness failed: ${f}`),d();});}drawTextInternal(e,t,s=this.EDGE_BUFFER,i=this.EDGE_BUFFER,r,n,a="normal",o="#000",h="center",l="middle"){let d=this.calculateOptimalFontSize(e,t,r,n,a);e.font=`${a} ${d}px ${this.DEFAULT_FONT}`,e.fillStyle=o,e.textAlign=h,e.textBaseline=l,e.fillText(t,s,i,r);}calculateOptimalFontSize(e,t,s,i,r="normal"){let n=`${r}|${Math.round(s)}|${Math.round(i)}|${t}`,a=this._fontSizeCache.get(n);if(a!==void 0)return a;let o=1,h=i,l=h;for(;o<=h;)l=Math.round((o+h)/2),e.font=`${r} ${l}px ${this.DEFAULT_FONT}`,e.measureText(t).width>s?h=l-1:o=l+1;return this._fontSizeCache.size>=c.FONT_SIZE_CACHE_LIMIT&&this._fontSizeCache.clear(),this._fontSizeCache.set(n,h),h}createTitleBitmap(e,t,s,i,r,n=.1){let a=document.createElement("canvas");a.width=Math.round(i*this.scaleFactor),a.height=Math.round(r*this.scaleFactor),a.style.width=`${i}px`,a.style.height=`${r}px`;let o=a.getContext("2d");return o&&(o.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),this.drawTitleInternal(o,e,t,s,i,r,n),this.areFontsLoaded()||this.fontsReadyPromise.then(()=>{try{o.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),this.drawTitleInternal(o,e,t,s,i,r,n);}catch(h){}}).catch(()=>{})),a}renderStaticToBitmap(e,t,s,i){let r=document.createElement("canvas");r.width=t*this.scaleFactor,r.height=s*this.scaleFactor;let n=r.getContext("2d");return n&&(n.setTransform(this.scaleFactor,0,0,this.scaleFactor,0,0),i(n)),r}drawRectangle(e,t,s,i,r,n){e.fillStyle=n,e.fillRect(t,s,i,r);}releaseCanvas(e,t={removeFromDom:true,clear:true}){if(!e)return;let{removeFromDom:s=true,clear:i=true}=t;try{let r=e.getContext("2d");i&&r&&r.clearRect(0,0,e.width,e.height),e.width=0,e.height=0,s&&e.parentNode&&e.parentNode.removeChild(e);}catch(r){console.warn("[CanvasService] releaseCanvas failed",r);}}releaseCanvases(e,t){e.forEach(s=>this.releaseCanvas(s,t));}static \u0275fac=function(t){return new(t||c)};static \u0275prov=Q$6({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})();var u$1=["canvas"],x$2=(()=>{class i{text=Hj.required();color=Hj.required();canvasRef=$j.required("canvas");canvas=w$4(R$4);canvasElement=null;canvasCtx=null;isReady=false;cssWidth=0;cssHeight=0;constructor(){}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvasCtx&&(this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,this.drawTitle();}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.isReady=true,this.drawTitle());}ngOnChanges(t){(t.text||t.color)&&this.drawTitle();}drawTitle(){!this.isReady||!this.canvasCtx||this.canvas.drawTitle(this.canvasCtx,this.text(),this.color(),"normal",this.cssWidth,this.cssHeight);}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement);}catch(t){}this.canvasCtx=null,this.canvasElement=null;}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=JD({type:i,selectors:[["widget-title"]],viewQuery:function(e,s){e&1&&eg(s.canvasRef,u$1,5),e&2&&Kw();},inputs:{text:[1,"text"],color:[1,"color"]},features:[lv],decls:3,vars:0,consts:[["canvas",""],[1,"title-wrapper"],[1,"title-canvas"]],template:function(e,s){e&1&&(dl$2(0,"div",1),Uh(1,"canvas",2,0),fl$2());},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;z-index:10}.title-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.title-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}"]})}return i})();function K$1(e,C){if(e&1&&(Pi$5(0,"mat-icon",1),TT(1),ul$2()),e&2){let t=qw();EE(),gg(t.icon());}}function L$1(e,C){if(e&1&&(Pi$5(0,"div",3),TT(1),ul$2()),e&2){let t=qw();EE(),gg(t.title());}}function $$1(e,C){if(e&1){let t=Fw();Pi$5(0,"div",5)(1,"button",7),Qh("click",function(){ud(t);let n=qw();return dd(n.onActionClick())}),TT(2),ul$2(),Pi$5(3,"button",7),Qh("click",function(){ud(t);let n=qw();return dd(n.dismiss())}),TT(4,"Cancel"),ul$2()();}if(e&2){let t=qw();EE(2),gg(t.data.action);}}function q(e,C){if(e&1){let t=Fw();Pi$5(0,"div",6)(1,"button",8),Qh("click",function(){ud(t);let n=qw();return dd(n.dismiss())}),Pi$5(2,"mat-icon"),TT(3,"close"),ul$2()()();}}var x$1=(()=>{class e{ref=w$4(P$4);data=w$4(Ye$3);severity=Dt$9(()=>this.data.severity??"message");hasAction=Dt$9(()=>!!this.data.action);title=Dt$9(()=>this.data.title??this.titleForSeverity(this.severity()));icon=Dt$9(()=>this.iconForSeverity(this.severity()));hostClass=Dt$9(()=>`toast-${this.severity()}`);onActionClick(){this.ref.dismissWithAction();}dismiss(){this.ref.dismiss();}titleForSeverity(t){switch(t){case "success":return "Success";case "warn":return "Warning";case "error":return "Error";case "info":return "Info";default:return "Message"}}iconForSeverity(t){switch(t){case "success":return "check";case "warn":return "warning";case "error":return "error";case "info":return "info";default:return "message"}}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=JD({type:e,selectors:[["toast-snackbar"]],hostVars:2,hostBindings:function(o,n){o&2&&pT(n.hostClass());},decls:8,vars:6,consts:[[1,"toast"],[1,"icon"],[1,"toast-body"],[1,"toast-title"],["matSnackBarLabel",""],[1,"button-group"],["matSnackBarActions","",1,"toast-body"],["matButton","tonal","matSnackBarAction","",3,"click"],["matIconButton","","matSnackBarAction","","aria-label","Dismiss notification",1,"toast-close",3,"click"]],template:function(o,n){o&1&&(Pi$5(0,"section",0),_w(1,K$1,2,1,"mat-icon",1),Pi$5(2,"div",2),_w(3,L$1,2,1,"div",3),Pi$5(4,"div",4),TT(5),ul$2(),_w(6,$$1,5,1,"div",5),ul$2(),_w(7,q,4,0,"div",6),ul$2()),o&2&&(Hh("data-severity",n.severity()),EE(),Mw(n.severity()!=="message"?1:-1),EE(2),Mw(n.severity()!=="message"?3:-1),EE(2),gg(n.data.message),EE(),Mw(n.hasAction()?6:-1),EE(),Mw(n.hasAction()?-1:7));},dependencies:[Op,xp$1,eu,yt$3,wt$3],styles:["[_nghost-%COMP%]{display:block;width:100%}.toast[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:flex-start;gap:10px}.toast[data-severity=message][_ngcontent-%COMP%]{align-items:center}.toast[data-severity=info][_ngcontent-%COMP%]{--toast-color: var(--mat-sys-inverse-primary)}.toast[data-severity=warn][_ngcontent-%COMP%]{--toast-color: var(--mat-sys-tertiary)}.toast[data-severity=error][_ngcontent-%COMP%]{--toast-color: var(--mat-sys-error-container)}.toast[data-severity=success][_ngcontent-%COMP%]{--toast-color: var(--kip-starboard-color)}.toast[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{display:inline-flex;width:36px;height:36px;font-size:36px;flex:0 0 auto;align-items:center;justify-content:center;--mat-icon-color: var(--toast-color)}.toast-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;gap:2px;flex:1 1 auto;min-width:0}.toast-title[_ngcontent-%COMP%]{font-weight:600;font-size:15px}.button-group[_ngcontent-%COMP%]{margin-top:10px;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-end;gap:8px}.toast-action[_ngcontent-%COMP%]{--mat-button-text-label-text-color: var(--mat-sys-primary)}.toast-close[_ngcontent-%COMP%]{align-self:flex-end;--mat-icon-button-icon-color: var(--mat-sys-inverse-on-surface);--mat-icon-button-icon-size: 32px}.toast-close[_ngcontent-%COMP%] icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}"]})}return e})();var lt$3=(()=>{class e{snackBar=w$4(et$4);app=w$4(Gi$3);soundDisabled=Wp(this.app.getNotificationServiceConfigAsO().pipe(ke$3(t=>t.sound.disableSound)),{initialValue:this.app.getNotificationConfig().sound.disableSound});toastAudio=null;audioBlockedNotificationShown=false;lastSnack=vt$9(null);show(t,o=1500,n=true,b="message",h){let z={message:t,duration:o,silent:n,action:h,severity:b},R={message:t,action:h,severity:b},k=this.snackBar.openFromComponent(x$1,{duration:o,verticalPosition:"top",data:R});return this.lastSnack.set(z),n||this.soundDisabled()||(this.toastAudio||(this.toastAudio=new Audio("assets/notification.mp3"),this.toastAudio.preload="auto",this.toastAudio.volume=.3),this.toastAudio.currentTime=0,this.toastAudio.play().catch(W=>{console.debug("Toast audio playback blocked:",W.message),this.audioBlockedNotificationShown||(this.audioBlockedNotificationShown=true,this.snackBar.openFromComponent(x$1,{duration:0,verticalPosition:"top",data:{message:"Sound notifications blocked by browser. Closing this message will enable audio.",severity:"warn"}}).afterDismissed().subscribe(()=>{this.audioBlockedNotificationShown=false;}));})),k}static \u0275fac=function(o){return new(o||e)};static \u0275prov=Q$6({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var k=[{id:"",name:"Dashboard 1",icon:"dashboard-dashboard",configuration:[{w:24,h:24,id:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc",selector:"widget-host2",input:{widgetProperties:{type:"widget-tutorial",uuid:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc"}},x:0,y:0}],collapseSplitShell:false}];var G$2=(()=>{class n{_settings=w$4(Gi$3);_router=w$4(G$3);_destroyRef=w$4(xe$3);dashboards=vt$9([],{equal:ln$3});activeDashboard=vt$9(null);_widgetAction=new Bn$5(null);widgetAction$=this._widgetAction.asObservable();isDashboardStatic=vt$9(true);widgetClipboard=vt$9(null);layoutEditSaved=vt$9(0);layoutEditCanceled=vt$9(0);constructor(){let t=this._settings.getDashboardConfig();if(!t||t.length===0){console.warn("[Dashboard Service] No dashboards found in settings, creating blank dashboard");let e=k.map(i=>z$5(G$b({},i),{id:b.create()}));this.dashboards.set([...e]);}else this.dashboards.set(t);this.applyDashboardParam(this.getRouteParam("id"),false);let a=this._router.events.pipe(fn$7(e=>e instanceof $$2),Du({bufferSize:1,refCount:true}),Gp(this._destroyRef));a.pipe(_t$9(1),ke$3(()=>this.getRouteParam("id"))).subscribe(e=>this.applyDashboardParam(e,true)),a.pipe(wu(1),ke$3(()=>this.getRouteParam("id")),Gl$2()).subscribe(e=>this.applyDashboardParam(e,false)),Fa$5(()=>{let e=this.dashboards();ge$5(()=>{this._settings.saveDashboards(e);});});}getRouteParam(t){let a=this._router.routerState.snapshot.root;for(;a;){if(a.paramMap.has(t))return a.paramMap.get(t);a=a.firstChild??null;}return null}applyDashboardParam(t,a){if(t===null||t===""){a&&this.setActiveDashboardIndex(0);return}let e=Number(t);if(Number.isNaN(e)){a&&this.setActiveDashboardIndex(0);return}this.setActiveDashboardIndex(e);}setActiveDashboardIndex(t){t!==this.activeDashboard()&&(t>=0&&t<this.dashboards().length?this.activeDashboard.set(t):console.error(`[Dashboard Service] Invalid dashboard ID: ${t}`));}toggleStaticDashboard(){this.isDashboardStatic.set(!this.isDashboardStatic());}add(t,a,e,i){let r=0;return this.dashboards.update(s=>{let d=[...s,{id:b.create(),name:t,icon:e??"dashboard-dashboard",configuration:a,collapseSplitShell:i??false}];return r=d.length-1,d}),r}update(t,a,e,i){this.dashboards.update(r=>r.map((s,d)=>d===t?z$5(G$b({},s),{name:a,icon:e??"dashboard-dashboard",collapseSplitShell:i??false}):s));}delete(t){this.dashboards.update(a=>a.filter((e,i)=>i!==t)),this.dashboards().length===0?(this.add("Dashboard "+(this.dashboards().length+1),[]),this.activeDashboard.set(0)):(this.activeDashboard()??-1)>this.dashboards().length-1&&this.activeDashboard.set(this.dashboards().length-1);}duplicate(t,a,e,i){if(t<0||t>=this.dashboards().length)return console.error(`[Dashboard Service] Invalid itemIndex: ${t}`),-1;let r=this.dashboards()[t],s=dp(r);s.id=b.create(),s.name=a,s.icon=e||"dashboard-dashboard",s.collapseSplitShell=i??false,Array.isArray(s.configuration)?s.configuration.forEach(o=>{o&&o.input?.widgetProperties?(o.id=b.create(),o.input.widgetProperties.uuid=o.id):console.error("Dashboard Service] Widget configuration is missing required properties:",o);}):(console.error("Dashboard Service] Dashboard configuration is not an array:",s.configuration),s.configuration=[]);let d=-1;return this.dashboards.update(o=>{let D=[...o,s];return d=D.length-1,D}),d}updateConfiguration(t,a){let e=dp(a??[]);this.dashboards.update(i=>i.map((r,s)=>s===t?ln$3(r.configuration,e)?r:z$5(G$b({},r),{configuration:e}):r));}previousDashboard(){let t=this.activeDashboard();if(t===null){this.activeDashboard.set(0);return}t+1>this.dashboards().length-1?this.activeDashboard.set(0):this.activeDashboard.set(t+1);}nextDashboard(){let t=this.activeDashboard();if(t===null){this.activeDashboard.set(0);return}t-1<0?this.activeDashboard.set(this.dashboards().length-1):this.activeDashboard.set(t-1);}navigateToActive(){this._router.navigate(["/dashboard",this.activeDashboard()]);}navigateTo(t){t>=0&&t<this.dashboards().length?this._router.navigate(["/dashboard",t]):console.error(`[Dashboard Service] Invalid dashboard ID: ${t}`);}navigateToNextDashboard(){let t=this.activeDashboard()??0,a=0;t-1<0?a=this.dashboards().length-1:a=t-1,this._router.navigate(["/dashboard",a]);}navigateToPreviousDashboard(){let t=this.activeDashboard()??0,a=0;t+1>=this.dashboards().length?a=0:a=t+1,this._router.navigate(["/dashboard",a]);}deleteWidget(t){this._widgetAction.next({id:t,operation:"delete"});}duplicateWidget(t){this._widgetAction.next({id:t,operation:"duplicate"});}copyWidget(t){this._widgetAction.next({id:t,operation:"copy"});}cutWidget(t){this._widgetAction.next({id:t,operation:"cut"});}setWidgetClipboardFromNode(t){let a=t?.input?.widgetProperties,e=a?.type;e&&this.widgetClipboard.set({w:t.w,h:t.h,selector:t.selector,input:{widgetProperties:{type:e,uuid:"clipboard",config:dp(a.config)}}});}clearWidgetClipboard(){this.widgetClipboard.set(null);}setStaticDashboard(t){this.isDashboardStatic.set(t);}notifyLayoutEditSaved(){this.layoutEditSaved.update(t=>t+1);}notifyLayoutEditCanceled(){this.layoutEditCanceled.update(t=>t+1);}static \u0275fac=function(a){return new(a||n)};static \u0275prov=Q$6({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var _=(()=>{class n{resolvePathConfig(e,t){let i=e.paths;if(!i)return;if(Array.isArray(i)){if(typeof t=="string"){let r=i.find(c=>typeof c.pathID=="string"&&c.pathID.trim()===t);if(r)return r;let u=Number(t);if(Number.isInteger(u)&&u>=0)return i[u]}return i[0]}let s=t??Object.keys(i)[0];return s?i[s]:void 0}metaWidget=Hj();dataService=w$4(De$2);destroyRef=w$4(xe$3);_metaConfig=vt$9(void 0);_meta=vt$9(null);reset$=new te$9;currentSub;pathSignature;zones=Dt$9(()=>this._meta()?.zones||[]);possibleValues=Dt$9(()=>this._meta()?.possibleValues||[]);supportsPut=Dt$9(()=>this._meta()?.supportsPut||false);observe(e){let t=this._metaConfig();if(!t?.paths)return;let s=this.resolvePathConfig(t,e)?.path;if(!s)return;let r=s;this.pathSignature!==r&&(this.pathSignature=r,this.subscribePathMeta(s));}subscribePathMeta(e){this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0);let t=this.dataService.getPathMetaObservable(e).pipe(bu(this.reset$),Gp(this.destroyRef)).subscribe(i=>{this._meta.set(i);});this.currentSub=t;}setMetaConfig(e){this._metaConfig.set(e);}applyMetaConfigDiff(e){this._metaConfig.set(e),this.pathSignature&&this.observe();}reset(){this.reset$.next(),this.reset$.complete(),this.reset$=new te$9,this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0),this.pathSignature=void 0,this._meta.set(null);}static \u0275fac=function(t){return new(t||n)};static \u0275dir=nw({type:n,selectors:[["","widget-metadata",""]],inputs:{metaWidget:[1,"metaWidget"]},exportAs:["widgetMetadata"]})}return n})();var rt$3=(()=>{class g{_streamsConfig=vt$9(void 0);dataService=w$4(De$2);unitsService=w$4(ut$2);destroyRef=w$4(xe$3);streams;registrations=[];subscriptions=new Map;baseSignatures=new Map;reset$=new te$9;rootSignature;buildObserver(t,e){return {next:r=>e(r),error:r=>console.error("[Widget] Observer got an error: "+r),complete:()=>{}}}computePathSignature(t){let e=this.normalizePath(t.path)??"",r=t.source?.trim()||"default";return [e,t.pathType??"",t.sampleTime,t.convertUnitTo,r,t.suppressBootstrapNull?"1":"0"].join("|")}computeBaseKey(t,e){let r=this.normalizePath(t)??"",i=e?.trim()||"default";return `${r}|${i}`}normalizePath(t){if(typeof t!="string")return;let e=t.trim();return e.length?e:void 0}computeRootSignature(t){return t?`timeout:${t.enableTimeout?"1":"0"}:${t.dataTimeout??""}`:"none"}getPathKeys(t){return t?Array.isArray(t)?t.map((e,r)=>(typeof e.pathID=="string"?e.pathID.trim():"")||String(r)):Object.keys(t):[]}getPathConfig(t,e){if(t){if(Array.isArray(t)){let r=t.find(o=>typeof o.pathID=="string"&&o.pathID.trim()===e);if(r)return r;let i=Number(e);return Number.isInteger(i)&&i>=0?t[i]:void 0}return t[e]}}ensureStreamsMap(){this.streams||(this.streams=new Map);}buildAndSubscribe(t,e,r,i){let o=this.normalizePath(i.path);if(!o){let u=this.subscriptions.get(t);u&&u.sub.unsubscribe(),this.subscriptions.delete(t),this.streams?.delete(t),this.baseSignatures.delete(t);return}this.ensureStreamsMap();let l=this.computeBaseKey(o,i.source),b=this.baseSignatures.get(t);(!this.streams.has(t)||b!==l)&&(this.streams.set(t,this.dataService.subscribePath(o,i.source?.trim()||"default")),this.baseSignatures.set(t,l));let m=this.streams.get(t),s=!!r.enableTimeout,n=(r.dataTimeout??5)*1e3,c=5e3,p=`[Widget] ${r.displayName} - ${n/1e3} second data update timeout reached for `,P=`[Widget] ${r.displayName} - Retrying in ${c/1e3} seconds`,d=i.pathType??"",h=i.convertUnitTo,T=!!i.suppressBootstrapNull,f=Number(i.sampleTime);(!Number.isFinite(f)||f<=0)&&(f=1e3);let q=u=>h?this.unitsService.convertToUnit(h,u):u,a=m;if(T){let u=false;a=a.pipe(fn$7(X=>(X?.data?.value!=null&&(u=true),u)));}let G=a.pipe(_t$9(1)),H=a.pipe(ny(f));a=zm(G,H),d==="number"&&(a=a.pipe(ke$3(u=>({data:{value:u.data.value==null?null:q(u.data.value),timestamp:u.data.timestamp},state:u.state})))),s&&(a=a.pipe(Sm({each:n,with:()=>bm(()=>{console.log(p+o),this.dataService.timeoutPathObservable(o,d);})}),ty(u=>u.pipe(Cu(()=>console.log(P)),wo$4(()=>We$9(c))))));let J=this.buildObserver(t,e),L=a.pipe(bu(this.reset$),Gp(this.destroyRef)).subscribe(J),Q=z$5(G$b({},i),{path:o}),V=this.computePathSignature(Q),z=this.subscriptions.get(t);z&&z.sub.unsubscribe(),this.subscriptions.set(t,{sub:L,signature:V});}setStreamsConfig(t){this._streamsConfig.set(t),this.rootSignature=this.computeRootSignature(t);}applyStreamsConfigDiff(t){let e=this._streamsConfig(),r=this.rootSignature,i=this.computeRootSignature(t);if(this._streamsConfig.set(t),this.rootSignature=i,!e||!e.paths||!this.getPathKeys(e.paths).length)return;if(!t||!t.paths){this.subscriptions.forEach(s=>s.sub.unsubscribe()),this.subscriptions.clear(),this.streams=void 0,this.baseSignatures.clear(),this.registrations=[];return}let o=this.getPathKeys(e.paths),l=this.getPathKeys(t.paths),b=o.filter(s=>!l.includes(s));for(let s of b){let n=this.subscriptions.get(s);n&&n.sub.unsubscribe(),this.subscriptions.delete(s),this.streams?.delete(s),this.baseSignatures.delete(s),this.registrations=this.registrations.filter(c=>c.pathName!==s);}let m=r!==i;for(let s of l){let n=this.getPathConfig(t.paths,s),c=this.normalizePath(n?.path);if(!c){let h=this.subscriptions.get(s);h&&h.sub.unsubscribe(),this.subscriptions.delete(s),this.streams?.delete(s),this.baseSignatures.delete(s);continue}let p=z$5(G$b({},n),{path:c}),P=this.computePathSignature(p),d=this.subscriptions.get(s);if(!d||d.signature!==P||m){d&&(d.sub.unsubscribe(),this.subscriptions.delete(s));let h=this.registrations.find(T=>T.pathName===s);h&&this.buildAndSubscribe(s,h.next,t,p);}}}observe(t,e){let r=this.registrations.find(n=>n.pathName===t)?.next;this.registrations=this.registrations.filter(n=>n.pathName!==t),this.registrations.push({pathName:t,next:e});let i=this._streamsConfig(),o=this.getPathConfig(i?.paths,t);if(!i||!o){let n=this.subscriptions.get(t);n&&(n.sub.unsubscribe(),this.subscriptions.delete(t),this.streams?.delete(t),this.baseSignatures.delete(t));return}let l=this.normalizePath(o?.path);if(!l){let n=this.subscriptions.get(t);n&&(n.sub.unsubscribe(),this.subscriptions.delete(t),this.streams?.delete(t),this.baseSignatures.delete(t)),this.registrations=this.registrations.filter(c=>c.pathName!==t);return}let b=z$5(G$b({},o),{path:l}),m=this.computePathSignature(b),s=this.subscriptions.get(t);s&&s.signature===m&&r===e||this.buildAndSubscribe(t,e,i,b);}static \u0275fac=function(e){return new(e||g)};static \u0275dir=nw({type:g,selectors:[["","widget-streams",""]],exportAs:["widgetStreams"]})}return g})();var p=(()=>{class s{config=Hj();defaultConfig=vt$9(void 0);_runtimeConfig=vt$9(void 0);lastBaseRef;lastUserRef;lastMergedRef;options=Dt$9(()=>{let e=this.defaultConfig(),t=this._runtimeConfig();if(this.lastMergedRef&&e===this.lastBaseRef&&t===this.lastUserRef)return this.lastMergedRef;let i;return e&&t?i=Ap(dp(e),dp(t)):e&&!t?i=dp(e):!e&&t?i=dp(t):i=void 0,this.lastBaseRef=e,this.lastUserRef=t,this.lastMergedRef=i,i});firstPathKey=Dt$9(()=>{let e=this.options();if(!e?.paths)return;let t=Object.keys(e.paths);return t.length?t[0]:void 0});constructor(){Fa$5(()=>{let e=this.config();ge$5(()=>{e&&this.setRuntimeConfig(e);});});}getPathCfg(e){let i=this.options()?.paths;if(!(!i||Array.isArray(i)))return i[e]}setRuntimeConfig(e){this._runtimeConfig.set(e);}initialize(e,t){e&&this.defaultConfig.set(e),t&&this._runtimeConfig.set(t);}static \u0275fac=function(t){return new(t||s)};static \u0275dir=nw({type:s,selectors:[["","widget-runtime",""]],inputs:{config:[1,"config"]},exportAs:["widgetRuntime"]})}return s})();var h=class l{static getElements(o,e=document){if(typeof o=="string"){let t="getElementById"in e?e:void 0;if(t&&!isNaN(+o[0])){let s=t.getElementById(o);return s?[s]:[]}let i=e.querySelectorAll(o);if(!i.length&&o[0]!=="."&&o[0]!=="#"&&(i=e.querySelectorAll("."+o),i.length||(i=e.querySelectorAll("#"+o)),!i.length)){let s=e.querySelector(`[gs-id="${o}"]`);return s?[s]:[]}return Array.from(i)}return [o]}static getElement(o,e=document){if(typeof o=="string"){let t="getElementById"in e?e:void 0;if(!o.length)return null;if(t&&o[0]==="#")return t.getElementById(o.substring(1));if(o[0]==="#"||o[0]==="."||o[0]==="[")return e.querySelector(o);if(t&&!isNaN(+o[0]))return t.getElementById(o);let i=e.querySelector(o);return t&&!i&&(i=t.getElementById(o)),i||(i=e.querySelector("."+o)),i}return o}static lazyLoad(o){return o.lazyLoad||o.grid?.opts?.lazyLoad&&o.lazyLoad!==false}static createDiv(o,e){let t=document.createElement("div");return o.forEach(i=>{i&&t.classList.add(i);}),e?.appendChild(t),t}static shouldSizeToContent(o,e=false){return o?.grid&&(e?o.sizeToContent===true||o.grid.opts.sizeToContent===true&&o.sizeToContent===void 0:!!o.sizeToContent||o.grid.opts.sizeToContent&&o.sizeToContent!==false)}static isIntercepted(o,e){return !(o.y>=e.y+e.h||o.y+o.h<=e.y||o.x+o.w<=e.x||o.x>=e.x+e.w)}static isTouching(o,e){return l.isIntercepted(o,{x:e.x-.5,y:e.y-.5,w:e.w+1,h:e.h+1})}static areaIntercept(o,e){let t=o.x>e.x?o.x:e.x,i=o.x+o.w<e.x+e.w?o.x+o.w:e.x+e.w;if(i<=t)return 0;let s=o.y>e.y?o.y:e.y,r=o.y+o.h<e.y+e.h?o.y+o.h:e.y+e.h;return r<=s?0:(i-t)*(r-s)}static area(o){return o.w*o.h}static sort(o,e=1){return o.sort((i,s)=>{let r=e*((i.y??1e4)-(s.y??1e4));return r===0?e*((i.x??1e4)-(s.x??1e4)):r})}static find(o,e){return e?o.find(t=>t.id===e):void 0}static toBool(o){return typeof o=="boolean"?o:typeof o=="string"?(o=o.toLowerCase(),!(o===""||o==="no"||o==="false"||o==="0")):!!o}static toNumber(o){return o===null||o.length===0?void 0:Number(o)}static parseHeight(o){let e,t="px";if(typeof o=="string")if(o==="auto"||o==="")e=0;else {let i=o.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${o}`);t=i[2]||"px",e=parseFloat(i[1]);}else e=o;return {h:e,unit:t}}static defaults(o,...e){return e.forEach(t=>{for(let i in t){if(!t.hasOwnProperty(i))return;o[i]===null||o[i]===void 0?o[i]=t[i]:typeof t[i]=="object"&&typeof o[i]=="object"&&l.defaults(o[i],t[i]);}}),o}static same(o,e){if(typeof o!="object")return o==e;if(typeof o!=typeof e||Object.keys(o).length!==Object.keys(e).length)return false;for(let t in o)if(o[t]!==e[t])return false;return true}static copyPos(o,e,t=false){return e.x!==void 0&&(o.x=e.x),e.y!==void 0&&(o.y=e.y),e.w!==void 0&&(o.w=e.w),e.h!==void 0&&(o.h=e.h),t&&(e.minW&&(o.minW=e.minW),e.minH&&(o.minH=e.minH),e.maxW&&(o.maxW=e.maxW),e.maxH&&(o.maxH=e.maxH)),o}static samePos(o,e){return o&&e&&o.x===e.x&&o.y===e.y&&(o.w||1)===(e.w||1)&&(o.h||1)===(e.h||1)}static sanitizeMinMax(o){o.minW||delete o.minW,o.minH||delete o.minH,o.maxW||delete o.maxW,o.maxH||delete o.maxH;}static removeInternalAndSame(o,e){if(!(typeof o!="object"||typeof e!="object")&&!(Array.isArray(o)||Array.isArray(e)))for(let t in o){let i=o[t],s=e[t];t[0]==="_"||i===s?delete o[t]:i&&typeof i=="object"&&s!==void 0&&(l.removeInternalAndSame(i,s),Object.keys(i).length||delete o[t]);}}static removeInternalForSave(o,e=true){for(let t in o)(t[0]==="_"||o[t]===null||o[t]===void 0)&&delete o[t];delete o.grid,e&&delete o.el,o.autoPosition||delete o.autoPosition,o.noResize||delete o.noResize,o.noMove||delete o.noMove,o.locked||delete o.locked,(o.w===1||o.w===o.minW)&&delete o.w,(o.h===1||o.h===o.minH)&&delete o.h;}static throttle(o,e){let t=false;return (...i)=>{t||(t=true,setTimeout(()=>{o(...i),t=false;},e));}}static removePositioningStyles(o){let e=o.style;e.position&&e.removeProperty("position"),e.left&&e.removeProperty("left"),e.top&&e.removeProperty("top"),e.width&&e.removeProperty("width"),e.height&&e.removeProperty("height");}static getScrollElement(o){if(!o)return document.scrollingElement||document.documentElement;let e=getComputedStyle(o).overflowY;return (e==="auto"||e==="scroll")&&o.scrollHeight>o.clientHeight?o:l.getScrollElement(o.parentElement)}static updateScrollResize(o,e,t){let i=l.getScrollElement(e),s=i.clientHeight,r=i===l.getScrollElement()?0:i.getBoundingClientRect().top,n=o.clientY-r,a=n<t,u=n>s-t;a?i.scrollBy({behavior:"smooth",top:n-t}):u&&i.scrollBy({behavior:"smooth",top:t-(s-n)});}static clone(o){return o==null||typeof o!="object"?o:o instanceof Array?[...o]:G$b({},o)}static cloneDeep(o){let e=["parentGrid","el","grid","subGrid","engine"],t=l.clone(o);for(let i in t)t.hasOwnProperty(i)&&typeof t[i]=="object"&&i.substring(0,2)!=="__"&&!e.find(s=>s===i)&&(t[i]=l.cloneDeep(o[i]));return t}static cloneNode(o){let e=o.cloneNode(true);return e.removeAttribute("id"),e}static appendTo(o,e){let t;typeof e=="string"?t=l.getElement(e):t=e,t&&t.appendChild(o);}static addElStyles(o,e){if(e instanceof Object)for(let t in e)e.hasOwnProperty(t)&&(Array.isArray(e[t])?e[t].forEach(i=>{o.style[t]=i;}):o.style[t]=e[t]);}static initEvent(o,e){let t={type:e.type},i={button:0,which:0,buttons:1,bubbles:true,cancelable:true,target:e.target?e.target:o.target};return ["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>t[s]=o[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>t[s]=o[s]),G$b(G$b({},t),i)}static simulateMouseEvent(o,e,t){let i=o,s=new MouseEvent(e,{bubbles:true,composed:true,cancelable:true,view:window,detail:1,screenX:o.screenX,screenY:o.screenY,clientX:o.clientX,clientY:o.clientY,ctrlKey:i.ctrlKey??false,altKey:i.altKey??false,shiftKey:i.shiftKey??false,metaKey:i.metaKey??false,button:0,relatedTarget:o.target});(t||o.target).dispatchEvent(s);}static getValuesFromTransformedElement(o){let e=document.createElement("div");l.addElStyles(e,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),o.appendChild(e);let t=e.getBoundingClientRect();return o.removeChild(e),e.remove(),{xScale:1/t.width,yScale:1/t.height,xOffset:t.left,yOffset:t.top}}static swap(o,e,t){if(!o)return;let i=o[e];o[e]=o[t],o[t]=i;}static canBeRotated(o){return !(!o||o.w===o.h||o.locked||o.noResize||o.grid?.opts.disableResize||o.minW&&o.minW===o.maxW||o.minH&&o.minH===o.maxH)}};var rt$2=(()=>{class l{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange;}batchUpdate(e=true,t=true){return !!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=true,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return (!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,s={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return false;if(e._moving&&!s.nested&&!this.float&&this.swap(e,i))return true;let r=t;!this._loading&&this._useEntireRowArea(e,t)&&(r={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,r,s.skip));let n=false,a={nested:true,pack:false},u=0;for(;i=i||this.collide(e,r,s.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,z$5(G$b({},i),{y:e.y}),e)||!this.collide(i,z$5(G$b({},i),{y:t.y-i.h}),e))){e._skipDown=e._skipDown||t.y>e.y;let d=G$b(z$5(G$b({},t),{y:i.y+i.h}),a);c=this._loading&&h.samePos(e,d)?true:this.moveNode(e,d),(i.locked||this._loading)&&c?h.copyPos(t,e):!i.locked&&c&&s.pack&&(this._packNodes(),t.y=i.y+i.h,h.copyPos(e,t)),n=n||c;}else c=this.moveNode(i,G$b(z$5(G$b({},i),{y:t.y+t.h,skip:e}),a));if(!c)return n;i=void 0;}return n}collide(e,t=e,i){let s=e._id,r=i?._id;return this.nodes.find(n=>n._id!==s&&n._id!==r&&h.isIntercepted(n,t))}collideAll(e,t=e,i){let s=e._id,r=i?._id;return this.nodes.filter(n=>n._id!==s&&n._id!==r&&h.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;let s=e._rect,r=G$b({},t.rect);r.y>s.y?(r.h+=r.y-s.y,r.y=s.y):r.h+=s.y-r.y,r.x>s.x?(r.w+=r.x-s.x,r.x=s.x):r.w+=s.x-r.x;let n,a=.5;for(let u of i){if(u.locked||!u._rect)break;let c=u._rect,d=Number.MAX_VALUE,p=Number.MAX_VALUE;s.y<c.y?d=(r.y+r.h-c.y)/c.h:s.y+s.h>c.y+c.h&&(d=(c.y+c.h-r.y)/c.h),s.x<c.x?p=(r.x+r.w-c.x)/c.w:s.x+s.w>c.x+c.w&&(p=(c.x+c.w-r.x)/c.w);let g=Math.min(p,d);g>a&&(a=g,n=u);}return t.collide=n,n}cacheRects(e,t,i,s,r,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-s,h:a.h*t-i-r}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return false;function i(){let r=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=r,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=r,e.y=n),e._dirty=t._dirty=true,true}let s;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(s=h.isTouching(e,t)))return i();if(s!==false){if(e.w===t.w&&e.x===t.x&&(s||(s=h.isTouching(e,t)))){if(t.y<e.y){let r=e;e=t,t=r;}return i()}if(s!==false){if(e.h===t.h&&e.y===t.y&&(s||(s=h.isTouching(e,t)))){if(t.x<e.x){let r=e;e=t,t=r;}return i()}return false}}}isAreaEmpty(e,t,i,s){let r={x:e||0,y:t||0,w:i||1,h:s||1};return !this.collide(r)}compact(e="compact",t=true){if(this.nodes.length===0)return this;t&&this.sortNodes();let i=this.batchMode;i||this.batchUpdate();let s=this._inColumnResize;s||(this._inColumnResize=true);let r=this.nodes;return this.nodes=[],r.forEach((n,a,u)=>{let c;n.locked||(n.autoPosition=true,e==="list"&&a&&(c=u[a-1])),this.addNode(n,false,c);}),s||delete this._inColumnResize,i||this.batchUpdate(false),this}set float(e){this._float!==e&&(this._float=e||false,e||this._packNodes()._notify());}get float(){return this._float||false}sortNodes(e=1){return this.nodes=h.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=true,e.y=t);}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){let i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i;}}),this)}prepareNode(e,t){e._id=e._id??l._idSeq++;let i=e.id;if(i){let r=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+r++;}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=true);let s={x:0,y:0,w:1,h:1};return h.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,h.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=s.x,e.autoPosition=true),isNaN(e.y)&&(e.y=s.y,e.autoPosition=true),isNaN(e.w)&&(e.w=s.w),isNaN(e.h)&&(e.h=s.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){let i=e._orig||h.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){let r=G$b({},e);r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,this.defaultColumn);}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),h.samePos(e,i)||(e._dirty=true),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!h.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;let t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried;}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=h.copyPos({},e),delete e._dirty;}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||h.samePos(e,e._orig)||(h.copyPos(e,e._orig),e._dirty=true);}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){let r=s?s.y*i+(s.x+s.w):0,n=false;for(let a=r;!n;++a){let u=a%i,c=Math.floor(a/i);if(u+e.w>i)continue;let d={x:u,y:c,w:e.w,h:e.h};t.find(p=>h.isIntercepted(d,p))||((e.x!==u||e.y!==c)&&(e._dirty=true),e.x=u,e.y=c,delete e.autoPosition,n=true);}return n}addNode(e,t=false,i){let s=this.nodes.find(n=>n._id===e._id);if(s)return s;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,r=true),this.nodes.push(e),t&&this.addedNodes.push(e),r||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=true,i=false){return this.nodes.find(s=>s._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=true),this.nodes=this.nodes.filter(s=>s._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=true,t=true){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(s=>s._removeDOM=true);let i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return false;if(t.pack=true,!this.maxRow)return this.moveNode(e,t);let i,s=new l({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i=G$b({},n),i):G$b({},n))});if(!i)return false;let r=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!t.resizing&&t.collide){let n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),true}return r?(s.nodes.filter(n=>n._dirty).forEach(n=>{let a=this.nodes.find(u=>u._id===n._id);a&&(h.copyPos(a,n),a._dirty=true);}),this._notify(),true):false}willItFit(e){if(delete e._willFitPos,!this.maxRow)return true;let t=new l({column:this.column,float:this.float,nodes:this.nodes.map(s=>G$b({},s))}),i=G$b({},e);return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=h.copyPos({},i),true):false}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?true:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return false;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=true),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);let s=e.w!==t.w||e.h!==t.h,r=h.copyPos({},e,true);if(h.copyPos(r,t),this.nodeBoundFix(r,s),h.copyPos(t,r),!t.forceCollide&&h.samePos(e,t))return false;let n=h.copyPos({},e),a=this.collideAll(e,r,t.skip),u=true;if(a.length){let c=e._moving&&!t.nested,d=c?this.directionCollideCoverage(e,t,a):a[0];if(c&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){let p=h.areaIntercept(t.rect,d._rect),g=h.area(t.rect),C=h.area(d._rect);p/(g<C?g:C)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0);}d?u=!this._fixCollisions(e,r,d,t):(u=false,i&&delete t.pack);}return u&&!h.samePos(e,r)&&(e._dirty=true,h.copyPos(e,r)),t.pack&&this._packNodes()._notify(),!h.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=true,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){let e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=true,t,i){let s=this._layouts?.length||0,r;s&&(i?i!==this.column&&(r=this._layouts[i]):this.column!==s-1&&(r=this._layouts[s-1]));let n=[];return this.sortNodes(),this.nodes.forEach(a=>{let u=r?.find(d=>d._id===a._id),c=G$b(G$b({},a),u||{});h.removeInternalForSave(c,!e),t&&t(a,c),n.push(c);}),n}layoutsNodesChange(e){return !this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else {let s=i/this.column;e.forEach(r=>{if(!r._orig)return;let n=t.find(a=>a._id===r._id);n&&(n.y>=0&&r.y!==r._orig.y&&(n.y+=r.y-r._orig.y,n.y<0&&(n.y=0)),r.x!==r._orig.x&&(n.x=Math.round(r.x*s),n.x<0&&(n.x=0)),r.w!==r._orig.w&&(n.w=Math.round(r.w*s),n.w<1&&(n.w=1)));});}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;let s=i==="compact"||i==="list";s&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let r=[],n=s?this.nodes:h.sort(this.nodes,-1);if(t>e&&this._layouts){let a=this._layouts[t]||[],u=this._layouts.length-1;!a.length&&e!==u&&this._layouts[u]?.length&&(e=u,this._layouts[u].forEach(c=>{let d=n.find(p=>p._id===c._id);d&&(!s&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=true));})),a.forEach(c=>{let d=n.findIndex(p=>p._id===c._id);if(d!==-1){let p=n[d];if(s){p.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,r),c.autoPosition||(p.x=c.x??p.x,p.y=c.y??p.y,p.w=c.w??p.w,r.push(p)),n.splice(d,1);}});}if(s)this.compact(i,false);else {if(n.length)if(typeof i=="function")i(t,e,r,n);else {let a=s||i==="none"?1:t/e,u=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";n.forEach(d=>{d.x=t===1?0:u?Math.round(d.x*a):Math.min(d.x,t-1),d.w=t===1||e===1?1:c?Math.round(d.w*a)||1:Math.min(d.w,t),r.push(d);}),n=[];}r=h.sort(r,-1),this._inColumnResize=true,this.nodes=[],r.forEach(a=>{this.addNode(a,false),delete a._orig;});}return this.nodes.forEach(a=>delete a._orig),this.batchUpdate(false,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=false){let s=[];return e.forEach((r,n)=>{if(r._id===void 0){let a=r.id?this.nodes.find(u=>u.id===r.id):void 0;r._id=a?._id??l._idSeq++;}s[n]={x:r.x,y:r.y,w:r.w,_id:r._id};}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??l._idSeq++;let i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=true)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];let s=this.findCacheLayout(e,t);return s===-1?this._layouts[t].push(i):this._layouts[t][s]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){let i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1);}}cleanupNode(e){for(let t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}return l._idSeq=0,l})();var P$2={alwaysShowResizeHandle:"mobile",animate:true,auto:true,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:true},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};var f=class{};var M$1=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),R$3=class R{};function Ue$1(l,o){l.touches.length>1||(l.cancelable&&l.preventDefault(),h.simulateMouseEvent(l.changedTouches[0],o));}function Gt$1(l,o){l.cancelable&&l.preventDefault(),h.simulateMouseEvent(l,o);}function de$1(l){R$3.touchHandled||(R$3.touchHandled=true,Ue$1(l,"mousedown"));}function he$2(l){R$3.touchHandled&&Ue$1(l,"mousemove");}function ce$1(l){if(!R$3.touchHandled)return;R$3.pointerLeaveTimeout&&(window.clearTimeout(R$3.pointerLeaveTimeout),delete R$3.pointerLeaveTimeout);let o=!!f.dragElement;Ue$1(l,"mouseup"),o||Ue$1(l,"click"),R$3.touchHandled=false;}function ue$1(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId);}function ot$3(l){f.dragElement&&l.pointerType!=="mouse"&&Gt$1(l,"mouseenter");}function nt$3(l){f.dragElement&&l.pointerType!=="mouse"&&(R$3.pointerLeaveTimeout=window.setTimeout(()=>{delete R$3.pointerLeaveTimeout,Gt$1(l,"mouseleave");},10));}var Ut$1=(()=>{class l{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=false,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init();}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element);}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e);}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${l.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),M$1&&(this.el.addEventListener("touchstart",de$1),this.el.addEventListener("pointerdown",ue$1)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),M$1&&(this.el.removeEventListener("touchstart",de$1),this.el.removeEventListener("pointerdown",ue$1)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:true,passive:true}),document.addEventListener("mouseup",this._mouseUp,true),M$1&&(this.el.addEventListener("touchmove",he$2),this.el.addEventListener("touchend",ce$1)),e.stopPropagation(),e.preventDefault();}_mouseMove(e){let t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=true,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation();}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,true),document.removeEventListener("mouseup",this._mouseUp,true),M$1&&(this.el.removeEventListener("touchmove",he$2),this.el.removeEventListener("touchend",ce$1)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault();}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent));}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}return l.prefix="ui-resizable-",l})();var j$1=class j{constructor(){this._eventRegister={};}get disabled(){return this._disabled}on(o,e){this._eventRegister[o]=e;}off(o){delete this._eventRegister[o];}enable(){this._disabled=false;}disable(){this._disabled=true;}destroy(){delete this._eventRegister;}triggerEvent(o,e){if(!this.disabled&&this._eventRegister&&this._eventRegister[o])return this._eventRegister[o](e)}};var $t$1=(()=>{class l extends j$1{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{let s=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},n=this.temporalRect||r;return {position:{left:this.option.rtl?(s.right-n.right)*this.rectScale.x:(n.left-s.left)*this.rectScale.x,top:(n.top-s.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers();}on(e,t){super.on(e,t);}off(e){super.off(e);}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide);}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(false);}destroy(){this._removeHandlers(),this._setupAutoHide(false),delete this.el,super.destroy();}updateOption(e){let t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(s=>this.option[s]=e[s]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),f.overResizeElement===this&&delete f.overResizeElement),this}_mouseOver(e){f.overResizeElement||f.dragElement||(f.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"));}_mouseOut(e){f.overResizeElement===this&&(delete f.overResizeElement,this.el.classList.add("ui-resizable-autohide"));}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ut$1(this.el,e,{element:this.option.element,start:t=>this._resizeStart(t),stop:t=>this._resizeStop(t),move:t=>this._resizing(t,e)})),this}_resizeStart(e){this.sizeToContent=h.shouldSizeToContent(this.el.gridstackNode,true),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=h.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();let t=h.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();let i=h.initEvent(e,{type:"resize",target:this.el});return i.resizeDir=t,i.hasMovedX=this.option.rtl?t.includes("e"):t.includes("w"),i.hasMovedY=t.includes("n"),this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){let t=h.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=l._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;let e=this.el.parentElement,t=h.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return l._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null;}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){let i=this.startEvent,s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},r=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY,a,u,c=this.option.rtl;!c&&t.indexOf("e")>-1?s.width+=r:c&&t.indexOf("w")>-1?s.width-=r:!c&&t.indexOf("w")>-1?(s.width-=r,s.left+=r,a=true):c&&t.indexOf("e")>-1&&(s.width+=r,s.right+=r,a=true),t.indexOf("s")>-1?s.height+=n:t.indexOf("n")>-1&&(s.height-=n,s.top+=n,u=true);let d=this._constrainSize(s.width,s.height,a,u);return Math.round(s.width)!==Math.round(d.width)&&(!c&&t.indexOf("w")>-1?s.left+=s.width-d.width:c&&t.indexOf("e")>-1&&(s.right-=s.width-d.width),s.width=d.width),Math.round(s.height)!==Math.round(d.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-d.height),s.height=d.height),s}_constrainSize(e,t,i,s){let r=this.option,n=(i?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,a=r.minWidth/this.rectScale.x||e,u=(s?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,c=r.minHeight/this.rectScale.y||t,d=Math.min(n,Math.max(a,e)),p=Math.min(u,Math.max(c,t));return {width:d,height:p}}_applyChange(){let e={left:0,right:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){let t=this.el.parentElement,{left:i,right:s,top:r}=t.getBoundingClientRect();e={left:i,right:s,top:r,width:0,height:0};}return this.temporalRect?(Object.entries(this.temporalRect).forEach(([t,i])=>{if(this.option.rtl?t==="left":t==="right")return;let s=t==="width"||t==="left"||t==="right"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1,r;t==="right"?r=(e.right-i)*this.rectScale.x+"px":r=(i-e[t])*s+"px",this.el.style[t]=r;}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}return l._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"],l})();var si$1='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',qt$1=(()=>{class l extends j$1{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},this._autoScrollTick=()=>{let r=this.helper,n=this._autoScrollContainer;if(!r||!n){this._stopScrolling();return}let a=this._getClipping(r,n);if(a===0){this._stopScrolling();return}if(!this._autoScrollMaxSpeed){let g=window.innerHeight||document.documentElement.clientHeight;this._autoScrollMaxSpeed=Math.max(g/150,4);}let u=Math.abs(a),c=Math.min(u*.5,this._autoScrollMaxSpeed),d=a>0?c:-c,p=n.scrollTop;if(n.scrollTop+=d,n.scrollTop===p){this._stopScrolling();return}this.dragging&&this.lastDrag&&(this._dragFollow(this.lastDrag),this._callDrag(this.lastDrag)),this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick);};let i=t?.handle?.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s?.subGrid?[e.querySelector(t.handle)||e]:this.getAllHandles(),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable();}getAllHandles(){return Array.from(this.el.querySelectorAll(this.option.handle)).filter(e=>{if(!(e instanceof HTMLElement))return false;let t=e.closest(".grid-stack-item");return t===this.el||!t})}on(e,t){super.on(e,t);}off(e){super.off(e);}enable(){this.disabled!==false&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),M$1&&(e.addEventListener("touchstart",de$1),e.addEventListener("pointerdown",ue$1));}),this.el.classList.remove("ui-draggable-disabled"));}disable(e=false){this.disabled!==true&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),M$1&&(t.removeEventListener("touchstart",de$1),t.removeEventListener("pointerdown",ue$1));}),e||this.el.classList.add("ui-draggable-disabled"));}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(true),delete this.el,delete this.helper,delete this.option,super.destroy();}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(R$3.touchHandled&&e.isTrusted&&(R$3.touchHandled=false),!f.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(si$1)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete f.dragElement,delete f.dropElement,delete this._autoScrollMaxSpeed,delete this._autoScrollContainer,document.addEventListener("mousemove",this._mouseMove,{capture:true,passive:true}),document.addEventListener("mouseup",this._mouseUp,true),M$1&&(e.currentTarget.addEventListener("touchmove",he$2),e.currentTarget.addEventListener("touchend",ce$1)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),f.mouseHandled=true),true}_callDrag(e){if(!this.dragging)return;let t=h.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t);}_mouseMove(e){let t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),f.pauseDrag){let i=Number.isInteger(f.pauseDrag)?f.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i);}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=true,f.dragElement=this;let i=this.el.gridstackNode?.grid;i?f.dropElement=i.el.ddElement.ddDroppable:delete f.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=h.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);let s=h.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent);}return true}_mouseUp(e){if(this._stopScrolling(),document.removeEventListener("mousemove",this._mouseMove,true),document.removeEventListener("mouseup",this._mouseUp,true),M$1&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",he$2,true),e.currentTarget.removeEventListener("touchend",ce$1,true)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),f.dropElement?.el===this.el.parentElement&&delete f.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();let t=h.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),f.dropElement&&f.dropElement.drop(e);}delete this.helper,delete this.mouseDownEvent,delete f.dragElement,delete f.dropElement,delete f.mouseHandled,e.preventDefault();}_keyEvent(e){let t=this.el.gridstackNode,i=t?.grid||f.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!h.canBeRotated(t))return;t._origRotate=t._origRotate||G$b({},t._orig),delete t._moving,i.setAnimation(false).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetX}).setAnimation(),t._moving=true,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",h.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag);}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=h.cloneNode(this.el)),e.parentElement||h.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=l.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");let t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, right, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null);},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){let t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",l.originStyleProp.forEach(s=>t.style[s]=this.dragElementOriginStyle[s]||null),setTimeout(()=>t.style.transition=i,50);}return delete this.dragElementOriginStyle,this}_dragFollow(e){let t=this.helper.style,i=this.dragOffset;this.option.rtl?(t.right=(window.innerWidth-e.clientX+i.offsetX)*this.dragTransform.xScale+"px",t.left&&(t.left="")):(t.left=(e.clientX+i.offsetX)*this.dragTransform.xScale+"px",t.right&&(t.right="")),t.top=(e.clientY+i.offsetTop)*this.dragTransform.yScale+"px";}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let s=0,r=0;i&&(s=this.dragTransform.xOffset,r=this.dragTransform.yOffset);let n=t.getBoundingClientRect(),a=this.option.rtl?n.right:n.left,u=this.option.rtl?e.clientX-n.right+s:-e.clientX+n.left-s;return {x:a,top:n.top,offsetX:u,offsetTop:-e.clientY+n.top-r,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}updateScrollPosition(e){this._autoScrollContainer=h.getScrollElement(e),this._getClipping(this.helper,this._autoScrollContainer)===0?this._stopScrolling():this._autoScrollAnimId||(this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick));}_getClipping(e,t){let i=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight;if(i.bottom<s.top||i.top>s.bottom)return 0;let n=i.bottom-Math.min(s.bottom,r),a=i.top-Math.max(s.top,0);return a<0?a:n>0?n:0}_stopScrolling(){this._autoScrollAnimId&&(cancelAnimationFrame(this._autoScrollAnimId),delete this._autoScrollAnimId);}ui(){let t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect(),s=this.option.rtl?(t.right-i.right)*this.dragTransform.xScale:(i.left-t.left)*this.dragTransform.xScale;return {position:{top:(i.top-t.top)*this.dragTransform.yScale,left:s}}}}return l.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"],l})();var $e$2=class $e extends j$1{constructor(o,e={}){super(),this.el=o,this.option=e,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept();}on(o,e){super.on(o,e);}off(o){super.off(o);}enable(){this.disabled!==false&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),M$1&&(this.el.addEventListener("pointerenter",ot$3),this.el.addEventListener("pointerleave",nt$3)));}disable(o=false){this.disabled!==true&&(super.disable(),this.el.classList.remove("ui-droppable"),o||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),M$1&&(this.el.removeEventListener("pointerenter",ot$3),this.el.removeEventListener("pointerleave",nt$3)));}destroy(){this.disable(true),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy();}updateOption(o){return Object.keys(o).forEach(e=>this.option[e]=o[e]),this._setupAccept(),this}_mouseEnter(o){if(!f.dragElement||R$3.touchHandled&&o.isTrusted||!this._canDrop(f.dragElement.el))return;o.preventDefault(),o.stopPropagation(),f.dragElement._stopScrolling(),f.dropElement&&f.dropElement!==this&&f.dropElement._mouseLeave(o,true),f.dropElement=this;let e=h.initEvent(o,{target:this.el,type:"dropover"});this.option.over&&this.option.over(e,this._ui(f.dragElement)),this.triggerEvent("dropover",e),this.el.classList.add("ui-droppable-over");}_mouseLeave(o,e=false){if(!f.dragElement||f.dropElement!==this)return;o.preventDefault(),o.stopPropagation(),e&&f.dragElement._stopScrolling();let t=h.initEvent(o,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(t,this._ui(f.dragElement)),this.triggerEvent("dropout",t),f.dropElement===this&&(delete f.dropElement,!e)){let i,s=this.el.parentElement;for(;!i&&s;)i=s.ddElement?.ddDroppable,s=s.parentElement;i&&i._mouseEnter(o);}}drop(o){o.preventDefault();let e=h.initEvent(o,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(e,this._ui(f.dragElement)),this.triggerEvent("drop",e);}_canDrop(o){return o&&(!this.accept||this.accept(o))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=o=>o.classList.contains(this.option.accept)||o.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(o){return G$b({draggable:o.el},o.ui())}};var qe$2=class l{static init(o){return o.ddElement||(o.ddElement=new l(o)),o.ddElement}constructor(o){this.el=o;}on(o,e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(o)>-1?this.ddDraggable.on(o,e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(o)>-1?this.ddDroppable.on(o,e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(o)>-1&&this.ddResizable.on(o,e),this}off(o){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(o)>-1?this.ddDraggable.off(o):this.ddDroppable&&["drop","dropover","dropout"].indexOf(o)>-1?this.ddDroppable.off(o):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(o)>-1&&this.ddResizable.off(o),this}setupDraggable(o){return this.ddDraggable?this.ddDraggable.updateOption(o):this.ddDraggable=new qt$1(this.el,o),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(o){return this.ddResizable?this.ddResizable.updateOption(o):this.ddResizable=new $t$1(this.el,o),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(o){return this.ddDroppable?this.ddDroppable.updateOption(o):this.ddDroppable=new $e$2(this.el,o),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}};var Ve$2=class Ve{resizable(o,e,t,i){return this._getDDElements(o,e).forEach(s=>{if(e==="disable"||e==="enable")s.ddResizable&&s.ddResizable[e]();else if(e==="destroy")s.ddResizable&&s.cleanResizable();else if(e==="option")s.setupResizable({[t]:i});else {let n=s.el.gridstackNode.grid,a=s.el.getAttribute("gs-resize-handles")||n.opts.resizable.handles||"e,s,se";a==="all"&&(a="n,e,s,w,se,sw,ne,nw");let u=!n.opts.alwaysShowResizeHandle;s.setupResizable(z$5(G$b({},n.opts.resizable),{handles:a,autoHide:u,start:e.start,stop:e.stop,resize:e.resize,rtl:e.rtl}));}}),this}draggable(o,e,t,i){return this._getDDElements(o,e).forEach(s=>{if(e==="disable"||e==="enable")s.ddDraggable&&s.ddDraggable[e]();else if(e==="destroy")s.ddDraggable&&s.cleanDraggable();else if(e==="option")s.setupDraggable({[t]:i});else {let r=s.el.gridstackNode.grid;s.setupDraggable(z$5(G$b({},r.opts.draggable),{start:e.start,stop:e.stop,drag:e.drag,rtl:e.rtl}));}}),this}dragIn(o,e){return this._getDDElements(o).forEach(t=>t.setupDraggable(e)),this}droppable(o,e,t,i){return typeof e.accept=="function"&&!e._accept&&(e._accept=e.accept,e.accept=s=>e._accept(s)),this._getDDElements(o,e).forEach(s=>{e==="disable"||e==="enable"?s.ddDroppable&&s.ddDroppable[e]():e==="destroy"?s.ddDroppable&&s.cleanDroppable():e==="option"?s.setupDroppable({[t]:i}):s.setupDroppable(e);}),this}isDroppable(o){return !!(o?.ddElement?.ddDroppable&&!o.ddElement.ddDroppable.disabled)}isDraggable(o){return !!(o?.ddElement?.ddDraggable&&!o.ddElement.ddDraggable.disabled)}isResizable(o){return !!(o?.ddElement?.ddResizable&&!o.ddElement.ddResizable.disabled)}on(o,e,t){return this._getDDElements(o).forEach(i=>i.on(e,s=>{t(s,f.dragElement?f.dragElement.el:s.target,f.dragElement?f.dragElement.helper:null);})),this}off(o,e){return this._getDDElements(o).forEach(t=>t.off(e)),this}_getDDElements(o,e){let t=o.gridstack||e!=="destroy"&&e!=="disable",i=h.getElements(o);return i.length?i.map(r=>r.ddElement||(t?qe$2.init(r):null)).filter(r=>r):[]}};var O$2=new Ve$2,Y$1=(()=>{class l{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;let i=l.getGridElement(t);return i?(i.gridstack||(i.gridstack=new l(i,h.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
6695
6695
  Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){let i=[];return typeof document>"u"||(l.getGridElements(t).forEach(s=>{s.gridstack||(s.gridstack=new l(s,h.cloneDeep(e))),i.push(s.gridstack);}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
6696
6696
  Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){let n=i.gridstack;return t&&(n.opts=G$b(G$b({},n.opts),t)),t.children!==void 0&&n.load(t.children),n}return (!e.classList.contains("grid-stack")||l.addRemoveCB)&&(l.addRemoveCB?i=l.addRemoveCB(e,t,true,true):i=h.createDiv(["grid-stack",t.class],e)),l.init(t,i)}static registerEngine(e){l.engineClass=e;}get placeholder(){if(!this._placeholder){this._placeholder=h.createDiv([this.opts.placeholderClass,P$2.itemClass,this.opts.itemClass]);let e=h.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText);}return this._placeholder}constructor(e,t={}){this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);let i=h.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let s=t.columnOpts;if(s){let c=s.breakpoints;!s.columnWidth&&!c?.length?delete t.columnOpts:(s.columnMax=s.columnMax||12,c?.length>1&&c.sort((d,p)=>(p.w||0)-(d.w||0)));}let r=z$5(G$b({},h.cloneDeep(P$2)),{column:h.toNumber(e.getAttribute("gs-column"))||P$2.column,minRow:i||h.toNumber(e.getAttribute("gs-min-row"))||P$2.minRow,maxRow:i||h.toNumber(e.getAttribute("gs-max-row"))||P$2.maxRow,staticGrid:h.toBool(e.getAttribute("gs-static"))||P$2.staticGrid,sizeToContent:h.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||P$2.draggable.handle},removableOptions:{accept:t.itemClass||P$2.removableOptions.accept,decline:P$2.removableOptions.decline}});e.getAttribute("gs-animate")&&(r.animate=h.toBool(e.getAttribute("gs-animate"))),t=h.defaults(t,r),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");let a=this.el.closest("."+P$2.itemClass)?.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else {typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==P$2.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);let c=t.cellHeight;delete t.cellHeight,this.cellHeight(c);}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=M$1),this._setStaticClass();let u=t.engineClass||l.engineClass||rt$2;if(this.engine=new u({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:c=>{c.forEach(d=>{let p=d.el;p&&(d._removeDOM?(p&&p.remove(),delete d._removeDOM):this._writePosAttr(p,d));}),this._updateContainerHeight();}}),t.auto&&(this.batchUpdate(),this.engine._loading=true,this.getGridItems().forEach(c=>this._prepareElement(c)),delete this.engine._loading,this.batchUpdate(false)),t.children){let c=t.children;delete t.children,c.length&&this.load(c);}this.setAnimation(),t.subGridDynamic&&!f.pauseDrag&&(f.pauseDrag=true),t.draggable?.pause!==void 0&&(f.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent();}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`);}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i.el?t=i.el:l.addRemoveCB?t=l.addRemoveCB(this.el,e,true,false):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(r=>r._id===i._id))return t;let s=this._readAttr(t);return h.defaults(e,s),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){let t=h.createDiv(["grid-stack-item",this.opts.itemClass]),i=h.createDiv(["grid-stack-item-content"],t);return h.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([s])=>{s.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,l.renderCB(i,e),e.grid?.prepareDragDrop(e.el));}),window.setTimeout(()=>e.visibleObservable?.observe(t))):l.renderCB(i,e),t}makeSubGrid(e,t,i,s=true){let r=e.gridstackNode;if(r||(r=this.makeWidget(e).gridstackNode),r.subGrid?.el)return r.subGrid;let n,a=this;for(;a&&!n;)n=a.opts?.subGridOpts,a=a.parentGridNode?.grid;t=h.cloneDeep(G$b(G$b(z$5(G$b({},this.opts),{id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0}),n||{}),t||r.subGridOpts||{})),r.subGridOpts=t;let u;t.column==="auto"&&(u=true,t.column=Math.max(r.w||1,i?.w||1),delete t.columnOpts);let c=r.el.querySelector(".grid-stack-item-content"),d,p;if(s&&(this._removeDD(r.el),p=z$5(G$b({},r),{x:0,y:0}),h.removeInternalForSave(p),delete p.subGridOpts,r.content&&(p.content=r.content,delete r.content),l.addRemoveCB?d=l.addRemoveCB(this.el,p,true,false):(d=h.createDiv(["grid-stack-item"]),d.appendChild(c),c=h.createDiv(["grid-stack-item-content"],r.el)),this.prepareDragDrop(r.el)),i){let C=u?t.column:r.w,w=r.h+i.h,D=r.el.style;D.transition="none",this.update(r.el,{w:C,h:w}),setTimeout(()=>D.transition=null);}let g=r.subGrid=l.addGrid(c,t);return i?._moving&&(g._isTemp=true),u&&(g._autoColumn=true),s&&g.makeWidget(d,p),i&&(i._moving?window.setTimeout(()=>h.simulateMouseEvent(i._event,"mouseenter",g.el),0):g.makeWidget(r.el,r)),this.resizeToContentCheck(false,r),g}removeAsSubGrid(e){let t=this.parentGridNode?.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,true,true),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,t.makeWidget(i.el,i);}),t.batchUpdate(false),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>h.simulateMouseEvent(e._event,"mouseenter",t.el),0));}save(e=true,t=false,i=l.saveCB,s){let r=this.engine.save(e,i,s);if(r.forEach(n=>{if(e&&n.el&&!n.subGrid&&!i){let a=n.el.querySelector(".grid-stack-item-content");n.content=a?.innerHTML,n.content||delete n.content;}else if(!e&&!i&&delete n.content,n.subGrid?.el){let a=n.w||n.subGrid.getColumn(),u=n.subGrid.save(e,t,i,a);n.subGridOpts=t?u:{children:u},delete n.subGrid;}delete n.el;}),t){let n=h.cloneDeep(this.opts);n.marginBottom===n.marginTop&&n.marginRight===n.marginLeft&&n.marginTop===n.marginRight&&(n.margin=n.marginTop,delete n.marginTop,delete n.marginRight,delete n.marginBottom,delete n.marginLeft),n.rtl===(this.el.style.direction==="rtl")&&(n.rtl="auto"),this._isAutoCellHeight&&(n.cellHeight="auto"),this._autoColumn&&(n.column="auto");let a=n._alwaysShowResizeHandle;return delete n._alwaysShowResizeHandle,a!==void 0?n.alwaysShowResizeHandle=a:delete n.alwaysShowResizeHandle,h.removeInternalAndSame(n,P$2),n.children=r,n}return r}load(e,t=l.addRemoveCB||true){e.forEach(d=>{d.w=d.w||d.minW||1,d.h=d.h||d.minH||1;}),e=h.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=true;let i=0;e.forEach(d=>{i=Math.max(i,(d.x||0)+d.w);}),i>this.engine.defaultColumn&&(this.engine.defaultColumn=i);let s=this.getColumn();i>s&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(i,s,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,i,true));let r=l.addRemoveCB;typeof t=="function"&&(l.addRemoveCB=t);let n=[];this.batchUpdate();let a=!this.engine.nodes.length,u=a&&this.opts.animate;u&&this.setAnimation(false),!a&&t&&[...this.engine.nodes].forEach(p=>{if(!p.id)return;h.find(e,p.id)||(l.addRemoveCB&&l.addRemoveCB(this.el,p,false,false),n.push(p),this.removeWidget(p.el,true,false));}),this.engine._loading=true;let c=[];return this.engine.nodes=this.engine.nodes.filter(d=>h.find(e,d.id)?(c.push(d),false):true),e.forEach(d=>{let p=h.find(c,d.id);if(p){if(h.shouldSizeToContent(p)&&(d.h=p.h),this.engine.nodeBoundFix(d),(d.autoPosition||d.x===void 0||d.y===void 0)&&(d.w=d.w||p.w,d.h=d.h||p.h,this.engine.findEmptyPosition(d)),this.engine.nodes.push(p),h.samePos(p,d)&&this.engine.nodes.length>1&&(this.moveNode(p,z$5(G$b({},d),{forceCollide:true})),h.copyPos(d,p)),this.update(p.el,d),d.subGridOpts?.children){let g=p.el.querySelector(".grid-stack");g&&g.gridstack&&g.gridstack.load(d.subGridOpts.children);}}else t&&this.addWidget(d);}),delete this.engine._loading,this.engine.removedNodes=n,this.batchUpdate(false),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,r?l.addRemoveCB=r:delete l.addRemoveCB,u&&this.setAnimation(true,true),this}batchUpdate(e=true){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=false){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;let t=this.el.querySelector("."+this.opts.itemClass);if(t){let s=h.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/s)}let i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){let i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i;}let t=h.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=false){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){let e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return false;let t=this.getColumn(),i=t,s=this._widthOrContainer(true);if(e.columnWidth)i=Math.min(Math.round(s/e.columnWidth)||1,e.columnMax);else {i=e.columnMax;let r=0;for(;r<e.breakpoints.length&&s<=e.breakpoints[r].w;)i=e.breakpoints[r++].c||t;}if(i!==t){let r=e.breakpoints?.find(n=>n.c===i);return this.column(i,r?.layout||e.layout),true}return false}compact(e="compact",t=true){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;let i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(true),this._ignoreLayoutsNodeChange=true,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=true){if(this.el)return this.offAll(),this._updateResizeEvent(true),this.setStatic(true,false),this.setAnimation(false),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=false){let i=this.el.getBoundingClientRect(),s;t?s={top:i.top+document.documentElement.scrollTop,left:i.left}:s={top:this.el.offsetTop,left:this.el.offsetLeft};let r=e.left-s.left,n=e.top-s.top,a=i.width/this.getColumn(),u=i.height/parseInt(this.el.getAttribute("gs-current-row"));return {x:Math.floor(r/a),y:Math.floor(n/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,s){return this.engine.isAreaEmpty(e,t,i,s)}makeWidget(e,t){let i=l.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,true,t);let s=i.gridstackNode;this._updateContainerHeight(),s.subGridOpts&&this.makeSubGrid(i,s.subGridOpts,void 0,false);let r;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(r=this._ignoreLayoutsNodeChange=true),this._triggerAddEvent(),this._triggerChangeEvent(),r&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(s=>this.on(s,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=s=>t(s):this._gsEventHandler[e]=s=>{s.detail&&t(s,s.detail);},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=true,i=true){return e?(l.getElements(e).forEach(s=>{if(s.parentElement&&s.parentElement!==this.el)return;let r=s.gridstackNode;r||(r=this.engine.nodes.find(n=>s===n.el)),r&&(t&&l.addRemoveCB&&l.addRemoveCB(this.el,r,false,false),delete s.gridstackNode,this._removeDD(s),this.engine.removeNode(r,t,i),t&&s.parentElement&&s.remove());}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=true,t=true){return this.engine.nodes.forEach(i=>{e&&l.addRemoveCB&&l.addRemoveCB(this.el,i,false,false),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el);}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e);}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=true,i=true){return !!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=true:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(s=>{this.prepareDragDrop(s.el),s.subGrid&&i&&s.subGrid.setStatic(e,t,i);}),t&&this._setStaticClass(),this)}updateOptions(e){let t=this.opts;if(e===t)return this;if(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts){let i=!!this.opts.columnOpts;this.opts.columnOpts=e.columnOpts,i!==!!this.opts.columnOpts&&this._updateResizeEvent(),this.checkDynamicColumn();}else e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column);return e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(t.minRow=t.maxRow=t.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(t.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(t.maxRow=this.engine.maxRow=e.maxRow)),e.lazyLoad!==void 0&&(t.lazyLoad=e.lazyLoad),e.children?.length&&this.load(e.children),this}update(e,t){return l.getElements(e).forEach(i=>{let s=i?.gridstackNode;if(!s)return;let r=G$b(G$b({},h.copyPos({},s)),h.cloneDeep(t));this.engine.nodeBoundFix(r),delete r.autoPosition;let n=["x","y","w","h"],a;if(n.some(d=>r[d]!==void 0&&r[d]!==s[d])&&(a={},n.forEach(d=>{a[d]=r[d]!==void 0?r[d]:s[d],delete r[d];})),!a&&(r.minW||r.minH||r.maxW||r.maxH)&&(a={}),r.content!==void 0){let d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==r.content&&(s.content=r.content,l.renderCB(d,r),s.subGrid?.el&&(d.appendChild(s.subGrid.el),s.subGrid._updateContainerHeight())),delete r.content;}let u=false,c=false;for(let d in r)d[0]!=="_"&&s[d]!==r[d]&&(s[d]=r[d],u=true,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(h.sanitizeMinMax(s),a){let d=a.w!==void 0&&a.w!==s.w;this.moveNode(s,a),d&&s.subGrid?s.subGrid.onResize(this.hasAnimationCSS()?s.w:void 0):this.resizeToContentCheck(d,s),delete s._orig;}(a||u)&&this._writeAttr(i,s),c&&this.prepareDragDrop(s.el),l.updateCB&&l.updateCB(s);}),this}moveNode(e,t){let i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate());}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;let t=e.gridstackNode;if(!t)return;let i=t.grid;if(!i||e.parentElement!==i.el)return;let s=i.getCellHeight(true);if(!s)return;let r=t.h?t.h*s:e.clientHeight,n;if(t.resizeToContentParent&&(n=e.querySelector(t.resizeToContentParent)),n||(n=e.querySelector(l.resizeToContentParent)),!n)return;let a=e.clientHeight-n.clientHeight,u=t.h?t.h*s-a:n.clientHeight,c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(true);let g=t.subGrid.el.getBoundingClientRect(),C=e.getBoundingClientRect();c+=g.top-C.top;}else {if(t.subGridOpts?.children?.length)return;{let g=n.firstElementChild;if(!g){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${l.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=g.getBoundingClientRect().height||u;}}if(u===c)return;r+=c-u;let d=Math.ceil(r/s),p=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;p&&d>p&&(d=p,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=true,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange);}resizeToContentCBCheck(e){l.resizeToContentCB?l.resizeToContentCB(e):this.resizeToContent(e);}rotate(e,t){return l.getElements(e).forEach(i=>{let s=i.gridstackNode;if(!h.canBeRotated(s))return;let r={w:s.h,h:s.w,minH:s.minW,minW:s.minH,maxH:s.maxW,maxW:s.maxH};if(t){let a=t.left>0?Math.floor(t.left/this.cellWidth()):0,u=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;r.x=s.x+a-(s.h-(u+1)),r.y=s.y+u-a;}Object.keys(r).forEach(a=>{r[a]===void 0&&delete r[a];});let n=s._orig;this.update(i,r),s._orig=n;}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){let i=h.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;let e=this.engine.getDirtyNodes(true);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty;});let e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e);}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){let e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e);}return this}_triggerEvent(e,t){let i=t?new CustomEvent(e,{bubbles:false,detail:t}):new Event(e),s=this;for(;s.parentGridNode;)s=s.parentGridNode.grid;return s.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;let e=this.parentGridNode,t=this.getRow()+this._extraDragRow,i=this.opts.cellHeight,s=this.opts.cellHeightUnit;if(!i)return this;if(!e&&!this.opts.minRow){let r=h.parseHeight(getComputedStyle(this.el).minHeight);if(r.h>0&&r.unit===s){let n=Math.floor(r.h/i);t<n&&(t=n);}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+s),e&&h.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=false,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(P$2.itemClass,this.opts.itemClass);let s=h.shouldSizeToContent(i);return s?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),s&&this.resizeToContentCheck(false,i),h.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){if(!t._moving&&!t._resizing||this._placeholder===e){let i=this.opts.rtl?"right":"left";e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style[i]=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null;}return e.setAttribute("gs-x",String(t.x)),e.setAttribute("gs-y",String(t.y)),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);let i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(let s in i)t[s]?e.setAttribute(i[s],String(t[s])):e.removeAttribute(i[s]);return this}_readAttr(e,t=true){let i={};i.x=h.toNumber(e.getAttribute("gs-x")),i.y=h.toNumber(e.getAttribute("gs-y")),i.w=h.toNumber(e.getAttribute("gs-w")),i.h=h.toNumber(e.getAttribute("gs-h")),i.autoPosition=h.toBool(e.getAttribute("gs-auto-position")),i.noResize=h.toBool(e.getAttribute("gs-no-resize")),i.noMove=h.toBool(e.getAttribute("gs-no-move")),i.locked=h.toBool(e.getAttribute("gs-locked"));let s=e.getAttribute("gs-size-to-content");s&&(s==="true"||s==="false"?i.sizeToContent=h.toBool(s):i.sizeToContent=parseInt(s,10)),i.id=e.getAttribute("gs-id"),i.maxW=h.toNumber(e.getAttribute("gs-max-w")),i.minW=h.toNumber(e.getAttribute("gs-min-w")),i.maxH=h.toNumber(e.getAttribute("gs-max-h")),i.minH=h.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(let r in i){if(!i.hasOwnProperty(r))return;!i[r]&&i[r]!==0&&r!=="sizeToContent"&&delete i[r];}return i}_setStaticClass(){let e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let t=false;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),t=true):t=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize();}),this._skipInitialResize||this.resizeToContentCheck(t),delete this._skipInitialResize,this.batchUpdate(false),this}resizeToContentCheck(e=false,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(false,t),this.animationDelay);if(t)h.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>h.shouldSizeToContent(i))){let i=[...this.engine.nodes];this.batchUpdate(),i.forEach(s=>{h.shouldSizeToContent(s)&&this.resizeToContentCBCheck(s.el);}),this._ignoreLayoutsNodeChange=true,this.batchUpdate(false),this._ignoreLayoutsNodeChange=false;}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes);}}_updateResizeEvent(e=false){let t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return !e&&t&&!this.resizeObserver?(this._sizeThrottle=h.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=true):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return h.getElement(e)}static getElements(e=".grid-stack-item"){return h.getElements(e)}static getGridElement(e){return l.getElement(e)}static getGridElements(e){return h.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=h.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(n=>{this.opts[n]===void 0?this.opts[n]=t:(e=h.parseHeight(this.opts[n]),this.opts[n]=e.h,delete this.opts.margin);}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);let r=this.el.style;return r.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return O$2}static setupDragIn(e,t,i,s=document){t?.pause!==void 0&&(f.pauseDrag=t.pause),t=G$b({appendTo:"body",helper:"clone"},t||{}),(typeof e=="string"?h.getElements(e,s):e).forEach((n,a)=>{O$2.isDraggable(n)||O$2.dragIn(n,t),i?.[a]&&(n.gridstackNode=i[a]);});}movable(e,t){return this.opts.staticGrid?this:(l.getElements(e).forEach(i=>{let s=i.gridstackNode;s&&(t?delete s.noMove:s.noMove=true,this.prepareDragDrop(s.el));}),this)}resizable(e,t){return this.opts.staticGrid?this:(l.getElements(e).forEach(i=>{let s=i.gridstackNode;s&&(t?delete s.noResize:s.noResize=true,this.prepareDragDrop(s.el));}),this)}disable(e=true){if(!this.opts.staticGrid)return this.enableMove(false,e),this.enableResize(false,e),this._triggerEvent("disable"),this}enable(e=true){if(!this.opts.staticGrid)return this.enableMove(true,e),this.enableResize(true,e),this._triggerEvent("enable"),this}enableMove(e,t=true){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=true,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t);}),this)}enableResize(e,t=true){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=true,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t);}),this)}cancelDrag(){let e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=true,this.engine.removeNode(e)):e._isAboutToRemove&&l._itemRemoving(e.el,false),this.engine.restoreInitial());}_removeDD(e){return O$2.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return O$2.droppable(this.el,"destroy"),this;let e,t,i=(s,r,n)=>{n=n||r;let a=n.gridstackNode;if(!a)return;if(!a.grid?.el){n.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;let g=n.getBoundingClientRect();n.style.left=g.x+(this.dragTransform.xScale-1)*(s.clientX-g.x)/this.dragTransform.xScale+"px",n.style.top=g.y+(this.dragTransform.yScale-1)*(s.clientY-g.y)/this.dragTransform.yScale+"px",n.style.transformOrigin="0px 0px";}let{top:u,left:c}=n.getBoundingClientRect(),d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;let p={position:{top:u*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(c/t)),a.y=Math.max(0,Math.round(u/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=true,!this.engine.willItFit(a)){O$2.off(r,"drag");return}a._willFitPos&&(h.copyPos(a,a._willFitPos),delete a._willFitPos);}this._onStartMoving(n,s,p,a,t,e);}else this._dragOrResize(n,s,p,a,t,e);};return O$2.droppable(this.el,{accept:s=>{let r=s.gridstackNode||this._readAttr(s,false);if(r?.grid===this)return true;if(!this.opts.acceptWidgets)return false;let n=true;if(typeof this.opts.acceptWidgets=="function")n=this.opts.acceptWidgets(s);else {let a=this.opts.acceptWidgets===true?".grid-stack-item":this.opts.acceptWidgets;n=s.matches(a);}if(n&&r&&this.opts.maxRow){let a={w:r.w,h:r.h,minW:r.minW,minH:r.minH};n=this.engine.willItFit(a);}return n}}).on(this.el,"dropover",(s,r,n)=>{let a=n?.gridstackNode||r.gridstackNode;if(a?.grid===this&&!a._temporaryRemoved)return false;if(a?._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a?.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(r,n),n=n||r,t=this.cellWidth(),e=this.getCellHeight(true),!a){let d=n.getAttribute("data-gs-widget")||n.getAttribute("gridstacknode");if(d){try{a=JSON.parse(d);}catch(p){console.error("Gridstack dropover: Bad JSON format: ",d);}n.removeAttribute("data-gs-widget"),n.removeAttribute("gridstacknode");}a||(a=this._readAttr(n)),a._sidebarOrig={w:a.w,h:a.h};}a.grid||(a.el||(a=G$b({},a)),a._isExternal=true,n.gridstackNode=a);let u=a.w||Math.round(n.offsetWidth/t)||1,c=a.h||Math.round(n.offsetHeight/e)||1;return a.grid&&a.grid!==this?(r._gridstackNodeOrig||(r._gridstackNodeOrig=a),r.gridstackNode=a=z$5(G$b({},a),{w:u,h:c,grid:this}),delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=true):(a.w=u,a.h=c,a._temporaryRemoved=true),l._itemRemoving(a.el,false),O$2.on(r,"drag",i),i(s,r,n),false}).on(this.el,"dropout",(s,r,n)=>{let a=n?.gridstackNode||r.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(r,n),this._isTemp&&this.removeAsSubGrid(a)),false}).on(this.el,"drop",(s,r,n)=>{let a=n?.gridstackNode||r.gridstackNode;if(a?.grid===this&&!a._isExternal)return false;let u=!!this.placeholder.parentElement,c=r!==n;this.placeholder.remove(),delete this.placeholder.gridstackNode,u&&this.opts.animate&&(this.setAnimation(false),this.setAnimation(true,true));let d=r._gridstackNodeOrig;if(delete r._gridstackNodeOrig,u&&d?.grid&&d.grid!==this){let g=d.grid;g.engine.removeNodeFromLayoutCache(d),g.engine.removedNodes.push(d),g._triggerRemoveEvent()._triggerChangeEvent(),g.parentGridNode&&!g.engine.nodes.length&&g.opts.subGridDynamic&&g.removeAsSubGrid();}if(!a||(u&&(this.engine.cleanupNode(a),a.grid=this),delete a.grid?._isTemp,O$2.off(r,"drag"),n!==r?(n.remove(),r=n):r.remove(),this._removeDD(r),!u))return false;let p=a.subGrid?.el?.gridstack;return h.copyPos(a,this._readAttr(this.placeholder)),h.removePositioningStyles(r),c&&(a.content||a.subGridOpts||l.addRemoveCB)?(delete a.el,r=this.addWidget(a)):(this._prepareElement(r,true,a),this.el.appendChild(r),this.resizeToContentCheck(false,a),p&&(p.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped(z$5(G$b({},s),{type:"dropped"}),d&&d.grid?d:void 0,a),false}),this}static _itemRemoving(e,t){if(!e)return;let i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=true:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"));}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;let e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!O$2.isDroppable(e)&&O$2.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>l._itemRemoving(i,true)).on(e,"dropout",(t,i)=>l._itemRemoving(i,false)),this):this}prepareDragDrop(e,t=false){let i=e?.gridstackNode;if(!i)return;let s=i.noMove||this.opts.disableDrag,r=i.noResize||this.opts.disableResize,n=this.opts.staticGrid||s&&r;if((t||n)&&(i._initDD&&(this._removeDD(e),delete i._initDD),n))return e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!i._initDD){let a,u,c=(g,C)=>{this.triggerEvent(g,g.target),a=this.cellWidth(),u=this.getCellHeight(true),this._onStartMoving(e,g,C,i,a,u);},d=(g,C)=>{this._dragOrResize(e,g,C,i,a,u);},p=g=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;let C=i.w!==i._orig.w,w=g.target;if(!(!w.gridstackNode||w.gridstackNode.grid!==this)){if(i.el=w,i._isAboutToRemove){let D=e.gridstackNode.grid;D._gsEventHandler[g.type]&&D._gsEventHandler[g.type](g,w),D.engine.nodes.push(i),D.removeWidget(e,true,true);}else h.removePositioningStyles(w),i._temporaryRemoved?(this._writePosAttr(w,i),this.engine.addNode(i)):this._writePosAttr(w,i),this.triggerEvent(g,w);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),g.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(C,i));}};O$2.draggable(e,{start:c,stop:p,drag:d,rtl:this.opts.rtl}).resizable(e,{start:c,stop:p,resize:d,rtl:this.opts.rtl}),i._initDD=true;}return O$2.draggable(e,s?"disable":"enable").resizable(e,r?"disable":"enable"),this}_onStartMoving(e,t,i,s,r,n){if(this.engine.cleanNodes().beginUpdate(s),this._writePosAttr(this.placeholder,s),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=s,s.grid?.el)this.dragTransform=h.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){let a=this.placeholder.closest(".grid-stack");this.dragTransform=h.getValuesFromTransformedElement(a);}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(s.el=this.placeholder,s._lastUiPosition=i.position,s._prevYPix=i.position.top,s._moving=t.type==="dragstart",s._resizing=t.type==="resizestart",delete s._lastTried,t.type==="dropover"&&s._temporaryRemoved&&(this.engine.addNode(s),s._moving=true),this.engine.cacheRects(r,n,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){let a=this.getColumn()-s.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-s.y;O$2.resizable(e,"option","minWidth",r*Math.min(s.minW||1,a)).resizable(e,"option","minHeight",n*Math.min(s.minH||1,u)).resizable(e,"option","maxWidth",r*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,a)).resizable(e,"option","maxWidthMoveLeft",r*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,s.x+s.w)).resizable(e,"option","maxHeight",n*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",n*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,s.y+s.h));}}_dragOrResize(e,t,i,s,r,n){let a=G$b({},s._orig),u,c=this.opts.marginLeft,d=this.opts.marginRight,p=this.opts.marginTop,g=this.opts.marginBottom,C=Math.round(n*.1),w=Math.round(r*.1);if(c=Math.min(c,w),d=Math.min(d,w),p=Math.min(p,C),g=Math.min(g,C),t.type==="drag"){if(s._temporaryRemoved)return;s._prevYPix=i.position.top,this.opts.draggable.scroll!==false&&f.dragElement?.updateScrollPosition(this.el);let U=i.position.left+(i.position.left>s._lastUiPosition.left?-d:c),ti=i.position.top+(i.position.top>s._lastUiPosition.top?-g:p);a.x=Math.round(U/r),a.y=Math.round(ti/n);let ii=this._extraDragRow;if(this.engine.collide(s,a)){let Xe=this.getRow(),Qe=Math.max(0,a.y+s.h-Xe);this.opts.maxRow&&Xe+Qe>this.opts.maxRow&&(Qe=Math.max(0,this.opts.maxRow-Xe)),this._extraDragRow=Qe;}else this._extraDragRow=0;if(this._extraDragRow!==ii&&this._updateContainerHeight(),s.x===a.x&&s.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(h.updateScrollResize(t,e,n),a.w=Math.round((i.size.width-c)/r),a.h=Math.round((i.size.height-p)/n),s.w===a.w&&s.h===a.h)||s._lastTried&&s._lastTried.w===a.w&&s._lastTried.h===a.h)return;if(t.hasMovedX){let U=i.position.left+c;a.x=Math.round(U/r);}if(t.hasMovedY){let U=i.position.top+p;a.y=Math.round(U/n);}u=true;}s._event=t,s._lastTried=a;let D={x:i.position.left+c,y:i.position.top+p,w:(i.size?i.size.width:s.w*r)-c-d,h:(i.size?i.size.height:s.h*n)-p-g};if(this.engine.moveNodeCheck(s,z$5(G$b({},a),{cellWidth:r,cellHeight:n,rect:D,resizing:u}))){s._lastUiPosition=i.position,this.engine.cacheRects(r,n,p,d,g,c),delete s._skipDown,u&&s.subGrid&&s.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();let U=t.target;s._sidebarOrig||this._writePosAttr(U,s),this.triggerEvent(t,U);}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t);}_leave(e,t){t=t||e;let i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,O$2.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=true,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;let s=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=s,this.opts.removable===true&&l._itemRemoving(e,true),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial();}}return l.renderCB=(o,e)=>{o&&e?.content&&(o.textContent=e.content);},l.resizeToContentParent=".grid-stack-item-content",l.Utils=h,l.Engine=rt$2,l.GDRev="12.6.0",l})();var Vt$1=["container"],ri$1=["*"];function oi$1(l,o){}var ni$1=["*",[["","empty-content",""]]],ai$1=["*","[empty-content]"],li$2=["*ngIf","isEmpty"];function di$2(l,o){l&1&&zw(0,1,li$2);}function hi$2(l,o){}var Ke$2=(()=>{class l{serialize(){}deserialize(e){this.widgetItem=e,e&&e.input&&Object.assign(this,e.input);}}return l.\u0275fac=function(e){return new(e||l)},l.\u0275prov=Q$6({token:l,factory:l.\u0275fac}),l})(),Kt$1=(()=>{class l{constructor(e){this.elementRef=e,this.el._gridItemComp=this;}set options(e){let t=this.el.gridstackNode?.grid;t?t.update(this.el,e):this._options=z$5(G$b({},e),{el:this.el});}get options(){return this.el.gridstackNode||this._options||{el:this.el}}get el(){return this.elementRef.nativeElement}clearOptions(){delete this._options;}ngOnDestroy(){this.clearOptions(),delete this.childWidget,delete this.el._gridItemComp,delete this.container,delete this.ref;}}return l.\u0275fac=function(e){return new(e||l)(Ur$4(Lr$5))},l.\u0275cmp=JD({type:l,selectors:[["gridstack-item"]],viewQuery:function(e,t){if(e&1&&Jh(Vt$1,7,Ki$5),e&2){let i;Zw(i=Yw())&&(t.container=i.first);}},inputs:{options:"options"},ngContentSelectors:ri$1,decls:5,vars:1,consts:[["container",""],[1,"grid-stack-item-content"]],template:function(e,t){e&1&&(Gw(),dl$2(0,"div",1),Ah(1,oi$1,0,0,"ng-template",null,0,qT),zw(3),TT(4),fl$2()),e&2&&(EE(4),gl$2(" ",t.options.content," "));},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:1}),l})(),Ce$1=(()=>{class l{constructor(e){this.elementRef=e,this.addedCB=new Qe$a,this.changeCB=new Qe$a,this.disableCB=new Qe$a,this.dragCB=new Qe$a,this.dragStartCB=new Qe$a,this.dragStopCB=new Qe$a,this.droppedCB=new Qe$a,this.enableCB=new Qe$a,this.removedCB=new Qe$a,this.resizeCB=new Qe$a,this.resizeStartCB=new Qe$a,this.resizeStopCB=new Qe$a,Y$1.addRemoveCB||(Y$1.addRemoveCB=ci$2),Y$1.saveCB||(Y$1.saveCB=ui$2),Y$1.updateCB||(Y$1.updateCB=pi$2),this.el._gridComp=this;}set options(e){this._grid?this._grid.updateOptions(e):this._options=e;}get options(){return this._grid?.opts||this._options||{}}get el(){return this.elementRef.nativeElement}get grid(){return this._grid}static addComponentToSelectorType(e){e.forEach(t=>l.selectorToType[l.getSelector(t)]=t);}static getSelector(e){return Xj(e).selector}ngOnInit(){this.loaded=!!this.options?.children?.length,this._grid=Y$1.init(this._options,this.el),delete this._options,this.checkEmpty();}ngAfterContentInit(){this._sub=this.gridstackItems?.changes.subscribe(()=>this.updateAll()),this.loaded||this.updateAll(),this.hookEvents(this.grid);}ngOnDestroy(){this.unhookEvents(this._grid),this._sub?.unsubscribe(),this._grid?.destroy(),delete this._grid,delete this.el._gridComp,delete this.container,delete this.ref;}updateAll(){if(!this.grid)return;let e=[];this.gridstackItems?.forEach(t=>{e.push(t.options),t.clearOptions();}),this.grid.load(e);}checkEmpty(){this.grid&&(this.isEmpty=!this.grid.engine.nodes.length);}hookEvents(e){e&&(e.parentGridNode||e.on("added",(t,i)=>{(i[0].grid?.el._gridComp||this).checkEmpty(),this.addedCB.emit({event:t,nodes:i});}).on("change",(t,i)=>this.changeCB.emit({event:t,nodes:i})).on("disable",t=>this.disableCB.emit({event:t})).on("drag",(t,i)=>this.dragCB.emit({event:t,el:i})).on("dragstart",(t,i)=>this.dragStartCB.emit({event:t,el:i})).on("dragstop",(t,i)=>this.dragStopCB.emit({event:t,el:i})).on("dropped",(t,i,s)=>this.droppedCB.emit({event:t,previousNode:i,newNode:s})).on("enable",t=>this.enableCB.emit({event:t})).on("removed",(t,i)=>{(i[0].grid?.el._gridComp||this).checkEmpty(),this.removedCB.emit({event:t,nodes:i});}).on("resize",(t,i)=>this.resizeCB.emit({event:t,el:i})).on("resizestart",(t,i)=>this.resizeStartCB.emit({event:t,el:i})).on("resizestop",(t,i)=>this.resizeStopCB.emit({event:t,el:i})));}unhookEvents(e){e&&(e.parentGridNode||e.off("added change disable drag dragstart dragstop dropped enable removed resize resizestart resizestop"));}}return l.selectorToType={},l.\u0275fac=function(e){return new(e||l)(Ur$4(Lr$5))},l.\u0275cmp=JD({type:l,selectors:[["gridstack"]],contentQueries:function(e,t,i){if(e&1&&Kh$1(i,Kt$1,4),e&2){let s;Zw(s=Yw())&&(t.gridstackItems=s);}},viewQuery:function(e,t){if(e&1&&Jh(Vt$1,7,Ki$5),e&2){let i;Zw(i=Yw())&&(t.container=i.first);}},inputs:{options:"options",isEmpty:"isEmpty"},outputs:{addedCB:"addedCB",changeCB:"changeCB",disableCB:"disableCB",dragCB:"dragCB",dragStartCB:"dragStartCB",dragStopCB:"dragStopCB",droppedCB:"droppedCB",enableCB:"enableCB",removedCB:"removedCB",resizeCB:"resizeCB",resizeStartCB:"resizeStartCB",resizeStopCB:"resizeStopCB"},ngContentSelectors:ai$1,decls:4,vars:1,consts:[["container",""],[4,"ngIf"]],template:function(e,t){e&1&&(Gw(ni$1),xh$1(0,di$2,1,0,"ng-content",1)(1,hi$2,0,0,"ng-template",null,0,qT),zw(3)),e&2&&Bh("ngIf",t.isEmpty);},dependencies:[Va$4],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:1}),l})();function ci$2(l,o,e,t){if(e){if(!l)return;if(t){let i=l.parentElement?._gridItemComp;if(!i)return;let r=(i.childWidget?.container||i.container)?.createComponent(Ce$1),n=r?.instance;return n?(n.ref=r,n.options=o,n.el):void 0}else {let s=l._gridComp?.container?.createComponent(Kt$1),r=s?.instance;if(!r)return;r.ref=s;let n=o.selector,a=n?Ce$1.selectorToType[n]:void 0;if(a){let u=()=>{let d=r.container?.createComponent(a)?.instance;d&&typeof d.serialize=="function"&&typeof d.deserialize=="function"&&(r.childWidget=d,d.deserialize(o));};o.lazyLoad||o.grid?.opts?.lazyLoad&&o.lazyLoad!==false?o.visibleObservable||(o.visibleObservable=new IntersectionObserver(([d])=>{d.isIntersecting&&(o.visibleObservable?.disconnect(),delete o.visibleObservable,u());}),window.setTimeout(()=>o.visibleObservable?.observe(r.el))):u();}return r.el}}else if(t){let i=o.el?._gridComp;i?.ref?i.ref.destroy():i?.ngOnDestroy();}else {let i=o.el?._gridItemComp;i?.ref?i.ref.destroy():i?.ngOnDestroy();}}function ui$2(l,o){let e=l.el?._gridItemComp;if(e){let i=e.childWidget?.serialize();i&&(o.input=i);return}l.el?._gridComp;}function pi$2(l){let o=l,e=l.el?._gridItemComp;e?.childWidget&&o.input&&e.childWidget.deserialize(o);}var gi$2=()=>[],fi$2=(l,o)=>o.id;function mi$2(l,o){if(l&1&&Uh(0,"div",4),l&2){let e=o.$index;qw(2);let t=xT(0);ig("background-color",t===e?"var(--mat-sys-on-surface)":"var(--mat-sys-inverse-on-surface)");}}function yi$2(l,o){if(l&1&&(dl$2(0,"div",0),pi$5("fade-toast"),dl$2(1,"span",1),TT(2),fl$2()(),dl$2(3,"div",2),pi$5("fade-toast"),xw(4,mi$2,1,2,"div",3,fi$2),fl$2()),l&2){qw();let e=xT(1),t=xT(2);EE(2),gg(t.name),EE(2),Aw(e);}}var jt$1=(()=>{class l{activePage=Hj();dashboards=Hj();visible=vt$9(false);constructor(){Fa$5(()=>{let e=this.activePage();if(e==null){this.visible.set(false);return}this.visible.set(false),queueMicrotask(()=>this.visible.set(true));});}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=JD({type:l,selectors:[["dashboard-scroller"]],inputs:{activePage:[1,"activePage"],dashboards:[1,"dashboards"]},decls:4,vars:5,consts:[[1,"page-scroll-title","page-scroll-container"],[1,"page-label"],[1,"page-scroll-page-number","page-scroll-container","fade-toast"],[1,"page-marker",3,"background-color"],[1,"page-marker"]],template:function(t,i){if(t&1&&(wg(0)(1)(2),_w(3,yi$2,6,1)),t&2){let s=NT(i.activePage());EE();let r=NT(i.dashboards()??FT(4,gi$2));EE();let n=NT(s==null?null:r[s]);EE(),Mw(i.visible()&&n?3:-1);}},styles:["[_nghost-%COMP%]{pointer-events:none}.page-scroll-title[_ngcontent-%COMP%]{position:absolute;top:50%;right:54px;transform:translateY(-50%);z-index:100;cursor:default;text-align:center;padding:10px;color:var(--mat-sys-inverse-surface)}.page-scroll-page-number[_ngcontent-%COMP%]{position:absolute;top:50%;right:15px;transform:translateY(-50%);z-index:100;cursor:default;display:grid;padding:0}.page-scroll-container[_ngcontent-%COMP%]{opacity:0;background-color:var(--mat-sys-tertiary-fixed-dim);border-radius:10px;border:1px solid var(--mat-sys-inverse-surface)}.page-label[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface);text-shadow:1px 1px 0 var(--mat-sys-outline),-1px 1px 0 var(--mat-sys-outline),-1px -1px 0 var(--mat-sys-outline),1px -1px 0 var(--mat-sys-outline);font-size:x-large}.page-marker[_ngcontent-%COMP%]{height:20px;width:20px;margin:4px;border-radius:50%;border:1px solid var(--mat-sys-outline)}@keyframes _ngcontent-%COMP%_fadeInHoldFadeOut{0%{opacity:0}7.407%{opacity:1}25.926%{opacity:1}to{opacity:0}}.fade-toast[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_fadeInHoldFadeOut 1.35s linear forwards}"]})}return l})();var Yt$1=(()=>{class l{twoFingerTapEnabled=Hj(true);twoFingerTapMaxDurationMs=Hj(450);twoFingerTapMoveThresholdPx=Hj(24);twoFingerTapPreventDefault=Hj(true);twoFingerTap=Vj();pointers=new Map;candidate=false;moved=false;startedAtMs=0;blocked=false;onPointerDown(e){if(!(!this.twoFingerTapEnabled()||e.pointerType!=="touch")){if(this.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.pointers.size===2&&!this.blocked){this.candidate=true,this.moved=false,this.startedAtMs=Date.now();return}this.pointers.size>2&&(this.blocked=true,this.resetTracking(false));}}onPointerMove(e){if(!this.candidate||e.pointerType!=="touch")return;let t=this.pointers.get(e.pointerId);if(!t)return;let i=e.clientX-t.x,s=e.clientY-t.y;Math.hypot(i,s)>this.twoFingerTapMoveThresholdPx()&&(this.moved=true);}onPointerUp(e){if(e.pointerType!=="touch")return;if(this.pointers.delete(e.pointerId),this.blocked){this.pointers.size===0&&(this.blocked=false);return}if(!this.candidate||this.pointers.size>0)return;let t=Date.now()-this.startedAtMs,i=!this.moved&&t<=this.twoFingerTapMaxDurationMs();this.resetTracking(false),i&&(this.twoFingerTapPreventDefault()&&(e.preventDefault(),e.stopPropagation()),this.twoFingerTap.emit(e));}onPointerCancel(e){e.pointerType==="touch"&&(this.pointers.delete(e.pointerId),this.pointers.size===0&&this.resetTracking(true));}resetTracking(e){this.pointers.clear(),this.candidate=false,this.moved=false,this.startedAtMs=0,e||(this.blocked=false);}static \u0275fac=function(t){return new(t||l)};static \u0275dir=nw({type:l,selectors:[["","twoFingerTap",""]],hostBindings:function(t,i){t&1&&Qh("pointerdown",function(r){return i.onPointerDown(r)})("pointermove",function(r){return i.onPointerMove(r)})("pointerup",function(r){return i.onPointerUp(r)})("pointercancel",function(r){return i.onPointerCancel(r)});},inputs:{twoFingerTapEnabled:[1,"twoFingerTapEnabled"],twoFingerTapMaxDurationMs:[1,"twoFingerTapMaxDurationMs"],twoFingerTapMoveThresholdPx:[1,"twoFingerTapMoveThresholdPx"],twoFingerTapPreventDefault:[1,"twoFingerTapPreventDefault"]},outputs:{twoFingerTap:"twoFingerTap"}})}return l})();function bi$2(l,o){if(l&1){let e=Fw();Pi$5(0,"button",0),Qh("click",function(){ud(e);let i=qw();return dd(i.clickAction("cancel"))}),Pi$5(1,"mat-icon",1),TT(2,"close"),ul$2(),Pi$5(3,"span"),TT(4,"Close"),ul$2()();}}var je$1=(()=>{class l{_bottomSheetRef=w$4(_$5);data=w$4(vA);showCancel=!!(this.data&&this.data.showCancel);clickAction(e){this._bottomSheetRef.dismiss(e);}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=JD({type:l,selectors:[["widget-host-bottom-sheet"]],decls:22,vars:1,consts:[["mat-list-item","",3,"click"],["matListItemIcon",""],["mat-list-item",""]],template:function(t,i){t&1&&(Pi$5(0,"mat-action-list")(1,"button",0),Qh("click",function(){return i.clickAction("duplicate")}),Pi$5(2,"mat-icon",1),TT(3,"add_to_photos"),ul$2(),Pi$5(4,"span"),TT(5,"Duplicate"),ul$2()(),Pi$5(6,"button",0),Qh("click",function(){return i.clickAction("copy")}),Pi$5(7,"mat-icon",1),TT(8,"content_copy"),ul$2(),Pi$5(9,"span"),TT(10,"Copy"),ul$2()(),Pi$5(11,"button",0),Qh("click",function(){return i.clickAction("cut")}),Pi$5(12,"mat-icon",1),TT(13,"content_cut"),ul$2(),Pi$5(14,"span"),TT(15,"Cut"),ul$2()(),Pi$5(16,"button",0),Qh("click",function(){return i.clickAction("delete")}),Pi$5(17,"mat-icon",1),TT(18,"delete_forever"),ul$2(),Pi$5(19,"span"),TT(20,"Delete"),ul$2()(),_w(21,bi$2,5,0,"button",2),ul$2()),t&2&&(EE(21),Mw(i.showCancel?21:-1));},dependencies:[Jt$8,Xt$5,Zt$7,st$7,yt$3,wt$3],encapsulation:2})}return l})();var Ye$2=(()=>{class l{http=w$4(yr$5);connection=w$4(T$2);pluginConfig=w$4(w$2);destroyRef=w$4(xe$3);kipPluginServiceUrl=null;constructor(){this.connection.serverServiceEndpoint$.pipe(Gp(this.destroyRef)).subscribe(e=>{let t=e?.httpServiceUrl||null;this.kipPluginServiceUrl=this.resolveKipPluginServiceUrl(t);});}resolveKipPluginServiceUrl(e){let t=this.connection.signalKURL?.url?.trim();return t?`${t.endsWith("/")?t.slice(0,-1):t}/plugins/kip/`:e?`${(e.endsWith("/")?e.slice(0,-1):e).replace(/\/signalk\/v2\/api$/,"").replace(/\/signalk\/v1\/api$/,"").replace(/\/signalk\/v2$/,"").replace(/\/signalk\/v1$/,"").replace(/\/signalk$/,"")}/plugins/kip/`:null}reconcileSeries(e){return Zr$4(this,null,function*(){try{if(!(yield this.pluginConfig.getKipRuntimeModeConfigCached("kip")).historySeriesServiceEnabled)return console.warn("[KipSeriesApiClientService] Reconcile skipped because history-series service is disabled in KIP plugin settings"),null;if(!this.kipPluginServiceUrl)return console.warn("[KipSeriesApiClientService] No KIP plugin endpoint available for series reconcile"),null;let i=`${this.kipPluginServiceUrl}series/reconcile`;console.log(`[KipSeriesApiClientService] POST ${i} (${e.length} series)`);let s=yield _m(this.http.post(i,e));return console.log(`[KipSeriesApiClientService] Series reconcile successful (created=${s.created}, updated=${s.updated}, deleted=${s.deleted}, total=${s.total})`),s}catch(t){return console.error("[KipSeriesApiClientService] Series reconcile request failed:",t),null}})}getSeriesDefinitions(){return Zr$4(this,null,function*(){try{if(!(yield this.pluginConfig.getKipRuntimeModeConfigCached("kip")).historySeriesServiceEnabled)return console.warn("[KipSeriesApiClientService] Series list skipped because history-series service is disabled in KIP plugin settings"),null;if(!this.kipPluginServiceUrl)return console.warn("[KipSeriesApiClientService] No KIP plugin endpoint available for series list"),null;let t=`${this.kipPluginServiceUrl}series`;return yield _m(this.http.get(t))}catch(e){return console.error("[KipSeriesApiClientService] Series list request failed:",e),null}})}getValues(e){return Zr$4(this,null,function*(){try{if(!this.kipPluginServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.kipPluginServiceUrl}history/values`,i=new de$8;i=i.set("paths",e.paths),e.context&&(i=i.set("context",e.context)),e.from&&(i=i.set("from",e.from)),e.to&&(i=i.set("to",e.to)),e.duration&&(i=i.set("duration",e.duration.toString())),e.resolution!==void 0&&e.resolution!==null&&(i=i.set("resolution",e.resolution.toString()));let s=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${s}`);let r=yield _m(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] History fetch successful, received ${r.data?.length??0} data points`),r}catch(t){return console.error("[HistoryApiClientService] History API request failed:",t),null}})}static \u0275fac=function(t){return new(t||l)};static \u0275prov=Q$6({token:l,factory:l.\u0275fac,providedIn:"root"})}return l})();var vi$2={batteries:"bms",solar:"solarCharger",chargers:"charger",inverters:"inverter",alternators:"alternator",ac:"ac"},Qt$2=(()=>{class l{dashboard=w$4(G$2);kipSeries=w$4(Ye$2);destroyRef=w$4(xe$3);connection=w$4(T$2);pluginConfig=w$4(w$2);widgetService=w$4(v);serverEndpoint=Wp(this.connection.serverServiceEndpoint$,{initialValue:null});RECONCILE_DEBOUNCE_MS=750;AUTO_RETENTION_MS=1440*60*1e3;reconcileTimer=null;lastSubmittedSignature=null;pendingSignature=null;pendingSeries=[];constructor(){Fa$5(()=>{let e=this.serverEndpoint(),t=this.dashboard.dashboards();if(e?.httpServiceUrl)try{let i=this.extractSeriesFromDashboards(t);this.scheduleReconcile(i);}catch(i){console.error("[DashboardHistorySeriesSyncService] Error extracting series from dashboards:",i);}}),this.destroyRef.onDestroy(()=>{this.reconcileTimer!==null&&(clearTimeout(this.reconcileTimer),this.reconcileTimer=null);});}scheduleReconcile(e){let t=this.getCanonicalSeriesSignature(e);t!==this.lastSubmittedSignature&&(this.pendingSeries=e,this.pendingSignature=t,this.reconcileTimer!==null&&clearTimeout(this.reconcileTimer),this.reconcileTimer=window.setTimeout(()=>{this.flushReconcile();},this.RECONCILE_DEBOUNCE_MS));}flushReconcile(){return Zr$4(this,null,function*(){if(!this.pendingSignature)return;let e=this.pendingSignature,t=this.pendingSeries;if(this.pendingSignature=null,this.reconcileTimer=null,!(yield this.pluginConfig.getKipRuntimeModeConfigCached("kip")).historySeriesServiceEnabled){console.warn("[DashboardHistorySeriesSyncService] Reconcile skipped because history series service mode is disabled"),this.lastSubmittedSignature=e;return}try{(yield this.kipSeries.reconcileSeries(t))?this.lastSubmittedSignature=e:console.warn("[DashboardHistorySeriesSyncService] Reconcile did not complete; will retry on next cycle");}catch(s){console.error("[DashboardHistorySeriesSyncService] Reconcile failed:",s);}})}extractSeriesFromDashboards(e){let t=[];return e.forEach(i=>{let s=this.coerceNodeList(i.configuration);this.collectSeriesFromNodes(s,t);}),t.sort((i,s)=>i.seriesId.localeCompare(s.seriesId))}resolveSeriesForWidget(e){let t=e?.type,i=e?.uuid,s=this.resolveWidgetConfig(t,e?.config);if(!t||!i||s?.supportAutomaticHistoricalSeries===false)return [];if(t==="widget-data-chart"){let n=this.mapDataChartWidget(i,t,s);return n?[n]:[]}if(t==="widget-windtrends-chart")return this.mapWindTrendsWidget(i,t,s);let r=a$1(t);if(r?.templateExpansionMode){let n=this.mapElectricalTemplateWidget(i,s,r);if(n)return [n]}return this.mapAutomaticHistorySeries(i,t,s)}resolveWidgetConfig(e,t){if(!e)return t;let i=this.getDefaultConfigForType(e);return i?t?z$5(G$b(G$b({},i),t),{paths:t.paths??i.paths}):i:t}getDefaultConfigForType(e){return this.widgetService.getDefaultConfig(e)}collectSeriesFromNodes(e,t){e.forEach(i=>{let s=i?.input?.widgetProperties;t.push(...this.resolveSeriesForWidget(s));let r=this.coerceNodeList(i?.subGridOpts?.children);r.length>0&&this.collectSeriesFromNodes(r,t);});}mapDataChartWidget(e,t,i){let s=this.normalizeString(i?.datachartPath);return s?{seriesId:`${e}:datachart`,datasetUuid:e,ownerWidgetUuid:e,ownerWidgetSelector:t,path:s,context:null,source:this.normalizeString(i?.datachartSource),timeScale:this.normalizeString(i?.timeScale),period:this.normalizeNumber(i?.period),retentionDurationMs:null,sampleTime:null,enabled:true}:null}mapWindTrendsWidget(e,t,i){let s={ownerWidgetUuid:e,ownerWidgetSelector:t,context:null,source:"default",timeScale:this.normalizeString(i?.timeScale),period:30,retentionDurationMs:null,sampleTime:null,enabled:true};return [z$5(G$b({},s),{seriesId:`${e}:wind-direction`,datasetUuid:`${e}-twd`,path:"self.environment.wind.directionTrue"}),z$5(G$b({},s),{seriesId:`${e}:wind-speed`,datasetUuid:`${e}-tws`,path:"self.environment.wind.speedTrue"})]}mapElectricalTemplateWidget(e,t,i){let s=i.templateExpansionMode;if(!s)return null;let r=this.resolveElectricalAllowedIds(t,i.familyKey),n=this.resolveTrackedDevicePairs(t,i.familyKey),a=i.familyKey;return {seriesId:`${e}:${a}-template`,datasetUuid:`${e}:${a}-template`,ownerWidgetUuid:e,ownerWidgetSelector:i.selector,path:`${i.selfRootPath}.*`,expansionMode:s,familyKey:i.familyKey,allowedIds:r.length>0?[...r]:null,trackedDevices:n.length>0?[...n]:null,context:null,source:"default",timeScale:this.normalizeString(t?.timeScale),period:this.normalizeNumber(t?.period),retentionDurationMs:this.AUTO_RETENTION_MS,sampleTime:null,enabled:true}}resolveElectricalAllowedIds(e,t){let i=this.resolveFamilyConfig(e,t);if(!i)return [];let s=this.resolveTrackedDevicePairs(e,t);if(s.length===0)return [];let r=new Set,n=new Set,a=s.map(d=>d.id);return this.collectStringIdsIntoSet(r,a),this.collectStringIdsIntoSet(n,a),(Array.isArray(i.groups)?i.groups:[]).forEach(d=>{this.collectStringIdsIntoSet(n,d.memberIds,r),this.collectStringIdsIntoSet(n,d.batteryIds,r);}),(Array.isArray(i.banks)?i.banks:[]).forEach(d=>{this.collectStringIdsIntoSet(n,d.memberIds,r),this.collectStringIdsIntoSet(n,d.batteryIds,r);}),[...n].sort((d,p)=>d.localeCompare(p))}resolveFamilyConfig(e,t){if(!e)return null;let s=e[vi$2[t]];return s&&typeof s=="object"?s:null}resolveTrackedDevicePairs(e,t){let i=this.resolveFamilyConfig(e,t);if(!i||!Array.isArray(i.trackedDevices))return [];let s=new Map;return i.trackedDevices.forEach(r=>{if(!r||typeof r!="object")return;let n=r,a=this.normalizeString(n.id);if(!a)return;let u=this.normalizeString(n.source)??"default";s.set(`${a}||${u}`,{id:a,source:u});}),[...s.values()].sort((r,n)=>{let a=r.id.localeCompare(n.id);return a!==0?a:r.source.localeCompare(n.source)})}collectStringIdsIntoSet(e,t,i){Array.isArray(t)&&t.forEach(s=>{if(typeof s!="string")return;let r=this.normalizeTrackedIdentifierToId(s);if(r.length>0){if(i&&!i.has(r))return;e.add(r);}});}normalizeTrackedIdentifierToId(e){let t=e.trim();if(t.length===0)return "";let i=t.indexOf("||");return i<0?t:t.slice(0,i).trim()}mapAutomaticHistorySeries(e,t,i){let s=this.extractWidgetPaths(i?.paths),r=new Map;return s.forEach(n=>{if(n.pathType!=="number")return;let a=this.normalizeString(n.path);if(!a)return;let u=this.normalizeString(n.source),c=`${a}|${u??"default"}`;if(r.has(c))return;let d=this.slugify(a),p=this.slugify(u??"default"),g=this.normalizeNumber(n.sampleTime);r.set(c,{seriesId:`${e}:auto:${d}:${p}`,datasetUuid:`${e}:${d}:${p}`,ownerWidgetUuid:e,ownerWidgetSelector:t,path:a,context:null,source:u,timeScale:this.normalizeString(i?.timeScale),period:this.normalizeNumber(i?.period),retentionDurationMs:this.AUTO_RETENTION_MS,sampleTime:g,enabled:true});}),[...r.values()]}extractWidgetPaths(e){return e?Array.isArray(e)?e:Object.values(e):[]}slugify(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}normalizeString(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}normalizeNumber(e){return typeof e!="number"||!Number.isFinite(e)?null:e}coerceNodeList(e){return Array.isArray(e)?e:[]}getCanonicalSeriesSignature(e){let t=e.map(i=>({seriesId:i.seriesId,datasetUuid:i.datasetUuid,ownerWidgetUuid:i.ownerWidgetUuid,ownerWidgetSelector:i.ownerWidgetSelector,path:i.path,expansionMode:i.expansionMode??null,familyKey:i.familyKey??null,allowedIds:Array.isArray(i.allowedIds)?[...i.allowedIds].sort():null,trackedDevices:Array.isArray(i.trackedDevices)?[...i.trackedDevices].map(s=>({id:s.id,source:s.source})).sort((s,r)=>{let n=s.id.localeCompare(r.id);return n!==0?n:s.source.localeCompare(r.source)}):null,context:i.context??null,source:i.source??null,timeScale:i.timeScale??null,period:i.period??null,retentionDurationMs:i.retentionDurationMs??null,sampleTime:i.sampleTime??null,enabled:i.enabled}));return JSON.stringify(t)}static \u0275fac=function(t){return new(t||l)};static \u0275prov=Q$6({token:l,factory:l.\u0275fac,providedIn:"root"})}return l})();var Ci$2=["childOutlet"],Jt$2=(()=>{class l extends Ke$2{widgetProperties;outlet;dialog=w$4(Ff);dashboard=w$4(G$2);bottomSheet=w$4(DA);streams=w$4(rt$3,{optional:true});meta=w$4(_,{optional:true});runtime=w$4(p,{optional:true});widgetService=w$4(v);app=w$4(N$1);historySync=w$4(Qt$2);kipSeries=w$4(Ye$2);_uiEvent=w$4(re$5);settings=w$4(Gi$3);theme=Wp(this.app.cssThemeColorRoles$,{requireSync:true});dashboardStaticView=Dt$9(()=>this.dashboard.isDashboardStatic());childRef=null;compType;_hasInitialized=false;_destroyed=false;openOverlays=new Set;isDebugEnabled(){try{return typeof localStorage<"u"&&localStorage.getItem("kip:gesturesDebug")==="1"}catch(e){return false}}debug(...e){this.isDebugEnabled()&&console.debug("[Host2]",...e);}acquireOverlay(e){return this.openOverlays.has(e)?(this.debug(`${e} already open; ignoring`,{widgetId:this.widgetProperties?.uuid}),false):(this.openOverlays.add(e),true)}releaseOverlay(e){this.openOverlays.delete(e);}constructor(){super(),Fa$5(()=>{let e=this.dashboard.layoutEditCanceled();!this._hasInitialized||!e||ge$5(()=>{this.reinitFromSavedConfig();});});}ngOnInit(){let e=this.widgetProperties.type;if(!e)return;let t=this.widgetProperties.autoOpenOptionsOnCreate===true;t&&delete this.widgetProperties.autoOpenOptionsOnCreate,this.loadAndCreateChild(e,t);}loadAndCreateChild(e,t){return Zr$4(this,null,function*(){let i=yield this.widgetService.getComponentType(e);if(this._destroyed||!i)return;this.compType=i;let s=this.getDefaultConfig();this.runtime?.initialize?.(s,this.widgetProperties.config);let r=this.runtime?.options();r&&(this.widgetProperties.config=r),this.streams?.applyStreamsConfigDiff?.(r),this.meta?.applyMetaConfigDiff?.(r),this.outlet&&this.compType&&(this.childRef=this.outlet.createComponent(this.compType,{bindings:[hD("id",()=>this.widgetProperties.uuid),hD("type",()=>this.widgetProperties.type),hD("theme",this.theme)]}),this.childRef.changeDetectorRef.detectChanges()),this._hasInitialized=true,t&&queueMicrotask(()=>this.openWidgetOptions(new Event("kip:auto-open-options")));})}ngOnDestroy(){this._destroyed=true,this.childRef?.destroy(),this.childRef=null,this.openOverlays.clear();}serialize(){let e=this.runtime?.options();return e?this.widgetProperties.config=e:this.widgetProperties.config||(this.widgetProperties.config={}),{widgetProperties:this.widgetProperties}}applyRuntimeConfig(e){e&&this.runtime?.setRuntimeConfig?.(e);let t=this.runtime?.options();t&&(this.widgetProperties.config=t),this.streams?.applyStreamsConfigDiff?.(t),this.meta?.applyMetaConfigDiff?.(t);}reinitFromSavedConfig(){try{let e=this.getSavedConfigForSelf(),t=this.getDefaultConfig();this.runtime?.initialize?.(t,dp(e));let i=this.runtime?.options();i&&(this.widgetProperties.config=i),this.streams?.applyStreamsConfigDiff?.(i),this.meta?.applyMetaConfigDiff?.(i);}catch(e){console.error("[Host2] failed to reinitialize saved config",{widgetId:this.widgetProperties?.uuid,error:e});}}getSavedConfigForSelf(){try{let e=this.dashboard.dashboards(),t=this.dashboard.activeDashboard();if(t==null||t<0)return;let r=(e?.[t]?.configuration??[]).find(n=>n?.id===this.widgetProperties.uuid);return r?.input?.widgetProperties?.config??r?.widgetProperties?.config??void 0}catch(e){return}}getDefaultConfig(){let e=this.compType&&this.compType.DEFAULT_CONFIG;if(!e&&this.compType&&this.outlet){let t=this.outlet.createComponent(this.compType);e=t.instance.defaultConfig,t.destroy();}return e}openWidgetOptions(e){if(e.stopPropagation(),this.debug("openWidgetOptions invoked",{widgetId:this.widgetProperties?.uuid,static:this.dashboard.isDashboardStatic()}),!this.dashboard.isDashboardStatic()){if(!this.acquireOverlay("options"))return;if(!this.widgetProperties){this.releaseOverlay("options");return}try{this.dialog.openWidgetOptions({title:"Widget Options",config:this.widgetProperties.config,confirmBtnText:"Save",cancelBtnText:"Cancel"}).afterClosed().subscribe(t=>{this.releaseOverlay("options"),t&&(this.debug("options saved",{widgetId:this.widgetProperties?.uuid}),this.applyRuntimeConfig(t));});}catch(t){this.releaseOverlay("options"),console.error("[Host2] failed to open widget options",{widgetId:this.widgetProperties?.uuid,error:t});}}}openBottomSheet(e){if(e.stopPropagation(),this.debug("openBottomSheet invoked",{widgetId:this.widgetProperties?.uuid,static:this.dashboard.isDashboardStatic()}),!this.dashboard.isDashboardStatic()){if(this._uiEvent.isDragging()){this.debug("bottom sheet suppressed during drag",{widgetId:this.widgetProperties?.uuid});return}if(!this.acquireOverlay("sheet"))return;let t=typeof navigator<"u"&&/Linux/.test(navigator.platform)&&/Firefox/.test(navigator.userAgent);try{this.bottomSheet.open(je$1,t?{disableClose:!0,data:{showCancel:!0}}:{}).afterDismissed().subscribe(s=>{switch(this.releaseOverlay("sheet"),this.debug("bottom sheet dismissed",{widgetId:this.widgetProperties?.uuid,action:s}),s){case "delete":this.dashboard.deleteWidget(this.widgetProperties.uuid);break;case "duplicate":this.dashboard.duplicateWidget(this.widgetProperties.uuid);break;case "copy":this.dashboard.copyWidget(this.widgetProperties.uuid);break;case "cut":this.dashboard.cutWidget(this.widgetProperties.uuid);break;default:break}});}catch(i){this.releaseOverlay("sheet"),console.error("[Host2] failed to open bottom sheet",{widgetId:this.widgetProperties?.uuid,error:i});}}}openWidgetHistoryDialog(e){e.preventDefault(),e.stopPropagation(),this.openWidgetHistoryDialogInternal();}onHistoryTwoFingerTap(e){e.preventDefault(),e.stopPropagation(),this.openWidgetHistoryDialogInternal();}openWidgetHistoryDialogInternal(){return Zr$4(this,null,function*(){if(!this.settings.getWidgetHistoryDisabled()&&this.dashboard.isDashboardStatic()&&this.acquireOverlay("history"))try{let e=yield this.resolveEffectiveSeriesDefinitions();if(!this.isHistoryDialogEligible(this.widgetProperties,e)){this.releaseOverlay("history");return}let t=a$1(this.widgetProperties?.type),i=this.widgetProperties?.config?.displayName||t?.displayTitle||"Widget Data History";(yield this.dialog.openWidgetHistoryDialog({title:i,widget:this.widgetProperties,seriesDefinitions:e})).afterClosed().subscribe(()=>{this.releaseOverlay("history");});}catch(e){this.releaseOverlay("history"),console.error("[Host2] failed to open history dialog",{widgetId:this.widgetProperties?.uuid,error:e});}})}resolveEffectiveSeriesDefinitions(){return Zr$4(this,null,function*(){let e=this.historySync.resolveSeriesForWidget(this.widgetProperties);if(!e.some(n))return e;let i=yield this.kipSeries.getSeriesDefinitions();if(!i)return e;let s=this.widgetProperties?.uuid;if(!s)return e;let r=new Set(e.filter(n).map(n=>{let a=(n.path??"").trim(),u=a.endsWith(".*")?a.slice(0,-2):a;return u.length?u.startsWith("self.")?u.slice(5):u:null}).filter(n=>!!n));return r.size===0?e:i.filter(n=>{if(n.ownerWidgetUuid!==s||!t$1(n))return false;let a=(n.path??"").trim();if(!a.length)return false;let u=a.startsWith("self.")?a.slice(5):a;return Array.from(r).some(c=>u.startsWith(`${c}.`))})})}isHistoryDialogEligible(e,t){if(!e?.config||e.config.supportAutomaticHistoricalSeries===false)return false;let i=a$1(e.type);if(t.some(r=>typeof r.expansionMode=="string"||r.enabled===true)&&i?.templateExpansionMode)return t.some(r=>r.enabled===true);let s=this.extractNumericPaths(e.config.paths);return s.length?t.some(r=>{let n=typeof r.path=="string"?r.path.trim():"";return s.includes(n)?r.enabled===true:false}):false}extractNumericPaths(e){if(!e)return [];let t=Array.isArray(e)?e:Object.values(e),i=new Set;return t.forEach(s=>{if(s?.pathType!=="number")return;let r=typeof s.path=="string"?s.path.trim():"";r.length&&i.add(r);}),[...i]}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=JD({type:l,selectors:[["widget-host2"]],viewQuery:function(t,i){if(t&1&&Jh(Ci$2,7,Ki$5),t&2){let s;Zw(s=Yw())&&(i.outlet=s.first);}},inputs:{widgetProperties:"widgetProperties"},features:[aw([rt$3,_,p]),Sh$1],decls:3,vars:3,consts:[["childOutlet",""],["kipGestures","","mode","press","appearance","raised","twoFingerTap","",1,"widget-container","kip-widget-card-colors",3,"twoFingerTap","doubletap","press","contextmenu","twoFingerTapEnabled"]],template:function(t,i){t&1&&(Pi$5(0,"mat-card",1),Qh("twoFingerTap",function(r){return i.onHistoryTwoFingerTap(r)})("doubletap",function(r){return i.openWidgetOptions(r)})("press",function(r){return i.openBottomSheet(r)})("contextmenu",function(r){return i.openWidgetHistoryDialog(r)}),Wh(1,null,0),ul$2()),t&2&&(ig("border",i.dashboardStaticView()?"1px dashed transparent":"1px dashed var(--mat-sys-outline)"),Bh("twoFingerTapEnabled",i.dashboardStaticView()));},dependencies:[_$2,I$3,zA,L$5,Yt$1],styles:["[_nghost-%COMP%]{width:100%;height:100%;display:block;overflow:hidden}.widget-container[_ngcontent-%COMP%]{display:block;width:100%;height:100%;margin:0;padding:0}.kip-widget-card-colors[_ngcontent-%COMP%]{background-color:var(--kip-widget-card-background-color)}"]})}return l})();function xi$2(l,o){if(l&1){let e=Fw();Pi$5(0,"div",2),Qh("doubletap",function(i){ud(e);let s=qw();return dd(s.openWidgetOptions(i))})("press",function(i){ud(e);let s=qw();return dd(s.openBottomSheet(i))}),ul$2();}}var Zt$2=(()=>{class l extends Ke$2{widgetProperties;dashboard=w$4(G$2);_dialog=w$4(Ff);_bottomSheet=w$4(DA);runtime=w$4(p);static DEFAULT_CONFIG={displayName:"Gauge Label",color:"contrast"};_sheetOpen=false;_optionsOpen=false;constructor(){super();}ngOnInit(){let e=this.widgetProperties.autoOpenOptionsOnCreate===true;e&&delete this.widgetProperties.autoOpenOptionsOnCreate,this.runtime?.initialize?.(l.DEFAULT_CONFIG,this.widgetProperties.config),e&&queueMicrotask(()=>this.openWidgetOptions(new Event("kip:auto-open-options")));}serialize(){let e=this.runtime?.options();return e?this.widgetProperties.config=e:this.widgetProperties.config||(this.widgetProperties.config={}),{widgetProperties:this.widgetProperties}}openWidgetOptions(e){if(e.stopPropagation(),!this.dashboard.isDashboardStatic()){if(this._optionsOpen)return;this._optionsOpen=true,this._dialog.openWidgetOptions({title:"Widget Options",config:dp(this.runtime.options()??{}),confirmBtnText:"Save",cancelBtnText:"Cancel"}).afterClosed().subscribe(t=>{this._optionsOpen=false,t&&this.runtime.setRuntimeConfig(t);});}}openBottomSheet(e){if(e.stopPropagation(),!this.dashboard.isDashboardStatic()){if(this._sheetOpen)return;this._sheetOpen=true;let t=typeof navigator<"u"&&/Linux/.test(navigator.platform)&&/Firefox/.test(navigator.userAgent);this._bottomSheet.open(je$1,t?{disableClose:true,data:{showCancel:true}}:{}).afterDismissed().subscribe(s=>{this._sheetOpen=false,s==="delete"&&this.dashboard.deleteWidget(this.widgetProperties.uuid);});}}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=JD({type:l,selectors:[["group-widget"]],inputs:{widgetProperties:"widgetProperties"},features:[aw([p]),Sh$1],decls:2,vars:3,consts:[[3,"text","color"],["kipGestures","","mode","press",1,"widgetOverlay"],["kipGestures","","mode","press",1,"widgetOverlay",3,"doubletap","press"]],template:function(t,i){t&1&&($h(0,"widget-title",0),_w(1,xi$2,1,0,"div",1)),t&2&&(Bh("text",i.runtime.options()?.displayName??"")("color",i.runtime.options()?.color??""),EE(),Mw(i.dashboard.isDashboardStatic()?-1:1));},dependencies:[x$2,L$5],styles:["[_nghost-%COMP%]{display:block;height:15%}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:15%;right:0;top:0;color:transparent;z-index:21}"]})}return l})();var ei$1=(()=>{class l{_bottomSheetRef=w$4(_$5);clickAction(e){this._bottomSheetRef.dismiss(e);}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=JD({type:l,selectors:[["dashboard-clipboard-bottom-sheet"]],decls:20,vars:0,consts:[["mat-subheader",""],["mat-list-item","",3,"click"],["matListItemIcon",""]],template:function(t,i){t&1&&(Pi$5(0,"mat-action-list")(1,"div",0),TT(2,"Clipboard"),ul$2(),Pi$5(3,"button",1),Qh("click",function(){return i.clickAction("paste")}),Pi$5(4,"mat-icon",2),TT(5,"content_paste"),ul$2(),Pi$5(6,"span"),TT(7,"Paste"),ul$2()(),Pi$5(8,"button",1),Qh("click",function(){return i.clickAction("clear")}),Pi$5(9,"mat-icon",2),TT(10,"clear"),ul$2(),Pi$5(11,"span"),TT(12,"Clear"),ul$2()(),Pi$5(13,"div",0),TT(14,"New Widget"),ul$2(),Pi$5(15,"button",1),Qh("click",function(){return i.clickAction("add")}),Pi$5(16,"mat-icon",2),TT(17,"add_circle"),ul$2(),Pi$5(18,"span"),TT(19,"Add"),ul$2()()());},dependencies:[Jt$8,Xt$5,Zt$7,st$7,Yt$5,yt$3,wt$3],styles:["[_nghost-%COMP%]{display:block}"]})}return l})();var Ei$2=["grid"];function Si$2(l,o){l&1&&(Pi$5(0,"p",10)(1,"strong"),TT(2,"Long press/click and hold anywhere"),ul$2(),TT(3," to add widgets"),ul$2(),Pi$5(4,"mat-icon",11),TT(5,"touch_app"),ul$2());}function Di$2(l,o){if(l&1){let e=Fw();Pi$5(0,"p",10),TT(1,"This empty dashboard is ready to be customized."),ul$2(),Pi$5(2,"button",12),Qh("click",function(){ud(e);let i=qw(2);return dd(i.editDashboard())}),Pi$5(3,"mat-icon"),TT(4,"lock_open"),ul$2(),TT(5," Unlock and Customize "),ul$2();}}function ki$2(l,o){if(l&1){let e=Fw();Pi$5(0,"div",5),Qh("swipeup",function(){ud(e);let i=qw();return dd(i.previousDashboard())})("swipedown",function(){ud(e);let i=qw();return dd(i.nextDashboard())})("press",function(i){ud(e);let s=qw();return dd(s.addNewWidget(i))}),Pi$5(1,"div",6)(2,"mat-icon",7),TT(3,"dashboard"),ul$2(),_w(4,Si$2,6,0)(5,Di$2,6,0),ul$2(),Pi$5(6,"div")(7,"div",8)(8,"button",9),Qh("click",function(){ud(e);let i=qw();return dd(i.navigateToHelp())}),Pi$5(9,"mat-icon"),TT(10,"help"),ul$2(),TT(11," Get Help "),ul$2()()()();}if(l&2){qw();let e=xT(0);Bh("mode",e===true?"dashboard":"editor")("enablePress",e===false)("enableDoubleTap",false),EE(4),Mw(e?5:4);}}function Ti$2(l,o){if(l&1){let e=Fw();Pi$5(0,"div",3)(1,"button",13),Qh("click",function(){ud(e);let i=qw();return dd(i.cancelLayoutChanges())}),Pi$5(2,"mat-icon"),TT(3,"close"),ul$2()(),Pi$5(4,"button",14),Qh("click",function(){ud(e);let i=qw();return dd(i.saveLayoutChanges())}),Pi$5(5,"mat-icon"),TT(6,"done"),ul$2()()();}}function Ri$2(l,o){if(l&1&&$h(0,"dashboard-scroller",4),l&2){let e=qw();Bh("activePage",e.dashboard.activeDashboard())("dashboards",e.dashboard.dashboards());}}var qo$1=(()=>{class l{toast=w$4(lt$3);_dialog=w$4(Ff);_bottomSheet=w$4(DA);dashboard=w$4(G$2);_destroyRef=w$4(xe$3);_uiEvent=w$4(re$5);datasetLifecycle=w$4(S);_pluginConfig=w$4(w$2);_router=w$4(G$3);_hostEl=w$4(Lr$5);isDashboardStatic=Dt$9(()=>this.dashboard.isDashboardStatic());dashboardStaticView=Dt$9(()=>this.dashboard.isDashboardStatic());gridIsEmpty=vt$9(true);_gridstack=$j.required("grid");_previousIsStaticState=true;_suppressDrag=false;subGridOptions={cellHeight:"auto",column:"auto",acceptWidgets:true,subGridDynamic:false,class:"group-container"};gridOptions=vt$9({column:24,row:24,margin:4,float:true,resizable:{handles:"all"},acceptWidgets:true,subGridDynamic:false,subGridOpts:this.subGridOptions,children:[]});_boundHandleKeyDown=this.handleKeyDown.bind(this);_resizeObserver;_pendingResizeRaf=null;_lastContainerHeight=0;_lastCellHeight=0;_addDialogOpen=false;_clipboardSheetOpen=false;constructor(){Ce$1.addComponentToSelectorType([Jt$2,Zt$2]),Fa$5(()=>{let e=this.dashboard.isDashboardStatic();ge$5(()=>{if(this._previousIsStaticState!==e){this._previousIsStaticState=e;try{this._gridstack().grid?.setStatic(e);}catch(t){}}});}),Fa$5(()=>{let e=this.dashboard.activeDashboard();ge$5(()=>{e!=null&&this.loadDashboard(e);});});}ngAfterViewInit(){this._gridstack().grid?.setStatic(this._previousIsStaticState),this.syncGridEmptyState(),this.resizeGridColumns(),this.setupResizeObserver(),this._uiEvent.addHotkeyListener(this._boundHandleKeyDown,{ctrlKey:true,keys:["arrowdown","arrowup"]});try{let t=this._gridstack().grid;t&&typeof t.on=="function"&&(t.on("dragstart",()=>{this._uiEvent.isDragging.set(!0);}),t.on("dragstop",()=>{setTimeout(()=>this._uiEvent.isDragging.set(!1),0);}),t.on("resizestart",()=>{this._uiEvent.isDragging.set(!0);}),t.on("resizestop",()=>{setTimeout(()=>this._uiEvent.isDragging.set(!1),0);}));}catch(e){}this.dashboard.widgetAction$.pipe(Gp(this._destroyRef)).subscribe(e=>{if(e){let t=this._gridstack();if(!t.grid)return;t.grid.getGridItems().forEach(i=>{let s=i.gridstackNode;if(s?.id&&s.id===e.id)switch(e.operation){case "delete":this.deleteWidget(i);break;case "duplicate":this.duplicateWidget(i);break;case "copy":this.dashboard.setWidgetClipboardFromNode(i.gridstackNode);break;case "cut":this.dashboard.setWidgetClipboardFromNode(i.gridstackNode),this.deleteWidget(i);break;}});}});}setupResizeObserver(){if(this._resizeObserver)return;let e=this._hostEl.nativeElement;try{this._resizeObserver=new ResizeObserver(()=>{this._pendingResizeRaf===null&&(this._pendingResizeRaf=requestAnimationFrame(()=>{this._pendingResizeRaf=null,this.resizeGridColumns();}));}),this._resizeObserver.observe(e);}catch(t){}}handleKeyDown(e){e==="arrowdown"?this.previousDashboard():e==="arrowup"&&this.nextDashboard();}resizeGridColumns(){try{let t=this._gridstack().grid;if(!t)return;let i=t,s=this._hostEl.nativeElement.clientHeight||window.innerHeight;if(s===this._lastContainerHeight&&this._lastCellHeight>0)return;let r=i.getRow?i.getRow():0;if(r>0&&i.cellHeight){let n=Number(r)||0,a=n>0?s/n:1;if(a=Math.max(1,Math.round(a*100)/100),this._lastCellHeight===a&&this._lastContainerHeight===s)return;i.cellHeight(a),i.batchUpdate&&(i.batchUpdate(),i.batchUpdate(!1)),this._lastContainerHeight=s,this._lastCellHeight=a;}}catch(e){}}loadDashboard(e){let i=this.dashboard.dashboards()[e],s=this._gridstack();if(!s?.grid||!i){queueMicrotask(()=>this.loadDashboard(e));return}let r=dp(i.configuration??[]);s.grid.batchUpdate(),s.grid.load(r),s.grid.batchUpdate(false),this.syncGridEmptyState();}onGridItemsChanged(){this.syncGridEmptyState();}syncGridEmptyState(){try{let t=(this._gridstack().grid?.getGridItems?.()??[]).length===0;this.gridIsEmpty.set(t);}catch(e){this.gridIsEmpty.set(true);}}saveDashboard(){let e=this._gridstack();if(!e.grid)return;let t=e.grid.save(false,false)||null,i=dp(t),s=this.dashboard.activeDashboard();s!=null&&this.dashboard.updateConfiguration(s,i);}saveLayoutChanges(){this.dashboard.setStaticDashboard(true),this.saveDashboard(),this.dashboard.notifyLayoutEditSaved();}cancelLayoutChanges(){let e=this.dashboard.activeDashboard();e!=null&&this.loadDashboard(e),this.dashboard.setStaticDashboard(true),this.dashboard.notifyLayoutEditCanceled();}addNewWidget(e){if(!this.dashboard.isDashboardStatic()&&e.detail!==void 0){if(this._addDialogOpen||this._clipboardSheetOpen)return;let t=e.detail||{},i=t.center?.x??t.x??0,s=t.center?.y??t.y??0,n=this._gridstack().grid;if(!n)return;let a=n.getCellFromPixel({left:i,top:s});if(n.isAreaEmpty(a.x,a.y,1,2)){if(this.dashboard.widgetClipboard()){this.openClipboardBottomSheet(a.x,a.y);return}this.openAddWidgetDialog(a.x,a.y);}else this.toast.show("Not enough free space at the selected location to add a widget. Please reorganize the dashboard to free up space or try a larger empty area.",0,false,"error");}}openClipboardBottomSheet(e,t){if(this._clipboardSheetOpen)return;this._clipboardSheetOpen=true,this._bottomSheet.open(ei$1).afterDismissed().subscribe(s=>{switch(this._clipboardSheetOpen=false,s){case "paste":this.pasteCopiedWidget(e,t);break;case "clear":this.dashboard.clearWidgetClipboard();break;case "add":this.openAddWidgetDialog(e,t);break;}});}openAddWidgetDialog(e,t){this._addDialogOpen=true,this._dialog.openFrameDialog({title:"Add Widget",component:"select-widget"},true).pipe(zl$2(()=>{this._addDialogOpen=false;})).subscribe(i=>Zr$4(this,null,function*(){if(!i||typeof i!="object")return;let s=i;yield this.tryAddWidgetWithDependencyChecks(s,e,t);}));}tryAddWidgetWithDependencyChecks(e,t,i){return Zr$4(this,null,function*(){let s=yield this.getDisabledRequiredPlugins(e.requiredPlugins??[]);if(s.length>0){this.promptEnableRequiredPlugins(e,t,i,s);return}let r=yield this.getAnyOfPluginActivationState(e.anyOfPlugins??[]),n=r.installed.length>0,a=r.enabled.length>0;if(n&&!a){this.notifyAnyOfPluginsRequireManualActivation(e,r.installed);return}this.addWidgetToGrid(e,t,i);})}getDisabledRequiredPlugins(e){return Zr$4(this,null,function*(){if(!e?.length)return [];let t=[...new Set(e)];return (yield Promise.all(t.map(s=>Zr$4(this,null,function*(){let r=yield this._pluginConfig.getPlugin(s);return {pluginId:s,enabled:r.ok&&r.data.state.enabled}})))).filter(s=>!s.enabled).map(s=>s.pluginId)})}getAnyOfPluginActivationState(e){return Zr$4(this,null,function*(){if(!e?.length)return {installed:[],enabled:[]};let t=[...new Set(e)],i=yield Promise.all(t.map(s=>Zr$4(this,null,function*(){let r=yield this._pluginConfig.getPlugin(s);return {pluginId:s,installed:r.ok,enabled:r.ok&&r.data.state.enabled}})));return {installed:i.filter(s=>s.installed).map(s=>s.pluginId),enabled:i.filter(s=>s.enabled).map(s=>s.pluginId)}})}notifyAnyOfPluginsRequireManualActivation(e,t){let i=t.join(", ");this.toast.show(`Cannot add "${e.name}" yet. Any-of plugin${t.length>1?"s are":" is"} installed (${i}) but none ${t.length>1?"are":"is"} active. Please manually activate and configure one or all in Signal K Plugin Config, then come back and add the widget.`,0,false,"warn");}promptEnableRequiredPlugins(e,t,i,s){let r=s.join(", ");this.toast.show(`Cannot add "${e.name}" widget until required plugin${s.length>1?"s are":" is"} enabled: ${r}.`,0,false,"warn","Enable").onAction().pipe(Gp(this._destroyRef)).subscribe(()=>{this.enableRequiredPluginsAndAddWidget(e,t,i,s);});}enableRequiredPluginsAndAddWidget(e,t,i,s){return Zr$4(this,null,function*(){let r=[...new Set(s)],a=(yield Promise.all(r.map(u=>Zr$4(this,null,function*(){return {pluginId:u,result:yield this._pluginConfig.setPluginEnabled(u,true)}})))).filter(u=>!u.result.ok).map(u=>u.pluginId);if(a.length>0){this.toast.show(`Failed to enable required plugin${a.length>1?"s":""}: ${a.join(", ")}.`,0,false,"error");return}this.toast.show(`Enabled required plugin${r.length>1?"s":""}: ${r.join(", ")}.`,3e3,true,"success"),yield this.tryAddWidgetWithDependencyChecks(e,t,i);})}addWidgetToGrid(e,t,i){let s=b.create(),r={};e.selector==="group-widget"?r={x:t,y:i,w:3,h:4,id:s,selector:"group-widget",input:{widgetProperties:{type:e.selector,uuid:s,config:{displayName:"Group Widget",color:"contrast"},autoOpenOptionsOnCreate:true}},subGridOpts:{children:[]}}:r={x:t,y:i,w:e.defaultWidth,h:e.defaultHeight,minW:e.minWidth,minH:e.minHeight,id:s,selector:"widget-host2",input:{widgetProperties:{type:e.selector,uuid:s,autoOpenOptionsOnCreate:true}}};let a=this._gridstack().grid;if(!a)return;let u=Number(e.minWidth??1),c=Number(e.minHeight??2),d=Number(e.defaultWidth??u),p=Number(e.defaultHeight??c);if(!(a.isAreaEmpty(t,i,d,p)&&a.willItFit({x:t,y:i,w:d,h:p}))){let D=this.findBestWidgetSizeAtCell(a,t,i,u,c,d,p);if(!D){this.toast.show(`Not enough free space to add "${e.name}" widget at the selected location. Please reorganize the dashboard to free up space or try a larger empty area.`,0,false,"error");return}r.w=D.w,r.h=D.h;}let w=a.addWidget(r).gridstackNode;w?.subGrid&&w.subGridOpts&&(w.subGridOpts.row=w.subGridOpts.minRow=w.subGridOpts.maxRow=w.h);}findBestWidgetSizeAtCell(e,t,i,s,r,n,a){let u=Math.max(1,Math.floor(s)),c=Math.max(1,Math.floor(r)),d=Math.max(u,Math.floor(n)),p=Math.max(c,Math.floor(a)),g=null;for(let C=u;C<=d;C++)for(let w=c;w<=p;w++){if(!e.isAreaEmpty(t,i,C,w)||!e.willItFit({x:t,y:i,w:C,h:w}))continue;let D=C*w;(!g||D>g.area||D===g.area&&w>g.h||D===g.area&&w===g.h&&C>g.w)&&(g={w:C,h:w,area:D});}return g?{w:g.w,h:g.h}:null}cancelPointerSequence(){if(!this._suppressDrag){this._suppressDrag=true;try{this._gridstack().grid?.setStatic(!0);}catch(e){}["pointerup","mouseup","touchend"].forEach(e=>{document.dispatchEvent(new Event(e,{bubbles:true}));});}}onPointerRelease(){if(this._suppressDrag&&(this._suppressDrag=false,!this.dashboard.isDashboardStatic()))try{this._gridstack().grid?.setStatic(!1);}catch(e){}}duplicateWidget(e){let t=b.create(),i=e.gridstackNode;if(!i?.input?.widgetProperties)return;let s={w:i.w,h:i.h,id:t,selector:i.selector,input:{widgetProperties:{type:i.input.widgetProperties.type,uuid:t,config:dp(i.input.widgetProperties.config)}}},n=this._gridstack().grid;n&&(n.willItFit(s)?n.addWidget(s):(s.h=2,s.w=1,n.willItFit(s)?n.addWidget(s):this.toast.show("Insufficient space on the dashboard. Please reorganize to free up space.",0,false,"error")));}pasteCopiedWidget(e,t){if(this.dashboard.isDashboardStatic())return;let i=this.dashboard.widgetClipboard(),s=i?.input?.widgetProperties;if(!i||!s?.type)return;let r=b.create(),n={w:i.w,h:i.h,id:r,selector:i.selector,input:{widgetProperties:{type:s.type,uuid:r,config:dp(s.config)}}};typeof e=="number"&&typeof t=="number"&&(n.x=e,n.y=t);let u=this._gridstack().grid;u&&(u.willItFit(n)?(u.addWidget(n),this.dashboard.clearWidgetClipboard()):(n.h=2,n.w=1,u.willItFit(n)?(u.addWidget(n),this.dashboard.clearWidgetClipboard()):this.toast.show("Insufficient space on the dashboard. Please reorganize to free up space.",0,false,"error")));}deleteWidget(e){let t=e.gridstackNode;this._gridstack().grid?.removeWidget(e),t?.id&&this.datasetLifecycle.removeOwnedDatasets(t.id,true);}nextDashboard(){this.dashboard.isDashboardStatic()&&this.dashboard.navigateToNextDashboard();}previousDashboard(){this.dashboard.isDashboardStatic()&&this.dashboard.navigateToPreviousDashboard();}editDashboard(){this.dashboard.setStaticDashboard(false);}navigateToHelp(){this._router.navigate(["/help"]);}ngOnDestroy(){let e=this._gridstack();if(e?.grid&&(e.grid.offAll(),e.grid.destroy()),this._resizeObserver){try{this._resizeObserver.disconnect();}catch(t){}this._resizeObserver=void 0;}this._pendingResizeRaf!==null&&(cancelAnimationFrame(this._pendingResizeRaf),this._pendingResizeRaf=null),this._uiEvent.removeHotkeyListener(this._boundHandleKeyDown);}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=JD({type:l,selectors:[["dashboard"]],viewQuery:function(t,i){t&1&&eg(i._gridstack,Ei$2,5),t&2&&Kw();},hostBindings:function(t,i){t&1&&Qh("mouseup",function(){return i.onPointerRelease()},TI)("touchend",function(){return i.onPointerRelease()},TI);},decls:6,vars:8,consts:[["grid",""],["kipGestures","",3,"addedCB","removedCB","swipeup","swipedown","press","mode","enablePress","enableDoubleTap","isEmpty","options"],["kipGestures","",1,"dashboard-empty-state-container",3,"mode","enablePress","enableDoubleTap"],[1,"edit-layout-close-icon"],[3,"activePage","dashboards"],["kipGestures","",1,"dashboard-empty-state-container",3,"swipeup","swipedown","press","mode","enablePress","enableDoubleTap"],[1,"dashboard-empty-state-action"],[1,"empty-state-icon"],[1,"empty-state-help"],["mat-button","",1,"empty-state-help-button",3,"click"],[1,"empty-state-text"],[1,"touch-icon"],["mat-flat-button","",1,"empty-state-button",3,"click"],["mat-fab","",1,"cancel",2,"margin-right","10px",3,"click"],["mat-fab","",1,"save",3,"click"]],template:function(t,i){if(t&1&&(wg(0),Pi$5(1,"gridstack",1,0),Qh("addedCB",function(){return i.onGridItemsChanged()})("removedCB",function(){return i.onGridItemsChanged()})("swipeup",function(){return i.previousDashboard()})("swipedown",function(){return i.nextDashboard()})("press",function(r){return i.addNewWidget(r)}),ul$2(),_w(3,ki$2,12,4,"div",2),_w(4,Ti$2,7,0,"div",3)(5,Ri$2,1,2,"dashboard-scroller",4)),t&2){let s=NT(i.dashboardStaticView()??true);EE(),Bh("mode",s===true?"dashboard":"editor")("enablePress",s===false)("enableDoubleTap",false)("isEmpty",false)("options",i.gridOptions()),EE(2),Mw(i.gridIsEmpty()?3:-1),EE(),Mw(s?5:4);}},dependencies:[Ce$1,jt$1,yt$3,wt$3,Op,xp$1,Fp,L$5],styles:["[_nghost-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;height:100%;width:100%;overflow:hidden}.grid-stack[_ngcontent-%COMP%]{width:100%;height:100%;box-sizing:border-box;position:relative} .grid-stack-sub-grid{border:1px solid var(--mat-sys-outline);border-radius:8px} .grid-stack-sub-grid div{display:flex;flex-direction:column} .grid-stack-sub-grid div .grid-stack{flex:1 1 auto;min-height:500px}.edit-layout-close-icon[_ngcontent-%COMP%]{position:absolute;bottom:20px;right:20px;cursor:pointer;z-index:100}.cancel[_ngcontent-%COMP%]{--mat-fab-container-color: var(--mat-sys-primary);--mat-fab-foreground-color: var(--mat-sys-background)}.save[_ngcontent-%COMP%]{--mat-fab-container-color: var(--mat-sys-primary-fixed);--mat-fab-foreground-color: var(--mat-sys-background)}.dashboard-empty-state-container[_ngcontent-%COMP%]{position:absolute;inset:0;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:center;justify-content:space-evenly;padding:1.5rem;text-align:center;box-sizing:border-box;overflow:hidden;pointer-events:auto}@media(orientation:landscape)and (max-height:420px){.dashboard-empty-state-container[_ngcontent-%COMP%]{padding:.75rem}.empty-state-icon[_ngcontent-%COMP%]{font-size:3.25rem;width:3.25rem;height:3.25rem}}.dashboard-empty-state-action[_ngcontent-%COMP%]{max-width:500px;color:var(--mat-sys-outline-variant)}.dashboard-empty-state-action[_ngcontent-%COMP%] .touch-icon[_ngcontent-%COMP%]{font-size:2rem;width:2rem;height:2rem;color:var(--mat-sys-outline-variant);margin-top:.5rem;animation:_ngcontent-%COMP%_bounce 2s infinite}.empty-state-icon[_ngcontent-%COMP%]{font-size:4rem;width:4rem;height:4rem;color:var(--mat-sys-outline-variant);margin-bottom:1rem}.empty-state-button[_ngcontent-%COMP%]{--mat-button-filled-label-text-color: var(--kip-widget-card-background-color);--mat-button-filled-container-color: var(--mat-sys-outline-variant);--mat-button-filled-hover-state-layer-opacity: .7;--mat-button-filled-state-layer-color: var(--mat-sys-primary-fixed-dim)}.empty-state-help-button[_ngcontent-%COMP%]{--mat-button-text-label-text-color: var(--mat-sys-outline-variant);--mat-button-text-hover-state-layer-opacity: .7;--mat-button-text-state-layer-color: var(--mat-sys-primary-fixed-dim)}.empty-state-text[_ngcontent-%COMP%]{color:var(--mat-sys-outline-variant);font-style:italic}@keyframes _ngcontent-%COMP%_bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-10px)}60%{transform:translateY(-5px)}}"]})}return l})();function T$1(n,I){if(n&1&&(Pi$5(0,"p"),TT(1),ul$2()),n&2){let o=qw();pT(`large-icon-tile-label${o.compact()?" compact":""}`),EE(),gg(o.label());}}function D(n,I){n&1&&$h(0,"div",3);}var R$2=(()=>{class n{svgIcon=Hj.required();iconSize=Hj.required();label=Hj.required();iconOnly=Hj(false);compact=Hj(false);active=Hj(false);onKeyboardActivate(o){o.preventDefault(),o.currentTarget?.click();}static \u0275fac=function(a){return new(a||n)};static \u0275cmp=JD({type:n,selectors:[["tile-large-icon"]],inputs:{svgIcon:[1,"svgIcon"],iconSize:[1,"iconSize"],label:[1,"label"],iconOnly:[1,"iconOnly"],compact:[1,"compact"],active:[1,"active"]},decls:4,vars:13,consts:[["matRipple","","tabindex","0","role","button",3,"keydown.enter","keydown.space"],["aria-hidden","false",3,"svgIcon"],[3,"class"],[1,"active-accent-bar"]],template:function(a,e){a&1&&(Pi$5(0,"div",0),Qh("keydown.enter",function(c){return e.onKeyboardActivate(c)})("keydown.space",function(c){return e.onKeyboardActivate(c)}),$h(1,"mat-icon",1),_w(2,T$1,2,3,"p",2),_w(3,D,1,0,"div",3),ul$2()),a&2&&(pT(`${e.compact()?"icon-container-compact":"icon-container"}`),sg("active-container-accent",e.active()),Hh("aria-pressed",e.active())("aria-label",e.iconOnly()?e.label():null),EE(),ig("width",e.iconSize(),"px")("height",e.iconSize(),"px"),Bh("svgIcon",e.svgIcon()),EE(),Mw(e.iconOnly()?-1:2),EE(),Mw(e.active()?3:-1));},dependencies:[yt$3,wt$3,_$2,ca$4,Kh],styles:["[_nghost-%COMP%]{display:block;width:100%}.icon-container[_ngcontent-%COMP%]{display:block;text-align:center;-webkit-tap-highlight-color:rgba(0,0,0,0);padding:10px 5px 15px;border-radius:7px;background-color:var(--mat-sys-surface-container);border-color:.2s ease;border:2px solid transparent}.icon-container[_ngcontent-%COMP%]:hover{border:2px solid var(--mat-sys-outline-variant);cursor:pointer}.icon-container[_ngcontent-%COMP%]:focus-visible{background-color:var(--mat-sys-surface-container-high);outline:-webkit-focus-ring-color auto 0px}.icon-container-compact[_ngcontent-%COMP%]{display:block;text-align:center;-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer;padding:5px;border-radius:7px;border:1px solid var(--mat-sys-outline-variant)}.icon-container-compact[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-inverse-on-surface);border:1px solid var(--mat-sys-primary);cursor:pointer}.icon-container-compact[_ngcontent-%COMP%]:focus-visible{background-color:var(--mat-sys-surface-bright);outline:-webkit-focus-ring-color auto 0px}.large-icon-tile-label[_ngcontent-%COMP%]{color:var(--mat-sys-outline);font-size:1.1em;margin:0}.compact[_ngcontent-%COMP%]{font-size:12px;margin:0}.active-container-accent[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-tertiary);pointer-events:none;background-color:var(--mat-sys-on-tertiary)}.active-container-accent[_ngcontent-%COMP%] .large-icon-tile-label[_ngcontent-%COMP%]{font-weight:700}.active-accent-bar[_ngcontent-%COMP%]{position:absolute;top:0;bottom:0;right:0;width:7px;background:var(--mat-sys-tertiary);box-shadow:0 0 10px 0 var(--mat-sys-tertiary)}"]})}return n})();var w$1=(()=>{class s{connectionStateMachine=w$4(We$3);destroyRef=w$4(xe$3);probeUrl="https://www.gstatic.com/generate_204";probeTimeoutMs=5e3;healthyRecheckMs=6e4;retryIntervalsMs=[5e3,3e4,6e4];useConnectionStateTriggers=true;isBrowser=typeof window<"u"&&typeof document<"u";started=false;retryAttempt=0;checkTimer=null;lastConnectionState=null;isChecking=vt$9(false);isReachable=vt$9(null);lastSuccessAt=vt$9(null);lastCheckedAt=vt$9(null);lastError=vt$9(null);internetAvailable=Dt$9(()=>this.isReachable()===true);start(){this.started||!this.isBrowser||(this.started=true,zm(Ds$3(window,"online"),Ds$3(window,"offline")).pipe(Gp(this.destroyRef)).subscribe(()=>this.recheckNow()),Ds$3(document,"visibilitychange").pipe(Gp(this.destroyRef)).subscribe(()=>{document.visibilityState==="visible"&&this.recheckNow();}),this.useConnectionStateTriggers&&this.connectionStateMachine.status$.pipe(Gp(this.destroyRef)).subscribe(e=>{e?.state&&e.state!==this.lastConnectionState&&(this.lastConnectionState=e.state,this.recheckNow());}),this.recheckNow());}recheckNow(){this.started&&(this.clearTimer(),this.isChecking()||this.runProbe());}runProbe(){return Zr$4(this,null,function*(){this.isChecking.set(true),this.lastCheckedAt.set(new Date);try{let e=yield this.performProbe();this.isReachable.set(e),e?(this.lastSuccessAt.set(new Date),this.lastError.set(null),this.retryAttempt=0,this.scheduleNext(this.healthyRecheckMs)):(this.lastError.set("Internet reachability probe failed"),this.scheduleRetry());}catch(e){this.isReachable.set(false),this.lastError.set("Internet reachability probe failed"),this.scheduleRetry();}finally{this.isChecking.set(false);}})}performProbe(){return Zr$4(this,null,function*(){let e=new AbortController,i=setTimeout(()=>e.abort(),this.probeTimeoutMs);try{let r=yield fetch(this.probeUrl,{method:"GET",mode:"no-cors",cache:"no-store",signal:e.signal});return r.type==="opaque"?!0:r.status>=200&&r.status<400}catch(r){return false}finally{clearTimeout(i);}})}scheduleRetry(){let e=Math.min(this.retryAttempt,this.retryIntervalsMs.length-1),i=this.retryIntervalsMs[e];this.retryAttempt++,this.scheduleNext(i);}scheduleNext(e){this.clearTimer(),this.checkTimer=setTimeout(()=>{this.checkTimer=null,this.runProbe();},e);}clearTimer(){this.checkTimer&&(clearTimeout(this.checkTimer),this.checkTimer=null);}ngOnDestroy(){this.clearTimer();}static \u0275fac=function(i){return new(i||s)};static \u0275prov=Q$6({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})();
6697
6697
  var m={200:"The request was successfully.",202:"Request accepted and pending completion.",400:"Something is wrong with the client's request.",401:"Login failed. Your User ID or Password is incorrect.",403:"DENIED: Authorization with R/W or Admin permission level is required to send commands. Configure Sign In credential.",405:"The server does not support the request.",500:"The request failed.",502:"Something went wrong carrying out the request on the server.",504:"Timeout on the server side trying to carry out the request."},T=(()=>{class u{signalKDeltaService=w$4(I$2);settings=w$4(Gi$3);toast=w$4(lt$3);auth=w$4(He$4);requestStatus$=new te$9;requests=[];constructor(){this.signalKDeltaService.subscribeRequestUpdates().pipe(Gp()).subscribe(s=>{this.updateRequest(s);});}requestDeviceAccessToken(){let s=b.create(),e={requestId:s,accessRequest:{clientId:this.settings.KipUUID,description:"KIP Instrument MDF",permissions:"admin"}};console.log("[Request Service] Requesting Device Authorization Token"),this.signalKDeltaService.publishDelta(e);let r={requestId:s,state:null,statusCode:null};return this.requests.push(r),s}requestUserLogin(s,e){let r=b.create(),t={requestId:r,login:{username:s,password:e}};console.log("[Request Service] Requesting User Login"),this.signalKDeltaService.publishDelta(t);let i={requestId:r,state:null,statusCode:null};return this.requests.push(i),r}putRequest(s,e,r){if(typeof e>"u")return console.error("[Request Service] Undefined value for PUT request"),null;if(!s)return console.error("[Request Service] Path is required for PUT request"),null;let t=b.create(),i=s.replace(/^(self\.)/,""),v={context:"vessels.self",requestId:t,put:{path:i,value:e}};this.signalKDeltaService.publishDelta(v);let g={requestId:t,state:null,statusCode:null,widgetUUID:r};return this.requests.push(g),t}updateRequest(s){let e=this.requests.findIndex(r=>r.requestId==s.requestId);if(e>-1){if(this.requests[e].state=s.state??null,this.requests[e].statusCode=s.statusCode??null,this.requests[e].message=s.message,typeof s.statusCode!="number"){this.toast.show("Unknown Request Status Code received: undefined",0,false,"error"),console.error("[Request Service] Unknown Request Status Code received: undefined"),this.requestStatus$.next(this.requests[e]),this.requests.splice(e,1);return}let r=m[s.statusCode];if(typeof r<"u"&&(this.requests[e].statusCode==200||this.requests[e].statusCode==202||this.requests[e].statusCode==400||this.requests[e].statusCode==401||this.requests[e].statusCode==403||this.requests[e].statusCode==405)){if(this.requests[e].statusCodeDescription=r,this.requests[e].statusCode==202){console.log("[Request Service] Async 202 response received");return}this.requests[e].statusCode==400&&(this.toast.show(this.requests[e].message??"Status Code 400 with missing return message received",0,false,"error"),console.log("[Request Service] "+this.requests[e].message)),this.requests[e].statusCode==403&&console.warn("[Request Service] Status Code: "+this.requests[e].statusCode+" - "+this.requests[e].statusCodeDescription),this.requests[e].statusCode==405&&console.error("[Request Service] Status Code: "+this.requests[e].statusCode+" - "+this.requests[e].message),s.accessRequest!==void 0&&s.accessRequest.token!==void 0?(this.toast.show(s.accessRequest.permission+": Device Access Token received from server.",5e3,false,"success"),console.log(`[Request Service] ${s.accessRequest.permission}: Device Access Token received`),this.auth.setDeviceAccessToken(s.accessRequest.token)):s.login!==void 0&&s.login.token;}else {let t=this.requests[e].statusCode,i=typeof t=="number"?m[t]??"Unknown status":"Unknown status";this.toast.show("Unknown Request Status Code received: "+t+" - "+i+" - "+this.requests[e].message,0,false,"error"),console.error("[Request Service] Unknown Request Status Code received: "+t+" - "+i+" - "+this.requests[e].message);}try{this.requestStatus$.next(this.requests[e]),this.requests.splice(e,1);}catch(t){this.requestStatus$.error(t),console.error("[Request Service] "+t),this.requests=[];}}else this.toast.show(`A request message that contains an unknown Request ID was received. Request Delta:
@@ -7106,4 +7106,4 @@ var m={200:"The request was successfully.",202:"Request accepted and pending com
7106
7106
  }
7107
7107
  `],encapsulation:2})}return n})();var zt$1=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=bh$1({type:n});static \u0275inj=Qs$2({imports:[Uc$1,we$5,Fn$5,yt$9]})}return n})();function ae(e){return e+.5|0}var _t=(e,i,t)=>Math.max(Math.min(e,t),i);function ne$1(e){return _t(ae(e*2.55),0,255)}function yt(e){return _t(ae(e*255),0,255)}function ut$1(e){return _t(ae(e/2.55)/100,0,1)}function Ps(e){return _t(ae(e*100),0,100)}var et$1={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ui$1=[..."0123456789ABCDEF"],No=e=>ui$1[e&15],Ho=e=>ui$1[(e&240)>>4]+ui$1[e&15],Ce=e=>(e&240)>>4===(e&15),jo=e=>Ce(e.r)&&Ce(e.g)&&Ce(e.b)&&Ce(e.a);function Yo(e){var i=e.length,t;return e[0]==="#"&&(i===4||i===5?t={r:255&et$1[e[1]]*17,g:255&et$1[e[2]]*17,b:255&et$1[e[3]]*17,a:i===5?et$1[e[4]]*17:255}:(i===7||i===9)&&(t={r:et$1[e[1]]<<4|et$1[e[2]],g:et$1[e[3]]<<4|et$1[e[4]],b:et$1[e[5]]<<4|et$1[e[6]],a:i===9?et$1[e[7]]<<4|et$1[e[8]]:255})),t}var $o=(e,i)=>e<255?i(e):"";function Uo(e){var i=jo(e)?No:Ho;return e?"#"+i(e.r)+i(e.g)+i(e.b)+$o(e.a,i):void 0}var Xo=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Os(e,i,t){let s=i*Math.min(t,1-t),n=(o,a=(o+e/30)%12)=>t-s*Math.max(Math.min(a-3,9-a,1),-1);return [n(0),n(8),n(4)]}function Ko(e,i,t){let s=(n,o=(n+e/60)%6)=>t-t*i*Math.max(Math.min(o,4-o,1),0);return [s(5),s(3),s(1)]}function qo(e,i,t){let s=Os(e,1,.5),n;for(i+t>1&&(n=1/(i+t),i*=n,t*=n),n=0;n<3;n++)s[n]*=1-i-t,s[n]+=i;return s}function Go(e,i,t,s,n){return e===n?(i-t)/s+(i<t?6:0):i===n?(t-e)/s+2:(e-i)/s+4}function fi$1(e){let t=e.r/255,s=e.g/255,n=e.b/255,o=Math.max(t,s,n),a=Math.min(t,s,n),r=(o+a)/2,l,c,h;return o!==a&&(h=o-a,c=r>.5?h/(2-o-a):h/(o+a),l=Go(t,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function gi$1(e,i,t,s){return (Array.isArray(i)?e(i[0],i[1],i[2]):e(i,t,s)).map(yt)}function pi$1(e,i,t){return gi$1(Os,e,i,t)}function Jo(e,i,t){return gi$1(qo,e,i,t)}function Zo(e,i,t){return gi$1(Ko,e,i,t)}function Ts(e){return (e%360+360)%360}function Qo(e){let i=Xo.exec(e),t=255,s;if(!i)return;i[5]!==s&&(t=i[6]?ne$1(+i[5]):yt(+i[5]));let n=Ts(+i[2]),o=+i[3]/100,a=+i[4]/100;return i[1]==="hwb"?s=Jo(n,o,a):i[1]==="hsv"?s=Zo(n,o,a):s=pi$1(n,o,a),{r:s[0],g:s[1],b:s[2],a:t}}function ta$1(e,i){var t=fi$1(e);t[0]=Ts(t[0]+i),t=pi$1(t),e.r=t[0],e.g=t[1],e.b=t[2];}function ea$1(e){if(!e)return;let i=fi$1(e),t=i[0],s=Ps(i[1]),n=Ps(i[2]);return e.a<255?`hsla(${t}, ${s}%, ${n}%, ${ut$1(e.a)})`:`hsl(${t}, ${s}%, ${n}%)`}var Cs$1={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ds={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function ia$1(){let e={},i=Object.keys(Ds),t=Object.keys(Cs$1),s,n,o,a,r;for(s=0;s<i.length;s++){for(a=r=i[s],n=0;n<t.length;n++)o=t[n],r=r.replace(o,Cs$1[o]);o=parseInt(Ds[a],16),e[r]=[o>>16&255,o>>8&255,o&255];}return e}var De;function sa$1(e){De||(De=ia$1(),De.transparent=[0,0,0,0]);let i=De[e.toLowerCase()];return i&&{r:i[0],g:i[1],b:i[2],a:i.length===4?i[3]:255}}var na$1=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function oa$1(e){let i=na$1.exec(e),t=255,s,n,o;if(i){if(i[7]!==s){let a=+i[7];t=i[8]?ne$1(a):_t(a*255,0,255);}return s=+i[1],n=+i[3],o=+i[5],s=255&(i[2]?ne$1(s):_t(s,0,255)),n=255&(i[4]?ne$1(n):_t(n,0,255)),o=255&(i[6]?ne$1(o):_t(o,0,255)),{r:s,g:n,b:o,a:t}}}function aa$1(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${ut$1(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var di$1=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Ht=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function ra$1(e,i,t){let s=Ht(ut$1(e.r)),n=Ht(ut$1(e.g)),o=Ht(ut$1(e.b));return {r:yt(di$1(s+t*(Ht(ut$1(i.r))-s))),g:yt(di$1(n+t*(Ht(ut$1(i.g))-n))),b:yt(di$1(o+t*(Ht(ut$1(i.b))-o))),a:e.a+t*(i.a-e.a)}}function Ae(e,i,t){if(e){let s=fi$1(e);s[i]=Math.max(0,Math.min(s[i]+s[i]*t,i===0?360:1)),s=pi$1(s),e.r=s[0],e.g=s[1],e.b=s[2];}}function Ls(e,i){return e&&Object.assign(i||{},e)}function As(e){var i={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(i={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(i.a=yt(e[3]))):(i=Ls(e,{r:0,g:0,b:0,a:1}),i.a=yt(i.a)),i}function la$1(e){return e.charAt(0)==="r"?oa$1(e):Qo(e)}var oe=class e{constructor(i){if(i instanceof e)return i;let t=typeof i,s;t==="object"?s=As(i):t==="string"&&(s=Yo(i)||sa$1(i)||la$1(i)),this._rgb=s,this._valid=!!s;}get valid(){return this._valid}get rgb(){var i=Ls(this._rgb);return i&&(i.a=ut$1(i.a)),i}set rgb(i){this._rgb=As(i);}rgbString(){return this._valid?aa$1(this._rgb):void 0}hexString(){return this._valid?Uo(this._rgb):void 0}hslString(){return this._valid?ea$1(this._rgb):void 0}mix(i,t){if(i){let s=this.rgb,n=i.rgb,o,a=t===o?.5:t,r=2*a-1,l=s.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=a*s.a+(1-a)*n.a,this.rgb=s;}return this}interpolate(i,t){return i&&(this._rgb=ra$1(this._rgb,i._rgb,t)),this}clone(){return new e(this.rgb)}alpha(i){return this._rgb.a=yt(i),this}clearer(i){let t=this._rgb;return t.a*=1-i,this}greyscale(){let i=this._rgb,t=ae(i.r*.3+i.g*.59+i.b*.11);return i.r=i.g=i.b=t,this}opaquer(i){let t=this._rgb;return t.a*=1+i,this}negate(){let i=this._rgb;return i.r=255-i.r,i.g=255-i.g,i.b=255-i.b,this}lighten(i){return Ae(this._rgb,2,i),this}darken(i){return Ae(this._rgb,2,-i),this}saturate(i){return Ae(this._rgb,1,i),this}desaturate(i){return Ae(this._rgb,1,-i),this}rotate(i){return ta$1(this._rgb,i),this}};function lt(){}var js=(()=>{let e=0;return ()=>e++})();function A(e){return e==null}function F(e){if(Array.isArray&&Array.isArray(e))return true;let i=Object.prototype.toString.call(e);return i.slice(0,7)==="[object"&&i.slice(-6)==="Array]"}function O(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function W(e){return (typeof e=="number"||e instanceof Number)&&isFinite(+e)}function J(e,i){return W(e)?e:i}function P(e,i){return typeof e>"u"?i:e}var Ys=(e,i)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/i,_i$1=(e,i)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*i:+e;function I(e,i,t){if(e&&typeof e.call=="function")return e.apply(t,i)}function R(e,i,t,s){let n,o,a;if(F(e))if(o=e.length,s);else for(n=0;n<o;n++)i.call(t,e[n],n);else if(O(e))for(a=Object.keys(e),o=a.length,n=0;n<o;n++)i.call(t,e[a[n]],a[n]);}function ce(e,i){let t,s,n,o;if(!e||!i||e.length!==i.length)return false;for(t=0,s=e.length;t<s;++t)if(n=e[t],o=i[t],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return false;return true}function Re(e){if(F(e))return e.map(Re);if(O(e)){let i=Object.create(null),t=Object.keys(e),s=t.length,n=0;for(;n<s;++n)i[t[n]]=Re(e[t[n]]);return i}return e}function $s(e){return ["__proto__","prototype","constructor"].indexOf(e)===-1}function ca$1(e,i,t,s){if(!$s(e))return;let n=i[e],o=t[e];O(n)&&O(o)?Yt(n,o,s):i[e]=Re(o);}function Yt(e,i,t){let s=F(i)?i:[i],n=s.length;if(!O(e))return e;t=t||{};let o=t.merger||ca$1,a;for(let r=0;r<n;++r){if(a=s[r],!O(a))continue;let l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],e,a,t);}return e}function Ut(e,i){return Yt(e,i,{merger:ha$1})}function ha$1(e,i,t){if(!$s(e))return;let s=i[e],n=t[e];O(s)&&O(n)?Ut(s,n):Object.prototype.hasOwnProperty.call(i,e)||(i[e]=Re(n));}var Rs={"":e=>e,x:e=>e.x,y:e=>e.y};function da$1(e){let i=e.split("."),t=[],s="";for(let n of i)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(t.push(s),s="");return t}function ua$1(e){let i=da$1(e);return t=>{for(let s of i){if(s==="")break;t=t&&t[s];}return t}}function pt(e,i){return (Rs[i]||(Rs[i]=ua$1(i)))(e)}function ze(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Xt=e=>typeof e<"u",ft$1=e=>typeof e=="function",yi$1=(e,i)=>{if(e.size!==i.size)return false;for(let t of e)if(!i.has(t))return false;return true};function Us(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}var L=Math.PI,z=2*L,fa$1=z+L,Ee=Number.POSITIVE_INFINITY,ga$1=L/180,N=L/2,Lt$1=L/4,Es=L*2/3,gt=Math.log10,nt=Math.sign;function Kt(e,i,t){return Math.abs(e-i)<t}function vi$1(e){let i=Math.round(e);e=Kt(e,i,e/1e3)?i:e;let t=Math.pow(10,Math.floor(gt(e))),s=e/t;return (s<=1?1:s<=2?2:s<=5?5:10)*t}function Xs(e){let i=[],t=Math.sqrt(e),s;for(s=1;s<t;s++)e%s===0&&(i.push(s),i.push(e/s));return t===(t|0)&&i.push(t),i.sort((n,o)=>n-o).pop(),i}function pa$1(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function It(e){return !pa$1(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function Ks(e,i){let t=Math.round(e);return t-i<=e&&t+i>=e}function Mi$1(e,i,t){let s,n,o;for(s=0,n=e.length;s<n;s++)o=e[s][t],isNaN(o)||(i.min=Math.min(i.min,o),i.max=Math.max(i.max,o));}function it(e){return e*(L/180)}function Be$1(e){return e*(180/L)}function ki$1(e){if(!W(e))return;let i=1,t=0;for(;Math.round(e*i)/i!==e;)i*=10,t++;return t}function Si$1(e,i){let t=i.x-e.x,s=i.y-e.y,n=Math.sqrt(t*t+s*s),o=Math.atan2(s,t);return o<-0.5*L&&(o+=z),{angle:o,distance:n}}function Ie(e,i){return Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}function ma$1(e,i){return (e-i+fa$1)%z-L}function U(e){return (e%z+z)%z}function qt(e,i,t,s){let n=U(e),o=U(i),a=U(t),r=U(o-n),l=U(a-n),c=U(n-o),h=U(n-a);return n===o||n===a||s&&o===a||r>l&&c<h}function Y(e,i,t){return Math.max(i,Math.min(t,e))}function qs(e){return Y(e,-32768,32767)}function ct(e,i,t,s=1e-6){return e>=Math.min(i,t)-s&&e<=Math.max(i,t)+s}function Ve$1(e,i,t){t=t||(a=>e[a]<i);let s=e.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,t(o)?n=o:s=o;return {lo:n,hi:s}}var at=(e,i,t,s)=>Ve$1(e,t,s?n=>{let o=e[n][i];return o<t||o===t&&e[n+1][i]===t}:n=>e[n][i]<t),Gs=(e,i,t)=>Ve$1(e,t,s=>e[s][i]>=t);function Js(e,i,t){let s=0,n=e.length;for(;s<n&&e[s]<i;)s++;for(;n>s&&e[n-1]>t;)n--;return s>0||n<e.length?e.slice(s,n):e}var Zs=["push","pop","shift","splice","unshift"];function Qs(e,i){if(e._chartjs){e._chartjs.listeners.push(i);return}Object.defineProperty(e,"_chartjs",{configurable:true,enumerable:false,value:{listeners:[i]}}),Zs.forEach(t=>{let s="_onData"+ze(t),n=e[t];Object.defineProperty(e,t,{configurable:true,enumerable:false,value(...o){let a=n.apply(this,o);return e._chartjs.listeners.forEach(r=>{typeof r[s]=="function"&&r[s](...o);}),a}});});}function wi$1(e,i){let t=e._chartjs;if(!t)return;let s=t.listeners,n=s.indexOf(i);n!==-1&&s.splice(n,1),!(s.length>0)&&(Zs.forEach(o=>{delete e[o];}),delete e._chartjs);}function Pi$1(e){let i=new Set(e);return i.size===e.length?e:Array.from(i)}var Ci$1=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function Di$1(e,i){let t=[],s=false;return function(...n){t=n,s||(s=true,Ci$1.call(window,()=>{s=false,e.apply(i,t);}));}}function tn(e,i){let t;return function(...s){return i?(clearTimeout(t),t=setTimeout(e,i,s)):e.apply(this,s),i}}var We$1=e=>e==="start"?"left":e==="end"?"right":"center",X=(e,i,t)=>e==="start"?i:e==="end"?t:(i+t)/2,en=(e,i,t,s)=>e===(s?"left":"right")?t:e==="center"?(i+t)/2:i;function Ai$1(e,i,t){let s=i.length,n=0,o=s;if(e._sorted){let{iScale:a,vScale:r,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,h=a.axis,{min:d,max:u,minDefined:f,maxDefined:p}=a.getUserBounds();if(f){if(n=Math.min(at(l,h,d).lo,t?s:at(i,h,a.getPixelForValue(d)).lo),c){let g=l.slice(0,n+1).reverse().findIndex(m=>!A(m[r.axis]));n-=Math.max(0,g);}n=Y(n,0,s-1);}if(p){let g=Math.max(at(l,a.axis,u,true).hi+1,t?0:at(i,h,a.getPixelForValue(u),true).hi+1);if(c){let m=l.slice(g-1).findIndex(b=>!A(b[r.axis]));g+=Math.max(0,m);}o=Y(g,n,s)-n;}else o=s-n;}return {start:n,count:o}}function Oi$1(e){let{xScale:i,yScale:t,_scaleRanges:s}=e,n={xmin:i.min,xmax:i.max,ymin:t.min,ymax:t.max};if(!s)return e._scaleRanges=n,true;let o=s.xmin!==i.min||s.xmax!==i.max||s.ymin!==t.min||s.ymax!==t.max;return Object.assign(s,n),o}var Oe=e=>e===0||e===1,Is=(e,i,t)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-i)*z/t)),Fs=(e,i,t)=>Math.pow(2,-10*e)*Math.sin((e-i)*z/t)+1,jt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-0.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-0.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*N)+1,easeOutSine:e=>Math.sin(e*N),easeInOutSine:e=>-0.5*(Math.cos(L*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Oe(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-0.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Oe(e)?e:Is(e,.075,.3),easeOutElastic:e=>Oe(e)?e:Fs(e,.075,.3),easeInOutElastic(e){return Oe(e)?e:e<.5?.5*Is(e*2,.1125,.45):.5+.5*Fs(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return (e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let i=1.70158;return (e/=.5)<1?.5*(e*e*(((i*=1.525)+1)*e-i)):.5*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)},easeInBounce:e=>1-jt.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?jt.easeInBounce(e*2)*.5:jt.easeOutBounce(e*2-1)*.5+.5};function Ti$1(e){if(e&&typeof e=="object"){let i=e.toString();return i==="[object CanvasPattern]"||i==="[object CanvasGradient]"}return false}function Li$1(e){return Ti$1(e)?e:new oe(e)}function mi$1(e){return Ti$1(e)?e:new oe(e).saturate(.5).darken(.1).hexString()}var ba$1=["x","y","borderWidth","radius","tension"],xa$1=["color","borderColor","backgroundColor"];function _a$1(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:false,_indexable:false,_scriptable:i=>i!=="onProgress"&&i!=="onComplete"&&i!=="fn"}),e.set("animations",{colors:{type:"color",properties:xa$1},numbers:{type:"number",properties:ba$1}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:i=>i|0}}}});}function ya$1(e){e.set("layout",{autoPadding:true,padding:{top:0,right:0,bottom:0,left:0}});}var zs=new Map;function va$1(e,i){i=i||{};let t=e+JSON.stringify(i),s=zs.get(t);return s||(s=new Intl.NumberFormat(e,i),zs.set(t,s)),s}function Gt(e,i,t){return va$1(i,t).format(e)}var sn={values(e){return F(e)?e:""+e},numeric(e,i,t){if(e===0)return "0";let s=this.chart.options.locale,n,o=e;if(t.length>1){let c=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=Ma$1(e,t);}let a=gt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Gt(e,s,l)},logarithmic(e,i,t){if(e===0)return "0";let s=t[i].significand||e/Math.pow(10,Math.floor(gt(e)));return [1,2,3,5,10,15].includes(s)||i>.8*t.length?sn.numeric.call(this,e,i,t):""}};function Ma$1(e,i){let t=i.length>3?i[2].value-i[1].value:i[1].value-i[0].value;return Math.abs(t)>=1&&e!==Math.floor(e)&&(t=e-Math.floor(e)),t}var he$1={formatters:sn};function ka$1(e){e.set("scale",{display:true,offset:false,reverse:false,beginAtZero:false,bounds:"ticks",clip:true,grace:0,grid:{display:true,lineWidth:1,drawOnChartArea:true,drawTicks:true,tickLength:8,tickWidth:(i,t)=>t.lineWidth,tickColor:(i,t)=>t.color,offset:false},border:{display:true,dash:[],dashOffset:0,width:1},title:{display:false,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:false,textStrokeWidth:0,textStrokeColor:"",padding:3,display:true,autoSkip:true,autoSkipPadding:3,labelOffset:0,callback:he$1.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:false,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:false,_scriptable:i=>!i.startsWith("before")&&!i.startsWith("after")&&i!=="callback"&&i!=="parser",_indexable:i=>i!=="borderDash"&&i!=="tickBorderDash"&&i!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:i=>i!=="backdropPadding"&&i!=="callback",_indexable:i=>i!=="backdropPadding"});}var kt=Object.create(null),Ne=Object.create(null);function re(e,i){if(!i)return e;let t=i.split(".");for(let s=0,n=t.length;s<n;++s){let o=t[s];e=e[o]||(e[o]=Object.create(null));}return e}function bi$1(e,i,t){return typeof i=="string"?Yt(re(e,i),t):Yt(re(e,""),i)}var xi$1=class xi{constructor(i,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>mi$1(n.backgroundColor),this.hoverBorderColor=(s,n)=>mi$1(n.borderColor),this.hoverColor=(s,n)=>mi$1(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:true,includeInvisible:false},this.maintainAspectRatio=true,this.onHover=null,this.onClick=null,this.parsing=true,this.plugins={},this.responsive=true,this.scale=void 0,this.scales={},this.showLine=true,this.drawActiveElementsOnTop=true,this.describe(i),this.apply(t);}set(i,t){return bi$1(this,i,t)}get(i){return re(this,i)}describe(i,t){return bi$1(Ne,i,t)}override(i,t){return bi$1(kt,i,t)}route(i,t,s,n){let o=re(this,i),a=re(this,s),r="_"+t;Object.defineProperties(o,{[r]:{value:o[t],writable:true},[t]:{enumerable:true,get(){let l=this[r],c=a[n];return O(l)?Object.assign({},c,l):P(l,c)},set(l){this[r]=l;}}});}apply(i){i.forEach(t=>t(this));}},B=new xi$1({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:false,_indexable:false}},[_a$1,ya$1,ka$1]);function Sa$1(e){return !e||A(e.size)||A(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function le(e,i,t,s,n){let o=i[n];return o||(o=i[n]=e.measureText(n).width,t.push(n)),o>s&&(s=o),s}function nn(e,i,t,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==i&&(n=s.data={},o=s.garbageCollect=[],s.font=i),e.save(),e.font=i;let a=0,r=t.length,l,c,h,d,u;for(l=0;l<r;l++)if(d=t[l],d!=null&&!F(d))a=le(e,n,o,a,d);else if(F(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!F(u)&&(a=le(e,n,o,a,u));e.restore();let f=o.length/2;if(f>t.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f);}return a}function St(e,i,t){let s=e.currentDevicePixelRatio,n=t!==0?Math.max(t/2,.5):0;return Math.round((i-n)*s)/s+n}function Ri$1(e,i){!i&&!e||(i=i||e.getContext("2d"),i.save(),i.resetTransform(),i.clearRect(0,0,e.width,e.height),i.restore());}function He$1(e,i,t,s){Ei$1(e,i,t,s,null);}function Ei$1(e,i,t,s,n){let o,a,r,l,c,h,d,u,f=i.pointStyle,p=i.rotation,g=i.radius,m=(p||0)*ga$1;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(t,s),e.rotate(m),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(g)||g<=0)){switch(e.beginPath(),f){default:n?e.ellipse(t,s,n/2,g,0,0,z):e.arc(t,s,g,0,z),e.closePath();break;case "triangle":h=n?n/2:g,e.moveTo(t+Math.sin(m)*h,s-Math.cos(m)*g),m+=Es,e.lineTo(t+Math.sin(m)*h,s-Math.cos(m)*g),m+=Es,e.lineTo(t+Math.sin(m)*h,s-Math.cos(m)*g),e.closePath();break;case "rectRounded":c=g*.516,l=g-c,a=Math.cos(m+Lt$1)*l,d=Math.cos(m+Lt$1)*(n?n/2-c:l),r=Math.sin(m+Lt$1)*l,u=Math.sin(m+Lt$1)*(n?n/2-c:l),e.arc(t-d,s-r,c,m-L,m-N),e.arc(t+u,s-a,c,m-N,m),e.arc(t+d,s+r,c,m,m+N),e.arc(t-u,s+a,c,m+N,m+L),e.closePath();break;case "rect":if(!p){l=Math.SQRT1_2*g,h=n?n/2:l,e.rect(t-h,s-l,2*h,2*l);break}m+=Lt$1;case "rectRot":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),e.moveTo(t-d,s-r),e.lineTo(t+u,s-a),e.lineTo(t+d,s+r),e.lineTo(t-u,s+a),e.closePath();break;case "crossRot":m+=Lt$1;case "cross":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),e.moveTo(t-d,s-r),e.lineTo(t+d,s+r),e.moveTo(t+u,s-a),e.lineTo(t-u,s+a);break;case "star":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),e.moveTo(t-d,s-r),e.lineTo(t+d,s+r),e.moveTo(t+u,s-a),e.lineTo(t-u,s+a),m+=Lt$1,d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),e.moveTo(t-d,s-r),e.lineTo(t+d,s+r),e.moveTo(t+u,s-a),e.lineTo(t-u,s+a);break;case "line":a=n?n/2:Math.cos(m)*g,r=Math.sin(m)*g,e.moveTo(t-a,s-r),e.lineTo(t+a,s+r);break;case "dash":e.moveTo(t,s),e.lineTo(t+Math.cos(m)*(n?n/2:g),s+Math.sin(m)*g);break;case false:e.closePath();break}e.fill(),i.borderWidth>0&&e.stroke();}}function rt(e,i,t){return t=t||.5,!i||e&&e.x>i.left-t&&e.x<i.right+t&&e.y>i.top-t&&e.y<i.bottom+t}function de(e,i){e.save(),e.beginPath(),e.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),e.clip();}function ue(e){e.restore();}function on(e,i,t,s,n){if(!i)return e.lineTo(t.x,t.y);if(n==="middle"){let o=(i.x+t.x)/2;e.lineTo(o,i.y),e.lineTo(o,t.y);}else n==="after"!=!!s?e.lineTo(i.x,t.y):e.lineTo(t.x,i.y);e.lineTo(t.x,t.y);}function an(e,i,t,s){if(!i)return e.lineTo(t.x,t.y);e.bezierCurveTo(s?i.cp1x:i.cp2x,s?i.cp1y:i.cp2y,s?t.cp2x:t.cp1x,s?t.cp2y:t.cp1y,t.x,t.y);}function wa$1(e,i){i.translation&&e.translate(i.translation[0],i.translation[1]),A(i.rotation)||e.rotate(i.rotation),i.color&&(e.fillStyle=i.color),i.textAlign&&(e.textAlign=i.textAlign),i.textBaseline&&(e.textBaseline=i.textBaseline);}function Pa$1(e,i,t,s,n){if(n.strikethrough||n.underline){let o=e.measureText(s),a=i-o.actualBoundingBoxLeft,r=i+o.actualBoundingBoxRight,l=t-o.actualBoundingBoxAscent,c=t+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=n.decorationWidth||2,e.moveTo(a,h),e.lineTo(r,h),e.stroke();}}function Ca$1(e,i){let t=e.fillStyle;e.fillStyle=i.color,e.fillRect(i.left,i.top,i.width,i.height),e.fillStyle=t;}function wt$1(e,i,t,s,n,o={}){let a=F(i)?i:[i],r=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(e.save(),e.font=n.string,wa$1(e,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Ca$1(e,o.backdrop),r&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),A(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,t,s,o.maxWidth)),e.fillText(c,t,s,o.maxWidth),Pa$1(e,t,s,c,o),s+=Number(n.lineHeight);e.restore();}function Jt$1(e,i){let{x:t,y:s,w:n,h:o,radius:a}=i;e.arc(t+a.topLeft,s+a.topLeft,a.topLeft,1.5*L,L,true),e.lineTo(t,s+o-a.bottomLeft),e.arc(t+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,L,N,true),e.lineTo(t+n-a.bottomRight,s+o),e.arc(t+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,N,0,true),e.lineTo(t+n,s+a.topRight),e.arc(t+n-a.topRight,s+a.topRight,a.topRight,0,-N,true),e.lineTo(t+a.topLeft,s);}var Da$1=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Aa$1=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Oa$1(e,i){let t=(""+e).match(Da$1);if(!t||t[1]==="normal")return i*1.2;switch(e=+t[2],t[3]){case "px":return e;case "%":e/=100;break}return i*e}var Ta$1=e=>+e||0;function je(e,i){let t={},s=O(i),n=s?Object.keys(i):i,o=O(e)?s?a=>P(e[a],e[i[a]]):a=>e[a]:()=>e;for(let a of n)t[a]=Ta$1(o(a));return t}function Ii$1(e){return je(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Pt(e){return je(e,["topLeft","topRight","bottomLeft","bottomRight"])}function K(e){let i=Ii$1(e);return i.width=i.left+i.right,i.height=i.top+i.bottom,i}function j(e,i){e=e||{},i=i||B.font;let t=P(e.size,i.size);typeof t=="string"&&(t=parseInt(t,10));let s=P(e.style,i.style);s&&!(""+s).match(Aa$1)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);let n={family:P(e.family,i.family),lineHeight:Oa$1(P(e.lineHeight,i.lineHeight),t),size:t,style:s,weight:P(e.weight,i.weight),string:""};return n.string=Sa$1(n),n}function Zt$1(e,i,t,s){let o,a,r;for(o=0,a=e.length;o<a;++o)if(r=e[o],r!==void 0&&(r!==void 0))return r}function rn(e,i,t){let{min:s,max:n}=e,o=_i$1(i,(n-s)/2),a=(r,l)=>t&&r===0?0:r+l;return {min:a(s,-Math.abs(o)),max:a(n,o)}}function mt(e,i){return Object.assign(Object.create(e),i)}function Ye$1(e,i=[""],t,s,n=()=>e[0]){let o=t||e;typeof s>"u"&&(s=hn$1("_fallback",e));let a={[Symbol.toStringTag]:"Object",_cacheable:true,_scopes:e,_rootScopes:o,_fallback:s,_getTarget:n,override:r=>Ye$1([r,...e],i,o,s)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete e[0][l],true},get(r,l){return ln$1(r,l,()=>Va$1(l,i,e,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(r,l){return Vs(r).includes(l)},ownKeys(r){return Vs(r)},set(r,l,c){let h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,true}})}function Et$1(e,i,t,s){let n={_cacheable:false,_proxy:e,_context:i,_subProxy:t,_stack:new Set,_descriptors:Fi$1(e,s),setContext:o=>Et$1(e,o,t,s),override:o=>Et$1(e.override(o),i,t,s)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete e[a],true},get(o,a,r){return ln$1(o,a,()=>Ra$1(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(e,a)?{enumerable:true,configurable:true}:void 0:Reflect.getOwnPropertyDescriptor(e,a)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,a){return Reflect.has(e,a)},ownKeys(){return Reflect.ownKeys(e)},set(o,a,r){return e[a]=r,delete o[a],true}})}function Fi$1(e,i={scriptable:true,indexable:true}){let{_scriptable:t=i.scriptable,_indexable:s=i.indexable,_allKeys:n=i.allKeys}=e;return {allKeys:n,scriptable:t,indexable:s,isScriptable:ft$1(t)?t:()=>t,isIndexable:ft$1(s)?s:()=>s}}var La$1=(e,i)=>e?e+ze(i):i,zi$1=(e,i)=>O(i)&&e!=="adapters"&&(Object.getPrototypeOf(i)===null||i.constructor===Object);function ln$1(e,i,t){if(Object.prototype.hasOwnProperty.call(e,i)||i==="constructor")return e[i];let s=t();return e[i]=s,s}function Ra$1(e,i,t){let{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=e,r=s[i];return ft$1(r)&&a.isScriptable(i)&&(r=Ea$1(i,r,e,t)),F(r)&&r.length&&(r=Ia$1(i,r,e,a.isIndexable)),zi$1(i,r)&&(r=Et$1(r,n,o&&o[i],a)),r}function Ea$1(e,i,t,s){let{_proxy:n,_context:o,_subProxy:a,_stack:r}=t;if(r.has(e))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+e);r.add(e);let l=i(o,a||s);return r.delete(e),zi$1(e,l)&&(l=Bi$1(n._scopes,n,e,l)),l}function Ia$1(e,i,t,s){let{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=t;if(typeof o.index<"u"&&s(e))return i[o.index%i.length];if(O(i[0])){let l=i,c=n._scopes.filter(h=>h!==l);i=[];for(let h of l){let d=Bi$1(c,n,e,h);i.push(Et$1(d,o,a&&a[e],r));}}return i}function cn(e,i,t){return ft$1(e)?e(i,t):e}var Fa$1=(e,i)=>e===true?i:typeof e=="string"?pt(i,e):void 0;function za$1(e,i,t,s,n){for(let o of i){let a=Fa$1(t,o);if(a){e.add(a);let r=cn(a._fallback,t,n);if(typeof r<"u"&&r!==t&&r!==s)return r}else if(a===false&&typeof s<"u"&&t!==s)return null}return false}function Bi$1(e,i,t,s){let n=i._rootScopes,o=cn(i._fallback,t,s),a=[...e,...n],r=new Set;r.add(s);let l=Bs(r,a,t,o||t,s);return l===null||typeof o<"u"&&o!==t&&(l=Bs(r,a,o,l,s),l===null)?false:Ye$1(Array.from(r),[""],n,o,()=>Ba$1(i,t,s))}function Bs(e,i,t,s,n){for(;t;)t=za$1(e,i,t,s,n);return t}function Ba$1(e,i,t){let s=e._getTarget();i in s||(s[i]={});let n=s[i];return F(n)&&O(t)?t:n||{}}function Va$1(e,i,t,s){let n;for(let o of i)if(n=hn$1(La$1(o,e),t),typeof n<"u")return zi$1(e,n)?Bi$1(t,s,e,n):n}function hn$1(e,i){for(let t of i){if(!t)continue;let s=t[e];if(typeof s<"u")return s}}function Vs(e){let i=e._keys;return i||(i=e._keys=Wa$1(e._scopes)),i}function Wa$1(e){let i=new Set;for(let t of e)for(let s of Object.keys(t).filter(n=>!n.startsWith("_")))i.add(s);return Array.from(i)}function Vi$1(e,i,t,s){let{iScale:n}=e,{key:o="r"}=this._parsing,a=new Array(s),r,l,c,h;for(r=0,l=s;r<l;++r)c=r+t,h=i[c],a[r]={r:n.parse(pt(h,o),c)};return a}var Na$1=Number.EPSILON||1e-14,$t=(e,i)=>i<e.length&&!e[i].skip&&e[i],dn$1=e=>e==="x"?"y":"x";function Ha$1(e,i,t,s){let n=e.skip?i:e,o=i,a=t.skip?i:t,r=Ie(o,n),l=Ie(a,o),c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;let d=s*c,u=s*h;return {previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function ja$1(e,i,t){let s=e.length,n,o,a,r,l,c=$t(e,0);for(let h=0;h<s-1;++h)if(l=c,c=$t(e,h+1),!(!l||!c)){if(Kt(i[h],0,Na$1)){t[h]=t[h+1]=0;continue}n=t[h]/i[h],o=t[h+1]/i[h],r=Math.pow(n,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),t[h]=n*a*i[h],t[h+1]=o*a*i[h]);}}function Ya$1(e,i,t="x"){let s=dn$1(t),n=e.length,o,a,r,l=$t(e,0);for(let c=0;c<n;++c){if(a=r,r=l,l=$t(e,c+1),!r)continue;let h=r[t],d=r[s];a&&(o=(h-a[t])/3,r[`cp1${t}`]=h-o,r[`cp1${s}`]=d-o*i[c]),l&&(o=(l[t]-h)/3,r[`cp2${t}`]=h+o,r[`cp2${s}`]=d+o*i[c]);}}function $a$1(e,i="x"){let t=dn$1(i),s=e.length,n=Array(s).fill(0),o=Array(s),a,r,l,c=$t(e,0);for(a=0;a<s;++a)if(r=l,l=c,c=$t(e,a+1),!!l){if(c){let h=c[i]-l[i];n[a]=h!==0?(c[t]-l[t])/h:0;}o[a]=r?c?nt(n[a-1])!==nt(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a];}ja$1(e,n,o),Ya$1(e,o,i);}function Te(e,i,t){return Math.max(Math.min(e,t),i)}function Ua$1(e,i){let t,s,n,o,a,r=rt(e[0],i);for(t=0,s=e.length;t<s;++t)a=o,o=r,r=t<s-1&&rt(e[t+1],i),o&&(n=e[t],a&&(n.cp1x=Te(n.cp1x,i.left,i.right),n.cp1y=Te(n.cp1y,i.top,i.bottom)),r&&(n.cp2x=Te(n.cp2x,i.left,i.right),n.cp2y=Te(n.cp2y,i.top,i.bottom)));}function un$1(e,i,t,s,n){let o,a,r,l;if(i.spanGaps&&(e=e.filter(c=>!c.skip)),i.cubicInterpolationMode==="monotone")$a$1(e,n);else {let c=s?e[e.length-1]:e[0];for(o=0,a=e.length;o<a;++o)r=e[o],l=Ha$1(c,r,e[Math.min(o+1,a-(s?0:1))%a],i.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r;}i.capBezierPoints&&Ua$1(e,t);}function $e$1(){return typeof window<"u"&&typeof document<"u"}function Ue(e){let i=e.parentNode;return i&&i.toString()==="[object ShadowRoot]"&&(i=i.host),i}function Fe$1(e,i,t){let s;return typeof e=="string"?(s=parseInt(e,10),e.indexOf("%")!==-1&&(s=s/100*i.parentNode[t])):s=e,s}var Xe=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Xa$1(e,i){return Xe(e).getPropertyValue(i)}var Ka$1=["top","right","bottom","left"];function Rt$1(e,i,t){let s={};t=t?"-"+t:"";for(let n=0;n<4;n++){let o=Ka$1[n];s[o]=parseFloat(e[i+"-"+o+t])||0;}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}var qa$1=(e,i,t)=>(e>0||i>0)&&(!t||!t.shadowRoot);function Ga$1(e,i){let t=e.touches,s=t&&t.length?t[0]:e,{offsetX:n,offsetY:o}=s,a=false,r,l;if(qa$1(n,o,e.target))r=n,l=o;else {let c=i.getBoundingClientRect();r=s.clientX-c.left,l=s.clientY-c.top,a=true;}return {x:r,y:l,box:a}}function Ct$1(e,i){if("native"in e)return e;let{canvas:t,currentDevicePixelRatio:s}=i,n=Xe(t),o=n.boxSizing==="border-box",a=Rt$1(n,"padding"),r=Rt$1(n,"border","width"),{x:l,y:c,box:h}=Ga$1(e,t),d=a.left+(h&&r.left),u=a.top+(h&&r.top),{width:f,height:p}=i;return o&&(f-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-d)/f*t.width/s),y:Math.round((c-u)/p*t.height/s)}}function Ja$1(e,i,t){let s,n;if(i===void 0||t===void 0){let o=e&&Ue(e);if(!o)i=e.clientWidth,t=e.clientHeight;else {let a=o.getBoundingClientRect(),r=Xe(o),l=Rt$1(r,"border","width"),c=Rt$1(r,"padding");i=a.width-c.width-l.width,t=a.height-c.height-l.height,s=Fe$1(r.maxWidth,o,"clientWidth"),n=Fe$1(r.maxHeight,o,"clientHeight");}}return {width:i,height:t,maxWidth:s||Ee,maxHeight:n||Ee}}var Mt$1=e=>Math.round(e*10)/10;function fn$1(e,i,t,s){let n=Xe(e),o=Rt$1(n,"margin"),a=Fe$1(n.maxWidth,e,"clientWidth")||Ee,r=Fe$1(n.maxHeight,e,"clientHeight")||Ee,l=Ja$1(e,i,t),{width:c,height:h}=l;if(n.boxSizing==="content-box"){let u=Rt$1(n,"border","width"),f=Rt$1(n,"padding");c-=f.width+u.width,h-=f.height+u.height;}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Mt$1(Math.min(c,a,l.maxWidth)),h=Mt$1(Math.min(h,r,l.maxHeight)),c&&!h&&(h=Mt$1(c/2)),(i!==void 0||t!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Mt$1(Math.floor(h*s))),{width:c,height:h}}function Wi$1(e,i,t){let s=i||1,n=Mt$1(e.height*s),o=Mt$1(e.width*s);e.height=Mt$1(e.height),e.width=Mt$1(e.width);let a=e.canvas;return a.style&&(t||!a.style.height&&!a.style.width)&&(a.style.height=`${e.height}px`,a.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||a.height!==n||a.width!==o?(e.currentDevicePixelRatio=s,a.height=n,a.width=o,e.ctx.setTransform(s,0,0,s,0,0),true):false}var gn$1=(function(){let e=false;try{let i={get passive(){return e=!0,!1}};$e$1()&&(window.addEventListener("test",null,i),window.removeEventListener("test",null,i));}catch(i){}return e})();function Ni$1(e,i){let t=Xa$1(e,i),s=t&&t.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function vt(e,i,t,s){return {x:e.x+t*(i.x-e.x),y:e.y+t*(i.y-e.y)}}function pn$1(e,i,t,s){return {x:e.x+t*(i.x-e.x),y:s==="middle"?t<.5?e.y:i.y:s==="after"?t<1?e.y:i.y:t>0?i.y:e.y}}function mn$1(e,i,t,s){let n={x:e.cp2x,y:e.cp2y},o={x:i.cp1x,y:i.cp1y},a=vt(e,n,t),r=vt(n,o,t),l=vt(o,i,t),c=vt(a,r,t),h=vt(r,l,t);return vt(c,h,t)}var Za$1=function(e,i){return {x(t){return e+e+i-t},setWidth(t){i=t;},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,s){return t-s},leftForLtr(t,s){return t-s}}},Qa$1=function(){return {x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,i){return e+i},leftForLtr(e,i){return e}}};function Ft(e,i,t){return e?Za$1(i,t):Qa$1()}function Hi$1(e,i){let t,s;(i==="ltr"||i==="rtl")&&(t=e.canvas.style,s=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",i,"important"),e.prevTextDirection=s);}function ji$1(e,i){i!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",i[0],i[1]));}function bn$1(e){return e==="angle"?{between:qt,compare:ma$1,normalize:U}:{between:ct,compare:(i,t)=>i-t,normalize:i=>i}}function Ws({start:e,end:i,count:t,loop:s,style:n}){return {start:e%t,end:i%t,loop:s&&(i-e+1)%t===0,style:n}}function tr$1(e,i,t){let{property:s,start:n,end:o}=t,{between:a,normalize:r}=bn$1(s),l=i.length,{start:c,end:h,loop:d}=e,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(r(i[c%l][s]),n,o);++u)c--,h--;c%=l,h%=l;}return h<c&&(h+=l),{start:c,end:h,loop:d,style:e.style}}function Yi$1(e,i,t){if(!t)return [e];let{property:s,start:n,end:o}=t,a=i.length,{compare:r,between:l,normalize:c}=bn$1(s),{start:h,end:d,loop:u,style:f}=tr$1(e,i,t),p=[],g=false,m=null,b,x,y,M=()=>l(n,y,b)&&r(n,y)!==0,_=()=>r(o,b)===0||l(o,y,b),v=()=>g||M(),S=()=>!g||_();for(let k=h,w=h;k<=d;++k)x=i[k%a],!x.skip&&(b=c(x[s]),b!==y&&(g=l(b,n,o),m===null&&v()&&(m=r(b,n)===0?k:w),m!==null&&S()&&(p.push(Ws({start:m,end:k,loop:u,count:a,style:f})),m=null),w=k,y=b));return m!==null&&p.push(Ws({start:m,end:d,loop:u,count:a,style:f})),p}function $i$1(e,i){let t=[],s=e.segments;for(let n=0;n<s.length;n++){let o=Yi$1(s[n],e.points,i);o.length&&t.push(...o);}return t}function er$1(e,i,t,s){let n=0,o=i-1;if(t&&!s)for(;n<i&&!e[n].skip;)n++;for(;n<i&&e[n].skip;)n++;for(n%=i,t&&(o+=n);o>n&&e[o%i].skip;)o--;return o%=i,{start:n,end:o}}function ir$1(e,i,t,s){let n=e.length,o=[],a=i,r=e[i],l;for(l=i+1;l<=t;++l){let c=e[l%n];c.skip||c.stop?r.skip||(s=false,o.push({start:i%n,end:(l-1)%n,loop:s}),i=a=c.stop?l:null):(a=l,r.skip&&(i=l)),r=c;}return a!==null&&o.push({start:i%n,end:a%n,loop:s}),o}function xn$1(e,i){let t=e.points,s=e.options.spanGaps,n=t.length;if(!n)return [];let o=!!e._loop,{start:a,end:r}=er$1(t,n,o,s);if(s===true)return Ns(e,[{start:a,end:r,loop:o}],t,i);let l=r<a?r+n:r,c=!!e._fullLoop&&a===0&&r===n-1;return Ns(e,ir$1(t,a,l,c),t,i)}function Ns(e,i,t,s){return !s||!s.setContext||!t?i:sr$1(e,i,t,s)}function sr$1(e,i,t,s){let n=e._chart.getContext(),o=Hs(e.options),{_datasetIndex:a,options:{spanGaps:r}}=e,l=t.length,c=[],h=o,d=i[0].start,u=d;function f(p,g,m,b){let x=r?-1:1;if(p!==g){for(p+=l;t[p%l].skip;)p-=x;for(;t[g%l].skip;)g+=x;p%l!==g%l&&(c.push({start:p%l,end:g%l,loop:m,style:b}),h=b,d=g%l);}}for(let p of i){d=r?d:p.start;let g=t[d%l],m;for(u=d+1;u<=p.end;u++){let b=t[u%l];m=Hs(s.setContext(mt(n,{type:"segment",p0:g,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),nr$1(m,h)&&f(d,u-1,p.loop,h),g=b,h=m;}d<u-1&&f(d,u-1,p.loop,h);}return c}function Hs(e){return {backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function nr$1(e,i){if(!i)return false;let t=[],s=function(n,o){return Ti$1(o)?(t.includes(o)||t.push(o),t.indexOf(o)):o};return JSON.stringify(e,s)!==JSON.stringify(i,s)}function Le(e,i,t){return e.options.clip?e[t]:i[t]}function or$1(e,i){let{xScale:t,yScale:s}=e;return t&&s?{left:Le(t,i,"left"),right:Le(t,i,"right"),top:Le(s,i,"top"),bottom:Le(s,i,"bottom")}:i}function Ui$1(e,i){let t=i._clip;if(t.disabled)return false;let s=or$1(i,e.chartArea);return {left:t.left===false?0:s.left-(t.left===true?0:t.left),right:t.right===false?e.width:s.right+(t.right===true?0:t.right),top:t.top===false?0:s.top-(t.top===true?0:t.top),bottom:t.bottom===false?e.height:s.bottom+(t.bottom===true?0:t.bottom)}}var ns$1=class ns{constructor(){this._request=null,this._charts=new Map,this._running=false,this._lastDate=void 0;}_notify(i,t,s,n){let o=t.listeners[n],a=t.duration;o.forEach(r=>r({chart:i,initial:t.initial,numSteps:a,currentStep:Math.min(s-t.start,a)}));}_refresh(){this._request||(this._running=true,this._request=Ci$1.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh();}));}_update(i=Date.now()){let t=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;let o=s.items,a=o.length-1,r=false,l;for(;a>=0;--a)l=o[a],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(i),r=true):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,s,i,"progress")),o.length||(s.running=false,this._notify(n,s,i,"complete"),s.initial=false),t+=o.length;}),this._lastDate=i,t===0&&(this._running=false);}_getAnims(i){let t=this._charts,s=t.get(i);return s||(s={running:false,initial:true,items:[],listeners:{complete:[],progress:[]}},t.set(i,s)),s}listen(i,t,s){this._getAnims(i).listeners[t].push(s);}add(i,t){!t||!t.length||this._getAnims(i).items.push(...t);}has(i){return this._getAnims(i).items.length>0}start(i){let t=this._charts.get(i);t&&(t.running=true,t.start=Date.now(),t.duration=t.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh());}running(i){if(!this._running)return false;let t=this._charts.get(i);return !(!t||!t.running||!t.items.length)}stop(i){let t=this._charts.get(i);if(!t||!t.items.length)return;let s=t.items,n=s.length-1;for(;n>=0;--n)s[n].cancel();t.items=[],this._notify(i,t,Date.now(),"complete");}remove(i){return this._charts.delete(i)}},bt=new ns$1,_n$1="transparent",ar$1={boolean(e,i,t){return t>.5?i:e},color(e,i,t){let s=Li$1(e||_n$1),n=s.valid&&Li$1(i||_n$1);return n&&n.valid?n.mix(s,t).hexString():i},number(e,i,t){return e+(i-e)*t}},os$1=class os{constructor(i,t,s,n){let o=t[s];n=Zt$1([i.to,n,o,i.from]);let a=Zt$1([i.from,o,n]);this._active=true,this._fn=i.fn||ar$1[i.type||typeof a],this._easing=jt[i.easing]||jt.linear,this._start=Math.floor(Date.now()+(i.delay||0)),this._duration=this._total=Math.floor(i.duration),this._loop=!!i.loop,this._target=t,this._prop=s,this._from=a,this._to=n,this._promises=void 0;}active(){return this._active}update(i,t,s){if(this._active){this._notify(false);let n=this._target[this._prop],o=s-this._start,a=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(a,i.duration)),this._total+=o,this._loop=!!i.loop,this._to=Zt$1([i.to,t,n,i.from]),this._from=Zt$1([i.from,n,t]);}}cancel(){this._active&&(this.tick(Date.now()),this._active=false,this._notify(false));}tick(i){let t=i-this._start,s=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||t<s),!this._active){this._target[n]=r,this._notify(true);return}if(t<0){this._target[n]=o;return}l=t/s%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l);}wait(){let i=this._promises||(this._promises=[]);return new Promise((t,s)=>{i.push({res:t,rej:s});})}_notify(i){let t=i?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][t]();}},ii$1=class ii{constructor(i,t){this._chart=i,this._properties=new Map,this.configure(t);}configure(i){if(!O(i))return;let t=Object.keys(B.animation),s=this._properties;Object.getOwnPropertyNames(i).forEach(n=>{let o=i[n];if(!O(o))return;let a={};for(let r of t)a[r]=o[r];(F(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!s.has(r))&&s.set(r,a);});});}_animateOptions(i,t){let s=t.options,n=lr$1(i,s);if(!n)return [];let o=this._createAnimations(n,s);return s.$shared&&rr$1(i.options.$animations,s).then(()=>{i.options=s;},()=>{}),o}_createAnimations(i,t){let s=this._properties,n=[],o=i.$animations||(i.$animations={}),a=Object.keys(t),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(i,t));continue}let h=t[c],d=o[c],u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){i[c]=h;continue}o[c]=d=new os$1(u,i,c,h),n.push(d);}return n}update(i,t){if(this._properties.size===0){Object.assign(i,t);return}let s=this._createAnimations(i,t);if(s.length)return bt.add(this._chart,s),true}};function rr$1(e,i){let t=[],s=Object.keys(i);for(let n=0;n<s.length;n++){let o=e[s[n]];o&&o.active()&&t.push(o.wait());}return Promise.all(t)}function lr$1(e,i){if(!i)return;let t=e.options;if(!t){e.options=i;return}return t.$shared&&(e.options=t=Object.assign({},t,{$shared:false,$animations:{}})),t}function yn$1(e,i){let t=e&&e.options||{},s=t.reverse,n=t.min===void 0?i:0,o=t.max===void 0?i:0;return {start:s?o:n,end:s?n:o}}function cr$1(e,i,t){if(t===false)return false;let s=yn$1(e,t),n=yn$1(i,t);return {top:n.end,right:s.end,bottom:n.start,left:s.start}}function hr$1(e){let i,t,s,n;return O(e)?(i=e.top,t=e.right,s=e.bottom,n=e.left):i=t=s=n=e,{top:i,right:t,bottom:s,left:n,disabled:e===false}}function yo(e,i){let t=[],s=e._getSortedDatasetMetas(i),n,o;for(n=0,o=s.length;n<o;++n)t.push(s[n].index);return t}function vn$1(e,i,t,s={}){let n=e.keys,o=s.mode==="single",a,r,l,c;if(i===null)return;let h=false;for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===t){if(h=true,s.all)continue;break}c=e.values[l],W(c)&&(o||i===0||nt(i)===nt(c))&&(i+=c);}return !h&&!s.all?0:i}function dr$1(e,i){let{iScale:t,vScale:s}=i,n=t.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",a=Object.keys(e),r=new Array(a.length),l,c,h;for(l=0,c=a.length;l<c;++l)h=a[l],r[l]={[n]:h,[o]:e[h]};return r}function Xi$1(e,i){let t=e&&e.options.stacked;return t||t===void 0&&i.stack!==void 0}function ur$1(e,i,t){return `${e.id}.${i.id}.${t.stack||t.type}`}function fr$1(e){let{min:i,max:t,minDefined:s,maxDefined:n}=e.getUserBounds();return {min:s?i:Number.NEGATIVE_INFINITY,max:n?t:Number.POSITIVE_INFINITY}}function gr$1(e,i,t){let s=e[i]||(e[i]={});return s[t]||(s[t]={})}function Mn$1(e,i,t,s){for(let n of i.getMatchingVisibleMetas(s).reverse()){let o=e[n.index];if(t&&o>0||!t&&o<0)return n.index}return null}function kn$1(e,i){let{chart:t,_cachedMeta:s}=e,n=t._stacks||(t._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,c=a.axis,h=ur$1(o,a,s),d=i.length,u;for(let f=0;f<d;++f){let p=i[f],{[l]:g,[c]:m}=p,b=p._stacks||(p._stacks={});u=b[c]=gr$1(n,h,g),u[r]=m,u._top=Mn$1(u,a,true,s.type),u._bottom=Mn$1(u,a,false,s.type);let x=u._visualValues||(u._visualValues={});x[r]=m;}}function Ki$1(e,i){let t=e.scales;return Object.keys(t).filter(s=>t[s].axis===i).shift()}function pr$1(e,i){return mt(e,{active:false,dataset:void 0,datasetIndex:i,index:i,mode:"default",type:"dataset"})}function mr$1(e,i,t){return mt(e,{active:false,dataIndex:i,parsed:void 0,raw:void 0,element:t,index:i,mode:"default",type:"data"})}function fe$1(e,i){let t=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){i=i||e._parsed;for(let n of i){let o=n._stacks;if(!o||o[s]===void 0||o[s][t]===void 0)return;delete o[s][t],o[s]._visualValues!==void 0&&o[s]._visualValues[t]!==void 0&&delete o[s]._visualValues[t];}}}var qi$1=e=>e==="reset"||e==="none",Sn$1=(e,i)=>i?e:Object.assign({},e),br$1=(e,i,t)=>e&&!i.hidden&&i._stacked&&{keys:yo(t,true),values:null},At$1=(()=>{class e{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,s){this.chart=t,this._ctx=t.ctx,this.index=s,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=false,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=false,this.supportsDecimation=false,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize();}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Xi$1(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options");}updateIndex(t){this.index!==t&&fe$1(this._cachedMeta),this.index=t;}linkScales(){let t=this.chart,s=this._cachedMeta,n=this.getDataset(),o=(u,f,p,g)=>u==="x"?f:u==="r"?g:p,a=s.xAxisID=P(n.xAxisID,Ki$1(t,"x")),r=s.yAxisID=P(n.yAxisID,Ki$1(t,"y")),l=s.rAxisID=P(n.rAxisID,Ki$1(t,"r")),c=s.indexAxis,h=s.iAxisID=o(c,a,r,l),d=s.vAxisID=o(c,r,a,l);s.xScale=this.getScaleForId(a),s.yScale=this.getScaleForId(r),s.rScale=this.getScaleForId(l),s.iScale=this.getScaleForId(h),s.vScale=this.getScaleForId(d);}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let s=this._cachedMeta;return t===s.iScale?s.vScale:s.iScale}reset(){this._update("reset");}_destroy(){let t=this._cachedMeta;this._data&&wi$1(this._data,this),t._stacked&&fe$1(t);}_dataCheck(){let t=this.getDataset(),s=t.data||(t.data=[]),n=this._data;if(O(s)){let o=this._cachedMeta;this._data=dr$1(s,o);}else if(n!==s){if(n){wi$1(n,this);let o=this._cachedMeta;fe$1(o),o._parsed=[];}s&&Object.isExtensible(s)&&Qs(s,this),this._syncList=[],this._data=s;}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType);}buildOrUpdateElements(t){let s=this._cachedMeta,n=this.getDataset(),o=false;this._dataCheck();let a=s._stacked;s._stacked=Xi$1(s.vScale,s),s.stack!==n.stack&&(o=true,fe$1(s),s.stack=n.stack),this._resyncElements(t),(o||a!==s._stacked)&&(kn$1(this,s._parsed),s._stacked=Xi$1(s.vScale,s));}configure(){let t=this.chart.config,s=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),s,true);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={};}parse(t,s){let{_cachedMeta:n,_data:o}=this,{iScale:a,_stacked:r}=n,l=a.axis,c=t===0&&s===o.length?true:n._sorted,h=t>0&&n._parsed[t-1],d,u,f;if(this._parsing===false)n._parsed=o,n._sorted=true,f=o;else {F(o[t])?f=this.parseArrayData(n,o,t,s):O(o[t])?f=this.parseObjectData(n,o,t,s):f=this.parsePrimitiveData(n,o,t,s);let p=()=>u[l]===null||h&&u[l]<h[l];for(d=0;d<s;++d)n._parsed[d+t]=u=f[d],c&&(p()&&(c=false),h=u);n._sorted=c;}r&&kn$1(this,f);}parsePrimitiveData(t,s,n,o){let{iScale:a,vScale:r}=t,l=a.axis,c=r.axis,h=a.getLabels(),d=a===r,u=new Array(o),f,p,g;for(f=0,p=o;f<p;++f)g=f+n,u[f]={[l]:d||a.parse(h[g],g),[c]:r.parse(s[g],g)};return u}parseArrayData(t,s,n,o){let{xScale:a,yScale:r}=t,l=new Array(o),c,h,d,u;for(c=0,h=o;c<h;++c)d=c+n,u=s[d],l[c]={x:a.parse(u[0],d),y:r.parse(u[1],d)};return l}parseObjectData(t,s,n,o){let{xScale:a,yScale:r}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,h=new Array(o),d,u,f,p;for(d=0,u=o;d<u;++d)f=d+n,p=s[f],h[d]={x:a.parse(pt(p,l),f),y:r.parse(pt(p,c),f)};return h}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,s,n){let o=this.chart,a=this._cachedMeta,r=s[t.axis],l={keys:yo(o,true),values:s._stacks[t.axis]._visualValues};return vn$1(l,r,a.index,{mode:n})}updateRangeFromParsed(t,s,n,o){let a=n[s.axis],r=a===null?NaN:a,l=o&&n._stacks[s.axis];o&&l&&(o.values=l,r=vn$1(o,a,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r);}getMinMax(t,s){let n=this._cachedMeta,o=n._parsed,a=n._sorted&&t===n.iScale,r=o.length,l=this._getOtherScale(t),c=br$1(s,n,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:u}=fr$1(l),f,p;function g(){p=o[f];let m=p[l.axis];return !W(p[t.axis])||d>m||u<m}for(f=0;f<r&&!(!g()&&(this.updateRangeFromParsed(h,t,p,c),a));++f);if(a){for(f=r-1;f>=0;--f)if(!g()){this.updateRangeFromParsed(h,t,p,c);break}}return h}getAllParsedValues(t){let s=this._cachedMeta._parsed,n=[],o,a,r;for(o=0,a=s.length;o<a;++o)r=s[o][t.axis],W(r)&&n.push(r);return n}getMaxOverflow(){return false}getLabelAndValue(t){let s=this._cachedMeta,n=s.iScale,o=s.vScale,a=this.getParsed(t);return {label:n?""+n.getLabelForValue(a[n.axis]):"",value:o?""+o.getLabelForValue(a[o.axis]):""}}_update(t){let s=this._cachedMeta;this.update(t||"default"),s._clip=hr$1(P(this.options.clip,cr$1(s.xScale,s.yScale,this.getMaxOverflow())));}update(t){}draw(){let t=this._ctx,s=this.chart,n=this._cachedMeta,o=n.data||[],a=s.chartArea,r=[],l=this._drawStart||0,c=this._drawCount||o.length-l,h=this.options.drawActiveElementsOnTop,d;for(n.dataset&&n.dataset.draw(t,a,l,c),d=l;d<l+c;++d){let u=o[d];u.hidden||(u.active&&h?r.push(u):u.draw(t,a));}for(d=0;d<r.length;++d)r[d].draw(t,a);}getStyle(t,s){let n=s?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,s,n){let o=this.getDataset(),a;if(t>=0&&t<this._cachedMeta.data.length){let r=this._cachedMeta.data[t];a=r.$context||(r.$context=mr$1(this.getContext(),t,r)),a.parsed=this.getParsed(t),a.raw=o.data[t],a.index=a.dataIndex=t;}else a=this.$context||(this.$context=pr$1(this.chart.getContext(),this.index)),a.dataset=o,a.index=a.datasetIndex=this.index;return a.active=!!s,a.mode=n,a}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,s){return this._resolveElementOptions(this.dataElementType.id,s,t)}_resolveElementOptions(t,s="default",n){let o=s==="active",a=this._cachedDataOpts,r=t+"-"+s,l=a[r],c=this.enableOptionSharing&&Xt(n);if(l)return Sn$1(l,c);let h=this.chart.config,d=h.datasetElementScopeKeys(this._type,t),u=o?[`${t}Hover`,"hover",t,""]:[t,""],f=h.getOptionScopes(this.getDataset(),d),p=Object.keys(B.elements[t]),g=()=>this.getContext(n,o,s),m=h.resolveNamedOptions(f,p,g,u);return m.$shared&&(m.$shared=c,a[r]=Object.freeze(Sn$1(m,c))),m}_resolveAnimations(t,s,n){let o=this.chart,a=this._cachedDataOpts,r=`animation-${s}`,l=a[r];if(l)return l;let c;if(o.options.animation!==false){let d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,s),f=d.getOptionScopes(this.getDataset(),u);c=d.createResolver(f,this.getContext(t,n,s));}let h=new ii$1(o,c&&c.animations);return c&&c._cacheable&&(a[r]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,s){return !s||qi$1(t)||this.chart._animationsDisabled}_getSharedOptions(t,s){let n=this.resolveDataElementOptions(t,s),o=this._sharedOptions,a=this.getSharedOptions(n),r=this.includeOptions(s,a)||a!==o;return this.updateSharedOptions(a,s,n),{sharedOptions:a,includeOptions:r}}updateElement(t,s,n,o){qi$1(o)?Object.assign(t,n):this._resolveAnimations(s,o).update(t,n);}updateSharedOptions(t,s,n){t&&!qi$1(s)&&this._resolveAnimations(void 0,s).update(t,n);}_setStyle(t,s,n,o){t.active=o;let a=this.getStyle(s,o);this._resolveAnimations(s,n,o).update(t,{options:!o&&this.getSharedOptions(a)||a});}removeHoverStyle(t,s,n){this._setStyle(t,n,"active",false);}setHoverStyle(t,s,n){this._setStyle(t,n,"active",true);}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",false);}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",true);}_resyncElements(t){let s=this._data,n=this._cachedMeta.data;for(let[l,c,h]of this._syncList)this[l](c,h);this._syncList=[];let o=n.length,a=s.length,r=Math.min(a,o);r&&this.parse(0,r),a>o?this._insertElements(o,a-o,t):a<o&&this._removeElements(a,o-a);}_insertElements(t,s,n=true){let o=this._cachedMeta,a=o.data,r=t+s,l,c=h=>{for(h.length+=s,l=h.length-1;l>=r;l--)h[l]=h[l-s];};for(c(a),l=t;l<r;++l)a[l]=new this.dataElementType;this._parsing&&c(o._parsed),this.parse(t,s),n&&this.updateElements(a,t,s,"reset");}updateElements(t,s,n,o){}_removeElements(t,s){let n=this._cachedMeta;if(this._parsing){let o=n._parsed.splice(t,s);n._stacked&&fe$1(n,o);}n.data.splice(t,s);}_sync(t){if(this._parsing)this._syncList.push(t);else {let[s,n,o]=t;this[s](n,o);}this.chart._dataChanges.push([this.index,...t]);}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t]);}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1]);}_onDataShift(){this._sync(["_removeElements",0,1]);}_onDataSplice(t,s){s&&this._sync(["_removeElements",t,s]);let n=arguments.length-2;n&&this._sync(["_insertElements",t,n]);}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length]);}}return e})();function xr$1(e,i){if(!e._cache.$bar){let t=e.getMatchingVisibleMetas(i),s=[];for(let n=0,o=t.length;n<o;n++)s=s.concat(t[n].controller.getAllParsedValues(e));e._cache.$bar=Pi$1(s.sort((n,o)=>n-o));}return e._cache.$bar}function _r$1(e){let i=e.iScale,t=xr$1(i,e.type),s=i._length,n,o,a,r,l=()=>{a===32767||a===-32768||(Xt(r)&&(s=Math.min(s,Math.abs(a-r)||s)),r=a);};for(n=0,o=t.length;n<o;++n)a=i.getPixelForValue(t[n]),l();for(r=void 0,n=0,o=i.ticks.length;n<o;++n)a=i.getPixelForTick(n),l();return s}function yr$1(e,i,t,s){let n=t.barThickness,o,a;return A(n)?(o=i.min*t.categoryPercentage,a=t.barPercentage):(o=n*s,a=1),{chunk:o/s,ratio:a,start:i.pixels[e]-o/2}}function vr$1(e,i,t,s){let n=i.pixels,o=n[e],a=e>0?n[e-1]:null,r=e<n.length-1?n[e+1]:null,l=t.categoryPercentage;a===null&&(a=o-(r===null?i.end-i.start:r-o)),r===null&&(r=o+o-a);let c=o-(o-Math.min(a,r))/2*l;return {chunk:Math.abs(r-a)/2*l/s,ratio:t.barPercentage,start:c}}function Mr$1(e,i,t,s){let n=t.parse(e[0],s),o=t.parse(e[1],s),a=Math.min(n,o),r=Math.max(n,o),l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),i[t.axis]=c,i._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r};}function vo(e,i,t,s){return F(e)?Mr$1(e,i,t,s):i[t.axis]=t.parse(e,s),i}function wn$1(e,i,t,s){let n=e.iScale,o=e.vScale,a=n.getLabels(),r=n===o,l=[],c,h,d,u;for(c=t,h=t+s;c<h;++c)u=i[c],d={},d[n.axis]=r||n.parse(a[c],c),l.push(vo(u,d,o,c));return l}function Gi$1(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function kr$1(e,i,t){return e!==0?nt(e):(i.isHorizontal()?1:-1)*(i.min>=t?1:-1)}function Sr$1(e){let i,t,s,n,o;return e.horizontal?(i=e.base>e.x,t="left",s="right"):(i=e.base<e.y,t="bottom",s="top"),i?(n="end",o="start"):(n="start",o="end"),{start:t,end:s,reverse:i,top:n,bottom:o}}function wr$1(e,i,t,s){let n=i.borderSkipped,o={};if(!n){e.borderSkipped=o;return}if(n===true){e.borderSkipped={top:true,right:true,bottom:true,left:true};return}let{start:a,end:r,reverse:l,top:c,bottom:h}=Sr$1(e);n==="middle"&&t&&(e.enableBorderRadius=true,(t._top||0)===s?n=c:(t._bottom||0)===s?n=h:(o[Pn$1(h,a,r,l)]=true,n=c)),o[Pn$1(n,a,r,l)]=true,e.borderSkipped=o;}function Pn$1(e,i,t,s){return s?(e=Pr$1(e,i,t),e=Cn$1(e,t,i)):e=Cn$1(e,i,t),e}function Pr$1(e,i,t){return e===i?t:e===t?i:e}function Cn$1(e,i,t){return e==="start"?i:e==="end"?t:e}function Cr$1(e,{inflateAmount:i},t){e.inflateAmount=i==="auto"?t===1?.33:0:i;}var Dr$1=(()=>{class e extends At$1{static id="bar";static defaults={datasetElementType:false,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:true,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:true,grid:{offset:true}},_value_:{type:"linear",beginAtZero:true}}};parsePrimitiveData(t,s,n,o){return wn$1(t,s,n,o)}parseArrayData(t,s,n,o){return wn$1(t,s,n,o)}parseObjectData(t,s,n,o){let{iScale:a,vScale:r}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,h=a.axis==="x"?l:c,d=r.axis==="x"?l:c,u=[],f,p,g,m;for(f=n,p=n+o;f<p;++f)m=s[f],g={},g[a.axis]=a.parse(pt(m,h),f),u.push(vo(pt(m,d),g,r,f));return u}updateRangeFromParsed(t,s,n,o){super.updateRangeFromParsed(t,s,n,o);let a=n._custom;a&&s===this._cachedMeta.vScale&&(t.min=Math.min(t.min,a.min),t.max=Math.max(t.max,a.max));}getMaxOverflow(){return 0}getLabelAndValue(t){let s=this._cachedMeta,{iScale:n,vScale:o}=s,a=this.getParsed(t),r=a._custom,l=Gi$1(r)?"["+r.start+", "+r.end+"]":""+o.getLabelForValue(a[o.axis]);return {label:""+n.getLabelForValue(a[n.axis]),value:l}}initialize(){this.enableOptionSharing=true,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack;}update(t){let s=this._cachedMeta;this.updateElements(s.data,0,s.data.length,t);}updateElements(t,s,n,o){let a=o==="reset",{index:r,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),h=l.isHorizontal(),d=this._getRuler(),{sharedOptions:u,includeOptions:f}=this._getSharedOptions(s,o);for(let p=s;p<s+n;p++){let g=this.getParsed(p),m=a||A(g[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(p),b=this._calculateBarIndexPixels(p,d),x=(g._stacks||{})[l.axis],y={horizontal:h,base:m.base,enableBorderRadius:!x||Gi$1(g._custom)||r===x._top||r===x._bottom,x:h?m.head:b.center,y:h?b.center:m.head,height:h?b.size:Math.abs(m.size),width:h?Math.abs(m.size):b.size};f&&(y.options=u||this.resolveDataElementOptions(p,t[p].active?"active":o));let M=y.options||t[p].options;wr$1(y,M,x,r),Cr$1(y,M,d.ratio),this.updateElement(t[p],p,y,o);}}_getStacks(t,s){let{iScale:n}=this._cachedMeta,o=n.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),a=n.options.stacked,r=[],l=this._cachedMeta.controller.getParsed(s),c=l&&l[n.axis],h=d=>{let u=d._parsed.find(p=>p[n.axis]===c),f=u&&u[d.vScale.axis];if(A(f)||isNaN(f))return true};for(let d of o)if(!(s!==void 0&&h(d))&&((a===false||r.indexOf(d.stack)===-1||a===void 0&&d.stack===void 0)&&r.push(d.stack),d.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,s=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===s).shift()}_getAxis(){let t={},s=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[P(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,s)]=true;return Object.keys(t)}_getStackIndex(t,s,n){let o=this._getStacks(t,n),a=s!==void 0?o.indexOf(s):-1;return a===-1?o.length-1:a}_getRuler(){let t=this.options,s=this._cachedMeta,n=s.iScale,o=[],a,r;for(a=0,r=s.data.length;a<r;++a)o.push(n.getPixelForValue(this.getParsed(a)[n.axis],a));let l=t.barThickness;return {min:l||_r$1(s),pixels:o,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:s,_stacked:n,index:o},options:{base:a,minBarLength:r}}=this,l=a||0,c=this.getParsed(t),h=c._custom,d=Gi$1(h),u=c[s.axis],f=0,p=n?this.applyStack(s,c,n):u,g,m;p!==u&&(f=p-u,p=u),d&&(u=h.barStart,p=h.barEnd-h.barStart,u!==0&&nt(u)!==nt(h.barEnd)&&(f=0),f+=u);let b=!A(a)&&!d?a:f,x=s.getPixelForValue(b);if(this.chart.getDataVisibility(t)?g=s.getPixelForValue(f+p):g=x,m=g-x,Math.abs(m)<r){m=kr$1(m,s,l)*r,u===l&&(x-=m/2);let y=s.getPixelForDecimal(0),M=s.getPixelForDecimal(1),_=Math.min(y,M),v=Math.max(y,M);x=Math.max(Math.min(x,v),_),g=x+m,n&&!d&&(c._stacks[s.axis]._visualValues[o]=s.getValueForPixel(g)-s.getValueForPixel(x));}if(x===s.getPixelForValue(l)){let y=nt(m)*s.getLineWidthForValue(l)/2;x+=y,m-=y;}return {size:m,base:x,head:g,center:g+m/2}}_calculateBarIndexPixels(t,s){let n=s.scale,o=this.options,a=o.skipNull,r=P(o.maxBarThickness,1/0),l,c,h=this._getAxisCount();if(s.grouped){let d=a?this._getStackCount(t):s.stackCount,u=o.barThickness==="flex"?vr$1(t,s,o,d*h):yr$1(t,s,o,d*h),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(P(f,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,a?t:void 0)+p;l=u.start+u.chunk*g+u.chunk/2,c=Math.min(r,u.chunk*u.ratio);}else l=n.getPixelForValue(this.getParsed(t)[n.axis],t),c=Math.min(r,s.min*s.ratio);return {base:l-c/2,head:l+c/2,center:l,size:c}}draw(){let t=this._cachedMeta,s=t.vScale,n=t.data,o=n.length,a=0;for(;a<o;++a)this.getParsed(a)[s.axis]!==null&&!n[a].hidden&&n[a].draw(this._ctx);}}return e})(),Ar$1=(()=>{class e extends At$1{static id="bubble";static defaults={datasetElementType:false,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=true,super.initialize();}parsePrimitiveData(t,s,n,o){let a=super.parsePrimitiveData(t,s,n,o);for(let r=0;r<a.length;r++)a[r]._custom=this.resolveDataElementOptions(r+n).radius;return a}parseArrayData(t,s,n,o){let a=super.parseArrayData(t,s,n,o);for(let r=0;r<a.length;r++){let l=s[n+r];a[r]._custom=P(l[2],this.resolveDataElementOptions(r+n).radius);}return a}parseObjectData(t,s,n,o){let a=super.parseObjectData(t,s,n,o);for(let r=0;r<a.length;r++){let l=s[n+r];a[r]._custom=P(l&&l.r&&+l.r,this.resolveDataElementOptions(r+n).radius);}return a}getMaxOverflow(){let t=this._cachedMeta.data,s=0;for(let n=t.length-1;n>=0;--n)s=Math.max(s,t[n].size(this.resolveDataElementOptions(n))/2);return s>0&&s}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:a}=s,r=this.getParsed(t),l=o.getLabelForValue(r.x),c=a.getLabelForValue(r.y),h=r._custom;return {label:n[t]||"",value:"("+l+", "+c+(h?", "+h:"")+")"}}update(t){let s=this._cachedMeta.data;this.updateElements(s,0,s.length,t);}updateElements(t,s,n,o){let a=o==="reset",{iScale:r,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(s,o),d=r.axis,u=l.axis;for(let f=s;f<s+n;f++){let p=t[f],g=!a&&this.getParsed(f),m={},b=m[d]=a?r.getPixelForDecimal(.5):r.getPixelForValue(g[d]),x=m[u]=a?l.getBasePixel():l.getPixelForValue(g[u]);m.skip=isNaN(b)||isNaN(x),h&&(m.options=c||this.resolveDataElementOptions(f,p.active?"active":o),a&&(m.options.radius=0)),this.updateElement(p,f,m,o);}}resolveDataElementOptions(t,s){let n=this.getParsed(t),o=super.resolveDataElementOptions(t,s);o.$shared&&(o=Object.assign({},o,{$shared:false}));let a=o.radius;return s!=="active"&&(o.radius=0),o.radius+=P(n&&n._custom,a),o}}return e})();function Or$1(e,i,t){let s=1,n=1,o=0,a=0;if(i<z){let r=e,l=r+i,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(y,M,_)=>qt(y,r,l,true)?1:Math.max(M,M*t,_,_*t),p=(y,M,_)=>qt(y,r,l,true)?-1:Math.min(M,M*t,_,_*t),g=f(0,c,d),m=f(N,h,u),b=p(L,c,d),x=p(L+N,h,u);s=(g-b)/2,n=(m-x)/2,o=-(g+b)/2,a=-(m+x)/2;}return {ratioX:s,ratioY:n,offsetX:o,offsetY:a}}var ws$1=(()=>{class e extends At$1{static id="doughnut";static defaults={datasetElementType:false,dataElementType:"arc",animation:{animateRotate:true,animateScale:false},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let s=t.data,{labels:{pointStyle:n,textAlign:o,color:a,useBorderRadius:r,borderRadius:l}}=t.legend.options;return s.labels.length&&s.datasets.length?s.labels.map((c,h)=>{let u=t.getDatasetMeta(0).controller.getStyle(h);return {text:c,fillStyle:u.backgroundColor,fontColor:a,hidden:!t.getDataVisibility(h),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:o,pointStyle:n,borderRadius:r&&(l||u.borderRadius),index:h}}):[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update();}}}};constructor(t,s){super(t,s),this.enableOptionSharing=true,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0;}linkScales(){}parse(t,s){let n=this.getDataset().data,o=this._cachedMeta;if(this._parsing===false)o._parsed=n;else {let a=c=>+n[c];if(O(n[t])){let{key:c="value"}=this._parsing;a=h=>+pt(n[h],c);}let r,l;for(r=t,l=t+s;r<l;++r)o._parsed[r]=a(r);}}_getRotation(){return it(this.options.rotation-90)}_getCircumference(){return it(this.options.circumference)}_getRotationExtents(){let t=z,s=-z;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let o=this.chart.getDatasetMeta(n).controller,a=o._getRotation(),r=o._getCircumference();t=Math.min(t,a),s=Math.max(s,a+r);}return {rotation:t,circumference:s-t}}update(t){let s=this.chart,{chartArea:n}=s,o=this._cachedMeta,a=o.data,r=this.getMaxBorderWidth()+this.getMaxOffset(a)+this.options.spacing,l=Math.max((Math.min(n.width,n.height)-r)/2,0),c=Math.min(Ys(this.options.cutout,l),1),h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:p,offsetX:g,offsetY:m}=Or$1(u,d,c),b=(n.width-r)/f,x=(n.height-r)/p,y=Math.max(Math.min(b,x)/2,0),M=_i$1(this.options.radius,y),_=Math.max(M*c,0),v=(M-_)/this._getVisibleDatasetWeightTotal();this.offsetX=g*M,this.offsetY=m*M,o.total=this.calculateTotal(),this.outerRadius=M-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*h,0),this.updateElements(a,0,a.length,t);}_circumference(t,s){let n=this.options,o=this._cachedMeta,a=this._getCircumference();return s&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||o._parsed[t]===null||o.data[t].hidden?0:this.calculateCircumference(o._parsed[t]*a/z)}updateElements(t,s,n,o){let a=o==="reset",r=this.chart,l=r.chartArea,h=r.options.animation,d=(l.left+l.right)/2,u=(l.top+l.bottom)/2,f=a&&h.animateScale,p=f?0:this.innerRadius,g=f?0:this.outerRadius,{sharedOptions:m,includeOptions:b}=this._getSharedOptions(s,o),x=this._getRotation(),y;for(y=0;y<s;++y)x+=this._circumference(y,a);for(y=s;y<s+n;++y){let M=this._circumference(y,a),_=t[y],v={x:d+this.offsetX,y:u+this.offsetY,startAngle:x,endAngle:x+M,circumference:M,outerRadius:g,innerRadius:p};b&&(v.options=m||this.resolveDataElementOptions(y,_.active?"active":o)),x+=M,this.updateElement(_,y,v,o);}}calculateTotal(){let t=this._cachedMeta,s=t.data,n=0,o;for(o=0;o<s.length;o++){let a=t._parsed[o];a!==null&&!isNaN(a)&&this.chart.getDataVisibility(o)&&!s[o].hidden&&(n+=Math.abs(a));}return n}calculateCircumference(t){let s=this._cachedMeta.total;return s>0&&!isNaN(t)?z*(Math.abs(t)/s):0}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart,o=n.data.labels||[],a=Gt(s._parsed[t],n.options.locale);return {label:o[t]||"",value:a}}getMaxBorderWidth(t){let s=0,n=this.chart,o,a,r,l,c;if(!t){for(o=0,a=n.data.datasets.length;o<a;++o)if(n.isDatasetVisible(o)){r=n.getDatasetMeta(o),t=r.data,l=r.controller;break}}if(!t)return 0;for(o=0,a=t.length;o<a;++o)c=l.resolveDataElementOptions(o),c.borderAlign!=="inner"&&(s=Math.max(s,c.borderWidth||0,c.hoverBorderWidth||0));return s}getMaxOffset(t){let s=0;for(let n=0,o=t.length;n<o;++n){let a=this.resolveDataElementOptions(n);s=Math.max(s,a.offset||0,a.hoverOffset||0);}return s}_getRingWeightOffset(t){let s=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(s+=this._getRingWeight(n));return s}_getRingWeight(t){return Math.max(P(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}return e})(),Tr$1=(()=>{class e extends At$1{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:true,spanGaps:false};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=true,this.supportsDecimation=true,super.initialize();}update(t){let s=this._cachedMeta,{dataset:n,data:o=[],_dataset:a}=s,r=this.chart._animationsDisabled,{start:l,count:c}=Ai$1(s,o,r);this._drawStart=l,this._drawCount=c,Oi$1(s)&&(l=0,c=o.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!a._decimated,n.points=o;let h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:h},t),this.updateElements(o,l,c,t);}updateElements(t,s,n,o){let a=o==="reset",{iScale:r,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,{sharedOptions:d,includeOptions:u}=this._getSharedOptions(s,o),f=r.axis,p=l.axis,{spanGaps:g,segment:m}=this.options,b=It(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||a||o==="none",y=s+n,M=t.length,_=s>0&&this.getParsed(s-1);for(let v=0;v<M;++v){let S=t[v],k=x?S:{};if(v<s||v>=y){k.skip=true;continue}let w=this.getParsed(v),D=A(w[p]),C=k[f]=r.getPixelForValue(w[f],v),T=k[p]=a||D?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,w,c):w[p],v);k.skip=isNaN(C)||isNaN(T)||D,k.stop=v>0&&Math.abs(w[f]-_[f])>b,m&&(k.parsed=w,k.raw=h.data[v]),u&&(k.options=d||this.resolveDataElementOptions(v,S.active?"active":o)),x||this.updateElement(S,v,k,o),_=w;}}getMaxOverflow(){let t=this._cachedMeta,s=t.dataset,n=s.options&&s.options.borderWidth||0,o=t.data||[];if(!o.length)return n;let a=o[0].size(this.resolveDataElementOptions(0)),r=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(n,a,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw();}}return e})(),Mo=(()=>{class e extends At$1{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:true,animateScale:true},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let s=t.data;if(s.labels.length&&s.datasets.length){let{labels:{pointStyle:n,color:o}}=t.legend.options;return s.labels.map((a,r)=>{let c=t.getDatasetMeta(0).controller.getStyle(r);return {text:a,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return []}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update();}}},scales:{r:{type:"radialLinear",angleLines:{display:false},beginAtZero:true,grid:{circular:true},pointLabels:{display:false},startAngle:0}}};constructor(t,s){super(t,s),this.innerRadius=void 0,this.outerRadius=void 0;}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart,o=n.data.labels||[],a=Gt(s._parsed[t].r,n.options.locale);return {label:o[t]||"",value:a}}parseObjectData(t,s,n,o){return Vi$1.bind(this)(t,s,n,o)}update(t){let s=this._cachedMeta.data;this._updateRadius(),this.updateElements(s,0,s.length,t);}getMinMax(){let t=this._cachedMeta,s={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,o)=>{let a=this.getParsed(o).r;!isNaN(a)&&this.chart.getDataVisibility(o)&&(a<s.min&&(s.min=a),a>s.max&&(s.max=a));}),s}_updateRadius(){let t=this.chart,s=t.chartArea,n=t.options,o=Math.min(s.right-s.left,s.bottom-s.top),a=Math.max(o/2,0),r=Math.max(n.cutoutPercentage?a/100*n.cutoutPercentage:1,0),l=(a-r)/t.getVisibleDatasetCount();this.outerRadius=a-l*this.index,this.innerRadius=this.outerRadius-l;}updateElements(t,s,n,o){let a=o==="reset",r=this.chart,c=r.options.animation,h=this._cachedMeta.rScale,d=h.xCenter,u=h.yCenter,f=h.getIndexAngle(0)-.5*L,p=f,g,m=360/this.countVisibleElements();for(g=0;g<s;++g)p+=this._computeAngle(g,o,m);for(g=s;g<s+n;g++){let b=t[g],x=p,y=p+this._computeAngle(g,o,m),M=r.getDataVisibility(g)?h.getDistanceFromCenterForValue(this.getParsed(g).r):0;p=y,a&&(c.animateScale&&(M=0),c.animateRotate&&(x=y=f));let _={x:d,y:u,innerRadius:0,outerRadius:M,startAngle:x,endAngle:y,options:this.resolveDataElementOptions(g,b.active?"active":o)};this.updateElement(b,g,_,o);}}countVisibleElements(){let t=this._cachedMeta,s=0;return t.data.forEach((n,o)=>{!isNaN(this.getParsed(o).r)&&this.chart.getDataVisibility(o)&&s++;}),s}_computeAngle(t,s,n){return this.chart.getDataVisibility(t)?it(this.resolveDataElementOptions(t,s).angle||n):0}}return e})(),Lr$1=(()=>{class e extends ws$1{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}return e})(),Rr$1=(()=>{class e extends At$1{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:true,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let s=this._cachedMeta.vScale,n=this.getParsed(t);return {label:s.getLabels()[t],value:""+s.getLabelForValue(n[s.axis])}}parseObjectData(t,s,n,o){return Vi$1.bind(this)(t,s,n,o)}update(t){let s=this._cachedMeta,n=s.dataset,o=s.data||[],a=s.iScale.getLabels();if(n.points=o,t!=="resize"){let r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);let l={_loop:true,_fullLoop:a.length===o.length,options:r};this.updateElement(n,void 0,l,t);}this.updateElements(o,0,o.length,t);}updateElements(t,s,n,o){let a=this._cachedMeta.rScale,r=o==="reset";for(let l=s;l<s+n;l++){let c=t[l],h=this.resolveDataElementOptions(l,c.active?"active":o),d=a.getPointPositionForValue(l,this.getParsed(l).r),u=r?a.xCenter:d.x,f=r?a.yCenter:d.y,p={x:u,y:f,angle:d.angle,skip:isNaN(u)||isNaN(f),options:h};this.updateElement(c,l,p,o);}}}return e})(),Er$1=(()=>{class e extends At$1{static id="scatter";static defaults={datasetElementType:false,dataElementType:"point",showLine:false,fill:false};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:a}=s,r=this.getParsed(t),l=o.getLabelForValue(r.x),c=a.getLabelForValue(r.y);return {label:n[t]||"",value:"("+l+", "+c+")"}}update(t){let s=this._cachedMeta,{data:n=[]}=s,o=this.chart._animationsDisabled,{start:a,count:r}=Ai$1(s,n,o);if(this._drawStart=a,this._drawCount=r,Oi$1(s)&&(a=0,r=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:l,_dataset:c}=s;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=n;let h=this.resolveDatasetElementOptions(t);h.segment=this.options.segment,this.updateElement(l,void 0,{animated:!o,options:h},t);}else this.datasetElementType&&(delete s.dataset,this.datasetElementType=false);this.updateElements(n,a,r,t);}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements();}updateElements(t,s,n,o){let a=o==="reset",{iScale:r,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,d=this.resolveDataElementOptions(s,o),u=this.getSharedOptions(d),f=this.includeOptions(o,u),p=r.axis,g=l.axis,{spanGaps:m,segment:b}=this.options,x=It(m)?m:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||a||o==="none",M=s>0&&this.getParsed(s-1);for(let _=s;_<s+n;++_){let v=t[_],S=this.getParsed(_),k=y?v:{},w=A(S[g]),D=k[p]=r.getPixelForValue(S[p],_),C=k[g]=a||w?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,S,c):S[g],_);k.skip=isNaN(D)||isNaN(C)||w,k.stop=_>0&&Math.abs(S[p]-M[p])>x,b&&(k.parsed=S,k.raw=h.data[_]),f&&(k.options=u||this.resolveDataElementOptions(_,v.active?"active":o)),y||this.updateElement(v,_,k,o),M=S;}this.updateSharedOptions(u,o,d);}getMaxOverflow(){let t=this._cachedMeta,s=t.data||[];if(!this.options.showLine){let l=0;for(let c=s.length-1;c>=0;--c)l=Math.max(l,s[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}let n=t.dataset,o=n.options&&n.options.borderWidth||0;if(!s.length)return o;let a=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(o,a,r)/2}}return e})(),Ir$1=Object.freeze({__proto__:null,BarController:Dr$1,BubbleController:Ar$1,DoughnutController:ws$1,LineController:Tr$1,PieController:Lr$1,PolarAreaController:Mo,RadarController:Rr$1,ScatterController:Er$1});function zt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var as$1=class e{static override(i){Object.assign(e.prototype,i);}options;constructor(i){this.options=i||{};}init(){}formats(){return zt()}parse(){return zt()}format(){return zt()}add(){return zt()}diff(){return zt()}startOf(){return zt()}endOf(){return zt()}},Fr$1={_date:as$1};function zr$1(e,i,t,s){let{controller:n,data:o,_sorted:a}=e,r=n._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(r&&i===r.axis&&i!=="r"&&a&&o.length){let c=r._reversePixels?Gs:at;if(s){if(n._sharedOptions){let h=o[0],d=typeof h.getRange=="function"&&h.getRange(i);if(d){let u=c(o,i,t-d),f=c(o,i,t+d);return {lo:u.lo,hi:f.hi}}}}else {let h=c(o,i,t);if(l){let{vScale:d}=n._cachedMeta,{_parsed:u}=e,f=u.slice(0,h.lo+1).reverse().findIndex(g=>!A(g[d.axis]));h.lo-=Math.max(0,f);let p=u.slice(h.hi).findIndex(g=>!A(g[d.axis]));h.hi+=Math.max(0,p);}return h}}return {lo:0,hi:o.length-1}}function ke(e,i,t,s,n){let o=e.getSortedVisibleDatasetMetas(),a=t[i];for(let r=0,l=o.length;r<l;++r){let{index:c,data:h}=o[r],{lo:d,hi:u}=zr$1(o[r],i,a,n);for(let f=d;f<=u;++f){let p=h[f];p.skip||s(p,c,f);}}}function Br$1(e){let i=e.indexOf("x")!==-1,t=e.indexOf("y")!==-1;return function(s,n){let o=i?Math.abs(s.x-n.x):0,a=t?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Ji$1(e,i,t,s,n){let o=[];return !n&&!e.isPointInArea(i)||ke(e,t,i,function(r,l,c){!n&&!rt(r,e.chartArea,0)||r.inRange(i.x,i.y,s)&&o.push({element:r,datasetIndex:l,index:c});},true),o}function Vr$1(e,i,t,s){let n=[];function o(a,r,l){let{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],s),{angle:d}=Si$1(a,{x:i.x,y:i.y});qt(d,c,h)&&n.push({element:a,datasetIndex:r,index:l});}return ke(e,t,i,o),n}function Wr$1(e,i,t,s,n,o){let a=[],r=Br$1(t),l=Number.POSITIVE_INFINITY;function c(h,d,u){let f=h.inRange(i.x,i.y,n);if(s&&!f)return;let p=h.getCenterPoint(n);if(!(!!o||e.isPointInArea(p))&&!f)return;let m=r(i,p);m<l?(a=[{element:h,datasetIndex:d,index:u}],l=m):m===l&&a.push({element:h,datasetIndex:d,index:u});}return ke(e,t,i,c),a}function Zi$1(e,i,t,s,n,o){return !o&&!e.isPointInArea(i)?[]:t==="r"&&!s?Vr$1(e,i,t,n):Wr$1(e,i,t,s,n,o)}function Dn(e,i,t,s,n){let o=[],a=t==="x"?"inXRange":"inYRange",r=false;return ke(e,t,i,(l,c,h)=>{l[a]&&l[a](i[t],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(i.x,i.y,n));}),s&&!r?[]:o}var Nr$1={modes:{index(e,i,t,s){let n=Ct$1(i,e),o=t.axis||"x",a=t.includeInvisible||false,r=t.intersect?Ji$1(e,n,o,s,a):Zi$1(e,n,o,false,s,a),l=[];return r.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{let h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h});}),l):[]},dataset(e,i,t,s){let n=Ct$1(i,e),o=t.axis||"xy",a=t.includeInvisible||false,r=t.intersect?Ji$1(e,n,o,s,a):Zi$1(e,n,o,false,s,a);if(r.length>0){let l=r[0].datasetIndex,c=e.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h});}return r},point(e,i,t,s){let n=Ct$1(i,e),o=t.axis||"xy",a=t.includeInvisible||false;return Ji$1(e,n,o,s,a)},nearest(e,i,t,s){let n=Ct$1(i,e),o=t.axis||"xy",a=t.includeInvisible||false;return Zi$1(e,n,o,t.intersect,s,a)},x(e,i,t,s){let n=Ct$1(i,e);return Dn(e,n,"x",t.intersect,s)},y(e,i,t,s){let n=Ct$1(i,e);return Dn(e,n,"y",t.intersect,s)}}},ko=["left","top","right","bottom"];function ge$1(e,i){return e.filter(t=>t.pos===i)}function An(e,i){return e.filter(t=>ko.indexOf(t.pos)===-1&&t.box.axis===i)}function pe$1(e,i){return e.sort((t,s)=>{let n=i?s:t,o=i?t:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Hr$1(e){let i=[],t,s,n,o,a,r;for(t=0,s=(e||[]).length;t<s;++t)n=e[t],{position:o,options:{stack:a,stackWeight:r=1}}=n,i.push({index:t,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return i}function jr$1(e){let i={};for(let t of e){let{stack:s,pos:n,stackWeight:o}=t;if(!s||!ko.includes(n))continue;let a=i[s]||(i[s]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o;}return i}function Yr$1(e,i){let t=jr$1(e),{vBoxMaxWidth:s,hBoxMaxHeight:n}=i,o,a,r;for(o=0,a=e.length;o<a;++o){r=e[o];let{fullSize:l}=r.box,c=t[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*s:l&&i.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:l&&i.availableHeight);}return t}function $r$1(e){let i=Hr$1(e),t=pe$1(i.filter(c=>c.box.fullSize),true),s=pe$1(ge$1(i,"left"),true),n=pe$1(ge$1(i,"right")),o=pe$1(ge$1(i,"top"),true),a=pe$1(ge$1(i,"bottom")),r=An(i,"x"),l=An(i,"y");return {fullSize:t,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:ge$1(i,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function On(e,i,t,s){return Math.max(e[t],i[t])+Math.max(e[s],i[s])}function So(e,i){e.top=Math.max(e.top,i.top),e.left=Math.max(e.left,i.left),e.bottom=Math.max(e.bottom,i.bottom),e.right=Math.max(e.right,i.right);}function Ur$1(e,i,t,s){let{pos:n,box:o}=t,a=e.maxPadding;if(!O(n)){t.size&&(e[n]-=t.size);let d=s[t.stack]||{size:0,count:1};d.size=Math.max(d.size,t.horizontal?o.height:o.width),t.size=d.size/d.count,e[n]+=t.size;}o.getPadding&&So(a,o.getPadding());let r=Math.max(0,i.outerWidth-On(a,e,"left","right")),l=Math.max(0,i.outerHeight-On(a,e,"top","bottom")),c=r!==e.w,h=l!==e.h;return e.w=r,e.h=l,t.horizontal?{same:c,other:h}:{same:h,other:c}}function Xr$1(e){let i=e.maxPadding;function t(s){let n=Math.max(i[s]-e[s],0);return e[s]+=n,n}e.y+=t("top"),e.x+=t("left"),t("right"),t("bottom");}function Kr$1(e,i){let t=i.maxPadding;function s(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(i[a],t[a]);}),o}return s(e?["left","right"]:["top","bottom"])}function xe(e,i,t,s){let n=[],o,a,r,l,c,h;for(o=0,a=e.length,c=0;o<a;++o){r=e[o],l=r.box,l.update(r.width||i.w,r.height||i.h,Kr$1(r.horizontal,i));let{same:d,other:u}=Ur$1(i,t,r,s);c|=d&&n.length,h=h||u,l.fullSize||n.push(r);}return c&&xe(n,i,t,s)||h}function Ke$1(e,i,t,s,n){e.top=t,e.left=i,e.right=i+s,e.bottom=t+n,e.width=s,e.height=n;}function Tn(e,i,t,s){let n=t.padding,{x:o,y:a}=i;for(let r of e){let l=r.box,c=s[r.stack]||{placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){let d=i.w*h,u=c.size||l.height;Xt(c.start)&&(a=c.start),l.fullSize?Ke$1(l,n.left,a,t.outerWidth-n.right-n.left,u):Ke$1(l,i.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom;}else {let d=i.h*h,u=c.size||l.width;Xt(c.start)&&(o=c.start),l.fullSize?Ke$1(l,o,n.top,u,t.outerHeight-n.bottom-n.top):Ke$1(l,o,i.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right;}}i.x=o,i.y=a;}var G={addBox(e,i){e.boxes||(e.boxes=[]),i.fullSize=i.fullSize||false,i.position=i.position||"top",i.weight=i.weight||0,i._layers=i._layers||function(){return [{z:0,draw(t){i.draw(t);}}]},e.boxes.push(i);},removeBox(e,i){let t=e.boxes?e.boxes.indexOf(i):-1;t!==-1&&e.boxes.splice(t,1);},configure(e,i,t){i.fullSize=t.fullSize,i.position=t.position,i.weight=t.weight;},update(e,i,t,s){if(!e)return;let n=K(e.options.layout.padding),o=Math.max(i-n.width,0),a=Math.max(t-n.height,0),r=$r$1(e.boxes),l=r.vertical,c=r.horizontal;R(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout();});let h=l.reduce((g,m)=>m.box.options&&m.box.options.display===false?g:g+1,0)||1,d=Object.freeze({outerWidth:i,outerHeight:t,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);So(u,K(s));let f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),p=Yr$1(l.concat(c),d);xe(r.fullSize,f,d,p),xe(l,f,d,p),xe(c,f,d,p)&&xe(l,f,d,p),Xr$1(f),Tn(r.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,Tn(r.rightAndBottom,f,d,p),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},R(r.chartArea,g=>{let m=g.box;Object.assign(m,e.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0});});}},si=class{acquireContext(i,t){}releaseContext(i){return false}addEventListener(i,t,s){}removeEventListener(i,t,s){}getDevicePixelRatio(){return 1}getMaximumSize(i,t,s,n){return t=Math.max(0,t||i.width),s=s||i.height,{width:t,height:Math.max(0,n?Math.floor(t/n):s)}}isAttached(i){return true}updateConfig(i){}},rs$1=class rs extends si{acquireContext(i){return i&&i.getContext&&i.getContext("2d")||null}updateConfig(i){i.options.animation=false;}},ti="$chartjs",qr$1={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ln=e=>e===null||e==="";function Gr$1(e,i){let t=e.style,s=e.getAttribute("height"),n=e.getAttribute("width");if(e[ti]={initial:{height:s,width:n,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",Ln(n)){let o=Ni$1(e,"width");o!==void 0&&(e.width=o);}if(Ln(s))if(e.style.height==="")e.height=e.width/(i||2);else {let o=Ni$1(e,"height");o!==void 0&&(e.height=o);}return e}var wo=gn$1?{passive:true}:false;function Jr$1(e,i,t){e&&e.addEventListener(i,t,wo);}function Zr$1(e,i,t){e&&e.canvas&&e.canvas.removeEventListener(i,t,wo);}function Qr$1(e,i){let t=qr$1[e.type]||e.type,{x:s,y:n}=Ct$1(e,i);return {type:t,chart:i,native:e,x:s!==void 0?s:null,y:n!==void 0?n:null}}function ni(e,i){for(let t of e)if(t===i||t.contains(i))return true}function tl(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let a=false;for(let r of o)a=a||ni(r.addedNodes,s),a=a&&!ni(r.removedNodes,s);a&&t();});return n.observe(document,{childList:true,subtree:true}),n}function el(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let a=false;for(let r of o)a=a||ni(r.removedNodes,s),a=a&&!ni(r.addedNodes,s);a&&t();});return n.observe(document,{childList:true,subtree:true}),n}var ye=new Map,Rn=0;function Po(){let e=window.devicePixelRatio;e!==Rn&&(Rn=e,ye.forEach((i,t)=>{t.currentDevicePixelRatio!==e&&i();}));}function il(e,i){ye.size||window.addEventListener("resize",Po),ye.set(e,i);}function sl(e){ye.delete(e),ye.size||window.removeEventListener("resize",Po);}function nl(e,i,t){let s=e.canvas,n=s&&Ue(s);if(!n)return;let o=Di$1((r,l)=>{let c=n.clientWidth;t(r,l),c<n.clientWidth&&t();},window),a=new ResizeObserver(r=>{let l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h);});return a.observe(n),il(e,o),a}function Qi$1(e,i,t){t&&t.disconnect(),i==="resize"&&sl(e);}function ol(e,i,t){let s=e.canvas,n=Di$1(o=>{e.ctx!==null&&t(Qr$1(o,e));},e);return Jr$1(s,i,n),n}var ls$1=class ls extends si{acquireContext(i,t){let s=i&&i.getContext&&i.getContext("2d");return s&&s.canvas===i?(Gr$1(i,t),s):null}releaseContext(i){let t=i.canvas;if(!t[ti])return false;let s=t[ti].initial;["height","width"].forEach(o=>{let a=s[o];A(a)?t.removeAttribute(o):t.setAttribute(o,a);});let n=s.style||{};return Object.keys(n).forEach(o=>{t.style[o]=n[o];}),t.width=t.width,delete t[ti],true}addEventListener(i,t,s){this.removeEventListener(i,t);let n=i.$proxies||(i.$proxies={}),a={attach:tl,detach:el,resize:nl}[t]||ol;n[t]=a(i,t,s);}removeEventListener(i,t){let s=i.$proxies||(i.$proxies={}),n=s[t];if(!n)return;(({attach:Qi$1,detach:Qi$1,resize:Qi$1})[t]||Zr$1)(i,t,n),s[t]=void 0;}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(i,t,s,n){return fn$1(i,t,s,n)}isAttached(i){let t=i&&Ue(i);return !!(t&&t.isConnected)}};function al(e){return !$e$1()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?rs$1:ls$1}var ot=class{static defaults={};static defaultRoutes=void 0;x;y;active=false;options;$animations;tooltipPosition(i){let{x:t,y:s}=this.getProps(["x","y"],i);return {x:t,y:s}}hasValue(){return It(this.x)&&It(this.y)}getProps(i,t){let s=this.$animations;if(!t||!s)return this;let n={};return i.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o];}),n}};function rl(e,i){let t=e.options.ticks,s=ll(e),n=Math.min(t.maxTicksLimit||s,s),o=t.major.enabled?hl(i):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return dl(i,c,o,a/n),c;let h=cl(o,i,n);if(a>0){let d,u,f=a>1?Math.round((l-r)/(a-1)):null;for(qe$1(i,c,h,A(f)?0:r-f,r),d=0,u=a-1;d<u;d++)qe$1(i,c,h,o[d],o[d+1]);return qe$1(i,c,h,l,A(f)?i.length:l+f),c}return qe$1(i,c,h),c}function ll(e){let i=e.options.offset,t=e._tickSize(),s=e._length/t+(i?0:1),n=e._maxLength/t;return Math.floor(Math.min(s,n))}function cl(e,i,t){let s=ul(e),n=i.length/t;if(!s)return Math.max(n,1);let o=Xs(s);for(let a=0,r=o.length-1;a<r;a++){let l=o[a];if(l>n)return l}return Math.max(n,1)}function hl(e){let i=[],t,s;for(t=0,s=e.length;t<s;t++)e[t].major&&i.push(t);return i}function dl(e,i,t,s){let n=0,o=t[0],a;for(s=Math.ceil(s),a=0;a<e.length;a++)a===o&&(i.push(e[a]),n++,o=t[n*s]);}function qe$1(e,i,t,s,n){let o=P(s,0),a=Math.min(P(n,e.length),e.length),r=0,l,c,h;for(t=Math.ceil(t),n&&(l=n-s,t=l/Math.floor(l/t)),h=o;h<0;)r++,h=Math.round(o+r*t);for(c=Math.max(o,0);c<a;c++)c===h&&(i.push(e[c]),r++,h=Math.round(o+r*t));}function ul(e){let i=e.length,t,s;if(i<2)return false;for(s=e[0],t=1;t<i;++t)if(e[t]-e[t-1]!==s)return false;return s}var fl=e=>e==="left"?"right":e==="right"?"left":e,En=(e,i,t)=>i==="top"||i==="left"?e[i]+t:e[i]-t,In$1=(e,i)=>Math.min(i||e,e);function Fn(e,i){let t=[],s=e.length/i,n=e.length,o=0;for(;o<n;o+=s)t.push(e[Math.floor(o)]);return t}function gl(e,i,t){let s=e.ticks.length,n=Math.min(i,s-1),o=e._startPixel,a=e._endPixel,r=1e-6,l=e.getPixelForTick(n),c;if(!(t&&(s===1?c=Math.max(l-o,a-l):i===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(n-1))/2,l+=n<i?c:-c,l<o-r||l>a+r)))return l}function pl(e,i){R(e,t=>{let s=t.gc,n=s.length/2,o;if(n>i){for(o=0;o<n;++o)delete t.data[s[o]];s.splice(0,n);}});}function me$1(e){return e.drawTicks?e.tickLength:0}function zn(e,i){if(!e.display)return 0;let t=j(e.font,i),s=K(e.padding);return (F(e.text)?e.text.length:1)*t.lineHeight+s.height}function ml(e,i){return mt(e,{scale:i,type:"scale"})}function bl(e,i,t){return mt(e,{tick:t,index:i,type:"tick"})}function xl(e,i,t){let s=We$1(e);return (t&&i!=="right"||!t&&i==="right")&&(s=fl(s)),s}function _l(e,i,t,s){let{top:n,left:o,bottom:a,right:r,chart:l}=e,{chartArea:c,scales:h}=l,d=0,u,f,p,g=a-n,m=r-o;if(e.isHorizontal()){if(f=X(s,o,r),O(t)){let b=Object.keys(t)[0],x=t[b];p=h[b].getPixelForValue(x)+g-i;}else t==="center"?p=(c.bottom+c.top)/2+g-i:p=En(e,t,i);u=r-o;}else {if(O(t)){let b=Object.keys(t)[0],x=t[b];f=h[b].getPixelForValue(x)-m+i;}else t==="center"?f=(c.left+c.right)/2-m+i:f=En(e,t,i);p=X(s,a,n),d=t==="left"?-N:N;}return {titleX:f,titleY:p,maxWidth:u,rotation:d}}var Vt=class e extends ot{constructor(i){super(),this.id=i.id,this.type=i.type,this.options=void 0,this.ctx=i.ctx,this.chart=i.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=false,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=false,this.$context=void 0;}init(i){this.options=i.setContext(this.getContext()),this.axis=i.axis,this._userMin=this.parse(i.min),this._userMax=this.parse(i.max),this._suggestedMin=this.parse(i.suggestedMin),this._suggestedMax=this.parse(i.suggestedMax);}parse(i,t){return i}getUserBounds(){let{_userMin:i,_userMax:t,_suggestedMin:s,_suggestedMax:n}=this;return i=J(i,Number.POSITIVE_INFINITY),t=J(t,Number.NEGATIVE_INFINITY),s=J(s,Number.POSITIVE_INFINITY),n=J(n,Number.NEGATIVE_INFINITY),{min:J(i,s),max:J(t,n),minDefined:W(i),maxDefined:W(t)}}getMinMax(i){let{min:t,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return {min:t,max:s};let r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,i),n||(t=Math.min(t,a.min)),o||(s=Math.max(s,a.max));return t=o&&t>s?s:t,s=n&&t>s?t:s,{min:J(t,J(s,t)),max:J(s,J(t,s))}}getPadding(){return {left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let i=this.chart.data;return this.options.labels||(this.isHorizontal()?i.xLabels:i.yLabels)||i.labels||[]}getLabelItems(i=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(i))}beforeLayout(){this._cache={},this._dataLimitsCached=false;}beforeUpdate(){I(this.options.beforeUpdate,[this]);}update(i,t,s){let{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=i,this.maxHeight=t,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=rn(this,o,n),this._dataLimitsCached=true),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?Fn(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=rl(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate();}configure(){let i=this.options.reverse,t,s;this.isHorizontal()?(t=this.left,s=this.right):(t=this.top,s=this.bottom,i=!i),this._startPixel=t,this._endPixel=s,this._reversePixels=i,this._length=s-t,this._alignToPixels=this.options.alignToPixels;}afterUpdate(){I(this.options.afterUpdate,[this]);}beforeSetDimensions(){I(this.options.beforeSetDimensions,[this]);}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0;}afterSetDimensions(){I(this.options.afterSetDimensions,[this]);}_callHooks(i){this.chart.notifyPlugins(i,this.getContext()),I(this.options[i],[this]);}beforeDataLimits(){this._callHooks("beforeDataLimits");}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits");}beforeBuildTicks(){this._callHooks("beforeBuildTicks");}buildTicks(){return []}afterBuildTicks(){this._callHooks("afterBuildTicks");}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this]);}generateTickLabels(i){let t=this.options.ticks,s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s],o.label=I(t.callback,[o.value,s,i],this);}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this]);}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this]);}calculateLabelRotation(){let i=this.options,t=i.ticks,s=In$1(this.ticks.length,i.ticks.maxTicksLimit),n=t.minRotation||0,o=t.maxRotation,a=n,r,l,c;if(!this._isVisible()||!t.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=Y(this.chart.width-d,0,this.maxWidth);r=i.offset?this.maxWidth/s:f/(s-1),d+6>r&&(r=f/(s-(i.offset?.5:1)),l=this.maxHeight-me$1(i.grid)-t.padding-zn(i.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=Be$1(Math.min(Math.asin(Y((h.highest.height+6)/r,-1,1)),Math.asin(Y(l/c,-1,1))-Math.asin(Y(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a;}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this]);}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this]);}fit(){let i={width:0,height:0},{chart:t,options:{ticks:s,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=zn(n,t.options.font);if(r?(i.width=this.maxWidth,i.height=me$1(o)+l):(i.height=this.maxHeight,i.width=me$1(o)+l),s.display&&this.ticks.length){let{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,p=it(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(r){let b=s.mirror?0:m*d.width+g*u.height;i.height=Math.min(this.maxHeight,i.height+b+f);}else {let b=s.mirror?0:g*d.width+m*u.height;i.width=Math.min(this.maxWidth,i.width+b+f);}this._calculatePadding(c,h,m,g);}}this._handleMargins(),r?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=i.height):(this.width=i.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom);}_calculatePadding(i,t,s,n){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=n*i.width,f=s*t.height):(u=s*i.height,f=n*t.width):o==="start"?f=t.width:o==="end"?u=i.width:o!=="inner"&&(u=i.width/2,f=t.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0);}else {let h=t.height/2,d=i.height/2;o==="start"?(h=0,d=i.height):o==="end"&&(h=t.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a;}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom));}afterFit(){I(this.options.afterFit,[this]);}isHorizontal(){let{axis:i,position:t}=this.options;return t==="top"||t==="bottom"||i==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(i){this.beforeTickToLabelConversion(),this.generateTickLabels(i);let t,s;for(t=0,s=i.length;t<s;t++)A(i[t].label)&&(i.splice(t,1),s--,t--);this.afterTickToLabelConversion();}_getLabelSizes(){let i=this._labelSizes;if(!i){let t=this.options.ticks.sampleSize,s=this.ticks;t<s.length&&(s=Fn(s,t)),this._labelSizes=i=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit);}return i}_computeLabelSizes(i,t,s){let{ctx:n,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(t/In$1(t,s)),c=0,h=0,d,u,f,p,g,m,b,x,y,M,_;for(d=0;d<t;d+=l){if(p=i[d].label,g=this._resolveTickFontOptions(d),n.font=m=g.string,b=o[m]=o[m]||{data:{},gc:[]},x=g.lineHeight,y=M=0,!A(p)&&!F(p))y=le(n,b.data,b.gc,y,p),M=x;else if(F(p))for(u=0,f=p.length;u<f;++u)_=p[u],!A(_)&&!F(_)&&(y=le(n,b.data,b.gc,y,_),M+=x);a.push(y),r.push(M),c=Math.max(y,c),h=Math.max(M,h);}pl(o,t);let v=a.indexOf(c),S=r.indexOf(h),k=w=>({width:a[w]||0,height:r[w]||0});return {first:k(0),last:k(t-1),widest:k(v),highest:k(S),widths:a,heights:r}}getLabelForValue(i){return i}getPixelForValue(i,t){return NaN}getValueForPixel(i){}getPixelForTick(i){let t=this.ticks;return i<0||i>t.length-1?null:this.getPixelForValue(t[i].value)}getPixelForDecimal(i){this._reversePixels&&(i=1-i);let t=this._startPixel+i*this._length;return qs(this._alignToPixels?St(this.chart,t,0):t)}getDecimalForPixel(i){let t=(i-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:i,max:t}=this;return i<0&&t<0?t:i>0&&t>0?i:0}getContext(i){let t=this.ticks||[];if(i>=0&&i<t.length){let s=t[i];return s.$context||(s.$context=bl(this.getContext(),i,s))}return this.$context||(this.$context=ml(this.chart.getContext(),this))}_tickSize(){let i=this.options.ticks,t=it(this.labelRotation),s=Math.abs(Math.cos(t)),n=Math.abs(Math.sin(t)),o=this._getLabelSizes(),a=i.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*s>r*n?r/s:l/n:l*n<r*s?l/s:r/n}_isVisible(){let i=this.options.display;return i!=="auto"?!!i:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(i){let t=this.axis,s=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=me$1(o),f=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(V){return St(s,V,g)},x,y,M,_,v,S,k,w,D,C,T,$;if(a==="top")x=b(this.bottom),S=this.bottom-u,w=x-m,C=b(i.top)+m,$=i.bottom;else if(a==="bottom")x=b(this.top),C=i.top,$=b(i.bottom)-m,S=x+m,w=this.top+u;else if(a==="left")x=b(this.right),v=this.right-u,k=x-m,D=b(i.left)+m,T=i.right;else if(a==="right")x=b(this.left),D=i.left,T=b(i.right)-m,v=x+m,k=this.left+u;else if(t==="x"){if(a==="center")x=b((i.top+i.bottom)/2+.5);else if(O(a)){let V=Object.keys(a)[0],H=a[V];x=b(this.chart.scales[V].getPixelForValue(H));}C=i.top,$=i.bottom,S=x+m,w=S+u;}else if(t==="y"){if(a==="center")x=b((i.left+i.right)/2);else if(O(a)){let V=Object.keys(a)[0],H=a[V];x=b(this.chart.scales[V].getPixelForValue(H));}v=x-m,k=v-u,D=i.left,T=i.right;}let tt=P(n.ticks.maxTicksLimit,d),E=Math.max(1,Math.ceil(d/tt));for(y=0;y<d;y+=E){let V=this.getContext(y),H=o.setContext(V),st=r.setContext(V),q=H.lineWidth,Wt=H.color,Se=st.dash||[],Nt=st.dashOffset,ie=H.tickWidth,Ot=H.tickColor,se=H.tickBorderDash||[],Tt=H.tickBorderDashOffset;M=gl(this,y,l),M!==void 0&&(_=St(s,M,q),c?v=k=D=T=_:S=w=C=$=_,f.push({tx1:v,ty1:S,tx2:k,ty2:w,x1:D,y1:C,x2:T,y2:$,width:q,color:Wt,borderDash:Se,borderDashOffset:Nt,tickWidth:ie,tickColor:Ot,tickBorderDash:se,tickBorderDashOffset:Tt}));}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(i){let t=this.axis,s=this.options,{position:n,ticks:o}=s,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=me$1(s.grid),f=u+h,p=d?-h:f,g=-it(this.labelRotation),m=[],b,x,y,M,_,v,S,k,w,D,C,T,$="middle";if(n==="top")v=this.bottom-p,S=this._getXAxisLabelAlignment();else if(n==="bottom")v=this.top+p,S=this._getXAxisLabelAlignment();else if(n==="left"){let E=this._getYAxisLabelAlignment(u);S=E.textAlign,_=E.x;}else if(n==="right"){let E=this._getYAxisLabelAlignment(u);S=E.textAlign,_=E.x;}else if(t==="x"){if(n==="center")v=(i.top+i.bottom)/2+f;else if(O(n)){let E=Object.keys(n)[0],V=n[E];v=this.chart.scales[E].getPixelForValue(V)+f;}S=this._getXAxisLabelAlignment();}else if(t==="y"){if(n==="center")_=(i.left+i.right)/2-f;else if(O(n)){let E=Object.keys(n)[0],V=n[E];_=this.chart.scales[E].getPixelForValue(V);}S=this._getYAxisLabelAlignment(u).textAlign;}t==="y"&&(l==="start"?$="top":l==="end"&&($="bottom"));let tt=this._getLabelSizes();for(b=0,x=r.length;b<x;++b){y=r[b],M=y.label;let E=o.setContext(this.getContext(b));k=this.getPixelForTick(b)+o.labelOffset,w=this._resolveTickFontOptions(b),D=w.lineHeight,C=F(M)?M.length:1;let V=C/2,H=E.color,st=E.textStrokeColor,q=E.textStrokeWidth,Wt=S;a?(_=k,S==="inner"&&(b===x-1?Wt=this.options.reverse?"left":"right":b===0?Wt=this.options.reverse?"right":"left":Wt="center"),n==="top"?c==="near"||g!==0?T=-C*D+D/2:c==="center"?T=-tt.highest.height/2-V*D+D:T=-tt.highest.height+D/2:c==="near"||g!==0?T=D/2:c==="center"?T=tt.highest.height/2-V*D:T=tt.highest.height-C*D,d&&(T*=-1),g!==0&&!E.showLabelBackdrop&&(_+=D/2*Math.sin(g))):(v=k,T=(1-C)*D/2);let Se;if(E.showLabelBackdrop){let Nt=K(E.backdropPadding),ie=tt.heights[b],Ot=tt.widths[b],se=T-Nt.top,Tt=0-Nt.left;switch($){case "middle":se-=ie/2;break;case "bottom":se-=ie;break}switch(S){case "center":Tt-=Ot/2;break;case "right":Tt-=Ot;break;case "inner":b===x-1?Tt-=Ot:b>0&&(Tt-=Ot/2);break}Se={left:Tt,top:se,width:Ot+Nt.width,height:ie+Nt.height,color:E.backdropColor};}m.push({label:M,font:w,textOffset:T,options:{rotation:g,color:H,strokeColor:st,strokeWidth:q,textAlign:Wt,textBaseline:$,translation:[_,v],backdrop:Se}});}return m}_getXAxisLabelAlignment(){let{position:i,ticks:t}=this.options;if(-it(this.labelRotation))return i==="top"?"left":"right";let n="center";return t.align==="start"?n="left":t.align==="end"?n="right":t.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(i){let{position:t,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=i+o,l=a.widest.width,c,h;return t==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):t==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;let i=this.chart,t=this.options.position;if(t==="left"||t==="right")return {top:0,left:this.left,bottom:i.height,right:this.right};if(t==="top"||t==="bottom")return {top:this.top,left:0,bottom:this.bottom,right:i.width}}drawBackground(){let{ctx:i,options:{backgroundColor:t},left:s,top:n,width:o,height:a}=this;t&&(i.save(),i.fillStyle=t,i.fillRect(s,n,o,a),i.restore());}getLineWidthForValue(i){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(o=>o.value===i);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(i){let t=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(i)),o,a,r=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore());};if(t.display)for(o=0,a=n.length;o<a;++o){let l=n[o];t.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),t.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset});}}drawBorder(){let{chart:i,ctx:t,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),a=s.display?o.width:0;if(!a)return;let r=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,h,d,u;this.isHorizontal()?(c=St(i,this.left,a)-a/2,h=St(i,this.right,r)+r/2,d=u=l):(d=St(i,this.top,a)-a/2,u=St(i,this.bottom,r)+r/2,c=h=l),t.save(),t.lineWidth=o.width,t.strokeStyle=o.color,t.beginPath(),t.moveTo(c,d),t.lineTo(h,u),t.stroke(),t.restore();}drawLabels(i){if(!this.options.ticks.display)return;let s=this.ctx,n=this._computeLabelArea();n&&de(s,n);let o=this.getLabelItems(i);for(let a of o){let r=a.options,l=a.font,c=a.label,h=a.textOffset;wt$1(s,c,0,h,l,r);}n&&ue(s);}drawTitle(){let{ctx:i,options:{position:t,title:s,reverse:n}}=this;if(!s.display)return;let o=j(s.font),a=K(s.padding),r=s.align,l=o.lineHeight/2;t==="bottom"||t==="center"||O(t)?(l+=a.bottom,F(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=a.top;let{titleX:c,titleY:h,maxWidth:d,rotation:u}=_l(this,l,t,r);wt$1(i,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:u,textAlign:xl(r,t,n),textBaseline:"middle",translation:[c,h]});}draw(i){this._isVisible()&&(this.drawBackground(),this.drawGrid(i),this.drawBorder(),this.drawTitle(),this.drawLabels(i));}_layers(){let i=this.options,t=i.ticks&&i.ticks.z||0,s=P(i.grid&&i.grid.z,-1),n=P(i.border&&i.border.z,0);return !this._isVisible()||this.draw!==e.prototype.draw?[{z:t,draw:o=>{this.draw(o);}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle();}},{z:n,draw:()=>{this.drawBorder();}},{z:t,draw:o=>{this.drawLabels(o);}}]}getMatchingVisibleMetas(i){let t=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[],o,a;for(o=0,a=t.length;o<a;++o){let r=t[o];r[s]===this.id&&(!i||r.type===i)&&n.push(r);}return n}_resolveTickFontOptions(i){let t=this.options.ticks.setContext(this.getContext(i));return j(t.font)}_maxDigits(){let i=this._resolveTickFontOptions(0).lineHeight;return (this.isHorizontal()?this.width:this.height)/i}},te$1=class te{constructor(i,t,s){this.type=i,this.scope=t,this.override=s,this.items=Object.create(null);}isForType(i){return Object.prototype.isPrototypeOf.call(this.type.prototype,i.prototype)}register(i){let t=Object.getPrototypeOf(i),s;Ml(t)&&(s=this.register(t));let n=this.items,o=i.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+i);return o in n||(n[o]=i,yl(i,a,s),this.override&&B.override(i.id,i.overrides)),a}get(i){return this.items[i]}unregister(i){let t=this.items,s=i.id,n=this.scope;s in t&&delete t[s],n&&s in B[n]&&(delete B[n][s],this.override&&delete kt[s]);}};function yl(e,i,t){let s=Yt(Object.create(null),[t?B.get(t):{},B.get(i),e.defaults]);B.set(i,s),e.defaultRoutes&&vl(i,e.defaultRoutes),e.descriptors&&B.describe(i,e.descriptors);}function vl(e,i){Object.keys(i).forEach(t=>{let s=t.split("."),n=s.pop(),o=[e].concat(s).join("."),a=i[t].split("."),r=a.pop(),l=a.join(".");B.route(o,n,l,r);});}function Ml(e){return "id"in e&&"defaults"in e}var cs$1=class cs{constructor(){this.controllers=new te$1(At$1,"datasets",true),this.elements=new te$1(ot,"elements"),this.plugins=new te$1(Object,"plugins"),this.scales=new te$1(Vt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements];}add(...i){this._each("register",i);}remove(...i){this._each("unregister",i);}addControllers(...i){this._each("register",i,this.controllers);}addElements(...i){this._each("register",i,this.elements);}addPlugins(...i){this._each("register",i,this.plugins);}addScales(...i){this._each("register",i,this.scales);}getController(i){return this._get(i,this.controllers,"controller")}getElement(i){return this._get(i,this.elements,"element")}getPlugin(i){return this._get(i,this.plugins,"plugin")}getScale(i){return this._get(i,this.scales,"scale")}removeControllers(...i){this._each("unregister",i,this.controllers);}removeElements(...i){this._each("unregister",i,this.elements);}removePlugins(...i){this._each("unregister",i,this.plugins);}removeScales(...i){this._each("unregister",i,this.scales);}_each(i,t,s){[...t].forEach(n=>{let o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(i,o,n):R(n,a=>{let r=s||this._getRegistryForType(a);this._exec(i,r,a);});});}_exec(i,t,s){let n=ze(i);I(s["before"+n],[],s),t[i](s),I(s["after"+n],[],s);}_getRegistryForType(i){for(let t=0;t<this._typedRegistries.length;t++){let s=this._typedRegistries[t];if(s.isForType(i))return s}return this.plugins}_get(i,t,s){let n=t.get(i);if(n===void 0)throw new Error('"'+i+'" is not a registered '+s+".");return n}},dt=new cs$1,hs$1=class hs{constructor(){this._init=void 0;}notify(i,t,s,n){if(t==="beforeInit"&&(this._init=this._createDescriptors(i,true),this._notify(this._init,i,"install")),this._init===void 0)return;let o=n?this._descriptors(i).filter(n):this._descriptors(i),a=this._notify(o,i,t,s);return t==="afterDestroy"&&(this._notify(o,i,"stop"),this._notify(this._init,i,"uninstall"),this._init=void 0),a}_notify(i,t,s,n){n=n||{};for(let o of i){let a=o.plugin,r=a[s],l=[t,n,o.options];if(I(r,l,a)===false&&n.cancelable)return false}return true}invalidate(){A(this._cache)||(this._oldCache=this._cache,this._cache=void 0);}_descriptors(i){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(i);return this._notifyStateChanges(i),t}_createDescriptors(i,t){let s=i&&i.config,n=P(s.options&&s.options.plugins,{}),o=kl(s);return n===false&&!t?[]:wl(i,o,n,t)}_notifyStateChanges(i){let t=this._oldCache||[],s=this._cache,n=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(t,s),i,"stop"),this._notify(n(s,t),i,"start");}};function kl(e){let i={},t=[],s=Object.keys(dt.plugins.items);for(let o=0;o<s.length;o++)t.push(dt.getPlugin(s[o]));let n=e.plugins||[];for(let o=0;o<n.length;o++){let a=n[o];t.indexOf(a)===-1&&(t.push(a),i[a.id]=true);}return {plugins:t,localIds:i}}function Sl(e,i){return !i&&e===false?null:e===true?{}:e}function wl(e,{plugins:i,localIds:t},s,n){let o=[],a=e.getContext();for(let r of i){let l=r.id,c=Sl(s[l],n);c!==null&&o.push({plugin:r,options:Pl(e.config,{plugin:r,local:t[l]},c,a)});}return o}function Pl(e,{plugin:i,local:t},s,n){let o=e.pluginScopeKeys(i),a=e.getOptionScopes(s,o);return t&&i.defaults&&a.push(i.defaults),e.createResolver(a,n,[""],{scriptable:false,indexable:false,allKeys:true})}function ds$1(e,i){let t=B.datasets[e]||{};return ((i.datasets||{})[e]||{}).indexAxis||i.indexAxis||t.indexAxis||"x"}function Cl(e,i){let t=e;return e==="_index_"?t=i:e==="_value_"&&(t=i==="x"?"y":"x"),t}function Dl(e,i){return e===i?"_index_":"_value_"}function Bn(e){if(e==="x"||e==="y"||e==="r")return e}function Al(e){if(e==="top"||e==="bottom")return "x";if(e==="left"||e==="right")return "y"}function us$1(e,...i){if(Bn(e))return e;for(let t of i){let s=t.axis||Al(t.position)||e.length>1&&Bn(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Vn(e,i,t){if(t[i+"AxisID"]===e)return {axis:i}}function Ol(e,i){if(i.data&&i.data.datasets){let t=i.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(t.length)return Vn(e,"x",t[0])||Vn(e,"y",t[0])}return {}}function Tl(e,i){let t=kt[e.type]||{scales:{}},s=i.scales||{},n=ds$1(e.type,i),o=Object.create(null);return Object.keys(s).forEach(a=>{let r=s[a];if(!O(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let l=us$1(a,r,Ol(a,e),B.scales[r.type]),c=Dl(l,n),h=t.scales||{};o[a]=Ut(Object.create(null),[{axis:l},r,h[l],h[c]]);}),e.data.datasets.forEach(a=>{let r=a.type||e.type,l=a.indexAxis||ds$1(r,i),h=(kt[r]||{}).scales||{};Object.keys(h).forEach(d=>{let u=Cl(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),Ut(o[f],[{axis:u},s[f],h[d]]);});}),Object.keys(o).forEach(a=>{let r=o[a];Ut(r,[B.scales[r.type],B.scale]);}),o}function Co(e){let i=e.options||(e.options={});i.plugins=P(i.plugins,{}),i.scales=Tl(e,i);}function Do(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Ll(e){return e=e||{},e.data=Do(e.data),Co(e),e}var Wn=new Map,Ao=new Set;function Ge(e,i){let t=Wn.get(e);return t||(t=i(),Wn.set(e,t),Ao.add(t)),t}var be=(e,i,t)=>{let s=pt(i,t);s!==void 0&&e.add(s);},fs$1=class fs{constructor(i){this._config=Ll(i),this._scopeCache=new Map,this._resolverCache=new Map;}get platform(){return this._config.platform}get type(){return this._config.type}set type(i){this._config.type=i;}get data(){return this._config.data}set data(i){this._config.data=Do(i);}get options(){return this._config.options}set options(i){this._config.options=i;}get plugins(){return this._config.plugins}update(){let i=this._config;this.clearCache(),Co(i);}clearCache(){this._scopeCache.clear(),this._resolverCache.clear();}datasetScopeKeys(i){return Ge(i,()=>[[`datasets.${i}`,""]])}datasetAnimationScopeKeys(i,t){return Ge(`${i}.transition.${t}`,()=>[[`datasets.${i}.transitions.${t}`,`transitions.${t}`],[`datasets.${i}`,""]])}datasetElementScopeKeys(i,t){return Ge(`${i}-${t}`,()=>[[`datasets.${i}.elements.${t}`,`datasets.${i}`,`elements.${t}`,""]])}pluginScopeKeys(i){let t=i.id,s=this.type;return Ge(`${s}-plugin-${t}`,()=>[[`plugins.${t}`,...i.additionalOptionScopes||[]]])}_cachedScopes(i,t){let s=this._scopeCache,n=s.get(i);return (!n||t)&&(n=new Map,s.set(i,n)),n}getOptionScopes(i,t,s){let{options:n,type:o}=this,a=this._cachedScopes(i,s),r=a.get(t);if(r)return r;let l=new Set;t.forEach(h=>{i&&(l.add(i),h.forEach(d=>be(l,i,d))),h.forEach(d=>be(l,n,d)),h.forEach(d=>be(l,kt[o]||{},d)),h.forEach(d=>be(l,B,d)),h.forEach(d=>be(l,Ne,d));});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Ao.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:i,type:t}=this;return [i,kt[t]||{},B.datasets[t]||{},{type:t},B,Ne]}resolveNamedOptions(i,t,s,n=[""]){let o={$shared:true},{resolver:a,subPrefixes:r}=Nn(this._resolverCache,i,n),l=a;if(El(a,t)){o.$shared=false,s=ft$1(s)?s():s;let c=this.createResolver(i,s,r);l=Et$1(a,s,c);}for(let c of t)o[c]=l[c];return o}createResolver(i,t,s=[""],n){let{resolver:o}=Nn(this._resolverCache,i,s);return O(t)?Et$1(o,t,void 0,n):o}};function Nn(e,i,t){let s=e.get(i);s||(s=new Map,e.set(i,s));let n=t.join(),o=s.get(n);return o||(o={resolver:Ye$1(i,t),subPrefixes:t.filter(r=>!r.toLowerCase().includes("hover"))},s.set(n,o)),o}var Rl=e=>O(e)&&Object.getOwnPropertyNames(e).some(i=>ft$1(e[i]));function El(e,i){let{isScriptable:t,isIndexable:s}=Fi$1(e);for(let n of i){let o=t(n),a=s(n),r=(a||o)&&e[n];if(o&&(ft$1(r)||Rl(r))||a&&F(r))return true}return false}var Il="4.5.1",Fl=["top","bottom","left","right","chartArea"];function Hn(e,i){return e==="top"||e==="bottom"||Fl.indexOf(e)===-1&&i==="x"}function jn(e,i){return function(t,s){return t[e]===s[e]?t[i]-s[i]:t[e]-s[e]}}function Yn(e){let i=e.chart,t=i.options.animation;i.notifyPlugins("afterRender"),I(t&&t.onComplete,[e],i);}function zl(e){let i=e.chart,t=i.options.animation;I(t&&t.onProgress,[e],i);}function Oo(e){return $e$1()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var ei={},$n=e=>{let i=Oo(e);return Object.values(ei).filter(t=>t.canvas===i).pop()};function Bl(e,i,t){let s=Object.keys(e);for(let n of s){let o=+n;if(o>=i){let a=e[n];delete e[n],(t>0||o>i)&&(e[o+t]=a);}}}function Vl(e,i,t,s){return !t||e.type==="mouseout"?null:s?i:e}var Wl=(()=>{class e{static defaults=B;static instances=ei;static overrides=kt;static registry=dt;static version=Il;static getChart=$n;static register(...t){dt.add(...t),Un();}static unregister(...t){dt.remove(...t),Un();}constructor(t,s){let n=this.config=new fs$1(s),o=Oo(t),a=$n(o);if(a)throw new Error("Canvas is already in use. Chart with ID '"+a.id+"' must be destroyed before the canvas with ID '"+a.canvas.id+"' can be reused.");let r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||al(o)),this.platform.updateConfig(n);let l=this.platform.acquireContext(o,r.aspectRatio),c=l&&l.canvas,h=c&&c.height,d=c&&c.width;if(this.id=js(),this.ctx=l,this.canvas=c,this.width=d,this.height=h,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new hs$1,this.$proxies={},this._hiddenIndices={},this.attached=false,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=tn(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],ei[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}bt.listen(this,"complete",Yn),bt.listen(this,"progress",zl),this._initialize(),this.attached&&this.update();}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:s},width:n,height:o,_aspectRatio:a}=this;return A(t)?s&&a?a:o?n/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t;}get options(){return this._options}set options(t){this.config.options=t;}get registry(){return dt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Wi$1(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ri$1(this.canvas,this.ctx),this}stop(){return bt.stop(this),this}resize(t,s){bt.running(this)?this._resizeBeforeDraw={width:t,height:s}:this._resize(t,s);}_resize(t,s){let n=this.options,o=this.canvas,a=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(o,t,s,a),l=n.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Wi$1(this,l,true)&&(this.notifyPlugins("resize",{size:r}),I(n.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render());}ensureScalesHaveIDs(){let s=this.options.scales||{};R(s,(n,o)=>{n.id=o;});}buildOrUpdateScales(){let t=this.options,s=t.scales,n=this.scales,o=Object.keys(n).reduce((r,l)=>(r[l]=false,r),{}),a=[];s&&(a=a.concat(Object.keys(s).map(r=>{let l=s[r],c=us$1(r,l),h=c==="r",d=c==="x";return {options:l,dposition:h?"chartArea":d?"bottom":"left",dtype:h?"radialLinear":d?"category":"linear"}}))),R(a,r=>{let l=r.options,c=l.id,h=us$1(c,l),d=P(l.type,r.dtype);(l.position===void 0||Hn(l.position,h)!==Hn(r.dposition))&&(l.position=r.dposition),o[c]=true;let u=null;if(c in n&&n[c].type===d)u=n[c];else {let f=dt.getScale(d);u=new f({id:c,type:d,ctx:this.ctx,chart:this}),n[u.id]=u;}u.init(l,t);}),R(o,(r,l)=>{r||delete n[l];}),R(n,r=>{G.configure(this,r,r.options),G.addBox(this,r);});}_updateMetasets(){let t=this._metasets,s=this.data.datasets.length,n=t.length;if(t.sort((o,a)=>o.index-a.index),n>s){for(let o=s;o<n;++o)this._destroyDatasetMeta(o);t.splice(s,n-s);}this._sortedMetasets=t.slice(0).sort(jn("order","index"));}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:s}}=this;t.length>s.length&&delete this._stacks,t.forEach((n,o)=>{s.filter(a=>a===n._dataset).length===0&&this._destroyDatasetMeta(o);});}buildOrUpdateControllers(){let t=[],s=this.data.datasets,n,o;for(this._removeUnreferencedMetasets(),n=0,o=s.length;n<o;n++){let a=s[n],r=this.getDatasetMeta(n),l=a.type||this.config.type;if(r.type&&r.type!==l&&(this._destroyDatasetMeta(n),r=this.getDatasetMeta(n)),r.type=l,r.indexAxis=a.indexAxis||ds$1(l,this.options),r.order=a.order||0,r.index=n,r.label=""+a.label,r.visible=this.isDatasetVisible(n),r.controller)r.controller.updateIndex(n),r.controller.linkScales();else {let c=dt.getController(l),{datasetElementType:h,dataElementType:d}=B.datasets[l];Object.assign(c,{dataElementType:dt.getElement(d),datasetElementType:h&&dt.getElement(h)}),r.controller=new c(this,n),t.push(r.controller);}}return this._updateMetasets(),t}_resetElements(){R(this.data.datasets,(t,s)=>{this.getDatasetMeta(s).controller.reset();},this);}reset(){this._resetElements(),this.notifyPlugins("reset");}update(t){let s=this.config;s.update();let n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:true})===false)return;let a=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let h=0,d=this.data.datasets.length;h<d;h++){let{controller:u}=this.getDatasetMeta(h),f=!o&&a.indexOf(u)===-1;u.buildOrUpdateElements(f),r=Math.max(+u.getMaxOverflow(),r);}r=this._minPadding=n.layout.autoPadding?r:0,this._updateLayout(r),o||R(a,h=>{h.reset();}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(jn("z","_idx"));let{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,true):l.length&&this._updateHoverStyles(l,l,true),this.render();}_updateScales(){R(this.scales,t=>{G.removeBox(this,t);}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales();}_checkEventBindings(){let t=this.options,s=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!yi$1(s,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents());}_updateHiddenIndices(){let{_hiddenIndices:t}=this,s=this._getUniformDataChanges()||[];for(let{method:n,start:o,count:a}of s){let r=n==="_removeElements"?-a:a;Bl(t,o,r);}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let s=this.data.datasets.length,n=a=>new Set(t.filter(r=>r[0]===a).map((r,l)=>l+","+r.splice(1).join(","))),o=n(0);for(let a=1;a<s;a++)if(!yi$1(o,n(a)))return;return Array.from(o).map(a=>a.split(",")).map(a=>({method:a[1],start:+a[2],count:+a[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:true})===false)return;G.update(this,this.width,this.height,t);let s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],R(this.boxes,o=>{n&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()));},this),this._layers.forEach((o,a)=>{o._idx=a;}),this.notifyPlugins("afterLayout");}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:true})!==false){for(let s=0,n=this.data.datasets.length;s<n;++s)this.getDatasetMeta(s).controller.configure();for(let s=0,n=this.data.datasets.length;s<n;++s)this._updateDataset(s,ft$1(t)?t({datasetIndex:s}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t});}}_updateDataset(t,s){let n=this.getDatasetMeta(t),o={meta:n,index:t,mode:s,cancelable:true};this.notifyPlugins("beforeDatasetUpdate",o)!==false&&(n.controller._update(s),o.cancelable=false,this.notifyPlugins("afterDatasetUpdate",o));}render(){this.notifyPlugins("beforeRender",{cancelable:true})!==false&&(bt.has(this)?this.attached&&!bt.running(this)&&bt.start(this):(this.draw(),Yn({chart:this})));}draw(){let t;if(this._resizeBeforeDraw){let{width:n,height:o}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,o);}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:true})===false)return;let s=this._layers;for(t=0;t<s.length&&s[t].z<=0;++t)s[t].draw(this.chartArea);for(this._drawDatasets();t<s.length;++t)s[t].draw(this.chartArea);this.notifyPlugins("afterDraw");}_getSortedDatasetMetas(t){let s=this._sortedMetasets,n=[],o,a;for(o=0,a=s.length;o<a;++o){let r=s[o];(!t||r.visible)&&n.push(r);}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(true)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:true})===false)return;let t=this.getSortedVisibleDatasetMetas();for(let s=t.length-1;s>=0;--s)this._drawDataset(t[s]);this.notifyPlugins("afterDatasetsDraw");}_drawDataset(t){let s=this.ctx,n={meta:t,index:t.index,cancelable:true},o=Ui$1(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==false&&(o&&de(s,o),t.controller.draw(),o&&ue(s),n.cancelable=false,this.notifyPlugins("afterDatasetDraw",n));}isPointInArea(t){return rt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,s,n,o){let a=Nr$1.modes[s];return typeof a=="function"?a(this,t,n,o):[]}getDatasetMeta(t){let s=this.data.datasets[t],n=this._metasets,o=n.filter(a=>a&&a._dataset===s).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:t,_dataset:s,_parsed:[],_sorted:false},n.push(o)),o}getContext(){return this.$context||(this.$context=mt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let s=this.data.datasets[t];if(!s)return false;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!s.hidden}setDatasetVisibility(t,s){let n=this.getDatasetMeta(t);n.hidden=!s;}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t];}getDataVisibility(t){return !this._hiddenIndices[t]}_updateVisibility(t,s,n){let o=n?"show":"hide",a=this.getDatasetMeta(t),r=a.controller._resolveAnimations(void 0,o);Xt(s)?(a.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(a,{visible:n}),this.update(l=>l.datasetIndex===t?o:void 0));}hide(t,s){this._updateVisibility(t,s,false);}show(t,s){this._updateVisibility(t,s,true);}_destroyDatasetMeta(t){let s=this._metasets[t];s&&s.controller&&s.controller._destroy(),delete this._metasets[t];}_stop(){let t,s;for(this.stop(),bt.remove(this),t=0,s=this.data.datasets.length;t<s;++t)this._destroyDatasetMeta(t);}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:s}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ri$1(t,s),this.platform.releaseContext(s),this.canvas=null,this.ctx=null),delete ei[this.id],this.notifyPlugins("afterDestroy");}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=true;}bindUserEvents(){let t=this._listeners,s=this.platform,n=(a,r)=>{s.addEventListener(this,a,r),t[a]=r;},o=(a,r,l)=>{a.offsetX=r,a.offsetY=l,this._eventHandler(a);};R(this.options.events,a=>n(a,o));}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,s=this.platform,n=(c,h)=>{s.addEventListener(this,c,h),t[c]=h;},o=(c,h)=>{t[c]&&(s.removeEventListener(this,c,h),delete t[c]);},a=(c,h)=>{this.canvas&&this.resize(c,h);},r,l=()=>{o("attach",l),this.attached=true,this.resize(),n("resize",a),n("detach",r);};r=()=>{this.attached=false,o("resize",a),this._stop(),this._resize(0,0),n("attach",l);},s.isAttached(this.canvas)?l():r();}unbindEvents(){R(this._listeners,(t,s)=>{this.platform.removeEventListener(this,s,t);}),this._listeners={},R(this._responsiveListeners,(t,s)=>{this.platform.removeEventListener(this,s,t);}),this._responsiveListeners=void 0;}updateHoverStyle(t,s,n){let o=n?"set":"remove",a,r,l,c;for(s==="dataset"&&(a=this.getDatasetMeta(t[0].datasetIndex),a.controller["_"+o+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){r=t[l];let h=r&&this.getDatasetMeta(r.datasetIndex).controller;h&&h[o+"HoverStyle"](r.element,r.datasetIndex,r.index);}}getActiveElements(){return this._active||[]}setActiveElements(t){let s=this._active||[],n=t.map(({datasetIndex:a,index:r})=>{let l=this.getDatasetMeta(a);if(!l)throw new Error("No dataset found at index "+a);return {datasetIndex:a,element:l.data[r],index:r}});!ce(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s));}notifyPlugins(t,s,n){return this._plugins.notify(this,t,s,n)}isPluginEnabled(t){return this._plugins._cache.filter(s=>s.plugin.id===t).length===1}_updateHoverStyles(t,s,n){let o=this.options.hover,a=(c,h)=>c.filter(d=>!h.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),r=a(s,t),l=n?t:a(t,s);r.length&&this.updateHoverStyle(r,o.mode,false),l.length&&o.mode&&this.updateHoverStyle(l,o.mode,true);}_eventHandler(t,s){let n={event:t,replay:s,cancelable:true,inChartArea:this.isPointInArea(t)},o=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,o)===false)return;let a=this._handleEvent(t,s,n.inChartArea);return n.cancelable=false,this.notifyPlugins("afterEvent",n,o),(a||n.changed)&&this.render(),this}_handleEvent(t,s,n){let{_active:o=[],options:a}=this,r=s,l=this._getActiveElements(t,o,n,r),c=Us(t),h=Vl(t,this._lastEvent,n,c);n&&(this._lastEvent=null,I(a.onHover,[t,l,this],this),c&&I(a.onClick,[t,l,this],this));let d=!ce(l,o);return (d||s)&&(this._active=l,this._updateHoverStyles(l,o,s)),this._lastEvent=h,d}_getActiveElements(t,s,n,o){if(t.type==="mouseout")return [];if(!n)return s;let a=this.options.hover;return this.getElementsAtEventForMode(t,a.mode,a,o)}}return e})();function Un(){return R(Wl.instances,e=>e._plugins.invalidate())}function Nl(e,i,t){let{startAngle:s,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=i,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/a,U(s-t));if(e.beginPath(),e.arc(n,o,a-c/2,s+d/2,t-d/2),r>0){let u=Math.min(c/r,U(s-t));e.arc(n,o,r+c/2,t-u/2,s+u/2,true);}else {let u=Math.min(c/2,a*U(s-t));if(h==="round")e.arc(n,o,u,t-L/2,s+L/2,true);else if(h==="bevel"){let f=2*u*u,p=-f*Math.cos(t+L/2)+n,g=-f*Math.sin(t+L/2)+o,m=f*Math.cos(s+L/2)+n,b=f*Math.sin(s+L/2)+o;e.lineTo(p,g),e.lineTo(m,b);}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd");}function Hl(e,i,t){let{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=i,c=n/r;e.beginPath(),e.arc(o,a,r,s-c,t+c),l>n?(c=n/l,e.arc(o,a,l,t+c,s-c,true)):e.arc(o,a,n,t+N,s-N),e.closePath(),e.clip();}function jl(e){return je(e,["outerStart","outerEnd","innerStart","innerEnd"])}function Yl(e,i,t,s){let n=jl(e.options.borderRadius),o=(t-i)/2,a=Math.min(o,s*i/2),r=l=>{let c=(t-Math.min(o,l))*s/2;return Y(l,0,Math.min(o,c))};return {outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Y(n.innerStart,0,a),innerEnd:Y(n.innerEnd,0,a)}}function Qt$1(e,i,t,s){return {x:t+e*Math.cos(i),y:s+e*Math.sin(i)}}function oi(e,i,t,s,n,o){let{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=i,d=Math.max(i.outerRadius+s+t-c,0),u=h>0?h+s+t+c:0,f=0,p=n-l;if(s){let E=h>0?h-s:0,V=d>0?d-s:0,H=(E+V)/2,st=H!==0?p*H/(H+s):p;f=(p-st)/2;}let g=Math.max(.001,p*d-t/L)/d,m=(p-g)/2,b=l+m+f,x=n-m-f,{outerStart:y,outerEnd:M,innerStart:_,innerEnd:v}=Yl(i,u,d,x-b),S=d-y,k=d-M,w=b+y/S,D=x-M/k,C=u+_,T=u+v,$=b+_/C,tt=x-v/T;if(e.beginPath(),o){let E=(w+D)/2;if(e.arc(a,r,d,w,E),e.arc(a,r,d,E,D),M>0){let q=Qt$1(k,D,a,r);e.arc(q.x,q.y,M,D,x+N);}let V=Qt$1(T,x,a,r);if(e.lineTo(V.x,V.y),v>0){let q=Qt$1(T,tt,a,r);e.arc(q.x,q.y,v,x+N,tt+Math.PI);}let H=(x-v/u+(b+_/u))/2;if(e.arc(a,r,u,x-v/u,H,true),e.arc(a,r,u,H,b+_/u,true),_>0){let q=Qt$1(C,$,a,r);e.arc(q.x,q.y,_,$+Math.PI,b-N);}let st=Qt$1(S,b,a,r);if(e.lineTo(st.x,st.y),y>0){let q=Qt$1(S,w,a,r);e.arc(q.x,q.y,y,b-N,w);}}else {e.moveTo(a,r);let E=Math.cos(w)*d+a,V=Math.sin(w)*d+r;e.lineTo(E,V);let H=Math.cos(D)*d+a,st=Math.sin(D)*d+r;e.lineTo(H,st);}e.closePath();}function $l(e,i,t,s,n){let{fullCircles:o,startAngle:a,circumference:r}=i,l=i.endAngle;if(o){oi(e,i,t,s,l,n);for(let c=0;c<o;++c)e.fill();isNaN(r)||(l=a+(r%z||z));}return oi(e,i,t,s,l,n),e.fill(),l}function Ul(e,i,t,s,n){let{fullCircles:o,startAngle:a,circumference:r,options:l}=i,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=u,p?(e.lineWidth=c*2,e.lineJoin=h||"round"):(e.lineWidth=c,e.lineJoin=h||"bevel");let g=i.endAngle;if(o){oi(e,i,t,s,g,n);for(let m=0;m<o;++m)e.stroke();isNaN(r)||(g=a+(r%z||z));}p&&Hl(e,i,g),l.selfJoin&&g-a>=L&&f===0&&h!=="miter"&&Nl(e,i,g),o||(oi(e,i,t,s,g,n),e.stroke());}var gs$1=class gs extends ot{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:true,selfJoin:false};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:true,_indexable:i=>i!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(i){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,i&&Object.assign(this,i);}inRange(i,t,s){let n=this.getProps(["x","y"],s),{angle:o,distance:a}=Si$1(n,{x:i,y:t}),{startAngle:r,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),u=(this.options.spacing+this.options.borderWidth)/2,f=P(d,l-r),p=qt(o,r,l)&&r!==l,g=f>=z||p,m=ct(a,c+u,h+u);return g&&m}getCenterPoint(i){let{x:t,y:s,startAngle:n,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],i),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(a+r+c+l)/2;return {x:t+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(i){return this.getCenterPoint(i)}draw(i){let{options:t,circumference:s}=this,n=(t.offset||0)/4,o=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=s>z?Math.floor(s/z):0,s===0||this.innerRadius<0||this.outerRadius<0)return;i.save();let r=(this.startAngle+this.endAngle)/2;i.translate(Math.cos(r)*n,Math.sin(r)*n);let l=1-Math.sin(Math.min(L,s||0)),c=n*l;i.fillStyle=t.backgroundColor,i.strokeStyle=t.borderColor,$l(i,this,c,o,a),Ul(i,this,c,o,a),i.restore();}};function To(e,i,t=i){e.lineCap=P(t.borderCapStyle,i.borderCapStyle),e.setLineDash(P(t.borderDash,i.borderDash)),e.lineDashOffset=P(t.borderDashOffset,i.borderDashOffset),e.lineJoin=P(t.borderJoinStyle,i.borderJoinStyle),e.lineWidth=P(t.borderWidth,i.borderWidth),e.strokeStyle=P(t.borderColor,i.borderColor);}function Xl(e,i,t){e.lineTo(t.x,t.y);}function Kl(e){return e.stepped?on:e.tension||e.cubicInterpolationMode==="monotone"?an:Xl}function Lo(e,i,t={}){let s=e.length,{start:n=0,end:o=s-1}=t,{start:a,end:r}=i,l=Math.max(n,a),c=Math.min(o,r),h=n<a&&o<a||n>r&&o>r;return {count:s,start:l,loop:i.loop,ilen:c<l&&!h?s+c-l:c-l}}function ql(e,i,t,s){let{points:n,options:o}=i,{count:a,start:r,loop:l,ilen:c}=Lo(n,t,s),h=Kl(o),{move:d=true,reverse:u}=s||{},f,p,g;for(f=0;f<=c;++f)p=n[(r+(u?c-f:f))%a],!p.skip&&(d?(e.moveTo(p.x,p.y),d=false):h(e,g,p,u,o.stepped),g=p);return l&&(p=n[(r+(u?c:0))%a],h(e,g,p,u,o.stepped)),!!l}function Gl(e,i,t,s){let n=i.points,{count:o,start:a,ilen:r}=Lo(n,t,s),{move:l=true,reverse:c}=s||{},h=0,d=0,u,f,p,g,m,b,x=M=>(a+(c?r-M:M))%o,y=()=>{g!==m&&(e.lineTo(h,m),e.lineTo(h,g),e.lineTo(h,b));};for(l&&(f=n[x(0)],e.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=n[x(u)],f.skip)continue;let M=f.x,_=f.y,v=M|0;v===p?(_<g?g=_:_>m&&(m=_),h=(d*h+M)/++d):(y(),e.lineTo(M,_),p=v,d=0,g=m=_),b=_;}y();}function ps$1(e){let i=e.options,t=i.borderDash&&i.borderDash.length;return !e._decimated&&!e._loop&&!i.tension&&i.cubicInterpolationMode!=="monotone"&&!i.stepped&&!t?Gl:ql}function Jl(e){return e.stepped?pn$1:e.tension||e.cubicInterpolationMode==="monotone"?mn$1:vt}function Zl(e,i,t,s){let n=i._path;n||(n=i._path=new Path2D,i.path(n,t,s)&&n.closePath()),To(e,i.options),e.stroke(n);}function Ql(e,i,t,s){let{segments:n,options:o}=i,a=ps$1(i);for(let r of n)To(e,o,r.style),e.beginPath(),a(e,i,r,{start:t,end:t+s-1})&&e.closePath(),e.stroke();}var tc=typeof Path2D=="function";function ec(e,i,t,s){tc&&!i.options.segment?Zl(e,i,t,s):Ql(e,i,t,s);}var li$1=(()=>{class e extends ot{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:true,cubicInterpolationMode:"default",fill:false,spanGaps:false,stepped:false,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:true,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=true,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=false,this._pointsUpdated=false,this._datasetIndex=void 0,t&&Object.assign(this,t);}updateControlPoints(t,s){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let o=n.spanGaps?this._loop:this._fullLoop;un$1(this._points,n,t,o,s),this._pointsUpdated=true;}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=false;}get points(){return this._points}get segments(){return this._segments||(this._segments=xn$1(this,this.options.segment))}first(){let t=this.segments,s=this.points;return t.length&&s[t[0].start]}last(){let t=this.segments,s=this.points,n=t.length;return n&&s[t[n-1].end]}interpolate(t,s){let n=this.options,o=t[s],a=this.points,r=$i$1(this,{property:s,start:o,end:o});if(!r.length)return;let l=[],c=Jl(n),h,d;for(h=0,d=r.length;h<d;++h){let{start:u,end:f}=r[h],p=a[u],g=a[f];if(p===g){l.push(p);continue}let m=Math.abs((o-p[s])/(g[s]-p[s])),b=c(p,g,m,n.stepped);b[s]=t[s],l.push(b);}return l.length===1?l[0]:l}pathSegment(t,s,n){return ps$1(this)(t,this,s,n)}path(t,s,n){let o=this.segments,a=ps$1(this),r=this._loop;s=s||0,n=n||this.points.length-s;for(let l of o)r&=a(t,this,l,{start:s,end:s+n-1});return !!r}draw(t,s,n,o){let a=this.options||{};(this.points||[]).length&&a.borderWidth&&(t.save(),ec(t,this,n,o),t.restore()),this.animated&&(this._pointsUpdated=false,this._path=void 0);}}return e})();function Xn(e,i,t,s){let n=e.options,{[t]:o}=e.getProps([t],s);return Math.abs(i-o)<n.radius+n.hitRadius}var ic=(()=>{class e extends ot{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t);}inRange(t,s,n){let o=this.options,{x:a,y:r}=this.getProps(["x","y"],n);return Math.pow(t-a,2)+Math.pow(s-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(t,s){return Xn(this,t,"x",s)}inYRange(t,s){return Xn(this,t,"y",s)}getCenterPoint(t){let{x:s,y:n}=this.getProps(["x","y"],t);return {x:s,y:n}}size(t){t=t||this.options||{};let s=t.radius||0;s=Math.max(s,s&&t.hoverRadius||0);let n=s&&t.borderWidth||0;return (s+n)*2}draw(t,s){let n=this.options;this.skip||n.radius<.1||!rt(this,s,this.size(n)/2)||(t.strokeStyle=n.borderColor,t.lineWidth=n.borderWidth,t.fillStyle=n.backgroundColor,He$1(t,n,this.x,this.y));}getRange(){let t=this.options||{};return t.radius+t.hitRadius}}return e})();function Ro(e,i){let{x:t,y:s,base:n,width:o,height:a}=e.getProps(["x","y","base","width","height"],i),r,l,c,h,d;return e.horizontal?(d=a/2,r=Math.min(t,n),l=Math.max(t,n),c=s-d,h=s+d):(d=o/2,r=t-d,l=t+d,c=Math.min(s,n),h=Math.max(s,n)),{left:r,top:c,right:l,bottom:h}}function Dt(e,i,t,s){return e?0:Y(i,t,s)}function sc(e,i,t){let s=e.options.borderWidth,n=e.borderSkipped,o=Ii$1(s);return {t:Dt(n.top,o.top,0,t),r:Dt(n.right,o.right,0,i),b:Dt(n.bottom,o.bottom,0,t),l:Dt(n.left,o.left,0,i)}}function nc(e,i,t){let{enableBorderRadius:s}=e.getProps(["enableBorderRadius"]),n=e.options.borderRadius,o=Pt(n),a=Math.min(i,t),r=e.borderSkipped,l=s||O(n);return {topLeft:Dt(!l||r.top||r.left,o.topLeft,0,a),topRight:Dt(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Dt(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Dt(!l||r.bottom||r.right,o.bottomRight,0,a)}}function oc(e){let i=Ro(e),t=i.right-i.left,s=i.bottom-i.top,n=sc(e,t/2,s/2),o=nc(e,t/2,s/2);return {outer:{x:i.left,y:i.top,w:t,h:s,radius:o},inner:{x:i.left+n.l,y:i.top+n.t,w:t-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function ts$1(e,i,t,s){let n=i===null,o=t===null,r=e&&!(n&&o)&&Ro(e,s);return r&&(n||ct(i,r.left,r.right))&&(o||ct(t,r.top,r.bottom))}function ac(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function rc(e,i){e.rect(i.x,i.y,i.w,i.h);}function es$1(e,i,t={}){let s=e.x!==t.x?-i:0,n=e.y!==t.y?-i:0,o=(e.x+e.w!==t.x+t.w?i:0)-s,a=(e.y+e.h!==t.y+t.h?i:0)-n;return {x:e.x+s,y:e.y+n,w:e.w+o,h:e.h+a,radius:e.radius}}var ms$1=class ms extends ot{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(i){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,i&&Object.assign(this,i);}draw(i){let{inflateAmount:t,options:{borderColor:s,backgroundColor:n}}=this,{inner:o,outer:a}=oc(this),r=ac(a.radius)?Jt$1:rc;i.save(),(a.w!==o.w||a.h!==o.h)&&(i.beginPath(),r(i,es$1(a,t,o)),i.clip(),r(i,es$1(o,-t,a)),i.fillStyle=s,i.fill("evenodd")),i.beginPath(),r(i,es$1(o,t)),i.fillStyle=n,i.fill(),i.restore();}inRange(i,t,s){return ts$1(this,i,t,s)}inXRange(i,t){return ts$1(this,i,null,t)}inYRange(i,t){return ts$1(this,null,i,t)}getCenterPoint(i){let{x:t,y:s,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],i);return {x:o?(t+n)/2:t,y:o?s:(s+n)/2}}getRange(i){return i==="x"?this.width/2:this.height/2}},lc=Object.freeze({__proto__:null,ArcElement:gs$1,BarElement:ms$1,LineElement:li$1,PointElement:ic}),bs$1=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Kn=bs$1.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function Eo(e){return bs$1[e%bs$1.length]}function Io(e){return Kn[e%Kn.length]}function cc(e,i){return e.borderColor=Eo(i),e.backgroundColor=Io(i),++i}function hc(e,i){return e.backgroundColor=e.data.map(()=>Eo(i++)),i}function dc(e,i){return e.backgroundColor=e.data.map(()=>Io(i++)),i}function uc(e){let i=0;return (t,s)=>{let n=e.getDatasetMeta(s).controller;n instanceof ws$1?i=hc(t,i):n instanceof Mo?i=dc(t,i):n&&(i=cc(t,i));}}function qn(e){let i;for(i in e)if(e[i].borderColor||e[i].backgroundColor)return true;return false}function fc(e){return e&&(e.borderColor||e.backgroundColor)}function gc(){return B.borderColor!=="rgba(0,0,0,0.1)"||B.backgroundColor!=="rgba(0,0,0,0.1)"}var pc={id:"colors",defaults:{enabled:true,forceOverride:false},beforeLayout(e,i,t){if(!t.enabled)return;let{data:{datasets:s},options:n}=e.config,{elements:o}=n,a=qn(s)||fc(n)||o&&qn(o)||gc();if(!t.forceOverride&&a)return;let r=uc(e);s.forEach(r);}};function mc(e,i,t,s,n){let o=n.samples||s;if(o>=t)return e.slice(i,i+t);let a=[],r=(t-2)/(o-2),l=0,c=i+t-1,h=i,d,u,f,p,g;for(a[l++]=e[h],d=0;d<o-2;d++){let m=0,b=0,x,y=Math.floor((d+1)*r)+1+i,M=Math.min(Math.floor((d+2)*r)+1,t)+i,_=M-y;for(x=y;x<M;x++)m+=e[x].x,b+=e[x].y;m/=_,b/=_;let v=Math.floor(d*r)+1+i,S=Math.min(Math.floor((d+1)*r)+1,t)+i,{x:k,y:w}=e[h];for(f=p=-1,x=v;x<S;x++)p=.5*Math.abs((k-m)*(e[x].y-w)-(k-e[x].x)*(b-w)),p>f&&(f=p,u=e[x],g=x);a[l++]=u,h=g;}return a[l++]=e[c],a}function bc(e,i,t,s){let n=0,o=0,a,r,l,c,h,d,u,f,p,g,m=[],b=i+t-1,x=e[i].x,M=e[b].x-x;for(a=i;a<i+t;++a){r=e[a],l=(r.x-x)/M*s,c=r.y;let _=l|0;if(_===h)c<p?(p=c,d=a):c>g&&(g=c,u=a),n=(o*n+r.x)/++o;else {let v=a-1;if(!A(d)&&!A(u)){let S=Math.min(d,u),k=Math.max(d,u);S!==f&&S!==v&&m.push(z$5(G$b({},e[S]),{x:n})),k!==f&&k!==v&&m.push(z$5(G$b({},e[k]),{x:n}));}a>0&&v!==f&&m.push(e[v]),m.push(r),h=_,o=0,p=g=c,d=u=f=a;}}return m}function Fo(e){if(e._decimated){let i=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:true,enumerable:true,writable:true,value:i});}}function Gn(e){e.data.datasets.forEach(i=>{Fo(i);});}function xc(e,i){let t=i.length,s=0,n,{iScale:o}=e,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(s=Y(at(i,o.axis,a).lo,0,t-1)),c?n=Y(at(i,o.axis,r).hi+1,s,t)-s:n=t-s,{start:s,count:n}}var _c={id:"decimation",defaults:{algorithm:"min-max",enabled:false},beforeElementsUpdate:(e,i,t)=>{if(!t.enabled){Gn(e);return}let s=e.width;e.data.datasets.forEach((n,o)=>{let{_data:a,indexAxis:r}=n,l=e.getDatasetMeta(o),c=a||n.data;if(Zt$1([r,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let h=e.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||e.options.parsing)return;let{start:d,count:u}=xc(l,c),f=t.threshold||4*s;if(u<=f){Fo(n);return}A(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:true,enumerable:true,get:function(){return this._decimated},set:function(g){this._data=g;}}));let p;switch(t.algorithm){case "lttb":p=mc(c,d,u,s,t);break;case "min-max":p=bc(c,d,u,s);break;default:throw new Error(`Unsupported decimation algorithm '${t.algorithm}'`)}n._decimated=p;});},destroy(e){Gn(e);}};function yc(e,i,t){let s=e.segments,n=e.points,o=i.points,a=[];for(let r of s){let{start:l,end:c}=r;c=ci$1(l,c,n);let h=xs$1(t,n[l],n[c],r.loop);if(!i.segments){a.push({source:r,target:h,start:n[l],end:n[c]});continue}let d=$i$1(i,h);for(let u of d){let f=xs$1(t,o[u.start],o[u.end],u.loop),p=Yi$1(r,n,f);for(let g of p)a.push({source:g,target:u,start:{[t]:Jn(h,f,"start",Math.max)},end:{[t]:Jn(h,f,"end",Math.min)}});}}return a}function xs$1(e,i,t,s){if(s)return;let n=i[e],o=t[e];return e==="angle"&&(n=U(n),o=U(o)),{property:e,start:n,end:o}}function vc(e,i){let{x:t=null,y:s=null}=e||{},n=i.points,o=[];return i.segments.forEach(({start:a,end:r})=>{r=ci$1(a,r,n);let l=n[a],c=n[r];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:c.y}));}),o}function ci$1(e,i,t){for(;i>e;i--){let s=t[i];if(!isNaN(s.x)&&!isNaN(s.y))break}return i}function Jn(e,i,t,s){return e&&i?s(e[t],i[t]):e?e[t]:i?i[t]:0}function zo(e,i){let t=[],s=false;return F(e)?(s=true,t=e):t=vc(e,i),t.length?new li$1({points:t,options:{tension:0},_loop:s,_fullLoop:s}):null}function Zn(e){return e&&e.fill!==false}function Mc(e,i,t){let n=e[i].fill,o=[i],a;if(!t)return n;for(;n!==false&&o.indexOf(n)===-1;){if(!W(n))return n;if(a=e[n],!a)return false;if(a.visible)return n;o.push(n),n=a.fill;}return false}function kc(e,i,t){let s=Cc(e);if(O(s))return isNaN(s.value)?false:s;let n=parseFloat(s);return W(n)&&Math.floor(n)===n?Sc(s[0],i,n,t):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Sc(e,i,t,s){return (e==="-"||e==="+")&&(t=i+t),t===i||t<0||t>=s?false:t}function wc(e,i){let t=null;return e==="start"?t=i.bottom:e==="end"?t=i.top:O(e)?t=i.getPixelForValue(e.value):i.getBasePixel&&(t=i.getBasePixel()),t}function Pc(e,i,t){let s;return e==="start"?s=t:e==="end"?s=i.options.reverse?i.min:i.max:O(e)?s=e.value:s=i.getBaseValue(),s}function Cc(e){let i=e.options,t=i.fill,s=P(t&&t.target,t);return s===void 0&&(s=!!i.backgroundColor),s===false||s===null?false:s===true?"origin":s}function Dc(e){let{scale:i,index:t,line:s}=e,n=[],o=s.segments,a=s.points,r=Ac(i,t);r.push(zo({x:null,y:i.bottom},s));for(let l=0;l<o.length;l++){let c=o[l];for(let h=c.start;h<=c.end;h++)Oc(n,a[h],r);}return new li$1({points:n,options:{}})}function Ac(e,i){let t=[],s=e.getMatchingVisibleMetas("line");for(let n=0;n<s.length;n++){let o=s[n];if(o.index===i)break;o.hidden||t.unshift(o.dataset);}return t}function Oc(e,i,t){let s=[];for(let n=0;n<t.length;n++){let o=t[n],{first:a,last:r,point:l}=Tc(o,i,"x");if(!(!l||a&&r)){if(a)s.unshift(l);else if(e.push(l),!r)break}}e.push(...s);}function Tc(e,i,t){let s=e.interpolate(i,t);if(!s)return {};let n=s[t],o=e.segments,a=e.points,r=false,l=false;for(let c=0;c<o.length;c++){let h=o[c],d=a[h.start][t],u=a[h.end][t];if(ct(n,d,u)){r=n===d,l=n===u;break}}return {first:r,last:l,point:s}}var ai=class{constructor(i){this.x=i.x,this.y=i.y,this.radius=i.radius;}pathSegment(i,t,s){let{x:n,y:o,radius:a}=this;return t=t||{start:0,end:z},i.arc(n,o,a,t.end,t.start,true),!s.bounds}interpolate(i){let{x:t,y:s,radius:n}=this,o=i.angle;return {x:t+Math.cos(o)*n,y:s+Math.sin(o)*n,angle:o}}};function Lc(e){let{chart:i,fill:t,line:s}=e;if(W(t))return Rc(i,t);if(t==="stack")return Dc(e);if(t==="shape")return true;let n=Ec(e);return n instanceof ai?n:zo(n,s)}function Rc(e,i){let t=e.getDatasetMeta(i);return t&&e.isDatasetVisible(i)?t.dataset:null}function Ec(e){return (e.scale||{}).getPointPositionForValue?Fc(e):Ic(e)}function Ic(e){let{scale:i={},fill:t}=e,s=wc(t,i);if(W(s)){let n=i.isHorizontal();return {x:n?s:null,y:n?null:s}}return null}function Fc(e){let{scale:i,fill:t}=e,s=i.options,n=i.getLabels().length,o=s.reverse?i.max:i.min,a=Pc(t,i,o),r=[];if(s.grid.circular){let l=i.getPointPositionForValue(0,o);return new ai({x:l.x,y:l.y,radius:i.getDistanceFromCenterForValue(a)})}for(let l=0;l<n;++l)r.push(i.getPointPositionForValue(l,a));return r}function is$1(e,i,t){let s=Lc(i),{chart:n,index:o,line:a,scale:r,axis:l}=i,c=a.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:f=d}=h||{},p=n.getDatasetMeta(o),g=Ui$1(n,p);s&&a.points.length&&(de(e,t),zc(e,{line:a,target:s,above:u,below:f,area:t,scale:r,axis:l,clip:g}),ue(e));}function zc(e,i){let{line:t,target:s,above:n,below:o,area:a,scale:r,clip:l}=i,c=t._loop?"angle":i.axis;e.save();let h=o;o!==n&&(c==="x"?(Qn(e,s,a.top),ss$1(e,{line:t,target:s,color:n,scale:r,property:c,clip:l}),e.restore(),e.save(),Qn(e,s,a.bottom)):c==="y"&&(to(e,s,a.left),ss$1(e,{line:t,target:s,color:o,scale:r,property:c,clip:l}),e.restore(),e.save(),to(e,s,a.right),h=n)),ss$1(e,{line:t,target:s,color:h,scale:r,property:c,clip:l}),e.restore();}function Qn(e,i,t){let{segments:s,points:n}=i,o=true,a=false;e.beginPath();for(let r of s){let{start:l,end:c}=r,h=n[l],d=n[ci$1(l,c,n)];o?(e.moveTo(h.x,h.y),o=false):(e.lineTo(h.x,t),e.lineTo(h.x,h.y)),a=!!i.pathSegment(e,r,{move:a}),a?e.closePath():e.lineTo(d.x,t);}e.lineTo(i.first().x,t),e.closePath(),e.clip();}function to(e,i,t){let{segments:s,points:n}=i,o=true,a=false;e.beginPath();for(let r of s){let{start:l,end:c}=r,h=n[l],d=n[ci$1(l,c,n)];o?(e.moveTo(h.x,h.y),o=false):(e.lineTo(t,h.y),e.lineTo(h.x,h.y)),a=!!i.pathSegment(e,r,{move:a}),a?e.closePath():e.lineTo(t,d.y);}e.lineTo(t,i.first().y),e.closePath(),e.clip();}function ss$1(e,i){let{line:t,target:s,property:n,color:o,scale:a,clip:r}=i,l=yc(t,s,n);for(let{source:c,target:h,start:d,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,p=s!==true;e.save(),e.fillStyle=f,Bc(e,a,r,p&&xs$1(n,d,u)),e.beginPath();let g=!!t.pathSegment(e,c),m;if(p){g?e.closePath():eo(e,s,u,n);let b=!!s.pathSegment(e,h,{move:g,reverse:true});m=g&&b,m||eo(e,s,d,n);}e.closePath(),e.fill(m?"evenodd":"nonzero"),e.restore();}}function Bc(e,i,t,s){let n=i.chart.chartArea,{property:o,start:a,end:r}=s||{};if(o==="x"||o==="y"){let l,c,h,d;o==="x"?(l=a,c=n.top,h=r,d=n.bottom):(l=n.left,c=a,h=n.right,d=r),e.beginPath(),t&&(l=Math.max(l,t.left),h=Math.min(h,t.right),c=Math.max(c,t.top),d=Math.min(d,t.bottom)),e.rect(l,c,h-l,d-c),e.clip();}}function eo(e,i,t,s){let n=i.interpolate(t,s);n&&e.lineTo(n.x,n.y);}var Vc={id:"filler",afterDatasetsUpdate(e,i,t){let s=(e.data.datasets||[]).length,n=[],o,a,r,l;for(a=0;a<s;++a)o=e.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof li$1&&(l={visible:e.isDatasetVisible(a),index:a,fill:kc(r,a,s),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],!(!l||l.fill===false)&&(l.fill=Mc(n,a,t.propagate));},beforeDraw(e,i,t){let s=t.drawTime==="beforeDraw",n=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let a=n.length-1;a>=0;--a){let r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),s&&r.fill&&is$1(e.ctx,r,o));}},beforeDatasetsDraw(e,i,t){if(t.drawTime!=="beforeDatasetsDraw")return;let s=e.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){let o=s[n].$filler;Zn(o)&&is$1(e.ctx,o,e.chartArea);}},beforeDatasetDraw(e,i,t){let s=i.meta.$filler;!Zn(s)||t.drawTime!=="beforeDatasetDraw"||is$1(e.ctx,s,e.chartArea);},defaults:{propagate:true,drawTime:"beforeDatasetDraw"}},io=(e,i)=>{let{boxHeight:t=i,boxWidth:s=i}=e;return e.usePointStyle&&(t=Math.min(t,i),s=e.pointStyleWidth||Math.min(s,i)),{boxWidth:s,boxHeight:t,itemHeight:Math.max(i,t)}},Wc=(e,i)=>e!==null&&i!==null&&e.datasetIndex===i.datasetIndex&&e.index===i.index,ri=class extends ot{constructor(i){super(),this._added=false,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=false,this.chart=i.chart,this.options=i.options,this.ctx=i.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0;}update(i,t,s){this.maxWidth=i,this.maxHeight=t,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit();}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height);}buildLabels(){let i=this.options.labels||{},t=I(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(s=>i.filter(s,this.chart.data))),i.sort&&(t=t.sort((s,n)=>i.sort(s,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t;}fit(){let{options:i,ctx:t}=this;if(!i.display){this.width=this.height=0;return}let s=i.labels,n=j(s.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=io(s,o),c,h;t.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,i.maxWidth||this.maxWidth),this.height=Math.min(h,i.maxHeight||this.maxHeight);}_fitRows(i,t,s,n){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r,d=i;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((p,g)=>{let m=s+t/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,f+=h,u++),l[g]={left:0,top:f,row:u,width:m,height:n},c[c.length-1]+=m+r;}),d}_fitCols(i,t,s,n){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-i,d=r,u=0,f=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{let{itemWidth:x,itemHeight:y}=Nc(s,t,o,m,n);b>0&&f+y+2*r>h&&(d+=u+r,c.push({width:u,height:f}),p+=u+r,g++,u=f=0),l[b]={left:p,top:f,col:g,width:x,height:y},u=Math.max(u,x),f+=y+r;}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let i=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:s,labels:{padding:n},rtl:o}}=this,a=Ft(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=X(s,this.left+n,this.right-this.lineWidths[r]);for(let c of t)r!==c.row&&(r=c.row,l=X(s,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+i+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n;}else {let r=0,l=X(s,this.top+i+n,this.bottom-this.columnSizes[r].height);for(let c of t)c.col!==r&&(r=c.col,l=X(s,this.top+i+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n;}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let i=this.ctx;de(i,this),this._draw(),ue(i);}}_draw(){let{options:i,columnSizes:t,lineWidths:s,ctx:n}=this,{align:o,labels:a}=i,r=B.color,l=Ft(i.rtl,this.left,this.width),c=j(a.font),{padding:h}=a,d=c.size,u=d/2,f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;let{boxWidth:p,boxHeight:g,itemHeight:m}=io(a,d),b=function(v,S,k){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;n.save();let w=P(k.lineWidth,1);if(n.fillStyle=P(k.fillStyle,r),n.lineCap=P(k.lineCap,"butt"),n.lineDashOffset=P(k.lineDashOffset,0),n.lineJoin=P(k.lineJoin,"miter"),n.lineWidth=w,n.strokeStyle=P(k.strokeStyle,r),n.setLineDash(P(k.lineDash,[])),a.usePointStyle){let D={radius:g*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:w},C=l.xPlus(v,p/2),T=S+u;Ei$1(n,D,C,T,a.pointStyleWidth&&p);}else {let D=S+Math.max((d-g)/2,0),C=l.leftForLtr(v,p),T=Pt(k.borderRadius);n.beginPath(),Object.values(T).some($=>$!==0)?Jt$1(n,{x:C,y:D,w:p,h:g,radius:T}):n.rect(C,D,p,g),n.fill(),w!==0&&n.stroke();}n.restore();},x=function(v,S,k){wt$1(n,k.text,v,S+m/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)});},y=this.isHorizontal(),M=this._computeTitleHeight();y?f={x:X(o,this.left+h,this.right-s[0]),y:this.top+h+M,line:0}:f={x:this.left+h,y:X(o,this.top+M+h,this.bottom-t[0].height),line:0},Hi$1(this.ctx,i.textDirection);let _=m+h;this.legendItems.forEach((v,S)=>{n.strokeStyle=v.fontColor,n.fillStyle=v.fontColor;let k=n.measureText(v.text).width,w=l.textAlign(v.textAlign||(v.textAlign=a.textAlign)),D=p+u+k,C=f.x,T=f.y;l.setWidth(this.width),y?S>0&&C+D+h>this.right&&(T=f.y+=_,f.line++,C=f.x=X(o,this.left+h,this.right-s[f.line])):S>0&&T+_>this.bottom&&(C=f.x=C+t[f.line].width+h,f.line++,T=f.y=X(o,this.top+M+h,this.bottom-t[f.line].height));let $=l.x(C);if(b($,T,v),C=en(w,C+p+u,y?C+D:this.right,i.rtl),x(l.x(C),T,v),y)f.x+=D+h;else if(typeof v.text!="string"){let tt=c.lineHeight;f.y+=Bo(v,tt)+h;}else f.y+=_;}),ji$1(this.ctx,i.textDirection);}drawTitle(){let i=this.options,t=i.title,s=j(t.font),n=K(t.padding);if(!t.display)return;let o=Ft(i.rtl,this.left,this.width),a=this.ctx,r=t.position,l=s.size/2,c=n.top+l,h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=X(i.align,d,this.right-u);else {let p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=c+X(i.align,this.top,this.bottom-p-i.labels.padding-this._computeTitleHeight());}let f=X(r,d,d+u);a.textAlign=o.textAlign(We$1(r)),a.textBaseline="middle",a.strokeStyle=t.color,a.fillStyle=t.color,a.font=s.string,wt$1(a,t.text,f,h,s);}_computeTitleHeight(){let i=this.options.title,t=j(i.font),s=K(i.padding);return i.display?t.lineHeight+s.height:0}_getLegendItemAt(i,t){let s,n,o;if(ct(i,this.left,this.right)&&ct(t,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],ct(i,n.left,n.left+n.width)&&ct(t,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(i){let t=this.options;if(!Yc(i.type,t))return;let s=this._getLegendItemAt(i.x,i.y);if(i.type==="mousemove"||i.type==="mouseout"){let n=this._hoveredItem,o=Wc(n,s);n&&!o&&I(t.onLeave,[i,n,this],this),this._hoveredItem=s,s&&!o&&I(t.onHover,[i,s,this],this);}else s&&I(t.onClick,[i,s,this],this);}};function Nc(e,i,t,s,n){let o=Hc(s,e,i,t),a=jc(n,s,i.lineHeight);return {itemWidth:o,itemHeight:a}}function Hc(e,i,t,s){let n=e.text;return n&&typeof n!="string"&&(n=n.reduce((o,a)=>o.length>a.length?o:a)),i+t.size/2+s.measureText(n).width}function jc(e,i,t){let s=e;return typeof i.text!="string"&&(s=Bo(i,t)),s}function Bo(e,i){let t=e.text?e.text.length:0;return i*t}function Yc(e,i){return !!((e==="mousemove"||e==="mouseout")&&(i.onHover||i.onLeave)||i.onClick&&(e==="click"||e==="mouseup"))}var $c={id:"legend",_element:ri,start(e,i,t){let s=e.legend=new ri({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s);},stop(e){G.removeBox(e,e.legend),delete e.legend;},beforeUpdate(e,i,t){let s=e.legend;G.configure(e,s,t),s.options=t;},afterUpdate(e){let i=e.legend;i.buildLabels(),i.adjustHitBoxes();},afterEvent(e,i){i.replay||e.legend.handleEvent(i.event);},defaults:{display:true,position:"top",align:"center",fullSize:true,reverse:false,weight:1e3,onClick(e,i,t){let s=i.datasetIndex,n=t.chart;n.isDatasetVisible(s)?(n.hide(s),i.hidden=true):(n.show(s),i.hidden=false);},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let i=e.data.datasets,{labels:{usePointStyle:t,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(t?0:void 0),h=K(c.borderWidth);return {text:i[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:false,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}},ve=class extends ot{constructor(i){super(),this.chart=i.chart,this.options=i.options,this.ctx=i.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0;}update(i,t){let s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=i,this.height=this.bottom=t;let n=F(s.text)?s.text.length:1;this._padding=K(s.padding);let o=n*j(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o;}isHorizontal(){let i=this.options.position;return i==="top"||i==="bottom"}_drawArgs(i){let{top:t,left:s,bottom:n,right:o,options:a}=this,r=a.align,l=0,c,h,d;return this.isHorizontal()?(h=X(r,s,o),d=t+i,c=o-s):(a.position==="left"?(h=s+i,d=X(r,n,t),l=L*-0.5):(h=o-i,d=X(r,t,n),l=L*.5),c=n-t),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){let i=this.ctx,t=this.options;if(!t.display)return;let s=j(t.font),o=s.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);wt$1(i,t.text,0,0,s,{color:t.color,maxWidth:l,rotation:c,textAlign:We$1(t.align),textBaseline:"middle",translation:[a,r]});}};function Uc(e,i){let t=new ve({ctx:e.ctx,options:i,chart:e});G.configure(e,t,i),G.addBox(e,t),e.titleBlock=t;}var Xc={id:"title",_element:ve,start(e,i,t){Uc(e,t);},stop(e){let i=e.titleBlock;G.removeBox(e,i),delete e.titleBlock;},beforeUpdate(e,i,t){let s=e.titleBlock;G.configure(e,s,t),s.options=t;},defaults:{align:"center",display:false,font:{weight:"bold"},fullSize:true,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:true,_indexable:false}},Je=new WeakMap,Kc={id:"subtitle",start(e,i,t){let s=new ve({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s),Je.set(e,s);},stop(e){G.removeBox(e,Je.get(e)),Je.delete(e);},beforeUpdate(e,i,t){let s=Je.get(e);G.configure(e,s,t),s.options=t;},defaults:{align:"center",display:false,font:{weight:"normal"},fullSize:true,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:true,_indexable:false}},_e={average(e){if(!e.length)return false;let i,t,s=new Set,n=0,o=0;for(i=0,t=e.length;i<t;++i){let r=e[i].element;if(r&&r.hasValue()){let l=r.tooltipPosition();s.add(l.x),n+=l.y,++o;}}return o===0||s.size===0?false:{x:[...s].reduce((r,l)=>r+l)/s.size,y:n/o}},nearest(e,i){if(!e.length)return false;let t=i.x,s=i.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=e.length;o<a;++o){let l=e[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),h=Ie(i,c);h<n&&(n=h,r=l);}}if(r){let l=r.tooltipPosition();t=l.x,s=l.y;}return {x:t,y:s}}};function ht(e,i){return i&&(F(i)?Array.prototype.push.apply(e,i):e.push(i)),e}function xt$1(e){return (typeof e=="string"||e instanceof String)&&e.indexOf(`
7108
7108
  `)>-1?e.split(`
7109
- `):e}function qc(e,i){let{element:t,datasetIndex:s,index:n}=i,o=e.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return {chart:e,label:a,parsed:o.getParsed(n),raw:e.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:t}}function so(e,i){let t=e.chart.ctx,{body:s,footer:n,title:o}=e,{boxWidth:a,boxHeight:r}=i,l=j(i.bodyFont),c=j(i.titleFont),h=j(i.footerFont),d=o.length,u=n.length,f=s.length,p=K(i.padding),g=p.height,m=0,b=s.reduce((M,_)=>M+_.before.length+_.lines.length+_.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*i.titleSpacing+i.titleMarginBottom),b){let M=i.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=f*M+(b-f)*l.lineHeight+(b-1)*i.bodySpacing;}u&&(g+=i.footerMarginTop+u*h.lineHeight+(u-1)*i.footerSpacing);let x=0,y=function(M){m=Math.max(m,t.measureText(M).width+x);};return t.save(),t.font=c.string,R(e.title,y),t.font=l.string,R(e.beforeBody.concat(e.afterBody),y),x=i.displayColors?a+2+i.boxPadding:0,R(s,M=>{R(M.before,y),R(M.lines,y),R(M.after,y);}),x=0,t.font=h.string,R(e.footer,y),t.restore(),m+=p.width,{width:m,height:g}}function Gc(e,i){let{y:t,height:s}=i;return t<s/2?"top":t>e.height-s/2?"bottom":"center"}function Jc(e,i,t,s){let{x:n,width:o}=s,a=t.caretSize+t.caretPadding;if(e==="left"&&n+o+a>i.width||e==="right"&&n-o-a<0)return true}function Zc(e,i,t,s){let{x:n,width:o}=t,{width:a,chartArea:{left:r,right:l}}=e,c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Jc(c,e,i,t)&&(c="center"),c}function no(e,i,t){let s=t.yAlign||i.yAlign||Gc(e,t);return {xAlign:t.xAlign||i.xAlign||Zc(e,i,t,s),yAlign:s}}function Qc(e,i){let{x:t,width:s}=e;return i==="right"?t-=s:i==="center"&&(t-=s/2),t}function th(e,i,t){let{y:s,height:n}=e;return i==="top"?s+=t:i==="bottom"?s-=n+t:s-=n/2,s}function oo(e,i,t,s){let{caretSize:n,caretPadding:o,cornerRadius:a}=e,{xAlign:r,yAlign:l}=t,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Pt(a),p=Qc(i,r),g=th(i,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(h,u)+n:r==="right"&&(p+=Math.max(d,f)+n),{x:Y(p,0,s.width-i.width),y:Y(g,0,s.height-i.height)}}function Ze(e,i,t){let s=K(t.padding);return i==="center"?e.x+e.width/2:i==="right"?e.x+e.width-s.right:e.x+s.left}function ao(e){return ht([],xt$1(e))}function eh(e,i,t){return mt(e,{tooltip:i,tooltipItems:t,type:"tooltip"})}function ro(e,i){let t=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return t?e.override(t):e}var Vo={beforeTitle:lt,title(e){if(e.length>0){let i=e[0],t=i.chart.data.labels,s=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return i.dataset.label||"";if(i.label)return i.label;if(s>0&&i.dataIndex<s)return t[i.dataIndex]}return ""},afterTitle:lt,beforeBody:lt,beforeLabel:lt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let i=e.dataset.label||"";i&&(i+=": ");let t=e.formattedValue;return A(t)||(i+=t),i},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return {borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return {pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:lt,afterBody:lt,beforeFooter:lt,footer:lt,afterFooter:lt};function Z(e,i,t,s){let n=e[i].call(t,s);return typeof n>"u"?Vo[i].call(t,s):n}var lo=(()=>{class e extends ot{static positioners=_e;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0;}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0;}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let s=this.chart,n=this.options.setContext(this.getContext()),o=n.enabled&&s.options.animation&&n.animations,a=new ii$1(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){return this.$context||(this.$context=eh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,s){let{callbacks:n}=s,o=Z(n,"beforeTitle",this,t),a=Z(n,"title",this,t),r=Z(n,"afterTitle",this,t),l=[];return l=ht(l,xt$1(o)),l=ht(l,xt$1(a)),l=ht(l,xt$1(r)),l}getBeforeBody(t,s){return ao(Z(s.callbacks,"beforeBody",this,t))}getBody(t,s){let{callbacks:n}=s,o=[];return R(t,a=>{let r={before:[],lines:[],after:[]},l=ro(n,a);ht(r.before,xt$1(Z(l,"beforeLabel",this,a))),ht(r.lines,Z(l,"label",this,a)),ht(r.after,xt$1(Z(l,"afterLabel",this,a))),o.push(r);}),o}getAfterBody(t,s){return ao(Z(s.callbacks,"afterBody",this,t))}getFooter(t,s){let{callbacks:n}=s,o=Z(n,"beforeFooter",this,t),a=Z(n,"footer",this,t),r=Z(n,"afterFooter",this,t),l=[];return l=ht(l,xt$1(o)),l=ht(l,xt$1(a)),l=ht(l,xt$1(r)),l}_createItems(t){let s=this._active,n=this.chart.data,o=[],a=[],r=[],l=[],c,h;for(c=0,h=s.length;c<h;++c)l.push(qc(this.chart,s[c]));return t.filter&&(l=l.filter((d,u,f)=>t.filter(d,u,f,n))),t.itemSort&&(l=l.sort((d,u)=>t.itemSort(d,u,n))),R(l,d=>{let u=ro(t.callbacks,d);o.push(Z(u,"labelColor",this,d)),a.push(Z(u,"labelPointStyle",this,d)),r.push(Z(u,"labelTextColor",this,d));}),this.labelColors=o,this.labelPointStyles=a,this.labelTextColors=r,this.dataPoints=l,l}update(t,s){let n=this.options.setContext(this.getContext()),o=this._active,a,r=[];if(!o.length)this.opacity!==0&&(a={opacity:0});else {let l=_e[n.position].call(this,o,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);let c=this._size=so(this,n),h=Object.assign({},l,c),d=no(this.chart,n,h),u=oo(n,h,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,a={opacity:1,x:u.x,y:u.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y};}this._tooltipItems=r,this.$context=void 0,a&&this._resolveAnimations().update(this,a),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s});}drawCaret(t,s,n,o){let a=this.getCaretPosition(t,n,o);s.lineTo(a.x1,a.y1),s.lineTo(a.x2,a.y2),s.lineTo(a.x3,a.y3);}getCaretPosition(t,s,n){let{xAlign:o,yAlign:a}=this,{caretSize:r,cornerRadius:l}=n,{topLeft:c,topRight:h,bottomLeft:d,bottomRight:u}=Pt(l),{x:f,y:p}=t,{width:g,height:m}=s,b,x,y,M,_,v;return a==="center"?(_=p+m/2,o==="left"?(b=f,x=b-r,M=_+r,v=_-r):(b=f+g,x=b+r,M=_-r,v=_+r),y=b):(o==="left"?x=f+Math.max(c,d)+r:o==="right"?x=f+g-Math.max(h,u)-r:x=this.caretX,a==="top"?(M=p,_=M-r,b=x-r,y=x+r):(M=p+m,_=M+r,b=x+r,y=x-r),v=M),{x1:b,x2:x,x3:y,y1:M,y2:_,y3:v}}drawTitle(t,s,n){let o=this.title,a=o.length,r,l,c;if(a){let h=Ft(n.rtl,this.x,this.width);for(t.x=Ze(this,n.titleAlign,n),s.textAlign=h.textAlign(n.titleAlign),s.textBaseline="middle",r=j(n.titleFont),l=n.titleSpacing,s.fillStyle=n.titleColor,s.font=r.string,c=0;c<a;++c)s.fillText(o[c],h.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+l,c+1===a&&(t.y+=n.titleMarginBottom-l);}}_drawColorBox(t,s,n,o,a){let r=this.labelColors[n],l=this.labelPointStyles[n],{boxHeight:c,boxWidth:h}=a,d=j(a.bodyFont),u=Ze(this,"left",a),f=o.x(u),p=c<d.lineHeight?(d.lineHeight-c)/2:0,g=s.y+p;if(a.usePointStyle){let m={radius:Math.min(h,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},b=o.leftForLtr(f,h)+h/2,x=g+c/2;t.strokeStyle=a.multiKeyBackground,t.fillStyle=a.multiKeyBackground,He$1(t,m,b,x),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,He$1(t,m,b,x);}else {t.lineWidth=O(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;let m=o.leftForLtr(f,h),b=o.leftForLtr(o.xPlus(f,1),h-2),x=Pt(r.borderRadius);Object.values(x).some(y=>y!==0)?(t.beginPath(),t.fillStyle=a.multiKeyBackground,Jt$1(t,{x:m,y:g,w:h,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Jt$1(t,{x:b,y:g+1,w:h-2,h:c-2,radius:x}),t.fill()):(t.fillStyle=a.multiKeyBackground,t.fillRect(m,g,h,c),t.strokeRect(m,g,h,c),t.fillStyle=r.backgroundColor,t.fillRect(b,g+1,h-2,c-2));}t.fillStyle=this.labelTextColors[n];}drawBody(t,s,n){let{body:o}=this,{bodySpacing:a,bodyAlign:r,displayColors:l,boxHeight:c,boxWidth:h,boxPadding:d}=n,u=j(n.bodyFont),f=u.lineHeight,p=0,g=Ft(n.rtl,this.x,this.width),m=function(w){s.fillText(w,g.x(t.x+p),t.y+f/2),t.y+=f+a;},b=g.textAlign(r),x,y,M,_,v,S,k;for(s.textAlign=r,s.textBaseline="middle",s.font=u.string,t.x=Ze(this,b,n),s.fillStyle=n.bodyColor,R(this.beforeBody,m),p=l&&b!=="right"?r==="center"?h/2+d:h+2+d:0,_=0,S=o.length;_<S;++_){for(x=o[_],y=this.labelTextColors[_],s.fillStyle=y,R(x.before,m),M=x.lines,l&&M.length&&(this._drawColorBox(s,t,_,g,n),f=Math.max(u.lineHeight,c)),v=0,k=M.length;v<k;++v)m(M[v]),f=u.lineHeight;R(x.after,m);}p=0,f=u.lineHeight,R(this.afterBody,m),t.y-=a;}drawFooter(t,s,n){let o=this.footer,a=o.length,r,l;if(a){let c=Ft(n.rtl,this.x,this.width);for(t.x=Ze(this,n.footerAlign,n),t.y+=n.footerMarginTop,s.textAlign=c.textAlign(n.footerAlign),s.textBaseline="middle",r=j(n.footerFont),s.fillStyle=n.footerColor,s.font=r.string,l=0;l<a;++l)s.fillText(o[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+n.footerSpacing;}}drawBackground(t,s,n,o){let{xAlign:a,yAlign:r}=this,{x:l,y:c}=t,{width:h,height:d}=n,{topLeft:u,topRight:f,bottomLeft:p,bottomRight:g}=Pt(o.cornerRadius);s.fillStyle=o.backgroundColor,s.strokeStyle=o.borderColor,s.lineWidth=o.borderWidth,s.beginPath(),s.moveTo(l+u,c),r==="top"&&this.drawCaret(t,s,n,o),s.lineTo(l+h-f,c),s.quadraticCurveTo(l+h,c,l+h,c+f),r==="center"&&a==="right"&&this.drawCaret(t,s,n,o),s.lineTo(l+h,c+d-g),s.quadraticCurveTo(l+h,c+d,l+h-g,c+d),r==="bottom"&&this.drawCaret(t,s,n,o),s.lineTo(l+p,c+d),s.quadraticCurveTo(l,c+d,l,c+d-p),r==="center"&&a==="left"&&this.drawCaret(t,s,n,o),s.lineTo(l,c+u),s.quadraticCurveTo(l,c,l+u,c),s.closePath(),s.fill(),o.borderWidth>0&&s.stroke();}_updateAnimationTarget(t){let s=this.chart,n=this.$animations,o=n&&n.x,a=n&&n.y;if(o||a){let r=_e[t.position].call(this,this._active,this._eventPosition);if(!r)return;let l=this._size=so(this,t),c=Object.assign({},r,this._size),h=no(s,t,c),d=oo(t,c,h,s);(o._to!==d.x||a._to!==d.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=l.width,this.height=l.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,d));}}_willRender(){return !!this.opacity}draw(t){let s=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(s);let o={width:this.width,height:this.height},a={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let r=K(s.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&l&&(t.save(),t.globalAlpha=n,this.drawBackground(a,t,o,s),Hi$1(t,s.textDirection),a.y+=r.top,this.drawTitle(a,t,s),this.drawBody(a,t,s),this.drawFooter(a,t,s),ji$1(t,s.textDirection),t.restore());}getActiveElements(){return this._active||[]}setActiveElements(t,s){let n=this._active,o=t.map(({datasetIndex:l,index:c})=>{let h=this.chart.getDatasetMeta(l);if(!h)throw new Error("Cannot find a dataset at index "+l);return {datasetIndex:l,element:h.data[c],index:c}}),a=!ce(n,o),r=this._positionChanged(o,s);(a||r)&&(this._active=o,this._eventPosition=s,this._ignoreReplayEvents=true,this.update(true));}handleEvent(t,s,n=true){if(s&&this._ignoreReplayEvents)return false;this._ignoreReplayEvents=false;let o=this.options,a=this._active||[],r=this._getActiveElements(t,a,s,n),l=this._positionChanged(r,t),c=s||!ce(r,a)||l;return c&&(this._active=r,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(true,s))),c}_getActiveElements(t,s,n,o){let a=this.options;if(t.type==="mouseout")return [];if(!o)return s.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,a.mode,a,n);return a.reverse&&r.reverse(),r}_positionChanged(t,s){let{caretX:n,caretY:o,options:a}=this,r=_e[a.position].call(this,t,s);return r!==false&&(n!==r.x||o!==r.y)}}return e})(),ih={id:"tooltip",_element:lo,positioners:_e,afterInit(e,i,t){t&&(e.tooltip=new lo({chart:e,options:t}));},beforeUpdate(e,i,t){e.tooltip&&e.tooltip.initialize(t);},reset(e,i,t){e.tooltip&&e.tooltip.initialize(t);},afterDraw(e){let i=e.tooltip;if(i&&i._willRender()){let t={tooltip:i};if(e.notifyPlugins("beforeTooltipDraw",z$5(G$b({},t),{cancelable:true}))===false)return;i.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",t);}},afterEvent(e,i){if(e.tooltip){let t=i.replay;e.tooltip.handleEvent(i.event,t,i.inChartArea)&&(i.changed=true);}},defaults:{enabled:true,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,i)=>i.bodyFont.size,boxWidth:(e,i)=>i.bodyFont.size,multiKeyBackground:"#fff",displayColors:true,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Vo},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:false,callbacks:{_scriptable:false,_indexable:false},animation:{_fallback:false},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},sh=Object.freeze({__proto__:null,Colors:pc,Decimation:_c,Filler:Vc,Legend:$c,SubTitle:Kc,Title:Xc,Tooltip:ih}),nh=(e,i,t,s)=>(typeof i=="string"?(t=e.push(i)-1,s.unshift({index:t,label:i})):isNaN(i)&&(t=null),t);function oh(e,i,t,s){let n=e.indexOf(i);if(n===-1)return nh(e,i,t,s);let o=e.lastIndexOf(i);return n!==o?t:n}var ah=(e,i)=>e===null?null:Y(Math.round(e),0,i);function co(e){let i=this.getLabels();return e>=0&&e<i.length?i[e]:e}var rh=(()=>{class e extends Vt{static id="category";static defaults={ticks:{callback:co}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[];}init(t){let s=this._addedLabels;if(s.length){let n=this.getLabels();for(let{index:o,label:a}of s)n[o]===a&&n.splice(o,1);this._addedLabels=[];}super.init(t);}parse(t,s){if(A(t))return null;let n=this.getLabels();return s=isFinite(s)&&n[s]===t?s:oh(n,t,P(s,t),this._addedLabels),ah(s,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this.getMinMax(true);this.options.bounds==="ticks"&&(t||(n=0),s||(o=this.getLabels().length-1)),this.min=n,this.max=o;}buildTicks(){let t=this.min,s=this.max,n=this.options.offset,o=[],a=this.getLabels();a=t===0&&s===a.length-1?a:a.slice(t,s+1),this._valueRange=Math.max(a.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=s;r++)o.push({value:r});return o}getLabelForValue(t){return co.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels);}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}return e})();function lh(e,i){let t=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=e,f=o||1,p=h-1,{min:g,max:m}=i,b=!A(a),x=!A(r),y=!A(c),M=(m-g)/(d+1),_=vi$1((m-g)/p/f)*f,v,S,k,w;if(_<1e-14&&!b&&!x)return [{value:g},{value:m}];w=Math.ceil(m/_)-Math.floor(g/_),w>p&&(_=vi$1(w*_/p/f)*f),A(l)||(v=Math.pow(10,l),_=Math.ceil(_*v)/v),n==="ticks"?(S=Math.floor(g/_)*_,k=Math.ceil(m/_)*_):(S=g,k=m),b&&x&&o&&Ks((r-a)/o,_/1e3)?(w=Math.round(Math.min((r-a)/_,h)),_=(r-a)/w,S=a,k=r):y?(S=b?a:S,k=x?r:k,w=c-1,_=(k-S)/w):(w=(k-S)/_,Kt(w,Math.round(w),_/1e3)?w=Math.round(w):w=Math.ceil(w));let D=Math.max(ki$1(_),ki$1(S));v=Math.pow(10,A(l)?D:l),S=Math.round(S*v)/v,k=Math.round(k*v)/v;let C=0;for(b&&(u&&S!==a?(t.push({value:a}),S<a&&C++,Kt(Math.round((S+C*_)*v)/v,a,ho(a,M,e))&&C++):S<a&&C++);C<w;++C){let T=Math.round((S+C*_)*v)/v;if(x&&T>r)break;t.push({value:T});}return x&&u&&k!==r?t.length&&Kt(t[t.length-1].value,r,ho(r,M,e))?t[t.length-1].value=r:t.push({value:r}):(!x||k===r)&&t.push({value:k}),t}function ho(e,i,{horizontal:t,minRotation:s}){let n=it(s),o=(t?Math.sin(n):Math.cos(n))||.001,a=.75*i*(""+e).length;return Math.min(i/o,a)}var ee$1=class ee extends Vt{constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0;}parse(i,t){return A(i)||(typeof i=="number"||i instanceof Number)&&!isFinite(+i)?null:+i}handleTickRangeOptions(){let{beginAtZero:i}=this.options,{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this,a=l=>n=t?n:l,r=l=>o=s?o:l;if(i){let l=nt(n),c=nt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0);}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),i||a(n-l);}this.min=n,this.max=o;}getTickLimit(){let i=this.options.ticks,{maxTicksLimit:t,stepSize:s}=i,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let i=this.options,t=i.ticks,s=this.getTickLimit();s=Math.max(2,s);let n={maxTicks:s,bounds:i.bounds,min:i.min,max:i.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==false},o=this._range||this,a=lh(n,o);return i.bounds==="ticks"&&Mi$1(a,this,"value"),i.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let i=this.ticks,t=this.min,s=this.max;if(super.configure(),this.options.offset&&i.length){let n=(s-t)/Math.max(i.length-1,1)/2;t-=n,s+=n;}this._startValue=t,this._endValue=s,this._valueRange=s-t;}getLabelForValue(i){return Gt(i,this.chart.options.locale,this.options.ticks.format)}},_s$1=class _s extends ee$1{static id="linear";static defaults={ticks:{callback:he$1.formatters.numeric}};determineDataLimits(){let{min:i,max:t}=this.getMinMax(true);this.min=W(i)?i:0,this.max=W(t)?t:1,this.handleTickRangeOptions();}computeTickLimit(){let i=this.isHorizontal(),t=i?this.width:this.height,s=it(this.options.ticks.minRotation),n=(i?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(i){return i===null?NaN:this.getPixelForDecimal((i-this._startValue)/this._valueRange)}getValueForPixel(i){return this._startValue+this.getDecimalForPixel(i)*this._valueRange}},Me=e=>Math.floor(gt(e)),Bt=(e,i)=>Math.pow(10,Me(e)+i);function uo(e){return e/Math.pow(10,Me(e))===1}function fo(e,i,t){let s=Math.pow(10,t),n=Math.floor(e/s);return Math.ceil(i/s)-n}function ch(e,i){let t=i-e,s=Me(t);for(;fo(e,i,s)>10;)s++;for(;fo(e,i,s)<10;)s--;return Math.min(s,Me(e))}function hh(e,{min:i,max:t}){i=J(e.min,i);let s=[],n=Me(i),o=ch(i,t),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((i-l)*a)/a,h=Math.floor((i-l)/r/10)*r*10,d=Math.floor((c-h)/Math.pow(10,o)),u=J(e.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<t;)s.push({value:u,major:uo(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;let f=J(e.max,u);return s.push({value:f,major:uo(f),significand:d}),s}var ys$1=class ys extends Vt{static id="logarithmic";static defaults={ticks:{callback:he$1.formatters.logarithmic,major:{enabled:true}}};constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0;}parse(i,t){let s=ee$1.prototype.parse.apply(this,[i,t]);if(s===0){this._zero=true;return}return W(s)&&s>0?s:null}determineDataLimits(){let{min:i,max:t}=this.getMinMax(true);this.min=W(i)?Math.max(0,i):null,this.max=W(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=true),this._zero&&this.min!==this._suggestedMin&&!W(this._userMin)&&(this.min=i===Bt(this.min,0)?Bt(this.min,-1):Bt(this.min,0)),this.handleTickRangeOptions();}handleTickRangeOptions(){let{minDefined:i,maxDefined:t}=this.getUserBounds(),s=this.min,n=this.max,o=r=>s=i?s:r,a=r=>n=t?n:r;s===n&&(s<=0?(o(1),a(10)):(o(Bt(s,-1)),a(Bt(n,1)))),s<=0&&o(Bt(n,-1)),n<=0&&a(Bt(s,1)),this.min=s,this.max=n;}buildTicks(){let i=this.options,t={min:this._userMin,max:this._userMax},s=hh(t,this);return i.bounds==="ticks"&&Mi$1(s,this,"value"),i.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(i){return i===void 0?"0":Gt(i,this.chart.options.locale,this.options.ticks.format)}configure(){let i=this.min;super.configure(),this._startValue=gt(i),this._valueRange=gt(this.max)-gt(i);}getPixelForValue(i){return (i===void 0||i===0)&&(i=this.min),i===null||isNaN(i)?NaN:this.getPixelForDecimal(i===this.min?0:(gt(i)-this._startValue)/this._valueRange)}getValueForPixel(i){let t=this.getDecimalForPixel(i);return Math.pow(10,this._startValue+t*this._valueRange)}};function vs$1(e){let i=e.ticks;if(i.display&&e.display){let t=K(i.backdropPadding);return P(i.font&&i.font.size,B.font.size)+t.height}return 0}function dh(e,i,t){return t=F(t)?t:[t],{w:nn(e,i.string,t),h:t.length*i.lineHeight}}function go(e,i,t,s,n){return e===s||e===n?{start:i-t/2,end:i+t/2}:e<s||e>n?{start:i-t,end:i}:{start:i,end:i+t}}function uh(e){let i={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},t=Object.assign({},i),s=[],n=[],o=e._pointLabels.length,a=e.options.pointLabels,r=a.centerPointLabels?L/o:0;for(let l=0;l<o;l++){let c=a.setContext(e.getPointLabelContext(l));n[l]=c.padding;let h=e.getPointPosition(l,e.drawingArea+n[l],r),d=j(c.font),u=dh(e.ctx,d,e._pointLabels[l]);s[l]=u;let f=U(e.getIndexAngle(l)+r),p=Math.round(Be$1(f)),g=go(p,h.x,u.w,0,180),m=go(p,h.y,u.h,90,270);fh(t,i,f,g,m);}e.setCenterPoint(i.l-t.l,t.r-i.r,i.t-t.t,t.b-i.b),e._pointLabelItems=mh(e,s,n);}function fh(e,i,t,s,n){let o=Math.abs(Math.sin(t)),a=Math.abs(Math.cos(t)),r=0,l=0;s.start<i.l?(r=(i.l-s.start)/o,e.l=Math.min(e.l,i.l-r)):s.end>i.r&&(r=(s.end-i.r)/o,e.r=Math.max(e.r,i.r+r)),n.start<i.t?(l=(i.t-n.start)/a,e.t=Math.min(e.t,i.t-l)):n.end>i.b&&(l=(n.end-i.b)/a,e.b=Math.max(e.b,i.b+l));}function gh(e,i,t){let s=e.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=t,l=e.getPointPosition(i,s+n+a,o),c=Math.round(Be$1(U(l.angle+N))),h=_h(l.y,r.h,c),d=bh(c),u=xh(l.x,r.w,d);return {visible:true,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function ph(e,i){if(!i)return true;let{left:t,top:s,right:n,bottom:o}=e;return !(rt({x:t,y:s},i)||rt({x:t,y:o},i)||rt({x:n,y:s},i)||rt({x:n,y:o},i))}function mh(e,i,t){let s=[],n=e._pointLabels.length,o=e.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:vs$1(o)/2,additionalAngle:a?L/n:0},c;for(let h=0;h<n;h++){l.padding=t[h],l.size=i[h];let d=gh(e,h,l);s.push(d),r==="auto"&&(d.visible=ph(d,c),d.visible&&(c=d));}return s}function bh(e){return e===0||e===180?"center":e<180?"left":"right"}function xh(e,i,t){return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function _h(e,i,t){return t===90||t===270?e-=i/2:(t>270||t<90)&&(e-=i),e}function yh(e,i,t){let{left:s,top:n,right:o,bottom:a}=t,{backdropColor:r}=i;if(!A(r)){let l=Pt(i.borderRadius),c=K(i.backdropPadding);e.fillStyle=r;let h=s-c.left,d=n-c.top,u=o-s+c.width,f=a-n+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),Jt$1(e,{x:h,y:d,w:u,h:f,radius:l}),e.fill()):e.fillRect(h,d,u,f);}}function vh(e,i){let{ctx:t,options:{pointLabels:s}}=e;for(let n=i-1;n>=0;n--){let o=e._pointLabelItems[n];if(!o.visible)continue;let a=s.setContext(e.getPointLabelContext(n));yh(t,a,o);let r=j(a.font),{x:l,y:c,textAlign:h}=o;wt$1(t,e._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"});}}function Wo(e,i,t,s){let{ctx:n}=e;if(t)n.arc(e.xCenter,e.yCenter,i,0,z);else {let o=e.getPointPosition(0,i);n.moveTo(o.x,o.y);for(let a=1;a<s;a++)o=e.getPointPosition(a,i),n.lineTo(o.x,o.y);}}function Mh(e,i,t,s,n){let o=e.ctx,a=i.circular,{color:r,lineWidth:l}=i;!a&&!s||!r||!l||t<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Wo(e,t,a,s),o.closePath(),o.stroke(),o.restore());}function kh(e,i,t){return mt(e,{label:t,index:i,type:"pointLabel"})}var Ms$1=class Ms extends ee$1{static id="radialLinear";static defaults={display:true,animate:true,position:"chartArea",angleLines:{display:true,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:false},startAngle:0,ticks:{showLabelBackdrop:true,callback:he$1.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:true,font:{size:10},callback(i){return i},padding:5,centerPointLabels:false}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(i){super(i),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[];}setDimensions(){let i=this._padding=K(vs$1(this.options)/2),t=this.width=this.maxWidth-i.width,s=this.height=this.maxHeight-i.height;this.xCenter=Math.floor(this.left+t/2+i.left),this.yCenter=Math.floor(this.top+s/2+i.top),this.drawingArea=Math.floor(Math.min(t,s)/2);}determineDataLimits(){let{min:i,max:t}=this.getMinMax(false);this.min=W(i)&&!isNaN(i)?i:0,this.max=W(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions();}computeTickLimit(){return Math.ceil(this.drawingArea/vs$1(this.options))}generateTickLabels(i){ee$1.prototype.generateTickLabels.call(this,i),this._pointLabels=this.getLabels().map((t,s)=>{let n=I(this.options.pointLabels.callback,[t,s],this);return n||n===0?n:""}).filter((t,s)=>this.chart.getDataVisibility(s));}fit(){let i=this.options;i.display&&i.pointLabels.display?uh(this):this.setCenterPoint(0,0,0,0);}setCenterPoint(i,t,s,n){this.xCenter+=Math.floor((i-t)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(i,t,s,n));}getIndexAngle(i){let t=z/(this._pointLabels.length||1),s=this.options.startAngle||0;return U(i*t+it(s))}getDistanceFromCenterForValue(i){if(A(i))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-i)*t:(i-this.min)*t}getValueForDistanceFromCenter(i){if(A(i))return NaN;let t=i/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(i){let t=this._pointLabels||[];if(i>=0&&i<t.length){let s=t[i];return kh(this.getContext(),i,s)}}getPointPosition(i,t,s=0){let n=this.getIndexAngle(i)-N+s;return {x:Math.cos(n)*t+this.xCenter,y:Math.sin(n)*t+this.yCenter,angle:n}}getPointPositionForValue(i,t){return this.getPointPosition(i,this.getDistanceFromCenterForValue(t))}getBasePosition(i){return this.getPointPositionForValue(i||0,this.getBaseValue())}getPointLabelPosition(i){let{left:t,top:s,right:n,bottom:o}=this._pointLabelItems[i];return {left:t,top:s,right:n,bottom:o}}drawBackground(){let{backgroundColor:i,grid:{circular:t}}=this.options;if(i){let s=this.ctx;s.save(),s.beginPath(),Wo(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),s.closePath(),s.fillStyle=i,s.fill(),s.restore();}}drawGrid(){let i=this.ctx,t=this.options,{angleLines:s,grid:n,border:o}=t,a=this._pointLabels.length,r,l,c;if(t.pointLabels.display&&vh(this,a),n.display&&this.ticks.forEach((h,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let u=this.getContext(d),f=n.setContext(u),p=o.setContext(u);Mh(this,f,l,a,p);}}),s.display){for(i.save(),r=a-1;r>=0;r--){let h=s.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(i.lineWidth=u,i.strokeStyle=d,i.setLineDash(h.borderDash),i.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(r,l),i.beginPath(),i.moveTo(this.xCenter,this.yCenter),i.lineTo(c.x,c.y),i.stroke());}i.restore();}}drawBorder(){}drawLabels(){let i=this.ctx,t=this.options,s=t.ticks;if(!s.display)return;let n=this.getIndexAngle(0),o,a;i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(n),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;let c=s.setContext(this.getContext(l)),h=j(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){i.font=h.string,a=i.measureText(r.label).width,i.fillStyle=c.backdropColor;let d=K(c.backdropPadding);i.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height);}wt$1(i,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth});}),i.restore();}drawTitle(){}},hi$1={millisecond:{common:true,size:1,steps:1e3},second:{common:true,size:1e3,steps:60},minute:{common:true,size:6e4,steps:60},hour:{common:true,size:36e5,steps:24},day:{common:true,size:864e5,steps:30},week:{common:false,size:6048e5,steps:4},month:{common:true,size:2628e6,steps:12},quarter:{common:false,size:7884e6,steps:4},year:{common:true,size:3154e7}},Q=Object.keys(hi$1);function po(e,i){return e-i}function mo(e,i){if(A(i))return null;let t=e._adapter,{parser:s,round:n,isoWeekday:o}=e._parseOpts,a=i;return typeof s=="function"&&(a=s(a)),W(a)||(a=typeof s=="string"?t.parse(a,s):t.parse(a)),a===null?null:(n&&(a=n==="week"&&(It(o)||o===true)?t.startOf(a,"isoWeek",o):t.startOf(a,n)),+a)}function bo(e,i,t,s){let n=Q.length;for(let o=Q.indexOf(e);o<n-1;++o){let a=hi$1[Q[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((t-i)/(r*a.size))<=s)return Q[o]}return Q[n-1]}function Sh(e,i,t,s,n){for(let o=Q.length-1;o>=Q.indexOf(t);o--){let a=Q[o];if(hi$1[a].common&&e._adapter.diff(n,s,a)>=i-1)return a}return Q[t?Q.indexOf(t):0]}function wh(e){for(let i=Q.indexOf(e)+1,t=Q.length;i<t;++i)if(hi$1[Q[i]].common)return Q[i]}function xo(e,i,t){if(!t)e[i]=true;else if(t.length){let{lo:s,hi:n}=Ve$1(t,i),o=t[s]>=i?t[s]:t[n];e[o]=true;}}function Ph(e,i,t,s){let n=e._adapter,o=+n.startOf(i[0].value,s),a=i[i.length-1].value,r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=t[r],l>=0&&(i[l].major=true);return i}function _o(e,i,t){let s=[],n={},o=i.length,a,r;for(a=0;a<o;++a)r=i[a],n[r]=a,s.push({value:r,major:false});return o===0||!t?s:Ph(e,s,n,t)}var ks$1=(()=>{class e extends Vt{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:false,unit:false,round:false,isoWeekday:false,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:false,major:{enabled:false}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=false,this._parseOpts=void 0;}init(t,s={}){let n=t.time||(t.time={}),o=this._adapter=new Fr$1._date(t.adapters.date);o.init(s),Ut(n.displayFormats,o.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=s.normalized;}parse(t,s){return t===void 0?null:mo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]};}determineDataLimits(){let t=this.options,s=this._adapter,n=t.time.unit||"day",{min:o,max:a,minDefined:r,maxDefined:l}=this.getUserBounds();function c(h){!r&&!isNaN(h.min)&&(o=Math.min(o,h.min)),!l&&!isNaN(h.max)&&(a=Math.max(a,h.max));}(!r||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(false))),o=W(o)&&!isNaN(o)?o:+s.startOf(Date.now(),n),a=W(a)&&!isNaN(a)?a:+s.endOf(Date.now(),n)+1,this.min=Math.min(o,a-1),this.max=Math.max(o+1,a);}_getLabelBounds(){let t=this.getLabelTimestamps(),s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(s=t[0],n=t[t.length-1]),{min:s,max:n}}buildTicks(){let t=this.options,s=t.time,n=t.ticks,o=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);let a=this.min,r=this.max,l=Js(o,a,r);return this._unit=s.unit||(n.autoSkip?bo(s.minUnit,this.min,this.max,this._getLabelCapacity(a)):Sh(this,l.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:wh(this._unit),this.initOffsets(o),t.reverse&&l.reverse(),_o(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value));}initOffsets(t=[]){let s=0,n=0,o,a;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?s=1-o:s=(this.getDecimalForValue(t[1])-o)/2,a=this.getDecimalForValue(t[t.length-1]),t.length===1?n=a:n=(a-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;s=Y(s,0,r),n=Y(n,0,r),this._offsets={start:s,end:n,factor:1/(s+1+n)};}_generate(){let t=this._adapter,s=this.min,n=this.max,o=this.options,a=o.time,r=a.unit||bo(a.minUnit,s,n,this._getLabelCapacity(s)),l=P(o.ticks.stepSize,1),c=r==="week"?a.isoWeekday:false,h=It(c)||c===true,d={},u=s,f,p;if(h&&(u=+t.startOf(u,"isoWeek",c)),u=+t.startOf(u,h?"day":r),t.diff(n,s,r)>1e5*l)throw new Error(s+" and "+n+" are too far apart with stepSize of "+l+" "+r);let g=o.ticks.source==="data"&&this.getDataTimestamps();for(f=u,p=0;f<n;f=+t.add(f,l,r),p++)xo(d,f,g);return (f===n||o.bounds==="ticks"||p===1)&&xo(d,f,g),Object.keys(d).sort(po).map(m=>+m)}getLabelForValue(t){let s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(t,n.tooltipFormat):s.format(t,n.displayFormats.datetime)}format(t,s){let o=this.options.time.displayFormats,a=this._unit,r=s||o[a];return this._adapter.format(t,r)}_tickFormatFunction(t,s,n,o){let a=this.options,r=a.ticks.callback;if(r)return I(r,[t,s,n],this);let l=a.time.displayFormats,c=this._unit,h=this._majorUnit,d=c&&l[c],u=h&&l[h],f=n[s],p=h&&u&&f&&f.major;return this._adapter.format(t,o||(p?u:d))}generateTickLabels(t){let s,n,o;for(s=0,n=t.length;s<n;++s)o=t[s],o.label=this._tickFormatFunction(o.value,s,t);}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let s=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(t){let s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let s=this.options.ticks,n=this.ctx.measureText(t).width,o=it(this.isHorizontal()?s.maxRotation:s.minRotation),a=Math.cos(o),r=Math.sin(o),l=this._resolveTickFontOptions(0).size;return {w:n*a+l*r,h:n*r+l*a}}_getLabelCapacity(t){let s=this.options.time,n=s.displayFormats,o=n[s.unit]||n.millisecond,a=this._tickFormatFunction(t,0,_o(this,[t],this._majorUnit),o),r=this._getLabelSize(a),l=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],s,n;if(t.length)return t;let o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(s=0,n=o.length;s<n;++s)t=t.concat(o[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],s,n;if(t.length)return t;let o=this.getLabels();for(s=0,n=o.length;s<n;++s)t.push(mo(this,o[s]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Pi$1(t.sort(po))}}return e})();function Qe(e,i,t){let s=0,n=e.length-1,o,a,r,l;t?(i>=e[s].pos&&i<=e[n].pos&&({lo:s,hi:n}=at(e,"pos",i)),{pos:o,time:r}=e[s],{pos:a,time:l}=e[n]):(i>=e[s].time&&i<=e[n].time&&({lo:s,hi:n}=at(e,"time",i)),{time:o,pos:r}=e[s],{time:a,pos:l}=e[n]);let c=a-o;return c?r+(l-r)*(i-o)/c:r}var Ss$1=class Ss extends ks$1{static id="timeseries";static defaults=ks$1.defaults;constructor(i){super(i),this._table=[],this._minPos=void 0,this._tableRange=void 0;}initOffsets(){let i=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(i);this._minPos=Qe(t,this.min),this._tableRange=Qe(t,this.max)-this._minPos,super.initOffsets(i);}buildLookupTable(i){let{min:t,max:s}=this,n=[],o=[],a,r,l,c,h;for(a=0,r=i.length;a<r;++a)c=i[a],c>=t&&c<=s&&n.push(c);if(n.length<2)return [{time:t,pos:0},{time:s,pos:1}];for(a=0,r=n.length;a<r;++a)h=n[a+1],l=n[a-1],c=n[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){let i=this.min,t=this.max,s=super.getDataTimestamps();return (!s.includes(i)||!s.length)&&s.splice(0,0,i),(!s.includes(t)||s.length===1)&&s.push(t),s.sort((n,o)=>n-o)}_getTimestampsForTable(){let i=this._cache.all||[];if(i.length)return i;let t=this.getDataTimestamps(),s=this.getLabelTimestamps();return t.length&&s.length?i=this.normalize(t.concat(s)):i=t.length?t:s,i=this._cache.all=i,i}getDecimalForValue(i){return (Qe(this._table,i)-this._minPos)/this._tableRange}getValueForPixel(i){let t=this._offsets,s=this.getDecimalForPixel(i)/t.factor-t.end;return Qe(this._table,s*this._tableRange+this._minPos,true)}},Ch=Object.freeze({__proto__:null,CategoryScale:rh,LinearScale:_s$1,LogarithmicScale:ys$1,RadialLinearScale:Ms$1,TimeScale:ks$1,TimeSeriesScale:Ss$1}),Lh=[Ir$1,lc,sh,Ch];var Be=(t,n)=>{let e=w$4(Gi$3),o=w$4(G$3),i=e.getSplitShellEnabled(),r="/"+n.map(l=>l.path).join("/"),a=i?"chartplotter":"dashboard",s=r.startsWith("/chartplotter"),c=r.startsWith("/dashboard");if(n.length===0)return o.createUrlTree([a,"0"]);if(n.length===1&&(n[0].path==="chartplotter"||n[0].path==="dashboard"))return o.createUrlTree([a,"0"]);if(i&&c&&!s){let l=n.length>1?n[1].path:void 0;return o.createUrlTree(["chartplotter",l??""])}if(!i&&s){let l=n.length>1?n[1].path:void 0;return o.createUrlTree(["dashboard",l??""])}return true};var ii=[{path:"dashboard/:id",component:qo$1,canMatch:[Be]},{path:"chartplotter/:id",loadComponent:()=>import('./chunk-Cu9FE8cB.js').then(t=>t.SplitShellComponent),canMatch:[Be]},{path:"settings",loadComponent:()=>import('./chunk-D0MyVrEL.js').then(t=>t.SettingsComponent),title:"KIP - Settings"},{path:"options",loadComponent:()=>import('./chunk-NnB8OYZt.js').then(t=>t.TabsComponent),title:"KIP - Options"},{path:"remote",loadComponent:()=>import('./chunk-8hkXyEzG.js').then(t=>t.RemoteControlComponent),title:"KIP - Remote Control"},{path:"help/:page",loadComponent:()=>import('./chunk-Bhah8DNM.js').then(t=>t.AppHelpComponent),title:"KIP - Help"},{path:"help",loadComponent:()=>import('./chunk-Bhah8DNM.js').then(t=>t.AppHelpComponent),title:"KIP - Help"},{path:"data",loadComponent:()=>import('./chunk-CSpA60X7.js').then(t=>t.DataInspectorComponent),title:"KIP - Data Inspector"},{path:"login",loadComponent:()=>import('./chunk-7lulvsGI.js').then(t=>t.WidgetLoginComponent),title:"Login"},{path:"**",component:qo$1,canMatch:[Be]}];var gr=(t,n)=>n.path;function br(t,n){t&1&&(Pi$5(0,"mat-icon"),TT(1,"info"),ul$2());}function yr(t,n){t&1&&(Pi$5(0,"mat-icon"),TT(1,"info"),ul$2());}function vr(t,n){t&1&&(Pi$5(0,"mat-icon",3),TT(1,"report"),ul$2());}function _r(t,n){t&1&&(Pi$5(0,"mat-icon",4),TT(1,"warning"),ul$2());}function Sr(t,n){t&1&&(Pi$5(0,"mat-icon",5),TT(1,"error"),ul$2());}function wr(t,n){t&1&&(Pi$5(0,"mat-icon",6),TT(1,"emergency_home"),ul$2());}function Cr(t,n){if(t&1){let e=Fw();Pi$5(0,"div",2),_w(1,br,2,0,"mat-icon")(2,yr,2,0,"mat-icon")(3,vr,2,0,"mat-icon",3)(4,_r,2,0,"mat-icon",4)(5,Sr,2,0,"mat-icon",5)(6,wr,2,0,"mat-icon",6),Pi$5(7,"div",7),TT(8),ul$2(),Pi$5(9,"div",8),TT(10),HT(11,"slice"),ul$2(),Pi$5(12,"div",9),TT(13),ul$2(),Pi$5(14,"button",10),Qh("click",function(){let i=ud(e).$implicit,r=qw();return dd(r.silence(i.path))}),Pi$5(15,"mat-icon"),TT(16,"music_off"),ul$2()(),Pi$5(17,"button",11),Qh("click",function(){let i=ud(e).$implicit,r=qw();return dd(r.clear(i.path))}),Pi$5(18,"mat-icon"),TT(19,"published_with_changes"),ul$2()()(),$h(20,"mat-divider",12);}if(t&2){let e,o=n.$implicit;EE(),Mw((e=o.value?.state??"normal")==="nominal"?1:e==="normal"?2:e==="alert"?3:e==="warn"?4:e==="alarm"?5:e==="emergency"?6:-1),EE(7),gg(o.value?.state??""),EE(2),gl$2(" ",UT(11,5,o.path,14)," "),EE(3),gg(o.value?.message??""),EE(),Bh("disabled",!o.value?.method?.includes("sound"));}}function xr(t,n){t&1&&(Pi$5(0,"mat-list-item",13)(1,"span",15),TT(2,"Notifications Disabled"),ul$2(),Pi$5(3,"span")(4,"i"),TT(5,"*Enable notifications in Settings."),ul$2()()());}function Mr(t,n){t&1&&(Pi$5(0,"mat-list-item",14)(1,"i"),TT(2,'"No Notification"'),ul$2()());}function kr(t,n){if(t&1&&_w(0,xr,6,0,"mat-list-item",13)(1,Mr,3,0,"mat-list-item",14),t&2){let e=qw();Mw(e.notificationConfig().disableNotifications?0:1);}}function Ir(t,n){if(t&1){let e=Fw();Pi$5(0,"button",17),Qh("click",function(){ud(e);let i=qw(2);return dd(i.mutePlayer(!i.isMuted))}),Pi$5(1,"span",18),TT(2,"volume_up"),ul$2(),TT(3," Unmute Audio "),ul$2();}}function Pr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",17),Qh("click",function(){ud(e);let i=qw(2);return dd(i.mutePlayer(!i.isMuted))}),Pi$5(1,"span",18),TT(2,"volume_off"),ul$2(),TT(3," Mute Audio "),ul$2();}}function Dr(t,n){if(t&1&&_w(0,Ir,4,0,"button",16)(1,Pr,4,0,"button",16),t&2){let e=qw();Mw(e.isMuted?0:1);}}var ci=(()=>{class t{_notificationsService=w$4(O$1);_notifications$=this._notificationsService.observeNotifications();notificationConfig=Wp(this._notificationsService.observeNotificationConfiguration(),{requireSync:true});menuNotifications=Wp(Fm([this._notifications$,this._notificationsService.observeNotificationConfiguration()]).pipe(ke$3(([e,o$1])=>{let i=[];return o$1.devices.showNormalState||i.push(n$1.Normal),o$1.devices.showNominalState||i.push(n$1.Nominal),e.filter(r=>r.value&&r.value.state&&!i.includes(r.value.state)).filter(r=>{let a=r.value?.method;return a?.length?a.includes(o.Visual)||a.includes(o.Sound):false})})),{requireSync:true,equal:ln$3});isMuted=false;mutePlayer(e){this.isMuted=e,this._notificationsService.mutePlayer(e);}silence(e){this._notificationsService.setSkMethod(e,[o.Visual]);}clear(e){this._notificationsService.setSkState(e,n$1.Normal);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["menu-notifications"]],decls:6,vars:2,consts:[[1,"menu-item-container"],[1,"actions-container","actions-bottom-container"],[1,"notification-container"],[1,"icon-alert-color"],[1,"icon-warn-color"],[1,"icon-alarm-color"],[1,"icon-emergency-color"],[1,"notification-title"],[1,"notification-path","scrollable-text"],[1,"notification-text"],["mat-icon-button","",1,"notification-action-btn",3,"click","disabled"],["mat-icon-button","",1,"notification-action-btn",3,"click"],[1,"notification-divider"],["lines","3","disabled","true",2,"text-align","center"],["disabled","true",2,"text-align","center"],["matListItemTitle",""],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button"],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button",3,"click"],[1,"material-icons"]],template:function(o,i){o&1&&(Pi$5(0,"mat-list",0),xw(1,Cr,21,8,null,null,gr,false,kr,2,1),ul$2(),Pi$5(4,"div",1),_w(5,Dr,2,1),ul$2()),o&2&&(EE(),Aw(i.menuNotifications()),EE(4),Mw(i.notificationConfig().disableNotifications?-1:5));},dependencies:[Jt$8,Wt$4,Zt$7,u$3,et$a,Op,xp$1,eu,H,zt$1,mt$1,yt$3,wt$3,rs$3],styles:[".notification-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;padding:2px 10px 7px;scroll-behavior:smooth}mat-icon[_ngcontent-%COMP%]{margin-right:10px}.scrollable-text[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.scrollable-text[_ngcontent-%COMP%]:hover{overflow:auto;white-space:normal;word-wrap:break-word}.notification-title[_ngcontent-%COMP%]{text-transform:capitalize;font-size:var(--mat-sys-headline-small-size);width:calc(100% - 34px)}.notification-path[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-size);word-break:break-all;width:100%}.notification-text[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-line-height);font-style:italic;width:100%;overflow:auto;white-space:normal;word-wrap:break-word}.notification-action-btn[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container)}.notification-btn-container[_ngcontent-%COMP%]{display:inline-block;width:50%;height:48px;text-align:center}.menu-item-container[_ngcontent-%COMP%]{width:230px;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;height:calc(100% - 48px)}.notification-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;background-color:var(--mat-sys-surface-container)}.actions-container[_ngcontent-%COMP%]{display:grid;grid-auto-flow:column}.actions-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;height:48px}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large))}.icon-alert-color[_ngcontent-%COMP%]{color:var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{color:var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{color:var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:transparent}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.notification-divider[_ngcontent-%COMP%]{padding-top:10px}"]})}return t})();var Ar=["badgeButton"],li=(()=>{class t{badgeButton=$j.required("badgeButton");_notifications=w$4(O$1);notificationsInfo=Wp(this._notifications.observerNotificationsInfo(),{requireSync:true});openNotificationMenu(){let e=new Event("openRightSidenav",{bubbles:true,cancelable:true});window.document.dispatchEvent(e);}onKeyDown(e){let o=e.key?.toLowerCase();(o==="enter"||o===" "||o==="spacebar")&&(e.preventDefault(),this.openNotificationMenu());}focus(){try{let e=this.badgeButton&&this.badgeButton(),o=e&&e.nativeElement;o&&typeof o.focus=="function"&&o.focus();}catch(e){}}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["notification-badge"]],viewQuery:function(o,i){o&1&&eg(i.badgeButton,Ar,5),o&2&&Kw();},decls:5,vars:7,consts:[["badgeButton",""],["mat-fab","","role","button","aria-label","Open notifications",1,"layout-action-btn",3,"click","keydown"],["aria-hidden","false","matBadgeSize","large","matBadgePosition","after","matBadgeOverlap","true",1,"icon-alert-color",3,"matBadgeHidden","matBadge"]],template:function(o,i){o&1&&(Pi$5(0,"div")(1,"button",1,0),Qh("click",function(){return i.openNotificationMenu()})("keydown",function(a){return i.onKeyDown(a)}),Pi$5(3,"mat-icon",2),TT(4,"notifications "),ul$2()()()),o&2&&(EE(),sg("warn",i.notificationsInfo()?.isWarn)("alarm-emergency-blink",i.notificationsInfo()?.isAlarmEmergency),Hh("aria-haspopup",true),EE(2),Bh("matBadgeHidden",!(i.notificationsInfo()?.alarmCount??0))("matBadge",i.notificationsInfo()?.alarmCount??0));},dependencies:[Op,Fp,yt$3,wt$3,H,G$1],styles:["[_nghost-%COMP%]{display:block}.layout-action-btn[_ngcontent-%COMP%]{color:var(--mat-sys-on-primary);background-color:var(--mat-sys-primary)}.icon-alert-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:var(--mat-sys-primary)}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}"]})}return t})();var di=(()=>{class t{overlayRef=null;overlay=w$4(ce$6);injector=w$4(be$5);open(){if(this.overlayRef)return;this.overlayRef=this.overlay.create({hasBackdrop:false,panelClass:"notification-overlay-panel",positionStrategy:this.overlay.position().global().bottom("20px").left("20px"),scrollStrategy:this.overlay.scrollStrategies.reposition()});let e=new bt$8(li,null,this.injector),o=this.overlayRef.attach(e);try{let i=o&&o.instance;if(i&&typeof i.focus=="function")i.focus();else {let r=this.overlayRef.overlayElement,a=r&&r.querySelector("button[mat-fab], .layout-action-btn");a&&typeof a.focus=="function"&&a.focus();}}catch(i){}}close(){try{this.overlayRef&&this.overlayRef.dispose();}catch(e){console.warn("[NotificationOverlayService] dispose failed",e);}finally{this.overlayRef=null;}}toggle(e){e?this.open():this.close();}isOpen(){return !!this.overlayRef}ngOnDestroy(){try{this.overlayRef&&this.overlayRef.dispose();}catch(e){}finally{this.overlayRef=null;}}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Or(t,n){if(t&1){let e=Fw();Pi$5(0,"button",12),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("toggleFullScreen"))}),Pi$5(1,"span",10),TT(2,"fullscreen"),ul$2()();}}function Tr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",12),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("toggleFullScreen"))}),Pi$5(1,"span",10),TT(2,"close_fullscreen"),ul$2()();}}function Er(t,n){if(t&1&&_w(0,Or,3,0,"button",11)(1,Tr,3,0,"button",11),t&2){let e=qw();Mw(e.uiEvent.fullscreenStatus()?1:0);}}function Rr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",14),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("nightMode"))}),Pi$5(1,"span",10),TT(2,"mode_night"),ul$2()();}}function Nr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",14),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("nightMode"))}),Pi$5(1,"span",10),TT(2,"light_mode"),ul$2()();}}function Lr(t,n){if(t&1&&_w(0,Rr,3,0,"button",13)(1,Nr,3,0,"button",13),t&2){let e=qw();Mw(e.app.isNightMode()?1:0);}}function zr(t,n){if(t&1){let e=Fw();Pi$5(0,"tile-large-icon",15,1),Qh("click",function(){let i=ud(e).$index,r=qw();return dd(r.navigateToDashboard(i))}),ul$2();}if(t&2){let e=n.$implicit;Bh("active",e.active)("svgIcon",e.svgIcon)("iconSize",e.iconSize)("label",e.label);}}var ui=(()=>{class t{actionsSidenav=Hj.required();_router=w$4(G$3);uiEvent=w$4(re$5);dashboard=w$4(G$2);app=w$4(N$1);_settings=w$4(Gi$3);isAutoNightMode=Wp(this._settings.getAutoNightModeAsO(),{requireSync:true});_initialDashboardMatch=(()=>{let o=this._router.parseUrl(this._router.url).root.children.primary,i=o?o.segments.map(r=>r.path):[];return i.length===0||i[0]==="dashboard"||i[0]==="chartplotter"})();isDashboardContext=Wp(this._router.events.pipe(fn$7(e=>e instanceof $$2),Tu(null),ke$3(()=>{let o=this._router.parseUrl(this._router.url).root.children.primary,i=o?o.segments.map(r=>r.path):[];return i.length===0||i[0]==="dashboard"||i[0]==="chartplotter"}),Gl$2()),{initialValue:this._initialDashboardMatch});menuItems=Dt$9(()=>{let e=this.dashboard.dashboards(),o=this.dashboard.activeDashboard();return e.map((i,r)=>({id:Number(i.id),active:r===o,pinned:false,svgIcon:i.icon||"dashboard-dashboard",iconSize:60,label:i.name||`Dashboard ${r+1}`}))});ngAfterViewInit(){this.uiEvent.addHotkeyListener((e,o)=>this.handleKeyDown(e,o),{ctrlKey:true,shiftKey:true,keys:["e","f","n"]});}ngOnDestroy(){this.uiEvent.removeHotkeyListener(this.handleKeyDown.bind(this));}handleKeyDown(e,o){switch(e){case "e":this.onActionItem("layout");break;case "f":this.onActionItem("toggleFullScreen");break;case "n":this.onActionItem("nightMode");break;}}onActionItem(e){switch(this.actionsSidenav().close(),e){case "toggleFullScreen":this.uiEvent.toggleFullScreen();break;case "settings":this._router.navigate(["/settings"]);break;case "layout":this.dashboard.setStaticDashboard(false);break;case "nightMode":this.app.isNightMode.set(!this.app.isNightMode()),this.app.toggleDayNightMode();break;}}navigateToDashboard(e){this.actionsSidenav().close(),this._router.navigate([`dashboard/${e}`]);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["menu-actions"]],inputs:{actionsSidenav:[1,"actionsSidenav"]},decls:14,vars:3,consts:[["tileContainer",""],["tile",""],[1,"actions-container"],[1,"actions-top-container"],["mat-flat-button","","tabindex","0",1,"action-button","home-btn",3,"click"],["height","24px","width","24px","svgIcon","kip","aria-hidden","false",1,"home-icon",2,"height","24px","width","24px"],[1,"menu-item-container"],[3,"active","svgIcon","iconSize","label"],[1,"actions-bottom-container"],["mat-flat-button","",1,"action-button",2,"width","135px",3,"click","disabled"],[1,"material-icons"],["mat-flat-button","","tabindex","0",1,"action-button"],["mat-flat-button","","tabindex","0",1,"action-button",3,"click"],["mat-flat-button","",1,"action-button"],["mat-flat-button","",1,"action-button",3,"click"],[3,"click","active","svgIcon","iconSize","label"]],template:function(o,i){o&1&&(Pi$5(0,"div",2)(1,"div",3),_w(2,Er,2,1),_w(3,Lr,2,1),Pi$5(4,"button",4),Qh("click",function(){return i.onActionItem("settings")}),$h(5,"mat-icon",5),ul$2()(),Pi$5(6,"div",6,0),xw(8,zr,2,4,"tile-large-icon",7,Sw),ul$2(),Pi$5(10,"div",8)(11,"button",9),Qh("click",function(){return i.onActionItem("layout")}),Pi$5(12,"span",10),TT(13,"lock_open"),ul$2()()()()),o&2&&(EE(2),Mw(i.uiEvent.fullscreenSupported()?2:-1),EE(),Mw(i.isAutoNightMode()?-1:3),EE(5),Aw(i.menuItems()),EE(3),Bh("disabled",!i.isDashboardContext()));},dependencies:[yt$3,wt$3,Op,xp$1,R$2],styles:[".actions-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:135px}.actions-top-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.actions-bottom-container[_ngcontent-%COMP%]{height:48px;width:100%}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;flex:1 1 48px;min-height:0;overflow:hidden;border:1px solid var(--mat-sidenav-container-background-color, var(--mat-sys-surface))}.home-btn[_ngcontent-%COMP%]{--mat-icon-button-icon-size: 24px;--mat-button-filled-icon-offset: 0px;--mat-button-filled-icon-spacing: 0px;--mat-button-filled-label-text-size: 0px}.home-icon[_ngcontent-%COMP%] .mat-mdc-unelevated-button[_ngcontent-%COMP%] > .mat-icon[_ngcontent-%COMP%]{font-size:0px}.full-size[_ngcontent-%COMP%]{width:135px}.menu-item-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;padding:3px 1px;gap:5px;width:135px;overflow-y:auto;scrollbar-width:none;overflow-x:hidden;scroll-behavior:smooth;flex:1 1 auto;min-height:0}"]})}return t})();var fi=(()=>{class t{COMMAND_SET_DISPLAY_PATH="self.kip.remote.setDisplay";COMMAND_SET_SCREEN_INDEX_PATH="self.kip.remote.setScreenIndex";COMMAND_REQUEST_ACTIVE_SCREEN_PATH="self.kip.remote.requestActiveScreen";settings=w$4(Gi$3);dashboard=w$4(G$2);data=w$4(De$2);requests=w$4(T);KIP_UUID=this.settings.KipUUID;ACTIVE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.screenIndex`;CHANGE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.activeScreen`;displayName=Wp(this.settings.getInstanceNameAsO());isRemoteControl=Wp(this.settings.getIsRemoteControlAsO());remoteScreenPosition=Wp(this.data.subscribePath(this.ACTIVE_SCREEN_PATH,"default"));changeDashboardTo=Wp(this.data.subscribePath(this.CHANGE_SCREEN_PATH,"default"));previousIsRemoteControl=false;constructor(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),this.setScreensOnRemote(this.KIP_UUID,null),this.clearActiveScreenOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Cleaning paths on server"),Fa$5(()=>{let e=this.isRemoteControl();this.displayName();ge$5(()=>{if(!e&&!this.previousIsRemoteControl)return;this.previousIsRemoteControl=!!e;let i=null;e?(i=this.getScreensPayload(this.dashboard.dashboards()),this.dashboard.activeDashboard()!==null&&this.setActiveDashboardOnRemote(this.KIP_UUID,this.dashboard.activeDashboard())):(i=null,this.clearActiveDashboardOnServer()),this.shareScreens(i);});}),Fa$5(()=>{let e=this.dashboard.dashboards();ge$5(()=>{if(!this.isRemoteControl())return;let o=this.getScreensPayload(e);this.shareScreens(o);});}),Fa$5(()=>{let e=this.dashboard.activeDashboard();ge$5(()=>{this.isRemoteControl()&&e!==null&&(this.setActiveDashboardOnRemote(this.KIP_UUID,e),console.log(`[Remote Dashboards] Sent new dashboard highlight index ${e} to server.`));});}),Fa$5(()=>{let e=this.changeDashboardTo();ge$5(()=>{if(!this.isRemoteControl()||!e||e.data.value==null)return;let o=Number(e.data.value);!isNaN(o)&&o>=0&&o<this.dashboard.dashboards().length&&this.dashboard.activeDashboard()!==o&&(this.dashboard.navigateTo(o),console.log(`[Remote Dashboards] Executed remote request to change active dashboard to: ${o}`));});});}clearActiveDashboardOnServer(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Disabled: Cleared active dashboard on server");}getScreensPayload(e){let o=this.displayName()??"Unknown Display Name",i=e.map(s=>{var c=s,{configuration:r}=c,a=tm(c,["configuration"]);return a});return {displayName:o,screens:i}}shareScreens(e){this.setScreensOnRemote(this.KIP_UUID,e),console.log("[Remote Dashboards] Sending dashboard configurations to server.");}setActiveDashboardOnRemote(e,o){let i={displayId:e,screenIdx:o};this.requests.putRequest(this.COMMAND_SET_SCREEN_INDEX_PATH,i,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing active dashboard: request was not accepted");}setScreensOnRemote(e,o){let i={displayId:e,display:o===null?null:G$b({},o)};this.requests.putRequest(this.COMMAND_SET_DISPLAY_PATH,i,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing screen configuration: request was not accepted");}clearActiveScreenOnRemote(e,o){let i={displayId:e,screenIdx:o};this.requests.putRequest(this.COMMAND_REQUEST_ACTIVE_SCREEN_PATH,i,this.KIP_UUID)||console.error("[Remote Dashboards] Error clearing active screen request path: request was not accepted");}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var hi=11,mi="connectionConfig",fe=(()=>{class t{config=G$b({},Xe$1);isLoggedIn=false;loggedInSubscription;connection=w$4(T$2);auth=w$4(He$4);connectionStateMachine=w$4(We$3);router=w$4(G$3);delta=w$4(I$2);data=w$4(De$2);storage=w$4(Ge$3);internetReachability=w$4(w$1);injector=w$4(be$5);datasetService=null;_bootstrapStatus$=new Bn$5("starting");_bootstrapIssue$=new Bn$5({reason:"none"});constructor(){this.loggedInSubscription=this.auth.isLoggedIn$.subscribe(e=>{this.isLoggedIn=e;});}getErrorStatus(e){if(!e||typeof e!="object")return;let o=e;return typeof o.status=="number"?o.status:void 0}initNetworkServices(){return Zr$4(this,null,function*(){let e=false;this.loadLocalStorageConfig(),this.preloadFonts(),this.internetReachability.start();try{if(this.config?.signalKUrl!==void 0&&this.config.signalKUrl!==null&&(yield this.connection.initializeConnection({url:this.config.signalKUrl,new:!1},this.config.proxyEnabled,this.config.signalKSubscribeAll)),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.config?.loginName&&this.config?.loginPassword&&(yield this.login()),this.isLoggedIn&&this.config?.useSharedConfig)if(yield this.storage.waitUntilReady()){let i=yield this.storage.getConfig("user",this.config.sharedConfigName,hi),r={sharedConfigName:this.config.sharedConfigName,configFileVersion:hi,initConfig:i};this.storage.bootstrapRemoteContext(r);}else throw new Error("[AppInit Network Service] StorageService did not become ready in time. Cannot bootstrap remote configuration.");this._bootstrapIssue$.next({reason:"none"}),yield this.getDatasetService().waitUntilReady(),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.router.navigate(["/login"]);}catch(o){e=true;let i=this.getErrorStatus(o);if(i===404&&this.config?.useSharedConfig){let r=yield this.probeLegacyUpgradeAvailability(this.config.sharedConfigName);this._bootstrapIssue$.next({reason:"missing-shared-config",statusCode:404,sharedConfigName:this.config.sharedConfigName,legacyUpgradeAvailable:r});}else i===0?this._bootstrapIssue$.next({reason:"network-unreachable",statusCode:0}):i===401?this._bootstrapIssue$.next({reason:"unauthorized",statusCode:401}):this._bootstrapIssue$.next({reason:"unknown",statusCode:i});i===0?(yield this.waitForHttpRetryCompletion())===l$1.HTTPConnected||this.connectionStateMachine.isHTTPConnected()?console.warn("[AppInit Network Service] Initial connection recovered during retry cycle. Skipping fallback route."):(console.warn("[AppInit Network Service] Initialization failed after HTTP retries. Redirecting to settings page."),yield this.router.navigate(["/options"])):i===401?(console.warn("[AppInit Network Service] Initialization failed. Unauthorized access. Redirecting to login page."),yield this.router.navigate(["/login"])):(console.warn("[AppInit Network Service] Initialization failed. Error: ",JSON.stringify(o)),yield this.router.navigate(["/options"])),console.warn("[AppInit Network Service] Startup continuing in degraded mode to allow UI feedback."),this._bootstrapStatus$.next("degraded");return}finally{e||this._bootstrapStatus$.next("ready"),console.log("[AppInit Network Service] Initialization completed"),this.connectionStateMachine.enableWebSocketMode(),this.connectionStateMachine.isHTTPConnected()&&(console.log("[AppInit Network Service] Starting WebSocket connection after initialization"),this.connectionStateMachine.startWebSocketConnection());}})}get bootstrapStatus$(){return this._bootstrapStatus$.asObservable()}get bootstrapIssue$(){return this._bootstrapIssue$.asObservable()}getDatasetService(){return this.datasetService||(this.datasetService=this.injector.get(K$3)),this.datasetService}waitForHttpRetryCompletion(e){return Zr$4(this,null,function*(){let o=e??this.connectionStateMachine.getHttpRetryWindowMs(2e3),i=new Set([l$1.HTTPConnected,l$1.PermanentFailure]),r=this.connectionStateMachine.currentState;return i.has(r)?r:new Promise(a=>{let s=window.setTimeout(()=>{c.unsubscribe(),a(null);},o),c=this.connectionStateMachine.state$.subscribe(l=>{i.has(l)&&(clearTimeout(s),c.unsubscribe(),a(l));});})})}probeLegacyUpgradeAvailability(e){return Zr$4(this,null,function*(){if(!e)return false;try{return (yield this.storage.getConfig("user",e,9))?.app?.configVersion===10}catch(o){return false}})}login(){return Zr$4(this,null,function*(){if(!this.isLoggedIn&&this.config.useSharedConfig&&this.config.loginName&&this.config.loginPassword)try{yield this.auth.login({usr:this.config.loginName,pwd:this.config.loginPassword});}catch(e){let o=this.getErrorStatus(e);throw o===0?yield this.router.navigate(["/settings"]):o===401&&(yield this.router.navigate(["/login"])),e}})}setLocalStorageConfig(){localStorage.setItem(mi,JSON.stringify(this.config));}loadLocalStorageConfig(){let e=localStorage.getItem(mi);this.config=e?JSON.parse(e):G$b({},Xe$1),e?this.config.signalKUrl||(this.config.signalKUrl=window.location.origin,this.setLocalStorageConfig(),console.log(`[AppInit Network Service] Config found with no server URL. Setting Auto-Discovery URL: ${this.config.signalKUrl}`)):(this.config=G$b({},Xe$1),this.config.signalKUrl=window.location.origin,console.log(`[AppInit Network Service] Connection Configuration not found. Creating configuration using Auto-Discovery URL: ${this.config.signalKUrl}`),this.setLocalStorageConfig()),this.config.configVersion==9&&(this.config.configVersion=10,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 9 to 10")),this.config.configVersion==10&&(this.config.configVersion=11,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 10 to 11")),this.config.configVersion==11&&(this.config.configVersion=12,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 11 to 12"));}preloadFonts(){let e=[{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fChc4AMP6lbBP.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fBBc4AMP6lQ.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2)",options:{weight:"500",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.woff2)",options:{weight:"500",style:"normal"}}];for(let{family:o,src:i,options:r}of e){let a=new FontFace(o,i,r);a.load().then(()=>document.fonts.add(a)).catch(s=>console.log(`[AppInit Network Service] Error loading fonts: ${s}`));}}ngOnDestroy(){this.loggedInSubscription?.unsubscribe();}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();var jr=["upgradeMessages"];function Ur(t,n){if(t&1&&(Pi$5(0,"li"),TT(1),ul$2()),t&2){let e=n.$implicit;EE(),gg(e);}}function Br(t,n){if(t&1&&(Pi$5(0,"ul",11,1),xw(2,Ur,2,1,"li",null,Sw),ul$2()),t&2){let e=qw(2);EE(2),Aw(e.upgrade.messages());}}function Fr(t,n){if(t&1&&(Pi$5(0,"div",7)(1,"div",8),$h(2,"mat-progress-spinner",9),Pi$5(3,"div",10)(4,"h3"),TT(5,"Upgrading Configuration\u2026"),ul$2(),Pi$5(6,"p"),TT(7,"Please wait a moment while we migrate your dashboards and widgets."),ul$2(),_w(8,Br,4,0,"ul",11),ul$2()()()),t&2){let e=qw();EE(8),Mw(e.upgrade.messages().length?8:-1);}}var pi=(()=>{class t{_deltaService=w$4(I$2);_connectionStateMachine=w$4(We$3);_appNetworkInit=w$4(fe);_historySeriesReconcile=w$4(Qt$2);authenticationService=w$4(He$4);_dataSet=w$4(K$3);_dashboard=w$4(G$2);_remoteControl=w$4(fi);toast=w$4(lt$3);_notifications=w$4(O$1);_uiEvent=w$4(re$5);_dialog=w$4(Ff);settings=w$4(Gi$3);_responsive=w$4(ir$4);_destroyRef=w$4(xe$3);_notificationOverlay=w$4(di);_router=w$4(G$3);upgrade=w$4(Pn$2);upgradeMessagesRef=$j("upgradeMessages");_upgradeShown=false;actionsSidenavOpened=Bj(false);notificationsSidenavOpened=Bj(false);notificationsInfo=Wp(this._notifications.observerNotificationsInfo());bootstrapStatus=Wp(this._appNetworkInit.bootstrapStatus$,{initialValue:"starting"});bootstrapIssue=Wp(this._appNetworkInit.bootstrapIssue$,{initialValue:{reason:"none"}});dashboardVisible=vt$9(false);isPhonePortrait;scheduledOpen=null;OPEN_DELAY_MS=300;missingConfigPromptShown=false;_swipeLeftHandler=()=>this.onSwipeLeft();_swipeRightHandler=()=>this.onSwipeRight();_hotkeyHandler=e=>this.handleKeyDown(e);constructor(){Fa$5(()=>{if(this.settings.configUpgrade()){let e=this.settings.getConfigVersion();e===11&&this.upgrade.runUpgrade(e),e||this._upgradeShown||(this._upgradeShown=true,this._dialog.openFrameDialog({title:"Upgrade Instructions",component:"upgrade-config"},true).pipe(Gp(this._destroyRef)).subscribe());}}),Fa$5(()=>{let e=this.upgrade.messages(),o=this.upgradeMessagesRef();if(this.upgrade.upgrading()&&e.length&&o){let i=o.nativeElement;i.scrollTop=i.scrollHeight;}});try{this.dashboardVisible.set(this.isUrlDashboard(this._router.url));}catch(e){}this._router.events.pipe(fn$7(e=>e instanceof $$2),Gp(this._destroyRef)).subscribe(e=>{try{this.dashboardVisible.set(this.isUrlDashboard(e.urlAfterRedirects||e.url));}catch(o){}}),Fa$5(()=>{let e=this.dashboardVisible()&&this._dashboard.isDashboardStatic()&&(this.notificationsInfo()?.alarmCount??0)>0;if(this.notificationsSidenavOpened()){this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close();}catch(i){}return}if(e){if(this.scheduledOpen)return;this.scheduledOpen=window.setTimeout(()=>{this.scheduledOpen=null;try{this._notificationOverlay.open();}catch(i){}},this.OPEN_DELAY_MS);}else {this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close();}catch(i){}}}),Fa$5(()=>{if(this.notificationsSidenavOpened())try{this._notificationOverlay.close();}catch(o){}}),this.isPhonePortrait=Wp(this._responsive.observe(Em.HandsetPortrait),{initialValue:{matches:false,breakpoints:{}}}),this._connectionStateMachine.status$.pipe(Gp(this._destroyRef)).subscribe(e=>this.displayConnectionsStatusNotification(e)),Fa$5(()=>{let e=this.bootstrapIssue();if(e.reason!=="missing-shared-config"||this.missingConfigPromptShown)return;this.missingConfigPromptShown=true;let o=e.sharedConfigName||"default",i=e.legacyUpgradeAvailable===true,r=i?"Upgrade":"Create",a=i?`Server is reachable, but no current version shared configuration '${o}' exists for this user. A legacy configuration was found and can be upgraded. Upgrade now?`:`Server is reachable, but no shared configuration '${o}' exists for this user. Create a default configuration now?`;this.toast.show(a,0,true,"warn",r).onAction().pipe(Gp(this._destroyRef)).subscribe(()=>{i?this.upgrade.runUpgrade():this.settings.resetSettings();});});}isUrlDashboard(e){if(!e)return false;let o=e.split("?")[0].replace(/\/+$/,"");return o==="/"||o==="/dashboard"||/^\/dashboard(\/\d+)?$/.test(o)||o==="/chartplotter"||/^\/chartplotter(\/\d+)?$/.test(o)}ngOnInit(){this._uiEvent.addGestureListeners(this._swipeLeftHandler,this._swipeRightHandler);}ngAfterViewInit(){this._uiEvent.addHotkeyListener(this._hotkeyHandler,{ctrlKey:true,keys:["arrowright","arrowleft"]});}handleKeyDown(e){switch(e){case "arrowright":this.onSwipeRight();break;case "arrowleft":this.onSwipeLeft();break;case "escape":this.backdropClicked();break}}escapeKeyPressed(e){e=e.toLowerCase(),e==="escape"&&this.backdropClicked();}displayConnectionsStatusNotification(e){let o=e.message,i=this.bootstrapStatus()!=="ready";switch(e.operation){case 0:this.toast.show(o,5e3,true);break;case 1:case 2:break;case 3:this.toast.show(o,3e3,i,"warn");break;case 4:this.toast.show(o,3e3,true,"info");break;case 5:this.toast.show(o,0,i);break;default:console.error("[AppComponent] Unknown operation code:",e.operation),this.toast.show(`Unknown connection status: ${e.state}`,0,i,"error");}}onSwipeRight(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.actionsSidenavOpened.set(false),this.notificationsSidenavOpened.set(true)):(this.actionsSidenavOpened.set(false),this.notificationsSidenavOpened.update(e=>!e)));}backdropClicked(){this.notificationsSidenavOpened.update(e=>e?!e:false),this.actionsSidenavOpened.update(e=>e?!e:false);}onSwipeLeft(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.notificationsSidenavOpened.set(false),this.actionsSidenavOpened.set(true)):(this.notificationsSidenavOpened.set(false),this.actionsSidenavOpened.update(e=>!e)));}ngOnDestroy(){this._uiEvent.removeGestureListeners(this._swipeLeftHandler,this._swipeRightHandler),this._uiEvent.removeHotkeyListener(this._hotkeyHandler),this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["app-root"]],viewQuery:function(o,i){o&1&&eg(i.upgradeMessagesRef,jr,5),o&2&&Kw();},inputs:{actionsSidenavOpened:[1,"actionsSidenavOpened"],notificationsSidenavOpened:[1,"notificationsSidenavOpened"]},outputs:{actionsSidenavOpened:"actionsSidenavOpenedChange",notificationsSidenavOpened:"notificationsSidenavOpenedChange"},decls:9,vars:6,consts:[["actionsSidenav",""],["upgradeMessages",""],["kipGestures","",1,"sidenav-container",3,"swipeleft","swiperight","backdropClick","mode","bridgeUiEvents"],["mode","over","position","start","autoFocus","true","disableClose","",1,"sidenav-notifications",3,"openedChange","keydown","opened"],["mode","over","position","end","autoFocus","true","disableClose","",1,"sidenav-actions",3,"openedChange","keydown","opened"],[3,"actionsSidenav"],[1,"router-outlet-container"],["role","alert","aria-live","polite",1,"config-upgrade-overlay"],[1,"config-upgrade-card"],["diameter","46","mode","indeterminate"],[1,"config-upgrade-text"],[1,"config-upgrade-messages"]],template:function(o,i){if(o&1){let r=Fw();Pi$5(0,"mat-sidenav-container",2),Qh("swipeleft",function(){return i.onSwipeLeft()})("swiperight",function(){return i.onSwipeRight()})("backdropClick",function(){return i.backdropClicked()}),Pi$5(1,"mat-sidenav",3),Eg("openedChange",function(s){return ud(r),ST(i.notificationsSidenavOpened,s)||(i.notificationsSidenavOpened=s),dd(s)}),Qh("keydown",function(s){return i.escapeKeyPressed(s.key)}),$h(2,"menu-notifications"),ul$2(),Pi$5(3,"mat-sidenav",4,0),Eg("openedChange",function(s){return ud(r),ST(i.actionsSidenavOpened,s)||(i.actionsSidenavOpened=s),dd(s)}),Qh("keydown",function(s){return i.escapeKeyPressed(s.key)}),$h(5,"menu-actions",5),ul$2(),Pi$5(6,"mat-sidenav-content"),$h(7,"router-outlet",6),ul$2()(),_w(8,Fr,9,1,"div",7);}if(o&2){let r=Jw(4);Bh("mode","horizontal")("bridgeUiEvents",true),EE(),Ig("opened",i.notificationsSidenavOpened),EE(2),Ig("opened",i.actionsSidenavOpened),EE(2),Bh("actionsSidenav",r),EE(3),Mw(i.upgrade.upgrading()?8:-1);}},dependencies:[ci,ui,Op,Ht$1,yt$3,ta$3,yr$3,ut$b,He$9,ht$a,Te$4,L$5,we$5,Mt$8,Dt$6],styles:[".sidenav-container[_ngcontent-%COMP%]{height:100%;width:100%;--mat-sidenav-scrim-color: color-mix(in srgb, var(--mat-sys-neutral-variant20) 70%, transparent)}mat-sidenav-content[_ngcontent-%COMP%]{overflow-y:hidden;overflow-x:hidden}mat-sidenav[_ngcontent-%COMP%]{box-shadow:0 0 1px 0 var(--kip-contrast-color)}mat-sidenav.sidenav-notifications[_ngcontent-%COMP%]{width:230px;z-index:1200}mat-sidenav.sidenav-actions[_ngcontent-%COMP%]{width:135px;z-index:1200;overflow-x:hidden}.config-upgrade-overlay[_ngcontent-%COMP%]{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#00000073;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:2000;pointer-events:all}.config-upgrade-card[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:18px;padding:20px 24px;width:clamp(300px,60vw,640px);background:var(--kip-background, #1f1f1f);border:1px solid rgba(255,255,255,.18);border-radius:14px;color:var(--kip-contrast-color, #fff);box-shadow:0 6px 22px #0000008c}.config-upgrade-text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 4px;font-size:1.05rem;font-weight:600;letter-spacing:.5px}.config-upgrade-text[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 10px;font-size:.8rem;opacity:.85}.config-upgrade-messages[_ngcontent-%COMP%]{list-style:disc;margin:0;padding-left:18px;max-height:180px;font-size:.68rem;line-height:1.25;scrollbar-width:thin;overflow-y:auto}.config-upgrade-messages[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-bottom:2px}"]})}return t})();var gi=(()=>{class t{auth=w$4(He$4);authToken=null;authTokenSubscription=null;constructor(){this.authTokenSubscription=this.auth.authToken$.subscribe(e=>{this.authToken=e;});}intercept(e,o){let i=e.clone();return this.authToken&&(i=e.clone({headers:e.headers.set("authorization","JWT "+this.authToken.token)})),o.handle(i)}ngOnDestroy(){this.authTokenSubscription?.unsubscribe();}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();var bi=(()=>{class t extends xt$8{_createContainer(){let e=document.createElement("div");e.classList.add("cdk-overlay-container"),(document.getElementById("app-filter-wrapper")||document.querySelector("app-root")||document.body).appendChild(e),this._containerElement=e;}static \u0275fac=(()=>{let e;return function(i){return (e||(e=Sv(t)))(i||t)}})();static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();var yi=(()=>{class t{_router=w$4(G$3);_dialog=w$4(ee$7);_bottomSheet=w$4(DA);_destroyRef=w$4(xe$3);constructor(){this._router.events.pipe(fn$7(e=>e instanceof te$3),Gp(this._destroyRef)).subscribe(()=>{this._dialog.openDialogs.length>0&&this._dialog.closeAll(),this._bottomSheet.dismiss();});}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var vi={modes:{point(t,n){return Fe(t,n,{intersect:true})},nearest(t,n,e){return $r(t,n,e)},x(t,n,e){return Fe(t,n,{intersect:e.intersect,axis:"x"})},y(t,n,e){return Fe(t,n,{intersect:e.intersect,axis:"y"})}}};function bn(t,n,e){return (vi.modes[e.mode]||vi.modes.nearest)(t,n,e)}function Hr(t,n,e){return e!=="x"&&e!=="y"?t.inRange(n.x,n.y,"x",true)||t.inRange(n.x,n.y,"y",true):t.inRange(n.x,n.y,e,true)}function Vr(t,n,e){return e==="x"?{x:t.x,y:n.y}:e==="y"?{x:n.x,y:t.y}:n}function Fe(t,n,e){return t.filter(o=>e.intersect?o.inRange(n.x,n.y):Hr(o,n,e.axis))}function $r(t,n,e){let o=Number.POSITIVE_INFINITY;return Fe(t,n,e).reduce((i,r)=>{let a=r.getCenterPoint(),s=Vr(n,a,e.axis),c=Ie(n,s);return c<o?(i=[r],o=c):c===o&&i.push(r),i},[]).sort((i,r)=>i._index-r._index).slice(0,1)}function Rt(t,n,e){let o=Math.cos(e),i=Math.sin(e),r=n.x,a=n.y;return {x:r+o*(t.x-r)-i*(t.y-a),y:a+i*(t.x-r)+o*(t.y-a)}}var Wr=(t,n)=>n>t||t.length>n.length&&t.slice(0,n.length)===n,At=.001,Ve=(t,n,e)=>Math.min(e,Math.max(n,t)),Ui=(t,n)=>t.value>=t.start-n&&t.value<=t.end+n;function Kr(t,n,e){for(let o of Object.keys(t))t[o]=Ve(t[o],n,e);return t}function qr(t,n,e,o){return !t||!n||e<=0?false:Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)<=Math.pow(e+o,2)}function Bi(t,{x:n,y:e,x2:o,y2:i},r,{borderWidth:a,hitTolerance:s}){let c=(a+s)/2,l=t.x>=n-c-At&&t.x<=o+c+At,d=t.y>=e-c-At&&t.y<=i+c+At;return r==="x"?l:(r==="y"||l)&&d}function Fi(t,{rect:n,center:e},o,{rotation:i,borderWidth:r,hitTolerance:a}){let s=Rt(t,e,it(-i));return Bi(s,n,o,{borderWidth:r,hitTolerance:a})}function Nt(t,n){let{centerX:e,centerY:o}=t.getProps(["centerX","centerY"],n);return {x:e,y:o}}function Yr(t,n,e,o=true){let i=e.split("."),r=0;for(let a of n.split(".")){let s=i[r++];if(parseInt(a,10)<parseInt(s,10))break;if(Wr(s,a)){if(o)throw new Error(`${t} v${e} is not supported. v${n} or newer is required.`);return false}}return true}var Hi=t=>typeof t=="string"&&t.endsWith("%"),Vi=t=>parseFloat(t)/100,$i=t=>Ve(Vi(t),0,1),he=(t,n)=>({x:t,y:n,x2:t,y2:n,width:0,height:0}),Xr={box:t=>he(t.centerX,t.centerY),doughnutLabel:t=>he(t.centerX,t.centerY),ellipse:t=>({centerX:t.centerX,centerY:t.centerX,radius:0,width:0,height:0}),label:t=>he(t.centerX,t.centerY),line:t=>he(t.x,t.y),point:t=>({centerX:t.centerX,centerY:t.centerY,radius:0,width:0,height:0}),polygon:t=>he(t.centerX,t.centerY)};function yn(t,n){return n==="start"?0:n==="end"?t:Hi(n)?$i(n)*t:t/2}function xt(t,n,e=true){return typeof n=="number"?n:Hi(n)?(e?$i(n):Vi(n))*t:t}function Gr(t,n){let{x:e,width:o}=t,i=n.textAlign;return i==="center"?e+o/2:i==="end"||i==="right"?e+o:e}function Wi(t,n,{borderWidth:e,position:o,xAdjust:i,yAdjust:r},a){let s=O(a),c=n.width+(s?a.width:0)+e,l=n.height+(s?a.height:0)+e,d=vn(o),u=_i(t.x,c,i,d.x),f=_i(t.y,l,r,d.y);return {x:u,y:f,x2:u+c,y2:f+l,width:c,height:l,centerX:u+c/2,centerY:f+l/2}}function vn(t,n="center"){return O(t)?{x:P(t.x,n),y:P(t.y,n)}:(t=P(t,n),{x:t,y:t})}var Ki=(t,n)=>t&&t.autoFit&&n<1;function qi(t,n){let e=t.font,o=F(e)?e:[e];return Ki(t,n)?o.map(function(i){let r=j(i);return r.size=Math.floor(i.size*n),r.lineHeight=i.lineHeight,j(r)}):o.map(i=>j(i))}function Yi(t){return t&&(Xt(t.xValue)||Xt(t.yValue))}function _i(t,n,e=0,o){return t-yn(n,o)+e}function ee(t,n,e){let o=e.init;if(o){if(o===true)return Gi(n,e)}else return;return Jr(t,n,e)}function Xi(t,n,e){let o=false;return n.forEach(i=>{ft$1(t[i])?(o=true,e[i]=t[i]):Xt(e[i])&&delete e[i];}),o}function Gi(t,n){let e=n.type||"line";return Xr[e](t)}function Jr(t,n,e){let o=I(e.init,[{chart:t,properties:n,options:e}]);if(o===true)return Gi(n,e);if(O(o))return o}var ln=new Map,Qr=t=>isNaN(t)||t<=0,Zr=t=>t.reduce(function(n,e){return n+=e.string,n},"");function $e(t){if(t&&typeof t=="object"){let n=t.toString();return n==="[object HTMLImageElement]"||n==="[object HTMLCanvasElement]"}}function We(t,{x:n,y:e},o){o&&(t.translate(n,e),t.rotate(it(o)),t.translate(-n,-e));}function ut(t,n){if(n&&n.borderWidth)return t.lineCap=n.borderCapStyle||"butt",t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,t.lineJoin=n.borderJoinStyle||"miter",t.lineWidth=n.borderWidth,t.strokeStyle=n.borderColor,true}function ne(t,n){t.shadowColor=n.backgroundShadowColor,t.shadowBlur=n.shadowBlur,t.shadowOffsetX=n.shadowOffsetX,t.shadowOffsetY=n.shadowOffsetY;}function Ke(t,n){let e=n.content;if($e(e))return {width:xt(e.width,n.width),height:xt(e.height,n.height)};let o=qi(n),i=n.textStrokeWidth,r=F(e)?e:[e],a=r.join()+Zr(o)+i+(t._measureText?"-spriting":"");return ln.has(a)||ln.set(a,oa(t,r,o,i)),ln.get(a)}function Ji(t,n,e){let{x:o,y:i,width:r,height:a}=n;t.save(),ne(t,e);let s=ut(t,e);t.fillStyle=e.backgroundColor,t.beginPath(),Jt$1(t,{x:o,y:i,w:r,h:a,radius:Kr(Pt(e.borderRadius),0,Math.min(r,a)/2)}),t.closePath(),t.fill(),s&&(t.shadowColor=e.borderShadowColor,t.stroke()),t.restore();}function Qi(t,n,e,o){let i=e.content;if($e(i)){t.save(),t.globalAlpha=aa(e.opacity,i.style.opacity),t.drawImage(i,n.x,n.y,n.width,n.height),t.restore();return}let r=F(i)?i:[i],a=qi(e,o),s=e.color,c=F(s)?s:[s],l=Gr(n,e),d=n.y+e.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=e.textAlign,ta(t,e)&&ia(t,{x:l,y:d},r,a),ra(t,{x:l,y:d},r,{fonts:a,colors:c}),t.restore();}function ta(t,n){if(n.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=n.textStrokeWidth,t.strokeStyle=n.textStrokeColor,true}function ea(t,n,e,o){let{radius:i,options:r}=n,a=r.pointStyle,s=r.rotation,c=(s||0)*ga$1;if($e(a)){t.save(),t.translate(e,o),t.rotate(c),t.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),t.restore();return}Qr(i)||na(t,{x:e,y:o,radius:i,rotation:s,style:a,rad:c});}function na(t,{x:n,y:e,radius:o,rotation:i,style:r,rad:a}){let s,c,l,d;switch(t.beginPath(),r){default:t.arc(n,e,o,0,z),t.closePath();break;case "triangle":t.moveTo(n+Math.sin(a)*o,e-Math.cos(a)*o),a+=Es,t.lineTo(n+Math.sin(a)*o,e-Math.cos(a)*o),a+=Es,t.lineTo(n+Math.sin(a)*o,e-Math.cos(a)*o),t.closePath();break;case "rectRounded":d=o*.516,l=o-d,s=Math.cos(a+Lt$1)*l,c=Math.sin(a+Lt$1)*l,t.arc(n-s,e-c,d,a-L,a-N),t.arc(n+c,e-s,d,a-N,a),t.arc(n+s,e+c,d,a,a+N),t.arc(n-c,e+s,d,a+N,a+L),t.closePath();break;case "rect":if(!i){l=Math.SQRT1_2*o,t.rect(n-l,e-l,2*l,2*l);break}a+=Lt$1;case "rectRot":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+c,e-s),t.lineTo(n+s,e+c),t.lineTo(n-c,e+s),t.closePath();break;case "crossRot":a+=Lt$1;case "cross":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c),t.moveTo(n+c,e-s),t.lineTo(n-c,e+s);break;case "star":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c),t.moveTo(n+c,e-s),t.lineTo(n-c,e+s),a+=Lt$1,s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c),t.moveTo(n+c,e-s),t.lineTo(n-c,e+s);break;case "line":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c);break;case "dash":t.moveTo(n,e),t.lineTo(n+Math.cos(a)*o,e+Math.sin(a)*o);break}t.fill();}function oa(t,n,e,o){t.save();let i=n.length,r=0,a=o;for(let s=0;s<i;s++){let c=e[Math.min(s,e.length-1)];t.font=c.string;let l=n[s];r=Math.max(r,t.measureText(l).width+o),a+=c.lineHeight;}return t.restore(),{width:r,height:a}}function ia(t,{x:n,y:e},o,i){t.beginPath();let r=0;o.forEach(function(a,s){let c=i[Math.min(s,i.length-1)],l=c.lineHeight;t.font=c.string,t.strokeText(a,n,e+l/2+r),r+=l;}),t.stroke();}function ra(t,{x:n,y:e},o,{fonts:i,colors:r}){let a=0;o.forEach(function(s,c){let l=r[Math.min(c,r.length-1)],d=i[Math.min(c,i.length-1)],u=d.lineHeight;t.beginPath(),t.font=d.string,t.fillStyle=l,t.fillText(s,n,e+u/2+a),a+=u,t.fill();});}function aa(t,n){let e=It(t)?t:n;return It(e)?Ve(e,0,1):1}var Zi=["left","bottom","top","right"];function sa(t,n){let{pointX:e,pointY:o,options:i}=n,r=i.callout,a=r&&r.display&&fa(n,r);if(!a||ma(n,r,a))return;if(t.save(),t.beginPath(),!ut(t,r))return t.restore();let{separatorStart:c,separatorEnd:l}=ca(n,a),{sideStart:d,sideEnd:u}=da(n,a,c);(r.margin>0||i.borderWidth===0)&&(t.moveTo(c.x,c.y),t.lineTo(l.x,l.y)),t.moveTo(d.x,d.y),t.lineTo(u.x,u.y);let f=Rt({x:e,y:o},n.getCenterPoint(),it(-n.rotation));t.lineTo(f.x,f.y),t.stroke(),t.restore();}function ca(t,n){let{x:e,y:o,x2:i,y2:r}=t,a=la(t,n),s,c;return n==="left"||n==="right"?(s={x:e+a,y:o},c={x:s.x,y:r}):(s={x:e,y:o+a},c={x:i,y:s.y}),{separatorStart:s,separatorEnd:c}}function la(t,n){let{width:e,height:o,options:i}=t,r=i.callout.margin+i.borderWidth/2;return n==="right"?e+r:n==="bottom"?o+r:-r}function da(t,n,e){let{y:o,width:i,height:r,options:a}=t,s=a.callout.start,c=ua(n,a.callout),l,d;return n==="left"||n==="right"?(l={x:e.x,y:o+xt(r,s)},d={x:l.x+c,y:l.y}):(l={x:e.x+xt(i,s),y:e.y},d={x:l.x,y:l.y+c}),{sideStart:l,sideEnd:d}}function ua(t,n){let e=n.side;return t==="left"||t==="top"?-e:e}function fa(t,n){let e=n.position;return Zi.includes(e)?e:ha(t,n)}function ha(t,n){let{x:e,y:o,x2:i,y2:r,width:a,height:s,pointX:c,pointY:l,centerX:d,centerY:u,rotation:f}=t,p={x:d,y:u},m=n.start,b=xt(a,m),y=xt(s,m),_=[e,e+b,e+b,i],w=[o+y,r,o,r],S=[];for(let k=0;k<4;k++){let D=Rt({x:_[k],y:w[k]},p,it(f));S.push({position:Zi[k],distance:Ie(D,{x:c,y:l})});}return S.sort((k,D)=>k.distance-D.distance)[0].position}function ma(t,n,e){let{pointX:o,pointY:i}=t,r=n.margin,a=o,s=i;return e==="left"?a+=r:e==="right"?a-=r:e==="top"?s+=r:e==="bottom"&&(s-=r),t.inRange(a,s)}var Si={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function Jt(t,n,e){return n=typeof n=="number"?n:t.parse(n),W(n)?t.getPixelForValue(n):e}function Ot(t,n,e){let o=n[e];if(o||e==="scaleID")return o;let i=e.charAt(0),r=Object.values(t).filter(a=>a.axis&&a.axis===i);return r.length?r[0].id:i}function tr(t,n){if(t){let e=t.options.reverse,o=Jt(t,n.min,e?n.end:n.start),i=Jt(t,n.max,e?n.start:n.end);return {start:o,end:i}}}function er(t,n){let{chartArea:e,scales:o}=t,i=o[Ot(o,n,"xScaleID")],r=o[Ot(o,n,"yScaleID")],a=e.width/2,s=e.height/2;return i&&(a=Jt(i,n.xValue,i.left+i.width/2)),r&&(s=Jt(r,n.yValue,r.top+r.height/2)),{x:a,y:s}}function _n(t,n){let e=t.scales,o=e[Ot(e,n,"xScaleID")],i=e[Ot(e,n,"yScaleID")];if(!o&&!i)return {};let{left:r,right:a}=o||t.chartArea,{top:s,bottom:c}=i||t.chartArea,l=wi(o,{min:n.xMin,max:n.xMax,start:r,end:a});r=l.start,a=l.end;let d=wi(i,{min:n.yMin,max:n.yMax,start:c,end:s});return s=d.start,c=d.end,{x:r,y:s,x2:a,y2:c,width:a-r,height:c-s,centerX:r+(a-r)/2,centerY:s+(c-s)/2}}function nr(t,n){if(!Yi(n)){let e=_n(t,n),o=n.radius;(!o||isNaN(o))&&(o=Math.min(e.width,e.height)/2,n.radius=o);let i=o*2,r=e.centerX+n.xAdjust,a=e.centerY+n.yAdjust;return {x:r-o,y:a-o,x2:r+o,y2:a+o,centerX:r,centerY:a,width:i,height:i,radius:o}}return ga(t,n)}function pa(t,n){let{scales:e,chartArea:o}=t,i=e[n.scaleID],r={x:o.left,y:o.top,x2:o.right,y2:o.bottom};return i?ba(i,r,n):ya(e,r,n),r}function or(t,n){let e=_n(t,n);return e.initProperties=ee(t,e,n),e.elements=[{type:"label",optionScope:"label",properties:Sa(t,e,n),initProperties:e.initProperties}],e}function ga(t,n){let e=er(t,n),o=n.radius*2;return {x:e.x-n.radius+n.xAdjust,y:e.y-n.radius+n.yAdjust,x2:e.x+n.radius+n.xAdjust,y2:e.y+n.radius+n.yAdjust,centerX:e.x+n.xAdjust,centerY:e.y+n.yAdjust,radius:n.radius,width:o,height:o}}function wi(t,n){let e=tr(t,n)||n;return {start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function ba(t,n,e){let o=Jt(t,e.value,NaN),i=Jt(t,e.endValue,o);t.isHorizontal()?(n.x=o,n.x2=i):(n.y=o,n.y2=i);}function ya(t,n,e){for(let o of Object.keys(Si)){let i=t[Ot(t,e,o)];if(i){let{min:r,max:a,start:s,end:c,startProp:l,endProp:d}=Si[o],u=tr(i,{min:e[r],max:e[a],start:i[s],end:i[c]});n[l]=u.start,n[d]=u.end;}}}function va({properties:t,options:n},e,o,i){let{x:r,x2:a,width:s}=t;return ir({start:r,end:a,borderWidth:n.borderWidth},{position:o.x,padding:{start:i.left,end:i.right},adjust:n.label.xAdjust,size:e.width})}function _a({properties:t,options:n},e,o,i){let{y:r,y2:a,height:s}=t;return ir({start:r,end:a,borderWidth:n.borderWidth},{position:o.y,padding:{start:i.top,end:i.bottom},adjust:n.label.yAdjust,size:e.height})}function ir(t,n){let{start:e,end:o,borderWidth:i}=t,{position:r,padding:{start:a,end:s},adjust:c}=n,l=o-i-e-a-s-n.size;return e+i/2+c+yn(l,r)}function Sa(t,n,e){let o=e.label;o.backgroundColor="transparent",o.callout.display=false;let i=vn(o.position),r=K(o.padding),a=Ke(t.ctx,o),s=va({properties:n,options:e},a,i,r),c=_a({properties:n,options:e},a,i,r),l=a.width+r.width,d=a.height+r.height;return {x:s,y:c,x2:s+l,y2:c+d,width:l,height:d,centerX:s+l/2,centerY:c+d/2,rotation:o.rotation}}var dn=["enter","leave"],Sn=dn.concat("click");function wa(t,n,e){n.listened=Xi(e,Sn,n.listeners),n.moveListened=false,dn.forEach(o=>{ft$1(e[o])&&(n.moveListened=true);}),(!n.listened||!n.moveListened)&&n.annotations.forEach(o=>{!n.listened&&ft$1(o.click)&&(n.listened=true),n.moveListened||dn.forEach(i=>{ft$1(o[i])&&(n.listened=true,n.moveListened=true);});});}function Ca(t,n,e){if(t.listened)switch(n.type){case "mousemove":case "mouseout":return xa(t,n,e);case "click":return Ma(t,n,e)}}function xa(t,n,e){if(!t.moveListened)return;let o;n.type==="mousemove"?o=bn(t.visibleElements,n,e.interaction):o=[];let i=t.hovered;t.hovered=o;let r={state:t,event:n},a=Ci(r,"leave",i,o);return Ci(r,"enter",o,i)||a}function Ci({state:t,event:n},e,o,i){let r;for(let a of o)i.indexOf(a)<0&&(r=rr(a.options[e]||t.listeners[e],a,n)||r);return r}function Ma(t,n,e){let o=t.listeners,i=bn(t.visibleElements,n,e.interaction),r;for(let a of i)r=rr(a.options.click||o.click,a,n)||r;return r}function rr(t,n,e){return I(t,[n.$context,e])===true}var He=["afterDraw","beforeDraw"];function ka(t,n,e){let o=n.visibleElements;n.hooked=Xi(e,He,n.hooks),n.hooked||o.forEach(i=>{n.hooked||He.forEach(r=>{ft$1(i.options[r])&&(n.hooked=true);});});}function xi(t,n,e){if(t.hooked){let o=n.options[e]||t.hooks[e];return I(o,[n.$context])}}function Ia(t,n,e){let o=Ta(t.scales,n,e),i=Mi(n,o,"min","suggestedMin");i=Mi(n,o,"max","suggestedMax")||i,i&&ft$1(n.handleTickRangeOptions)&&n.handleTickRangeOptions();}function Pa(t,n){for(let e of t)Aa(e,n);}function Mi(t,n,e,o){if(W(n[e])&&!Da(t.options,e,o)){let i=t[e]!==n[e];return t[e]=n[e],i}}function Da(t,n,e){return Xt(t[n])||Xt(t[e])}function Aa(t,n){for(let e of ["scaleID","xScaleID","yScaleID"]){let o=Ot(n,t,e);o&&!n[o]&&Oa(t,e)&&console.warn(`No scale found with id '${o}' for annotation '${t.id}'`);}}function Oa(t,n){if(n==="scaleID")return true;let e=n.charAt(0);for(let o of ["Min","Max","Value"])if(Xt(t[e+o]))return true;return false}function Ta(t,n,e){let o=n.axis,i=n.id,r=o+"ScaleID",a={min:P(n.min,Number.NEGATIVE_INFINITY),max:P(n.max,Number.POSITIVE_INFINITY)};for(let s of e)s.scaleID===i?ki(s,n,["value","endValue"],a):Ot(t,s,r)===i&&ki(s,n,[o+"Min",o+"Max",o+"Value"],a);return a}function ki(t,n,e,o){for(let i of e){let r=t[i];if(Xt(r)){let a=n.parse(r);o.min=Math.min(o.min,a),o.max=Math.max(o.max,a);}}}var Mt=class extends ot{inRange(n,e,o,i){let{x:r,y:a}=Rt({x:n,y:e},this.getCenterPoint(i),it(-this.options.rotation));return Bi({x:r,y:a},this.getProps(["x","y","x2","y2"],i),o,this.options)}getCenterPoint(n){return Nt(this,n)}draw(n){n.save(),We(n,this.getCenterPoint(),this.options.rotation),Ji(n,this,this.options),n.restore();}get label(){return this.elements&&this.elements[0]}resolveElementProperties(n,e){return or(n,e)}};Mt.id="boxAnnotation";Mt.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:true,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:false},color:"black",content:null,display:false,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Mt.defaultRoutes={borderColor:"color",backgroundColor:"color"};Mt.descriptors={label:{_fallback:true}};var Qt=class extends ot{inRange(n,e,o,i){return Fi({x:n,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},o,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(n){return Nt(this,n)}draw(n){let e=this.options;!e.display||!e.content||(ja(n,this),n.save(),We(n,this.getCenterPoint(),this.rotation),Qi(n,this,e,this._fitRatio),n.restore());}resolveElementProperties(n,e){let o=Ea(n,e);if(!o)return {};let{controllerMeta:i,point:r,radius:a}=Na(n,e,o),s=Ke(n.ctx,e),c=La(s,a);Ki(e,c)&&(s={width:s.width*c,height:s.height*c});let{position:l,xAdjust:d,yAdjust:u}=e,f=Wi(r,s,{borderWidth:0,position:l,xAdjust:d,yAdjust:u});return z$5(G$b(G$b({initProperties:ee(n,f,e)},f),i),{rotation:e.rotation,_fitRatio:c})}};Qt.id="doughnutLabelAnnotation";Qt.defaults={autoFit:true,autoHide:true,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:true,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0};Qt.defaultRoutes={};function Ea(t,n){return t.getSortedVisibleDatasetMetas().reduce(function(e,o){let i=o.controller;return i instanceof ws$1&&Ra(t,n,o.data)&&(!e||i.innerRadius<e.controller.innerRadius)&&i.options.circumference>=90?o:e},void 0)}function Ra(t,n,e){if(!n.autoHide)return true;for(let o=0;o<e.length;o++)if(!e[o].hidden&&t.getDataVisibility(o))return true}function Na({chartArea:t},n,e){let{left:o,top:i,right:r,bottom:a}=t,{innerRadius:s,offsetX:c,offsetY:l}=e.controller,d=(o+r)/2+c,u=(i+a)/2+l,f={left:Math.max(d-s,o),right:Math.min(d+s,r),top:Math.max(u-s,i),bottom:Math.min(u+s,a)},p={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},m=n.spacing+n.borderWidth/2,b=s-m,y=p.y>u,_=y?i+m:a-m,w=za(_,d,u,b);return {controllerMeta:G$b({_centerX:d,_centerY:u,_radius:b,_counterclockwise:y},w),point:p,radius:Math.min(s,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function La({width:t,height:n},e){let o=Math.sqrt(Math.pow(t,2)+Math.pow(n,2));return e*2/o}function za(t,n,e,o){let i=Math.pow(e-t,2),r=Math.pow(o,2),a=n*-2,s=Math.pow(n,2)+i-r,c=Math.pow(a,2)-4*s;if(c<=0)return {_startAngle:0,_endAngle:z};let l=(-a-Math.sqrt(c))/2,d=(-a+Math.sqrt(c))/2;return {_startAngle:Si$1({x:n,y:e},{x:l,y:t}).angle,_endAngle:Si$1({x:n,y:e},{x:d,y:t}).angle}}function ja(t,n){let{_centerX:e,_centerY:o,_radius:i,_startAngle:r,_endAngle:a,_counterclockwise:s,options:c}=n;t.save();let l=ut(t,c);t.fillStyle=c.backgroundColor,t.beginPath(),t.arc(e,o,i,r,a,s),t.closePath(),t.fill(),l&&t.stroke(),t.restore();}var Tt=class extends ot{inRange(n,e,o,i){return Fi({x:n,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},o,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(n){return Nt(this,n)}draw(n){let e=this.options,o=!Xt(this._visible)||this._visible;!e.display||!e.content||!o||(n.save(),We(n,this.getCenterPoint(),this.rotation),sa(n,this),Ji(n,this,e),Qi(n,Ua(this),e),n.restore());}resolveElementProperties(n,e){let o;if(Yi(e))o=er(n,e);else {let{centerX:s,centerY:c}=_n(n,e);o={x:s,y:c};}let i=K(e.padding),r=Ke(n.ctx,e),a=Wi(o,r,e,i);return z$5(G$b({initProperties:ee(n,a,e),pointX:o.x,pointY:o.y},a),{rotation:e.rotation})}};Tt.id="labelAnnotation";Tt.defaults={adjustScaleRange:true,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:false,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:true,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};Tt.defaultRoutes={borderColor:"color"};function Ua({x:t,y:n,width:e,height:o,options:i}){let r=i.borderWidth/2,a=K(i.padding);return {x:t+a.left+r,y:n+a.top+r,width:e-a.left-a.right-i.borderWidth,height:o-a.top-a.bottom-i.borderWidth}}var wn=(t,n,e)=>({x:t.x+e*(n.x-t.x),y:t.y+e*(n.y-t.y)}),un=(t,n,e)=>wn(n,e,Math.abs((t-n.y)/(e.y-n.y))).x,Ii=(t,n,e)=>wn(n,e,Math.abs((t-n.x)/(e.x-n.x))).y,pe=t=>t*t,Ba=(t,n,{x:e,y:o,x2:i,y2:r},a)=>a==="y"?{start:Math.min(o,r),end:Math.max(o,r),value:n}:{start:Math.min(e,i),end:Math.max(e,i),value:t},Pi=(t,n,e,o)=>(1-o)*(1-o)*t+2*(1-o)*o*n+o*o*e,fn=(t,n,e,o)=>({x:Pi(t.x,n.x,e.x,o),y:Pi(t.y,n.y,e.y,o)}),Di=(t,n,e,o)=>2*(1-o)*(n-t)+2*o*(e-n),Ai=(t,n,e,o)=>-Math.atan2(Di(t.x,n.x,e.x,o),Di(t.y,n.y,e.y,o))+.5*L,qe=(()=>{class t extends ot{inRange(e,o,i,r){let a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){let s={mouseX:e,mouseY:o},{path:c,ctx:l}=this;if(c){ut(l,this.options),l.lineWidth+=this.options.hitTolerance;let{chart:u}=this.$context,f=e*u.currentDevicePixelRatio,p=o*u.currentDevicePixelRatio,m=l.isPointInStroke(c,f,p)||hn(this,s,r);return l.restore(),m}let d=pe(a);return $a(this,s,d,r)||hn(this,s,r)}return Fa(this,{mouseX:e,mouseY:o},i,{hitSize:a,useFinalPosition:r})}getCenterPoint(e){return Nt(this,e)}draw(e){let{x:o,y:i,x2:r,y2:a,cp:s,options:c}=this;if(e.save(),!ut(e,c))return e.restore();ne(e,c);let l=Math.sqrt(Math.pow(r-o,2)+Math.pow(a-i,2));if(c.curve&&s)return Qa(e,this,s,l),e.restore();let{startOpts:d,endOpts:u,startAdjust:f,endAdjust:p}=ar(this),m=Math.atan2(a-i,r-o);e.translate(o,i),e.rotate(m),e.beginPath(),e.moveTo(0+f,0),e.lineTo(l-p,0),e.shadowColor=c.borderShadowColor,e.stroke(),mn(e,0,f,d),mn(e,l,-p,u),e.restore();}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,o){let i=pa(e,o),{x:r,y:a,x2:s,y2:c}=i,l=Ha(i,e.chartArea),d=l?Va({x:r,y:a},{x:s,y:c},e.chartArea):{x:r,y:a,x2:s,y2:c,width:Math.abs(s-r),height:Math.abs(c-a)};if(d.centerX=(s+r)/2,d.centerY=(c+a)/2,d.initProperties=ee(e,d,o),o.curve){let f={x:d.x,y:d.y},p={x:d.x2,y:d.y2};d.cp=Ja(d,o,Ie(f,p));}let u=Wa(e,d,o.label);return u._visible=l,d.elements=[{type:"label",optionScope:"label",properties:u,initProperties:d.initProperties}],d}}return t.id="lineAnnotation",t})(),Oi={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};qe.defaults={adjustScaleRange:true,arrowHeads:{display:false,end:Object.assign({},Oi),fill:false,length:12,start:Object.assign({},Oi),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:false,controlPoint:{y:"-50%"},display:true,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Tt.defaults.callout),color:"#fff",content:null,display:false,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};qe.descriptors={arrowHeads:{start:{_fallback:true},end:{_fallback:true},_fallback:true}};qe.defaultRoutes={borderColor:"color"};function Fa(t,{mouseX:n,mouseY:e},o,{hitSize:i,useFinalPosition:r}){let a=Ba(n,e,t.getProps(["x","y","x2","y2"],r),o);return Ui(a,i)||hn(t,{mouseX:n,mouseY:e},r,o)}function Ha({x:t,y:n,x2:e,y2:o},{top:i,right:r,bottom:a,left:s}){return !(t<s&&e<s||t>r&&e>r||n<i&&o<i||n>a&&o>a)}function Ti({x:t,y:n},e,{top:o,right:i,bottom:r,left:a}){return t<a&&(n=Ii(a,{x:t,y:n},e),t=a),t>i&&(n=Ii(i,{x:t,y:n},e),t=i),n<o&&(t=un(o,{x:t,y:n},e),n=o),n>r&&(t=un(r,{x:t,y:n},e),n=r),{x:t,y:n}}function Va(t,n,e){let{x:o,y:i}=Ti(t,n,e),{x:r,y:a}=Ti(n,t,e);return {x:o,y:i,x2:r,y2:a,width:Math.abs(r-o),height:Math.abs(a-i)}}function $a(t,{mouseX:n,mouseY:e},o=At,i){let{x:r,y:a,x2:s,y2:c}=t.getProps(["x","y","x2","y2"],i),l=s-r,d=c-a,u=pe(l)+pe(d),f=u===0?-1:((n-r)*l+(e-a)*d)/u,p,m;return f<0?(p=r,m=a):f>1?(p=s,m=c):(p=r+f*l,m=a+f*d),pe(n-p)+pe(e-m)<=o}function hn(t,{mouseX:n,mouseY:e},o,i){let r=t.label;return r.options.display&&r.inRange(n,e,i,o)}function Wa(t,n,e){let o=e.borderWidth,i=K(e.padding),r=Ke(t.ctx,e),a=r.width+i.width+o,s=r.height+i.height+o;return qa(n,e,{width:a,height:s,padding:i},t.chartArea)}function Ka(t){let{x:n,y:e,x2:o,y2:i}=t,r=Math.atan2(i-e,o-n);return r>L/2?r-L:r<L/-2?r+L:r}function qa(t,n,e,o){let{width:i,height:r,padding:a}=e,{xAdjust:s,yAdjust:c}=n,l={x:t.x,y:t.y},d={x:t.x2,y:t.y2},u=n.rotation==="auto"?Ka(t):it(n.rotation),f=Ya(i,r,u),p=Xa(t,n,{labelSize:f,padding:a},o),m=t.cp?fn(l,t.cp,d,p):wn(l,d,p),b={size:f.w,min:o.left,max:o.right,padding:a.left},y={size:f.h,min:o.top,max:o.bottom,padding:a.top},_=Ri(m.x,b)+s,w=Ri(m.y,y)+c;return {x:_-i/2,y:w-r/2,x2:_+i/2,y2:w+r/2,centerX:_,centerY:w,pointX:m.x,pointY:m.y,width:i,height:r,rotation:Be$1(u)}}function Ya(t,n,e){let o=Math.cos(e),i=Math.sin(e);return {w:Math.abs(t*o)+Math.abs(n*i),h:Math.abs(t*i)+Math.abs(n*o)}}function Xa(t,n,e,o){let i,r=Ga(t,o);return n.position==="start"?i=Ei({w:t.x2-t.x,h:t.y2-t.y},e,n,r):n.position==="end"?i=1-Ei({w:t.x-t.x2,h:t.y-t.y2},e,n,r):i=yn(1,n.position),i}function Ei(t,n,e,o){let{labelSize:i,padding:r}=n,a=t.w*o.dx,s=t.h*o.dy,c=a>0&&(i.w/2+r.left-o.x)/a,l=s>0&&(i.h/2+r.top-o.y)/s;return Ve(Math.max(c,l),0,.25)}function Ga(t,n){let{x:e,x2:o,y:i,y2:r}=t,a=Math.min(i,r)-n.top,s=Math.min(e,o)-n.left,c=n.bottom-Math.max(i,r),l=n.right-Math.max(e,o);return {x:Math.min(s,l),y:Math.min(a,c),dx:s<=l?1:-1,dy:a<=c?1:-1}}function Ri(t,n){let{size:e,min:o,max:i,padding:r}=n,a=e/2;return e>i-o?(i+o)/2:(o>=t-r-a&&(t=o+r+a),i<=t+r+a&&(t=i-r-a),t)}function ar(t){let n=t.options,e=n.arrowHeads&&n.arrowHeads.start,o=n.arrowHeads&&n.arrowHeads.end;return {startOpts:e,endOpts:o,startAdjust:Ni(t,e),endAdjust:Ni(t,o)}}function Ni(t,n){if(!n||!n.display)return 0;let{length:e,width:o}=n,i=t.options.borderWidth/2,r={x:e,y:o+i};return Math.abs(un(0,r,{x:0,y:i}))}function mn(t,n,e,o){if(!o||!o.display)return;let{length:i,width:r,fill:a,backgroundColor:s,borderColor:c}=o,l=Math.abs(n-i)+e;t.beginPath(),ne(t,o),ut(t,o),t.moveTo(l,-r),t.lineTo(n+e,0),t.lineTo(l,r),a===true?(t.fillStyle=s||c,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=o.borderShadowColor,t.stroke();}function Ja(t,n,e){let{x:o,y:i,x2:r,y2:a,centerX:s,centerY:c}=t,l=Math.atan2(a-i,r-o),d=vn(n.controlPoint,0),u={x:s+xt(e,d.x,false),y:c+xt(e,d.y,false)};return Rt(u,{x:s,y:c},l)}function Li(t,{x:n,y:e},{angle:o,adjust:i},r){!r||!r.display||(t.save(),t.translate(n,e),t.rotate(o),mn(t,0,-i,r),t.restore());}function Qa(t,n,e,o){let{x:i,y:r,x2:a,y2:s,options:c}=n,{startOpts:l,endOpts:d,startAdjust:u,endAdjust:f}=ar(n),p={x:i,y:r},m={x:a,y:s},b=Ai(p,e,m,0),y=Ai(p,e,m,1)-L,_=fn(p,e,m,u/o),w=fn(p,e,m,1-f/o),S=new Path2D;t.beginPath(),S.moveTo(_.x,_.y),S.quadraticCurveTo(e.x,e.y,w.x,w.y),t.shadowColor=c.borderShadowColor,t.stroke(S),n.path=S,n.ctx=t,Li(t,_,{angle:b,adjust:u},l),Li(t,w,{angle:y,adjust:f},d);}var Et=class extends ot{inRange(n,e,o,i){let r=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(o!=="x"&&o!=="y")return Za({x:n,y:e},this.getProps(["width","height","centerX","centerY"],i),r,a);let{x:s,y:c,x2:l,y2:d}=this.getProps(["x","y","x2","y2"],i),u=o==="y"?{start:c,end:d}:{start:s,end:l},f=Rt({x:n,y:e},this.getCenterPoint(i),it(-r));return f[o]>=u.start-a-At&&f[o]<=u.end+a+At}getCenterPoint(n){return Nt(this,n)}draw(n){let{width:e,height:o,centerX:i,centerY:r,options:a}=this;n.save(),We(n,this.getCenterPoint(),a.rotation),ne(n,this.options),n.beginPath(),n.fillStyle=a.backgroundColor;let s=ut(n,a);n.ellipse(i,r,o/2,e/2,L/2,0,2*L),n.fill(),s&&(n.shadowColor=a.borderShadowColor,n.stroke()),n.restore();}get label(){return this.elements&&this.elements[0]}resolveElementProperties(n,e){return or(n,e)}};Et.id="ellipseAnnotation";Et.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:true,hitTolerance:0,init:void 0,label:Object.assign({},Mt.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Et.defaultRoutes={borderColor:"color",backgroundColor:"color"};Et.descriptors={label:{_fallback:true}};function Za(t,n,e,o){let{width:i,height:r,centerX:a,centerY:s}=n,c=i/2,l=r/2;if(c<=0||l<=0)return false;let d=it(e||0),u=Math.cos(d),f=Math.sin(d),p=Math.pow(u*(t.x-a)+f*(t.y-s),2),m=Math.pow(f*(t.x-a)-u*(t.y-s),2);return p/Math.pow(c+o,2)+m/Math.pow(l+o,2)<=1.0001}var Zt=class extends ot{inRange(n,e,o,i){let{x:r,y:a,x2:s,y2:c,width:l}=this.getProps(["x","y","x2","y2","width"],i),d=(this.options.borderWidth+this.options.hitTolerance)/2;return o!=="x"&&o!=="y"?qr({x:n,y:e},this.getCenterPoint(i),l/2,d):Ui(o==="y"?{start:a,end:c,value:e}:{start:r,end:s,value:n},d)}getCenterPoint(n){return Nt(this,n)}draw(n){let e=this.options,o=e.borderWidth;if(e.radius<.1)return;n.save(),n.fillStyle=e.backgroundColor,ne(n,e);let i=ut(n,e);ea(n,this,this.centerX,this.centerY),i&&!$e(e.pointStyle)&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore(),e.borderWidth=o;}resolveElementProperties(n,e){let o=nr(n,e);return o.initProperties=ee(n,o,e),o}};Zt.id="pointAnnotation";Zt.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:true,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};Zt.defaultRoutes={borderColor:"color",backgroundColor:"color"};var te=class extends ot{inRange(n,e,o,i){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&es(this.elements,n,e,i);let r=Rt({x:n,y:e},this.getCenterPoint(i),it(-this.options.rotation)),a=this.elements.map(l=>o==="y"?l.bY:l.bX),s=Math.min(...a),c=Math.max(...a);return r[o]>=s&&r[o]<=c}getCenterPoint(n){return Nt(this,n)}draw(n){let{elements:e,options:o}=this;n.save(),n.beginPath(),n.fillStyle=o.backgroundColor,ne(n,o);let i=ut(n,o),r=true;for(let a of e)r?(n.moveTo(a.x,a.y),r=false):n.lineTo(a.x,a.y);n.closePath(),n.fill(),i&&(n.shadowColor=o.borderShadowColor,n.stroke()),n.restore();}resolveElementProperties(n,e){let o=nr(n,e),{sides:i,rotation:r}=e,a=[],s=2*L/i,c=r*ga$1;for(let l=0;l<i;l++,c+=s){let d=ts(o,e,c);d.initProperties=ee(n,o,e),a.push(d);}return o.elements=a,o}};te.id="polygonAnnotation";te.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:true,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};te.defaultRoutes={borderColor:"color",backgroundColor:"color"};function ts({centerX:t,centerY:n},{radius:e,borderWidth:o,hitTolerance:i},r){let a=(o+i)/2,s=Math.sin(r),c=Math.cos(r),l={x:t+s*e,y:n-c*e};return {type:"point",optionScope:"point",properties:{x:l.x,y:l.y,centerX:l.x,centerY:l.y,bX:t+s*(e+a),bY:n-c*(e+a)}}}function es(t,n,e,o){let i=false,r=t[t.length-1].getProps(["bX","bY"],o);for(let a of t){let s=a.getProps(["bX","bY"],o);s.bY>e!=r.bY>e&&n<(r.bX-s.bX)*(e-s.bY)/(r.bY-s.bY)+s.bX&&(i=!i),r=s;}return i}var Ct={box:Mt,doughnutLabel:Qt,ellipse:Et,label:Tt,line:qe,point:Zt,polygon:te};Object.keys(Ct).forEach(t=>{B.describe(`elements.${Ct[t].id}`,{_fallback:"plugins.annotation.common"});});var ns={update:Object.assign},os=Sn.concat(He),zi=(t,n)=>O(n)?gn(t,n):t,pn=t=>t==="color"||t==="font";function Cn(t="line"){return Ct[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function is(t,n,e,o){let i=as(t,e.animations,o),r=n.annotations,a=ls(n.elements,r);for(let s=0;s<r.length;s++){let c=r[s],l=sr(a,s,c.type),d=c.setContext(cs(t,l,a,c)),u=l.resolveElementProperties(t,d);u.skip=rs(u),"elements"in u&&(ss(l,u.elements,d,i),delete u.elements),Xt(l.x)||Object.assign(l,u),Object.assign(l,u.initProperties),u.options=cr(d),i.update(l,u);}}function rs(t){return isNaN(t.x)||isNaN(t.y)}function as(t,n,e){return e==="reset"||e==="none"||e==="resize"?ns:new ii$1(t,n)}function ss(t,n,e,o){let i=t.elements||(t.elements=[]);i.length=n.length;for(let r=0;r<n.length;r++){let a=n[r],s=a.properties,c=sr(i,r,a.type,a.initProperties),l=e[a.optionScope].override(a);s.options=cr(l),o.update(c,s);}}function sr(t,n,e,o){let i=Ct[Cn(e)],r=t[n];return (!r||!(r instanceof i))&&(r=t[n]=new i,Object.assign(r,o)),r}function cr(t){let n=Ct[Cn(t.type)],e={};e.id=t.id,e.type=t.type,e.drawTime=t.drawTime,Object.assign(e,gn(t,n.defaults),gn(t,n.defaultRoutes));for(let o of os)e[o]=t[o];return e}function gn(t,n){let e={};for(let o of Object.keys(n)){let i=n[o],r=t[o];pn(o)&&F(r)?e[o]=r.map(a=>zi(a,i)):e[o]=zi(r,i);}return e}function cs(t,n,e,o){return n.$context||(n.$context=Object.assign(Object.create(t.getContext()),{element:n,get elements(){return e.filter(i=>i&&i.options)},id:o.id,type:"annotation"}))}function ls(t,n){let e=n.length,o=t.length;if(o<e){let i=e-o;t.splice(o,0,...new Array(i));}else o>e&&t.splice(e,o-e);return t}var ds="3.1.0",wt=new Map,ji=t=>t.type!=="doughnutLabel",us=Sn.concat(He),lr={id:"annotation",version:ds,beforeRegister(){Yr("chart.js","4.0",Wl.version);},afterRegister(){Wl.register(Ct);},afterUnregister(){Wl.unregister(Ct);},beforeInit(t){wt.set(t,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:false,moveListened:false,hooks:{},hooked:false,hovered:[]});},beforeUpdate(t,n,e){let o=wt.get(t),i=o.annotations=[],r=e.annotations;O(r)?Object.keys(r).forEach(a=>{let s=r[a];O(s)&&(s.id=a,i.push(s));}):F(r)&&i.push(...r),Pa(i.filter(ji),t.scales);},afterDataLimits(t,n){let e=wt.get(t);Ia(t,n.scale,e.annotations.filter(ji).filter(o=>o.display&&o.adjustScaleRange));},afterUpdate(t,n,e){let o=wt.get(t);wa(t,o,e),is(t,o,e,n.mode),o.visibleElements=o.elements.filter(i=>!i.skip&&i.options.display),ka(t,o,e);},beforeDatasetsDraw(t,n,e){me(t,"beforeDatasetsDraw",e.clip);},afterDatasetsDraw(t,n,e){me(t,"afterDatasetsDraw",e.clip);},beforeDatasetDraw(t,n,e){me(t,n.index,e.clip);},beforeDraw(t,n,e){me(t,"beforeDraw",e.clip);},afterDraw(t,n,e){me(t,"afterDraw",e.clip);},beforeEvent(t,n,e){let o=wt.get(t);Ca(o,n.event,e)&&(n.changed=true);},afterDestroy(t){wt.delete(t);},getAnnotations(t){let n=wt.get(t);return n?n.elements:[]},_getAnnotationElementsAtEventForMode(t,n,e){return bn(t,n,e)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:true,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:false,label:{}}},descriptors:{_indexable:false,_scriptable:t=>!us.includes(t)&&t!=="init",annotations:{_allKeys:false,_fallback:(t,n)=>`elements.${Ct[Cn(n.type)].id}`},interaction:{_fallback:true},common:{label:{_indexable:pn,_fallback:true},_indexable:pn}},additionalOptionScopes:[""]};function me(t,n,e){let{ctx:o,chartArea:i}=t,r=wt.get(t);e&&de(o,i);let a=fs(r.visibleElements,n).sort((s,c)=>s.element.options.z-c.element.options.z);for(let s of a)hs(o,i,r,s);e&&ue(o);}function fs(t,n){let e=[];for(let o of t)if(o.options.drawTime===n&&e.push({element:o,main:true}),o.elements&&o.elements.length)for(let i of o.elements)i.options.display&&i.options.drawTime===n&&e.push({element:i});return e}function hs(t,n,e,o){let i=o.element;o.main?(xi(e,i,"beforeDraw"),i.draw(t,n),xi(e,i,"afterDraw")):i.draw(t,n);}var ms="3.5.1";function xn(t,n,e){return Math.min(Math.max(t,n),e)}function E(t,n){let e=t.options.realtime,o=t.chart.options.plugins?.streaming;return P(e?.[n],o?.[n])}function Mn(t,{x:n,y:e},{xAxisID:o,yAxisID:i}){let r={};for(let a=0,s=n.length;a<s;++a)r[n[a]]={axisId:o};for(let a=0,s=e.length;a<s;++a)r[e[a]]={axisId:i};return r}var ps=typeof window>"u"?lt:window.cancelAnimationFrame;function dr(t){let n=t.frameRequestID;n&&(ps.call(window,n),delete t.frameRequestID);}function mr(t){let n=t.refreshTimerID;n&&(clearInterval(n),delete t.refreshTimerID,delete t.refreshInterval);}function pr(t,n,e){t.refreshTimerID||(t.refreshTimerID=setInterval(()=>{if(typeof document<"u"&&document.hidden)return;let o=I(n,[],t);t.refreshInterval===o||isNaN(o)||(mr(t),pr(t,n,o));},e||0),t.refreshInterval=e||0);}function et(t,n,e){return n=typeof n=="number"?n:t.parse(n),W(n)?{value:t.getPixelForValue(n),transitionable:true}:{value:e,transitionable:false}}function gs(){let t=dt.getElement("boxAnnotation"),n=dt.getElement("lineAnnotation"),e=dt.getElement("pointAnnotation");if(!t||!n||!e)return;let o=t.prototype.resolveElementProperties,i=n.prototype.resolveElementProperties,r=e.prototype.resolveElementProperties;t.prototype.resolveElementProperties=function(a,s){return (function(c,l,d){let{scales:u,chartArea:f}=l,{xScaleID:p,yScaleID:m,xMin:b,xMax:y,yMin:_,yMax:w}=d,S=u[p],k=u[m],{top:D,left:z,bottom:A,right:x}=f,R=c.$streaming={};if(S){let C=et(S,b,z),I=et(S,y,x),P=C.value>I.value;C.transitionable&&(R[P?"x2":"x"]={axisId:p}),I.transitionable&&(R[P?"x":"x2"]={axisId:p}),C.transitionable!==I.transitionable&&(R.width={axisId:p,reverse:C.transitionable});}if(k){let C=et(k,_,D),I=et(k,w,A),P=C.value>I.value;C.transitionable&&(R[P?"y2":"y"]={axisId:m}),I.transitionable&&(R[P?"y":"y2"]={axisId:m}),C.transitionable!==I.transitionable&&(R.height={axisId:m,reverse:C.transitionable});}})(this,a,s),o.call(this,a,s)},n.prototype.resolveElementProperties=function(a,s){let c=a.chartArea;a.chartArea=(function(d,u,f){let{scales:p,chartArea:m}=u,{scaleID:b,value:y}=f,_=p[b],{top:w,left:S,bottom:k,right:D}=m,z=d.$streaming={};if(_){let F=_.isHorizontal();return et(_,y,0).transitionable&&(z[F?"x":"y"]={axisId:b},z[F?"x2":"y2"]={axisId:b}),F?{top:w,bottom:k}:{left:S,right:D}}let{xScaleID:A,yScaleID:x,xMin:R,xMax:C,yMin:I,yMax:P}=f,N=p[A],O=p[x],B={};if(N){let F=et(N,R,S),X=et(N,C,D);F.transitionable?z.x={axisId:A}:B.left=S,X.transitionable?z.x2={axisId:A}:B.right=D;}if(O){let F=et(O,I,w),X=et(O,P,k);F.transitionable?z.y={axisId:x}:B.top=w,X.transitionable?z.y2={axisId:x}:B.bottom=k;}return B})(this,a,s);let l=i.call(this,a,s);return a.chartArea=c,l},e.prototype.resolveElementProperties=function(a,s){return (function(c,l,d){let u=l.scales,{xScaleID:f,yScaleID:p,xValue:m,yValue:b}=d,y=u[f],_=u[p],w=c.$streaming={};y&&et(y,m,0).transitionable&&(w.x={axisId:f}),_&&et(_,b,0).transitionable&&(w.y={axisId:p});})(this,a,s),r.call(this,a,s)};}var bs={x:["x","caretX"],y:["y","caretY"]};function ys(...t){let n=this,e=n.getActiveElements()[0];if(e){let o=n.chart.getDatasetMeta(e.datasetIndex);n.$streaming=Mn(0,bs,o);}else n.$streaming={};n.constructor.prototype.update.call(n,...t);}var kn=new WeakMap;function In(t){let{originalScaleOptions:n}=(function(o){let i=kn.get(o);return i||(i={originalScaleOptions:{}},kn.set(o,i)),i})(t),e=t.scales;return R(e,o=>{let i=o.id;n[i]||(n[i]={duration:E(o,"duration"),delay:E(o,"delay")});}),R(n,(o,i)=>{e&&e[i]||delete n[i];}),n}function vs(t,n,e,o){let{chart:i}=t,r=t.id,{minDuration:a=0,maxDuration:s=1/0,minDelay:c=-1/0,maxDelay:l=1/0}=o?.[r]||{},d=t.options.realtime,u=E(t,"duration"),f=E(t,"delay"),p=xn(u*(2-n),a,s),m,b;return In(i),m=t.isHorizontal()?(t.right-e.x)/(t.right-t.left):(t.bottom-e.y)/(t.bottom-t.top),b=f+m*(u-p),d.duration=p,d.delay=xn(b,c,l),p!==t.max-t.min}function _s(t,n,e){let{chart:o}=t,i=t.id,{minDelay:r=-1/0,maxDelay:a=1/0}=e?.[i]||{},s=E(t,"delay")+((t.getValueForPixel(n)||0)-(t.getValueForPixel(0)||0));return In(o),t.options.realtime.delay=xn(s,r,a),true}function Ss(t,n){let e=n.$streaming;if(e.zoomPlugin!==t){let o=e.resetZoom=n.resetZoom;((function(i){i.zoomFunctions.realtime=vs,i.panFunctions.realtime=_s;}))(t),n.resetZoom=i=>{((function(r){let a=In(r);R(r.scales,s=>{let c=s.options.realtime;if(c){let l=a[s.id];l?(c.duration=l.duration,c.delay=l.delay):(delete c.duration,delete c.delay);}});}))(n),o(i);},e.zoomPlugin=t;}}function ws(t){let n=t.$streaming;n.zoomPlugin&&(t.resetZoom=n.resetZoom,(function(e){kn.delete(e);})(t),delete n.resetZoom,delete n.zoomPlugin);}var ge={millisecond:{common:true,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:true,size:1e3,steps:[1,2,5,10,15,30]},minute:{common:true,size:6e4,steps:[1,2,5,10,15,30]},hour:{common:true,size:36e5,steps:[1,2,3,6,12]},day:{common:true,size:864e5,steps:[1,2,5]},week:{common:false,size:6048e5,steps:[1,2,3,4]},month:{common:true,size:2628e6,steps:[1,2,3]},quarter:{common:false,size:7884e6,steps:[1,2,3,4]},year:{common:true,size:3154e7}},Lt=Object.keys(ge);function ur(t,n,e){if(e){if(e.length){let{lo:o,hi:i}=Ve$1(e,n);t[e[o]>=n?e[o]:e[i]]=true;}}else t[n]=true;}var fr=["pointBackgroundColor","pointBorderColor","pointBorderWidth","pointRadius","pointRotation","pointStyle","pointHitRadius","pointHoverBackgroundColor","pointHoverBorderColor","pointHoverBorderWidth","pointHoverRadius","backgroundColor","borderColor","borderSkipped","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","radius","rotation"];function Ye(t,n,e){let o=t.$streaming;if(!o)return;let i=t.$animations||{},r=e;for(let a in o){let s=o[a];if(s.axisId===n){let c=s.reverse?-r:r,l=i[a];W(t[a])&&(t[a]-=c),l&&(l._from-=c,l._to-=c);}}}var ft=class extends ks$1{constructor(n){super(n),this.$realtime={};}init(n,e){let o=this;super.init.call(o,n),(function(i){if(typeof console<"u"&&console.warn){let r=E(i,"duration"),a=E(i,"delay"),s=E(i,"frameRate"),c=E(i,"refresh");(typeof r!="number"||r<=0)&&console.warn("Chart streaming: duration should be a positive number"),typeof a!="number"&&console.warn("Chart streaming: delay should be a number"),(typeof s!="number"||s<=0)&&console.warn("Chart streaming: frameRate should be a positive number"),(typeof c!="number"||c<=0)&&console.warn("Chart streaming: refresh should be a positive number");}})(o),pr(o.$realtime,()=>{let i=o.chart;try{let r=E(o,"onRefresh");return typeof r=="function"&&I(r,[i],o),(function(a){let{chart:s,id:c,max:l}=a,d=E(a,"duration"),u=E(a,"delay"),f=E(a,"ttl"),p=E(a,"pause"),m=Date.now()-(isNaN(f)?d+u:f),b,y,_,w;R(s.data.datasets,(S,k)=>{let D=s.getDatasetMeta(k),z=c===D.xAxisID?"x":c===D.yAxisID&&"y";if(z){let A=D.controller,x=S.data,R=x.length;if(p){for(b=0;b<R;++b){let C=A.getParsed&&typeof A.getParsed=="function"?A.getParsed(b):Array.isArray(x[b])?{x:x[b][0],y:x[b][1]}:x[b];if(C&&!(C[z]<l))break}y=b+2;}else y=0;for(b=y;b<R;++b){let C=A.getParsed&&typeof A.getParsed=="function"?A.getParsed(b):Array.isArray(x[b])?{x:x[b][0],y:x[b][1]}:x[b];if(!(C&&C[z]<=m))break}if(_=b-y,isNaN(f)&&(_=Math.max(_-2,0)),_>0){x.splice(y,_);for(let P=0,N=fr.length;P<N;++P){let O=fr[P];F(S[O])&&S[O].splice(y,_);}let C=S.datalabels;if(C)for(let P in C)F(C[P])&&C[P].splice(y,_);typeof x[0]!="object"&&(w={start:y,count:_});let I=s._active;if(I&&I.length>0)for(let P=I.length-1;P>=0;P--){let N=I[P];N.datasetIndex===k&&(N.index>=y+_?N.index-=_:N.index>=y&&I.splice(P,1));}}}}),w&&s.data.labels?.splice(w.start,w.count);})(o),i.update("quiet"),E(o,"refresh")}catch(r){return typeof console<"u"&&console.error&&console.error("Error in streaming refresh:",r),1e3}});}update(n,e,o){let i=this,{$realtime:r,options:a}=i,{bounds:s,offset:c,ticks:l}=a,{autoSkip:d,source:u,major:f}=l,p=f.enabled;E(i,"pause")?dr(r):(r.frameRequestID||(r.head=Date.now()),(function(m,b){if(!m.frameRequestID){let y=()=>{if(typeof document<"u"&&document.hidden)return void(m.frameRequestID=Ci$1.call(window,y));let _=m.nextRefresh||0,w=Date.now();if(_<=w){let S=I(b,[],m),k=1e3/(Math.max(S,0)||30),D=(m.nextRefresh||0)+k||0;m.nextRefresh=D>w?D:w+k;}m.frameRequestID=Ci$1.call(window,y);};m.frameRequestID=Ci$1.call(window,y);}})(r,()=>{let m=i.chart,b=m.$streaming;return (function(y){let{chart:_,id:w,$realtime:S}=y,k=E(y,"duration"),D=E(y,"delay"),z=y.isHorizontal(),A=z?y.width:y.height,x=Date.now(),R=_.tooltip,C=(function(O){let B=O.$streaming?.annotationPlugin;return B?B.getAnnotations(O):[]})(_),I=A*(x-S.head)/k;z===!!y.options.reverse&&(I=-I);let P=_.data.datasets.length;for(let O=0;O<P;++O){let B=_.getDatasetMeta(O),{data:F=[],dataset:X}=B,oe=F.length;for(let ie=0;ie<oe;++ie)Ye(F[ie],w,I);X&&(Ye(X,w,I),delete X._path);}let N=C.length;for(let O=0;O<N;++O)Ye(C[O],w,I);R&&Ye(R,w,I),y.max=x-D,y.min=y.max-k,S.head=x;})(i),b&&I(b.render,[m]),E(i,"frameRate")})),a.bounds=void 0,a.offset=false,l.autoSkip=false,l.source=u==="auto"?"":u,f.enabled=true,super.update.call(i,n,e,o),a.bounds=s,a.offset=c,l.autoSkip=d,l.source=u,f.enabled=p;}buildTicks(){let n=this,e=E(n,"duration"),o=E(n,"delay"),i=n.$realtime.head-o,r=i-e,a=[1e15,i],s=[-1e15,r];Object.defineProperty(n,"min",{get:()=>s.shift(),set:lt,configurable:true}),Object.defineProperty(n,"max",{get:()=>a.shift(),set:lt,configurable:true});let c=super.buildTicks.call(n);return delete n.min,delete n.max,n.min=r,n.max=i,c}calculateLabelRotation(){let n=this.options.ticks,e=n.maxRotation;n.maxRotation=n.minRotation||0,super.calculateLabelRotation.call(this),n.maxRotation=e;}fit(){let n=this,e=n.options;super.fit.call(n),e.ticks.display&&e.display&&n.isHorizontal()&&(n.paddingLeft=3,n.paddingRight=3,n._handleMargins());}draw(n){let e=this,{chart:o,ctx:i}=e,r=e.isHorizontal()?{left:n.left,top:0,right:n.right,bottom:o.height}:{left:0,top:n.top,right:o.width,bottom:n.bottom};e._gridLineItems=null,e._labelItems=null,de(i,r),super.draw.call(e,n),ue(i);}destroy(){let n=this.$realtime;dr(n),mr(n);}_generate(){let n=this,e=n._adapter,o=E(n,"duration"),i=E(n,"delay"),r=E(n,"refresh"),a=n.$realtime.head-i,s=a-o,c=n._getLabelCapacity(s),{time:l,ticks:d}=n.options,u=l.unit||(function(A,x,R,C){let I=R-x,P=Lt.length;for(let N=Lt.indexOf(A);N<P-1;++N){let O=Lt[N],B=ge[O];if(!B)continue;let{common:F,size:X,steps:oe}=B,ie=oe?oe[oe.length-1]:Number.MAX_SAFE_INTEGER;if(F&&Math.ceil(I/(ie*X))<=C)return O}return Lt[P-1]})(l.minUnit,s,a,c),f=(function(A){for(let x=Lt.indexOf(A)+1,R=Lt.length;x<R;++x){let C=Lt[x];if(ge[C]?.common)return C}})(u),p=l.stepSize||(function(A,x,R,C){let I=x-A,P=ge[R];if(!P)return 1;let{size:N,steps:O}=P,B=1;if(!O)return Math.ceil(I/(C*N));for(let F=0,X=O.length;F<X&&(B=O[F],!(Math.ceil(I/(N*B))<=C));++F);return B||1})(s,a,u,c),m=u==="week"&&l.isoWeekday,b=d.major.enabled,y=It(m)||m===true,_=ge[u],w={},S,k,D=s;if(y&&(D=+e.startOf(D,"isoWeek",m)),D=+e.startOf(D,y?"day":u),e.diff(a,s,u)>1e5*p)throw new Error(s+" and "+a+" are too far apart with stepSize of "+p+" "+u);S=D,b&&f&&!y&&!l.round&&(S=+e.startOf(S,f),S=+e.add(S,~~((D-S)/(_.size*p))*p,u));let z=d.source==="data"&&n.getDataTimestamps();for(k=0;S<a+r;S=+e.add(S,p,u),k++)ur(w,S,z);return S!==a+r&&k!==1||ur(w,S,z),Object.keys(w).sort((A,x)=>+A-+x).map(A=>+A)}};ft.id="realtime",ft.defaults={bounds:"data",adapters:{},time:{parser:false,unit:false,round:false,isoWeekday:false,minUnit:"millisecond",displayFormats:{}},realtime:{},ticks:{autoSkip:false,source:"auto",major:{enabled:true}}},B.describe("scale.realtime",{_scriptable:t=>t!=="onRefresh"});var Cs=ms;B.set("transitions",{quiet:{animation:{duration:0}}});var hr={x:["x","cp1x","cp2x"],y:["y","cp1y","cp2y"]};function xs(t){let n=this;t==="quiet"&&R(n.data.datasets,(e,o)=>{let i=n.getDatasetMeta(o).controller;i&&(i._setStyle=function(r,a,s,c){At$1.prototype._setStyle.call(this,r,a,"quiet",c);});}),Wl.prototype.update.call(n,t),t==="quiet"&&R(n.data.datasets,(e,o)=>{let i=n.getDatasetMeta(o).controller;i&&delete i._setStyle;});}function Ms(t){let n=t.$streaming;t.render(),n.lastMouseEvent&&setTimeout(()=>{let e=n.lastMouseEvent;e&&t._eventHandler(e);},0);}var ks={id:"streaming",version:Cs,beforeInit(t){let n=t.$streaming=t.$streaming||{render:Ms},e=n.canvas=t.canvas,o=n.mouseEventListener=i=>{let r=Ct$1(i,t);n.lastMouseEvent={type:"mousemove",chart:t,native:i,x:r.x,y:r.y};};if(e.addEventListener("mousedown",o),e.addEventListener("mouseup",o),typeof document<"u"&&document.addEventListener){let i=()=>{if(!document.hidden){let r=t.scales;r&&Object.keys(r).forEach(a=>{let s=r[a];s&&s instanceof ft&&s.$realtime&&(s.$realtime.head=Date.now());});}};document.addEventListener("visibilitychange",i),n.visibilityChangeListener=i;}},afterInit(t){t.update=xs;},beforeUpdate(t){let{scales:n,elements:e}=t.options,o=t.tooltip;n&&R(n,i=>{i?.type==="realtime"&&e&&(e.line.capBezierPoints=false);}),o&&(o.update=ys);try{let i=dt.getPlugin("annotation");i&&(function(r,a){let s=a.$streaming;if(s.annotationPlugin!==r){let c=r.afterUpdate;gs(),s.annotationPlugin=r,r.afterUpdate=function(l,d,u){let f=d.mode,p=u.animation;f==="quiet"&&(u.animation=!1),c.call(this,l,d,u),f==="quiet"&&(u.animation=p);};}})(i,t);}catch(i){(function(r){delete r.$streaming.annotationPlugin;})(t);}try{let i=dt.getPlugin("zoom");i&&Ss(i,t);}catch(i){ws(t);}},beforeDatasetUpdate(t,n){let{meta:e,mode:o}=n;if(o==="quiet"){let{controller:i,$animations:r}=e;r&&r.visible&&r.visible._active&&(i.updateElement=lt,i.updateSharedOptions=lt);}},afterDatasetUpdate(t,n){let{meta:e,mode:o}=n,{data:i=[],dataset:r,controller:a}=e;for(let s=0,c=i.length;s<c;++s)i[s].$streaming=Mn(i[s],hr,e);r&&(r.$streaming=Mn(0,hr,e)),o==="quiet"&&(delete a.updateElement,delete a.updateSharedOptions);},beforeDatasetDraw(t,n){let{ctx:e,chartArea:o,width:i,height:r}=t,{xAxisID:a,yAxisID:s,controller:c}=n.meta,l={left:0,top:0,right:i,bottom:r};a&&c.getScaleForId(a)instanceof ft&&(l.left=o.left,l.right=o.right),s&&c.getScaleForId(s)instanceof ft&&(l.top=o.top,l.bottom=o.bottom),de(e,l);},afterDatasetDraw(t){ue(t.ctx);},beforeEvent(t,n){let e=t.$streaming,o=n.event;o?.type==="mousemove"?e.lastMouseEvent=o:o?.type==="mouseout"&&delete e.lastMouseEvent;},afterDestroy(t){let{scales:n,tooltip:e}=t,o=t.$streaming,{canvas:i,mouseEventListener:r,visibilityChangeListener:a}=o;delete t.update,e&&delete e.update,i.removeEventListener("mousedown",r),i.removeEventListener("mouseup",r),a&&typeof document<"u"&&document.removeEventListener&&document.removeEventListener("visibilitychange",a),R(n,s=>{s instanceof ft&&s.destroy();});},defaults:{duration:1e4,delay:0,frameRate:30,refresh:1e3,onRefresh:null,pause:false,ttl:void 0},descriptors:{_scriptable:t=>t!=="onRefresh"}},Pn=[ks,ft];Wl.register(Pn);Wl.register(lr,Pn,rh,Vc,$c,Tr$1,li$1,_s$1,ic,Kc,ks$1,Xc,ih);ws$3(pi,{providers:[WT(),zj(),Ku(xs$3),{provide:yo$3,useClass:gi,multi:true},{provide:Ke$7,useValue:{hasBackdrop:true,disableClose:false,autoFocus:"first-tabbable",delayFocusTrap:true,backdropClass:"dialogBackdrop"}},{provide:ot$8,useValue:{appearance:"outline",floatLabel:"always",subscriptSizing:"dynamic"}},{provide:st,useValue:{showDelay:1500,hideDelay:0}},He$4,De$2,T$2,I$2,We$3,K$3,G$2,ut$2,fe,Gi$3,O$1,l,Ge$3,Zn$4(),Xs$2(qs$2(),Js$2()),Xo$2(ii,ea$3()),{provide:xt$8,useClass:bi},iw(()=>w$4(fe).initNetworkServices()),iw(()=>{w$4(yi);})]});export{$j as $,re$5 as A,Bh as B,Ff as C,Dt$9 as D,Em as E,Fa$5 as F,Gi$3 as G,Dr$4 as H,zA as I,JD as J,Kw as K,Fp as L,Mw as M,N$1 as N,Op as O,Pi$5 as P,Qn$4 as Q,Rp as R,ca$4 as S,TT as T,Kh as U,L$5 as V,Wp as W,xw as X,Aw as Y,TI as Z,_w as _,G$2 as a,Zr$4 as a$,_$5 as a0,vA as a1,Jt$8 as a2,Xt$5 as a3,Zt$7 as a4,st$7 as a5,Lr$5 as a6,Gj as a7,H$7 as a8,ru as a9,gg as aA,gr$6 as aB,L$7 as aC,Ce$6 as aD,Sr$6 as aE,Pr$5 as aF,tD as aG,j$5 as aH,ms$4 as aI,wm as aJ,wr$5 as aK,me$4 as aL,At$8 as aM,wt$a as aN,Sn$5 as aO,Nt$5 as aP,ee$7 as aQ,lt$3 as aR,De$2 as aS,T$2 as aT,I$2 as aU,We$3 as aV,w$1 as aW,He$4 as aX,xe$3 as aY,R$4 as aZ,Gp as a_,N$7 as aa,te$9 as ab,Mr$4 as ac,Qe$a as ad,be$5 as ae,Tu as af,bu as ag,nn$6 as ah,Ar$5 as ai,zm as aj,nw as ak,Zj as al,LT as am,Hh as an,ue$7 as ao,Ki$5 as ap,Bn$5 as aq,S$5 as ar,ke$3 as as,Tp$1 as at,be$4 as au,_t$9 as av,Cu as aw,ry as ax,lv as ay,Yj as az,wt$3 as b,Jh as b$,Wl as b0,U$2 as b1,Ln$3 as b2,Gn$4 as b3,Xe$5 as b4,Pn$5 as b5,kn$5 as b6,ft$6 as b7,Ht$5 as b8,rn$3 as b9,Ft$2 as bA,F$2 as bB,Qa$4 as bC,HT as bD,$T as bE,w$2 as bF,Bj as bG,ln$4 as bH,Lt$4 as bI,va$4 as bJ,an$3 as bK,ft$5 as bL,Ge$3 as bM,Hn$4 as bN,ve$2 as bO,si$2 as bP,Dn$4 as bQ,ot$e as bR,oa$5 as bS,Lg as bT,jt$6 as bU,Gw as bV,zw as bW,L$4 as bX,m$4 as bY,Po$4 as bZ,Gh as b_,Qt$6 as ba,rt$7 as bb,ae$3 as bc,an$4 as bd,It$4 as be,Kt$3 as bf,mt$1 as bg,xp$1 as bh,Eg as bi,ST as bj,cD as bk,Jw as bl,Ig as bm,FT as bn,lD as bo,gl$2 as bp,yg as bq,vg as br,dp as bs,u$3 as bt,ut$2 as bu,Tn$4 as bv,Bn$4 as bw,Wn$4 as bx,gn$4 as by,hn$3 as bz,$h as c,Wh as c$,Zw as c0,Yw as c1,bh$1 as c2,Qs$2 as c3,Fn$5 as c4,Ut$7 as c5,Ii$5 as c6,Ir$5 as c7,Sv as c8,Sh$1 as c9,Te$4 as cA,Mt$8 as cB,Dt$6 as cC,V as cD,Xl$2 as cE,Un$5 as cF,Ht$1 as cG,R$1 as cH,ee$2 as cI,Nt$1 as cJ,Lt$2 as cK,vb as cL,yb as cM,Wl$2 as cN,eu$1 as cO,Z$9 as cP,ce$4 as cQ,zt$1 as cR,pl$2 as cS,hl$2 as cT,$n$4 as cU,Td as cV,Ur$4 as cW,Xt$7 as cX,Io$3 as cY,Tm as cZ,Fm as c_,Kh$1 as ca,E$5 as cb,fn$7 as cc,N$6 as cd,Ri$5 as ce,xh$1 as cf,Ct$b as cg,Wo$3 as ch,dl$2 as ci,fl$2 as cj,Nr$4 as ck,G$a as cl,Kj as cm,wd as cn,Mr$5 as co,Uh as cp,ie$5 as cq,mg as cr,Sw as cs,Lh as ct,T as cu,G$b as cv,z$5 as cw,ut$b as cx,He$9 as cy,ht$a as cz,ig as d,zl$2 as d$,dh$1 as d0,Hj as d1,wt$9 as d2,ib as d3,gi$6 as d4,jt$9 as d5,_$4 as d6,Ce$5 as d7,Y$9 as d8,Cm as d9,UT as dA,Gl$2 as dB,x$2 as dC,_ as dD,RT as dE,l as dF,rn$1 as dG,ac$1 as dH,cn$1 as dI,nc$1 as dJ,qn$1 as dK,zn$1 as dL,pa$2 as dM,Q$6 as dN,fp$1 as dO,pp$1 as dP,AT as dQ,Fr$1 as dR,Da$4 as dS,wg as dT,NT as dU,Vj as dV,Zh as dW,xT as dX,O$1 as dY,yr$5 as dZ,vl$2 as d_,Qm as da,Dm as db,O$6 as dc,$e$8 as dd,Nt$8 as de,Vt$6 as df,pt$8 as dg,zt$6 as dh,jt$7 as di,Nw as dj,Vh as dk,E$1 as dl,G$4 as dm,ge$5 as dn,n as dp,Ht$6 as dq,Ot$6 as dr,bt$5 as ds,nt$9 as dt,p as du,rt$3 as dv,S as dw,n$1 as dx,K$3 as dy,es$3 as dz,EE as e,lm as e0,H as e1,Xa$4 as e2,v as e3,_$2 as e4,I$3 as e5,aw as e6,ln$3 as e7,II as e8,a$1 as e9,K$4 as ea,rw as eb,eg as f,qw as g,Fw as h,ir$4 as i,jT as j,Qh as k,ud as l,dd as m,G$3 as n,eu as o,R$2 as p,qo$1 as q,f$2 as r,sg as s,pT as t,ul$2 as u,vt$9 as v,w$4 as w,DA as x,yt$3 as y,za$4 as z};
7109
+ `):e}function qc(e,i){let{element:t,datasetIndex:s,index:n}=i,o=e.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return {chart:e,label:a,parsed:o.getParsed(n),raw:e.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:t}}function so(e,i){let t=e.chart.ctx,{body:s,footer:n,title:o}=e,{boxWidth:a,boxHeight:r}=i,l=j(i.bodyFont),c=j(i.titleFont),h=j(i.footerFont),d=o.length,u=n.length,f=s.length,p=K(i.padding),g=p.height,m=0,b=s.reduce((M,_)=>M+_.before.length+_.lines.length+_.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*i.titleSpacing+i.titleMarginBottom),b){let M=i.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=f*M+(b-f)*l.lineHeight+(b-1)*i.bodySpacing;}u&&(g+=i.footerMarginTop+u*h.lineHeight+(u-1)*i.footerSpacing);let x=0,y=function(M){m=Math.max(m,t.measureText(M).width+x);};return t.save(),t.font=c.string,R(e.title,y),t.font=l.string,R(e.beforeBody.concat(e.afterBody),y),x=i.displayColors?a+2+i.boxPadding:0,R(s,M=>{R(M.before,y),R(M.lines,y),R(M.after,y);}),x=0,t.font=h.string,R(e.footer,y),t.restore(),m+=p.width,{width:m,height:g}}function Gc(e,i){let{y:t,height:s}=i;return t<s/2?"top":t>e.height-s/2?"bottom":"center"}function Jc(e,i,t,s){let{x:n,width:o}=s,a=t.caretSize+t.caretPadding;if(e==="left"&&n+o+a>i.width||e==="right"&&n-o-a<0)return true}function Zc(e,i,t,s){let{x:n,width:o}=t,{width:a,chartArea:{left:r,right:l}}=e,c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Jc(c,e,i,t)&&(c="center"),c}function no(e,i,t){let s=t.yAlign||i.yAlign||Gc(e,t);return {xAlign:t.xAlign||i.xAlign||Zc(e,i,t,s),yAlign:s}}function Qc(e,i){let{x:t,width:s}=e;return i==="right"?t-=s:i==="center"&&(t-=s/2),t}function th(e,i,t){let{y:s,height:n}=e;return i==="top"?s+=t:i==="bottom"?s-=n+t:s-=n/2,s}function oo(e,i,t,s){let{caretSize:n,caretPadding:o,cornerRadius:a}=e,{xAlign:r,yAlign:l}=t,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Pt(a),p=Qc(i,r),g=th(i,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(h,u)+n:r==="right"&&(p+=Math.max(d,f)+n),{x:Y(p,0,s.width-i.width),y:Y(g,0,s.height-i.height)}}function Ze(e,i,t){let s=K(t.padding);return i==="center"?e.x+e.width/2:i==="right"?e.x+e.width-s.right:e.x+s.left}function ao(e){return ht([],xt$1(e))}function eh(e,i,t){return mt(e,{tooltip:i,tooltipItems:t,type:"tooltip"})}function ro(e,i){let t=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return t?e.override(t):e}var Vo={beforeTitle:lt,title(e){if(e.length>0){let i=e[0],t=i.chart.data.labels,s=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return i.dataset.label||"";if(i.label)return i.label;if(s>0&&i.dataIndex<s)return t[i.dataIndex]}return ""},afterTitle:lt,beforeBody:lt,beforeLabel:lt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let i=e.dataset.label||"";i&&(i+=": ");let t=e.formattedValue;return A(t)||(i+=t),i},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return {borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return {pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:lt,afterBody:lt,beforeFooter:lt,footer:lt,afterFooter:lt};function Z(e,i,t,s){let n=e[i].call(t,s);return typeof n>"u"?Vo[i].call(t,s):n}var lo=(()=>{class e extends ot{static positioners=_e;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0;}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0;}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let s=this.chart,n=this.options.setContext(this.getContext()),o=n.enabled&&s.options.animation&&n.animations,a=new ii$1(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){return this.$context||(this.$context=eh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,s){let{callbacks:n}=s,o=Z(n,"beforeTitle",this,t),a=Z(n,"title",this,t),r=Z(n,"afterTitle",this,t),l=[];return l=ht(l,xt$1(o)),l=ht(l,xt$1(a)),l=ht(l,xt$1(r)),l}getBeforeBody(t,s){return ao(Z(s.callbacks,"beforeBody",this,t))}getBody(t,s){let{callbacks:n}=s,o=[];return R(t,a=>{let r={before:[],lines:[],after:[]},l=ro(n,a);ht(r.before,xt$1(Z(l,"beforeLabel",this,a))),ht(r.lines,Z(l,"label",this,a)),ht(r.after,xt$1(Z(l,"afterLabel",this,a))),o.push(r);}),o}getAfterBody(t,s){return ao(Z(s.callbacks,"afterBody",this,t))}getFooter(t,s){let{callbacks:n}=s,o=Z(n,"beforeFooter",this,t),a=Z(n,"footer",this,t),r=Z(n,"afterFooter",this,t),l=[];return l=ht(l,xt$1(o)),l=ht(l,xt$1(a)),l=ht(l,xt$1(r)),l}_createItems(t){let s=this._active,n=this.chart.data,o=[],a=[],r=[],l=[],c,h;for(c=0,h=s.length;c<h;++c)l.push(qc(this.chart,s[c]));return t.filter&&(l=l.filter((d,u,f)=>t.filter(d,u,f,n))),t.itemSort&&(l=l.sort((d,u)=>t.itemSort(d,u,n))),R(l,d=>{let u=ro(t.callbacks,d);o.push(Z(u,"labelColor",this,d)),a.push(Z(u,"labelPointStyle",this,d)),r.push(Z(u,"labelTextColor",this,d));}),this.labelColors=o,this.labelPointStyles=a,this.labelTextColors=r,this.dataPoints=l,l}update(t,s){let n=this.options.setContext(this.getContext()),o=this._active,a,r=[];if(!o.length)this.opacity!==0&&(a={opacity:0});else {let l=_e[n.position].call(this,o,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);let c=this._size=so(this,n),h=Object.assign({},l,c),d=no(this.chart,n,h),u=oo(n,h,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,a={opacity:1,x:u.x,y:u.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y};}this._tooltipItems=r,this.$context=void 0,a&&this._resolveAnimations().update(this,a),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s});}drawCaret(t,s,n,o){let a=this.getCaretPosition(t,n,o);s.lineTo(a.x1,a.y1),s.lineTo(a.x2,a.y2),s.lineTo(a.x3,a.y3);}getCaretPosition(t,s,n){let{xAlign:o,yAlign:a}=this,{caretSize:r,cornerRadius:l}=n,{topLeft:c,topRight:h,bottomLeft:d,bottomRight:u}=Pt(l),{x:f,y:p}=t,{width:g,height:m}=s,b,x,y,M,_,v;return a==="center"?(_=p+m/2,o==="left"?(b=f,x=b-r,M=_+r,v=_-r):(b=f+g,x=b+r,M=_-r,v=_+r),y=b):(o==="left"?x=f+Math.max(c,d)+r:o==="right"?x=f+g-Math.max(h,u)-r:x=this.caretX,a==="top"?(M=p,_=M-r,b=x-r,y=x+r):(M=p+m,_=M+r,b=x+r,y=x-r),v=M),{x1:b,x2:x,x3:y,y1:M,y2:_,y3:v}}drawTitle(t,s,n){let o=this.title,a=o.length,r,l,c;if(a){let h=Ft(n.rtl,this.x,this.width);for(t.x=Ze(this,n.titleAlign,n),s.textAlign=h.textAlign(n.titleAlign),s.textBaseline="middle",r=j(n.titleFont),l=n.titleSpacing,s.fillStyle=n.titleColor,s.font=r.string,c=0;c<a;++c)s.fillText(o[c],h.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+l,c+1===a&&(t.y+=n.titleMarginBottom-l);}}_drawColorBox(t,s,n,o,a){let r=this.labelColors[n],l=this.labelPointStyles[n],{boxHeight:c,boxWidth:h}=a,d=j(a.bodyFont),u=Ze(this,"left",a),f=o.x(u),p=c<d.lineHeight?(d.lineHeight-c)/2:0,g=s.y+p;if(a.usePointStyle){let m={radius:Math.min(h,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},b=o.leftForLtr(f,h)+h/2,x=g+c/2;t.strokeStyle=a.multiKeyBackground,t.fillStyle=a.multiKeyBackground,He$1(t,m,b,x),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,He$1(t,m,b,x);}else {t.lineWidth=O(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;let m=o.leftForLtr(f,h),b=o.leftForLtr(o.xPlus(f,1),h-2),x=Pt(r.borderRadius);Object.values(x).some(y=>y!==0)?(t.beginPath(),t.fillStyle=a.multiKeyBackground,Jt$1(t,{x:m,y:g,w:h,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Jt$1(t,{x:b,y:g+1,w:h-2,h:c-2,radius:x}),t.fill()):(t.fillStyle=a.multiKeyBackground,t.fillRect(m,g,h,c),t.strokeRect(m,g,h,c),t.fillStyle=r.backgroundColor,t.fillRect(b,g+1,h-2,c-2));}t.fillStyle=this.labelTextColors[n];}drawBody(t,s,n){let{body:o}=this,{bodySpacing:a,bodyAlign:r,displayColors:l,boxHeight:c,boxWidth:h,boxPadding:d}=n,u=j(n.bodyFont),f=u.lineHeight,p=0,g=Ft(n.rtl,this.x,this.width),m=function(w){s.fillText(w,g.x(t.x+p),t.y+f/2),t.y+=f+a;},b=g.textAlign(r),x,y,M,_,v,S,k;for(s.textAlign=r,s.textBaseline="middle",s.font=u.string,t.x=Ze(this,b,n),s.fillStyle=n.bodyColor,R(this.beforeBody,m),p=l&&b!=="right"?r==="center"?h/2+d:h+2+d:0,_=0,S=o.length;_<S;++_){for(x=o[_],y=this.labelTextColors[_],s.fillStyle=y,R(x.before,m),M=x.lines,l&&M.length&&(this._drawColorBox(s,t,_,g,n),f=Math.max(u.lineHeight,c)),v=0,k=M.length;v<k;++v)m(M[v]),f=u.lineHeight;R(x.after,m);}p=0,f=u.lineHeight,R(this.afterBody,m),t.y-=a;}drawFooter(t,s,n){let o=this.footer,a=o.length,r,l;if(a){let c=Ft(n.rtl,this.x,this.width);for(t.x=Ze(this,n.footerAlign,n),t.y+=n.footerMarginTop,s.textAlign=c.textAlign(n.footerAlign),s.textBaseline="middle",r=j(n.footerFont),s.fillStyle=n.footerColor,s.font=r.string,l=0;l<a;++l)s.fillText(o[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+n.footerSpacing;}}drawBackground(t,s,n,o){let{xAlign:a,yAlign:r}=this,{x:l,y:c}=t,{width:h,height:d}=n,{topLeft:u,topRight:f,bottomLeft:p,bottomRight:g}=Pt(o.cornerRadius);s.fillStyle=o.backgroundColor,s.strokeStyle=o.borderColor,s.lineWidth=o.borderWidth,s.beginPath(),s.moveTo(l+u,c),r==="top"&&this.drawCaret(t,s,n,o),s.lineTo(l+h-f,c),s.quadraticCurveTo(l+h,c,l+h,c+f),r==="center"&&a==="right"&&this.drawCaret(t,s,n,o),s.lineTo(l+h,c+d-g),s.quadraticCurveTo(l+h,c+d,l+h-g,c+d),r==="bottom"&&this.drawCaret(t,s,n,o),s.lineTo(l+p,c+d),s.quadraticCurveTo(l,c+d,l,c+d-p),r==="center"&&a==="left"&&this.drawCaret(t,s,n,o),s.lineTo(l,c+u),s.quadraticCurveTo(l,c,l+u,c),s.closePath(),s.fill(),o.borderWidth>0&&s.stroke();}_updateAnimationTarget(t){let s=this.chart,n=this.$animations,o=n&&n.x,a=n&&n.y;if(o||a){let r=_e[t.position].call(this,this._active,this._eventPosition);if(!r)return;let l=this._size=so(this,t),c=Object.assign({},r,this._size),h=no(s,t,c),d=oo(t,c,h,s);(o._to!==d.x||a._to!==d.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=l.width,this.height=l.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,d));}}_willRender(){return !!this.opacity}draw(t){let s=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(s);let o={width:this.width,height:this.height},a={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let r=K(s.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&l&&(t.save(),t.globalAlpha=n,this.drawBackground(a,t,o,s),Hi$1(t,s.textDirection),a.y+=r.top,this.drawTitle(a,t,s),this.drawBody(a,t,s),this.drawFooter(a,t,s),ji$1(t,s.textDirection),t.restore());}getActiveElements(){return this._active||[]}setActiveElements(t,s){let n=this._active,o=t.map(({datasetIndex:l,index:c})=>{let h=this.chart.getDatasetMeta(l);if(!h)throw new Error("Cannot find a dataset at index "+l);return {datasetIndex:l,element:h.data[c],index:c}}),a=!ce(n,o),r=this._positionChanged(o,s);(a||r)&&(this._active=o,this._eventPosition=s,this._ignoreReplayEvents=true,this.update(true));}handleEvent(t,s,n=true){if(s&&this._ignoreReplayEvents)return false;this._ignoreReplayEvents=false;let o=this.options,a=this._active||[],r=this._getActiveElements(t,a,s,n),l=this._positionChanged(r,t),c=s||!ce(r,a)||l;return c&&(this._active=r,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(true,s))),c}_getActiveElements(t,s,n,o){let a=this.options;if(t.type==="mouseout")return [];if(!o)return s.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,a.mode,a,n);return a.reverse&&r.reverse(),r}_positionChanged(t,s){let{caretX:n,caretY:o,options:a}=this,r=_e[a.position].call(this,t,s);return r!==false&&(n!==r.x||o!==r.y)}}return e})(),ih={id:"tooltip",_element:lo,positioners:_e,afterInit(e,i,t){t&&(e.tooltip=new lo({chart:e,options:t}));},beforeUpdate(e,i,t){e.tooltip&&e.tooltip.initialize(t);},reset(e,i,t){e.tooltip&&e.tooltip.initialize(t);},afterDraw(e){let i=e.tooltip;if(i&&i._willRender()){let t={tooltip:i};if(e.notifyPlugins("beforeTooltipDraw",z$5(G$b({},t),{cancelable:true}))===false)return;i.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",t);}},afterEvent(e,i){if(e.tooltip){let t=i.replay;e.tooltip.handleEvent(i.event,t,i.inChartArea)&&(i.changed=true);}},defaults:{enabled:true,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,i)=>i.bodyFont.size,boxWidth:(e,i)=>i.bodyFont.size,multiKeyBackground:"#fff",displayColors:true,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Vo},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:false,callbacks:{_scriptable:false,_indexable:false},animation:{_fallback:false},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},sh=Object.freeze({__proto__:null,Colors:pc,Decimation:_c,Filler:Vc,Legend:$c,SubTitle:Kc,Title:Xc,Tooltip:ih}),nh=(e,i,t,s)=>(typeof i=="string"?(t=e.push(i)-1,s.unshift({index:t,label:i})):isNaN(i)&&(t=null),t);function oh(e,i,t,s){let n=e.indexOf(i);if(n===-1)return nh(e,i,t,s);let o=e.lastIndexOf(i);return n!==o?t:n}var ah=(e,i)=>e===null?null:Y(Math.round(e),0,i);function co(e){let i=this.getLabels();return e>=0&&e<i.length?i[e]:e}var rh=(()=>{class e extends Vt{static id="category";static defaults={ticks:{callback:co}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[];}init(t){let s=this._addedLabels;if(s.length){let n=this.getLabels();for(let{index:o,label:a}of s)n[o]===a&&n.splice(o,1);this._addedLabels=[];}super.init(t);}parse(t,s){if(A(t))return null;let n=this.getLabels();return s=isFinite(s)&&n[s]===t?s:oh(n,t,P(s,t),this._addedLabels),ah(s,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this.getMinMax(true);this.options.bounds==="ticks"&&(t||(n=0),s||(o=this.getLabels().length-1)),this.min=n,this.max=o;}buildTicks(){let t=this.min,s=this.max,n=this.options.offset,o=[],a=this.getLabels();a=t===0&&s===a.length-1?a:a.slice(t,s+1),this._valueRange=Math.max(a.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=s;r++)o.push({value:r});return o}getLabelForValue(t){return co.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels);}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}return e})();function lh(e,i){let t=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=e,f=o||1,p=h-1,{min:g,max:m}=i,b=!A(a),x=!A(r),y=!A(c),M=(m-g)/(d+1),_=vi$1((m-g)/p/f)*f,v,S,k,w;if(_<1e-14&&!b&&!x)return [{value:g},{value:m}];w=Math.ceil(m/_)-Math.floor(g/_),w>p&&(_=vi$1(w*_/p/f)*f),A(l)||(v=Math.pow(10,l),_=Math.ceil(_*v)/v),n==="ticks"?(S=Math.floor(g/_)*_,k=Math.ceil(m/_)*_):(S=g,k=m),b&&x&&o&&Ks((r-a)/o,_/1e3)?(w=Math.round(Math.min((r-a)/_,h)),_=(r-a)/w,S=a,k=r):y?(S=b?a:S,k=x?r:k,w=c-1,_=(k-S)/w):(w=(k-S)/_,Kt(w,Math.round(w),_/1e3)?w=Math.round(w):w=Math.ceil(w));let D=Math.max(ki$1(_),ki$1(S));v=Math.pow(10,A(l)?D:l),S=Math.round(S*v)/v,k=Math.round(k*v)/v;let C=0;for(b&&(u&&S!==a?(t.push({value:a}),S<a&&C++,Kt(Math.round((S+C*_)*v)/v,a,ho(a,M,e))&&C++):S<a&&C++);C<w;++C){let T=Math.round((S+C*_)*v)/v;if(x&&T>r)break;t.push({value:T});}return x&&u&&k!==r?t.length&&Kt(t[t.length-1].value,r,ho(r,M,e))?t[t.length-1].value=r:t.push({value:r}):(!x||k===r)&&t.push({value:k}),t}function ho(e,i,{horizontal:t,minRotation:s}){let n=it(s),o=(t?Math.sin(n):Math.cos(n))||.001,a=.75*i*(""+e).length;return Math.min(i/o,a)}var ee$1=class ee extends Vt{constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0;}parse(i,t){return A(i)||(typeof i=="number"||i instanceof Number)&&!isFinite(+i)?null:+i}handleTickRangeOptions(){let{beginAtZero:i}=this.options,{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this,a=l=>n=t?n:l,r=l=>o=s?o:l;if(i){let l=nt(n),c=nt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0);}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),i||a(n-l);}this.min=n,this.max=o;}getTickLimit(){let i=this.options.ticks,{maxTicksLimit:t,stepSize:s}=i,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let i=this.options,t=i.ticks,s=this.getTickLimit();s=Math.max(2,s);let n={maxTicks:s,bounds:i.bounds,min:i.min,max:i.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==false},o=this._range||this,a=lh(n,o);return i.bounds==="ticks"&&Mi$1(a,this,"value"),i.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let i=this.ticks,t=this.min,s=this.max;if(super.configure(),this.options.offset&&i.length){let n=(s-t)/Math.max(i.length-1,1)/2;t-=n,s+=n;}this._startValue=t,this._endValue=s,this._valueRange=s-t;}getLabelForValue(i){return Gt(i,this.chart.options.locale,this.options.ticks.format)}},_s$1=class _s extends ee$1{static id="linear";static defaults={ticks:{callback:he$1.formatters.numeric}};determineDataLimits(){let{min:i,max:t}=this.getMinMax(true);this.min=W(i)?i:0,this.max=W(t)?t:1,this.handleTickRangeOptions();}computeTickLimit(){let i=this.isHorizontal(),t=i?this.width:this.height,s=it(this.options.ticks.minRotation),n=(i?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(i){return i===null?NaN:this.getPixelForDecimal((i-this._startValue)/this._valueRange)}getValueForPixel(i){return this._startValue+this.getDecimalForPixel(i)*this._valueRange}},Me=e=>Math.floor(gt(e)),Bt=(e,i)=>Math.pow(10,Me(e)+i);function uo(e){return e/Math.pow(10,Me(e))===1}function fo(e,i,t){let s=Math.pow(10,t),n=Math.floor(e/s);return Math.ceil(i/s)-n}function ch(e,i){let t=i-e,s=Me(t);for(;fo(e,i,s)>10;)s++;for(;fo(e,i,s)<10;)s--;return Math.min(s,Me(e))}function hh(e,{min:i,max:t}){i=J(e.min,i);let s=[],n=Me(i),o=ch(i,t),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((i-l)*a)/a,h=Math.floor((i-l)/r/10)*r*10,d=Math.floor((c-h)/Math.pow(10,o)),u=J(e.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<t;)s.push({value:u,major:uo(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;let f=J(e.max,u);return s.push({value:f,major:uo(f),significand:d}),s}var ys$1=class ys extends Vt{static id="logarithmic";static defaults={ticks:{callback:he$1.formatters.logarithmic,major:{enabled:true}}};constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0;}parse(i,t){let s=ee$1.prototype.parse.apply(this,[i,t]);if(s===0){this._zero=true;return}return W(s)&&s>0?s:null}determineDataLimits(){let{min:i,max:t}=this.getMinMax(true);this.min=W(i)?Math.max(0,i):null,this.max=W(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=true),this._zero&&this.min!==this._suggestedMin&&!W(this._userMin)&&(this.min=i===Bt(this.min,0)?Bt(this.min,-1):Bt(this.min,0)),this.handleTickRangeOptions();}handleTickRangeOptions(){let{minDefined:i,maxDefined:t}=this.getUserBounds(),s=this.min,n=this.max,o=r=>s=i?s:r,a=r=>n=t?n:r;s===n&&(s<=0?(o(1),a(10)):(o(Bt(s,-1)),a(Bt(n,1)))),s<=0&&o(Bt(n,-1)),n<=0&&a(Bt(s,1)),this.min=s,this.max=n;}buildTicks(){let i=this.options,t={min:this._userMin,max:this._userMax},s=hh(t,this);return i.bounds==="ticks"&&Mi$1(s,this,"value"),i.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(i){return i===void 0?"0":Gt(i,this.chart.options.locale,this.options.ticks.format)}configure(){let i=this.min;super.configure(),this._startValue=gt(i),this._valueRange=gt(this.max)-gt(i);}getPixelForValue(i){return (i===void 0||i===0)&&(i=this.min),i===null||isNaN(i)?NaN:this.getPixelForDecimal(i===this.min?0:(gt(i)-this._startValue)/this._valueRange)}getValueForPixel(i){let t=this.getDecimalForPixel(i);return Math.pow(10,this._startValue+t*this._valueRange)}};function vs$1(e){let i=e.ticks;if(i.display&&e.display){let t=K(i.backdropPadding);return P(i.font&&i.font.size,B.font.size)+t.height}return 0}function dh(e,i,t){return t=F(t)?t:[t],{w:nn(e,i.string,t),h:t.length*i.lineHeight}}function go(e,i,t,s,n){return e===s||e===n?{start:i-t/2,end:i+t/2}:e<s||e>n?{start:i-t,end:i}:{start:i,end:i+t}}function uh(e){let i={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},t=Object.assign({},i),s=[],n=[],o=e._pointLabels.length,a=e.options.pointLabels,r=a.centerPointLabels?L/o:0;for(let l=0;l<o;l++){let c=a.setContext(e.getPointLabelContext(l));n[l]=c.padding;let h=e.getPointPosition(l,e.drawingArea+n[l],r),d=j(c.font),u=dh(e.ctx,d,e._pointLabels[l]);s[l]=u;let f=U(e.getIndexAngle(l)+r),p=Math.round(Be$1(f)),g=go(p,h.x,u.w,0,180),m=go(p,h.y,u.h,90,270);fh(t,i,f,g,m);}e.setCenterPoint(i.l-t.l,t.r-i.r,i.t-t.t,t.b-i.b),e._pointLabelItems=mh(e,s,n);}function fh(e,i,t,s,n){let o=Math.abs(Math.sin(t)),a=Math.abs(Math.cos(t)),r=0,l=0;s.start<i.l?(r=(i.l-s.start)/o,e.l=Math.min(e.l,i.l-r)):s.end>i.r&&(r=(s.end-i.r)/o,e.r=Math.max(e.r,i.r+r)),n.start<i.t?(l=(i.t-n.start)/a,e.t=Math.min(e.t,i.t-l)):n.end>i.b&&(l=(n.end-i.b)/a,e.b=Math.max(e.b,i.b+l));}function gh(e,i,t){let s=e.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=t,l=e.getPointPosition(i,s+n+a,o),c=Math.round(Be$1(U(l.angle+N))),h=_h(l.y,r.h,c),d=bh(c),u=xh(l.x,r.w,d);return {visible:true,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function ph(e,i){if(!i)return true;let{left:t,top:s,right:n,bottom:o}=e;return !(rt({x:t,y:s},i)||rt({x:t,y:o},i)||rt({x:n,y:s},i)||rt({x:n,y:o},i))}function mh(e,i,t){let s=[],n=e._pointLabels.length,o=e.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:vs$1(o)/2,additionalAngle:a?L/n:0},c;for(let h=0;h<n;h++){l.padding=t[h],l.size=i[h];let d=gh(e,h,l);s.push(d),r==="auto"&&(d.visible=ph(d,c),d.visible&&(c=d));}return s}function bh(e){return e===0||e===180?"center":e<180?"left":"right"}function xh(e,i,t){return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function _h(e,i,t){return t===90||t===270?e-=i/2:(t>270||t<90)&&(e-=i),e}function yh(e,i,t){let{left:s,top:n,right:o,bottom:a}=t,{backdropColor:r}=i;if(!A(r)){let l=Pt(i.borderRadius),c=K(i.backdropPadding);e.fillStyle=r;let h=s-c.left,d=n-c.top,u=o-s+c.width,f=a-n+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),Jt$1(e,{x:h,y:d,w:u,h:f,radius:l}),e.fill()):e.fillRect(h,d,u,f);}}function vh(e,i){let{ctx:t,options:{pointLabels:s}}=e;for(let n=i-1;n>=0;n--){let o=e._pointLabelItems[n];if(!o.visible)continue;let a=s.setContext(e.getPointLabelContext(n));yh(t,a,o);let r=j(a.font),{x:l,y:c,textAlign:h}=o;wt$1(t,e._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"});}}function Wo(e,i,t,s){let{ctx:n}=e;if(t)n.arc(e.xCenter,e.yCenter,i,0,z);else {let o=e.getPointPosition(0,i);n.moveTo(o.x,o.y);for(let a=1;a<s;a++)o=e.getPointPosition(a,i),n.lineTo(o.x,o.y);}}function Mh(e,i,t,s,n){let o=e.ctx,a=i.circular,{color:r,lineWidth:l}=i;!a&&!s||!r||!l||t<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Wo(e,t,a,s),o.closePath(),o.stroke(),o.restore());}function kh(e,i,t){return mt(e,{label:t,index:i,type:"pointLabel"})}var Ms$1=class Ms extends ee$1{static id="radialLinear";static defaults={display:true,animate:true,position:"chartArea",angleLines:{display:true,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:false},startAngle:0,ticks:{showLabelBackdrop:true,callback:he$1.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:true,font:{size:10},callback(i){return i},padding:5,centerPointLabels:false}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(i){super(i),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[];}setDimensions(){let i=this._padding=K(vs$1(this.options)/2),t=this.width=this.maxWidth-i.width,s=this.height=this.maxHeight-i.height;this.xCenter=Math.floor(this.left+t/2+i.left),this.yCenter=Math.floor(this.top+s/2+i.top),this.drawingArea=Math.floor(Math.min(t,s)/2);}determineDataLimits(){let{min:i,max:t}=this.getMinMax(false);this.min=W(i)&&!isNaN(i)?i:0,this.max=W(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions();}computeTickLimit(){return Math.ceil(this.drawingArea/vs$1(this.options))}generateTickLabels(i){ee$1.prototype.generateTickLabels.call(this,i),this._pointLabels=this.getLabels().map((t,s)=>{let n=I(this.options.pointLabels.callback,[t,s],this);return n||n===0?n:""}).filter((t,s)=>this.chart.getDataVisibility(s));}fit(){let i=this.options;i.display&&i.pointLabels.display?uh(this):this.setCenterPoint(0,0,0,0);}setCenterPoint(i,t,s,n){this.xCenter+=Math.floor((i-t)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(i,t,s,n));}getIndexAngle(i){let t=z/(this._pointLabels.length||1),s=this.options.startAngle||0;return U(i*t+it(s))}getDistanceFromCenterForValue(i){if(A(i))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-i)*t:(i-this.min)*t}getValueForDistanceFromCenter(i){if(A(i))return NaN;let t=i/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(i){let t=this._pointLabels||[];if(i>=0&&i<t.length){let s=t[i];return kh(this.getContext(),i,s)}}getPointPosition(i,t,s=0){let n=this.getIndexAngle(i)-N+s;return {x:Math.cos(n)*t+this.xCenter,y:Math.sin(n)*t+this.yCenter,angle:n}}getPointPositionForValue(i,t){return this.getPointPosition(i,this.getDistanceFromCenterForValue(t))}getBasePosition(i){return this.getPointPositionForValue(i||0,this.getBaseValue())}getPointLabelPosition(i){let{left:t,top:s,right:n,bottom:o}=this._pointLabelItems[i];return {left:t,top:s,right:n,bottom:o}}drawBackground(){let{backgroundColor:i,grid:{circular:t}}=this.options;if(i){let s=this.ctx;s.save(),s.beginPath(),Wo(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),s.closePath(),s.fillStyle=i,s.fill(),s.restore();}}drawGrid(){let i=this.ctx,t=this.options,{angleLines:s,grid:n,border:o}=t,a=this._pointLabels.length,r,l,c;if(t.pointLabels.display&&vh(this,a),n.display&&this.ticks.forEach((h,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let u=this.getContext(d),f=n.setContext(u),p=o.setContext(u);Mh(this,f,l,a,p);}}),s.display){for(i.save(),r=a-1;r>=0;r--){let h=s.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(i.lineWidth=u,i.strokeStyle=d,i.setLineDash(h.borderDash),i.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(r,l),i.beginPath(),i.moveTo(this.xCenter,this.yCenter),i.lineTo(c.x,c.y),i.stroke());}i.restore();}}drawBorder(){}drawLabels(){let i=this.ctx,t=this.options,s=t.ticks;if(!s.display)return;let n=this.getIndexAngle(0),o,a;i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(n),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;let c=s.setContext(this.getContext(l)),h=j(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){i.font=h.string,a=i.measureText(r.label).width,i.fillStyle=c.backdropColor;let d=K(c.backdropPadding);i.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height);}wt$1(i,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth});}),i.restore();}drawTitle(){}},hi$1={millisecond:{common:true,size:1,steps:1e3},second:{common:true,size:1e3,steps:60},minute:{common:true,size:6e4,steps:60},hour:{common:true,size:36e5,steps:24},day:{common:true,size:864e5,steps:30},week:{common:false,size:6048e5,steps:4},month:{common:true,size:2628e6,steps:12},quarter:{common:false,size:7884e6,steps:4},year:{common:true,size:3154e7}},Q=Object.keys(hi$1);function po(e,i){return e-i}function mo(e,i){if(A(i))return null;let t=e._adapter,{parser:s,round:n,isoWeekday:o}=e._parseOpts,a=i;return typeof s=="function"&&(a=s(a)),W(a)||(a=typeof s=="string"?t.parse(a,s):t.parse(a)),a===null?null:(n&&(a=n==="week"&&(It(o)||o===true)?t.startOf(a,"isoWeek",o):t.startOf(a,n)),+a)}function bo(e,i,t,s){let n=Q.length;for(let o=Q.indexOf(e);o<n-1;++o){let a=hi$1[Q[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((t-i)/(r*a.size))<=s)return Q[o]}return Q[n-1]}function Sh(e,i,t,s,n){for(let o=Q.length-1;o>=Q.indexOf(t);o--){let a=Q[o];if(hi$1[a].common&&e._adapter.diff(n,s,a)>=i-1)return a}return Q[t?Q.indexOf(t):0]}function wh(e){for(let i=Q.indexOf(e)+1,t=Q.length;i<t;++i)if(hi$1[Q[i]].common)return Q[i]}function xo(e,i,t){if(!t)e[i]=true;else if(t.length){let{lo:s,hi:n}=Ve$1(t,i),o=t[s]>=i?t[s]:t[n];e[o]=true;}}function Ph(e,i,t,s){let n=e._adapter,o=+n.startOf(i[0].value,s),a=i[i.length-1].value,r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=t[r],l>=0&&(i[l].major=true);return i}function _o(e,i,t){let s=[],n={},o=i.length,a,r;for(a=0;a<o;++a)r=i[a],n[r]=a,s.push({value:r,major:false});return o===0||!t?s:Ph(e,s,n,t)}var ks$1=(()=>{class e extends Vt{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:false,unit:false,round:false,isoWeekday:false,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:false,major:{enabled:false}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=false,this._parseOpts=void 0;}init(t,s={}){let n=t.time||(t.time={}),o=this._adapter=new Fr$1._date(t.adapters.date);o.init(s),Ut(n.displayFormats,o.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=s.normalized;}parse(t,s){return t===void 0?null:mo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]};}determineDataLimits(){let t=this.options,s=this._adapter,n=t.time.unit||"day",{min:o,max:a,minDefined:r,maxDefined:l}=this.getUserBounds();function c(h){!r&&!isNaN(h.min)&&(o=Math.min(o,h.min)),!l&&!isNaN(h.max)&&(a=Math.max(a,h.max));}(!r||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(false))),o=W(o)&&!isNaN(o)?o:+s.startOf(Date.now(),n),a=W(a)&&!isNaN(a)?a:+s.endOf(Date.now(),n)+1,this.min=Math.min(o,a-1),this.max=Math.max(o+1,a);}_getLabelBounds(){let t=this.getLabelTimestamps(),s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(s=t[0],n=t[t.length-1]),{min:s,max:n}}buildTicks(){let t=this.options,s=t.time,n=t.ticks,o=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);let a=this.min,r=this.max,l=Js(o,a,r);return this._unit=s.unit||(n.autoSkip?bo(s.minUnit,this.min,this.max,this._getLabelCapacity(a)):Sh(this,l.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:wh(this._unit),this.initOffsets(o),t.reverse&&l.reverse(),_o(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value));}initOffsets(t=[]){let s=0,n=0,o,a;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?s=1-o:s=(this.getDecimalForValue(t[1])-o)/2,a=this.getDecimalForValue(t[t.length-1]),t.length===1?n=a:n=(a-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;s=Y(s,0,r),n=Y(n,0,r),this._offsets={start:s,end:n,factor:1/(s+1+n)};}_generate(){let t=this._adapter,s=this.min,n=this.max,o=this.options,a=o.time,r=a.unit||bo(a.minUnit,s,n,this._getLabelCapacity(s)),l=P(o.ticks.stepSize,1),c=r==="week"?a.isoWeekday:false,h=It(c)||c===true,d={},u=s,f,p;if(h&&(u=+t.startOf(u,"isoWeek",c)),u=+t.startOf(u,h?"day":r),t.diff(n,s,r)>1e5*l)throw new Error(s+" and "+n+" are too far apart with stepSize of "+l+" "+r);let g=o.ticks.source==="data"&&this.getDataTimestamps();for(f=u,p=0;f<n;f=+t.add(f,l,r),p++)xo(d,f,g);return (f===n||o.bounds==="ticks"||p===1)&&xo(d,f,g),Object.keys(d).sort(po).map(m=>+m)}getLabelForValue(t){let s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(t,n.tooltipFormat):s.format(t,n.displayFormats.datetime)}format(t,s){let o=this.options.time.displayFormats,a=this._unit,r=s||o[a];return this._adapter.format(t,r)}_tickFormatFunction(t,s,n,o){let a=this.options,r=a.ticks.callback;if(r)return I(r,[t,s,n],this);let l=a.time.displayFormats,c=this._unit,h=this._majorUnit,d=c&&l[c],u=h&&l[h],f=n[s],p=h&&u&&f&&f.major;return this._adapter.format(t,o||(p?u:d))}generateTickLabels(t){let s,n,o;for(s=0,n=t.length;s<n;++s)o=t[s],o.label=this._tickFormatFunction(o.value,s,t);}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let s=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(t){let s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let s=this.options.ticks,n=this.ctx.measureText(t).width,o=it(this.isHorizontal()?s.maxRotation:s.minRotation),a=Math.cos(o),r=Math.sin(o),l=this._resolveTickFontOptions(0).size;return {w:n*a+l*r,h:n*r+l*a}}_getLabelCapacity(t){let s=this.options.time,n=s.displayFormats,o=n[s.unit]||n.millisecond,a=this._tickFormatFunction(t,0,_o(this,[t],this._majorUnit),o),r=this._getLabelSize(a),l=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],s,n;if(t.length)return t;let o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(s=0,n=o.length;s<n;++s)t=t.concat(o[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],s,n;if(t.length)return t;let o=this.getLabels();for(s=0,n=o.length;s<n;++s)t.push(mo(this,o[s]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Pi$1(t.sort(po))}}return e})();function Qe(e,i,t){let s=0,n=e.length-1,o,a,r,l;t?(i>=e[s].pos&&i<=e[n].pos&&({lo:s,hi:n}=at(e,"pos",i)),{pos:o,time:r}=e[s],{pos:a,time:l}=e[n]):(i>=e[s].time&&i<=e[n].time&&({lo:s,hi:n}=at(e,"time",i)),{time:o,pos:r}=e[s],{time:a,pos:l}=e[n]);let c=a-o;return c?r+(l-r)*(i-o)/c:r}var Ss$1=class Ss extends ks$1{static id="timeseries";static defaults=ks$1.defaults;constructor(i){super(i),this._table=[],this._minPos=void 0,this._tableRange=void 0;}initOffsets(){let i=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(i);this._minPos=Qe(t,this.min),this._tableRange=Qe(t,this.max)-this._minPos,super.initOffsets(i);}buildLookupTable(i){let{min:t,max:s}=this,n=[],o=[],a,r,l,c,h;for(a=0,r=i.length;a<r;++a)c=i[a],c>=t&&c<=s&&n.push(c);if(n.length<2)return [{time:t,pos:0},{time:s,pos:1}];for(a=0,r=n.length;a<r;++a)h=n[a+1],l=n[a-1],c=n[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){let i=this.min,t=this.max,s=super.getDataTimestamps();return (!s.includes(i)||!s.length)&&s.splice(0,0,i),(!s.includes(t)||s.length===1)&&s.push(t),s.sort((n,o)=>n-o)}_getTimestampsForTable(){let i=this._cache.all||[];if(i.length)return i;let t=this.getDataTimestamps(),s=this.getLabelTimestamps();return t.length&&s.length?i=this.normalize(t.concat(s)):i=t.length?t:s,i=this._cache.all=i,i}getDecimalForValue(i){return (Qe(this._table,i)-this._minPos)/this._tableRange}getValueForPixel(i){let t=this._offsets,s=this.getDecimalForPixel(i)/t.factor-t.end;return Qe(this._table,s*this._tableRange+this._minPos,true)}},Ch=Object.freeze({__proto__:null,CategoryScale:rh,LinearScale:_s$1,LogarithmicScale:ys$1,RadialLinearScale:Ms$1,TimeScale:ks$1,TimeSeriesScale:Ss$1}),Lh=[Ir$1,lc,sh,Ch];var Be=(t,n)=>{let e=w$4(Gi$3),o=w$4(G$3),i=e.getSplitShellEnabled(),r="/"+n.map(l=>l.path).join("/"),a=i?"chartplotter":"dashboard",s=r.startsWith("/chartplotter"),c=r.startsWith("/dashboard");if(n.length===0)return o.createUrlTree([a,"0"]);if(n.length===1&&(n[0].path==="chartplotter"||n[0].path==="dashboard"))return o.createUrlTree([a,"0"]);if(i&&c&&!s){let l=n.length>1?n[1].path:void 0;return o.createUrlTree(["chartplotter",l??""])}if(!i&&s){let l=n.length>1?n[1].path:void 0;return o.createUrlTree(["dashboard",l??""])}return true};var ii=[{path:"dashboard/:id",component:qo$1,canMatch:[Be]},{path:"chartplotter/:id",loadComponent:()=>import('./chunk-DIl1k00y.js').then(t=>t.SplitShellComponent),canMatch:[Be]},{path:"settings",loadComponent:()=>import('./chunk-CIGP2YJm.js').then(t=>t.SettingsComponent),title:"KIP - Settings"},{path:"options",loadComponent:()=>import('./chunk-0z3nIRXw.js').then(t=>t.TabsComponent),title:"KIP - Options"},{path:"remote",loadComponent:()=>import('./chunk-DTN-sa1K.js').then(t=>t.RemoteControlComponent),title:"KIP - Remote Control"},{path:"help/:page",loadComponent:()=>import('./chunk-CLTHuhlN.js').then(t=>t.AppHelpComponent),title:"KIP - Help"},{path:"help",loadComponent:()=>import('./chunk-CLTHuhlN.js').then(t=>t.AppHelpComponent),title:"KIP - Help"},{path:"data",loadComponent:()=>import('./chunk-BJ-wyixK.js').then(t=>t.DataInspectorComponent),title:"KIP - Data Inspector"},{path:"login",loadComponent:()=>import('./chunk-BN7A4g6c.js').then(t=>t.WidgetLoginComponent),title:"Login"},{path:"**",component:qo$1,canMatch:[Be]}];var gr=(t,n)=>n.path;function br(t,n){t&1&&(Pi$5(0,"mat-icon"),TT(1,"info"),ul$2());}function yr(t,n){t&1&&(Pi$5(0,"mat-icon"),TT(1,"info"),ul$2());}function vr(t,n){t&1&&(Pi$5(0,"mat-icon",3),TT(1,"report"),ul$2());}function _r(t,n){t&1&&(Pi$5(0,"mat-icon",4),TT(1,"warning"),ul$2());}function Sr(t,n){t&1&&(Pi$5(0,"mat-icon",5),TT(1,"error"),ul$2());}function wr(t,n){t&1&&(Pi$5(0,"mat-icon",6),TT(1,"emergency_home"),ul$2());}function Cr(t,n){if(t&1){let e=Fw();Pi$5(0,"div",2),_w(1,br,2,0,"mat-icon")(2,yr,2,0,"mat-icon")(3,vr,2,0,"mat-icon",3)(4,_r,2,0,"mat-icon",4)(5,Sr,2,0,"mat-icon",5)(6,wr,2,0,"mat-icon",6),Pi$5(7,"div",7),TT(8),ul$2(),Pi$5(9,"div",8),TT(10),HT(11,"slice"),ul$2(),Pi$5(12,"div",9),TT(13),ul$2(),Pi$5(14,"button",10),Qh("click",function(){let i=ud(e).$implicit,r=qw();return dd(r.silence(i.path))}),Pi$5(15,"mat-icon"),TT(16,"music_off"),ul$2()(),Pi$5(17,"button",11),Qh("click",function(){let i=ud(e).$implicit,r=qw();return dd(r.clear(i.path))}),Pi$5(18,"mat-icon"),TT(19,"published_with_changes"),ul$2()()(),$h(20,"mat-divider",12);}if(t&2){let e,o=n.$implicit;EE(),Mw((e=o.value?.state??"normal")==="nominal"?1:e==="normal"?2:e==="alert"?3:e==="warn"?4:e==="alarm"?5:e==="emergency"?6:-1),EE(7),gg(o.value?.state??""),EE(2),gl$2(" ",UT(11,5,o.path,14)," "),EE(3),gg(o.value?.message??""),EE(),Bh("disabled",!o.value?.method?.includes("sound"));}}function xr(t,n){t&1&&(Pi$5(0,"mat-list-item",13)(1,"span",15),TT(2,"Notifications Disabled"),ul$2(),Pi$5(3,"span")(4,"i"),TT(5,"*Enable notifications in Settings."),ul$2()()());}function Mr(t,n){t&1&&(Pi$5(0,"mat-list-item",14)(1,"i"),TT(2,'"No Notification"'),ul$2()());}function kr(t,n){if(t&1&&_w(0,xr,6,0,"mat-list-item",13)(1,Mr,3,0,"mat-list-item",14),t&2){let e=qw();Mw(e.notificationConfig().disableNotifications?0:1);}}function Ir(t,n){if(t&1){let e=Fw();Pi$5(0,"button",17),Qh("click",function(){ud(e);let i=qw(2);return dd(i.mutePlayer(!i.isMuted))}),Pi$5(1,"span",18),TT(2,"volume_up"),ul$2(),TT(3," Unmute Audio "),ul$2();}}function Pr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",17),Qh("click",function(){ud(e);let i=qw(2);return dd(i.mutePlayer(!i.isMuted))}),Pi$5(1,"span",18),TT(2,"volume_off"),ul$2(),TT(3," Mute Audio "),ul$2();}}function Dr(t,n){if(t&1&&_w(0,Ir,4,0,"button",16)(1,Pr,4,0,"button",16),t&2){let e=qw();Mw(e.isMuted?0:1);}}var ci=(()=>{class t{_notificationsService=w$4(O$1);_notifications$=this._notificationsService.observeNotifications();notificationConfig=Wp(this._notificationsService.observeNotificationConfiguration(),{requireSync:true});menuNotifications=Wp(Fm([this._notifications$,this._notificationsService.observeNotificationConfiguration()]).pipe(ke$3(([e,o$1])=>{let i=[];return o$1.devices.showNormalState||i.push(n$1.Normal),o$1.devices.showNominalState||i.push(n$1.Nominal),e.filter(r=>r.value&&r.value.state&&!i.includes(r.value.state)).filter(r=>{let a=r.value?.method;return a?.length?a.includes(o.Visual)||a.includes(o.Sound):false})})),{requireSync:true,equal:ln$3});isMuted=false;mutePlayer(e){this.isMuted=e,this._notificationsService.mutePlayer(e);}silence(e){this._notificationsService.setSkMethod(e,[o.Visual]);}clear(e){this._notificationsService.setSkState(e,n$1.Normal);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["menu-notifications"]],decls:6,vars:2,consts:[[1,"menu-item-container"],[1,"actions-container","actions-bottom-container"],[1,"notification-container"],[1,"icon-alert-color"],[1,"icon-warn-color"],[1,"icon-alarm-color"],[1,"icon-emergency-color"],[1,"notification-title"],[1,"notification-path","scrollable-text"],[1,"notification-text"],["mat-icon-button","",1,"notification-action-btn",3,"click","disabled"],["mat-icon-button","",1,"notification-action-btn",3,"click"],[1,"notification-divider"],["lines","3","disabled","true",2,"text-align","center"],["disabled","true",2,"text-align","center"],["matListItemTitle",""],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button"],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button",3,"click"],[1,"material-icons"]],template:function(o,i){o&1&&(Pi$5(0,"mat-list",0),xw(1,Cr,21,8,null,null,gr,false,kr,2,1),ul$2(),Pi$5(4,"div",1),_w(5,Dr,2,1),ul$2()),o&2&&(EE(),Aw(i.menuNotifications()),EE(4),Mw(i.notificationConfig().disableNotifications?-1:5));},dependencies:[Jt$8,Wt$4,Zt$7,u$3,et$a,Op,xp$1,eu,H,zt$1,mt$1,yt$3,wt$3,rs$3],styles:[".notification-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;padding:2px 10px 7px;scroll-behavior:smooth}mat-icon[_ngcontent-%COMP%]{margin-right:10px}.scrollable-text[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.scrollable-text[_ngcontent-%COMP%]:hover{overflow:auto;white-space:normal;word-wrap:break-word}.notification-title[_ngcontent-%COMP%]{text-transform:capitalize;font-size:var(--mat-sys-headline-small-size);width:calc(100% - 34px)}.notification-path[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-size);word-break:break-all;width:100%}.notification-text[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-line-height);font-style:italic;width:100%;overflow:auto;white-space:normal;word-wrap:break-word}.notification-action-btn[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container)}.notification-btn-container[_ngcontent-%COMP%]{display:inline-block;width:50%;height:48px;text-align:center}.menu-item-container[_ngcontent-%COMP%]{width:230px;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;height:calc(100% - 48px)}.notification-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;background-color:var(--mat-sys-surface-container)}.actions-container[_ngcontent-%COMP%]{display:grid;grid-auto-flow:column}.actions-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;height:48px}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large))}.icon-alert-color[_ngcontent-%COMP%]{color:var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{color:var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{color:var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:transparent}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.notification-divider[_ngcontent-%COMP%]{padding-top:10px}"]})}return t})();var Ar=["badgeButton"],li=(()=>{class t{badgeButton=$j.required("badgeButton");_notifications=w$4(O$1);notificationsInfo=Wp(this._notifications.observerNotificationsInfo(),{requireSync:true});openNotificationMenu(){let e=new Event("openRightSidenav",{bubbles:true,cancelable:true});window.document.dispatchEvent(e);}onKeyDown(e){let o=e.key?.toLowerCase();(o==="enter"||o===" "||o==="spacebar")&&(e.preventDefault(),this.openNotificationMenu());}focus(){try{let e=this.badgeButton&&this.badgeButton(),o=e&&e.nativeElement;o&&typeof o.focus=="function"&&o.focus();}catch(e){}}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["notification-badge"]],viewQuery:function(o,i){o&1&&eg(i.badgeButton,Ar,5),o&2&&Kw();},decls:5,vars:7,consts:[["badgeButton",""],["mat-fab","","role","button","aria-label","Open notifications",1,"layout-action-btn",3,"click","keydown"],["aria-hidden","false","matBadgeSize","large","matBadgePosition","after","matBadgeOverlap","true",1,"icon-alert-color",3,"matBadgeHidden","matBadge"]],template:function(o,i){o&1&&(Pi$5(0,"div")(1,"button",1,0),Qh("click",function(){return i.openNotificationMenu()})("keydown",function(a){return i.onKeyDown(a)}),Pi$5(3,"mat-icon",2),TT(4,"notifications "),ul$2()()()),o&2&&(EE(),sg("warn",i.notificationsInfo()?.isWarn)("alarm-emergency-blink",i.notificationsInfo()?.isAlarmEmergency),Hh("aria-haspopup",true),EE(2),Bh("matBadgeHidden",!(i.notificationsInfo()?.alarmCount??0))("matBadge",i.notificationsInfo()?.alarmCount??0));},dependencies:[Op,Fp,yt$3,wt$3,H,G$1],styles:["[_nghost-%COMP%]{display:block}.layout-action-btn[_ngcontent-%COMP%]{color:var(--mat-sys-on-primary);background-color:var(--mat-sys-primary)}.icon-alert-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:var(--mat-sys-primary)}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}"]})}return t})();var di=(()=>{class t{overlayRef=null;overlay=w$4(ce$6);injector=w$4(be$5);open(){if(this.overlayRef)return;this.overlayRef=this.overlay.create({hasBackdrop:false,panelClass:"notification-overlay-panel",positionStrategy:this.overlay.position().global().bottom("20px").left("20px"),scrollStrategy:this.overlay.scrollStrategies.reposition()});let e=new bt$8(li,null,this.injector),o=this.overlayRef.attach(e);try{let i=o&&o.instance;if(i&&typeof i.focus=="function")i.focus();else {let r=this.overlayRef.overlayElement,a=r&&r.querySelector("button[mat-fab], .layout-action-btn");a&&typeof a.focus=="function"&&a.focus();}}catch(i){}}close(){try{this.overlayRef&&this.overlayRef.dispose();}catch(e){console.warn("[NotificationOverlayService] dispose failed",e);}finally{this.overlayRef=null;}}toggle(e){e?this.open():this.close();}isOpen(){return !!this.overlayRef}ngOnDestroy(){try{this.overlayRef&&this.overlayRef.dispose();}catch(e){}finally{this.overlayRef=null;}}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Or(t,n){if(t&1){let e=Fw();Pi$5(0,"button",12),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("toggleFullScreen"))}),Pi$5(1,"span",10),TT(2,"fullscreen"),ul$2()();}}function Tr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",12),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("toggleFullScreen"))}),Pi$5(1,"span",10),TT(2,"close_fullscreen"),ul$2()();}}function Er(t,n){if(t&1&&_w(0,Or,3,0,"button",11)(1,Tr,3,0,"button",11),t&2){let e=qw();Mw(e.uiEvent.fullscreenStatus()?1:0);}}function Rr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",14),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("nightMode"))}),Pi$5(1,"span",10),TT(2,"mode_night"),ul$2()();}}function Nr(t,n){if(t&1){let e=Fw();Pi$5(0,"button",14),Qh("click",function(){ud(e);let i=qw(2);return dd(i.onActionItem("nightMode"))}),Pi$5(1,"span",10),TT(2,"light_mode"),ul$2()();}}function Lr(t,n){if(t&1&&_w(0,Rr,3,0,"button",13)(1,Nr,3,0,"button",13),t&2){let e=qw();Mw(e.app.isNightMode()?1:0);}}function zr(t,n){if(t&1){let e=Fw();Pi$5(0,"tile-large-icon",15,1),Qh("click",function(){let i=ud(e).$index,r=qw();return dd(r.navigateToDashboard(i))}),ul$2();}if(t&2){let e=n.$implicit;Bh("active",e.active)("svgIcon",e.svgIcon)("iconSize",e.iconSize)("label",e.label);}}var ui=(()=>{class t{actionsSidenav=Hj.required();_router=w$4(G$3);uiEvent=w$4(re$5);dashboard=w$4(G$2);app=w$4(N$1);_settings=w$4(Gi$3);isAutoNightMode=Wp(this._settings.getAutoNightModeAsO(),{requireSync:true});_initialDashboardMatch=(()=>{let o=this._router.parseUrl(this._router.url).root.children.primary,i=o?o.segments.map(r=>r.path):[];return i.length===0||i[0]==="dashboard"||i[0]==="chartplotter"})();isDashboardContext=Wp(this._router.events.pipe(fn$7(e=>e instanceof $$2),Tu(null),ke$3(()=>{let o=this._router.parseUrl(this._router.url).root.children.primary,i=o?o.segments.map(r=>r.path):[];return i.length===0||i[0]==="dashboard"||i[0]==="chartplotter"}),Gl$2()),{initialValue:this._initialDashboardMatch});menuItems=Dt$9(()=>{let e=this.dashboard.dashboards(),o=this.dashboard.activeDashboard();return e.map((i,r)=>({id:Number(i.id),active:r===o,pinned:false,svgIcon:i.icon||"dashboard-dashboard",iconSize:60,label:i.name||`Dashboard ${r+1}`}))});ngAfterViewInit(){this.uiEvent.addHotkeyListener((e,o)=>this.handleKeyDown(e,o),{ctrlKey:true,shiftKey:true,keys:["e","f","n"]});}ngOnDestroy(){this.uiEvent.removeHotkeyListener(this.handleKeyDown.bind(this));}handleKeyDown(e,o){switch(e){case "e":this.onActionItem("layout");break;case "f":this.onActionItem("toggleFullScreen");break;case "n":this.onActionItem("nightMode");break;}}onActionItem(e){switch(this.actionsSidenav().close(),e){case "toggleFullScreen":this.uiEvent.toggleFullScreen();break;case "settings":this._router.navigate(["/settings"]);break;case "layout":this.dashboard.setStaticDashboard(false);break;case "nightMode":this.app.isNightMode.set(!this.app.isNightMode()),this.app.toggleDayNightMode();break;}}navigateToDashboard(e){this.actionsSidenav().close(),this._router.navigate([`dashboard/${e}`]);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["menu-actions"]],inputs:{actionsSidenav:[1,"actionsSidenav"]},decls:14,vars:3,consts:[["tileContainer",""],["tile",""],[1,"actions-container"],[1,"actions-top-container"],["mat-flat-button","","tabindex","0",1,"action-button","home-btn",3,"click"],["height","24px","width","24px","svgIcon","kip","aria-hidden","false",1,"home-icon",2,"height","24px","width","24px"],[1,"menu-item-container"],[3,"active","svgIcon","iconSize","label"],[1,"actions-bottom-container"],["mat-flat-button","",1,"action-button",2,"width","135px",3,"click","disabled"],[1,"material-icons"],["mat-flat-button","","tabindex","0",1,"action-button"],["mat-flat-button","","tabindex","0",1,"action-button",3,"click"],["mat-flat-button","",1,"action-button"],["mat-flat-button","",1,"action-button",3,"click"],[3,"click","active","svgIcon","iconSize","label"]],template:function(o,i){o&1&&(Pi$5(0,"div",2)(1,"div",3),_w(2,Er,2,1),_w(3,Lr,2,1),Pi$5(4,"button",4),Qh("click",function(){return i.onActionItem("settings")}),$h(5,"mat-icon",5),ul$2()(),Pi$5(6,"div",6,0),xw(8,zr,2,4,"tile-large-icon",7,Sw),ul$2(),Pi$5(10,"div",8)(11,"button",9),Qh("click",function(){return i.onActionItem("layout")}),Pi$5(12,"span",10),TT(13,"lock_open"),ul$2()()()()),o&2&&(EE(2),Mw(i.uiEvent.fullscreenSupported()?2:-1),EE(),Mw(i.isAutoNightMode()?-1:3),EE(5),Aw(i.menuItems()),EE(3),Bh("disabled",!i.isDashboardContext()));},dependencies:[yt$3,wt$3,Op,xp$1,R$2],styles:[".actions-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:135px}.actions-top-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.actions-bottom-container[_ngcontent-%COMP%]{height:48px;width:100%}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;flex:1 1 48px;min-height:0;overflow:hidden;border:1px solid var(--mat-sidenav-container-background-color, var(--mat-sys-surface))}.home-btn[_ngcontent-%COMP%]{--mat-icon-button-icon-size: 24px;--mat-button-filled-icon-offset: 0px;--mat-button-filled-icon-spacing: 0px;--mat-button-filled-label-text-size: 0px}.home-icon[_ngcontent-%COMP%] .mat-mdc-unelevated-button[_ngcontent-%COMP%] > .mat-icon[_ngcontent-%COMP%]{font-size:0px}.full-size[_ngcontent-%COMP%]{width:135px}.menu-item-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;padding:3px 1px;gap:5px;width:135px;overflow-y:auto;scrollbar-width:none;overflow-x:hidden;scroll-behavior:smooth;flex:1 1 auto;min-height:0}"]})}return t})();var fi=(()=>{class t{COMMAND_SET_DISPLAY_PATH="self.kip.remote.setDisplay";COMMAND_SET_SCREEN_INDEX_PATH="self.kip.remote.setScreenIndex";COMMAND_REQUEST_ACTIVE_SCREEN_PATH="self.kip.remote.requestActiveScreen";settings=w$4(Gi$3);dashboard=w$4(G$2);data=w$4(De$2);requests=w$4(T);KIP_UUID=this.settings.KipUUID;ACTIVE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.screenIndex`;CHANGE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.activeScreen`;displayName=Wp(this.settings.getInstanceNameAsO());isRemoteControl=Wp(this.settings.getIsRemoteControlAsO());remoteScreenPosition=Wp(this.data.subscribePath(this.ACTIVE_SCREEN_PATH,"default"));changeDashboardTo=Wp(this.data.subscribePath(this.CHANGE_SCREEN_PATH,"default"));previousIsRemoteControl=false;constructor(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),this.setScreensOnRemote(this.KIP_UUID,null),this.clearActiveScreenOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Cleaning paths on server"),Fa$5(()=>{let e=this.isRemoteControl();this.displayName();ge$5(()=>{if(!e&&!this.previousIsRemoteControl)return;this.previousIsRemoteControl=!!e;let i=null;e?(i=this.getScreensPayload(this.dashboard.dashboards()),this.dashboard.activeDashboard()!==null&&this.setActiveDashboardOnRemote(this.KIP_UUID,this.dashboard.activeDashboard())):(i=null,this.clearActiveDashboardOnServer()),this.shareScreens(i);});}),Fa$5(()=>{let e=this.dashboard.dashboards();ge$5(()=>{if(!this.isRemoteControl())return;let o=this.getScreensPayload(e);this.shareScreens(o);});}),Fa$5(()=>{let e=this.dashboard.activeDashboard();ge$5(()=>{this.isRemoteControl()&&e!==null&&(this.setActiveDashboardOnRemote(this.KIP_UUID,e),console.log(`[Remote Dashboards] Sent new dashboard highlight index ${e} to server.`));});}),Fa$5(()=>{let e=this.changeDashboardTo();ge$5(()=>{if(!this.isRemoteControl()||!e||e.data.value==null)return;let o=Number(e.data.value);!isNaN(o)&&o>=0&&o<this.dashboard.dashboards().length&&this.dashboard.activeDashboard()!==o&&(this.dashboard.navigateTo(o),console.log(`[Remote Dashboards] Executed remote request to change active dashboard to: ${o}`));});});}clearActiveDashboardOnServer(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Disabled: Cleared active dashboard on server");}getScreensPayload(e){let o=this.displayName()??"Unknown Display Name",i=e.map(s=>{var c=s,{configuration:r}=c,a=tm(c,["configuration"]);return a});return {displayName:o,screens:i}}shareScreens(e){this.setScreensOnRemote(this.KIP_UUID,e),console.log("[Remote Dashboards] Sending dashboard configurations to server.");}setActiveDashboardOnRemote(e,o){let i={displayId:e,screenIdx:o};this.requests.putRequest(this.COMMAND_SET_SCREEN_INDEX_PATH,i,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing active dashboard: request was not accepted");}setScreensOnRemote(e,o){let i={displayId:e,display:o===null?null:G$b({},o)};this.requests.putRequest(this.COMMAND_SET_DISPLAY_PATH,i,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing screen configuration: request was not accepted");}clearActiveScreenOnRemote(e,o){let i={displayId:e,screenIdx:o};this.requests.putRequest(this.COMMAND_REQUEST_ACTIVE_SCREEN_PATH,i,this.KIP_UUID)||console.error("[Remote Dashboards] Error clearing active screen request path: request was not accepted");}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var hi=11,mi="connectionConfig",fe=(()=>{class t{config=G$b({},Xe$1);isLoggedIn=false;loggedInSubscription;connection=w$4(T$2);auth=w$4(He$4);connectionStateMachine=w$4(We$3);router=w$4(G$3);delta=w$4(I$2);data=w$4(De$2);storage=w$4(Ge$3);internetReachability=w$4(w$1);injector=w$4(be$5);datasetService=null;_bootstrapStatus$=new Bn$5("starting");_bootstrapIssue$=new Bn$5({reason:"none"});constructor(){this.loggedInSubscription=this.auth.isLoggedIn$.subscribe(e=>{this.isLoggedIn=e;});}getErrorStatus(e){if(!e||typeof e!="object")return;let o=e;return typeof o.status=="number"?o.status:void 0}initNetworkServices(){return Zr$4(this,null,function*(){let e=false;this.loadLocalStorageConfig(),this.preloadFonts(),this.internetReachability.start();try{if(this.config?.signalKUrl!==void 0&&this.config.signalKUrl!==null&&(yield this.connection.initializeConnection({url:this.config.signalKUrl,new:!1},this.config.proxyEnabled,this.config.signalKSubscribeAll)),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.config?.loginName&&this.config?.loginPassword&&(yield this.login()),this.isLoggedIn&&this.config?.useSharedConfig)if(yield this.storage.waitUntilReady()){let i=yield this.storage.getConfig("user",this.config.sharedConfigName,hi),r={sharedConfigName:this.config.sharedConfigName,configFileVersion:hi,initConfig:i};this.storage.bootstrapRemoteContext(r);}else throw new Error("[AppInit Network Service] StorageService did not become ready in time. Cannot bootstrap remote configuration.");this._bootstrapIssue$.next({reason:"none"}),yield this.getDatasetService().waitUntilReady(),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.router.navigate(["/login"]);}catch(o){e=true;let i=this.getErrorStatus(o);if(i===404&&this.config?.useSharedConfig){let r=yield this.probeLegacyUpgradeAvailability(this.config.sharedConfigName);this._bootstrapIssue$.next({reason:"missing-shared-config",statusCode:404,sharedConfigName:this.config.sharedConfigName,legacyUpgradeAvailable:r});}else i===0?this._bootstrapIssue$.next({reason:"network-unreachable",statusCode:0}):i===401?this._bootstrapIssue$.next({reason:"unauthorized",statusCode:401}):this._bootstrapIssue$.next({reason:"unknown",statusCode:i});i===0?(yield this.waitForHttpRetryCompletion())===l$1.HTTPConnected||this.connectionStateMachine.isHTTPConnected()?console.warn("[AppInit Network Service] Initial connection recovered during retry cycle. Skipping fallback route."):(console.warn("[AppInit Network Service] Initialization failed after HTTP retries. Redirecting to settings page."),yield this.router.navigate(["/options"])):i===401?(console.warn("[AppInit Network Service] Initialization failed. Unauthorized access. Redirecting to login page."),yield this.router.navigate(["/login"])):(console.warn("[AppInit Network Service] Initialization failed. Error: ",JSON.stringify(o)),yield this.router.navigate(["/options"])),console.warn("[AppInit Network Service] Startup continuing in degraded mode to allow UI feedback."),this._bootstrapStatus$.next("degraded");return}finally{e||this._bootstrapStatus$.next("ready"),console.log("[AppInit Network Service] Initialization completed"),this.connectionStateMachine.enableWebSocketMode(),this.connectionStateMachine.isHTTPConnected()&&(console.log("[AppInit Network Service] Starting WebSocket connection after initialization"),this.connectionStateMachine.startWebSocketConnection());}})}get bootstrapStatus$(){return this._bootstrapStatus$.asObservable()}get bootstrapIssue$(){return this._bootstrapIssue$.asObservable()}getDatasetService(){return this.datasetService||(this.datasetService=this.injector.get(K$3)),this.datasetService}waitForHttpRetryCompletion(e){return Zr$4(this,null,function*(){let o=e??this.connectionStateMachine.getHttpRetryWindowMs(2e3),i=new Set([l$1.HTTPConnected,l$1.PermanentFailure]),r=this.connectionStateMachine.currentState;return i.has(r)?r:new Promise(a=>{let s=window.setTimeout(()=>{c.unsubscribe(),a(null);},o),c=this.connectionStateMachine.state$.subscribe(l=>{i.has(l)&&(clearTimeout(s),c.unsubscribe(),a(l));});})})}probeLegacyUpgradeAvailability(e){return Zr$4(this,null,function*(){if(!e)return false;try{return (yield this.storage.getConfig("user",e,9))?.app?.configVersion===10}catch(o){return false}})}login(){return Zr$4(this,null,function*(){if(!this.isLoggedIn&&this.config.useSharedConfig&&this.config.loginName&&this.config.loginPassword)try{yield this.auth.login({usr:this.config.loginName,pwd:this.config.loginPassword});}catch(e){let o=this.getErrorStatus(e);throw o===0?yield this.router.navigate(["/settings"]):o===401&&(yield this.router.navigate(["/login"])),e}})}setLocalStorageConfig(){localStorage.setItem(mi,JSON.stringify(this.config));}loadLocalStorageConfig(){let e=localStorage.getItem(mi);this.config=e?JSON.parse(e):G$b({},Xe$1),e?this.config.signalKUrl||(this.config.signalKUrl=window.location.origin,this.setLocalStorageConfig(),console.log(`[AppInit Network Service] Config found with no server URL. Setting Auto-Discovery URL: ${this.config.signalKUrl}`)):(this.config=G$b({},Xe$1),this.config.signalKUrl=window.location.origin,console.log(`[AppInit Network Service] Connection Configuration not found. Creating configuration using Auto-Discovery URL: ${this.config.signalKUrl}`),this.setLocalStorageConfig()),this.config.configVersion==9&&(this.config.configVersion=10,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 9 to 10")),this.config.configVersion==10&&(this.config.configVersion=11,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 10 to 11")),this.config.configVersion==11&&(this.config.configVersion=12,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 11 to 12"));}preloadFonts(){let e=[{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fChc4AMP6lbBP.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fBBc4AMP6lQ.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2)",options:{weight:"500",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.woff2)",options:{weight:"500",style:"normal"}}];for(let{family:o,src:i,options:r}of e){let a=new FontFace(o,i,r);a.load().then(()=>document.fonts.add(a)).catch(s=>console.log(`[AppInit Network Service] Error loading fonts: ${s}`));}}ngOnDestroy(){this.loggedInSubscription?.unsubscribe();}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();var jr=["upgradeMessages"];function Ur(t,n){if(t&1&&(Pi$5(0,"li"),TT(1),ul$2()),t&2){let e=n.$implicit;EE(),gg(e);}}function Br(t,n){if(t&1&&(Pi$5(0,"ul",11,1),xw(2,Ur,2,1,"li",null,Sw),ul$2()),t&2){let e=qw(2);EE(2),Aw(e.upgrade.messages());}}function Fr(t,n){if(t&1&&(Pi$5(0,"div",7)(1,"div",8),$h(2,"mat-progress-spinner",9),Pi$5(3,"div",10)(4,"h3"),TT(5,"Upgrading Configuration\u2026"),ul$2(),Pi$5(6,"p"),TT(7,"Please wait a moment while we migrate your dashboards and widgets."),ul$2(),_w(8,Br,4,0,"ul",11),ul$2()()()),t&2){let e=qw();EE(8),Mw(e.upgrade.messages().length?8:-1);}}var pi=(()=>{class t{_deltaService=w$4(I$2);_connectionStateMachine=w$4(We$3);_appNetworkInit=w$4(fe);_historySeriesReconcile=w$4(Qt$2);authenticationService=w$4(He$4);_dataSet=w$4(K$3);_dashboard=w$4(G$2);_remoteControl=w$4(fi);toast=w$4(lt$3);_notifications=w$4(O$1);_uiEvent=w$4(re$5);_dialog=w$4(Ff);settings=w$4(Gi$3);_responsive=w$4(ir$4);_destroyRef=w$4(xe$3);_notificationOverlay=w$4(di);_router=w$4(G$3);upgrade=w$4(Pn$2);upgradeMessagesRef=$j("upgradeMessages");_upgradeShown=false;actionsSidenavOpened=Bj(false);notificationsSidenavOpened=Bj(false);notificationsInfo=Wp(this._notifications.observerNotificationsInfo());bootstrapStatus=Wp(this._appNetworkInit.bootstrapStatus$,{initialValue:"starting"});bootstrapIssue=Wp(this._appNetworkInit.bootstrapIssue$,{initialValue:{reason:"none"}});dashboardVisible=vt$9(false);isPhonePortrait;scheduledOpen=null;OPEN_DELAY_MS=300;missingConfigPromptShown=false;_swipeLeftHandler=()=>this.onSwipeLeft();_swipeRightHandler=()=>this.onSwipeRight();_hotkeyHandler=e=>this.handleKeyDown(e);constructor(){Fa$5(()=>{if(this.settings.configUpgrade()){let e=this.settings.getConfigVersion();e===11&&this.upgrade.runUpgrade(e),e||this._upgradeShown||(this._upgradeShown=true,this._dialog.openFrameDialog({title:"Upgrade Instructions",component:"upgrade-config"},true).pipe(Gp(this._destroyRef)).subscribe());}}),Fa$5(()=>{let e=this.upgrade.messages(),o=this.upgradeMessagesRef();if(this.upgrade.upgrading()&&e.length&&o){let i=o.nativeElement;i.scrollTop=i.scrollHeight;}});try{this.dashboardVisible.set(this.isUrlDashboard(this._router.url));}catch(e){}this._router.events.pipe(fn$7(e=>e instanceof $$2),Gp(this._destroyRef)).subscribe(e=>{try{this.dashboardVisible.set(this.isUrlDashboard(e.urlAfterRedirects||e.url));}catch(o){}}),Fa$5(()=>{let e=this.dashboardVisible()&&this._dashboard.isDashboardStatic()&&(this.notificationsInfo()?.alarmCount??0)>0;if(this.notificationsSidenavOpened()){this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close();}catch(i){}return}if(e){if(this.scheduledOpen)return;this.scheduledOpen=window.setTimeout(()=>{this.scheduledOpen=null;try{this._notificationOverlay.open();}catch(i){}},this.OPEN_DELAY_MS);}else {this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close();}catch(i){}}}),Fa$5(()=>{if(this.notificationsSidenavOpened())try{this._notificationOverlay.close();}catch(o){}}),this.isPhonePortrait=Wp(this._responsive.observe(Em.HandsetPortrait),{initialValue:{matches:false,breakpoints:{}}}),this._connectionStateMachine.status$.pipe(Gp(this._destroyRef)).subscribe(e=>this.displayConnectionsStatusNotification(e)),Fa$5(()=>{let e=this.bootstrapIssue();if(e.reason!=="missing-shared-config"||this.missingConfigPromptShown)return;this.missingConfigPromptShown=true;let o=e.sharedConfigName||"default",i=e.legacyUpgradeAvailable===true,r=i?"Upgrade":"Create",a=i?`Server is reachable, but no current version shared configuration '${o}' exists for this user. A legacy configuration was found and can be upgraded. Upgrade now?`:`Server is reachable, but no shared configuration '${o}' exists for this user. Create a default configuration now?`;this.toast.show(a,0,true,"warn",r).onAction().pipe(Gp(this._destroyRef)).subscribe(()=>{i?this.upgrade.runUpgrade():this.settings.resetSettings();});});}isUrlDashboard(e){if(!e)return false;let o=e.split("?")[0].replace(/\/+$/,"");return o==="/"||o==="/dashboard"||/^\/dashboard(\/\d+)?$/.test(o)||o==="/chartplotter"||/^\/chartplotter(\/\d+)?$/.test(o)}ngOnInit(){this._uiEvent.addGestureListeners(this._swipeLeftHandler,this._swipeRightHandler);}ngAfterViewInit(){this._uiEvent.addHotkeyListener(this._hotkeyHandler,{ctrlKey:true,keys:["arrowright","arrowleft"]});}handleKeyDown(e){switch(e){case "arrowright":this.onSwipeRight();break;case "arrowleft":this.onSwipeLeft();break;case "escape":this.backdropClicked();break}}escapeKeyPressed(e){e=e.toLowerCase(),e==="escape"&&this.backdropClicked();}displayConnectionsStatusNotification(e){let o=e.message,i=this.bootstrapStatus()!=="ready";switch(e.operation){case 0:this.toast.show(o,5e3,true);break;case 1:case 2:break;case 3:this.toast.show(o,3e3,i,"warn");break;case 4:this.toast.show(o,3e3,true,"info");break;case 5:this.toast.show(o,0,i);break;default:console.error("[AppComponent] Unknown operation code:",e.operation),this.toast.show(`Unknown connection status: ${e.state}`,0,i,"error");}}onSwipeRight(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.actionsSidenavOpened.set(false),this.notificationsSidenavOpened.set(true)):(this.actionsSidenavOpened.set(false),this.notificationsSidenavOpened.update(e=>!e)));}backdropClicked(){this.notificationsSidenavOpened.update(e=>e?!e:false),this.actionsSidenavOpened.update(e=>e?!e:false);}onSwipeLeft(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.notificationsSidenavOpened.set(false),this.actionsSidenavOpened.set(true)):(this.notificationsSidenavOpened.set(false),this.actionsSidenavOpened.update(e=>!e)));}ngOnDestroy(){this._uiEvent.removeGestureListeners(this._swipeLeftHandler,this._swipeRightHandler),this._uiEvent.removeHotkeyListener(this._hotkeyHandler),this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=JD({type:t,selectors:[["app-root"]],viewQuery:function(o,i){o&1&&eg(i.upgradeMessagesRef,jr,5),o&2&&Kw();},inputs:{actionsSidenavOpened:[1,"actionsSidenavOpened"],notificationsSidenavOpened:[1,"notificationsSidenavOpened"]},outputs:{actionsSidenavOpened:"actionsSidenavOpenedChange",notificationsSidenavOpened:"notificationsSidenavOpenedChange"},decls:9,vars:6,consts:[["actionsSidenav",""],["upgradeMessages",""],["kipGestures","",1,"sidenav-container",3,"swipeleft","swiperight","backdropClick","mode","bridgeUiEvents"],["mode","over","position","start","autoFocus","true","disableClose","",1,"sidenav-notifications",3,"openedChange","keydown","opened"],["mode","over","position","end","autoFocus","true","disableClose","",1,"sidenav-actions",3,"openedChange","keydown","opened"],[3,"actionsSidenav"],[1,"router-outlet-container"],["role","alert","aria-live","polite",1,"config-upgrade-overlay"],[1,"config-upgrade-card"],["diameter","46","mode","indeterminate"],[1,"config-upgrade-text"],[1,"config-upgrade-messages"]],template:function(o,i){if(o&1){let r=Fw();Pi$5(0,"mat-sidenav-container",2),Qh("swipeleft",function(){return i.onSwipeLeft()})("swiperight",function(){return i.onSwipeRight()})("backdropClick",function(){return i.backdropClicked()}),Pi$5(1,"mat-sidenav",3),Eg("openedChange",function(s){return ud(r),ST(i.notificationsSidenavOpened,s)||(i.notificationsSidenavOpened=s),dd(s)}),Qh("keydown",function(s){return i.escapeKeyPressed(s.key)}),$h(2,"menu-notifications"),ul$2(),Pi$5(3,"mat-sidenav",4,0),Eg("openedChange",function(s){return ud(r),ST(i.actionsSidenavOpened,s)||(i.actionsSidenavOpened=s),dd(s)}),Qh("keydown",function(s){return i.escapeKeyPressed(s.key)}),$h(5,"menu-actions",5),ul$2(),Pi$5(6,"mat-sidenav-content"),$h(7,"router-outlet",6),ul$2()(),_w(8,Fr,9,1,"div",7);}if(o&2){let r=Jw(4);Bh("mode","horizontal")("bridgeUiEvents",true),EE(),Ig("opened",i.notificationsSidenavOpened),EE(2),Ig("opened",i.actionsSidenavOpened),EE(2),Bh("actionsSidenav",r),EE(3),Mw(i.upgrade.upgrading()?8:-1);}},dependencies:[ci,ui,Op,Ht$1,yt$3,ta$3,yr$3,ut$b,He$9,ht$a,Te$4,L$5,we$5,Mt$8,Dt$6],styles:[".sidenav-container[_ngcontent-%COMP%]{height:100%;width:100%;--mat-sidenav-scrim-color: color-mix(in srgb, var(--mat-sys-neutral-variant20) 70%, transparent)}mat-sidenav-content[_ngcontent-%COMP%]{overflow-y:hidden;overflow-x:hidden}mat-sidenav[_ngcontent-%COMP%]{box-shadow:0 0 1px 0 var(--kip-contrast-color)}mat-sidenav.sidenav-notifications[_ngcontent-%COMP%]{width:230px;z-index:1200}mat-sidenav.sidenav-actions[_ngcontent-%COMP%]{width:135px;z-index:1200;overflow-x:hidden}.config-upgrade-overlay[_ngcontent-%COMP%]{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#00000073;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:2000;pointer-events:all}.config-upgrade-card[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:18px;padding:20px 24px;width:clamp(300px,60vw,640px);background:var(--kip-background, #1f1f1f);border:1px solid rgba(255,255,255,.18);border-radius:14px;color:var(--kip-contrast-color, #fff);box-shadow:0 6px 22px #0000008c}.config-upgrade-text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 4px;font-size:1.05rem;font-weight:600;letter-spacing:.5px}.config-upgrade-text[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 10px;font-size:.8rem;opacity:.85}.config-upgrade-messages[_ngcontent-%COMP%]{list-style:disc;margin:0;padding-left:18px;max-height:180px;font-size:.68rem;line-height:1.25;scrollbar-width:thin;overflow-y:auto}.config-upgrade-messages[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-bottom:2px}"]})}return t})();var gi=(()=>{class t{auth=w$4(He$4);authToken=null;authTokenSubscription=null;constructor(){this.authTokenSubscription=this.auth.authToken$.subscribe(e=>{this.authToken=e;});}intercept(e,o){let i=e.clone();return this.authToken&&(i=e.clone({headers:e.headers.set("authorization","JWT "+this.authToken.token)})),o.handle(i)}ngOnDestroy(){this.authTokenSubscription?.unsubscribe();}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();var bi=(()=>{class t extends xt$8{_createContainer(){let e=document.createElement("div");e.classList.add("cdk-overlay-container"),(document.getElementById("app-filter-wrapper")||document.querySelector("app-root")||document.body).appendChild(e),this._containerElement=e;}static \u0275fac=(()=>{let e;return function(i){return (e||(e=Sv(t)))(i||t)}})();static \u0275prov=Q$6({token:t,factory:t.\u0275fac})}return t})();var yi=(()=>{class t{_router=w$4(G$3);_dialog=w$4(ee$7);_bottomSheet=w$4(DA);_destroyRef=w$4(xe$3);constructor(){this._router.events.pipe(fn$7(e=>e instanceof te$3),Gp(this._destroyRef)).subscribe(()=>{this._dialog.openDialogs.length>0&&this._dialog.closeAll(),this._bottomSheet.dismiss();});}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Q$6({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var vi={modes:{point(t,n){return Fe(t,n,{intersect:true})},nearest(t,n,e){return $r(t,n,e)},x(t,n,e){return Fe(t,n,{intersect:e.intersect,axis:"x"})},y(t,n,e){return Fe(t,n,{intersect:e.intersect,axis:"y"})}}};function bn(t,n,e){return (vi.modes[e.mode]||vi.modes.nearest)(t,n,e)}function Hr(t,n,e){return e!=="x"&&e!=="y"?t.inRange(n.x,n.y,"x",true)||t.inRange(n.x,n.y,"y",true):t.inRange(n.x,n.y,e,true)}function Vr(t,n,e){return e==="x"?{x:t.x,y:n.y}:e==="y"?{x:n.x,y:t.y}:n}function Fe(t,n,e){return t.filter(o=>e.intersect?o.inRange(n.x,n.y):Hr(o,n,e.axis))}function $r(t,n,e){let o=Number.POSITIVE_INFINITY;return Fe(t,n,e).reduce((i,r)=>{let a=r.getCenterPoint(),s=Vr(n,a,e.axis),c=Ie(n,s);return c<o?(i=[r],o=c):c===o&&i.push(r),i},[]).sort((i,r)=>i._index-r._index).slice(0,1)}function Rt(t,n,e){let o=Math.cos(e),i=Math.sin(e),r=n.x,a=n.y;return {x:r+o*(t.x-r)-i*(t.y-a),y:a+i*(t.x-r)+o*(t.y-a)}}var Wr=(t,n)=>n>t||t.length>n.length&&t.slice(0,n.length)===n,At=.001,Ve=(t,n,e)=>Math.min(e,Math.max(n,t)),Ui=(t,n)=>t.value>=t.start-n&&t.value<=t.end+n;function Kr(t,n,e){for(let o of Object.keys(t))t[o]=Ve(t[o],n,e);return t}function qr(t,n,e,o){return !t||!n||e<=0?false:Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)<=Math.pow(e+o,2)}function Bi(t,{x:n,y:e,x2:o,y2:i},r,{borderWidth:a,hitTolerance:s}){let c=(a+s)/2,l=t.x>=n-c-At&&t.x<=o+c+At,d=t.y>=e-c-At&&t.y<=i+c+At;return r==="x"?l:(r==="y"||l)&&d}function Fi(t,{rect:n,center:e},o,{rotation:i,borderWidth:r,hitTolerance:a}){let s=Rt(t,e,it(-i));return Bi(s,n,o,{borderWidth:r,hitTolerance:a})}function Nt(t,n){let{centerX:e,centerY:o}=t.getProps(["centerX","centerY"],n);return {x:e,y:o}}function Yr(t,n,e,o=true){let i=e.split("."),r=0;for(let a of n.split(".")){let s=i[r++];if(parseInt(a,10)<parseInt(s,10))break;if(Wr(s,a)){if(o)throw new Error(`${t} v${e} is not supported. v${n} or newer is required.`);return false}}return true}var Hi=t=>typeof t=="string"&&t.endsWith("%"),Vi=t=>parseFloat(t)/100,$i=t=>Ve(Vi(t),0,1),he=(t,n)=>({x:t,y:n,x2:t,y2:n,width:0,height:0}),Xr={box:t=>he(t.centerX,t.centerY),doughnutLabel:t=>he(t.centerX,t.centerY),ellipse:t=>({centerX:t.centerX,centerY:t.centerX,radius:0,width:0,height:0}),label:t=>he(t.centerX,t.centerY),line:t=>he(t.x,t.y),point:t=>({centerX:t.centerX,centerY:t.centerY,radius:0,width:0,height:0}),polygon:t=>he(t.centerX,t.centerY)};function yn(t,n){return n==="start"?0:n==="end"?t:Hi(n)?$i(n)*t:t/2}function xt(t,n,e=true){return typeof n=="number"?n:Hi(n)?(e?$i(n):Vi(n))*t:t}function Gr(t,n){let{x:e,width:o}=t,i=n.textAlign;return i==="center"?e+o/2:i==="end"||i==="right"?e+o:e}function Wi(t,n,{borderWidth:e,position:o,xAdjust:i,yAdjust:r},a){let s=O(a),c=n.width+(s?a.width:0)+e,l=n.height+(s?a.height:0)+e,d=vn(o),u=_i(t.x,c,i,d.x),f=_i(t.y,l,r,d.y);return {x:u,y:f,x2:u+c,y2:f+l,width:c,height:l,centerX:u+c/2,centerY:f+l/2}}function vn(t,n="center"){return O(t)?{x:P(t.x,n),y:P(t.y,n)}:(t=P(t,n),{x:t,y:t})}var Ki=(t,n)=>t&&t.autoFit&&n<1;function qi(t,n){let e=t.font,o=F(e)?e:[e];return Ki(t,n)?o.map(function(i){let r=j(i);return r.size=Math.floor(i.size*n),r.lineHeight=i.lineHeight,j(r)}):o.map(i=>j(i))}function Yi(t){return t&&(Xt(t.xValue)||Xt(t.yValue))}function _i(t,n,e=0,o){return t-yn(n,o)+e}function ee(t,n,e){let o=e.init;if(o){if(o===true)return Gi(n,e)}else return;return Jr(t,n,e)}function Xi(t,n,e){let o=false;return n.forEach(i=>{ft$1(t[i])?(o=true,e[i]=t[i]):Xt(e[i])&&delete e[i];}),o}function Gi(t,n){let e=n.type||"line";return Xr[e](t)}function Jr(t,n,e){let o=I(e.init,[{chart:t,properties:n,options:e}]);if(o===true)return Gi(n,e);if(O(o))return o}var ln=new Map,Qr=t=>isNaN(t)||t<=0,Zr=t=>t.reduce(function(n,e){return n+=e.string,n},"");function $e(t){if(t&&typeof t=="object"){let n=t.toString();return n==="[object HTMLImageElement]"||n==="[object HTMLCanvasElement]"}}function We(t,{x:n,y:e},o){o&&(t.translate(n,e),t.rotate(it(o)),t.translate(-n,-e));}function ut(t,n){if(n&&n.borderWidth)return t.lineCap=n.borderCapStyle||"butt",t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,t.lineJoin=n.borderJoinStyle||"miter",t.lineWidth=n.borderWidth,t.strokeStyle=n.borderColor,true}function ne(t,n){t.shadowColor=n.backgroundShadowColor,t.shadowBlur=n.shadowBlur,t.shadowOffsetX=n.shadowOffsetX,t.shadowOffsetY=n.shadowOffsetY;}function Ke(t,n){let e=n.content;if($e(e))return {width:xt(e.width,n.width),height:xt(e.height,n.height)};let o=qi(n),i=n.textStrokeWidth,r=F(e)?e:[e],a=r.join()+Zr(o)+i+(t._measureText?"-spriting":"");return ln.has(a)||ln.set(a,oa(t,r,o,i)),ln.get(a)}function Ji(t,n,e){let{x:o,y:i,width:r,height:a}=n;t.save(),ne(t,e);let s=ut(t,e);t.fillStyle=e.backgroundColor,t.beginPath(),Jt$1(t,{x:o,y:i,w:r,h:a,radius:Kr(Pt(e.borderRadius),0,Math.min(r,a)/2)}),t.closePath(),t.fill(),s&&(t.shadowColor=e.borderShadowColor,t.stroke()),t.restore();}function Qi(t,n,e,o){let i=e.content;if($e(i)){t.save(),t.globalAlpha=aa(e.opacity,i.style.opacity),t.drawImage(i,n.x,n.y,n.width,n.height),t.restore();return}let r=F(i)?i:[i],a=qi(e,o),s=e.color,c=F(s)?s:[s],l=Gr(n,e),d=n.y+e.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=e.textAlign,ta(t,e)&&ia(t,{x:l,y:d},r,a),ra(t,{x:l,y:d},r,{fonts:a,colors:c}),t.restore();}function ta(t,n){if(n.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=n.textStrokeWidth,t.strokeStyle=n.textStrokeColor,true}function ea(t,n,e,o){let{radius:i,options:r}=n,a=r.pointStyle,s=r.rotation,c=(s||0)*ga$1;if($e(a)){t.save(),t.translate(e,o),t.rotate(c),t.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),t.restore();return}Qr(i)||na(t,{x:e,y:o,radius:i,rotation:s,style:a,rad:c});}function na(t,{x:n,y:e,radius:o,rotation:i,style:r,rad:a}){let s,c,l,d;switch(t.beginPath(),r){default:t.arc(n,e,o,0,z),t.closePath();break;case "triangle":t.moveTo(n+Math.sin(a)*o,e-Math.cos(a)*o),a+=Es,t.lineTo(n+Math.sin(a)*o,e-Math.cos(a)*o),a+=Es,t.lineTo(n+Math.sin(a)*o,e-Math.cos(a)*o),t.closePath();break;case "rectRounded":d=o*.516,l=o-d,s=Math.cos(a+Lt$1)*l,c=Math.sin(a+Lt$1)*l,t.arc(n-s,e-c,d,a-L,a-N),t.arc(n+c,e-s,d,a-N,a),t.arc(n+s,e+c,d,a,a+N),t.arc(n-c,e+s,d,a+N,a+L),t.closePath();break;case "rect":if(!i){l=Math.SQRT1_2*o,t.rect(n-l,e-l,2*l,2*l);break}a+=Lt$1;case "rectRot":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+c,e-s),t.lineTo(n+s,e+c),t.lineTo(n-c,e+s),t.closePath();break;case "crossRot":a+=Lt$1;case "cross":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c),t.moveTo(n+c,e-s),t.lineTo(n-c,e+s);break;case "star":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c),t.moveTo(n+c,e-s),t.lineTo(n-c,e+s),a+=Lt$1,s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c),t.moveTo(n+c,e-s),t.lineTo(n-c,e+s);break;case "line":s=Math.cos(a)*o,c=Math.sin(a)*o,t.moveTo(n-s,e-c),t.lineTo(n+s,e+c);break;case "dash":t.moveTo(n,e),t.lineTo(n+Math.cos(a)*o,e+Math.sin(a)*o);break}t.fill();}function oa(t,n,e,o){t.save();let i=n.length,r=0,a=o;for(let s=0;s<i;s++){let c=e[Math.min(s,e.length-1)];t.font=c.string;let l=n[s];r=Math.max(r,t.measureText(l).width+o),a+=c.lineHeight;}return t.restore(),{width:r,height:a}}function ia(t,{x:n,y:e},o,i){t.beginPath();let r=0;o.forEach(function(a,s){let c=i[Math.min(s,i.length-1)],l=c.lineHeight;t.font=c.string,t.strokeText(a,n,e+l/2+r),r+=l;}),t.stroke();}function ra(t,{x:n,y:e},o,{fonts:i,colors:r}){let a=0;o.forEach(function(s,c){let l=r[Math.min(c,r.length-1)],d=i[Math.min(c,i.length-1)],u=d.lineHeight;t.beginPath(),t.font=d.string,t.fillStyle=l,t.fillText(s,n,e+u/2+a),a+=u,t.fill();});}function aa(t,n){let e=It(t)?t:n;return It(e)?Ve(e,0,1):1}var Zi=["left","bottom","top","right"];function sa(t,n){let{pointX:e,pointY:o,options:i}=n,r=i.callout,a=r&&r.display&&fa(n,r);if(!a||ma(n,r,a))return;if(t.save(),t.beginPath(),!ut(t,r))return t.restore();let{separatorStart:c,separatorEnd:l}=ca(n,a),{sideStart:d,sideEnd:u}=da(n,a,c);(r.margin>0||i.borderWidth===0)&&(t.moveTo(c.x,c.y),t.lineTo(l.x,l.y)),t.moveTo(d.x,d.y),t.lineTo(u.x,u.y);let f=Rt({x:e,y:o},n.getCenterPoint(),it(-n.rotation));t.lineTo(f.x,f.y),t.stroke(),t.restore();}function ca(t,n){let{x:e,y:o,x2:i,y2:r}=t,a=la(t,n),s,c;return n==="left"||n==="right"?(s={x:e+a,y:o},c={x:s.x,y:r}):(s={x:e,y:o+a},c={x:i,y:s.y}),{separatorStart:s,separatorEnd:c}}function la(t,n){let{width:e,height:o,options:i}=t,r=i.callout.margin+i.borderWidth/2;return n==="right"?e+r:n==="bottom"?o+r:-r}function da(t,n,e){let{y:o,width:i,height:r,options:a}=t,s=a.callout.start,c=ua(n,a.callout),l,d;return n==="left"||n==="right"?(l={x:e.x,y:o+xt(r,s)},d={x:l.x+c,y:l.y}):(l={x:e.x+xt(i,s),y:e.y},d={x:l.x,y:l.y+c}),{sideStart:l,sideEnd:d}}function ua(t,n){let e=n.side;return t==="left"||t==="top"?-e:e}function fa(t,n){let e=n.position;return Zi.includes(e)?e:ha(t,n)}function ha(t,n){let{x:e,y:o,x2:i,y2:r,width:a,height:s,pointX:c,pointY:l,centerX:d,centerY:u,rotation:f}=t,p={x:d,y:u},m=n.start,b=xt(a,m),y=xt(s,m),_=[e,e+b,e+b,i],w=[o+y,r,o,r],S=[];for(let k=0;k<4;k++){let D=Rt({x:_[k],y:w[k]},p,it(f));S.push({position:Zi[k],distance:Ie(D,{x:c,y:l})});}return S.sort((k,D)=>k.distance-D.distance)[0].position}function ma(t,n,e){let{pointX:o,pointY:i}=t,r=n.margin,a=o,s=i;return e==="left"?a+=r:e==="right"?a-=r:e==="top"?s+=r:e==="bottom"&&(s-=r),t.inRange(a,s)}var Si={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function Jt(t,n,e){return n=typeof n=="number"?n:t.parse(n),W(n)?t.getPixelForValue(n):e}function Ot(t,n,e){let o=n[e];if(o||e==="scaleID")return o;let i=e.charAt(0),r=Object.values(t).filter(a=>a.axis&&a.axis===i);return r.length?r[0].id:i}function tr(t,n){if(t){let e=t.options.reverse,o=Jt(t,n.min,e?n.end:n.start),i=Jt(t,n.max,e?n.start:n.end);return {start:o,end:i}}}function er(t,n){let{chartArea:e,scales:o}=t,i=o[Ot(o,n,"xScaleID")],r=o[Ot(o,n,"yScaleID")],a=e.width/2,s=e.height/2;return i&&(a=Jt(i,n.xValue,i.left+i.width/2)),r&&(s=Jt(r,n.yValue,r.top+r.height/2)),{x:a,y:s}}function _n(t,n){let e=t.scales,o=e[Ot(e,n,"xScaleID")],i=e[Ot(e,n,"yScaleID")];if(!o&&!i)return {};let{left:r,right:a}=o||t.chartArea,{top:s,bottom:c}=i||t.chartArea,l=wi(o,{min:n.xMin,max:n.xMax,start:r,end:a});r=l.start,a=l.end;let d=wi(i,{min:n.yMin,max:n.yMax,start:c,end:s});return s=d.start,c=d.end,{x:r,y:s,x2:a,y2:c,width:a-r,height:c-s,centerX:r+(a-r)/2,centerY:s+(c-s)/2}}function nr(t,n){if(!Yi(n)){let e=_n(t,n),o=n.radius;(!o||isNaN(o))&&(o=Math.min(e.width,e.height)/2,n.radius=o);let i=o*2,r=e.centerX+n.xAdjust,a=e.centerY+n.yAdjust;return {x:r-o,y:a-o,x2:r+o,y2:a+o,centerX:r,centerY:a,width:i,height:i,radius:o}}return ga(t,n)}function pa(t,n){let{scales:e,chartArea:o}=t,i=e[n.scaleID],r={x:o.left,y:o.top,x2:o.right,y2:o.bottom};return i?ba(i,r,n):ya(e,r,n),r}function or(t,n){let e=_n(t,n);return e.initProperties=ee(t,e,n),e.elements=[{type:"label",optionScope:"label",properties:Sa(t,e,n),initProperties:e.initProperties}],e}function ga(t,n){let e=er(t,n),o=n.radius*2;return {x:e.x-n.radius+n.xAdjust,y:e.y-n.radius+n.yAdjust,x2:e.x+n.radius+n.xAdjust,y2:e.y+n.radius+n.yAdjust,centerX:e.x+n.xAdjust,centerY:e.y+n.yAdjust,radius:n.radius,width:o,height:o}}function wi(t,n){let e=tr(t,n)||n;return {start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function ba(t,n,e){let o=Jt(t,e.value,NaN),i=Jt(t,e.endValue,o);t.isHorizontal()?(n.x=o,n.x2=i):(n.y=o,n.y2=i);}function ya(t,n,e){for(let o of Object.keys(Si)){let i=t[Ot(t,e,o)];if(i){let{min:r,max:a,start:s,end:c,startProp:l,endProp:d}=Si[o],u=tr(i,{min:e[r],max:e[a],start:i[s],end:i[c]});n[l]=u.start,n[d]=u.end;}}}function va({properties:t,options:n},e,o,i){let{x:r,x2:a,width:s}=t;return ir({start:r,end:a,borderWidth:n.borderWidth},{position:o.x,padding:{start:i.left,end:i.right},adjust:n.label.xAdjust,size:e.width})}function _a({properties:t,options:n},e,o,i){let{y:r,y2:a,height:s}=t;return ir({start:r,end:a,borderWidth:n.borderWidth},{position:o.y,padding:{start:i.top,end:i.bottom},adjust:n.label.yAdjust,size:e.height})}function ir(t,n){let{start:e,end:o,borderWidth:i}=t,{position:r,padding:{start:a,end:s},adjust:c}=n,l=o-i-e-a-s-n.size;return e+i/2+c+yn(l,r)}function Sa(t,n,e){let o=e.label;o.backgroundColor="transparent",o.callout.display=false;let i=vn(o.position),r=K(o.padding),a=Ke(t.ctx,o),s=va({properties:n,options:e},a,i,r),c=_a({properties:n,options:e},a,i,r),l=a.width+r.width,d=a.height+r.height;return {x:s,y:c,x2:s+l,y2:c+d,width:l,height:d,centerX:s+l/2,centerY:c+d/2,rotation:o.rotation}}var dn=["enter","leave"],Sn=dn.concat("click");function wa(t,n,e){n.listened=Xi(e,Sn,n.listeners),n.moveListened=false,dn.forEach(o=>{ft$1(e[o])&&(n.moveListened=true);}),(!n.listened||!n.moveListened)&&n.annotations.forEach(o=>{!n.listened&&ft$1(o.click)&&(n.listened=true),n.moveListened||dn.forEach(i=>{ft$1(o[i])&&(n.listened=true,n.moveListened=true);});});}function Ca(t,n,e){if(t.listened)switch(n.type){case "mousemove":case "mouseout":return xa(t,n,e);case "click":return Ma(t,n,e)}}function xa(t,n,e){if(!t.moveListened)return;let o;n.type==="mousemove"?o=bn(t.visibleElements,n,e.interaction):o=[];let i=t.hovered;t.hovered=o;let r={state:t,event:n},a=Ci(r,"leave",i,o);return Ci(r,"enter",o,i)||a}function Ci({state:t,event:n},e,o,i){let r;for(let a of o)i.indexOf(a)<0&&(r=rr(a.options[e]||t.listeners[e],a,n)||r);return r}function Ma(t,n,e){let o=t.listeners,i=bn(t.visibleElements,n,e.interaction),r;for(let a of i)r=rr(a.options.click||o.click,a,n)||r;return r}function rr(t,n,e){return I(t,[n.$context,e])===true}var He=["afterDraw","beforeDraw"];function ka(t,n,e){let o=n.visibleElements;n.hooked=Xi(e,He,n.hooks),n.hooked||o.forEach(i=>{n.hooked||He.forEach(r=>{ft$1(i.options[r])&&(n.hooked=true);});});}function xi(t,n,e){if(t.hooked){let o=n.options[e]||t.hooks[e];return I(o,[n.$context])}}function Ia(t,n,e){let o=Ta(t.scales,n,e),i=Mi(n,o,"min","suggestedMin");i=Mi(n,o,"max","suggestedMax")||i,i&&ft$1(n.handleTickRangeOptions)&&n.handleTickRangeOptions();}function Pa(t,n){for(let e of t)Aa(e,n);}function Mi(t,n,e,o){if(W(n[e])&&!Da(t.options,e,o)){let i=t[e]!==n[e];return t[e]=n[e],i}}function Da(t,n,e){return Xt(t[n])||Xt(t[e])}function Aa(t,n){for(let e of ["scaleID","xScaleID","yScaleID"]){let o=Ot(n,t,e);o&&!n[o]&&Oa(t,e)&&console.warn(`No scale found with id '${o}' for annotation '${t.id}'`);}}function Oa(t,n){if(n==="scaleID")return true;let e=n.charAt(0);for(let o of ["Min","Max","Value"])if(Xt(t[e+o]))return true;return false}function Ta(t,n,e){let o=n.axis,i=n.id,r=o+"ScaleID",a={min:P(n.min,Number.NEGATIVE_INFINITY),max:P(n.max,Number.POSITIVE_INFINITY)};for(let s of e)s.scaleID===i?ki(s,n,["value","endValue"],a):Ot(t,s,r)===i&&ki(s,n,[o+"Min",o+"Max",o+"Value"],a);return a}function ki(t,n,e,o){for(let i of e){let r=t[i];if(Xt(r)){let a=n.parse(r);o.min=Math.min(o.min,a),o.max=Math.max(o.max,a);}}}var Mt=class extends ot{inRange(n,e,o,i){let{x:r,y:a}=Rt({x:n,y:e},this.getCenterPoint(i),it(-this.options.rotation));return Bi({x:r,y:a},this.getProps(["x","y","x2","y2"],i),o,this.options)}getCenterPoint(n){return Nt(this,n)}draw(n){n.save(),We(n,this.getCenterPoint(),this.options.rotation),Ji(n,this,this.options),n.restore();}get label(){return this.elements&&this.elements[0]}resolveElementProperties(n,e){return or(n,e)}};Mt.id="boxAnnotation";Mt.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:true,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:false},color:"black",content:null,display:false,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Mt.defaultRoutes={borderColor:"color",backgroundColor:"color"};Mt.descriptors={label:{_fallback:true}};var Qt=class extends ot{inRange(n,e,o,i){return Fi({x:n,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},o,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(n){return Nt(this,n)}draw(n){let e=this.options;!e.display||!e.content||(ja(n,this),n.save(),We(n,this.getCenterPoint(),this.rotation),Qi(n,this,e,this._fitRatio),n.restore());}resolveElementProperties(n,e){let o=Ea(n,e);if(!o)return {};let{controllerMeta:i,point:r,radius:a}=Na(n,e,o),s=Ke(n.ctx,e),c=La(s,a);Ki(e,c)&&(s={width:s.width*c,height:s.height*c});let{position:l,xAdjust:d,yAdjust:u}=e,f=Wi(r,s,{borderWidth:0,position:l,xAdjust:d,yAdjust:u});return z$5(G$b(G$b({initProperties:ee(n,f,e)},f),i),{rotation:e.rotation,_fitRatio:c})}};Qt.id="doughnutLabelAnnotation";Qt.defaults={autoFit:true,autoHide:true,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:true,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0};Qt.defaultRoutes={};function Ea(t,n){return t.getSortedVisibleDatasetMetas().reduce(function(e,o){let i=o.controller;return i instanceof ws$1&&Ra(t,n,o.data)&&(!e||i.innerRadius<e.controller.innerRadius)&&i.options.circumference>=90?o:e},void 0)}function Ra(t,n,e){if(!n.autoHide)return true;for(let o=0;o<e.length;o++)if(!e[o].hidden&&t.getDataVisibility(o))return true}function Na({chartArea:t},n,e){let{left:o,top:i,right:r,bottom:a}=t,{innerRadius:s,offsetX:c,offsetY:l}=e.controller,d=(o+r)/2+c,u=(i+a)/2+l,f={left:Math.max(d-s,o),right:Math.min(d+s,r),top:Math.max(u-s,i),bottom:Math.min(u+s,a)},p={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},m=n.spacing+n.borderWidth/2,b=s-m,y=p.y>u,_=y?i+m:a-m,w=za(_,d,u,b);return {controllerMeta:G$b({_centerX:d,_centerY:u,_radius:b,_counterclockwise:y},w),point:p,radius:Math.min(s,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function La({width:t,height:n},e){let o=Math.sqrt(Math.pow(t,2)+Math.pow(n,2));return e*2/o}function za(t,n,e,o){let i=Math.pow(e-t,2),r=Math.pow(o,2),a=n*-2,s=Math.pow(n,2)+i-r,c=Math.pow(a,2)-4*s;if(c<=0)return {_startAngle:0,_endAngle:z};let l=(-a-Math.sqrt(c))/2,d=(-a+Math.sqrt(c))/2;return {_startAngle:Si$1({x:n,y:e},{x:l,y:t}).angle,_endAngle:Si$1({x:n,y:e},{x:d,y:t}).angle}}function ja(t,n){let{_centerX:e,_centerY:o,_radius:i,_startAngle:r,_endAngle:a,_counterclockwise:s,options:c}=n;t.save();let l=ut(t,c);t.fillStyle=c.backgroundColor,t.beginPath(),t.arc(e,o,i,r,a,s),t.closePath(),t.fill(),l&&t.stroke(),t.restore();}var Tt=class extends ot{inRange(n,e,o,i){return Fi({x:n,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},o,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(n){return Nt(this,n)}draw(n){let e=this.options,o=!Xt(this._visible)||this._visible;!e.display||!e.content||!o||(n.save(),We(n,this.getCenterPoint(),this.rotation),sa(n,this),Ji(n,this,e),Qi(n,Ua(this),e),n.restore());}resolveElementProperties(n,e){let o;if(Yi(e))o=er(n,e);else {let{centerX:s,centerY:c}=_n(n,e);o={x:s,y:c};}let i=K(e.padding),r=Ke(n.ctx,e),a=Wi(o,r,e,i);return z$5(G$b({initProperties:ee(n,a,e),pointX:o.x,pointY:o.y},a),{rotation:e.rotation})}};Tt.id="labelAnnotation";Tt.defaults={adjustScaleRange:true,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:false,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:true,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};Tt.defaultRoutes={borderColor:"color"};function Ua({x:t,y:n,width:e,height:o,options:i}){let r=i.borderWidth/2,a=K(i.padding);return {x:t+a.left+r,y:n+a.top+r,width:e-a.left-a.right-i.borderWidth,height:o-a.top-a.bottom-i.borderWidth}}var wn=(t,n,e)=>({x:t.x+e*(n.x-t.x),y:t.y+e*(n.y-t.y)}),un=(t,n,e)=>wn(n,e,Math.abs((t-n.y)/(e.y-n.y))).x,Ii=(t,n,e)=>wn(n,e,Math.abs((t-n.x)/(e.x-n.x))).y,pe=t=>t*t,Ba=(t,n,{x:e,y:o,x2:i,y2:r},a)=>a==="y"?{start:Math.min(o,r),end:Math.max(o,r),value:n}:{start:Math.min(e,i),end:Math.max(e,i),value:t},Pi=(t,n,e,o)=>(1-o)*(1-o)*t+2*(1-o)*o*n+o*o*e,fn=(t,n,e,o)=>({x:Pi(t.x,n.x,e.x,o),y:Pi(t.y,n.y,e.y,o)}),Di=(t,n,e,o)=>2*(1-o)*(n-t)+2*o*(e-n),Ai=(t,n,e,o)=>-Math.atan2(Di(t.x,n.x,e.x,o),Di(t.y,n.y,e.y,o))+.5*L,qe=(()=>{class t extends ot{inRange(e,o,i,r){let a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){let s={mouseX:e,mouseY:o},{path:c,ctx:l}=this;if(c){ut(l,this.options),l.lineWidth+=this.options.hitTolerance;let{chart:u}=this.$context,f=e*u.currentDevicePixelRatio,p=o*u.currentDevicePixelRatio,m=l.isPointInStroke(c,f,p)||hn(this,s,r);return l.restore(),m}let d=pe(a);return $a(this,s,d,r)||hn(this,s,r)}return Fa(this,{mouseX:e,mouseY:o},i,{hitSize:a,useFinalPosition:r})}getCenterPoint(e){return Nt(this,e)}draw(e){let{x:o,y:i,x2:r,y2:a,cp:s,options:c}=this;if(e.save(),!ut(e,c))return e.restore();ne(e,c);let l=Math.sqrt(Math.pow(r-o,2)+Math.pow(a-i,2));if(c.curve&&s)return Qa(e,this,s,l),e.restore();let{startOpts:d,endOpts:u,startAdjust:f,endAdjust:p}=ar(this),m=Math.atan2(a-i,r-o);e.translate(o,i),e.rotate(m),e.beginPath(),e.moveTo(0+f,0),e.lineTo(l-p,0),e.shadowColor=c.borderShadowColor,e.stroke(),mn(e,0,f,d),mn(e,l,-p,u),e.restore();}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,o){let i=pa(e,o),{x:r,y:a,x2:s,y2:c}=i,l=Ha(i,e.chartArea),d=l?Va({x:r,y:a},{x:s,y:c},e.chartArea):{x:r,y:a,x2:s,y2:c,width:Math.abs(s-r),height:Math.abs(c-a)};if(d.centerX=(s+r)/2,d.centerY=(c+a)/2,d.initProperties=ee(e,d,o),o.curve){let f={x:d.x,y:d.y},p={x:d.x2,y:d.y2};d.cp=Ja(d,o,Ie(f,p));}let u=Wa(e,d,o.label);return u._visible=l,d.elements=[{type:"label",optionScope:"label",properties:u,initProperties:d.initProperties}],d}}return t.id="lineAnnotation",t})(),Oi={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};qe.defaults={adjustScaleRange:true,arrowHeads:{display:false,end:Object.assign({},Oi),fill:false,length:12,start:Object.assign({},Oi),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:false,controlPoint:{y:"-50%"},display:true,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Tt.defaults.callout),color:"#fff",content:null,display:false,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};qe.descriptors={arrowHeads:{start:{_fallback:true},end:{_fallback:true},_fallback:true}};qe.defaultRoutes={borderColor:"color"};function Fa(t,{mouseX:n,mouseY:e},o,{hitSize:i,useFinalPosition:r}){let a=Ba(n,e,t.getProps(["x","y","x2","y2"],r),o);return Ui(a,i)||hn(t,{mouseX:n,mouseY:e},r,o)}function Ha({x:t,y:n,x2:e,y2:o},{top:i,right:r,bottom:a,left:s}){return !(t<s&&e<s||t>r&&e>r||n<i&&o<i||n>a&&o>a)}function Ti({x:t,y:n},e,{top:o,right:i,bottom:r,left:a}){return t<a&&(n=Ii(a,{x:t,y:n},e),t=a),t>i&&(n=Ii(i,{x:t,y:n},e),t=i),n<o&&(t=un(o,{x:t,y:n},e),n=o),n>r&&(t=un(r,{x:t,y:n},e),n=r),{x:t,y:n}}function Va(t,n,e){let{x:o,y:i}=Ti(t,n,e),{x:r,y:a}=Ti(n,t,e);return {x:o,y:i,x2:r,y2:a,width:Math.abs(r-o),height:Math.abs(a-i)}}function $a(t,{mouseX:n,mouseY:e},o=At,i){let{x:r,y:a,x2:s,y2:c}=t.getProps(["x","y","x2","y2"],i),l=s-r,d=c-a,u=pe(l)+pe(d),f=u===0?-1:((n-r)*l+(e-a)*d)/u,p,m;return f<0?(p=r,m=a):f>1?(p=s,m=c):(p=r+f*l,m=a+f*d),pe(n-p)+pe(e-m)<=o}function hn(t,{mouseX:n,mouseY:e},o,i){let r=t.label;return r.options.display&&r.inRange(n,e,i,o)}function Wa(t,n,e){let o=e.borderWidth,i=K(e.padding),r=Ke(t.ctx,e),a=r.width+i.width+o,s=r.height+i.height+o;return qa(n,e,{width:a,height:s,padding:i},t.chartArea)}function Ka(t){let{x:n,y:e,x2:o,y2:i}=t,r=Math.atan2(i-e,o-n);return r>L/2?r-L:r<L/-2?r+L:r}function qa(t,n,e,o){let{width:i,height:r,padding:a}=e,{xAdjust:s,yAdjust:c}=n,l={x:t.x,y:t.y},d={x:t.x2,y:t.y2},u=n.rotation==="auto"?Ka(t):it(n.rotation),f=Ya(i,r,u),p=Xa(t,n,{labelSize:f,padding:a},o),m=t.cp?fn(l,t.cp,d,p):wn(l,d,p),b={size:f.w,min:o.left,max:o.right,padding:a.left},y={size:f.h,min:o.top,max:o.bottom,padding:a.top},_=Ri(m.x,b)+s,w=Ri(m.y,y)+c;return {x:_-i/2,y:w-r/2,x2:_+i/2,y2:w+r/2,centerX:_,centerY:w,pointX:m.x,pointY:m.y,width:i,height:r,rotation:Be$1(u)}}function Ya(t,n,e){let o=Math.cos(e),i=Math.sin(e);return {w:Math.abs(t*o)+Math.abs(n*i),h:Math.abs(t*i)+Math.abs(n*o)}}function Xa(t,n,e,o){let i,r=Ga(t,o);return n.position==="start"?i=Ei({w:t.x2-t.x,h:t.y2-t.y},e,n,r):n.position==="end"?i=1-Ei({w:t.x-t.x2,h:t.y-t.y2},e,n,r):i=yn(1,n.position),i}function Ei(t,n,e,o){let{labelSize:i,padding:r}=n,a=t.w*o.dx,s=t.h*o.dy,c=a>0&&(i.w/2+r.left-o.x)/a,l=s>0&&(i.h/2+r.top-o.y)/s;return Ve(Math.max(c,l),0,.25)}function Ga(t,n){let{x:e,x2:o,y:i,y2:r}=t,a=Math.min(i,r)-n.top,s=Math.min(e,o)-n.left,c=n.bottom-Math.max(i,r),l=n.right-Math.max(e,o);return {x:Math.min(s,l),y:Math.min(a,c),dx:s<=l?1:-1,dy:a<=c?1:-1}}function Ri(t,n){let{size:e,min:o,max:i,padding:r}=n,a=e/2;return e>i-o?(i+o)/2:(o>=t-r-a&&(t=o+r+a),i<=t+r+a&&(t=i-r-a),t)}function ar(t){let n=t.options,e=n.arrowHeads&&n.arrowHeads.start,o=n.arrowHeads&&n.arrowHeads.end;return {startOpts:e,endOpts:o,startAdjust:Ni(t,e),endAdjust:Ni(t,o)}}function Ni(t,n){if(!n||!n.display)return 0;let{length:e,width:o}=n,i=t.options.borderWidth/2,r={x:e,y:o+i};return Math.abs(un(0,r,{x:0,y:i}))}function mn(t,n,e,o){if(!o||!o.display)return;let{length:i,width:r,fill:a,backgroundColor:s,borderColor:c}=o,l=Math.abs(n-i)+e;t.beginPath(),ne(t,o),ut(t,o),t.moveTo(l,-r),t.lineTo(n+e,0),t.lineTo(l,r),a===true?(t.fillStyle=s||c,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=o.borderShadowColor,t.stroke();}function Ja(t,n,e){let{x:o,y:i,x2:r,y2:a,centerX:s,centerY:c}=t,l=Math.atan2(a-i,r-o),d=vn(n.controlPoint,0),u={x:s+xt(e,d.x,false),y:c+xt(e,d.y,false)};return Rt(u,{x:s,y:c},l)}function Li(t,{x:n,y:e},{angle:o,adjust:i},r){!r||!r.display||(t.save(),t.translate(n,e),t.rotate(o),mn(t,0,-i,r),t.restore());}function Qa(t,n,e,o){let{x:i,y:r,x2:a,y2:s,options:c}=n,{startOpts:l,endOpts:d,startAdjust:u,endAdjust:f}=ar(n),p={x:i,y:r},m={x:a,y:s},b=Ai(p,e,m,0),y=Ai(p,e,m,1)-L,_=fn(p,e,m,u/o),w=fn(p,e,m,1-f/o),S=new Path2D;t.beginPath(),S.moveTo(_.x,_.y),S.quadraticCurveTo(e.x,e.y,w.x,w.y),t.shadowColor=c.borderShadowColor,t.stroke(S),n.path=S,n.ctx=t,Li(t,_,{angle:b,adjust:u},l),Li(t,w,{angle:y,adjust:f},d);}var Et=class extends ot{inRange(n,e,o,i){let r=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(o!=="x"&&o!=="y")return Za({x:n,y:e},this.getProps(["width","height","centerX","centerY"],i),r,a);let{x:s,y:c,x2:l,y2:d}=this.getProps(["x","y","x2","y2"],i),u=o==="y"?{start:c,end:d}:{start:s,end:l},f=Rt({x:n,y:e},this.getCenterPoint(i),it(-r));return f[o]>=u.start-a-At&&f[o]<=u.end+a+At}getCenterPoint(n){return Nt(this,n)}draw(n){let{width:e,height:o,centerX:i,centerY:r,options:a}=this;n.save(),We(n,this.getCenterPoint(),a.rotation),ne(n,this.options),n.beginPath(),n.fillStyle=a.backgroundColor;let s=ut(n,a);n.ellipse(i,r,o/2,e/2,L/2,0,2*L),n.fill(),s&&(n.shadowColor=a.borderShadowColor,n.stroke()),n.restore();}get label(){return this.elements&&this.elements[0]}resolveElementProperties(n,e){return or(n,e)}};Et.id="ellipseAnnotation";Et.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:true,hitTolerance:0,init:void 0,label:Object.assign({},Mt.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Et.defaultRoutes={borderColor:"color",backgroundColor:"color"};Et.descriptors={label:{_fallback:true}};function Za(t,n,e,o){let{width:i,height:r,centerX:a,centerY:s}=n,c=i/2,l=r/2;if(c<=0||l<=0)return false;let d=it(e||0),u=Math.cos(d),f=Math.sin(d),p=Math.pow(u*(t.x-a)+f*(t.y-s),2),m=Math.pow(f*(t.x-a)-u*(t.y-s),2);return p/Math.pow(c+o,2)+m/Math.pow(l+o,2)<=1.0001}var Zt=class extends ot{inRange(n,e,o,i){let{x:r,y:a,x2:s,y2:c,width:l}=this.getProps(["x","y","x2","y2","width"],i),d=(this.options.borderWidth+this.options.hitTolerance)/2;return o!=="x"&&o!=="y"?qr({x:n,y:e},this.getCenterPoint(i),l/2,d):Ui(o==="y"?{start:a,end:c,value:e}:{start:r,end:s,value:n},d)}getCenterPoint(n){return Nt(this,n)}draw(n){let e=this.options,o=e.borderWidth;if(e.radius<.1)return;n.save(),n.fillStyle=e.backgroundColor,ne(n,e);let i=ut(n,e);ea(n,this,this.centerX,this.centerY),i&&!$e(e.pointStyle)&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore(),e.borderWidth=o;}resolveElementProperties(n,e){let o=nr(n,e);return o.initProperties=ee(n,o,e),o}};Zt.id="pointAnnotation";Zt.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:true,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};Zt.defaultRoutes={borderColor:"color",backgroundColor:"color"};var te=class extends ot{inRange(n,e,o,i){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&es(this.elements,n,e,i);let r=Rt({x:n,y:e},this.getCenterPoint(i),it(-this.options.rotation)),a=this.elements.map(l=>o==="y"?l.bY:l.bX),s=Math.min(...a),c=Math.max(...a);return r[o]>=s&&r[o]<=c}getCenterPoint(n){return Nt(this,n)}draw(n){let{elements:e,options:o}=this;n.save(),n.beginPath(),n.fillStyle=o.backgroundColor,ne(n,o);let i=ut(n,o),r=true;for(let a of e)r?(n.moveTo(a.x,a.y),r=false):n.lineTo(a.x,a.y);n.closePath(),n.fill(),i&&(n.shadowColor=o.borderShadowColor,n.stroke()),n.restore();}resolveElementProperties(n,e){let o=nr(n,e),{sides:i,rotation:r}=e,a=[],s=2*L/i,c=r*ga$1;for(let l=0;l<i;l++,c+=s){let d=ts(o,e,c);d.initProperties=ee(n,o,e),a.push(d);}return o.elements=a,o}};te.id="polygonAnnotation";te.defaults={adjustScaleRange:true,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:true,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};te.defaultRoutes={borderColor:"color",backgroundColor:"color"};function ts({centerX:t,centerY:n},{radius:e,borderWidth:o,hitTolerance:i},r){let a=(o+i)/2,s=Math.sin(r),c=Math.cos(r),l={x:t+s*e,y:n-c*e};return {type:"point",optionScope:"point",properties:{x:l.x,y:l.y,centerX:l.x,centerY:l.y,bX:t+s*(e+a),bY:n-c*(e+a)}}}function es(t,n,e,o){let i=false,r=t[t.length-1].getProps(["bX","bY"],o);for(let a of t){let s=a.getProps(["bX","bY"],o);s.bY>e!=r.bY>e&&n<(r.bX-s.bX)*(e-s.bY)/(r.bY-s.bY)+s.bX&&(i=!i),r=s;}return i}var Ct={box:Mt,doughnutLabel:Qt,ellipse:Et,label:Tt,line:qe,point:Zt,polygon:te};Object.keys(Ct).forEach(t=>{B.describe(`elements.${Ct[t].id}`,{_fallback:"plugins.annotation.common"});});var ns={update:Object.assign},os=Sn.concat(He),zi=(t,n)=>O(n)?gn(t,n):t,pn=t=>t==="color"||t==="font";function Cn(t="line"){return Ct[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function is(t,n,e,o){let i=as(t,e.animations,o),r=n.annotations,a=ls(n.elements,r);for(let s=0;s<r.length;s++){let c=r[s],l=sr(a,s,c.type),d=c.setContext(cs(t,l,a,c)),u=l.resolveElementProperties(t,d);u.skip=rs(u),"elements"in u&&(ss(l,u.elements,d,i),delete u.elements),Xt(l.x)||Object.assign(l,u),Object.assign(l,u.initProperties),u.options=cr(d),i.update(l,u);}}function rs(t){return isNaN(t.x)||isNaN(t.y)}function as(t,n,e){return e==="reset"||e==="none"||e==="resize"?ns:new ii$1(t,n)}function ss(t,n,e,o){let i=t.elements||(t.elements=[]);i.length=n.length;for(let r=0;r<n.length;r++){let a=n[r],s=a.properties,c=sr(i,r,a.type,a.initProperties),l=e[a.optionScope].override(a);s.options=cr(l),o.update(c,s);}}function sr(t,n,e,o){let i=Ct[Cn(e)],r=t[n];return (!r||!(r instanceof i))&&(r=t[n]=new i,Object.assign(r,o)),r}function cr(t){let n=Ct[Cn(t.type)],e={};e.id=t.id,e.type=t.type,e.drawTime=t.drawTime,Object.assign(e,gn(t,n.defaults),gn(t,n.defaultRoutes));for(let o of os)e[o]=t[o];return e}function gn(t,n){let e={};for(let o of Object.keys(n)){let i=n[o],r=t[o];pn(o)&&F(r)?e[o]=r.map(a=>zi(a,i)):e[o]=zi(r,i);}return e}function cs(t,n,e,o){return n.$context||(n.$context=Object.assign(Object.create(t.getContext()),{element:n,get elements(){return e.filter(i=>i&&i.options)},id:o.id,type:"annotation"}))}function ls(t,n){let e=n.length,o=t.length;if(o<e){let i=e-o;t.splice(o,0,...new Array(i));}else o>e&&t.splice(e,o-e);return t}var ds="3.1.0",wt=new Map,ji=t=>t.type!=="doughnutLabel",us=Sn.concat(He),lr={id:"annotation",version:ds,beforeRegister(){Yr("chart.js","4.0",Wl.version);},afterRegister(){Wl.register(Ct);},afterUnregister(){Wl.unregister(Ct);},beforeInit(t){wt.set(t,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:false,moveListened:false,hooks:{},hooked:false,hovered:[]});},beforeUpdate(t,n,e){let o=wt.get(t),i=o.annotations=[],r=e.annotations;O(r)?Object.keys(r).forEach(a=>{let s=r[a];O(s)&&(s.id=a,i.push(s));}):F(r)&&i.push(...r),Pa(i.filter(ji),t.scales);},afterDataLimits(t,n){let e=wt.get(t);Ia(t,n.scale,e.annotations.filter(ji).filter(o=>o.display&&o.adjustScaleRange));},afterUpdate(t,n,e){let o=wt.get(t);wa(t,o,e),is(t,o,e,n.mode),o.visibleElements=o.elements.filter(i=>!i.skip&&i.options.display),ka(t,o,e);},beforeDatasetsDraw(t,n,e){me(t,"beforeDatasetsDraw",e.clip);},afterDatasetsDraw(t,n,e){me(t,"afterDatasetsDraw",e.clip);},beforeDatasetDraw(t,n,e){me(t,n.index,e.clip);},beforeDraw(t,n,e){me(t,"beforeDraw",e.clip);},afterDraw(t,n,e){me(t,"afterDraw",e.clip);},beforeEvent(t,n,e){let o=wt.get(t);Ca(o,n.event,e)&&(n.changed=true);},afterDestroy(t){wt.delete(t);},getAnnotations(t){let n=wt.get(t);return n?n.elements:[]},_getAnnotationElementsAtEventForMode(t,n,e){return bn(t,n,e)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:true,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:false,label:{}}},descriptors:{_indexable:false,_scriptable:t=>!us.includes(t)&&t!=="init",annotations:{_allKeys:false,_fallback:(t,n)=>`elements.${Ct[Cn(n.type)].id}`},interaction:{_fallback:true},common:{label:{_indexable:pn,_fallback:true},_indexable:pn}},additionalOptionScopes:[""]};function me(t,n,e){let{ctx:o,chartArea:i}=t,r=wt.get(t);e&&de(o,i);let a=fs(r.visibleElements,n).sort((s,c)=>s.element.options.z-c.element.options.z);for(let s of a)hs(o,i,r,s);e&&ue(o);}function fs(t,n){let e=[];for(let o of t)if(o.options.drawTime===n&&e.push({element:o,main:true}),o.elements&&o.elements.length)for(let i of o.elements)i.options.display&&i.options.drawTime===n&&e.push({element:i});return e}function hs(t,n,e,o){let i=o.element;o.main?(xi(e,i,"beforeDraw"),i.draw(t,n),xi(e,i,"afterDraw")):i.draw(t,n);}var ms="3.5.1";function xn(t,n,e){return Math.min(Math.max(t,n),e)}function E(t,n){let e=t.options.realtime,o=t.chart.options.plugins?.streaming;return P(e?.[n],o?.[n])}function Mn(t,{x:n,y:e},{xAxisID:o,yAxisID:i}){let r={};for(let a=0,s=n.length;a<s;++a)r[n[a]]={axisId:o};for(let a=0,s=e.length;a<s;++a)r[e[a]]={axisId:i};return r}var ps=typeof window>"u"?lt:window.cancelAnimationFrame;function dr(t){let n=t.frameRequestID;n&&(ps.call(window,n),delete t.frameRequestID);}function mr(t){let n=t.refreshTimerID;n&&(clearInterval(n),delete t.refreshTimerID,delete t.refreshInterval);}function pr(t,n,e){t.refreshTimerID||(t.refreshTimerID=setInterval(()=>{if(typeof document<"u"&&document.hidden)return;let o=I(n,[],t);t.refreshInterval===o||isNaN(o)||(mr(t),pr(t,n,o));},e||0),t.refreshInterval=e||0);}function et(t,n,e){return n=typeof n=="number"?n:t.parse(n),W(n)?{value:t.getPixelForValue(n),transitionable:true}:{value:e,transitionable:false}}function gs(){let t=dt.getElement("boxAnnotation"),n=dt.getElement("lineAnnotation"),e=dt.getElement("pointAnnotation");if(!t||!n||!e)return;let o=t.prototype.resolveElementProperties,i=n.prototype.resolveElementProperties,r=e.prototype.resolveElementProperties;t.prototype.resolveElementProperties=function(a,s){return (function(c,l,d){let{scales:u,chartArea:f}=l,{xScaleID:p,yScaleID:m,xMin:b,xMax:y,yMin:_,yMax:w}=d,S=u[p],k=u[m],{top:D,left:z,bottom:A,right:x}=f,R=c.$streaming={};if(S){let C=et(S,b,z),I=et(S,y,x),P=C.value>I.value;C.transitionable&&(R[P?"x2":"x"]={axisId:p}),I.transitionable&&(R[P?"x":"x2"]={axisId:p}),C.transitionable!==I.transitionable&&(R.width={axisId:p,reverse:C.transitionable});}if(k){let C=et(k,_,D),I=et(k,w,A),P=C.value>I.value;C.transitionable&&(R[P?"y2":"y"]={axisId:m}),I.transitionable&&(R[P?"y":"y2"]={axisId:m}),C.transitionable!==I.transitionable&&(R.height={axisId:m,reverse:C.transitionable});}})(this,a,s),o.call(this,a,s)},n.prototype.resolveElementProperties=function(a,s){let c=a.chartArea;a.chartArea=(function(d,u,f){let{scales:p,chartArea:m}=u,{scaleID:b,value:y}=f,_=p[b],{top:w,left:S,bottom:k,right:D}=m,z=d.$streaming={};if(_){let F=_.isHorizontal();return et(_,y,0).transitionable&&(z[F?"x":"y"]={axisId:b},z[F?"x2":"y2"]={axisId:b}),F?{top:w,bottom:k}:{left:S,right:D}}let{xScaleID:A,yScaleID:x,xMin:R,xMax:C,yMin:I,yMax:P}=f,N=p[A],O=p[x],B={};if(N){let F=et(N,R,S),X=et(N,C,D);F.transitionable?z.x={axisId:A}:B.left=S,X.transitionable?z.x2={axisId:A}:B.right=D;}if(O){let F=et(O,I,w),X=et(O,P,k);F.transitionable?z.y={axisId:x}:B.top=w,X.transitionable?z.y2={axisId:x}:B.bottom=k;}return B})(this,a,s);let l=i.call(this,a,s);return a.chartArea=c,l},e.prototype.resolveElementProperties=function(a,s){return (function(c,l,d){let u=l.scales,{xScaleID:f,yScaleID:p,xValue:m,yValue:b}=d,y=u[f],_=u[p],w=c.$streaming={};y&&et(y,m,0).transitionable&&(w.x={axisId:f}),_&&et(_,b,0).transitionable&&(w.y={axisId:p});})(this,a,s),r.call(this,a,s)};}var bs={x:["x","caretX"],y:["y","caretY"]};function ys(...t){let n=this,e=n.getActiveElements()[0];if(e){let o=n.chart.getDatasetMeta(e.datasetIndex);n.$streaming=Mn(0,bs,o);}else n.$streaming={};n.constructor.prototype.update.call(n,...t);}var kn=new WeakMap;function In(t){let{originalScaleOptions:n}=(function(o){let i=kn.get(o);return i||(i={originalScaleOptions:{}},kn.set(o,i)),i})(t),e=t.scales;return R(e,o=>{let i=o.id;n[i]||(n[i]={duration:E(o,"duration"),delay:E(o,"delay")});}),R(n,(o,i)=>{e&&e[i]||delete n[i];}),n}function vs(t,n,e,o){let{chart:i}=t,r=t.id,{minDuration:a=0,maxDuration:s=1/0,minDelay:c=-1/0,maxDelay:l=1/0}=o?.[r]||{},d=t.options.realtime,u=E(t,"duration"),f=E(t,"delay"),p=xn(u*(2-n),a,s),m,b;return In(i),m=t.isHorizontal()?(t.right-e.x)/(t.right-t.left):(t.bottom-e.y)/(t.bottom-t.top),b=f+m*(u-p),d.duration=p,d.delay=xn(b,c,l),p!==t.max-t.min}function _s(t,n,e){let{chart:o}=t,i=t.id,{minDelay:r=-1/0,maxDelay:a=1/0}=e?.[i]||{},s=E(t,"delay")+((t.getValueForPixel(n)||0)-(t.getValueForPixel(0)||0));return In(o),t.options.realtime.delay=xn(s,r,a),true}function Ss(t,n){let e=n.$streaming;if(e.zoomPlugin!==t){let o=e.resetZoom=n.resetZoom;((function(i){i.zoomFunctions.realtime=vs,i.panFunctions.realtime=_s;}))(t),n.resetZoom=i=>{((function(r){let a=In(r);R(r.scales,s=>{let c=s.options.realtime;if(c){let l=a[s.id];l?(c.duration=l.duration,c.delay=l.delay):(delete c.duration,delete c.delay);}});}))(n),o(i);},e.zoomPlugin=t;}}function ws(t){let n=t.$streaming;n.zoomPlugin&&(t.resetZoom=n.resetZoom,(function(e){kn.delete(e);})(t),delete n.resetZoom,delete n.zoomPlugin);}var ge={millisecond:{common:true,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:true,size:1e3,steps:[1,2,5,10,15,30]},minute:{common:true,size:6e4,steps:[1,2,5,10,15,30]},hour:{common:true,size:36e5,steps:[1,2,3,6,12]},day:{common:true,size:864e5,steps:[1,2,5]},week:{common:false,size:6048e5,steps:[1,2,3,4]},month:{common:true,size:2628e6,steps:[1,2,3]},quarter:{common:false,size:7884e6,steps:[1,2,3,4]},year:{common:true,size:3154e7}},Lt=Object.keys(ge);function ur(t,n,e){if(e){if(e.length){let{lo:o,hi:i}=Ve$1(e,n);t[e[o]>=n?e[o]:e[i]]=true;}}else t[n]=true;}var fr=["pointBackgroundColor","pointBorderColor","pointBorderWidth","pointRadius","pointRotation","pointStyle","pointHitRadius","pointHoverBackgroundColor","pointHoverBorderColor","pointHoverBorderWidth","pointHoverRadius","backgroundColor","borderColor","borderSkipped","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","radius","rotation"];function Ye(t,n,e){let o=t.$streaming;if(!o)return;let i=t.$animations||{},r=e;for(let a in o){let s=o[a];if(s.axisId===n){let c=s.reverse?-r:r,l=i[a];W(t[a])&&(t[a]-=c),l&&(l._from-=c,l._to-=c);}}}var ft=class extends ks$1{constructor(n){super(n),this.$realtime={};}init(n,e){let o=this;super.init.call(o,n),(function(i){if(typeof console<"u"&&console.warn){let r=E(i,"duration"),a=E(i,"delay"),s=E(i,"frameRate"),c=E(i,"refresh");(typeof r!="number"||r<=0)&&console.warn("Chart streaming: duration should be a positive number"),typeof a!="number"&&console.warn("Chart streaming: delay should be a number"),(typeof s!="number"||s<=0)&&console.warn("Chart streaming: frameRate should be a positive number"),(typeof c!="number"||c<=0)&&console.warn("Chart streaming: refresh should be a positive number");}})(o),pr(o.$realtime,()=>{let i=o.chart;try{let r=E(o,"onRefresh");return typeof r=="function"&&I(r,[i],o),(function(a){let{chart:s,id:c,max:l}=a,d=E(a,"duration"),u=E(a,"delay"),f=E(a,"ttl"),p=E(a,"pause"),m=Date.now()-(isNaN(f)?d+u:f),b,y,_,w;R(s.data.datasets,(S,k)=>{let D=s.getDatasetMeta(k),z=c===D.xAxisID?"x":c===D.yAxisID&&"y";if(z){let A=D.controller,x=S.data,R=x.length;if(p){for(b=0;b<R;++b){let C=A.getParsed&&typeof A.getParsed=="function"?A.getParsed(b):Array.isArray(x[b])?{x:x[b][0],y:x[b][1]}:x[b];if(C&&!(C[z]<l))break}y=b+2;}else y=0;for(b=y;b<R;++b){let C=A.getParsed&&typeof A.getParsed=="function"?A.getParsed(b):Array.isArray(x[b])?{x:x[b][0],y:x[b][1]}:x[b];if(!(C&&C[z]<=m))break}if(_=b-y,isNaN(f)&&(_=Math.max(_-2,0)),_>0){x.splice(y,_);for(let P=0,N=fr.length;P<N;++P){let O=fr[P];F(S[O])&&S[O].splice(y,_);}let C=S.datalabels;if(C)for(let P in C)F(C[P])&&C[P].splice(y,_);typeof x[0]!="object"&&(w={start:y,count:_});let I=s._active;if(I&&I.length>0)for(let P=I.length-1;P>=0;P--){let N=I[P];N.datasetIndex===k&&(N.index>=y+_?N.index-=_:N.index>=y&&I.splice(P,1));}}}}),w&&s.data.labels?.splice(w.start,w.count);})(o),i.update("quiet"),E(o,"refresh")}catch(r){return typeof console<"u"&&console.error&&console.error("Error in streaming refresh:",r),1e3}});}update(n,e,o){let i=this,{$realtime:r,options:a}=i,{bounds:s,offset:c,ticks:l}=a,{autoSkip:d,source:u,major:f}=l,p=f.enabled;E(i,"pause")?dr(r):(r.frameRequestID||(r.head=Date.now()),(function(m,b){if(!m.frameRequestID){let y=()=>{if(typeof document<"u"&&document.hidden)return void(m.frameRequestID=Ci$1.call(window,y));let _=m.nextRefresh||0,w=Date.now();if(_<=w){let S=I(b,[],m),k=1e3/(Math.max(S,0)||30),D=(m.nextRefresh||0)+k||0;m.nextRefresh=D>w?D:w+k;}m.frameRequestID=Ci$1.call(window,y);};m.frameRequestID=Ci$1.call(window,y);}})(r,()=>{let m=i.chart,b=m.$streaming;return (function(y){let{chart:_,id:w,$realtime:S}=y,k=E(y,"duration"),D=E(y,"delay"),z=y.isHorizontal(),A=z?y.width:y.height,x=Date.now(),R=_.tooltip,C=(function(O){let B=O.$streaming?.annotationPlugin;return B?B.getAnnotations(O):[]})(_),I=A*(x-S.head)/k;z===!!y.options.reverse&&(I=-I);let P=_.data.datasets.length;for(let O=0;O<P;++O){let B=_.getDatasetMeta(O),{data:F=[],dataset:X}=B,oe=F.length;for(let ie=0;ie<oe;++ie)Ye(F[ie],w,I);X&&(Ye(X,w,I),delete X._path);}let N=C.length;for(let O=0;O<N;++O)Ye(C[O],w,I);R&&Ye(R,w,I),y.max=x-D,y.min=y.max-k,S.head=x;})(i),b&&I(b.render,[m]),E(i,"frameRate")})),a.bounds=void 0,a.offset=false,l.autoSkip=false,l.source=u==="auto"?"":u,f.enabled=true,super.update.call(i,n,e,o),a.bounds=s,a.offset=c,l.autoSkip=d,l.source=u,f.enabled=p;}buildTicks(){let n=this,e=E(n,"duration"),o=E(n,"delay"),i=n.$realtime.head-o,r=i-e,a=[1e15,i],s=[-1e15,r];Object.defineProperty(n,"min",{get:()=>s.shift(),set:lt,configurable:true}),Object.defineProperty(n,"max",{get:()=>a.shift(),set:lt,configurable:true});let c=super.buildTicks.call(n);return delete n.min,delete n.max,n.min=r,n.max=i,c}calculateLabelRotation(){let n=this.options.ticks,e=n.maxRotation;n.maxRotation=n.minRotation||0,super.calculateLabelRotation.call(this),n.maxRotation=e;}fit(){let n=this,e=n.options;super.fit.call(n),e.ticks.display&&e.display&&n.isHorizontal()&&(n.paddingLeft=3,n.paddingRight=3,n._handleMargins());}draw(n){let e=this,{chart:o,ctx:i}=e,r=e.isHorizontal()?{left:n.left,top:0,right:n.right,bottom:o.height}:{left:0,top:n.top,right:o.width,bottom:n.bottom};e._gridLineItems=null,e._labelItems=null,de(i,r),super.draw.call(e,n),ue(i);}destroy(){let n=this.$realtime;dr(n),mr(n);}_generate(){let n=this,e=n._adapter,o=E(n,"duration"),i=E(n,"delay"),r=E(n,"refresh"),a=n.$realtime.head-i,s=a-o,c=n._getLabelCapacity(s),{time:l,ticks:d}=n.options,u=l.unit||(function(A,x,R,C){let I=R-x,P=Lt.length;for(let N=Lt.indexOf(A);N<P-1;++N){let O=Lt[N],B=ge[O];if(!B)continue;let{common:F,size:X,steps:oe}=B,ie=oe?oe[oe.length-1]:Number.MAX_SAFE_INTEGER;if(F&&Math.ceil(I/(ie*X))<=C)return O}return Lt[P-1]})(l.minUnit,s,a,c),f=(function(A){for(let x=Lt.indexOf(A)+1,R=Lt.length;x<R;++x){let C=Lt[x];if(ge[C]?.common)return C}})(u),p=l.stepSize||(function(A,x,R,C){let I=x-A,P=ge[R];if(!P)return 1;let{size:N,steps:O}=P,B=1;if(!O)return Math.ceil(I/(C*N));for(let F=0,X=O.length;F<X&&(B=O[F],!(Math.ceil(I/(N*B))<=C));++F);return B||1})(s,a,u,c),m=u==="week"&&l.isoWeekday,b=d.major.enabled,y=It(m)||m===true,_=ge[u],w={},S,k,D=s;if(y&&(D=+e.startOf(D,"isoWeek",m)),D=+e.startOf(D,y?"day":u),e.diff(a,s,u)>1e5*p)throw new Error(s+" and "+a+" are too far apart with stepSize of "+p+" "+u);S=D,b&&f&&!y&&!l.round&&(S=+e.startOf(S,f),S=+e.add(S,~~((D-S)/(_.size*p))*p,u));let z=d.source==="data"&&n.getDataTimestamps();for(k=0;S<a+r;S=+e.add(S,p,u),k++)ur(w,S,z);return S!==a+r&&k!==1||ur(w,S,z),Object.keys(w).sort((A,x)=>+A-+x).map(A=>+A)}};ft.id="realtime",ft.defaults={bounds:"data",adapters:{},time:{parser:false,unit:false,round:false,isoWeekday:false,minUnit:"millisecond",displayFormats:{}},realtime:{},ticks:{autoSkip:false,source:"auto",major:{enabled:true}}},B.describe("scale.realtime",{_scriptable:t=>t!=="onRefresh"});var Cs=ms;B.set("transitions",{quiet:{animation:{duration:0}}});var hr={x:["x","cp1x","cp2x"],y:["y","cp1y","cp2y"]};function xs(t){let n=this;t==="quiet"&&R(n.data.datasets,(e,o)=>{let i=n.getDatasetMeta(o).controller;i&&(i._setStyle=function(r,a,s,c){At$1.prototype._setStyle.call(this,r,a,"quiet",c);});}),Wl.prototype.update.call(n,t),t==="quiet"&&R(n.data.datasets,(e,o)=>{let i=n.getDatasetMeta(o).controller;i&&delete i._setStyle;});}function Ms(t){let n=t.$streaming;t.render(),n.lastMouseEvent&&setTimeout(()=>{let e=n.lastMouseEvent;e&&t._eventHandler(e);},0);}var ks={id:"streaming",version:Cs,beforeInit(t){let n=t.$streaming=t.$streaming||{render:Ms},e=n.canvas=t.canvas,o=n.mouseEventListener=i=>{let r=Ct$1(i,t);n.lastMouseEvent={type:"mousemove",chart:t,native:i,x:r.x,y:r.y};};if(e.addEventListener("mousedown",o),e.addEventListener("mouseup",o),typeof document<"u"&&document.addEventListener){let i=()=>{if(!document.hidden){let r=t.scales;r&&Object.keys(r).forEach(a=>{let s=r[a];s&&s instanceof ft&&s.$realtime&&(s.$realtime.head=Date.now());});}};document.addEventListener("visibilitychange",i),n.visibilityChangeListener=i;}},afterInit(t){t.update=xs;},beforeUpdate(t){let{scales:n,elements:e}=t.options,o=t.tooltip;n&&R(n,i=>{i?.type==="realtime"&&e&&(e.line.capBezierPoints=false);}),o&&(o.update=ys);try{let i=dt.getPlugin("annotation");i&&(function(r,a){let s=a.$streaming;if(s.annotationPlugin!==r){let c=r.afterUpdate;gs(),s.annotationPlugin=r,r.afterUpdate=function(l,d,u){let f=d.mode,p=u.animation;f==="quiet"&&(u.animation=!1),c.call(this,l,d,u),f==="quiet"&&(u.animation=p);};}})(i,t);}catch(i){(function(r){delete r.$streaming.annotationPlugin;})(t);}try{let i=dt.getPlugin("zoom");i&&Ss(i,t);}catch(i){ws(t);}},beforeDatasetUpdate(t,n){let{meta:e,mode:o}=n;if(o==="quiet"){let{controller:i,$animations:r}=e;r&&r.visible&&r.visible._active&&(i.updateElement=lt,i.updateSharedOptions=lt);}},afterDatasetUpdate(t,n){let{meta:e,mode:o}=n,{data:i=[],dataset:r,controller:a}=e;for(let s=0,c=i.length;s<c;++s)i[s].$streaming=Mn(i[s],hr,e);r&&(r.$streaming=Mn(0,hr,e)),o==="quiet"&&(delete a.updateElement,delete a.updateSharedOptions);},beforeDatasetDraw(t,n){let{ctx:e,chartArea:o,width:i,height:r}=t,{xAxisID:a,yAxisID:s,controller:c}=n.meta,l={left:0,top:0,right:i,bottom:r};a&&c.getScaleForId(a)instanceof ft&&(l.left=o.left,l.right=o.right),s&&c.getScaleForId(s)instanceof ft&&(l.top=o.top,l.bottom=o.bottom),de(e,l);},afterDatasetDraw(t){ue(t.ctx);},beforeEvent(t,n){let e=t.$streaming,o=n.event;o?.type==="mousemove"?e.lastMouseEvent=o:o?.type==="mouseout"&&delete e.lastMouseEvent;},afterDestroy(t){let{scales:n,tooltip:e}=t,o=t.$streaming,{canvas:i,mouseEventListener:r,visibilityChangeListener:a}=o;delete t.update,e&&delete e.update,i.removeEventListener("mousedown",r),i.removeEventListener("mouseup",r),a&&typeof document<"u"&&document.removeEventListener&&document.removeEventListener("visibilitychange",a),R(n,s=>{s instanceof ft&&s.destroy();});},defaults:{duration:1e4,delay:0,frameRate:30,refresh:1e3,onRefresh:null,pause:false,ttl:void 0},descriptors:{_scriptable:t=>t!=="onRefresh"}},Pn=[ks,ft];Wl.register(Pn);Wl.register(lr,Pn,rh,Vc,$c,Tr$1,li$1,_s$1,ic,Kc,ks$1,Xc,ih);ws$3(pi,{providers:[WT(),zj(),Ku(xs$3),{provide:yo$3,useClass:gi,multi:true},{provide:Ke$7,useValue:{hasBackdrop:true,disableClose:false,autoFocus:"first-tabbable",delayFocusTrap:true,backdropClass:"dialogBackdrop"}},{provide:ot$8,useValue:{appearance:"outline",floatLabel:"always",subscriptSizing:"dynamic"}},{provide:st,useValue:{showDelay:1500,hideDelay:0}},He$4,De$2,T$2,I$2,We$3,K$3,G$2,ut$2,fe,Gi$3,O$1,l,Ge$3,Zn$4(),Xs$2(qs$2(),Js$2()),Xo$2(ii,ea$3()),{provide:xt$8,useClass:bi},iw(()=>w$4(fe).initNetworkServices()),iw(()=>{w$4(yi);})]});export{$j as $,re$5 as A,Bh as B,Ff as C,Dt$9 as D,Em as E,Fa$5 as F,Gi$3 as G,Dr$4 as H,zA as I,JD as J,Kw as K,Fp as L,Mw as M,N$1 as N,Op as O,Pi$5 as P,Qn$4 as Q,Rp as R,ca$4 as S,TT as T,Kh as U,L$5 as V,Wp as W,xw as X,Aw as Y,TI as Z,_w as _,G$2 as a,Zr$4 as a$,_$5 as a0,vA as a1,Jt$8 as a2,Xt$5 as a3,Zt$7 as a4,st$7 as a5,Lr$5 as a6,Gj as a7,H$7 as a8,ru as a9,gg as aA,gr$6 as aB,L$7 as aC,Ce$6 as aD,Sr$6 as aE,Pr$5 as aF,tD as aG,j$5 as aH,ms$4 as aI,wm as aJ,wr$5 as aK,me$4 as aL,At$8 as aM,wt$a as aN,Sn$5 as aO,Nt$5 as aP,ee$7 as aQ,lt$3 as aR,De$2 as aS,T$2 as aT,I$2 as aU,We$3 as aV,w$1 as aW,He$4 as aX,xe$3 as aY,R$4 as aZ,Gp as a_,N$7 as aa,te$9 as ab,Mr$4 as ac,Qe$a as ad,be$5 as ae,Tu as af,bu as ag,nn$6 as ah,Ar$5 as ai,zm as aj,nw as ak,Zj as al,LT as am,Hh as an,ue$7 as ao,Ki$5 as ap,Bn$5 as aq,S$5 as ar,ke$3 as as,Tp$1 as at,be$4 as au,_t$9 as av,Cu as aw,ry as ax,lv as ay,Yj as az,wt$3 as b,Jh as b$,Wl as b0,U$2 as b1,Ln$3 as b2,Gn$4 as b3,Xe$5 as b4,Pn$5 as b5,kn$5 as b6,ft$6 as b7,Ht$5 as b8,rn$3 as b9,Ft$2 as bA,F$2 as bB,Qa$4 as bC,HT as bD,$T as bE,w$2 as bF,Bj as bG,ln$4 as bH,Lt$4 as bI,va$4 as bJ,an$3 as bK,ft$5 as bL,Ge$3 as bM,Hn$4 as bN,ve$2 as bO,si$2 as bP,Dn$4 as bQ,ot$e as bR,oa$5 as bS,Lg as bT,jt$6 as bU,Gw as bV,zw as bW,L$4 as bX,m$4 as bY,Po$4 as bZ,Gh as b_,Qt$6 as ba,rt$7 as bb,ae$3 as bc,an$4 as bd,It$4 as be,Kt$3 as bf,mt$1 as bg,xp$1 as bh,Eg as bi,ST as bj,cD as bk,Jw as bl,Ig as bm,FT as bn,lD as bo,gl$2 as bp,yg as bq,vg as br,dp as bs,u$3 as bt,ut$2 as bu,Tn$4 as bv,Bn$4 as bw,Wn$4 as bx,gn$4 as by,hn$3 as bz,$h as c,Wh as c$,Zw as c0,Yw as c1,bh$1 as c2,Qs$2 as c3,Fn$5 as c4,Ut$7 as c5,Ii$5 as c6,Ir$5 as c7,Sv as c8,Sh$1 as c9,Te$4 as cA,Mt$8 as cB,Dt$6 as cC,V as cD,Xl$2 as cE,Un$5 as cF,Ht$1 as cG,R$1 as cH,ee$2 as cI,Nt$1 as cJ,Lt$2 as cK,vb as cL,yb as cM,Wl$2 as cN,eu$1 as cO,Z$9 as cP,ce$4 as cQ,zt$1 as cR,pl$2 as cS,hl$2 as cT,$n$4 as cU,Td as cV,Ur$4 as cW,Xt$7 as cX,Io$3 as cY,Tm as cZ,Fm as c_,Kh$1 as ca,E$5 as cb,fn$7 as cc,N$6 as cd,Ri$5 as ce,xh$1 as cf,Ct$b as cg,Wo$3 as ch,dl$2 as ci,fl$2 as cj,Nr$4 as ck,G$a as cl,Kj as cm,wd as cn,Mr$5 as co,Uh as cp,ie$5 as cq,mg as cr,Sw as cs,Lh as ct,T as cu,G$b as cv,z$5 as cw,ut$b as cx,He$9 as cy,ht$a as cz,ig as d,zl$2 as d$,dh$1 as d0,Hj as d1,wt$9 as d2,ib as d3,gi$6 as d4,jt$9 as d5,_$4 as d6,Ce$5 as d7,Y$9 as d8,Cm as d9,UT as dA,Gl$2 as dB,x$2 as dC,_ as dD,RT as dE,l as dF,rn$1 as dG,ac$1 as dH,cn$1 as dI,nc$1 as dJ,qn$1 as dK,zn$1 as dL,pa$2 as dM,Q$6 as dN,fp$1 as dO,pp$1 as dP,AT as dQ,Fr$1 as dR,Da$4 as dS,wg as dT,NT as dU,Vj as dV,Zh as dW,xT as dX,O$1 as dY,yr$5 as dZ,vl$2 as d_,Qm as da,Dm as db,O$6 as dc,$e$8 as dd,Nt$8 as de,Vt$6 as df,pt$8 as dg,zt$6 as dh,jt$7 as di,Nw as dj,Vh as dk,E$1 as dl,G$4 as dm,ge$5 as dn,n as dp,Ht$6 as dq,Ot$6 as dr,bt$5 as ds,nt$9 as dt,p as du,rt$3 as dv,S as dw,n$1 as dx,K$3 as dy,es$3 as dz,EE as e,lm as e0,H as e1,Xa$4 as e2,v as e3,_$2 as e4,I$3 as e5,aw as e6,ln$3 as e7,II as e8,a$1 as e9,K$4 as ea,rw as eb,eg as f,qw as g,Fw as h,ir$4 as i,jT as j,Qh as k,ud as l,dd as m,G$3 as n,eu as o,R$2 as p,qo$1 as q,f$2 as r,sg as s,pT as t,ul$2 as u,vt$9 as v,w$4 as w,DA as x,yt$3 as y,za$4 as z};