{"version":3,"file":"Cascader.mjs","names":["useId","classes"],"sources":["../../../src/components/Cascader/Cascader.tsx"],"sourcesContent":["import { Fragment, useEffect, useMemo } from 'react';\nimport type { SafePolygonOptions } from '@floating-ui/react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n  BoxProps,\n  ElementProps,\n  extractStyleProps,\n  Factory,\n  factory,\n  MantineColor,\n  StylesApiProps,\n  useProps,\n  useResolvedStylesApi,\n  useStyles,\n} from '../../core';\nimport { CheckIcon } from '../Checkbox/CheckIcon';\nimport { Combobox, ComboboxLikeStylesNames, useCombobox } from '../Combobox';\nimport {\n  __BaseInputProps,\n  __InputStylesNames,\n  ClearSectionMode,\n  InputClearButtonProps,\n  InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport { CascaderColumns } from './CascaderColumns';\nimport { flattenCascaderPaths } from './flatten-cascader-paths';\nimport { getCascaderPathOptions } from './get-cascader-path-options';\nimport { useCascader } from './use-cascader';\nimport classes from './Cascader.module.css';\n\nexport interface CascaderOption {\n  /** Option value, must be unique across the whole data tree */\n  value: string;\n\n  /** Option label, if not set `value` is used instead */\n  label?: React.ReactNode;\n\n  /** Nested options */\n  children?: CascaderOption[];\n\n  /** If set, the option cannot be selected or expanded */\n  disabled?: boolean;\n}\n\nexport interface CascaderFormatValueInput {\n  /** Selected path from root to node */\n  value: string[];\n\n  /** Option chain resolved from the selected path */\n  options: CascaderOption[];\n}\n\nexport type CascaderFormatValue = (input: CascaderFormatValueInput) => React.ReactNode;\n\nexport type CascaderSafeAreaPolygonOptions = Omit<SafePolygonOptions, 'blockPointerEvents'>;\n\nexport type CascaderStylesNames =\n  | __InputStylesNames\n  | ComboboxLikeStylesNames\n  | 'columnsList'\n  | 'columnsOverflow'\n  | 'column'\n  | 'columnScroll'\n  | 'columnOption'\n  | 'columnOptionLabel'\n  | 'columnOptionIcon'\n  | 'columnOptionCheck'\n  | 'columnEmpty'\n  | 'flatOption';\n\nexport interface CascaderProps\n  extends\n    BoxProps,\n    __BaseInputProps,\n    StylesApiProps<CascaderFactory>,\n    ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n  /** Hierarchical options data */\n  data: CascaderOption[];\n\n  /** Controlled selected path from root to node */\n  value?: string[] | null;\n\n  /** Uncontrolled selected path from root to node */\n  defaultValue?: string[] | null;\n\n  /** Called when the selected path changes with the path and the resolved option chain */\n  onChange?: (value: string[] | null, options: CascaderOption[]) => void;\n\n  /** If set, any intermediate option can be selected, not only leaf options @default false */\n  changeOnSelect?: boolean;\n\n  /** Determines whether the dropdown should be closed when a value is selected, defaults to `!allowDeselect` */\n  closeOnSelect?: boolean;\n\n  /** If set, the selected value can be deselected by selecting it again @default true */\n  allowDeselect?: boolean;\n\n  /** If set, the check icon is displayed on the selected option @default true */\n  withCheckIcon?: boolean;\n\n  /** Position of the check icon relative to the option label @default 'right' */\n  checkIconPosition?: 'left' | 'right';\n\n  /** Renders the dropdown as cascading columns. When `false`, options are rendered as a flat list of paths, the same way as search results (useful for narrow/mobile layouts) @default true */\n  withColumns?: boolean;\n\n  /** Determines how the next column is opened @default 'click' */\n  expandTrigger?: 'click' | 'hover';\n\n  /** Determines whether the next column stays open while the cursor moves toward it, applicable only when `expandTrigger=\"hover\"`. Pass an object to configure safe polygon behavior. @default true */\n  safeAreaPolygon?: boolean | CascaderSafeAreaPolygonOptions;\n\n  /** If set, options can be searched by their flattened paths @default false */\n  searchable?: boolean;\n\n  /** Controlled search value */\n  searchValue?: string;\n\n  /** Uncontrolled search value */\n  defaultSearchValue?: string;\n\n  /** Called when the search value changes */\n  onSearchChange?: (value: string) => void;\n\n  /** Custom search filter, matched against the full option path */\n  filter?: (query: string, options: CascaderOption[]) => boolean;\n\n  /** Custom rendering of a search result row */\n  renderSearchOption?: (query: string, options: CascaderOption[]) => React.ReactNode;\n\n  /** A function to format the selected path displayed in the input, should return a string */\n  formatValue?: CascaderFormatValue;\n\n  /** Custom rendering of an option in columns */\n  renderOption?: (option: CascaderOption, level: number) => React.ReactNode;\n\n  /** Path separator displayed in the input and search results @default '/' */\n  separator?: React.ReactNode;\n\n  /** Width of each column */\n  columnWidth?: number | string;\n\n  /** Maximum number of columns (levels) displayed next to each other, deeper levels replace earlier ones @default 3 */\n  maxDisplayedLevels?: number;\n\n  /** `aria-label` and `title` of the control that reveals levels hidden before the visible ones by `maxDisplayedLevels` @default 'Show previous levels' */\n  previousLevelsControlLabel?: string;\n\n  /** `aria-label` and `title` of the control that reveals levels hidden after the visible ones by `maxDisplayedLevels` @default 'Show next levels' */\n  nextLevelsControlLabel?: string;\n\n  /** Max height of a column before it becomes scrollable @default 260 */\n  maxDropdownHeight?: number | string;\n\n  /** Message displayed when there are no options or search results */\n  nothingFoundMessage?: React.ReactNode;\n\n  /** If set, the clear button is displayed when a value is selected @default false */\n  clearable?: boolean;\n\n  /** Determines how the clear button and `rightSection` are rendered @default 'both' */\n  clearSectionMode?: ClearSectionMode;\n\n  /** Props passed down to the clear button */\n  clearButtonProps?: InputClearButtonProps;\n\n  /** Called when the clear button is clicked */\n  onClear?: () => void;\n\n  /** Controlled dropdown opened state */\n  dropdownOpened?: boolean;\n\n  /** Uncontrolled dropdown opened state */\n  defaultDropdownOpened?: boolean;\n\n  /** Called when the dropdown opens */\n  onDropdownOpen?: () => void;\n\n  /** Called when the dropdown closes */\n  onDropdownClose?: () => void;\n\n  /** Props passed down to the underlying `Combobox` component */\n  comboboxProps?: Record<string, any>;\n\n  /** Props passed down to the dropdown `ScrollArea` */\n  scrollAreaProps?: ScrollAreaProps;\n\n  /** Controls the default chevron color */\n  chevronColor?: MantineColor;\n\n  /** Props passed down to the hidden input */\n  hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n  /** Opens the dropdown when the input is focused in `searchable` mode @default true */\n  openOnFocus?: boolean;\n}\n\nexport type CascaderFactory = Factory<{\n  props: CascaderProps;\n  ref: HTMLInputElement;\n  stylesNames: CascaderStylesNames;\n  variant: InputVariant;\n}>;\n\nconst defaultProps = {\n  expandTrigger: 'click',\n  safeAreaPolygon: true,\n  changeOnSelect: false,\n  allowDeselect: true,\n  withCheckIcon: true,\n  checkIconPosition: 'right',\n  withColumns: true,\n  searchable: false,\n  separator: '/',\n  maxDisplayedLevels: 3,\n  previousLevelsControlLabel: 'Show previous levels',\n  nextLevelsControlLabel: 'Show next levels',\n  maxDropdownHeight: 260,\n  openOnFocus: true,\n  size: 'sm',\n} satisfies Partial<CascaderProps>;\n\nfunction optionLabelToString(option: CascaderOption): string {\n  return typeof option.label === 'string' || typeof option.label === 'number'\n    ? String(option.label)\n    : option.value;\n}\n\nfunction firstEnabledOptionIndex(options: CascaderOption[]): number {\n  return options.findIndex((option) => !option.disabled);\n}\n\nfunction lastEnabledOptionIndex(options: CascaderOption[]): number {\n  for (let index = options.length - 1; index >= 0; index -= 1) {\n    if (!options[index].disabled) {\n      return index;\n    }\n  }\n  return -1;\n}\n\nfunction joinPathLabels(options: CascaderOption[], separator: string): string {\n  return options.map(optionLabelToString).join(` ${separator} `);\n}\n\nfunction defaultCascaderFilter(\n  query: string,\n  options: CascaderOption[],\n  separator: string\n): boolean {\n  const trimmed = query.trim().toLowerCase();\n  if (trimmed.length === 0) {\n    return true;\n  }\n  return joinPathLabels(options, separator).toLowerCase().includes(trimmed);\n}\n\nfunction defaultRenderSearchOption(\n  options: CascaderOption[],\n  separator: React.ReactNode\n): React.ReactNode {\n  return options.map((option, index) => (\n    <Fragment key={option.value}>\n      {index > 0 && <span data-cascader-separator> {separator} </span>}\n      {option.label ?? option.value}\n    </Fragment>\n  ));\n}\n\nexport const Cascader = factory<CascaderFactory>((_props) => {\n  const props = useProps(['Input', 'InputWrapper', 'Cascader'], defaultProps as any, _props);\n  const {\n    classNames,\n    className,\n    style,\n    styles,\n    unstyled,\n    vars,\n    size,\n    data,\n    value,\n    defaultValue,\n    onChange,\n    changeOnSelect,\n    closeOnSelect,\n    allowDeselect,\n    withCheckIcon,\n    checkIconPosition,\n    withColumns,\n    expandTrigger,\n    safeAreaPolygon,\n    searchable,\n    searchValue,\n    defaultSearchValue,\n    onSearchChange,\n    filter,\n    renderSearchOption,\n    formatValue,\n    renderOption,\n    separator,\n    columnWidth,\n    maxDisplayedLevels,\n    previousLevelsControlLabel,\n    nextLevelsControlLabel,\n    maxDropdownHeight,\n    nothingFoundMessage,\n    clearable,\n    clearSectionMode,\n    clearButtonProps,\n    onClear,\n    dropdownOpened,\n    defaultDropdownOpened,\n    onDropdownOpen,\n    onDropdownClose,\n    comboboxProps,\n    scrollAreaProps,\n    chevronColor,\n    hiddenInputProps,\n    openOnFocus,\n    variant,\n    onKeyDown,\n    onFocus,\n    onBlur,\n    onClick,\n    readOnly,\n    disabled,\n    radius,\n    rightSection,\n    rightSectionWidth,\n    rightSectionPointerEvents,\n    rightSectionProps,\n    leftSection,\n    leftSectionWidth,\n    leftSectionPointerEvents,\n    leftSectionProps,\n    inputContainer,\n    inputWrapperOrder,\n    withAsterisk,\n    labelProps,\n    descriptionProps,\n    errorProps,\n    successProps,\n    wrapperProps,\n    description,\n    label,\n    error,\n    success,\n    withErrorStyles,\n    withSuccessStyles,\n    name,\n    form,\n    id,\n    placeholder,\n    required,\n    mod,\n    attributes,\n    ...others\n  } = props;\n\n  const _id = useId(id);\n  const separatorString =\n    typeof separator === 'string' || typeof separator === 'number' ? String(separator) : '/';\n\n  const combobox = useCombobox({\n    opened: dropdownOpened,\n    defaultOpened: defaultDropdownOpened,\n    onDropdownOpen: () => {\n      onDropdownOpen?.();\n      cascader.resetActivePath();\n    },\n    onDropdownClose: () => {\n      onDropdownClose?.();\n      if (searchable) {\n        setSearchValue(cascader.value ? displayString : '');\n      }\n    },\n  });\n\n  // When `allowDeselect` is enabled, keep the dropdown open by default so the value can be toggled\n  const shouldCloseOnSelect = closeOnSelect ?? !allowDeselect;\n\n  const cascader = useCascader({\n    data,\n    value,\n    defaultValue,\n    onChange,\n    changeOnSelect,\n    allowDeselect,\n    expandTrigger,\n    onLeafSelect: () => {\n      if (shouldCloseOnSelect) {\n        combobox.closeDropdown();\n      }\n    },\n  });\n\n  const getStyles = useStyles<CascaderFactory>({\n    name: 'Cascader',\n    classes,\n    props: props as any,\n    classNames,\n    styles,\n    unstyled,\n    attributes,\n  });\n\n  const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<CascaderFactory>({\n    props,\n    styles,\n    classNames,\n  });\n\n  const {\n    styleProps,\n    rest: { type, autoComplete, ...rest },\n  } = extractStyleProps(others);\n\n  const displayString = useMemo(() => {\n    if (cascader.pathOptions.length === 0 || !cascader.value) {\n      return '';\n    }\n    if (formatValue) {\n      const rendered = formatValue({ value: cascader.value, options: cascader.pathOptions });\n      if (typeof rendered === 'string' || typeof rendered === 'number') {\n        return String(rendered);\n      }\n    }\n    return joinPathLabels(cascader.pathOptions, separatorString);\n  }, [cascader.pathOptions, cascader.value, formatValue, separatorString]);\n\n  const initialSearchValue = useMemo(() => {\n    if (!searchable || !defaultValue) {\n      return '';\n    }\n    return joinPathLabels(getCascaderPathOptions(data, defaultValue), separatorString);\n  }, []);\n\n  const [_searchValue, setSearchValue] = useUncontrolled({\n    value: searchValue,\n    defaultValue: defaultSearchValue,\n    finalValue: initialSearchValue,\n    onChange: onSearchChange,\n  });\n\n  const isSearching =\n    !!searchable && _searchValue.trim().length > 0 && _searchValue !== displayString;\n\n  useEffect(() => {\n    if (searchable) {\n      setSearchValue(cascader.value ? displayString : '');\n    }\n  }, [cascader.value]);\n\n  // The dropdown renders a flat list of paths when searching or when `withColumns` is disabled\n  const showFlatList = isSearching || !withColumns;\n\n  const flatPaths = useMemo(() => flattenCascaderPaths(data), [data]);\n\n  const flatListItems = useMemo(() => {\n    if (!showFlatList) {\n      return [];\n    }\n    const base = flatPaths.filter((flatPath) => (changeOnSelect ? true : flatPath.leaf));\n    if (!isSearching) {\n      return base;\n    }\n    return base.filter((flatPath) =>\n      filter\n        ? filter(_searchValue, flatPath.options)\n        : defaultCascaderFilter(_searchValue, flatPath.options, separatorString)\n    );\n  }, [flatPaths, showFlatList, isSearching, _searchValue, changeOnSelect, filter, separatorString]);\n\n  const canInteract = !readOnly && !disabled;\n\n  const handleSearchChange = (nextValue: string) => {\n    setSearchValue(nextValue);\n    if (canInteract) {\n      combobox.openDropdown();\n    }\n  };\n\n  const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n    onKeyDown?.(event);\n\n    if (event.key === 'Escape') {\n      combobox.closeDropdown();\n      return;\n    }\n\n    if (showFlatList || !canInteract) {\n      return;\n    }\n\n    if (!combobox.dropdownOpened) {\n      const opensDropdown =\n        event.key === 'ArrowDown' ||\n        event.key === 'ArrowUp' ||\n        event.key === 'ArrowRight' ||\n        event.key === 'Enter' ||\n        (!searchable && event.key === ' ');\n\n      if (opensDropdown) {\n        event.preventDefault();\n        cascader.setKeyboardNav(true);\n        combobox.openDropdown();\n\n        if (!cascader.value && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {\n          const rootIndex =\n            event.key === 'ArrowDown'\n              ? firstEnabledOptionIndex(data)\n              : lastEnabledOptionIndex(data);\n          if (rootIndex >= 0) {\n            cascader.setActivePath([data[rootIndex].value]);\n          }\n        }\n      }\n      return;\n    }\n\n    if (cascader.handleColumnsKeyDown(event)) {\n      event.preventDefault();\n    } else if (!searchable && event.key === ' ') {\n      event.preventDefault();\n    }\n  };\n\n  const clearButton = (\n    <Combobox.ClearButton\n      {...clearButtonProps}\n      onClear={() => {\n        onClear?.();\n        cascader.setValue(null);\n        cascader.setActivePath([]);\n        setSearchValue('');\n        combobox.focusTarget();\n      }}\n    />\n  );\n\n  const hasValue = Array.isArray(cascader.value) && cascader.value.length > 0;\n  const _clearable = clearable && hasValue && !disabled && !readOnly;\n\n  const listId = _id ? `${_id}-cascader-list` : undefined;\n  const valueKey = cascader.value ? JSON.stringify(cascader.value) : null;\n\n  const dropdown = (\n    <Combobox.Dropdown\n      hidden={readOnly || disabled}\n      style={showFlatList ? undefined : { padding: 0 }}\n    >\n      {showFlatList ? (\n        <Combobox.Options aria-label={typeof label === 'string' ? label : undefined}>\n          <ScrollArea.Autosize\n            mah={maxDropdownHeight ?? 260}\n            type=\"scroll\"\n            scrollbarSize=\"var(--combobox-padding)\"\n            offsetScrollbars=\"y\"\n            {...scrollAreaProps}\n          >\n            {flatListItems.map((flatPath, index) => {\n              const pathKey = JSON.stringify(flatPath.path);\n              const active = valueKey !== null && pathKey === valueKey;\n              return (\n                <Combobox.Option\n                  key={pathKey}\n                  value={`${index}`}\n                  active={active}\n                  disabled={flatPath.disabled}\n                >\n                  <span {...getStyles('flatOption')}>\n                    {active && withCheckIcon && checkIconPosition === 'left' && (\n                      <CheckIcon {...getStyles('columnOptionCheck')} />\n                    )}\n                    <span {...getStyles('columnOptionLabel')}>\n                      {renderSearchOption\n                        ? renderSearchOption(_searchValue, flatPath.options)\n                        : defaultRenderSearchOption(flatPath.options, separator)}\n                    </span>\n                    {active && withCheckIcon && checkIconPosition !== 'left' && (\n                      <CheckIcon {...getStyles('columnOptionCheck')} />\n                    )}\n                  </span>\n                </Combobox.Option>\n              );\n            })}\n          </ScrollArea.Autosize>\n          {flatListItems.length === 0 && nothingFoundMessage && (\n            <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>\n          )}\n        </Combobox.Options>\n      ) : (\n        <CascaderColumns\n          data={data}\n          activePath={cascader.activePath}\n          value={cascader.value}\n          keyboardNav={cascader.keyboardNav}\n          withCheckIcon={withCheckIcon}\n          checkIconPosition={checkIconPosition}\n          renderOption={renderOption}\n          columnWidth={columnWidth}\n          maxDisplayedLevels={maxDisplayedLevels}\n          previousLevelsControlLabel={previousLevelsControlLabel}\n          nextLevelsControlLabel={nextLevelsControlLabel}\n          maxDropdownHeight={maxDropdownHeight}\n          nothingFoundMessage={nothingFoundMessage}\n          getStyles={getStyles}\n          unstyled={unstyled}\n          scrollAreaProps={scrollAreaProps}\n          onOptionClick={cascader.handleOptionClick}\n          onOptionMouseEnter={cascader.handleOptionMouseEnter}\n          onColumnsMouseLeave={() => {\n            if (expandTrigger === 'hover') {\n              cascader.setActivePath(cascader.value ?? []);\n            }\n          }}\n          onPointerActivity={() => cascader.setKeyboardNav(false)}\n          listId={listId}\n          safeAreaPolygon={expandTrigger === 'hover' ? safeAreaPolygon : false}\n        />\n      )}\n    </Combobox.Dropdown>\n  );\n\n  return (\n    <>\n      <Combobox\n        store={combobox}\n        __staticSelector=\"Cascader\"\n        classNames={resolvedClassNames}\n        styles={resolvedStyles}\n        unstyled={unstyled}\n        readOnly={readOnly}\n        size={size}\n        attributes={attributes}\n        width={showFlatList ? 'target' : 'max-content'}\n        position=\"bottom-start\"\n        onOptionSubmit={(val) => {\n          const index = Number(val);\n          const flatPath = flatListItems[index];\n          if (!flatPath || flatPath.disabled) {\n            return;\n          }\n          cascader.selectPath(flatPath.path);\n          cascader.setActivePath(flatPath.path);\n          if (shouldCloseOnSelect) {\n            combobox.closeDropdown();\n          }\n        }}\n        {...comboboxProps}\n      >\n        <Combobox.Target\n          targetType={searchable ? 'input' : 'button'}\n          withKeyboardNavigation={showFlatList}\n          autoComplete={autoComplete}\n        >\n          <InputBase\n            id={_id}\n            __defaultRightSection={\n              <Combobox.Chevron\n                size={size}\n                error={error}\n                unstyled={unstyled}\n                color={chevronColor}\n              />\n            }\n            __clearSection={clearButton}\n            __clearable={_clearable}\n            __clearSectionMode={clearSectionMode}\n            rightSection={rightSection}\n            rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n            {...rest}\n            {...styleProps}\n            size={size}\n            __staticSelector=\"Cascader\"\n            disabled={disabled}\n            readOnly={readOnly || !searchable}\n            value={searchable ? _searchValue : displayString}\n            onChange={(event) => handleSearchChange(event.currentTarget.value)}\n            onFocus={(event) => {\n              if (openOnFocus && searchable && canInteract) {\n                combobox.openDropdown();\n              }\n              onFocus?.(event);\n            }}\n            onBlur={(event) => {\n              combobox.closeDropdown();\n              onBlur?.(event);\n            }}\n            onClick={(event) => {\n              if (canInteract) {\n                cascader.setKeyboardNav(false);\n                if (searchable) {\n                  combobox.openDropdown();\n                } else {\n                  combobox.toggleDropdown();\n                }\n              }\n              onClick?.(event);\n            }}\n            onKeyDown={handleKeyDown}\n            classNames={resolvedClassNames}\n            styles={resolvedStyles}\n            unstyled={unstyled}\n            pointer={!searchable}\n            error={error}\n            success={success}\n            attributes={attributes}\n            className={className}\n            style={style}\n            variant={variant}\n            radius={radius}\n            leftSection={leftSection}\n            leftSectionWidth={leftSectionWidth}\n            leftSectionPointerEvents={leftSectionPointerEvents}\n            leftSectionProps={leftSectionProps}\n            rightSectionWidth={rightSectionWidth}\n            rightSectionProps={rightSectionProps}\n            inputContainer={inputContainer}\n            inputWrapperOrder={inputWrapperOrder}\n            withAsterisk={withAsterisk}\n            labelProps={labelProps}\n            descriptionProps={descriptionProps}\n            errorProps={errorProps}\n            successProps={successProps}\n            wrapperProps={wrapperProps}\n            description={description}\n            label={label}\n            withErrorStyles={withErrorStyles}\n            withSuccessStyles={withSuccessStyles}\n            placeholder={placeholder}\n            required={required}\n            mod={mod}\n          />\n        </Combobox.Target>\n        {dropdown}\n      </Combobox>\n      <Combobox.HiddenInput\n        value={cascader.value}\n        name={name}\n        form={form}\n        disabled={disabled}\n        {...hiddenInputProps}\n      />\n    </>\n  );\n});\n\nCascader.classes = { ...InputBase.classes, ...Combobox.classes, ...classes };\nCascader.displayName = '@mantine/core/Cascader';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8MA,MAAM,eAAe;CACnB,eAAe;CACf,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;CACb,YAAY;CACZ,WAAW;CACX,oBAAoB;CACpB,4BAA4B;CAC5B,wBAAwB;CACxB,mBAAmB;CACnB,aAAa;CACb,MAAM;AACR;AAEA,SAAS,oBAAoB,QAAgC;CAC3D,OAAO,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,WAC/D,OAAO,OAAO,KAAK,IACnB,OAAO;AAC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