{"version":3,"file":"index.js","names":["getTranslation","toWords","React","FieldLabel","useField","useConfig","useListQuery","useTranslation","Pill","transformWhereToNaturalLanguage","where","collectionLabel","renderCondition","condition","key","Object","keys","operator","operatorValue","formatValue","val","Date","toLocaleDateString","toString","value","Array","isArray","map","join","_jsxs","pillStyle","size","_jsx","renderWhere","or","length","className","orCondition","orIndex","Fragment","and","andCondition","andIndex","QueryPresetsWhereField","t0","field","t1","label","required","path","collectionSlug","getEntityConfig","collectionConfig","i18n","children","as","labels","plural"],"sources":["../../../../../src/elements/QueryPresets/fields/WhereField/index.tsx"],"sourcesContent":["'use client'\nimport type { JSONFieldClientComponent, Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { toWords } from 'payload/shared'\nimport React from 'react'\n\nimport { FieldLabel } from '../../../../fields/FieldLabel/index.js'\nimport { useField } from '../../../../forms/useField/index.js'\nimport { useConfig } from '../../../../providers/Config/index.js'\nimport { useListQuery } from '../../../../providers/ListQuery/index.js'\nimport { useTranslation } from '../../../../providers/Translation/index.js'\nimport { Pill } from '../../../Pill/index.js'\nimport './index.scss'\n\n/** @todo: improve this */\nconst transformWhereToNaturalLanguage = (\n where: Where,\n collectionLabel: string,\n): React.ReactNode => {\n if (!where) {\n return null\n }\n\n const renderCondition = (condition: any): React.ReactNode => {\n if (!condition || typeof condition !== 'object') {\n return 'No where query'\n }\n\n const key = Object.keys(condition)[0]\n\n if (!key || !condition[key] || typeof condition[key] !== 'object') {\n return 'No where query'\n }\n\n const operator = Object.keys(condition[key])[0]\n const operatorValue = condition[key][operator]\n\n // Format value - ideally would use field schema for proper typing\n const formatValue = (val: any): string => {\n if (typeof val === 'object' && val != null) {\n try {\n return new Date(val).toLocaleDateString()\n } catch {\n return 'Unknown error has occurred'\n }\n }\n return val?.toString() ?? ''\n }\n\n const value = Array.isArray(operatorValue)\n ? operatorValue.map(formatValue).join(', ')\n : formatValue(operatorValue)\n\n return (\n