@signalk/freeboard-sk 3.2.0-beta.3 → 3.2.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/package.json +2 -2
  2. package/public/3rdpartylicenses.txt +31 -31
  3. package/public/assets/features/gpx-export-1.jpg +0 -0
  4. package/public/assets/features/gpx-export-2.jpg +0 -0
  5. package/public/assets/features/track-history-1.jpg +0 -0
  6. package/public/assets/features/track-history-2.jpg +0 -0
  7. package/public/assets/features/track-history-3.jpg +0 -0
  8. package/public/assets/features/vessel-tracks-1.jpg +0 -0
  9. package/public/assets/features/vessel-tracks-2.jpg +0 -0
  10. package/public/assets/features/vessel-tracks-3.jpg +0 -0
  11. package/public/assets/features-corpus.json +1 -1
  12. package/public/assets/help/index.html +51 -28
  13. package/public/{chunk-ABRMW675.js → chunk-4DXUR67I.js} +1 -1
  14. package/public/{chunk-B5SN3ZBN.js → chunk-4JRVRHO7.js} +14 -14
  15. package/public/{chunk-T5UYZVNA.js → chunk-4ZE2OKZZ.js} +1 -1
  16. package/public/{chunk-APXAP2M7.js → chunk-6PWYCIYX.js} +1 -1
  17. package/public/chunk-7D3RA76X.js +1 -0
  18. package/public/{chunk-FMYAA5JW.js → chunk-7TRKAN4B.js} +1 -1
  19. package/public/{chunk-OGLYW4PJ.js → chunk-AA62TGOR.js} +1 -1
  20. package/public/chunk-AMDY4THY.js +1 -0
  21. package/public/chunk-BMQUNGKK.js +1 -0
  22. package/public/chunk-CCTZD6S5.js +1 -0
  23. package/public/chunk-HHW5G2CI.js +1 -0
  24. package/public/chunk-IVUSRYQI.js +1 -0
  25. package/public/{chunk-K7PZKJJ7.js → chunk-JEAAYERI.js} +2 -2
  26. package/public/{chunk-PLO4RGKC.js → chunk-KGFHR4JM.js} +2 -2
  27. package/public/chunk-L4FEUXHI.js +4372 -0
  28. package/public/{chunk-XTQIZ74A.js → chunk-N4UL6N3G.js} +1 -1
  29. package/public/{chunk-K2CIRFN7.js → chunk-OPNUYGIO.js} +51 -51
  30. package/public/chunk-P5KVJ35V.js +1 -0
  31. package/public/{chunk-FC62PK2U.js → chunk-PU7NCPYW.js} +5 -5
  32. package/public/{chunk-KNJHWYQ3.js → chunk-TK54SKYF.js} +1 -1
  33. package/public/{chunk-2M5JDEPT.js → chunk-VJLDZ4NI.js} +11 -11
  34. package/public/{chunk-ABEPBSQB.js → chunk-WCLDE6BT.js} +1 -1
  35. package/public/{chunk-TTKT5FKY.js → chunk-WTDLBURC.js} +3 -3
  36. package/public/{chunk-2UND4DAL.js → chunk-WYYDGUIZ.js} +2 -2
  37. package/public/index.html +2 -2
  38. package/public/main-I7SJMW3M.js +468 -0
  39. package/public/styles-YRQUZIIZ.css +1 -0
  40. package/public/worker-3WLRYUBE.js +3 -0
  41. package/public/chunk-3FOJW6X2.js +0 -1
  42. package/public/chunk-4TZSCPY6.js +0 -1
  43. package/public/chunk-7H3TNUZC.js +0 -4195
  44. package/public/chunk-CJYO3MRU.js +0 -1
  45. package/public/chunk-Q4PCFBHO.js +0 -1
  46. package/public/chunk-RLJNSFJD.js +0 -1
  47. package/public/chunk-TYJ363DD.js +0 -1
  48. package/public/chunk-W3IQ2KES.js +0 -1
  49. package/public/main-GUEKBZU3.js +0 -468
  50. package/public/styles-4PTRKEMS.css +0 -1
  51. package/public/worker-2DO6V3OI.js +0 -3
@@ -764,8 +764,11 @@
764
764
  Groups provide a means of defining a set of resources so they can
765
765
  be easily displayed or hidden.
766
766
  <br />
767
- Selecting a Group will display all of the resources within the
768
- group on the map and hide all other resources.
767
+ Selecting a Group will display the resources within the group on
768
+ the map and hide the other resources of the same type. A type with
769
+ nothing in the group is hidden when <i>Hide</i> is checked for it
770
+ in the Group's properties, and otherwise left as it is. Charts are
771
+ left as they are unless the group contains charts.
769
772
  <br />
770
773
  Resources can be added to groups directly from the specific
771
774
  resource list <i>(e.g. Routes, Waypoints, Regions, Charts)</i> or
@@ -792,7 +795,7 @@
792
795
  Use this to:
793
796
  <ul>
794
797
  <li>Rename the group</li>
795
- <li>Display the resourcces within the group</li>
798
+ <li>Display the resources within the group</li>
796
799
  <li>Add and Remove resources from the group</li>
797
800
  </ul>
798
801
  group.
@@ -993,9 +996,10 @@
993
996
  Check the <b>Include trail from server</b> if you want to
994
997
  include trail data stored on the server.<br />
995
998
  <i>
996
- Recommended if you have the
997
- <b>Get Trail from server</b> option checked in
998
- <b>Settings</b>.
999
+ Recommended when the vessel trail comes from the server (<b
1000
+ >Track source</b
1001
+ >
1002
+ in <b>Settings</b>).
999
1003
  </i>
1000
1004
  </li>
1001
1005
  <li>
@@ -1393,12 +1397,12 @@
1393
1397
  You will be presented with a screen that will allow you to select
1394
1398
  some or all of the Route and Waypoint resources from the Signal K
1395
1399
  server.<br />
1396
- Additionally, the locally stored vessel trail can be saved as a
1397
- GPX track.<br />
1398
- <i
1399
- >Note: this option is only available when
1400
- <b>Get Trail from Server</b> setting is not selected.</i
1401
- ><br />
1400
+ Additionally, the vessel trail can be saved as a GPX track,
1401
+ whether it is kept on this device or fetched from the server.<br />
1402
+ A single vessel's track can also be exported from its popup with
1403
+ <i class="material-icons">download</i> <b>Export track to GPX</b>.
1404
+ For the track ranges that can be saved, see the Feature Browser
1405
+ &rarr; <i>Export to GPX</i>.<br />
1402
1406
  <ul>
1403
1407
  <li>
1404
1408
  <b>Waypoints:</b> Click the checkbox to select all Waypoints
@@ -2558,22 +2562,37 @@
2558
2562
  the selected time and the vessel's current SOG.
2559
2563
  </li>
2560
2564
  <li>
2561
- <b>Display Vessel Trail</b>: Check this box if you want to display
2562
- the vessel trail.<br />
2563
- By default Freeboard will display the vessel trail using a local
2564
- cache maintaining up to 5000 points at a 5 second interval.
2565
+ <b>Display Vessel Track</b>: Check this box to display the vessel
2566
+ trail (on by default). See the Feature Browser &rarr;
2567
+ <i>Vessel Tracks</i> for how the trail is shown.
2565
2568
  <ul>
2566
2569
  <li>
2567
- <b>Get Trail from Server</b>: Check this to retrieve vessel
2568
- trail data from the server at the path
2569
- <i>signalk/v1/api/self/track</i>.<br />
2570
+ <b>Track source</b>: where the trail comes from.
2571
+ <ul>
2572
+ <li>
2573
+ <i>Auto</i> (default): the server's recorded track when
2574
+ the server can supply one, otherwise a local cache on this
2575
+ device.
2576
+ </li>
2577
+ <li>
2578
+ <i>Server</i>: the track recorded by the server's Track
2579
+ API (<i>signalk/v2/api/tracks</i>, Signal K server 2.33 or
2580
+ later with a track provider). Unavailable when the server
2581
+ has no track source.
2582
+ </li>
2583
+ <li>
2584
+ <i>This device</i>: a local cache maintaining up to 5000
2585
+ points at a 5 second interval, recorded while Freeboard is
2586
+ open.
2587
+ </li>
2588
+ </ul>
2570
2589
  </li>
2571
2590
  <li>
2572
2591
  Use the slider to set the <b>length</b> of track to retrieve
2573
2592
  from the server in hours. Time is relative to the current
2574
2593
  time.<br />
2575
2594
 
2576
- The <b>Resolution</b> settings define the number of track
2595
+ The <b>Resolution</b> settings define the spacing of track
2577
2596
  points returned by the server for the following time windows:
2578
2597
  <ul>
2579
2598
  <li>Last hour (default = 5 secs)</li>
@@ -2585,8 +2604,8 @@
2585
2604
  transferred from the server which may impact performance. </span
2586
2605
  ><br />
2587
2606
  Trail data received from the server undergoes temporal
2588
- simplification to minimise the data used to display the trail
2589
- whilst maintianing integrity.
2607
+ simplification to minimize the data used to display the trail
2608
+ while maintaining integrity.
2590
2609
  </li>
2591
2610
  </ul>
2592
2611
  </li>
@@ -2610,14 +2629,18 @@
2610
2629
  the map.
2611
2630
  </li>
2612
2631
  <li>
2613
- <b>Wind / Trail Zoom Level</b>: The minimum Zoom level at which
2614
- other vessels wind vector and trails will be displayed.
2615
- <i>(Default=15)</i>
2632
+ <b>Wind / Track Zoom Level</b>: The minimum Zoom level at which
2633
+ other vessels' wind vectors are displayed. <i>(Default=15)</i>
2634
+ </li>
2635
+ <li>
2636
+ <b>Show all tracks</b>: Select to display the last 2 hours of the
2637
+ tracks of all other vessels in the map view, from zoom level 10.
2638
+ See the Feature Browser &rarr; <i>Vessel Tracks</i>.
2616
2639
  </li>
2617
2640
  <li>
2618
- <b>Show Trails</b>: Select to display trails of other vessels on
2619
- map. Note: length of trail is limited in length to approx 1hr of
2620
- data.
2641
+ <b>Picked vessel track length</b>: How far back the track of a
2642
+ vessel picked with its <i>TRACK</i> button reaches (hours, default
2643
+ 12). Shown only while <i>Show all tracks</i> is off.
2621
2644
  </li>
2622
2645
  <li>
2623
2646
  <b>Hide Moored</b>: Select to hide vessels with a state of
@@ -1 +1 @@
1
- import{Ga as $,r as Y,z as Z}from"./chunk-7H3TNUZC.js";import{a as N,b as Q,c as X}from"./chunk-TTKT5FKY.js";import"./chunk-2UND4DAL.js";import{i as K,k as W}from"./chunk-2M5JDEPT.js";import{a as J,b as U,d as q}from"./chunk-FC62PK2U.js";import{a as B}from"./chunk-XTQIZ74A.js";import"./chunk-T5UYZVNA.js";import"./chunk-FMYAA5JW.js";import"./chunk-OGLYW4PJ.js";import{b as H,i as z,o as G}from"./chunk-ABEPBSQB.js";import{Dd as P,Ea as u,Ed as R,Fa as g,Ha as C,Hd as k,Ia as M,Ja as I,Jd as T,Ka as _,La as i,Ma as t,Na as b,R as d,Rd as V,S as p,Td as A,Ua as h,Wa as f,Wd as F,Ya as c,Yd as O,Zd as j,ja as r,lb as n,mb as w,nb as v,oa as m,pb as D,pe as L,qb as S,ra as y,rb as E}from"./chunk-K2CIRFN7.js";import"./chunk-6H3I7D5M.js";function te(o,a){if(o&1&&(i(0,"mat-option",10),n(1),t()),o&2){let e=a.$implicit;_("value",e),r(),w(e)}}function ie(o,a){if(o&1){let e=h();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()()()()}o&2&&(r(),_("astext",!0))}function ne(o,a){if(o&1){let e=h();i(0,"div")(1,"div")(2,"b"),n(3,"Invalid Resource Data:"),t(),b(4,"br")(5,"br"),i(6,"i"),n(7,"Selected file does not contain valid data. "),t(),b(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 oe(o,a){o&1&&(i(0,"div",16),n(1," Note: Data will not be validated when uploaded to server! "),t())}function ae(o,a){if(o&1){let e=h();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(),b(27,"br"),n(28,"\xA0 "),u(29,oe,2,0,"div",16),t()()()}if(o&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),v(" ",e.source.name," "),r(4),v(" ",e.source.type," "),r(2),_("disabled",!e.targetPath||!e.source.name),r(6),g(e.targetPath&&e.source.name?29:-1)}}var ee=class o{constructor(a,e,s,l){this.app=a;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};unsubscribe=[];ngOnInit(){this.skclient.api.get(this.app.skApiVersion,"/resources").subscribe(a=>{this.resPaths=[],this.targetPath=null,this.resPaths=Object.keys(a).filter(e=>!["routes","waypoints","notes","regions","charts","tracks"].includes(e))},()=>{this.resPaths=[],this.targetPath=null})}ngOnDestroy(){this.unsubscribe.forEach(a=>a.unsubscribe())}load(){this.dialogRef.close({path:this.targetPath,data:this.source.data})}parseFile(a){this.source=a,this.source.type="Unknown";try{let e=JSON.parse(a.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||o)(m(Z),m(Y),m(P),m(R))};static \u0275cmp=y({type:o,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,ae,30,8,"div",7),t()()),e&2&&(r(12),g(s.display.notValid?-1:12))},dependencies:[L,G,z,H,q,U,J,N,B,j,O,K,F,A,V,X,Q,W,T,k,$],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
+ import{Sa as $,q as Y,z as Z}from"./chunk-L4FEUXHI.js";import{a as q,b as Q,c as X}from"./chunk-WTDLBURC.js";import{j as B,l as N}from"./chunk-VJLDZ4NI.js";import{a as z,b as G,d as J}from"./chunk-PU7NCPYW.js";import{a as U}from"./chunk-N4UL6N3G.js";import"./chunk-AA62TGOR.js";import{b as K,i as W,o as H}from"./chunk-WCLDE6BT.js";import"./chunk-WYYDGUIZ.js";import"./chunk-4ZE2OKZZ.js";import"./chunk-7TRKAN4B.js";import{Ea as u,Ed as P,Fa as g,Fd as R,Ha as C,Ia as M,Id as k,Ja as I,Ka as _,Kd as T,La as i,Ma as t,Md as V,Na as b,Nd as A,R as d,S as p,Ua as h,Vd as F,Wa as f,Xd as O,Ya as c,_d as j,ja as r,lb as n,mb as w,nb as v,oa as m,pb as D,qb as S,qe as L,ra as y,rb as E}from"./chunk-OPNUYGIO.js";import"./chunk-6H3I7D5M.js";function te(o,a){if(o&1&&(i(0,"mat-option",10),n(1),t()),o&2){let e=a.$implicit;_("value",e),r(),w(e)}}function ie(o,a){if(o&1){let e=h();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()()()()}o&2&&(r(),_("astext",!0))}function ne(o,a){if(o&1){let e=h();i(0,"div")(1,"div")(2,"b"),n(3,"Invalid Resource Data:"),t(),b(4,"br")(5,"br"),i(6,"i"),n(7,"Selected file does not contain valid data. "),t(),b(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 oe(o,a){o&1&&(i(0,"div",16),n(1," Note: Data will not be validated when uploaded to server! "),t())}function ae(o,a){if(o&1){let e=h();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(),b(27,"br"),n(28,"\xA0 "),u(29,oe,2,0,"div",16),t()()()}if(o&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),v(" ",e.source.name," "),r(4),v(" ",e.source.type," "),r(2),_("disabled",!e.targetPath||!e.source.name),r(6),g(e.targetPath&&e.source.name?29:-1)}}var ee=class o{constructor(a,e,s,l){this.app=a;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};unsubscribe=[];ngOnInit(){this.skclient.api.get(this.app.skApiVersion,"/resources").subscribe(a=>{this.resPaths=[],this.targetPath=null,this.resPaths=Object.keys(a).filter(e=>!["routes","waypoints","notes","regions","charts","tracks"].includes(e))},()=>{this.resPaths=[],this.targetPath=null})}ngOnDestroy(){this.unsubscribe.forEach(a=>a.unsubscribe())}load(){this.dialogRef.close({path:this.targetPath,data:this.source.data})}parseFile(a){this.source=a,this.source.type="Unknown";try{let e=JSON.parse(a.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||o)(m($),m(Y),m(P),m(R))};static \u0275cmp=y({type:o,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,ae,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,4 +1,4 @@
1
- import{f as y}from"./chunk-6H3I7D5M.js";var b=a=>typeof Worker>"u"?Promise.reject(new Error("Error starting Worker!")):new Promise((t,e)=>{let n=new Worker(new URL("worker-5LIQ6F6U.js",import.meta.url),{type:"module"}),i=s=>{n.terminate(),s?t(s):e(new Error("Error processing content!"))};n.onmessage=s=>i(s.data),n.onerror=()=>i(null),n.postMessage({sourceType:"xml",value:a})});function o(a,t){if(typeof a!="string"||a.trim()==="")return t;let e=Number(a);return Number.isFinite(e)?e:t}var g=class{version;creator;wpt;rte;trk;extensions;metadata;constructor(){this.init()}init(){this.version="1.1",this.creator="@panaaj",this.wpt=[],this.rte=[],this.trk=[],this.extensions={},this.metadata=new m}stringify(){return this.toXML()}toXML(){let t=`<?xml version="1.0" encoding="UTF-8"?>\r
1
+ import{f as b}from"./chunk-6H3I7D5M.js";var g=r=>typeof Worker>"u"?Promise.reject(new Error("Error starting Worker!")):new Promise((t,e)=>{let n=new Worker(new URL("worker-5LIQ6F6U.js",import.meta.url),{type:"module"}),i=s=>{n.terminate(),s?t(s):e(new Error("Error processing content!"))};n.onmessage=s=>i(s.data),n.onerror=()=>i(null),n.postMessage({sourceType:"xml",value:r})});function c(r,t){if(typeof r!="string"||r.trim()==="")return t;let e=Number(r);return Number.isFinite(e)?e:t}function o(r){return String(r).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var x=class{version;creator;wpt;rte;trk;extensions;metadata;constructor(){this.init()}init(){this.version="1.1",this.creator="@panaaj",this.wpt=[],this.rte=[],this.trk=[],this.extensions={},this.metadata=new d}stringify(){return this.toXML()}toXML(){let t=`<?xml version="1.0" encoding="UTF-8"?>\r
2
2
  <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="${this.version}" xmlns="http://www.topografix.com/GPX/1/1" creator="${this.creator}" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.topografix.com/GPX/Private/TopoGrafix/0/1 http://www.topografix.com/GPX/Private/TopoGrafix/0/1/topografix.xsd" xmlns:topografix="http://www.topografix.com/GPX/Private/TopoGrafix/0/1">\r
3
3
  `+this.metadataToXML()+this.waypointsToXML()+this.routesToXML()+this.tracksToXML();return t+=this.extensionsToXML(this.extensions),t+=`</gpx>\r
4
4
  `,t}metadataToXML(){let t=` <metadata>\r
@@ -40,25 +40,25 @@ import{f as y}from"./chunk-6H3I7D5M.js";var b=a=>typeof Worker>"u"?Promise.rejec
40
40
  </link>\r
41
41
  `}),t+=this.extensionsToXML(e.extensions,2);for(let n of e.rtept)t+=this.ptToXML(n,"rtept");t+=` </rte>\r
42
42
  `}),t}tracksToXML(){let t="";return this.trk.forEach(e=>{t+=` <trk>\r
43
- `,t+=e.name?` <name>${e.name||""}</name>\r
44
- `:"",t+=e.cmt?` <cmt>${e.cmt||""}</cmt>\r
45
- `:"",t+=e.desc?` <desc>${e.desc||""}</desc>\r
46
- `:"",t+=e.src?` <src>${e.src||""}</src>\r
43
+ `,t+=e.name?` <name>${o(e.name)}</name>\r
44
+ `:"",t+=e.cmt?` <cmt>${o(e.cmt)}</cmt>\r
45
+ `:"",t+=e.desc?` <desc>${o(e.desc)}</desc>\r
46
+ `:"",t+=e.src?` <src>${o(e.src)}</src>\r
47
47
  `:"",t+=e.number?` <number>${e.number||""}</number>\r
48
- `:"",t+=e.type?` <type>${e.type||""}</type>\r
48
+ `:"",t+=e.type?` <type>${o(e.type)}</type>\r
49
49
  `:"",t+=this.extensionsToXML(e.extensions,2),e.trkseg.forEach(n=>{t+=` <trkseg>\r
50
50
  `;for(let i of n.trkpt)t+=this.ptToXML(i,"trkpt");t+=` </trkseg>\r
51
51
  `}),t+=` </trk>\r
52
52
  `}),t}ptToXML(t,e){let n="",i=2;switch(e){case"trkpt":n=" ",i=4;break;case"rtept":n=" ",i=3;break}let s="";return s+=`${n} <${e} lat="${t.lat.toFixed(6)}" lon="${t.lon.toFixed(6)}">\r
53
- `,s+=t.sym?`${n} <sym>${t.sym||""}</sym>\r
53
+ `,s+=t.ele?`${n} <ele>${t.ele||""}</ele>\r
54
+ `:"",s+=t.datetime instanceof Date&&!isNaN(t.datetime.getTime())?`${n} <time>${t.datetime.toISOString()}</time>\r
55
+ `:"",s+=t.sym?`${n} <sym>${t.sym||""}</sym>\r
54
56
  `:"",s+=t.name?`${n} <name>${t.name||""}</name>\r
55
57
  `:"",s+=t.cmt?`${n} <cmt>${t.cmt||""}</cmt>\r
56
58
  `:"",s+=t.desc?`${n} <desc>${t.desc||""}</desc>\r
57
59
  `:"",s+=t.src?`${n} <src>${t.src||""}</src>\r
58
60
  `:"",s+=t.type?`${n} <type>${t.type||""}</type>\r
59
- `:"",s+=t.time?`${n} <time>${t.datetime||""}</time>\r
60
61
  `:"",s+=t.fix?`${n} <fix>${t.fix||""}</fix>\r
61
- `:"",s+=t.ele?`${n} <ele>${t.ele||""}</ele>\r
62
62
  `:"",s+=t.magvar?`${n} <magvar>${t.magvar||""}</magvar>\r
63
63
  `:"",s+=t.geoidHeight?`${n} <geoidheight>${t.geoidHeight||""}</geoidheight>\r
64
64
  `:"",s+=t.sat?`${n} <sat>${t.sat||""}</sat>\r
@@ -67,14 +67,14 @@ import{f as y}from"./chunk-6H3I7D5M.js";var b=a=>typeof Worker>"u"?Promise.rejec
67
67
  `:"",s+=t.pdop?`${n} <pdop>${t.pdop||""}</pdop>\r
68
68
  `:"",s+=t.ageOfGpsData?`${n} <ageofdgpsdata>${t.ageOfGpsData||""}</ageofdgpsdata>\r
69
69
  `:"",s+=t.dgpsid?`${n} <dgpsid>${t.dgpsid||""}</dgpsid>\r
70
- `:"",t.link.forEach(r=>{s+=`${n} <link href="${r.href||""}">\r
71
- ${n} <text>${r.text||""}</text>\r
72
- ${n} <type>${r.type||""}</type>\r
70
+ `:"",t.link.forEach(a=>{s+=`${n} <link href="${a.href||""}">\r
71
+ ${n} <text>${a.text||""}</text>\r
72
+ ${n} <type>${a.type||""}</type>\r
73
73
  ${n} </link>\r
74
74
  `}),s+=this.extensionsToXML(t.extensions,i),s+=`${n} </${e}>\r
75
- `,s}extensionsToXML(t,e=1){let n="";if(t&&Object.keys(t).length!==0){let i=" ".slice(0-e),s="";t.signalk&&Object.keys(t.signalk).forEach(r=>{s+=`${i} <${r}>${t.signalk[r]}</${r}>\r
75
+ `,s}extensionsToXML(t,e=1){let n="";if(t&&Object.keys(t).length!==0){let i=" ".slice(0-e),s="";t.signalk&&Object.keys(t.signalk).forEach(a=>{s+=`${i} <${a}>${t.signalk[a]}</${a}>\r
76
76
  `}),n+=`${i}<extensions>\r
77
77
  ${i} <signalk>\r
78
78
  `+s+`${i} </signalk>\r
79
79
  ${i}</extensions>\r
80
- `}return n}xValue(t){if(t&&Array.isArray(t))return t.length!==0?t[0]:null}applyBounds(t){let e=t?.$??{},n=this.metadata.bounds;n.minLat=o(e.minlat,n.minLat),n.minLon=o(e.minlon,n.minLon),n.maxLat=o(e.maxlat,n.maxLat),n.maxLon=o(e.maxlon,n.maxLon)}parse(t){return y(this,null,function*(){if(!t||t.indexOf("<gpx")===-1)return!1;this.init();try{let e=yield b(t);if(e.gpx.metadata){let n=this.xValue(e.gpx.metadata);this.metadata.name=n.name?this.xValue(n.name):null,this.metadata.desc=n.desc?this.xValue(n.desc):null,this.metadata.keywords=n.keywords?n.keywords:null,n.bounds&&this.applyBounds(this.xValue(n.bounds)),this.metadata.extensions=n.extensions?this.parseExtensions(n.extensions):{}}return e.gpx.wpt&&this.parseWaypoints(e.gpx.wpt),e.gpx.rte&&this.parseRoutes(e.gpx.rte),e.gpx.trk&&this.parseTracks(e.gpx.trk),this.extensions=e.gpx.extensions?this.parseExtensions(e.gpx.extensions):{},!0}catch(e){return!1}})}parseWaypoints(t){if(Array.isArray(t))t.forEach(e=>{let n=this.toWpt(e);this.updateBounds(n),this.wpt.push(n)});else{let e=this.toWpt(t);this.updateBounds(e),this.wpt.push(e)}}parseRoutes(t){if(Array.isArray(t))t.forEach(e=>{let n=this.toRte(e);this.updateBounds(n),this.rte.push(n)});else{let e=this.toRte(t);this.updateBounds(e),this.rte.push(e)}}parseTracks(t){if(Array.isArray(t))t.forEach(e=>{let n=this.toTrk(e);this.updateBounds(n),this.trk.push(n)});else{let e=this.toTrk(t);this.updateBounds(e),this.trk.push(e)}}parseExtensions(t){if(!t)return{};if(!Array.isArray(t))return{};let e={};return t.forEach(n=>{if(n.signalk){let i={},s=this.xValue(n.signalk);Object.keys(s).forEach(r=>{i[r]=this.xValue(s[r])}),e.signalk=i}}),e}parseLinks(t){let e=[];if(!t)return e;if(Array.isArray(t))t.forEach(n=>{let i=new u;i.href=n._href,i.text=n.text,i.type=n.type,e.push(i)});else{let n=new u;n.href=t._href,n.text=t.text,n.type=t.type,e.push(n)}return e}toRte(t){let e=new h;return e.name=t.name?this.xValue(t.name):null,e.cmt=t.cmt?this.xValue(t.cmt):null,e.desc=t.desc?this.xValue(t.desc):null,e.src=t.src?this.xValue(t.src):null,e.extensions=t.extensions?this.parseExtensions(t.extensions):{},t.rtept&&(e.rtept=this.toPtArray(t.rtept)),e}toWpt(t){let e=new p;return e.lat=Number(t.$.lat)||0,e.lon=Number(t.$.lon)||0,e.ele=t.ele?Number(this.xValue(t.ele)):null,e.sym=t.sym?this.xValue(t.sym):null,e.name=t.name?this.xValue(t.name):null,e.cmt=t.cmt?this.xValue(t.cmt):null,e.desc=t.desc?this.xValue(t.desc):null,e.src=t.src?this.xValue(t.src):null,e.type=t.type?this.xValue(t.type):null,e.extensions=t.extensions?this.parseExtensions(t.extensions):{},e}toTrk(t){let e=new l;if(e.name=t.name?this.xValue(t.name):null,e.cmt=t.cmt?this.xValue(t.cmt):null,e.desc=t.desc?this.xValue(t.desc):null,e.src=t.src?this.xValue(t.src):null,e.number=t.number?Number(this.xValue(t.number)):null,e.type=t.type?this.xValue(t.type):null,e.extensions=t.extensions?this.parseExtensions(t.extensions):{},t.trkseg)if(Array.isArray(t.trkseg))t.trkseg.forEach(n=>{let i=new c;i.extensions=n.extensions?this.parseExtensions(n.extensions):{},n.trkpt&&(i.trkpt=this.toPtArray(n.trkpt)),e.trkseg.push(i)});else{let n=new c;n.extensions=t.trkseg.extensions?this.parseExtensions(t.trkseg.extensions):{},t.trkseg.trkpt&&(n.trkpt=this.toPtArray(t.trkseg.trkpt)),e.trkseg.push(n)}return e}toPtArray(t){let e=[];if(Array.isArray(t))t.forEach(n=>{let i=this.toWpt(n);this.updateBounds(i),e.push(i)});else{let n=this.toWpt(t);this.updateBounds(n),e.push(n)}return e}setExtension(t,e,n){t.extensions||(t.extensions={});let i=e.split("."),s=t.extensions;i.forEach(r=>{s[r]||(s[r]={}),s=s[r]}),t.extensions.signalk.uuid=n}updateBounds(t){this.metadata.bounds.minLat=t.lat<this.metadata.bounds.minLat?t.lat:this.metadata.bounds.minLat,this.metadata.bounds.minLon=t.lon<this.metadata.bounds.minLon?t.lon:this.metadata.bounds.minLon,this.metadata.bounds.maxLat=t.lat>this.metadata.bounds.maxLat?t.lat:this.metadata.bounds.maxLat,this.metadata.bounds.maxLon=t.lon>this.metadata.bounds.maxLon?t.lon:this.metadata.bounds.maxLon}},p=class{lat;lon;ele;datetime;magvar;geoidHeight;name;cmt;desc;src;link=[];sym;type;fix;sat;hdop;vdop;pdop;ageOfGpsData;dgpsid;extensions={};constructor(t,e){this.lat=t||0,this.lon=e||0}},h=class{name;cmt;desc;src;link=[];number;type;extensions={};rtept=[];constructor(t){this.name=t||""}},l=class{name;cmt;desc;src;link=[];number;type;extensions={};trkseg=[];constructor(t){this.name=t||""}},c=class{trkpt=[];extensions={}};var m=class{name="";desc="";author;copyright;link=[];time=new Date().toISOString();keywords="";bounds=new d;extensions={}},u=class{href="";text="";type=""};var d=class{minLat=90;minLon=180;maxLat=-90;maxLon=-180};export{g as a,p as b,h as c,l as d,c as e};
80
+ `}return n}xValue(t){if(t&&Array.isArray(t))return t.length!==0?t[0]:null}applyBounds(t){let e=t?.$??{},n=this.metadata.bounds;n.minLat=c(e.minlat,n.minLat),n.minLon=c(e.minlon,n.minLon),n.maxLat=c(e.maxlat,n.maxLat),n.maxLon=c(e.maxlon,n.maxLon)}parse(t){return b(this,null,function*(){if(!t||t.indexOf("<gpx")===-1)return!1;this.init();try{let e=yield g(t);if(e.gpx.metadata){let n=this.xValue(e.gpx.metadata);this.metadata.name=n.name?this.xValue(n.name):null,this.metadata.desc=n.desc?this.xValue(n.desc):null,this.metadata.keywords=n.keywords?n.keywords:null,n.bounds&&this.applyBounds(this.xValue(n.bounds)),this.metadata.extensions=n.extensions?this.parseExtensions(n.extensions):{}}return e.gpx.wpt&&this.parseWaypoints(e.gpx.wpt),e.gpx.rte&&this.parseRoutes(e.gpx.rte),e.gpx.trk&&this.parseTracks(e.gpx.trk),this.extensions=e.gpx.extensions?this.parseExtensions(e.gpx.extensions):{},!0}catch(e){return!1}})}parseWaypoints(t){if(Array.isArray(t))t.forEach(e=>{let n=this.toWpt(e);this.updateBounds(n),this.wpt.push(n)});else{let e=this.toWpt(t);this.updateBounds(e),this.wpt.push(e)}}parseRoutes(t){if(Array.isArray(t))t.forEach(e=>{let n=this.toRte(e);this.updateBounds(n),this.rte.push(n)});else{let e=this.toRte(t);this.updateBounds(e),this.rte.push(e)}}parseTracks(t){if(Array.isArray(t))t.forEach(e=>{let n=this.toTrk(e);this.updateBounds(n),this.trk.push(n)});else{let e=this.toTrk(t);this.updateBounds(e),this.trk.push(e)}}parseExtensions(t){if(!t)return{};if(!Array.isArray(t))return{};let e={};return t.forEach(n=>{if(n.signalk){let i={},s=this.xValue(n.signalk);Object.keys(s).forEach(a=>{i[a]=this.xValue(s[a])}),e.signalk=i}}),e}parseLinks(t){let e=[];if(!t)return e;if(Array.isArray(t))t.forEach(n=>{let i=new p;i.href=n._href,i.text=n.text,i.type=n.type,e.push(i)});else{let n=new p;n.href=t._href,n.text=t.text,n.type=t.type,e.push(n)}return e}toRte(t){let e=new h;return e.name=t.name?this.xValue(t.name):null,e.cmt=t.cmt?this.xValue(t.cmt):null,e.desc=t.desc?this.xValue(t.desc):null,e.src=t.src?this.xValue(t.src):null,e.extensions=t.extensions?this.parseExtensions(t.extensions):{},t.rtept&&(e.rtept=this.toPtArray(t.rtept)),e}toWpt(t){let e=new l;return e.lat=Number(t.$.lat)||0,e.lon=Number(t.$.lon)||0,e.ele=t.ele?Number(this.xValue(t.ele)):null,e.sym=t.sym?this.xValue(t.sym):null,e.name=t.name?this.xValue(t.name):null,e.cmt=t.cmt?this.xValue(t.cmt):null,e.desc=t.desc?this.xValue(t.desc):null,e.src=t.src?this.xValue(t.src):null,e.type=t.type?this.xValue(t.type):null,e.extensions=t.extensions?this.parseExtensions(t.extensions):{},e}toTrk(t){let e=new m;if(e.name=t.name?this.xValue(t.name):null,e.cmt=t.cmt?this.xValue(t.cmt):null,e.desc=t.desc?this.xValue(t.desc):null,e.src=t.src?this.xValue(t.src):null,e.number=t.number?Number(this.xValue(t.number)):null,e.type=t.type?this.xValue(t.type):null,e.extensions=t.extensions?this.parseExtensions(t.extensions):{},t.trkseg)if(Array.isArray(t.trkseg))t.trkseg.forEach(n=>{let i=new u;i.extensions=n.extensions?this.parseExtensions(n.extensions):{},n.trkpt&&(i.trkpt=this.toPtArray(n.trkpt)),e.trkseg.push(i)});else{let n=new u;n.extensions=t.trkseg.extensions?this.parseExtensions(t.trkseg.extensions):{},t.trkseg.trkpt&&(n.trkpt=this.toPtArray(t.trkseg.trkpt)),e.trkseg.push(n)}return e}toPtArray(t){let e=[];if(Array.isArray(t))t.forEach(n=>{let i=this.toWpt(n);this.updateBounds(i),e.push(i)});else{let n=this.toWpt(t);this.updateBounds(n),e.push(n)}return e}setExtension(t,e,n){t.extensions||(t.extensions={});let i=e.split("."),s=t.extensions;i.forEach(a=>{s[a]||(s[a]={}),s=s[a]}),t.extensions.signalk.uuid=n}updateBounds(t){this.metadata.bounds.minLat=t.lat<this.metadata.bounds.minLat?t.lat:this.metadata.bounds.minLat,this.metadata.bounds.minLon=t.lon<this.metadata.bounds.minLon?t.lon:this.metadata.bounds.minLon,this.metadata.bounds.maxLat=t.lat>this.metadata.bounds.maxLat?t.lat:this.metadata.bounds.maxLat,this.metadata.bounds.maxLon=t.lon>this.metadata.bounds.maxLon?t.lon:this.metadata.bounds.maxLon}},l=class{lat;lon;ele;datetime;magvar;geoidHeight;name;cmt;desc;src;link=[];sym;type;fix;sat;hdop;vdop;pdop;ageOfGpsData;dgpsid;extensions={};constructor(t,e){this.lat=t||0,this.lon=e||0}},h=class{name;cmt;desc;src;link=[];number;type;extensions={};rtept=[];constructor(t){this.name=t||""}},m=class{name;cmt;desc;src;link=[];number;type;extensions={};trkseg=[];constructor(t){this.name=t||""}},u=class{trkpt=[];extensions={}};var d=class{name="";desc="";author;copyright;link=[];time=new Date().toISOString();keywords="";bounds=new y;extensions={}},p=class{href="";text="";type=""};var y=class{minLat=90;minLon=180;maxLat=-90;maxLon=-180};export{x as a,l as b,h as c,m as d,u as e};
@@ -1,4 +1,4 @@
1
- import{M as a,ib as i,ra as c,sa as r,vd as d,xc as s}from"./chunk-K2CIRFN7.js";var p=(()=>{class e{_animationsDisabled=d();state="unchecked";disabled=!1;appearance="full";constructor(){}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=c({type:e,selectors:[["mat-pseudo-checkbox"]],hostAttrs:[1,"mat-pseudo-checkbox"],hostVars:12,hostBindings:function(t,o){t&2&&i("mat-pseudo-checkbox-indeterminate",o.state==="indeterminate")("mat-pseudo-checkbox-checked",o.state==="checked")("mat-pseudo-checkbox-disabled",o.disabled)("mat-pseudo-checkbox-minimal",o.appearance==="minimal")("mat-pseudo-checkbox-full",o.appearance==="full")("_mat-animation-noopable",o._animationsDisabled)},inputs:{state:"state",disabled:"disabled",appearance:"appearance"},decls:0,vars:0,template:function(t,o){},styles:[`.mat-pseudo-checkbox {
1
+ import{M as a,ib as i,ra as c,sa as r,wd as d,yc as s}from"./chunk-OPNUYGIO.js";var p=(()=>{class e{_animationsDisabled=d();state="unchecked";disabled=!1;appearance="full";constructor(){}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=c({type:e,selectors:[["mat-pseudo-checkbox"]],hostAttrs:[1,"mat-pseudo-checkbox"],hostVars:12,hostBindings:function(t,o){t&2&&i("mat-pseudo-checkbox-indeterminate",o.state==="indeterminate")("mat-pseudo-checkbox-checked",o.state==="checked")("mat-pseudo-checkbox-disabled",o.disabled)("mat-pseudo-checkbox-minimal",o.appearance==="minimal")("mat-pseudo-checkbox-full",o.appearance==="full")("_mat-animation-noopable",o._animationsDisabled)},inputs:{state:"state",disabled:"disabled",appearance:"appearance"},decls:0,vars:0,template:function(t,o){},styles:[`.mat-pseudo-checkbox {
2
2
  border-radius: 2px;
3
3
  cursor: pointer;
4
4
  display: inline-block;
@@ -1 +1 @@
1
- import{c as y,d as S,e as k,g as E,k as R,o as B}from"./chunk-2UND4DAL.js";import"./chunk-T5UYZVNA.js";import"./chunk-FMYAA5JW.js";import{Dd as b,Ed as I,Gd as L,Hd as C,Ia as f,Id as w,Ja as u,Jd as P,La as e,Ma as a,R as s,S as g,Td as W,Ua as M,Wa as c,Wd as v,Ya as _,Yd as T,Zd as h,ja as l,lb as o,mb as D,nb as A,oa as r,ob as x,ra as p}from"./chunk-K2CIRFN7.js";import"./chunk-6H3I7D5M.js";var F=(n,i)=>i.extension+"/"+i.widget.id;function O(n,i){if(n&1){let t=M();e(0,"button",4),c("click",function(){let m=s(t).$implicit,j=_();return g(j.dialogRef.close(m))}),e(1,"span",5),o(2),a(),e(3,"span",6),o(4),a()()}if(n&2){let t=i.$implicit;l(2),D(t.widget.title),l(2),x("",t.extensionName," \xB7 ",t.widget.size)}}var N=class n{constructor(i,t){this.dialogRef=i;this.data=t;this.anchorLabel=B[t.anchor]}dialogRef;data;anchorLabel;static \u0275fac=function(t){return new(t||n)(r(b),r(I))};static \u0275cmp=p({type:n,selectors:[["fb-plotterext-add-widget"]],decls:12,vars:1,consts:[["mat-dialog-title","",1,"pe-add-title"],["mat-list-item",""],["align","end"],["mat-button","",3,"click"],["mat-list-item","",3,"click"],["matListItemTitle",""],["matListItemLine",""]],template:function(t,d){t&1&&(e(0,"div",0)(1,"mat-icon"),o(2,"widgets"),a(),e(3,"span"),o(4),a()(),e(5,"mat-dialog-content")(6,"mat-action-list"),f(7,O,5,3,"button",1,F),a()(),e(9,"mat-dialog-actions",2)(10,"button",3),c("click",function(){return d.dialogRef.close()}),o(11,"Cancel"),a()()),t&2&&(l(4),A("Add widget \u2014 ",d.anchorLabel),l(3),u(d.data.candidates))},dependencies:[P,L,w,C,v,W,h,T,R,k,E,S,y],styles:[".pe-add-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}"]})};export{N as PlotterAddWidgetDialog};
1
+ import{c as y,d as S,e as k,g as E,k as R,o as B}from"./chunk-WYYDGUIZ.js";import"./chunk-4ZE2OKZZ.js";import"./chunk-7TRKAN4B.js";import{Ed as b,Fd as I,Hd as L,Ia as f,Id as C,Ja as u,Jd as w,Kd as P,La as e,Ma as a,Md as W,Nd as v,R as s,S as g,Ua as M,Wa as c,Xd as T,Ya as _,_d as h,ja as l,lb as o,mb as D,nb as A,oa as r,ob as x,ra as p}from"./chunk-OPNUYGIO.js";import"./chunk-6H3I7D5M.js";var F=(n,i)=>i.extension+"/"+i.widget.id;function O(n,i){if(n&1){let t=M();e(0,"button",4),c("click",function(){let m=s(t).$implicit,j=_();return g(j.dialogRef.close(m))}),e(1,"span",5),o(2),a(),e(3,"span",6),o(4),a()()}if(n&2){let t=i.$implicit;l(2),D(t.widget.title),l(2),x("",t.extensionName," \xB7 ",t.widget.size)}}var N=class n{constructor(i,t){this.dialogRef=i;this.data=t;this.anchorLabel=B[t.anchor]}dialogRef;data;anchorLabel;static \u0275fac=function(t){return new(t||n)(r(b),r(I))};static \u0275cmp=p({type:n,selectors:[["fb-plotterext-add-widget"]],decls:12,vars:1,consts:[["mat-dialog-title","",1,"pe-add-title"],["mat-list-item",""],["align","end"],["mat-button","",3,"click"],["mat-list-item","",3,"click"],["matListItemTitle",""],["matListItemLine",""]],template:function(t,d){t&1&&(e(0,"div",0)(1,"mat-icon"),o(2,"widgets"),a(),e(3,"span"),o(4),a()(),e(5,"mat-dialog-content")(6,"mat-action-list"),f(7,O,5,3,"button",1,F),a()(),e(9,"mat-dialog-actions",2)(10,"button",3),c("click",function(){return d.dialogRef.close()}),o(11,"Cancel"),a()()),t&2&&(l(4),A("Add widget \u2014 ",d.anchorLabel),l(3),u(d.data.candidates))},dependencies:[P,L,w,C,h,T,v,W,R,k,E,S,y],styles:[".pe-add-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}"]})};export{N as PlotterAddWidgetDialog};
@@ -0,0 +1 @@
1
+ import{Ra as a}from"./chunk-L4FEUXHI.js";import"./chunk-WTDLBURC.js";import"./chunk-VJLDZ4NI.js";import"./chunk-PU7NCPYW.js";import"./chunk-N4UL6N3G.js";import"./chunk-AA62TGOR.js";import"./chunk-WCLDE6BT.js";import"./chunk-WYYDGUIZ.js";import"./chunk-4ZE2OKZZ.js";import"./chunk-7TRKAN4B.js";import"./chunk-OPNUYGIO.js";import"./chunk-6H3I7D5M.js";export{a as Trail2RouteDialog};
@@ -1 +1 @@
1
- import{L as f,c as u,vc as o}from"./chunk-K2CIRFN7.js";var d=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 u;constructor(e=!1,t,s=!0,n){this._multiple=e,this._emitChanges=s,this.compareWith=n,t&&t.length&&(e?t.forEach(i=>this._markSelected(i)):this._markSelected(t[0]),this._selectedToEmit.length=0)}select(...e){this._verifyValueAssignment(e),e.forEach(s=>this._markSelected(s));let t=this._hasQueuedChanges();return this._emitChangeEvent(),t}deselect(...e){this._verifyValueAssignment(e),e.forEach(s=>this._unmarkSelected(s));let t=this._hasQueuedChanges();return this._emitChangeEvent(),t}setSelection(...e){this._verifyValueAssignment(e);let t=this.selected,s=new Set(e.map(i=>this._getConcreteValue(i)));e.forEach(i=>this._markSelected(i)),t.filter(i=>!s.has(this._getConcreteValue(i,s))).forEach(i=>this._unmarkSelected(i));let n=this._hasQueuedChanges();return this._emitChangeEvent(),n}toggle(e){return this.isSelected(e)?this.deselect(e):this.select(e)}clear(e=!0){this._unmarkAll();let t=this._hasQueuedChanges();return e&&this._emitChangeEvent(),t}isSelected(e){return this._selection.has(this._getConcreteValue(e))}isEmpty(){return this._selection.size===0}hasValue(){return!this.isEmpty()}sort(e){this._multiple&&this.selected&&this._selected.sort(e)}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(e){e=this._getConcreteValue(e),this.isSelected(e)||(this._multiple||this._unmarkAll(),this.isSelected(e)||this._selection.add(e),this._emitChanges&&this._selectedToEmit.push(e))}_unmarkSelected(e){e=this._getConcreteValue(e),this.isSelected(e)&&(this._selection.delete(e),this._emitChanges&&this._deselectedToEmit.push(e))}_unmarkAll(){this.isEmpty()||this._selection.forEach(e=>this._unmarkSelected(e))}_verifyValueAssignment(e){e.length>1&&this._multiple}_hasQueuedChanges(){return!!(this._deselectedToEmit.length||this._selectedToEmit.length)}_getConcreteValue(e,t){if(this.compareWith){t=t??this._selection;for(let s of t)if(this.compareWith(e,s))return s;return e}else return e}};var p=(()=>{class r{_listeners=[];notify(t,s){for(let n of this._listeners)n(t,s)}listen(t){return this._listeners.push(t),()=>{this._listeners=this._listeners.filter(s=>t!==s)}}ngOnDestroy(){this._listeners=[]}static \u0275fac=function(s){return new(s||r)};static \u0275prov=f({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var g=class{applyChanges(e,t,s,n,i){e.forEachOperation((c,a,_)=>{let h,l;if(c.previousIndex==null){let m=s(c,a,_);h=t.createEmbeddedView(m.templateRef,m.context,m.index),l=o.INSERTED}else _==null?(t.remove(a),l=o.REMOVED):(h=t.get(a),t.move(h,_),l=o.MOVED);i&&i({context:h?.context,operation:l,record:c})})}detach(){}};export{d as a,p as b,g as c};
1
+ import{L as f,c as u,wc as o}from"./chunk-OPNUYGIO.js";var d=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 u;constructor(e=!1,t,s=!0,n){this._multiple=e,this._emitChanges=s,this.compareWith=n,t&&t.length&&(e?t.forEach(i=>this._markSelected(i)):this._markSelected(t[0]),this._selectedToEmit.length=0)}select(...e){this._verifyValueAssignment(e),e.forEach(s=>this._markSelected(s));let t=this._hasQueuedChanges();return this._emitChangeEvent(),t}deselect(...e){this._verifyValueAssignment(e),e.forEach(s=>this._unmarkSelected(s));let t=this._hasQueuedChanges();return this._emitChangeEvent(),t}setSelection(...e){this._verifyValueAssignment(e);let t=this.selected,s=new Set(e.map(i=>this._getConcreteValue(i)));e.forEach(i=>this._markSelected(i)),t.filter(i=>!s.has(this._getConcreteValue(i,s))).forEach(i=>this._unmarkSelected(i));let n=this._hasQueuedChanges();return this._emitChangeEvent(),n}toggle(e){return this.isSelected(e)?this.deselect(e):this.select(e)}clear(e=!0){this._unmarkAll();let t=this._hasQueuedChanges();return e&&this._emitChangeEvent(),t}isSelected(e){return this._selection.has(this._getConcreteValue(e))}isEmpty(){return this._selection.size===0}hasValue(){return!this.isEmpty()}sort(e){this._multiple&&this.selected&&this._selected.sort(e)}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(e){e=this._getConcreteValue(e),this.isSelected(e)||(this._multiple||this._unmarkAll(),this.isSelected(e)||this._selection.add(e),this._emitChanges&&this._selectedToEmit.push(e))}_unmarkSelected(e){e=this._getConcreteValue(e),this.isSelected(e)&&(this._selection.delete(e),this._emitChanges&&this._deselectedToEmit.push(e))}_unmarkAll(){this.isEmpty()||this._selection.forEach(e=>this._unmarkSelected(e))}_verifyValueAssignment(e){e.length>1&&this._multiple}_hasQueuedChanges(){return!!(this._deselectedToEmit.length||this._selectedToEmit.length)}_getConcreteValue(e,t){if(this.compareWith){t=t??this._selection;for(let s of t)if(this.compareWith(e,s))return s;return e}else return e}};var p=(()=>{class r{_listeners=[];notify(t,s){for(let n of this._listeners)n(t,s)}listen(t){return this._listeners.push(t),()=>{this._listeners=this._listeners.filter(s=>t!==s)}}ngOnDestroy(){this._listeners=[]}static \u0275fac=function(s){return new(s||r)};static \u0275prov=f({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var g=class{applyChanges(e,t,s,n,i){e.forEachOperation((c,a,_)=>{let h,l;if(c.previousIndex==null){let m=s(c,a,_);h=t.createEmbeddedView(m.templateRef,m.context,m.index),l=o.INSERTED}else _==null?(t.remove(a),l=o.REMOVED):(h=t.get(a),t.move(h,_),l=o.MOVED);i&&i({context:h?.context,operation:l,record:c})})}detach(){}};export{d as a,p as b,g as c};
@@ -1,4 +1,4 @@
1
- import{Za as l,_a as o,ib as r,ra as a}from"./chunk-K2CIRFN7.js";var d=["mat-internal-form-field",""],f=["*"],g=(()=>{class t{labelPosition="after";static \u0275fac=function(n){return new(n||t)};static \u0275cmp=a({type:t,selectors:[["div","mat-internal-form-field",""]],hostAttrs:[1,"mdc-form-field","mat-internal-form-field"],hostVars:2,hostBindings:function(n,e){n&2&&r("mdc-form-field--align-end",e.labelPosition==="before")},inputs:{labelPosition:"labelPosition"},attrs:d,ngContentSelectors:f,decls:1,vars:0,template:function(n,e){n&1&&(l(),o(0))},styles:[`.mat-internal-form-field {
1
+ import{Za as l,_a as o,ib as r,ra as a}from"./chunk-OPNUYGIO.js";var d=["mat-internal-form-field",""],f=["*"],g=(()=>{class t{labelPosition="after";static \u0275fac=function(n){return new(n||t)};static \u0275cmp=a({type:t,selectors:[["div","mat-internal-form-field",""]],hostAttrs:[1,"mdc-form-field","mat-internal-form-field"],hostVars:2,hostBindings:function(n,e){n&2&&r("mdc-form-field--align-end",e.labelPosition==="before")},inputs:{labelPosition:"labelPosition"},attrs:d,ngContentSelectors:f,decls:1,vars:0,template:function(n,e){n&1&&(l(),o(0))},styles:[`.mat-internal-form-field {
2
2
  -moz-osx-font-smoothing: grayscale;
3
3
  -webkit-font-smoothing: antialiased;
4
4
  display: inline-flex;
@@ -0,0 +1 @@
1
+ import{m as a,n as b,o as c,p as d,q as e,r as f}from"./chunk-VJLDZ4NI.js";import"./chunk-AA62TGOR.js";import"./chunk-WCLDE6BT.js";import"./chunk-OPNUYGIO.js";import"./chunk-6H3I7D5M.js";export{d as AboutDialog,b as AlertDialog,c as ConfirmDialog,e as LoginDialog,f as MessageBarComponent,a as MsgBox};
@@ -0,0 +1 @@
1
+ import{Qa as a}from"./chunk-L4FEUXHI.js";import"./chunk-WTDLBURC.js";import"./chunk-VJLDZ4NI.js";import"./chunk-PU7NCPYW.js";import"./chunk-N4UL6N3G.js";import"./chunk-AA62TGOR.js";import"./chunk-WCLDE6BT.js";import"./chunk-WYYDGUIZ.js";import"./chunk-4ZE2OKZZ.js";import"./chunk-7TRKAN4B.js";import"./chunk-OPNUYGIO.js";import"./chunk-6H3I7D5M.js";export{a as GeoJSONImportDialog};
@@ -0,0 +1 @@
1
+ import{j as a}from"./chunk-PU7NCPYW.js";import"./chunk-N4UL6N3G.js";import"./chunk-AA62TGOR.js";import"./chunk-WCLDE6BT.js";import"./chunk-4ZE2OKZZ.js";import"./chunk-7TRKAN4B.js";import"./chunk-OPNUYGIO.js";import"./chunk-6H3I7D5M.js";export{a as PlaybackDialog};
@@ -0,0 +1 @@
1
+ import{H as z}from"./chunk-L4FEUXHI.js";import"./chunk-WTDLBURC.js";import"./chunk-VJLDZ4NI.js";import"./chunk-PU7NCPYW.js";import"./chunk-N4UL6N3G.js";import"./chunk-AA62TGOR.js";import"./chunk-WCLDE6BT.js";import"./chunk-WYYDGUIZ.js";import"./chunk-4ZE2OKZZ.js";import"./chunk-7TRKAN4B.js";import{Ea as m,Ed as C,Fa as d,Fd as w,Hd as S,Id as R,Jd as E,Ka as _,Kd as O,La as a,Ma as o,Md as T,Na as v,Nd as A,R as f,S as u,Ua as D,Vd as k,Wa as p,Xd as j,Ya as g,_d as V,ab as b,bb as x,cb as y,ha as h,ja as s,lb as r,lc as I,mb as M,oa as c,ra as P}from"./chunk-OPNUYGIO.js";import"./chunk-6H3I7D5M.js";var U=["frame"];function Q(n,e){if(n&1&&(a(0,"mat-dialog-content",3),v(1,"iframe",6,0),o()),n&2){let t=g();s(),_("src",t.url,h)("title",t.data.panel.title)}}function B(n,e){n&1&&(a(0,"mat-dialog-content",4),r(1," This widget has no settings. "),o())}function F(n,e){if(n&1){let t=D();a(0,"mat-dialog-actions",5)(1,"button",7),p("click",function(){f(t);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(e,t,i,l){this.dialogRef=e;this.data=t;this.service=i;this.sanitizer=l}dialogRef;data;service;sanitizer;frame;url;detach=null;ngOnInit(){let e=this.data.panel;e&&(this.url=this.sanitizer.bypassSecurityTrustResourceUrl(e.url?this.service.resolveAssetUrl(e.url):"about:blank"))}ngAfterViewInit(){let e=this.data.panel;!e||!this.frame||(this.detach=this.service.attachPanel(this.frame.nativeElement,{extension:this.data.extension,panel:e,targetInstance:this.data.targetInstance,targetWidget:this.data.targetWidget,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(t){return new(t||n)(c(C),c(w),c(z),c(I))};static \u0275cmp=P({type:n,selectors:[["fb-plotterext-panel-dialog"]],viewQuery:function(t,i){if(t&1&&b(U,5),t&2){let l;x(l=y())&&(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(t,i){t&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)),t&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:[O,S,E,R,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};
@@ -0,0 +1 @@
1
+ import{a as Ie,b as O,c as Ae,d as Ke,e as Be}from"./chunk-4JRVRHO7.js";import{Ea as Re,Fa as Oe,Ga as Ge,Ha as Fe,Ia as Xe,Ja as We,K as Se,Sa as Ve,U as Pe,V as Me,W as De,d as ee,i as _e,j as ye,k as ke,l as Ce,m as ve,p as Ee,q as R}from"./chunk-L4FEUXHI.js";import{a as be,b as Te,c as we}from"./chunk-WTDLBURC.js";import{j as oe,k as re,l as se}from"./chunk-VJLDZ4NI.js";import{a as he,b as ge,d as xe}from"./chunk-PU7NCPYW.js";import{a as fe}from"./chunk-N4UL6N3G.js";import"./chunk-AA62TGOR.js";import{b as le,i as ce,j as pe,n as de,o as me}from"./chunk-WCLDE6BT.js";import{b as ue}from"./chunk-WYYDGUIZ.js";import"./chunk-4ZE2OKZZ.js";import"./chunk-7TRKAN4B.js";import{Ea as f,Ed as j,Fa as _,Fd as N,Ha as V,Ia as T,Id as U,Ja as w,Ka as g,Kd as z,L as B,La as r,Ma as s,Md as q,Na as L,Nd as Q,P as b,R as m,S as u,Ua as y,Vd as Y,Wa as h,Xd as J,Ya as d,_d as Z,ae as te,c as A,fe as ie,gb as E,ie as ae,ja as c,k as K,lb as l,mb as H,nb as S,oa as C,pb as P,qb as M,qe as ne,ra as $,rb as D}from"./chunk-OPNUYGIO.js";import{f as v}from"./chunk-6H3I7D5M.js";var G=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 Ae;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=Ee(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 Ke;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,p)=>{let x=new Be;n.forEach((W,He)=>{let k=new O;k.lon=W[0],k.lat=W[1],k.ele=W[2]||null;let I=a?.[p]?.[He];I&&(k.datetime=new Date(I)),x.trkpt.push(k),this.gpx.updateBounds(k)}),t.trkseg.push(x)}),t}};var F=class o{resultSource;result$;sk2gpx;hasFSA;signalk=b(R);constructor(){this.resultSource=new A,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){this.sk2gpx=new G;let t={},a={},n={};for(let p=0;p<e.rte.selected.length;p++)e.rte.selected[p]&&(t[i.routes[p].feature.id]=i.routes[p]);this.sk2gpx.setRoutes(t);for(let p=0;p<e.wpt.selected.length;p++)e.wpt.selected[p]&&(a[i.waypoints[p].feature.id]=i.waypoints[p]);this.sk2gpx.setWaypoints(a),(e.trk.tracks??[]).forEach(p=>{let x=this.signalk.uuid;n[x]=We(x,p)}),this.sk2gpx.setTracks(n),this.hasFSA?this.fsaSaveFile():this.legacySaveToFile()}legacySaveToFile(){let i=new Blob([this.sk2gpx.toXML()],{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.sk2gpx.toXML()]);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),h("change",function(){let a=m(e).$index,n=E(5),p=d(2);return u(p.checkWpt(n.checked,a))}),s()()()}if(o&2){let e=i.$implicit,t=i.$index,a=d(2);c(2),H(e.name),c(2),g("checked",a.selWaypoints[t])}}function Qe(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),h("opened",function(){m(e);let a=d();return u(a.display.expand.waypoints=!0)})("closed",function(){m(e);let a=d();return u(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),h("change",function(a){m(e);let n=d();return u(n.checkWpt(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),T(13,qe,6,2,"div",19,V),s()()()}if(o&2){let e=d();c(),g("expanded",e.display.expand.waypoints),c(10),g("indeterminate",e.display.someWptChecked)("checked",e.display.allWaypointsChecked)("disabled",e.resData.waypoints.length===0),c(2),w(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),h("change",function(){let a=m(e).$index,n=E(7),p=d(2);return u(p.checkRte(n.checked,a))}),s()()()}if(o&2){let e=i.$implicit,t=i.$index,a=d(2);c(4),S(" ",e.name," "),c(2),g("checked",a.selRoutes[t])}}function Je(o,i){if(o&1){let e=y();r(0,"div",12)(1,"mat-expansion-panel",13),h("opened",function(){m(e);let a=d();return u(a.display.expand.routes=!0)})("closed",function(){m(e);let a=d();return u(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),h("change",function(a){m(e);let n=d();return u(n.checkRte(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),T(13,Ye,8,2,"div",19,V),s()()()}if(o&2){let e=d();c(),g("expanded",e.display.expand.routes),c(10),g("indeterminate",e.display.someRteChecked)("checked",e.display.allRoutesChecked)("disabled",e.resData.routes.length==0),c(2),w(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),h("change",function(){let a=m(e).$index,n=E(7),p=d(2);return u(p.checkTrk(n.checked,a))}),s()()(),f(8,Ze,2,0,"div",30)}if(o&2){let e=i.$implicit,t=i.$index,a=d(2);c(4),S(" ",e.label," "),c(2),g("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),D("ngModelChange",function(a){m(e);let n=d(3);return M(n.customFrom,a)||(n.customFrom=a),u(a)}),s()(),r(5,"mat-form-field")(6,"mat-label"),l(7,"To"),s(),r(8,"input",40),D("ngModelChange",function(a){m(e);let n=d(3);return M(n.customTo,a)||(n.customTo=a),u(a)}),s()()(),f(9,it,2,0,"div",30)}if(o&2){let e=d(3);c(4),P("ngModel",e.customFrom),c(4),P("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),D("ngModelChange",function(a){m(e);let n=d(2);return M(n.trackChoice,a)||(n.trackChoice=a),u(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=d(2);c(4),P("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),h("opened",function(){m(e);let a=d();return u(a.display.expand.tracks=!0)})("closed",function(){m(e);let a=d();return u(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),h("change",function(a){m(e);let n=d();return u(n.checkTrk(a.checked,-1))})("click",function(a){return a.cancelBubble=!0}),s()()()(),r(12,"div",18),T(13,et,9,3,null,null,Ue),s(),f(15,ot,18,3,"div",28),s()()}if(o&2){let e=d();c(),g("expanded",e.display.expand.tracks),c(10),g("indeterminate",e.display.someTrkChecked)("checked",e.display.allTracksChecked)("disabled",e.resData.tracks.length==0),c(2),w(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 X(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=b(R);trackHistory=b(De);selRoutes=[];selectedRoute=null;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 v(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:X(this.customFrom),to:X(this.customTo)}})}get customInvalid(){return this.trackChoice==="custom"&&!Oe({from:X(this.customFrom),to:X(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 v(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 v(this,null,function*(){let i=this.resData.tracks.filter((n,p)=>this.selTracks[p]);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 p=e===null?n.displayed:yield this.fetchTrack(n.context,e),x=Xe(n.label,p,t);if(!x)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(x)}}finally{this.fetching=!1}return a})}fetchTrack(i,e){return v(this,null,function*(){let t=this.app.trackSource()?.provider,a=this.signalk.api.get(2,`/tracks?${Ge(i,e,t)}`);if(!a)throw new Error("Not connected");let n=yield K(a),p=ee(i,n,t);return{lines:p?.lines??[],times:p?.times??(p?.lines??[]).map(x=>x.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||Fe(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)(C(Ve),C(Se),C(F),C(j),C(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),h("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),h("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),g("disabled",!t.canSave),c(5),S(" ",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,Me,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,X as fromLocalInput,$e as toLocalInput};