PageSourceSearch

https://navpro.truckerpath.com/assets/address-book-import-CqY4whmI.js

js truckerpath.com collected 2026-09-24 09:45:12 UTC 65,855 bytes, 2,038 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 { t as produce } from "./vendor-redux-CLEI5hTp.js";
8import "./vendor-pdf-DksyQ9Qr.js";
9import { L as useDebounce_default, t as require_validator } from "./vendor-utils-DiM3BD4o.js";
10import "./vendor-ui-G6aSO5L-.js";
11import { n as toast } from "./dist-Bh07-69G.js";
12import { $t as Download, I as Search, Ot as Info, Un as ArrowLeft, X as PencilLine, bn as CircleCheck, qt as FileInput, v as TriangleAlert } from "./vendor-lucide-EY3Z5fcy.js";
13import { a as cn, t as Button } from "./button-BWyXpawe.js";
14import "./vendor-twilio-BWAG7uEQ.js";
15import { t as BizIcon } from "./biz-icon-BHlHk8WD.js";
16import "./ping-one-CpLVEVLd.js";
17import "./vendor-tiptap-_i5A4X7p.js";
18import "./app-storage-slice-mFVFfzPf.js";
19import { d as unformatPhone } from "./strings-dAFeDkjR.js";
20import "./vendor-date-d6_4rWHy.js";
21import "./dates-B2P7D4-n.js";
22import "./vendor-tanstack-N3AJtZOe.js";
23import { t as Spin } from "./spin-Bjb5hq6_.js";
24import { b as useForm, f as objectType, m as stringType, t } from "./vendor-form-DCqShb_y.js";
25import "./label-BU8XDazs.js";
26import { n as RadioGroupItem, t as RadioGroup } from "./radio-group-DEh2WG4M.js";
27import { l as useMap } from "./vendor-maps-1lAD1rp9.js";
28import { $ as TextareaField, X as useControllableState, Yn as trackMethodCall, _ as downloadBlob, cn as DialogFooter, d as Alert, dn as DialogTitle, in as Dialog, k as data_table_default, ln as DialogHeader, m as InputField, mr as Input, on as DialogContent, p as AlertTitle, rt as FormWrapper, un as DialogInner } from "./main-DDHJZG-i.js";
29import { t as DocumentUpload } from "./document-upload-CFFEvI8B.js";
30import "./progress-BMT-Tsbj.js";
31import { t as useGetProfileQuery } from "./profile-service-Dr5sIh12.js";
32import "./poi-od04TUaf.js";
33import { n as useGetHereOauthTokenMutation, s as useLazyRevgeocodeByLatLngQuery } from "./here-service-BnskO8xY.js";
34import { O as MapAPIProvider, _ as MapProvider, c as MAP_ELEMENT_ID, l as MapDefault } from "./marker-tQkMpDnD.js";
35import { t as POI } from "./markers-Dqkq5E8S.js";
36import { T as useParsePoiFileMutation, g as useGetLocationGroupQuery, o as useBatchImportPoiMutation, x as useLazyDownloadPoiTemplateQuery } from "./address-book-service-BvEDI2nF.js";
37import "./highlight-query-C8rGVgio.js";
38import { t as MapDefaultControls } from "./map-default-controls-Cg-QqICw.js";
39import { t as Page } from "./page-DjksvvDH.js";
40import { i as AddressBookSearch, r as AddressBookEmptyState, t as AddressBookPoiGroupItem } from "./address-book-poi-group-list-Dc1shLu6.js";
41var import_compiler_runtime$1 = /* @__PURE__ */ __toESM(require_compiler_runtime());
42var import_react = /* @__PURE__ */ __toESM(require_react());
43var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
44const StepBar = import_react.forwardRef(({ items, current: currentProp, defaultCurrent = 0, onChange, className }, ref) => {
45	const [currentIndex, setCurrentIndex] = useControllableState({
46		prop: currentProp,
47		defaultProp: defaultCurrent,
48		onChange
49	});
50	import_react.useImperativeHandle(ref, () => ({
51		next: () => {
52			if (currentIndex < items.length - 1) setCurrentIndex(currentIndex + 1);
53		},
54		back: () => {
55			if (currentIndex > 0) setCurrentIndex(currentIndex - 1);
56		},
57		get currentIndex() {
58			return currentIndex;
59		}
60	}), [
61		currentIndex,
62		items.length,
63		setCurrentIndex
64	]);
65	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
66		className: cn("flex w-full items-center", className),
67		children: items.map((item, index) => {
68			const isCompleted = index < currentIndex;
69			const isActive = index === currentIndex;
70			const isLast = index === items.length - 1;
71			return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
72				className: "flex items-center",
73				children: [isCompleted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheck, { className: "h-6 w-6 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
74					className: cn("flex h-6 w-6 items-center justify-center rounded-full border-2 text-xs font-medium transition-colors", isActive ? "border-primary bg-primary text-primary-foreground" : "border-muted-foreground text-muted-foreground"),
75					children: index + 1
76				}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
77					className: cn("ml-2 text-sm font-semibold whitespace-nowrap", isActive || isCompleted ? "text-foreground" : "text-muted-foreground"),
78					children: item.title
79				})]
80			}), !isLast && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mx-2.5 h-[1px] flex-1 rounded-full bg-border" })] }, index);
81		})
82	});
83});
84StepBar.displayName = "StepBar";
85var address_book_import_q80_default = "/assets/address-book-import.q80-BlGNZ22P.webp";
86var import_validator = /* @__PURE__ */ __toESM(require_validator());
87var parseCoordinate = (coord) => {
88	if (!coord) throw new Error("Empty coordinate");
89	const match = /^(-?\d+(\.\d+)?)\s*,\s*(-?\d+(\.\d+)?)$/.exec(coord.trim());
90	if (!match) throw new Error("Invalid coordinate format");
91	const lat = parseFloat(match[1]);
92	const lng = parseFloat(match[3]);
93	if (lat < -90 || lat > 90 || lng < -180 || lng > 180) throw new Error("Coordinate out of range");
94	return {
95		lat,
96		lng
97	};
98};
99var AddressBookImportMapPreviewInner = (t0) => {
100	const $ = (0, import_compiler_runtime$1.c)(9);
101	const { data } = t0;
102	const map = useMap(MAP_ELEMENT_ID);
103	let validMarkers;
104	if ($[0] !== data) {
105		validMarkers = [];
106		data.forEach((item, index) => {
107			try {
108				const position = parseCoordinate(item.customerCoordinate);
109				validMarkers.push({
110					id: `import-poi-${index}`,
111					type: "poi",
112					position,
113					data: {
114						type: "custom",
115						tid: 100,
116						sid: 200,
117						title: item.customerName,
118						address: [
119							item.street,
120							item.city,
121							item.state
122						].filter(Boolean).join(", "),
123						originalData: item
124					}
125				});
126			} catch {}
127		});
128		$[0] = data;
129		$[1] = validMarkers;
130	} else validMarkers = $[1];
131	const markers = validMarkers;
132	let t1;
133	let t2;
134	if ($[2] !== map || $[3] !== markers) {
135		t1 = () => {
136			if (!map || markers.length === 0) return;
137			const bounds = new google.maps.LatLngBounds();
138			markers.forEach((marker) => bounds.extend(marker.position));
139			map.fitBounds(bounds, {
140				top: 50,
141				right: 50,
142				bottom: 50,
143				left: 50
144			});
145		};
146		t2 = [map, markers];
147		$[2] = map;
148		$[3] = markers;
149		$[4] = t1;
150		$[5] = t2;
151	} else {
152		t1 = $[4];
153		t2 = $[5];
154	}
155	(0, import_react.useEffect)(t1, t2);
156	const renderMarker = _temp$1;
157	let t3;
158	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
159		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapDefaultControls, {});
160		$[6] = t3;
161	} else t3 = $[6];
162	let t4;
163	if ($[7] !== markers) {
164		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
165			className: "h-full p-5",
166			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MapDefault, {
167				className: "h-full w-full overflow-hidden rounded-sm",
168				showControlLayers: true,
169				showMapDisplay: false,
170				gestureHandling: "auto",
171				disableDefaultUI: true,
172				clickableIcons: false,
173				children: [t3, markers.map(renderMarker)]
174			})
175		});
176		$[7] = markers;
177		$[8] = t4;
178	} else t4 = $[8];
179	return t4;
180};
181const AddressBookImportMapPreview = (t0) => {
182	const $ = (0, import_compiler_runtime$1.c)(2);
183	const { data } = t0;
184	let t1;
185	if ($[0] !== data) {
186		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapAPIProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookImportMapPreviewInner, { data }) }) });
187		$[0] = data;
188		$[1] = t1;
189	} else t1 = $[1];
190	return t1;
191};
192function _temp$1(marker_0) {
193	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(POI, {
194		data: marker_0.data,
195		position: marker_0.position,
196		style: "map"
197	}, marker_0.id);
198}
199var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime());
200var STEPS = [
201	{ title: "Upload File" },
202	{ title: "Review" },
203	{ title: "Done" }
204];
205var validateCoordinate = (val) => {
206	if (!val) return true;
207	const match = /^(-?\d+(\.\d+)?)\s*,\s*(-?\d+(\.\d+)?)$/.exec(val.trim());
208	if (!match) return false;
209	const lat = parseFloat(match[1]);
210	const lon = parseFloat(match[3]);
211	return lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180;
212};
213var coordinateErrorMessage = "Invalid format or range. Expected: Lat, Lon (e.g. 40.4198, -74.1710)";
214var customerInfoSchema = objectType({
215	customerName: stringType().min(1, "Customer Name is required"),
216	city: stringType().optional(),
217	state: stringType().optional(),
218	zipCode: stringType().optional(),
219	country: stringType().optional(),
220	street: stringType().optional(),
221	customerCoordinate: stringType().min(1, "Coordinates are required").refine(validateCoordinate, { message: coordinateErrorMessage })
222});
223var EditCustomerInfoDialog = ({ open, onOpenChange, data, onSave }) => {
224	const [getHereOauthToken] = useGetHereOauthTokenMutation();
225	const [revGeocode] = useLazyRevgeocodeByLatLngQuery();
226	const form = useForm({
227		resolver: t(customerInfoSchema),
228		defaultValues: {
229			customerName: data.customerName,
230			city: data.city,
231			state: data.state,
232			zipCode: data.zipCode,
233			country: data.country,
234			street: data.street,
235			customerCoordinate: data.customerCoordinate
236		}
237	});
238	(0, import_react.useEffect)(() => {
239		if (open) form.reset({
240			customerName: data.customerName,
241			city: data.city,
242			state: data.state,
243			zipCode: data.zipCode,
244			country: data.country,
245			street: data.street,
246			customerCoordinate: data.customerCoordinate
247		});
248	}, [
249		open,
250		data,
251		form
252	]);
253	const handleSearchSelect = async (item) => {
254		trackMethodCall("handleSearchSelect", [item]);
255		const lat = item.location?.lat ?? item.position[0];
256		const lon = item.location?.lon ?? item.position[1];
257		form.setValue("customerCoordinate", `${lat.toFixed(6)}, ${lon.toFixed(6)}`, { shouldValidate: true });
258		const street = item.address || item.title;
259		form.setValue("street", street, { shouldValidate: true });
260		try {
261			const tokenResult = await getHereOauthToken({
262				time: (/* @__PURE__ */ new Date()).getTime(),
263				url: "https://geocode.search.hereapi.com/v1/geocode"
264			}).unwrap();
265			if (tokenResult.code === 200) {
266				const token = tokenResult.data.accessToken;
267				const address = (await revGeocode({
268					at: `${lat},${lon}`,
269					apiToken: token
270				}).unwrap()).items?.[0]?.address;
271				if (address) {
272					form.setValue("city", address.city || "", { shouldValidate: true });
273					form.setValue("state", address.stateCode || address.state || "", { shouldValidate: true });
274					form.setValue("zipCode", address.postalCode || "", { shouldValidate: true });
275					form.setValue("country", address.countryName || address.countryCode || "", { shouldValidate: true });
276				}
277			}
278		} catch (error) {
279			console.error("Failed to fetch address details:", error);
280		}
281	};
282	const handleSearchClear = () => {
283		trackMethodCall("handleSearchClear", []);
284		form.setValue("city", data.city, { shouldValidate: true });
285		form.setValue("state", data.state, { shouldValidate: true });
286		form.setValue("zipCode", data.zipCode, { shouldValidate: true });
287		form.setValue("country", data.country, { shouldValidate: true });
288		form.setValue("customerCoordinate", data.customerCoordinate, { shouldValidate: true });
289	};
290	const handleSaveInEditCustomerInfoDialog = (values) => {
291		trackMethodCall("handleSaveInEditCustomerInfoDialog", [values]);
292		onSave(values);
293		onOpenChange(false);
294	};
295	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
296		open,
297		onOpenChange,
298		children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
299			className: "w-[425px]",
300			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Edit Customer Info" }) }
300), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormWrapper, {
301				form,
302				onSubmit: form.handleSubmit(handleSaveInEditCustomerInfoDialog),
303				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogInner, {
304					className: "flex flex-col gap-4 px-6 py-4",
305					children: [
306						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
307							name: "customerName",
308							title: "Customer Name",
309							placeholder: "Enter customer name",
310							required: true
311						}),
312						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
313							className: "flex flex-col gap-1.5",
314							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
315								className: "text-sm font-medium",
316								children: "Search Locations"
317							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookSearch, {
318								onSelect: handleSearchSelect,
319								onClear: handleSearchClear,
320								placeholder: "Search to auto-fill",
321								defaultValue: data.street
322							})]
323						}),
324						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
325							className: "flex gap-4",
326							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
327								className: "flex-1",
328								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
329									name: "city",
330									title: "City",
331									readOnly: true,
332									className: "cursor-not-allowed opacity-50"
333								})
334							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
335								className: "flex-1",
336								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
337									name: "state",
338									title: "State",
339									readOnly: true,
340									className: "cursor-not-allowed opacity-50"
341								})
342							})]
343						}),
344						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
345							className: "flex gap-4",
346							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
347								className: "flex-1",
348								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
349									name: "zipCode",
350									title: "Zip Code",
351									readOnly: true,
352									className: "cursor-not-allowed opacity-50"
353								})
354							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
355								className: "flex-1",
356								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
357									name: "country",
358									title: "Country",
359									readOnly: true,
360									className: "cursor-not-allowed opacity-50"
361								})
362							})]
363						}),
364						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
365							name: "customerCoordinate",
366							title: "Coordinates",
367							placeholder: "lat, lon",
368							required: true
369						})
370					]
371				}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
372					variant: "outline",
373					type: "button",
374					onClick: () => {
375						return onOpenChange(false);
376					},
377					children: "Cancel"
378				}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
379					type: "submit",
380					children: "Save"
381				})] })]
382			})]
383		})
384	});
385};
386var entranceExitSchema = objectType({
387	entrance1Coordinate: stringType().optional().refine(validateCoordinate, { message: coordinateErrorMessage }),
388	entrance2Coordinate: stringType().optional().refine(validateCoordinate, { message: coordinateErrorMessage }),
389	exit1Coordinate: stringType().optional().refine(validateCoordinate, { message: coordinateErrorMessage }),
390	exit2Coordinate: stringType().optional().refine(validateCoordinate, { message: coordinateErrorMessage })
391});
392var EditEntranceExitDialog = (t0) => {
393	const $ = (0, import_compiler_runtime.c)(38);
394	const { open, onOpenChange, data, onSave } = t0;
395	let t1;
396	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
397		t1 = t(entranceExitSchema);
398		$[0] = t1;
399	} else t1 = $[0];
400	let t2;
401	if ($[1] !== data.entrance1Coordinate || $[2] !== data.entrance2Coordinate || $[3] !== data.exit1Coordinate || $[4] !== data.exit2Coordinate) {
402		t2 = {
403			resolver: t1,
404			defaultValues: {
405				entrance1Coordinate: data.entrance1Coordinate,
406				entrance2Coordinate: data.entrance2Coordinate,
407				exit1Coordinate: data.exit1Coordinate,
408				exit2Coordinate: data.exit2Coordinate
409			}
410		};
411		$[1] = data.entrance1Coordinate;
412		$[2] = data.entrance2Coordinate;
413		$[3] = data.exit1Coordinate;
414		$[4] = data.exit2Coordinate;
415		$[5] = t2;
416	} else t2 = $[5];
417	const form = useForm(t2);
418	let t3;
419	if ($[6] !== data.entrance1Coordinate || $[7] !== data.entrance2Coordinate || $[8] !== data.exit1Coordinate || $[9] !== data.exit2Coordinate || $[10] !== form || $[11] !== open) {
420		t3 = () => {
421			if (open) form.reset({
422				entrance1Coordinate: data.entrance1Coordinate,
423				entrance2Coordinate: data.entrance2Coordinate,
424				exit1Coordinate: data.exit1Coordinate,
425				exit2Coordinate: data.exit2Coordinate
426			});
427		};
428		$[6] = data.entrance1Coordinate;
429		$[7] = data.entrance2Coordinate;
430		$[8] = data.exit1Coordinate;
431		$[9] = data.exit2Coordinate;
432		$[10] = form;
433		$[11] = open;
434		$[12] = t3;
435	} else t3 = $[12];
436	let t4;
437	if ($[13] !== data || $[14] !== form || $[15] !== open) {
438		t4 = [
439			open,
440			data,
441			form
442		];
443		$[13] = data;
444		$[14] = form;
445		$[15] = open;
446		$[16] = t4;
447	} else t4 = $[16];
448	(0, import_react.useEffect)(t3, t4);
449	let t5;
450	if ($[17] !== onOpenChange || $[18] !== onSave) {
451		t5 = (values) => {
452			trackMethodCall("handleSaveInEditEntranceExitDialog", [values]);
453			onSave(values);
454			onOpenChange(false);
455		};
456		$[17] = onOpenChange;
457		$[18] = onSave;
458		$[19] = t5;
459	} else t5 = $[19];
460	const handleSaveInEditEntranceExitDialog = t5;
461	let t6;
462	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
463		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Edit Entrance / Exit" }) });
464		$[20] = t6;
465	} else t6 = $[20];
466	let t7;
467	if ($[21] !== form || $[22] !== handleSaveInEditEntranceExitDialog) {
468		t7 = form.handleSubmit(handleSaveInEditEntranceExitDialog);
469		$[21] = form;
470		$[22] = handleSaveInEditEntranceExitDialog;
471		$[23] = t7;
472	} else t7 = $[23];
473	let t8;
474	if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
475		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogInner, {
476			className: "flex flex-col gap-4 px-6 py-4",
477			children: [
478				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
479					name: "entrance1Coordinate",
480					title: "Entrance 1",
481					placeholder: "lat, lon"
482				}),
483				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
484					name: "exit1Coordinate",
485					title: "Exit 1",
486					placeholder: "lat, lon"
487				}),
488				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
489					name: "entrance2Coordinate",
490					title: "Entrance 2",
491					placeholder: "lat, lon"
492				}),
493				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
494					name: "exit2Coordinate",
495					title: "Exit 2",
496					placeholder: "lat, lon"
497				})
498			]
499		});
500		$[24] = t8;
501	} else t8 = $[24];
502	let t9;
503	if ($[25] !== onOpenChange) {
504		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
505			variant: "outline",
506			type: "button",
507			onClick: () => onOpenChange(false),
508			children: "Cancel"
509		});
510		$[25] = onOpenChange;
511		$[26] = t9;
512	} else t9 = $[26];
513	let t10;
514	if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
515		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
516			type: "submit",
517			children: "Save"
518		});
519		$[27] = t10;
520	} else t10 = $[27];
521	let t11;
522	if ($[28] !== t9) {
523		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [t9, t10] });
524		$[28] = t9;
525		$[29] = t11;
526	} else t11 = $[29];
527	let t12;
528	if ($[30] !== form || $[31] !== t11 || $[32] !== t7) {
529		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
530			className: "w-[425px]",
531			children: [t6, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormWrapper, {
532				form,
533				onSubmit: t7,
534				children: [t8, t11]
535			})]
536		});
537		$[30] = form;
538		$[31] = t11;
539		$[32] = t7;
540		$[33] = t12;
541	} else t12 = $[33];
542	let t13;
543	if ($[34] !== onOpenChange || $[35] !== open || $[36] !== t12) {
544		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
545			open,
546			onOpenChange,
547			children: t12
548		});
549		$[34] = onOpenChange;
550		$[35] = open;
551		$[36] = t12;
552		$[37] = t13;
553	} else t13 = $[37];
554	return t13;
555};
556var phoneSchema = objectType({
557	phone: stringType().min(1, "Phone Number is required").refine((val) => {
558		return (0, import_validator.isMobilePhone)(unformatPhone(val));
559	}, "Invalid phone format"),
560	extensionNumber: stringType().optional()
561});
562var EditPhoneDialog = (t0) => {
563	const $ = (0, import_compiler_runtime.c)(36);
564	const { open, onOpenChange, data, onSave } = t0;
565	let t1;
566	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
567		t1 = t(phoneSchema);
568		$[0] = t1;
569	} else t1 = $[0];
570	let t2;
571	if ($[1] !== data.extensionNumber || $[2] !== data.phone) {
572		t2 = {
573			resolver: t1,
574			defaultValues: {
575				phone: data.phone,
576				extensionNumber: data.extensionNumber
577			}
578		};
579		$[1] = data.extensionNumber;
580		$[2] = data.phone;
581		$[3] = t2;
582	} else t2 = $[3];
583	const form = useForm(t2);
584	let t3;
585	if ($[4] !== data.extensionNumber || $[5] !== data.phone || $[6] !== form || $[7] !== open) {
586		t3 = () => {
587			if (open) form.reset({
588				phone: data.phone,
589				extensionNumber: data.extensionNumber
590			});
591		};
592		$[4] = data.extensionNumber;
593		$[5] = data.phone;
594		$[6] = form;
595		$[7] = open;
596		$[8] = t3;
597	} else t3 = $[8];
598	let t4;
599	if ($[9] !== data || $[10] !== form || $[11] !== open) {
600		t4 = [
601			open,
602			data,
603			form
604		];
605		$[9] = data;
606		$[10] = form;
607		$[11] = open;
608		$[12] = t4;
609	} else t4 = $[12];
610	(0, import_react.useEffect)(t3, t4);
611	let t5;
612	if ($[13] !== onOpenChange || $[14] !== onSave) {
613		t5 = (values) => {
614			trackMethodCall("handleSaveInEditPhoneDialog", [values]);
615			onSave(values);
616			onOpenChange(false);
617		};
618		$[13] = onOpenChange;
619		$[14] = onSave;
620		$[15] = t5;
621	} else t5 = $[15];
622	const handleSaveInEditPhoneDialog = t5;
623	let t6;
624	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
625		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Edit Phone" }) });
626		$[16] = t6;
627	} else t6 = $[16];
628	let t7;
629	if ($[17] !== form || $[18] !== handleSaveInEditPhoneDialog) {
630		t7 = form.handleSubmit(handleSaveInEditPhoneDialog);
631		$[17] = form;
632		$[18] = handleSaveInEditPhoneDialog;
633		$[19] = t7;
634	} else t7 = $[19];
635	let t8;
636	let t9;
637	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
638		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
639			className: "flex-1",
640			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
641				name: "phone",
642				title: "Phone Number",
643				placeholder: "Enter phone number",
644				required: true
645			})
646		});
647		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
648			className: "mt-8 text-muted-foreground",
649			children: "-"
650		});
651		$[20] = t8;
652		$[21] = t9;
653	} else {
654		t8 = $[20];
655		t9 = $[21];
656	}
657	let t10;
658	if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
659		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogInner, {
660			className: "flex flex-col gap-4 px-6 py-4",
661			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
662				className: "flex items-start gap-2",
663				children: [
664					t8,
665					t9,
666					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
667						className: "w-24",
668						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
669							name: "extensionNumber",
670							title: "",
671							placeholder: "Ext",
672							className: "mt-[26px]"
673						})
674					})
675				]
676			})
677		});
678		$[22] = t10;
679	} else t10 = $[22];
680	let t11;
681	if ($[23] !== onOpenChange) {
682		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
683			variant: "outline",
684			type: "button",
685			onClick: () => onOpenChange(false),
686			children: "Cancel"
687		});
688		$[23] = onOpenChange;
689		$[24] = t11;
690	} else t11 = $[24];
691	let t12;
692	if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
693		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
694			type: "submit",
695			children: "Save"
696		});
697		$[25] = t12;
698	} else t12 = $[25];
699	let t13;
700	if ($[26] !== t11) {
701		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [t11, t12] });
702		$[26] = t11;
703		$[27] = t13;
704	} else t13 = $[27];
705	let t14;
706	if ($[28] !== form || $[29] !== t13 || $[30] !== t7) {
707		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
708			className: "w-[425px]",
709			children: [t6, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormWrapper, {
710				form,
711				onSubmit: t7,
712				children: [t10, t13]
713			})]
714		});
715		$[28] = form;
716		$[29] = t13;
717		$[30] = t7;
718		$[31] = t14;
719	} else t14 = $[31];
720	let t15;
721	if ($[32] !== onOpenChange || $[33] !== open || $[34] !== t14) {
722		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
723			open,
724			onOpenChange,
725			children: t14
726		});
727		$[32] = onOpenChange;
728		$[33] = open;
729		$[34] = t14;
730		$[35] = t15;
731	} else t15 = $[35];
732	return t15;
733};
734var siteInstructionsSchema = objectType({ siteInstruction: stringType().optional() });
735var EditSiteInstructionsDialog = (t0) => {
736	const $ = (0, import_compiler_runtime.c)(32);
737	const { open, onOpenChange, data, onSave } = t0;
738	let t1;
739	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
740		t1 = t(siteInstructionsSchema);
741		$[0] = t1;
742	} else t1 = $[0];
743	let t2;
744	if ($[1] !== data.siteInstruction) {
745		t2 = {
746			resolver: t1,
747			defaultValues: { siteInstruction: data.siteInstruction }
748		};
749		$[1] = data.siteInstruction;
750		$[2] = t2;
751	} else t2 = $[2];
752	const form = useForm(t2);
753	let t3;
754	if ($[3] !== data.siteInstruction || $[4] !== form || $[5] !== open) {
755		t3 = () => {
756			if (open) form.reset({ siteInstruction: data.siteInstruction });
757		};
758		$[3] = data.siteInstruction;
759		$[4] = form;
760		$[5] = open;
761		$[6] = t3;
762	} else t3 = $[6];
763	let t4;
764	if ($[7] !== data || $[8] !== form || $[9] !== open) {
765		t4 = [
766			open,
767			data,
768			form
769		];
770		$[7] = data;
771		$[8] = form;
772		$[9] = open;
773		$[10] = t4;
774	} else t4 = $[10];
775	(0, import_react.useEffect)(t3, t4);
776	let t5;
777	if ($[11] !== onOpenChange || $[12] !== onSave) {
778		t5 = (values) => {
779			trackMethodCall("handleSaveInEditSiteInstructionsDialog", [values]);
780			onSave(values);
781			onOpenChange(false);
782		};
783		$[11] = onOpenChange;
784		$[12] = onSave;
785		$[13] = t5;
786	} else t5 = $[13];
787	const handleSaveInEditSiteInstructionsDialog = t5;
788	let t6;
789	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
790		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Edit Site Instructions" }) });
791		$[14] = t6;
792	} else t6 = $[14];
793	let t7;
794	if ($[15] !== form || $[16] !== handleSaveInEditSiteInstructionsDialog) {
795		t7 = form.handleSubmit(handleSaveInEditSiteInstructionsDialog);
796		$[15] = form;
797		$[16] = handleSaveInEditSiteInstructionsDialog;
798		$[17] = t7;
799	} else t7 = $[17];
800	let t8;
801	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
802		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogInner, {
803			className: "px-6 py-4",
804			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextareaField, {
805				name: "siteInstruction",
806				title: "Site Instructions",
807				placeholder: "Enter",
808				className: "h-32 resize-none"
809			})
810		});
811		$[18] = t8;
812	} else t8 = $[18];
813	let t9;
814	if ($[19] !== onOpenChange) {
815		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
816			variant: "outline",
817			type: "button",
818			onClick: () => onOpenChange(false),
819			children: "Cancel"
820		});
821		$[19] = onOpenChange;
822		$[20] = t9;
823	} else t9 = $[20];
824	let t10;
825	if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
826		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
827			type: "submit",
828			children: "Save"
829		});
830		$[21] = t10;
831	} else t10 = $[21];
832	let t11;
833	if ($[22] !== t9) {
834		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [t9, t10] });
835		$[22] = t9;
836		$[23] = t11;
837	} else t11 = $[23];
838	let t12;
839	if ($[24] !== form || $[25] !== t11 || $[26] !== t7) {
840		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
841			className: "w-[500px]",
842			children: [t6, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormWrapper, {
843				form,
844				onSubmit: t7,
845				children: [t8, t11]
846			})]
847		});
848		$[24] = form;
849		$[25] = t11;
850		$[26] = t7;
851		$[27] = t12;
852	} else t12 = $[27];
853	let t13;
854	if ($[28] !== onOpenChange || $[29] !== open || $[30] !== t12) {
855		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
856			open,
857			onOpenChange,
858			children: t12
859		});
860		$[28] = onOpenChange;
861		$[29] = open;
862		$[30] = t12;
863		$[31] = t13;
864	} else t13 = $[31];
865	return t13;
866};
867var AddToPoiGroupDialog = (t0) => {
868	const $ = (0, import_compiler_runtime.c)(46);
869	const { open, onOpenChange, onSave } = t0;
870	const [query, setQuery] = (0, import_react.useState)("");
871	let t1;
872	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
873		t1 = { wait: 500 };
874		$[0] = t1;
875	} else t1 = $[0];
876	const debouncedQuery = useDebounce_default(query, t1);
877	const [selectedId, setSelectedId] = (0, import_react.useState)("");
878	let t2;
879	if ($[1] !== debouncedQuery) {
880		t2 = {
881			page: 1,
882			size: 100,
883			input: debouncedQuery
884		};
885		$[1] = debouncedQuery;
886		$[2] = t2;
887	} else t2 = $[2];
888	const t3 = !open;
889	let t4;
890	if ($[3] !== t3) {
891		t4 = { skip: t3 };
892		$[3] = t3;
893		$[4] = t4;
894	} else t4 = $[4];
895	const { data: groupsData, isLoading } = useGetLocationGroupQuery(t2, t4);
896	let t5;
897	if ($[5] !== groupsData?.data?.content) {
898		t5 = groupsData?.data?.content ?? [];
899		$[5] = groupsData?.data?.content;
900		$[6] = t5;
901	} else t5 = $[6];
902	const groups = t5;
903	let t6;
904	let t7;
905	if ($[7] !== open) {
906		t6 = () => {
907			if (!open) {
908				setQuery("");
909				setSelectedId("");
910			}
911		};
912		t7 = [open];
913		$[7] = open;
914		$[8] = t6;
915		$[9] = t7;
916	} else {
917		t6 = $[8];
918		t7 = $[9];
919	}
920	(0, import_react.useEffect)(t6, t7);
921	let t8;
922	if ($[10] !== groups || $[11] !== onOpenChange || $[12] !== onSave || $[13] !== selectedId) {
923		t8 = () => {
924			trackMethodCall("handleAddToPoiGroup", []);
925			const selectedGroup = groups.find((g) => g.id.toString() === selectedId);
926			if (selectedGroup) onSave(selectedGroup.name);
927			onOpenChange(false);
928		};
929		$[10] = groups;
930		$[11] = onOpenChange;
931		$[12] = onSave;
932		$[13] = selectedId;
933		$[14] = t8;
934	} else t8 = $[14];
935	const handleAddToPoiGroup = t8;
936	let t9;
937	if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
938		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Add to POI Group" }) });
939		$[15] = t9;
940	} else t9 = $[15];
941	let t10;
942	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
943		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { className: "h-4 w-4 text-muted-foreground" });
944		$[16] = t10;
945	} else t10 = $[16];
946	let t11;
947	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
948		t11 = (e) => setQuery(e.target.value);
949		$[17] = t11;
950	} else t11 = $[17];
951	let t12;
952	if ($[18] !== query) {
953		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
954			className: "py-4",
955			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
956				placeholder: "Search POI group",
957				prefixIcon: t10,
958				value: query,
959				onChange: t11
960			})
961		});
962		$[18] = query;
963		$[19] = t12;
964	} else t12 = $[19];
965	let t13;
966	if ($[20] !== groups || $[21] !== isLoading || $[22] !== query || $[23] !== selectedId) {
967		t13 = groups.length === 0 && !isLoading ? query.trim() ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookEmptyState, {
968			icon: "empty-poi",
969			title: "No matching POI Groups found",
970			description: "Check your search for any spelling errors, or try a different search term."
971		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookEmptyState, {
972			icon: "empty-poi",
973			title: "No POI group listed",
974			description: "All of your POI groups will appear here."
975		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup, {
976			value: selectedId,
977			onValueChange: setSelectedId,
978			className: "gap-0",
979			children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
980				htmlFor: `group-${group.id}`,
981				className: cn("flex cursor-pointer items-center gap-4 border-b p-4 pt-3.5 last:border-0", selectedId === group.id.toString() && "bg-accent/50"),
982				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItem, {
983					value: group.id.toString(),
984					id: `group-${group.id}`
985				}
985), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookPoiGroupItem, {
986					name: group.name,
987					placeNumber: group.placeNumber,
988					description: group.description
989				})]
990			}, group.id))
991		});
992		$[20] = groups;
993		$[21] = isLoading;
994		$[22] = query;
995		$[23] = selectedId;
996		$[24] = t13;
997	} else t13 = $[24];
998	let t14;
999	if ($[25] !== isLoading || $[26] !== t13) {
1000		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1001			className: "h-[388px] overflow-y-auto",
1002			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, {
1003				spinning: isLoading,
1004				children: t13
1005			})
1006		});
1007		$[25] = isLoading;
1008		$[26] = t13;
1009		$[27] = t14;
1010	} else t14 = $[27];
1011	let t15;
1012	if ($[28] !== t12 || $[29] !== t14) {
1013		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogInner, {
1014			className: "px-6 py-0",
1015			children: [t12, t14]
1016		});
1017		$[28] = t12;
1018		$[29] = t14;
1019		$[30] = t15;
1020	} else t15 = $[30];
1021	let t16;
1022	if ($[31] !== onOpenChange) {
1023		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1024			variant: "outline",
1025			onClick: () => onOpenChange(false),
1026			children: "Cancel"
1027		});
1028		$[31] = onOpenChange;
1029		$[32] = t16;
1030	} else t16 = $[32];
1031	const t17 = !selectedId;
1032	let t18;
1033	if ($[33] !== handleAddToPoiGroup || $[34] !== t17) {
1034		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1035			onClick: handleAddToPoiGroup,
1036			disabled: t17,
1037			children: "Save"
1038		});
1039		$[33] = handleAddToPoiGroup;
1040		$[34] = t17;
1041		$[35] = t18;
1042	} else t18 = $[35];
1043	let t19;
1044	if ($[36] !== t16 || $[37] !== t18) {
1045		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, {
1046			className: "px-5 py-4",
1047			children: [t16, t18]
1048		});
1049		$[36] = t16;
1050		$[37] = t18;
1051		$[38] = t19;
1052	} else t19 = $[38];
1053	let t20;
1054	if ($[39] !== t15 || $[40] !== t19) {
1055		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
1056			className: "w-[500px]",
1057			children: [
1058				t9,
1059				t15,
1060				t19
1061			]
1062		});
1063		$[39] = t15;
1064		$[40] = t19;
1065		$[41] = t20;
1066	} else t20 = $[41];
1067	let t21;
1068	if ($[42] !== onOpenChange || $[43] !== open || $[44] !== t20) {
1069		t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
1070			open,
1071			onOpenChange,
1072			children: t20
1073		});
1074		$[42] = onOpenChange;
1075		$[43] = open;
1076		$[44] = t20;
1077		$[45] = t21;
1078	} else t21 = $[45];
1079	return t21;
1080};
1081var AddressBookImportUploadStep = (t0) => {
1082	const $ = (0, import_compiler_runtime.c)(23);
1083	const { onUploadSuccess } = t0;
1084	const [downloadPoiTemplate, t1] = useLazyDownloadPoiTemplateQuery();
1085	const { isLoading: isDownloading } = t1;
1086	const [parsePoiFile] = useParsePoiFileMutation();
1087	let t2;
1088	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1089		t2 = [];
1090		$[0] = t2;
1091	} else t2 = $[0];
1092	const [documents, setDocuments] = (0, import_react.useState)(t2);
1093	let t3;
1094	if ($[1] !== downloadPoiTemplate) {
1095		t3 = async () => {
1096			trackMethodCall("handleDownloadSampleFile", []);
1097			try {
1098				const blob = await downloadPoiTemplate().unwrap();
1099				downloadBlob(blob, "Sample_File.xlsx");
1100			} catch (t4$1) {
1101				const error = t4$1;
1102				console.error("Download failed", error);
1103			}
1104		};
1105		$[1] = downloadPoiTemplate;
1106		$[2] = t3;
1107	} else t3 = $[2];
1108	const handleDownloadSampleFile = t3;
1109	let t4;
1110	if ($[3] !== onUploadSuccess || $[4] !== parsePoiFile) {
1111		const handleUpload = async (doc) => {
1112			trackMethodCall("handleUpload", [doc]);
1113			setDocuments([{
1114				...doc,
1115				status: "upload",
1116				progress: 0
1117			}]);
1118			try {
1119				const formData = new FormData();
1120				if (doc.file) formData.append("file", doc.file);
1121				const response = await parsePoiFile(formData).unwrap();
1122				onUploadSuccess(response.data.result);
1123				setDocuments([{
1124					...doc,
1125					status: "idle",
1126					progress: 100
1127				}]);
1128			} catch (t5$1) {
1129				const err = t5$1;
1130				setDocuments([{
1131					...doc,
1132					status: "error",
1133					error: err?.data?.message || "Upload failed"
1134				}]);
1135			}
1136		};
1137		t4 = (docs) => {
1138			if (docs.length === 0) {
1139				setDocuments([]);
1140				return;
1141			}
1142			const lastDoc = docs[docs.length - 1];
1143			if (lastDoc.status === "idle" && (!lastDoc.progress || lastDoc.progress === 0) || lastDoc.status === "upload" && (!lastDoc.progress || lastDoc.progress === 0)) {
1144				const docToUpload = {
1145					...lastDoc,
1146					status: "upload",
1147					progress: 0
1148				};
1149				setDocuments([docToUpload]);
1150				handleUpload(docToUpload);
1151			} else setDocuments([lastDoc]);
1152		};
1153		$[3] = onUploadSuccess;
1154		$[4] = parsePoiFile;
1155		$[5] = t4;
1156	} else t4 = $[5];
1157	const onChangeDocuments = t4;
1158	let t5;
1159	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1160		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1161			className: "text-lg font-semibold",
1162			children: "1. Download Sample File for Import"
1163		});
1164		$[6] = t5;
1165	} else t5 = $[6];
1166	let t6;
1167	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1168		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", {
1169			className: "space-y-1 pt-4 pb-5 pl-8",
1170			children: [
1171				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
1172					className: "list-disc text-sm text-muted-foreground",
1173					children: "Uploaded file must mirror the sample file."
1174				}),
1175				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
1176					className: "list-disc text-sm text-muted-foreground",
1177					children: "Only one file can be uploaded at a time."
1178				}),
1179				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
1180					className: "list-disc text-sm text-muted-foreground",
1181					children: "Red fields are required."
1182				})
1183			]
1184		});
1185		$[7] = t6;
1186	} else t6 = $[7];
1187	let t7;
1188	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1189		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Download, {});
1190		$[8] = t7;
1191	} else t7 = $[8];
1192	let t8;
1193	if ($[9] !== handleDownloadSampleFile || $[10] !== isDownloading) {
1194		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1195			t5,
1196			t6,
1197			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
1198				variant: "outline",
1199				onClick: handleDownloadSampleFile,
1200				disabled: isDownloading,
1201				children: [t7, "Download Sample File"]
1202			})
1203		] });
1204		$[9] = handleDownloadSampleFile;
1205		$[10] = isDownloading;
1206		$[11] = t8;
1207	} else t8 = $[11];
1208	let t9;
1209	if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1210		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1211			className: "w-[503px] bg-border p-2",
1212			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
1213				src: address_book_import_q80_default,
1214				alt: "Address Book Import"
1215			})
1216		}) });
1217		$[12] = t9;
1218	} else t9 = $[12];
1219	let t10;
1220	if ($[13] !== t8) {
1221		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1222			className: "flex justify-between",
1223			children: [t8, t9]
1224		});
1225		$[13] = t8;
1226		$[14] = t10;
1227	} else t10 = $[14];
1228	let t11;
1229	if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
1230		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1231			className: "text-lg font-semibold",
1232			children: "2. Please upload the completed file"
1233		});
1234		$[15] = t11;
1235	} else t11 = $[15];
1236	let t12;
1237	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
1238		t12 = {
1239			"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
1240			"application/vnd.ms-excel": [".xls"],
1241			"text/csv": [".csv"]
1242		};
1243		$[16] = t12;
1244	} else t12 = $[16];
1245	let t13;
1246	if ($[17] !== documents || $[18] !== onChangeDocuments) {
1247		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [t11, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1248			className: "mt-4",
1249			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentUpload, {
1250				className: "w-full [&>div:first-child]:bg-accent [&>div:first-child]:px-12 [&>div:first-child]:py-10",
1251				documents,
1252				onChangeDocuments,
1253				maxFiles: 1,
1254				accept: t12
1255			})
1256		})] });
1257		$[17] = documents;
1258		$[18] = onChangeDocuments;
1259		$[19] = t13;
1260	} else t13 = $[19];
1261	let t14;
1262	if ($[20] !== t10 || $[21] !== t13) {
1263		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1264			className: "flex h-fit w-full max-w-[1000px] flex-col gap-11 rounded-2xl border p-16",
1265			children: [t10, t13]
1266		});
1267		$[20] = t10;
1268		$[21] = t13;
1269		$[22] = t14;
1270	} else t14 = $[22];
1271	return t14;
1272};
1273var AddressBookImportReviewStep = (t0) => {
1274	const $ = (0, import_compiler_runtime.c)(60);
1275	const { data, onUpdatePoi, onErrorChange } = t0;
1276	const [editCustomerIndex, setEditCustomerIndex] = (0, import_react.useState)(null);
1277	const [editEntranceIndex, setEditEntranceIndex] = (0, import_react.useState)(null);
1278	const [editPhoneIndex, setEditPhoneIndex] = (0, import_react.useState)(null);
1279	const [editGroupIndex, setEditGroupIndex] = (0, import_react.useState)(null);
1280	const [editInstructionIndex, setEditInstructionIndex] = (0, import_react.useState)(null);
1281	let t1;
1282	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1283		t1 = {
1284			page: 1,
1285			size: 1e3
1286		};
1287		$[0] = t1;
1288	} else t1 = $[0];
1289	const { data: groupsData } = useGetLocationGroupQuery(t1);
1290	let t2;
1291	if ($[1] !== groupsData?.data?.content) {
1292		t2 = new Set(groupsData?.data?.content.map(_temp) || []);
1293		$[1] = groupsData?.data?.content;
1294		$[2] = t2;
1295	} else t2 = $[2];
1296	const existingGroupNames = t2;
1297	const validate = _temp2;
1298	let t3;
1299	if ($[3] !== data) {
1300		let t4$1;
1301		if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1302			t4$1 = (item_0) =>
1302 Object.keys(validate(item_0)).length > 0;
1303			$[5] = t4$1;
1304		} else t4$1 = $[5];
1305		t3 = data.some(t4$1);
1306		$[3] = data;
1307		$[4] = t3;
1308	} else t3 = $[4];
1309	const hasError = t3;
1310	let t4;
1311	let t5;
1312	if ($[6] !== hasError || $[7] !== onErrorChange) {
1313		t4 = () => {
1314			onErrorChange?.(hasError);
1315		};
1316		t5 = [hasError, onErrorChange];
1317		$[6] = hasError;
1318		$[7] = onErrorChange;
1319		$[8] = t4;
1320		$[9] = t5;
1321	} else {
1322		t4 = $[8];
1323		t5 = $[9];
1324	}
1325	(0, import_react.useEffect)(t4, t5);
1326	const hasAutoCleared = (0, import_react.useRef)(false);
1327	let t6;
1328	if ($[10] !== data || $[11] !== existingGroupNames || $[12] !== groupsData || $[13] !== onUpdatePoi) {
1329		t6 = () => {
1330			if (groupsData && !hasAutoCleared.current) {
1331				hasAutoCleared.current = true;
1332				data.forEach((item_1, index) => {
1333					if (item_1.group && !existingGroupNames.has(item_1.group)) onUpdatePoi(index, { group: "" });
1334				});
1335			}
1336		};
1337		$[10] = data;
1338		$[11] = existingGroupNames;
1339		$[12] = groupsData;
1340		$[13] = onUpdatePoi;
1341		$[14] = t6;
1342	} else t6 = $[14];
1343	let t7;
1344	if ($[15] !== groupsData) {
1345		t7 = [groupsData];
1346		$[15] = groupsData;
1347		$[16] = t7;
1348	} else t7 = $[16];
1349	(0, import_react.useEffect)(t6, t7);
1350	let t8;
1351	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
1352		t8 = {
1353			header: "CUSTOMER NAME",
1354			accessorKey: "customerName",
1355			cell: (t9$1) => {
1356				const { row } = t9$1;
1357				const errors_0 = validate(row.original);
1358				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1359					className: "group flex items-center justify-between gap-2",
1360					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1361						className: "flex flex-col gap-0.5",
1362						children: [
1363							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1364								className: cn("text-sm font-semibold", errors_0.name && "text-destructive"),
1365								children: row.original.customerName || "Name is required"
1366							}),
1367							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1368								className: "text-sm",
1369								children: [
1370									row.original.street,
1371									row.original.city,
1372									row.original.state,
1373									row.original.zipCode
1374								].filter(Boolean).join(", ")
1375							}),
1376							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1377								className: cn("text-sm text-muted-foreground", errors_0.address && "text-destructive"),
1378								children: row.original.customerCoordinate || errors_0.address && "Coordinate is required"
1379							}),
1380							errors_0.address === "Invalid coordinate format" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1381								className: "text-sm text-destructive",
1382								children: "Invalid coordinate format"
1383							})
1384						]
1385					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1386						variant: "ghost",
1387						size: "icon",
1388						className: "shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
1389						onClick: () => setEditCustomerIndex(row.index),
1390						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PencilLine, { className: "size-4" })
1391					})]
1392				});
1393			}
1394		};
1395		$[17] = t8;
1396	} else t8 = $[17];
1397	let t9;
1398	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
1399		t9 = {
1400			header: "ENTRANCE / EXIT",
1401			id: "entranceExit",
1402			cell: (t10$1) => {
1403				const { row: row_0 } = t10$1;
1404				const errors_1 = validate(row_0.original);
1405				const { entrance1Coordinate, entrance2Coordinate, exit1Coordinate, exit2Coordinate } = row_0.original;
1406				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1407					className: "group flex items-center justify-between gap-2",
1408					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1409						className: "flex flex-col gap-1",
1410						children: [
1411							entrance1Coordinate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1412								className: cn(errors_1.entrance1 && "text-destructive"),
1413								children: ["Entrance 1: ", entrance1Coordinate]
1414							}),
1415							entrance2Coordinate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1416								className: cn(errors_1.entrance2 && "text-destructive"),
1417								children: ["Entrance 2: ", entrance2Coordinate]
1418							}),
1419							exit1Coordinate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1420								className: cn(errors_1.exit1 && "text-destructive"),
1421								children: ["Exit 1: ", exit1Coordinate]
1422							}),
1423							exit2Coordinate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1424								className: cn(errors_1.exit2 && "text-destructive"),
1425								children: ["Exit 2: ", exit2Coordinate]
1426							})
1427						]
1428					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1429						variant: "ghost",
1430						size: "icon",
1431						className: "shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
1432						onClick: () => setEditEntranceIndex(row_0.index),
1433						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PencilLine, { className: "size-4" })
1434					})]
1435				});
1436			}
1437		};
1438		$[18] = t9;
1439	} else t9 = $[18];
1440	let t10;
1441	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
1442		t10 = {
1443			header: "PHONE",
1444			accessorKey: "phone",
1445			cell: (t11$1) => {
1446				const { row: row_1 } = t11$1;
1447				const errors_2 = validate(row_1.original);
1448				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1449					className: "group flex items-center justify-between gap-2",
1450					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1451						className: cn(errors_2.phone && "text-destructive"),
1452						children: [row_1.original.phone, row_1.original.extensionNumber ? ` Ext.${row_1.original.extensionNumber}` : ""]
1453					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1454						variant: "ghost",
1455						size: "icon",
1456						className: "shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
1457						onClick: () => setEditPhoneIndex(row_1.index),
1458						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PencilLine, { className: "size-4" })
1459					})]
1460				});
1461			}
1462		};
1463		$[19] = t10;
1464	} else t10 = $[19];
1465	let t11;
1466	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
1467		t11 = {
1468			header: "Group",
1469			accessorKey: "group",
1470			cell: (t12$1) => {
1471				const { row: row_2 } = t12$1;
1472				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1473					className: "group flex items-center justify-between gap-2",
1474					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: row_2.original.group }
1474), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1475						variant: "ghost",
1476						size: "icon",
1477						className: "shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
1478						onClick: () => setEditGroupIndex(row_2.index),
1479						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PencilLine, { className: "size-4" })
1480					})]
1481				});
1482			}
1483		};
1484		$[20] = t11;
1485	} else t11 = $[20];
1486	let t12;
1487	if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
1488		t12 = [
1489			t8,
1490			t9,
1491			t10,
1492			t11,
1493			{
1494				header: "SITE INSTRUCTIONS",
1495				accessorKey: "siteInstruction",
1496				cell: (t13$1) => {
1497					const { row: row_3 } = t13$1;
1498					return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1499						className: "group flex items-center justify-between gap-2",
1500						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: row_3.original.siteInstruction }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1501							variant: "ghost",
1502							size: "icon",
1503							className: "shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
1504							onClick: () => setEditInstructionIndex(row_3.index),
1505							children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PencilLine, { className: "size-4" })
1506						})]
1507					});
1508				}
1509			}
1510		];
1511		$[21] = t12;
1512	} else t12 = $[21];
1513	const columns = t12;
1514	let t13;
1515	if ($[22] !== hasError) {
1516		t13 = hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1517			className: "px-5 pb-4",
1518			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
1519				variant: "destructive",
1520				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: "One or more fields need to be verified before uploading" })]
1521			})
1522		});
1523		$[22] = hasError;
1524		$[23] = t13;
1525	} else t13 = $[23];
1526	let t14;
1527	if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
1528		t14 = {
1529			page: 1,
1530			pageSize: 10,
1531			containerClassName: "absolute bottom-0 left-0 right-0 bg-background border-t py-4"
1532		};
1533		$[24] = t14;
1534	} else t14 = $[24];
1535	let t15;
1536	if ($[25] !== data) {
1537		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1538			className: "relative min-h-0 flex-1 px-5",
1539			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(data_table_default, {
1540				data,
1541				columns,
1542				pagination: t14,
1543				containerClassName: "h-full overflow-auto pb-20 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10 [&_thead]:bg-background"
1544			})
1545		});
1546		$[25] = data;
1547		$[26] = t15;
1548	} else t15 = $[26];
1549	let t16;
1550	if ($[27] !== t13 || $[28] !== t15) {
1551		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1552			className: "flex min-w-0 flex-1 flex-col overflow-hidden",
1553			children: [t13, t15]
1554		});
1555		$[27] = t13;
1556		$[28] = t15;
1557		$[29] = t16;
1558	} else t16 = $[29];
1559	let t17;
1560	if ($[30] !== data) {
1561		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1562			className: "w-[495px] shrink-0 border-l",
1563			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookImportMapPreview, { data })
1564		});
1565		$[30] = data;
1566		$[31] = t17;
1567	} else t17 = $[31];
1568	let t18;
1569	if ($[32] !== data || $[33] !== editCustomerIndex || $[34] !== onUpdatePoi) {
1570		t18 = editCustomerIndex !== null && data[editCustomerIndex] && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditCustomerInfoDialog, {
1571			open: editCustomerIndex !== null,
1572			onOpenChange: (open) => !open && setEditCustomerIndex(null),
1573			data: data[editCustomerIndex],
1574			onSave: (newData) => onUpdatePoi(editCustomerIndex, newData)
1575		});
1576		$[32] = data;
1577		$[33] = editCustomerIndex;
1578		$[34] = onUpdatePoi;
1579		$[35] = t18;
1580	} else t18 = $[35];
1581	let t19;
1582	if ($[36] !== data || $[37] !== editEntranceIndex || $[38] !== onUpdatePoi) {
1583		t19 = editEntranceIndex !== null && data[editEntranceIndex] && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditEntranceExitDialog, {
1584			open: editEntranceIndex !== null,
1585			onOpenChange: (open_0) => !open_0 && setEditEntranceIndex(null),
1586			data: data[editEntranceIndex],
1587			onSave: (newData_0) => onUpdatePoi(editEntranceIndex, newData_0)
1588		});
1589		$[36] = data;
1590		$[37] = editEntranceIndex;
1591		$[38] = onUpdatePoi;
1592		$[39] = t19;
1593	} else t19 = $[39];
1594	let t20;
1595	if ($[40] !== data || $[41] !== editPhoneIndex || $[42] !== onUpdatePoi) {
1596		t20 = editPhoneIndex !== null && data[editPhoneIndex] && /* @__P
1596URE__ */ (0, import_jsx_runtime.jsx)(EditPhoneDialog, {
1597			open: editPhoneIndex !== null,
1598			onOpenChange: (open_1) => !open_1 && setEditPhoneIndex(null),
1599			data: data[editPhoneIndex],
1600			onSave: (newData_1) => onUpdatePoi(editPhoneIndex, newData_1)
1601		});
1602		$[40] = data;
1603		$[41] = editPhoneIndex;
1604		$[42] = onUpdatePoi;
1605		$[43] = t20;
1606	} else t20 = $[43];
1607	let t21;
1608	if ($[44] !== data || $[45] !== editGroupIndex || $[46] !== onUpdatePoi) {
1609		t21 = editGroupIndex !== null && data[editGroupIndex] && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddToPoiGroupDialog, {
1610			open: editGroupIndex !== null,
1611			onOpenChange: (open_2) => !open_2 && setEditGroupIndex(null),
1612			onSave: (groupName) => onUpdatePoi(editGroupIndex, { group: groupName })
1613		});
1614		$[44] = data;
1615		$[45] = editGroupIndex;
1616		$[46] = onUpdatePoi;
1617		$[47] = t21;
1618	} else t21 = $[47];
1619	let t22;
1620	if ($[48] !== data || $[49] !== editInstructionIndex || $[50] !== onUpdatePoi) {
1621		t22 = editInstructionIndex !== null && data[editInstructionIndex] && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditSiteInstructionsDialog, {
1622			open: editInstructionIndex !== null,
1623			onOpenChange: (open_3) => !open_3 && setEditInstructionIndex(null),
1624			data: data[editInstructionIndex],
1625			onSave: (newData_2) => onUpdatePoi(editInstructionIndex, newData_2)
1626		});
1627		$[48] = data;
1628		$[49] = editInstructionIndex;
1629		$[50] = onUpdatePoi;
1630		$[51] = t22;
1631	} else t22 = $[51];
1632	let t23;
1633	if ($[52] !== t16 || $[53] !== t17 || $[54] !== t18 || $[55] !== t19 || $[56] !== t20 || $[57] !== t21 || $[58] !== t22) {
1634		t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1635			className: "flex h-full w-full overflow-hidden",
1636			children: [
1637				t16,
1638				t17,
1639				t18,
1640				t19,
1641				t20,
1642				t21,
1643				t22
1644			]
1645		});
1646		$[52] = t16;
1647		$[53] = t17;
1648		$[54] = t18;
1649		$[55] = t19;
1650		$[56] = t20;
1651		$[57] = t21;
1652		$[58] = t22;
1653		$[59] = t23;
1654	} else t23 = $[59];
1655	return t23;
1656};
1657var AddressBookImportDoneStep = (t0) => {
1658	const $ = (0, import_compiler_runtime.c)(17);
1659	const { count, onFinish, onImportAnother } = t0;
1660	let t1;
1661	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1662		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "success" });
1663		$[0] = t1;
1664	} else t1 = $[0];
1665	let t2;
1666	if ($[1] !== count) {
1667		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", {
1668			className: "text-2xl font-semibold text-nowrap",
1669			children: [count, " rows were successfully imported!"]
1670		});
1671		$[1] = count;
1672		$[2] = t2;
1673	} else t2 = $[2];
1674	let t3;
1675	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1676		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
1677			className: "w-[390px]",
1678			variant: "info",
1679			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, {
1680				className: "line-clamp-none text-wrap",
1681				children: "You will be notified once your imported POIs are ready for viewing. This may take a few minutes."
1682			})]
1683		});
1684		$[3] = t3;
1685	} else t3 = $[3];
1686	let t4;
1687	if ($[4] !== t2) {
1688		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1689			className: "flex flex-col gap-2",
1690			children: [t2, t3]
1691		});
1692		$[4] = t2;
1693		$[5] = t4;
1694	} else t4 = $[5];
1695	let t5;
1696	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1697		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileInput, {});
1698		$[6] = t5;
1699	} else t5 = $[6];
1700	let t6;
1701	if ($[7] !== onImportAnother) {
1702		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
1703			variant: "outline",
1704			className: "flex-1",
1705			onClick: onImportAnother,
1706			children: [t5, "import another file"]
1707		});
1708		$[7] = onImportAnother;
1709		$[8] = t6;
1710	} else t6 = $[8];
1711	let t7;
1712	if ($[9] !== onFinish) {
1713		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1714			onClick: onFinish,
1715			className: "flex-1",
1716			children: "Done"
1717		});
1718		$[9] = onFinish;
1719		$[10] = t7;
1720	} else t7 = $[10];
1721	let t8;
1722	if ($[11] !== t6 || $[12] !== t7) {
1723		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1724			className: "flex w-full justify-between gap-2",
1725			children: [t6, t7]
1726		});
1727		$[11] = t6;
1728		$[12] = t7;
1729		$[13] = t8;
1730	} else t8 = $[13];
1731	let t9;
1732	if ($[14] !== t4 || $[15] !== t8) {
1733		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1734			className: "flex w-full max-w-[390px] flex-col items-center justify-center gap-5",
1735			children: [
1736				t1,
1737				t4,
1738				t8
1739			]
1740		});
1741		$[14] = t4;
1742		$[15] = t8;
1743		$[16] = t9;
1744	} else t9 = $[16];
1745	return t9;
1746};
1747const AddressBookImportPage = () => {
1748	const $ = (0, import_compiler_runtime.c)(53);
1749	const navigate = useNavigate();
1750	const [currentStep, setCurrentStep] = (0, import_react.useState)(0);
1751	let t0;
1752	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1753		t0 = [];
1754		$[0] = t0;
1755	} else t0 = $[0];
1756	const [poiData, setPoiData] = (0, import_react.useState)(t0);
1757	const [uploadKey, setUploadKey] = (0, import_react.useState)(0);
1758	const [hasError, setHasError] = (0, import_react.useState)(false);
1759	const { data: profileData } = useGetProfileQuery();
1760	const [batchImportPoi, t1] = useBatchImportPoiMutation();
1761	const { isLoading: isImporting } = t1;
1762	let t2;
1763	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1764		t2 = (index, newData) => {
1765			console.log("Update POI at index", index, newData);
1766			setPoiData(produce((draft) => {
1767				if (draft[index]) Object.assign(draft[index], newData);
1768			}));
1769		};
1770		$[1] = t2;
1771	} else t2 = $[1];
1772	const onUpdatePoi = t2;
1773	let t3;
1774	if ($[2] !== navigate) {
1775		t3 = () => {
1776			trackMethodCall("handleClickBack", []);
1777			navigate("/settings/address-book");
1778		};
1779		$[2] = navigate;
1780		$[3] = t3;
1781	} else t3 = $[3];
1782	const handleClickBack = t3;
1783	let t4;
1784	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1785		t4 = () => {
1786			setCurrentStep(0);
1787			setPoiData([]);
1788			setHasError(false);
1789			setUploadKey(_temp3);
1790		};
1791		$[4] = t4;
1792	} else t4 = $[4];
1793	const onImportAnother = t4;
1794	let t5;
1795	if ($[5] !== batchImportPoi || $[6] !== currentStep || $[7] !== hasError || $[8] !== poiData || $[9] !== profileData?.data?.companyProfile?.companyEmail || $[10] !== profileData?.data?.userProfile?.email) {
1796		t5 = async () => {
1797			trackMethodCall("handleNextStep", []);
1798			if (currentStep < STEPS.length - 1) {
1799				if (currentStep === 1) {
1800					if (hasError) return;
1801					const companyEmail = profileData?.data?.companyProfile?.companyEmail || profileData?.data?.userProfile?.email;
1802					if (!companyEmail) {
1803						toast.error("User email not found");
1804						return;
1805					}
1806					try {
1807						await batchImportPoi({
1808							companyEmail,
1809							poiList: poiData
1810						}).unwrap();
1811						setCurrentStep(_temp4);
1812					} catch (t6$1) {
1813						const err = t6$1;
1814						console.error("Import failed", err);
1815						toast.error(err?.data?.message || "Import failed");
1816					}
1817					return;
1818				}
1819				setCurrentStep(_temp5);
1820			}
1821		};
1822		$[5] = batchImportPoi;
1823		$[6] = currentStep;
1824		$[7] = hasError;
1825		$[8] = poiData;
1826		$[9] = profileData?.data?.companyProfile?.companyEmail;
1827		$[10] = profileData?.data?.userProfile?.email;
1828		$[11] = t5;
1829	} else t5 = $[11];
1830	const handleNextStep = t5;
1831	let t6;
1832	if ($[12] !== currentStep) {
1833		t6 = () => {
1834			trackMethodCall("handlePreviousStep", []);
1835			if (currentStep > 0) setCurrentStep(_temp6);
1836		};
1837		$[12] = currentStep;
1838		$[13] = t6;
1839	} else t6 = $[13];
1840	const handlePreviousStep = t6;
1841	let t7;
1842	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1843		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowLeft, { className: "size-4" });
1844		$[14] = t7;
1845	} else t7 = $[14];
1846	let t8;
1847	if ($[15] !== handleClickBack) {
1848		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1849			className: "flex cursor-pointer items-center gap-1 text-sm text-muted-foreground",
1850			onClick: handleClickBack,
1851			children: [t7, " Back"]
1852		});
1853		$[15] = handleClickBack;
1854		$[16] = t8;
1855	} else t8 = $[16];
1856	let t9;
1857	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
1858		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1859			className: "text-2xl font-semibold",
1860			children: "Import POI"
1861		});
1862		$[17] = t9;
1863	} else t9 = $[17];
1864	let t10;
1865	if ($[18] !== t8) {
1866		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1867			className: "mx-5 flex flex-col gap-1.5 border-b pt-8 pb-6",
1868			children: [t8, t9]
1869		});
1870		$[18] = t8;
1871		$[19] = t10;
1872	} else t10 = $[19];
1873	let t11;
1874	if ($[20] !== currentStep) {
1875		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1876			className: "flex justify-center py-8",
1877			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StepBar, {
1878				className: "max-w-[1000px]",
1879				current: currentStep,
1880				items: STEPS,
1881				onChange: setCurrentStep
1882			})
1883		});
1884		$[20] = currentStep;
1885		$[21] = t11;
1886	} else t11 = $[21];
1887	const t12 = currentStep === 0 ? "visible" : "hidden";
1888	let t13;
1889	if ($[22] !== uploadKey) {
1890		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookImportUploadStep, { onUploadSuccess: setPoiData }, uploadKey);
1891		$[22] = uploadKey;
1892		$[23] = t13;
1893	} else t13 = $[23];
1894	let t14;
1895	if ($[24] !== t12 || $[25] !== t13) {
1896		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, {
1897			mode: t12,
1898			children: t13
1899		});
1900		$[24] = t12;
1901		$[25] = t13;
1902		$[26] = t14;
1903	} else t14 = $[26];
1904	const t15 = currentStep === 1 ? "visible" : "hidden";
1905	let t16;
1906	if ($[27] !== poiData) {
1907		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1908			className: "h-full w-full",
1909			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookImportReviewStep, {
1910				data: poiData,
1911				onUpdatePoi,
1912				onErrorChange: setHasError
1913			})
1914		});
1915		$[27] = poiData;
1916		$[28] = t16;
1917	} else t16 = $[28];
1918	let t17;
1919	if ($[29] !== t15 || $[30] !== t16) {
1920		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, {
1921			mode: t15,
1922			children: t16
1923		});
1924		$[29] = t15;
1925		$[30] = t16;
1926		$[31] = t17;
1927	} else t17 = $[31];
1928	const t18 = currentStep === 2 ? "visible" : "hidden";
1929	let t19;
1930	if ($[32] !== handleClickBack || $[33] !== poiData.length) {
1931		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddressBookImportDoneStep, {
1932			count: poiData.length,
1933			onFinish: handleClickBack,
1934			onImportAnother
1935		});
1936		$[32] = handleClickBack;
1937		$[33] = poiData.length;
1938		$[34] = t19;
1939	} else t19 = $[34];
1940	let t20;
1941	if ($[35] !== t18 || $[36] !== t19) {
1942		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, {
1943			mode: t18,
1944			children: t19
1945		});
1946		$[35] = t18;
1947		$[36] = t19;
1948		$[37] = t20;
1949	} else t20 = $[37];
1950	let t21;
1951	if ($[38] !== t14 || $[39] !== t17 || $[40] !== t20) {
1952		t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1953			className: "flex min-h-0 flex-1 justify-center overflow-hidden",
1954			children: [
1955				t14,
1956				t17,
1957				t20
1958			]
1959		});
1960		$[38] = t14;
1961		$[39] = t17;
1962		$[40] = t20;
1963		$[41] = t21;
1964	} else t21 = $[41];
1965	let t22;
1966	if ($[42] !== currentStep || $[43] !== handleNextStep || $[44] !== handlePreviousStep || $[45] !== hasError || $[46] !== isImporting) {
1967		t22 = currentStep < 2 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1968			className: "flex justify-end gap-3 border-t p-5",
1969			children: [currentStep !== 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1970				variant: "outline",
1971				size: "lg",
1972				onClick: handlePreviousStep,
1973				disabled: isImporting,
1974				children: "Previous Step"
1975			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1976				size: "lg",
1977				onClick: handleNextStep,
1978				disabled: currentStep === 1 && hasError || isImporting,
1979				loading: isImporting,
1980				children: currentStep === 1 ? "Import" : "Next Step"
1981			})]
1982		});
1983		$[42] = currentStep;
1984		$[43] = handleNextStep;
1985		$[44] = handlePreviousStep;
1986		$[45] = hasError;
1987		$[46] = isImporting;
1988		$[47] = t22;
1989	} else t22 = $[47];
1990	let t23;
1991	if ($[48] !== t10 || $[49] !== t11 || $[50] !== t21 || $[51] !== t22) {
1992		t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Page, {
1993			title: "Import Address Book",
1994			children: [
1995				t10,
1996				t11,
1997				t21,
1998				t22
1999			]
2000		});
2001		$[48] = t10;
2002		$[49] = t11;
2003		$[50] = t21;
2004		$[51] = t22;
2005		$[52] = t23;
2006	} else t23 = $[52];
2007	return t23;
2008};
2009function _temp(g) {
2010	return g.name;
2011}
2012function _temp2(item) {
2013	const errors = {};
2014	if (!item.customerName?.trim()) errors.name = "Name is required";
2015	const hasAddress = item.street || item.city || item.state || item.zipCode;
2016	const hasCoordinate = item.customerCoordinate?.trim();
2017	if (!hasAddress && !hasCoordinate) errors.address = "Address or Coordinate is required";
2018	else if (hasCoordinate && !validateCoordinate(item.customerCoordinate)) errors.address = "Invalid coordinate format";
2019	if (item.entrance1Coordinate && !validateCoordinate(item.entrance1Coordinate)) errors.entrance1 = "Invalid";
2020	if (item.entrance2Coordinate && !validateCoordinate(item.entrance2Coordinate)) errors.entrance2 = "Invalid";
2021	if (item.exit1Coordinate && !validateCoordinate(item.exit1Coordinate)) errors.exit1 = "Invalid";
2022	if (item.exit2Coordinate && !validateCoordinate(item.exit2Coordinate)) errors.exit2 = "Invalid";
2023	if (item.phone && !(0, import_validator.isMobilePhone)(unformatPhone(item.phone))) errors.phone = "Invalid phone format";
2024	return errors;
2025}
2026function _temp3(prev) {
2027	return prev + 1;
2028}
2029function _temp4(prev_0) {
2030	return prev_0 + 1;
2031}
2032function _temp5(prev_1) {
2033	return prev_1 + 1;
2034}
2035function _temp6(prev_2) {
2036	return prev_2 - 1;
2037}
2038export { AddressBookImportPage };

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.