PageSourceSearch

https://navpro.truckerpath.com/assets/fuel-network-settings-DseT91o4.js

js truckerpath.com collected 2026-09-24 09:45:44 UTC 86,423 bytes, 2,265 lines download raw bytes

1import { a as __toESM } from "./rolldown-runtime-Cql5ZV07.js";
2import { p as require_react } from "./vendor-charts-D81iZKCV.js";
3import { f as useNavigate, g as require_compiler_runtime, t as require_jsx_runtime } from "./vendor-react-HZz3WA9p.js";
4import "./vendor-dnd-D_JGdZnv.js";
5import "./vendor-mixpanel-Dh8wsiZW.js";
6import "./device-CBwMusKw.js";
7import "./vendor-redux-CLEI5hTp.js";
8import "./vendor-pdf-DksyQ9Qr.js";
9import { L as useDebounce_default } from "./vendor-utils-DiM3BD4o.js";
10import "./vendor-ui-G6aSO5L-.js";
11import { n as toast } from "./dist-Bh07-69G.js";
12import { A as Smartphone, G as Plus, Ot as Info, Y as Pencil, b as Trash2, nt as Monitor } from "./vendor-lucide-EY3Z5fcy.js";
13import { a as cn, t as Button } from "./button-BWyXpawe.js";
14import "./vendor-twilio-BWAG7uEQ.js";
15import "./app-storage-slice-mFVFfzPf.js";
16import { t as Spin } from "./spin-Bjb5hq6_.js";
17import { t as Label } from "./label-BU8XDazs.js";
18import { n as RadioGroupItem, t as RadioGroup } from "./radio-group-DEh2WG4M.js";
19import { B as TableCell, C as TabsContent, H as TableHead, Qn as PopoverTrigger, R as Table, S as Tabs, St as Checkbox, T as TabsTrigger, U as TableHeader, V as TableContainer, W as TableRow, Xn as Popover, Yn as trackMethodCall, Zn as PopoverContent, cn as DialogFooter, ct as Empty, d as Alert, dn as DialogTitle, dt as EmptyHeader, f as AlertDescription, ft as EmptyMedia, h as Switch, hn as Badge, in as Dialog, ln as DialogHeader, nr as Tooltip, on as DialogContent, or as TooltipTrigger, pt as EmptyTitle, rr as TooltipContent, sn as DialogDescription, un as DialogInner, ut as EmptyDescription, w as TabsList, z as TableBody } from "./main-DDHJZG-i.js";
20import "./breadcrumb-DaQ4spt4.js";
21import { a as useGetFuelNetworkSettingsQuery, f as useUpdateFuelNetworkSettingMutation, i as useGetDriverPriceSettingsQuery, l as usePreviewDriverPriceSettingsMutation, n as useGetDieselAvgPriceQuery, r as useGetDriverAudiencesQuery, u as useSaveDriverPriceSettingsMutation } from "./fuel-price-service-BqRwZM13.js";
22import { t as AppBreadcrumb } from "./app-breadcrumb-C_0-hj4G.js";
23var import_react = /* @__PURE__ */ __toESM(require_react());
24var import_compiler_runtime$7 = /* @__PURE__ */ __toESM(require_compiler_runtime());
25var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
26const FuelNetworkOutOfNetworkPriceCard = (t0) => {
27	const $ = (0, import_compiler_runtime$7.c)(48);
28	const { appSetting, webSetting, getChecked, onToggle, disabled } = t0;
29	let t1;
30	let t2;
31	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
32		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
33			className: "text-lg font-semibold text-accent-foreground",
34			children: "Show Out of Network Fuel Price"
35		});
36		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
37			className: "text-sm text-muted-foreground",
38			children: "Turn on to show market retail prices from out of network fuel price stations."
39		});
40		$[0] = t1;
41		$[1] = t2;
42	} else {
43		t1 = $[0];
44		t2 = $[1];
45	}
46	let t3;
47	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
48		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
49			className: "flex size-10 shrink-0 items-center justify-center rounded-md bg-primary-muted",
50			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Monitor, {
51				className: "size-4 text-primary",
52				"aria-hidden": true
53			})
54		});
55		$[2] = t3;
56	} else t3 = $[2];
57	const t4 = appSetting?.name ?? "Trucker Path driver app";
58	let t5;
59	if ($[3] !== t4) {
60		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
61			className: "font-medium text-accent-foreground",
62			children: t4
63		});
64		$[3] = t4;
65		$[4] = t5;
66	} else t5 = $[4];
67	const t6 = appSetting?.description ?? "Show out of network fuel prices to drivers";
68	let t7;
69	if ($[5] !== t6) {
70		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
71			className: "text-muted-foreground",
72			children: t6
73		});
74		$[5] = t6;
75		$[6] = t7;
76	} else t7 = $[6];
77	let t8;
78	if ($[7] !== t5 || $[8] !== t7) {
79		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
80			className: "flex min-w-0 flex-1 flex-col gap-1 text-sm",
81			children: [t5, t7]
82		});
83		$[7] = t5;
84		$[8] = t7;
85		$[9] = t8;
86	} else t8 = $[9];
87	const t9 = appSetting?.id;
88	let t10;
89	if ($[10] !== getChecked || $[11] !== t9) {
90		t10 = getChecked(t9);
91		$[10] = getChecked;
92		$[11] = t9;
93		$[12] = t10;
94	} else t10 = $[12];
95	let t11;
96	if ($[13] !== appSetting?.id || $[14] !== onToggle) {
97		t11 = (checked) => onToggle(appSetting?.id, checked);
98		$[13] = appSetting?.id;
99		$[14] = onToggle;
100		$[15] = t11;
101	} else t11 = $[15];
102	let t12;
103	if ($[16] !== disabled || $[17] !== t10 || $[18] !== t11) {
104		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, {
105			checked: t10,
106			onCheckedChange: t11,
107			disabled
108		});
109		$[16] = disabled;
110		$[17] = t10;
111		$[18] = t11;
112		$[19] = t12;
113	} else t12 = $[19];
114	let t13;
115	if ($[20] !== t12 || $[21] !== t8) {
116		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
117			className: "flex items-center gap-4 p-5",
118			children: [
119				t3,
120				t8,
121				t12
122			]
123		});
124		$[20] = t12;
125		$[21] = t8;
126		$[22] = t13;
127	} else t13 = $[22];
128	let t14;
129	if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
130		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mx-5 border-t border-border" });
131		$[23] = t14;
132	} else t14 = $[23];
133	let t15;
134	if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
135		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
136			className: "flex size-10 shrink-0 items-center justify-center rounded-md bg-primary-muted",
137			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Smartphone, {
138				className: "size-4 text-primary",
139				"aria-hidden": true
140			})
141		});
142		$[24] = t15;
143	} else t15 = $[24];
144	const t16 = webSetting?.name ?? "Fleet manager web dashboard";
145	let t17;
146	if ($[25] !== t16) {
147		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
148			className: "font-medium text-accent-foreground",
149			children: t16
150		});
151		$[25] = t16;
152		$[26] = t17;
153	} else t17 = $[26];
154	const t18 = webSetting?.description ?? "Show out of network fuel prices in web portal";
155	let t19;
156	if ($[27] !== t18) {
157		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
158			className: "text-muted-foreground",
159			children: t18
160		});
161		$[27] = t18;
162		$[28] = t19;
163	} else t19 = $[28];
164	let t20;
165	if ($[29] !== t17 || $[30] !== t19) {
166		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
167			className: "flex min-w-0 flex-1 flex-col gap-1 text-sm",
168			children: [t17, t19]
169		});
170		$[29] = t17;
171		$[30] = t19;
172		$[31] = t20;
173	} else t20 = $[31];
174	const t21 = webSetting?.id;
175	let t22;
176	if ($[32] !== getChecked || $[33] !== t21) {
177		t22 = getChecked(t21);
178		$[32] = getChecked;
179		$[33] = t21;
180		$[34] = t22;
181	} else t22 = $[34];
182	let t23;
183	if ($[35] !== onToggle || $[36] !== webSetting?.id) {
184		t23 = (checked_0) => onToggle(webSetting?.id, checked_0);
185		$[35] = onToggle;
186		$[36] = webSetting?.id;
187		$[37] = t23;
188	} else t23 = $[37];
189	let t24;
190	if ($[38] !== disabled || $[39] !== t22 || $[40] !== t23) {
191		t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, {
192			checked: t22,
193			onCheckedChange: t23,
194			disabled
195		});
196		$[38] = disabled;
197		$[39] = t22;
198		$[40] = t23;
199		$[41] = t24;
200	} else t24 = $[41];
201	let t25;
202	if ($[42] !== t20 || $[43] !== t24) {
203		t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
204			className: "flex items-center gap-4 p-5",
205			children: [
206				t15,
207				t20,
208				t24
209			]
210		});
211		$[42] = t20;
212		$[43] = t24;
213		$[44] = t25;
214	} else t25 = $[44];
215	let t26;
216	if ($[45] !== t13 || $[46] !== t25) {
217		t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
218			className: "flex w-full flex-col gap-1 lg:w-200",
219			children: [
220				t1,
221				t2,
222				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
223					className: "mt-5 flex flex-col overflow-hidden rounded-xl border border-border",
224					children: [
225						t13,
226						t14,
227						t25
228					]
229				})
230			]
231		});
232		$[45] = t13;
233		$[46] = t25;
234		$[47] = t26;
235	} else t26 = $[47];
236	return t26;
237};
238var import_compiler_runtime$6 = /* @__PURE__ */ __toESM(require_compiler_runtime());
239var VISIBLE_ROWS = 3;
240const FuelNetworkDriverAudiencePicker = (t0) => {
241	const $ = (0, import_compiler_runtime$6.c)(65);
242	const { driverTypes, driverGroups, hasDriverGroup, selectedTypeCodes, selectedGroupIds, onToggleType, onToggleGroup, columns: t1, className, tabsListClassName, contentClassName, idPrefix } = t0;
243	const columns = t1 === void 0 ? 3 : t1;
244	const [tab, setTab] = (0, import_react.useState)("DRIVER_TYPE");
245	const [typesExpanded, setTypesExpanded] = (0, import_react.useState)(false);
246	const [groupsExpanded, setGroupsExpanded] = (0, import_react.useState)(false);
247	const visibleLimit = VISIBLE_ROWS * columns;
248	const gridColsClassName = columns === 2 ? "grid-cols-1 lg:grid-cols-2" : "grid-cols-1 lg:grid-cols-3";
249	let t2;
250	if ($[0] !== driverTypes || $[1] !== typesExpanded || $[2] !== visibleLimit) {
251		t2 = typesExpanded ? driverTypes : driverTypes.slice(0, visibleLimit);
252		$[0] = driverTypes;
253		$[1] = typesExpanded;
254		$[2] = visibleLimit;
255		$[3] = t2;
256	} else t2 = $[3];
257	const visibleTypes = t2;
258	let t3;
259	if ($[4] !== driverGroups || $[5] !== groupsExpanded || $[6] !== visibleLimit) {
260		t3 = groupsExpanded ? driverGroups : driverGroups.slice(0, visibleLimit);
261		$[4] = driverGroups;
262		$[5] = groupsExpanded;
263		$[6] = visibleLimit;
264		$[7] = t3;
265	} else t3 = $[7];
266	const visibleGroups = t3;
267	let t4;
268	if ($[8] !== driverTypes || $[9] !== selectedTypeCodes) {
269		let t5$1;
270		if ($[11] !== driverTypes) {
271			t5$1 = (code) => driverTypes.some((dt) => dt.code === code);
272			$[11] = driverTypes;
273			$[12] = t5$1;
274		} else t5$1 = $[12];
275		t4 = selectedTypeCodes.filter(t5$1);
276		$[8] = driverTypes;
277		$[9] = selectedTypeCodes;
278		$[10] = t4;
279	} else t4 = $[10];
280	const activeTypeCount = t4.length;
281	let t5;
282	if ($[13] !== driverGroups || $[14] !== selectedGroupIds) {
283		let t6$1;
284		if ($[16] !== driverGroups) {
285			t6$1 = (id) => driverGroups.some((dg) => dg.id === id);
286			$[16] = driverGroups;
287			$[17] = t6$1;
288		} else t6$1 = $[17];
289		t5 = selectedGroupIds.filter(t6$1);
290		$[13] = driverGroups;
291		$[14] = selectedGroupIds;
292		$[15] = t5;
293	} else t5 = $[15];
294	const activeGroupCount = t5.length;
295	let t6;
296	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
297		t6 = () => {
298			trackMethodCall("handleToggleShowAllDriverTypes", []);
299			return setTypesExpanded(_temp$4);
300		};
301		$[18] = t6;
302	} else t6 = $[18];
303	const handleToggleShowAllDriverTypes = t6;
304	let t7;
305	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
306		t7 = () => {
307			trackMethodCall("handleToggleShowAllDriverGroups", []);
308			return setGroupsExpanded(_temp2$3);
309		};
310		$[19] = t7;
311	} else t7 = $[19];
312	const handleToggleShowAllDriverGroups = t7;
313	const t8 = hasDriverGroup ? tab : "DRIVER_TYPE";
314	let t9;
315	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
316		t9 = (value) => setTab(value);
317		$[20] = t9;
318	} else t9 = $[20];
319	let t10;
320	if ($[21] !== className) {
321		t10 = cn("gap-0", className);
322		$[21] = className;
323		$[22] = t10;
324	} else t10 = $[22];
325	let t11;
326	if ($[23] !== activeGroupCount || $[24] !== activeTypeCount || $[25] !== hasDriverGroup || $[26] !== tabsListClassName) {
327		t11 = hasDriverGroup && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsList, {
328			className: tabsListClassName,
329			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
330				value: "DRIVER_TYPE",
331				className: "gap-1.5",
332				children: ["Driver Types", activeTypeCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
333					variant: "default-subtle",
334					size: "num",
335					className: "rounded-sm",
336					children: activeTypeCount
337				})]
338			}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
339				value: "DRIVER_GROUP",
340				className: "gap-1.5",
341				children: ["Driver Groups", activeGroupCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
342					variant: "default-subtle",
343					size: "num",
344					className: "rounded-sm",
345					children: activeGroupCount
346				})]
347			})]
348		});
349		$[23] = activeGroupCount;
350		$[24] = activeTypeCount;
351		$[25] = hasDriverGroup;
352		$[26] = tabsListClassName;
353		$[27] = t11;
354	} else t11 = $[27];
355	let t12;
356	if ($[28] !== contentClassName || $[29] !== gridColsClassName) {
357		t12 = cn("grid gap-x-6 gap-y-4 py-5", gridColsClassName, contentClassName);
358		$[28] = contentClassName;
359		$[29] = gridColsClassName;
360		$[30] = t12;
361	} else t12 = $[30];
362	let t13;
363	if ($[31] !== idPrefix || $[32] !== onToggleType || $[33] !== selectedTypeCodes || $[34] !== visibleTypes) {
364		let t14$1;
365		if ($[36] !== idPrefix || $[37] !== onToggleType || $[38] !== selectedTypeCodes) {
366			t14$1 = (driverType) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
367				className: "flex items-center gap-2",
368				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, {
369					id: `${idPrefix}-driver-type-${driverType.code}`,
370					checked: selectedTypeCodes.includes(driverType.code),
371					onCheckedChange: () => onToggleType(driverType.code)
372				}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
373					htmlFor: `${idPrefix}-driver-type-${driverType.code}`,
374					children: driverType.name
375				})]
376			}, driverType.code);
377			$[36] = idPrefix;
378			$[37] = onToggleType;
379			$[38] = selectedTypeCodes;
380			$[39] = t14$1;
381		} else t14$1 = $[39];
382		t13 = visibleTypes.map(t14$1);
383		$[31] = idPrefix;
384		$[32] = onToggleType;
385		$[33] = selectedTypeCodes;
386		$[34] = visibleTypes;
387		$[35] = t13;
388	} else t13 = $[35];
389	let t14;
390	if ($[40] !== driverTypes.length || $[41] !== typesExpanded || $[42] !== visibleLimit) {
391		t14 = driverTypes.length > visibleLimit && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
392			variant: "link",
393			className: "col-span-full h-auto w-fit justify-self-start p-0",
394			onClick: handleToggleShowAllDriverTypes,
395			children: typesExpanded ? "Show Less" : "Show All"
396		});
397		$[40] = driverTypes.length;
398		$[41] = typesExpanded;
399		$[42] = visibleLimit;
400		$[43] = t14;
401	} else t14 = $[43];
402	let t15;
403	if ($[44] !== t12 || $[45] !== t13 || $[46] !== t14) {
404		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsContent, {
405			value: "DRIVER_TYPE",
406			className: t12,
407			children: [t13, t14]
408		});
409		$[44] = t12;
410		$[45] = t13;
411		$[46] = t14;
412		$[47] = t15;
413	} else t15 = $[47];
414	let t16;
415	if ($[48] !== contentClassName || $[49] !== driverGroups || $[50] !== gridColsClassName || $[51] !== groupsExpanded || $[52] !== hasDriverGroup || $[53] !== idPrefix || $[54] !== onToggleGroup || $[55] !== selectedGroupIds || $[56] !== visibleGroups || $[57] !== visibleLimit) {
416		t16 = hasDriverGroup && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsContent, {
417			value: "DRIVER_GROUP",
418			className: cn("grid gap-x-6 gap-y-4 py-5", gridColsClassName, contentClassName),
419			children: [visibleGroups.map((driverGroup) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
420				className: "flex items-center gap-2",
421				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, {
422					id: `${idPrefix}-driver-group-${driverGroup.id}`,
423					checked: selectedGroupIds.includes(driverGroup.id),
424					onCheckedChange: () => onToggleGroup(driverGroup.id)
425				}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
426					className: "flex flex-wrap items-center gap-1",
427					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
428						htmlFor: `${idPrefix}-driver-group-${driverGroup.id}`,
429						children: driverGroup.name
430					}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTrigger, {
431						asChild: true,
432						children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
433							type: "button",
434							className: "text-sm font-normal text-primary [text-decoration-skip-ink:none] hover:underline",
435							children: [
436								"(",
437								driverGroup.memberCount,
438								")"
439							]
440						})
441					}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopoverContent, {
442						className: "w-52 overflow-hidden p-0",
443						align: "start",
444						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
445							className: "px-1 py-2",
446							children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
447								className: "px-2 text-xs text-muted-foreground",
448								children: [
449									driverGroup.name,
450									" (",
451									driverGroup.memberCount,
452									")"
453								]
454							})
455						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
456							className: "max-h-[260px] overflow-y-auto p-1",
457							children: driverGroup.driverList.map(_temp3$1)
458						})]
459					})] })]
460				})]
461			}, driverGroup.id)), driverGroups.length > visibleLimit && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
462				variant: "link",
463				className: "col-span-full h-auto w-fit justify-self-start p-0",
464				onClick: handleToggleShowAllDriverGroups,
465				children: groupsExpanded ? "Show Less" : "Show All"
466			})]
467		});
468		$[48] = contentClassName;
469		$[49] = driverGroups;
470		$[50] = gridColsClassName;
471		$[51] = groupsExpanded;
472		$[52] = hasDriverGroup;
473		$[53] = idPrefix;
474		$[54] = onToggleGroup;
475		$[55] = selectedGroupIds;
476		$[56] = visibleGroups;
477		$[57] = visibleLimit;
478		$[58] = t16;
479	} else t16 = $[58];
480	let t17;
481	if ($[59] !== t10 || $[60] !== t11 || $[61] !== t15 || $[62] !== t16 || $[63] !== t8) {
482		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs, {
483			value: t8,
484			onValueChange: t9,
485			className: t10,
486			children: [
487				t11,
488				t15,
489				t16
490			]
491		});
492		$[59] = t10;
493		$[60] = t11;
494		$[61] = t15;
495		$[62] = t16;
496		$[63] = t8;
497		$[64] = t17;
498	} else t17 = $[64];
499	return t17;
500};
501function _temp$4(prev) {
502	return !prev;
503}
504function _temp2$3(prev_0) {
505	return !prev_0;
506}
507function _temp3$1(driver) {
508	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
509		className: "px-2 py-2 text-sm text-popover-foreground",
510		children: driver.driverName
511	}, driver.driverId);
512}
513var MAX_VISIBLE_AUDIENCE_NAMES = 2;
514const toggleInArray = (array, value) => {
515	return array.includes(value) ? array.filter((item) => {
516		return item !== value;
517	}) : [...array, value];
518};
519var hasIntersection = (a, b) => {
520	const setB = new Set(b);
521	return a.some((value) => {
522		return setB.has(value);
523	});
524};
525var getAudienceGranularity = (audience) => {
526	const hasType = audience.driverTypeCodes.length > 0;
527	const hasGroup = audience.groupIds.length > 0;
528	if (hasType && hasGroup) return "TYPE_AND_GROUP";
529	if (hasType) return "TYPE";
530	if (hasGroup) return "GROUP";
531	return "NONE";
532};
533const isOverlappingAudience = (a, b) => {
534	const granularity = getAudienceGranularity(a);
535	if (granularity === "NONE" || granularity !== getAudienceGranularity(b)) return false;
536	if (granularity === "TYPE") return hasIntersection(a.driverTypeCodes, b.driverTypeCodes);
537	if (granularity === "GROUP") return hasIntersection(a.groupIds, b.groupIds);
538	return hasIntersection(a.driverTypeCodes, b.driverTypeCodes) && hasIntersection(a.groupIds, b.groupIds);
539};
540const findDuplicateAdjustments = (candidate, existing, excludeIndex) => {
541	return existing.filter((rule, index) => {
542		return index !== excludeIndex && isOverlappingAudience(candidate, rule);
543	});
544};
545const validateDiscountAgainstRetail = (discount, retailPrice) => {
546	if (discount === null || Number.isNaN(discount)) return {
547		valid: false,
548		reason: "RANGE"
549	};
550	if (discount <= 0 || discount >= 10) return {
551		valid: false,
552		reason: "RANGE"
553	};
554	if (retailPrice !== void 0 && discount >= retailPrice) return {
555		valid: false,
556		reason: "RETAIL"
557	};
558	return { valid: true };
559};
560const formatCollapsedNames = (names) => {
561	if (names.length <= MAX_VISIBLE_AUDIENCE_NAMES) return names.join("; ");
562	const hiddenCount = names.length - MAX_VISIBLE_AUDIENCE_NAMES;
563	return `${names.slice(0, MAX_VISIBLE_AUDIENCE_NAMES).join("; ")} …+${hiddenCount}`;
564};
565const formatDriverTypeNames = (codes, driverTypes) => {
566	const names = codes.map((code) => {
567		return driverTypes.find((driverType) => {
568			return driverType.code === code;
569		})?.name;
570	}).filter((name) => {
571		return Boolean(name);
572	});
573	return formatCollapsedNames(names);
574};
575const formatGroupNames = (groups) => {
576	return formatCollapsedNames(groups.map((group) => {
577		return group.name;
578	}));
579};
580const formatAdjustmentAudienceSummary = (rule, driverTypes) => {
581	const typeNames = rule.driverTypeCodes.map((code) => {
582		return driverTypes.find((driverType) => {
583			return driverType.code === code;
584		})?.name;
585	}).filter((name) => {
586		return Boolean(name);
587	});
588	const groupNames = rule.groups.map((group) => {
589		return group.name;
590	});
591	return [...typeNames, ...groupNames].join(" / ");
592};
593const getOverlapStatusLabel = (rule) => {
594	if (rule.needsResolution) return `Needs Resolution · ${rule.overlapDriverCount} drivers`;
595	if (rule.overlapDriverCount > 0 && rule.overlapDecision) return rule.overlapDecision === "SHOW_ADJUSTED" ? `Show adjusted price · ${rule.overlapDriverCount} drivers` : `Keep hidden · ${rule.overlapDriverCount} drivers`;
596	return null;
597};
598const getPriorityAppliedLabel = (rule, allRules, adjustmentPriority) => {
599	if (!adjustmentPriority) return null;
600	const isTypeOnly = rule.driverTypeCodes.length > 0 && rule.groupIds.length === 0;
601	const isGroupOnly = rule.groupIds.length > 0 && rule.driverTypeCodes.length === 0;
602	if (!isTypeOnly && !isGroupOnly) return null;
603	if (!allRules.some((other) => {
604		return other !== rule && (isTypeOnly ? other.groupIds.length > 0 && other.driverTypeCodes.length === 0 : other.driverTypeCodes.length > 0 && other.groupIds.length === 0);
605	})) return null;
606	if (isTypeOnly) return adjustmentPriority === "DRIVER_TYPE" ? "Type priority applied" : null;
607	return adjustmentPriority === "DRIVER_GROUP" ? "Group priority applied" : null;
608};
609const toAdjustmentDraft = (rule) => {
610	return {
611		driverTypeCodes: rule.driverTypeCodes,
612		groupIds: rule.groupIds,
613		discountFromRetail: rule.discountFromRetail,
614		overlapDecision: rule.overlapDecision
615	};
616};
617const normalizeAdjustmentRule = (rule, driverGroups) => {
618	const groupIds = rule.groupIds?.length ? rule.groupIds : rule.groups?.map((g) => {
619		return g.id;
620	}) ?? [];
621	return {
622		...rule,
623		driverTypeCodes: rule.driverTypeCodes ?? [],
624		groupIds,
625		groups: driverGroups ? groupIds.map((id) => {
626			return driverGroups.find((group) => {
627				return group.id === id;
628			});
629		}).filter((group) => {
630			return Boolean(group);
631		}).map((group) => {
632			return {
633				id: group.id,
634				name: group.name
635			};
636		}) : rule.groups ?? []
637	};
638};
639var import_compiler_runtime$5 = /* @__PURE__ */ __toESM(require_compiler_runtime());
640const FuelNetworkHideInNetworkPriceCard = (t0) => {
641	const $ = (0, import_compiler_runtime$5.c)(15);
642	const { driverTypes, driverGroups, hasDriverGroup, value, onChange } = t0;
643	let t1;
644	if ($[0] !== onChange || $[1] !== value) {
645		t1 = (code) => {
646			trackMethodCall("handleToggleHideDriverType", [code]);
647			onChange({
648				...value,
649				driverTypeCodes: toggleInArray(value.driverTypeCodes, code)
650			});
651		};
652		$[0] = onChange;
653		$[1] = value;
654		$[2] = t1;
655	} else t1 = $[2];
656	const handleToggleHideDriverType = t1;
657	let t2;
658	if ($[3] !== onChange || $[4] !== value) {
659		t2 = (id) => {
660			trackMethodCall("handleToggleHideDriverGroup", [id]);
661			onChange({
662				...value,
663				groupIds: toggleInArray(value.groupIds, id)
664			});
665		};
666		$[3] = onChange;
667		$[4] = value;
668		$[5] = t2;
669	} else t2 = $[5];
670	const handleToggleHideDriverGroup = t2;
671	let t3;
672	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
673		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
674			className: "flex flex-col gap-1 rounded-2xs bg-muted/50 p-5",
675			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
676				className: "text-sm font-semibold text-accent-foreground",
677				children: "Hide in-network price"
678			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
679				className: "text-sm text-muted-foreground",
680				children: "Drivers matching any selected group or driver type won't see your fleet's in-network price."
681			})]
682		});
683		$[6] = t3;
684	} else t3 = $[6];
685	let t4;
686	if ($[7] !== driverGroups || $[8] !== driverTypes || $[9] !== handleToggleHideDriverGroup || $[10] !== handleToggleHideDriverType || $[11] !== hasDriverGroup || $[12] !== value.driverTypeCodes || $[13] !== value.groupIds) {
687		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
688			className: "flex w-full flex-col overflow-hidden rounded-xl border border-border",
689			children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
690				className: "px-5 pt-1.5",
691				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkDriverAudiencePicker, {
692					driverTypes,
693					driverGroups,
694					hasDriverGroup,
695					selectedTypeCodes: value.driverTypeCodes,
696					selectedGroupIds: value.groupIds,
697					onToggleType: handleToggleHideDriverType,
698					onToggleGroup: handleToggleHideDriverGroup,
699					columns: 3,
700					idPrefix: "hide"
701				})
702			})]
703		});
704		$[7] = driverGroups;
705		$[8] = driverTypes;
706		$[9] = handleToggleHideDriverGroup;
707		$[10] = handleToggleHideDriverType;
708		$[11] = hasDriverGroup;
709		$[12] = value.driverTypeCodes;
710		$[13] = value.groupIds;
711		$[14] = t4;
712	} else t4 = $[14];
713	return t4;
714};
715var SvgEmptyPriceAdjustments = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
716	width: 100,
717	height: 100,
718	viewBox: "0 0 100 100",
719	fill: "none",
720	xmlns: "http://www.w3.org/2000/svg",
721	...props,
722	children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
723		transform: "translate(8,8)",
724		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
725			id: "编组-4",
726			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("mask", {
727				id: "mask0_0_832",
728				style: { maskType: "alpha" },
729				maskUnits: "userSpaceOnUse",
730				x: 0,
731				y: 0,
732				width: 91,
733				height: 91,
734				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
735					id: "mask-u6e023ap2z-3",
736					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
737						id: "Vector",
738						d: "M45.5 91C70.629 91 91 70.629 91 45.5C91 20.371 70.629 0 45.5 0C20.371 0 0 20.371 0 45.5C0 70.629 20.371 91 45.5 91Z",
739						fill: "white"
740					})
741				})
742			}
742), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
743				mask: "url(#mask0_0_832)",
744				children: [
745					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
746						id: "椭圆形",
747						d: "M45.5 91C70.629 91 91 70.629 91 45.5C91 20.371 70.629 0 45.5 0C20.371 0 0 20.371 0 45.5C0 70.629 20.371 91 45.5 91Z",
748						fill: "url(#paint0_linear_0_832)"
749					}),
750					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
751						id: "椭圆形_2",
752						d: "M28.0001 67C46.7778 67 62.0001 51.7776 62.0001 33C62.0001 14.2223 46.7778 -1.00003 28.0001 -1.00003C9.22244 -1.00003 -5.99988 14.2223 -5.99988 33C-5.99988 51.7776 9.22244 67 28.0001 67Z",
753						fill: "url(#paint1_linear_0_832)"
754					}),
755					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
756						id: "矩形",
757						d: "M54.1568 47.8438L76.318 71.1618L70.6611 76.8187L48.4999 53.5007L54.1568 47.8438Z",
758						fill: "url(#paint2_linear_0_832)"
759					}),
760					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
761						id: "矩形_2",
762						d: "M69.0743 59.676L88.8733 79.475C91.607 82.2086 91.607 86.6408 88.8733 89.3744C86.1396 92.1081 81.7075 92.1081 78.9738 89.3744L59.1748 69.5755C58.3938 68.7944 58.3938 67.5281 59.1748 66.747L66.2459 59.676C67.0269 58.8949 68.2933 58.8949 69.0743 59.676Z",
763						fill: "url(#paint3_linear_0_832)"
764					})
765				]
766			})]
767		}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("defs", { children: [
768			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
769				id: "paint0_linear_0_832",
770				x1: -89.6945,
771				y1: -87.3545,
772				x2: 77.7301,
773				y2: 76.3795,
774				gradientUnits: "userSpaceOnUse",
775				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#D2D5DA" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
776					offset: 1,
777					stopColor: "#E3E5E8"
778				})]
779			}),
780			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
781				id: "paint1_linear_0_832",
782				x1: 54.069,
783				y1: 76.3168,
784				x2: 28.0001,
785				y2: 33,
786				gradientUnits: "userSpaceOnUse",
787				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
788					offset: 1,
789					stopColor: "#D2D5DA"
790				})]
791			}),
792			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
793				id: "paint2_linear_0_832",
794				x1: 62.4089,
795				y1: 62.3312,
796				x2: 50.8686,
797				y2: 50.5217,
798				gradientUnits: "userSpaceOnUse",
799				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#F4F5F6" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
800					offset: 1,
801					stopColor: "#E3E5E8"
802				})]
803			}),
804			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
805				id: "paint3_linear_0_832",
806				x1: 62.7103,
807				y1: 63.2115,
808				x2: 90.8364,
809				y2: 91.3375,
810				gradientUnits: "userSpaceOnUse",
811				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#C9CCD1" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
812					offset: 1,
813					stopColor: "#E3E5E8"
814				})]
815			})
816		] })]
817	}
817), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
818		transform: "translate(2,2)",
819		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
820			id: "Group",
821			children: [
822				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
823					id: "椭圆形",
824					d: "M34 68C52.7777 68 68 52.7777 68 34C68 15.2223 52.7777 0 34 0C15.2223 0 0 15.2223 0 34C0 52.7777 15.2223 68 34 68Z",
825					fill: "url(#paint0_linear_0_827)"
826				}),
827				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
828					id: "椭圆形_2",
829					d: "M33.9999 62C49.4639 62 61.9999 49.464 61.9999 34C61.9999 18.5361 49.4639 6.00003 33.9999 6.00003C18.5359 6.00003 5.99988 18.5361 5.99988 34C5.99988 49.464 18.5359 62 33.9999 62Z",
830					fill: "url(#paint1_linear_0_827)"
831				}),
832				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
833					id: "形状",
834					d: "M36.8697 38.7831V37.5132C36.8697 36.8642 37.0195 36.3633 37.3191 36.0106C37.6187 35.6578 38.2043 35.284 39.0759 34.8889C40.1654 34.381 41.0847 33.9012 41.8337 33.4497C42.5827 32.9982 43.1888 32.4621 43.6518 31.8413C44.1148 31.2205 44.4553 30.4656 44.6732 29.5767C44.8911 28.6878 45.0001 27.552 45.0001 26.1693C45.0001 24.3633 44.7549 22.9242 44.2647 21.8519C43.7744 20.7795 43.0798 19.9612 42.181 19.3968C41.2822 18.8325 40.1995 18.4586 38.9329 18.2751C37.6664 18.0917 36.2569 18 34.7043 18C33.0701 18 31.5993 18.0847 30.2919 18.254C28.9845 18.4233 27.8678 18.7972 26.9417 19.3757C26.0156 19.9541 25.3006 20.7795 24.7968 21.8519C24.2929 22.9242 24.0273 24.3633 24.0001 26.1693V27.4815H31.0273V26.1693C31.0273 25.5767 31.1226 25.1111 31.3133 24.7725C31.504 24.4339 31.7627 24.1728 32.0896 23.9894C32.4164 23.806 32.8045 23.6931 33.254 23.6508C33.7034 23.6085 34.1868 23.5873 34.7043 23.5873C35.8211 23.5873 36.645 23.7354 37.1761 24.0317C37.7073 24.328 37.9728 25.0406 37.9728 26.1693C37.9728 26.7619 37.9115 27.2487 37.789 27.6296C37.6664 28.0106 37.4894 28.328 37.2578 28.582C37.0263 28.836 36.7608 29.0547 36.4612 29.2381C36.1615 29.4215 35.8347 29.5979 35.4806 29.7672L34.0098 30.4868C33.0565 30.9665 32.3075 31.418 31.7627 31.8413C31.218 32.2646 30.8026 32.7302 30.5166 33.2381C30.2306 33.746 30.0468 34.3386 29.965 35.0159C29.8833 35.6931 29.8425 36.5256 29.8425 37.5132V38.7831H36.8697ZM36.6654 42.6349H30.0468V50H36.6654V42.6349Z",
835					fill: "white"
836				}),
837				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
838					id: "形状结合",
839					d: "M33.9999 6.00003C35.6939 6.00003 37.3529 6.15047 38.964 6.43873C43.3422 11.3804 45.9999 17.8798 45.9999 25C45.9999 40.464 33.4639 53 17.9999 53C16.3058 53 14.6469 52.8496 13.0358 52.5613C8.65755 47.6197 5.99988 41.1202 5.99988 34C5.99988 18.5361 18.5359 6.00003 33.9999 6.00003Z",
840					fill: "url(#paint2_linear_0_827)",
841					fillOpacity: .1
842				})
843			]
844		}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("defs", { children: [
845			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
846				id: "paint0_linear_0_827",
847				x1: 34,
848				y1: 68,
849				x2: 32.2653,
850				y2: 17.037,
851				gradientUnits: "userSpaceOnUse",
852				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#F9FAFA" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
853					offset: 1,
854					stopColor: "#F1F2F4"
855				})]
856			}),
857			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
858				id: "paint1_linear_0_827",
859				x1: 5.99988,
860				y1: 6.00003,
861				x2: 61.9999,
862				y2: 62,
863				gradientUnits: "userSpaceOnUse",
864				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
865					offset: 1,
866					stopColor: "#D2D5DA"
867				})]
868			}),
869			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
870				id: "paint2_linear_0_827",
871				x1: 19.7921,
872				y1: 53,
873				x2: 19.7921,
874				y2: 8.78189,
875				gradientUnits: "userSpaceOnUse",
876				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#F4F5F6" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
877					offset: 1,
878					stopColor: "#FCFCFD"
879				})]
880			})
881		] })]
882	})]
883});
884var empty_price_adjustments_default = SvgEmptyPriceAdjustments;
885var formatCurrency = (value) => {
886	return `$${value.toFixed(2)}`;
887};
888const FuelNetworkPriceAdjustmentDialog = ({ open, onOpenChange, driverTypes, driverGroups, hasDriverGroup, hideDraft, existingAdjustments, editingIndex, retailPrice, onSave }) => {
889	const editingRule = editingIndex !== void 0 ? existingAdjustments[editingIndex] : void 0;
890	const [driverTypeCodes, setDriverTypeCodes] = (0, import_react.useState)(editingRule?.driverTypeCodes ?? []);
891	const [groupIds, setGroupIds] = (0, import_react.useState)(editingRule?.groupIds ?? []);
892	const [discountInput, setDiscountInput] = (0, import_react.useState)(editingRule?.discountFromRetail !== void 0 && editingRule?.discountFromRetail !== null ? String(editingRule.discountFromRetail) : "");
893	const [overlapDecision, setOverlapDecision] = (0, import_react.useState)(editingRule?.overlapDecision ?? null);
894	const [localAdjustmentPriority, setLocalAdjustmentPriority] = (0, import_react.useState)("");
895	const [showConflictBlock, setShowConflictBlock] = (0, import_react.useState)(Boolean(editingRule && editingRule.overlapDriverCount > 0));
896	const [showPriorityBlock, setShowPriorityBlock] = (0, import_react.useState)(false);
897	const [overlapDriverCount, setOverlapDriverCount] = (0, import_react.useState)(editingRule?.overlapDriverCount ?? 0);
898	const [asyncErrorMessage, setAsyncErrorMessage] = (0, import_react.useState)(null);
899	const [previewDriverPriceSettings, { isLoading: isPreviewLoading }] = usePreviewDriverPriceSettingsMutation();
900	const handleToggleDriverType = (code) => {
901		trackMethodCall("handleToggleDriverType", [code]);
902		setDriverTypeCodes((prev) => {
903			return toggleInArray(prev, code);
904		});
905		setAsyncErrorMessage(null);
906	};
907	const handleToggleDriverGroup = (id) => {
908		trackMethodCall("handleToggleDriverGroup", [id]);
909		setGroupIds((prev_0) => {
910			return toggleInArray(prev_0, id);
911		});
912		setAsyncErrorMessage(null);
913	};
914	const parsedDiscount = discountInput.trim() === "" ? null : Number(discountInput);
915	const discountCheck = validateDiscountAgainstRetail(parsedDiscount, retailPrice);
916	const audienceEmpty = driverTypeCodes.length === 0 && groupIds.length === 0;
917	const duplicateRules = !audienceEmpty ? findDuplicateAdjustments({
918		driverTypeCodes,
919		groupIds
920	}, existingAdjustments, editingIndex) : [];
921	const liveErrorMessage = (() => {
922		if (audienceEmpty || discountInput.trim() === "") return null;
923		if (!discountCheck.valid) return discountCheck.reason === "RETAIL" ? `Discount (${formatCurrency(parsedDiscount)}/gal) ≥ Retail price. Please check and reset.` : null;
924		if (duplicateRules.length >
924 0) return `This audience already has an adjusted price configuration. Existing configuration: ${duplicateRules.map((rule) => {
925			return `${formatAdjustmentAudienceSummary(rule, driverTypes)} - ${formatCurrency(rule.discountFromRetail ?? 0)}/gal`;
926		}).join("; ")}.`;
927		return null;
928	})();
929	const displayedErrorMessage = liveErrorMessage ?? asyncErrorMessage;
930	const isSaveDisabled = audienceEmpty || discountInput.trim() === "" || Boolean(liveErrorMessage) || showPriorityBlock && !localAdjustmentPriority || showConflictBlock && !overlapDecision || isPreviewLoading;
931	const handleSaveInPriceAdjustmentDialog = async () => {
932		trackMethodCall("handleSaveInPriceAdjustmentDialog", []);
933		if (audienceEmpty || parsedDiscount === null || !discountCheck.valid || duplicateRules.length > 0) return;
934		const candidateDraft = {
935			driverTypeCodes,
936			groupIds,
937			discountFromRetail: parsedDiscount,
938			overlapDecision
939		};
940		const draftAdjustments = existingAdjustments.map(toAdjustmentDraft);
941		const candidateIndex = editingIndex ?? draftAdjustments.length;
942		if (editingIndex !== void 0) draftAdjustments[editingIndex] = candidateDraft;
943		else draftAdjustments.push(candidateDraft);
944		try {
945			const result = await previewDriverPriceSettings({
946				hide: hideDraft,
947				adjustments: draftAdjustments,
948				adjustmentPriority: localAdjustmentPriority || void 0
949			}).unwrap();
950			const thisRuleErrors = result.data.errors.filter((error) => {
951				return error.ruleIndexes.includes(candidateIndex);
952			});
953			const echoedRule = result.data.adjustments.find((rule_0) => {
954				return rule_0.ruleIndex === candidateIndex;
955			});
956			const needsPriority = thisRuleErrors.some((error_0) => {
957				return error_0.code === "MISSING_ADJUSTMENT_PRIORITY";
958			});
959			const needsOverlapDecision = thisRuleErrors.some((error_1) => {
960				return error_1.code === "MISSING_OVERLAP_DECISION";
961			});
962			if (needsPriority) setShowPriorityBlock(true);
963			if (needsOverlapDecision) {
964				const overlapError = thisRuleErrors.find((error_2) => {
965					return error_2.code === "MISSING_OVERLAP_DECISION";
966				});
967				setShowConflictBlock(true);
968				setOverlapDriverCount(Number(overlapError?.detail?.overlapDriverCount ?? 0));
969			}
970			if (needsPriority && !localAdjustmentPriority || needsOverlapDecision && !overlapDecision) {
971				setAsyncErrorMessage(null);
972				return;
973			}
974			if (thisRuleErrors.length > 0 || !echoedRule) {
975				setAsyncErrorMessage("Please check the fields above and try again.");
976				return;
977			}
978			setAsyncErrorMessage(null);
979			const normalizedAdjustments = result.data.adjustments.map((rule_1) => {
980				return normalizeAdjustmentRule(rule_1, driverGroups);
981			});
982			onSave(normalizedAdjustments, localAdjustmentPriority, result.data.valid);
983			onOpenChange(false);
984		} catch {
985			setAsyncErrorMessage("Network error, please retry.");
986		}
987	};
988	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
989		open,
990		onOpenChange,
991		children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
992			className: "max-w-lg gap-0 p-0",
993			children: [
994				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: editingRule ? "Edit Price Adjustment" : "Add Price Adjustment" }) }),
995				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogInner, {
996					className: "gap-5",
997					children: [
998						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
999							className: "flex flex-col gap-2.5",
1000							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1001								className: "flex flex-col gap-0.5 text-sm",
1002								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1003									className: "font-medium text-foreground",
1004									children: "Audience"
1005								}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1006									className: "text-muted-foreground",
1007									children: "Select at least one Driver Type or Driver Group"
1008								})]
1009							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1010								className: "rounded-md border border-border",
1011								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkDriverAudiencePicker, {
1012									driverTypes,
1013									driverGroups,
1014									hasDriverGroup,
1015									selectedTypeCodes: driverTypeCodes,
1016									selectedGroupIds: groupIds,
1017									onToggleType: handleToggleDriverType,
1018									onToggleGroup: handleToggleDriverGroup,
1019									columns: 2,
1020									tabsListClassName: "px-4",
1021									contentClassName: "p-4",
1022									idPrefix: "adjustment"
1023								})
1024							})]
1025						}),
1026						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1027							className: "flex flex-col gap-2",
1028							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Label, {
1029								htmlFor: "price-adjustment-discount",
1030								children: ["Discount From Retail", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1031									"aria-hidden": true,
1032									className: "text-destructive",
1033									children: "*"
1034								})]
1035							}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1036								className: "bg-input-field flex items-center gap-1 rounded-md border border-input px-3 py-2 shadow-xs",
1037								children: [
1038									/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1039										className: "text-sm text-foreground",
1040										children: "$"
1041									}),
1042									/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
1043										id: "price-adjustment-discount",
1044										type: "number",
1045										min: 0,
1046										max: 10,
1047										step: .01,
1048										required: true,
1049										placeholder: "0.00",
1050										value: discountInput,
1051										onChange: (e) => {
1052											const nextValue = e.target.value;
1053											if (nextValue !== "" && !/^\d*\.?\d{0,2}$/.test(nextValue)) return;
1054											if (nextValue !== "" && Number(nextValue) >= 10) return;
1055											setDiscountInput(nextValue);
1056											setAsyncErrorMessage(null);
1057										},
1058										className: "w-full flex-1 [appearance:textfield] border-0 bg-transparent p-0 text-sm text-foreground outline-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
1059									}),
1060									/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1061										className: "shrink-0 text-sm text-muted-foreground",
1062										children: "per gallon"
1063									})
1064								]
1065							})]
1066						}),
1067						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1068							className: "flex items-center gap-1 rounded-md bg-accent px-4 py-2.5 text-sm text-accent-foreground",
1069							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1070								className: "font-medium",
1071								children: "Driver Fees = "
1072							}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1073								className: "font-medium",
1074								children: ["Retail price - ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1075									className: "text-success-foreground",
1076									children: discountCheck.valid && parsedDiscount !== null ? `${formatCurrency(parsedDiscount)}/gal` : "$0.00/gal"
1077								})]
1078							})]
1079						}),
1080						showConflictBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1081							className: "flex flex-col gap-4 rounded-lg bg-primary-muted p-4",
1082							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1083								className: "flex flex-col gap-1 text-sm",
1084								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
1085									className: "font-semibold text-accent-foreground",
1086									children: [
1087										"Price Visibility Conflict",
1088										" ",
1089										/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1090											"aria-hidden": true,
1091											className: "text-destructive",
1092											children: "*"
1093										})
1094									]
1095								}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
1096									className: "text-muted-foreground",
1097									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1098										className: "text-foreground",
1099										children: [overlapDriverCount, " drivers"]
1100									}), ` match both the Hide in-network price setting and this price adjustment. Choose what they should see.`]
1101								})]
1102							}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RadioGroup, {
1103								value: overlapDecision ?? void 0,
1104								onValueChange: (value) => {
1105									setOverlapDecision(value);
1106									setAsyncErrorMessage(null);
1107								},
1108								className: "flex flex-col gap-3",
1109								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1110									className: "flex items-start gap-3",
1111									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItem, {
1112										value: "KEEP_HIDDEN",
1113										id: "overlap-keep-hidden"
1114									}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
1115										htmlFor: "overlap-keep-hidden",
1116										className: "cursor-pointer",
1117										children: "Keep in-network price hidden (show retail)"
1118									})]
1119								}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1120									className: "flex items-start gap-3",
1121									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItem, {
1122										value: "SHOW_ADJUSTED",
1123										id: "overlap-show-adjusted"
1124									}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
1125										htmlFor: "overlap-show-adjusted",
1126										className: "cursor-pointer",
1127										children: "Show adjusted price"
1128									})]
1129								})]
1130							})]
1131						}),
1132						showPriorityBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1133							className: "flex flex-col gap-4 rounded-lg bg-primary-muted p-4",
1134							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1135								className: "flex flex-col gap-1 text-sm",
1136								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
1137									className: "font-semibold text-accent-foreground",
1138									children: [
1139										"Adjustment Priority",
1140										" ",
1141										/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1142											"aria-hidden": true,
1143											className: "text-destructive",
1144											children: "*"
1145										})
1146									]
1147								}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1148									className: "text-muted-foreground",
1149									children: "When a driver matches both a Driver Type and Driver Group adjustment, choose which adjustment applies when no exact match exists."
1150								})]
1151							}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RadioGroup, {
1152								value: localAdjustmentPriority || void 0,
1153								onValueChange: (value_0) => {
1154									setLocalAdjustmentPriority(value_0);
1155									setAsyncErrorMessage(null);
1156								},
1157								className: "flex flex-col gap-3",
1158								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1159									className: "flex items-start gap-3",
1160									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItem, {
1161										value: "DRIVER_TYPE",
1162										id: "priority-driver-type"
1163									}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
1164										htmlFor: "priority-driver-type",
1165										className: "cursor-pointer",
1166										children: "Driver Type adjustment"
1167									})]
1168								}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1169									className: "flex items-start gap-3",
1170									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItem, {
1171										value: "DRIVER_GROUP",
1172										id: "priority-driver-group"
1173									}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
1174										htmlFor: "priority-driver-group",
1175										className: "cursor-pointer",
1176										children: "Driver Group adjustment"
1177									})]
1178								})]
1179							})]
1180						}),
1181						displayedErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1182							className: "text-sm text-destructive",
1183							children: displayedErrorMessage
1184						})
1185					]
1186				}),
1187				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1188					variant: "outline",
1189					onClick: () => {
1190						return onOpenChange(false);
1191					},
1192					children: "Cancel"
1193				}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1194					onClick: handleSaveInPriceAdjustmentDialog,
1195					disabled: isSaveDisabled,
1196					loading: isPreviewLoading,
1197					children: editingRule ? "Save Changes" : "Add Price Adjustment"
1198				})] })
1199			]
1200		})
1201	});
1202};
1203var import_compiler_runtime$4 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1204const FuelNetworkPriceAdjustmentDeleteDialog = (t0) => {
1205	const $ = (0, import_compiler_runtime$4.c)(46);
1206	const { open, onOpenChange, adjustment, driverTypes, hideDraft, adjustments, adjustmentPriority, onConfirm } = t0;
1207	const [previewDriverPriceSettings] = usePreviewDriverPriceSettingsMutation();
1208	const [needsFurtherResolution, setNeedsFurtherResolution] = (0, import_react.useState)(false);
1209	let t1;
1210	let t2;
1211	if ($[0] !== adjustment || $[1] !== adjustmentPriority || $[2] !== adjustments || $[3] !== hideDraft || $[4] !== open || $[5] !== previewDriverPriceSettings) {
1212		t1 = () => {
1213			if (!open || !adjustment) {
1214				setNeedsFurtherResolution(false);
1215				return;
1216			}
1217			const remainingAdjustments = adjustments.filter((rule) => rule !== adjustment).map(toAdjustmentDraft);
1218			previewDriverPriceSettings({
1219				hide: hideDraft,
1220				adjustments: remainingAdjustments,
1221				adjustmentPriority: adjustmentPriority || void 0
1222			}).unwrap().then((result) => {
1223				setNeedsFurtherResolution(result.data.adjustments.some(_temp$3));
1224			}).catch(() => setNeedsFurtherResolution(false));
1225		};
1226		t2 = [
1227			open,
1228			adjustment,
1229			adjustments,
1230			hideDraft,
1231			adjustmentPriority,
1232			previewDriverPriceSettings
1233		];
1234		$[0] = adjustment;
1235		$[1] = adjustmentPriority;
1236		$[2] = adjustments;
1237		$[3] = hideDraft;
1238		$[4] = open;
1239		$[5] = previewDriverPriceSettings;
1240		$[6] = t1;
1241		$[7] = t2;
1242	} else {
1243		t1 = $[6];
1244		t2 = $[7];
1245	}
1246	(0, import_react.useEffect)(t1, t2);
1247	let t3;
1248	if ($[8] !== onConfirm || $[9] !== onOpenChange) {
1249		t3 = () => {
1250			trackMethodCall("handleDeletePriceAdjustment", []);
1251			onConfirm();
1252			onOpenChange(false);
1253		};
1254		$[8] = onConfirm;
1255		$[9] = onOpenChange;
1256		$[10] = t3;
1257	} else t3 = $[10];
1258	const handleDeletePriceAdjustment = t3;
1259	let t4;
1260	if ($[11] !== adjustment || $[12] !== driverTypes) {
1261		t4 = adjustment ? formatAdjustmentAudienceSummary(adjustment, driverTypes) : "";
1262		$[11] = adjustment;
1263		$[12] = driverTypes;
1264		$[13] = t4;
1265	} else t4 = $[13];
1266	const audienceSummary = t4;
1267	let t5;
1268	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1269		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Delete Price Adjustment?" });
1270		$[14] = t5;
1271	} else t5 = $[14];
1272	const t6 = adjustment?.discountFromRetail ?? 0;
1273	let t7;
1274	if ($[15] !== t6) {
1275		t7 = t6.toFixed(2);
1276		$[15] = t6;
1277		$[16] = t7;
1278	} else t7 = $[16];
1279	let t8;
1280	if ($[17] !== t7) {
1281		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1282			className: "font-medium text-foreground",
1283			children: [
1284				"$",
1285				t7,
1286				"/gal"
1287			]
1288		});
1289		$[17] = t7;
1290		$[18] = t8;
1291	} else t8 = $[18];
1292	let t9;
1293	if ($[19] !== audienceSummary) {
1294		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1295			className: "font-medium text-foreground",
1296			children: audienceSummary
1297		});
1298		$[19] = audienceSummary;
1299		$[20] = t9;
1300	} else t9 = $[20];
1301	const t10 = adjustment?.matchedDriverCount ?? 0;
1302	let t11;
1303	if ($[21] !== t10) {
1304		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1305			className: "font-medium text-foreground",
1306			children: [t10, " drivers"]
1307		});
1308		$[21] = t10;
1309		$[22] = t11;
1310	} else t11 = $[22];
1311	let t12;
1312	if ($[23] !== t11 || $[24] !== t8 || $[25] !== t9) {
1313		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1314			"Delete the ",
1315			t8,
1316			" adjustment for ",
1317			t9,
1318			"? This adjustment currently applies to ",
1319			t11,
1320			"."
1321		] });
1322		$[23] = t11;
1323		$[24] = t8;
1324		$[25] = t9;
1325		$[26] = t12;
1326	} else t12 = $[26];
1327	const t13 = needsFurtherResolution && " Deleting this adjustment may require you to resolve other price conflicts before saving.";
1328	let t14;
1329	if ($[27] !== t13) {
1330		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["After you save changes, their prices will be recalculated using the remaining settings.", t13] });
1331		$[27] = t13;
1332		$[28] = t14;
1333	} else t14 = $[28];
1334	let t15;
1335	if ($[29] !== t12 || $[30] !== t14) {
1336		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogHeader, { children: [t5, /* @__P
1336URE__ */ (0, import_jsx_runtime.jsxs)(DialogDescription, {
1337			className: "flex flex-col gap-2",
1338			children: [t12, t14]
1339		})] });
1340		$[29] = t12;
1341		$[30] = t14;
1342		$[31] = t15;
1343	} else t15 = $[31];
1344	let t16;
1345	if ($[32] !== onOpenChange) {
1346		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1347			variant: "outline",
1348			onClick: () => onOpenChange(false),
1349			children: "Cancel"
1350		});
1351		$[32] = onOpenChange;
1352		$[33] = t16;
1353	} else t16 = $[33];
1354	let t17;
1355	if ($[34] !== handleDeletePriceAdjustment) {
1356		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1357			variant: "destructive",
1358			onClick: handleDeletePriceAdjustment,
1359			children: "Delete Adjustment"
1360		});
1361		$[34] = handleDeletePriceAdjustment;
1362		$[35] = t17;
1363	} else t17 = $[35];
1364	let t18;
1365	if ($[36] !== t16 || $[37] !== t17) {
1366		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [t16, t17] });
1367		$[36] = t16;
1368		$[37] = t17;
1369		$[38] = t18;
1370	} else t18 = $[38];
1371	let t19;
1372	if ($[39] !== t15 || $[40] !== t18) {
1373		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { children: [t15, t18] });
1374		$[39] = t15;
1375		$[40] = t18;
1376		$[41] = t19;
1377	} else t19 = $[41];
1378	let t20;
1379	if ($[42] !== onOpenChange || $[43] !== open || $[44] !== t19) {
1380		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
1381			open,
1382			onOpenChange,
1383			children: t19
1384		});
1385		$[42] = onOpenChange;
1386		$[43] = open;
1387		$[44] = t19;
1388		$[45] = t20;
1389	} else t20 = $[45];
1390	return t20;
1391};
1392function _temp$3(rule_0) {
1393	return rule_0.needsResolution;
1394}
1395var import_compiler_runtime$3 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1396const FuelNetworkPriceAdjustmentCard = (t0) => {
1397	const $ = (0, import_compiler_runtime$3.c)(38);
1398	const { driverTypes, driverGroups, hasDriverGroup, hideDraft, adjustments, adjustmentPriority, retailPrice, onSaveAdjustment, onDeleteAdjustment } = t0;
1399	const [dialogOpen, setDialogOpen] = (0, import_react.useState)(false);
1400	const [editingIndex, setEditingIndex] = (0, import_react.useState)();
1401	const [deletingIndex, setDeletingIndex] = (0, import_react.useState)();
1402	const [dialogInstanceKey, setDialogInstanceKey] = (0, import_react.useState)(0);
1403	let t1;
1404	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1405		t1 = () => {
1406			trackMethodCall("handleAddPriceAdjustment", []);
1407			setEditingIndex(void 0);
1408			setDialogInstanceKey(_temp$2);
1409			setDialogOpen(true);
1410		};
1411		$[0] = t1;
1412	} else t1 = $[0];
1413	const handleAddPriceAdjustment = t1;
1414	let t2;
1415	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1416		t2 = (index) => {
1417			trackMethodCall("handleEditPriceAdjustment", [index]);
1418			setEditingIndex(index);
1419			setDialogInstanceKey(_temp2$2);
1420			setDialogOpen(true);
1421		};
1422		$[1] = t2;
1423	} else t2 = $[1];
1424	const handleEditPriceAdjustment = t2;
1425	let t3;
1426	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1427		t3 = (index_0) => {
1428			trackMethodCall("handleOpenDeletePriceAdjustmentDialog", [index_0]);
1429			setDeletingIndex(index_0);
1430		};
1431		$[2] = t3;
1432	} else t3 = $[2];
1433	const handleOpenDeletePriceAdjustmentDialog = t3;
1434	let t4;
1435	if ($[3] !== onSaveAdjustment) {
1436		t4 = (nextAdjustments, nextAdjustmentPriority, valid) => {
1437			trackMethodCall("handleSaveInPriceAdjustmentDialog", [
1438				nextAdjustments,
1439				nextAdjustmentPriority,
1440				valid
1441			]);
1442			onSaveAdjustment(nextAdjustments, nextAdjustmentPriority, valid);
1443		};
1444		$[3] = onSaveAdjustment;
1445		$[4] = t4;
1446	} else t4 = $[4];
1447	const handleSaveInPriceAdjustmentDialog = t4;
1448	let t5;
1449	if ($[5] !== deletingIndex || $[6] !== onDeleteAdjustment) {
1450		t5 = () => {
1451			trackMethodCall("handleDeletePriceAdjustment", []);
1452			if (deletingIndex === void 0) return;
1453			onDeleteAdjustment(deletingIndex);
1454			setDeletingIndex(void 0);
1455		};
1456		$[5] = deletingIndex;
1457		$[6] = onDeleteAdjustment;
1458		$[7] = t5;
1459	} else t5 = $[7];
1460	const handleDeletePriceAdjustment = t5;
1461	let t6;
1462	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1463		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1464			className: "flex flex-1 flex-col gap-1 text-sm",
1465			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1466				className: "font-semibold text-accent-foreground",
1467				children: "Show adjusted in-network price"
1468			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1469				className: "text-muted-foreground",
1470				children: "Selected drivers see a configured discount from retail instead of the full in-network price."
1471			})]
1472		});
1473		$[8] = t6;
1474	} else t6 = $[8];
1475	let t7;
1476	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1477		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1478			className: "flex flex-col items-start gap-4 rounded-2xs bg-muted/50 p-5 lg:flex-row",
1479			children: [t6, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
1480				variant: "outline",
1481				onClick: handleAddPriceAdjustment,
1482				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, {
1483					className: "size-4",
1484					"aria-hidden": true
1485				}), "Add Price Adjustment"]
1486			})]
1487		});
1488		$[9] = t7;
1489	} else t7 = $[9];
1490	let t8;
1491	if ($[10] !== adjustmentPriority || $[11] !== adjustments || $[12] !== driverTypes) {
1492		t8 = adjustments.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, {
1493			className: "border-0 p-5",
1494			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, {
1495				className: "gap-3",
1496				children: [
1497					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, {
1498						variant: "default",
1499						className: "size-25",
1500						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(empty_price_adjustments_default, {})
1501					}),
1502					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { children: "No Price Adjustments" }),
1503					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { children: "Drivers see the full in-network price unless they match Hide in-network price." })
1504				]
1505			})
1506		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableContainer, {
1507			className: "px-5",
1508			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table, {
1509				className: "lg:table-fixed",
1510				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, { children: [
1511					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
1512						className: "uppercase",
1513						children: "Driver Types"
1514					}),
1515					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
1516						className: "uppercase",
1517						children: "Driver Groups"
1518					}),
1519					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
1520						className: "uppercase lg:w-56",
1521						children: "Discount From Retail"
1522					}),
1523					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, { className: "lg:w-20" })
1524				] }) }
1524), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, { children: adjustments.map((adjustment, index_1) => {
1525					const priorityLabel = getPriorityAppliedLabel(adjustment, adjustments, adjustmentPriority);
1526					const overlapLabel = getOverlapStatusLabel(adjustment);
1527					return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, { children: [
1528						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1529							className: "flex min-w-0 flex-col gap-0.5",
1530							children: [adjustment.driverTypeCodes.length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
1531								asChild: true,
1532								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1533									className: "cursor-default truncate font-medium",
1534									children: formatDriverTypeNames(adjustment.driverTypeCodes, driverTypes)
1535								})
1536							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: adjustment.driverTypeCodes.map((code) => {
1537								return driverTypes.find((d) => d.code === code)?.name;
1538							}).filter(Boolean).join("; ") })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1539								className: "truncate font-medium",
1540								children: adjustment.driverTypeCodes.length > 0 ? formatDriverTypeNames(adjustment.driverTypeCodes, driverTypes) : "Any driver type"
1541							}), priorityLabel === "Type priority applied" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1542								className: "text-xs text-muted-foreground",
1543								children: priorityLabel
1544							})]
1545						}) }),
1546						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1547							className: "flex min-w-0 flex-col gap-0.5",
1548							children: [adjustment.groups.length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
1549								asChild: true,
1550								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1551									className: "cursor-default truncate font-medium",
1552									children: formatGroupNames(adjustment.groups)
1553								})
1554							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: adjustment.groups.map(_temp3).join("; ") })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1555								className: "truncate font-medium",
1556								children: adjustment.groups.length > 0 ? formatGroupNames(adjustment.groups) : "Any driver group"
1557							}), priorityLabel === "Group priority applied" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1558								className: "text-xs text-muted-foreground",
1559								children: priorityLabel
1560							})]
1561						}) }),
1562						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1563							className: "flex flex-col gap-0.5",
1564							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1565								className: "font-medium",
1566								children: `Retail - $${(adjustment.discountFromRetail ?? 0).toFixed(2)}/gal`
1567							}), overlapLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1568								className: adjustment.needsResolution ? "text-xs text-destructive" : "text-xs text-muted-foreground",
1569								children: overlapLabel
1570							})]
1571						}) }),
1572						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1573							className: "flex items-center justify-end gap-1",
1574							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1575								variant: "ghost",
1576								size: "icon",
1577								"aria-label": "Edit price adjustment",
1578								onClick: () => handleEditPriceAdjustment(index_1),
1579								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pencil, {
1580									className: "size-4",
1581									"aria-hidden": true
1582								})
1583							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1584								variant: "ghost",
1585								size: "icon",
1586								"aria-label": "Delete price adjustment",
1587								onClick: () => handleOpenDeletePriceAdjustmentDialog(index_1),
1588								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, {
1589									className: "size-4",
1590									"aria-hidden": true
1591								})
1592							})]
1593						}) })
1594					] }, adjustment.id ?? `draft-${index_1}`);
1595				}) })]
1596			})
1597		});
1598		$[10] = adjustmentPriority;
1599		$[11] = adjustments;
1600		$[12] = driverTypes;
1601		$[13] = t8;
1602	} else t8 = $[13];
1603	let t9;
1604	if ($[14] !== adjustments || $[15] !== dialogInstanceKey || $[16] !== dialogOpen || $[17] !== driverGroups || $[18] !== driverTypes || $[19] !== editingIndex || $[20] !== handleSaveInPriceAdjustmentDialog || $[21] !== hasDriverGroup || $[22] !== hideDraft || $[23] !== retailPrice) {
1605		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkPriceAdjustmentDialog, {
1606			open: dialogOpen,
1607			onOpenChange: setDialogOpen,
1608			driverTypes,
1609			driverGroups,
1610			hasDriverGroup,
1611			hideDraft,
1612			existingAdjustments: adjustments,
1613			editingIndex,
1614			retailPrice,
1615			onSave: handleSaveInPriceAdjustmentDialog
1616		}, dialogInstanceKey);
1617		$[14] = adjustments;
1618		$[15] = dialogInstanceKey;
1619		$[16] = dialogOpen;
1620		$[17] = driverGroups;
1621		$[18] = driverTypes;
1622		$[19] = editingIndex;
1623		$[20] = handleSaveInPriceAdjustmentDialog;
1624		$[21] = hasDriverGroup;
1625		$[22] = hideDraft;
1626		$[23] = retailPrice;
1627		$[24] = t9;
1628	} else t9 = $[24];
1629	const t10 = deletingIndex !== void 0;
1630	let t11;
1631	if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
1632		t11 = (open) => !open && setDeletingIndex(void 0);
1633		$[25] = t11;
1634	} else t11 = $[25];
1635	const t12 = deletingIndex !== void 0 ? adjustments[deletingIndex] : void 0;
1636	let t13;
1637	if ($[26] !== adjustmentPriority || $[27] !== adjustments || $[28] !== driverTypes || $[29] !== handleDeletePriceAdjustment || $[30] !== hideDraft || $[31] !== t10 || $[32] !== t12) {
1638		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkPriceAdjustmentDeleteDialog, {
1639			open: t10,
1640			onOpenChange: t11,
1641			adjustment: t12,
1642			driverTypes,
1643			hideDraft,
1644			adjustments,
1645			adjustmentPriority,
1646			onConfirm: handleDeletePriceAdjustment
1647		});
1648		$[26] = adjustmentPriority;
1649		$[27] = adjustments;
1650		$[28] = driverTypes;
1651		$[29] = handleDeletePriceAdjustment;
1652		$[30] = hideDraft;
1653		$[31] = t10;
1654		$[32] = t12;
1655		$[33] = t13;
1656	} else t13 = $[33];
1657	let t14;
1658	if ($[34] !== t13 || $[35] !== t8 || $[36] !== t9) {
1659		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1660			className: "flex w-full flex-col overflow-hidden rounded-xl border border-border",
1661			children: [
1662				t7,
1663				t8,
1664				t9,
1665				t13
1666			]
1667		});
1668		$[34] = t13;
1669		$[35] = t8;
1670		$[36] = t9;
1671		$[37] = t14;
1672	} else t14 = $[37];
1673	return t14;
1674};
1675function _temp$2(prev) {
1676	return prev + 1;
1677}
1678function _temp2$2(prev_0) {
1679	return prev_0 + 1;
1680}
1681function _temp3(g) {
1682	return g.name;
1683}
1684var import_compiler_runtime$2 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1685const FuelNetworkInNetworkPriceSettings = (t0) => {
1686	const $ = (0, import_compiler_runtime$2.c)(21);
1687	const { driverTypes, driverGroups, hasDriverGroup, retailPrice, hideDraft, onHideDraftChange, adjustments, adjustmentPriority, onSaveAdjustment, onDeleteAdjustment } = t0;
1688	let t1;
1689	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1690		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1691			className: "flex flex-col gap-1",
1692			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
1693				className: "text-lg font-semibold text-accent-foreground",
1694				children: "Driver In-network Price Settings"
1695			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1696				className: "text-sm text-muted-foreground",
1697				children: "Control how selected drivers see your fleet's in-network fuel prices."
1698			})]
1699		});
1700		$[0] = t1;
1701	} else t1 = $[0];
1702	let t2;
1703	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1704		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
1705			variant: "info",
1706			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { "aria-hidden": true }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDescription, {
1707				className: "font-medium text-foreground",
1708				children: "Drivers not included in these settings continue seeing the full in-network price."
1709			})]
1710		});
1711		$[1] = t2;
1712	} else t2 = $[1];
1713	let t3;
1714	if ($[2] !== driverGroups || $[3] !== driverTypes || $[4] !== hasDriverGroup || $[5] !== hideDraft || $[6] !== onHideDraftChange) {
1715		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkHideInNetworkPriceCard, {
1716			driverTypes,
1717			driverGroups,
1718			hasDriverGroup,
1719			value: hideDraft,
1720			onChange: onHideDraftChange
1721		});
1722		$[2] = driverGroups;
1723		$[3] = driverTypes;
1724		$[4] = hasDriverGroup;
1725		$[5] = hideDraft;
1726		$[6] = onHideDraftChange;
1727		$[7] = t3;
1728	} else t3 = $[7];
1729	let t4;
1730	if ($[8] !== adjustmentPriority || $[9] !== adjustments || $[10] !== driverGroups || $[11] !== driverTypes || $[12] !== hasDriverGroup || $[13] !== hideDraft || $[14] !== onDeleteAdjustment || $[15] !== onSaveAdjustment || $[16] !== retailPrice) {
1731		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkPriceAdjustmentCard, {
1732			driverTypes,
1733			driverGroups,
1734			hasDriverGroup,
1735			hideDraft,
1736			adjustments,
1737			adjustmentPriority,
1738			retailPrice,
1739			onSaveAdjustment,
1740			onDeleteAdjustment
1741		});
1742		$[8] = adjustmentPriority;
1743		$[9] = adjustments;
1744		$[10] = driverGroups;
1745		$[11] = driverTypes;
1746		$[12] = hasDriverGroup;
1747		$[13] = hideDraft;
1748		$[14] = onDeleteAdjustment;
1749		$[15] = onSaveAdjustment;
1750		$[16] = retailPrice;
1751		$[17] = t4;
1752	} else t4 = $[17];
1753	let t5;
1754	if ($[18] !== t3 || $[19] !== t4) {
1755		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1756			className: "flex w-full flex-col gap-4 lg:w-200",
1757			children: [
1758				t1,
1759				t2,
1760				t3,
1761				t4
1762			]
1763		});
1764		$[18] = t3;
1765		$[19] = t4;
1766		$[20] = t5;
1767	} else t5 = $[20];
1768	return t5;
1769};
1770var import_compiler_runtime$1 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1771var EMPTY_HIDE_DRAFT = {
1772	driverTypeCodes: [],
1773	groupIds: []
1774};
1775const useDriverInNetworkPriceSettings = () => {
1776	const $ = (0, import_compiler_runtime$1.c)(54);
1777	const { data: audiencesResponse, isLoading: isAudiencesLoading } = useGetDriverAudiencesQuery();
1778	const { data: settingsResponse, isLoading: isSettingsLoading } = useGetDriverPriceSettingsQuery();
1779	const { data: dieselAvgPriceResponse } = useGetDieselAvgPriceQuery();
1780	const [previewDriverPriceSettings] = usePreviewDriverPriceSettingsMutation();
1781	const [saveDriverPriceSettings, t0] = useSaveDriverPriceSettingsMutation();
1782	const { isLoading: isSavingDriverPriceSettings } = t0;
1783	let t1;
1784	if ($[0] !== audiencesResponse?.data.driverTypes) {
1785		t1 = audiencesResponse?.data.driverTypes ?? [];
1786		$[0] = audiencesResponse?.data.driverTypes;
1787		$[1] = t1;
1788	} else t1 = $[1];
1789	const driverTypes = t1;
1790	let t2;
1791	if ($[2] !== audiencesResponse?.data.driverGroups) {
1792		t2 = audiencesResponse?.data.driverGroups ?? [];
1793		$[2] = audiencesResponse?.data.driverGroups;
1794		$[3] = t2;
1795	} else t2 = $[3];
1796	const driverGroups = t2;
1797	const hasDriverGroup = audiencesResponse?.data.hasDriverGroup ?? false;
1798	const retailPrice = dieselAvgPriceResponse?.data.dieselAvgPrice;
1799	const [hideDraft, setHideDraft] = (0, import_react.useState)(EMPTY_HIDE_DRAFT);
1800	let t3;
1801	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1802		t3 = [];
1803		$[4] = t3;
1804	} else t3 = $[4];
1805	const [adjustments, setAdjustments] = (0, import_react.useState)(t3);
1806	const [adjustmentPriority, setAdjustmentPriority] = (0, import_react.useState)("");
1807	const [isDraftInitialized, setIsDraftInitialized] = (0, import_react.useState)(false);
1808	const [isDraftValid, setIsDraftValid] = (0, import_react.useState)(true);
1809	const [isPreviewPending, setIsPreviewPending] = (0, import_react.useState)(false);
1810	const [initialDraftPayloadKey, setInitialDraftPayloadKey] = (0, import_react.useState)(null);
1811	let t4;
1812	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1813		t4 = [];
1814		$[5] = t4;
1815	} else t4 = $[5];
1816	const [baselineAdjustments, setBaselineAdjustments] = (0, import_react.useState)(t4);
1817	const [baselineIsDraftValid, setBaselineIsDraftValid] = (0, import_react.useState)(true);
1818	const [savedDraftPayloadKey, setSavedDraftPayloadKey] = (0, import_react.useState)(null);
1819	let t5;
1820	let t6;
1821	if ($[6] !== isDraftInitialized || $[7] !== settingsResponse) {
1822		t5 = () => {
1823			if (!settingsResponse || isDraftInitialized) return;
1824			const initialHide = {
1825				driverTypeCodes: settingsResponse.data.hide.driverTypeCodes ?? [],
1826				groupIds: settingsResponse.data.hide.groupIds ?? []
1827			};
1828			const initialAdjustments = settingsResponse.data.adjustments.map(_temp$1);
1829			const initialAdjustmentPriority = settingsResponse.data.adjustmentPriority ?? "";
1830			const initialPayloadKey = JSON.stringify({
1831				hide: initialHide,
1832				adjustments: initialAdjustments.map(toAdjustmentDraft),
1833				adjustmentPriority: initialAdjustmentPriority || void 0
1834			});
1835			setHideDraft(initialHide);
1836			setAdjustments(initialAdjustments);
1837			setAdjustmentPriority(initialAdjustmentPriority);
1838			setInitialDraftPayloadKey(initialPayloadKey);
1839			setSavedDraftPayloadKey(initialPayloadKey);
1840			const hasUnresolvedRule = initialAdjustments.some(_temp2$1);
1841			const isMissingRequiredPriority = settingsResponse.data.adjustmentPriorityRequired && !initialAdjustmentPriority;
1842			const initialIsDraftValid = !hasUnresolvedRule && !isMissingRequiredPriority;
1843			setIsDraftValid(initialIsDraftValid);
1844			setBaselineAdjustments(initialAdjustments);
1845			setBaselineIsDraftValid(initialIsDraftValid);
1846			setIsDraftInitialized(true);
1847		};
1848		t6 = [settingsResponse, isDraftInitialized];
1849		$[6] = isDraftInitialized;
1850		$[7] = settingsResponse;
1851		$[8] = t5;
1852		$[9] = t6;
1853	} else {
1854		t5 = $[8];
1855		t6 = $[9];
1856	}
1857	(0, import_react.useEffect)(t5, t6);
1858	let t7;
1859	if ($[10] !== adjustments) {
1860		t7 = adjustments.map(toAdjustmentDraft);
1861		$[10] = adjustments;
1862		$[11] = t7;
1863	} else t7 = $[11];
1864	const t8 = adjustmentPriority || void 0;
1865	let t9;
1866	if ($[12] !== hideDraft || $[13] !== t7 || $[14] !== t8) {
1867		t9 = {
1868			hide: hideDraft,
1869			adjustments: t7,
1870			adjustmentPriority: t8
1871		};
1872		$[12] = hideDraft;
1873		$[13] = t7;
1874		$[14] = t8;
1875		$[15] = t9;
1876	} else t9 = $[15];
1877	const draftPayload = t9;
1878	let t10;
1879	if ($[16] !== draftPayload) {
1880		t10 = JSON.stringify(draftPayload);
1881		$[16] = draftPayload;
1882		$[17] = t10;
1883	} else t10 = $[17];
1884	const draftPayloadKey = t10;
1885	let t11;
1886	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
1887		t11 = { wait: 400 };
1888		$[18] = t11;
1889	} else t11 = $[18];
1890	const debouncedDraftPayloadKey = useDebounce_default(draftPayloadKey, t11);
1891	let t12;
1892	if ($[19] !== baselineAdjustments || $[20] !== baselineIsDraftValid || $[21] !== debouncedDraftPayloadKey || $[22] !== draftPayload || $[23] !== driverGroups || $[24] !== initialDraftPayloadKey || $[25] !== isDraftInitialized || $[26] !== previewDriverPriceSettings) {
1893		t12 = () => {
1894			if (!isDraftInitialized) return;
1895			if (debouncedDraftPayloadKey === initialDraftPayloadKey) {
1896				setIsDraftValid(baselineIsDraftValid);
1897				setAdjustments(baselineAdjustments);
1898				return;
1899			}
1900			setIsPreviewPending(true);
1901			previewDriverPriceSettings(draftPayload).unwrap().then((result) => {
1902				setIsDraftValid(result.data.valid);
1903				setAdjustments((prev) => prev.map((rule_1, index) => {
1904					const echoedRule = result.data.adjustments.find((candidate) => candidate.ruleIndex === index);
1905					return echoedRule ? normalizeAdjustmentRule({
1906						...rule_1,
1907						...echoedRule
1908					}, driverGroups) : rule_1;
1909				}));
1910			}).catch(() => setIsDraftValid(false)).finally(() => setIsPreviewPending(false));
1911		};
1912		$[19] = baselineAdjustments;
1913		$[20] = baselineIsDraftValid;
1914		$[21] = debouncedDraftPayloadKey;
1915		$[22] = draftPayload;
1916		$[23] = driverGroups;
1917		$[24] = initialDraftPayloadKey;
1918		$[25] = isDraftInitialized;
1919		$[26] = previewDriverPriceSettings;
1920		$[27] = t12;
1921	} else t12 = $[27];
1922	let t13;
1923	if ($[28] !== debouncedDraftPayloadKey) {
1924		t13 = [debouncedDraftPayloadKey];
1925		$[28] = debouncedDraftPayloadKey;
1926		$[29] = t13;
1927	} else t13 = $[29];
1928	(0, import_react.useEffect)(t12, t13);
1929	let t14;
1930	if ($[30] !== hideDraft) {
1931		t14 = (nextAdjustments, nextAdjustmentPriority, valid) => {
1932			trackMethodCall("handleSaveAdjustment", [
1933				nextAdjustments,
1934				nextAdjustmentPriority,
1935				valid
1936			]);
1937			setAdjustments(nextAdjustments);
1938			setAdjustmentPriority(nextAdjustmentPriority);
1939			setIsDraftValid(valid);
1940			setBaselineAdjustments(nextAdjustments);
1941			setBaselineIsDraftValid(valid);
1942			setInitialDraftPayloadKey(JSON.stringify({
1943				hide: hideDraft,
1944				adjustments: nextAdjustments.map(toAdjustmentDraft),
1945				adjustmentPriority: nextAdjustmentPriority || void 0
1946			}));
1947		};
1948		$[30] = hideDraft;
1949		$[31] = t14;
1950	} else t14 = $[31];
1951	const handleSaveAdjustment = t14;
1952	let t15;
1953	if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
1954		t15 = (index_0) => {
1955			trackMethodCall("handleDeleteAdjustment", [index_0]);
1956			setAdjustments((prev_0) => prev_0.filter((_, existingIndex) => existingIndex !== index_0));
1957		};
1958		$[32] = t15;
1959	} else t15 = $[32];
1960	const handleDeleteAdjustment = t15;
1961	let t16;
1962	if ($[33] !== adjustmentPriority || $[34] !== adjustments || $[35] !== driverGroups || $[36] !== hideDraft || $[37] !== saveDriverPriceSettings) {
1963		t16 = async () => {
1964			const result_0 = await saveDriverPriceSettings({
1965				hide: hideDraft,
1966				adjustments: adjustments.map(toAdjustmentDraft),
1967				adjustmentPriority: adjustmentPriority || void 0
1968			}).unwrap();
1969			if (result_0.data.valid) {
1970				const savedAdjustments = result_0.data.adjustments.map((rule_2) => normalizeAdjustmentRule(rule_2, driverGroups));
1971				const savedPayloadKey = JSON.stringify({
1972					hide: hideDraft,
1973					adjustments: savedAdjustments.map(toAdjustmentDraft),
1974					adjustmentPriority: adjustmentPriority || void 0
1975				});
1976				setAdjustments(savedAdjustments);
1977				setBaselineAdjustments(savedAdjustments);
1978				setBaselineIsDraftValid(true);
1979				setInitialDraftPayloadKey(savedPayloadKey);
1980				setSavedDraftPayloadKey(savedPayloadKey);
1981			}
1982			return result_0.data.valid;
1983		};
1984		$[33] = adjustmentPriority;
1985		$[34] = adjustments;
1986		$[35] = driverGroups;
1987		$[36] = hideDraft;
1988		$[37] = saveDriverPriceSettings;
1989		$[38] = t16;
1990	} else t16 = $[38];
1991	const saveDraftAdjustments = t16;
1992	const t17 = isAudiencesLoading || isSettingsLoading || !isDraftInitialized;
1993	const t18 = isDraftInitialized && !isPreviewPending && isDraftValid;
1994	const t19 = isDraftInitialized && draftPayloadKey !== savedDraftPayloadKey;
1995	let t20;
1996	if ($[39] !== adjustmentPriority || $[40] !== adjustments || $[41] !== driverGroups || $[42] !== driverTypes || $[43] !== handleSaveAdjustment || $[44] !== hasDriverGroup || $[45] !== hideDraft || $[46] !== isPreviewPending || $[47] !== isSavingDriverPriceSettings || $[48] !== retailPrice || $[49] !== saveDraftAdjustments || $[50] !== t17 || $[51] !== t18 || $[52] !== t19) {
1997		t20 = {
1998			driverTypes,
1999			driverGroups,
2000			hasDriverGroup,
2001			retailPrice,
2002			hideDraft,
2003			setHideDraft,
2004			adjustments,
2005			adjustmentPriority,
2006			handleSaveAdjustment,
2007			handleDeleteAdjustment,
2008			saveDraftAdjustments,
2009			isLoading: t17,
2010			isSaving: isSavingDriverPriceSettings,
2011			isValid: t18,
2012			isValidating: isPreviewPending,
2013			hasChanges: t19
2014		};
2015		$[39] = adjustmentPriority;
2016		$[40] = adjustments;
2017		$[41] = driverGroups;
2018		$[42] = driverTypes;
2019		$[43] = handleSaveAdjustment;
2020		$[44] = hasDriverGroup;
2021		$[45] = hideDraft;
2022		$[46] = isPreviewPending;
2023		$[47] = isSavingDriverPriceSettings;
2024		$[48] = retailPrice;
2025		$[49] = saveDraftAdjustments;
2026		$[50] = t17;
2027		$[51] = t18;
2028		$[52] = t19;
2029		$[53] = t20;
2030	} else t20 = $[53];
2031	return t20;
2032};
2033function _temp$1(rule) {
2034	return normalizeAdjustmentRule(rule);
2035}
2036function _temp2$1(rule_0) {
2037	return rule_0.needsResolution;
2038}
2039var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime());
2040var FuelNetworkSettings = () => {
2041	const $ = (0, import_compiler_runtime.c)(51);
2042	const navigate = useNavigate();
2043	const { data: settingsResponse, isLoading } = useGetFuelNetworkSettingsQuery();
2044	const [updateSetting, t0] = useUpdateFuelNetworkSettingMutation();
2045	const { isLoading: isSaving } = t0;
2046	const driverPriceSettings = useDriverInNetworkPriceSettings();
2047	let t1;
2048	if ($[0] !== settingsResponse?.data) {
2049		t1 = settingsResponse?.data ?? [];
2050		$[0] = settingsResponse?.data;
2051		$[1] = t1;
2052	} else t1 = $[1];
2053	const settings = t1;
2054	let t2;
2055	if ($[2] !== settings) {
2056		t2 = settings.find(_temp);
2057		$[2] = settings;
2058		$[3] = t2;
2059	} else t2 = $[3];
2060	const appSetting = t2;
2061	let t3;
2062	if ($[4] !== settings) {
2063		t3 = settings.find(_temp2);
2064		$[4] = settings;
2065		$[5] = t3;
2066	} else t3 = $[5];
2067	const webSetting = t3;
2068	let t4;
2069	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
2070		t4 = {};
2071		$[6] = t4;
2072	} else t4 = $[6];
2073	const [pendingChanges, setPendingChanges] = (0, import_react.useState)(t4);
2074	let t5;
2075	if ($[7] !== pendingChanges || $[8] !== settings) {
2076		t5 = (id) => {
2077			if (id === void 0) return false;
2078			return (id in pendingChanges ? pendingChanges[id] : settings.find((s_1) => s_1.id === id)?.value ?? "OFF") === "ON";
2079		};
2080		$[7] = pendingChanges;
2081		$[8] = settings;
2082		$[9] = t5;
2083	} else t5 = $[9];
2084	const getChecked = t5;
2085	let t6;
2086	if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
2087		t6 = (id_0, checked) => {
2088			trackMethodCall("handleToggle", [id_0, checked]);
2089			if (id_0 === void 0) return;
2090			setPendingChanges((prev) => ({
2091				...prev,
2092				[id_0]: checked ? "ON" : "OFF"
2093			}));
2094		};
2095		$[10] = t6;
2096	} else t6 = $[10];
2097	const handleToggle = t6;
2098	let t7;
2099	if ($[11] !== driverPriceSettings || $[12] !== navigate || $[13] !== pendingChanges || $[14] !== settings || $[15] !== updateSetting) {
2100		t7 = async () => {
2101			trackMethodCall("handleSave", []);
2102			const changed = settings.filter((s_2) => s_2.id in pendingChanges && pendingChanges[s_2.id] !== s_2.value);
2103			try {
2104				if (changed.length > 0) {
2105					await updateSetting(changed.map((s_3) => ({
2106						id: s_3.id,
2107						value: pendingChanges[s_3.id]
2108					}
2108))).unwrap();
2109					setPendingChanges({});
2110				}
2111				if (!await driverPriceSettings.saveDraftAdjustments()) {
2112					toast.error("Some price adjustments need attention before saving.");
2113					return;
2114				}
2115				toast.success("Settings saved");
2116				navigate("/fuel-network");
2117			} catch {
2118				toast.error("Failed to save settings");
2119			}
2120		};
2121		$[11] = driverPriceSettings;
2122		$[12] = navigate;
2123		$[13] = pendingChanges;
2124		$[14] = settings;
2125		$[15] = updateSetting;
2126		$[16] = t7;
2127	} else t7 = $[16];
2128	const handleSave = t7;
2129	let t8;
2130	if ($[17] !== pendingChanges || $[18] !== settings) {
2131		let t9$1;
2132		if ($[20] !== pendingChanges) {
2133			t9$1 = (s_4) => s_4.id in pendingChanges && pendingChanges[s_4.id] !== s_4.value;
2134			$[20] = pendingChanges;
2135			$[21] = t9$1;
2136		} else t9$1 = $[21];
2137		t8 = settings.some(t9$1);
2138		$[17] = pendingChanges;
2139		$[18] = settings;
2140		$[19] = t8;
2141	} else t8 = $[19];
2142	const hasOutOfNetworkChanges = t8;
2143	const isSaveDisabled = isSaving || isLoading || driverPriceSettings.isSaving || driverPriceSettings.isLoading || !driverPriceSettings.isValid || !hasOutOfNetworkChanges && !driverPriceSettings.hasChanges;
2144	let t9;
2145	if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
2146		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppBreadcrumb, {});
2147		$[22] = t9;
2148	} else t9 = $[22];
2149	let t10;
2150	if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
2151		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2152			className: "mt-4 flex justify-between border-b pb-6",
2153			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2154				className: "flex items-center space-x-2",
2155				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
2156					className: "text-2xl font-semibold",
2157					children: "Fuel Network Settings"
2158				})
2159			})
2160		});
2161		$[23] = t10;
2162	} else t10 = $[23];
2163	const t11 = isLoading || driverPriceSettings.isLoading;
2164	let t12;
2165	if ($[24] !== appSetting || $[25] !== getChecked || $[26] !== isSaving || $[27] !== webSetting) {
2166		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkOutOfNetworkPriceCard, {
2167			appSetting,
2168			webSetting,
2169			getChecked,
2170			onToggle: handleToggle,
2171			disabled: isSaving
2172		});
2173		$[24] = appSetting;
2174		$[25] = getChecked;
2175		$[26] = isSaving;
2176		$[27] = webSetting;
2177		$[28] = t12;
2178	} else t12 = $[28];
2179	let t13;
2180	if ($[29] !== driverPriceSettings.adjustmentPriority || $[30] !== driverPriceSettings.adjustments || $[31] !== driverPriceSettings.driverGroups || $[32] !== driverPriceSettings.driverTypes || $[33] !== driverPriceSettings.handleDeleteAdjustment || $[34] !== driverPriceSettings.handleSaveAdjustment || $[35] !== driverPriceSettings.hasDriverGroup || $[36] !== driverPriceSettings.hideDraft || $[37] !== driverPriceSettings.retailPrice || $[38] !== driverPriceSettings.setHideDraft) {
2181		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FuelNetworkInNetworkPriceSettings, {
2182			driverTypes: driverPriceSettings.driverTypes,
2183			driverGroups: driverPriceSettings.driverGroups,
2184			hasDriverGroup: driverPriceSettings.hasDriverGroup,
2185			retailPrice: driverPriceSettings.retailPrice,
2186			hideDraft: driverPriceSettings.hideDraft,
2187			onHideDraftChange: driverPriceSettings.setHideDraft,
2188			adjustments: driverPriceSettings.adjustments,
2189			adjustmentPriority: driverPriceSettings.adjustmentPriority,
2190			onSaveAdjustment: driverPriceSettings.handleSaveAdjustment,
2191			onDeleteAdjustment: driverPriceSettings.handleDeleteAdjustment
2192		});
2193		$[29] = driverPriceSettings.adjustmentPriority;
2194		$[30] = driverPriceSettings.adjustments;
2195		$[31] = driverPriceSettings.driverGroups;
2196		$[32] = driverPriceSettings.driverTypes;
2197		$[33] = driverPriceSettings.handleDeleteAdjustment;
2198		$[34] = driverPriceSettings.handleSaveAdjustment;
2199		$[35] = driverPriceSettings.hasDriverGroup;
2200		$[36] = driverPriceSettings.hideDraft;
2201		$[37] = driverPriceSettings.retailPrice;
2202		$[38] = driverPriceSettings.setHideDraft;
2203		$[39] = t13;
2204	} else t13 = $[39];
2205	let t14;
2206	if ($[40] !== driverPriceSettings.isValidating || $[41] !== handleSave || $[42] !== isSaveDisabled) {
2207		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2208			className: "w-200",
2209			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
2210				onClick: handleSave,
2211				disabled: isSaveDisabled,
2212				loading: driverPriceSettings.isValidating,
2213				children: "Save Changes"
2214			})
2215		});
2216		$[40] = driverPriceSettings.isValidating;
2217		$[41] = handleSave;
2218		$[42] = isSaveDisabled;
2219		$[43] = t14;
2220	} else t14 = $[43];
2221	let t15;
2222	if ($[44] !== t12 || $[45] !== t13 || $[46] !== t14) {
2223		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2224			className: "mt-11 flex flex-col items-center justify-center space-y-11",
2225			children: [
2226				t12,
2227				t13,
2228				t14
2229			]
2230		});
2231		$[44] = t12;
2232		$[45] = t13;
2233		$[46] = t14;
2234		$[47] = t15;
2235	} else t15 = $[47];
2236	let t16;
2237	if ($[48] !== t11 || $[49] !== t15) {
2238		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2239			className: "flex h-full flex-col gap-6 overflow-y-auto px-5 pt-8",
2240			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2241				className: "flex flex-col",
2242				children: [
2243					t9,
2244					t10,
2245					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, {
2246						spinning: t11,
2247						children: t15
2248					})
2249				]
2250			})
2251		});
2252		$[48] = t11;
2253		$[49] = t15;
2254		$[50] = t16;
2255	} else t16 = $[50];
2256	return t16;
2257};
2258var fuel_network_settings_default = FuelNetworkSettings;
2259function _temp(s) {
2260	return s.key === "portal_show_non_pfn_fuel_price";
2261}
2262function _temp2(s_0) {
2263	return s_0.key === "driver_show_non_pfn_fuel_price";
2264}
2265export { fuel_network_settings_default as default };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.