@mamrp/components 1.7.54 → 1.7.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { MRT_ColumnDef, MRT_PaginationState, MRT_ColumnFiltersState, MRT_Sorting
2
2
  export { MRT_ColumnDef } from 'material-react-table';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { ReactNode, CSSProperties, Dispatch, SetStateAction } from 'react';
5
- import { Control, FieldValues, Path, FieldErrors, UseFormSetValue } from 'react-hook-form';
5
+ import { Control, FieldValues, Path, FieldErrors, UseFormSetValue, FieldPath } from 'react-hook-form';
6
6
  import { DialogProps, PaperProps, SxProps, Theme } from '@mui/material';
7
7
  import { IconType } from 'react-icons';
8
8
  import { Moment } from 'moment-jalaali';
@@ -732,4 +732,28 @@ type UploadImageProps<T extends FieldValues> = {
732
732
  };
733
733
  declare const UploadImage: <T extends FieldValues>({ placeholder, name, selectedImage, setSelectedImage, control, errors, setValue, height, allowGallery, imageFit, disableCamera, }: UploadImageProps<T>) => React__default.JSX.Element;
734
734
 
735
- export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
735
+ interface SubCustomerFormFields {
736
+ fullName: string;
737
+ phoneNumber: string;
738
+ address: string;
739
+ cityId: number;
740
+ customerType: number;
741
+ remittanceDiscrepancyTolerancePercent: number | null;
742
+ lat: number | null;
743
+ long: number | null;
744
+ }
745
+ interface MapPickerProps {
746
+ control: Control<SubCustomerFormFields>;
747
+ nameLat: FieldPath<SubCustomerFormFields>;
748
+ nameLong: FieldPath<SubCustomerFormFields>;
749
+ nameAddress?: FieldPath<SubCustomerFormFields>;
750
+ isLoading?: boolean;
751
+ defaultLat?: number;
752
+ defaultLng?: number;
753
+ defaultZoom?: number;
754
+ minZoom?: number;
755
+ maxZoom?: number;
756
+ }
757
+ declare function MapLocationPicker({ control, nameLat, nameLong, nameAddress, isLoading, defaultLat, defaultLng, defaultZoom, minZoom, maxZoom, }: MapPickerProps): React$1.JSX.Element;
758
+
759
+ export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { MRT_ColumnDef, MRT_PaginationState, MRT_ColumnFiltersState, MRT_Sorting
2
2
  export { MRT_ColumnDef } from 'material-react-table';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { ReactNode, CSSProperties, Dispatch, SetStateAction } from 'react';
5
- import { Control, FieldValues, Path, FieldErrors, UseFormSetValue } from 'react-hook-form';
5
+ import { Control, FieldValues, Path, FieldErrors, UseFormSetValue, FieldPath } from 'react-hook-form';
6
6
  import { DialogProps, PaperProps, SxProps, Theme } from '@mui/material';
7
7
  import { IconType } from 'react-icons';
8
8
  import { Moment } from 'moment-jalaali';
@@ -732,4 +732,28 @@ type UploadImageProps<T extends FieldValues> = {
732
732
  };
733
733
  declare const UploadImage: <T extends FieldValues>({ placeholder, name, selectedImage, setSelectedImage, control, errors, setValue, height, allowGallery, imageFit, disableCamera, }: UploadImageProps<T>) => React__default.JSX.Element;
734
734
 
735
- export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
735
+ interface SubCustomerFormFields {
736
+ fullName: string;
737
+ phoneNumber: string;
738
+ address: string;
739
+ cityId: number;
740
+ customerType: number;
741
+ remittanceDiscrepancyTolerancePercent: number | null;
742
+ lat: number | null;
743
+ long: number | null;
744
+ }
745
+ interface MapPickerProps {
746
+ control: Control<SubCustomerFormFields>;
747
+ nameLat: FieldPath<SubCustomerFormFields>;
748
+ nameLong: FieldPath<SubCustomerFormFields>;
749
+ nameAddress?: FieldPath<SubCustomerFormFields>;
750
+ isLoading?: boolean;
751
+ defaultLat?: number;
752
+ defaultLng?: number;
753
+ defaultZoom?: number;
754
+ minZoom?: number;
755
+ maxZoom?: number;
756
+ }
757
+ declare function MapLocationPicker({ control, nameLat, nameLong, nameAddress, isLoading, defaultLat, defaultLng, defaultZoom, minZoom, maxZoom, }: MapPickerProps): React$1.JSX.Element;
758
+
759
+ export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(src_exports, {
52
52
  HorizontalStepper: () => HorizontalStepper,
53
53
  ImgViewer: () => imgViewer,
54
54
  LicensePlate: () => LicensePlate,
55
+ MapLocationPicker: () => MapLocationPicker,
55
56
  MobileDateTimePicker: () => mobile_date_time_picker_default,
56
57
  Modal: () => ConfirmationDialog2,
57
58
  NestedSelectort: () => selector_default,
@@ -6118,6 +6119,458 @@ var UploadImage2 = ({
6118
6119
  );
6119
6120
  };
6120
6121
  var upload_image_default = UploadImage2;
6122
+
6123
+ // src/map-location-picker/index.tsx
6124
+ var import_material34 = require("@mui/material");
6125
+ var import_md13 = require("react-icons/md");
6126
+ var import_react33 = require("react");
6127
+ var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
6128
+ var import_react_hook_form18 = require("react-hook-form");
6129
+ function MapLocationPicker({
6130
+ control,
6131
+ nameLat,
6132
+ nameLong,
6133
+ nameAddress,
6134
+ isLoading = false,
6135
+ defaultLat = 36.557153,
6136
+ defaultLng = 52.679547,
6137
+ defaultZoom = 16,
6138
+ minZoom = 10,
6139
+ maxZoom = 19
6140
+ }) {
6141
+ const theme3 = (0, import_material34.useTheme)();
6142
+ const isDarkMode = theme3.palette.mode === "dark";
6143
+ const { field: latField, fieldState: latState } = (0, import_react_hook_form18.useController)({
6144
+ name: nameLat,
6145
+ control
6146
+ });
6147
+ const { field: longField, fieldState: longState } = (0, import_react_hook_form18.useController)({
6148
+ name: nameLong,
6149
+ control
6150
+ });
6151
+ const addressController = nameAddress ? (0, import_react_hook_form18.useController)({ name: nameAddress, control }) : null;
6152
+ const error = !!latState.error || !!longState.error;
6153
+ const helperText = latState.error?.message || longState.error?.message || "";
6154
+ const latitude = latField.value;
6155
+ const longitude = longField.value;
6156
+ const handleLocationChange = (lat, lng) => {
6157
+ latField.onChange(lat);
6158
+ longField.onChange(lng);
6159
+ };
6160
+ const handleAddressChange = nameAddress ? (address) => addressController?.field.onChange(address) : void 0;
6161
+ const mapRef = (0, import_react33.useRef)(null);
6162
+ const mapInstanceRef = (0, import_react33.useRef)(null);
6163
+ const markerRef = (0, import_react33.useRef)(null);
6164
+ const [isMapLoading, setIsMapLoading] = (0, import_react33.useState)(true);
6165
+ const [isGeocoding, setIsGeocoding] = (0, import_react33.useState)(false);
6166
+ const [isGeolocating, setIsGeolocating] = (0, import_react33.useState)(false);
6167
+ const [showGpsDialog, setShowGpsDialog] = (0, import_react33.useState)(false);
6168
+ const [gpsErrorType, setGpsErrorType] = (0, import_react33.useState)("other");
6169
+ const [zoom, setZoom] = (0, import_react33.useState)(defaultZoom);
6170
+ (0, import_react33.useEffect)(() => {
6171
+ if (!document.getElementById("leaflet-css")) {
6172
+ const link = document.createElement("link");
6173
+ link.id = "leaflet-css";
6174
+ link.rel = "stylesheet";
6175
+ link.href = "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.css";
6176
+ document.head.appendChild(link);
6177
+ }
6178
+ const script = document.createElement("script");
6179
+ script.src = "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js";
6180
+ script.async = true;
6181
+ script.onload = () => {
6182
+ setIsMapLoading(false);
6183
+ initializeMap();
6184
+ };
6185
+ document.body.appendChild(script);
6186
+ return () => {
6187
+ if (mapInstanceRef.current) {
6188
+ mapInstanceRef.current.remove();
6189
+ }
6190
+ };
6191
+ }, []);
6192
+ (0, import_react33.useEffect)(() => {
6193
+ if (!mapInstanceRef.current) return;
6194
+ if (latitude === null || longitude === null) {
6195
+ if (markerRef.current) {
6196
+ markerRef.current.remove();
6197
+ markerRef.current = null;
6198
+ }
6199
+ return;
6200
+ }
6201
+ const currentLat = latitude ?? defaultLat;
6202
+ const currentLng = longitude ?? defaultLng;
6203
+ const L = window.L;
6204
+ if (!markerRef.current) {
6205
+ markerRef.current = L.marker([currentLat, currentLng], {
6206
+ draggable: true
6207
+ }).addTo(mapInstanceRef.current);
6208
+ markerRef.current.on("dragend", async (e) => {
6209
+ const { lat, lng } = e.target.getLatLng();
6210
+ handleLocationChange(lat, lng);
6211
+ if (handleAddressChange) {
6212
+ setIsGeocoding(true);
6213
+ const address = await reverseGeocode(lat, lng);
6214
+ handleAddressChange(address);
6215
+ setIsGeocoding(false);
6216
+ }
6217
+ });
6218
+ } else {
6219
+ markerRef.current.setLatLng([currentLat, currentLng]);
6220
+ }
6221
+ }, [latitude, longitude, handleAddressChange, defaultLat, defaultLng]);
6222
+ const reverseGeocode = async (lat, lng) => {
6223
+ try {
6224
+ const response = await fetch(
6225
+ `https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${lat}&lon=${lng}&accept-language=fa`
6226
+ );
6227
+ if (!response.ok) throw new Error("Failed to fetch address");
6228
+ const data = await response.json();
6229
+ const fullAddress = data.display_name || "";
6230
+ const parts = fullAddress.split(",");
6231
+ return parts.slice(0, 4).map((p) => p.trim()).join("\u060C ");
6232
+ } catch {
6233
+ return "";
6234
+ }
6235
+ };
6236
+ const initializeMap = () => {
6237
+ if (!window.L || !mapRef.current || mapInstanceRef.current) return;
6238
+ const L = window.L;
6239
+ const initialLat = latitude ?? defaultLat;
6240
+ const initialLng = longitude ?? defaultLng;
6241
+ const map = L.map(mapRef.current, {
6242
+ attributionControl: false,
6243
+ minZoom
6244
+ }).setView([initialLat, initialLng], zoom);
6245
+ L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
6246
+ attribution: "\xA9 OpenStreetMap contributors",
6247
+ maxZoom
6248
+ }).addTo(map);
6249
+ map.on("zoomend", () => {
6250
+ setZoom(map.getZoom());
6251
+ });
6252
+ if (latitude !== null && longitude !== null) {
6253
+ const marker = L.marker([initialLat, initialLng], {
6254
+ draggable: true
6255
+ }).addTo(map);
6256
+ marker.on("dragend", async (e) => {
6257
+ const { lat, lng } = e.target.getLatLng();
6258
+ handleLocationChange(lat, lng);
6259
+ if (handleAddressChange) {
6260
+ setIsGeocoding(true);
6261
+ const address = await reverseGeocode(lat, lng);
6262
+ handleAddressChange(address);
6263
+ setIsGeocoding(false);
6264
+ }
6265
+ });
6266
+ markerRef.current = marker;
6267
+ }
6268
+ map.on("click", async (e) => {
6269
+ const { lat, lng } = e.latlng;
6270
+ if (!markerRef.current) {
6271
+ const L2 = window.L;
6272
+ markerRef.current = L2.marker([lat, lng], {
6273
+ draggable: true
6274
+ }).addTo(map);
6275
+ markerRef.current.on("dragend", async (dragEvent) => {
6276
+ const { lat: dragLat, lng: dragLng } = dragEvent.target.getLatLng();
6277
+ handleLocationChange(dragLat, dragLng);
6278
+ if (handleAddressChange) {
6279
+ setIsGeocoding(true);
6280
+ const address = await reverseGeocode(dragLat, dragLng);
6281
+ handleAddressChange(address);
6282
+ setIsGeocoding(false);
6283
+ }
6284
+ });
6285
+ } else {
6286
+ markerRef.current.setLatLng([lat, lng]);
6287
+ }
6288
+ handleLocationChange(lat, lng);
6289
+ if (handleAddressChange) {
6290
+ setIsGeocoding(true);
6291
+ const address = await reverseGeocode(lat, lng);
6292
+ handleAddressChange(address);
6293
+ setIsGeocoding(false);
6294
+ }
6295
+ });
6296
+ mapInstanceRef.current = map;
6297
+ };
6298
+ const checkGeolocationSupport = () => {
6299
+ if (!navigator.geolocation) {
6300
+ import_react_hot_toast2.default.error("\u0645\u0631\u0648\u0631\u06AF\u0631 \u0634\u0645\u0627 \u0627\u0632 \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0646\u0645\u06CC\u200C\u06A9\u0646\u062F.");
6301
+ return false;
6302
+ }
6303
+ return true;
6304
+ };
6305
+ const handleCurrentLocation = async () => {
6306
+ if (!checkGeolocationSupport() || !mapInstanceRef.current) {
6307
+ return;
6308
+ }
6309
+ if (navigator.permissions) {
6310
+ try {
6311
+ const permissionStatus = await navigator.permissions.query({
6312
+ name: "geolocation"
6313
+ });
6314
+ if (permissionStatus.state === "denied") {
6315
+ setGpsErrorType("permission");
6316
+ setShowGpsDialog(true);
6317
+ return;
6318
+ }
6319
+ } catch (error2) {
6320
+ console.log("Permissions API not available");
6321
+ }
6322
+ }
6323
+ setIsGeolocating(true);
6324
+ const timeoutId = setTimeout(() => {
6325
+ if (isGeolocating) {
6326
+ setIsGeolocating(false);
6327
+ setGpsErrorType("gps_off");
6328
+ setShowGpsDialog(true);
6329
+ }
6330
+ }, 5e3);
6331
+ navigator.geolocation.getCurrentPosition(
6332
+ async (pos) => {
6333
+ clearTimeout(timeoutId);
6334
+ setIsGeolocating(false);
6335
+ const { latitude: lat, longitude: lng } = pos.coords;
6336
+ const map = mapInstanceRef.current;
6337
+ const L = window.L;
6338
+ handleLocationChange(lat, lng);
6339
+ if (!markerRef.current) {
6340
+ markerRef.current = L.marker([lat, lng], {
6341
+ draggable: true
6342
+ }).addTo(map);
6343
+ markerRef.current.on("dragend", async (e) => {
6344
+ const { lat: dragLat, lng: dragLng } = e.target.getLatLng();
6345
+ handleLocationChange(dragLat, dragLng);
6346
+ if (handleAddressChange) {
6347
+ setIsGeocoding(true);
6348
+ const address = await reverseGeocode(dragLat, dragLng);
6349
+ handleAddressChange(address);
6350
+ setIsGeocoding(false);
6351
+ }
6352
+ });
6353
+ } else {
6354
+ markerRef.current.setLatLng([lat, lng]);
6355
+ }
6356
+ map.setView([lat, lng], map.getZoom(), { animate: true });
6357
+ if (handleAddressChange) {
6358
+ setIsGeocoding(true);
6359
+ const address = await reverseGeocode(lat, lng);
6360
+ handleAddressChange(address);
6361
+ setIsGeocoding(false);
6362
+ }
6363
+ import_react_hot_toast2.default.success("\u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F");
6364
+ },
6365
+ (error2) => {
6366
+ clearTimeout(timeoutId);
6367
+ setIsGeolocating(false);
6368
+ let errorMessage = "\u062E\u0637\u0627 \u062F\u0631 \u062F\u0631\u06CC\u0627\u0641\u062A \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC";
6369
+ switch (error2.code) {
6370
+ case error2.PERMISSION_DENIED:
6371
+ setGpsErrorType("permission");
6372
+ setShowGpsDialog(true);
6373
+ return;
6374
+ case error2.POSITION_UNAVAILABLE:
6375
+ setGpsErrorType("gps_off");
6376
+ setShowGpsDialog(true);
6377
+ return;
6378
+ case error2.TIMEOUT:
6379
+ setGpsErrorType("gps_off");
6380
+ setShowGpsDialog(true);
6381
+ return;
6382
+ default:
6383
+ errorMessage = "\u062E\u0637\u0627\u06CC \u0646\u0627\u0645\u0634\u062E\u0635 \u062F\u0631 \u062F\u0631\u06CC\u0627\u0641\u062A \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u0631\u062E \u062F\u0627\u062F.";
6384
+ break;
6385
+ }
6386
+ import_react_hot_toast2.default.error(errorMessage);
6387
+ },
6388
+ {
6389
+ enableHighAccuracy: true,
6390
+ timeout: 8e3,
6391
+ maximumAge: 0
6392
+ }
6393
+ );
6394
+ };
6395
+ const handleGpsDialogClose = () => {
6396
+ setShowGpsDialog(false);
6397
+ };
6398
+ const handleOpenSettings = () => {
6399
+ setShowGpsDialog(false);
6400
+ const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
6401
+ if (isMobile) {
6402
+ import_react_hot_toast2.default.loading(
6403
+ /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "body2", sx: { mb: 1 } }, "\u0644\u0637\u0641\u0627\u064B \u0645\u0631\u0627\u062D\u0644 \u0632\u06CC\u0631 \u0631\u0627 \u0627\u0646\u062C\u0627\u0645 \u062F\u0647\u06CC\u062F:"), /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "caption", component: "div" }, "\u06F1. \u0648\u0627\u0631\u062F \u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u062F\u0633\u062A\u06AF\u0627\u0647 \u0634\u0648\u06CC\u062F"), /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "caption", component: "div" }, '\u06F2. \u0628\u0647 \u0628\u062E\u0634 "\u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC" \u0628\u0631\u0648\u06CC\u062F'), /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "caption", component: "div" }, "\u06F3. GPS \u0631\u0627 \u0641\u0639\u0627\u0644 \u06A9\u0646\u06CC\u062F"), /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "caption", component: "div" }, "\u06F4. \u062F\u0648\u0628\u0627\u0631\u0647 \u0627\u0645\u062A\u062D\u0627\u0646 \u06A9\u0646\u06CC\u062F")),
6404
+ {
6405
+ duration: 8e3,
6406
+ position: "top-center"
6407
+ }
6408
+ );
6409
+ } else {
6410
+ import_react_hot_toast2.default.error("\u0644\u0637\u0641\u0627\u064B GPS \u062F\u0633\u062A\u06AF\u0627\u0647 \u062E\u0648\u062F \u0631\u0627 \u0631\u0648\u0634\u0646 \u06A9\u0646\u06CC\u062F");
6411
+ }
6412
+ };
6413
+ const handleRetryLocation = () => {
6414
+ setShowGpsDialog(false);
6415
+ setTimeout(() => {
6416
+ handleCurrentLocation();
6417
+ }, 1e3);
6418
+ };
6419
+ const handleClearLocation = () => {
6420
+ if (markerRef.current) {
6421
+ markerRef.current.remove();
6422
+ markerRef.current = null;
6423
+ }
6424
+ handleLocationChange(null, null);
6425
+ if (handleAddressChange) {
6426
+ handleAddressChange("");
6427
+ }
6428
+ };
6429
+ return /* @__PURE__ */ React.createElement(import_material34.Box, { sx: { width: "100%" } }, /* @__PURE__ */ React.createElement(
6430
+ import_react_hot_toast2.Toaster,
6431
+ {
6432
+ position: "top-center",
6433
+ toastOptions: {
6434
+ duration: 4e3,
6435
+ style: {
6436
+ background: isDarkMode ? "#333" : "#fff",
6437
+ color: isDarkMode ? "#fff" : "#333"
6438
+ }
6439
+ }
6440
+ }
6441
+ ), /* @__PURE__ */ React.createElement(
6442
+ import_material34.Dialog,
6443
+ {
6444
+ open: showGpsDialog,
6445
+ onClose: handleGpsDialogClose,
6446
+ "aria-labelledby": "gps-dialog-title"
6447
+ },
6448
+ /* @__PURE__ */ React.createElement(import_material34.DialogTitle, { id: "gps-dialog-title" }, "\u0645\u0634\u06A9\u0644 \u062F\u0631 \u062F\u0631\u06CC\u0627\u0641\u062A \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC"),
6449
+ /* @__PURE__ */ React.createElement(import_material34.DialogContent, null, gpsErrorType === "permission" ? /* @__PURE__ */ React.createElement(import_material34.Typography, null, "\u062F\u0633\u062A\u0631\u0633\u06CC \u0628\u0647 \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u062A\u0648\u0633\u0637 \u0634\u0645\u0627 \u0631\u062F \u0634\u062F\u0647 \u0627\u0633\u062A. \u0628\u0631\u0627\u06CC \u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0627\u06CC\u0646 \u0642\u0627\u0628\u0644\u06CC\u062A:", /* @__PURE__ */ React.createElement("br", null), "\u06F1. \u0631\u0648\u06CC \u0622\u06CC\u06A9\u0648\u0646 \u0642\u0641\u0644 \u062F\u0631 \u0646\u0648\u0627\u0631 \u0622\u062F\u0631\u0633 \u06A9\u0644\u06CC\u06A9 \u06A9\u0646\u06CC\u062F", /* @__PURE__ */ React.createElement("br", null), '\u06F2. \u06AF\u0632\u06CC\u0646\u0647 "\u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC" \u0631\u0627 \u067E\u06CC\u062F\u0627 \u06A9\u0646\u06CC\u062F', /* @__PURE__ */ React.createElement("br", null), '\u06F3. \u062F\u0633\u062A\u0631\u0633\u06CC \u0631\u0627 "\u0627\u062C\u0627\u0632\u0647" \u06A9\u0646\u06CC\u062F') : gpsErrorType === "gps_off" ? /* @__PURE__ */ React.createElement(import_material34.Typography, null, "GPS \u062F\u0633\u062A\u06AF\u0627\u0647 \u0634\u0645\u0627 \u062E\u0627\u0645\u0648\u0634 \u0627\u0633\u062A. \u0644\u0637\u0641\u0627\u064B:", /* @__PURE__ */ React.createElement("br", null), "\u06F1. \u0648\u0627\u0631\u062F \u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u062F\u0633\u062A\u06AF\u0627\u0647 \u0634\u0648\u06CC\u062F", /* @__PURE__ */ React.createElement("br", null), '\u06F2. \u0628\u062E\u0634 "\u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC" \u06CC\u0627 "Location" \u0631\u0627 \u067E\u06CC\u062F\u0627 \u06A9\u0646\u06CC\u062F', /* @__PURE__ */ React.createElement("br", null), "\u06F3. GPS \u0631\u0627 \u0641\u0639\u0627\u0644 \u06A9\u0646\u06CC\u062F") : /* @__PURE__ */ React.createElement(import_material34.Typography, null, "\u062E\u0637\u0627\u06CC\u06CC \u062F\u0631 \u062F\u0631\u06CC\u0627\u0641\u062A \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u0631\u062E \u062F\u0627\u062F\u0647 \u0627\u0633\u062A. \u0644\u0637\u0641\u0627\u064B \u0645\u0637\u0645\u0626\u0646 \u0634\u0648\u06CC\u062F:", /* @__PURE__ */ React.createElement("br", null), "\u06F1. GPS \u062F\u0633\u062A\u06AF\u0627\u0647 \u0631\u0648\u0634\u0646 \u0627\u0633\u062A", /* @__PURE__ */ React.createElement("br", null), "\u06F2. \u0628\u0647 \u0627\u06CC\u0646\u062A\u0631\u0646\u062A \u0645\u062A\u0635\u0644 \u0647\u0633\u062A\u06CC\u062F", /* @__PURE__ */ React.createElement("br", null), "\u06F3. \u0645\u0631\u0648\u0631\u06AF\u0631 \u0627\u062C\u0627\u0632\u0647 \u062F\u0633\u062A\u0631\u0633\u06CC \u062F\u0627\u0631\u062F")),
6450
+ /* @__PURE__ */ React.createElement(import_material34.DialogActions, { sx: { pb: 2, pr: 2 } }, /* @__PURE__ */ React.createElement(import_material34.Button, { onClick: handleGpsDialogClose }, "\u0627\u0646\u0635\u0631\u0627\u0641"), gpsErrorType === "permission" ? /* @__PURE__ */ React.createElement(
6451
+ import_material34.Button,
6452
+ {
6453
+ onClick: handleRetryLocation,
6454
+ variant: "contained",
6455
+ color: "primary"
6456
+ },
6457
+ "\u062A\u0644\u0627\u0634 \u0645\u062C\u062F\u062F"
6458
+ ) : /* @__PURE__ */ React.createElement(
6459
+ import_material34.Button,
6460
+ {
6461
+ onClick: handleOpenSettings,
6462
+ variant: "contained",
6463
+ color: "primary"
6464
+ },
6465
+ "\u0631\u0627\u0647\u0646\u0645\u0627\u06CC \u0641\u0639\u0627\u0644\u200C\u0633\u0627\u0632\u06CC"
6466
+ ))
6467
+ ), /* @__PURE__ */ React.createElement(import_material34.Box, { sx: { position: "relative", height: "370px", width: "100%" } }, /* @__PURE__ */ React.createElement(
6468
+ import_material34.Paper,
6469
+ {
6470
+ sx: {
6471
+ height: "100%",
6472
+ position: "relative",
6473
+ overflow: "hidden",
6474
+ borderRadius: 2,
6475
+ border: error ? 2 : 0,
6476
+ borderColor: error ? "error.main" : "transparent"
6477
+ }
6478
+ },
6479
+ (isMapLoading || isGeocoding || isGeolocating || isLoading) && /* @__PURE__ */ React.createElement(
6480
+ import_material34.Box,
6481
+ {
6482
+ sx: {
6483
+ position: "absolute",
6484
+ inset: 0,
6485
+ display: "flex",
6486
+ alignItems: "center",
6487
+ justifyContent: "center",
6488
+ backgroundColor: isDarkMode ? "rgba(18, 18, 18, 0.9)" : "rgba(255, 255, 255, 0.8)",
6489
+ zIndex: 1e3,
6490
+ flexDirection: "column",
6491
+ gap: 1
6492
+ }
6493
+ },
6494
+ /* @__PURE__ */ React.createElement(import_material34.CircularProgress, null),
6495
+ /* @__PURE__ */ React.createElement(import_material34.Typography, null, isMapLoading ? "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0646\u0642\u0634\u0647..." : isLoading ? "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0637\u0644\u0627\u0639\u0627\u062A \u0645\u0648\u0642\u0639\u06CC\u062A..." : isGeocoding ? "\u062F\u0631 \u062D\u0627\u0644 \u062F\u0631\u06CC\u0627\u0641\u062A \u0622\u062F\u0631\u0633..." : "\u062F\u0631 \u062D\u0627\u0644 \u062F\u0631\u06CC\u0627\u0641\u062A \u0645\u0648\u0642\u0639\u06CC\u062A \u0641\u0639\u0644\u06CC...")
6496
+ ),
6497
+ /* @__PURE__ */ React.createElement("div", { ref: mapRef, style: { height: "100%", width: "100%" } }),
6498
+ /* @__PURE__ */ React.createElement(
6499
+ import_material34.Box,
6500
+ {
6501
+ sx: {
6502
+ position: "absolute",
6503
+ bottom: 16,
6504
+ right: 16,
6505
+ display: "flex",
6506
+ flexDirection: "column",
6507
+ gap: 1,
6508
+ zIndex: 1e3
6509
+ }
6510
+ },
6511
+ /* @__PURE__ */ React.createElement(
6512
+ import_material34.IconButton,
6513
+ {
6514
+ onClick: handleCurrentLocation,
6515
+ disabled: isGeolocating,
6516
+ sx: {
6517
+ backgroundColor: isDarkMode ? "#1e1e1e" : "white",
6518
+ color: isDarkMode ? "white" : "inherit",
6519
+ boxShadow: 2,
6520
+ "&:hover": {
6521
+ backgroundColor: isDarkMode ? "#2a2a2a" : "#f5f5f5"
6522
+ }
6523
+ },
6524
+ title: "\u0645\u0648\u0642\u0639\u06CC\u062A \u0641\u0639\u0644\u06CC"
6525
+ },
6526
+ /* @__PURE__ */ React.createElement(import_md13.MdMyLocation, null)
6527
+ ),
6528
+ (latitude !== null || longitude !== null) && /* @__PURE__ */ React.createElement(
6529
+ import_material34.IconButton,
6530
+ {
6531
+ onClick: handleClearLocation,
6532
+ sx: {
6533
+ backgroundColor: isDarkMode ? "#1e1e1e" : "white",
6534
+ color: theme3.palette.error.main,
6535
+ boxShadow: 2,
6536
+ "&:hover": {
6537
+ backgroundColor: isDarkMode ? "#2a2a2a" : "#f5f5f5"
6538
+ }
6539
+ },
6540
+ title: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646 \u0645\u0648\u0642\u0639\u06CC\u062A"
6541
+ },
6542
+ /* @__PURE__ */ React.createElement(import_md13.MdOutlineClear, null)
6543
+ )
6544
+ )
6545
+ )), /* @__PURE__ */ React.createElement(
6546
+ import_material34.Box,
6547
+ {
6548
+ sx: {
6549
+ mt: 1,
6550
+ p: 1.5,
6551
+ backgroundColor: isDarkMode ? "#1e1e1e" : "#f5f5f5",
6552
+ borderRadius: 1,
6553
+ display: "flex",
6554
+ justifyContent: "space-between",
6555
+ alignItems: "center"
6556
+ }
6557
+ },
6558
+ /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "body2", sx: { fontFamily: "monospace" } }, /* @__PURE__ */ React.createElement("strong", null, "\u0639\u0631\u0636 \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC:"), " ", typeof latitude === "number" ? latitude.toFixed(6) : "\u2014"),
6559
+ /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "body2", sx: { fontFamily: "monospace" } }, /* @__PURE__ */ React.createElement("strong", null, "\u0637\u0648\u0644 \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC:"), " ", typeof longitude === "number" ? longitude.toFixed(6) : "\u2014")
6560
+ ), error && helperText && /* @__PURE__ */ React.createElement(
6561
+ import_material34.Typography,
6562
+ {
6563
+ variant: "caption",
6564
+ sx: {
6565
+ color: "error.main",
6566
+ mt: 0.5,
6567
+ display: "block",
6568
+ px: 1.5
6569
+ }
6570
+ },
6571
+ helperText
6572
+ ));
6573
+ }
6121
6574
  // Annotate the CommonJS export names for ESM import in node:
6122
6575
  0 && (module.exports = {
6123
6576
  Accordion,
@@ -6142,6 +6595,7 @@ var upload_image_default = UploadImage2;
6142
6595
  HorizontalStepper,
6143
6596
  ImgViewer,
6144
6597
  LicensePlate,
6598
+ MapLocationPicker,
6145
6599
  MobileDateTimePicker,
6146
6600
  Modal,
6147
6601
  NestedSelectort,