@welldot/core 0.3.0 → 0.4.0-next.20261015.d7c7365

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 (54) hide show
  1. package/README.md +288 -75
  2. package/dist/index.cjs +2342 -44
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +14060 -4206
  5. package/dist/index.d.ts +14060 -4206
  6. package/dist/index.js +2220 -43
  7. package/dist/index.js.map +1 -1
  8. package/docs/schema/v2/well.schema.json +1043 -17
  9. package/docs/spec/v2/format-reference.md +507 -41
  10. package/docs/spec/v2/interoperability.md +44 -27
  11. package/docs/spec/v2/object-schemas.md +983 -113
  12. package/docs/spec/v2/overview.md +122 -6
  13. package/docs/spec/v2/water-quality.md +483 -0
  14. package/examples/README.md +83 -0
  15. package/examples/belem-pa-condominio-outorga.well +961 -0
  16. package/examples/belem-pa-monitoramento-posto.well +1141 -0
  17. package/examples/belem-pa-pirabas-abastecimento.well +1751 -0
  18. package/examples/belem-pa-poco-colmatado.well +496 -0
  19. package/examples/belem-pa-poco-raso-abandonado.well +388 -0
  20. package/examples/belem-pa-qualidade-agua-acida.well +895 -0
  21. package/examples/colatina-es-gnaisse-rural.well +1047 -0
  22. package/examples/coluna-mg-cristalino-abastecimento.well +1437 -0
  23. package/examples/estrela-doeste-sp-bauru-serra-geral.well +919 -0
  24. package/examples/extremoz-rn-barreiras-raso.well +623 -0
  25. package/examples/gastao-vidigal-sp-dados-inconsistentes.well +222 -0
  26. package/examples/index.json +452 -0
  27. package/examples/irece-ba-carste-bambui.well +861 -0
  28. package/examples/lagoa-santa-mg-carste-abastecimento.well +1087 -0
  29. package/examples/minas-novas-mg-cadastro-incompleto.well +157 -0
  30. package/examples/quixeramobim-ce-cristalino-salobro.well +989 -0
  31. package/examples/rinopolis-sp-estratigrafico-guarani.well +287 -0
  32. package/examples/santarem-pa-jorrante-alter-do-chao.well +554 -0
  33. package/examples/sao-gabriel-rs-cacimba.well +360 -0
  34. package/examples/sete-lagoas-mg-carste-industrial.well +410 -0
  35. package/examples/thumbs/belem-pa-condominio-outorga.svg +1 -0
  36. package/examples/thumbs/belem-pa-monitoramento-posto.svg +1 -0
  37. package/examples/thumbs/belem-pa-pirabas-abastecimento.svg +1 -0
  38. package/examples/thumbs/belem-pa-poco-colmatado.svg +1 -0
  39. package/examples/thumbs/belem-pa-poco-raso-abandonado.svg +1 -0
  40. package/examples/thumbs/belem-pa-qualidade-agua-acida.svg +1 -0
  41. package/examples/thumbs/colatina-es-gnaisse-rural.svg +1 -0
  42. package/examples/thumbs/coluna-mg-cristalino-abastecimento.svg +1 -0
  43. package/examples/thumbs/estrela-doeste-sp-bauru-serra-geral.svg +1 -0
  44. package/examples/thumbs/extremoz-rn-barreiras-raso.svg +1 -0
  45. package/examples/thumbs/gastao-vidigal-sp-dados-inconsistentes.svg +1 -0
  46. package/examples/thumbs/irece-ba-carste-bambui.svg +1 -0
  47. package/examples/thumbs/lagoa-santa-mg-carste-abastecimento.svg +1 -0
  48. package/examples/thumbs/minas-novas-mg-cadastro-incompleto.svg +1 -0
  49. package/examples/thumbs/quixeramobim-ce-cristalino-salobro.svg +1 -0
  50. package/examples/thumbs/rinopolis-sp-estratigrafico-guarani.svg +1 -0
  51. package/examples/thumbs/santarem-pa-jorrante-alter-do-chao.svg +1 -0
  52. package/examples/thumbs/sao-gabriel-rs-cacimba.svg +1 -0
  53. package/examples/thumbs/sete-lagoas-mg-carste-industrial.svg +1 -0
  54. package/package.json +5 -3
package/dist/index.js CHANGED
@@ -7,8 +7,31 @@ var mergeWell = createDefu((obj, key, value) => {
7
7
  return true;
8
8
  }
9
9
  });
10
+ var isPlainObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
11
+ var mergeParsed = createDefu((obj, key, value) => {
12
+ if (Array.isArray(value)) {
13
+ const raw = obj[key];
14
+ obj[key] = Array.isArray(raw) && raw.length === value.length ? value.map(
15
+ (item, i) => isPlainObject(item) && isPlainObject(raw[i]) ? mergeParsed(item, raw[i]) : item
16
+ ) : value;
17
+ return true;
18
+ }
19
+ });
10
20
  var RFC3339_WITH_OFFSET = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
11
21
  var rfc3339 = () => z.string().regex(RFC3339_WITH_OFFSET, "datetime must be RFC 3339 with UTC offset");
22
+ var CALENDAR_DATE = /^\d{4}-\d{2}-\d{2}$/;
23
+ var calendarDate = () => z.string().regex(CALENDAR_DATE, "date must be YYYY-MM-DD");
24
+ var DATE_DURATION = /^P(?=\d)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?$/;
25
+ var dateDuration = () => z.string().regex(DATE_DURATION, "duration must be an ISO 8601 date duration");
26
+ var AttachmentSchema = z.object({
27
+ id: z.string(),
28
+ uri: z.string().url(),
29
+ media_type: z.string(),
30
+ document_type: z.string().optional(),
31
+ filename: z.string().optional(),
32
+ description: z.string().optional(),
33
+ sha256: z.string().optional()
34
+ });
12
35
  var WellIdSchema = z.object({
13
36
  authority: z.string(),
14
37
  id: z.string(),
@@ -52,7 +75,8 @@ var WellScreenSchema = z.object({
52
75
  to: z.number(),
53
76
  type: z.string(),
54
77
  diameter: z.number(),
55
- screen_slot: z.number()
78
+ screen_slot: z.number(),
79
+ slot_type: z.string().optional()
56
80
  });
57
81
  var HoleFillSchema = z.object({
58
82
  from: z.number(),
@@ -130,7 +154,9 @@ var HydrodynamicEventBaseSchema = z.object({
130
154
  sequence: z.number().int().optional(),
131
155
  operator: z.string().optional(),
132
156
  equipment: z.string().optional(),
133
- notes: z.string().optional()
157
+ notes: z.string().optional(),
158
+ corrects: z.string().optional(),
159
+ attachments: z.array(AttachmentSchema).optional()
134
160
  });
135
161
  var SpotMeasurementEventSchema = HydrodynamicEventBaseSchema.extend({
136
162
  type: z.literal("spot_measurement"),
@@ -172,14 +198,13 @@ var HydrodynamicEventSchema = z.discriminatedUnion("type", [
172
198
  AirliftEventSchema,
173
199
  RecoveryOnlyEventSchema
174
200
  ]).or(HydrodynamicEventBaseSchema.passthrough());
175
- var AttachmentSchema = z.object({
176
- id: z.string(),
177
- uri: z.string().url(),
178
- media_type: z.string(),
179
- filename: z.string().optional(),
180
- description: z.string().optional(),
181
- sha256: z.string().optional()
182
- });
201
+ var WellStatusSchema = z.enum([
202
+ "active",
203
+ "maintenance",
204
+ "inactive",
205
+ "decommissioned",
206
+ "abandoned"
207
+ ]);
183
208
  var HistoryLogEntrySchema = z.object({
184
209
  id: z.string(),
185
210
  datetime: rfc3339(),
@@ -188,7 +213,13 @@ var HistoryLogEntrySchema = z.object({
188
213
  description: z.string(),
189
214
  author: z.string().optional(),
190
215
  severity: z.string().optional(),
191
- attachments: z.array(AttachmentSchema).optional()
216
+ attachments: z.array(AttachmentSchema).optional(),
217
+ hydrodynamic_event_ids: z.array(z.string()).optional(),
218
+ sample_ids: z.array(z.string()).optional(),
219
+ maintenance_type: z.string().optional(),
220
+ pump_installation_id: z.string().optional(),
221
+ meter_id: z.string().optional(),
222
+ status: WellStatusSchema.optional()
192
223
  });
193
224
  var AquiferAnalysisSchema = z.object({
194
225
  id: z.string(),
@@ -214,8 +245,297 @@ var AquiferAnalysisSchema = z.object({
214
245
  jacob_b: z.number().optional(),
215
246
  jacob_c: z.number().optional(),
216
247
  well_efficiency_pct: z.number().optional(),
248
+ notes: z.string().optional(),
249
+ attachments: z.array(AttachmentSchema).optional()
250
+ });
251
+ var PumpElectricalSchema = z.object({
252
+ voltage: z.number().nonnegative().optional(),
253
+ phases: z.union([z.literal(1), z.literal(3)]).optional(),
254
+ cable_section: z.number().nonnegative().optional(),
255
+ cable_length: z.number().nonnegative().optional()
256
+ });
257
+ var PumpInstallationSchema = z.object({
258
+ id: z.string(),
259
+ installed_at: rfc3339(),
260
+ removed_at: rfc3339().optional(),
261
+ installed_by: z.string().optional(),
262
+ removed_by: z.string().optional(),
263
+ type: z.string(),
264
+ power_source: z.string().optional(),
265
+ manufacturer: z.string().optional(),
266
+ model: z.string().optional(),
267
+ serial: z.string().optional(),
268
+ intake_depth: z.number().nonnegative().optional(),
269
+ rated_flow_rate: z.number().nonnegative().optional(),
270
+ rated_head: z.number().nonnegative().optional(),
271
+ rated_power: z.number().nonnegative().optional(),
272
+ stages: z.number().int().positive().optional(),
273
+ riser_diameter: z.number().nonnegative().optional(),
274
+ riser_material: z.string().optional(),
275
+ check_valve: z.boolean().optional(),
276
+ electrical: PumpElectricalSchema.optional(),
277
+ notes: z.string().optional(),
278
+ updated_at: rfc3339().optional(),
279
+ attachments: z.array(AttachmentSchema).optional()
280
+ });
281
+ var VolumeLimitSchema = z.object({
282
+ period: z.enum(["daily", "monthly", "annual"]),
283
+ volume: z.number().nonnegative()
284
+ });
285
+ var MonthlyGrantSchema = z.object({
286
+ month: z.number().int().min(1).max(12),
287
+ flow_rate: z.number().nonnegative().optional(),
288
+ daily_operating_time: z.number().nonnegative().optional(),
289
+ days: z.number().int().min(0).max(31).optional()
290
+ });
291
+ var ConditionFulfillmentSchema = z.object({
292
+ id: z.string(),
293
+ datetime: rfc3339(),
294
+ due_date: calendarDate().optional(),
295
+ description: z.string().optional(),
296
+ author: z.string().optional(),
297
+ event_id: z.string().optional(),
298
+ sample_id: z.string().optional(),
299
+ updated_at: rfc3339().optional(),
300
+ attachments: z.array(AttachmentSchema).optional()
301
+ });
302
+ var PermitConditionSchema = z.object({
303
+ id: z.string(),
304
+ description: z.string(),
305
+ category: z.string().optional(),
306
+ first_due: calendarDate().optional(),
307
+ due_after: dateDuration().optional(),
308
+ recurrence: dateDuration().optional(),
309
+ last_due: calendarDate().optional(),
310
+ occurrences: z.number().int().positive().optional(),
311
+ responsible: z.string().optional(),
312
+ fulfillments: z.array(ConditionFulfillmentSchema).optional()
313
+ });
314
+ var PermitAdministrativeStatusSchema = z.enum([
315
+ "requested",
316
+ "granted",
317
+ "suspended",
318
+ "revoked",
319
+ "denied",
320
+ "withdrawn"
321
+ ]);
322
+ var PermitHistoryEntrySchema = z.object({
323
+ id: z.string(),
324
+ date: calendarDate(),
325
+ type: z.string().optional(),
326
+ description: z.string(),
327
+ done: z.boolean().optional(),
328
+ due_date: calendarDate().optional(),
329
+ updated_at: rfc3339().optional(),
330
+ attachments: z.array(AttachmentSchema).optional()
331
+ });
332
+ var PermitSchema = z.object({
333
+ id: z.string(),
334
+ type: z.string(),
335
+ authority: z.string(),
336
+ identifier: z.string().optional(),
337
+ request_identifier: z.string().optional(),
338
+ status: PermitAdministrativeStatusSchema.optional(),
339
+ issued_at: calendarDate().optional(),
340
+ valid_from: calendarDate().optional(),
341
+ valid_until: calendarDate().optional(),
342
+ renewal_requested_at: calendarDate().optional(),
343
+ water_use: z.array(z.string()).optional(),
344
+ flow_rate: z.number().nonnegative().optional(),
345
+ daily_operating_time: z.number().nonnegative().optional(),
346
+ volume_limits: z.array(VolumeLimitSchema).optional(),
347
+ monthly_schedule: z.array(MonthlyGrantSchema).optional(),
348
+ conditions: z.array(PermitConditionSchema).optional(),
349
+ history: z.array(PermitHistoryEntrySchema).optional(),
350
+ supersedes: z.string().optional(),
351
+ notes: z.string().optional(),
352
+ updated_at: rfc3339().optional(),
353
+ attachments: z.array(AttachmentSchema).optional()
354
+ });
355
+ var MeterSchema = z.object({
356
+ id: z.string(),
357
+ installed_at: rfc3339(),
358
+ removed_at: rfc3339().optional(),
359
+ installed_by: z.string().optional(),
360
+ removed_by: z.string().optional(),
361
+ type: z.string().optional(),
362
+ manufacturer: z.string().optional(),
363
+ model: z.string().optional(),
364
+ serial: z.string().optional(),
365
+ nominal_diameter: z.number().nonnegative().optional(),
366
+ max_reading: z.number().positive().optional(),
367
+ notes: z.string().optional(),
368
+ updated_at: rfc3339().optional(),
369
+ attachments: z.array(AttachmentSchema).optional()
370
+ });
371
+ var ProductionEntryBaseSchema = z.object({
372
+ id: z.string(),
373
+ type: z.string(),
374
+ corrects: z.string().optional(),
375
+ sequence: z.number().int().optional(),
217
376
  notes: z.string().optional()
218
377
  });
378
+ var MeterReadingSchema = ProductionEntryBaseSchema.extend({
379
+ type: z.literal("meter_reading"),
380
+ datetime: rfc3339(),
381
+ meter_id: z.string(),
382
+ reading: z.number().nonnegative(),
383
+ source: z.string().optional()
384
+ });
385
+ var EstimatedVolumeSchema = ProductionEntryBaseSchema.extend({
386
+ type: z.literal("estimated_volume"),
387
+ period_start: rfc3339(),
388
+ period_end: rfc3339(),
389
+ volume: z.number().nonnegative(),
390
+ method: z.string().optional()
391
+ });
392
+ var PRODUCTION_TYPES = ["meter_reading", "estimated_volume"];
393
+ var ProductionEntrySchema = z.discriminatedUnion("type", [MeterReadingSchema, EstimatedVolumeSchema]).or(
394
+ ProductionEntryBaseSchema.passthrough().refine(
395
+ (e) => !PRODUCTION_TYPES.includes(e.type),
396
+ { message: "malformed production entry" }
397
+ )
398
+ );
399
+ var OperatingRegimeSchema = z.object({
400
+ id: z.string(),
401
+ effective_from: rfc3339(),
402
+ flow_rate: z.number().nonnegative().optional(),
403
+ daily_operating_time: z.number().min(0).max(24).optional(),
404
+ days_per_week: z.number().int().min(1).max(7).optional(),
405
+ notes: z.string().optional(),
406
+ updated_at: rfc3339().optional()
407
+ });
408
+ var PARAMETER_VOCABULARY = /^(welldot|cas|x-.+)$/;
409
+ var ParameterSchema = z.object({
410
+ code: z.string().min(1),
411
+ vocabulary: z.string().regex(PARAMETER_VOCABULARY, "vocabulary must be welldot, cas or x-\u2026")
412
+ });
413
+ var TimeResolutionSchema = z.literal("day");
414
+ var SamplingPointSchema = z.object({
415
+ type: z.string(),
416
+ depth: z.number().nonnegative().optional(),
417
+ depth_precision: z.number().nonnegative().optional(),
418
+ from: z.number().nonnegative().optional(),
419
+ to: z.number().nonnegative().optional(),
420
+ device: z.string().optional(),
421
+ pump_installation_id: z.string().optional()
422
+ }).refine(
423
+ (p) => !(p.depth !== void 0 && (p.from !== void 0 || p.to !== void 0)),
424
+ { message: "depth and from/to are mutually exclusive" }
425
+ );
426
+ var PurgeReadingSchema = z.object({
427
+ elapsed: z.number().nonnegative(),
428
+ parameter: ParameterSchema,
429
+ value: z.number()
430
+ });
431
+ var PurgeSchema = z.object({
432
+ duration: z.number().nonnegative().optional(),
433
+ volume: z.number().nonnegative().optional(),
434
+ flow_rate: z.number().nonnegative().optional(),
435
+ stabilized: z.boolean().optional(),
436
+ readings: z.array(PurgeReadingSchema).optional()
437
+ });
438
+ var LaboratorySchema = z.object({
439
+ name: z.string(),
440
+ accreditation: z.string().optional(),
441
+ report_number: z.string().optional(),
442
+ batch_id: z.string().optional(),
443
+ sample_id: z.string().optional(),
444
+ received_at: rfc3339().optional(),
445
+ received_at_resolution: TimeResolutionSchema.optional(),
446
+ received_temperature: z.number().optional()
447
+ });
448
+ var FiltrationSchema = z.object({
449
+ pore_size: z.number().positive().optional(),
450
+ location: z.enum(["field", "lab"]).optional()
451
+ });
452
+ var ResultValidationSchema = z.object({
453
+ status: z.enum(["unvalidated", "validated", "qualified", "rejected"]),
454
+ qualifier: z.string().optional(),
455
+ guideline: z.string().optional(),
456
+ validated_by: z.string().optional(),
457
+ validated_at: rfc3339().optional()
458
+ });
459
+ var ResultQualifierSchema = z.enum([
460
+ "<",
461
+ ">",
462
+ "not_detected",
463
+ "estimated"
464
+ ]);
465
+ var WaterQualityResultSchema = z.object({
466
+ parameter: ParameterSchema,
467
+ value: z.number().optional(),
468
+ presence: z.boolean().optional(),
469
+ text: z.string().optional(),
470
+ qualifier: ResultQualifierSchema.optional(),
471
+ unit: z.string().min(1).optional(),
472
+ detection_limit: z.number().nonnegative().optional(),
473
+ quantification_limit: z.number().nonnegative().optional(),
474
+ value_precision: z.number().nonnegative().optional(),
475
+ fraction: z.enum(["total", "dissolved", "suspended"]).optional(),
476
+ filtration: FiltrationSchema.optional(),
477
+ measured_in: z.enum(["field", "lab"]).optional(),
478
+ method: z.string().optional(),
479
+ analyzed_at: rfc3339().optional(),
480
+ analyzed_at_resolution: TimeResolutionSchema.optional(),
481
+ lab_flags: z.array(z.string()).optional(),
482
+ validation: ResultValidationSchema.optional(),
483
+ notes: z.string().optional()
484
+ }).superRefine((r, ctx) => {
485
+ const forms = [r.value, r.presence, r.text].filter(
486
+ (v) => v !== void 0
487
+ ).length;
488
+ if (r.qualifier === "not_detected") {
489
+ if (forms !== 0)
490
+ ctx.addIssue({
491
+ code: z.ZodIssueCode.custom,
492
+ message: "not_detected results carry no value form"
493
+ });
494
+ } else if (forms !== 1) {
495
+ ctx.addIssue({
496
+ code: z.ZodIssueCode.custom,
497
+ message: "result must have exactly one of value, presence or text"
498
+ });
499
+ } else if (r.qualifier !== void 0 && r.value === void 0) {
500
+ ctx.addIssue({
501
+ code: z.ZodIssueCode.custom,
502
+ message: `qualifier ${r.qualifier} requires a numeric value`
503
+ });
504
+ }
505
+ const custom = r.parameter.vocabulary.startsWith("x-");
506
+ if (custom && r.unit === void 0)
507
+ ctx.addIssue({
508
+ code: z.ZodIssueCode.custom,
509
+ path: ["unit"],
510
+ message: "unit is required for x- vocabularies"
511
+ });
512
+ if (!custom && r.unit !== void 0)
513
+ ctx.addIssue({
514
+ code: z.ZodIssueCode.custom,
515
+ path: ["unit"],
516
+ message: "unit is forbidden for welldot and cas parameters"
517
+ });
518
+ });
519
+ var WaterSampleSchema = z.object({
520
+ id: z.string(),
521
+ datetime: rfc3339(),
522
+ sample_type: z.string(),
523
+ parent_sample_id: z.string().optional(),
524
+ sequence: z.number().int().optional(),
525
+ campaign: z.string().optional(),
526
+ sampling_method: z.string().optional(),
527
+ sampling_point: SamplingPointSchema.optional(),
528
+ purge: PurgeSchema.optional(),
529
+ static_level_event_id: z.string().optional(),
530
+ collected_by: z.string().optional(),
531
+ preservation: z.string().optional(),
532
+ chain_of_custody: z.string().optional(),
533
+ laboratory: LaboratorySchema.optional(),
534
+ corrects: z.string().optional(),
535
+ notes: z.string().optional(),
536
+ attachments: z.array(AttachmentSchema).optional(),
537
+ results: z.array(WaterQualityResultSchema).min(1)
538
+ });
219
539
  var WellSchema = z.object({
220
540
  version: z.number().int(),
221
541
  "@context": z.union([z.string(), z.array(z.unknown()), z.record(z.unknown())]).optional(),
@@ -230,7 +550,7 @@ var WellSchema = z.object({
230
550
  well_purpose: z.array(z.string()).optional(),
231
551
  name: z.string().optional(),
232
552
  well_driller: z.string().optional(),
233
- construction_date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "construction_date must be YYYY-MM-DD").optional(),
553
+ construction_date: z.string().regex(CALENDAR_DATE, "construction_date must be YYYY-MM-DD").optional(),
234
554
  obs: z.string().optional(),
235
555
  lat: z.number().optional(),
236
556
  lng: z.number().optional(),
@@ -249,7 +569,14 @@ var WellSchema = z.object({
249
569
  caves: z.array(CaveSchema),
250
570
  hydrodynamic_events: z.array(HydrodynamicEventSchema).optional(),
251
571
  aquifer_analysis: z.array(AquiferAnalysisSchema).optional(),
252
- history_logs: z.array(HistoryLogEntrySchema).optional()
572
+ history_logs: z.array(HistoryLogEntrySchema).optional(),
573
+ attachments: z.array(AttachmentSchema).optional(),
574
+ pump_installations: z.array(PumpInstallationSchema).optional(),
575
+ permits: z.array(PermitSchema).optional(),
576
+ meters: z.array(MeterSchema).optional(),
577
+ production: z.array(ProductionEntrySchema).optional(),
578
+ operating_regime: z.array(OperatingRegimeSchema).optional(),
579
+ water_samples: z.array(WaterSampleSchema).optional()
253
580
  }).passthrough();
254
581
  function normalizeV1Fields(raw) {
255
582
  const out = { ...raw };
@@ -321,7 +648,7 @@ function parseWell(json) {
321
648
  }
322
649
  if (version === 1) {
323
650
  const normalized = normalizeV1Fields(raw);
324
- return mergeWell(
651
+ return mergeParsed(
325
652
  WellSchema.parse(normalized),
326
653
  normalized
327
654
  );
@@ -331,19 +658,56 @@ function parseWell(json) {
331
658
  } else {
332
659
  raw.version = 2;
333
660
  }
334
- return mergeWell(WellSchema.parse(raw), raw);
661
+ return mergeParsed(WellSchema.parse(raw), raw);
335
662
  }
336
663
 
337
664
  // src/utils/well.utils.ts
338
665
  var WELL_FORMAT_VERSION = 2;
339
666
  var INCHES_TO_MM = 25.4;
667
+ var LEGACY_ROOT_KEYS = /* @__PURE__ */ new Set([
668
+ "lat",
669
+ "lng",
670
+ "elevation",
671
+ "bole_hole",
672
+ "constructive",
673
+ "geologic"
674
+ ]);
340
675
  var SECTION_KEYS = [
341
676
  "general",
342
677
  "constructive",
343
678
  "geology",
344
679
  "hydrodynamic",
345
- "history"
680
+ "history",
681
+ "operation",
682
+ "water_quality"
346
683
  ];
684
+ var VISIBILITY_TREE = {
685
+ general: ["identification", "location", "obs", "attachments"],
686
+ constructive: [
687
+ "bore_hole",
688
+ "surface_case",
689
+ "well_case",
690
+ "reduction",
691
+ "well_screen",
692
+ "hole_fill",
693
+ "centralizers",
694
+ "cement_pad"
695
+ ],
696
+ geology: ["lithology", "fractures", "caves"],
697
+ hydrodynamic: ["hydrodynamic_events", "aquifer_analysis"],
698
+ history: [],
699
+ operation: [
700
+ "pump_installations",
701
+ "meters",
702
+ "operating_regime",
703
+ "production",
704
+ "permits"
705
+ ],
706
+ water_quality: []
707
+ };
708
+ var VISIBILITY_LEAF_KEYS = SECTION_KEYS.flatMap(
709
+ (section) => VISIBILITY_TREE[section].length ? VISIBILITY_TREE[section] : [section]
710
+ );
347
711
  var EMPTY_WELL = {
348
712
  version: 2,
349
713
  bore_hole: [],
@@ -490,6 +854,27 @@ function decodeV2Well(raw) {
490
854
  },
491
855
  ...raw.history_logs !== void 0 && {
492
856
  history_logs: raw.history_logs
857
+ },
858
+ ...raw.attachments !== void 0 && {
859
+ attachments: raw.attachments
860
+ },
861
+ ...raw.pump_installations !== void 0 && {
862
+ pump_installations: raw.pump_installations
863
+ },
864
+ ...raw.permits !== void 0 && {
865
+ permits: raw.permits
866
+ },
867
+ ...raw.meters !== void 0 && {
868
+ meters: raw.meters
869
+ },
870
+ ...raw.production !== void 0 && {
871
+ production: raw.production
872
+ },
873
+ ...raw.operating_regime !== void 0 && {
874
+ operating_regime: raw.operating_regime
875
+ },
876
+ ...raw.water_samples !== void 0 && {
877
+ water_samples: raw.water_samples
493
878
  }
494
879
  };
495
880
  return mergeWell(decoded, raw);
@@ -531,6 +916,11 @@ function normalizeGeologic(raw) {
531
916
  caves: raw.caves ?? []
532
917
  };
533
918
  }
919
+ function unknownRootKeys(well) {
920
+ return Object.keys(well).filter(
921
+ (key) => !(key in WellSchema.shape) && !LEGACY_ROOT_KEYS.has(key)
922
+ );
923
+ }
534
924
  function serializeWell(well) {
535
925
  const payload = {
536
926
  version: WELL_FORMAT_VERSION,
@@ -568,8 +958,25 @@ function serializeWell(well) {
568
958
  ...well.aquifer_analysis !== void 0 && {
569
959
  aquifer_analysis: well.aquifer_analysis
570
960
  },
571
- ...well.history_logs !== void 0 && { history_logs: well.history_logs }
961
+ ...well.history_logs !== void 0 && { history_logs: well.history_logs },
962
+ ...well.attachments !== void 0 && { attachments: well.attachments },
963
+ ...well.pump_installations !== void 0 && {
964
+ pump_installations: well.pump_installations
965
+ },
966
+ ...well.permits !== void 0 && { permits: well.permits },
967
+ ...well.meters !== void 0 && { meters: well.meters },
968
+ ...well.production !== void 0 && { production: well.production },
969
+ ...well.operating_regime !== void 0 && {
970
+ operating_regime: well.operating_regime
971
+ },
972
+ ...well.water_samples !== void 0 && {
973
+ water_samples: well.water_samples
974
+ }
572
975
  };
976
+ for (const key of unknownRootKeys(well)) {
977
+ const value = well[key];
978
+ if (value !== void 0) payload[key] = value;
979
+ }
573
980
  return JSON.stringify(payload);
574
981
  }
575
982
  function isWellEmpty(well) {
@@ -578,43 +985,68 @@ function isWellEmpty(well) {
578
985
  if (raw.constructive || raw.geologic) return false;
579
986
  return well.lithology?.length === 0 && well.fractures?.length === 0 && well.caves?.length === 0 && well.bore_hole?.length === 0 && well.hole_fill?.length === 0 && well.well_case?.length === 0 && well.well_screen?.length === 0;
580
987
  }
988
+ function isFilled(value) {
989
+ if (value === void 0 || value === null) return false;
990
+ if (typeof value === "string") return value.trim() !== "";
991
+ if (typeof value === "number") return value !== 0;
992
+ if (Array.isArray(value)) return value.length > 0;
993
+ if (typeof value === "object") return Object.values(value).some(isFilled);
994
+ return true;
995
+ }
996
+ var NON_DATA_ROOT_KEYS = /* @__PURE__ */ new Set(["version", "$schema", "@context"]);
997
+ function hasWellData(well) {
998
+ if (!well) return false;
999
+ if (!isWellEmpty(well)) return true;
1000
+ return Object.entries(well).some(
1001
+ ([key, value]) => !NON_DATA_ROOT_KEYS.has(key) && isFilled(value)
1002
+ );
1003
+ }
581
1004
  function redactWell(well, visibility) {
1005
+ const v = visibility;
582
1006
  const redacted = { ...well };
583
- if (!visibility.general) {
1007
+ const sectionOf = (field) => SECTION_KEYS.find((s) => VISIBILITY_TREE[s].includes(field));
1008
+ const hidden = (key) => v[key] === false || !SECTION_KEYS.includes(key) && v[sectionOf(key)] === false;
1009
+ const sectionHidden = (section) => v[section] === false || VISIBILITY_TREE[section].length > 0 && VISIBILITY_TREE[section].every((f) => v[f] === false);
1010
+ if (hidden("identification")) {
584
1011
  delete redacted.well_id;
585
- delete redacted.location;
586
1012
  delete redacted.well_type;
587
1013
  delete redacted.well_purpose;
588
1014
  delete redacted.name;
589
1015
  delete redacted.well_driller;
590
1016
  delete redacted.construction_date;
591
- delete redacted.obs;
1017
+ }
1018
+ if (hidden("location")) {
1019
+ delete redacted.location;
592
1020
  delete redacted.lat;
593
1021
  delete redacted.lng;
594
1022
  delete redacted.elevation;
595
1023
  }
596
- if (!visibility.constructive) {
597
- redacted.bore_hole = [];
598
- redacted.well_case = [];
599
- redacted.reduction = [];
600
- redacted.well_screen = [];
601
- redacted.surface_case = [];
602
- redacted.hole_fill = [];
603
- delete redacted.centralizers;
604
- delete redacted.cement_pad;
605
- delete redacted.well_depth;
606
- }
607
- if (!visibility.geology) {
608
- redacted.lithology = [];
609
- redacted.fractures = [];
610
- redacted.caves = [];
611
- }
612
- if (!visibility.hydrodynamic) {
613
- redacted.hydrodynamic_events = [];
614
- redacted.aquifer_analysis = [];
615
- }
616
- if (!visibility.history) {
617
- redacted.history_logs = [];
1024
+ if (hidden("obs")) delete redacted.obs;
1025
+ if (hidden("attachments")) delete redacted.attachments;
1026
+ if (hidden("bore_hole")) redacted.bore_hole = [];
1027
+ if (hidden("surface_case")) redacted.surface_case = [];
1028
+ if (hidden("well_case")) redacted.well_case = [];
1029
+ if (hidden("reduction")) redacted.reduction = [];
1030
+ if (hidden("well_screen")) redacted.well_screen = [];
1031
+ if (hidden("hole_fill")) redacted.hole_fill = [];
1032
+ if (hidden("centralizers")) delete redacted.centralizers;
1033
+ if (hidden("cement_pad")) delete redacted.cement_pad;
1034
+ if (sectionHidden("constructive")) delete redacted.well_depth;
1035
+ if (hidden("lithology")) redacted.lithology = [];
1036
+ if (hidden("fractures")) redacted.fractures = [];
1037
+ if (hidden("caves")) redacted.caves = [];
1038
+ if (hidden("hydrodynamic_events")) redacted.hydrodynamic_events = [];
1039
+ if (hidden("aquifer_analysis")) redacted.aquifer_analysis = [];
1040
+ if (hidden("history")) redacted.history_logs = [];
1041
+ if (hidden("pump_installations")) delete redacted.pump_installations;
1042
+ if (hidden("meters")) delete redacted.meters;
1043
+ if (hidden("operating_regime")) delete redacted.operating_regime;
1044
+ if (hidden("production")) delete redacted.production;
1045
+ if (hidden("permits")) delete redacted.permits;
1046
+ if (hidden("water_quality")) delete redacted.water_samples;
1047
+ if (Object.values(v).some((shown) => shown === false)) {
1048
+ for (const key of unknownRootKeys(redacted))
1049
+ delete redacted[key];
618
1050
  }
619
1051
  return redacted;
620
1052
  }
@@ -969,6 +1401,1521 @@ var FGDC_TEXTURES_OPTIONS = [
969
1401
  { code: 733, label: "Ore" }
970
1402
  ];
971
1403
 
1404
+ // src/vocab/waterQuality.limits.ts
1405
+ var NEPHELOMETRIC_TURBIDITY_CODES = [
1406
+ "turbidity",
1407
+ "turbidity_ntu",
1408
+ "turbidity_fnu"
1409
+ ];
1410
+ var WHO_GDWQ_2022 = {
1411
+ id: "who_gdwq_2022",
1412
+ name: "WHO Guidelines for Drinking-water Quality (2022)",
1413
+ jurisdiction: "INT",
1414
+ source: "WHO, Guidelines for drinking-water quality: 4th edition incorporating the first and second addenda, 2022",
1415
+ limits: [
1416
+ { code: "antimony", max: 0.02, basis: "health" },
1417
+ { code: "arsenic", max: 0.01, basis: "health", note: "provisional" },
1418
+ { code: "barium", max: 1.3, basis: "health" },
1419
+ { code: "boron", max: 2.4, basis: "health" },
1420
+ { code: "cadmium", max: 3e-3, basis: "health" },
1421
+ { code: "chromium", max: 0.05, basis: "health", note: "provisional" },
1422
+ { code: "copper", max: 2, basis: "health" },
1423
+ { code: "fluoride", max: 1.5, basis: "health" },
1424
+ { code: "lead", max: 0.01, basis: "health", note: "provisional" },
1425
+ { code: "manganese", max: 0.08, basis: "health", note: "provisional" },
1426
+ { code: "mercury", max: 6e-3, basis: "health", note: "inorganic mercury" },
1427
+ { code: "nickel", max: 0.07, basis: "health" },
1428
+ { code: "nitrate_as_no3", max: 50, basis: "health" },
1429
+ { code: "nitrite_as_no2", max: 3, basis: "health" },
1430
+ { code: "selenium", max: 0.04, basis: "health", note: "provisional" },
1431
+ { code: "uranium", max: 0.03, basis: "health", note: "provisional" },
1432
+ { code: "e_coli", presence_allowed: false, basis: "health" },
1433
+ {
1434
+ code: "thermotolerant_coliforms",
1435
+ presence_allowed: false,
1436
+ basis: "health"
1437
+ },
1438
+ { code: "gross_alpha", max: 0.5, basis: "health", note: "screening level" },
1439
+ { code: "gross_beta", max: 1, basis: "health", note: "screening level" }
1440
+ ]
1441
+ };
1442
+ var BR_GM_MS_888_2021 = {
1443
+ id: "br_gm_ms_888_2021",
1444
+ name: "Brasil \u2014 Portaria GM/MS 888/2021",
1445
+ jurisdiction: "BR",
1446
+ source: "Minist\xE9rio da Sa\xFAde, Portaria GM/MS n\xBA 888, de 4 de maio de 2021",
1447
+ limits: [
1448
+ // Inorganic substances (health)
1449
+ { code: "antimony", max: 6e-3, basis: "health" },
1450
+ { code: "arsenic", max: 0.01, basis: "health" },
1451
+ { code: "barium", max: 0.7, basis: "health" },
1452
+ { code: "cadmium", max: 3e-3, basis: "health" },
1453
+ { code: "lead", max: 0.01, basis: "health" },
1454
+ { code: "cyanide_total_as_cn", max: 0.07, basis: "health" },
1455
+ { code: "copper", max: 2, basis: "health" },
1456
+ { code: "chromium", max: 0.05, basis: "health" },
1457
+ { code: "fluoride", max: 1.5, basis: "health" },
1458
+ { code: "mercury", max: 1e-3, basis: "health" },
1459
+ { code: "nickel", max: 0.07, basis: "health" },
1460
+ { code: "nitrate_as_n", max: 10, basis: "health" },
1461
+ { code: "nitrite_as_n", max: 1, basis: "health" },
1462
+ { code: "selenium", max: 0.04, basis: "health" },
1463
+ { code: "uranium", max: 0.03, basis: "health" },
1464
+ // Organoleptic standard
1465
+ { code: "aluminum", max: 0.2, basis: "aesthetic" },
1466
+ { code: "ammonia_as_nh3", max: 1.2, basis: "aesthetic" },
1467
+ { code: "chloride", max: 250, basis: "aesthetic" },
1468
+ { code: "apparent_color", max: 15, basis: "aesthetic" },
1469
+ { code: "hardness_total_as_caco3", max: 300, basis: "aesthetic" },
1470
+ { code: "iron", max: 0.3, basis: "aesthetic" },
1471
+ { code: "manganese", max: 0.1, basis: "aesthetic" },
1472
+ { code: "sodium", max: 200, basis: "aesthetic" },
1473
+ { code: "total_dissolved_solids", max: 500, basis: "aesthetic" },
1474
+ { code: "sulfate", max: 250, basis: "aesthetic" },
1475
+ {
1476
+ code: "turbidity",
1477
+ max: 5,
1478
+ basis: "aesthetic",
1479
+ note: "organoleptic standard (uT)"
1480
+ },
1481
+ // Operational
1482
+ {
1483
+ code: "ph",
1484
+ min: 6,
1485
+ max: 9,
1486
+ basis: "operational",
1487
+ note: "recommended range"
1488
+ },
1489
+ {
1490
+ code: "free_chlorine",
1491
+ min: 0.2,
1492
+ max: 5,
1493
+ basis: "operational",
1494
+ note: "residual in the distribution system"
1495
+ },
1496
+ // Microbiological
1497
+ { code: "e_coli", presence_allowed: false, basis: "health" },
1498
+ {
1499
+ code: "total_coliforms",
1500
+ presence_allowed: false,
1501
+ basis: "indicator",
1502
+ note: "tolerances apply by system size and sampling point"
1503
+ },
1504
+ // Radioactivity
1505
+ { code: "gross_alpha", max: 0.5, basis: "health", note: "screening level" },
1506
+ { code: "gross_beta", max: 1, basis: "health", note: "screening level" },
1507
+ { code: "radium_226", max: 1, basis: "health" },
1508
+ { code: "radium_228", max: 0.1, basis: "health" }
1509
+ ]
1510
+ };
1511
+ var EU_2020_2184 = {
1512
+ id: "eu_2020_2184",
1513
+ name: "EU Drinking Water Directive 2020/2184",
1514
+ jurisdiction: "EU",
1515
+ source: "Directive (EU) 2020/2184 of the European Parliament and of the Council, Annex I",
1516
+ limits: [
1517
+ // Part A — microbiological
1518
+ { code: "e_coli", presence_allowed: false, basis: "health" },
1519
+ // Part B — chemical
1520
+ { code: "antimony", max: 0.01, basis: "health" },
1521
+ { code: "arsenic", max: 0.01, basis: "health" },
1522
+ {
1523
+ code: "boron",
1524
+ max: 1.5,
1525
+ basis: "health",
1526
+ note: "2.4 mg/L where desalinated water is the predominant source"
1527
+ },
1528
+ { code: "cadmium", max: 5e-3, basis: "health" },
1529
+ {
1530
+ code: "chromium",
1531
+ max: 0.05,
1532
+ basis: "health",
1533
+ note: "0.025 mg/L from 12 January 2036"
1534
+ },
1535
+ { code: "copper", max: 2, basis: "health" },
1536
+ { code: "cyanide_total_as_cn", max: 0.05, basis: "health" },
1537
+ { code: "fluoride", max: 1.5, basis: "health" },
1538
+ {
1539
+ code: "lead",
1540
+ max: 0.01,
1541
+ basis: "health",
1542
+ note: "0.005 mg/L from 12 January 2036"
1543
+ },
1544
+ { code: "mercury", max: 1e-3, basis: "health" },
1545
+ { code: "nickel", max: 0.02, basis: "health" },
1546
+ { code: "nitrate_as_no3", max: 50, basis: "health" },
1547
+ { code: "nitrite_as_no2", max: 0.5, basis: "health", note: "at the tap" },
1548
+ { code: "selenium", max: 0.02, basis: "health" },
1549
+ { code: "uranium", max: 0.03, basis: "health" },
1550
+ // Part C — indicator parameters
1551
+ { code: "aluminum", max: 0.2, basis: "indicator" },
1552
+ { code: "chloride", max: 250, basis: "indicator" },
1553
+ {
1554
+ code: "specific_conductance",
1555
+ max: 2500,
1556
+ basis: "indicator",
1557
+ note: "directive value is at 20 \xB0C"
1558
+ },
1559
+ { code: "ph", min: 6.5, max: 9.5, basis: "indicator" },
1560
+ { code: "iron", max: 0.2, basis: "indicator" },
1561
+ { code: "manganese", max: 0.05, basis: "indicator" },
1562
+ { code: "sodium", max: 200, basis: "indicator" },
1563
+ { code: "sulfate", max: 250, basis: "indicator" },
1564
+ { code: "total_coliforms", presence_allowed: false, basis: "indicator" }
1565
+ ]
1566
+ };
1567
+ var WATER_QUALITY_LIMIT_SETS = [
1568
+ WHO_GDWQ_2022,
1569
+ BR_GM_MS_888_2021,
1570
+ EU_2020_2184
1571
+ ];
1572
+ function getLimitSet(id) {
1573
+ return WATER_QUALITY_LIMIT_SETS.find((s) => s.id === id);
1574
+ }
1575
+
1576
+ // src/utils/language.utils.ts
1577
+ function parseLanguageTextJson(value) {
1578
+ const trimmed = value.trim();
1579
+ if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) return void 0;
1580
+ let parsed;
1581
+ try {
1582
+ parsed = JSON.parse(trimmed);
1583
+ } catch {
1584
+ return void 0;
1585
+ }
1586
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
1587
+ return void 0;
1588
+ }
1589
+ const entries = Object.entries(parsed).filter(
1590
+ (entry) => typeof entry[1] === "string" && entry[1].trim() !== ""
1591
+ );
1592
+ return Object.fromEntries(entries);
1593
+ }
1594
+ function resolveLanguageText(text, locale, fallback = "en") {
1595
+ if (text == null) return "";
1596
+ const labels = typeof text === "string" ? parseLanguageTextJson(text) : text;
1597
+ if (labels === void 0) return text;
1598
+ const base = locale.split("-")[0];
1599
+ const usable = (key) => {
1600
+ const value = labels[key];
1601
+ return typeof value === "string" && value.trim() !== "" ? value : void 0;
1602
+ };
1603
+ return usable(locale) ?? usable(base) ?? usable(fallback) ?? Object.keys(labels).map(usable).find((v) => v !== void 0) ?? "";
1604
+ }
1605
+
1606
+ // src/vocab/waterQuality.vocab.ts
1607
+ var WATER_QUALITY_VOCABULARY_VERSION = "1.0.0";
1608
+ var WATER_QUALITY_UNITS = {
1609
+ mg_l: { symbol: "mg/L", ucum: "mg/L" },
1610
+ us_cm: { symbol: "\xB5S/cm", ucum: "uS/cm" },
1611
+ celsius: { symbol: "\xB0C", ucum: "Cel" },
1612
+ mv: { symbol: "mV", ucum: "mV" },
1613
+ ph: { symbol: "", ucum: "[pH]" },
1614
+ ftu: { symbol: "FTU" },
1615
+ ntu: { symbol: "NTU" },
1616
+ fnu: { symbol: "FNU" },
1617
+ fau: { symbol: "FAU" },
1618
+ hazen: { symbol: "uH" },
1619
+ mpn_100ml: { symbol: "MPN/100 mL", ucum: "{MPN}/(100.mL)" },
1620
+ cfu_100ml: { symbol: "CFU/100 mL", ucum: "{CFU}/(100.mL)" },
1621
+ cfu_ml: { symbol: "CFU/mL", ucum: "{CFU}/mL" },
1622
+ bq_l: { symbol: "Bq/L", ucum: "Bq/L" },
1623
+ none: { symbol: "" }
1624
+ };
1625
+ var U = WATER_QUALITY_UNITS;
1626
+ function defineParameter(code, group, label, pt, unit, extra = {}) {
1627
+ return {
1628
+ code,
1629
+ group,
1630
+ label,
1631
+ labels: { pt },
1632
+ unit,
1633
+ form: extra.form ?? "value",
1634
+ ...extra.cas !== void 0 && { cas: extra.cas },
1635
+ ...extra.molar_mass !== void 0 && { molar_mass: extra.molar_mass },
1636
+ ...extra.charge !== void 0 && { charge: extra.charge }
1637
+ };
1638
+ }
1639
+ var WATER_QUALITY_PARAMETERS = [
1640
+ // Physical / field
1641
+ defineParameter(
1642
+ "temperature",
1643
+ "physical",
1644
+ "Temperature",
1645
+ "Temperatura",
1646
+ U.celsius
1647
+ ),
1648
+ defineParameter("ph", "physical", "pH", "pH", U.ph),
1649
+ defineParameter(
1650
+ "specific_conductance",
1651
+ "physical",
1652
+ "Specific conductance at 25 \xB0C",
1653
+ "Condutividade el\xE9trica a 25 \xB0C",
1654
+ U.us_cm
1655
+ ),
1656
+ defineParameter(
1657
+ "conductivity_uncompensated",
1658
+ "physical",
1659
+ "Electrical conductivity, uncompensated",
1660
+ "Condutividade sem compensa\xE7\xE3o",
1661
+ U.us_cm
1662
+ ),
1663
+ defineParameter(
1664
+ "dissolved_oxygen",
1665
+ "physical",
1666
+ "Dissolved oxygen",
1667
+ "Oxig\xEAnio dissolvido",
1668
+ U.mg_l
1669
+ ),
1670
+ defineParameter(
1671
+ "orp",
1672
+ "physical",
1673
+ "Oxidation-reduction potential vs. reference electrode",
1674
+ "Potencial redox vs. eletrodo de refer\xEAncia",
1675
+ U.mv
1676
+ ),
1677
+ defineParameter(
1678
+ "eh",
1679
+ "physical",
1680
+ "Redox potential vs. SHE",
1681
+ "Potencial redox corrigido vs. EPH",
1682
+ U.mv
1683
+ ),
1684
+ defineParameter(
1685
+ "turbidity",
1686
+ "physical",
1687
+ "Turbidity, formazin, method unspecified",
1688
+ "Turbidez, formazina sem m\xE9todo identificado",
1689
+ U.ftu
1690
+ ),
1691
+ defineParameter(
1692
+ "turbidity_ntu",
1693
+ "physical",
1694
+ "Turbidity, nephelometric white light",
1695
+ "Turbidez nefelom\xE9trica, luz branca",
1696
+ U.ntu
1697
+ ),
1698
+ defineParameter(
1699
+ "turbidity_fnu",
1700
+ "physical",
1701
+ "Turbidity, nephelometric infrared (ISO 7027)",
1702
+ "Turbidez nefelom\xE9trica, infravermelho",
1703
+ U.fnu
1704
+ ),
1705
+ defineParameter(
1706
+ "turbidity_fau",
1707
+ "physical",
1708
+ "Turbidity, attenuation (ISO 7027)",
1709
+ "Turbidez por atenua\xE7\xE3o",
1710
+ U.fau
1711
+ ),
1712
+ defineParameter(
1713
+ "apparent_color",
1714
+ "physical",
1715
+ "Apparent color",
1716
+ "Cor aparente",
1717
+ U.hazen
1718
+ ),
1719
+ defineParameter(
1720
+ "true_color",
1721
+ "physical",
1722
+ "True color",
1723
+ "Cor verdadeira",
1724
+ U.hazen
1725
+ ),
1726
+ defineParameter("odor", "physical", "Odor", "Odor", U.none, { form: "text" }),
1727
+ defineParameter("taste", "physical", "Taste", "Gosto", U.none, {
1728
+ form: "text"
1729
+ }),
1730
+ defineParameter(
1731
+ "total_dissolved_solids",
1732
+ "physical",
1733
+ "Total dissolved solids",
1734
+ "S\xF3lidos totais dissolvidos",
1735
+ U.mg_l
1736
+ ),
1737
+ defineParameter(
1738
+ "total_suspended_solids",
1739
+ "physical",
1740
+ "Total suspended solids",
1741
+ "S\xF3lidos suspensos totais",
1742
+ U.mg_l
1743
+ ),
1744
+ defineParameter(
1745
+ "total_solids",
1746
+ "physical",
1747
+ "Total solids",
1748
+ "S\xF3lidos totais",
1749
+ U.mg_l
1750
+ ),
1751
+ defineParameter(
1752
+ "free_co2",
1753
+ "physical",
1754
+ "Free carbon dioxide",
1755
+ "G\xE1s carb\xF4nico livre",
1756
+ U.mg_l
1757
+ ),
1758
+ // Aggregate (expressed as CaCO₃: 100.087 g/mol, divalent → 50.04 mg/meq)
1759
+ defineParameter(
1760
+ "alkalinity_total_as_caco3",
1761
+ "aggregate",
1762
+ "Total alkalinity as CaCO\u2083",
1763
+ "Alcalinidade total como CaCO\u2083",
1764
+ U.mg_l,
1765
+ { molar_mass: 100.087, charge: -2 }
1766
+ ),
1767
+ defineParameter(
1768
+ "alkalinity_bicarbonate_as_caco3",
1769
+ "aggregate",
1770
+ "Bicarbonate alkalinity as CaCO\u2083",
1771
+ "Alcalinidade de bicarbonatos como CaCO\u2083",
1772
+ U.mg_l,
1773
+ { molar_mass: 100.087, charge: -2 }
1774
+ ),
1775
+ defineParameter(
1776
+ "alkalinity_carbonate_as_caco3",
1777
+ "aggregate",
1778
+ "Carbonate alkalinity as CaCO\u2083",
1779
+ "Alcalinidade de carbonatos como CaCO\u2083",
1780
+ U.mg_l,
1781
+ { molar_mass: 100.087, charge: -2 }
1782
+ ),
1783
+ defineParameter(
1784
+ "alkalinity_hydroxide_as_caco3",
1785
+ "aggregate",
1786
+ "Hydroxide alkalinity as CaCO\u2083",
1787
+ "Alcalinidade de hidr\xF3xidos como CaCO\u2083",
1788
+ U.mg_l,
1789
+ { molar_mass: 100.087, charge: -2 }
1790
+ ),
1791
+ defineParameter(
1792
+ "acidity_total_as_caco3",
1793
+ "aggregate",
1794
+ "Total acidity as CaCO\u2083",
1795
+ "Acidez total como CaCO\u2083",
1796
+ U.mg_l,
1797
+ { molar_mass: 100.087, charge: 2 }
1798
+ ),
1799
+ defineParameter(
1800
+ "hardness_total_as_caco3",
1801
+ "aggregate",
1802
+ "Total hardness as CaCO\u2083",
1803
+ "Dureza total como CaCO\u2083",
1804
+ U.mg_l,
1805
+ { molar_mass: 100.087, charge: 2 }
1806
+ ),
1807
+ defineParameter(
1808
+ "hardness_calcium_as_caco3",
1809
+ "aggregate",
1810
+ "Calcium hardness as CaCO\u2083",
1811
+ "Dureza de c\xE1lcio como CaCO\u2083",
1812
+ U.mg_l,
1813
+ { molar_mass: 100.087, charge: 2 }
1814
+ ),
1815
+ // Major ions
1816
+ defineParameter("calcium", "major_ion", "Calcium", "C\xE1lcio", U.mg_l, {
1817
+ cas: "7440-70-2",
1818
+ molar_mass: 40.078,
1819
+ charge: 2
1820
+ }),
1821
+ defineParameter("magnesium", "major_ion", "Magnesium", "Magn\xE9sio", U.mg_l, {
1822
+ cas: "7439-95-4",
1823
+ molar_mass: 24.305,
1824
+ charge: 2
1825
+ }),
1826
+ defineParameter("sodium", "major_ion", "Sodium", "S\xF3dio", U.mg_l, {
1827
+ cas: "7440-23-5",
1828
+ molar_mass: 22.99,
1829
+ charge: 1
1830
+ }),
1831
+ defineParameter("potassium", "major_ion", "Potassium", "Pot\xE1ssio", U.mg_l, {
1832
+ cas: "7440-09-7",
1833
+ molar_mass: 39.098,
1834
+ charge: 1
1835
+ }),
1836
+ defineParameter(
1837
+ "bicarbonate",
1838
+ "major_ion",
1839
+ "Bicarbonate as HCO\u2083\u207B",
1840
+ "Bicarbonato como HCO\u2083\u207B",
1841
+ U.mg_l,
1842
+ { cas: "71-52-3", molar_mass: 61.017, charge: -1 }
1843
+ ),
1844
+ defineParameter(
1845
+ "carbonate",
1846
+ "major_ion",
1847
+ "Carbonate as CO\u2083\xB2\u207B",
1848
+ "Carbonato como CO\u2083\xB2\u207B",
1849
+ U.mg_l,
1850
+ { cas: "3812-32-6", molar_mass: 60.009, charge: -2 }
1851
+ ),
1852
+ defineParameter("chloride", "major_ion", "Chloride", "Cloreto", U.mg_l, {
1853
+ cas: "16887-00-6",
1854
+ molar_mass: 35.453,
1855
+ charge: -1
1856
+ }),
1857
+ defineParameter("sulfate", "major_ion", "Sulfate", "Sulfato", U.mg_l, {
1858
+ cas: "14808-79-8",
1859
+ molar_mass: 96.06,
1860
+ charge: -2
1861
+ }),
1862
+ defineParameter("fluoride", "major_ion", "Fluoride", "Fluoreto", U.mg_l, {
1863
+ cas: "16984-48-8",
1864
+ molar_mass: 18.998,
1865
+ charge: -1
1866
+ }),
1867
+ defineParameter(
1868
+ "silica_as_sio2",
1869
+ "major_ion",
1870
+ "Silica as SiO\u2082",
1871
+ "S\xEDlica como SiO\u2082",
1872
+ U.mg_l,
1873
+ { cas: "7631-86-9" }
1874
+ ),
1875
+ // Nutrients
1876
+ defineParameter(
1877
+ "nitrate_as_n",
1878
+ "nutrient",
1879
+ "Nitrate as N",
1880
+ "Nitrato como N",
1881
+ U.mg_l,
1882
+ {
1883
+ molar_mass: 14.007,
1884
+ charge: -1
1885
+ }
1886
+ ),
1887
+ defineParameter(
1888
+ "nitrate_as_no3",
1889
+ "nutrient",
1890
+ "Nitrate as NO\u2083\u207B",
1891
+ "Nitrato como NO\u2083\u207B",
1892
+ U.mg_l,
1893
+ { cas: "14797-55-8", molar_mass: 62.004, charge: -1 }
1894
+ ),
1895
+ defineParameter(
1896
+ "nitrite_as_n",
1897
+ "nutrient",
1898
+ "Nitrite as N",
1899
+ "Nitrito como N",
1900
+ U.mg_l,
1901
+ {
1902
+ molar_mass: 14.007,
1903
+ charge: -1
1904
+ }
1905
+ ),
1906
+ defineParameter(
1907
+ "nitrite_as_no2",
1908
+ "nutrient",
1909
+ "Nitrite as NO\u2082\u207B",
1910
+ "Nitrito como NO\u2082\u207B",
1911
+ U.mg_l,
1912
+ { cas: "14797-65-0", molar_mass: 46.005, charge: -1 }
1913
+ ),
1914
+ defineParameter(
1915
+ "ammonia_as_n",
1916
+ "nutrient",
1917
+ "Ammonia nitrogen as N",
1918
+ "Nitrog\xEAnio amoniacal como N",
1919
+ U.mg_l,
1920
+ { molar_mass: 14.007, charge: 1 }
1921
+ ),
1922
+ defineParameter(
1923
+ "ammonia_as_nh3",
1924
+ "nutrient",
1925
+ "Ammonia as NH\u2083",
1926
+ "Am\xF4nia como NH\u2083",
1927
+ U.mg_l,
1928
+ {
1929
+ cas: "7664-41-7"
1930
+ }
1931
+ ),
1932
+ defineParameter(
1933
+ "kjeldahl_nitrogen_as_n",
1934
+ "nutrient",
1935
+ "Total Kjeldahl nitrogen as N",
1936
+ "Nitrog\xEAnio Kjeldahl total como N",
1937
+ U.mg_l
1938
+ ),
1939
+ defineParameter(
1940
+ "phosphorus_total_as_p",
1941
+ "nutrient",
1942
+ "Total phosphorus as P",
1943
+ "F\xF3sforo total como P",
1944
+ U.mg_l
1945
+ ),
1946
+ defineParameter(
1947
+ "orthophosphate_as_po4",
1948
+ "nutrient",
1949
+ "Orthophosphate as PO\u2084\xB3\u207B",
1950
+ "Ortofosfato como PO\u2084\xB3\u207B",
1951
+ U.mg_l,
1952
+ { molar_mass: 94.971, charge: -3 }
1953
+ ),
1954
+ // Organic
1955
+ defineParameter(
1956
+ "total_organic_carbon",
1957
+ "organic",
1958
+ "Total organic carbon",
1959
+ "Carbono org\xE2nico total",
1960
+ U.mg_l
1961
+ ),
1962
+ defineParameter(
1963
+ "cod",
1964
+ "organic",
1965
+ "Chemical oxygen demand",
1966
+ "Demanda qu\xEDmica de oxig\xEAnio (DQO)",
1967
+ U.mg_l
1968
+ ),
1969
+ defineParameter(
1970
+ "bod5",
1971
+ "organic",
1972
+ "Biochemical oxygen demand, 5-day",
1973
+ "Demanda bioqu\xEDmica de oxig\xEAnio (DBO\u2085)",
1974
+ U.mg_l
1975
+ ),
1976
+ defineParameter(
1977
+ "total_petroleum_hydrocarbons",
1978
+ "organic",
1979
+ "Total petroleum hydrocarbons (range per method)",
1980
+ "Hidrocarbonetos totais de petr\xF3leo",
1981
+ U.mg_l
1982
+ ),
1983
+ defineParameter(
1984
+ "oil_and_grease",
1985
+ "organic",
1986
+ "Oil and grease",
1987
+ "\xD3leos e graxas",
1988
+ U.mg_l
1989
+ ),
1990
+ // Disinfection
1991
+ defineParameter(
1992
+ "free_chlorine",
1993
+ "disinfection",
1994
+ "Free chlorine residual",
1995
+ "Cloro residual livre",
1996
+ U.mg_l
1997
+ ),
1998
+ defineParameter(
1999
+ "total_chlorine",
2000
+ "disinfection",
2001
+ "Total chlorine residual",
2002
+ "Cloro residual total",
2003
+ U.mg_l
2004
+ ),
2005
+ // Mining and redox
2006
+ defineParameter(
2007
+ "ferrous_iron",
2008
+ "mining_redox",
2009
+ "Ferrous iron (Fe\xB2\u207A)",
2010
+ "Ferro ferroso (Fe\xB2\u207A)",
2011
+ U.mg_l
2012
+ ),
2013
+ defineParameter(
2014
+ "chromium_hexavalent",
2015
+ "mining_redox",
2016
+ "Hexavalent chromium",
2017
+ "Cromo hexavalente",
2018
+ U.mg_l,
2019
+ { cas: "18540-29-9" }
2020
+ ),
2021
+ defineParameter(
2022
+ "cyanide_total_as_cn",
2023
+ "mining_redox",
2024
+ "Total cyanide as CN\u207B",
2025
+ "Cianeto total como CN\u207B",
2026
+ U.mg_l
2027
+ ),
2028
+ defineParameter(
2029
+ "cyanide_wad_as_cn",
2030
+ "mining_redox",
2031
+ "Weak acid dissociable cyanide as CN\u207B",
2032
+ "Cianeto WAD como CN\u207B",
2033
+ U.mg_l
2034
+ ),
2035
+ defineParameter(
2036
+ "cyanide_free_as_cn",
2037
+ "mining_redox",
2038
+ "Free cyanide as CN\u207B",
2039
+ "Cianeto livre como CN\u207B",
2040
+ U.mg_l
2041
+ ),
2042
+ defineParameter(
2043
+ "thiocyanate",
2044
+ "mining_redox",
2045
+ "Thiocyanate",
2046
+ "Tiocianato",
2047
+ U.mg_l,
2048
+ {
2049
+ cas: "302-04-5"
2050
+ }
2051
+ ),
2052
+ defineParameter(
2053
+ "sulfide_total_as_s",
2054
+ "mining_redox",
2055
+ "Total sulfide as S",
2056
+ "Sulfeto total como S",
2057
+ U.mg_l
2058
+ ),
2059
+ // Metals / trace
2060
+ defineParameter("iron", "metal", "Iron", "Ferro", U.mg_l, {
2061
+ cas: "7439-89-6",
2062
+ molar_mass: 55.845,
2063
+ charge: 2
2064
+ }),
2065
+ defineParameter("manganese", "metal", "Manganese", "Mangan\xEAs", U.mg_l, {
2066
+ cas: "7439-96-5",
2067
+ molar_mass: 54.938,
2068
+ charge: 2
2069
+ }),
2070
+ defineParameter("aluminum", "metal", "Aluminium", "Alum\xEDnio", U.mg_l, {
2071
+ cas: "7429-90-5"
2072
+ }),
2073
+ defineParameter("antimony", "metal", "Antimony", "Antim\xF4nio", U.mg_l, {
2074
+ cas: "7440-36-0"
2075
+ }),
2076
+ defineParameter("arsenic", "metal", "Arsenic", "Ars\xEAnio", U.mg_l, {
2077
+ cas: "7440-38-2"
2078
+ }),
2079
+ defineParameter("barium", "metal", "Barium", "B\xE1rio", U.mg_l, {
2080
+ cas: "7440-39-3"
2081
+ }),
2082
+ defineParameter("beryllium", "metal", "Beryllium", "Ber\xEDlio", U.mg_l, {
2083
+ cas: "7440-41-7"
2084
+ }),
2085
+ defineParameter("boron", "metal", "Boron", "Boro", U.mg_l, {
2086
+ cas: "7440-42-8"
2087
+ }),
2088
+ defineParameter("cadmium", "metal", "Cadmium", "C\xE1dmio", U.mg_l, {
2089
+ cas: "7440-43-9"
2090
+ }),
2091
+ defineParameter(
2092
+ "chromium",
2093
+ "metal",
2094
+ "Chromium, total",
2095
+ "Cromo total",
2096
+ U.mg_l,
2097
+ {
2098
+ cas: "7440-47-3"
2099
+ }
2100
+ ),
2101
+ defineParameter("cobalt", "metal", "Cobalt", "Cobalto", U.mg_l, {
2102
+ cas: "7440-48-4"
2103
+ }),
2104
+ defineParameter("copper", "metal", "Copper", "Cobre", U.mg_l, {
2105
+ cas: "7440-50-8"
2106
+ }),
2107
+ defineParameter("lead", "metal", "Lead", "Chumbo", U.mg_l, {
2108
+ cas: "7439-92-1"
2109
+ }),
2110
+ defineParameter("lithium", "metal", "Lithium", "L\xEDtio", U.mg_l, {
2111
+ cas: "7439-93-2",
2112
+ molar_mass: 6.94,
2113
+ charge: 1
2114
+ }),
2115
+ defineParameter("mercury", "metal", "Mercury", "Merc\xFArio", U.mg_l, {
2116
+ cas: "7439-97-6"
2117
+ }),
2118
+ defineParameter("molybdenum", "metal", "Molybdenum", "Molibd\xEAnio", U.mg_l, {
2119
+ cas: "7439-98-7"
2120
+ }),
2121
+ defineParameter("nickel", "metal", "Nickel", "N\xEDquel", U.mg_l, {
2122
+ cas: "7440-02-0"
2123
+ }),
2124
+ defineParameter("selenium", "metal", "Selenium", "Sel\xEAnio", U.mg_l, {
2125
+ cas: "7782-49-2"
2126
+ }),
2127
+ defineParameter("silver", "metal", "Silver", "Prata", U.mg_l, {
2128
+ cas: "7440-22-4"
2129
+ }),
2130
+ defineParameter("strontium", "metal", "Strontium", "Estr\xF4ncio", U.mg_l, {
2131
+ cas: "7440-24-6",
2132
+ molar_mass: 87.62,
2133
+ charge: 2
2134
+ }),
2135
+ defineParameter("thallium", "metal", "Thallium", "T\xE1lio", U.mg_l, {
2136
+ cas: "7440-28-0"
2137
+ }),
2138
+ defineParameter("uranium", "metal", "Uranium", "Ur\xE2nio", U.mg_l, {
2139
+ cas: "7440-61-1"
2140
+ }),
2141
+ defineParameter("vanadium", "metal", "Vanadium", "Van\xE1dio", U.mg_l, {
2142
+ cas: "7440-62-2"
2143
+ }),
2144
+ defineParameter("zinc", "metal", "Zinc", "Zinco", U.mg_l, {
2145
+ cas: "7440-66-6"
2146
+ }),
2147
+ // Microbiology
2148
+ defineParameter(
2149
+ "total_coliforms",
2150
+ "microbiology",
2151
+ "Total coliforms in 100 mL",
2152
+ "Coliformes totais em 100 mL",
2153
+ U.none,
2154
+ { form: "presence" }
2155
+ ),
2156
+ defineParameter(
2157
+ "total_coliforms_mpn",
2158
+ "microbiology",
2159
+ "Total coliforms, count",
2160
+ "Coliformes totais, contagem",
2161
+ U.mpn_100ml
2162
+ ),
2163
+ defineParameter(
2164
+ "total_coliforms_cfu",
2165
+ "microbiology",
2166
+ "Total coliforms, count",
2167
+ "Coliformes totais, contagem",
2168
+ U.cfu_100ml
2169
+ ),
2170
+ defineParameter(
2171
+ "e_coli",
2172
+ "microbiology",
2173
+ "E. coli in 100 mL",
2174
+ "E. coli em 100 mL",
2175
+ U.none,
2176
+ { form: "presence" }
2177
+ ),
2178
+ defineParameter(
2179
+ "e_coli_mpn",
2180
+ "microbiology",
2181
+ "E. coli, count",
2182
+ "E. coli, contagem",
2183
+ U.mpn_100ml
2184
+ ),
2185
+ defineParameter(
2186
+ "e_coli_cfu",
2187
+ "microbiology",
2188
+ "E. coli, count",
2189
+ "E. coli, contagem",
2190
+ U.cfu_100ml
2191
+ ),
2192
+ defineParameter(
2193
+ "thermotolerant_coliforms",
2194
+ "microbiology",
2195
+ "Thermotolerant coliforms in 100 mL",
2196
+ "Coliformes termotolerantes em 100 mL",
2197
+ U.none,
2198
+ { form: "presence" }
2199
+ ),
2200
+ defineParameter(
2201
+ "thermotolerant_coliforms_mpn",
2202
+ "microbiology",
2203
+ "Thermotolerant coliforms, count",
2204
+ "Coliformes termotolerantes, contagem",
2205
+ U.mpn_100ml
2206
+ ),
2207
+ defineParameter(
2208
+ "thermotolerant_coliforms_cfu",
2209
+ "microbiology",
2210
+ "Thermotolerant coliforms, count",
2211
+ "Coliformes termotolerantes, contagem",
2212
+ U.cfu_100ml
2213
+ ),
2214
+ defineParameter(
2215
+ "heterotrophic_plate_count",
2216
+ "microbiology",
2217
+ "Heterotrophic plate count",
2218
+ "Bact\xE9rias heterotr\xF3ficas",
2219
+ U.cfu_ml
2220
+ ),
2221
+ // Radioactivity (Bq/L even where a CAS exists)
2222
+ defineParameter(
2223
+ "gross_alpha",
2224
+ "radioactivity",
2225
+ "Gross alpha activity",
2226
+ "Atividade alfa total",
2227
+ U.bq_l
2228
+ ),
2229
+ defineParameter(
2230
+ "gross_beta",
2231
+ "radioactivity",
2232
+ "Gross beta activity",
2233
+ "Atividade beta total",
2234
+ U.bq_l
2235
+ ),
2236
+ defineParameter(
2237
+ "radium_226",
2238
+ "radioactivity",
2239
+ "Radium-226",
2240
+ "R\xE1dio-226",
2241
+ U.bq_l,
2242
+ {
2243
+ cas: "13982-63-3"
2244
+ }
2245
+ ),
2246
+ defineParameter(
2247
+ "radium_228",
2248
+ "radioactivity",
2249
+ "Radium-228",
2250
+ "R\xE1dio-228",
2251
+ U.bq_l,
2252
+ {
2253
+ cas: "15262-20-1"
2254
+ }
2255
+ ),
2256
+ defineParameter(
2257
+ "radon_222",
2258
+ "radioactivity",
2259
+ "Radon-222",
2260
+ "Rad\xF4nio-222",
2261
+ U.bq_l,
2262
+ {
2263
+ cas: "14859-67-7"
2264
+ }
2265
+ )
2266
+ ];
2267
+ var BY_CODE = new Map(WATER_QUALITY_PARAMETERS.map((d) => [d.code, d]));
2268
+ var BY_CAS = new Map(
2269
+ WATER_QUALITY_PARAMETERS.filter((d) => d.cas).map((d) => [d.cas, d])
2270
+ );
2271
+ function getParameterDefinition(parameter) {
2272
+ if (parameter.vocabulary === "welldot") return BY_CODE.get(parameter.code);
2273
+ if (parameter.vocabulary === "cas") return BY_CAS.get(parameter.code);
2274
+ return void 0;
2275
+ }
2276
+ function getParameterLabel(parameter, locale) {
2277
+ const def = getParameterDefinition(parameter);
2278
+ if (!def) return parameter.code;
2279
+ return resolveLanguageText({ ...def.labels, en: def.label }, locale, "en");
2280
+ }
2281
+ function parameterKey(parameter) {
2282
+ const def = getParameterDefinition(parameter);
2283
+ if (def) return def.code;
2284
+ return `${parameter.vocabulary}:${parameter.code}`;
2285
+ }
2286
+ function isKnownParameter(parameter) {
2287
+ if (parameter.vocabulary !== "welldot") return true;
2288
+ return BY_CODE.has(parameter.code);
2289
+ }
2290
+
2291
+ // src/vocab/attachment.vocab.ts
2292
+ var DOCUMENT_TYPES = [
2293
+ {
2294
+ value: "drilling_report",
2295
+ label: { en: "Drilling report", pt: "Relat\xF3rio de perfura\xE7\xE3o" }
2296
+ },
2297
+ {
2298
+ value: "as_built_drawing",
2299
+ label: { en: "As-built drawing", pt: "Perfil construtivo as-built" }
2300
+ },
2301
+ {
2302
+ value: "registry_record",
2303
+ label: { en: "Registry record", pt: "Ficha cadastral" }
2304
+ },
2305
+ { value: "photo", label: { en: "Photo", pt: "Fotografia" } },
2306
+ {
2307
+ value: "permit_document",
2308
+ label: { en: "Permit document", pt: "Portaria / outorga" }
2309
+ },
2310
+ {
2311
+ value: "condition_evidence",
2312
+ label: { en: "Condition evidence", pt: "Comprovante de condicionante" }
2313
+ },
2314
+ { value: "pump_curve", label: { en: "Pump curve", pt: "Curva da bomba" } },
2315
+ {
2316
+ value: "field_sheet",
2317
+ label: { en: "Field sheet", pt: "Planilha de campo" }
2318
+ },
2319
+ {
2320
+ value: "test_report",
2321
+ label: {
2322
+ en: "Pumping test report",
2323
+ pt: "Relat\xF3rio de teste de bombeamento"
2324
+ }
2325
+ },
2326
+ {
2327
+ value: "lab_report",
2328
+ label: { en: "Lab report", pt: "Laudo laboratorial" }
2329
+ },
2330
+ { value: "invoice", label: { en: "Invoice", pt: "Nota fiscal" } }
2331
+ ];
2332
+ var DOCUMENT_TYPE_SUGGESTIONS = {
2333
+ root: ["drilling_report", "as_built_drawing", "registry_record", "photo"],
2334
+ pump: ["pump_curve", "invoice", "photo"],
2335
+ meter: ["photo", "invoice", "condition_evidence"],
2336
+ permit: ["permit_document", "photo"],
2337
+ condition: ["condition_evidence", "photo"],
2338
+ permit_history: ["permit_document", "invoice", "photo"],
2339
+ event: ["field_sheet", "photo"],
2340
+ history: ["condition_evidence", "photo", "invoice"],
2341
+ sample: ["lab_report", "field_sheet", "photo", "condition_evidence"]
2342
+ };
2343
+
2344
+ // src/vocab/construction.vocab.ts
2345
+ var DRILLING_METHODS = [
2346
+ { value: "rotary", label: { en: "Rotary", pt: "Rotativo" } },
2347
+ { value: "percussion", label: { en: "Percussion", pt: "Percuss\xE3o" } },
2348
+ { value: "cable_tool", label: { en: "Cable tool", pt: "Percuss\xE3o a cabo" } },
2349
+ { value: "auger", label: { en: "Auger", pt: "Trado" } },
2350
+ {
2351
+ value: "air_hammer",
2352
+ label: { en: "Air hammer", pt: "Martelo pneum\xE1tico" }
2353
+ }
2354
+ ];
2355
+ var CONSTRUCTION_MATERIALS = [
2356
+ { value: "pvc", label: { en: "PVC", pt: "PVC" } },
2357
+ {
2358
+ value: "geomechanical_pvc",
2359
+ label: { en: "Geomechanical PVC", pt: "PVC geomec\xE2nico" }
2360
+ },
2361
+ { value: "carbon_steel", label: { en: "Carbon steel", pt: "A\xE7o carbono" } },
2362
+ {
2363
+ value: "galvanized_steel",
2364
+ label: { en: "Galvanized steel", pt: "A\xE7o galvanizado" }
2365
+ },
2366
+ {
2367
+ value: "stainless_steel",
2368
+ label: { en: "Stainless steel", pt: "A\xE7o inox" }
2369
+ },
2370
+ { value: "fiberglass", label: { en: "Fiberglass", pt: "Fibra de vidro" } }
2371
+ ];
2372
+ var SCREEN_SLOT_TYPES = [
2373
+ {
2374
+ value: "continuous_slot",
2375
+ label: { en: "Continuous slot", pt: "Espiralado (tipo Johnson)" }
2376
+ },
2377
+ { value: "slotted", label: { en: "Slotted", pt: "Ranhurado" } },
2378
+ { value: "bridge_slot", label: { en: "Bridge slot", pt: "Tipo ponte" } },
2379
+ { value: "louver", label: { en: "Louver", pt: "Veneziana" } },
2380
+ { value: "perforated", label: { en: "Perforated", pt: "Perfurado" } },
2381
+ { value: "nold", label: { en: "Nold type", pt: "Tipo Nold" } }
2382
+ ];
2383
+ var CENTRALIZER_TYPES = [
2384
+ { value: "spring_bow", label: { en: "Spring bow", pt: "Mola (spring bow)" } },
2385
+ { value: "rigid", label: { en: "Rigid", pt: "R\xEDgido" } },
2386
+ { value: "semi_rigid", label: { en: "Semi-rigid", pt: "Semirr\xEDgido" } },
2387
+ { value: "polymer", label: { en: "Polymer", pt: "Polim\xE9rico" } },
2388
+ { value: "carbon_steel", label: { en: "Carbon steel", pt: "A\xE7o carbono" } },
2389
+ {
2390
+ value: "galvanized_steel",
2391
+ label: { en: "Galvanized steel", pt: "A\xE7o galvanizado" }
2392
+ },
2393
+ {
2394
+ value: "stainless_steel",
2395
+ label: { en: "Stainless steel", pt: "A\xE7o inox" }
2396
+ }
2397
+ ];
2398
+ var CEMENT_PAD_TYPES = [
2399
+ { value: "concrete", label: { en: "Concrete", pt: "Concreto" } },
2400
+ {
2401
+ value: "reinforced_concrete",
2402
+ label: { en: "Reinforced concrete", pt: "Concreto armado" }
2403
+ },
2404
+ { value: "cement", label: { en: "Cement", pt: "Cimento" } },
2405
+ { value: "mortar", label: { en: "Mortar", pt: "Argamassa" } }
2406
+ ];
2407
+
2408
+ // src/vocab/general.vocab.ts
2409
+ var WELL_TYPES = [
2410
+ { value: "tubular", label: { en: "Tubular", pt: "Tubular" } },
2411
+ {
2412
+ value: "hand_dug",
2413
+ label: { en: "Hand dug", pt: "Cacimba / po\xE7o escavado" }
2414
+ },
2415
+ { value: "horizontal", label: { en: "Horizontal", pt: "Horizontal" } },
2416
+ {
2417
+ value: "infiltration_gallery",
2418
+ label: { en: "Infiltration gallery", pt: "Galeria de infiltra\xE7\xE3o" }
2419
+ },
2420
+ {
2421
+ value: "artesian",
2422
+ label: { en: "Artesian (deprecated)", pt: "Artesiano (obsoleto)" },
2423
+ deprecated: true
2424
+ }
2425
+ ];
2426
+ var WELL_PURPOSES = [
2427
+ {
2428
+ value: "production",
2429
+ label: { en: "Production", pt: "Produ\xE7\xE3o / capta\xE7\xE3o" }
2430
+ },
2431
+ {
2432
+ value: "monitoring",
2433
+ label: { en: "Monitoring well", pt: "Po\xE7o de monitoramento" }
2434
+ },
2435
+ { value: "piezometer", label: { en: "Piezometer", pt: "Piez\xF4metro" } },
2436
+ {
2437
+ value: "water_level_indicator",
2438
+ label: {
2439
+ en: "Water level indicator",
2440
+ pt: "INA \u2014 indicador de n\xEDvel d'\xE1gua"
2441
+ }
2442
+ },
2443
+ {
2444
+ value: "observation",
2445
+ label: { en: "Observation well", pt: "Po\xE7o de observa\xE7\xE3o" }
2446
+ },
2447
+ {
2448
+ value: "exploration",
2449
+ label: { en: "Exploration", pt: "Pesquisa / explorat\xF3rio" }
2450
+ },
2451
+ {
2452
+ value: "injection",
2453
+ label: { en: "Injection / recharge", pt: "Inje\xE7\xE3o / recarga" }
2454
+ },
2455
+ { value: "dewatering", label: { en: "Dewatering", pt: "Rebaixamento" } }
2456
+ ];
2457
+
2458
+ // src/vocab/history.vocab.ts
2459
+ var HISTORY_LOG_CATEGORIES = [
2460
+ { value: "maintenance", label: { en: "Maintenance", pt: "Manuten\xE7\xE3o" } },
2461
+ { value: "inspection", label: { en: "Inspection", pt: "Inspe\xE7\xE3o" } },
2462
+ { value: "incident", label: { en: "Incident", pt: "Incidente" } },
2463
+ { value: "event", label: { en: "Event", pt: "Evento" } },
2464
+ {
2465
+ value: "status_change",
2466
+ label: { en: "Status change", pt: "Mudan\xE7a de situa\xE7\xE3o" }
2467
+ }
2468
+ ];
2469
+ var HISTORY_LOG_SEVERITIES = [
2470
+ { value: "low", label: { en: "Low", pt: "Baixa" } },
2471
+ { value: "medium", label: { en: "Medium", pt: "M\xE9dia" } },
2472
+ { value: "high", label: { en: "High", pt: "Alta" } },
2473
+ { value: "critical", label: { en: "Critical", pt: "Cr\xEDtica" } }
2474
+ ];
2475
+
2476
+ // src/vocab/hydrodynamic.vocab.ts
2477
+ var HYDRODYNAMIC_EVENT_TYPES = [
2478
+ {
2479
+ value: "spot_measurement",
2480
+ label: { en: "Spot measurement", pt: "Medi\xE7\xE3o pontual" }
2481
+ },
2482
+ {
2483
+ value: "constant_rate",
2484
+ label: { en: "Constant rate", pt: "Vaz\xE3o constante" }
2485
+ },
2486
+ { value: "step_drawdown", label: { en: "Step drawdown", pt: "Escalonada" } },
2487
+ { value: "airlift", label: { en: "Air-lift", pt: "Air-lift" } },
2488
+ {
2489
+ value: "recovery_only",
2490
+ label: { en: "Recovery only", pt: "Recupera\xE7\xE3o" }
2491
+ }
2492
+ ];
2493
+ var MEASUREMENT_METHODS = [
2494
+ {
2495
+ value: "electric_probe",
2496
+ label: { en: "Electric probe", pt: "Sonda el\xE9trica" }
2497
+ },
2498
+ {
2499
+ value: "pressure_transducer",
2500
+ label: { en: "Pressure transducer", pt: "Transdutor de press\xE3o" }
2501
+ },
2502
+ { value: "air_line", label: { en: "Air line", pt: "Linha de ar" } },
2503
+ { value: "tape", label: { en: "Tape", pt: "Trena" } }
2504
+ ];
2505
+ var AQUIFER_ANALYSIS_METHODS = [
2506
+ { value: "cooper_jacob", label: { en: "Cooper-Jacob", pt: "Cooper-Jacob" } },
2507
+ { value: "theis", label: { en: "Theis", pt: "Theis" } },
2508
+ { value: "neuman", label: { en: "Neuman", pt: "Neuman" } },
2509
+ { value: "hantush", label: { en: "Hantush", pt: "Hantush" } },
2510
+ {
2511
+ value: "birsoy_summers",
2512
+ label: { en: "Birsoy-Summers", pt: "Birsoy-Summers" }
2513
+ },
2514
+ { value: "eden_hazel", label: { en: "Eden-Hazel", pt: "Eden-Hazel" } },
2515
+ {
2516
+ value: "visual_inspection",
2517
+ label: { en: "Visual inspection", pt: "Inspe\xE7\xE3o visual" }
2518
+ }
2519
+ ];
2520
+
2521
+ // src/vocab/operation.vocab.ts
2522
+ var PUMP_TYPES = [
2523
+ {
2524
+ value: "submersible",
2525
+ label: { en: "Submersible pump", pt: "Bomba submersa" }
2526
+ },
2527
+ {
2528
+ value: "vertical_turbine",
2529
+ label: { en: "Vertical turbine pump", pt: "Bomba de eixo vertical" }
2530
+ },
2531
+ { value: "jet", label: { en: "Jet pump", pt: "Bomba injetora" } },
2532
+ {
2533
+ value: "progressive_cavity",
2534
+ label: { en: "Progressive cavity pump", pt: "Bomba helicoidal" }
2535
+ },
2536
+ { value: "hand_pump", label: { en: "Hand pump", pt: "Bomba manual" } },
2537
+ {
2538
+ value: "compressor_airlift",
2539
+ label: { en: "Compressor (air-lift)", pt: "Compressor (air-lift)" }
2540
+ }
2541
+ ];
2542
+ var POWER_SOURCES = [
2543
+ { value: "grid", label: { en: "Grid", pt: "Rede el\xE9trica" } },
2544
+ { value: "solar", label: { en: "Solar", pt: "Solar" } },
2545
+ { value: "diesel", label: { en: "Diesel", pt: "Diesel" } },
2546
+ { value: "hybrid", label: { en: "Hybrid", pt: "H\xEDbrido" } }
2547
+ ];
2548
+ var METER_TYPES = [
2549
+ { value: "mechanical", label: { en: "Mechanical", pt: "Mec\xE2nico" } },
2550
+ {
2551
+ value: "electromagnetic",
2552
+ label: { en: "Electromagnetic", pt: "Eletromagn\xE9tico" }
2553
+ },
2554
+ { value: "ultrasonic", label: { en: "Ultrasonic", pt: "Ultrass\xF4nico" } }
2555
+ ];
2556
+ var READING_SOURCES = [
2557
+ { value: "manual", label: { en: "Manual", pt: "Manual" } },
2558
+ { value: "telemetry", label: { en: "Telemetry", pt: "Telemetria" } }
2559
+ ];
2560
+ var ESTIMATION_METHODS = [
2561
+ {
2562
+ value: "flow_time",
2563
+ label: { en: "Flow \xD7 operating time", pt: "Vaz\xE3o \xD7 tempo de opera\xE7\xE3o" }
2564
+ },
2565
+ {
2566
+ value: "energy",
2567
+ label: { en: "Energy consumption", pt: "Consumo de energia" }
2568
+ },
2569
+ {
2570
+ value: "user_statement",
2571
+ label: { en: "User statement", pt: "Informado pelo usu\xE1rio" }
2572
+ }
2573
+ ];
2574
+ var MAINTENANCE_TYPES = [
2575
+ { value: "inspection", label: { en: "Inspection", pt: "Inspe\xE7\xE3o" } },
2576
+ { value: "cleaning", label: { en: "Cleaning", pt: "Limpeza" } },
2577
+ {
2578
+ value: "redevelopment",
2579
+ label: { en: "Redevelopment", pt: "Redesenvolvimento" }
2580
+ },
2581
+ { value: "disinfection", label: { en: "Disinfection", pt: "Desinfec\xE7\xE3o" } },
2582
+ {
2583
+ value: "pump_service",
2584
+ label: { en: "Pump service", pt: "Manuten\xE7\xE3o da bomba" }
2585
+ },
2586
+ {
2587
+ value: "meter_calibration",
2588
+ label: { en: "Meter calibration", pt: "Aferi\xE7\xE3o do hidr\xF4metro" }
2589
+ },
2590
+ {
2591
+ value: "video_inspection",
2592
+ label: {
2593
+ en: "Video inspection / optical logging",
2594
+ pt: "Filmagem / perfilagem \xF3tica"
2595
+ }
2596
+ },
2597
+ {
2598
+ value: "level_measurement",
2599
+ label: { en: "Level measurement", pt: "Medi\xE7\xE3o de n\xEDvel" }
2600
+ },
2601
+ {
2602
+ value: "pump_test",
2603
+ label: { en: "Pumping test", pt: "Teste de bombeamento" }
2604
+ },
2605
+ {
2606
+ value: "water_sampling",
2607
+ label: { en: "Water sampling", pt: "Coleta de \xE1gua" }
2608
+ }
2609
+ ];
2610
+
2611
+ // src/vocab/permit.vocab.ts
2612
+ var PERMIT_TYPES = [
2613
+ {
2614
+ value: "abstraction_permit",
2615
+ label: { en: "Abstraction permit", pt: "Outorga de direito de uso" }
2616
+ },
2617
+ {
2618
+ value: "preliminary_permit",
2619
+ label: { en: "Preliminary permit", pt: "Outorga pr\xE9via" }
2620
+ },
2621
+ {
2622
+ value: "exemption",
2623
+ label: { en: "Exemption", pt: "Dispensa / uso insignificante" }
2624
+ },
2625
+ { value: "registration", label: { en: "Registration", pt: "Cadastro" } },
2626
+ {
2627
+ value: "dewatering_permit",
2628
+ label: { en: "Dewatering permit", pt: "Outorga para rebaixamento" }
2629
+ },
2630
+ {
2631
+ value: "drilling_permit",
2632
+ label: { en: "Drilling permit", pt: "Autoriza\xE7\xE3o de perfura\xE7\xE3o" }
2633
+ }
2634
+ ];
2635
+ var WATER_USES = [
2636
+ {
2637
+ value: "human_supply",
2638
+ label: { en: "Human supply", pt: "Abastecimento humano" }
2639
+ },
2640
+ { value: "industrial", label: { en: "Industrial", pt: "Industrial" } },
2641
+ { value: "mining", label: { en: "Mining", pt: "Minera\xE7\xE3o" } },
2642
+ { value: "irrigation", label: { en: "Irrigation", pt: "Irriga\xE7\xE3o" } },
2643
+ {
2644
+ value: "livestock",
2645
+ label: { en: "Livestock", pt: "Dessedenta\xE7\xE3o animal" }
2646
+ },
2647
+ {
2648
+ value: "commercial",
2649
+ label: { en: "Commercial", pt: "Comercial / servi\xE7os" }
2650
+ }
2651
+ ];
2652
+ var CONDITION_CATEGORIES = [
2653
+ {
2654
+ value: "monitoring",
2655
+ label: { en: "Monitoring", pt: "Monitoramento" },
2656
+ description: {
2657
+ en: "Water level, flow, abstracted volume and water quality monitoring/sampling",
2658
+ pt: "Monitoramento/amostragem de n\xEDvel, vaz\xE3o, volume captado e qualidade da \xE1gua"
2659
+ }
2660
+ },
2661
+ {
2662
+ value: "reporting",
2663
+ label: { en: "Reporting", pt: "Relat\xF3rios e declara\xE7\xF5es" },
2664
+ description: {
2665
+ en: "Periodic reports and volume/flow declarations submitted to the authority",
2666
+ pt: "Relat\xF3rios peri\xF3dicos e declara\xE7\xF5es de volume/vaz\xE3o entregues ao \xF3rg\xE3o"
2667
+ }
2668
+ },
2669
+ {
2670
+ value: "equipment_installation",
2671
+ label: { en: "Equipment installation", pt: "Instala\xE7\xE3o de equipamentos" },
2672
+ description: {
2673
+ en: "Meters (hidr\xF4metro), level gauges, sampling taps, telemetry",
2674
+ pt: "Hidr\xF4metro, medidor de n\xEDvel, torneira de amostragem, telemetria"
2675
+ }
2676
+ },
2677
+ {
2678
+ value: "well_protection",
2679
+ label: { en: "Well protection", pt: "Prote\xE7\xE3o do po\xE7o" },
2680
+ description: {
2681
+ en: "Sanitary slab, seal, protection perimeter, wellhead closure",
2682
+ pt: "Laje de prote\xE7\xE3o, selo sanit\xE1rio, per\xEDmetro de prote\xE7\xE3o, tampa do po\xE7o"
2683
+ }
2684
+ },
2685
+ {
2686
+ value: "environmental",
2687
+ label: { en: "Environmental", pt: "Ambiental" },
2688
+ description: {
2689
+ en: "Environmental measures, compensation, licensing of the activity",
2690
+ pt: "Medidas ambientais, compensa\xE7\xE3o, licenciamento da atividade"
2691
+ }
2692
+ },
2693
+ {
2694
+ value: "legal",
2695
+ label: { en: "Legal / administrative", pt: "Legal / administrativo" },
2696
+ description: {
2697
+ en: "Renewal request, fees, registrations, document submissions",
2698
+ pt: "Pedido de renova\xE7\xE3o, taxas, cadastros, entrega de documentos"
2699
+ }
2700
+ }
2701
+ ];
2702
+ var PERMIT_HISTORY_TYPES = [
2703
+ { value: "filing", label: { en: "Filing", pt: "Protocolo" } },
2704
+ { value: "process", label: { en: "Process", pt: "Andamento" } },
2705
+ { value: "notification", label: { en: "Notification", pt: "Notifica\xE7\xE3o" } },
2706
+ { value: "fee", label: { en: "Fee", pt: "Taxa" } },
2707
+ { value: "inspection", label: { en: "Inspection", pt: "Vistoria" } },
2708
+ { value: "decision", label: { en: "Decision", pt: "Decis\xE3o" } },
2709
+ { value: "renewal", label: { en: "Renewal", pt: "Renova\xE7\xE3o" } }
2710
+ ];
2711
+
2712
+ // src/vocab/vocab.ts
2713
+ function getVocabEntry(vocab, value) {
2714
+ if (value === void 0) return void 0;
2715
+ return vocab.find((entry) => entry.value === value);
2716
+ }
2717
+ function isVocabValue(vocab, value) {
2718
+ return getVocabEntry(vocab, value) !== void 0;
2719
+ }
2720
+ function getVocabLabel(vocab, value, locale) {
2721
+ const entry = getVocabEntry(vocab, value);
2722
+ return entry ? resolveLanguageText(entry.label, locale) : value;
2723
+ }
2724
+ function formatVocabList(vocab, values, locale) {
2725
+ return (values ?? []).map((v) => getVocabLabel(vocab, v, locale)).join(", ");
2726
+ }
2727
+ function vocabValues(vocab, { includeDeprecated = false } = {}) {
2728
+ return vocab.filter((entry) => includeDeprecated || !entry.deprecated).map((entry) => entry.value);
2729
+ }
2730
+
2731
+ // src/vocab/closed.vocab.ts
2732
+ function closedVocab() {
2733
+ return (entries) => entries;
2734
+ }
2735
+ var valuesOf = (vocab) => vocab.map((entry) => entry.value);
2736
+ var WELL_STATUSES = closedVocab()([
2737
+ { value: "active", label: { en: "Active", pt: "Ativo" } },
2738
+ {
2739
+ value: "maintenance",
2740
+ label: { en: "Under maintenance", pt: "Em manuten\xE7\xE3o" }
2741
+ },
2742
+ { value: "inactive", label: { en: "Inactive", pt: "Paralisado" } },
2743
+ {
2744
+ value: "decommissioned",
2745
+ label: { en: "Decommissioned", pt: "Desativado" }
2746
+ },
2747
+ { value: "abandoned", label: { en: "Abandoned", pt: "Abandonado" } }
2748
+ ]);
2749
+ var PERMIT_ADMINISTRATIVE_STATUSES = closedVocab()([
2750
+ { value: "requested", label: { en: "Requested", pt: "Requerida" } },
2751
+ { value: "granted", label: { en: "Granted", pt: "Concedida" } },
2752
+ { value: "suspended", label: { en: "Suspended", pt: "Suspensa" } },
2753
+ { value: "revoked", label: { en: "Revoked", pt: "Revogada" } },
2754
+ { value: "denied", label: { en: "Denied", pt: "Indeferida" } },
2755
+ { value: "withdrawn", label: { en: "Withdrawn", pt: "Cancelada" } }
2756
+ ]);
2757
+ var VOLUME_LIMIT_PERIODS = closedVocab()([
2758
+ { value: "daily", label: { en: "Daily", pt: "Di\xE1rio" } },
2759
+ { value: "monthly", label: { en: "Monthly", pt: "Mensal" } },
2760
+ { value: "annual", label: { en: "Annual", pt: "Anual" } }
2761
+ ]);
2762
+ var PRODUCTION_ENTRY_TYPES = closedVocab()([
2763
+ {
2764
+ value: "meter_reading",
2765
+ label: { en: "Meter reading", pt: "Leitura de hidr\xF4metro" }
2766
+ },
2767
+ {
2768
+ value: "estimated_volume",
2769
+ label: { en: "Estimated volume", pt: "Volume estimado" }
2770
+ }
2771
+ ]);
2772
+ var RESULT_QUALIFIERS = closedVocab()([
2773
+ { value: "<", label: { en: "< less than", pt: "< menor que" } },
2774
+ { value: ">", label: { en: "> greater than", pt: "> maior que" } },
2775
+ { value: "not_detected", label: { en: "Not detected", pt: "N\xE3o detectado" } },
2776
+ { value: "estimated", label: { en: "Estimated", pt: "Estimado" } }
2777
+ ]);
2778
+ var RESULT_FRACTIONS = closedVocab()([
2779
+ { value: "total", label: { en: "Total", pt: "Total" } },
2780
+ { value: "dissolved", label: { en: "Dissolved", pt: "Dissolvida" } },
2781
+ { value: "suspended", label: { en: "Suspended", pt: "Suspensa" } }
2782
+ ]);
2783
+ var MEASUREMENT_LOCATIONS = closedVocab()([
2784
+ { value: "field", label: { en: "Field", pt: "Campo" } },
2785
+ { value: "lab", label: { en: "Lab", pt: "Laborat\xF3rio" } }
2786
+ ]);
2787
+ var VALIDATION_STATUSES = closedVocab()([
2788
+ { value: "unvalidated", label: { en: "Unvalidated", pt: "N\xE3o validado" } },
2789
+ { value: "validated", label: { en: "Validated", pt: "Validado" } },
2790
+ { value: "qualified", label: { en: "Qualified", pt: "Qualificado" } },
2791
+ { value: "rejected", label: { en: "Rejected", pt: "Rejeitado" } }
2792
+ ]);
2793
+ var PARAMETER_GROUPS = closedVocab()([
2794
+ {
2795
+ value: "physical",
2796
+ label: { en: "Physical / field", pt: "F\xEDsico / campo" }
2797
+ },
2798
+ { value: "aggregate", label: { en: "Aggregate", pt: "Agregados" } },
2799
+ { value: "major_ion", label: { en: "Major ions", pt: "\xCDons maiores" } },
2800
+ { value: "nutrient", label: { en: "Nutrients", pt: "Nutrientes" } },
2801
+ { value: "organic", label: { en: "Organic", pt: "Org\xE2nicos" } },
2802
+ { value: "disinfection", label: { en: "Disinfection", pt: "Desinfec\xE7\xE3o" } },
2803
+ {
2804
+ value: "mining_redox",
2805
+ label: { en: "Mining and redox", pt: "Minera\xE7\xE3o e redox" }
2806
+ },
2807
+ { value: "metal", label: { en: "Metals / trace", pt: "Metais / tra\xE7o" } },
2808
+ { value: "microbiology", label: { en: "Microbiology", pt: "Microbiologia" } },
2809
+ {
2810
+ value: "radioactivity",
2811
+ label: { en: "Radioactivity", pt: "Radioatividade" }
2812
+ }
2813
+ ]);
2814
+ var WELL_STATUS_VALUES = valuesOf(WELL_STATUSES);
2815
+ var PERMIT_ADMINISTRATIVE_STATUS_VALUES = valuesOf(
2816
+ PERMIT_ADMINISTRATIVE_STATUSES
2817
+ );
2818
+ var QUALIFIER_VALUES = valuesOf(RESULT_QUALIFIERS);
2819
+ var FRACTION_VALUES = valuesOf(RESULT_FRACTIONS);
2820
+ var MEASURED_IN_VALUES = valuesOf(MEASUREMENT_LOCATIONS);
2821
+ var FILTRATION_LOCATION_VALUES = valuesOf(MEASUREMENT_LOCATIONS);
2822
+ var VALIDATION_STATUS_VALUES = valuesOf(VALIDATION_STATUSES);
2823
+ var PARAMETER_GROUP_VALUES = valuesOf(PARAMETER_GROUPS);
2824
+ var NUMERIC_QUALIFIERS = [
2825
+ "<",
2826
+ ">",
2827
+ "estimated"
2828
+ ];
2829
+ var PARENT_SAMPLE_TYPES = [
2830
+ "field_duplicate",
2831
+ "split_sample"
2832
+ ];
2833
+ var BLANK_SAMPLE_TYPES = [
2834
+ "field_blank",
2835
+ "trip_blank",
2836
+ "equipment_blank"
2837
+ ];
2838
+
2839
+ // src/vocab/waterSample.vocab.ts
2840
+ var SAMPLE_TYPES = [
2841
+ { value: "routine", label: { en: "Routine", pt: "Rotina" } },
2842
+ {
2843
+ value: "field_duplicate",
2844
+ label: { en: "Field duplicate", pt: "Duplicata de campo" }
2845
+ },
2846
+ {
2847
+ value: "split_sample",
2848
+ label: { en: "Split sample", pt: "Amostra dividida (split)" }
2849
+ },
2850
+ { value: "field_blank", label: { en: "Field blank", pt: "Branco de campo" } },
2851
+ {
2852
+ value: "trip_blank",
2853
+ label: { en: "Trip blank", pt: "Branco de transporte" }
2854
+ },
2855
+ {
2856
+ value: "equipment_blank",
2857
+ label: { en: "Equipment blank", pt: "Branco de equipamento" }
2858
+ }
2859
+ ];
2860
+ var SAMPLING_METHODS = [
2861
+ {
2862
+ value: "low_flow",
2863
+ label: { en: "Low flow", pt: "Purga de baixa vaz\xE3o (micropurga)" }
2864
+ },
2865
+ {
2866
+ value: "volumetric_purge",
2867
+ label: { en: "Volumetric purge", pt: "Purga de volume determinado" }
2868
+ },
2869
+ { value: "no_purge", label: { en: "No purge", pt: "Amostragem sem purga" } },
2870
+ {
2871
+ value: "pump_discharge",
2872
+ label: { en: "Pump discharge", pt: "Bomba de produ\xE7\xE3o em opera\xE7\xE3o" }
2873
+ }
2874
+ ];
2875
+ var SAMPLING_POINT_TYPES = [
2876
+ {
2877
+ value: "pump_discharge",
2878
+ label: { en: "Pump discharge", pt: "Sa\xEDda da bomba de produ\xE7\xE3o" }
2879
+ },
2880
+ {
2881
+ value: "wellhead_tap",
2882
+ label: { en: "Wellhead tap", pt: "Torneira do cavalete" }
2883
+ },
2884
+ { value: "in_well", label: { en: "In well", pt: "Dentro do po\xE7o" } }
2885
+ ];
2886
+ var SAMPLING_DEVICES = [
2887
+ {
2888
+ value: "bailer",
2889
+ label: { en: "Bailer", pt: "Bailer (amostrador de reten\xE7\xE3o)" }
2890
+ },
2891
+ {
2892
+ value: "discrete_depth_sampler",
2893
+ label: {
2894
+ en: "Discrete depth sampler",
2895
+ pt: "Amostrador pontual de profundidade"
2896
+ }
2897
+ },
2898
+ {
2899
+ value: "passive_diffusion_bag",
2900
+ label: { en: "Passive diffusion bag", pt: "Bolsa de difus\xE3o passiva" }
2901
+ },
2902
+ {
2903
+ value: "grab_sleeve",
2904
+ label: {
2905
+ en: "Grab sleeve (HydraSleeve)",
2906
+ pt: "Amostrador passivo tipo luva (HydraSleeve)"
2907
+ }
2908
+ },
2909
+ {
2910
+ value: "low_flow_pump",
2911
+ label: { en: "Low-flow pump", pt: "Bomba de baixa vaz\xE3o" }
2912
+ },
2913
+ {
2914
+ value: "packer_pump",
2915
+ label: { en: "Packer pump", pt: "Bomba com obturador (packer)" }
2916
+ }
2917
+ ];
2918
+
972
2919
  // src/utils/units.ts
973
2920
  var FEET_PER_METER = 3.280839895;
974
2921
  var METERS_PER_FOOT = 0.3048;
@@ -978,6 +2925,11 @@ var M3H_TO_USGPM = 4.402867361;
978
2925
  var M2S_TO_M2D = 86400;
979
2926
  var PSI_PER_KPA = 0.145037738;
980
2927
  var SLOT_MM = 0.0254;
2928
+ var KW_PER_CV = 0.73549875;
2929
+ var KW_PER_HP = 0.745699872;
2930
+ var LITERS_PER_M3 = 1e3;
2931
+ var FT3_PER_M3 = 35.314666721;
2932
+ var USGAL_PER_M3 = 264.172052358;
981
2933
  function metersToFeet(m) {
982
2934
  return m * FEET_PER_METER;
983
2935
  }
@@ -1002,6 +2954,68 @@ function cubicMeterPerHourToUsGallonsPerMinute(q) {
1002
2954
  function usGallonsPerMinuteToCubicMeterPerHour(q) {
1003
2955
  return q / M3H_TO_USGPM;
1004
2956
  }
2957
+ function litersToCubicMeters(l) {
2958
+ return l / LITERS_PER_M3;
2959
+ }
2960
+ function cubicMetersToLiters(m3) {
2961
+ return m3 * LITERS_PER_M3;
2962
+ }
2963
+ function cubicMetersToCubicFeet(m3) {
2964
+ return m3 * FT3_PER_M3;
2965
+ }
2966
+ function cubicFeetToCubicMeters(ft3) {
2967
+ return ft3 / FT3_PER_M3;
2968
+ }
2969
+ function cubicMetersToUsGallons(m3) {
2970
+ return m3 * USGAL_PER_M3;
2971
+ }
2972
+ function usGallonsToCubicMeters(gal) {
2973
+ return gal / USGAL_PER_M3;
2974
+ }
2975
+ function cvToKilowatts(cv) {
2976
+ return cv * KW_PER_CV;
2977
+ }
2978
+ function kilowattsToCv(kw) {
2979
+ return kw / KW_PER_CV;
2980
+ }
2981
+ function hpToKilowatts(hp) {
2982
+ return hp * KW_PER_HP;
2983
+ }
2984
+ function kilowattsToHp(kw) {
2985
+ return kw / KW_PER_HP;
2986
+ }
2987
+ function flowFromCanonical(m3h, unit) {
2988
+ if (unit === "L/s") return cubicMeterPerHourToLitersPerSecond(m3h);
2989
+ if (unit === "gpm") return cubicMeterPerHourToUsGallonsPerMinute(m3h);
2990
+ return m3h;
2991
+ }
2992
+ function flowToCanonical(value, unit) {
2993
+ if (unit === "L/s") return litersPerSecondToCubicMeterPerHour(value);
2994
+ if (unit === "gpm") return usGallonsPerMinuteToCubicMeterPerHour(value);
2995
+ return value;
2996
+ }
2997
+ function powerFromCanonical(kw, unit) {
2998
+ if (unit === "cv") return kilowattsToCv(kw);
2999
+ if (unit === "hp") return kilowattsToHp(kw);
3000
+ return kw;
3001
+ }
3002
+ function powerToCanonical(value, unit) {
3003
+ if (unit === "cv") return cvToKilowatts(value);
3004
+ if (unit === "hp") return hpToKilowatts(value);
3005
+ return value;
3006
+ }
3007
+ function volumeFromCanonical(m3, unit) {
3008
+ if (unit === "L") return cubicMetersToLiters(m3);
3009
+ if (unit === "ft3") return cubicMetersToCubicFeet(m3);
3010
+ if (unit === "gal") return cubicMetersToUsGallons(m3);
3011
+ return m3;
3012
+ }
3013
+ function volumeToCanonical(value, unit) {
3014
+ if (unit === "L") return litersToCubicMeters(value);
3015
+ if (unit === "ft3") return cubicFeetToCubicMeters(value);
3016
+ if (unit === "gal") return usGallonsToCubicMeters(value);
3017
+ return value;
3018
+ }
1005
3019
  function squareMeterPerSecondToSquareMeterPerDay(t) {
1006
3020
  return t * M2S_TO_M2D;
1007
3021
  }
@@ -1039,63 +3053,226 @@ function minutesToHours(min) {
1039
3053
  function hoursToMinutes(h) {
1040
3054
  return h * 60;
1041
3055
  }
3056
+ var MG_L_PER_UNIT = {
3057
+ "g/L": 1e3,
3058
+ "mg/L": 1,
3059
+ "ug/L": 1e-3,
3060
+ "ng/L": 1e-6
3061
+ };
3062
+ function concentrationToCanonical(value, unit) {
3063
+ return value * MG_L_PER_UNIT[unit];
3064
+ }
3065
+ function concentrationFromCanonical(mgL, unit) {
3066
+ return mgL / MG_L_PER_UNIT[unit];
3067
+ }
3068
+ function milliSiemensPerMeterToMicroSiemensPerCm(mSm) {
3069
+ return mSm * 10;
3070
+ }
3071
+ function milliSiemensPerCmToMicroSiemensPerCm(mScm) {
3072
+ return mScm * 1e3;
3073
+ }
3074
+ function normalizeColorUnit(unit) {
3075
+ const u = unit.trim().toLowerCase().replace(/\s+/g, "");
3076
+ return ["uh", "hazen", "mgpt-co/l", "mgpt/l", "pt-co", "pcu", "tcu"].includes(
3077
+ u
3078
+ ) ? "uH" : void 0;
3079
+ }
3080
+ function turbidityCodeForUnit(unit) {
3081
+ switch (unit.trim().toUpperCase()) {
3082
+ case "NTU":
3083
+ return "turbidity_ntu";
3084
+ case "FNU":
3085
+ return "turbidity_fnu";
3086
+ case "FAU":
3087
+ return "turbidity_fau";
3088
+ case "FTU":
3089
+ case "UT":
3090
+ return "turbidity";
3091
+ default:
3092
+ return void 0;
3093
+ }
3094
+ }
3095
+ function expandedToStandardUncertainty(expanded, coverageFactor = 2) {
3096
+ return expanded / coverageFactor;
3097
+ }
1042
3098
  export {
3099
+ AQUIFER_ANALYSIS_METHODS,
1043
3100
  AirliftEventSchema,
1044
3101
  AquiferAnalysisSchema,
1045
3102
  AttachmentSchema,
3103
+ BLANK_SAMPLE_TYPES,
3104
+ BR_GM_MS_888_2021,
1046
3105
  BoreHoleSchema,
3106
+ CEMENT_PAD_TYPES,
3107
+ CENTRALIZER_TYPES,
3108
+ CONDITION_CATEGORIES,
3109
+ CONSTRUCTION_MATERIALS,
1047
3110
  CaveSchema,
1048
3111
  CementPadSchema,
1049
3112
  CentralizerSchema,
3113
+ ConditionFulfillmentSchema,
1050
3114
  ConstantRateEventSchema,
3115
+ DOCUMENT_TYPES,
3116
+ DOCUMENT_TYPE_SUGGESTIONS,
3117
+ DRILLING_METHODS,
3118
+ ESTIMATION_METHODS,
3119
+ EU_2020_2184,
3120
+ EstimatedVolumeSchema,
1051
3121
  FGDC_TEXTURES_OPTIONS,
3122
+ FILTRATION_LOCATION_VALUES,
3123
+ FRACTION_VALUES,
3124
+ FiltrationSchema,
1052
3125
  FractureSchema,
3126
+ HISTORY_LOG_CATEGORIES,
3127
+ HISTORY_LOG_SEVERITIES,
3128
+ HYDRODYNAMIC_EVENT_TYPES,
1053
3129
  HistoryLogEntrySchema,
1054
3130
  HoleFillSchema,
1055
3131
  HydrodynamicEventBaseSchema,
1056
3132
  HydrodynamicEventSchema,
3133
+ LaboratorySchema,
1057
3134
  LevelReadingSchema,
1058
3135
  LithologySchema,
1059
3136
  LocationPropertiesSchema,
1060
3137
  LocationSchema,
3138
+ MAINTENANCE_TYPES,
3139
+ MEASURED_IN_VALUES,
3140
+ MEASUREMENT_LOCATIONS,
3141
+ MEASUREMENT_METHODS,
3142
+ METER_TYPES,
3143
+ MeterReadingSchema,
3144
+ MeterSchema,
3145
+ MonthlyGrantSchema,
3146
+ NEPHELOMETRIC_TURBIDITY_CODES,
3147
+ NUMERIC_QUALIFIERS,
3148
+ OperatingRegimeSchema,
3149
+ PARAMETER_GROUPS,
3150
+ PARAMETER_GROUP_VALUES,
3151
+ PARENT_SAMPLE_TYPES,
3152
+ PERMIT_ADMINISTRATIVE_STATUSES,
3153
+ PERMIT_ADMINISTRATIVE_STATUS_VALUES,
3154
+ PERMIT_HISTORY_TYPES,
3155
+ PERMIT_TYPES,
3156
+ POWER_SOURCES,
3157
+ PRODUCTION_ENTRY_TYPES,
3158
+ PUMP_TYPES,
3159
+ ParameterSchema,
3160
+ PermitAdministrativeStatusSchema,
3161
+ PermitConditionSchema,
3162
+ PermitHistoryEntrySchema,
3163
+ PermitSchema,
3164
+ ProductionEntryBaseSchema,
3165
+ ProductionEntrySchema,
3166
+ PumpElectricalSchema,
3167
+ PumpInstallationSchema,
1061
3168
  PumpingStepSchema,
3169
+ PurgeReadingSchema,
3170
+ PurgeSchema,
3171
+ QUALIFIER_VALUES,
3172
+ READING_SOURCES,
3173
+ RESULT_FRACTIONS,
3174
+ RESULT_QUALIFIERS,
1062
3175
  RecoveryOnlyEventSchema,
1063
3176
  RecoveryPhaseSchema,
1064
3177
  ReductionSchema,
3178
+ ResultQualifierSchema,
3179
+ ResultValidationSchema,
3180
+ SAMPLE_TYPES,
3181
+ SAMPLING_DEVICES,
3182
+ SAMPLING_METHODS,
3183
+ SAMPLING_POINT_TYPES,
3184
+ SCREEN_SLOT_TYPES,
1065
3185
  SECTION_KEYS,
3186
+ SamplingPointSchema,
1066
3187
  SpotMeasurementEventSchema,
1067
3188
  StepDrawdownEventSchema,
1068
3189
  SurfaceCaseSchema,
1069
3190
  TextureSchema,
3191
+ TimeResolutionSchema,
3192
+ VALIDATION_STATUSES,
3193
+ VALIDATION_STATUS_VALUES,
3194
+ VISIBILITY_LEAF_KEYS,
3195
+ VISIBILITY_TREE,
3196
+ VOLUME_LIMIT_PERIODS,
3197
+ VolumeLimitSchema,
3198
+ WATER_QUALITY_LIMIT_SETS,
3199
+ WATER_QUALITY_PARAMETERS,
3200
+ WATER_QUALITY_UNITS,
3201
+ WATER_QUALITY_VOCABULARY_VERSION,
3202
+ WATER_USES,
3203
+ WELL_PURPOSES,
3204
+ WELL_STATUSES,
3205
+ WELL_STATUS_VALUES,
3206
+ WELL_TYPES,
3207
+ WHO_GDWQ_2022,
3208
+ WaterQualityResultSchema,
3209
+ WaterSampleSchema,
1070
3210
  WellCaseSchema,
1071
3211
  WellIdSchema,
1072
3212
  WellSchema,
1073
3213
  WellScreenSchema,
3214
+ WellStatusSchema,
3215
+ calculatedWellDepth,
1074
3216
  checkIfProfileIsEmpty,
3217
+ concentrationFromCanonical,
3218
+ concentrationToCanonical,
1075
3219
  convertProfileFromJSON,
3220
+ cubicFeetToCubicMeters,
1076
3221
  cubicMeterPerHourToLitersPerSecond,
1077
3222
  cubicMeterPerHourToUsGallonsPerMinute,
3223
+ cubicMetersToCubicFeet,
3224
+ cubicMetersToLiters,
3225
+ cubicMetersToUsGallons,
3226
+ cvToKilowatts,
1078
3227
  decimalDegreesToDms,
1079
3228
  deserializeWell,
1080
3229
  dmsToDecimalDegrees,
3230
+ expandedToStandardUncertainty,
1081
3231
  feetToMeters,
3232
+ flowFromCanonical,
3233
+ flowToCanonical,
3234
+ formatVocabList,
3235
+ getLimitSet,
3236
+ getParameterDefinition,
3237
+ getParameterLabel,
3238
+ getVocabEntry,
3239
+ getVocabLabel,
3240
+ hasWellData,
1082
3241
  hoursToMinutes,
3242
+ hpToKilowatts,
1083
3243
  inchesToMm,
3244
+ isKnownParameter,
3245
+ isVocabValue,
1084
3246
  isWellEmpty,
1085
3247
  kilopascalToPsi,
3248
+ kilowattsToCv,
3249
+ kilowattsToHp,
1086
3250
  litersPerSecondToCubicMeterPerHour,
3251
+ litersToCubicMeters,
1087
3252
  metersToFeet,
3253
+ milliSiemensPerCmToMicroSiemensPerCm,
3254
+ milliSiemensPerMeterToMicroSiemensPerCm,
1088
3255
  minutesToHours,
1089
3256
  mmToInches,
1090
3257
  mmToSlotNumber,
3258
+ normalizeColorUnit,
3259
+ parameterKey,
1091
3260
  parseWell,
3261
+ powerFromCanonical,
3262
+ powerToCanonical,
1092
3263
  profileToWell,
1093
3264
  psiToKilopascal,
1094
3265
  redactWell,
3266
+ resolveLanguageText,
1095
3267
  serializeWell,
1096
3268
  slotNumberToMm,
1097
3269
  squareMeterPerDayToSquareMeterPerSecond,
1098
3270
  squareMeterPerSecondToSquareMeterPerDay,
1099
- usGallonsPerMinuteToCubicMeterPerHour
3271
+ turbidityCodeForUnit,
3272
+ usGallonsPerMinuteToCubicMeterPerHour,
3273
+ usGallonsToCubicMeters,
3274
+ vocabValues,
3275
+ volumeFromCanonical,
3276
+ volumeToCanonical
1100
3277
  };
1101
3278
  //# sourceMappingURL=index.js.map