@chrtco/sdk 0.10.2 → 0.10.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.
package/dist/index.cjs CHANGED
@@ -40,6 +40,7 @@ __export(index_exports, {
40
40
  CHRT_ICON_EXPRESSIONS: () => CHRT_ICON_EXPRESSIONS,
41
41
  CHRT_ICON_PREFIX: () => CHRT_ICON_PREFIX,
42
42
  CHRT_SDF_GLYPHS: () => CHRT_SDF_GLYPHS,
43
+ CHRT_STYLE_MODES: () => CHRT_STYLE_MODES,
43
44
  Chrt: () => Chrt,
44
45
  ChrtError: () => ChrtError,
45
46
  DEFAULT_CLICK_TOLERANCE: () => DEFAULT_CLICK_TOLERANCE,
@@ -95,6 +96,7 @@ __export(index_exports, {
95
96
  TileAuth: () => TileAuth,
96
97
  TileTokenError: () => TileTokenError,
97
98
  WATER_BODY_LAYER_GROUPS: () => WATER_BODY_LAYER_GROUPS,
99
+ WeatherEndpoint: () => WeatherEndpoint,
98
100
  applyChrtSymbolSet: () => applyChrtSymbolSet,
99
101
  applyColorTheme: () => applyColorTheme,
100
102
  applyCustomStyleSettings: () => applyCustomStyleSettings,
@@ -169,6 +171,7 @@ __export(index_exports, {
169
171
  lightColor: () => lightColor,
170
172
  lightFillExpression: () => lightFillExpression,
171
173
  lightsIconExpression: () => lightsIconExpression,
174
+ normalizeStyleMode: () => normalizeStyleMode,
172
175
  normalizeTheme: () => normalizeTheme,
173
176
  paginate: () => paginate,
174
177
  parseListCodes: () => parseListCodes,
@@ -189,6 +192,7 @@ __export(index_exports, {
189
192
  sanitizeCustomStyleConfig: () => sanitizeCustomStyleConfig,
190
193
  scaleSizeValue: () => scaleSizeValue,
191
194
  scaminToMinZoom: () => scaminToMinZoom,
195
+ styleModeBand: () => styleModeBand,
192
196
  withinBboxFilter: () => withinBboxFilter,
193
197
  worldMinusBboxPolygon: () => worldMinusBboxPolygon
194
198
  });
@@ -536,10 +540,11 @@ var TilesEndpoint = class {
536
540
  }
537
541
  region;
538
542
  tileBaseUrl;
539
- styleEndpoint(theme, symbols) {
543
+ styleEndpoint(opts) {
540
544
  const params = new URLSearchParams();
541
- if (theme) params.set("theme", theme);
542
- if (symbols) params.set("symbols", symbols);
545
+ if (opts.theme) params.set("theme", opts.theme);
546
+ if (opts.symbols) params.set("symbols", opts.symbols);
547
+ if (opts.mode) params.set("mode", opts.mode);
543
548
  const query2 = params.size > 0 ? `?${params.toString()}` : "";
544
549
  return `${this.tileBaseUrl}/v1/styles/${this.region}/style.json${query2}`;
545
550
  }
@@ -565,7 +570,7 @@ var TilesEndpoint = class {
565
570
  */
566
571
  async styleUrl(opts = {}) {
567
572
  await this.tileAuth.getToken(this.region);
568
- return this.styleEndpoint(opts.theme, opts.symbols);
573
+ return this.styleEndpoint(opts);
569
574
  }
570
575
  /**
571
576
  * Fetch the served S-52 style as a MapLibre style object (see
@@ -579,7 +584,7 @@ var TilesEndpoint = class {
579
584
  */
580
585
  async fetchStyle(opts = {}) {
581
586
  const token = await this.tileAuth.getToken(this.region);
582
- const res = await fetch(this.styleEndpoint(opts.theme, opts.symbols), {
587
+ const res = await fetch(this.styleEndpoint(opts), {
583
588
  headers: { authorization: `Bearer ${token.token}` },
584
589
  signal: opts.signal
585
590
  });
@@ -643,6 +648,79 @@ var CellsEndpoint = class {
643
648
  }
644
649
  };
645
650
 
651
+ // src/endpoints/weather.ts
652
+ var WeatherEndpoint = class {
653
+ constructor(http) {
654
+ this.http = http;
655
+ }
656
+ /**
657
+ * Observed conditions from the nearest reporting NOAA NDBC station.
658
+ *
659
+ * A **measurement, not a forecast**, and not live — most buoys report hourly
660
+ * and the median observation is around 40 minutes old. `observed.ageMinutes`
661
+ * is on every response and should be displayed: a readout that looks current
662
+ * but is 90 minutes stale is worse than one that says so.
663
+ *
664
+ * `unavailable` names every field the station did not report, so absence is
665
+ * stated rather than inferred from a missing key.
666
+ */
667
+ async conditions(options) {
668
+ return this.http.request(
669
+ "/weather/conditions",
670
+ {
671
+ lat: options.lat,
672
+ lon: options.lon,
673
+ units: options.units,
674
+ station: options.station
675
+ },
676
+ options.signal
677
+ );
678
+ }
679
+ /**
680
+ * Active NWS marine warnings for the zone — Small Craft Advisory, Gale,
681
+ * Storm, Hurricane Force Wind, Special Marine Warning. Most severe first.
682
+ *
683
+ * Its own call, so warnings can be re-checked cheaply (~60 s) without pulling
684
+ * a forecast you already have.
685
+ *
686
+ * **`expires` and `ends` are different.** `expires` is when the *bulletin*
687
+ * lapses — alerts are usually re-issued before then. `ends` is when the
688
+ * *hazard* is expected to be over. They are routinely hours apart, so
689
+ * describe the hazard with `ends` and use `expires` only to decide when to
690
+ * re-fetch.
691
+ *
692
+ * Display `instruction` verbatim: it is NWS's own advice to mariners.
693
+ */
694
+ async alerts(options) {
695
+ return this.http.request(
696
+ "/weather/marine-alerts",
697
+ { lat: options.lat, lon: options.lon, zone: options.zone },
698
+ options.signal
699
+ );
700
+ }
701
+ /**
702
+ * The NWS marine zone forecast — U.S. coastal and Great Lakes waters.
703
+ *
704
+ * Periods are NWS's own and are **neither hourly nor uniform**: `OVERNIGHT`,
705
+ * `TUE NIGHT`, `WED NIGHT THROUGH THU NIGHT`. A single period can span days.
706
+ * Flattening them into an hourly series invents resolution the data does not
707
+ * have.
708
+ *
709
+ * `expires` is the forecast's **own** stated validity, taken from the
710
+ * bulletin, not a TTL CHRT invented. `source.productId` identifies the
711
+ * upstream NWS product, so you can verify CHRT against NOAA directly.
712
+ *
713
+ * Offshore zones are not yet supported and fail with `501`.
714
+ */
715
+ async forecast(options) {
716
+ return this.http.request(
717
+ "/weather/marine-forecast",
718
+ { lat: options.lat, lon: options.lon, zone: options.zone },
719
+ options.signal
720
+ );
721
+ }
722
+ };
723
+
646
724
  // src/endpoints/coverage.ts
647
725
  var METRES_PER_NAUTICAL_MILE = 1852;
648
726
  var CoverageEndpoint = class {
@@ -1154,7 +1232,9 @@ var OfflineEndpoint = class {
1154
1232
  const token = await this.requireToken([region]);
1155
1233
  const palette = opts.palette ?? "DAY";
1156
1234
  const protocol = opts.protocol ?? "mbtiles";
1157
- const path = `/offline/styles/${encodeURIComponent(region)}?palette=${palette}&protocol=${protocol}`;
1235
+ const symbolsParam = opts.symbols ? `&symbols=${encodeURIComponent(opts.symbols)}` : "";
1236
+ const modeParam = opts.mode ? `&mode=${encodeURIComponent(opts.mode)}` : "";
1237
+ const path = `/offline/styles/${encodeURIComponent(region)}?palette=${palette}&protocol=${protocol}${symbolsParam}${modeParam}`;
1158
1238
  const res = await this.http.getJsonWithBearer(
1159
1239
  path,
1160
1240
  token.token
@@ -1499,157 +1579,519 @@ function dirname(p) {
1499
1579
  return p.slice(0, k);
1500
1580
  }
1501
1581
 
1502
- // src/interact/decode.ts
1503
- var LITCHR_TABLE = {
1504
- 1: { name: "Fixed", abbr: "F" },
1505
- 2: { name: "Flashing", abbr: "Fl" },
1506
- 3: { name: "Long Flashing", abbr: "LFl" },
1507
- 4: { name: "Occulting", abbr: "Oc" },
1508
- 5: { name: "Isophase", abbr: "Iso" },
1509
- 6: { name: "Short Flashing", abbr: "S.Fl" },
1510
- 7: { name: "Short Long Flashing", abbr: "S.LFl" },
1511
- 8: { name: "Alternating Occulting", abbr: "Al.Oc" },
1512
- 9: { name: "Alternating Long Flashing", abbr: "Al.LFl" },
1513
- 10: { name: "Alternating Flashing", abbr: "Al.Fl" },
1514
- 11: { name: "Alternating Group", abbr: "Al.Gp" },
1515
- 12: { name: "Morse", abbr: "Mo" },
1516
- 13: { name: "Quick", abbr: "Q" },
1517
- 14: { name: "Very Quick", abbr: "VQ" },
1518
- 15: { name: "Ultra Quick", abbr: "UQ" },
1519
- 16: { name: "Alternating", abbr: "Al" },
1520
- 17: { name: "Alternating Fixed/Flash", abbr: "Al.F.Fl" },
1521
- 25: { name: "Quick + Long Flash", abbr: "Q+LFl" },
1522
- 26: { name: "Very Quick + Long Flash", abbr: "VQ+LFl" },
1523
- 27: { name: "Ultra Quick + Long Flash", abbr: "UQ+LFl" },
1524
- 28: { name: "Alternating", abbr: "Al" },
1525
- 29: { name: "Fixed + Long Flash", abbr: "F.LFl" }
1582
+ // src/s57/codelists.generated.ts
1583
+ var BOYSHP_CODES = {
1584
+ 1: { code: 1, name: "Conical (nun, ogival)" },
1585
+ 2: { code: 2, name: "Can (cylindrical)" },
1586
+ 3: { code: 3, name: "Spherical" },
1587
+ 4: { code: 4, name: "Pillar" },
1588
+ 5: { code: 5, name: "Spar (spindle)" },
1589
+ 6: { code: 6, name: "Barrel (tun)" },
1590
+ 7: { code: 7, name: "Super-buoy" },
1591
+ 8: { code: 8, name: "Ice buoy" }
1592
+ };
1593
+ var CATACH_CODES = {
1594
+ 1: { code: 1, name: "Unrestricted anchorage" },
1595
+ 2: { code: 2, name: "Deep water anchorage" },
1596
+ 3: { code: 3, name: "Tanker anchorage" },
1597
+ 4: { code: 4, name: "Explosives anchorage" },
1598
+ 5: { code: 5, name: "Quarantine anchorage" },
1599
+ 6: { code: 6, name: "Sea-plane anchorage" },
1600
+ 7: { code: 7, name: "Small craft anchorage" },
1601
+ 8: { code: 8, name: "Small craft mooring area" },
1602
+ 9: { code: 9, name: "Anchorage for periods up to 24 hours" }
1603
+ };
1604
+ var CATCAM_CODES = {
1605
+ 1: { code: 1, name: "North cardinal mark" },
1606
+ 2: { code: 2, name: "East cardinal mark" },
1607
+ 3: { code: 3, name: "South cardinal mark" },
1608
+ 4: { code: 4, name: "West cardinal mark" }
1609
+ };
1610
+ var CATCBL_CODES = {
1611
+ 1: { code: 1, name: "Power line" },
1612
+ 2: { code: 2, name: "Submarine cable", supplement: true, unverified: true },
1613
+ 3: { code: 3, name: "Transmission line" },
1614
+ 4: { code: 4, name: "Telephone" },
1615
+ 5: { code: 5, name: "Telegraph" },
1616
+ 6: { code: 6, name: "Mooring cable/chain" }
1617
+ };
1618
+ var CATCOA_CODES = {
1619
+ 1: { code: 1, name: "Steep coast" },
1620
+ 2: { code: 2, name: "Flat coast" },
1621
+ 3: { code: 3, name: "Sandy shore" },
1622
+ 4: { code: 4, name: "Stony shore" },
1623
+ 5: { code: 5, name: "Shingly shore" },
1624
+ 6: { code: 6, name: "Glacier (seaward end)" },
1625
+ 7: { code: 7, name: "Mangrove" },
1626
+ 8: { code: 8, name: "Marshy shore" },
1627
+ 9: { code: 9, name: "Coral reef" },
1628
+ 10: { code: 10, name: "Ice coast" },
1629
+ 11: { code: 11, name: "Embankment", supplement: true, unverified: true }
1630
+ };
1631
+ var CATCRN_CODES = {
1632
+ 2: { code: 2, name: "Container crane/gantry" },
1633
+ 3: { code: 3, name: "Sheerlegs" },
1634
+ 4: { code: 4, name: "Travelling crane" },
1635
+ 5: { code: 5, name: "A-frame" }
1636
+ };
1637
+ var CATDPG_CODES = {
1638
+ 1: { code: 1, name: "General dumping ground", supplement: true, unverified: true },
1639
+ 2: { code: 2, name: "Chemical waste dumping ground" },
1640
+ 3: { code: 3, name: "Nuclear waste dumping ground" },
1641
+ 4: { code: 4, name: "Explosives dumping ground" },
1642
+ 5: { code: 5, name: "Spoil ground" },
1643
+ 6: { code: 6, name: "Vessel dumping ground" }
1644
+ };
1645
+ var CATFOG_CODES = {
1646
+ 1: { code: 1, name: "Explosive", abbr: "EXPLOS" },
1647
+ 2: { code: 2, name: "Diaphone", abbr: "DIA" },
1648
+ 3: { code: 3, name: "Siren", abbr: "SIREN" },
1649
+ 4: { code: 4, name: "Nautophone", abbr: "NAUTO" },
1650
+ 5: { code: 5, name: "Reed", abbr: "REED" },
1651
+ 6: { code: 6, name: "Tyfon", abbr: "TYFON" },
1652
+ 7: { code: 7, name: "Bell", abbr: "BELL" },
1653
+ 8: { code: 8, name: "Whistle", abbr: "WHIS" },
1654
+ 9: { code: 9, name: "Gong", abbr: "GONG" },
1655
+ 10: { code: 10, name: "Horn", abbr: "HORN" }
1656
+ };
1657
+ var CATHAF_CODES = {
1658
+ 1: { code: 1, name: "RoRo-terminal" },
1659
+ 3: { code: 3, name: "Ferry terminal" },
1660
+ 4: { code: 4, name: "Fishing harbour" },
1661
+ 5: { code: 5, name: "Yacht harbour/marina" },
1662
+ 6: { code: 6, name: "Naval base" },
1663
+ 7: { code: 7, name: "Tanker terminal" },
1664
+ 8: { code: 8, name: "Passenger terminal" },
1665
+ 9: { code: 9, name: "Shipyard" },
1666
+ 10: { code: 10, name: "Container terminal" },
1667
+ 11: { code: 11, name: "Bulk terminal" },
1668
+ 12: { code: 12, name: "Synchrolift", supplement: true, unverified: true },
1669
+ 13: { code: 13, name: "Straddle carrier", supplement: true, unverified: true },
1670
+ 14: { code: 14, name: "Port terminal", supplement: true, unverified: true }
1671
+ };
1672
+ var CATLAM_CODES = {
1673
+ 1: { code: 1, name: "Port-hand lateral mark" },
1674
+ 2: { code: 2, name: "Starboard-hand lateral mark" },
1675
+ 3: { code: 3, name: "Preferred channel to starboard lateral mark" },
1676
+ 4: { code: 4, name: "Preferred channel to port lateral mark" }
1677
+ };
1678
+ var CATLIT_CODES = {
1679
+ 1: { code: 1, name: "Directional function" },
1680
+ 4: { code: 4, name: "Leading light" },
1681
+ 5: { code: 5, name: "Aero light" },
1682
+ 6: { code: 6, name: "Air obstruction light" },
1683
+ 7: { code: 7, name: "Fog detector light" },
1684
+ 8: { code: 8, name: "Flood light" },
1685
+ 9: { code: 9, name: "Strip light" },
1686
+ 10: { code: 10, name: "Subsidiary light" },
1687
+ 11: { code: 11, name: "Spotlight" },
1688
+ 12: { code: 12, name: "Front" },
1689
+ 13: { code: 13, name: "Rear" },
1690
+ 14: { code: 14, name: "Lower" },
1691
+ 15: { code: 15, name: "Upper" },
1692
+ 16: { code: 16, name: "Moir\xE9 effect" },
1693
+ 17: { code: 17, name: "Emergency" },
1694
+ 18: { code: 18, name: "Bearing light" },
1695
+ 19: { code: 19, name: "Horizontally disposed" },
1696
+ 20: { code: 20, name: "Vertically disposed" }
1697
+ };
1698
+ var CATLMK_CODES = {
1699
+ 1: { code: 1, name: "Cairn" },
1700
+ 2: { code: 2, name: "Cemetery" },
1701
+ 3: { code: 3, name: "Chimney" },
1702
+ 4: { code: 4, name: "Dish aerial" },
1703
+ 5: { code: 5, name: "Flagstaff (flagpole)" },
1704
+ 6: { code: 6, name: "Flare stack" },
1705
+ 7: { code: 7, name: "Mast" },
1706
+ 8: { code: 8, name: "Windsock" },
1707
+ 9: { code: 9, name: "Monument" },
1708
+ 10: { code: 10, name: "Column (pillar)" },
1709
+ 11: { code: 11, name: "Memorial plaque" },
1710
+ 12: { code: 12, name: "Obelisk" },
1711
+ 13: { code: 13, name: "Statue" },
1712
+ 14: { code: 14, name: "Cross" },
1713
+ 15: { code: 15, name: "Dome" },
1714
+ 16: { code: 16, name: "Radar scanner" },
1715
+ 17: { code: 17, name: "Tower" },
1716
+ 18: { code: 18, name: "Windmill" },
1717
+ 19: { code: 19, name: "Windmotor" },
1718
+ 20: { code: 20, name: "Spire/minaret" }
1719
+ };
1720
+ var CATMFA_CODES = {
1721
+ 1: { code: 1, name: "Crustaceans" },
1722
+ 2: { code: 2, name: "Oyster/mussels" },
1723
+ 3: { code: 3, name: "Fish" },
1724
+ 4: { code: 4, name: "Seaweed" },
1725
+ 5: { code: 5, name: "Seaweed / kelp farm", supplement: true, unverified: true }
1726
+ };
1727
+ var CATOBS_CODES = {
1728
+ 1: { code: 1, name: "Snag / stump" },
1729
+ 2: { code: 2, name: "Wellhead" },
1730
+ 3: { code: 3, name: "Diffuser" },
1731
+ 4: { code: 4, name: "Crib" },
1732
+ 5: { code: 5, name: "Fish haven" },
1733
+ 6: { code: 6, name: "Foul area" },
1734
+ 7: { code: 7, name: "Foul ground" },
1735
+ 8: { code: 8, name: "Ice boom" },
1736
+ 9: { code: 9, name: "Ground tackle" },
1737
+ 10: { code: 10, name: "Boom", supplement: true, unverified: true },
1738
+ 11: { code: 11, name: "Platform", supplement: true, unverified: true }
1739
+ };
1740
+ var CATPIP_CODES = {
1741
+ 1: { code: 1, name: "Pipeline in general", supplement: true, unverified: true },
1742
+ 2: { code: 2, name: "Outfall pipe" },
1743
+ 3: { code: 3, name: "Intake pipe" },
1744
+ 4: { code: 4, name: "Sewer" },
1745
+ 5: { code: 5, name: "Bubbler system" },
1746
+ 6: { code: 6, name: "Supply pipe" }
1526
1747
  };
1527
- var COLOUR_TABLE = {
1528
- 1: { name: "White", abbr: "W", hex: "#ffffff" },
1529
- 2: { name: "Black", abbr: "B", hex: "#333333" },
1530
- 3: { name: "Red", abbr: "R", hex: "#ef4444" },
1531
- 4: { name: "Green", abbr: "G", hex: "#22c55e" },
1532
- 5: { name: "Blue", abbr: "Bu", hex: "#3b82f6" },
1533
- 6: { name: "Yellow", abbr: "Y", hex: "#eab308" },
1534
- 7: { name: "Grey", abbr: "Gr", hex: "#9ca3af" },
1535
- 8: { name: "Brown", abbr: "Bn", hex: "#92400e" },
1536
- 9: { name: "Amber", abbr: "Am", hex: "#f59e0b" },
1537
- 10: { name: "Violet", abbr: "Vi", hex: "#8b5cf6" },
1538
- 11: { name: "Orange", abbr: "Or", hex: "#f97316" },
1539
- 12: { name: "Magenta", abbr: "Mg", hex: "#d946ef" },
1540
- 13: { name: "Pink", abbr: "Pk", hex: "#f472b6" }
1748
+ var CATREA_CODES = {
1749
+ 1: { code: 1, name: "Offshore safety zone" },
1750
+ 2: { code: 2, name: "Anchoring prohibition", supplement: true, unverified: true },
1751
+ 3: { code: 3, name: "Fishing prohibition", supplement: true, unverified: true },
1752
+ 4: { code: 4, name: "Nature reserve" },
1753
+ 5: { code: 5, name: "Bird sanctuary" },
1754
+ 6: { code: 6, name: "Game preserve" },
1755
+ 7: { code: 7, name: "Seal sanctuary" },
1756
+ 8: { code: 8, name: "Degaussing range" },
1757
+ 9: { code: 9, name: "Military area" },
1758
+ 10: { code: 10, name: "Historic wreck area" },
1759
+ 12: { code: 12, name: "Navigational aid safety zone" },
1760
+ 14: { code: 14, name: "Minefield" },
1761
+ 18: { code: 18, name: "Swimming area" },
1762
+ 19: { code: 19, name: "Waiting area" },
1763
+ 20: { code: 20, name: "Research area" },
1764
+ 21: { code: 21, name: "Dredging area" },
1765
+ 22: { code: 22, name: "Fish sanctuary" },
1766
+ 23: { code: 23, name: "Ecological reserve" },
1767
+ 24: { code: 24, name: "No wake area" },
1768
+ 25: { code: 25, name: "Swinging area" },
1769
+ 26: { code: 26, name: "No fishing area", supplement: true, unverified: true },
1770
+ 27: { code: 27, name: "Speed restriction zone", supplement: true, unverified: true },
1771
+ 28: { code: 28, name: "To be avoided area", supplement: true, unverified: true }
1541
1772
  };
1542
- var BOYSHP_TABLE = {
1543
- 1: "Conical (nun)",
1544
- 2: "Can (cylindrical)",
1545
- 3: "Spherical",
1546
- 4: "Pillar",
1547
- 5: "Spar",
1548
- 6: "Barrel",
1549
- 7: "Super buoy",
1550
- 8: "Ice buoy"
1773
+ var CATSCF_CODES = {
1774
+ 1: { code: 1, name: "Visitors' berth" },
1775
+ 2: { code: 2, name: "Nautical club" },
1776
+ 3: { code: 3, name: "Boat hoist" },
1777
+ 4: { code: 4, name: "Sailmaker" },
1778
+ 5: { code: 5, name: "Boatyard" },
1779
+ 6: { code: 6, name: "Public inn" },
1780
+ 7: { code: 7, name: "Restaurant" },
1781
+ 8: { code: 8, name: "Chandler" },
1782
+ 9: { code: 9, name: "Provisions" },
1783
+ 10: { code: 10, name: "Doctor" },
1784
+ 11: { code: 11, name: "Pharmacy" },
1785
+ 12: { code: 12, name: "Water tap" },
1786
+ 13: { code: 13, name: "Fuel station" },
1787
+ 14: { code: 14, name: "Electricity" },
1788
+ 15: { code: 15, name: "Bottle gas" },
1789
+ 16: { code: 16, name: "Showers" },
1790
+ 17: { code: 17, name: "Launderette" },
1791
+ 18: { code: 18, name: "Public toilets" },
1792
+ 19: { code: 19, name: "Post box" },
1793
+ 20: { code: 20, name: "Public telephone" },
1794
+ 21: { code: 21, name: "Refuse bin" },
1795
+ 22: { code: 22, name: "Car park" },
1796
+ 23: { code: 23, name: "Parking for boats and trailers" },
1797
+ 24: { code: 24, name: "Caravan site" },
1798
+ 25: { code: 25, name: "Camping site" },
1799
+ 26: { code: 26, name: "Sewerage pump-out station" },
1800
+ 27: { code: 27, name: "Emergency telephone" },
1801
+ 28: { code: 28, name: "Landing / launching place for boats" },
1802
+ 29: { code: 29, name: "Visitors mooring" },
1803
+ 30: { code: 30, name: "Scrubbing berth" },
1804
+ 31: { code: 31, name: "Picnic area" }
1551
1805
  };
1552
- var CATLAM_TABLE = {
1553
- 1: "Port",
1554
- 2: "Starboard",
1555
- 3: "Preferred channel to starboard",
1556
- 4: "Preferred channel to port"
1806
+ var CATWRK_CODES = {
1807
+ 1: { code: 1, name: "Non-dangerous wreck" },
1808
+ 2: { code: 2, name: "Dangerous wreck" },
1809
+ 3: { code: 3, name: "Distributed remains of wreck" },
1810
+ 4: { code: 4, name: "Wreck showing mast/masts" },
1811
+ 5: { code: 5, name: "Wreck showing any portion of hull or superstructure" }
1557
1812
  };
1558
- var CATCAM_TABLE = {
1559
- 1: "North cardinal",
1560
- 2: "East cardinal",
1561
- 3: "South cardinal",
1562
- 4: "West cardinal"
1813
+ var COLOUR_CODES = {
1814
+ 1: { code: 1, name: "White", abbr: "W" },
1815
+ 2: { code: 2, name: "Black", abbr: "B" },
1816
+ 3: { code: 3, name: "Red", abbr: "R" },
1817
+ 4: { code: 4, name: "Green", abbr: "G" },
1818
+ 5: { code: 5, name: "Blue", abbr: "Bu" },
1819
+ 6: { code: 6, name: "Yellow", abbr: "Y" },
1820
+ 7: { code: 7, name: "Grey", abbr: "Gr" },
1821
+ 8: { code: 8, name: "Brown", abbr: "Bn" },
1822
+ 9: { code: 9, name: "Amber", abbr: "Am" },
1823
+ 10: { code: 10, name: "Violet", abbr: "Vi" },
1824
+ 11: { code: 11, name: "Orange", abbr: "Or" },
1825
+ 12: { code: 12, name: "Magenta", abbr: "Mg" },
1826
+ 13: { code: 13, name: "Pink", abbr: "Pk" }
1563
1827
  };
1564
- var CATLMK_TABLE = {
1565
- 1: "Cairn",
1566
- 2: "Cemetery",
1567
- 3: "Chimney",
1568
- 4: "Dish aerial",
1569
- 5: "Flagstaff",
1570
- 6: "Flare stack",
1571
- 7: "Mast",
1572
- 8: "Windsock",
1573
- 9: "Monument",
1574
- 10: "Column / pillar",
1575
- 11: "Memorial plaque",
1576
- 12: "Obelisk",
1577
- 13: "Statue",
1578
- 14: "Cross",
1579
- 15: "Dome",
1580
- 16: "Radar scanner",
1581
- 17: "Tower",
1582
- 18: "Windmill",
1583
- 19: "Wind turbine",
1584
- 20: "Spire"
1828
+ var CONDTN_CODES = {
1829
+ 1: { code: 1, name: "Under construction" },
1830
+ 2: { code: 2, name: "Ruined" },
1831
+ 3: { code: 3, name: "Under reclamation" },
1832
+ 4: { code: 4, name: "Wingless" },
1833
+ 5: { code: 5, name: "Planned construction" }
1585
1834
  };
1586
- var CATFOG_TABLE = {
1587
- 1: "Explosive",
1588
- 2: "Diaphone",
1589
- 3: "Siren",
1590
- 4: "Nautophone",
1591
- 5: "Bell",
1592
- 6: "Whistle",
1593
- 7: "Reed",
1594
- 8: "Gong",
1595
- 9: "Horn"
1835
+ var LITCHR_CODES = {
1836
+ 1: { code: 1, name: "Fixed", abbr: "F" },
1837
+ 2: { code: 2, name: "Flashing", abbr: "Fl" },
1838
+ 3: { code: 3, name: "Long-flashing", abbr: "LFl" },
1839
+ 4: { code: 4, name: "Quick-flashing", abbr: "Q" },
1840
+ 5: { code: 5, name: "Very quick-flashing", abbr: "VQ" },
1841
+ 6: { code: 6, name: "Ultra quick-flashing", abbr: "UQ" },
1842
+ 7: { code: 7, name: "Isophase", abbr: "Iso" },
1843
+ 8: { code: 8, name: "Occulting", abbr: "Oc" },
1844
+ 9: { code: 9, name: "Interrupted quick-flashing", abbr: "IQ" },
1845
+ 10: { code: 10, name: "Interrupted very quick-flashing", abbr: "IVQ" },
1846
+ 11: { code: 11, name: "Interrupted ultra quick-flashing", abbr: "IUQ" },
1847
+ 12: { code: 12, name: "Morse", abbr: "Mo" },
1848
+ 13: { code: 13, name: "Fixed / flash", abbr: "FFl" },
1849
+ 14: { code: 14, name: "Flash / long-flash", abbr: "Fl+LFl" },
1850
+ 15: { code: 15, name: "Occulting / flash", abbr: "Oc+Fl" },
1851
+ 16: { code: 16, name: "Fixed / long-flash", abbr: "FLFl" },
1852
+ 17: { code: 17, name: "Occulting alternating", abbr: "Al.Oc" },
1853
+ 18: { code: 18, name: "Long-flash alternating", abbr: "Al.LFl" },
1854
+ 19: { code: 19, name: "Flash alternating", abbr: "Al.Fl" },
1855
+ 20: { code: 20, name: "Group alternating", abbr: "Al.Gr" },
1856
+ 25: { code: 25, name: "Quick-flash plus long-flash", abbr: "Q+LFl" },
1857
+ 26: { code: 26, name: "Very quick-flash plus long-flash", abbr: "VQ+LFl" },
1858
+ 27: { code: 27, name: "Ultra quick-flash plus long-flash", abbr: "UQ+LFl" },
1859
+ 28: { code: 28, name: "Alternating", abbr: "Al" },
1860
+ 29: { code: 29, name: "Fixed and alternating flashing", abbr: "F.Al.Fl" }
1596
1861
  };
1597
- var CATFOG_ABBR_TABLE = {
1598
- 1: "EXPLOS",
1599
- 2: "DIA",
1600
- 3: "SIREN",
1601
- 4: "NAUTO",
1602
- 5: "BELL",
1603
- 6: "WHIS",
1604
- 7: "REED",
1605
- 8: "GONG",
1606
- 9: "HORN"
1862
+ var MARSYS_CODES = {
1863
+ 1: { code: 1, name: "IALA A" },
1864
+ 2: { code: 2, name: "IALA B" },
1865
+ 9: { code: 9, name: "No system" },
1866
+ 10: { code: 10, name: "Other system" }
1607
1867
  };
1608
- var TOPSHP_TABLE = {
1609
- 1: "Cone, point up",
1610
- 2: "Cone, point down",
1611
- 3: "Sphere",
1612
- 4: "2 spheres",
1613
- 5: "Cylinder",
1614
- 6: "Board",
1615
- 7: "X-shape",
1616
- 8: "Upright cross",
1617
- 9: "Cube, point up",
1618
- 10: "2 cones, point to point",
1619
- 11: "2 cones, base to base",
1620
- 12: "Rhombus",
1621
- 13: "2 cones, up",
1622
- 14: "2 cones, down",
1623
- 15: "Besom, point up",
1624
- 16: "Besom, point down",
1625
- 17: "Flag",
1626
- 18: "Sphere over rhombus",
1627
- 19: "Square",
1628
- 33: "T-shape"
1868
+ var NATSUR_CODES = {
1869
+ 1: { code: 1, name: "Mud" },
1870
+ 2: { code: 2, name: "Clay" },
1871
+ 3: { code: 3, name: "Silt" },
1872
+ 4: { code: 4, name: "Sand" },
1873
+ 5: { code: 5, name: "Stone" },
1874
+ 6: { code: 6, name: "Gravel" },
1875
+ 7: { code: 7, name: "Pebbles" },
1876
+ 8: { code: 8, name: "Cobbles" },
1877
+ 9: { code: 9, name: "Rock" },
1878
+ 11: { code: 11, name: "Lava" },
1879
+ 14: { code: 14, name: "Coral" },
1880
+ 17: { code: 17, name: "Shells" },
1881
+ 18: { code: 18, name: "Boulder" }
1629
1882
  };
1630
- var STATUS_TABLE = {
1631
- 1: "Permanent",
1632
- 2: "Occasional",
1633
- 3: "Recommended",
1634
- 4: "Not in use",
1635
- 5: "Periodic/intermittent",
1636
- 6: "Reserved",
1637
- 7: "Temporary",
1638
- 8: "Private",
1639
- 9: "Mandatory",
1640
- 11: "Extinguished",
1641
- 12: "Illuminated",
1642
- 13: "Historic",
1643
- 14: "Public",
1644
- 15: "Synchronized",
1645
- 16: "Watched",
1646
- 17: "Un-watched",
1647
- 18: "Existence doubtful"
1883
+ var QUASOU_CODES = {
1884
+ 1: { code: 1, name: "Depth known" },
1885
+ 2: { code: 2, name: "Depth unknown" },
1886
+ 3: { code: 3, name: "Doubtful sounding" },
1887
+ 4: { code: 4, name: "Unreliable sounding" },
1888
+ 5: { code: 5, name: "No bottom found at value shown" },
1889
+ 6: { code: 6, name: "Least depth known" },
1890
+ 7: { code: 7, name: "Least depth unknown, safe clearance at value shown" },
1891
+ 8: { code: 8, name: "Value reported (not surveyed)" },
1892
+ 9: { code: 9, name: "Value reported (not confirmed)" },
1893
+ 10: { code: 10, name: "Maintained depth" },
1894
+ 11: { code: 11, name: "Not regularly maintained" }
1648
1895
  };
1649
- var MARSYS_TABLE = {
1650
- 1: "IALA-A",
1651
- 2: "IALA-B"
1896
+ var RESTRN_CODES = {
1897
+ 1: { code: 1, name: "Anchoring prohibited" },
1898
+ 2: { code: 2, name: "Anchoring restricted" },
1899
+ 3: { code: 3, name: "Fishing prohibited" },
1900
+ 4: { code: 4, name: "Fishing restricted" },
1901
+ 5: { code: 5, name: "Trawling prohibited" },
1902
+ 6: { code: 6, name: "Trawling restricted" },
1903
+ 7: { code: 7, name: "Entry prohibited" },
1904
+ 8: { code: 8, name: "Entry restricted" },
1905
+ 9: { code: 9, name: "Dredging prohibited" },
1906
+ 10: { code: 10, name: "Dredging restricted" },
1907
+ 11: { code: 11, name: "Diving prohibited" },
1908
+ 12: { code: 12, name: "Diving restricted" },
1909
+ 13: { code: 13, name: "No wake" },
1910
+ 14: { code: 14, name: "Area to be avoided" },
1911
+ 15: { code: 15, name: "Construction prohibited" },
1912
+ 16: { code: 16, name: "Discharging prohibited", supplement: true, unverified: true },
1913
+ 17: { code: 17, name: "Discharging restricted", supplement: true, unverified: true },
1914
+ 18: { code: 18, name: "Industrial prohibited", supplement: true, unverified: true },
1915
+ 19: { code: 19, name: "Metallic hull vessels prohibited", supplement: true, unverified: true },
1916
+ 20: { code: 20, name: "Navigating prohibited", supplement: true, unverified: true },
1917
+ 21: { code: 21, name: "Speed restricted", supplement: true, unverified: true },
1918
+ 24: { code: 24, name: "Stopping prohibited", supplement: true, unverified: true },
1919
+ 25: { code: 25, name: "Landing prohibited", supplement: true, unverified: true }
1652
1920
  };
1921
+ var STATUS_CODES = {
1922
+ 1: { code: 1, name: "Permanent" },
1923
+ 2: { code: 2, name: "Occasional" },
1924
+ 3: { code: 3, name: "Recommended" },
1925
+ 4: { code: 4, name: "Disused" },
1926
+ 5: { code: 5, name: "Periodically/intermittent" },
1927
+ 6: { code: 6, name: "Reserved" },
1928
+ 7: { code: 7, name: "Temporary" },
1929
+ 8: { code: 8, name: "Private" },
1930
+ 9: { code: 9, name: "Mandatory" },
1931
+ 11: { code: 11, name: "Extinguished" },
1932
+ 12: { code: 12, name: "Illuminated" },
1933
+ 13: { code: 13, name: "Historic" },
1934
+ 14: { code: 14, name: "Public" },
1935
+ 15: { code: 15, name: "Synchronized" },
1936
+ 16: { code: 16, name: "Watched" },
1937
+ 17: { code: 17, name: "Un-watched" },
1938
+ 18: { code: 18, name: "Existence doubtful" }
1939
+ };
1940
+ var TOPSHP_CODES = {
1941
+ 1: { code: 1, name: "Cone, point up" },
1942
+ 2: { code: 2, name: "Cone, point down" },
1943
+ 3: { code: 3, name: "Sphere" },
1944
+ 4: { code: 4, name: "2 sphere" },
1945
+ 5: { code: 5, name: "Cylinder (can)" },
1946
+ 6: { code: 6, name: "Board" },
1947
+ 7: { code: 7, name: "X-shape (St. Andrew's cross)" },
1948
+ 8: { code: 8, name: "Upright cross (St. George cross)" },
1949
+ 9: { code: 9, name: "Cube, point up" },
1950
+ 10: { code: 10, name: "2 cones, point to point" },
1951
+ 11: { code: 11, name: "2 cones, base to base" },
1952
+ 12: { code: 12, name: "Rhombus (diamond)" },
1953
+ 13: { code: 13, name: "2 cones (points upward)" },
1954
+ 14: { code: 14, name: "2 cones (points downward)" },
1955
+ 15: { code: 15, name: "Besom, point up (broom or perch)" },
1956
+ 16: { code: 16, name: "Besom, point down (broom or perch)" },
1957
+ 17: { code: 17, name: "Flag" },
1958
+ 18: { code: 18, name: "Sphere over rhombus" },
1959
+ 19: { code: 19, name: "Square" },
1960
+ 20: { code: 20, name: "Rectangle, horizontal" },
1961
+ 21: { code: 21, name: "Rectangle, vertical" },
1962
+ 22: { code: 22, name: "Trapezium, up" },
1963
+ 23: { code: 23, name: "Trapezium, down" },
1964
+ 24: { code: 24, name: "Triangle, point up" },
1965
+ 25: { code: 25, name: "Triangle, point down" },
1966
+ 26: { code: 26, name: "Circle" },
1967
+ 27: { code: 27, name: "Two upright crosses (one over the other)" },
1968
+ 28: { code: 28, name: "T-shape" },
1969
+ 29: { code: 29, name: "Triangle pointing up over a circle" },
1970
+ 30: { code: 30, name: "Upright cross over a circle" },
1971
+ 31: { code: 31, name: "Rhombus over a circle" },
1972
+ 32: { code: 32, name: "Circle over a triangle pointing up" },
1973
+ 33: { code: 33, name: "Other shape (see INFORM)" }
1974
+ };
1975
+ var TRAFIC_CODES = {
1976
+ 1: { code: 1, name: "Inbound" },
1977
+ 2: { code: 2, name: "Outbound" },
1978
+ 3: { code: 3, name: "One-way" },
1979
+ 4: { code: 4, name: "Two-way" }
1980
+ };
1981
+ var WATLEV_CODES = {
1982
+ 1: { code: 1, name: "Partly submerged at high water" },
1983
+ 2: { code: 2, name: "Always dry" },
1984
+ 3: { code: 3, name: "Always under water/submerged" },
1985
+ 4: { code: 4, name: "Covers and uncovers" },
1986
+ 5: { code: 5, name: "Awash" },
1987
+ 6: { code: 6, name: "Subject to inundation or flooding" },
1988
+ 7: { code: 7, name: "Floating", supplement: true, unverified: true }
1989
+ };
1990
+ var S57_CODELISTS = /* @__PURE__ */ new Map([
1991
+ ["BOYSHP", BOYSHP_CODES],
1992
+ ["CATACH", CATACH_CODES],
1993
+ ["CATCAM", CATCAM_CODES],
1994
+ ["CATCBL", CATCBL_CODES],
1995
+ ["CATCOA", CATCOA_CODES],
1996
+ ["CATCRN", CATCRN_CODES],
1997
+ ["CATDPG", CATDPG_CODES],
1998
+ ["CATFOG", CATFOG_CODES],
1999
+ ["CATHAF", CATHAF_CODES],
2000
+ ["CATLAM", CATLAM_CODES],
2001
+ ["CATLIT", CATLIT_CODES],
2002
+ ["CATLMK", CATLMK_CODES],
2003
+ ["CATMFA", CATMFA_CODES],
2004
+ ["CATOBS", CATOBS_CODES],
2005
+ ["CATPIP", CATPIP_CODES],
2006
+ ["CATREA", CATREA_CODES],
2007
+ ["CATSCF", CATSCF_CODES],
2008
+ ["CATWRK", CATWRK_CODES],
2009
+ ["COLOUR", COLOUR_CODES],
2010
+ ["CONDTN", CONDTN_CODES],
2011
+ ["LITCHR", LITCHR_CODES],
2012
+ ["MARSYS", MARSYS_CODES],
2013
+ ["NATSUR", NATSUR_CODES],
2014
+ ["QUASOU", QUASOU_CODES],
2015
+ ["RESTRN", RESTRN_CODES],
2016
+ ["STATUS", STATUS_CODES],
2017
+ ["TOPSHP", TOPSHP_CODES],
2018
+ ["TRAFIC", TRAFIC_CODES],
2019
+ ["WATLEV", WATLEV_CODES]
2020
+ ]);
2021
+ var S57_DOMAINS = new Map(
2022
+ [...S57_CODELISTS].map(([acronym, list]) => [
2023
+ acronym,
2024
+ new Set(Object.keys(list).map(Number))
2025
+ ])
2026
+ );
2027
+ var nameTableCache = /* @__PURE__ */ new Map();
2028
+ var abbrTableCache = /* @__PURE__ */ new Map();
2029
+ function s57NameTable(acronym) {
2030
+ let cached = nameTableCache.get(acronym);
2031
+ if (cached === void 0) {
2032
+ const out = {};
2033
+ for (const c of Object.values(S57_CODELISTS.get(acronym) ?? {})) out[c.code] = c.name;
2034
+ cached = Object.freeze(out);
2035
+ nameTableCache.set(acronym, cached);
2036
+ }
2037
+ return cached;
2038
+ }
2039
+ function s57AbbrTable(acronym) {
2040
+ let cached = abbrTableCache.get(acronym);
2041
+ if (cached === void 0) {
2042
+ const out = {};
2043
+ for (const c of Object.values(S57_CODELISTS.get(acronym) ?? {})) {
2044
+ if (c.abbr !== void 0) out[c.code] = c.abbr;
2045
+ }
2046
+ cached = Object.freeze(out);
2047
+ abbrTableCache.set(acronym, cached);
2048
+ }
2049
+ return cached;
2050
+ }
2051
+
2052
+ // src/interact/decode.ts
2053
+ function nameAbbrTable(acronym) {
2054
+ const names = s57NameTable(acronym);
2055
+ const abbrs = s57AbbrTable(acronym);
2056
+ const out = {};
2057
+ for (const [code, name] of Object.entries(names)) {
2058
+ const abbr = abbrs[Number(code)];
2059
+ if (abbr !== void 0) out[Number(code)] = { name, abbr };
2060
+ }
2061
+ return out;
2062
+ }
2063
+ var COLOUR_HEX = {
2064
+ 1: "#ffffff",
2065
+ 2: "#333333",
2066
+ 3: "#ef4444",
2067
+ 4: "#22c55e",
2068
+ 5: "#3b82f6",
2069
+ 6: "#eab308",
2070
+ 7: "#9ca3af",
2071
+ 8: "#92400e",
2072
+ 9: "#f59e0b",
2073
+ 10: "#8b5cf6",
2074
+ 11: "#f97316",
2075
+ 12: "#d946ef",
2076
+ 13: "#f472b6"
2077
+ };
2078
+ var LITCHR_TABLE = nameAbbrTable("LITCHR");
2079
+ var COLOUR_TABLE = Object.fromEntries(
2080
+ Object.values(COLOUR_CODES).filter((c) => c.abbr !== void 0 && COLOUR_HEX[c.code] !== void 0).map((c) => [c.code, { name: c.name, abbr: c.abbr, hex: COLOUR_HEX[c.code] }])
2081
+ );
2082
+ var BOYSHP_TABLE = s57NameTable("BOYSHP");
2083
+ var CATLAM_TABLE = s57NameTable("CATLAM");
2084
+ var CATCAM_TABLE = s57NameTable("CATCAM");
2085
+ var CATLMK_TABLE = s57NameTable("CATLMK");
2086
+ var CATFOG_TABLE = s57NameTable("CATFOG");
2087
+ var CATFOG_ABBR_TABLE = s57AbbrTable("CATFOG");
2088
+ var CATFOG_NAUTOPHONE = Object.values(CATFOG_CODES).find(
2089
+ (c) => c.name.toLowerCase() === "nautophone"
2090
+ )?.code;
2091
+ var CATLIT_TABLE = s57NameTable("CATLIT");
2092
+ var TOPSHP_TABLE = s57NameTable("TOPSHP");
2093
+ var STATUS_TABLE = s57NameTable("STATUS");
2094
+ var MARSYS_TABLE = s57NameTable("MARSYS");
1653
2095
  var LAYER_TYPE_MAP = {
1654
2096
  BOYLAT: "Lateral Buoy",
1655
2097
  BOYCAR: "Cardinal Buoy",
@@ -1843,12 +2285,7 @@ var CATBRG_LABELS = {
1843
2285
  11: "Aqueduct",
1844
2286
  12: "Suspension bridge"
1845
2287
  };
1846
- var CONDTN_TABLE = {
1847
- 1: "Under construction",
1848
- 2: "Ruined",
1849
- 3: "Under reclamation",
1850
- 5: "Planned"
1851
- };
2288
+ var CONDTN_TABLE = s57NameTable("CONDTN");
1852
2289
  function parseFirstNum(val) {
1853
2290
  if (val == null) return null;
1854
2291
  const s = String(val);
@@ -1890,185 +2327,21 @@ function decodeBridgeProps(props) {
1890
2327
  sourceDate: props.SORDAT ? String(props.SORDAT) : null
1891
2328
  };
1892
2329
  }
1893
- var CATOBS_TABLE = {
1894
- 1: "Snag / stump",
1895
- 2: "Wellhead",
1896
- 3: "Diffuser",
1897
- 4: "Crib",
1898
- 5: "Fish haven",
1899
- 6: "Foul area",
1900
- 7: "Foul ground",
1901
- 8: "Ice boom",
1902
- 9: "Ground tackle",
1903
- 10: "Boom",
1904
- 11: "Platform"
1905
- };
1906
- var CATWRK_TABLE = {
1907
- 1: "Non-dangerous",
1908
- 2: "Dangerous",
1909
- 3: "Distributed remains",
1910
- 4: "Mast showing",
1911
- 5: "Hull showing"
1912
- };
1913
- var WATLEV_TABLE = {
1914
- 1: "Partly submerged at high water",
1915
- 2: "Always dry",
1916
- 3: "Always submerged",
1917
- 4: "Covers and uncovers",
1918
- 5: "Awash",
1919
- 6: "Subject to inundation / flooding",
1920
- 7: "Floating"
1921
- };
1922
- var CATREA_TABLE = {
1923
- 1: "Offshore safety zone",
1924
- 2: "Anchoring prohibition",
1925
- 3: "Fishing prohibition",
1926
- 4: "Nature reserve",
1927
- 5: "Bird sanctuary",
1928
- 6: "Game preserve",
1929
- 7: "Seal sanctuary",
1930
- 8: "Degaussing range",
1931
- 9: "Military area",
1932
- 10: "Historic wreck",
1933
- 12: "Navigational aid safety zone",
1934
- 14: "No wake zone",
1935
- 18: "Swimming area",
1936
- 19: "Waiting area",
1937
- 20: "Research area",
1938
- 21: "Dredging area",
1939
- 22: "Fish sanctuary",
1940
- 23: "Ecological reserve",
1941
- 24: "No discharge zone",
1942
- 25: "No anchoring area",
1943
- 26: "No fishing area",
1944
- 27: "Speed restriction zone",
1945
- 28: "To be avoided area"
1946
- };
1947
- var RESTRN_TABLE = {
1948
- 1: "Anchoring prohibited",
1949
- 2: "Anchoring restricted",
1950
- 3: "Fishing prohibited",
1951
- 4: "Fishing restricted",
1952
- 5: "Trawling prohibited",
1953
- 6: "Trawling restricted",
1954
- 7: "Entry prohibited",
1955
- 8: "Entry restricted",
1956
- 9: "Dredging prohibited",
1957
- 10: "Dredging restricted",
1958
- 11: "Diving prohibited",
1959
- 12: "Diving restricted",
1960
- 13: "No wake",
1961
- 14: "To be avoided",
1962
- 15: "Construction prohibited",
1963
- 16: "Discharging prohibited",
1964
- 17: "Discharging restricted",
1965
- 18: "Industrial prohibited",
1966
- 19: "Metallic hull vessels prohibited",
1967
- 20: "Navigating prohibited",
1968
- 21: "Speed restricted",
1969
- 24: "Stopping prohibited",
1970
- 25: "Landing prohibited"
1971
- };
1972
- var CATHAF_TABLE = {
1973
- 1: "RoRo terminal",
1974
- 3: "Ferry terminal",
1975
- 4: "Fishing harbour",
1976
- 5: "Yacht harbour / marina",
1977
- 6: "Naval base",
1978
- 7: "Tanker terminal",
1979
- 8: "Passenger terminal",
1980
- 9: "Shipyard",
1981
- 10: "Container terminal",
1982
- 11: "Bulk terminal",
1983
- 12: "Synchrolift",
1984
- 13: "Straddle carrier",
1985
- 14: "Port terminal"
1986
- };
1987
- var CATSCF_TABLE = {
1988
- 1: "Visitors' berth",
1989
- 2: "Nautical club",
1990
- 3: "Boat hoist",
1991
- 4: "Sailmaker",
1992
- 5: "Boatyard",
1993
- 6: "Public inn",
1994
- 7: "Restaurant",
1995
- 8: "Chandler",
1996
- 9: "Provisions",
1997
- 10: "Doctor",
1998
- 11: "Pharmacy",
1999
- 12: "Water tap",
2000
- 13: "Fuel station",
2001
- 14: "Electricity",
2002
- 15: "Bottle gas",
2003
- 16: "Showers",
2004
- 17: "Launderette",
2005
- 18: "Public toilets",
2006
- 19: "Post box"
2007
- };
2008
- var CATCRN_TABLE = {
2009
- 2: "Container crane / gantry",
2010
- 3: "Sheerlegs",
2011
- 4: "Travelling crane"
2012
- };
2013
- var CATACH_TABLE = {
2014
- 1: "Unrestricted anchorage",
2015
- 2: "Deep water anchorage",
2016
- 3: "Tanker anchorage",
2017
- 4: "Explosives anchorage",
2018
- 5: "Quarantine anchorage",
2019
- 6: "Sea-plane anchorage",
2020
- 7: "Small craft anchorage",
2021
- 8: "Small craft mooring area",
2022
- 9: "Anchorage for 24 hours or less"
2023
- };
2024
- var CATDPG_TABLE = {
2025
- 1: "General dumping ground",
2026
- 2: "Chemical waste",
2027
- 3: "Nuclear waste",
2028
- 4: "Explosives",
2029
- 5: "Spoil ground",
2030
- 6: "Vessel dumping ground"
2031
- };
2032
- var CATMFA_TABLE = {
2033
- 1: "Crustaceans",
2034
- 2: "Oysters / mussels",
2035
- 3: "Fish",
2036
- 4: "Seaweed",
2037
- 5: "Pearl culture"
2038
- };
2039
- var CATCBL_TABLE = {
2040
- 1: "Submarine power cable",
2041
- 2: "Submarine transmission cable",
2042
- 3: "Submarine telegraph cable",
2043
- 4: "Submarine telephone cable",
2044
- 5: "Mooring cable",
2045
- 6: "Ferry cable"
2046
- };
2047
- var CATPIP_TABLE = {
2048
- 1: "Pipeline",
2049
- 2: "Outfall pipe",
2050
- 3: "Intake pipe",
2051
- 4: "Sewer",
2052
- 5: "Bubbler system",
2053
- 6: "Supply pipe"
2054
- };
2055
- var TRAFIC_TABLE = {
2056
- 1: "Inbound",
2057
- 2: "Outbound",
2058
- 3: "One-way",
2059
- 4: "Two-way"
2060
- };
2061
- var QUASOU_TABLE = {
2062
- 1: "Depth known",
2063
- 2: "Depth unknown",
2064
- 3: "Doubtful sounding",
2065
- 4: "Unreliable sounding",
2066
- 6: "Least depth known",
2067
- 7: "Least depth unknown",
2068
- 9: "Not regularly maintained",
2069
- 10: "Maintained depth",
2070
- 11: "Not surveyed"
2071
- };
2330
+ var CATOBS_TABLE = s57NameTable("CATOBS");
2331
+ var CATWRK_TABLE = s57NameTable("CATWRK");
2332
+ var WATLEV_TABLE = s57NameTable("WATLEV");
2333
+ var CATREA_TABLE = s57NameTable("CATREA");
2334
+ var RESTRN_TABLE = s57NameTable("RESTRN");
2335
+ var CATHAF_TABLE = s57NameTable("CATHAF");
2336
+ var CATSCF_TABLE = s57NameTable("CATSCF");
2337
+ var CATCRN_TABLE = s57NameTable("CATCRN");
2338
+ var CATACH_TABLE = s57NameTable("CATACH");
2339
+ var CATDPG_TABLE = s57NameTable("CATDPG");
2340
+ var CATMFA_TABLE = s57NameTable("CATMFA");
2341
+ var CATCBL_TABLE = s57NameTable("CATCBL");
2342
+ var CATPIP_TABLE = s57NameTable("CATPIP");
2343
+ var TRAFIC_TABLE = s57NameTable("TRAFIC");
2344
+ var QUASOU_TABLE = s57NameTable("QUASOU");
2072
2345
  function decodeAreaFeatureProps(layerName, props) {
2073
2346
  const rawLayer = layerName.replace(/^enc-/, "").replace(/-(point|line|polygon|midpoint)$/, "");
2074
2347
  const parseCodeLocal = (val) => {
@@ -2531,6 +2804,15 @@ function decodeAreaFeatureProps(layerName, props) {
2531
2804
  if (st && STATUS_TABLE[st]) entries.push({ label: "Status", value: STATUS_TABLE[st] });
2532
2805
  return { type, title: title || type, properties: entries };
2533
2806
  }
2807
+ function catfogCodeFromName(lowercaseName) {
2808
+ if (!lowercaseName) return null;
2809
+ for (const entry of Object.values(CATFOG_CODES)) {
2810
+ const term = entry.name.toLowerCase();
2811
+ if (new RegExp(`\\b${term}\\b`).test(lowercaseName)) return entry.code;
2812
+ }
2813
+ if (/\bnauto\b/.test(lowercaseName)) return CATFOG_NAUTOPHONE ?? null;
2814
+ return null;
2815
+ }
2534
2816
  function parseCode(val) {
2535
2817
  if (val == null) return null;
2536
2818
  let s = String(val).trim();
@@ -2642,14 +2924,7 @@ function decodeNavAidProps(layerName, props, coords) {
2642
2924
  const sigper = props.SIGPER != null ? Number(props.SIGPER) : null;
2643
2925
  const group = parseGroup(props.SIGGRP);
2644
2926
  const nameForFog = String(props.OBJNAM ?? "").toLowerCase();
2645
- let catfogCode = null;
2646
- if (/\bwhistle\b/.test(nameForFog)) catfogCode = 6;
2647
- else if (/\bgong\b/.test(nameForFog)) catfogCode = 8;
2648
- else if (/\bbell\b/.test(nameForFog)) catfogCode = 5;
2649
- else if (/\bhorn\b/.test(nameForFog)) catfogCode = 9;
2650
- else if (/\bsiren\b/.test(nameForFog)) catfogCode = 3;
2651
- else if (/diaphone/.test(nameForFog)) catfogCode = 2;
2652
- else if (/nautophone|nauto/.test(nameForFog)) catfogCode = 4;
2927
+ let catfogCode = catfogCodeFromName(nameForFog);
2653
2928
  if (!catfogCode) catfogCode = parseCode(props.CATFOG);
2654
2929
  const fogSignal2 = catfogCode ? CATFOG_TABLE[catfogCode] ?? null : null;
2655
2930
  const fogSignalAbbr = catfogCode ? CATFOG_ABBR_TABLE[catfogCode] ?? null : null;
@@ -5803,6 +6078,31 @@ var S52_LOOKUP = {
5803
6078
  viewingGroup: 27080,
5804
6079
  scamin: 22e3
5805
6080
  },
6081
+ RADRFL: {
6082
+ objectClass: "RADRFL",
6083
+ name: "Radar Reflector",
6084
+ category: "Navigation Aids",
6085
+ displayCategory: "OTHER",
6086
+ int1Ref: "S6",
6087
+ style: { type: "symbol", paint: {}, layout: { "icon-size": 0.6, "icon-allow-overlap": true }, iconImage: "RADRFL03" },
6088
+ viewingGroup: 27080,
6089
+ scamin: 22e3
6090
+ },
6091
+ // Retroreflecting material fitted to buoys/beacons. 7,506 features across 616
6092
+ // NOAA cells (docs/validation/s52-occurrence-snapshot.json) rendered nothing
6093
+ // until this entry existed. RETRFL02 is the simplified variant — RETRFL01 is
6094
+ // the paper-chart glyph, per the reference manifest descriptions.
6095
+ // int1Ref intentionally omitted: no INT-1 citation for retroreflectors could
6096
+ // be verified against an in-repo source, and the field is optional.
6097
+ RETRFL: {
6098
+ objectClass: "RETRFL",
6099
+ name: "Retroreflector",
6100
+ category: "Navigation Aids",
6101
+ displayCategory: "OTHER",
6102
+ style: { type: "symbol", paint: {}, layout: { "icon-size": 0.6, "icon-allow-overlap": true }, iconImage: "RETRFL02" },
6103
+ viewingGroup: 27080,
6104
+ scamin: 22e3
6105
+ },
5806
6106
  NAVLNE: {
5807
6107
  objectClass: "NAVLNE",
5808
6108
  name: "Navigation Line",
@@ -21347,6 +21647,8 @@ var SYMBOL_MAP = {
21347
21647
  FOGSIG: "FOGSIG01",
21348
21648
  RTPBCN: "RTPBCN02",
21349
21649
  RDOSTA: "RTPBCN02",
21650
+ RADRFL: "RADRFL03",
21651
+ RETRFL: "RETRFL02",
21350
21652
  // Nav aids
21351
21653
  DAYMAR: "DAYTRI01",
21352
21654
  PILPNT: "PILPNT02",
@@ -21800,31 +22102,28 @@ function getLookupEntry(layerName) {
21800
22102
  return S52_LOOKUP[layerName] ?? null;
21801
22103
  }
21802
22104
 
22105
+ // src/s57/match-expression.ts
22106
+ var pairsCache = /* @__PURE__ */ new Map();
22107
+ function codeLabelPairs(acronym, kind) {
22108
+ const key = `${acronym}:${kind}`;
22109
+ let pairs = pairsCache.get(key);
22110
+ if (pairs === void 0) {
22111
+ const table = kind === "abbr" ? s57AbbrTable(acronym) : s57NameTable(acronym);
22112
+ const flat = [];
22113
+ for (const code of Object.keys(table).map(Number).sort((a, b) => a - b)) {
22114
+ flat.push(code, table[code]);
22115
+ }
22116
+ pairs = flat;
22117
+ pairsCache.set(key, pairs);
22118
+ }
22119
+ return pairs;
22120
+ }
22121
+ function s57MatchExpression(acronym, kind, input, fallback = "") {
22122
+ return ["match", input, ...codeLabelPairs(acronym, kind), fallback];
22123
+ }
22124
+
21803
22125
  // src/atlas/labels.ts
21804
- var LITCHR_ABBR = {
21805
- 1: "F",
21806
- 2: "Fl",
21807
- 3: "LFl",
21808
- 4: "Oc",
21809
- 5: "Iso",
21810
- 6: "S.Fl",
21811
- 7: "S.LFl",
21812
- 8: "Al.Oc",
21813
- 9: "Al.LFl",
21814
- 10: "Al.Fl",
21815
- 11: "Al.Gp",
21816
- 12: "Mo",
21817
- 13: "Q",
21818
- 14: "VQ",
21819
- 15: "UQ",
21820
- 16: "Al",
21821
- 17: "Al.F.Fl",
21822
- 25: "Q+LFl",
21823
- 26: "VQ+LFl",
21824
- 27: "UQ+LFl",
21825
- 28: "Al",
21826
- 29: "F.LFl"
21827
- };
22126
+ var LITCHR_ABBR = s57AbbrTable("LITCHR");
21828
22127
  var COLOUR_ABBR = {
21829
22128
  1: "W",
21830
22129
  3: "R",
@@ -22613,27 +22912,11 @@ function getLabelConfig(layerName, opts = {}) {
22613
22912
  }
22614
22913
  };
22615
22914
  case "FOGSIG": {
22616
- const catfogExpr = [
22617
- "match",
22618
- ["to-number", ["coalesce", ["get", "CATFOG"], 0], 0],
22619
- 2,
22620
- "DIA",
22621
- 3,
22622
- "SIREN",
22623
- 4,
22624
- "NAUTO",
22625
- 5,
22626
- "BELL",
22627
- 6,
22628
- "WHIS",
22629
- 7,
22630
- "REED",
22631
- 8,
22632
- "GONG",
22633
- 9,
22634
- "HORN",
22635
- ""
22636
- ];
22915
+ const catfogExpr = s57MatchExpression(
22916
+ "CATFOG",
22917
+ "abbr",
22918
+ ["to-number", ["coalesce", ["get", "CATFOG"], 0], 0]
22919
+ );
22637
22920
  return {
22638
22921
  type: "symbol",
22639
22922
  textField: catfogExpr,
@@ -26189,33 +26472,11 @@ function buildNavAidLabelExpression() {
26189
26472
  ];
26190
26473
  }
26191
26474
  function buildLightLabelExpression() {
26192
- const litchrExpr = [
26193
- "match",
26194
- ["coalesce", ["get", "LITCHR"], 0],
26195
- 1,
26196
- "F",
26197
- 2,
26198
- "Fl",
26199
- 3,
26200
- "LFl",
26201
- 4,
26202
- "Oc",
26203
- 5,
26204
- "Iso",
26205
- 6,
26206
- "S.Fl",
26207
- 7,
26208
- "S.LFl",
26209
- 12,
26210
- "Mo",
26211
- 13,
26212
- "Q",
26213
- 14,
26214
- "VQ",
26215
- 15,
26216
- "UQ",
26217
- ""
26218
- ];
26475
+ const litchrExpr = s57MatchExpression(
26476
+ "LITCHR",
26477
+ "abbr",
26478
+ ["coalesce", ["get", "LITCHR"], 0]
26479
+ );
26219
26480
  const colourExpr = colourCodeCase(
26220
26481
  [
26221
26482
  ["3", " R"],
@@ -27363,6 +27624,20 @@ var CHART_CASCADE_CODES = {
27363
27624
  Approach: ["1", "2", "3", "4"],
27364
27625
  Harbor: ["1", "2", "3", "4", "5", "6"]
27365
27626
  };
27627
+ var CHRT_STYLE_MODES = [
27628
+ "continuous",
27629
+ ...Object.keys(CHART_BAND_CODES).map(
27630
+ (band) => `chart:${band}`
27631
+ )
27632
+ ];
27633
+ function normalizeStyleMode(raw) {
27634
+ if (raw === null || raw === void 0 || raw === "") return "continuous";
27635
+ const lower = raw.toLowerCase();
27636
+ return CHRT_STYLE_MODES.find((mode) => mode.toLowerCase() === lower) ?? null;
27637
+ }
27638
+ function styleModeBand(mode) {
27639
+ return mode === "continuous" ? null : mode.slice("chart:".length);
27640
+ }
27366
27641
  function bandFilterExpression(codes) {
27367
27642
  const list = Array.isArray(codes) ? codes : [codes];
27368
27643
  if (list.length === 1) {
@@ -28381,6 +28656,14 @@ var Chrt = class {
28381
28656
  cells;
28382
28657
  /** Coverage data — list available chart sources */
28383
28658
  coverage;
28659
+ /**
28660
+ * CHRTweather — NOAA-backed marine weather: observed conditions, active
28661
+ * warnings, and the NWS zone forecast. U.S. waters only, and requires the
28662
+ * `weather:read` scope on your key — a chart key does not carry it.
28663
+ *
28664
+ * An empty result from any of these never means calm water.
28665
+ */
28666
+ weather;
28384
28667
  /**
28385
28668
  * CHRToffline — download MBTiles bundles for offline use.
28386
28669
  * Requires `deviceId` in config. Manifest-based budget enforcement
@@ -28412,6 +28695,7 @@ var Chrt = class {
28412
28695
  this.tiles = new TilesEndpoint(this.http, this.tileAuth, tileOpts);
28413
28696
  this.cells = new CellsEndpoint(this.http);
28414
28697
  this.coverage = new CoverageEndpoint(this.http);
28698
+ this.weather = new WeatherEndpoint(this.http);
28415
28699
  this.featuresEp = new FeaturesEndpoint(this.http);
28416
28700
  this.queryEp = new QueryEndpoint(this.http);
28417
28701
  this.offline = new OfflineEndpoint(this.http, config.deviceId, config.manifestPath);
@@ -28692,6 +28976,7 @@ var Chrt = class {
28692
28976
  CHRT_ICON_EXPRESSIONS,
28693
28977
  CHRT_ICON_PREFIX,
28694
28978
  CHRT_SDF_GLYPHS,
28979
+ CHRT_STYLE_MODES,
28695
28980
  Chrt,
28696
28981
  ChrtError,
28697
28982
  DEFAULT_CLICK_TOLERANCE,
@@ -28747,6 +29032,7 @@ var Chrt = class {
28747
29032
  TileAuth,
28748
29033
  TileTokenError,
28749
29034
  WATER_BODY_LAYER_GROUPS,
29035
+ WeatherEndpoint,
28750
29036
  applyChrtSymbolSet,
28751
29037
  applyColorTheme,
28752
29038
  applyCustomStyleSettings,
@@ -28821,6 +29107,7 @@ var Chrt = class {
28821
29107
  lightColor,
28822
29108
  lightFillExpression,
28823
29109
  lightsIconExpression,
29110
+ normalizeStyleMode,
28824
29111
  normalizeTheme,
28825
29112
  paginate,
28826
29113
  parseListCodes,
@@ -28841,6 +29128,7 @@ var Chrt = class {
28841
29128
  sanitizeCustomStyleConfig,
28842
29129
  scaleSizeValue,
28843
29130
  scaminToMinZoom,
29131
+ styleModeBand,
28844
29132
  withinBboxFilter,
28845
29133
  worldMinusBboxPolygon
28846
29134
  });