@burdenoff/microfe-theglobalfuel 2026.1107.3 → 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 (38) hide show
  1. package/dist/theglobalfuel/components/AllocateProductionSheet.d.ts.map +1 -1
  2. package/dist/theglobalfuel/components/AllocateProductionSheet.js +197 -122
  3. package/dist/theglobalfuel/components/AllocateProductionSheet.js.map +1 -1
  4. package/dist/theglobalfuel/components/CorrectAllocationSheet.d.ts +11 -0
  5. package/dist/theglobalfuel/components/CorrectAllocationSheet.d.ts.map +1 -0
  6. package/dist/theglobalfuel/components/CorrectAllocationSheet.js +235 -0
  7. package/dist/theglobalfuel/components/CorrectAllocationSheet.js.map +1 -0
  8. package/dist/theglobalfuel/components/UnitConversionsDialog.d.ts +18 -0
  9. package/dist/theglobalfuel/components/UnitConversionsDialog.d.ts.map +1 -0
  10. package/dist/theglobalfuel/components/UnitConversionsDialog.js +228 -0
  11. package/dist/theglobalfuel/components/UnitConversionsDialog.js.map +1 -0
  12. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +12 -2
  13. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -1
  14. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +146 -109
  15. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
  16. package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts +4 -0
  17. package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts.map +1 -1
  18. package/dist/theglobalfuel/pages/production/AllocationsPanel.js +211 -138
  19. package/dist/theglobalfuel/pages/production/AllocationsPanel.js.map +1 -1
  20. package/dist/theglobalfuel/pages/production/NetPositionPanel.d.ts +5 -0
  21. package/dist/theglobalfuel/pages/production/NetPositionPanel.d.ts.map +1 -1
  22. package/dist/theglobalfuel/pages/production/NetPositionPanel.js +174 -96
  23. package/dist/theglobalfuel/pages/production/NetPositionPanel.js.map +1 -1
  24. package/dist/theglobalfuel/types/index.d.ts +58 -0
  25. package/dist/theglobalfuel/types/index.d.ts.map +1 -1
  26. package/dist/theglobalfuel/utils/allocationForm.d.ts +32 -1
  27. package/dist/theglobalfuel/utils/allocationForm.d.ts.map +1 -1
  28. package/dist/theglobalfuel/utils/allocationForm.js +136 -67
  29. package/dist/theglobalfuel/utils/allocationForm.js.map +1 -1
  30. package/dist/theglobalfuel/utils/correctionForm.d.ts +48 -0
  31. package/dist/theglobalfuel/utils/correctionForm.d.ts.map +1 -0
  32. package/dist/theglobalfuel/utils/correctionForm.js +91 -0
  33. package/dist/theglobalfuel/utils/correctionForm.js.map +1 -0
  34. package/dist/theglobalfuel/utils/unitConversion.d.ts +20 -0
  35. package/dist/theglobalfuel/utils/unitConversion.d.ts.map +1 -0
  36. package/dist/theglobalfuel/utils/unitConversion.js +55 -0
  37. package/dist/theglobalfuel/utils/unitConversion.js.map +1 -0
  38. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AllocateProductionSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAqCH,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,+BAkW9B"}
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,31 +1,31 @@
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, useTheAllInterestDecks as a, useTheCreateProductionAllocation as o } from "../hooks/useTheGlobalFuelApi.js";
4
- import { useNotify as s } from "../hooks/useNotify.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
+ import { useNotify as ee } from "../hooks/useNotify.js";
5
5
  import "../hooks/index.js";
6
- import { buildAllocationInput as ee, newAllocationRow as c, previewAllocation as te } from "../utils/allocationForm.js";
7
- import { resolveDeckForPeriod as ne } from "../utils/interestDeckForm.js";
8
- import { useMemo as l, useState as u } from "react";
9
- import { Plus as re, Trash2 as d } from "lucide-react";
10
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
11
- import { Button as m, Input as h, Label as g, ResponsiveDialog as _, ResponsiveDialogContent as v, ResponsiveDialogDescription as y, ResponsiveDialogFooter as b, ResponsiveDialogHeader as ie, ResponsiveDialogTitle as ae, Select as x, SelectContent as S, SelectItem as C, SelectTrigger as w, SelectValue as T, Textarea as E } 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";
12
12
  //#region src/theglobalfuel/components/AllocateProductionSheet.tsx
13
- function D({ open: D, onOpenChange: O, record: k, measurementAssetName: A }) {
14
- let j = s(), M = i({ enabled: D }), N = o(), P = l(() => [...M.data?.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [M.data]), oe = 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(() => {
15
15
  let e = /* @__PURE__ */ new Map();
16
16
  for (let t of P) e.set(t.id, t.workingInterestPct);
17
17
  return e;
18
- }, [P]), [F, I] = u("MANUAL"), [L, R] = u(() => [c()]), [z, B] = u(""), [V, H] = u(null), U = D && k ? `open:${k.id}` : "closed", [W, G] = u(U);
19
- U !== W && (G(U), D && k && (I("MANUAL"), R([c()]), B(""), H(null)));
20
- let K = a({ enabled: D }), se = l(() => K.data?.items ?? [], [K.data]), q = (e) => {
21
- let t = oe.get(e) ?? 100;
22
- if (!k || !e) return {
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
23
  workingInterestPct: t,
24
24
  royaltyPct: 0,
25
25
  overridingRoyaltyPct: 0,
26
26
  source: "ASSET_DEFAULT"
27
27
  };
28
- let n = ne(se, e, k.periodStart, k.periodEnd);
28
+ let n = d(me, e, A.periodStart, A.periodEnd);
29
29
  return n.kind === "deck" ? {
30
30
  workingInterestPct: n.workingInterestPct,
31
31
  royaltyPct: n.deck.royaltyPct,
@@ -38,74 +38,75 @@ function D({ open: D, onOpenChange: O, record: k, measurementAssetName: A }) {
38
38
  overridingRoyaltyPct: 0,
39
39
  source: n.kind === "spans" ? "SPANS" : "ASSET_DEFAULT"
40
40
  };
41
- }, J = k?.volume ?? 0, Y = k?.unit ?? "BARRELS", X = te(F, J, L, q), Z = (e, t) => R((n) => n.map((n) => n.key === e ? {
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 ? {
42
42
  ...n,
43
43
  ...t
44
- } : n)), ce = (e) => R((t) => t.length > 1 ? t.filter((t) => t.key !== e) : t), Q = () => O(!1), le = async () => {
45
- if (!k) return;
46
- let e = ee({
47
- productionRecordId: k.id,
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
48
  method: F,
49
49
  measuredVolume: J,
50
50
  rows: L,
51
- notes: z
51
+ notes: z,
52
+ shrinkage: V
52
53
  });
53
54
  if (!e.ok) {
54
- H(e.error), j.error(e.error);
55
+ W(e.error), j.error(e.error);
55
56
  return;
56
57
  }
57
- H(null);
58
+ W(null);
58
59
  try {
59
- await N.mutateAsync(e.input), j.success("Allocation drafted — approve it to lock the split"), Q();
60
+ await N.mutateAsync(e.input), j.success("Allocation drafted — approve it to lock the split"), $();
60
61
  } catch (e) {
61
- H(e instanceof Error ? e.message : "Failed to allocate production."), j.fromError(e);
62
+ W(e instanceof Error ? e.message : "Failed to allocate production."), j.fromError(e);
62
63
  }
63
- }, $ = F === "PRO_RATA" ? "Factor" : "Volume";
64
- return /* @__PURE__ */ f(_, {
65
- open: D && !!k,
66
- onOpenChange: O,
67
- 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, {
68
69
  "data-testid": "allocate-production-sheet",
69
70
  className: "md:max-w-3xl",
70
- children: [/* @__PURE__ */ p(ie, { children: [/* @__PURE__ */ f(ae, { children: "Allocate production" }), /* @__PURE__ */ f(y, { children: k ? `${r(k.volume, k.unit)} measured at ${A ?? "this asset"}, ${t(k.periodStart)} – ${t(k.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", {
71
72
  onSubmit: (e) => {
72
- e.preventDefault(), le();
73
+ e.preventDefault(), ge();
73
74
  },
74
- children: [/* @__PURE__ */ p("div", {
75
+ children: [/* @__PURE__ */ h("div", {
75
76
  className: "grid gap-4 py-2",
76
77
  children: [
77
- /* @__PURE__ */ p("div", {
78
+ /* @__PURE__ */ h("div", {
78
79
  className: "grid gap-1.5",
79
80
  children: [
80
- /* @__PURE__ */ f(g, {
81
+ /* @__PURE__ */ m(v, {
81
82
  htmlFor: "alMethod",
82
83
  children: "Method"
83
84
  }),
84
- /* @__PURE__ */ p(x, {
85
+ /* @__PURE__ */ h(S, {
85
86
  value: F,
86
87
  onValueChange: (e) => I(e),
87
- children: [/* @__PURE__ */ f(w, {
88
+ children: [/* @__PURE__ */ m(T, {
88
89
  id: "alMethod",
89
90
  className: "h-11 md:h-10 md:w-72",
90
- children: /* @__PURE__ */ f(T, {})
91
- }), /* @__PURE__ */ p(S, { children: [/* @__PURE__ */ f(C, {
91
+ children: /* @__PURE__ */ m(E, {})
92
+ }), /* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(w, {
92
93
  value: "MANUAL",
93
94
  children: "Manual — enter each asset’s volume"
94
- }), /* @__PURE__ */ f(C, {
95
+ }), /* @__PURE__ */ m(w, {
95
96
  value: "PRO_RATA",
96
97
  children: "Pro rata — split by factor"
97
98
  })] })]
98
99
  }),
99
- /* @__PURE__ */ f("p", {
100
+ /* @__PURE__ */ m("p", {
100
101
  className: "text-xs text-text-tertiary",
101
- children: F === "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."
102
103
  })
103
104
  ]
104
105
  }),
105
- /* @__PURE__ */ p("div", {
106
+ /* @__PURE__ */ h("div", {
106
107
  className: "grid gap-3",
107
108
  children: [
108
- M.data?.truncated && /* @__PURE__ */ p("p", {
109
+ M.data?.truncated && /* @__PURE__ */ h("p", {
109
110
  className: "text-xs text-status-warning-text",
110
111
  children: [
111
112
  "Showing the first ",
@@ -113,178 +114,252 @@ function D({ open: D, onOpenChange: O, record: k, measurementAssetName: A }) {
113
114
  " assets of this workspace."
114
115
  ]
115
116
  }),
116
- L.map((i, a) => {
117
- let o = X.rows[a], s = q(i.assetId);
118
- return /* @__PURE__ */ p("div", {
117
+ L.map((n, a) => {
118
+ let o = X.rows[a], s = q(n.assetId);
119
+ return /* @__PURE__ */ h("div", {
119
120
  className: "grid gap-2 rounded-lg border border-border-seam p-3",
120
121
  "data-testid": "allocation-row",
121
122
  children: [
122
- /* @__PURE__ */ p("div", {
123
+ /* @__PURE__ */ h("div", {
123
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]",
124
125
  children: [
125
- /* @__PURE__ */ p("div", {
126
+ /* @__PURE__ */ h("div", {
126
127
  className: "grid gap-1",
127
- children: [/* @__PURE__ */ f(g, {
128
- htmlFor: `${i.key}-asset`,
128
+ children: [/* @__PURE__ */ m(v, {
129
+ htmlFor: `${n.key}-asset`,
129
130
  className: "text-xs",
130
131
  children: "Contributing asset"
131
- }), /* @__PURE__ */ p(x, {
132
- value: i.assetId,
133
- onValueChange: (e) => Z(i.key, { assetId: e }),
134
- children: [/* @__PURE__ */ f(w, {
135
- id: `${i.key}-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`,
136
137
  className: "h-10",
137
- children: /* @__PURE__ */ f(T, { placeholder: "Select an asset" })
138
- }), /* @__PURE__ */ f(S, { children: P.map((e) => /* @__PURE__ */ f(C, {
138
+ children: /* @__PURE__ */ m(E, { placeholder: "Select an asset" })
139
+ }), /* @__PURE__ */ m(C, { children: P.map((e) => /* @__PURE__ */ m(w, {
139
140
  value: e.id,
140
141
  children: e.name
141
142
  }, e.id)) })]
142
143
  })]
143
144
  }),
144
- /* @__PURE__ */ p("div", {
145
+ /* @__PURE__ */ h("div", {
145
146
  className: "grid gap-1",
146
- children: [/* @__PURE__ */ f(g, {
147
- htmlFor: `${i.key}-amount`,
147
+ children: [/* @__PURE__ */ m(v, {
148
+ htmlFor: `${n.key}-amount`,
148
149
  className: "text-xs",
149
- children: $
150
- }), /* @__PURE__ */ f(h, {
151
- id: `${i.key}-amount`,
150
+ children: _e
151
+ }), /* @__PURE__ */ m(_, {
152
+ id: `${n.key}-amount`,
152
153
  type: "number",
153
154
  inputMode: "decimal",
154
155
  min: "0",
155
156
  step: "any",
156
157
  className: "h-10 tabular-nums",
157
- value: i.amount,
158
- onChange: (e) => Z(i.key, { amount: e.target.value })
158
+ value: n.amount,
159
+ onChange: (e) => Q(n.key, { amount: e.target.value })
159
160
  })]
160
161
  }),
161
- /* @__PURE__ */ p("div", {
162
+ /* @__PURE__ */ h("div", {
162
163
  className: "grid gap-1",
163
- children: [/* @__PURE__ */ f(g, {
164
- htmlFor: `${i.key}-wi`,
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`,
165
184
  className: "text-xs",
166
185
  children: "Working interest %"
167
- }), /* @__PURE__ */ f(h, {
168
- id: `${i.key}-wi`,
186
+ }), /* @__PURE__ */ m(_, {
187
+ id: `${n.key}-wi`,
169
188
  type: "number",
170
189
  inputMode: "decimal",
171
190
  min: "0",
172
191
  max: "100",
173
192
  step: "any",
174
193
  className: "h-10 tabular-nums",
175
- placeholder: n(s.workingInterestPct),
176
- value: i.workingInterestPct,
177
- onChange: (e) => Z(i.key, { workingInterestPct: e.target.value })
194
+ placeholder: r(s.workingInterestPct),
195
+ value: n.workingInterestPct,
196
+ onChange: (e) => Q(n.key, { workingInterestPct: e.target.value })
178
197
  })]
179
198
  }),
180
- /* @__PURE__ */ p("div", {
199
+ /* @__PURE__ */ h("div", {
181
200
  className: "grid gap-1",
182
- children: [/* @__PURE__ */ f(g, {
183
- htmlFor: `${i.key}-royalty`,
201
+ children: [/* @__PURE__ */ m(v, {
202
+ htmlFor: `${n.key}-royalty`,
184
203
  className: "text-xs",
185
204
  children: "Royalty %"
186
- }), /* @__PURE__ */ f(h, {
187
- id: `${i.key}-royalty`,
205
+ }), /* @__PURE__ */ m(_, {
206
+ id: `${n.key}-royalty`,
188
207
  type: "number",
189
208
  inputMode: "decimal",
190
209
  min: "0",
191
210
  max: "100",
192
211
  step: "any",
193
212
  className: "h-10 tabular-nums",
194
- placeholder: n(s.royaltyPct),
195
- value: i.royaltyPct,
196
- onChange: (e) => Z(i.key, { royaltyPct: e.target.value })
213
+ placeholder: r(s.royaltyPct),
214
+ value: n.royaltyPct,
215
+ onChange: (e) => Q(n.key, { royaltyPct: e.target.value })
197
216
  })]
198
217
  }),
199
- /* @__PURE__ */ p("div", {
218
+ /* @__PURE__ */ h("div", {
200
219
  className: "grid gap-1",
201
- children: [/* @__PURE__ */ f(g, {
202
- htmlFor: `${i.key}-orri`,
220
+ children: [/* @__PURE__ */ m(v, {
221
+ htmlFor: `${n.key}-orri`,
203
222
  className: "text-xs",
204
223
  children: "ORRI %"
205
- }), /* @__PURE__ */ f(h, {
206
- id: `${i.key}-orri`,
224
+ }), /* @__PURE__ */ m(_, {
225
+ id: `${n.key}-orri`,
207
226
  type: "number",
208
227
  inputMode: "decimal",
209
228
  min: "0",
210
229
  max: "100",
211
230
  step: "any",
212
231
  className: "h-10 tabular-nums",
213
- placeholder: n(s.overridingRoyaltyPct),
214
- value: i.overridingRoyaltyPct,
215
- onChange: (e) => Z(i.key, { overridingRoyaltyPct: e.target.value })
232
+ placeholder: r(s.overridingRoyaltyPct),
233
+ value: n.overridingRoyaltyPct,
234
+ onChange: (e) => Q(n.key, { overridingRoyaltyPct: e.target.value })
216
235
  })]
217
236
  }),
218
- /* @__PURE__ */ f("div", {
237
+ /* @__PURE__ */ m("div", {
219
238
  className: "flex items-end",
220
- children: /* @__PURE__ */ f(m, {
239
+ children: /* @__PURE__ */ m(g, {
221
240
  type: "button",
222
241
  variant: "ghost",
223
242
  size: "icon",
224
243
  "aria-label": `Remove row ${a + 1}`,
225
244
  disabled: L.length === 1,
226
- onClick: () => ce(i.key),
227
- children: /* @__PURE__ */ f(d, { className: "h-4 w-4" })
245
+ onClick: () => he(n.key),
246
+ children: /* @__PURE__ */ m(oe, { className: "h-4 w-4" })
228
247
  })
229
248
  })
230
249
  ]
231
250
  }),
232
- i.assetId && /* @__PURE__ */ f("p", {
251
+ n.assetId && /* @__PURE__ */ m("p", {
233
252
  className: e("text-xs", o?.needsAllTerms ? "text-status-warning-text" : "text-text-tertiary"),
234
253
  "data-testid": "allocation-row-terms",
235
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)" : ""}.`
236
255
  }),
237
- o && /* @__PURE__ */ p("p", {
256
+ o && /* @__PURE__ */ h("p", {
238
257
  className: "text-xs tabular-nums text-text-secondary",
239
258
  children: [
240
259
  "Gross ",
241
- r(o.allocatedVolume, Y),
260
+ i(o.allocatedVolume, Y),
242
261
  " (",
243
- n(o.sharePct, { maximumFractionDigits: 2 }),
262
+ r(o.sharePct, { maximumFractionDigits: 2 }),
244
263
  "%) · Net WI",
245
264
  " ",
246
- r(o.netWorkingInterestVolume, Y),
265
+ i(o.netWorkingInterestVolume, Y),
247
266
  " · Royalty",
248
267
  " ",
249
- r(o.royaltyVolume, Y),
268
+ i(o.royaltyVolume, Y),
250
269
  " · Net revenue",
251
270
  " ",
252
- r(o.netRevenueVolume, Y)
271
+ i(o.netRevenueVolume, Y),
272
+ Z.shrinkageTotal > 0 && ` · Wellhead ${i(o.allocatedVolume + (Z.rowShrinkage[a] ?? 0), Y)}`
253
273
  ]
254
274
  })
255
275
  ]
256
- }, i.key);
276
+ }, n.key);
257
277
  }),
258
- /* @__PURE__ */ f("div", { children: /* @__PURE__ */ p(m, {
278
+ /* @__PURE__ */ m("div", { children: /* @__PURE__ */ h(g, {
259
279
  type: "button",
260
280
  variant: "outline",
261
281
  size: "sm",
262
- onClick: () => R((e) => [...e, c()]),
263
- children: [/* @__PURE__ */ f(re, { 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"]
264
284
  }) })
265
285
  ]
266
286
  }),
267
- /* @__PURE__ */ p("div", {
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", {
268
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"),
269
331
  "data-testid": "allocation-balance",
270
332
  children: [
271
333
  "Allocated ",
272
- r(X.allocatedTotal, Y),
334
+ i(X.allocatedTotal, Y),
273
335
  " of",
274
336
  " ",
275
- r(J, Y),
276
- F === "MANUAL" && !X.balanced ? ` — ${r(Math.abs(X.difference), Y)} ${X.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"}` : "",
277
339
  " · ",
278
340
  "Net revenue ",
279
- r(X.netRevenueTotal, Y)
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 })}`
280
355
  ]
281
356
  }),
282
- /* @__PURE__ */ p("div", {
357
+ /* @__PURE__ */ h("div", {
283
358
  className: "grid gap-1.5",
284
- children: [/* @__PURE__ */ f(g, {
359
+ children: [/* @__PURE__ */ m(v, {
285
360
  htmlFor: "alNotes",
286
361
  children: "Notes"
287
- }), /* @__PURE__ */ f(E, {
362
+ }), /* @__PURE__ */ m(D, {
288
363
  id: "alNotes",
289
364
  rows: 2,
290
365
  value: z,
@@ -292,21 +367,21 @@ function D({ open: D, onOpenChange: O, record: k, measurementAssetName: A }) {
292
367
  placeholder: "Basis for the split (well tests, meter proving, agreements)."
293
368
  })]
294
369
  }),
295
- V && /* @__PURE__ */ f("p", {
370
+ U && /* @__PURE__ */ m("p", {
296
371
  role: "alert",
297
372
  className: "text-sm text-status-error-text",
298
- children: V
373
+ children: U
299
374
  })
300
375
  ]
301
- }), /* @__PURE__ */ p(b, {
376
+ }), /* @__PURE__ */ h(y, {
302
377
  className: "max-md:flex-col-reverse max-md:gap-2",
303
- children: [/* @__PURE__ */ f(m, {
378
+ children: [/* @__PURE__ */ m(g, {
304
379
  type: "button",
305
380
  variant: "outline",
306
381
  className: "max-md:h-11",
307
- onClick: Q,
382
+ onClick: $,
308
383
  children: "Cancel"
309
- }), /* @__PURE__ */ f(m, {
384
+ }), /* @__PURE__ */ m(g, {
310
385
  type: "submit",
311
386
  className: "max-md:h-11",
312
387
  disabled: N.isPending,
@@ -318,6 +393,6 @@ function D({ open: D, onOpenChange: O, record: k, measurementAssetName: A }) {
318
393
  });
319
394
  }
320
395
  //#endregion
321
- export { D as AllocateProductionSheet };
396
+ export { O as AllocateProductionSheet };
322
397
 
323
398
  //# sourceMappingURL=AllocateProductionSheet.js.map