@burdenoff/microfe-theglobalfuel 2026.1107.2 → 2026.1107.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/theglobalfuel/components/AllocateProductionSheet.d.ts.map +1 -1
  2. package/dist/theglobalfuel/components/AllocateProductionSheet.js +304 -180
  3. package/dist/theglobalfuel/components/AllocateProductionSheet.js.map +1 -1
  4. package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts +11 -0
  5. package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts.map +1 -0
  6. package/dist/theglobalfuel/components/AssignEntitlementDialog.js +117 -0
  7. package/dist/theglobalfuel/components/AssignEntitlementDialog.js.map +1 -0
  8. package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts +17 -0
  9. package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts.map +1 -0
  10. package/dist/theglobalfuel/components/ConfirmActionDialog.js +29 -0
  11. package/dist/theglobalfuel/components/ConfirmActionDialog.js.map +1 -0
  12. package/dist/theglobalfuel/components/CorrectAllocationSheet.d.ts +11 -0
  13. package/dist/theglobalfuel/components/CorrectAllocationSheet.d.ts.map +1 -0
  14. package/dist/theglobalfuel/components/CorrectAllocationSheet.js +235 -0
  15. package/dist/theglobalfuel/components/CorrectAllocationSheet.js.map +1 -0
  16. package/dist/theglobalfuel/components/InterestDeckSheet.d.ts +21 -0
  17. package/dist/theglobalfuel/components/InterestDeckSheet.d.ts.map +1 -0
  18. package/dist/theglobalfuel/components/InterestDeckSheet.js +287 -0
  19. package/dist/theglobalfuel/components/InterestDeckSheet.js.map +1 -0
  20. package/dist/theglobalfuel/components/StatusBadge.d.ts.map +1 -1
  21. package/dist/theglobalfuel/components/StatusBadge.js +7 -1
  22. package/dist/theglobalfuel/components/StatusBadge.js.map +1 -1
  23. package/dist/theglobalfuel/components/UnitConversionsDialog.d.ts +18 -0
  24. package/dist/theglobalfuel/components/UnitConversionsDialog.d.ts.map +1 -0
  25. package/dist/theglobalfuel/components/UnitConversionsDialog.js +228 -0
  26. package/dist/theglobalfuel/components/UnitConversionsDialog.js.map +1 -0
  27. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +38 -2
  28. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -1
  29. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +265 -124
  30. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
  31. package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts +8 -1
  32. package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts.map +1 -1
  33. package/dist/theglobalfuel/pages/production/AllocationsPanel.js +288 -174
  34. package/dist/theglobalfuel/pages/production/AllocationsPanel.js.map +1 -1
  35. package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts +14 -0
  36. package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts.map +1 -0
  37. package/dist/theglobalfuel/pages/production/EntitlementsPanel.js +205 -0
  38. package/dist/theglobalfuel/pages/production/EntitlementsPanel.js.map +1 -0
  39. package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts +12 -0
  40. package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts.map +1 -0
  41. package/dist/theglobalfuel/pages/production/InterestDecksPanel.js +243 -0
  42. package/dist/theglobalfuel/pages/production/InterestDecksPanel.js.map +1 -0
  43. package/dist/theglobalfuel/pages/production/NetPositionPanel.d.ts +5 -0
  44. package/dist/theglobalfuel/pages/production/NetPositionPanel.d.ts.map +1 -1
  45. package/dist/theglobalfuel/pages/production/NetPositionPanel.js +174 -96
  46. package/dist/theglobalfuel/pages/production/NetPositionPanel.js.map +1 -1
  47. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +3 -0
  48. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +1 -1
  49. package/dist/theglobalfuel/pages/production/ProductionPage.js +109 -95
  50. package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
  51. package/dist/theglobalfuel/types/index.d.ts +141 -0
  52. package/dist/theglobalfuel/types/index.d.ts.map +1 -1
  53. package/dist/theglobalfuel/utils/allocationForm.d.ts +62 -5
  54. package/dist/theglobalfuel/utils/allocationForm.d.ts.map +1 -1
  55. package/dist/theglobalfuel/utils/allocationForm.js +150 -63
  56. package/dist/theglobalfuel/utils/allocationForm.js.map +1 -1
  57. package/dist/theglobalfuel/utils/correctionForm.d.ts +48 -0
  58. package/dist/theglobalfuel/utils/correctionForm.d.ts.map +1 -0
  59. package/dist/theglobalfuel/utils/correctionForm.js +91 -0
  60. package/dist/theglobalfuel/utils/correctionForm.js.map +1 -0
  61. package/dist/theglobalfuel/utils/interestDeckForm.d.ts +64 -0
  62. package/dist/theglobalfuel/utils/interestDeckForm.d.ts.map +1 -0
  63. package/dist/theglobalfuel/utils/interestDeckForm.js +140 -0
  64. package/dist/theglobalfuel/utils/interestDeckForm.js.map +1 -0
  65. package/dist/theglobalfuel/utils/unitConversion.d.ts +20 -0
  66. package/dist/theglobalfuel/utils/unitConversion.d.ts.map +1 -0
  67. package/dist/theglobalfuel/utils/unitConversion.js +55 -0
  68. package/dist/theglobalfuel/utils/unitConversion.js.map +1 -0
  69. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AllocateProductionSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA8BH,OAAO,KAAK,EAAuB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzE,UAAU,4BAA4B;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,kFAAkF;IAClF,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,sDAAsD;IACtD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,oBAAoB,GACrB,EAAE,4BAA4B,+BAiS9B"}
1
+ {"version":3,"file":"AllocateProductionSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA0CH,OAAO,KAAK,EAAuB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzE,UAAU,4BAA4B;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,kFAAkF;IAClF,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,sDAAsD;IACtD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,oBAAoB,GACrB,EAAE,4BAA4B,+BA6a9B"}
@@ -1,267 +1,391 @@
1
1
  import { cn as e } from "../utils/cn.js";
2
- import { formatDate as t, formatNumber as n, formatVolume as r } from "../utils/formatters.js";
3
- import { useTheAllAssets as i, useTheCreateProductionAllocation as a } from "../hooks/useTheGlobalFuelApi.js";
2
+ import { formatDate as t, formatEnumLabel as n, formatNumber as r, formatVolume as i } from "../utils/formatters.js";
3
+ import { useTheAllAssets as a, useTheAllInterestDecks as o, useTheCreateProductionAllocation as s } from "../hooks/useTheGlobalFuelApi.js";
4
4
  import { useNotify as ee } from "../hooks/useNotify.js";
5
5
  import "../hooks/index.js";
6
- import { buildAllocationInput as o, newAllocationRow as s, previewAllocation as c } from "../utils/allocationForm.js";
7
- import { useMemo as l, useState as u } from "react";
8
- import { Plus as d, Trash2 as te } from "lucide-react";
9
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
10
- import { Button as m, Input as h, Label as g, ResponsiveDialog as _, ResponsiveDialogContent as v, ResponsiveDialogDescription as y, ResponsiveDialogFooter as b, ResponsiveDialogHeader as x, ResponsiveDialogTitle as S, Select as C, SelectContent as w, SelectItem as T, SelectTrigger as E, SelectValue as D, Textarea as O } from "@burdenoff/fe-libs/ui";
6
+ import { SHRINKAGE_CATEGORIES as c, SHRINKAGE_LABELS as te, buildAllocationInput as ne, emptyShrinkage as l, newAllocationRow as u, previewAllocation as re, previewReconciliation as ie } from "../utils/allocationForm.js";
7
+ import { resolveDeckForPeriod as d } from "../utils/interestDeckForm.js";
8
+ import { useMemo as f, useState as p } from "react";
9
+ import { Plus as ae, Trash2 as oe } from "lucide-react";
10
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
11
+ import { Button as g, Input as _, Label as v, ResponsiveDialog as se, ResponsiveDialogContent as ce, ResponsiveDialogDescription as le, ResponsiveDialogFooter as y, ResponsiveDialogHeader as b, ResponsiveDialogTitle as x, Select as S, SelectContent as C, SelectItem as w, SelectTrigger as T, SelectValue as E, Textarea as D } from "@burdenoff/fe-libs/ui";
11
12
  //#region src/theglobalfuel/components/AllocateProductionSheet.tsx
12
- function k({ open: k, onOpenChange: A, record: j, measurementAssetName: M }) {
13
- let N = ee(), P = i({ enabled: k }), F = a(), I = l(() => [...P.data?.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [P.data]), L = l(() => {
13
+ function O({ open: O, onOpenChange: k, record: A, measurementAssetName: ue }) {
14
+ let j = ee(), M = a({ enabled: O }), N = s(), P = f(() => [...M.data?.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [M.data]), de = f(() => {
14
15
  let e = /* @__PURE__ */ new Map();
15
- for (let t of I) e.set(t.id, t.workingInterestPct);
16
+ for (let t of P) e.set(t.id, t.workingInterestPct);
16
17
  return e;
17
- }, [I]), [R, z] = u("MANUAL"), [B, V] = u(() => [s()]), [H, U] = u(""), [W, G] = u(null), K = k && j ? `open:${j.id}` : "closed", [q, J] = u(K);
18
- K !== q && (J(K), k && j && (z("MANUAL"), V([s()]), U(""), G(null)));
19
- let Y = j?.volume ?? 0, X = j?.unit ?? "BARRELS", Z = c(R, Y, B, (e) => L.get(e) ?? 100), Q = (e, t) => V((n) => n.map((n) => n.key === e ? {
18
+ }, [P]), [F, I] = p("MANUAL"), [L, R] = p(() => [u()]), [z, B] = p(""), [V, H] = p(l), [U, W] = p(null), G = O && A ? `open:${A.id}` : "closed", [fe, pe] = p(G);
19
+ G !== fe && (pe(G), O && A && (I("MANUAL"), R([u()]), B(""), H(l()), W(null)));
20
+ let K = o({ enabled: O }), me = f(() => K.data?.items ?? [], [K.data]), q = (e) => {
21
+ let t = de.get(e) ?? 100;
22
+ if (!A || !e) return {
23
+ workingInterestPct: t,
24
+ royaltyPct: 0,
25
+ overridingRoyaltyPct: 0,
26
+ source: "ASSET_DEFAULT"
27
+ };
28
+ let n = d(me, e, A.periodStart, A.periodEnd);
29
+ return n.kind === "deck" ? {
30
+ workingInterestPct: n.workingInterestPct,
31
+ royaltyPct: n.deck.royaltyPct,
32
+ overridingRoyaltyPct: n.deck.overridingRoyaltyPct,
33
+ source: "INTEREST_DECK",
34
+ effectiveFrom: n.deck.effectiveFrom
35
+ } : {
36
+ workingInterestPct: t,
37
+ royaltyPct: 0,
38
+ overridingRoyaltyPct: 0,
39
+ source: n.kind === "spans" ? "SPANS" : "ASSET_DEFAULT"
40
+ };
41
+ }, J = A?.volume ?? 0, Y = A?.unit ?? "BARRELS", X = re(F, J, L, q), Z = ie(F, J, L, X, V), Q = (e, t) => R((n) => n.map((n) => n.key === e ? {
20
42
  ...n,
21
43
  ...t
22
- } : n)), ne = (e) => V((t) => t.length > 1 ? t.filter((t) => t.key !== e) : t), $ = () => A(!1), re = async () => {
23
- if (!j) return;
24
- let e = o({
25
- productionRecordId: j.id,
26
- method: R,
27
- measuredVolume: Y,
28
- rows: B,
29
- notes: H
44
+ } : n)), he = (e) => R((t) => t.length > 1 ? t.filter((t) => t.key !== e) : t), $ = () => k(!1), ge = async () => {
45
+ if (!A) return;
46
+ let e = ne({
47
+ productionRecordId: A.id,
48
+ method: F,
49
+ measuredVolume: J,
50
+ rows: L,
51
+ notes: z,
52
+ shrinkage: V
30
53
  });
31
54
  if (!e.ok) {
32
- G(e.error), N.error(e.error);
55
+ W(e.error), j.error(e.error);
33
56
  return;
34
57
  }
35
- G(null);
58
+ W(null);
36
59
  try {
37
- await F.mutateAsync(e.input), N.success("Allocation drafted — approve it to lock the split"), $();
60
+ await N.mutateAsync(e.input), j.success("Allocation drafted — approve it to lock the split"), $();
38
61
  } catch (e) {
39
- G(e instanceof Error ? e.message : "Failed to allocate production."), N.fromError(e);
62
+ W(e instanceof Error ? e.message : "Failed to allocate production."), j.fromError(e);
40
63
  }
41
- }, ie = R === "PRO_RATA" ? "Factor" : "Volume";
42
- return /* @__PURE__ */ f(_, {
43
- open: k && !!j,
44
- onOpenChange: A,
45
- children: /* @__PURE__ */ p(v, {
64
+ }, _e = F === "PRO_RATA" ? "Factor" : "Volume";
65
+ return /* @__PURE__ */ m(se, {
66
+ open: O && !!A,
67
+ onOpenChange: k,
68
+ children: /* @__PURE__ */ h(ce, {
46
69
  "data-testid": "allocate-production-sheet",
47
70
  className: "md:max-w-3xl",
48
- children: [/* @__PURE__ */ p(x, { children: [/* @__PURE__ */ f(S, { children: "Allocate production" }), /* @__PURE__ */ f(y, { children: j ? `${r(j.volume, j.unit)} measured at ${M ?? "this asset"}, ${t(j.periodStart)} – ${t(j.periodEnd)}.` : "" })] }), /* @__PURE__ */ p("form", {
71
+ children: [/* @__PURE__ */ h(b, { children: [/* @__PURE__ */ m(x, { children: "Allocate production" }), /* @__PURE__ */ m(le, { children: A ? `${i(A.volume, A.unit)} measured at ${ue ?? "this asset"}, ${t(A.periodStart)} – ${t(A.periodEnd)}.` : "" })] }), /* @__PURE__ */ h("form", {
49
72
  onSubmit: (e) => {
50
- e.preventDefault(), re();
73
+ e.preventDefault(), ge();
51
74
  },
52
- children: [/* @__PURE__ */ p("div", {
75
+ children: [/* @__PURE__ */ h("div", {
53
76
  className: "grid gap-4 py-2",
54
77
  children: [
55
- /* @__PURE__ */ p("div", {
78
+ /* @__PURE__ */ h("div", {
56
79
  className: "grid gap-1.5",
57
80
  children: [
58
- /* @__PURE__ */ f(g, {
81
+ /* @__PURE__ */ m(v, {
59
82
  htmlFor: "alMethod",
60
83
  children: "Method"
61
84
  }),
62
- /* @__PURE__ */ p(C, {
63
- value: R,
64
- onValueChange: (e) => z(e),
65
- children: [/* @__PURE__ */ f(E, {
85
+ /* @__PURE__ */ h(S, {
86
+ value: F,
87
+ onValueChange: (e) => I(e),
88
+ children: [/* @__PURE__ */ m(T, {
66
89
  id: "alMethod",
67
90
  className: "h-11 md:h-10 md:w-72",
68
- children: /* @__PURE__ */ f(D, {})
69
- }), /* @__PURE__ */ p(w, { children: [/* @__PURE__ */ f(T, {
91
+ children: /* @__PURE__ */ m(E, {})
92
+ }), /* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(w, {
70
93
  value: "MANUAL",
71
94
  children: "Manual — enter each asset’s volume"
72
- }), /* @__PURE__ */ f(T, {
95
+ }), /* @__PURE__ */ m(w, {
73
96
  value: "PRO_RATA",
74
97
  children: "Pro rata — split by factor"
75
98
  })] })]
76
99
  }),
77
- /* @__PURE__ */ f("p", {
100
+ /* @__PURE__ */ m("p", {
78
101
  className: "text-xs text-text-tertiary",
79
- children: R === "PRO_RATA" ? "Factors can be well-test rates, theoretical volumes or metered shares. The measured volume is split in proportion." : "The volumes must add up to the measured volume."
102
+ children: F === "PRO_RATA" ? "Factors can be well-test rates, theoretical volumes or metered shares. The measured volume is split in proportion; leave a factor blank to split by the theoretical volume." : "The volumes must add up to the measured volume."
80
103
  })
81
104
  ]
82
105
  }),
83
- /* @__PURE__ */ p("div", {
106
+ /* @__PURE__ */ h("div", {
84
107
  className: "grid gap-3",
85
108
  children: [
86
- P.data?.truncated && /* @__PURE__ */ p("p", {
109
+ M.data?.truncated && /* @__PURE__ */ h("p", {
87
110
  className: "text-xs text-status-warning-text",
88
111
  children: [
89
112
  "Showing the first ",
90
- I.length,
113
+ P.length,
91
114
  " assets of this workspace."
92
115
  ]
93
116
  }),
94
- B.map((e, t) => {
95
- let i = Z.rows[t], a = L.get(e.assetId);
96
- return /* @__PURE__ */ p("div", {
117
+ L.map((n, a) => {
118
+ let o = X.rows[a], s = q(n.assetId);
119
+ return /* @__PURE__ */ h("div", {
97
120
  className: "grid gap-2 rounded-lg border border-border-seam p-3",
98
121
  "data-testid": "allocation-row",
99
- children: [/* @__PURE__ */ p("div", {
100
- className: "grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]",
101
- children: [
102
- /* @__PURE__ */ p("div", {
103
- className: "grid gap-1",
104
- children: [/* @__PURE__ */ f(g, {
105
- htmlFor: `${e.key}-asset`,
106
- className: "text-xs",
107
- children: "Contributing asset"
108
- }), /* @__PURE__ */ p(C, {
109
- value: e.assetId,
110
- onValueChange: (t) => Q(e.key, { assetId: t }),
111
- children: [/* @__PURE__ */ f(E, {
112
- id: `${e.key}-asset`,
113
- className: "h-10",
114
- children: /* @__PURE__ */ f(D, { placeholder: "Select an asset" })
115
- }), /* @__PURE__ */ f(w, { children: I.map((e) => /* @__PURE__ */ f(T, {
116
- value: e.id,
117
- children: e.name
118
- }, e.id)) })]
119
- })]
120
- }),
121
- /* @__PURE__ */ p("div", {
122
- className: "grid gap-1",
123
- children: [/* @__PURE__ */ f(g, {
124
- htmlFor: `${e.key}-amount`,
125
- className: "text-xs",
126
- children: ie
127
- }), /* @__PURE__ */ f(h, {
128
- id: `${e.key}-amount`,
129
- type: "number",
130
- inputMode: "decimal",
131
- min: "0",
132
- step: "any",
133
- className: "h-10 tabular-nums",
134
- value: e.amount,
135
- onChange: (t) => Q(e.key, { amount: t.target.value })
136
- })]
137
- }),
138
- /* @__PURE__ */ p("div", {
139
- className: "grid gap-1",
140
- children: [/* @__PURE__ */ f(g, {
141
- htmlFor: `${e.key}-wi`,
142
- className: "text-xs",
143
- children: "Working interest %"
144
- }), /* @__PURE__ */ f(h, {
145
- id: `${e.key}-wi`,
146
- type: "number",
147
- inputMode: "decimal",
148
- min: "0",
149
- max: "100",
150
- step: "any",
151
- className: "h-10 tabular-nums",
152
- placeholder: a == null ? "100" : n(a),
153
- value: e.workingInterestPct,
154
- onChange: (t) => Q(e.key, { workingInterestPct: t.target.value })
155
- })]
156
- }),
157
- /* @__PURE__ */ p("div", {
158
- className: "grid gap-1",
159
- children: [/* @__PURE__ */ f(g, {
160
- htmlFor: `${e.key}-royalty`,
161
- className: "text-xs",
162
- children: "Royalty %"
163
- }), /* @__PURE__ */ f(h, {
164
- id: `${e.key}-royalty`,
165
- type: "number",
166
- inputMode: "decimal",
167
- min: "0",
168
- max: "100",
169
- step: "any",
170
- className: "h-10 tabular-nums",
171
- placeholder: "0",
172
- value: e.royaltyPct,
173
- onChange: (t) => Q(e.key, { royaltyPct: t.target.value })
174
- })]
175
- }),
176
- /* @__PURE__ */ f("div", {
177
- className: "flex items-end",
178
- children: /* @__PURE__ */ f(m, {
179
- type: "button",
180
- variant: "ghost",
181
- size: "icon",
182
- "aria-label": `Remove row ${t + 1}`,
183
- disabled: B.length === 1,
184
- onClick: () => ne(e.key),
185
- children: /* @__PURE__ */ f(te, { className: "h-4 w-4" })
122
+ children: [
123
+ /* @__PURE__ */ h("div", {
124
+ className: "grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]",
125
+ children: [
126
+ /* @__PURE__ */ h("div", {
127
+ className: "grid gap-1",
128
+ children: [/* @__PURE__ */ m(v, {
129
+ htmlFor: `${n.key}-asset`,
130
+ className: "text-xs",
131
+ children: "Contributing asset"
132
+ }), /* @__PURE__ */ h(S, {
133
+ value: n.assetId,
134
+ onValueChange: (e) => Q(n.key, { assetId: e }),
135
+ children: [/* @__PURE__ */ m(T, {
136
+ id: `${n.key}-asset`,
137
+ className: "h-10",
138
+ children: /* @__PURE__ */ m(E, { placeholder: "Select an asset" })
139
+ }), /* @__PURE__ */ m(C, { children: P.map((e) => /* @__PURE__ */ m(w, {
140
+ value: e.id,
141
+ children: e.name
142
+ }, e.id)) })]
143
+ })]
144
+ }),
145
+ /* @__PURE__ */ h("div", {
146
+ className: "grid gap-1",
147
+ children: [/* @__PURE__ */ m(v, {
148
+ htmlFor: `${n.key}-amount`,
149
+ className: "text-xs",
150
+ children: _e
151
+ }), /* @__PURE__ */ m(_, {
152
+ id: `${n.key}-amount`,
153
+ type: "number",
154
+ inputMode: "decimal",
155
+ min: "0",
156
+ step: "any",
157
+ className: "h-10 tabular-nums",
158
+ value: n.amount,
159
+ onChange: (e) => Q(n.key, { amount: e.target.value })
160
+ })]
161
+ }),
162
+ /* @__PURE__ */ h("div", {
163
+ className: "grid gap-1",
164
+ children: [/* @__PURE__ */ m(v, {
165
+ htmlFor: `${n.key}-theoretical`,
166
+ className: "text-xs",
167
+ children: "Theoretical"
168
+ }), /* @__PURE__ */ m(_, {
169
+ id: `${n.key}-theoretical`,
170
+ type: "number",
171
+ inputMode: "decimal",
172
+ min: "0",
173
+ step: "any",
174
+ className: "h-10 tabular-nums",
175
+ placeholder: "Optional",
176
+ value: n.theoreticalVolume,
177
+ onChange: (e) => Q(n.key, { theoreticalVolume: e.target.value })
178
+ })]
179
+ }),
180
+ /* @__PURE__ */ h("div", {
181
+ className: "grid gap-1",
182
+ children: [/* @__PURE__ */ m(v, {
183
+ htmlFor: `${n.key}-wi`,
184
+ className: "text-xs",
185
+ children: "Working interest %"
186
+ }), /* @__PURE__ */ m(_, {
187
+ id: `${n.key}-wi`,
188
+ type: "number",
189
+ inputMode: "decimal",
190
+ min: "0",
191
+ max: "100",
192
+ step: "any",
193
+ className: "h-10 tabular-nums",
194
+ placeholder: r(s.workingInterestPct),
195
+ value: n.workingInterestPct,
196
+ onChange: (e) => Q(n.key, { workingInterestPct: e.target.value })
197
+ })]
198
+ }),
199
+ /* @__PURE__ */ h("div", {
200
+ className: "grid gap-1",
201
+ children: [/* @__PURE__ */ m(v, {
202
+ htmlFor: `${n.key}-royalty`,
203
+ className: "text-xs",
204
+ children: "Royalty %"
205
+ }), /* @__PURE__ */ m(_, {
206
+ id: `${n.key}-royalty`,
207
+ type: "number",
208
+ inputMode: "decimal",
209
+ min: "0",
210
+ max: "100",
211
+ step: "any",
212
+ className: "h-10 tabular-nums",
213
+ placeholder: r(s.royaltyPct),
214
+ value: n.royaltyPct,
215
+ onChange: (e) => Q(n.key, { royaltyPct: e.target.value })
216
+ })]
217
+ }),
218
+ /* @__PURE__ */ h("div", {
219
+ className: "grid gap-1",
220
+ children: [/* @__PURE__ */ m(v, {
221
+ htmlFor: `${n.key}-orri`,
222
+ className: "text-xs",
223
+ children: "ORRI %"
224
+ }), /* @__PURE__ */ m(_, {
225
+ id: `${n.key}-orri`,
226
+ type: "number",
227
+ inputMode: "decimal",
228
+ min: "0",
229
+ max: "100",
230
+ step: "any",
231
+ className: "h-10 tabular-nums",
232
+ placeholder: r(s.overridingRoyaltyPct),
233
+ value: n.overridingRoyaltyPct,
234
+ onChange: (e) => Q(n.key, { overridingRoyaltyPct: e.target.value })
235
+ })]
236
+ }),
237
+ /* @__PURE__ */ m("div", {
238
+ className: "flex items-end",
239
+ children: /* @__PURE__ */ m(g, {
240
+ type: "button",
241
+ variant: "ghost",
242
+ size: "icon",
243
+ "aria-label": `Remove row ${a + 1}`,
244
+ disabled: L.length === 1,
245
+ onClick: () => he(n.key),
246
+ children: /* @__PURE__ */ m(oe, { className: "h-4 w-4" })
247
+ })
186
248
  })
187
- })
188
- ]
189
- }), i && /* @__PURE__ */ p("p", {
190
- className: "text-xs tabular-nums text-text-secondary",
191
- children: [
192
- "Gross ",
193
- r(i.allocatedVolume, X),
194
- " (",
195
- n(i.sharePct, { maximumFractionDigits: 2 }),
196
- "%) · Net WI",
197
- " ",
198
- r(i.netWorkingInterestVolume, X),
199
- " · Royalty",
200
- " ",
201
- r(i.royaltyVolume, X),
202
- " · Net revenue",
203
- " ",
204
- r(i.netRevenueVolume, X)
205
- ]
206
- })]
207
- }, e.key);
249
+ ]
250
+ }),
251
+ n.assetId && /* @__PURE__ */ m("p", {
252
+ className: e("text-xs", o?.needsAllTerms ? "text-status-warning-text" : "text-text-tertiary"),
253
+ "data-testid": "allocation-row-terms",
254
+ children: s.source === "INTEREST_DECK" ? `Terms from the interest deck effective ${t(s.effectiveFrom)}${o?.overridden ? " (with overrides)" : ""}.` : s.source === "SPANS" ? "Ownership changes inside this period — enter working interest, royalty and ORRI, or split the record at the change." : `No interest deck covers this period — using the asset's working interest${o?.overridden ? " (with overrides)" : ""}.`
255
+ }),
256
+ o && /* @__PURE__ */ h("p", {
257
+ className: "text-xs tabular-nums text-text-secondary",
258
+ children: [
259
+ "Gross ",
260
+ i(o.allocatedVolume, Y),
261
+ " (",
262
+ r(o.sharePct, { maximumFractionDigits: 2 }),
263
+ "%) · Net WI",
264
+ " ",
265
+ i(o.netWorkingInterestVolume, Y),
266
+ " · Royalty",
267
+ " ",
268
+ i(o.royaltyVolume, Y),
269
+ " · Net revenue",
270
+ " ",
271
+ i(o.netRevenueVolume, Y),
272
+ Z.shrinkageTotal > 0 && ` · Wellhead ${i(o.allocatedVolume + (Z.rowShrinkage[a] ?? 0), Y)}`
273
+ ]
274
+ })
275
+ ]
276
+ }, n.key);
208
277
  }),
209
- /* @__PURE__ */ f("div", { children: /* @__PURE__ */ p(m, {
278
+ /* @__PURE__ */ m("div", { children: /* @__PURE__ */ h(g, {
210
279
  type: "button",
211
280
  variant: "outline",
212
281
  size: "sm",
213
- onClick: () => V((e) => [...e, s()]),
214
- children: [/* @__PURE__ */ f(d, { className: "mr-1.5 h-4 w-4" }), " Add asset"]
282
+ onClick: () => R((e) => [...e, u()]),
283
+ children: [/* @__PURE__ */ m(ae, { className: "mr-1.5 h-4 w-4" }), " Add asset"]
215
284
  }) })
216
285
  ]
217
286
  }),
218
- /* @__PURE__ */ p("div", {
219
- className: e("rounded-lg px-3 py-2 text-sm tabular-nums", Z.balanced ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"),
287
+ /* @__PURE__ */ h("fieldset", {
288
+ className: "grid gap-2 rounded-lg border border-border-seam p-3",
289
+ children: [
290
+ /* @__PURE__ */ m("legend", {
291
+ className: "px-1 text-sm font-medium text-text-primary",
292
+ children: "Shrinkage before the meter"
293
+ }),
294
+ /* @__PURE__ */ h("p", {
295
+ className: "text-xs text-text-tertiary",
296
+ children: [
297
+ "Volumes produced at the wells that never reached the measurement point, in",
298
+ " ",
299
+ n(Y),
300
+ ". They are shared across the assets by theoretical volume (or factor, or allocated volume)."
301
+ ]
302
+ }),
303
+ /* @__PURE__ */ m("div", {
304
+ className: "grid grid-cols-2 gap-2 md:grid-cols-4",
305
+ children: c.map((e) => /* @__PURE__ */ h("div", {
306
+ className: "grid gap-1",
307
+ children: [/* @__PURE__ */ m(v, {
308
+ htmlFor: `shrink-${e}`,
309
+ className: "text-xs",
310
+ children: te[e]
311
+ }), /* @__PURE__ */ m(_, {
312
+ id: `shrink-${e}`,
313
+ type: "number",
314
+ inputMode: "decimal",
315
+ min: "0",
316
+ step: "any",
317
+ className: "h-10 tabular-nums",
318
+ placeholder: "0",
319
+ value: V[e],
320
+ onChange: (t) => H((n) => ({
321
+ ...n,
322
+ [e]: t.target.value
323
+ }))
324
+ })]
325
+ }, e))
326
+ })
327
+ ]
328
+ }),
329
+ /* @__PURE__ */ h("div", {
330
+ className: e("rounded-lg px-3 py-2 text-sm tabular-nums", X.balanced ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"),
220
331
  "data-testid": "allocation-balance",
221
332
  children: [
222
333
  "Allocated ",
223
- r(Z.allocatedTotal, X),
334
+ i(X.allocatedTotal, Y),
224
335
  " of",
225
336
  " ",
226
- r(Y, X),
227
- R === "MANUAL" && !Z.balanced ? ` — ${r(Math.abs(Z.difference), X)} ${Z.difference > 0 ? "left to allocate" : "over-allocated"}` : "",
337
+ i(J, Y),
338
+ F === "MANUAL" && !X.balanced ? ` — ${i(Math.abs(X.difference), Y)} ${X.difference > 0 ? "left to allocate" : "over-allocated"}` : "",
228
339
  " · ",
229
340
  "Net revenue ",
230
- r(Z.netRevenueTotal, X)
341
+ i(X.netRevenueTotal, Y)
342
+ ]
343
+ }),
344
+ (Z.shrinkageTotal > 0 || Z.theoreticalTotal !== null) && /* @__PURE__ */ h("p", {
345
+ className: "rounded-lg bg-bg-surface px-3 py-2 text-sm tabular-nums text-text-secondary",
346
+ "data-testid": "allocation-reconciliation",
347
+ children: [
348
+ "Shrinkage ",
349
+ i(Z.shrinkageTotal, Y),
350
+ " · Wellhead",
351
+ " ",
352
+ i(Z.wellheadVolume, Y),
353
+ Z.theoreticalTotal !== null && ` · Theoretical ${i(Z.theoreticalTotal, Y)}`,
354
+ Z.reconciliationFactor !== null && ` · Reconciliation factor ${r(Z.reconciliationFactor, { maximumFractionDigits: 4 })}`
231
355
  ]
232
356
  }),
233
- /* @__PURE__ */ p("div", {
357
+ /* @__PURE__ */ h("div", {
234
358
  className: "grid gap-1.5",
235
- children: [/* @__PURE__ */ f(g, {
359
+ children: [/* @__PURE__ */ m(v, {
236
360
  htmlFor: "alNotes",
237
361
  children: "Notes"
238
- }), /* @__PURE__ */ f(O, {
362
+ }), /* @__PURE__ */ m(D, {
239
363
  id: "alNotes",
240
364
  rows: 2,
241
- value: H,
242
- onChange: (e) => U(e.target.value),
365
+ value: z,
366
+ onChange: (e) => B(e.target.value),
243
367
  placeholder: "Basis for the split (well tests, meter proving, agreements)."
244
368
  })]
245
369
  }),
246
- W && /* @__PURE__ */ f("p", {
370
+ U && /* @__PURE__ */ m("p", {
247
371
  role: "alert",
248
372
  className: "text-sm text-status-error-text",
249
- children: W
373
+ children: U
250
374
  })
251
375
  ]
252
- }), /* @__PURE__ */ p(b, {
376
+ }), /* @__PURE__ */ h(y, {
253
377
  className: "max-md:flex-col-reverse max-md:gap-2",
254
- children: [/* @__PURE__ */ f(m, {
378
+ children: [/* @__PURE__ */ m(g, {
255
379
  type: "button",
256
380
  variant: "outline",
257
381
  className: "max-md:h-11",
258
382
  onClick: $,
259
383
  children: "Cancel"
260
- }), /* @__PURE__ */ f(m, {
384
+ }), /* @__PURE__ */ m(g, {
261
385
  type: "submit",
262
386
  className: "max-md:h-11",
263
- disabled: F.isPending,
264
- children: F.isPending ? "Saving…" : "Save draft allocation"
387
+ disabled: N.isPending,
388
+ children: N.isPending ? "Saving…" : "Save draft allocation"
265
389
  })]
266
390
  })]
267
391
  })]
@@ -269,6 +393,6 @@ function k({ open: k, onOpenChange: A, record: j, measurementAssetName: M }) {
269
393
  });
270
394
  }
271
395
  //#endregion
272
- export { k as AllocateProductionSheet };
396
+ export { O as AllocateProductionSheet };
273
397
 
274
398
  //# sourceMappingURL=AllocateProductionSheet.js.map