{"version":3,"file":"__federation_expose_DRPage3EFModel1.chunk.bundle","sources":["/Users/claudiobaiardi/Documents/GitHub/aldyl/DataOil-front/apps/data-oil-app/dailyReport/src/screens/DRPage3EFModel1.tsx","/Users/claudiobaiardi/Documents/GitHub/aldyl/DataOil-front/apps/data-oil-app/dailyReport/src/store/dailyReportBase.store.ts","/Users/claudiobaiardi/Documents/GitHub/aldyl/DataOil-front/apps/data-oil-app/dailyReport/src/store/dailyReportEF.store.ts"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { View, StyleSheet, ScrollView, Text } from 'react-native';\nimport { useNavigation } from '@react-navigation/native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport {\n  SummaryTable,\n  DatePicker,\n  TimePicker,\n  Select,\n  MenuItem,\n  NumericField,\n  RadioGroup,\n  ConfirmationModal,\n  useToast,\n} from '@data-oil-front/ui-mobile';\nimport DRFooterActions from '../components/DRFooterActions';\nimport { Controller, useForm, useWatch } from 'react-hook-form';\nimport { useDailyReportBaseStore } from '../store/dailyReportBase.store';\nimport {\n  useDailyReportEFStore,\n  SampleTakenOption,\n} from '../store/dailyReportEF.store';\nimport {\n  getFlowStationTanksFiltered,\n  submitReport,\n  useAuth,\n  configService,\n} from '@data-oil-front/core-shared';\nimport type { FlowStationTank } from '@data-oil-front/core-shared';\n\ntype YesNoOption = 'yes' | 'no' | null;\n\ninterface FormValues {\n  status: string;\n  date: Date | null;\n  time: string | null;\n  tankLevel: string;\n  sampleTaken: YesNoOption;\n  netOperatedProduction: string;\n}\n\nconst formatTwoDigits = (value: number) => value.toString().padStart(2, '0');\n\nconst getDefaultTime = () => {\n  const now = new Date();\n  return `${formatTwoDigits(now.getHours())}:${formatTwoDigits(now.getMinutes())}`;\n};\n\n// Helper function to normalize numeric strings (convert comma to dot)\nconst normalizeNumericString = (value: string | number | null | undefined): string => {\n  if (value === null || value === undefined || value === '') return '';\n  const str = String(value);\n  return str.replace(',', '.');\n};\n\nexport default function DRPage3EFModel1() {\n  const navigation = useNavigation();\n  const insets = useSafeAreaInsets();\n  const clientConfig = configService.getCurrentConfig();\n  const accentColor = clientConfig.primaryColor;\n  const { show } = useToast();\n  const { user } = useAuth();\n\n  const { summary } = useDailyReportBaseStore(state => state);\n  const { step2, model1Step3, setModel1Step3, reset } = useDailyReportEFStore(\n    state => state,\n  );\n\n  const [flowStationTank, setFlowStationTank] = useState<FlowStationTank | null>(\n    null,\n  );\n  const [isLoading, setIsLoading] = useState(false);\n  const [isSubmitting, setIsSubmitting] = useState(false);\n  const [isModalOpen, setIsModalOpen] = useState(false);\n  const guardDisabledRef = useRef(false);\n  const missingToastShownRef = useRef(false);\n\n  const defaultDate = model1Step3.reportDate ?? new Date();\n  const defaultTime = model1Step3.reportTime ?? getDefaultTime();\n\n  const {\n    control,\n    handleSubmit,\n    formState: { isValid },\n  } = useForm<FormValues>({\n    defaultValues: {\n      status: model1Step3.status ?? 'active',\n      date: defaultDate,\n      time: defaultTime,\n      tankLevel: normalizeNumericString(model1Step3.tankLevel),\n      sampleTaken: model1Step3.sampleTaken ?? null,\n      netOperatedProduction: normalizeNumericString(model1Step3.netOperatedProduction),\n    },\n    mode: 'onChange',\n  });\n\n  const watchedValues = useWatch({ control });\n\n  useEffect(() => {\n    if (!watchedValues) return;\n    const { status, date, time, tankLevel, sampleTaken, netOperatedProduction } =\n      watchedValues;\n    setModel1Step3({\n      status: status ?? null,\n      reportDate: date ?? null,\n      reportTime: time ?? null,\n      tankLevel: tankLevel ?? null,\n      sampleTaken: (sampleTaken ?? null) as SampleTakenOption,\n      netOperatedProduction: netOperatedProduction ?? null,\n    });\n  }, [watchedValues, setModel1Step3]);\n\n  useEffect(() => {\n    let mounted = true;\n    const fetchTank = async () => {\n      if (!step2.tankId) {\n        setFlowStationTank(null);\n        setIsLoading(false);\n        return;\n      }\n      setIsLoading(true);\n      try {\n        const tanks = await getFlowStationTanksFiltered([\n          ['id', '=', Number(step2.tankId)],\n        ]);\n        if (!mounted) return;\n        setFlowStationTank(Array.isArray(tanks) ? tanks[0] ?? null : null);\n      } catch {\n        if (mounted) setFlowStationTank(null);\n      } finally {\n        if (mounted) setIsLoading(false);\n      }\n    };\n    fetchTank();\n    return () => {\n      mounted = false;\n    };\n  }, [step2.tankId]);\n\n  useEffect(() => {\n    if (guardDisabledRef.current) return;\n\n    const missing = !step2.flowStationId || !step2.tankId;\n    if (!missing) {\n      missingToastShownRef.current = false;\n      return;\n    }\n\n    if (!missingToastShownRef.current) {\n      missingToastShownRef.current = true;\n      show({\n        type: 'info',\n        message: 'Selecciona una estación de flujo y un tanque para continuar.',\n      });\n    }\n    // @ts-ignore navegación provista por host\n    navigation?.navigate?.('DRPage2EF');\n  }, [navigation, show, step2.flowStationId, step2.tankId]);\n\n  const summaryItems = useMemo(\n    () => [\n      { name: 'Localización', value: summary.location },\n      { name: 'Actividad', value: summary.activity },\n      { name: 'Campo', value: summary.field },\n      { name: 'Instalación', value: summary.facility },\n      { name: 'Estación de flujo', value: step2.flowStationName },\n      { name: 'Tanque', value: step2.tankName },\n    ],\n    [summary.activity, summary.field, summary.facility, summary.location, step2.flowStationName, step2.tankName],\n  );\n\n  const handleFinish = handleSubmit(async values => {\n    if (!step2.tankId) {\n      show({\n        type: 'error',\n        message: 'No se encontró el tanque seleccionado. Regresa y selecciona nuevamente.',\n      });\n      return;\n    }\n\n    if (isLoading || !flowStationTank) {\n      show({\n        type: 'info',\n        message: 'Esperando datos del tanque. Intenta nuevamente en unos segundos.',\n      });\n      return;\n    }\n\n    if (isSubmitting) return;\n\n    const sampleTaken = values.sampleTaken;\n    if (sampleTaken === null) {\n      show({ type: 'error', message: 'Debes indicar si se tomó muestra.' });\n      return;\n    }\n\n    setIsSubmitting(true);\n    const pad = (num: number) => num.toString().padStart(2, '0');\n    const now = new Date();\n    const nowDate = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(\n      now.getDate(),\n    )} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;\n\n    const toNumber = (value: string | number | null | undefined): number | null => {\n      if (value === null || value === undefined || value === '') return null;\n      // Normalize comma to dot before parsing\n      const normalized = normalizeNumericString(value);\n      const num = Number(normalized);\n      return Number.isNaN(num) ? null : num;\n    };\n\n    // Use the form's date and time values, not the current date/time\n    const selectedDate = values.date ?? defaultDate;\n    const selectedTime = values.time ?? defaultTime;\n    const [hours = '00', minutes = '00'] = selectedTime.split(':');\n    const hh = pad(Math.max(0, Math.min(23, Number.isFinite(Number(hours)) ? Number(hours) : 0)));\n    const mm = pad(Math.max(0, Math.min(59, Number.isFinite(Number(minutes)) ? Number(minutes) : 0)));\n    const dateCreated = `${selectedDate.getFullYear()}-${pad(selectedDate.getMonth() + 1)}-${pad(selectedDate.getDate())} ${hh}:${mm}:00`;\n\n    const activityId =\n      summary.activity === 'Producción'\n        ? 1\n        : summary.activity === 'Recuperación'\n        ? 2\n        : 1;\n\n    const fieldPairs: [string, string | number | boolean | null][] = [\n      ['date_created', dateCreated],\n      ['date_updated', nowDate],\n      ['edition_number', 0],\n      ['activity_id', activityId],\n      ['user_id', user?.id != null ? String(user.id) : null],\n      ['flow_station_tank_id', Number(step2.tankId)],\n      ['status', values.status || 'active'],\n      ['current_stock', null],\n      ['sample_taken', sampleTaken === 'yes'],\n      ['net_operated_production', toNumber(values.netOperatedProduction)],\n      ['tank_level', toNumber(values.tankLevel)],\n      ['filling_start_date', null],\n      ['filling_start_level', null],\n      ['filling_end_date', null],\n      ['filling_end_level', null],\n      ['raw_operated_production', null],\n      ['lab_analysis', false],\n    ];\n\n    const payload = {\n      verb: 'insert',\n      table: 'daily_report_flow_station_tank',\n      fields: fieldPairs.map(([key]) => key),\n      values: fieldPairs.map(([, value]) => value),\n      filter: [],\n    } as const;\n\n    try {\n      const result = await submitReport(\n        'daily_report_flow_station_tank',\n        payload as any,\n        () => {},\n        error => {\n          show({\n            type: 'error',\n            message: `Error al enviar el reporte: ${error}`,\n          });\n        },\n      );\n\n      if (result.success) {\n        guardDisabledRef.current = true;\n        if (result.offline) {\n          show({\n            type: 'info',\n            message:\n              'Reporte guardado offline. Se enviará cuando tengas conexión.',\n          });\n        } else {\n          show({ type: 'success', message: 'Reporte enviado correctamente.' });\n        }\n        reset();\n        // @ts-ignore navegación provista por host\n        navigation?.navigate?.('Home');\n      } else {\n        show({\n          type: 'error',\n          message: 'No se pudo enviar el reporte. Inténtalo nuevamente.',\n        });\n      }\n    } catch (error) {\n      show({\n        type: 'error',\n        message: 'Error inesperado al procesar el reporte.',\n      });\n    } finally {\n      setIsSubmitting(false);\n    }\n  });\n\n  const handleCancel = () => {\n    setIsModalOpen(true);\n  };\n\n  const confirmCancel = () => {\n    guardDisabledRef.current = true;\n    reset();\n    setIsModalOpen(false);\n    // @ts-ignore navegación provista por host\n    navigation?.navigate?.('Home');\n  };\n\n  useEffect(() => {\n    // @ts-ignore navegación provista por host\n    navigation?.navigate?.('DRPage3EFUnicModel');\n  }, [navigation]);\n\n  return (\n    <View style={styles.screen}>\n      <ScrollView\n        style={styles.container}\n        contentContainerStyle={{ paddingBottom: insets.bottom + 120 }}\n      >\n        <View style={styles.form}>\n          <SummaryTable items={summaryItems} />\n\n          <View style={styles.block} />\n\n          <Text style={styles.sectionTitle}>Redirecting...</Text>\n        </View>\n      </ScrollView>\n    </View>\n  );\n}\n\nconst styles = StyleSheet.create({\n  screen: { flex: 1, backgroundColor: '#f9fafb' },\n  container: { flex: 1, paddingTop: 16 },\n  form: { paddingHorizontal: 20, paddingBottom: 24, gap: 0 },\n  block: { height: 16 },\n  row: {\n    flexDirection: 'row',\n    alignItems: 'center',\n  },\n  flex1: { flex: 1 },\n  spacer: { width: 12 },\n  sectionTitle: {\n    textAlign: 'center',\n    fontSize: 18,\n    fontWeight: '600',\n    color: '#1F2937',\n  },\n  helperText: {\n    marginTop: 12,\n    textAlign: 'center',\n    color: '#6B7280',\n    fontSize: 14,\n  },\n  errorText: {\n    marginTop: 8,\n    color: '#DC2626',\n    fontSize: 12,\n  },\n});\n\n\n","import { create } from 'zustand';\nimport type { ReportHistoryTable } from '@data-oil-front/core-shared';\n\ninterface DailyReportBaseStore {\n  fieldId: string | null;\n  summary: {\n    location: string | null;\n    activity: string | null;\n    field: string | null;\n    facility: string | null;\n  };\n  editing: DailyReportEditingState;\n}\n\ninterface DailyReportBaseStoreActions {\n  setFieldId: (fieldId: string | null) => void;\n  setSummary: (summary: DailyReportBaseStore['summary']) => void;\n  setEditing: (editing: Partial<DailyReportEditingState>) => void;\n  resetEditing: () => void;\n}\n\nexport interface DailyReportEditingState {\n  isEditing: boolean;\n  reportId: string | number | null;\n  table: ReportHistoryTable | null;\n  revision?: number | null;\n  payload?: Record<string, any> | null;\n}\n\nconst INITIAL_EDITING_STATE: DailyReportEditingState = {\n  isEditing: false,\n  reportId: null,\n  table: null,\n  revision: null,\n  payload: null,\n};\n\nconst INITIAL_STATE: DailyReportBaseStore = {\n  fieldId: null,\n  summary: {\n    location: null,\n    activity: null,\n    field: null,\n    facility: null,\n  },\n  editing: INITIAL_EDITING_STATE,\n};\n\nexport const useDailyReportBaseStore = create<\n  DailyReportBaseStore & DailyReportBaseStoreActions\n>(set => ({\n  ...INITIAL_STATE,\n  // ACTIONS\n  setFieldId: (fieldId: string | null) => set(state => ({ ...state, fieldId })),\n  setSummary: (summary: DailyReportBaseStore['summary']) =>\n    set(state => ({ ...state, summary })),\n  setEditing: editing =>\n    set(state => ({\n      ...state,\n      editing: {\n        ...state.editing,\n        ...editing,\n      },\n    })),\n  resetEditing: () =>\n    set(state => ({\n      ...state,\n      editing: INITIAL_EDITING_STATE,\n    })),\n}));\n","import { create } from 'zustand';\n\nexport interface DREFStep2State {\n  flowStationId: string | null;\n  flowStationName?: string | null;\n  tankId: string | null;\n  tankName?: string | null;\n}\n\nexport type SampleTakenOption = 'yes' | 'no' | null;\n\nexport interface DREFModel1Step3State {\n  status: string | null;\n  reportDate: Date | null;\n  reportTime: string | null;\n  tankLevel: string | null;\n  sampleTaken: SampleTakenOption;\n  netOperatedProduction: string | null;\n}\n\nexport interface DREFModel2Step3State {\n  status: string | null;\n  reportDate: Date | null;\n  reportTime: string | null;\n  fillingStartDate: Date | null;\n  fillingStartTime: string | null;\n  fillingStartLevel: string | null;\n  fillingEndDate: Date | null;\n  fillingEndTime: string | null;\n  fillingEndLevel: string | null;\n  rawOperatedProduction: string | null;\n  sampleTaken: SampleTakenOption;\n  netOperatedProduction: string | null;\n}\n\nexport interface DREFUnicModelStep3State {\n  status: string | null;\n  reportDate: Date | null;\n  reportTime: string | null;\n  tankLevel: string | null;\n  rawOperatedProduction: string | null;\n  sampleTaken: SampleTakenOption;\n  netOperatedProduction: string | null;\n  comments: string | null;\n}\n\nexport interface DREFModel3Step3State {\n  status: string | null;\n  currentStockDate: Date | null;\n  currentStockTime: string | null;\n  currentStock: string | null;\n  previousDayStock: string | null;\n  vacuumTransfer: string | null;\n  grossOperatedProduction: string | null;\n  sampleTaken: SampleTakenOption;\n  netOperatedProduction: string | null;\n}\n\nexport interface DREFMeta {\n  editionMode: boolean;\n  recordId?: string | null;\n  revision?: number | null;\n  payload?: Record<string, any> | null;\n}\n\ninterface DailyReportEFStoreState {\n  step2: Partial<DREFStep2State>;\n  model1Step3: Partial<DREFModel1Step3State>;\n  model2Step3: Partial<DREFModel2Step3State>;\n  model3Step3: Partial<DREFModel3Step3State>;\n  unicModelStep3: Partial<DREFUnicModelStep3State>;\n  meta: DREFMeta;\n  setStep2: (values: Partial<DREFStep2State>) => void;\n  setModel1Step3: (values: Partial<DREFModel1Step3State>) => void;\n  setModel2Step3: (values: Partial<DREFModel2Step3State>) => void;\n  setModel3Step3: (values: Partial<DREFModel3Step3State>) => void;\n  setUnicModelStep3: (values: Partial<DREFUnicModelStep3State>) => void;\n  setLoadingMeta: (values: Partial<DREFMeta>) => void;\n  resetStep3: () => void;\n  reset: () => void;\n}\n\nconst createInitialStep2State = (): Partial<DREFStep2State> => ({\n  flowStationId: null,\n  tankId: null,\n  flowStationName: null,\n  tankName: null,\n});\n\nconst createInitialModel1Step3State = (): Partial<DREFModel1Step3State> => ({\n  status: 'active',\n  reportDate: null,\n  reportTime: null,\n  tankLevel: null,\n  sampleTaken: null,\n  netOperatedProduction: null,\n});\n\nconst createInitialModel2Step3State = (): Partial<DREFModel2Step3State> => ({\n  status: 'active',\n  reportDate: null,\n  reportTime: null,\n  fillingStartDate: null,\n  fillingStartTime: null,\n  fillingStartLevel: null,\n  fillingEndDate: null,\n  fillingEndTime: null,\n  fillingEndLevel: null,\n  rawOperatedProduction: null,\n  sampleTaken: null,\n  netOperatedProduction: null,\n});\n\nconst createInitialModel3Step3State = (): Partial<DREFModel3Step3State> => ({\n  status: 'active',\n  currentStockDate: null,\n  currentStockTime: null,\n  currentStock: null,\n  previousDayStock: null,\n  vacuumTransfer: null,\n  grossOperatedProduction: '0',\n  sampleTaken: null,\n  netOperatedProduction: null,\n});\n\nconst createInitialUnicModelStep3State = (): Partial<DREFUnicModelStep3State> => ({\n    status: 'active',\n    reportDate: null,\n    reportTime: null,\n    tankLevel: null,\n    rawOperatedProduction: null,\n    sampleTaken: null,\n    netOperatedProduction: null,\n    comments: null,\n});\n\nconst INITIAL_META_STATE: DREFMeta = {\n  editionMode: false,\n  recordId: null,\n  revision: null,\n  payload: null,\n};\n\nexport const useDailyReportEFStore = create<DailyReportEFStoreState>(set => ({\n  step2: createInitialStep2State(),\n  model1Step3: createInitialModel1Step3State(),\n  model2Step3: createInitialModel2Step3State(),\n  model3Step3: createInitialModel3Step3State(),\n  unicModelStep3: createInitialUnicModelStep3State(),\n  meta: INITIAL_META_STATE,\n  setStep2: values =>\n    set(state => ({\n      step2: {\n        ...state.step2,\n        ...values,\n      },\n    })),\n  setModel1Step3: values =>\n    set(state => ({\n      model1Step3: {\n        ...state.model1Step3,\n        ...values,\n      },\n    })),\n  setModel2Step3: values =>\n    set(state => ({\n      model2Step3: {\n        ...state.model2Step3,\n        ...values,\n      },\n    })),\n  setModel3Step3: values =>\n    set(state => ({\n      model3Step3: {\n        ...state.model3Step3,\n        ...values,\n      },\n    })),\n    setUnicModelStep3: values =>\n    set(state => ({\n      unicModelStep3: {\n        ...state.unicModelStep3,\n        ...values,\n      },\n    })),\n  setLoadingMeta: values =>\n    set(state => ({\n      meta: {\n        ...state.meta,\n        ...values,\n      },\n    })),\n  resetStep3: () =>\n    set(state => ({\n      step2: state.step2,\n      model1Step3: createInitialModel1Step3State(),\n      model2Step3: createInitialModel2Step3State(),\n      model3Step3: createInitialModel3Step3State(),\n      unicModelStep3: createInitialUnicModelStep3State(),\n      meta: state.meta,\n    })),\n  reset: () =>\n    set(() => ({\n      step2: createInitialStep2State(),\n      model1Step3: createInitialModel1Step3State(),\n      model2Step3: createInitialModel2Step3State(),\n      model3Step3: createInitialModel3Step3State(),\n      unicModelStep3: createInitialUnicModelStep3State(),\n      meta: INITIAL_META_STATE,\n    })),\n}));\n"],"names":["DRPage3EFModel1","formatTwoDigits","value","toString","padStart","getDefaultTime","now","Date","getHours","getMinutes","normalizeNumericString","String","replace","navigation","useNavigation","insets","useSafeAreaInsets","configService","getCurrentConfig","primaryColor","useToast","show","useAuth","user","useDailyReportBaseStore","state","summary","useDailyReportEFStore","step2","model1Step3","setModel1Step3","reset","flowStationTank","setFlowStationTank","useState","isLoading","setIsLoading","isSubmitting","setIsSubmitting","guardDisabledRef","useRef","missingToastShownRef","defaultDate","reportDate","defaultTime","reportTime","useForm","defaultValues","status","date","time","tankLevel","sampleTaken","netOperatedProduction","mode","control","handleSubmit","watchedValues","formState","isValid","useWatch","useEffect","mounted","tankId","tanks","getFlowStationTanksFiltered","Number","Array","isArray","current","flowStationId","type","message","navigate","summaryItems","useMemo","name","location","activity","field","facility","flowStationName","tankName","values","pad","num","nowDate","getFullYear","getMonth","getDate","getSeconds","toNumber","normalized","isNaN","selectedDate","selectedTime","split","hours","minutes","hh","Math","max","min","isFinite","mm","fieldPairs","id","payload","verb","table","fields","map","filter","result","submitReport","error","success","offline","View","style","styles","screen","ScrollView","container","contentContainerStyle","paddingBottom","bottom","form","SummaryTable","items","block","Text","sectionTitle","StyleSheet","create","flex","backgroundColor","paddingTop","paddingHorizontal","gap","height","row","flexDirection","alignItems","flex1","spacer","width","textAlign","fontSize","fontWeight","color","helperText","marginTop","errorText","INITIAL_EDITING_STATE","isEditing","reportId","revision","INITIAL_STATE","fieldId","editing","DailyReportBaseStore","set","setFieldId","setSummary","setEditing","resetEditing","INITIAL_META_STATE","editionMode","recordId","DailyReportEFStoreState","model2Step3","fillingStartDate","fillingStartTime","fillingStartLevel","fillingEndDate","fillingEndTime","fillingEndLevel","rawOperatedProduction","model3Step3","currentStockDate","currentStockTime","currentStock","previousDayStock","vacuumTransfer","grossOperatedProduction","unicModelStep3","comments","meta","setStep2","setModel2Step3","setModel3Step3","setUnicModelStep3","setLoadingMeta","resetStep3"],"mappings":"6PAuDwBA,C,4DAvDoC,O,IACT,O,IACrB,O,IACI,O,IAW3B,O,IAEuC,O,IACN,O,IAIjC,O,IAMA,OAcDC,EAAkBA,SAACC,G,OAAkBA,EAAMC,WAAWC,SAAS,EAAG,I,EAElEC,EAAiBA,WACrB,IAAMC,EAAM,IAAIC,KAChB,MAAO,GAAGN,EAAgBK,EAAIE,eAAeP,EAAgBK,EAAIG,eACnE,EAGMC,EAAyBA,SAACR,GAC9B,OAAIA,SAAmD,KAAVA,EAAqB,GACtDS,OAAOT,GACRU,QAAQ,IAAK,IAC1B,EAEe,SAASZ,IACtB,I,QAAMa,GAAa,EAAAC,EAAAA,iBACbC,GAAS,EAAAC,EAAAA,qBAGT,GAFeC,EAAAA,cAAcC,mBACFC,cAC3B,EAAWC,EAAAA,YAATC,MACF,KAAWC,EAAAA,WAATC,KAEF,KAAcC,EAAAA,yBAAuB,SAACC,G,OAASA,C,GAA7CC,QAC8CC,GAAhD,2BAAqE,SACzEF,G,OAASA,C,OADHG,MAAOC,EAAF,EAAEA,YAAaC,EAAF,EAAEA,eAAgBC,EAAF,EAAEA,MAI5C,EAAM,mBACJ,MACD,GAFMC,EAAe,K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