@signalk/freeboard-sk 3.4.0 → 3.4.1
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/public/assets/features-corpus.json +1 -1
- package/public/{chunk-VX5OMNYT.js → chunk-2NWIJAJ6.js} +1 -1
- package/public/{chunk-LAEWLVI3.js → chunk-3MRBMOCG.js} +1 -1
- package/public/{chunk-O7ZJUEKN.js → chunk-4BCNBZTG.js} +1 -1
- package/public/{chunk-S3D6SFT3.js → chunk-6JTVABJT.js} +103 -103
- package/public/{chunk-KVAJ5GVN.js → chunk-7VECY4HP.js} +1 -1
- package/public/{chunk-6WBZNWRD.js → chunk-QYBMIGVH.js} +1 -1
- package/public/{chunk-7TRPB24O.js → chunk-RH4MSKTX.js} +1 -1
- package/public/{chunk-A6WPZCNE.js → chunk-YH3OTY6F.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-4HT3LEFF.js → main-WXGVUWZE.js} +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{da as z}from"./chunk-
|
|
1
|
+
import{da as z}from"./chunk-6JTVABJT.js";import"./chunk-YBVURHD5.js";import"./chunk-CI2BDMX2.js";import"./chunk-DSUCHYD7.js";import"./chunk-MZ3YWFFB.js";import"./chunk-SIFYI3HU.js";import"./chunk-GJZ7P5CR.js";import"./chunk-RENDTMDT.js";import"./chunk-DN6IX7CO.js";import"./chunk-ZQSUYMH2.js";import"./chunk-DC5AFSD6.js";import{$a as V,Fa as C,Ga as w,Ia as O,Ja as S,Ka as R,La as E,Na as T,Oa as A,Wa as k,Ya as j,m as I}from"./chunk-2QKJQDG4.js";import"./chunk-LEEF5WZZ.js";import"./chunk-7FANVIZX.js";import"./chunk-K4EGDHPT.js";import"./chunk-RYULE37H.js";import{Db as D,Hb as p,Jb as g,La as h,Nb as y,Oa as s,Ob as b,Pb as x,Wa as c,Yb as r,Zb as M,_a as v,ba as f,ca as u,nb as m,ob as d,tb as P,ub as a,vb as o,wb as _}from"./chunk-R6ABX6RX.js";import"./chunk-MWETYHR7.js";import"./chunk-WARJYBQ7.js";import"./chunk-BZGM3F3K.js";var U=["frame"];function Q(n,t){if(n&1&&(a(0,"mat-dialog-content",3),_(1,"iframe",6,0),o()),n&2){let e=g();s(),P("src",e.url,h)("title",e.data.panel.title)}}function B(n,t){n&1&&(a(0,"mat-dialog-content",4),r(1," This widget has no settings. "),o())}function F(n,t){if(n&1){let e=D();a(0,"mat-dialog-actions",5)(1,"button",7),p("click",function(){f(e);let l=g();return u(l.removeWidget())}),a(2,"mat-icon"),r(3,"delete"),o(),r(4," Remove widget "),o()()}}var W=class n{constructor(t,e,i,l){this.dialogRef=t;this.data=e;this.service=i;this.sanitizer=l}dialogRef;data;service;sanitizer;frame;url;detach=null;ngOnInit(){let t=this.data.panel;t&&(this.url=this.sanitizer.bypassSecurityTrustResourceUrl(t.url?this.service.resolveAssetUrl(t.url):"about:blank"))}ngAfterViewInit(){let t=this.data.panel;!t||!this.frame||(this.detach=this.service.attachPanel(this.frame.nativeElement,{extension:this.data.extension,panel:t,targetInstance:this.data.targetInstance,targetWidget:this.data.targetWidget,targetOverlay:this.data.targetOverlay,close:()=>this.dialogRef.close()}))}removeWidget(){this.data.targetInstance&&this.service.removeWidget(this.data.targetInstance),this.dialogRef.close()}ngOnDestroy(){this.detach?.(),this.detach=null}static \u0275fac=function(e){return new(e||n)(c(C),c(w),c(z),c(I))};static \u0275cmp=v({type:n,selectors:[["fb-plotterext-panel-dialog"]],viewQuery:function(e,i){if(e&1&&y(U,5),e&2){let l;b(l=x())&&(i.frame=l.first)}},decls:9,vars:3,consts:[["frame",""],["mat-dialog-title","",1,"pe-panel-header"],["mat-icon-button","","aria-label","Close",3,"click"],[1,"pe-panel-content"],[1,"pe-panel-noconfig"],[1,"pe-panel-actions"],["sandbox","allow-scripts allow-same-origin allow-forms",3,"src","title"],["mat-button","",1,"pe-remove",3,"click"]],template:function(e,i){e&1&&(a(0,"div",1)(1,"span"),r(2),o(),a(3,"button",2),p("click",function(){return i.dialogRef.close()}),a(4,"mat-icon"),r(5,"close"),o()()(),m(6,Q,3,2,"mat-dialog-content",3)(7,B,2,0,"mat-dialog-content",4),m(8,F,5,0,"mat-dialog-actions",5)),e&2&&(s(2),M(i.data.panel?i.data.panel.title:i.data.title),s(4),d(i.data.panel?6:7),s(2),d(i.data.targetInstance?8:-1))},dependencies:[E,O,R,S,V,j,k,A,T],styles:[".pe-panel-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding-right:8px}.pe-panel-content[_ngcontent-%COMP%]{padding:0;height:60vh}.pe-panel-noconfig[_ngcontent-%COMP%]{padding:16px 24px}iframe[_ngcontent-%COMP%]{display:block;width:100%;height:100%;border:none}.pe-panel-actions[_ngcontent-%COMP%]{justify-content:flex-start}.pe-remove[_ngcontent-%COMP%]{color:#d32f2f}"]})};export{W as PlotterPanelDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as Z,bc as $,v as Y}from"./chunk-
|
|
1
|
+
import{N as Z,bc as $,v as Y}from"./chunk-6JTVABJT.js";import{a as q,b as Q,c as X}from"./chunk-YBVURHD5.js";import"./chunk-CI2BDMX2.js";import"./chunk-DSUCHYD7.js";import{j as B,l as N}from"./chunk-MZ3YWFFB.js";import{a as z,b as G,d as J}from"./chunk-SIFYI3HU.js";import{a as U}from"./chunk-GJZ7P5CR.js";import"./chunk-RENDTMDT.js";import"./chunk-DN6IX7CO.js";import"./chunk-ZQSUYMH2.js";import{b as K,i as W,o as H}from"./chunk-DC5AFSD6.js";import{$a as j,Fa as P,Ga as R,Ja as k,La as T,Na as V,Oa as A,Wa as F,Ya as O,rb as L}from"./chunk-2QKJQDG4.js";import"./chunk-LEEF5WZZ.js";import"./chunk-7FANVIZX.js";import"./chunk-K4EGDHPT.js";import"./chunk-RYULE37H.js";import{Db as b,Hb as f,Jb as c,Oa as r,Wa as m,Yb as n,Zb as w,_a as v,_b as y,ba as d,bc as D,ca as p,cc as S,dc as E,nb as u,ob as g,qb as C,rb as M,sb as I,tb as _,ub as i,vb as t,wb as h}from"./chunk-R6ABX6RX.js";import"./chunk-MWETYHR7.js";import"./chunk-WARJYBQ7.js";import"./chunk-BZGM3F3K.js";function te(a,o){if(a&1&&(i(0,"mat-option",10),n(1),t()),a&2){let e=o.$implicit;_("value",e),r(),w(e)}}function ie(a,o){if(a&1){let e=b();i(0,"div")(1,"ap-file-input",17),f("chosen",function(l){d(e);let x=c(2);return p(x.parseFile(l))}),i(2,"div",18)(3,"div",19),n(4," Click or Drop file "),t()()()()}a&2&&(r(),_("astext",!0))}function ne(a,o){if(a&1){let e=b();i(0,"div")(1,"div")(2,"b"),n(3,"Invalid Resource Data:"),t(),h(4,"br")(5,"br"),i(6,"i"),n(7,"Selected file does not contain valid data. "),t(),h(8,"br"),t(),i(9,"div",20)(10,"button",21),f("click",function(){d(e);let l=c(2);return p(l.app.showHelp("resource"))}),i(11,"mat-icon"),n(12,"help"),t(),n(13," Help "),t()()()}}function ae(a,o){a&1&&(i(0,"div",16),n(1," Note: Data will not be validated when uploaded to server! "),t())}function oe(a,o){if(a&1){let e=b();i(0,"div",7)(1,"div")(2,"mat-form-field",8)(3,"mat-label"),n(4,"Select Destination Path"),t(),i(5,"mat-select",9,0),E("valueChange",function(l){d(e);let x=c();return S(x.targetPath,l)||(x.targetPath=l),p(l)}),M(7,te,2,2,"mat-option",10,C),t()()(),u(9,ie,5,1,"div"),u(10,ne,14,0,"div"),i(11,"div")(12,"div",11)(13,"div",12)(14,"div")(15,"span",13),n(16,"Name:"),t(),n(17),t(),i(18,"div")(19,"span",13),n(20,"Type:"),t(),n(21),t()()(),i(22,"div",14)(23,"button",15),f("click",function(){d(e);let l=c();return p(l.load())}),i(24,"mat-icon"),n(25,"file_upload"),t(),n(26," \xA0Load\xA0 "),t(),h(27,"br"),n(28,"\xA0 "),u(29,ae,2,0,"div",16),t()()()}if(a&2){let e=c();r(5),_("disabled",!e.resPaths),D("value",e.targetPath),r(2),I(e.resPaths),r(2),g(e.source.name?-1:9),r(),g(e.display.notValid?10:-1),r(7),y(" ",e.source.name," "),r(4),y(" ",e.source.type," "),r(2),_("disabled",!e.targetPath||!e.source.name),r(6),g(e.targetPath&&e.source.name?29:-1)}}var ee=class a{constructor(o,e,s,l){this.app=o;this.skclient=e;this.dialogRef=s;this.data=l}app;skclient;dialogRef;data;resPaths=[];targetPath=null;source={type:null,name:null,data:null};display={notValid:!1};ngOnInit(){this.skclient.api.get(this.app.skApiVersion,"/resources").subscribe(o=>{this.resPaths=[],this.targetPath=null,this.resPaths=Object.keys(o).filter(e=>!["routes","waypoints","notes","regions","charts","tracks"].includes(e))},()=>{this.resPaths=[],this.targetPath=null})}load(){this.dialogRef.close({path:this.targetPath,data:this.source.data})}parseFile(o){this.source=o,this.source.type="Unknown";try{let e=JSON.parse(o.data);this.source.type=e.type?e.type:this.source.type}catch(e){console.log("Error parsing resource file!")}}static \u0275fac=function(e){return new(e||a)(m($),m(Y),m(P),m(R))};static \u0275cmp=v({type:a,selectors:[["resource-upload-dialog"]],decls:13,vars:1,consts:[["respaths",""],[1,"resourceload-dialog"],[2,"background-color","transparent"],[2,"flex","1 1 auto","text-align","center"],[2,"text-align","right"],["mat-icon-button","",3,"click"],["mat-dialog-content",""],[1,"card-group"],["floatLabel","always",2,"width","100%"],["id","respaths",3,"valueChange","disabled","value"],[3,"value"],[2,"display","flex","flex-wrap","wrap"],[2,"flex","1 1 auto","padding","5px","font-size","smaller"],[2,"font-weight","bold"],[2,"text-align","center","padding-top","15px"],["mat-raised-button","","matTooltip","Load features","matTooltipPosition","below",3,"click","disabled"],[2,"padding","10px","border","gray 1px dashed","font-style","italic"],[3,"chosen","astext"],[2,"width","200px"],[2,"padding","25%","border","gray 1px dashed"],[2,"width","100%","text-align","center"],["mat-raised-button","",3,"click"]],template:function(e,s){e&1&&(i(0,"div",1)(1,"mat-toolbar",2)(2,"span")(3,"mat-icon"),n(4,"category"),t()(),i(5,"span",3),n(6,"Load Resource"),t(),i(7,"span",4)(8,"button",5),f("click",function(){return s.dialogRef.close()}),i(9,"mat-icon"),n(10,"close"),t()()()(),i(11,"div",6),u(12,oe,30,8,"div",7),t()()),e&2&&(r(12),g(s.display.notValid?-1:12))},dependencies:[L,H,W,K,J,G,z,X,U,A,V,B,j,O,F,Q,q,N,T,k,Z],styles:[".resourceload-dialog[_ngcontent-%COMP%]{font-family:roboto;position:relative;width:100%}.card-group[_ngcontent-%COMP%]{padding:5px 5%}@media only screen and (min-width:800px){.card-group[_ngcontent-%COMP%]{padding:5px 5%}}"]})};export{ee as ResourceImportDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ie,b as O,c as Ke,d as Ae,e as Be}from"./chunk-7PF3OZ2P.js";import{Ha as Pe,Ia as De,Ja as Me,bc as Ve,g as ee,l as _e,m as ye,n as ke,o as Ce,p as ve,pb as Re,qb as Ge,rb as Oe,sb as Xe,tb as Fe,u as Se,ub as We,v as G,xa as Ee}from"./chunk-S3D6SFT3.js";import{a as be,b as Te,c as we}from"./chunk-YBVURHD5.js";import"./chunk-CI2BDMX2.js";import{b as ue}from"./chunk-DSUCHYD7.js";import{j as oe,k as re,l as se}from"./chunk-MZ3YWFFB.js";import{a as he,b as ge,d as xe}from"./chunk-SIFYI3HU.js";import{a as fe}from"./chunk-GJZ7P5CR.js";import"./chunk-RENDTMDT.js";import"./chunk-DN6IX7CO.js";import"./chunk-ZQSUYMH2.js";import{b as le,i as ce,j as pe,n as de,o as me}from"./chunk-DC5AFSD6.js";import{$a as Z,Fa as j,Ga as N,Ja as U,La as z,Na as q,Oa as Q,Wa as Y,Ya as J,bb as te,gb as ie,jb as ae,rb as ne}from"./chunk-2QKJQDG4.js";import"./chunk-LEEF5WZZ.js";import"./chunk-7FANVIZX.js";import"./chunk-K4EGDHPT.js";import"./chunk-RYULE37H.js";import{Db as y,Hb as g,Jb as p,Oa as c,T as B,Tb as E,Wa as v,X as T,Yb as l,Zb as H,_a as $,_b as P,ba as u,bc as D,ca as h,cc as M,d as K,dc as R,nb as f,o as A,ob as _,qb as V,rb as w,sb as S,tb as x,ub as r,vb as s,wb as L}from"./chunk-R6ABX6RX.js";import"./chunk-MWETYHR7.js";import"./chunk-WARJYBQ7.js";import{g as b}from"./chunk-BZGM3F3K.js";var X=class{gpx;constructor(){this.init()}init(){this.gpx=new Ie,this.gpx.metadata.name="Signal K Resource Export",this.gpx.metadata.desc="Freeboard export of Signal K resources"}toXML(){return this.gpx.toXML()}setRoutes(i,e){if(e)e.forEach(t=>{i[t]&&this.gpx.rte.push(this.packageRoute(t,i[t]))});else for(let t in i)this.gpx.rte.push(this.packageRoute(t,i[t]))}packageRoute(i,e){let t=new Ke;t.extensions=t.extensions??{},t.extensions.signalk={},t.extensions.signalk.uuid=i,e.distance&&(t.extensions.signalk.distance=e.distance),t.name=e.name||null,t.desc=e.description||null,t.cmt=e.feature.properties.cmt||null,t.src=e.feature.properties.src||null,t.number=e.feature.properties.number||null,t.type=e.feature.properties.type||null;for(let a of e.feature.geometry.coordinates){let n=new O;n.lon=a[0],n.lat=a[1],n.ele=a[2]||null,t.rtept.push(n),this.gpx.updateBounds(n)}return t}setWaypoints(i,e){if(e)e.forEach(t=>{i[t]&&this.gpx.wpt.push(this.packageWaypoint(t,i[t]))});else for(let t in i)this.gpx.wpt.push(this.packageWaypoint(t,i[t]))}packageWaypoint(i,e){let t=new O;if(t.extensions=t.extensions||{},t.extensions.signalk={},t.extensions.signalk.uuid=i,t.name=e.name||"",t.desc=e.description||"",t.cmt=e.feature.properties.cmt||null,t.geoidHeight=e.feature.properties.geoidHeight||null,t.src=e.feature.properties.src||null,t.sym=e.feature.properties.sym||null,t.type=e.feature.properties.type||null,e.type==="waypoint"){let a=Se(e.feature.properties.skIcon);a?.gpxType&&(t.type=a.gpxType),a?.gpxSym&&(t.sym=a.gpxSym)}return t.fix=e.feature.properties.fix||null,t.sat=e.feature.properties.sat||null,t.hdop=e.feature.properties.hdop||null,t.vdop=e.feature.properties.vdop||null,t.pdop=e.feature.properties.pdop||null,t.ageOfGpsData=e.feature.properties.ageOfGpsData||null,t.dgpsid=e.feature.properties.dgpsid||null,t.lat=e.feature.geometry.coordinates[1],t.lon=e.feature.geometry.coordinates[0],t.ele=e.feature.geometry.coordinates[2]||null,this.gpx.updateBounds(t),t}setTracks(i,e){if(e)e.forEach(t=>{i[t]&&this.gpx.trk.push(this.packageTrack(t,i[t]))});else for(let t in i)this.gpx.trk.push(this.packageTrack(t,i[t]))}packageTrack(i,e){let t=new Ae;t.extensions=t.extensions||{},t.extensions.signalk={},t.extensions.signalk.uuid=i,t.name=e.feature.properties.name||null,t.desc=e.feature.properties.description||null,t.cmt=e.feature.properties.cmt||null,t.src=e.feature.properties.src||null,t.number=e.feature.properties.number||null,t.type=e.feature.properties.type||null;let a=e.feature.properties.coordTimes;return e.feature.geometry.coordinates.forEach((n,m)=>{let d=new Be;n.forEach((k,He)=>{let C=new O;C.lon=k[0],C.lat=k[1],C.ele=k[2]||null;let I=a?.[m]?.[He];I&&(C.datetime=new Date(I)),d.trkpt.push(C),this.gpx.updateBounds(C)}),t.trkseg.push(d)}),t}};var F=class o{resultSource;result$;sk2gpx=null;hasFSA;signalk=T(G);constructor(){this.resultSource=new K,this.result$=this.resultSource.asObservable(),this.hasFSA="showOpenFilePicker"in window}clear(){this.sk2gpx=null}prepData(i){let e={routes:[],waypoints:[],tracks:[]},t=1;return e.routes=i.routes.map(a=>{let n=a[1];return n.feature.id=a[0],n}),t=1,e.waypoints=i.waypoints.map(a=>{let n=a[1];return n.feature.id=a[0],n.name=n.name??`Wpt: ${t}`,t++,n}),e.tracks=i.tracks,e}saveToFile(i,e){let t=new X;this.sk2gpx=t;let a={},n={},m={};for(let d=0;d<e.rte.selected.length;d++)e.rte.selected[d]&&(a[i.routes[d].feature.id]=i.routes[d]);t.setRoutes(a);for(let d=0;d<e.wpt.selected.length;d++)e.wpt.selected[d]&&(n[i.waypoints[d].feature.id]=i.waypoints[d]);t.setWaypoints(n),(e.trk.tracks??[]).forEach(d=>{let k=this.signalk.uuid;m[k]=We(k,d)}),t.setTracks(m),this.hasFSA?this.fsaSaveFile():this.legacySaveToFile()}gpxXml(){if(!this.sk2gpx)throw new Error("No GPX export to save");return this.sk2gpx.toXML()}legacySaveToFile(){let i=new Blob([this.gpxXml()],{type:"text/xml"}),e=document.createElement("a");e.href=URL.createObjectURL(i),e.download="fb_export.gpx",e.click(),URL.revokeObjectURL(e.href),e.remove(),this.resultSource.next(-1)}fsaSaveFile(){window.showSaveFilePicker({types:[{description:"GPX file",accept:{"text/xml":[".gpx"]}}]}).then(i=>{i.createWritable().then(e=>{let t=new Blob([this.gpxXml()]);e.write(t).then(()=>{e.close(),this.resultSource.next(0)})}).catch(e=>{console.warn(e),this.resultSource.next(1)})}).catch(i=>{i?.name==="SecurityError"?this.legacySaveToFile():this.resultSource.next(-1)})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=B({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ue=(o,i)=>i.context;function ze(o,i){o&1&&L(0,"mat-progress-bar",10)}function qe(o,i){if(o&1){let e=y();r(0,"div",19)(1,"div",20),l(2),s(),r(3,"div",21)(4,"mat-checkbox",22,0),g("change",function(){let a=u(e).$index,n=E(5),m=p(2);return h(m.checkWpt(n.checked,a))}),s()()()}if(o&2){let e=i.$implicit,t=i.$index,a=p(2);c(2),H(e.name),c(2),x("checked",a.selWaypoints[t])}}function Qe(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),g("opened",function(){u(e);let a=p();return h(a.display.expand.waypoints=!0)})("closed",function(){u(e);let a=p();return h(a.display.expand.waypoints=!1)}),r(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-icon",15),l(5,"place"),s(),l(6," \xA0"),r(7,"b"),l(8,"Waypoints:"),s()(),r(9,"mat-panel-description")(10,"div",16)(11,"mat-checkbox",17),g("change",function(a){u(e);let n=p();return h(n.checkWpt(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),w(13,qe,6,2,"div",19,V),s()()()}if(o&2){let e=p();c(),x("expanded",e.display.expand.waypoints),c(10),x("indeterminate",e.display.someWptChecked)("checked",e.display.allWaypointsChecked)("disabled",e.resData.waypoints.length===0),c(2),S(e.resData.waypoints)}}function Ye(o,i){if(o&1){let e=y();r(0,"div",19)(1,"div",20)(2,"mat-icon",23),l(3,"directions"),s(),l(4),s(),r(5,"div",21)(6,"mat-checkbox",25,1),g("change",function(){let a=u(e).$index,n=E(7),m=p(2);return h(m.checkRte(n.checked,a))}),s()()()}if(o&2){let e=i.$implicit,t=i.$index,a=p(2);c(4),P(" ",e.name," "),c(2),x("checked",a.selRoutes[t])}}function Je(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),g("opened",function(){u(e);let a=p();return h(a.display.expand.routes=!0)})("closed",function(){u(e);let a=p();return h(a.display.expand.routes=!1)}),r(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-icon",23),l(5,"directions"),s(),l(6," \xA0"),r(7,"b"),l(8,"Routes:"),s()(),r(9,"mat-panel-description")(10,"div",16)(11,"mat-checkbox",24),g("change",function(a){u(e);let n=p();return h(n.checkRte(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),w(13,Ye,8,2,"div",19,V),s()()()}if(o&2){let e=p();c(),x("expanded",e.display.expand.routes),c(10),x("indeterminate",e.display.someRteChecked)("checked",e.display.allRoutesChecked)("disabled",e.resData.routes.length==0),c(2),S(e.resData.routes)}}function Ze(o,i){o&1&&(r(0,"div",30),l(1," Only the positions gathered while Freeboard was open: the server has no recorded track for this vessel. "),s())}function et(o,i){if(o&1){let e=y();r(0,"div",19)(1,"div",20)(2,"mat-icon",26),l(3,"directions_boat"),s(),l(4),s(),r(5,"div",21)(6,"mat-checkbox",29,2),g("change",function(){let a=u(e).$index,n=E(7),m=p(2);return h(m.checkTrk(n.checked,a))}),s()()(),f(8,Ze,2,0,"div",30)}if(o&2){let e=i.$implicit,t=i.$index,a=p(2);c(4),P(" ",e.label," "),c(2),x("checked",a.selTracks[t]),c(2),_(e.tailOnly&&a.trackChoice==="displayed"?8:-1)}}function tt(o,i){o&1&&(r(0,"mat-option",37),l(1,"Track history range"),s())}function it(o,i){o&1&&(r(0,"div",30),l(1,"Choose a From time before the To time."),s())}function at(o,i){if(o&1){let e=y();r(0,"div",39)(1,"mat-form-field")(2,"mat-label"),l(3,"From"),s(),r(4,"input",40),R("ngModelChange",function(a){u(e);let n=p(3);return M(n.customFrom,a)||(n.customFrom=a),h(a)}),s()(),r(5,"mat-form-field")(6,"mat-label"),l(7,"To"),s(),r(8,"input",40),R("ngModelChange",function(a){u(e);let n=p(3);return M(n.customTo,a)||(n.customTo=a),h(a)}),s()()(),f(9,it,2,0,"div",30)}if(o&2){let e=p(3);c(4),D("ngModel",e.customFrom),c(4),D("ngModel",e.customTo),c(),_(e.customInvalid?9:-1)}}function nt(o,i){o&1&&(r(0,"div",30),l(1," Fetched from the server when you save, in the most detail it provides. "),s())}function ot(o,i){if(o&1){let e=y();r(0,"div",28)(1,"mat-form-field",31)(2,"mat-label"),l(3,"Track to export"),s(),r(4,"mat-select",32),R("ngModelChange",function(a){u(e);let n=p(2);return M(n.trackChoice,a)||(n.trackChoice=a),h(a)}),r(5,"mat-option",33),l(6,"As displayed"),s(),r(7,"mat-option",34),l(8,"Last 7 days"),s(),r(9,"mat-option",35),l(10,"Last 30 days"),s(),r(11,"mat-option",36),l(12,"All recorded"),s(),f(13,tt,2,0,"mat-option",37),r(14,"mat-option",38),l(15,"Custom range"),s()()(),f(16,at,10,3)(17,nt,2,0,"div",30),s()}if(o&2){let e=p(2);c(4),D("ngModel",e.trackChoice),c(9),_(e.historyRange?13:-1),c(3),_(e.trackChoice==="custom"?16:e.trackChoice!=="displayed"?17:-1)}}function rt(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),g("opened",function(){u(e);let a=p();return h(a.display.expand.tracks=!0)})("closed",function(){u(e);let a=p();return h(a.display.expand.tracks=!1)}),r(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-icon",26),l(5,"show_chart"),s(),l(6," \xA0"),r(7,"b"),l(8,"Tracks:"),s()(),r(9,"mat-panel-description")(10,"div",16)(11,"mat-checkbox",27),g("change",function(a){u(e);let n=p();return h(n.checkTrk(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),w(13,et,9,3,null,null,Ue),s(),f(15,ot,18,3,"div",28),s()()}if(o&2){let e=p();c(),x("expanded",e.display.expand.tracks),c(10),x("indeterminate",e.display.someTrkChecked)("checked",e.display.allTracksChecked)("disabled",e.resData.tracks.length==0),c(2),S(e.resData.tracks),c(2),_(e.rangeAvailable?15:-1)}}var st=36e5;function $e(o){let i=new Date(o),e=t=>String(t).padStart(2,"0");return`${i.getFullYear()}-${e(i.getMonth()+1)}-${e(i.getDate())}T${e(i.getHours())}:${e(i.getMinutes())}`}function W(o){let i=o?new Date(o).getTime():NaN;return Number.isFinite(i)?i:null}var Le=class o{constructor(i,e,t,a,n){this.app=i;this.skres=e;this.facade=t;this.dialogRef=a;this.data=n}app;skres;facade;dialogRef;data;resData={routes:[],waypoints:[],tracks:[]};trackChoice="displayed";customFrom="";customTo="";fetching=!1;closed=!1;signalk=T(G);trackHistory=T(Me);selRoutes=[];selWaypoints=[];selTracks=[];display={notValid:!1,allRoutesChecked:!1,allWaypointsChecked:!1,allTracksChecked:!1,someWptChecked:!1,someRteChecked:!1,someTrkChecked:!1,saveRoutesOK:!1,saveWaypointsOK:!1,saveTracksOK:!1,routeViewer:!1,selCount:{routes:0,waypoints:0,tracks:0},expand:{routes:!1,waypoints:!1,tracks:!1}};unsubscribe=[];ngOnInit(){let i=Date.now();this.customFrom=$e(i-24*st),this.customTo=$e(i),this.loadResources(),this.data.initialChoice&&this.rangeAvailable&&(this.data.initialChoice!=="history"||this.historyRange)&&(this.trackChoice=this.data.initialChoice),this.unsubscribe.push(this.facade.result$.subscribe(e=>{this.dialogRef.close(e)}))}ngOnDestroy(){this.closed=!0,this.unsubscribe.forEach(i=>i.unsubscribe()),this.facade.clear()}loadResources(){return b(this,null,function*(){if(this.data.tracksOnly){this.data.waypoints=[],this.parseResourceData();return}this.data.routes.sort((i,e)=>i[1].name.localeCompare(e[1].name));try{this.app.sIsFetching.set(!0);let i=yield this.skres.listFromServer("waypoints");i.sort((e,t)=>e[1].name.localeCompare(t[1].name)),this.data.waypoints=i,this.app.sIsFetching.set(!1)}catch(i){this.app.sIsFetching.set(!1),this.resData.waypoints=[]}this.parseResourceData()})}get rangeAvailable(){return!!this.app.featureFlags().tracksApi}get historyRange(){return this.resData.tracks.some(i=>this.trackHistory.isShown(i.context))?this.trackHistory.range():void 0}chosenRange(){return Re(this.trackChoice,Date.now(),{history:this.historyRange,custom:{from:W(this.customFrom),to:W(this.customTo)}})}get customInvalid(){return this.trackChoice==="custom"&&!Ge({from:W(this.customFrom),to:W(this.customTo)})}get rangeUnusable(){return this.rangeAvailable&&this.trackChoice!=="displayed"&&this.chosenRange()===null}get canSave(){return!this.fetching&&!(this.display.saveTracksOK&&this.rangeUnusable)&&(this.display.saveRoutesOK||this.display.saveWaypointsOK||this.display.saveTracksOK)}save(){return b(this,null,function*(){let i;try{i=yield this.selectedTracks()}catch(e){if(this.closed)return;this.app.showAlert("GPX Save","Unable to fetch the recorded track from the server.");return}i===null||this.closed||this.facade.saveToFile(this.resData,{rte:{selected:this.selRoutes},wpt:{selected:this.selWaypoints},trk:{tracks:i}})})}selectedTracks(){return b(this,null,function*(){let i=this.resData.tracks.filter((n,m)=>this.selTracks[m]);if(i.length===0)return[];let e=this.rangeAvailable?this.chosenRange():null,t=Date.now(),a=[];this.fetching=!0;try{for(let n of i){let m=e===null?n.displayed:yield this.fetchTrack(n.context,e),d=Fe(n.label,m,t);if(!d)return this.app.showAlert("GPX Save",e===null?`There is no track to save for ${n.label}.`:`No track is recorded for ${n.label} in the selected range.`),null;a.push(d)}}finally{this.fetching=!1}return a})}fetchTrack(i,e){return b(this,null,function*(){let t=this.app.trackSource()?.provider,a=this.signalk.api.get(2,`/tracks?${Oe(i,e,t)}`);if(!a)throw new Error("Not connected");let n=yield A(a),m=ee(i,n,t);return{lines:m?.lines??[],times:m?.times??(m?.lines??[]).map(d=>d.map(()=>{}))}})}parseResourceData(){this.display.allRoutesChecked=!1,this.display.saveRoutesOK=!1,this.selRoutes=[],this.display.allWaypointsChecked=!1,this.display.saveWaypointsOK=!1,this.selWaypoints=[],this.display.allTracksChecked=!1,this.display.saveTracksOK=!1,this.selTracks=[],this.display.selCount={routes:0,waypoints:0,tracks:0},this.display.expand={routes:!1,waypoints:!1,tracks:!1},this.display.notValid=!1,this.resData=this.facade.prepData(this.data),this.resData.tracks=this.resData.tracks.filter(i=>this.rangeAvailable||Xe(i.displayed?.lines)),this.resData.routes.forEach(()=>{this.selRoutes.push(!1)}),this.selRoutes.length===1&&(this.selRoutes[0]=!0,this.display.allRoutesChecked=!0,this.display.expand.routes=!0,this.display.saveRoutesOK=!0),this.resData.waypoints.forEach(()=>{this.selWaypoints.push(!1)}),this.resData.tracks.forEach(()=>{this.selTracks.push(!1)}),this.data.tracksOnly&&this.selTracks.length!==0&&(this.checkTrk(!0,-1),this.display.expand.tracks=!0)}checkRte(i,e=-1){let t=0;if(e!==-1){this.selRoutes[e]=i,this.display.saveRoutesOK=i;for(let a of this.selRoutes)a&&t++;this.display.saveRoutesOK=t!==0,this.display.selCount.routes=t,this.display.allRoutesChecked=t===this.selRoutes.length}else{for(let a=0;a<this.selRoutes.length;a++)this.selRoutes[a]=i,this.display.saveRoutesOK=i,this.display.allRoutesChecked=i;this.display.selCount.routes=i?this.selRoutes.length:0}this.display.someRteChecked=!(this.display.allRoutesChecked||t===0)}checkWpt(i,e=-1){let t=0;if(e!==-1){this.selWaypoints[e]=i,this.display.saveWaypointsOK=i;for(let a of this.selWaypoints)a&&t++;this.display.saveWaypointsOK=t!==0,this.display.selCount.waypoints=t,this.display.allWaypointsChecked=t===this.selWaypoints.length}else{for(let a=0;a<this.selWaypoints.length;a++)this.selWaypoints[a]=i,this.display.saveWaypointsOK=i,this.display.allWaypointsChecked=i;this.display.selCount.waypoints=i?this.selWaypoints.length:0}this.display.someWptChecked=!(this.display.allWaypointsChecked||t===0)}checkTrk(i,e=-1){let t=0;if(e!==-1){this.selTracks[e]=i,this.display.saveTracksOK=i;for(let a of this.selTracks)a&&t++;this.display.saveTracksOK=t!==0,this.display.selCount.tracks=t,this.display.allTracksChecked=t===this.selTracks.length}else{for(let a=0;a<this.selTracks.length;a++)this.selTracks[a]=i,this.display.saveTracksOK=i,this.display.allTracksChecked=i;this.display.selCount.tracks=i?this.selTracks.length:0}this.display.someTrkChecked=!(this.display.allTracksChecked||t===0)}static \u0275fac=function(e){return new(e||o)(v(Ve),v(Ee),v(F),v(j),v(N))};static \u0275cmp=$({type:o,selectors:[["gpxsave-dialog"]],decls:19,vars:6,consts:[["wval",""],["rval",""],["tval",""],[1,"gpxsave-dialog"],[2,"background-color","transparent"],[2,"display","flex","width","100%"],["mat-raised-button","","matTooltip","Save selected resources","matTooltipPosition","right",2,"width","85px",3,"click","disabled"],[2,"flex","1 1 auto","text-align","center"],[2,"text-align","right"],["mat-icon-button","",3,"click"],["mode","indeterminate"],["mat-dialog-content","",2,"padding","2px"],[1,"card-group"],[3,"opened","closed","expanded"],[1,"panel-header"],[1,"icon-waypoint"],[1,"panel-description"],["matTooltip","Select all Waypoints","matTooltipPosition","before",3,"change","click","indeterminate","checked","disabled"],[1,"list-container-scrollable"],[1,"item-row"],[1,"name"],[1,"check"],["matTooltip","Select Waypoint","matTooltipPosition","below",3,"change","checked"],[1,"icon-route"],["matTooltip","Select all Routes","matTooltipPosition","before",3,"change","click","indeterminate","checked","disabled"],["matTooltip","Select this Route","matTooltipPosition","below",3,"change","checked"],[1,"icon-track"],["matTooltip","Select all Tracks","matTooltipPosition","before",3,"change","click","indeterminate","checked","disabled"],[1,"track-range"],["matTooltip","Select this Track","matTooltipPosition","below",3,"change","checked"],[1,"track-note"],[1,"track-range-select"],[3,"ngModelChange","ngModel"],["value","displayed"],["value","7d"],["value","30d"],["value","all"],["value","history"],["value","custom"],[1,"track-range-custom"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"]],template:function(e,t){e&1&&(r(0,"div",3)(1,"mat-toolbar",4)(2,"div",5)(3,"div")(4,"button",6),g("click",function(){return t.save()}),r(5,"mat-icon"),l(6,"save"),s(),l(7,"\xA0Save\xA0 "),s()(),r(8,"div",7),l(9),s(),r(10,"div",8)(11,"button",9),g("click",function(){return t.dialogRef.close(-1)}),r(12,"mat-icon"),l(13,"close"),s()()()()(),f(14,ze,1,0,"mat-progress-bar",10),r(15,"div",11),f(16,Qe,15,4,"div",12),f(17,Je,15,4,"div",12),f(18,rt,16,5,"div",12),s()()),e&2&&(c(4),x("disabled",!t.canSave),c(5),P(" ",t.data.tracksOnly?"Export track to GPX":"Export to GPX"," "),c(5),_(t.fetching?14:-1),c(2),_(t.resData.waypoints.length!==0?16:-1),c(),_(t.resData.routes.length!==0?17:-1),c(),_(t.resData.tracks.length!==0?18:-1))},dependencies:[Te,be,De,Pe,z,U,Q,q,Z,J,Y,oe,pe,ce,le,me,de,ue,ve,_e,ye,Ce,ke,se,re,we,fe,xe,ge,he,ne,te,ie,ae],styles:[".gpxsave-dialog[_ngcontent-%COMP%]{font-family:roboto;position:relative}.dialog-content[_ngcontent-%COMP%]{position:relative;min-height:300px;max-height:400px;width:100%;min-width:240px;overflow-y:auto}.dialog-icon[_ngcontent-%COMP%]{display:none}.card-group[_ngcontent-%COMP%]{padding:5px 5%}.card-group[_ngcontent-%COMP%] .panel-header[_ngcontent-%COMP%]{padding:0 5px}.card-group[_ngcontent-%COMP%] .panel-description[_ngcontent-%COMP%]{text-align:right;width:100%;padding-right:10px}.card-group-title[_ngcontent-%COMP%]{font-weight:700;font-size:10pt;font-family:Arial,Helvetica,sans-serif;padding:10px 0}button[_ngcontent-%COMP%]{min-width:unset;padding:unset}.item-row[_ngcontent-%COMP%]{display:flex;width:100%;padding:2px 0}.item-row[_ngcontent-%COMP%] .name[_ngcontent-%COMP%]{flex:1 1 auto;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;text-overflow:ellipsis;line-height:2.5em}.item-row[_ngcontent-%COMP%] .check[_ngcontent-%COMP%]{text-align:right;padding-right:15px}.track-note[_ngcontent-%COMP%]{font-size:.85em;opacity:.8;padding:0 15px 4px 30px}.track-range[_ngcontent-%COMP%]{padding:8px 5px 0}.track-range-select[_ngcontent-%COMP%]{width:100%}.track-range-custom[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:0 8px}.track-range-custom[_ngcontent-%COMP%] mat-form-field[_ngcontent-%COMP%]{flex:1 1 220px}@media only screen and (min-width:475px){button[_ngcontent-%COMP%]{min-width:inherit;padding:inherit}.dialog-content[_ngcontent-%COMP%]{min-width:400px}.dialog-icon[_ngcontent-%COMP%]{display:inline}}@media only screen and (min-width:800px){.card-group[_ngcontent-%COMP%]{padding:5px 5%}}"]})};export{Le as GPXExportDialog,W as fromLocalInput,$e as toLocalInput};
|
|
1
|
+
import{a as Ie,b as O,c as Ke,d as Ae,e as Be}from"./chunk-7PF3OZ2P.js";import{Ha as Pe,Ia as De,Ja as Me,bc as Ve,g as ee,l as _e,m as ye,n as ke,o as Ce,p as ve,pb as Re,qb as Ge,rb as Oe,sb as Xe,tb as Fe,u as Se,ub as We,v as G,xa as Ee}from"./chunk-6JTVABJT.js";import{a as be,b as Te,c as we}from"./chunk-YBVURHD5.js";import"./chunk-CI2BDMX2.js";import{b as ue}from"./chunk-DSUCHYD7.js";import{j as oe,k as re,l as se}from"./chunk-MZ3YWFFB.js";import{a as he,b as ge,d as xe}from"./chunk-SIFYI3HU.js";import{a as fe}from"./chunk-GJZ7P5CR.js";import"./chunk-RENDTMDT.js";import"./chunk-DN6IX7CO.js";import"./chunk-ZQSUYMH2.js";import{b as le,i as ce,j as pe,n as de,o as me}from"./chunk-DC5AFSD6.js";import{$a as Z,Fa as j,Ga as N,Ja as U,La as z,Na as q,Oa as Q,Wa as Y,Ya as J,bb as te,gb as ie,jb as ae,rb as ne}from"./chunk-2QKJQDG4.js";import"./chunk-LEEF5WZZ.js";import"./chunk-7FANVIZX.js";import"./chunk-K4EGDHPT.js";import"./chunk-RYULE37H.js";import{Db as y,Hb as g,Jb as p,Oa as c,T as B,Tb as E,Wa as v,X as T,Yb as l,Zb as H,_a as $,_b as P,ba as u,bc as D,ca as h,cc as M,d as K,dc as R,nb as f,o as A,ob as _,qb as V,rb as w,sb as S,tb as x,ub as r,vb as s,wb as L}from"./chunk-R6ABX6RX.js";import"./chunk-MWETYHR7.js";import"./chunk-WARJYBQ7.js";import{g as b}from"./chunk-BZGM3F3K.js";var X=class{gpx;constructor(){this.init()}init(){this.gpx=new Ie,this.gpx.metadata.name="Signal K Resource Export",this.gpx.metadata.desc="Freeboard export of Signal K resources"}toXML(){return this.gpx.toXML()}setRoutes(i,e){if(e)e.forEach(t=>{i[t]&&this.gpx.rte.push(this.packageRoute(t,i[t]))});else for(let t in i)this.gpx.rte.push(this.packageRoute(t,i[t]))}packageRoute(i,e){let t=new Ke;t.extensions=t.extensions??{},t.extensions.signalk={},t.extensions.signalk.uuid=i,e.distance&&(t.extensions.signalk.distance=e.distance),t.name=e.name||null,t.desc=e.description||null,t.cmt=e.feature.properties.cmt||null,t.src=e.feature.properties.src||null,t.number=e.feature.properties.number||null,t.type=e.feature.properties.type||null;for(let a of e.feature.geometry.coordinates){let n=new O;n.lon=a[0],n.lat=a[1],n.ele=a[2]||null,t.rtept.push(n),this.gpx.updateBounds(n)}return t}setWaypoints(i,e){if(e)e.forEach(t=>{i[t]&&this.gpx.wpt.push(this.packageWaypoint(t,i[t]))});else for(let t in i)this.gpx.wpt.push(this.packageWaypoint(t,i[t]))}packageWaypoint(i,e){let t=new O;if(t.extensions=t.extensions||{},t.extensions.signalk={},t.extensions.signalk.uuid=i,t.name=e.name||"",t.desc=e.description||"",t.cmt=e.feature.properties.cmt||null,t.geoidHeight=e.feature.properties.geoidHeight||null,t.src=e.feature.properties.src||null,t.sym=e.feature.properties.sym||null,t.type=e.feature.properties.type||null,e.type==="waypoint"){let a=Se(e.feature.properties.skIcon);a?.gpxType&&(t.type=a.gpxType),a?.gpxSym&&(t.sym=a.gpxSym)}return t.fix=e.feature.properties.fix||null,t.sat=e.feature.properties.sat||null,t.hdop=e.feature.properties.hdop||null,t.vdop=e.feature.properties.vdop||null,t.pdop=e.feature.properties.pdop||null,t.ageOfGpsData=e.feature.properties.ageOfGpsData||null,t.dgpsid=e.feature.properties.dgpsid||null,t.lat=e.feature.geometry.coordinates[1],t.lon=e.feature.geometry.coordinates[0],t.ele=e.feature.geometry.coordinates[2]||null,this.gpx.updateBounds(t),t}setTracks(i,e){if(e)e.forEach(t=>{i[t]&&this.gpx.trk.push(this.packageTrack(t,i[t]))});else for(let t in i)this.gpx.trk.push(this.packageTrack(t,i[t]))}packageTrack(i,e){let t=new Ae;t.extensions=t.extensions||{},t.extensions.signalk={},t.extensions.signalk.uuid=i,t.name=e.feature.properties.name||null,t.desc=e.feature.properties.description||null,t.cmt=e.feature.properties.cmt||null,t.src=e.feature.properties.src||null,t.number=e.feature.properties.number||null,t.type=e.feature.properties.type||null;let a=e.feature.properties.coordTimes;return e.feature.geometry.coordinates.forEach((n,m)=>{let d=new Be;n.forEach((k,He)=>{let C=new O;C.lon=k[0],C.lat=k[1],C.ele=k[2]||null;let I=a?.[m]?.[He];I&&(C.datetime=new Date(I)),d.trkpt.push(C),this.gpx.updateBounds(C)}),t.trkseg.push(d)}),t}};var F=class o{resultSource;result$;sk2gpx=null;hasFSA;signalk=T(G);constructor(){this.resultSource=new K,this.result$=this.resultSource.asObservable(),this.hasFSA="showOpenFilePicker"in window}clear(){this.sk2gpx=null}prepData(i){let e={routes:[],waypoints:[],tracks:[]},t=1;return e.routes=i.routes.map(a=>{let n=a[1];return n.feature.id=a[0],n}),t=1,e.waypoints=i.waypoints.map(a=>{let n=a[1];return n.feature.id=a[0],n.name=n.name??`Wpt: ${t}`,t++,n}),e.tracks=i.tracks,e}saveToFile(i,e){let t=new X;this.sk2gpx=t;let a={},n={},m={};for(let d=0;d<e.rte.selected.length;d++)e.rte.selected[d]&&(a[i.routes[d].feature.id]=i.routes[d]);t.setRoutes(a);for(let d=0;d<e.wpt.selected.length;d++)e.wpt.selected[d]&&(n[i.waypoints[d].feature.id]=i.waypoints[d]);t.setWaypoints(n),(e.trk.tracks??[]).forEach(d=>{let k=this.signalk.uuid;m[k]=We(k,d)}),t.setTracks(m),this.hasFSA?this.fsaSaveFile():this.legacySaveToFile()}gpxXml(){if(!this.sk2gpx)throw new Error("No GPX export to save");return this.sk2gpx.toXML()}legacySaveToFile(){let i=new Blob([this.gpxXml()],{type:"text/xml"}),e=document.createElement("a");e.href=URL.createObjectURL(i),e.download="fb_export.gpx",e.click(),URL.revokeObjectURL(e.href),e.remove(),this.resultSource.next(-1)}fsaSaveFile(){window.showSaveFilePicker({types:[{description:"GPX file",accept:{"text/xml":[".gpx"]}}]}).then(i=>{i.createWritable().then(e=>{let t=new Blob([this.gpxXml()]);e.write(t).then(()=>{e.close(),this.resultSource.next(0)})}).catch(e=>{console.warn(e),this.resultSource.next(1)})}).catch(i=>{i?.name==="SecurityError"?this.legacySaveToFile():this.resultSource.next(-1)})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=B({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ue=(o,i)=>i.context;function ze(o,i){o&1&&L(0,"mat-progress-bar",10)}function qe(o,i){if(o&1){let e=y();r(0,"div",19)(1,"div",20),l(2),s(),r(3,"div",21)(4,"mat-checkbox",22,0),g("change",function(){let a=u(e).$index,n=E(5),m=p(2);return h(m.checkWpt(n.checked,a))}),s()()()}if(o&2){let e=i.$implicit,t=i.$index,a=p(2);c(2),H(e.name),c(2),x("checked",a.selWaypoints[t])}}function Qe(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),g("opened",function(){u(e);let a=p();return h(a.display.expand.waypoints=!0)})("closed",function(){u(e);let a=p();return h(a.display.expand.waypoints=!1)}),r(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-icon",15),l(5,"place"),s(),l(6," \xA0"),r(7,"b"),l(8,"Waypoints:"),s()(),r(9,"mat-panel-description")(10,"div",16)(11,"mat-checkbox",17),g("change",function(a){u(e);let n=p();return h(n.checkWpt(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),w(13,qe,6,2,"div",19,V),s()()()}if(o&2){let e=p();c(),x("expanded",e.display.expand.waypoints),c(10),x("indeterminate",e.display.someWptChecked)("checked",e.display.allWaypointsChecked)("disabled",e.resData.waypoints.length===0),c(2),S(e.resData.waypoints)}}function Ye(o,i){if(o&1){let e=y();r(0,"div",19)(1,"div",20)(2,"mat-icon",23),l(3,"directions"),s(),l(4),s(),r(5,"div",21)(6,"mat-checkbox",25,1),g("change",function(){let a=u(e).$index,n=E(7),m=p(2);return h(m.checkRte(n.checked,a))}),s()()()}if(o&2){let e=i.$implicit,t=i.$index,a=p(2);c(4),P(" ",e.name," "),c(2),x("checked",a.selRoutes[t])}}function Je(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),g("opened",function(){u(e);let a=p();return h(a.display.expand.routes=!0)})("closed",function(){u(e);let a=p();return h(a.display.expand.routes=!1)}),r(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-icon",23),l(5,"directions"),s(),l(6," \xA0"),r(7,"b"),l(8,"Routes:"),s()(),r(9,"mat-panel-description")(10,"div",16)(11,"mat-checkbox",24),g("change",function(a){u(e);let n=p();return h(n.checkRte(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),w(13,Ye,8,2,"div",19,V),s()()()}if(o&2){let e=p();c(),x("expanded",e.display.expand.routes),c(10),x("indeterminate",e.display.someRteChecked)("checked",e.display.allRoutesChecked)("disabled",e.resData.routes.length==0),c(2),S(e.resData.routes)}}function Ze(o,i){o&1&&(r(0,"div",30),l(1," Only the positions gathered while Freeboard was open: the server has no recorded track for this vessel. "),s())}function et(o,i){if(o&1){let e=y();r(0,"div",19)(1,"div",20)(2,"mat-icon",26),l(3,"directions_boat"),s(),l(4),s(),r(5,"div",21)(6,"mat-checkbox",29,2),g("change",function(){let a=u(e).$index,n=E(7),m=p(2);return h(m.checkTrk(n.checked,a))}),s()()(),f(8,Ze,2,0,"div",30)}if(o&2){let e=i.$implicit,t=i.$index,a=p(2);c(4),P(" ",e.label," "),c(2),x("checked",a.selTracks[t]),c(2),_(e.tailOnly&&a.trackChoice==="displayed"?8:-1)}}function tt(o,i){o&1&&(r(0,"mat-option",37),l(1,"Track history range"),s())}function it(o,i){o&1&&(r(0,"div",30),l(1,"Choose a From time before the To time."),s())}function at(o,i){if(o&1){let e=y();r(0,"div",39)(1,"mat-form-field")(2,"mat-label"),l(3,"From"),s(),r(4,"input",40),R("ngModelChange",function(a){u(e);let n=p(3);return M(n.customFrom,a)||(n.customFrom=a),h(a)}),s()(),r(5,"mat-form-field")(6,"mat-label"),l(7,"To"),s(),r(8,"input",40),R("ngModelChange",function(a){u(e);let n=p(3);return M(n.customTo,a)||(n.customTo=a),h(a)}),s()()(),f(9,it,2,0,"div",30)}if(o&2){let e=p(3);c(4),D("ngModel",e.customFrom),c(4),D("ngModel",e.customTo),c(),_(e.customInvalid?9:-1)}}function nt(o,i){o&1&&(r(0,"div",30),l(1," Fetched from the server when you save, in the most detail it provides. "),s())}function ot(o,i){if(o&1){let e=y();r(0,"div",28)(1,"mat-form-field",31)(2,"mat-label"),l(3,"Track to export"),s(),r(4,"mat-select",32),R("ngModelChange",function(a){u(e);let n=p(2);return M(n.trackChoice,a)||(n.trackChoice=a),h(a)}),r(5,"mat-option",33),l(6,"As displayed"),s(),r(7,"mat-option",34),l(8,"Last 7 days"),s(),r(9,"mat-option",35),l(10,"Last 30 days"),s(),r(11,"mat-option",36),l(12,"All recorded"),s(),f(13,tt,2,0,"mat-option",37),r(14,"mat-option",38),l(15,"Custom range"),s()()(),f(16,at,10,3)(17,nt,2,0,"div",30),s()}if(o&2){let e=p(2);c(4),D("ngModel",e.trackChoice),c(9),_(e.historyRange?13:-1),c(3),_(e.trackChoice==="custom"?16:e.trackChoice!=="displayed"?17:-1)}}function rt(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),g("opened",function(){u(e);let a=p();return h(a.display.expand.tracks=!0)})("closed",function(){u(e);let a=p();return h(a.display.expand.tracks=!1)}),r(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-icon",26),l(5,"show_chart"),s(),l(6," \xA0"),r(7,"b"),l(8,"Tracks:"),s()(),r(9,"mat-panel-description")(10,"div",16)(11,"mat-checkbox",27),g("change",function(a){u(e);let n=p();return h(n.checkTrk(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),w(13,et,9,3,null,null,Ue),s(),f(15,ot,18,3,"div",28),s()()}if(o&2){let e=p();c(),x("expanded",e.display.expand.tracks),c(10),x("indeterminate",e.display.someTrkChecked)("checked",e.display.allTracksChecked)("disabled",e.resData.tracks.length==0),c(2),S(e.resData.tracks),c(2),_(e.rangeAvailable?15:-1)}}var st=36e5;function $e(o){let i=new Date(o),e=t=>String(t).padStart(2,"0");return`${i.getFullYear()}-${e(i.getMonth()+1)}-${e(i.getDate())}T${e(i.getHours())}:${e(i.getMinutes())}`}function W(o){let i=o?new Date(o).getTime():NaN;return Number.isFinite(i)?i:null}var Le=class o{constructor(i,e,t,a,n){this.app=i;this.skres=e;this.facade=t;this.dialogRef=a;this.data=n}app;skres;facade;dialogRef;data;resData={routes:[],waypoints:[],tracks:[]};trackChoice="displayed";customFrom="";customTo="";fetching=!1;closed=!1;signalk=T(G);trackHistory=T(Me);selRoutes=[];selWaypoints=[];selTracks=[];display={notValid:!1,allRoutesChecked:!1,allWaypointsChecked:!1,allTracksChecked:!1,someWptChecked:!1,someRteChecked:!1,someTrkChecked:!1,saveRoutesOK:!1,saveWaypointsOK:!1,saveTracksOK:!1,routeViewer:!1,selCount:{routes:0,waypoints:0,tracks:0},expand:{routes:!1,waypoints:!1,tracks:!1}};unsubscribe=[];ngOnInit(){let i=Date.now();this.customFrom=$e(i-24*st),this.customTo=$e(i),this.loadResources(),this.data.initialChoice&&this.rangeAvailable&&(this.data.initialChoice!=="history"||this.historyRange)&&(this.trackChoice=this.data.initialChoice),this.unsubscribe.push(this.facade.result$.subscribe(e=>{this.dialogRef.close(e)}))}ngOnDestroy(){this.closed=!0,this.unsubscribe.forEach(i=>i.unsubscribe()),this.facade.clear()}loadResources(){return b(this,null,function*(){if(this.data.tracksOnly){this.data.waypoints=[],this.parseResourceData();return}this.data.routes.sort((i,e)=>i[1].name.localeCompare(e[1].name));try{this.app.sIsFetching.set(!0);let i=yield this.skres.listFromServer("waypoints");i.sort((e,t)=>e[1].name.localeCompare(t[1].name)),this.data.waypoints=i,this.app.sIsFetching.set(!1)}catch(i){this.app.sIsFetching.set(!1),this.resData.waypoints=[]}this.parseResourceData()})}get rangeAvailable(){return!!this.app.featureFlags().tracksApi}get historyRange(){return this.resData.tracks.some(i=>this.trackHistory.isShown(i.context))?this.trackHistory.range():void 0}chosenRange(){return Re(this.trackChoice,Date.now(),{history:this.historyRange,custom:{from:W(this.customFrom),to:W(this.customTo)}})}get customInvalid(){return this.trackChoice==="custom"&&!Ge({from:W(this.customFrom),to:W(this.customTo)})}get rangeUnusable(){return this.rangeAvailable&&this.trackChoice!=="displayed"&&this.chosenRange()===null}get canSave(){return!this.fetching&&!(this.display.saveTracksOK&&this.rangeUnusable)&&(this.display.saveRoutesOK||this.display.saveWaypointsOK||this.display.saveTracksOK)}save(){return b(this,null,function*(){let i;try{i=yield this.selectedTracks()}catch(e){if(this.closed)return;this.app.showAlert("GPX Save","Unable to fetch the recorded track from the server.");return}i===null||this.closed||this.facade.saveToFile(this.resData,{rte:{selected:this.selRoutes},wpt:{selected:this.selWaypoints},trk:{tracks:i}})})}selectedTracks(){return b(this,null,function*(){let i=this.resData.tracks.filter((n,m)=>this.selTracks[m]);if(i.length===0)return[];let e=this.rangeAvailable?this.chosenRange():null,t=Date.now(),a=[];this.fetching=!0;try{for(let n of i){let m=e===null?n.displayed:yield this.fetchTrack(n.context,e),d=Fe(n.label,m,t);if(!d)return this.app.showAlert("GPX Save",e===null?`There is no track to save for ${n.label}.`:`No track is recorded for ${n.label} in the selected range.`),null;a.push(d)}}finally{this.fetching=!1}return a})}fetchTrack(i,e){return b(this,null,function*(){let t=this.app.trackSource()?.provider,a=this.signalk.api.get(2,`/tracks?${Oe(i,e,t)}`);if(!a)throw new Error("Not connected");let n=yield A(a),m=ee(i,n,t);return{lines:m?.lines??[],times:m?.times??(m?.lines??[]).map(d=>d.map(()=>{}))}})}parseResourceData(){this.display.allRoutesChecked=!1,this.display.saveRoutesOK=!1,this.selRoutes=[],this.display.allWaypointsChecked=!1,this.display.saveWaypointsOK=!1,this.selWaypoints=[],this.display.allTracksChecked=!1,this.display.saveTracksOK=!1,this.selTracks=[],this.display.selCount={routes:0,waypoints:0,tracks:0},this.display.expand={routes:!1,waypoints:!1,tracks:!1},this.display.notValid=!1,this.resData=this.facade.prepData(this.data),this.resData.tracks=this.resData.tracks.filter(i=>this.rangeAvailable||Xe(i.displayed?.lines)),this.resData.routes.forEach(()=>{this.selRoutes.push(!1)}),this.selRoutes.length===1&&(this.selRoutes[0]=!0,this.display.allRoutesChecked=!0,this.display.expand.routes=!0,this.display.saveRoutesOK=!0),this.resData.waypoints.forEach(()=>{this.selWaypoints.push(!1)}),this.resData.tracks.forEach(()=>{this.selTracks.push(!1)}),this.data.tracksOnly&&this.selTracks.length!==0&&(this.checkTrk(!0,-1),this.display.expand.tracks=!0)}checkRte(i,e=-1){let t=0;if(e!==-1){this.selRoutes[e]=i,this.display.saveRoutesOK=i;for(let a of this.selRoutes)a&&t++;this.display.saveRoutesOK=t!==0,this.display.selCount.routes=t,this.display.allRoutesChecked=t===this.selRoutes.length}else{for(let a=0;a<this.selRoutes.length;a++)this.selRoutes[a]=i,this.display.saveRoutesOK=i,this.display.allRoutesChecked=i;this.display.selCount.routes=i?this.selRoutes.length:0}this.display.someRteChecked=!(this.display.allRoutesChecked||t===0)}checkWpt(i,e=-1){let t=0;if(e!==-1){this.selWaypoints[e]=i,this.display.saveWaypointsOK=i;for(let a of this.selWaypoints)a&&t++;this.display.saveWaypointsOK=t!==0,this.display.selCount.waypoints=t,this.display.allWaypointsChecked=t===this.selWaypoints.length}else{for(let a=0;a<this.selWaypoints.length;a++)this.selWaypoints[a]=i,this.display.saveWaypointsOK=i,this.display.allWaypointsChecked=i;this.display.selCount.waypoints=i?this.selWaypoints.length:0}this.display.someWptChecked=!(this.display.allWaypointsChecked||t===0)}checkTrk(i,e=-1){let t=0;if(e!==-1){this.selTracks[e]=i,this.display.saveTracksOK=i;for(let a of this.selTracks)a&&t++;this.display.saveTracksOK=t!==0,this.display.selCount.tracks=t,this.display.allTracksChecked=t===this.selTracks.length}else{for(let a=0;a<this.selTracks.length;a++)this.selTracks[a]=i,this.display.saveTracksOK=i,this.display.allTracksChecked=i;this.display.selCount.tracks=i?this.selTracks.length:0}this.display.someTrkChecked=!(this.display.allTracksChecked||t===0)}static \u0275fac=function(e){return new(e||o)(v(Ve),v(Ee),v(F),v(j),v(N))};static \u0275cmp=$({type:o,selectors:[["gpxsave-dialog"]],decls:19,vars:6,consts:[["wval",""],["rval",""],["tval",""],[1,"gpxsave-dialog"],[2,"background-color","transparent"],[2,"display","flex","width","100%"],["mat-raised-button","","matTooltip","Save selected resources","matTooltipPosition","right",2,"width","85px",3,"click","disabled"],[2,"flex","1 1 auto","text-align","center"],[2,"text-align","right"],["mat-icon-button","",3,"click"],["mode","indeterminate"],["mat-dialog-content","",2,"padding","2px"],[1,"card-group"],[3,"opened","closed","expanded"],[1,"panel-header"],[1,"icon-waypoint"],[1,"panel-description"],["matTooltip","Select all Waypoints","matTooltipPosition","before",3,"change","click","indeterminate","checked","disabled"],[1,"list-container-scrollable"],[1,"item-row"],[1,"name"],[1,"check"],["matTooltip","Select Waypoint","matTooltipPosition","below",3,"change","checked"],[1,"icon-route"],["matTooltip","Select all Routes","matTooltipPosition","before",3,"change","click","indeterminate","checked","disabled"],["matTooltip","Select this Route","matTooltipPosition","below",3,"change","checked"],[1,"icon-track"],["matTooltip","Select all Tracks","matTooltipPosition","before",3,"change","click","indeterminate","checked","disabled"],[1,"track-range"],["matTooltip","Select this Track","matTooltipPosition","below",3,"change","checked"],[1,"track-note"],[1,"track-range-select"],[3,"ngModelChange","ngModel"],["value","displayed"],["value","7d"],["value","30d"],["value","all"],["value","history"],["value","custom"],[1,"track-range-custom"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"]],template:function(e,t){e&1&&(r(0,"div",3)(1,"mat-toolbar",4)(2,"div",5)(3,"div")(4,"button",6),g("click",function(){return t.save()}),r(5,"mat-icon"),l(6,"save"),s(),l(7,"\xA0Save\xA0 "),s()(),r(8,"div",7),l(9),s(),r(10,"div",8)(11,"button",9),g("click",function(){return t.dialogRef.close(-1)}),r(12,"mat-icon"),l(13,"close"),s()()()()(),f(14,ze,1,0,"mat-progress-bar",10),r(15,"div",11),f(16,Qe,15,4,"div",12),f(17,Je,15,4,"div",12),f(18,rt,16,5,"div",12),s()()),e&2&&(c(4),x("disabled",!t.canSave),c(5),P(" ",t.data.tracksOnly?"Export track to GPX":"Export to GPX"," "),c(5),_(t.fetching?14:-1),c(2),_(t.resData.waypoints.length!==0?16:-1),c(),_(t.resData.routes.length!==0?17:-1),c(),_(t.resData.tracks.length!==0?18:-1))},dependencies:[Te,be,De,Pe,z,U,Q,q,Z,J,Y,oe,pe,ce,le,me,de,ue,ve,_e,ye,Ce,ke,se,re,we,fe,xe,ge,he,ne,te,ie,ae],styles:[".gpxsave-dialog[_ngcontent-%COMP%]{font-family:roboto;position:relative}.dialog-content[_ngcontent-%COMP%]{position:relative;min-height:300px;max-height:400px;width:100%;min-width:240px;overflow-y:auto}.dialog-icon[_ngcontent-%COMP%]{display:none}.card-group[_ngcontent-%COMP%]{padding:5px 5%}.card-group[_ngcontent-%COMP%] .panel-header[_ngcontent-%COMP%]{padding:0 5px}.card-group[_ngcontent-%COMP%] .panel-description[_ngcontent-%COMP%]{text-align:right;width:100%;padding-right:10px}.card-group-title[_ngcontent-%COMP%]{font-weight:700;font-size:10pt;font-family:Arial,Helvetica,sans-serif;padding:10px 0}button[_ngcontent-%COMP%]{min-width:unset;padding:unset}.item-row[_ngcontent-%COMP%]{display:flex;width:100%;padding:2px 0}.item-row[_ngcontent-%COMP%] .name[_ngcontent-%COMP%]{flex:1 1 auto;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;text-overflow:ellipsis;line-height:2.5em}.item-row[_ngcontent-%COMP%] .check[_ngcontent-%COMP%]{text-align:right;padding-right:15px}.track-note[_ngcontent-%COMP%]{font-size:.85em;opacity:.8;padding:0 15px 4px 30px}.track-range[_ngcontent-%COMP%]{padding:8px 5px 0}.track-range-select[_ngcontent-%COMP%]{width:100%}.track-range-custom[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:0 8px}.track-range-custom[_ngcontent-%COMP%] mat-form-field[_ngcontent-%COMP%]{flex:1 1 220px}@media only screen and (min-width:475px){button[_ngcontent-%COMP%]{min-width:inherit;padding:inherit}.dialog-content[_ngcontent-%COMP%]{min-width:400px}.dialog-icon[_ngcontent-%COMP%]{display:inline}}@media only screen and (min-width:800px){.card-group[_ngcontent-%COMP%]{padding:5px 5%}}"]})};export{Le as GPXExportDialog,W as fromLocalInput,$e as toLocalInput};
|