@mxtommy/kip 4.7.0-beta.2 → 4.7.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/history-series.service.js +91 -13
- package/plugin/index.js +110 -8
- package/plugin/kip-plugin/src/history-series.service.js +537 -0
- package/plugin/kip-plugin/src/index.js +1194 -0
- package/plugin/kip-plugin/src/openApi.json +787 -0
- package/plugin/kip-plugin/src/sqlite-history-storage.service.js +1122 -0
- package/plugin/openApi.json +14 -0
- package/plugin/sqlite-history-storage.service.js +13 -19
- package/plugin/src/app/core/contracts/kip-series-contract.js +14 -0
- package/plugin/src/app/core/contracts/kip-series-contract.spec.js +68 -0
- package/public/assets/svg/icons.svg +1 -1
- package/public/{chunk-3MSOVKX6.js → chunk-4YDVZHMH.js} +1 -1
- package/public/{chunk-7H5VXIPS.js → chunk-7ZZK5KBC.js} +1 -1
- package/public/{chunk-EZZ4IJBX.js → chunk-AB34PRGT.js} +1 -1
- package/public/{chunk-NK7SNP45.js → chunk-AQROQY2F.js} +1 -1
- package/public/{chunk-CMHH7BXX.js → chunk-BQPPRM7O.js} +1 -1
- package/public/{chunk-64MHGMIL.js → chunk-CRJ2S7XQ.js} +2 -2
- package/public/{chunk-7EAIOLCB.js → chunk-IENESD5Q.js} +1 -1
- package/public/{chunk-CHMMSVYD.js → chunk-M37BLWHF.js} +5 -5
- package/public/{chunk-Y4DXERRE.js → chunk-OXKOGBYN.js} +12 -12
- package/public/{chunk-FVGLVFWP.js → chunk-QV7OHVD5.js} +1 -1
- package/public/{chunk-NFUW7ILE.js → chunk-SDPSUOCJ.js} +1 -1
- package/public/{chunk-B3VMWHNV.js → chunk-YY4ZUJFI.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-VB3XIM4H.js → main-5HQ6OYM7.js} +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as w}from"./chunk-
|
|
1
|
+
import{b as w}from"./chunk-YY4ZUJFI.js";import{$b as f,Cb as u,Db as s,Eb as p,Ec as t,Fb as d,Ob as b,Qb as y,Re as x,Se as O,Va as i,ac as _,ae as h,cc as m,dc as M,ec as C,fb as g,fe as k,ub as v,wb as r,xb as l}from"./chunk-PZ6I6W3H.js";function T(n,I){if(n&1&&(s(0,"p"),M(1),p()),n&2){let o=y();m(`large-icon-tile-label${o.compact()?" compact":""}`),i(),C(o.label())}}function D(n,I){n&1&&d(0,"div",3)}var R=(()=>{class n{svgIcon=t.required();iconSize=t.required();label=t.required();iconOnly=t(!1);compact=t(!1);active=t(!1);onKeyboardActivate(o){o instanceof KeyboardEvent,o.preventDefault(),o.currentTarget?.click()}static \u0275fac=function(a){return new(a||n)};static \u0275cmp=g({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&&(s(0,"div",0),b("keydown.enter",function(c){return e.onKeyboardActivate(c)})("keydown.space",function(c){return e.onKeyboardActivate(c)}),d(1,"mat-icon",1),r(2,T,2,3,"p",2),r(3,D,1,0,"div",3),p()),a&2&&(m(`${e.compact()?"icon-container-compact":"icon-container"}`),_("active-container-accent",e.active()),v("aria-pressed",e.active())("aria-label",e.iconOnly()?e.label():null),i(),f("width",e.iconSize(),"px")("height",e.iconSize(),"px"),u("svgIcon",e.svgIcon()),i(),l(e.iconOnly()?-1:2),i(),l(e.active()?3:-1))},dependencies:[O,x,w,k,h],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})();export{R as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{d as O,f as Re,g as v,h as Ae,i as We,k as Ie}from"./chunk-2GOHQZH5.js";import{A as de,Aa as R,Ca as ue,Cb as N,Da as fe,Db as H,Eb as Y,Fa as ge,Fb as F,G as he,Gb as ke,Hb as Se,I as pe,Jc as Ee,K as me,Ka as be,Lc as Q,Nb as q,Nd as Z,Ob as ve,Od as Ce,Oe as u,Qb as P,Rb as C,Sb as k,Ub as ye,Va as T,Vb as xe,Wb as De,Xd as Oe,ac as S,ae as J,be as $e,dc as G,ee as U,fb as _,fc as K,fe as X,g as oe,gb as A,h as ne,j as w,k as d,ka as E,l as re,la as $,m as b,n as M,na as L,ob as _e,pa as p,rc as Me,rd as Te,s as ce,sd as we,te as V,ub as z,wb as W,xb as I,z as le}from"./chunk-PZ6I6W3H.js";var ze={url:"",deserializer:a=>JSON.parse(a.data),serializer:a=>JSON.stringify(a)},He="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",j=class a extends re{constructor(o,e){if(super(),this._socket=null,o instanceof w)this.destination=e,this.source=o;else{let t=this._config=Object.assign({},ze);if(this._output=new d,typeof o=="string")t.url=o;else for(let i in o)o.hasOwnProperty(i)&&(t[i]=o[i]);if(!t.WebSocketCtor&&WebSocket)t.WebSocketCtor=WebSocket;else if(!t.WebSocketCtor)throw new Error("no WebSocket constructor can be found");this.destination=new M}}lift(o){let e=new a(this._config,this.destination);return e.operator=o,e.source=this,e}_resetState(){this._socket=null,this.source||(this.destination=new M),this._output=new d}multiplex(o,e,t){let i=this;return new w(s=>{try{i.next(o())}catch(r){s.error(r)}let n=i.subscribe({next:r=>{try{t(r)&&s.next(r)}catch(c){s.error(c)}},error:r=>s.error(r),complete:()=>s.complete()});return()=>{try{i.next(e())}catch(r){s.error(r)}n.unsubscribe()}})}_connectSocket(){let{WebSocketCtor:o,protocol:e,url:t,binaryType:i}=this._config,s=this._output,n=null;try{n=e?new o(t,e):new o(t),this._socket=n,i&&(this._socket.binaryType=i)}catch(c){s.error(c);return}let r=new oe(()=>{this._socket=null,n&&n.readyState===1&&n.close()});n.onopen=c=>{let{_socket:l}=this;if(!l){n.close(),this._resetState();return}let{openObserver:f}=this._config;f&&f.next(c);let g=this.destination;this.destination=ne.create(h=>{if(n.readyState===1)try{let{serializer:m}=this._config;n.send(m(h))}catch(m){this.destination.error(m)}},h=>{let{closingObserver:m}=this._config;m&&m.next(void 0),h&&h.code?n.close(h.code,h.reason):s.error(new TypeError(He)),this._resetState()},()=>{let{closingObserver:h}=this._config;h&&h.next(void 0),n.close(),this._resetState()}),g&&g instanceof M&&r.add(g.subscribe(this.destination))},n.onerror=c=>{this._resetState(),s.error(c)},n.onclose=c=>{n===this._socket&&this._resetState();let{closeObserver:l}=this._config;l&&l.next(c),c.wasClean?s.complete():s.error(c)},n.onmessage=c=>{try{let{deserializer:l}=this._config;s.next(l(c))}catch(l){s.error(l)}}}_subscribe(o){let{source:e}=this;return e?e.subscribe(o):(this._socket||this._connectSocket(),this._output.subscribe(o),o.add(()=>{let{_socket:t}=this;this._output.observers.length===0&&(t&&(t.readyState===1||t.readyState===0)&&t.close(),this._resetState())}),o)}unsubscribe(){let{_socket:o}=this;o&&(o.readyState===1||o.readyState===0)&&o.close(),this._resetState(),super.unsubscribe()}};function ee(a){return new j(a)}var Ne=(()=>{class a{_destroyRef=p(R);_skRequests$=new d;_skNotificationsMsg$=new d;_skValue$=new d;_skMetadata$=new d;_vesselSelfUrn$=new d;_selfUrn=void 0;streamEndpoint={operation:0,message:"Not connected",hasToken:!1};streamEndpoint$=new b(this.streamEndpoint);endpointWS=null;SubscriptionType="self";WS_CONNECTION_SUBSCRIBE="?subscribe=";WS_CONNECTION_META="&sendMeta=all";socketWS$;socketWSCloseEvent$=new d;socketWSOpenEvent$=new d;authToken=null;server=p(We);auth=p(Ie);connectionStateMachine=p(Ae);zones=p(fe);FLATTEN_CONFIG={maxDepth:3,maxObjectSize:20,enableFlattening:!0};DO_NOT_FLATTEN_PATHS=["displays."];constructor(){this.connectionStateMachine.setWebSocketRetryCallback(()=>{console.log("[Delta Service] Executing WebSocket retry via callback"),this.retryWebSocketConnection()}),this.server.serverServiceEndpoint$.pipe(u(this._destroyRef)).subscribe(e=>{e.operation===2&&(this.endpointWS=e.WsServiceUrl,e.subscribeAll?this.SubscriptionType="all":this.SubscriptionType="self")}),this.connectionStateMachine.state$.pipe(u(this._destroyRef)).subscribe(e=>{switch(e){case v.WebSocketConnecting:this.handleWebSocketConnecting();break;case v.Connected:break;case v.Disconnected:case v.WebSocketError:case v.PermanentFailure:this.handleDisconnection();break}}),this.auth.authToken$.pipe(u(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(u(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(u(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)}),he(document,"visibilitychange").pipe(u(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.zones.runOutsideAngular(()=>{this.socketWS$.pipe(u(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=!0):this.streamEndpoint.hasToken=!1,ee({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(n=>s.path.includes(n))){let n={context:t,path:s.path,source:i.$source,timestamp:i.timestamp,value:s.value};this._skValue$.next(n)}else this.FLATTEN_CONFIG.enableFlattening&&this.canFlattenCompletely(s.value,this.FLATTEN_CONFIG.maxDepth,this.FLATTEN_CONFIG.maxObjectSize)?this.flattenObjectValue(s.value,s.path).forEach(r=>{let c={context:t,path:r.path,source:i.$source,timestamp:i.timestamp,value:r.value};this._skValue$.next(c)}):Object.keys(s.value).forEach(n=>{let r={context:t,path:`${s.path}.${n}`,source:i.$source,timestamp:i.timestamp,value:s.value[n]};this._skValue$.next(r)});else{let n={context:t,path:s.path,source:i.$source,timestamp:i.timestamp,value:s.value};this._skValue$.next(n)}})})}canFlattenCompletely(e,t,i,s=0){if(s>=t)return!1;if(typeof e!="object"||e===null)return!0;let n=Object.keys(e);if(n.length>i)return!1;for(let r of n)if(!this.canFlattenCompletely(e[r],t,i,s+1))return!1;return!0}flattenObjectValue(e,t,i=0){let s=[];if(typeof e!="object"||e===null||i>=this.FLATTEN_CONFIG.maxDepth)return[{path:t,value:e}];let n=Object.keys(e);for(let r of n){let c=t?`${t}.${r}`:r,l=this.flattenObjectValue(e[r],c,i+1);s.push(...l)}return s}parseSkMeta(e,t){e.value.properties!==void 0?Object.keys(e.value.properties).forEach(i=>{this._skMetadata$.next({context:t,path:`${e.path}.${i}`,meta:e.value.properties[i]})}):this._skMetadata$.next({context:t,path:e.path,meta:e.value})}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!==v.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||a)};static \u0275prov=E({token:a,factory:a.\u0275fac,providedIn:"root"})}return a})();var x=(function(a){return a.Normal="normal",a.Nominal="nominal",a.Alert="alert",a.Warn="warn",a.Alarm="alarm",a.Emergency="emergency",a})(x||{});var Ye=(function(a){return a.Visual="visual",a.Sound="sound",a})(Ye||{});var qe="self",Fe=a=>isFinite(+(a instanceof Date?a:new Date(a)))?!!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(a):!1,Pe=a=>{if(a)return a==="RFC 3339 (UTC)"?"Date":"number"},Pt=(()=>{class a{delta=p(Ne);_destroyRef=p(R);_deltaUpdatesCounter=0;_deltaUpdatesSubject=new M(10);_isSkDataFullTreeActive=!1;_skDataSubject$=new b([]);_skDataEmitTimer=null;_skDataEmitIntervalMs=200;_dataServiceMeta=[];_dataServiceMetaByPath=new Map;_isSkMetaFullTreeActive=!1;_dataServiceMetaSubject$=new b([]);_skNotificationMsg$=new d;_skNotificationMeta$=new d;_isReset=new d;_pathUpdates$=new d;_selfUrn="self";_skData=new Map;_skDataArrayCache=[];_skDataIndexByPath=new Map;_pathRegister=[];_pathRegisterByPath=new Map;constructor(){pe(1e3).pipe(u(this._destroyRef)).subscribe(()=>{let e={timestamp:Date.now(),value:this._deltaUpdatesCounter};this._deltaUpdatesSubject.next(e),this._deltaUpdatesCounter=0}),this.delta.subscribeDataPathsUpdates().pipe(u(this._destroyRef)).subscribe(e=>{this.updatePathData(e)}),this.delta.subscribeMetadataUpdates().pipe(u(this._destroyRef)).subscribe(e=>{this.setMeta(e)}),this.delta.subscribeNotificationsUpdates().pipe(u(this._destroyRef)).subscribe(e=>{let t=e.path.replace("notifications.","self."),i=this._skData.get(t);if(i&&i.state!==e.value.state){i.state=e.value.state;let s=this._pathRegisterByPath.get(t);if(s?.length)for(let n of s)n._pathState$.next(i.state)}this._skNotificationMsg$.next(e)}),this.delta.subscribeSelfUpdates().pipe(u(this._destroyRef)).subscribe(e=>{this.setSelfUrn(e)})}getSignalkDeltaUpdateStatistics(){return this._deltaUpdatesSubject.asObservable()}resetSignalKData(){this._skData=new Map,this._skDataArrayCache=[],this._skDataIndexByPath.clear(),this._selfUrn="self",this._isReset.next(!0)}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 n=s.filter(r=>r!==i);n.length?this._pathRegisterByPath.set(e,n):this._pathRegisterByPath.delete(e)}}}subscribePath(e,t){let i=this._pathRegisterByPath.get(e),s=i?.find(D=>D.path===e&&D.source===t);if(s)return s.pathDataUpdate$;let n=null,r=null,c=null,l=x.Normal,f={data:{value:null,timestamp:null},state:l},g=null,h=this._skData.get(e);h&&(n=t==="default"?h.pathValue:h.sources?.[t]?.sourceValue??null,r=t==="default"?h.pathTimestamp:h.sources?.[t]?.sourceTimestamp??null,c=r?new Date(r):null,f={data:{value:n,timestamp:c},state:h.state||l},l=h.state||l,g=h.meta||null);let m={path:e,source:t,_pathData$:new b(f.data),_pathState$:new b(f.state),pathDataUpdate$:new b(f),pathMeta$:new b(g?O(g):null)},Be=de([m._pathData$,m._pathState$]).pipe(le(([D,Le])=>({data:D,state:Le})));return m.combinedSub=Be.subscribe(D=>m.pathDataUpdate$.next(D)),this._pathRegister.push(m),i?i.push(m):this._pathRegisterByPath.set(e,[m]),m.pathDataUpdate$}subscribePathTree(e,t="default"){let i=this.normalizePathPrefix(e);return new w(s=>{for(let r of this._skData.values())r.path.startsWith(i)&&s.next({path:r.path,update:this.buildPathUpdate(r,t)});let n=this._pathUpdates$.pipe(me(r=>r.fullPath.startsWith(i))).subscribe(r=>{let c=this._skData.get(r.fullPath);c&&s.next({path:c.path,update:this.buildPathUpdate(c,t)})});return()=>n.unsubscribe()}).pipe(u(this._destroyRef))}updatePathData(e){this._deltaUpdatesCounter++;let t=this.setPathContext(e.context,e.path),i=this._skData.get(t);if(i)i.defaultSource===void 0&&(i.defaultSource=e.source),i.type===void 0&&e.value!==null&&(i.type=typeof e.value,i.type==="string"&&Fe(e.value)&&(i.type="Date")),i.pathValue=e.value,i.pathTimestamp=e.timestamp,i.sources[e.source]={sourceTimestamp:e.timestamp,sourceValue:e.value};else{let n=e.value===null?void 0:typeof e.value;n==="string"&&Fe(e.value)&&(n="Date"),i={path:t,pathValue:e.value,pathTimestamp:e.timestamp,defaultSource:e.source,type:n,state:x.Normal,sources:{[e.source]:{sourceTimestamp:e.timestamp,sourceValue:e.value}}},this._skData.set(t,i)}let s=this._pathRegisterByPath.get(t)??[];if(s.length){let n={value:i.pathValue,timestamp:i.pathTimestamp?new Date(i.pathTimestamp):null},r=s.find(l=>l.source==="default");r&&r._pathData$.next(n);let c=s.find(l=>l.source===e.source);c&&c._pathData$.next(n)}this._isSkDataFullTreeActive&&(this.upsertSkDataCache(i),this.scheduleSkDataFullTreeEmit()),this._pathUpdates$.next({fullPath:t,update:e})}setMeta(e){if(e.path.startsWith("notifications."))this._skNotificationMeta$.next(e);else{let t=this.setPathContext(e.context,e.path),i=this._skData.get(t);i?(i.type==="object"&&e.meta.units&&(i.type=Pe(e.meta.units)),i.meta=Re({},i.meta,e.meta)):(i={path:t,pathValue:void 0,pathTimestamp:void 0,type:Pe(e.meta.units),state:x.Normal,defaultSource:void 0,sources:{},meta:e.meta?O(e.meta):null},this._skData.set(t,i),this._isSkDataFullTreeActive&&(this.upsertSkDataCache(i),this.scheduleSkDataFullTreeEmit()));let s=this._pathRegisterByPath.get(t);if(s?.length)for(let n of s)n.pathMeta$.next(i.meta?O(i.meta):null);this._isSkMetaFullTreeActive&&(this._dataServiceMetaByPath.set(t,{path:t,meta:i.meta}),this._dataServiceMeta=Array.from(this._dataServiceMetaByPath.values()),this._dataServiceMetaSubject$.next(this._dataServiceMeta))}}startSkMetaFullTree(){this._isSkMetaFullTreeActive=!0,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=!1,this._dataServiceMetaSubject$.next([]),this._dataServiceMeta=[],this._dataServiceMetaByPath.clear()}startSkDataFullTree(){return this._isSkDataFullTreeActive=!0,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=!1,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}`:`${qe}.${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,n=i?e.pathTimestamp:e.sources?.[t]?.sourceTimestamp??null;return{data:{value:s,timestamp:n?new Date(n):null},state:e.state||x.Normal}}getPathsByType(e,t){return this.getSkDataArray().filter(i=>i.type===e&&(!t||i.path.startsWith("self"))).map(i=>i.path)}getPathsAndMetaByType(e,t=!1,i=!1,s=!0){return this.getSkDataArray().filter(n=>{let c=["string","number","boolean","object","undefined","function","symbol","bigint","Date"].includes(e)?n.type===e:n.meta?.type===e,l=!s||n.path.startsWith("self"),f=t===!0?n.meta?.supportsPut===!0:!0,g=i===!0?Array.isArray(n.meta?.zones)&&n.meta.zones.length>0:!0;return c&&l&&f&&g}).map(n=>({path:n.path,meta:n.meta}))}getPathObject(e){return O(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;["string","Date","number","multiple"].includes(t)&&(s={data:{value:null,timestamp:null},state:x.Normal}),i.pathDataUpdate$.next(s)}}getNotificationMsgObservable(){return this._skNotificationMsg$.asObservable()}getNotificationMetaObservable(){return this._skNotificationMeta$.asObservable()}getPathMetaObservable(e){return this._pathRegisterByPath.get(e)?.[0]?.pathMeta$.asObservable()||ce(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||a)};static \u0275prov=E({token:a,factory:a.\u0275fac,providedIn:"root"})}return a})();var Ue=(()=>{class a{_animationsDisabled=Oe();state="unchecked";disabled=!1;appearance="full";constructor(){}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=_({type:a,selectors:[["mat-pseudo-checkbox"]],hostAttrs:[1,"mat-pseudo-checkbox"],hostVars:12,hostBindings:function(t,i){t&2&&S("mat-pseudo-checkbox-indeterminate",i.state==="indeterminate")("mat-pseudo-checkbox-checked",i.state==="checked")("mat-pseudo-checkbox-disabled",i.disabled)("mat-pseudo-checkbox-minimal",i.appearance==="minimal")("mat-pseudo-checkbox-full",i.appearance==="full")("_mat-animation-noopable",i._animationsDisabled)},inputs:{state:"state",disabled:"disabled",appearance:"appearance"},decls:0,vars:0,template:function(t,i){},styles:[`.mat-pseudo-checkbox{border-radius:2px;cursor:pointer;display:inline-block;vertical-align:middle;box-sizing:border-box;position:relative;flex-shrink:0;transition:border-color 90ms cubic-bezier(0, 0, 0.2, 0.1),background-color 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox::after{position:absolute;opacity:0;content:"";border-bottom:2px solid currentColor;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox._mat-animation-noopable{transition:none !important;animation:none !important}.mat-pseudo-checkbox._mat-animation-noopable::after{transition:none}.mat-pseudo-checkbox-disabled{cursor:default}.mat-pseudo-checkbox-indeterminate::after{left:1px;opacity:1;border-radius:2px}.mat-pseudo-checkbox-checked::after{left:1px;border-left:2px solid currentColor;transform:rotate(-45deg);opacity:1;box-sizing:content-box}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-minimal-selected-checkmark-color, var(--mat-sys-primary))}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full{border-color:var(--mat-pseudo-checkbox-full-unselected-icon-color, var(--mat-sys-on-surface-variant));border-width:2px;border-style:solid}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-disabled{border-color:var(--mat-pseudo-checkbox-full-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate{background-color:var(--mat-pseudo-checkbox-full-selected-icon-color, var(--mat-sys-primary));border-color:rgba(0,0,0,0)}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-full-selected-checkmark-color, var(--mat-sys-on-primary))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled{background-color:var(--mat-pseudo-checkbox-full-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-full-disabled-selected-checkmark-color, var(--mat-sys-surface))}.mat-pseudo-checkbox{width:18px;height:18px}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after{width:14px;height:6px;transform-origin:center;top:-4.2426406871px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{top:8px;width:16px}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after{width:10px;height:4px;transform-origin:center;top:-2.8284271247px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{top:6px;width:12px}
|
|
2
|
-
`],encapsulation:2,changeDetection:0})}return
|
|
3
|
-
`],encapsulation:2,changeDetection:0})}return
|
|
4
|
-
`],encapsulation:2,changeDetection:0})}return
|
|
5
|
-
`],encapsulation:2,changeDetection:0})}return
|
|
1
|
+
import{d as O,f as Re,g as v,h as Ae,i as We,k as Ie}from"./chunk-2GOHQZH5.js";import{A as de,Aa as R,Ca as ue,Cb as N,Da as fe,Db as H,Eb as Y,Fa as ge,Fb as P,G as he,Gb as ke,Hb as Se,I as pe,Jc as Ee,K as me,Ka as be,Lc as Q,Nb as q,Nd as Z,Ob as ve,Od as Ce,Oe as f,Qb as F,Rb as C,Sb as k,Ub as ye,Va as T,Vb as xe,Wb as De,Xd as Oe,ac as S,ae as J,be as $e,dc as G,ee as U,fb as _,fc as K,fe as X,g as oe,gb as A,h as ne,j as w,k as d,ka as E,l as re,la as $,m as b,n as M,na as L,ob as _e,pa as m,rc as Me,rd as Te,s as ce,sd as we,te as V,ub as z,wb as W,xb as I,z as le}from"./chunk-PZ6I6W3H.js";var ze={url:"",deserializer:s=>JSON.parse(s.data),serializer:s=>JSON.stringify(s)},He="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",j=class s extends re{constructor(o,e){if(super(),this._socket=null,o instanceof w)this.destination=e,this.source=o;else{let t=this._config=Object.assign({},ze);if(this._output=new d,typeof o=="string")t.url=o;else for(let i in o)o.hasOwnProperty(i)&&(t[i]=o[i]);if(!t.WebSocketCtor&&WebSocket)t.WebSocketCtor=WebSocket;else if(!t.WebSocketCtor)throw new Error("no WebSocket constructor can be found");this.destination=new M}}lift(o){let e=new s(this._config,this.destination);return e.operator=o,e.source=this,e}_resetState(){this._socket=null,this.source||(this.destination=new M),this._output=new d}multiplex(o,e,t){let i=this;return new w(a=>{try{i.next(o())}catch(r){a.error(r)}let n=i.subscribe({next:r=>{try{t(r)&&a.next(r)}catch(c){a.error(c)}},error:r=>a.error(r),complete:()=>a.complete()});return()=>{try{i.next(e())}catch(r){a.error(r)}n.unsubscribe()}})}_connectSocket(){let{WebSocketCtor:o,protocol:e,url:t,binaryType:i}=this._config,a=this._output,n=null;try{n=e?new o(t,e):new o(t),this._socket=n,i&&(this._socket.binaryType=i)}catch(c){a.error(c);return}let r=new oe(()=>{this._socket=null,n&&n.readyState===1&&n.close()});n.onopen=c=>{let{_socket:l}=this;if(!l){n.close(),this._resetState();return}let{openObserver:h}=this._config;h&&h.next(c);let g=this.destination;this.destination=ne.create(p=>{if(n.readyState===1)try{let{serializer:u}=this._config;n.send(u(p))}catch(u){this.destination.error(u)}},p=>{let{closingObserver:u}=this._config;u&&u.next(void 0),p&&p.code?n.close(p.code,p.reason):a.error(new TypeError(He)),this._resetState()},()=>{let{closingObserver:p}=this._config;p&&p.next(void 0),n.close(),this._resetState()}),g&&g instanceof M&&r.add(g.subscribe(this.destination))},n.onerror=c=>{this._resetState(),a.error(c)},n.onclose=c=>{n===this._socket&&this._resetState();let{closeObserver:l}=this._config;l&&l.next(c),c.wasClean?a.complete():a.error(c)},n.onmessage=c=>{try{let{deserializer:l}=this._config;a.next(l(c))}catch(l){a.error(l)}}}_subscribe(o){let{source:e}=this;return e?e.subscribe(o):(this._socket||this._connectSocket(),this._output.subscribe(o),o.add(()=>{let{_socket:t}=this;this._output.observers.length===0&&(t&&(t.readyState===1||t.readyState===0)&&t.close(),this._resetState())}),o)}unsubscribe(){let{_socket:o}=this;o&&(o.readyState===1||o.readyState===0)&&o.close(),this._resetState(),super.unsubscribe()}};function ee(s){return new j(s)}var Ne=(()=>{class s{_destroyRef=m(R);_skRequests$=new d;_skNotificationsMsg$=new d;_skValue$=new d;_skMetadata$=new d;_vesselSelfUrn$=new d;_selfUrn=void 0;streamEndpoint={operation:0,message:"Not connected",hasToken:!1};streamEndpoint$=new b(this.streamEndpoint);endpointWS=null;SubscriptionType="self";WS_CONNECTION_SUBSCRIBE="?subscribe=";WS_CONNECTION_META="&sendMeta=all";socketWS$;socketWSCloseEvent$=new d;socketWSOpenEvent$=new d;authToken=null;server=m(We);auth=m(Ie);connectionStateMachine=m(Ae);zones=m(fe);FLATTEN_CONFIG={maxDepth:3,maxObjectSize:20,enableFlattening:!0};DO_NOT_FLATTEN_PATHS=["displays."];constructor(){this.connectionStateMachine.setWebSocketRetryCallback(()=>{console.log("[Delta Service] Executing WebSocket retry via callback"),this.retryWebSocketConnection()}),this.server.serverServiceEndpoint$.pipe(f(this._destroyRef)).subscribe(e=>{e.operation===2&&(this.endpointWS=e.WsServiceUrl,e.subscribeAll?this.SubscriptionType="all":this.SubscriptionType="self")}),this.connectionStateMachine.state$.pipe(f(this._destroyRef)).subscribe(e=>{switch(e){case v.WebSocketConnecting:this.handleWebSocketConnecting();break;case v.Connected:break;case v.Disconnected:case v.WebSocketError:case v.PermanentFailure:this.handleDisconnection();break}}),this.auth.authToken$.pipe(f(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(f(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(f(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)}),he(document,"visibilitychange").pipe(f(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.zones.runOutsideAngular(()=>{this.socketWS$.pipe(f(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=!0):this.streamEndpoint.hasToken=!1,ee({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(a=>this.parseSkMeta(a,t)),i.values!==void 0&&i.values.forEach(a=>{if(a.path.startsWith("notifications."))this._skNotificationsMsg$.next(a);else if(typeof a.value=="object"&&a.value!==null)if(this.DO_NOT_FLATTEN_PATHS.some(n=>a.path.includes(n))){let n={context:t,path:a.path,source:i.$source,timestamp:i.timestamp,value:a.value};this._skValue$.next(n)}else this.FLATTEN_CONFIG.enableFlattening&&this.canFlattenCompletely(a.value,this.FLATTEN_CONFIG.maxDepth,this.FLATTEN_CONFIG.maxObjectSize)?this.flattenObjectValue(a.value,a.path).forEach(r=>{let c={context:t,path:r.path,source:i.$source,timestamp:i.timestamp,value:r.value};this._skValue$.next(c)}):Object.keys(a.value).forEach(n=>{let r={context:t,path:`${a.path}.${n}`,source:i.$source,timestamp:i.timestamp,value:a.value[n]};this._skValue$.next(r)});else{let n={context:t,path:a.path,source:i.$source,timestamp:i.timestamp,value:a.value};this._skValue$.next(n)}})})}canFlattenCompletely(e,t,i,a=0){if(a>=t)return!1;if(typeof e!="object"||e===null)return!0;let n=Object.keys(e);if(n.length>i)return!1;for(let r of n)if(!this.canFlattenCompletely(e[r],t,i,a+1))return!1;return!0}flattenObjectValue(e,t,i=0){let a=[];if(typeof e!="object"||e===null||i>=this.FLATTEN_CONFIG.maxDepth)return[{path:t,value:e}];let n=Object.keys(e);for(let r of n){let c=t?`${t}.${r}`:r,l=this.flattenObjectValue(e[r],c,i+1);a.push(...l)}return a}parseSkMeta(e,t){e.value.properties!==void 0?Object.keys(e.value.properties).forEach(i=>{this._skMetadata$.next({context:t,path:`${e.path}.${i}`,meta:e.value.properties[i]})}):this._skMetadata$.next({context:t,path:e.path,meta:e.value})}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!==v.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||s)};static \u0275prov=E({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})();var x=(function(s){return s.Normal="normal",s.Nominal="nominal",s.Alert="alert",s.Warn="warn",s.Alarm="alarm",s.Emergency="emergency",s})(x||{});var Ye=(function(s){return s.Visual="visual",s.Sound="sound",s})(Ye||{});var qe="self",Pe=s=>isFinite(+(s instanceof Date?s:new Date(s)))?!!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(s):!1,Fe=s=>{if(s)return s==="RFC 3339 (UTC)"?"Date":"number"},Ft=(()=>{class s{delta=m(Ne);_destroyRef=m(R);_deltaUpdatesCounter=0;_deltaUpdatesSubject=new M(10);_isSkDataFullTreeActive=!1;_skDataSubject$=new b([]);_skDataEmitTimer=null;_skDataEmitIntervalMs=200;_dataServiceMeta=[];_dataServiceMetaByPath=new Map;_isSkMetaFullTreeActive=!1;_dataServiceMetaSubject$=new b([]);_skNotificationMsg$=new d;_skNotificationMeta$=new d;_isReset=new d;_pathUpdates$=new d;_selfUrn="self";_skData=new Map;_pendingPathStates=new Map;_skDataArrayCache=[];_skDataIndexByPath=new Map;_pathRegister=[];_pathRegisterByPath=new Map;constructor(){pe(1e3).pipe(f(this._destroyRef)).subscribe(()=>{let e={timestamp:Date.now(),value:this._deltaUpdatesCounter};this._deltaUpdatesSubject.next(e),this._deltaUpdatesCounter=0}),this.delta.subscribeDataPathsUpdates().pipe(f(this._destroyRef)).subscribe(e=>{this.updatePathData(e)}),this.delta.subscribeMetadataUpdates().pipe(f(this._destroyRef)).subscribe(e=>{this.setMeta(e)}),this.delta.subscribeNotificationsUpdates().pipe(f(this._destroyRef)).subscribe(e=>{let t=e.path.replace("notifications.","self."),i=e.value.state,a=this._skData.get(t);if(a&&a.state!==i){a.state=i,this._pathUpdates$.next({fullPath:t,kind:"state"});let n=this._pathRegisterByPath.get(t);if(n?.length)for(let r of n)r._pathState$.next(a.state)}else a||this._pendingPathStates.set(t,i);this._skNotificationMsg$.next(e)}),this.delta.subscribeSelfUpdates().pipe(f(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(!0)}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 a=this._pathRegisterByPath.get(e);if(a){let n=a.filter(r=>r!==i);n.length?this._pathRegisterByPath.set(e,n):this._pathRegisterByPath.delete(e)}}}subscribePath(e,t){let i=this._pathRegisterByPath.get(e),a=i?.find(D=>D.path===e&&D.source===t);if(a)return a.pathDataUpdate$;let n=null,r=null,c=null,l=x.Normal,h={data:{value:null,timestamp:null},state:l},g=null,p=this._skData.get(e);p&&(n=t==="default"?p.pathValue:p.sources?.[t]?.sourceValue??null,r=t==="default"?p.pathTimestamp:p.sources?.[t]?.sourceTimestamp??null,c=r?new Date(r):null,h={data:{value:n,timestamp:c},state:p.state||l},l=p.state||l,g=p.meta||null);let u={path:e,source:t,_pathData$:new b(h.data),_pathState$:new b(h.state),pathDataUpdate$:new b(h),pathMeta$:new b(g?O(g):null)},Be=de([u._pathData$,u._pathState$]).pipe(le(([D,Le])=>({data:D,state:Le})));return u.combinedSub=Be.subscribe(D=>u.pathDataUpdate$.next(D)),this._pathRegister.push(u),i?i.push(u):this._pathRegisterByPath.set(e,[u]),u.pathDataUpdate$}subscribePathTree(e,t="default"){let i=this.normalizePathPrefix(e);return new w(a=>{for(let r of this._skData.values())r.path.startsWith(i)&&a.next({path:r.path,update:this.buildPathUpdate(r,t)});let n=this._pathUpdates$.pipe(me(r=>r.fullPath.startsWith(i))).subscribe(r=>{let c=this._skData.get(r.fullPath);c&&a.next({path:c.path,update:this.buildPathUpdate(c,t)})});return()=>n.unsubscribe()}).pipe(f(this._destroyRef))}updatePathData(e){this._deltaUpdatesCounter++;let t=this.setPathContext(e.context,e.path),i=this._pendingPathStates.get(t),a=this._skData.get(t);if(a)a.defaultSource===void 0&&(a.defaultSource=e.source),a.type===void 0&&e.value!==null&&(a.type=typeof e.value,a.type==="string"&&Pe(e.value)&&(a.type="Date")),a.pathValue=e.value,a.pathTimestamp=e.timestamp,a.sources[e.source]={sourceTimestamp:e.timestamp,sourceValue:e.value};else{let r=e.value===null?void 0:typeof e.value;r==="string"&&Pe(e.value)&&(r="Date"),a={path:t,pathValue:e.value,pathTimestamp:e.timestamp,defaultSource:e.source,type:r,state:i??x.Normal,sources:{[e.source]:{sourceTimestamp:e.timestamp,sourceValue:e.value}}},this._skData.set(t,a),i!==void 0&&this._pendingPathStates.delete(t)}let n=this._pathRegisterByPath.get(t)??[];if(n.length){let r={value:a.pathValue,timestamp:a.pathTimestamp?new Date(a.pathTimestamp):null},c=n.find(h=>h.source==="default");c&&c._pathData$.next(r);let l=n.find(h=>h.source===e.source);l&&l._pathData$.next(r)}this._isSkDataFullTreeActive&&(this.upsertSkDataCache(a),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),a=this._skData.get(t);a?(a.type==="object"&&e.meta.units&&(a.type=Fe(e.meta.units)),a.meta=Re({},a.meta,e.meta)):(a={path:t,pathValue:void 0,pathTimestamp:void 0,type:Fe(e.meta.units),state:i??x.Normal,defaultSource:void 0,sources:{},meta:e.meta?O(e.meta):null},this._skData.set(t,a),i!==void 0&&this._pendingPathStates.delete(t),this._isSkDataFullTreeActive&&(this.upsertSkDataCache(a),this.scheduleSkDataFullTreeEmit()));let n=this._pathRegisterByPath.get(t);if(n?.length)for(let r of n)r.pathMeta$.next(a.meta?O(a.meta):null);this._isSkMetaFullTreeActive&&(this._dataServiceMetaByPath.set(t,{path:t,meta:a.meta}),this._dataServiceMeta=Array.from(this._dataServiceMetaByPath.values()),this._dataServiceMetaSubject$.next(this._dataServiceMeta))}}startSkMetaFullTree(){this._isSkMetaFullTreeActive=!0,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=!1,this._dataServiceMetaSubject$.next([]),this._dataServiceMeta=[],this._dataServiceMetaByPath.clear()}startSkDataFullTree(){return this._isSkDataFullTreeActive=!0,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=!1,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}`:`${qe}.${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",a=i?e.pathValue:e.sources?.[t]?.sourceValue??null,n=i?e.pathTimestamp:e.sources?.[t]?.sourceTimestamp??null;return{data:{value:a,timestamp:n?new Date(n):null},state:e.state||x.Normal}}getPathsByType(e,t){return this.getSkDataArray().filter(i=>i.type===e&&(!t||i.path.startsWith("self"))).map(i=>i.path)}getCachedPaths(e=!1){return this.getSkDataArray().map(t=>t.path).filter(t=>!e||t.startsWith("self."))}getPathsAndMetaByType(e,t=!1,i=!1,a=!0){return this.getSkDataArray().filter(n=>{let c=["string","number","boolean","object","undefined","function","symbol","bigint","Date"].includes(e)?n.type===e:n.meta?.type===e,l=!a||n.path.startsWith("self"),h=t===!0?n.meta?.supportsPut===!0:!0,g=i===!0?Array.isArray(n.meta?.zones)&&n.meta.zones.length>0:!0;return c&&l&&h&&g}).map(n=>({path:n.path,meta:n.meta}))}getPathObject(e){return O(this._skData.get(e))||null}getPathUnitType(e){return this._skData.get(e)?.meta?.units||null}timeoutPathObservable(e,t){let i=this._pathRegister.find(a=>a.path==e);if(i){let a;["string","Date","number","multiple"].includes(t)&&(a={data:{value:null,timestamp:null},state:x.Normal}),i.pathDataUpdate$.next(a)}}getNotificationMsgObservable(){return this._skNotificationMsg$.asObservable()}getNotificationMetaObservable(){return this._skNotificationMeta$.asObservable()}getPathMetaObservable(e){return this._pathRegisterByPath.get(e)?.[0]?.pathMeta$.asObservable()||ce(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||s)};static \u0275prov=E({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})();var Ue=(()=>{class s{_animationsDisabled=Oe();state="unchecked";disabled=!1;appearance="full";constructor(){}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=_({type:s,selectors:[["mat-pseudo-checkbox"]],hostAttrs:[1,"mat-pseudo-checkbox"],hostVars:12,hostBindings:function(t,i){t&2&&S("mat-pseudo-checkbox-indeterminate",i.state==="indeterminate")("mat-pseudo-checkbox-checked",i.state==="checked")("mat-pseudo-checkbox-disabled",i.disabled)("mat-pseudo-checkbox-minimal",i.appearance==="minimal")("mat-pseudo-checkbox-full",i.appearance==="full")("_mat-animation-noopable",i._animationsDisabled)},inputs:{state:"state",disabled:"disabled",appearance:"appearance"},decls:0,vars:0,template:function(t,i){},styles:[`.mat-pseudo-checkbox{border-radius:2px;cursor:pointer;display:inline-block;vertical-align:middle;box-sizing:border-box;position:relative;flex-shrink:0;transition:border-color 90ms cubic-bezier(0, 0, 0.2, 0.1),background-color 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox::after{position:absolute;opacity:0;content:"";border-bottom:2px solid currentColor;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox._mat-animation-noopable{transition:none !important;animation:none !important}.mat-pseudo-checkbox._mat-animation-noopable::after{transition:none}.mat-pseudo-checkbox-disabled{cursor:default}.mat-pseudo-checkbox-indeterminate::after{left:1px;opacity:1;border-radius:2px}.mat-pseudo-checkbox-checked::after{left:1px;border-left:2px solid currentColor;transform:rotate(-45deg);opacity:1;box-sizing:content-box}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-minimal-selected-checkmark-color, var(--mat-sys-primary))}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full{border-color:var(--mat-pseudo-checkbox-full-unselected-icon-color, var(--mat-sys-on-surface-variant));border-width:2px;border-style:solid}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-disabled{border-color:var(--mat-pseudo-checkbox-full-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate{background-color:var(--mat-pseudo-checkbox-full-selected-icon-color, var(--mat-sys-primary));border-color:rgba(0,0,0,0)}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-full-selected-checkmark-color, var(--mat-sys-on-primary))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled{background-color:var(--mat-pseudo-checkbox-full-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-full-disabled-selected-checkmark-color, var(--mat-sys-surface))}.mat-pseudo-checkbox{width:18px;height:18px}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after{width:14px;height:6px;transform-origin:center;top:-4.2426406871px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{top:8px;width:16px}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after{width:10px;height:4px;transform-origin:center;top:-2.8284271247px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{top:6px;width:12px}
|
|
2
|
+
`],encapsulation:2,changeDetection:0})}return s})();var Qe=["*",[["mat-option"],["ng-container"]]],Ze=["*","mat-option, ng-container"],Je=["text"],Xe=[[["mat-icon"]],"*"],et=["mat-icon","*"];function tt(s,o){if(s&1&&P(0,"mat-pseudo-checkbox",1),s&2){let e=F();N("disabled",e.disabled)("state",e.selected?"checked":"unchecked")}}function it(s,o){if(s&1&&P(0,"mat-pseudo-checkbox",3),s&2){let e=F();N("disabled",e.disabled)}}function at(s,o){if(s&1&&(H(0,"span",4),G(1),Y()),s&2){let e=F();T(),K("(",e.group.label,")")}}var te=new L("MAT_OPTION_PARENT_COMPONENT"),ie=new L("MatOptgroup"),st=(()=>{class s{label;disabled=!1;_labelId=m(Z).getId("mat-optgroup-label-");_inert;constructor(){let e=m(te,{optional:!0});this._inert=e?.inertGroups??!1}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=_({type:s,selectors:[["mat-optgroup"]],hostAttrs:[1,"mat-mdc-optgroup"],hostVars:3,hostBindings:function(t,i){t&2&&z("role",i._inert?null:"group")("aria-disabled",i._inert?null:i.disabled.toString())("aria-labelledby",i._inert?null:i._labelId)},inputs:{label:"label",disabled:[2,"disabled","disabled",Q]},exportAs:["matOptgroup"],features:[Me([{provide:ie,useExisting:s}])],ngContentSelectors:Ze,decls:5,vars:4,consts:[["role","presentation",1,"mat-mdc-optgroup-label",3,"id"],[1,"mdc-list-item__primary-text"]],template:function(t,i){t&1&&(C(Qe),ke(0,"span",0)(1,"span",1),G(2),k(3),Se()(),k(4,1)),t&2&&(S("mdc-list-item--disabled",i.disabled),q("id",i._labelId),T(2),K("",i.label," "))},styles:[`.mat-mdc-optgroup{color:var(--mat-optgroup-label-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-optgroup-label-text-font, var(--mat-sys-title-small-font));line-height:var(--mat-optgroup-label-text-line-height, var(--mat-sys-title-small-line-height));font-size:var(--mat-optgroup-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-optgroup-label-text-tracking, var(--mat-sys-title-small-tracking));font-weight:var(--mat-optgroup-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-optgroup-label{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;min-height:48px;padding:0 16px;outline:none}.mat-mdc-optgroup-label.mdc-list-item--disabled{opacity:.38}.mat-mdc-optgroup-label .mdc-list-item__primary-text{font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;white-space:normal;color:inherit}
|
|
3
|
+
`],encapsulation:2,changeDetection:0})}return s})(),B=class{source;isUserInput;constructor(o,e=!1){this.source=o,this.isUserInput=e}},ae=(()=>{class s{_element=m(be);_changeDetectorRef=m(Ee);_parent=m(te,{optional:!0});group=m(ie,{optional:!0});_signalDisableRipple=!1;_selected=!1;_active=!1;_mostRecentViewValue="";get multiple(){return this._parent&&this._parent.multiple}get selected(){return this._selected}value;id=m(Z).getId("mat-option-");get disabled(){return this.group&&this.group.disabled||this._disabled()}set disabled(e){this._disabled.set(e)}_disabled=ge(!1);get disableRipple(){return this._signalDisableRipple?this._parent.disableRipple():!!this._parent?.disableRipple}get hideSingleSelectionIndicator(){return!!(this._parent&&this._parent.hideSingleSelectionIndicator)}onSelectionChange=new ue;_text;_stateChanges=new d;constructor(){let e=m(Te);e.load($e),e.load(we),this._signalDisableRipple=!!this._parent&&_e(this._parent.disableRipple)}get active(){return this._active}get viewValue(){return(this._text?.nativeElement.textContent||"").trim()}select(e=!0){this._selected||(this._selected=!0,this._changeDetectorRef.markForCheck(),e&&this._emitSelectionChangeEvent())}deselect(e=!0){this._selected&&(this._selected=!1,this._changeDetectorRef.markForCheck(),e&&this._emitSelectionChangeEvent())}focus(e,t){let i=this._getHostElement();typeof i.focus=="function"&&i.focus(t)}setActiveStyles(){this._active||(this._active=!0,this._changeDetectorRef.markForCheck())}setInactiveStyles(){this._active&&(this._active=!1,this._changeDetectorRef.markForCheck())}getLabel(){return this.viewValue}_handleKeydown(e){(e.keyCode===13||e.keyCode===32)&&!Ce(e)&&(this._selectViaInteraction(),e.preventDefault())}_selectViaInteraction(){this.disabled||(this._selected=this.multiple?!this._selected:!0,this._changeDetectorRef.markForCheck(),this._emitSelectionChangeEvent(!0))}_getTabIndex(){return this.disabled?"-1":"0"}_getHostElement(){return this._element.nativeElement}ngAfterViewChecked(){if(this._selected){let e=this.viewValue;e!==this._mostRecentViewValue&&(this._mostRecentViewValue&&this._stateChanges.next(),this._mostRecentViewValue=e)}}ngOnDestroy(){this._stateChanges.complete()}_emitSelectionChangeEvent(e=!1){this.onSelectionChange.emit(new B(this,e))}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=_({type:s,selectors:[["mat-option"]],viewQuery:function(t,i){if(t&1&&ye(Je,7),t&2){let a;xe(a=De())&&(i._text=a.first)}},hostAttrs:["role","option",1,"mat-mdc-option","mdc-list-item"],hostVars:11,hostBindings:function(t,i){t&1&&ve("click",function(){return i._selectViaInteraction()})("keydown",function(n){return i._handleKeydown(n)}),t&2&&(q("id",i.id),z("aria-selected",i.selected)("aria-disabled",i.disabled.toString()),S("mdc-list-item--selected",i.selected)("mat-mdc-option-multiple",i.multiple)("mat-mdc-option-active",i.active)("mdc-list-item--disabled",i.disabled))},inputs:{value:"value",id:"id",disabled:[2,"disabled","disabled",Q]},outputs:{onSelectionChange:"onSelectionChange"},exportAs:["matOption"],ngContentSelectors:et,decls:8,vars:5,consts:[["text",""],["aria-hidden","true",1,"mat-mdc-option-pseudo-checkbox",3,"disabled","state"],[1,"mdc-list-item__primary-text"],["state","checked","aria-hidden","true","appearance","minimal",1,"mat-mdc-option-pseudo-checkbox",3,"disabled"],[1,"cdk-visually-hidden"],["aria-hidden","true","mat-ripple","",1,"mat-mdc-option-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled"]],template:function(t,i){t&1&&(C(Xe),W(0,tt,1,2,"mat-pseudo-checkbox",1),k(1),H(2,"span",2,0),k(4,1),Y(),W(5,it,1,1,"mat-pseudo-checkbox",3),W(6,at,2,1,"span",4),P(7,"div",5)),t&2&&(I(i.multiple?0:-1),T(5),I(!i.multiple&&i.selected&&!i.hideSingleSelectionIndicator?5:-1),T(),I(i.group&&i.group._inert?6:-1),T(),N("matRippleTrigger",i._getHostElement())("matRippleDisabled",i.disabled||i.disableRipple))},dependencies:[Ue,J],styles:[`.mat-mdc-option{-webkit-user-select:none;user-select:none;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;min-height:48px;padding:0 16px;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--mat-option-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-option-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-option-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-option-label-text-size, var(--mat-sys-body-large-size));letter-spacing:var(--mat-option-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-option-label-text-weight, var(--mat-sys-body-large-weight))}.mat-mdc-option:hover:not(.mdc-list-item--disabled){background-color:var(--mat-option-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-option:focus.mdc-list-item,.mat-mdc-option.mat-mdc-option-active.mdc-list-item{background-color:var(--mat-option-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent));outline:0}.mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled):not(.mat-mdc-option-active,.mat-mdc-option-multiple,:focus,:hover){background-color:var(--mat-option-selected-state-layer-color, var(--mat-sys-secondary-container))}.mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled):not(.mat-mdc-option-active,.mat-mdc-option-multiple,:focus,:hover) .mdc-list-item__primary-text{color:var(--mat-option-selected-state-label-text-color, var(--mat-sys-on-secondary-container))}.mat-mdc-option .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-option-selected-state-label-text-color, var(--mat-sys-on-secondary-container))}.mat-mdc-option.mdc-list-item{align-items:center;background:rgba(0,0,0,0)}.mat-mdc-option.mdc-list-item--disabled{cursor:default;pointer-events:none}.mat-mdc-option.mdc-list-item--disabled .mat-mdc-option-pseudo-checkbox,.mat-mdc-option.mdc-list-item--disabled .mdc-list-item__primary-text,.mat-mdc-option.mdc-list-item--disabled>mat-icon{opacity:.38}.mat-mdc-optgroup .mat-mdc-option:not(.mat-mdc-option-multiple){padding-left:32px}[dir=rtl] .mat-mdc-optgroup .mat-mdc-option:not(.mat-mdc-option-multiple){padding-left:16px;padding-right:32px}.mat-mdc-option .mat-icon,.mat-mdc-option .mat-pseudo-checkbox-full{margin-right:16px;flex-shrink:0}[dir=rtl] .mat-mdc-option .mat-icon,[dir=rtl] .mat-mdc-option .mat-pseudo-checkbox-full{margin-right:0;margin-left:16px}.mat-mdc-option .mat-pseudo-checkbox-minimal{margin-left:16px;flex-shrink:0}[dir=rtl] .mat-mdc-option .mat-pseudo-checkbox-minimal{margin-right:16px;margin-left:0}.mat-mdc-option .mat-mdc-option-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-option .mdc-list-item__primary-text{white-space:normal;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;margin-right:auto}[dir=rtl] .mat-mdc-option .mdc-list-item__primary-text{margin-right:0;margin-left:auto}@media(forced-colors: active){.mat-mdc-option.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}[dir=rtl] .mat-mdc-option.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after{right:auto;left:16px}}.mat-mdc-option-multiple{--mat-list-list-item-selected-container-color: var(--mat-list-list-item-container-color, transparent)}.mat-mdc-option-active .mat-focus-indicator::before{content:""}
|
|
4
|
+
`],encapsulation:2,changeDetection:0})}return s})();function ot(s,o,e){if(e.length){let t=o.toArray(),i=e.toArray(),a=0;for(let n=0;n<s+1;n++)t[n].group&&t[n].group===i[a]&&a++;return a}return 0}function nt(s,o,e,t){return s<e?s:s+o>e+t?Math.max(0,s-t+o):e}var se=class{_multiple;_emitChanges;compareWith;_selection=new Set;_deselectedToEmit=[];_selectedToEmit=[];_selected=null;get selected(){return this._selected||(this._selected=Array.from(this._selection.values())),this._selected}changed=new d;constructor(o=!1,e,t=!0,i){this._multiple=o,this._emitChanges=t,this.compareWith=i,e&&e.length&&(o?e.forEach(a=>this._markSelected(a)):this._markSelected(e[0]),this._selectedToEmit.length=0)}select(...o){this._verifyValueAssignment(o),o.forEach(t=>this._markSelected(t));let e=this._hasQueuedChanges();return this._emitChangeEvent(),e}deselect(...o){this._verifyValueAssignment(o),o.forEach(t=>this._unmarkSelected(t));let e=this._hasQueuedChanges();return this._emitChangeEvent(),e}setSelection(...o){this._verifyValueAssignment(o);let e=this.selected,t=new Set(o.map(a=>this._getConcreteValue(a)));o.forEach(a=>this._markSelected(a)),e.filter(a=>!t.has(this._getConcreteValue(a,t))).forEach(a=>this._unmarkSelected(a));let i=this._hasQueuedChanges();return this._emitChangeEvent(),i}toggle(o){return this.isSelected(o)?this.deselect(o):this.select(o)}clear(o=!0){this._unmarkAll();let e=this._hasQueuedChanges();return o&&this._emitChangeEvent(),e}isSelected(o){return this._selection.has(this._getConcreteValue(o))}isEmpty(){return this._selection.size===0}hasValue(){return!this.isEmpty()}sort(o){this._multiple&&this.selected&&this._selected.sort(o)}isMultipleSelection(){return this._multiple}_emitChangeEvent(){this._selected=null,(this._selectedToEmit.length||this._deselectedToEmit.length)&&(this.changed.next({source:this,added:this._selectedToEmit,removed:this._deselectedToEmit}),this._deselectedToEmit=[],this._selectedToEmit=[])}_markSelected(o){o=this._getConcreteValue(o),this.isSelected(o)||(this._multiple||this._unmarkAll(),this.isSelected(o)||this._selection.add(o),this._emitChanges&&this._selectedToEmit.push(o))}_unmarkSelected(o){o=this._getConcreteValue(o),this.isSelected(o)&&(this._selection.delete(o),this._emitChanges&&this._deselectedToEmit.push(o))}_unmarkAll(){this.isEmpty()||this._selection.forEach(o=>this._unmarkSelected(o))}_verifyValueAssignment(o){o.length>1&&this._multiple}_hasQueuedChanges(){return!!(this._deselectedToEmit.length||this._selectedToEmit.length)}_getConcreteValue(o,e){if(this.compareWith){e=e??this._selection;for(let t of e)if(this.compareWith(o,t))return t;return o}else return o}};var rt=(()=>{class s{_listeners=[];notify(e,t){for(let i of this._listeners)i(e,t)}listen(e){return this._listeners.push(e),()=>{this._listeners=this._listeners.filter(t=>e!==t)}}ngOnDestroy(){this._listeners=[]}static \u0275fac=function(t){return new(t||s)};static \u0275prov=E({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})();var Ve=class{applyChanges(o,e,t,i,a){o.forEachOperation((n,r,c)=>{let l,h;if(n.previousIndex==null){let g=t(n,r,c);l=e.createEmbeddedView(g.templateRef,g.context,g.index),h=V.INSERTED}else c==null?(e.remove(r),h=V.REMOVED):(l=e.get(r),e.move(l,c),h=V.MOVED);a&&a({context:l?.context,operation:h,record:n})})}detach(){}};var je=(()=>{class s{static \u0275fac=function(t){return new(t||s)};static \u0275mod=A({type:s});static \u0275inj=$({imports:[U]})}return s})();var ct=(()=>{class s{static \u0275fac=function(t){return new(t||s)};static \u0275mod=A({type:s});static \u0275inj=$({imports:[X,je,ae,U]})}return s})();var lt=["mat-internal-form-field",""],dt=["*"],xi=(()=>{class s{labelPosition="after";static \u0275fac=function(t){return new(t||s)};static \u0275cmp=_({type:s,selectors:[["div","mat-internal-form-field",""]],hostAttrs:[1,"mdc-form-field","mat-internal-form-field"],hostVars:2,hostBindings:function(t,i){t&2&&S("mdc-form-field--align-end",i.labelPosition==="before")},inputs:{labelPosition:"labelPosition"},attrs:lt,ngContentSelectors:dt,decls:1,vars:0,template:function(t,i){t&1&&(C(),k(0))},styles:[`.mat-internal-form-field{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;vertical-align:middle}.mat-internal-form-field>label{margin-left:0;margin-right:auto;padding-left:4px;padding-right:0;order:0}[dir=rtl] .mat-internal-form-field>label{margin-left:auto;margin-right:0;padding-left:0;padding-right:4px}.mdc-form-field--align-end>label{margin-left:auto;margin-right:0;padding-left:0;padding-right:4px;order:-1}[dir=rtl] .mdc-form-field--align-end .mdc-form-field--align-end label{margin-left:0;margin-right:auto;padding-left:4px;padding-right:0}
|
|
5
|
+
`],encapsulation:2,changeDetection:0})}return s})();export{Ue as a,te as b,ie as c,st as d,B as e,ae as f,ot as g,nt as h,rt as i,Ve as j,se as k,je as l,ct as m,xi as n,x as o,Ye as p,Ne as q,Ft as r};
|