@atmosx/event-product-parser 3.0.44 → 3.0.46

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 (62) hide show
  1. package/README.md +66 -31
  2. package/SUPPORTED_EVENTS.md +369 -0
  3. package/dist/cjs/index.cjs +476 -373
  4. package/dist/esm/index.mjs +454 -352
  5. package/dist/index.d.mts +42 -24
  6. package/dist/index.d.ts +42 -24
  7. package/package.json +1 -1
  8. package/src/@building/{building.outlooks.ts → building.attachments.ts} +7 -1
  9. package/src/@building/building.enhance.ts +7 -3
  10. package/src/@building/building.office.ts +2 -2
  11. package/src/@building/building.properties.ts +11 -11
  12. package/src/@building/building.signature.ts +11 -11
  13. package/src/@building/building.tags.ts +2 -2
  14. package/src/@building/building.tracking.ts +3 -3
  15. package/src/@building/building.validate.ts +2 -2
  16. package/src/@core/core.createEvent.ts +82 -0
  17. package/src/@dictionaries/{dictionaries.eventActions.ts → dictionaries.actions.ts} +1 -1
  18. package/src/@dictionaries/{dictionaries.eventAwipAbreviations.ts → dictionaries.awips.ts} +1 -1
  19. package/src/@dictionaries/{dictionaries.eventCancelMessages.ts → dictionaries.cancellation.ts} +1 -1
  20. package/src/@dictionaries/{dictionaries.eventCauses.ts → dictionaries.causes.ts} +1 -1
  21. package/src/@dictionaries/{dictionaries.statusCorrelationText.ts → dictionaries.correlations.ts} +1 -1
  22. package/src/@dictionaries/{dictionaries.betterEventNames.ts → dictionaries.enhanced.ts} +13 -2
  23. package/src/@dictionaries/{dictionaries.eventTypes.ts → dictionaries.events.ts} +1 -1
  24. package/src/@dictionaries/{dictionaries.regExp.ts → dictionaries.expressions.ts} +1 -1
  25. package/src/@dictionaries/{dictionaries.hailStrings.ts → dictionaries.hail.ts} +4 -1
  26. package/src/@dictionaries/{dictionaries.officeICAOs.ts → dictionaries.icao.ts} +1 -1
  27. package/src/@dictionaries/{dictionaries.eventsMatchText.ts → dictionaries.matches.ts} +1 -1
  28. package/src/@dictionaries/{dictionaries.eventProducts.ts → dictionaries.products.ts} +1 -1
  29. package/src/@dictionaries/{dictionaries.eventRecords.ts → dictionaries.records.ts} +1 -1
  30. package/src/@dictionaries/{dictionaries.eventSeverity.ts → dictionaries.severity.ts} +1 -1
  31. package/src/@dictionaries/{dictionaries.shapefileLinks.ts → dictionaries.shapefiles.ts} +1 -1
  32. package/src/@dictionaries/{dictionaries.eventStatus.ts → dictionaries.status.ts} +1 -1
  33. package/src/@dictionaries/{dictionaries.eventTags.ts → dictionaries.tags.ts} +1 -1
  34. package/src/@dictionaries/{dictionaries.testSignatures.ts → dictionaries.test.ts} +3 -2
  35. package/src/@events/events.api.ts +17 -15
  36. package/src/@events/events.text.ts +2 -2
  37. package/src/@events/events.ugc.ts +2 -2
  38. package/src/@manager/manager.mkEvent.ts +3 -3
  39. package/src/@manager/manager.rmEvent.ts +3 -2
  40. package/src/@manager/manager.updateListener.ts +124 -0
  41. package/src/@modules/@database/database.shapefiles.ts +2 -2
  42. package/src/@modules/@eas/eas.getCleanDescription.ts +2 -0
  43. package/src/@modules/@eas/eas.getTTS.ts +19 -8
  44. package/src/@modules/@eas/eas.setEasTone.ts +15 -10
  45. package/src/@modules/@stanza/stanza.getAwipsType.ts +2 -2
  46. package/src/@modules/@stanza/stanza.validate.ts +3 -3
  47. package/src/@modules/@utilities/utilities.setCronSchedule.ts +4 -2
  48. package/src/@parsers/@hvtec/hvtec.extract.ts +8 -8
  49. package/src/@parsers/@pvtec/pvtec.extract.ts +12 -12
  50. package/src/@parsers/@text/text.getDescriptionFromProduct.ts +2 -2
  51. package/src/@parsers/@text/text.getEmbed.ts +60 -0
  52. package/src/@parsers/@ugc/ugc.header.ts +3 -3
  53. package/src/@types/type.event.ts +2 -2
  54. package/src/@types/{type.webhook.ts → type.listener.ts} +11 -7
  55. package/src/@types/type.properties.ts +9 -9
  56. package/src/@types/type.settings.ts +7 -6
  57. package/src/bootstrap.ts +7 -6
  58. package/src/index.ts +2 -1
  59. package/test.js +19 -19
  60. package/src/@manager/manager.createWebhook.ts +0 -129
  61. package/src/@manager/manager.updateWebhooks.ts +0 -49
  62. package/src/@modules/@utilities/utilities.isImageReady.ts +0 -27
@@ -10491,6 +10491,7 @@ var index_exports = {};
10491
10491
  __export(index_exports, {
10492
10492
  Manager: () => Manager,
10493
10493
  clearEvents: () => clearEvents,
10494
+ createEvent: () => createEvent2,
10494
10495
  default: () => index_default,
10495
10496
  getCleanedEvent: () => getCleanedEvent,
10496
10497
  getEventGeometry: () => getEventGeometry,
@@ -10510,7 +10511,7 @@ module.exports = __toCommonJS(index_exports);
10510
10511
  var import_path = __toESM(require("path"));
10511
10512
  var import_node_events = require("events");
10512
10513
  var bootstrap = {
10513
- version: `3.0.44`,
10514
+ version: `3.0.46`,
10514
10515
  isReady: true,
10515
10516
  ratelimits: {},
10516
10517
  session_xmpp: null,
@@ -10566,7 +10567,7 @@ var bootstrap = {
10566
10567
  CallbackInterval: 15,
10567
10568
  EventsEndpoint: `https://api.weather.gov/alerts/active`
10568
10569
  },
10569
- WebhookSettings: [],
10570
+ ListenerSettings: [],
10570
10571
  GlobalSettings: {
10571
10572
  EventManagement: true,
10572
10573
  BetterEventNames: true,
@@ -10586,10 +10587,11 @@ var bootstrap = {
10586
10587
  NodeLocationFiltering: false,
10587
10588
  IgnoreTestProducts: true
10588
10589
  },
10589
- EASSettings: {
10590
- ArchiveTTL: 60,
10591
- ArchiveDirectory: null,
10592
- IntroWavFile: null
10590
+ ArchiveSettings: {
10591
+ TTL: 60,
10592
+ TextDirectory: null,
10593
+ EasDirectory: null,
10594
+ EasToneout: null
10593
10595
  }
10594
10596
  }
10595
10597
  }
@@ -13603,8 +13605,8 @@ var xError = () => {
13603
13605
  }));
13604
13606
  };
13605
13607
 
13606
- // src/@dictionaries/dictionaries.regExp.ts
13607
- var regExp = {
13608
+ // src/@dictionaries/dictionaries.expressions.ts
13609
+ var dict_expressions = {
13608
13610
  pvtec: new RegExp(`[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`, "g"),
13609
13611
  hvtec: new RegExp(`[a-zA-Z0-9]{4}.[A-Z0-9].[A-Z]{2}.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[A-Z]{2}`, "imu"),
13610
13612
  wmo: new RegExp(`[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`, "imu"),
@@ -13614,8 +13616,8 @@ var regExp = {
13614
13616
  dateline: new RegExp(`\\d{3,4}\\s*(AM|PM)?\\s*[A-Z]{2,4}\\s+[A-Z]{3,}\\s+[A-Z]{3,}\\s+\\d{1,2}\\s+\\d{4}`, "gim")
13615
13617
  };
13616
13618
 
13617
- // src/@dictionaries/dictionaries.eventAwipAbreviations.ts
13618
- var eventAwipAbreviations = {
13619
+ // src/@dictionaries/dictionaries.awips.ts
13620
+ var dict_awips = {
13619
13621
  ABV: `rawinsonde-data-above-100-millibars`,
13620
13622
  ADA: `alarm-alert-administrative-message`,
13621
13623
  ADM: `alert-administrative-message`,
@@ -13970,7 +13972,7 @@ var getAwipsType = (options) => {
13970
13972
  prefix: null
13971
13973
  };
13972
13974
  }
13973
- for (const [prefix, type] of Object.entries(eventAwipAbreviations)) {
13975
+ for (const [prefix, type] of Object.entries(dict_awips)) {
13974
13976
  if (attributes.awipsid.startsWith(prefix)) {
13975
13977
  return { type, prefix };
13976
13978
  }
@@ -13988,8 +13990,8 @@ var validate = (options) => {
13988
13990
  if (attributes.awipsid && attributes.awipsid.length > 1) {
13989
13991
  const isCapEvent = message.includes(`<?xml`);
13990
13992
  const isCapAreaDescription = message.includes(`<areaDesc>`);
13991
- const isVTEC = message.match(regExp.pvtec) != null;
13992
- const isUGC = message.match(regExp.ugc1) != null;
13993
+ const isVTEC = message.match(dict_expressions.pvtec) != null;
13994
+ const isUGC = message.match(dict_expressions.ugc1) != null;
13993
13995
  const getType = getAwipsType({ attributes });
13994
13996
  if (getType.type != null) {
13995
13997
  return {
@@ -14013,7 +14015,7 @@ var validate = (options) => {
14013
14015
  // src/@parsers/@text/text.getDescriptionFromProduct.ts
14014
14016
  var getDescriptionFromProduct = (options) => {
14015
14017
  let message = options.message;
14016
- const dates = Array.from(message.matchAll(regExp.dateline));
14018
+ const dates = Array.from(message.matchAll(dict_expressions.dateline));
14017
14019
  if (dates.length) {
14018
14020
  const lastMatch = dates[dates.length - 1][0];
14019
14021
  const sIndx = message.lastIndexOf(lastMatch);
@@ -14079,8 +14081,8 @@ var getTextFromProduct = (options) => {
14079
14081
  return null;
14080
14082
  };
14081
14083
 
14082
- // src/@dictionaries/dictionaries.officeICAOs.ts
14083
- var officeICAOs = {
14084
+ // src/@dictionaries/dictionaries.icao.ts
14085
+ var dict_icao = {
14084
14086
  "KLUB": "Lubbock, TX",
14085
14087
  "KLCH": "Lake Charles, LA",
14086
14088
  "TSTL": "St. Louis, MO",
@@ -14325,12 +14327,12 @@ var officeICAOs = {
14325
14327
  var getEventOffice = (options) => {
14326
14328
  var _a, _b, _c, _d, _e, _f, _g;
14327
14329
  const office = options.pVtec != null ? (_b = (_a = options.pVtec) == null ? void 0 : _a.tracking) == null ? void 0 : _b.split(`.`)[0] : (_e = (_c = options.attributes) == null ? void 0 : _c.cccc) != null ? _e : options.organization != null ? Array.isArray(options.organization) ? (_d = options.organization) == null ? void 0 : _d[0] : options.organization : null;
14328
- const name = (_g = (_f = officeICAOs) == null ? void 0 : _f[office]) != null ? _g : null;
14330
+ const name = (_g = (_f = dict_icao) == null ? void 0 : _f[office]) != null ? _g : null;
14329
14331
  return { office, name };
14330
14332
  };
14331
14333
 
14332
- // src/@dictionaries/dictionaries.eventTags.ts
14333
- var eventTags = {
14334
+ // src/@dictionaries/dictionaries.tags.ts
14335
+ var dict_tags = {
14334
14336
  "FROSTBITE AND HYPOTHERMIA ARE LIKELY": "Frostbite and Hypothermia Likely",
14335
14337
  "LICKELY BECOME SLICK AND HAZARDOUS": "Slick and Hazardous Roads",
14336
14338
  "SLIPPERY ROAD CONDITIONS": "Slippery Roads",
@@ -14407,13 +14409,13 @@ var eventTags = {
14407
14409
 
14408
14410
  // src/@building/building.tags.ts
14409
14411
  var getEventTags = (message) => {
14410
- return Object.entries(eventTags).filter(([key]) => message == null ? void 0 : message.toLowerCase().includes(key.toLowerCase())).map(([, value]) => value);
14412
+ return Object.entries(dict_tags).filter(([key]) => message == null ? void 0 : message.toLowerCase().includes(key.toLowerCase())).map(([, value]) => value);
14411
14413
  };
14412
14414
 
14413
14415
  // src/@building/building.properties.ts
14414
14416
  var properties = (options) => {
14415
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
14416
- const organization = (_b = (_a = options.message.match(regExp.wmo)) == null ? void 0 : _a[0]) != null ? _b : null;
14417
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V;
14418
+ const organization = (_b = (_a = options.message.match(dict_expressions.wmo)) == null ? void 0 : _a[0]) != null ? _b : null;
14417
14419
  const polygons = getPolygonFromProduct(options.message);
14418
14420
  const properties2 = {
14419
14421
  locations: (_e = (_d = (_c = options == null ? void 0 : options.ugc) == null ? void 0 : _c.locations) == null ? void 0 : _d.join(`; `)) != null ? _e : null,
@@ -14440,27 +14442,27 @@ var properties = (options) => {
14440
14442
  wind_threat: (_s = getTextFromProduct({ message: options.message, find: [`WIND THREAT...`] })) != null ? _s : null,
14441
14443
  hail_threat: (_t = getTextFromProduct({ message: options.message, find: [`HAIL THREAT...`], removal: [] })) != null ? _t : null
14442
14444
  },
14443
- spc_parameters: {
14444
- spc_number: (_u = getTextFromProduct({ message: options.message, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) != null ? _u : null,
14445
- spc_concerning: (_v = getTextFromProduct({ message: options.message, find: [`Concerning...`] })) != null ? _v : null,
14446
- spc_max_tornado: (_w = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _w : null,
14447
- spc_max_hail: (_x = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _x : null,
14448
- spc_max_wind: (_y = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _y : null,
14449
- spc_watch_issuance: (_z = getTextFromProduct({ message: options.message, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _z : null
14445
+ discussion_parameters: {
14446
+ discussion_number: (_w = (_v = (_u = getTextFromProduct({ message: options.message, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) == null ? void 0 : _u.toString()) == null ? void 0 : _v.padStart(4, "0")) != null ? _w : null,
14447
+ discussion_concerning: (_x = getTextFromProduct({ message: options.message, find: [`Concerning...`] })) != null ? _x : null,
14448
+ discussion_max_tornado: (_y = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _y : null,
14449
+ discussion_max_hail: (_z = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _z : null,
14450
+ discussion_max_wind: (_A = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _A : null,
14451
+ discussion_watch_issuance: (_B = getTextFromProduct({ message: options.message, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _B : null
14450
14452
  },
14451
14453
  watch_parameters: {
14452
- watch_number: (_C = (_B = (_A = getTextFromProduct({ message: options.message, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _A.replace(/(WT|WS|)/g, "")) == null ? void 0 : _B.trim()) != null ? _C : null,
14454
+ watch_number: ((_C = options == null ? void 0 : options.pVtec) == null ? void 0 : _C.is_watch) && ((_M = (_L = (_G = (_F = (_E = (_D = getTextFromProduct({ message: options.message, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _D.replace(/(WT|WS|)/g, "")) == null ? void 0 : _E.trim()) == null ? void 0 : _F.toString()) == null ? void 0 : _G.padStart(4, "0")) != null ? _L : (_K = (_J = (_I = (_H = options == null ? void 0 : options.pVtec) == null ? void 0 : _H.tracking) == null ? void 0 : _I.slice(-4)) == null ? void 0 : _J.toString()) == null ? void 0 : _K.padStart(4, "0")) != null ? _M : null),
14453
14455
  watch_type: options.message.includes(`TORNADO WATCH`) ? `Tornado` : (options == null ? void 0 : options.message.includes(`SEVERE`)) ? `Severe` : null,
14454
- additional_tornadoes_probability: (_D = getTextFromProduct({ message: options.message, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _D : null,
14455
- strong_tornadoes_probability: (_E = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _E : null,
14456
- severe_wind_probability: (_F = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _F : null,
14457
- severe_hail_probability: (_G = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _G : null,
14458
- hail_2in_probability: (_H = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? _H : null,
14459
- combined_hail_wind_probability: (_I = getTextFromProduct({ message: options.message, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _I : null,
14460
- max_hail_in: (_J = getTextFromProduct({ message: options.message, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _J : null,
14461
- max_wind_surface: (_K = getTextFromProduct({ message: options.message, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _K : null,
14462
- max_tops_x100feet: (_L = getTextFromProduct({ message: options.message, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _L : null,
14463
- pds_watch: getTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`
14456
+ additional_tornadoes_probability: (_N = getTextFromProduct({ message: options.message, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _N : null,
14457
+ strong_tornadoes_probability: (_O = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _O : null,
14458
+ severe_wind_probability: (_P = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _P : null,
14459
+ severe_hail_probability: (_Q = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Q : null,
14460
+ hail_2in_probability: (_R = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? _R : null,
14461
+ combined_hail_wind_probability: (_S = getTextFromProduct({ message: options.message, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _S : null,
14462
+ max_hail_in: (_T = getTextFromProduct({ message: options.message, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _T : null,
14463
+ max_wind_surface: (_U = getTextFromProduct({ message: options.message, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _U : null,
14464
+ max_tops_x100feet: (_V = getTextFromProduct({ message: options.message, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _V : null,
14465
+ pds_watch: getTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES` ? true : null
14464
14466
  }
14465
14467
  };
14466
14468
  if (isNaN(Number(properties2.watch_parameters.watch_number))) {
@@ -14478,8 +14480,8 @@ var getEventHeader = (options) => {
14478
14480
  return `ZCZC-ATMOSX-${options.getType.prefix}-${ugc2}-${(_b = vtec2 == null ? void 0 : vtec2.status) != null ? _b : `Issued`}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").split(".")[0]}-${(_c = properties2.geocode.office.office) != null ? _c : `KWNS`}`;
14479
14481
  };
14480
14482
 
14481
- // src/@dictionaries/dictionaries.eventsMatchText.ts
14482
- var eventsMatchText = {
14483
+ // src/@dictionaries/dictionaries.matches.ts
14484
+ var dict_matches = {
14483
14485
  "Special Weather Statement": "Special Weather Statement",
14484
14486
  "Hurricane Warning": "Hurricane Warning",
14485
14487
  "Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
@@ -14499,7 +14501,7 @@ var eventsMatchText = {
14499
14501
 
14500
14502
  // src/@building/building.tracking.ts
14501
14503
  var getEventTracking = (options) => {
14502
- var _a, _b, _c, _d, _e, _f, _g;
14504
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
14503
14505
  const properties2 = options.properties;
14504
14506
  const attributes = options.attributes;
14505
14507
  const stanza = options.stanza;
@@ -14516,26 +14518,26 @@ var getEventTracking = (options) => {
14516
14518
  }
14517
14519
  if (options.type === `API`) {
14518
14520
  if (options.vtec) {
14519
- const vtecValue = Array.isArray(options.vtec) ? options.vtec[0] : options.vtec;
14521
+ const vtecValue = Array.isArray(options.vtec) ? options.vtec[0].vtec : (_c = options.vtec) == null ? void 0 : _c.vtec;
14520
14522
  const splitPVTEC = vtecValue.split(".");
14521
14523
  return `${splitPVTEC[2]}.${splitPVTEC[3]}.${splitPVTEC[4]}.${splitPVTEC[5]}`;
14522
14524
  }
14523
- const wmoMatch = (_d = (_c = options.organization) == null ? void 0 : _c.wmoidentifier) == null ? void 0 : _d.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
14524
- const station = (_e = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _e : "N/A";
14525
+ const wmoMatch = (_e = (_d = options.organization) == null ? void 0 : _d.wmoidentifier) == null ? void 0 : _e.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
14526
+ const station = (_f = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _f : "N/A";
14525
14527
  if (options.organization.featureId) {
14526
14528
  const idMatch = options.organization.featureId.match(/([a-f0-9]+)\.(\d+)\.(\d+)$/);
14527
- return `${station}.${(_f = idMatch == null ? void 0 : idMatch[1]) != null ? _f : "N/A"}`;
14529
+ return `${station}.${(_h = (_g = idMatch == null ? void 0 : idMatch[0]) == null ? void 0 : _g.replace(/\./g, "")) != null ? _h : "N/A"}`;
14528
14530
  }
14529
- const id2 = (_g = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _g : "N/A";
14530
- return `${station}.${id2}`;
14531
+ const id2 = (_i = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _i : "N/A";
14532
+ return `${station}.${(_j = id2 == null ? void 0 : id2.replace(/\./g, "")) != null ? _j : "N/A"}`;
14531
14533
  }
14532
14534
  };
14533
14535
 
14534
14536
  // src/@building/building.validate.ts
14535
14537
  var import_crypto = require("crypto");
14536
14538
 
14537
- // src/@dictionaries/dictionaries.betterEventNames.ts
14538
- var betterEventNames = {
14539
+ // src/@dictionaries/dictionaries.enhanced.ts
14540
+ var dict_enhanced = {
14539
14541
  "Tornado Warning": {
14540
14542
  "Tornado Emergency": {
14541
14543
  description: "tornado emergency"
@@ -14553,6 +14555,11 @@ var betterEventNames = {
14553
14555
  },
14554
14556
  "Radar Indicated Tornado Warning": {}
14555
14557
  },
14558
+ "Fire Weather Warning": {
14559
+ "PDS Fire Weather Warning": {
14560
+ description: "particularly dangerous situation"
14561
+ }
14562
+ },
14556
14563
  "Blizzard Warning": {
14557
14564
  "PDS Blizzard Warning": {
14558
14565
  description: "particularly dangerous situation"
@@ -14570,7 +14577,12 @@ var betterEventNames = {
14570
14577
  },
14571
14578
  "Tornado Watch": {
14572
14579
  "PDS Tornado Watch": {
14573
- description: "particularly dangerous situation"
14580
+ pdswatch: true
14581
+ }
14582
+ },
14583
+ "Severe Thunderstorm Watch": {
14584
+ "PDS Severe Thunderstorm Watch": {
14585
+ pdswatch: true
14574
14586
  }
14575
14587
  },
14576
14588
  "Flash Flood Warning": {
@@ -14611,16 +14623,17 @@ var betterEventNames = {
14611
14623
 
14612
14624
  // src/@building/building.enhance.ts
14613
14625
  var getEventEnhancedName = (event) => {
14614
- var _a, _b, _c, _d, _e, _f, _g;
14626
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
14615
14627
  const configurations = bootstrap.settings;
14616
14628
  let name = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.event;
14617
14629
  if (!((_b = configurations == null ? void 0 : configurations.GlobalSettings) == null ? void 0 : _b.BetterEventNames)) {
14618
14630
  return name;
14619
14631
  }
14620
14632
  const damage = (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.parameters) == null ? void 0 : _d.damage_threat;
14621
- const tornado = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters.tornado_threat;
14622
- const description = (_g = (_f = event == null ? void 0 : event.properties) == null ? void 0 : _f.description) == null ? void 0 : _g.toLowerCase();
14623
- for (const [eventKey, eventConfig] of Object.entries(betterEventNames)) {
14633
+ const tornado = (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.tornado_threat;
14634
+ const pdswatch = (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.watch_parameters) == null ? void 0 : _h.pds_watch;
14635
+ const description = (_j = (_i = event == null ? void 0 : event.properties) == null ? void 0 : _i.description) == null ? void 0 : _j.toLowerCase();
14636
+ for (const [eventKey, eventConfig] of Object.entries(dict_enhanced)) {
14624
14637
  if (eventKey !== name) continue;
14625
14638
  for (const [paramKey, paramValue] of Object.entries(eventConfig)) {
14626
14639
  let matches = true;
@@ -14633,6 +14646,9 @@ var getEventEnhancedName = (event) => {
14633
14646
  if (paramValue == null ? void 0 : paramValue.tornado) {
14634
14647
  if (paramValue.tornado !== tornado) matches = false;
14635
14648
  }
14649
+ if (paramValue == null ? void 0 : paramValue.pdswatch) {
14650
+ if (paramValue.pdswatch !== pdswatch) matches = false;
14651
+ }
14636
14652
  if (matches) {
14637
14653
  name = paramKey;
14638
14654
  break;
@@ -14642,8 +14658,8 @@ var getEventEnhancedName = (event) => {
14642
14658
  return name;
14643
14659
  };
14644
14660
 
14645
- // src/@dictionaries/dictionaries.statusCorrelationText.ts
14646
- var statusCorrelationText = [
14661
+ // src/@dictionaries/dictionaries.correlations.ts
14662
+ var dict_correlations = [
14647
14663
  { type: "Statement", name: "Statement", isCancel: false, isUpdate: false, isIssued: true, isStatement: true },
14648
14664
  { type: "Update", name: "Updated", isCancel: false, isUpdate: true, isIssued: false, isStatement: false },
14649
14665
  { type: "Cancel", name: "Cancelled", isCancel: true, isUpdate: false, isIssued: false, isStatement: false },
@@ -14658,8 +14674,8 @@ var statusCorrelationText = [
14658
14674
  { type: "Routine", name: "Routine", isCancel: false, isUpdate: true, isIssued: false, isStatement: false }
14659
14675
  ];
14660
14676
 
14661
- // src/@dictionaries/dictionaries.eventCancelMessages.ts
14662
- var eventCancelMessages = [
14677
+ // src/@dictionaries/dictionaries.cancellation.ts
14678
+ var dict_cancellation = [
14663
14679
  "has been cancelled",
14664
14680
  "subsided sufficiently for the advisory to be cancelled",
14665
14681
  "has been cancelled",
@@ -14671,24 +14687,28 @@ var eventCancelMessages = [
14671
14687
  "has weakened below severe"
14672
14688
  ];
14673
14689
 
14674
- // src/@dictionaries/dictionaries.testSignatures.ts
14675
- var testSignatures = [
14690
+ // src/@dictionaries/dictionaries.test.ts
14691
+ var dict_testing = [
14676
14692
  `This is a test message`,
14677
14693
  `Monitoring message only.`,
14678
- `THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY`
14694
+ `THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY`,
14695
+ "TEST MESSAGE"
14679
14696
  ];
14680
14697
 
14681
- // src/@dictionaries/dictionaries.eventProducts.ts
14682
- var eventProducts = {
14698
+ // src/@dictionaries/dictionaries.products.ts
14699
+ var dict_products = {
14683
14700
  "O": "Operational Product",
14684
14701
  "T": "Test Product",
14685
14702
  "E": "Experimental Product",
14686
14703
  "X": "Experimental Product (Non-Operational)"
14687
14704
  };
14688
14705
 
14689
- // src/@dictionaries/dictionaries.hailStrings.ts
14690
- var hailStrings = {
14706
+ // src/@dictionaries/dictionaries.hail.ts
14707
+ var dict_hail = {
14708
+ ".25": "Pea",
14709
+ ".50": "Penny",
14691
14710
  ".75": "Penny",
14711
+ "Up to .75": "Penny",
14692
14712
  ".88": "Nickel",
14693
14713
  "0.75": "Penny",
14694
14714
  "0.88": "Nickel",
@@ -14704,25 +14724,25 @@ var hailStrings = {
14704
14724
 
14705
14725
  // src/@building/building.signature.ts
14706
14726
  var getEventSignature = (event) => {
14707
- var _a, _b, _c, _d, _e, _f;
14727
+ var _a, _b, _c, _d, _e, _f, _g, _h;
14708
14728
  const properties2 = event == null ? void 0 : event.properties;
14709
14729
  const vtec2 = (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.metadata) == null ? void 0 : _b.vtec;
14710
- const status = statusCorrelationText.find((c) => c.type === (properties2 == null ? void 0 : properties2.status));
14711
- const csig = eventCancelMessages.find((sig) => properties2.description.toLowerCase().includes(sig.toLowerCase()));
14730
+ const status = dict_correlations.find((c) => c.type === (properties2 == null ? void 0 : properties2.status));
14731
+ const csig = dict_cancellation.find((sig) => properties2.description.toLowerCase().includes(sig.toLowerCase()));
14712
14732
  properties2.status_metadata = __spreadProps(__spreadValues({}, properties2.status_metadata), { is_issued: true, is_test: false });
14713
- if (properties2.parameters.estimated_hail_size) {
14714
- properties2.parameters.estimated_hail_size += ` (${(_c = hailStrings[properties2.parameters.estimated_hail_size]) != null ? _c : "--"})`;
14733
+ if ((_c = properties2 == null ? void 0 : properties2.parameters) == null ? void 0 : _c.estimated_hail_size) {
14734
+ properties2.parameters.estimated_hail_size += ` (${(_e = dict_hail[(_d = properties2 == null ? void 0 : properties2.parameters) == null ? void 0 : _d.estimated_hail_size]) != null ? _e : "--"})`;
14715
14735
  }
14716
14736
  if (status) {
14717
- properties2.status = (_d = status.name) != null ? _d : properties2.status;
14737
+ properties2.status = (_f = status.name) != null ? _f : properties2.status;
14718
14738
  properties2.status_metadata = __spreadProps(__spreadValues({}, properties2.status_metadata), { is_updated: !!status.isUpdate, is_issued: !!status.isIssued, is_expired: !!status.isCancel, is_statement: !!status.isStatement });
14719
14739
  }
14720
14740
  if (csig) {
14721
14741
  properties2.status_metadata = __spreadProps(__spreadValues({}, properties2.status_metadata), { is_expired: true });
14722
14742
  }
14723
- const getProduct = (_f = (_e = vtec2 == null ? void 0 : vtec2.vtec) == null ? void 0 : _e.split(`.`)[0]) == null ? void 0 : _f.replace(`/`, ``);
14724
- const isTestProduct = eventProducts[getProduct] == `Test Product`;
14725
- if (isTestProduct || testSignatures.some((sig) => {
14743
+ const getProduct = (_h = (_g = vtec2 == null ? void 0 : vtec2.vtec) == null ? void 0 : _g.split(`.`)[0]) == null ? void 0 : _h.replace(`/`, ``);
14744
+ const isTestProduct = dict_products[getProduct] == `Test Product`;
14745
+ if (isTestProduct || dict_testing.some((sig) => {
14726
14746
  var _a2, _b2, _c2, _d2;
14727
14747
  return (_d2 = (_a2 = properties2.description) == null ? void 0 : _a2.toLowerCase().includes(sig.toLowerCase())) != null ? _d2 : (_c2 = (_b2 = properties2 == null ? void 0 : properties2.parameters) == null ? void 0 : _b2.instructions) == null ? void 0 : _c2.toLowerCase().includes(sig.toLowerCase());
14728
14748
  })) {
@@ -14749,74 +14769,6 @@ var setHash = (event, entry) => {
14749
14769
  }
14750
14770
  };
14751
14771
 
14752
- // src/@modules/@utilities/utilities.createHttp.ts
14753
- var import_request = __toESM(require("request"));
14754
- var createHttp = (options) => __async(null, null, function* () {
14755
- return new Promise((resolve6, reject) => {
14756
- var _a, _b, _c, _d, _e;
14757
- const requestOptions = {
14758
- url: (_a = options.url) != null ? _a : `https://api.weather.gov/alerts/active`,
14759
- headers: (_b = options.headers) != null ? _b : {
14760
- "User-Agent": "AtmosphericX",
14761
- "Accept": "application/geo+json, text/plain, */*; q=0.9",
14762
- "Accept-Language": "en-US,en;q=0.9"
14763
- },
14764
- method: (_c = options.method) != null ? _c : `GET`,
14765
- timeout: (_d = options.timeout) != null ? _d : 1e4,
14766
- proxy: (_e = options.proxy) != null ? _e : null,
14767
- maxRedirects: 1
14768
- };
14769
- if (options.formData) {
14770
- requestOptions["formData"] = options.formData;
14771
- } else if (options.body) {
14772
- requestOptions["body"] = options.body;
14773
- }
14774
- (0, import_request.default)(requestOptions, (error, response2, body) => {
14775
- var _a2, _b2, _c2, _d2, _e2;
14776
- if (error) {
14777
- return resolve6({
14778
- error: true,
14779
- options: requestOptions,
14780
- status: -1,
14781
- message: (_a2 = error.message) != null ? _a2 : `Unknown Error`
14782
- });
14783
- }
14784
- if (response2.statusCode < 200 || response2.statusCode >= 300) {
14785
- return resolve6({
14786
- error: true,
14787
- options: requestOptions,
14788
- status: (_b2 = response2.statusCode) != null ? _b2 : -1,
14789
- message: `HTTP Status Code ${(_c2 = response2.statusCode) != null ? _c2 : `Unknown Status Code`} (${body})`
14790
- });
14791
- }
14792
- if (body == void 0 || body == null) {
14793
- return resolve6({
14794
- error: true,
14795
- options: requestOptions,
14796
- status: (_d2 = response2.statusCode) != null ? _d2 : -1,
14797
- message: `Empty Response Body`
14798
- });
14799
- }
14800
- resolve6({
14801
- error: false,
14802
- options: requestOptions,
14803
- status: (_e2 = response2.statusCode) != null ? _e2 : -1,
14804
- message: body
14805
- });
14806
- });
14807
- });
14808
- });
14809
-
14810
- // src/@modules/@utilities/utilities.isImageReady.ts
14811
- var isImageReady = (url) => __async(null, null, function* () {
14812
- try {
14813
- const res = yield fetch(url, { method: "HEAD" });
14814
- return res.ok;
14815
- } catch (e) {
14816
- return false;
14817
- }
14818
- });
14819
-
14820
14772
  // src/@modules/@eas/eas.getWavPCM16.ts
14821
14773
  var getWavPCM16 = (buffer) => {
14822
14774
  if (buffer.toString("ascii", 0, 4) !== "RIFF" || buffer.toString("ascii", 8, 12) !== "WAVE") {
@@ -15061,17 +15013,34 @@ var getPCM16 = (samples, sampleRate) => {
15061
15013
 
15062
15014
  // src/@modules/@eas/eas.getTTS.ts
15063
15015
  var import_os = require("os");
15016
+ var import_fs = require("fs");
15064
15017
  var import_child_process = require("child_process");
15065
15018
  var getTTS = (text2, outputPath) => __async(null, null, function* () {
15066
15019
  const vPlatform = (0, import_os.platform)();
15067
15020
  switch (vPlatform) {
15068
15021
  case "win32": {
15069
- const command = `Add-Type -AssemblyName System.Speech;$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;$speak.SetOutputToWaveFile('${outputPath}');$speak.Speak('${text2}');$speak.Dispose();`;
15070
- (0, import_child_process.execSync)(`powershell -Command "${command}"`, { stdio: "ignore" });
15022
+ try {
15023
+ const txtPath = outputPath + ".txt";
15024
+ (0, import_fs.writeFileSync)(txtPath, text2, "utf8");
15025
+ const command = [
15026
+ "Add-Type -AssemblyName System.Speech;",
15027
+ `$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;`,
15028
+ `$text = Get-Content -Raw -LiteralPath '${txtPath}';`,
15029
+ `$speak.SetOutputToWaveFile('${outputPath}');`,
15030
+ `$speak.Speak($text);`,
15031
+ `$speak.Dispose();`
15032
+ ].join(" ");
15033
+ (0, import_child_process.execSync)(`powershell -Command "${command}"`, { stdio: "inherit" });
15034
+ } catch (error) {
15035
+ console.error("Error occurred while generating TTS:", error);
15036
+ }
15071
15037
  break;
15072
15038
  }
15073
15039
  case "linux":
15074
- (0, import_child_process.execSync)(`espeak -w "${outputPath}" "${text2.replace(/"/g, '\\"')}"`);
15040
+ try {
15041
+ (0, import_child_process.execSync)(`espeak -w "${outputPath}" "${text2.replace(/"/g, '\\"')}"`);
15042
+ } catch (e) {
15043
+ }
15075
15044
  break;
15076
15045
  default:
15077
15046
  break;
@@ -15147,20 +15116,22 @@ var getCleanDescription = (message) => {
15147
15116
  for (const { regex, replacement } of patches) {
15148
15117
  message = message.replace(regex, replacement);
15149
15118
  }
15150
- return message.replace(/\b(\d{1,2}):(\d{2})\s*(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{1,2})\s+(\d{2})\s+(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{2})(\d{2})\s+(AM|PM)\b/gi, (_, hh, mm, ap) => fmt(+hh, +mm, ap.toUpperCase())).replace(/\*+/g, " ").replace(/-/g, " ").replace(/\n/g, " ").trim();
15119
+ return message.replace(/'/g, "''").replace(/\b(\d{1,2}):(\d{2})\s*(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{1,2})\s+(\d{2})\s+(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{2})(\d{2})\s+(AM|PM)\b/gi, (_, hh, mm, ap) => fmt(+hh, +mm, ap.toUpperCase())).replace(/\b(\d{1,2})\s+(AM|PM)\b/gi, (_, h, ap) => fmt(+h, 0, ap.toUpperCase())).replace(/\*+/g, " ").replace(/-/g, " ").replace(/\n/g, " ").trim();
15151
15120
  };
15152
15121
 
15153
15122
  // src/@modules/@eas/eas.setEasTone.ts
15154
15123
  var import_path2 = require("path");
15155
- var import_fs = require("fs");
15124
+ var import_fs2 = require("fs");
15156
15125
  var import_child_process2 = require("child_process");
15157
15126
  var import_os2 = require("os");
15158
15127
  var setEasTone = (options) => __async(null, null, function* () {
15128
+ var _a;
15159
15129
  const settings = bootstrap.settings;
15160
- const directory = settings.GlobalSettings.EASSettings.ArchiveDirectory;
15161
- const prefix = settings.GlobalSettings.EASSettings.IntroWavFile;
15130
+ const directory = settings.GlobalSettings.ArchiveSettings.EasDirectory;
15131
+ const prefix = settings.GlobalSettings.ArchiveSettings.EasToneout;
15162
15132
  let message = options.message;
15163
15133
  let header = options.header;
15134
+ let title = (_a = options.title) != null ? _a : `${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, "")}`;
15164
15135
  if (!message || !header) {
15165
15136
  setWarning({
15166
15137
  title: `EAS`,
@@ -15171,17 +15142,17 @@ var setEasTone = (options) => __async(null, null, function* () {
15171
15142
  let buffTTS;
15172
15143
  let buffRadio;
15173
15144
  let buffFull = [];
15174
- if (!(0, import_fs.existsSync)(directory)) {
15175
- (0, import_fs.mkdirSync)(directory, { recursive: true });
15145
+ if (!(0, import_fs2.existsSync)(directory)) {
15146
+ (0, import_fs2.mkdirSync)(directory, { recursive: true });
15176
15147
  }
15177
- if (!(0, import_fs.existsSync)((0, import_path2.join)(directory, `/temp`))) {
15178
- (0, import_fs.mkdirSync)((0, import_path2.join)(directory, `/temp`), { recursive: true });
15148
+ if (!(0, import_fs2.existsSync)((0, import_path2.join)(directory, `/tts`))) {
15149
+ (0, import_fs2.mkdirSync)((0, import_path2.join)(directory, `/tts`), { recursive: true });
15179
15150
  }
15180
- if (!(0, import_fs.existsSync)((0, import_path2.join)(directory, `/output`))) {
15181
- (0, import_fs.mkdirSync)((0, import_path2.join)(directory, `/output`), { recursive: true });
15151
+ if (!(0, import_fs2.existsSync)((0, import_path2.join)(directory, `/encoded`))) {
15152
+ (0, import_fs2.mkdirSync)((0, import_path2.join)(directory, `/encoded`), { recursive: true });
15182
15153
  }
15183
- const tmpTTS = (0, import_path2.join)(directory, `/temp/${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, "")}.wav`);
15184
- const outTTS = (0, import_path2.join)(directory, `/output/${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, "")}.wav`);
15154
+ const tmpTTS = (0, import_path2.join)(directory, `/tts/${title}.wav`);
15155
+ const outTTS = (0, import_path2.join)(directory, `/encoded/${title}.wav`);
15185
15156
  const vPlatform = (0, import_os2.platform)();
15186
15157
  if (vPlatform === "darwin") {
15187
15158
  setWarning({
@@ -15193,25 +15164,28 @@ var setEasTone = (options) => __async(null, null, function* () {
15193
15164
  yield new Promise((resolve6, reject) => {
15194
15165
  const tMsg = getCleanDescription(message);
15195
15166
  getTTS(tMsg, tmpTTS).then(() => {
15196
- buffTTS = (0, import_fs.readFileSync)(tmpTTS);
15197
15167
  resolve6();
15198
15168
  });
15199
15169
  });
15170
+ if (!(0, import_fs2.existsSync)(tmpTTS)) {
15171
+ return null;
15172
+ }
15173
+ buffTTS = (0, import_fs2.readFileSync)(tmpTTS);
15200
15174
  const vWav = getWavPCM16(buffTTS);
15201
15175
  const vSamples = getSampledPCM16(vWav.samples, vWav.sampleRate, 8e3);
15202
15176
  const vRadio = setRadioEffect(vSamples, 8e3);
15203
- if ((0, import_fs.existsSync)(prefix)) {
15204
- let tBuffer = (0, import_fs.readFileSync)(prefix);
15177
+ if ((0, import_fs2.existsSync)(prefix)) {
15178
+ let tBuffer = (0, import_fs2.readFileSync)(prefix);
15205
15179
  let tWav = getWavPCM16(tBuffer);
15206
15180
  if (tWav == null) {
15207
15181
  try {
15208
- const converted = (0, import_path2.join)(directory, `/temp/${Math.random().toString(36).substring(2, 15)}.converted.wav`);
15182
+ const converted = (0, import_path2.join)(directory, `/tts/${title}.converted.wav`);
15209
15183
  (0, import_child_process2.execSync)(`ffmpeg -y -i "${prefix}" -ar 8000 -ac 1 -sample_fmt s16 "${converted}"`, { stdio: "ignore" });
15210
- if ((0, import_fs.existsSync)(converted)) {
15211
- tBuffer = (0, import_fs.readFileSync)(converted);
15184
+ if ((0, import_fs2.existsSync)(converted)) {
15185
+ tBuffer = (0, import_fs2.readFileSync)(converted);
15212
15186
  tWav = getWavPCM16(tBuffer);
15213
15187
  try {
15214
- (0, import_fs.unlinkSync)(converted);
15188
+ (0, import_fs2.unlinkSync)(converted);
15215
15189
  } catch (e) {
15216
15190
  }
15217
15191
  }
@@ -15243,138 +15217,204 @@ var setEasTone = (options) => __async(null, null, function* () {
15243
15217
  const aSamples = getMergedPCM16(buffFull);
15244
15218
  const aFinal = setNoise(aSamples, 2e-3);
15245
15219
  const aBuffer = getPCM16(Array.from(aFinal).map((v) => ({ value: v })), 8e3);
15246
- (0, import_fs.writeFileSync)(outTTS, aBuffer);
15220
+ (0, import_fs2.writeFileSync)(outTTS, aBuffer);
15247
15221
  try {
15248
- (0, import_fs.unlinkSync)(tmpTTS);
15222
+ (0, import_fs2.unlinkSync)(tmpTTS);
15249
15223
  } catch (e) {
15250
15224
  }
15251
15225
  return outTTS;
15252
15226
  });
15253
15227
 
15254
- // src/@manager/manager.createWebhook.ts
15255
- var import_fs2 = require("fs");
15256
- var import_form_data = __toESM(require_form_data());
15257
- var createWebhook = (options) => __async(null, null, function* () {
15258
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
15259
- const event = options.event.properties;
15260
- const settings = options.webhook;
15228
+ // src/@parsers/@text/text.getEmbed.ts
15229
+ var getEmebed = (event) => {
15230
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua;
15261
15231
  const line = (label, value, condition = true) => condition && value ? `${label} ${value}` : null;
15262
- const isLimited = setTimeoutAction({ identifier: options.webhook.webhook, interval: options.webhook.rate, max: options.webhook.rate, addTime: true });
15263
- if (!isLimited.limited) {
15264
- const isStatement = event.status_metadata.is_statement;
15265
- const isExpired = event.status_metadata.is_expired;
15266
- let body = [
15267
- line(`**Locations:**`, (_a = event == null ? void 0 : event.locations) == null ? void 0 : _a.slice(0, 100)),
15268
- line(`**Issued:**`, `<t:${Math.floor(new Date(event.issued).getTime() / 1e3)}:R>`),
15269
- line(`**Expires:**`, `<t:${Math.floor(new Date(event.expires).getTime() / 1e3)}:R>`, !isExpired && !isStatement),
15270
- line(`**Damage Threat:**`, event.parameters.damage_threat, !isExpired),
15271
- line(`**Flood Threat:**`, event.parameters.flood_threat, !isExpired),
15272
- line(`**Tornado Threat:**`, event.parameters.tornado_threat, !isExpired),
15273
- line(`**Estimated Wind Gusts:**`, `${event.parameters.estimated_wind_gusts} ${event.parameters.wind_threat ? ` (${event.parameters.wind_threat})` : ""}`, !isExpired && event.parameters.estimated_wind_gusts != null),
15274
- line(`**Estimated Hail Size:**`, `${event.parameters.estimated_hail_size} ${event.parameters.hail_threat ? ` (${event.parameters.hail_threat})` : ""}`, !isExpired && event.parameters.estimated_hail_size != null),
15275
- line(`**Discussion:**`, event.spc_parameters.spc_number, !isExpired),
15276
- line(`**Concern:**`, event.spc_parameters.spc_concerning, !isExpired),
15277
- line(`**SPC Max Tornado Threat:**`, event.spc_parameters.spc_max_tornado, !isExpired),
15278
- line(`**SPC Max Hail Threat:**`, event.spc_parameters.spc_max_hail, !isExpired),
15279
- line(`**SPC Max Wind Threat:**`, event.spc_parameters.spc_max_wind, !isExpired),
15280
- line(`**SPC Watch Issuance Probability:**`, event.spc_parameters.spc_watch_issuance ? `${event.spc_parameters.spc_watch_issuance}%` : null, !isExpired),
15281
- line(`**Watch Number:**`, event.watch_parameters.watch_number, !isExpired),
15282
- line(`**Strong Tornadoes Probability:**`, event.watch_parameters.strong_tornadoes_probability ? `${event.watch_parameters.strong_tornadoes_probability}%` : null, !isExpired),
15283
- line(`**Additional Tornadoes Probability:**`, event.watch_parameters.additional_tornadoes_probability ? `${event.watch_parameters.additional_tornadoes_probability}%` : null, !isExpired),
15284
- line(`**Combined Hail/Wind Probability:**`, event.watch_parameters.combined_hail_wind_probability ? `${event.watch_parameters.combined_hail_wind_probability}%` : null, !isExpired),
15285
- line(`**Severe Hail Probability:**`, event.watch_parameters.severe_hail_probability ? `${event.watch_parameters.severe_hail_probability}%` : null, !isExpired),
15286
- line(`**Hail >2in Probability:**`, event.watch_parameters.hail_2in_probability ? `${event.watch_parameters.hail_2in_probability}%` : null, !isExpired),
15287
- line(`**Max Hail Inches:**`, event.watch_parameters.max_hail_in, !isExpired),
15288
- line(`**Severe Wind Probability:**`, event.watch_parameters.severe_wind_probability ? `${event.watch_parameters.severe_wind_probability}%` : null, !isExpired),
15289
- line(`**Max Surface Wind:**`, event.watch_parameters.max_wind_surface, !isExpired),
15290
- line(`**Max Tops (x100 feet):**`, event.watch_parameters.max_tops_x100feet, !isExpired),
15291
- line(`**Tags:**`, ((_b = event.parameters.tags) == null ? void 0 : _b.length) > 0 ? event.parameters.tags.join(", ") : null, !isExpired),
15292
- line(`**Sender:**`, ((_d = (_c = event.geocode) == null ? void 0 : _c.office) == null ? void 0 : _d.name) ? `${event.geocode.office.name} (${event.geocode.office.office})` : (_f = (_e = event.geocode) == null ? void 0 : _e.office) == null ? void 0 : _f.office),
15293
- line(`**Tracking:**`, (_g = event.metadata) == null ? void 0 : _g.tracking),
15294
- line(`**Logs:**`, ((_h = event.metadata.history) == null ? void 0 : _h.length) > 0 ? event.metadata.history.length : null),
15295
- line(``, event.description ? "```\n" + event.description.split("\n").map((l) => l.trim()).filter(Boolean).join("\n") + "\n```" : null, !isExpired)
15296
- ].filter(Boolean).join("\n");
15297
- if (body.length > 1900) {
15298
- body = body.substring(0, 1900) + "\n\n[Message truncated due to length]";
15299
- const blocks = ((_i = body.match(/```/g)) != null ? _i : []).length;
15300
- if (blocks % 2 !== 0) body += "```";
15301
- }
15302
- if (event.description.length < 25) {
15303
- return;
15304
- }
15305
- const form = new import_form_data.default();
15306
- const img = (_j = event.metadata.attachments) == null ? void 0 : _j[0];
15307
- const embed = {
15308
- title: `${event.event} (${event.status})`,
15309
- description: body,
15310
- color: 16711680,
15311
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
15312
- image: {},
15313
- footer: { text: settings.title }
15232
+ const isStatement = event.properties.status_metadata.is_statement;
15233
+ const isExpired = event.properties.status_metadata.is_expired;
15234
+ return [
15235
+ line(`**Locations:**`, (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.locations) == null ? void 0 : _b.slice(0, 100)),
15236
+ line(`**Issued:**`, `<t:${Math.floor(new Date(event.properties.issued).getTime() / 1e3)}:R>`, !isExpired),
15237
+ line(`**Expires:**`, `<t:${Math.floor(new Date(event.properties.expires).getTime() / 1e3)}:R>`, !isStatement),
15238
+ line(`**Damage Threat:**`, (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.parameters) == null ? void 0 : _d.damage_threat, !isExpired),
15239
+ line(`**Flood Threat:**`, (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.flood_threat, !isExpired),
15240
+ line(`**Tornado Threat:**`, (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.parameters) == null ? void 0 : _h.tornado_threat, !isExpired),
15241
+ line(`**Estimated Wind Gusts:**`, `${(_j = (_i = event == null ? void 0 : event.properties) == null ? void 0 : _i.parameters) == null ? void 0 : _j.estimated_wind_gusts} ${((_l = (_k = event == null ? void 0 : event.properties) == null ? void 0 : _k.parameters) == null ? void 0 : _l.wind_threat) ? ` (${(_n = (_m = event == null ? void 0 : event.properties) == null ? void 0 : _m.parameters) == null ? void 0 : _n.wind_threat})` : ""}`, !isExpired && ((_p = (_o = event == null ? void 0 : event.properties) == null ? void 0 : _o.parameters) == null ? void 0 : _p.estimated_wind_gusts) != null),
15242
+ line(`**Estimated Hail Size:**`, `${(_r = (_q = event == null ? void 0 : event.properties) == null ? void 0 : _q.parameters) == null ? void 0 : _r.estimated_hail_size} ${((_t = (_s = event == null ? void 0 : event.properties) == null ? void 0 : _s.parameters) == null ? void 0 : _t.hail_threat) ? ` (${(_v = (_u = event == null ? void 0 : event.properties) == null ? void 0 : _u.parameters) == null ? void 0 : _v.hail_threat})` : ""}`, !isExpired && ((_x = (_w = event == null ? void 0 : event.properties) == null ? void 0 : _w.parameters) == null ? void 0 : _x.estimated_hail_size) != null),
15243
+ line(`**Discussion:**`, (_z = (_y = event == null ? void 0 : event.properties) == null ? void 0 : _y.discussion_parameters) == null ? void 0 : _z.discussion_number, !isExpired),
15244
+ line(`**Concern:**`, (_B = (_A = event == null ? void 0 : event.properties) == null ? void 0 : _A.discussion_parameters) == null ? void 0 : _B.discussion_concerning, !isExpired),
15245
+ line(`**SPC Max Tornado Threat:**`, (_D = (_C = event == null ? void 0 : event.properties) == null ? void 0 : _C.discussion_parameters) == null ? void 0 : _D.discussion_max_tornado, !isExpired),
15246
+ line(`**SPC Max Hail Threat:**`, (_F = (_E = event == null ? void 0 : event.properties) == null ? void 0 : _E.discussion_parameters) == null ? void 0 : _F.discussion_max_hail, !isExpired),
15247
+ line(`**SPC Max Wind Threat:**`, (_H = (_G = event == null ? void 0 : event.properties) == null ? void 0 : _G.discussion_parameters) == null ? void 0 : _H.discussion_max_wind, !isExpired),
15248
+ line(`**SPC Watch Issuance Probability:**`, ((_J = (_I = event == null ? void 0 : event.properties) == null ? void 0 : _I.discussion_parameters) == null ? void 0 : _J.discussion_watch_issuance) ? `${(_L = (_K = event == null ? void 0 : event.properties) == null ? void 0 : _K.discussion_parameters) == null ? void 0 : _L.discussion_watch_issuance}%` : null, !isExpired),
15249
+ line(`**Watch Number:**`, (_N = (_M = event == null ? void 0 : event.properties) == null ? void 0 : _M.watch_parameters) == null ? void 0 : _N.watch_number, !isExpired),
15250
+ line(`**Strong Tornadoes Probability:**`, ((_P = (_O = event == null ? void 0 : event.properties) == null ? void 0 : _O.watch_parameters) == null ? void 0 : _P.strong_tornadoes_probability) ? `${(_R = (_Q = event == null ? void 0 : event.properties) == null ? void 0 : _Q.watch_parameters) == null ? void 0 : _R.strong_tornadoes_probability}%` : null, !isExpired),
15251
+ line(`**Additional Tornadoes Probability:**`, ((_T = (_S = event == null ? void 0 : event.properties) == null ? void 0 : _S.watch_parameters) == null ? void 0 : _T.additional_tornadoes_probability) ? `${(_V = (_U = event == null ? void 0 : event.properties) == null ? void 0 : _U.watch_parameters) == null ? void 0 : _V.additional_tornadoes_probability}%` : null, !isExpired),
15252
+ line(`**Combined Hail/Wind Probability:**`, ((_X = (_W = event == null ? void 0 : event.properties) == null ? void 0 : _W.watch_parameters) == null ? void 0 : _X.combined_hail_wind_probability) ? `${(_Z = (_Y = event == null ? void 0 : event.properties) == null ? void 0 : _Y.watch_parameters) == null ? void 0 : _Z.combined_hail_wind_probability}%` : null, !isExpired),
15253
+ line(`**Severe Hail Probability:**`, ((_$ = (__ = event == null ? void 0 : event.properties) == null ? void 0 : __.watch_parameters) == null ? void 0 : _$.severe_hail_probability) ? `${(_ba = (_aa = event == null ? void 0 : event.properties) == null ? void 0 : _aa.watch_parameters) == null ? void 0 : _ba.severe_hail_probability}%` : null, !isExpired),
15254
+ line(`**Hail >2in Probability:**`, ((_da = (_ca = event == null ? void 0 : event.properties) == null ? void 0 : _ca.watch_parameters) == null ? void 0 : _da.hail_2in_probability) ? `${(_fa = (_ea = event == null ? void 0 : event.properties) == null ? void 0 : _ea.watch_parameters) == null ? void 0 : _fa.hail_2in_probability}%` : null, !isExpired),
15255
+ line(`**Max Hail Inches:**`, (_ha = (_ga = event == null ? void 0 : event.properties) == null ? void 0 : _ga.watch_parameters) == null ? void 0 : _ha.max_hail_in, !isExpired),
15256
+ line(`**Severe Wind Probability:**`, ((_ja = (_ia = event == null ? void 0 : event.properties) == null ? void 0 : _ia.watch_parameters) == null ? void 0 : _ja.severe_wind_probability) ? `${(_la = (_ka = event == null ? void 0 : event.properties) == null ? void 0 : _ka.watch_parameters) == null ? void 0 : _la.severe_wind_probability}%` : null, !isExpired),
15257
+ line(`**Max Surface Wind:**`, (_na = (_ma = event == null ? void 0 : event.properties) == null ? void 0 : _ma.watch_parameters) == null ? void 0 : _na.max_wind_surface, !isExpired),
15258
+ line(`**Max Tops (x100 feet):**`, (_pa = (_oa = event == null ? void 0 : event.properties) == null ? void 0 : _oa.watch_parameters) == null ? void 0 : _pa.max_tops_x100feet, !isExpired),
15259
+ line(`**Tags:**`, ((_sa = (_ra = (_qa = event == null ? void 0 : event.properties) == null ? void 0 : _qa.parameters) == null ? void 0 : _ra.tags) == null ? void 0 : _sa.length) > 0 ? (_ua = (_ta = event == null ? void 0 : event.properties) == null ? void 0 : _ta.parameters) == null ? void 0 : _ua.tags.join(", ") : null, !isExpired),
15260
+ line(`**Sender:**`, ((_xa = (_wa = (_va = event == null ? void 0 : event.properties) == null ? void 0 : _va.geocode) == null ? void 0 : _wa.office) == null ? void 0 : _xa.name) ? `${(_Aa = (_za = (_ya = event == null ? void 0 : event.properties) == null ? void 0 : _ya.geocode) == null ? void 0 : _za.office) == null ? void 0 : _Aa.name} (${(_Da = (_Ca = (_Ba = event == null ? void 0 : event.properties) == null ? void 0 : _Ba.geocode) == null ? void 0 : _Ca.office) == null ? void 0 : _Da.office})` : (_Ga = (_Fa = (_Ea = event == null ? void 0 : event.properties) == null ? void 0 : _Ea.geocode) == null ? void 0 : _Fa.office) == null ? void 0 : _Ga.office),
15261
+ line(`**Tracking:**`, (_Ia = (_Ha = event == null ? void 0 : event.properties) == null ? void 0 : _Ha.metadata) == null ? void 0 : _Ia.tracking),
15262
+ line(`**Logs:**`, ((_La = (_Ka = (_Ja = event == null ? void 0 : event.properties) == null ? void 0 : _Ja.metadata) == null ? void 0 : _Ka.history) == null ? void 0 : _La.length) > 0 ? (_Na = (_Ma = event == null ? void 0 : event.properties) == null ? void 0 : _Ma.metadata) == null ? void 0 : _Na.history.length : null),
15263
+ line(``, ((_Qa = (_Pa = (_Oa = event == null ? void 0 : event.properties) == null ? void 0 : _Oa.metadata) == null ? void 0 : _Pa.attachments) == null ? void 0 : _Qa.length) > 0 ? `**Attachments:** ${(_Sa = (_Ra = event == null ? void 0 : event.properties) == null ? void 0 : _Ra.metadata) == null ? void 0 : _Sa.attachments.map((attachment) => {
15264
+ var _a2, _b2;
15265
+ return `[Attachment #${((_b2 = (_a2 = event == null ? void 0 : event.properties) == null ? void 0 : _a2.metadata) == null ? void 0 : _b2.attachments.indexOf(attachment)) + 1}](${attachment})`;
15266
+ }).join(" | ")}` : null),
15267
+ line(``, ((_Ta = event == null ? void 0 : event.properties) == null ? void 0 : _Ta.description) ? "```\n" + ((_Ua = event == null ? void 0 : event.properties) == null ? void 0 : _Ua.description.split("\n").map((l) => l.trim()).filter(Boolean).join("\n")) + "\n```" : null, !isExpired)
15268
+ ].filter(Boolean).join("\n");
15269
+ };
15270
+
15271
+ // src/@modules/@utilities/utilities.createHttp.ts
15272
+ var import_request = __toESM(require("request"));
15273
+ var createHttp = (options) => __async(null, null, function* () {
15274
+ return new Promise((resolve6, reject) => {
15275
+ var _a, _b, _c, _d, _e;
15276
+ const requestOptions = {
15277
+ url: (_a = options.url) != null ? _a : `https://api.weather.gov/alerts/active`,
15278
+ headers: (_b = options.headers) != null ? _b : {
15279
+ "User-Agent": "AtmosphericX",
15280
+ "Accept": "application/geo+json, text/plain, */*; q=0.9",
15281
+ "Accept-Language": "en-US,en;q=0.9"
15282
+ },
15283
+ method: (_c = options.method) != null ? _c : `GET`,
15284
+ timeout: (_d = options.timeout) != null ? _d : 1e4,
15285
+ proxy: (_e = options.proxy) != null ? _e : null,
15286
+ maxRedirects: 1
15314
15287
  };
15315
- if (img) {
15316
- for (let i = 0; i < 5; i++) {
15317
- const ok = yield isImageReady(img);
15318
- if (ok) break;
15319
- yield new Promise((r) => setTimeout(r, 5e3));
15288
+ if (options.formData) {
15289
+ requestOptions["formData"] = options.formData;
15290
+ } else if (options.body) {
15291
+ requestOptions["body"] = options.body;
15292
+ }
15293
+ (0, import_request.default)(requestOptions, (error, response2, body) => {
15294
+ var _a2, _b2, _c2, _d2, _e2;
15295
+ if (error) {
15296
+ return resolve6({
15297
+ error: true,
15298
+ options: requestOptions,
15299
+ status: -1,
15300
+ message: (_a2 = error.message) != null ? _a2 : `Unknown Error`
15301
+ });
15320
15302
  }
15321
- const finalCheck = yield isImageReady(img);
15322
- if (finalCheck) {
15323
- embed.image = { url: img };
15303
+ if (response2.statusCode < 200 || response2.statusCode >= 300) {
15304
+ return resolve6({
15305
+ error: true,
15306
+ options: requestOptions,
15307
+ status: (_b2 = response2.statusCode) != null ? _b2 : -1,
15308
+ message: `HTTP Status Code ${(_c2 = response2.statusCode) != null ? _c2 : `Unknown Status Code`} (${body})`
15309
+ });
15324
15310
  }
15325
- }
15326
- form.append("payload_json", JSON.stringify({
15327
- username: (_k = settings.title) != null ? _k : "AtmosphericX",
15328
- content: (_l = settings.message) != null ? _l : "",
15329
- embeds: [embed]
15330
- }));
15331
- if (settings.upload) {
15332
- form.append("fUpload", Buffer.from(`${event.metadata.raw}
15333
-
15334
- ${JSON.stringify(getCleanedEvent(event), null, 2)}`), { filename: `${event.event}_${event.status}_${event.metadata.tracking}.txt`, contentType: "application/text" });
15335
- }
15336
- if (settings.eas) {
15337
- const audio = yield setEasTone({
15338
- message: event.description,
15339
- header: event.metadata.header
15340
- });
15341
- const file = (0, import_fs2.readFileSync)(audio);
15342
- if (audio) {
15343
- form.append("fEas", Buffer.from(file), { filename: `${event.event}_${event.status}_${event.metadata.tracking}_eas.mp3`, contentType: "audio/mpeg" });
15311
+ if (body == void 0 || body == null) {
15312
+ return resolve6({
15313
+ error: true,
15314
+ options: requestOptions,
15315
+ status: (_d2 = response2.statusCode) != null ? _d2 : -1,
15316
+ message: `Empty Response Body`
15317
+ });
15344
15318
  }
15345
- }
15346
- yield createHttp({
15347
- url: settings.webhook,
15348
- timeout: 2e3,
15349
- method: `POST`,
15350
- headers: form.getHeaders(),
15351
- body: form
15319
+ resolve6({
15320
+ error: false,
15321
+ options: requestOptions,
15322
+ status: (_e2 = response2.statusCode) != null ? _e2 : -1,
15323
+ message: body
15324
+ });
15352
15325
  });
15353
- }
15326
+ });
15354
15327
  });
15355
15328
 
15356
- // src/@manager/manager.updateWebhooks.ts
15357
- var updateWebhooks = (event) => __async(null, null, function* () {
15329
+ // src/@manager/manager.updateListener.ts
15330
+ var import_fs3 = require("fs");
15331
+ var import_form_data = __toESM(require_form_data());
15332
+ var updateListener = (event) => __async(null, null, function* () {
15333
+ var _a, _b, _c, _d;
15358
15334
  const settings = bootstrap.settings;
15359
- const webhooks = settings.WebhookSettings;
15360
- const eventName = event.properties.event;
15361
- for (const socket of webhooks) {
15335
+ const listeners2 = settings.ListenerSettings;
15336
+ const properties2 = event.properties;
15337
+ for (const socket of listeners2) {
15362
15338
  const events = socket.events;
15363
- if (!events || events.length === 0) {
15364
- yield createWebhook({ webhook: socket, event });
15365
- continue;
15366
- }
15339
+ const sWebhook = socket == null ? void 0 : socket.webhook;
15340
+ const sUploads = socket == null ? void 0 : socket.uploads;
15367
15341
  const matched = events.some((pattern) => {
15368
15342
  if (!pattern) return false;
15369
- if (pattern === "*" || pattern === eventName) return true;
15343
+ if (pattern === "*" || pattern === properties2.event) return true;
15370
15344
  if (pattern.includes("*")) {
15371
15345
  const regex = "^" + pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*") + "$";
15372
- return new RegExp(regex).test(eventName);
15346
+ return new RegExp(regex).test(properties2.event);
15373
15347
  }
15374
15348
  return false;
15375
15349
  });
15376
- if (matched) {
15377
- yield createWebhook({ webhook: socket, event });
15350
+ if ((events == null ? void 0 : events.length) == 0 || matched) {
15351
+ let eas;
15352
+ let file;
15353
+ if (sUploads == null ? void 0 : sUploads.eas) {
15354
+ eas = yield setEasTone({
15355
+ title: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}`,
15356
+ message: properties2.description,
15357
+ header: properties2.metadata.header
15358
+ });
15359
+ }
15360
+ if (sUploads == null ? void 0 : sUploads.file) {
15361
+ const destination = bootstrap.settings.GlobalSettings.ArchiveSettings.TextDirectory;
15362
+ if (destination) {
15363
+ if (!(0, import_fs3.existsSync)(destination)) {
15364
+ (0, import_fs3.mkdirSync)(destination, { recursive: true });
15365
+ }
15366
+ if ((0, import_fs3.existsSync)(`${destination}/${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`)) {
15367
+ (0, import_fs3.appendFileSync)(`${destination}/${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`, properties2.metadata.raw);
15368
+ } else {
15369
+ (0, import_fs3.writeFileSync)(`${destination}/${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`, properties2.metadata.raw);
15370
+ }
15371
+ }
15372
+ file = properties2.metadata.raw;
15373
+ }
15374
+ if (sWebhook == null ? void 0 : sWebhook.enabled) {
15375
+ const isLimited = setTimeoutAction({ identifier: sWebhook.destination, interval: sWebhook.ratelimit, max: sWebhook.ratelimit, addTime: true });
15376
+ if (!isLimited.limited) {
15377
+ let body = getEmebed(event);
15378
+ if (body.length > 1900) {
15379
+ body = body.substring(0, 1900) + "\n\n[Message truncated due to length]";
15380
+ const blocks = ((_a = body.match(/```/g)) != null ? _a : []).length;
15381
+ if (blocks % 2 !== 0) body += "```";
15382
+ }
15383
+ if (properties2.description.length < 25) {
15384
+ continue;
15385
+ }
15386
+ const form = new import_form_data.default();
15387
+ const embed = {
15388
+ title: `${properties2.event} (${properties2.status})`,
15389
+ description: body,
15390
+ color: 16711680,
15391
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
15392
+ image: {},
15393
+ footer: { text: (_b = sWebhook.title) != null ? _b : `AtmosphericX` }
15394
+ };
15395
+ form.append("payload_json", JSON.stringify({
15396
+ username: (_c = sWebhook.title) != null ? _c : "AtmosphericX",
15397
+ content: (_d = sWebhook.message) != null ? _d : "",
15398
+ embeds: [embed]
15399
+ }));
15400
+ if (sUploads == null ? void 0 : sUploads.file) {
15401
+ form.append("fUpload", Buffer.from(file), { filename: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`, contentType: "application/text" });
15402
+ }
15403
+ if (sUploads == null ? void 0 : sUploads.eas) {
15404
+ if (eas) {
15405
+ const file2 = (0, import_fs3.readFileSync)(eas);
15406
+ form.append("fEas", Buffer.from(file2), { filename: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}_eas.mp3`, contentType: "audio/mpeg" });
15407
+ }
15408
+ }
15409
+ const a = yield createHttp({
15410
+ url: sWebhook.destination,
15411
+ timeout: 5e3,
15412
+ method: `POST`,
15413
+ headers: form.getHeaders(),
15414
+ body: form
15415
+ });
15416
+ }
15417
+ }
15378
15418
  }
15379
15419
  }
15380
15420
  });
@@ -15593,10 +15633,10 @@ var mkEvent = (event) => __async(null, null, function* () {
15593
15633
  })
15594
15634
  })
15595
15635
  });
15596
- updateWebhooks(bootstrap.cache.events.features[getIndex]);
15636
+ updateListener(bootstrap.cache.events.features[getIndex]);
15597
15637
  } else {
15598
15638
  features.push(event);
15599
- updateWebhooks(event);
15639
+ updateListener(event);
15600
15640
  }
15601
15641
  }
15602
15642
  }
@@ -15611,6 +15651,7 @@ var rmEvent = (event) => {
15611
15651
  const cachedStatus = event.properties.status;
15612
15652
  event.properties.expires = (/* @__PURE__ */ new Date()).toISOString();
15613
15653
  event.properties.status = `Expired`;
15654
+ event.properties.status_metadata.is_expired = true;
15614
15655
  if (getEvent) {
15615
15656
  setEventEmit({
15616
15657
  event: `onEventStatus`,
@@ -15621,7 +15662,7 @@ var rmEvent = (event) => {
15621
15662
  message: `[Removed] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
15622
15663
  });
15623
15664
  setEventEmit({ event: `onExpiredProduct`, metadata: event });
15624
- if (cachedStatus != `Statement`) updateWebhooks(event);
15665
+ if (cachedStatus != `Statement`) updateListener(event);
15625
15666
  bootstrap.cache.events.features.splice(bootstrap.cache.events.features.indexOf(getEvent), 1);
15626
15667
  bootstrap.cache.hashes = bootstrap.cache.hashes.filter((hash) => hash.tracking !== event.properties.metadata.tracking);
15627
15668
  }
@@ -15646,15 +15687,21 @@ var getLatestIssuance = () => {
15646
15687
  return latest.toString().padStart(4, "0");
15647
15688
  };
15648
15689
 
15649
- // src/@building/building.outlooks.ts
15690
+ // src/@building/building.attachments.ts
15650
15691
  var getEventAttachments = (event) => {
15651
- var _a, _b;
15692
+ var _a, _b, _c, _d;
15652
15693
  const latestTime = getLatestIssuance();
15694
+ const spcNumber = (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.discussion_parameters) == null ? void 0 : _b.discussion_number;
15695
+ const watchNumber = (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.watch_parameters) == null ? void 0 : _d.watch_number;
15653
15696
  const validEvents = [
15654
15697
  { target: "Day 1", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${latestTime}.png` },
15655
15698
  { target: "Day 2", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
15656
15699
  { target: "Day 3", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
15657
- { target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${(_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.spc_parameters) == null ? void 0 : _b.spc_number}.png` }
15700
+ { target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${spcNumber}.png` },
15701
+ { target: "Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
15702
+ { target: "PDS Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
15703
+ { target: "Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
15704
+ { target: "PDS Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` }
15658
15705
  ];
15659
15706
  const isValid = validEvents.find((outlook) => outlook.target == event.properties.event);
15660
15707
  if (isValid) {
@@ -15704,7 +15751,7 @@ var validateEvents = (events) => __async(null, null, function* () {
15704
15751
  rmEvent(define2);
15705
15752
  return false;
15706
15753
  }
15707
- if ((_c = (_b = properties2.metadata) == null ? void 0 : _b.vtec) == null ? void 0 : _c.is_watch) {
15754
+ if (((_c = (_b = properties2.metadata) == null ? void 0 : _b.vtec) == null ? void 0 : _c.is_watch) && properties2.metadata.source != `events.api`) {
15708
15755
  const isSPC = (_e = (_d = properties2.metadata) == null ? void 0 : _d.vtec) == null ? void 0 : _e.prediction_center;
15709
15756
  setEventEmit({ event: isSPC ? `onStormPredictionWatch` : `onNonStormPredictionWatch`, metadata: define2 });
15710
15757
  if ((bools == null ? void 0 : bools.SPCWatchesOnly) && !isSPC) {
@@ -15792,7 +15839,7 @@ var text = (stanza) => __async(null, null, function* () {
15792
15839
  const header = getEventHeader({ properties: props, getType: stanza.getType });
15793
15840
  const issued = new Date(attributes.issue);
15794
15841
  const expires = new Date(issued.getTime() + 12 * 60 * 60 * 1e3);
15795
- let event = Object.keys(eventsMatchText).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
15842
+ let event = Object.keys(dict_matches).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
15796
15843
  let isStatement = false;
15797
15844
  if (!event) {
15798
15845
  event = stanza.getType.type.split(`-`).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `);
@@ -15835,9 +15882,9 @@ var text = (stanza) => __async(null, null, function* () {
15835
15882
 
15836
15883
  // src/@parsers/@ugc/ugc.header.ts
15837
15884
  var getUGCHeader = (message) => {
15838
- const start = message.search(regExp.ugc1);
15885
+ const start = message.search(dict_expressions.ugc1);
15839
15886
  const sub = message.substring(start);
15840
- const end = sub.search(regExp.ugc2);
15887
+ const end = sub.search(dict_expressions.ugc2);
15841
15888
  const fin = sub.substring(0, end).replace(/\s+/g, "").slice(0, -1);
15842
15889
  return fin != null ? fin : null;
15843
15890
  };
@@ -15929,7 +15976,7 @@ var ugc = (stanza) => __async(null, null, function* () {
15929
15976
  const issued = new Date(attributes.issue);
15930
15977
  const expires = new Date(ugc2.expires);
15931
15978
  const header = getEventHeader({ properties: props, getType: stanza.getType });
15932
- let event = Object.keys(eventsMatchText).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
15979
+ let event = Object.keys(dict_matches).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
15933
15980
  let isStatement = false;
15934
15981
  if (!event) {
15935
15982
  event = stanza.getType.type.split(`-`).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `);
@@ -15971,8 +16018,8 @@ var ugc = (stanza) => __async(null, null, function* () {
15971
16018
  validateEvents(processed);
15972
16019
  });
15973
16020
 
15974
- // src/@dictionaries/dictionaries.eventTypes.ts
15975
- var eventTypes = {
16021
+ // src/@dictionaries/dictionaries.events.ts
16022
+ var dict_events = {
15976
16023
  "AF": "Ashfall",
15977
16024
  "AS": "Air Stagnation",
15978
16025
  "BH": "Beach Hazard",
@@ -16036,8 +16083,8 @@ var eventTypes = {
16036
16083
  "ZY": "Freezing Spray"
16037
16084
  };
16038
16085
 
16039
- // src/@dictionaries/dictionaries.eventActions.ts
16040
- var eventActions = {
16086
+ // src/@dictionaries/dictionaries.actions.ts
16087
+ var dict_actions = {
16041
16088
  "W": "Warning",
16042
16089
  "F": "Forecast",
16043
16090
  "A": "Watch",
@@ -16047,8 +16094,8 @@ var eventActions = {
16047
16094
  "S": "Statement"
16048
16095
  };
16049
16096
 
16050
- // src/@dictionaries/dictionaries.eventStatus.ts
16051
- var eventStatus = {
16097
+ // src/@dictionaries/dictionaries.status.ts
16098
+ var dict_status = {
16052
16099
  "NEW": "Issued",
16053
16100
  "CON": "Updated",
16054
16101
  "EXT": "Extended",
@@ -16073,7 +16120,8 @@ var getExpiry2 = (dates) => {
16073
16120
  // src/@parsers/@pvtec/pvtec.extract.ts
16074
16121
  var pvExtract = (message) => {
16075
16122
  var _a, _b, _c, _d;
16076
- const getVTECs = (_a = message.match(regExp.pvtec)) != null ? _a : [];
16123
+ if (!message) return null;
16124
+ const getVTECs = (_a = message.match(dict_expressions.pvtec)) != null ? _a : [];
16077
16125
  const vtecs = [];
16078
16126
  for (const vtec2 of getVTECs) {
16079
16127
  const sub = vtec2.split(`.`);
@@ -16081,11 +16129,11 @@ var pvExtract = (message) => {
16081
16129
  const dates = (_b = sub[6]) == null ? void 0 : _b.split(`-`);
16082
16130
  vtecs.push({
16083
16131
  vtec: vtec2,
16084
- product: eventProducts[sub[0]],
16132
+ product: dict_products[sub[0]],
16085
16133
  tracking: `${sub[2]}.${sub[3]}.${sub[4]}.${sub[5]}`,
16086
- event: `${eventTypes[sub[3]]} ${eventActions[sub[4]]}`,
16087
- status: eventStatus[sub[1]],
16088
- organization: (_d = (_c = message.match(regExp.wmo)) == null ? void 0 : _c[0]) != null ? _d : null,
16134
+ event: `${dict_events[sub[3]]} ${dict_actions[sub[4]]}`,
16135
+ status: dict_status[sub[1]],
16136
+ organization: (_d = (_c = message.match(dict_expressions.wmo)) == null ? void 0 : _c[0]) != null ? _d : null,
16089
16137
  expires: getExpiry2(dates),
16090
16138
  is_watch: (sub[4] == `A` || sub[4] == `Y`) && (sub[3] == `TO` || sub[3] == `SV`),
16091
16139
  prediction_center: sub[2] == `KWNS` ? true : false
@@ -16094,8 +16142,8 @@ var pvExtract = (message) => {
16094
16142
  return vtecs.length > 0 ? vtecs : null;
16095
16143
  };
16096
16144
 
16097
- // src/@dictionaries/dictionaries.eventCauses.ts
16098
- var eventCauses = {
16145
+ // src/@dictionaries/dictionaries.causes.ts
16146
+ var dict_causes = {
16099
16147
  "SM": "Snow Melt",
16100
16148
  "RS": "Rain/Snow Melt",
16101
16149
  "ER": "Excessive Rain",
@@ -16113,16 +16161,16 @@ var eventCauses = {
16113
16161
  "OT": "Other Effects"
16114
16162
  };
16115
16163
 
16116
- // src/@dictionaries/dictionaries.eventRecords.ts
16117
- var eventRecords = {
16164
+ // src/@dictionaries/dictionaries.records.ts
16165
+ var dict_records = {
16118
16166
  "NO": "No Record Expected",
16119
16167
  "NR": "Near Record or possible record",
16120
16168
  "UU": "Unknown history of records",
16121
16169
  "OO": "Other"
16122
16170
  };
16123
16171
 
16124
- // src/@dictionaries/dictionaries.eventSeverity.ts
16125
- var eventSeverity = {
16172
+ // src/@dictionaries/dictionaries.severity.ts
16173
+ var dict_severity = {
16126
16174
  N: "Not Expected",
16127
16175
  0: "Areal Flood or FF Product",
16128
16176
  1: "Minor",
@@ -16134,16 +16182,16 @@ var eventSeverity = {
16134
16182
  // src/@parsers/@hvtec/hvtec.extract.ts
16135
16183
  var hvExtract = (message) => {
16136
16184
  var _a;
16137
- const getHVTECs = (_a = message.match(regExp.hvtec)) != null ? _a : [];
16185
+ const getHVTECs = (_a = message.match(dict_expressions.hvtec)) != null ? _a : [];
16138
16186
  const vtecs = [];
16139
16187
  for (const vtec2 of getHVTECs) {
16140
16188
  const sub = vtec2.split(`.`);
16141
16189
  if (sub.length < 7) continue;
16142
16190
  vtecs.push({
16143
16191
  hvtec: vtec2,
16144
- severity: eventSeverity[sub[1]],
16145
- cause: eventCauses[sub[2]],
16146
- record: eventRecords[sub[6]]
16192
+ severity: dict_severity[sub[1]],
16193
+ cause: dict_causes[sub[2]],
16194
+ record: dict_records[sub[6]]
16147
16195
  });
16148
16196
  }
16149
16197
  return vtecs.length > 0 ? vtecs : null;
@@ -16207,12 +16255,12 @@ var vtec = (stanza) => __async(null, null, function* () {
16207
16255
 
16208
16256
  // src/@events/events.api.ts
16209
16257
  var api = (stanza) => __async(null, null, function* () {
16210
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb;
16258
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb;
16211
16259
  let processed = [];
16212
16260
  const messages = Object.values(JSON.parse(stanza.message).features);
16213
16261
  for (const feature of messages) {
16214
16262
  const tick = performance.now();
16215
- const pVtec = (_d = (_c = (_b = (_a = feature == null ? void 0 : feature.properties) == null ? void 0 : _a.parameters) == null ? void 0 : _b.VTEC) == null ? void 0 : _c[0]) != null ? _d : null;
16263
+ const pVtec = (_d = pvExtract((_c = (_b = (_a = feature == null ? void 0 : feature.properties) == null ? void 0 : _a.parameters) == null ? void 0 : _b.VTEC) == null ? void 0 : _c[0])) != null ? _d : null;
16216
16264
  processed.push({
16217
16265
  type: `Feature`,
16218
16266
  geometry: {
@@ -16230,63 +16278,63 @@ var api = (stanza) => __async(null, null, function* () {
16230
16278
  attributes: (_t = (_s = feature == null ? void 0 : feature.properties) == null ? void 0 : _s.attributes) != null ? _t : {},
16231
16279
  geocode: {
16232
16280
  office: {
16233
- office: pVtec ? pVtec.split(`.`)[2] : null,
16234
- name: (_u = officeICAOs[pVtec ? pVtec.split(`.`)[2] : null]) != null ? _u : null
16281
+ office: pVtec ? (_u = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _u.tracking.split(`.`)[0] : null,
16282
+ name: (_w = dict_icao[pVtec ? (_v = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _v.tracking.split(`.`)[0] : null]) != null ? _w : null
16235
16283
  },
16236
- organization: (_x = (_w = (_v = feature == null ? void 0 : feature.properties) == null ? void 0 : _v.parameters) == null ? void 0 : _w.WMOidentifier) == null ? void 0 : _x[0],
16237
- ugc: (_A = (_z = (_y = feature == null ? void 0 : feature.properties) == null ? void 0 : _y.geocode) == null ? void 0 : _z.UGC) != null ? _A : [],
16238
- polygon: ((_B = feature == null ? void 0 : feature.geometry) == null ? void 0 : _B.coordinates.length) > 0 ? Buffer.from(JSON.stringify([(_C = feature == null ? void 0 : feature.geometry) == null ? void 0 : _C.coordinates[0]])).toString("base64") : null,
16239
- polygon_generated: ((_D = feature == null ? void 0 : feature.geometry) == null ? void 0 : _D.coordinates.length) > 0 ? true : false
16284
+ organization: (_z = (_y = (_x = feature == null ? void 0 : feature.properties) == null ? void 0 : _x.parameters) == null ? void 0 : _y.WMOidentifier) == null ? void 0 : _z[0],
16285
+ ugc: (_C = (_B = (_A = feature == null ? void 0 : feature.properties) == null ? void 0 : _A.geocode) == null ? void 0 : _B.UGC) != null ? _C : [],
16286
+ polygon: ((_D = feature == null ? void 0 : feature.geometry) == null ? void 0 : _D.coordinates.length) > 0 ? Buffer.from(JSON.stringify([(_E = feature == null ? void 0 : feature.geometry) == null ? void 0 : _E.coordinates[0]])).toString("base64") : null,
16287
+ polygon_generated: ((_F = feature == null ? void 0 : feature.geometry) == null ? void 0 : _F.coordinates.length) > 0 ? true : false
16240
16288
  },
16241
16289
  parameters: {
16242
- tags: getEventTags((_E = feature == null ? void 0 : feature.properties) == null ? void 0 : _E.description),
16243
- instructions: (_G = (_F = feature == null ? void 0 : feature.properties) == null ? void 0 : _F.instruction) != null ? _G : null,
16244
- source: (_I = getTextFromProduct({ message: (_H = feature == null ? void 0 : feature.properties) == null ? void 0 : _H.description, find: [`SOURCE...`], removal: [`.`] })) != null ? _I : null,
16245
- hazards: (_K = getTextFromProduct({ message: (_J = feature == null ? void 0 : feature.properties) == null ? void 0 : _J.description, find: [`HAZARD...`], removal: [`.`] })) != null ? _K : null,
16246
- impacts: (_M = getTextFromProduct({ message: (_L = feature == null ? void 0 : feature.properties) == null ? void 0 : _L.description, find: [`IMPACT...`], removal: [`.`] })) != null ? _M : null,
16247
- estimated_hail_size: (_Q = (_P = (_O = (_N = feature == null ? void 0 : feature.properties) == null ? void 0 : _N.parameters) == null ? void 0 : _O.maxHailSize) == null ? void 0 : _P[0]) != null ? _Q : null,
16248
- estimated_wind_gusts: (_U = (_T = (_S = (_R = feature == null ? void 0 : feature.properties) == null ? void 0 : _R.parameters) == null ? void 0 : _S.maxWindGust) == null ? void 0 : _T[0]) != null ? _U : null,
16249
- damage_threat: (_Y = (_X = (_W = (_V = feature == null ? void 0 : feature.properties) == null ? void 0 : _V.parameters) == null ? void 0 : _W.thunderstormDamageThreat) == null ? void 0 : _X[0]) != null ? _Y : null,
16250
- tornado_threat: (_aa = (_$ = (__ = (_Z = feature == null ? void 0 : feature.properties) == null ? void 0 : _Z.parameters) == null ? void 0 : __.tornadoDetection) == null ? void 0 : _$[0]) != null ? _aa : null,
16251
- flood_threat: (_ea = (_da = (_ca = (_ba = feature == null ? void 0 : feature.properties) == null ? void 0 : _ba.parameters) == null ? void 0 : _ca.floodDetection) == null ? void 0 : _da[0]) != null ? _ea : null,
16252
- wind_threat: (_ia = (_ha = (_ga = (_fa = feature == null ? void 0 : feature.properties) == null ? void 0 : _fa.parameters) == null ? void 0 : _ga.windThreat) == null ? void 0 : _ha[0]) != null ? _ia : null,
16253
- hail_threat: (_ma = (_la = (_ka = (_ja = feature == null ? void 0 : feature.properties) == null ? void 0 : _ja.parameters) == null ? void 0 : _ka.hailThreat) == null ? void 0 : _la[0]) != null ? _ma : null
16290
+ tags: getEventTags((_G = feature == null ? void 0 : feature.properties) == null ? void 0 : _G.description),
16291
+ instructions: (_I = (_H = feature == null ? void 0 : feature.properties) == null ? void 0 : _H.instruction) != null ? _I : null,
16292
+ source: (_K = getTextFromProduct({ message: (_J = feature == null ? void 0 : feature.properties) == null ? void 0 : _J.description, find: [`SOURCE...`], removal: [`.`] })) != null ? _K : null,
16293
+ hazards: (_M = getTextFromProduct({ message: (_L = feature == null ? void 0 : feature.properties) == null ? void 0 : _L.description, find: [`HAZARD...`], removal: [`.`] })) != null ? _M : null,
16294
+ impacts: (_O = getTextFromProduct({ message: (_N = feature == null ? void 0 : feature.properties) == null ? void 0 : _N.description, find: [`IMPACT...`], removal: [`.`] })) != null ? _O : null,
16295
+ estimated_hail_size: (_S = (_R = (_Q = (_P = feature == null ? void 0 : feature.properties) == null ? void 0 : _P.parameters) == null ? void 0 : _Q.maxHailSize) == null ? void 0 : _R[0]) != null ? _S : null,
16296
+ estimated_wind_gusts: (_W = (_V = (_U = (_T = feature == null ? void 0 : feature.properties) == null ? void 0 : _T.parameters) == null ? void 0 : _U.maxWindGust) == null ? void 0 : _V[0]) != null ? _W : null,
16297
+ damage_threat: (__ = (_Z = (_Y = (_X = feature == null ? void 0 : feature.properties) == null ? void 0 : _X.parameters) == null ? void 0 : _Y.thunderstormDamageThreat) == null ? void 0 : _Z[0]) != null ? __ : null,
16298
+ tornado_threat: (_ca = (_ba = (_aa = (_$ = feature == null ? void 0 : feature.properties) == null ? void 0 : _$.parameters) == null ? void 0 : _aa.tornadoDetection) == null ? void 0 : _ba[0]) != null ? _ca : null,
16299
+ flood_threat: (_ga = (_fa = (_ea = (_da = feature == null ? void 0 : feature.properties) == null ? void 0 : _da.parameters) == null ? void 0 : _ea.floodDetection) == null ? void 0 : _fa[0]) != null ? _ga : null,
16300
+ wind_threat: (_ka = (_ja = (_ia = (_ha = feature == null ? void 0 : feature.properties) == null ? void 0 : _ha.parameters) == null ? void 0 : _ia.windThreat) == null ? void 0 : _ja[0]) != null ? _ka : null,
16301
+ hail_threat: (_oa = (_na = (_ma = (_la = feature == null ? void 0 : feature.properties) == null ? void 0 : _la.parameters) == null ? void 0 : _ma.hailThreat) == null ? void 0 : _na[0]) != null ? _oa : null
16254
16302
  },
16255
- spc_parameters: {
16256
- spc_number: (_oa = getTextFromProduct({ message: (_na = feature == null ? void 0 : feature.properties) == null ? void 0 : _na.description, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) != null ? _oa : null,
16257
- spc_concerning: (_qa = getTextFromProduct({ message: (_pa = feature == null ? void 0 : feature.properties) == null ? void 0 : _pa.description, find: [`Concerning...`] })) != null ? _qa : null,
16258
- spc_max_tornado: (_sa = getTextFromProduct({ message: (_ra = feature == null ? void 0 : feature.properties) == null ? void 0 : _ra.description, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _sa : null,
16259
- spc_max_hail: (_ua = getTextFromProduct({ message: (_ta = feature == null ? void 0 : feature.properties) == null ? void 0 : _ta.description, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _ua : null,
16260
- spc_max_wind: (_wa = getTextFromProduct({ message: (_va = feature == null ? void 0 : feature.properties) == null ? void 0 : _va.description, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _wa : null,
16261
- spc_watch_issuance: (_ya = getTextFromProduct({ message: (_xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _xa.description, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _ya : null
16303
+ discussion_parameters: {
16304
+ discussion_number: (_sa = (_ra = (_qa = getTextFromProduct({ message: (_pa = feature == null ? void 0 : feature.properties) == null ? void 0 : _pa.description, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) == null ? void 0 : _qa.toString()) == null ? void 0 : _ra.padStart(4, "0")) != null ? _sa : null,
16305
+ discussion_concerning: (_ua = getTextFromProduct({ message: (_ta = feature == null ? void 0 : feature.properties) == null ? void 0 : _ta.description, find: [`Concerning...`] })) != null ? _ua : null,
16306
+ discussion_max_tornado: (_wa = getTextFromProduct({ message: (_va = feature == null ? void 0 : feature.properties) == null ? void 0 : _va.description, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _wa : null,
16307
+ discussion_max_hail: (_ya = getTextFromProduct({ message: (_xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _xa.description, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _ya : null,
16308
+ discussion_max_wind: (_Aa = getTextFromProduct({ message: (_za = feature == null ? void 0 : feature.properties) == null ? void 0 : _za.description, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _Aa : null,
16309
+ discussion_watch_issuance: (_Ca = getTextFromProduct({ message: (_Ba = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ba.description, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _Ca : null
16262
16310
  },
16263
16311
  watch_parameters: {
16264
- watch_number: (_Ca = (_Ba = (_Aa = getTextFromProduct({ message: (_za = feature == null ? void 0 : feature.properties) == null ? void 0 : _za.description, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _Aa.replace(/(WT|WS|)/g, "")) == null ? void 0 : _Ba.trim()) != null ? _Ca : null,
16265
- watch_type: ((_Da = feature == null ? void 0 : feature.properties) == null ? void 0 : _Da.description.includes(`TORNADO WATCH`)) ? `Tornado` : ((_Ea = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ea.description.includes(`SEVERE`)) ? `Severe` : null,
16266
- additional_tornadoes_probability: (_Ga = getTextFromProduct({ message: (_Fa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Fa.description, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Ga : null,
16267
- strong_tornadoes_probability: (_Ia = getTextFromProduct({ message: (_Ha = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ha.description, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Ia : null,
16268
- severe_wind_probability: (_Ka = getTextFromProduct({ message: (_Ja = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ja.description, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Ka : null,
16269
- severe_hail_probability: (_Ma = getTextFromProduct({ message: (_La = feature == null ? void 0 : feature.properties) == null ? void 0 : _La.description, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Ma : null,
16270
- hail_2in_probability: (_Oa = getTextFromProduct({ message: (_Na = feature == null ? void 0 : feature.properties) == null ? void 0 : _Na.description, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? _Oa : null,
16271
- combined_hail_wind_probability: (_Qa = getTextFromProduct({ message: (_Pa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Pa.description, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Qa : null,
16272
- max_hail_in: (_Sa = getTextFromProduct({ message: (_Ra = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ra.description, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _Sa : null,
16273
- max_wind_surface: (_Ua = getTextFromProduct({ message: (_Ta = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ta.description, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _Ua : null,
16274
- max_tops_x100feet: (_Wa = getTextFromProduct({ message: (_Va = feature == null ? void 0 : feature.properties) == null ? void 0 : _Va.description, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _Wa : null,
16275
- pds_watch: getTextFromProduct({ message: (_Xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Xa.description, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`
16312
+ watch_number: ((_Da = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _Da.is_watch) && ((_Oa = (_Na = (_Ia = (_Ha = (_Ga = (_Fa = getTextFromProduct({ message: (_Ea = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ea.description, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _Fa.replace(/(WT|WS|)/g, "")) == null ? void 0 : _Ga.trim()) == null ? void 0 : _Ha.toString()) == null ? void 0 : _Ia.padStart(4, "0")) != null ? _Na : (_Ma = (_La = (_Ka = (_Ja = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _Ja.tracking) == null ? void 0 : _Ka.slice(-4)) == null ? void 0 : _La.toString()) == null ? void 0 : _Ma.padStart(4, "0")) != null ? _Oa : null),
16313
+ watch_type: ((_Pa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Pa.description.includes(`TORNADO WATCH`)) ? `Tornado` : ((_Qa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Qa.description.includes(`SEVERE`)) ? `Severe` : null,
16314
+ additional_tornadoes_probability: (_Sa = getTextFromProduct({ message: (_Ra = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ra.description, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Sa : null,
16315
+ strong_tornadoes_probability: (_Ua = getTextFromProduct({ message: (_Ta = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ta.description, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Ua : null,
16316
+ severe_wind_probability: (_Wa = getTextFromProduct({ message: (_Va = feature == null ? void 0 : feature.properties) == null ? void 0 : _Va.description, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Wa : null,
16317
+ severe_hail_probability: (_Ya = getTextFromProduct({ message: (_Xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Xa.description, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Ya : null,
16318
+ hail_2in_probability: (__a = getTextFromProduct({ message: (_Za = feature == null ? void 0 : feature.properties) == null ? void 0 : _Za.description, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? __a : null,
16319
+ combined_hail_wind_probability: (_ab = getTextFromProduct({ message: (_$a = feature == null ? void 0 : feature.properties) == null ? void 0 : _$a.description, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _ab : null,
16320
+ max_hail_in: (_cb = getTextFromProduct({ message: (_bb = feature == null ? void 0 : feature.properties) == null ? void 0 : _bb.description, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _cb : null,
16321
+ max_wind_surface: (_eb = getTextFromProduct({ message: (_db = feature == null ? void 0 : feature.properties) == null ? void 0 : _db.description, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _eb : null,
16322
+ max_tops_x100feet: (_gb = getTextFromProduct({ message: (_fb = feature == null ? void 0 : feature.properties) == null ? void 0 : _fb.description, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _gb : null,
16323
+ pds_watch: getTextFromProduct({ message: (_hb = feature == null ? void 0 : feature.properties) == null ? void 0 : _hb.description, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`
16276
16324
  },
16277
16325
  metadata: {
16278
16326
  ms: performance.now() - tick,
16279
16327
  source: `events.api`,
16280
- tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: (__a = (_Za = (_Ya = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ya.parameters) == null ? void 0 : _Za.WMOidentifier) == null ? void 0 : __a[0], featureId: feature == null ? void 0 : feature.id }, vtec: pVtec }),
16281
- header: `ZCZC-ATMOSX-${(_ab = (_$a = feature == null ? void 0 : feature.properties) == null ? void 0 : _$a.parameters) == null ? void 0 : _ab.WMOidentifier}`,
16282
- vtec: pVtec,
16328
+ tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: (_kb = (_jb = (_ib = feature == null ? void 0 : feature.properties) == null ? void 0 : _ib.parameters) == null ? void 0 : _jb.WMOidentifier) == null ? void 0 : _kb[0], featureId: feature == null ? void 0 : feature.id }, vtec: pVtec == null ? void 0 : pVtec[0] }),
16329
+ header: `ZCZC-ATMOSX-${(_mb = (_lb = feature == null ? void 0 : feature.properties) == null ? void 0 : _lb.parameters) == null ? void 0 : _mb.WMOidentifier}`,
16330
+ vtec: pVtec == null ? void 0 : pVtec[0],
16283
16331
  hvtec: null,
16284
- raw: (_bb = feature == null ? void 0 : feature.properties) == null ? void 0 : _bb.description,
16332
+ raw: (_nb = feature == null ? void 0 : feature.properties) == null ? void 0 : _nb.description,
16285
16333
  history: [
16286
16334
  {
16287
- description: (_cb = feature == null ? void 0 : feature.properties) == null ? void 0 : _cb.description,
16288
- issued: ((_db = feature == null ? void 0 : feature.properties) == null ? void 0 : _db.sent) ? new Date((_eb = feature == null ? void 0 : feature.properties) == null ? void 0 : _eb.sent).toISOString() : null,
16289
- status: (_gb = (_fb = feature == null ? void 0 : feature.properties) == null ? void 0 : _fb.messageType) != null ? _gb : null
16335
+ description: (_ob = feature == null ? void 0 : feature.properties) == null ? void 0 : _ob.description,
16336
+ issued: ((_pb = feature == null ? void 0 : feature.properties) == null ? void 0 : _pb.sent) ? new Date((_qb = feature == null ? void 0 : feature.properties) == null ? void 0 : _qb.sent).toISOString() : null,
16337
+ status: (_sb = (_rb = feature == null ? void 0 : feature.properties) == null ? void 0 : _rb.messageType) != null ? _sb : null
16290
16338
  }
16291
16339
  ]
16292
16340
  }
@@ -16404,11 +16452,11 @@ var xDeploy = () => __async(null, null, function* () {
16404
16452
  });
16405
16453
 
16406
16454
  // src/@modules/@database/database.init.ts
16407
- var import_fs4 = __toESM(require("fs"));
16455
+ var import_fs5 = __toESM(require("fs"));
16408
16456
  var import_better_sqlite3 = __toESM(require("better-sqlite3"));
16409
16457
 
16410
16458
  // src/@modules/@database/database.shapefiles.ts
16411
- var import_fs3 = __toESM(require("fs"));
16459
+ var import_fs4 = __toESM(require("fs"));
16412
16460
  var import_path3 = require("path");
16413
16461
  var import_jszip = require("jszip");
16414
16462
  var import_shapefile = require("shapefile");
@@ -16422,8 +16470,8 @@ var setSleep = (options) => __async(null, null, function* () {
16422
16470
  });
16423
16471
  });
16424
16472
 
16425
- // src/@dictionaries/dictionaries.shapefileLinks.ts
16426
- var shapefileLinks = [
16473
+ // src/@dictionaries/dictionaries.shapefiles.ts
16474
+ var dict_shapefiles = [
16427
16475
  { name: "us_counties", id: "C", link: "https://www.weather.gov/source/gis/Shapefiles/County/c_16ap26.zip" },
16428
16476
  { name: "us_states_territories", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/County/s_16ap26.zip" },
16429
16477
  { name: "fire_weather_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/fz16ap26.zip" },
@@ -16444,19 +16492,19 @@ var importShapefiles = () => __async(null, null, function* () {
16444
16492
  if (tShapefiles === 0) {
16445
16493
  yield setSleep({ timeout: 1e3 });
16446
16494
  setWarning({ message: `Shapefiles are currently building, please DO NOT close your terminal. The shapefiles will not finish and will remain incomplete. If you do mess up, you will need to delete ${settings.Database} and restart the application.` });
16447
- for (const shapefile of shapefileLinks) {
16495
+ for (const shapefile of dict_shapefiles) {
16448
16496
  const response2 = yield fetch(shapefile.link);
16449
16497
  const arrayBuff = yield response2.arrayBuffer();
16450
16498
  const content = yield (0, import_jszip.loadAsync)(arrayBuff);
16451
16499
  const directory = (0, import_path3.resolve)(__dirname, `../../shapefiles`);
16452
- if (!import_fs3.default.existsSync(directory)) {
16453
- import_fs3.default.mkdirSync(directory, { recursive: true });
16500
+ if (!import_fs4.default.existsSync(directory)) {
16501
+ import_fs4.default.mkdirSync(directory, { recursive: true });
16454
16502
  }
16455
16503
  for (const file of Object.keys(content.files)) {
16456
16504
  if (file.endsWith(".shp") || file.endsWith(".dbf")) {
16457
16505
  const data = yield content.files[file].async(`nodebuffer`);
16458
16506
  const output = (0, import_path3.resolve)(directory, `${(_a = shapefile == null ? void 0 : shapefile.name) != null ? _a : ``}_${(_b = shapefile == null ? void 0 : shapefile.id) != null ? _b : ``}${(0, import_path3.extname)(file)}`);
16459
- import_fs3.default.writeFileSync(output, data);
16507
+ import_fs4.default.writeFileSync(output, data);
16460
16508
  }
16461
16509
  }
16462
16510
  const filepath = (0, import_path3.resolve)(__dirname, "../../shapefiles", shapefile.name + "_" + shapefile.id);
@@ -16487,13 +16535,13 @@ var importShapefiles = () => __async(null, null, function* () {
16487
16535
  insert.run(final2, location, JSON.stringify(geometry));
16488
16536
  }
16489
16537
  });
16490
- import_fs3.default.unlinkSync(`${filepath}.shp`);
16491
- import_fs3.default.unlinkSync(`${filepath}.dbf`);
16538
+ import_fs4.default.unlinkSync(`${filepath}.shp`);
16539
+ import_fs4.default.unlinkSync(`${filepath}.dbf`);
16492
16540
  setWarning({ message: `Cleaned up temporary files for ${shapefile.name}_${shapefile.id}` });
16493
16541
  transaction(features);
16494
16542
  }
16495
16543
  setWarning({ message: `Shapefiles have finished compiling, you can now continue and close this terminal` });
16496
- import_fs3.default.rm((0, import_path3.resolve)(__dirname, "../../shapefiles"), { recursive: true, force: true }, () => {
16544
+ import_fs4.default.rm((0, import_path3.resolve)(__dirname, "../../shapefiles"), { recursive: true, force: true }, () => {
16497
16545
  });
16498
16546
  }
16499
16547
  } catch (error) {
@@ -16505,8 +16553,8 @@ var importShapefiles = () => __async(null, null, function* () {
16505
16553
  var initializeDatabase = () => __async(null, null, function* () {
16506
16554
  const settings = bootstrap.settings;
16507
16555
  try {
16508
- if (!import_fs4.default.existsSync(settings.Database)) {
16509
- import_fs4.default.writeFileSync(settings.Database, "");
16556
+ if (!import_fs5.default.existsSync(settings.Database)) {
16557
+ import_fs5.default.writeFileSync(settings.Database, "");
16510
16558
  setWarning({ message: `Creating new database at ${settings.Database}` });
16511
16559
  }
16512
16560
  bootstrap.database = new import_better_sqlite3.default(settings.Database);
@@ -16589,25 +16637,25 @@ var xReconnect = (interval) => __async(null, null, function* () {
16589
16637
  });
16590
16638
 
16591
16639
  // src/@modules/@utilities/utilities.setCronSchedule.ts
16592
- var import_fs5 = require("fs");
16640
+ var import_fs6 = require("fs");
16593
16641
  var import_path4 = require("path");
16594
16642
  var setCronSchedule = () => __async(null, null, function* () {
16595
16643
  const settings = bootstrap.settings;
16596
- const TTL = settings.GlobalSettings.EASSettings.ArchiveTTL;
16644
+ const TTL = settings.GlobalSettings.ArchiveSettings.TTL;
16597
16645
  const TTLCUT = Date.now() - TTL * 1e3;
16598
16646
  const walk = (dir) => {
16599
- if ((0, import_fs5.existsSync)(dir)) {
16600
- const entries = (0, import_fs5.readdirSync)(dir, { withFileTypes: true });
16647
+ if ((0, import_fs6.existsSync)(dir)) {
16648
+ const entries = (0, import_fs6.readdirSync)(dir, { withFileTypes: true });
16601
16649
  for (const entry of entries) {
16602
16650
  const fullPath = (0, import_path4.join)(dir, entry.name);
16603
16651
  if (entry.isDirectory()) {
16604
16652
  walk(fullPath);
16605
16653
  continue;
16606
16654
  }
16607
- const stats = (0, import_fs5.statSync)(fullPath);
16655
+ const stats = (0, import_fs6.statSync)(fullPath);
16608
16656
  if (stats.mtime.getTime() < TTLCUT) {
16609
16657
  try {
16610
- (0, import_fs5.unlinkSync)(fullPath);
16658
+ (0, import_fs6.unlinkSync)(fullPath);
16611
16659
  } catch (err) {
16612
16660
  console.error(`Failed to delete ${fullPath}:`, err);
16613
16661
  }
@@ -16615,7 +16663,8 @@ var setCronSchedule = () => __async(null, null, function* () {
16615
16663
  }
16616
16664
  }
16617
16665
  };
16618
- walk(settings.GlobalSettings.EASSettings.ArchiveDirectory);
16666
+ walk(settings.GlobalSettings.ArchiveSettings.TextDirectory);
16667
+ walk(settings.GlobalSettings.ArchiveSettings.EasDirectory);
16619
16668
  if (settings.EnableWireService) {
16620
16669
  if (settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.Enabled) {
16621
16670
  void xReconnect(settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval);
@@ -16783,6 +16832,59 @@ var getNodes = () => {
16783
16832
  return bootstrap.cache.nodes;
16784
16833
  };
16785
16834
 
16835
+ // src/@core/core.createEvent.ts
16836
+ var createEvent2 = (options) => {
16837
+ var _a;
16838
+ const tick = performance.now();
16839
+ validateEvents([{
16840
+ type: `Feature`,
16841
+ geometry: {
16842
+ type: `Point`,
16843
+ coordinates: options.coordinates
16844
+ },
16845
+ properties: {
16846
+ event: options.event,
16847
+ parent: options.event,
16848
+ status: options.status,
16849
+ issued: options.issued.toISOString(),
16850
+ expires: options.expires.toISOString(),
16851
+ locations: options.locations,
16852
+ description: options.description,
16853
+ geocode: {
16854
+ office: {
16855
+ office: `ATMX`,
16856
+ name: `AtmosphericX Manual Event`
16857
+ },
16858
+ organization: `AtmosphericX`,
16859
+ ugc: [],
16860
+ polygon: options.coordinates.length > 0 ? Buffer.from(JSON.stringify([options.coordinates[0]])).toString("base64") : null,
16861
+ polygon_generated: options.coordinates.length > 0 ? true : false
16862
+ },
16863
+ status_metadata: {
16864
+ is_issued: options.status == `Issued`,
16865
+ is_updated: options.status == `Updated`,
16866
+ is_expired: options.status == `Expired`,
16867
+ is_test: options.status == `Test`,
16868
+ is_statement: options.status == `Statement`
16869
+ },
16870
+ metadata: {
16871
+ ms: performance.now() - tick,
16872
+ source: `events.manual`,
16873
+ tracking: `ATMX-M-W-01`,
16874
+ header: `ZCZC-ATMOSX-ATMX-M-W-01`,
16875
+ raw: options.description,
16876
+ history: [
16877
+ {
16878
+ description: options.description,
16879
+ issued: options.issued.toISOString(),
16880
+ status: (_a = options.status) != null ? _a : null
16881
+ }
16882
+ ]
16883
+ }
16884
+ }
16885
+ }]);
16886
+ };
16887
+
16786
16888
  // src/@core/core.getRandomEvent.ts
16787
16889
  var getRandomEvent = () => {
16788
16890
  return bootstrap.cache.events.features[Math.floor(Math.random() * bootstrap.cache.events.features.length)];
@@ -16843,6 +16945,7 @@ var index_default = Manager;
16843
16945
  0 && (module.exports = {
16844
16946
  Manager,
16845
16947
  clearEvents,
16948
+ createEvent,
16846
16949
  getCleanedEvent,
16847
16950
  getEventGeometry,
16848
16951
  getEvents,