elements\n// rendered by the react_component() Rails helper in ApplicationHelper.\nfunction resolveComponent(name) {\n const keys = componentRequireContext.keys()\n const candidates = [\n `./${name}`,\n `./${name}.jsx`,\n `./${name}.js`,\n `./${name}/index.jsx`,\n `./${name}/index.js`,\n ]\n const key = candidates.find((c) => keys.includes(c))\n if (!key) throw new Error(`Cannot find React component: ${name}`)\n const mod = componentRequireContext(key)\n return mod.default || mod\n}\n\nfunction mountComponents() {\n document.querySelectorAll('[data-react-class]').forEach((node) => {\n const componentName = node.dataset.reactClass\n const props = node.dataset.reactProps ? JSON.parse(node.dataset.reactProps) : {}\n try {\n const Component = resolveComponent(componentName)\n const root = createRoot(node)\n root.render(\n React.createElement(ThemeProvider, { theme },\n React.createElement(Component, props)\n )\n )\n } catch (e) {\n console.error(`Failed to mount React component \"${componentName}\":`, e)\n }\n })\n}\n","import {\n arrayOf, bool, oneOf, number, shape, string,\n} from 'prop-types'\n\nexport const ID = number\n\nexport const EMR = oneOf(['athena', 'allscripts', 'epic', 'cerner', 'modernizing_medicine', 'dr_chrono', 'advanced_md', 'point_click_care', 'nextgen'])\nexport const OrdersDisabledEmr = ['cerner', 'modernizing_medicine', 'dr_chrono']\nexport const NoRecsEmr = ['athena', 'cerner', 'modernizing_medicine', 'dr_chrono']\n\nexport const Source = string\nexport const Sources = arrayOf(Source)\n\nexport const RuleCategory = oneOf(['Advisories', 'Previsit'])\n\nexport const Styles = shape()\n\nexport const OrderPreference = shape({\n options: shape({\n entry_name: string,\n diagnosis_name: string,\n }),\n use_step_therapy: bool,\n action: string,\n description: string,\n})\n\nexport const Tag = shape({\n id: ID,\n name: string,\n})\n\nexport const Tags = arrayOf(Tag)\n\nexport const Subscription = shape({\n id: ID,\n active: bool,\n})\n\nexport const Rule = shape({\n default_display_code: string,\n description: string,\n id: ID,\n link: string,\n name: string,\n order_preference: OrderPreference,\n rule_type: string,\n snomed_diagnosis_name: string,\n source: string,\n subscription: Subscription,\n tags: arrayOf(Tag),\n migrated_at: string\n})\n\nexport const Rules = arrayOf(Rule)\n\nexport const Order = shape({\n order_type: string,\n})\n\nexport const Orders = arrayOf(Order)\n\nexport const Options = shape({\n orders: Orders,\n})\n\nexport const Observation = shape({\n\n})\n\nexport const Patient = shape({\n observations: arrayOf(Observation),\n})\n\nexport const Appointment = shape({\n patient: Patient,\n\n})\n\nexport const Diagnosis = shape({\n\n})\n\nexport const Diagnoses = arrayOf(Diagnosis)\n\nexport const Recommendation = shape({})\n\nexport const Recommendations = arrayOf(Recommendation)\n","import PropTypes from 'prop-types'\nimport React, { Component } from 'react'\nimport DepartmentsTypeahead from '../reusableComponents/DepartmentsTypeahead'\n\nconst DEPARTMENT = PropTypes.shape({\n name: PropTypes.string,\n})\n\nconst propTypes = {\n departments: PropTypes.arrayOf(DEPARTMENT).isRequired,\n currentDepartment: DEPARTMENT,\n organizationId: PropTypes.number.isRequired,\n}\n\nconst defaultProps = {\n currentDepartment: {\n name: '',\n },\n}\n\nconst onOptionSelected = (opt, context) => {\n context.setState({ entry: opt.name })\n const hiddenInput = document.querySelector('#care_team_department_id')\n hiddenInput.value = opt.id\n}\n\nclass DepartmentSearch extends Component {\n constructor(props) {\n super(props)\n const { currentDepartment } = props\n this.state = {\n department: currentDepartment,\n }\n }\n\n render() {\n const { departments, organizationId } = this.props\n const { department } = this.state\n return (\n
\n )\n }\n}\n\nDepartmentSearch.propTypes = propTypes\nDepartmentSearch.defaultProps = defaultProps\n\n","import React from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport { Box, Button } from '@mui/material'\nimport theme from '../theme'\nimport CareTeamCard from './shared/CareTeamCard'\nimport { doRequest } from '../utilities/careTeamsApi'\n\nexport default function CareTeamsList({ careTeams = [], currentUserId, csrfToken = '' }) {\n async function handleJoin(careTeamId) {\n await doRequest('POST', `/care_teams/${careTeamId}/users?id=${currentUserId}`, csrfToken)\n window.location.reload()\n }\n\n async function handleLeave(careTeamId) {\n await doRequest('DELETE', `/care_teams/${careTeamId}/users?id=${currentUserId}`, csrfToken)\n window.location.reload()\n }\n\n return (\n
\n \n {careTeams.map(ct => (\n \n u.isCurrentUser ? (\n \n ) : (\n -\n )\n }\n cardActions={\n !ct.isMember && (\n \n )\n }\n />\n ))}\n \n \n )\n}\n","import React, { useState, useEffect } from 'react'\nimport PropTypes from 'prop-types'\n\nconst SYNTAX_MUTED = '#808080' // muted color for JSON punctuation/delimiters in tree view\n\nconst JsonEditorComponent = ({ value = {}, onChange = null, label = '' }) => {\n const [jsonData, setJsonData] = useState({})\n const [expandedKeys, setExpandedKeys] = useState(new Set())\n const [editMode, setEditMode] = useState(false)\n const [textValue, setTextValue] = useState('')\n const [error, setError] = useState(null)\n\n useEffect(() => {\n const parseValue = (val) => {\n if (!val) return {}\n if (typeof val === 'object') { return val }\n if (typeof val === 'string') {\n try {\n return JSON.parse(val)\n } catch (e) {\n try {\n const jsonString = val.replace(/=>/g, ':')\n return JSON.parse(jsonString)\n } catch (e2) {\n return {}\n }\n }\n }\n return {}\n }\n\n const parsed = parseValue(value)\n setJsonData(parsed)\n setTextValue(JSON.stringify(parsed, null, 2))\n // Expand all top-level keys by default\n setExpandedKeys(new Set(Object.keys(parsed)))\n }, [])\n\n const toggleExpand = (key) => {\n setExpandedKeys(prev => {\n const newSet = new Set(prev)\n if (newSet.has(key)) {\n newSet.delete(key)\n } else {\n newSet.add(key)\n }\n return newSet\n })\n }\n\n const handleTextChange = (e) => {\n const newValue = e.target.value\n setTextValue(newValue)\n\n try {\n const parsed = JSON.parse(newValue)\n setError(null)\n setJsonData(parsed)\n if (onChange) {\n onChange(parsed)\n }\n } catch (e) {\n setError('Invalid JSON')\n }\n }\n\n const renderValue = (val, key = '', depth = 0) => {\n const indent = depth * 16\n\n if (val === null) {\n return
null\n }\n\n if (typeof val === 'boolean') {\n return
{val.toString()}\n }\n\n if (typeof val === 'number') {\n return
{val}\n }\n\n if (typeof val === 'string') {\n return
\"{val}\"\n }\n\n if (Array.isArray(val)) {\n const isExpanded = expandedKeys.has(key)\n return (\n
\n toggleExpand(key)} \n style={{ cursor: 'pointer', userSelect: 'none' }}\n >\n {isExpanded ? '▼' : '►'} \n \n [{val.length}]\n {isExpanded && (\n \n {val.map((item, i) => (\n
\n {i}: \n {renderValue(item, `${key}.${i}`, depth + 1)}\n
\n ))}\n
\n )}\n \n )\n }\n\n if (typeof val === 'object') {\n const isExpanded = expandedKeys.has(key)\n const keys = Object.keys(val)\n return (\n
\n toggleExpand(key)} \n style={{ cursor: 'pointer', userSelect: 'none' }}\n >\n {isExpanded ? '▼' : '►'} \n \n {`{${keys.length}}`}\n {isExpanded && (\n \n {keys.map((k) => (\n
\n \"{k}\"\n : \n {renderValue(val[k], `${key}.${k}`, depth + 1)}\n
\n ))}\n
\n )}\n \n )\n }\n\n return
{String(val)}\n }\n\n return (\n
\n {label && (\n
\n )}\n \n
\n \n \n
\n\n {editMode ? (\n <>\n
\n {error && (\n
\n {error}\n
\n )}\n >\n ) : (\n
\n {Object.keys(jsonData).length === 0 ? (\n
Empty object {'{}'}\n ) : (\n Object.keys(jsonData).map((key) => (\n
\n \"{key}\"\n : \n {renderValue(jsonData[key], key, 0)}\n
\n ))\n )}\n
\n )}\n
\n )\n}\n\nJsonEditorComponent.propTypes = {\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n onChange: PropTypes.func,\n label: PropTypes.string\n}\n\nexport default JsonEditorComponent","import React from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Tabs from '@mui/material/Tabs';\nimport Tab from '@mui/material/Tab';\nimport theme from '../theme/index';\n\nconst TABS_ALL = [\n { label: 'Overview', report: 'overview' },\n { label: 'Medication', report: 'medication' },\n { label: 'Safety', report: 'safety' },\n { label: 'Data', report: 'data' },\n];\n\nexport default function LookerAnalytics({ emr, embedUrl, reportsBasePath }) {\n const tabs = emr === 'epic' ? TABS_ALL.slice(0, 1) : TABS_ALL;\n\n return (\n
\n \n \n {tabs.map(({ label, report }) => (\n \n ))}\n \n \n \n \n \n \n );\n}\n","import React, { useState } from 'react'\nimport log from '../../utilities/logger'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport Divider from '@mui/material/Divider'\nimport Button from '@mui/material/Button'\nimport Box from '@mui/material/Box'\nimport TextField from '@mui/material/TextField'\n\nexport default function MmeCalculation() {\n const [file, setFile] = useState(undefined)\n const handleFileSelect = (event) => {\n setFile(event.target.files[0])\n }\n const [removeInput, setRemoveInput] = useState(\"\")\n const handleRemoveInputChange = (event) => {\n setRemoveInput(event.target.value)\n }\n const handleFileSubmit = (event) => {\n const formData = new FormData()\n formData.append(\"file\", file)\n event.preventDefault()\n const call = { \n method: 'post',\n url: '/root/mme_calculation/med_equivalency_csv',\n contentType: false,\n processData: false,\n data: formData,\n enctype: 'multipart/form-data'\n }\n $.ajax(call)\n .done(() => {\n flash.success('Med Equivalency csv successfully imported')\n })\n .fail((error) => {\n const errorMsg = error.responseJSON?.errors || 'Unknown error'\n const { data, ...callWithoutData } = call\n log({ title: 'Failed to import med equivalency CSV', className: 'MmeCalculation', values: { call: callWithoutData, error: errorMsg } })\n flash.error(`Error importing your med equivalency csv. ${errorMsg}`)\n console.error(error)\n })\n }\n\n const handleRemoveEquivalencies = (event) => {\n event.preventDefault()\n const requestData = {\n input: removeInput,\n }\n const removeCall = {\n method: \"post\",\n url: \"/root/mme_calculation/remove_equivalency_class\",\n data: JSON.stringify(requestData),\n contentType: \"application/json\",\n }\n $.ajax(removeCall)\n .done(() => {\n flash.success('Med Equivalencies have been removed successfully', 50000)\n })\n .fail((error) => {\n log({ title: 'Failed to remove med equivalencies by equivalency class', className: 'MmeCalculation', values: { call: removeCall, error }, context: { removeInput } })\n flash.error(`Error removing med equivalencies by equivalency class. ${error.responseJSON?.errors}`, 50000)\n console.error(error)\n })\n }\n\n return (\n
\n )\n}","import React from 'react'\nimport TableBody from '@mui/material/TableBody'\nimport TableCell from '@mui/material/TableCell'\nimport TableRow from '@mui/material/TableRow'\n\nconst Body = ({ data }) => (\n
\n {data.map((row) => (\n \n {$('#value_set_name').val()}\n {row.description}\n {row.code}\n {row.code_system}\n \n ))}\n \n)\n\nexport default Body","import React from 'react'\nimport TableHead from '@mui/material/TableHead'\nimport TableRow from '@mui/material/TableRow'\nimport TableCell from '@mui/material/TableCell'\n\nconst Header = () => (\n
\n \n \n \n Name\n
\n \n \n \n Description\n
\n \n \n \n Code\n
\n \n \n \n Code System\n
\n \n \n \n)\n\nexport default Header","import React from 'react'\nimport TableContainer from '@mui/material/TableContainer'\nimport MUITable from '@mui/material/Table'\nimport Header from './Header'\nimport Body from './Body'\n\nconst Table = ({ data }) => (\n <>\n
\n \n \n \n \n \n >\n)\n\nexport default Table","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2\"\n}), 'CheckBoxOutlineBlank');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z\"\n}), 'CheckBox');","import React, { useState } from 'react'\nimport { ThemeProvider, styled, createTheme } from '@mui/material/styles'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport TextField from '@mui/material/TextField'\nimport InputLabel from '@mui/material/InputLabel'\nimport Input from '@mui/material/Input'\nimport Select from '@mui/material/Select'\nimport Checkbox from '@mui/material/Checkbox'\nimport CheckBoxOutlineBlank from '@mui/icons-material/CheckBoxOutlineBlank'\nimport CheckBoxIcon from '@mui/icons-material/CheckBox'\nimport MenuItem from '@mui/material/MenuItem'\nimport Table from './Table'\nimport log from '../../utilities/logger'\n\nconst theme = createTheme()\n\nconst StyledSelect = styled(Select)({\n minWidth: '200px',\n})\n\nconst NewValueSet = () => {\n const [query, setQuery] = useState('')\n const [data, setData] = useState([])\n const allOption = { description: \"All\", code: \"\", code_system: \"\" }\n const [valueSets, setValueSets] = useState([])\n const [codeSystem, setCodeSystem] = useState([]) \n const [allSelected, setAllSelected] = useState(false)\n const [checkAllBox, setCheckAllBox] = useState(false)\n const [lastRequest, setLastRequest] = useState(null)\n\n const compareDescriptions = (a, b) => {\n const lowerA = a.description.toLowerCase()\n const lowerB = b.description.toLowerCase()\n if (lowerA < lowerB) { return -1 }\n if (lowerA > lowerB) { return 1 }\n return 0\n } \n\n const handleChange = (event) => {\n setCodeSystem(event.target.value)\n }\n\n const handleCall = (event) => {\n const newQuery = event.target.value\n setQuery(newQuery)\n setAllSelected(false)\n if (lastRequest) {\n lastRequest.abort()\n }\n const call = {\n method: 'get',\n url: '/root/search_athena_rxnorm',\n dataType: 'json',\n contentType: 'application/json',\n data: { api_query: newQuery, code_systems: codeSystem },\n }\n const request = $.ajax(call)\n .done((response) => {\n const optionsSorted = response.value_sets.slice().sort(compareDescriptions)\n if (optionsSorted.length !== 0) setData([allOption].concat(optionsSorted))\n setCheckAllBox(false)\n })\n .fail((error) => {\n log({ title: 'Failed to search Athena/RxNorm value sets', className: 'NewValueSet', values: { call, error }, context: { query: newQuery, codeSystem } })\n console.error(error)\n })\n setLastRequest(request)\n }\n\n const debouncedAthenaCall = _.debounce(handleCall, 300)\n \n const optionText = (option) => {\n let text = option.description\n if (option.code_system === \"ATHENA_ORDER_TYPE\") {\n text = `${option.description} (Athena)`\n } else if (option.code_system === \"RXNORM\") {\n text = `${option.description} (RxNorm)`\n } else if (option.code_system === \"ICD10CM\") {\n text = `${option.description} (ICD10)`\n } else if (option.code_system === \"SNOMEDCT\") {\n text = `${option.description} (SNOMED)`\n }\n return text\n }\n\n const optionSelect = (event, value, reason) => {\n let selectedText\n if (reason === \"clear\") {\n setValueSets([])\n setAllSelected(false)\n setCheckAllBox(false)\n setQuery(\"\")\n } else if (reason === \"selectOption\" || reason === \"removeOption\") {\n selectedText = event.currentTarget.innerText\n }\n\n if (selectedText === \"All\" && checkAllBox === false) {\n setAllSelected(true)\n setCheckAllBox(true)\n setValueSets(valueSets.concat(data.slice(1)).filter((v, i, a) => \n a.indexOf(v) === i\n ))\n } else if (selectedText !== \"All\" && allSelected === false) {\n setValueSets(value)\n } else if (selectedText !== \"All\" && allSelected === true) {\n setAllSelected(false)\n setCheckAllBox(true)\n setValueSets(valueSets.filter(valueSet => optionText(valueSet) !== selectedText))\n } else if (selectedText === \"All\" && checkAllBox === true) {\n setAllSelected(false)\n setCheckAllBox(false)\n setValueSets(valueSets.filter(valueSet => !data.slice(1).includes(valueSet)))\n }\n }\n \n const icon =
\n const checkedIcon =
\n \n // Value Sets to be added will be sent to the form via \"description\" because form can only take a ValueSet field (ex. description, code, code_system, etc.) as an input\n $('#description').val(JSON.stringify(valueSets))\n\n return (\n
\n \n\n {valueSets.length === 0 ? No value sets selected
: }\n \n )\n}\n\nexport default NewValueSet","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { alpha } from '@mui/system/colorManipulator';\nimport { styled } from \"../zero-styled/index.js\";\nimport memoTheme from \"../utils/memoTheme.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport rootShouldForwardProp from \"../styles/rootShouldForwardProp.js\";\nimport ButtonBase from \"../ButtonBase/index.js\";\nimport useEnhancedEffect from \"../utils/useEnhancedEffect.js\";\nimport useForkRef from \"../utils/useForkRef.js\";\nimport ListContext from \"../List/ListContext.js\";\nimport listItemButtonClasses, { getListItemButtonUtilityClass } from \"./listItemButtonClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const overridesResolver = (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, ownerState.dense && styles.dense, ownerState.alignItems === 'flex-start' && styles.alignItemsFlexStart, ownerState.divider && styles.divider, !ownerState.disableGutters && styles.gutters];\n};\nconst useUtilityClasses = ownerState => {\n const {\n alignItems,\n classes,\n dense,\n disabled,\n disableGutters,\n divider,\n selected\n } = ownerState;\n const slots = {\n root: ['root', dense && 'dense', !disableGutters && 'gutters', divider && 'divider', disabled && 'disabled', alignItems === 'flex-start' && 'alignItemsFlexStart', selected && 'selected']\n };\n const composedClasses = composeClasses(slots, getListItemButtonUtilityClass, classes);\n return {\n ...classes,\n ...composedClasses\n };\n};\nconst ListItemButtonRoot = styled(ButtonBase, {\n shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',\n name: 'MuiListItemButton',\n slot: 'Root',\n overridesResolver\n})(memoTheme(({\n theme\n}) => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-start',\n alignItems: 'center',\n position: 'relative',\n textDecoration: 'none',\n minWidth: 0,\n boxSizing: 'border-box',\n textAlign: 'left',\n paddingTop: 8,\n paddingBottom: 8,\n transition: theme.transitions.create('background-color', {\n duration: theme.transitions.duration.shortest\n }),\n '&:hover': {\n textDecoration: 'none',\n backgroundColor: (theme.vars || theme).palette.action.hover,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: 'transparent'\n }\n },\n [`&.${listItemButtonClasses.selected}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),\n [`&.${listItemButtonClasses.focusVisible}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity)\n }\n },\n [`&.${listItemButtonClasses.selected}:hover`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity)\n }\n },\n [`&.${listItemButtonClasses.focusVisible}`]: {\n backgroundColor: (theme.vars || theme).palette.action.focus\n },\n [`&.${listItemButtonClasses.disabled}`]: {\n opacity: (theme.vars || theme).palette.action.disabledOpacity\n },\n variants: [{\n props: ({\n ownerState\n }) => ownerState.divider,\n style: {\n borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`,\n backgroundClip: 'padding-box'\n }\n }, {\n props: {\n alignItems: 'flex-start'\n },\n style: {\n alignItems: 'flex-start'\n }\n }, {\n props: ({\n ownerState\n }) => !ownerState.disableGutters,\n style: {\n paddingLeft: 16,\n paddingRight: 16\n }\n }, {\n props: ({\n ownerState\n }) => ownerState.dense,\n style: {\n paddingTop: 4,\n paddingBottom: 4\n }\n }]\n})));\nconst ListItemButton = /*#__PURE__*/React.forwardRef(function ListItemButton(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiListItemButton'\n });\n const {\n alignItems = 'center',\n autoFocus = false,\n component = 'div',\n children,\n dense = false,\n disableGutters = false,\n divider = false,\n focusVisibleClassName,\n selected = false,\n className,\n ...other\n } = props;\n const context = React.useContext(ListContext);\n const childContext = React.useMemo(() => ({\n dense: dense || context.dense || false,\n alignItems,\n disableGutters\n }), [alignItems, context.dense, dense, disableGutters]);\n const listItemRef = React.useRef(null);\n useEnhancedEffect(() => {\n if (autoFocus) {\n if (listItemRef.current) {\n listItemRef.current.focus();\n } else if (process.env.NODE_ENV !== 'production') {\n console.error('MUI: Unable to set focus to a ListItemButton whose component has not been rendered.');\n }\n }\n }, [autoFocus]);\n const ownerState = {\n ...props,\n alignItems,\n dense: childContext.dense,\n disableGutters,\n divider,\n selected\n };\n const classes = useUtilityClasses(ownerState);\n const handleRef = useForkRef(listItemRef, ref);\n return /*#__PURE__*/_jsx(ListContext.Provider, {\n value: childContext,\n children: /*#__PURE__*/_jsx(ListItemButtonRoot, {\n ref: handleRef,\n href: other.href || other.to\n // `ButtonBase` processes `href` or `to` if `component` is set to 'button'\n ,\n component: (other.href || other.to) && component === 'div' ? 'button' : component,\n focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),\n ownerState: ownerState,\n className: clsx(classes.root, className),\n ...other,\n classes: classes,\n children: children\n })\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? ListItemButton.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * Defines the `align-items` style property.\n * @default 'center'\n */\n alignItems: PropTypes.oneOf(['center', 'flex-start']),\n /**\n * If `true`, the list item is focused during the first mount.\n * Focus will also be triggered if the value changes from false to true.\n * @default false\n */\n autoFocus: PropTypes.bool,\n /**\n * The content of the component if a `ListItemSecondaryAction` is used it must\n * be the last child.\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * If `true`, compact vertical padding designed for keyboard and mouse input is used.\n * The prop defaults to the value inherited from the parent List component.\n * @default false\n */\n dense: PropTypes.bool,\n /**\n * If `true`, the component is disabled.\n * @default false\n */\n disabled: PropTypes.bool,\n /**\n * If `true`, the left and right padding is removed.\n * @default false\n */\n disableGutters: PropTypes.bool,\n /**\n * If `true`, a 1px light border is added to the bottom of the list item.\n * @default false\n */\n divider: PropTypes.bool,\n /**\n * This prop can help identify which element has keyboard focus.\n * The class name will be applied when the element gains the focus through keyboard interaction.\n * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).\n * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).\n * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components\n * if needed.\n */\n focusVisibleClassName: PropTypes.string,\n /**\n * @ignore\n */\n href: PropTypes.string,\n /**\n * Use to apply selected styling.\n * @default false\n */\n selected: PropTypes.bool,\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n} : void 0;\nexport default ListItemButton;","import React, { useState } from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport {\n Box, Typography, TextField, Button, Paper, List, ListItem,\n ListItemButton, ListItemText, Alert, CircularProgress, Divider,\n} from '@mui/material'\nimport SearchIcon from '@mui/icons-material/Search'\nimport theme from '../theme'\n\nconst EMR_ATHENA = 'athena'\nconst EMR_ALLSCRIPTS = 'allscripts'\nconst EMR_EPIC = 'epic'\n\nexport default function PatientSearch({ emr = EMR_ATHENA, organizationId, recommendationsShowPath = '/recommendations/show' }) {\n const [fields, setFields] = useState({ firstname: '', lastname: '', dob: '', patientid: '', search: '' })\n const [results, setResults] = useState(null)\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState(null)\n\n function handleChange(e) {\n setFields(prev => ({ ...prev, [e.target.name]: e.target.value }))\n }\n\n async function handleSubmit(e) {\n e.preventDefault()\n setLoading(true)\n setError(null)\n setResults(null)\n\n const params = new URLSearchParams()\n if (emr === EMR_ALLSCRIPTS) {\n params.set('search', fields.search)\n } else {\n if (fields.firstname) { params.set('firstname', fields.firstname) }\n if (fields.lastname) { params.set('lastname', fields.lastname) }\n if (fields.dob) { params.set('dob', fields.dob) }\n if (fields.patientid) { params.set('patientid', fields.patientid) }\n }\n\n try {\n const resp = await fetch(`/patient_search/find?${params.toString()}`, {\n headers: { Accept: 'application/json' },\n credentials: 'include',\n })\n const data = await resp.json()\n if (!resp.ok) {\n setError(data.error || 'An error occurred. Please try again.')\n } else if (!data.patients || data.patients.length === 0) {\n setError('No patients found. Please make sure to input the full first name, full last name, or both.')\n } else {\n setResults({ patients: data.patients, organizationId: data.organizationId })\n }\n } catch {\n setError('An error occurred. Please try again.')\n } finally {\n setLoading(false)\n }\n }\n\n function patientHref(patient) {\n const p = new URLSearchParams({\n emr_patient_id: patient.emrPatientId,\n emr_department_id: patient.emrDepartmentId,\n organization_id: results.organizationId,\n })\n return `${recommendationsShowPath}?${p.toString()}`\n }\n\n const isAthenaOrEpic = emr === EMR_ATHENA || emr === EMR_EPIC\n\n return (\n
\n \n
\n Search for Patients\n \n Complete at least one field before selecting the search button.\n \n \n \n {isAthenaOrEpic && (\n <>\n \n \n \n \n >\n )}\n {emr === EMR_ALLSCRIPTS && (\n \n )}\n : }\n disabled={loading}\n sx={{ alignSelf: 'center' }}\n >\n Search\n \n \n \n \n\n {error &&
{error}}\n\n {results && results.patients.length > 0 && (\n
\n \n {results.patients.map((patient, idx) => (\n \n {idx > 0 && }\n \n \n \n \n \n \n ))}\n
\n \n )}\n
\n \n )\n}\n","import React from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport Button from '@mui/material/Button';\nimport Link from '@mui/material/Link';\nimport theme from '../theme/index';\n\nexport default function RafRecommendationUpload({ submitPath, csrfToken, backPath }) {\n return (\n
\n \n \n \n \n \n \n Upload RAF Recommendation CSV\n \n \n \n \n \n \n Back\n \n \n \n \n \n \n );\n}\n","import React from 'react'\nimport PropTypes from 'prop-types'\n\nconst SelectableUUID = ({ uuid, label = 'Rule UUID:', labelStyle = {}, uuidStyle = {}, className }) => {\n const stopPropagation = (e) => e.stopPropagation()\n\n return (\n
\n \n {label}\n \n {\n if (e.key === 'Enter' || e.key === ' ') stopPropagation(e)\n }}\n style={{\n userSelect: 'text',\n WebkitUserSelect: 'text',\n MozUserSelect: 'text',\n msUserSelect: 'text',\n cursor: 'pointer',\n ...uuidStyle\n }}\n >\n {uuid}\n \n
\n )\n}\n\nSelectableUUID.propTypes = {\n uuid: PropTypes.string.isRequired,\n label: PropTypes.string,\n labelStyle: PropTypes.shape({}),\n uuidStyle: PropTypes.shape({}),\n className: PropTypes.string\n}\n\nexport default SelectableUUID","import React, { useState } from 'react'\nimport {\n Box, Typography, TextField, Button, Select, MenuItem,\n FormControl, InputLabel, FormControlLabel, Checkbox, Alert, Divider,\n Accordion, AccordionSummary, AccordionDetails,\n} from '@mui/material'\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore'\nimport FormPageCard from '../reusableComponents/FormPageCard'\nimport useFormSubmit from '../reusableComponents/useFormSubmit'\nimport ProviderGroupingFinder from './user/ProviderGroupingFinder'\n\nexport default function UserAccountSettings({\n user = {},\n userId,\n roles = [],\n departments = [],\n organizations = [],\n isShadowUser = false,\n currentUserOrg = null,\n currentUserPg = null,\n submitPath,\n csrfToken = '',\n}) {\n const [firstName, setFirstName] = useState(user.firstName || '')\n const [lastName, setLastName] = useState(user.lastName || '')\n const [email, setEmail] = useState(user.email || '')\n const [phoneNumber, setPhoneNumber] = useState(user.phoneNumber || '')\n const [faxNumber, setFaxNumber] = useState(user.faxNumber || '')\n const [npi, setNpi] = useState(user.npi || '')\n const [roleId, setRoleId] = useState(user.roleId || '')\n const [selectedDeptIds, setSelectedDeptIds] = useState(user.departmentIds || [])\n const [organizationId, setOrganizationId] = useState(currentUserOrg?.id || '')\n const [providerGroupingId, setProviderGroupingId] = useState(currentUserPg?.id || '')\n\n function handleDeptChange(deptId, checked) {\n if (checked) {\n setSelectedDeptIds(prev => [...prev, deptId])\n } else {\n setSelectedDeptIds(prev => prev.filter(id => id !== deptId))\n }\n }\n\n const { error, saving, handleSubmit } = useFormSubmit({\n submitPath,\n csrfToken,\n method: 'PATCH',\n onBuildBody: () => ({\n user: {\n first_name: firstName,\n last_name: lastName,\n email,\n phone_number: phoneNumber,\n fax_number: faxNumber,\n npi,\n role_ids: roleId ? [roleId] : [],\n department_ids: selectedDeptIds,\n ...(isShadowUser ? {\n organization_id: organizationId,\n provider_grouping_id: providerGroupingId,\n } : {}),\n },\n }),\n onSuccess: () => window.location.assign('/'),\n })\n\n return (\n
\n Account Settings\n \n \n Update your name, email, and phone number.\n \n\n {error && {error}}\n\n \n \n setFirstName(e.target.value)}\n sx={{ flex: '1 1 180px' }}\n />\n setLastName(e.target.value)}\n sx={{ flex: '1 1 180px' }}\n />\n \n\n \n setEmail(e.target.value)}\n type=\"email\"\n sx={{ flex: '1 1 200px' }}\n />\n setPhoneNumber(e.target.value)}\n placeholder=\"555-555-5555\"\n sx={{ flex: '1 1 180px' }}\n />\n setFaxNumber(e.target.value)}\n placeholder=\"555-555-5556\"\n sx={{ flex: '1 1 180px' }}\n />\n \n\n \n \n Role\n \n \n setNpi(e.target.value)}\n sx={{ flex: '1 1 180px' }}\n />\n \n\n {isShadowUser && (\n \n \n Provider Grouping\n \n \n )}\n\n \n \n }>\n Departments\n \n \n \n {departments.map(dept => (\n handleDeptChange(dept.id, e.target.checked)}\n />\n }\n label={dept.name}\n />\n ))}\n \n \n \n \n\n \n \n \n )\n}\n","import React, { useState, useEffect } from 'react'\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material'\nimport { bool } from 'prop-types'\nimport log from '../../utilities/logger'\n\nconst propTypes = {\n isStaging: bool.isRequired,\n}\n\nconst MigrateButton = ({ isStaging }) => {\n const [disabled, setDisabled] = useState(false)\n const [creationCount, setCreationCount] = useState(0)\n const [deletionCount, setDeletionCount] = useState(0)\n const [selfPayCount, setSelfPayCount] = useState(0)\n const [isDialogOpen, setDialogOpen] = useState(false)\n\n useEffect(() => {\n const call = {\n method: 'get',\n url: '/root/value_set_migration_count',\n dataType: 'json',\n contentType: 'application/json',\n }\n $.ajax(call)\n .done((response) => {\n setCreationCount(response.creations)\n setDeletionCount(response.deletions)\n setSelfPayCount(response.selfPay)\n })\n .fail((error) => {\n log({ title: 'Failed to fetch value set migration count', className: 'MigrateButton', values: { call, error } })\n console.error(error)\n })\n }, [])\n\n const handleMigration = () => {\n setDisabled(true)\n const migrateCall = {\n method: 'post',\n url: '/root/value_sets/migrate_value_sets',\n dataType: 'json',\n contentType: 'application/json',\n }\n $.ajax(migrateCall)\n .done((response) => {\n console.log(response)\n })\n .fail((error) => {\n log({ title: 'Failed to migrate value sets', className: 'MigrateButton', values: { call: migrateCall, error } })\n console.error(error)\n })\n \n setDialogOpen(false)\n }\n \n const handleButtonClick = () => {\n setDialogOpen(true)\n }\n\n const handleCancel = () => {\n setDialogOpen(false)\n }\n\n return (\n <>\n
\n \n\n \n
\n >\n )\n}\n\nMigrateButton.propTypes = propTypes\n\nexport default MigrateButton","import React, { useState, useEffect } from 'react'\nimport { DataGrid } from '@mui/x-data-grid'\nimport { Card, CardContent } from '@mui/material'\nimport { bool } from 'prop-types'\nimport LoadingSkeleton from '../../loadingSkeleton/LoadingSkeleton'\nimport log from '../../utilities/logger'\nimport MigrateButton from './MigrateButton'\n\nconst columns = [\n { field: 'valueSetName', headerName: 'Name', width: 200 },\n { field: 'description', headerName: 'Description', width: 200},\n { field: 'codeSystem', headerName: 'Code System', width: 200},\n { field: 'code', headerName: 'Code', width: 200},\n { field: 'type', headerName: 'Type', width: 200},\n]\n\nconst propTypes = {\n isStaging: bool.isRequired,\n}\n\n// Custom function to generate unique IDs\n\nconst ShowMigrationValueSets = ({ isStaging }) => {\n const [data, setData] = useState([])\n const [error, setError] = useState(null)\n const [loading, setLoading] = useState(true)\n\n\n useEffect(() => {\n const fetchData = async () => {\n const call = {\n method: 'get',\n url: '/root/value_sets_migration_list',\n dataType: 'json',\n contentType: 'application/json',\n }\n $.ajax(call)\n .done((response) => {\n setData(response.value_sets)\n setLoading(false)\n })\n .fail((errors) => {\n log({ title: 'Failed to fetch value sets migration list', className: 'ShowMigrationValueSets', values: { call, errors } })\n setError(errors)\n setLoading(false)\n console.error(errors)\n })\n }\n fetchData()\n }, [])\n\n const getRowId = (row) => row.description + row.valueSetName + row.codeSystem + row.code + row.type\n\n return (\n
\n
\n \n \n \n
\n
Migration Value Sets
\n \n {loading ? (\n
\n ) : (\n
\n )}\n
\n \n \n
\n )\n}\n\nShowMigrationValueSets.propTypes = propTypes\n\nexport default ShowMigrationValueSets","import React from 'react'\nimport Chip from '@mui/material/Chip'\n\nconst styles = {\n section: {\n fontSize: \"14px\",\n color: \"white\",\n backgroundColor: \"rgba(2, 47, 64, 0.7)\",\n padding: \"5px\",\n },\n wrapper: {\n textAlign: \"right\",\n margin: \"0 auto\",\n marginTop: \"5px\",\n marginRight: \"5px\"\n }\n}\n\nconst StagingChip = () => (\n <>\n
\n \n
\n >\n )\n\nexport default StagingChip","import React, { useState } from 'react'\nimport {\n Box, Typography, TextField, Button, Autocomplete, Alert,\n} from '@mui/material'\nimport FormPageCard from '../../reusableComponents/FormPageCard'\n\nexport default function AdminCareTeamForm({\n careTeam = {},\n organizationId,\n departments = [],\n users = [],\n assignedUsers = [],\n currentDepartment = null,\n submitPath,\n method = 'post',\n csrfToken = '',\n isEdit = false,\n}) {\n const [name, setName] = useState(careTeam.name || '')\n const [department, setDepartment] = useState(currentDepartment || null)\n const [selectedUsers, setSelectedUsers] = useState(assignedUsers)\n const [error, setError] = useState(null)\n const [saving, setSaving] = useState(false)\n\n async function handleSubmit(e) {\n e.preventDefault()\n setSaving(true)\n setError(null)\n\n const body = {\n care_team: {\n name,\n organization_id: organizationId,\n department_id: department?.id || '',\n user_ids: selectedUsers.map(u => u.id),\n },\n }\n\n const resp = await fetch(submitPath, {\n method: method.toUpperCase() === 'POST' ? 'POST' : 'PATCH',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRF-Token': csrfToken,\n Accept: 'application/json, text/html',\n },\n credentials: 'include',\n body: JSON.stringify(body),\n })\n\n if (resp.redirected) {\n window.location.assign(resp.url)\n return\n }\n if (!resp.ok) {\n const data = await resp.json().catch(() => ({}))\n setError(data.errors || 'An error occurred. Please try again.')\n setSaving(false)\n return\n }\n // follow redirect from server\n window.location.assign(resp.url || submitPath.replace('/new', '').replace(/\\/edit$/, ''))\n }\n\n return (\n
\n \n \n {isEdit ? `Edit ${careTeam.name || 'Care Team'}` : 'New Care Team'}\n \n {error && {typeof error === 'string' ? error : JSON.stringify(error)}}\n\n setName(e.target.value)}\n fullWidth\n sx={{ mb: 3 }}\n required\n />\n\n \n Select a department for this care team. Users in this department can join, leave, and switch care teams on their own.\n \n opt.name || ''}\n value={department}\n onChange={(_, val) => setDepartment(val)}\n isOptionEqualToValue={(opt, val) => opt.id === val?.id}\n renderInput={params => }\n sx={{ mb: 3 }}\n />\n\n \n Select users for this care team. MAs and Nurses can see appointments for all Providers in the team.\n \n opt.name || ''}\n value={selectedUsers}\n onChange={(_, val) => setSelectedUsers(val)}\n isOptionEqualToValue={(opt, val) => opt.id === val?.id}\n renderInput={params => }\n sx={{ mb: 3 }}\n />\n\n \n \n \n )\n}\n","import React from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport {\n Box, Typography, Button, Link,\n TableContainer, Table, TableHead, TableBody, TableRow, TableCell, Paper,\n} from '@mui/material'\nimport theme from '../../theme'\n\nfunction doDelete(url, csrfToken) {\n return fetch(url, {\n method: 'DELETE',\n headers: { 'X-CSRF-Token': csrfToken },\n credentials: 'include',\n })\n}\n\nexport default function AdminCareTeamShow({\n careTeamId,\n careTeamName = '',\n users = [],\n editPath = '',\n csrfToken = '',\n}) {\n async function handleRemove(userId) {\n await doDelete(`/admin/care_teams/${careTeamId}/users?id=${userId}`, csrfToken)\n window.location.reload()\n }\n\n return (\n
\n \n {careTeamName}\n \n \n \n \n NAME\n TYPE\n ROLE\n MA\n ACTIONS\n \n \n \n {users.map(u => (\n \n {u.name}\n {u.type}\n {u.role}\n {u.isMa ? 'Yes' : 'No'}\n \n handleRemove(u.id)}\n >\n remove\n \n \n \n ))}\n \n
\n \n \n \n \n )\n}\n","import React, { useState } from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport {\n Box, Typography, Card, CardContent, Button,\n Checkbox, FormControlLabel,\n} from '@mui/material'\nimport theme from '../../theme'\nimport CareTeamCard from '../shared/CareTeamCard'\nimport { doRequest } from '../../utilities/careTeamsApi'\n\nexport default function AdminCareTeamsList({\n careTeams = [],\n currentUserId,\n csrfToken = '',\n newCareTeamPath = '',\n currentUserCareTeamName = null,\n currentUserMedicalAssistant = false,\n currentUserPath = '',\n}) {\n const [medicalAssistant, setMedicalAssistant] = useState(currentUserMedicalAssistant)\n\n async function handleJoin(careTeamId) {\n await doRequest('POST', `/care_teams/${careTeamId}/users?id=${currentUserId}`, csrfToken)\n window.location.reload()\n }\n\n async function handleLeave(careTeamId) {\n await doRequest('DELETE', `/care_teams/${careTeamId}/users?id=${currentUserId}`, csrfToken)\n window.location.reload()\n }\n\n async function handleRemove(careTeamId, userId) {\n await doRequest('DELETE', `/admin/care_teams/${careTeamId}/users?id=${userId}`, csrfToken)\n window.location.reload()\n }\n\n async function handleSaveMedicalAssistant(e) {\n e.preventDefault()\n await doRequest('PATCH', currentUserPath, csrfToken, {\n user: { medical_assistant: medicalAssistant },\n })\n window.location.reload()\n }\n\n return (\n
\n \n {currentUserCareTeamName && (\n \n \n \n My Settings for {currentUserCareTeamName}\n \n \n \n \n )}\n\n {careTeams.map(ct => (\n \n u.isCurrentUser ? (\n \n ) : (\n \n )\n }\n cardActions={\n <>\n \n {!ct.isMember && (\n \n )}\n >\n }\n />\n ))}\n\n {newCareTeamPath && (\n \n )}\n \n \n )\n}\n","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getCardHeaderUtilityClass(slot) {\n return generateUtilityClass('MuiCardHeader', slot);\n}\nconst cardHeaderClasses = generateUtilityClasses('MuiCardHeader', ['root', 'avatar', 'action', 'content', 'title', 'subheader']);\nexport default cardHeaderClasses;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport composeClasses from '@mui/utils/composeClasses';\nimport Typography, { typographyClasses } from \"../Typography/index.js\";\nimport { styled } from \"../zero-styled/index.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport cardHeaderClasses, { getCardHeaderUtilityClass } from \"./cardHeaderClasses.js\";\nimport useSlot from \"../utils/useSlot.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n classes\n } = ownerState;\n const slots = {\n root: ['root'],\n avatar: ['avatar'],\n action: ['action'],\n content: ['content'],\n title: ['title'],\n subheader: ['subheader']\n };\n return composeClasses(slots, getCardHeaderUtilityClass, classes);\n};\nconst CardHeaderRoot = styled('div', {\n name: 'MuiCardHeader',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n return [{\n [`& .${cardHeaderClasses.title}`]: styles.title\n }, {\n [`& .${cardHeaderClasses.subheader}`]: styles.subheader\n }, styles.root];\n }\n})({\n display: 'flex',\n alignItems: 'center',\n padding: 16\n});\nconst CardHeaderAvatar = styled('div', {\n name: 'MuiCardHeader',\n slot: 'Avatar',\n overridesResolver: (props, styles) => styles.avatar\n})({\n display: 'flex',\n flex: '0 0 auto',\n marginRight: 16\n});\nconst CardHeaderAction = styled('div', {\n name: 'MuiCardHeader',\n slot: 'Action',\n overridesResolver: (props, styles) => styles.action\n})({\n flex: '0 0 auto',\n alignSelf: 'flex-start',\n marginTop: -4,\n marginRight: -8,\n marginBottom: -4\n});\nconst CardHeaderContent = styled('div', {\n name: 'MuiCardHeader',\n slot: 'Content',\n overridesResolver: (props, styles) => styles.content\n})({\n flex: '1 1 auto',\n [`.${typographyClasses.root}:where(& .${cardHeaderClasses.title})`]: {\n display: 'block'\n },\n [`.${typographyClasses.root}:where(& .${cardHeaderClasses.subheader})`]: {\n display: 'block'\n }\n});\nconst CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiCardHeader'\n });\n const {\n action,\n avatar,\n component = 'div',\n disableTypography = false,\n subheader: subheaderProp,\n subheaderTypographyProps,\n title: titleProp,\n titleTypographyProps,\n slots = {},\n slotProps = {},\n ...other\n } = props;\n const ownerState = {\n ...props,\n component,\n disableTypography\n };\n const classes = useUtilityClasses(ownerState);\n const externalForwardedProps = {\n slots,\n slotProps: {\n title: titleTypographyProps,\n subheader: subheaderTypographyProps,\n ...slotProps\n }\n };\n let title = titleProp;\n const [TitleSlot, titleSlotProps] = useSlot('title', {\n className: classes.title,\n elementType: Typography,\n externalForwardedProps,\n ownerState,\n additionalProps: {\n variant: avatar ? 'body2' : 'h5',\n component: 'span'\n }\n });\n if (title != null && title.type !== Typography && !disableTypography) {\n title = /*#__PURE__*/_jsx(TitleSlot, {\n ...titleSlotProps,\n children: title\n });\n }\n let subheader = subheaderProp;\n const [SubheaderSlot, subheaderSlotProps] = useSlot('subheader', {\n className: classes.subheader,\n elementType: Typography,\n externalForwardedProps,\n ownerState,\n additionalProps: {\n variant: avatar ? 'body2' : 'body1',\n color: 'textSecondary',\n component: 'span'\n }\n });\n if (subheader != null && subheader.type !== Typography && !disableTypography) {\n subheader = /*#__PURE__*/_jsx(SubheaderSlot, {\n ...subheaderSlotProps,\n children: subheader\n });\n }\n const [RootSlot, rootSlotProps] = useSlot('root', {\n ref,\n className: classes.root,\n elementType: CardHeaderRoot,\n externalForwardedProps: {\n ...externalForwardedProps,\n ...other,\n component\n },\n ownerState\n });\n const [AvatarSlot, avatarSlotProps] = useSlot('avatar', {\n className: classes.avatar,\n elementType: CardHeaderAvatar,\n externalForwardedProps,\n ownerState\n });\n const [ContentSlot, contentSlotProps] = useSlot('content', {\n className: classes.content,\n elementType: CardHeaderContent,\n externalForwardedProps,\n ownerState\n });\n const [ActionSlot, actionSlotProps] = useSlot('action', {\n className: classes.action,\n elementType: CardHeaderAction,\n externalForwardedProps,\n ownerState\n });\n return /*#__PURE__*/_jsxs(RootSlot, {\n ...rootSlotProps,\n children: [avatar && /*#__PURE__*/_jsx(AvatarSlot, {\n ...avatarSlotProps,\n children: avatar\n }), /*#__PURE__*/_jsxs(ContentSlot, {\n ...contentSlotProps,\n children: [title, subheader]\n }), action && /*#__PURE__*/_jsx(ActionSlot, {\n ...actionSlotProps,\n children: action\n })]\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? CardHeader.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The action to display in the card header.\n */\n action: PropTypes.node,\n /**\n * The Avatar element to display.\n */\n avatar: PropTypes.node,\n /**\n * @ignore\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * If `true`, `subheader` and `title` won't be wrapped by a Typography component.\n * This can be useful to render an alternative Typography variant by wrapping\n * the `title` text, and optional `subheader` text\n * with the Typography component.\n * @default false\n */\n disableTypography: PropTypes.bool,\n /**\n * The props used for each slot inside.\n * @default {}\n */\n slotProps: PropTypes.shape({\n action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n avatar: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n content: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n subheader: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n title: PropTypes.oneOfType([PropTypes.func, PropTypes.object])\n }),\n /**\n * The components used for each slot inside.\n * @default {}\n */\n slots: PropTypes.shape({\n action: PropTypes.elementType,\n avatar: PropTypes.elementType,\n content: PropTypes.elementType,\n root: PropTypes.elementType,\n subheader: PropTypes.elementType,\n title: PropTypes.elementType\n }),\n /**\n * The content of the component.\n */\n subheader: PropTypes.node,\n /**\n * These props will be forwarded to the subheader\n * (as long as disableTypography is not `true`).\n * @deprecated Use `slotProps.subheader` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.\n */\n subheaderTypographyProps: PropTypes.object,\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n /**\n * The content of the component.\n */\n title: PropTypes.node,\n /**\n * These props will be forwarded to the title\n * (as long as disableTypography is not `true`).\n * @deprecated Use `slotProps.title` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.\n */\n titleTypographyProps: PropTypes.object\n} : void 0;\nexport default CardHeader;","import React, { useState } from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport CardHeader from '@mui/material/CardHeader';\nimport FormControl from '@mui/material/FormControl';\nimport InputLabel from '@mui/material/InputLabel';\nimport Select from '@mui/material/Select';\nimport MenuItem from '@mui/material/MenuItem';\nimport Button from '@mui/material/Button';\nimport Typography from '@mui/material/Typography';\nimport theme from '../../theme/index';\n\nexport default function AdminDictionariesImport({ organizations, importPath, csrfToken }) {\n const [selectedOrgId, setSelectedOrgId] = useState('');\n\n return (\n
\n \n \n Dictionaries}\n />\n \n \n \n \n Organization\n \n \n \n \n \n \n \n \n );\n}\n","import React, { useState } from 'react'\nimport {\n Box, Typography, TextField, Button, Select, MenuItem,\n FormControl, InputLabel, Alert,\n} from '@mui/material'\nimport log from '../../utilities/logger'\nimport FormPageCard from '../../reusableComponents/FormPageCard'\n\nconst EMR_OPTIONS = [\n 'athena', 'epic', 'cerner', 'dr_chrono', 'modernizing_medicine',\n 'allscripts', 'nextgen', 'point_click_care', 'advanced_md', 'disabled',\n]\n\nconst US_TIMEZONES = [\n 'Hawaii', 'Alaska', 'Pacific Time (US & Canada)', 'Arizona',\n 'Mountain Time (US & Canada)', 'Central Time (US & Canada)',\n 'Eastern Time (US & Canada)', 'Indiana (East)',\n]\n\nexport default function AdminOrganizationForm({\n organization = {},\n submitPath,\n isEdit = false,\n csrfToken = '',\n}) {\n const [name, setName] = useState(organization.name || '')\n const [emr, setEmr] = useState(organization.emr || '')\n const [practiceId, setPracticeId] = useState(organization.practiceId || '')\n const [timeZone, setTimeZone] = useState(organization.timeZone || 'Eastern Time (US & Canada)')\n const [allowedUsernames, setAllowedUsernames] = useState(organization.allowedUsernames || '')\n const [error, setError] = useState(null)\n const [saving, setSaving] = useState(false)\n\n async function handleSubmit(e) {\n e.preventDefault()\n setSaving(true)\n setError(null)\n\n const body = {\n organization: {\n name,\n emr,\n time_zone: timeZone,\n practice_id: practiceId,\n allowed_usernames: allowedUsernames,\n },\n }\n\n try {\n const resp = await fetch(submitPath, {\n method: isEdit ? 'PATCH' : 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n 'X-CSRF-Token': csrfToken,\n },\n credentials: 'include',\n body: JSON.stringify(body),\n })\n\n const data = await resp.json().catch(() => ({}))\n\n if (resp.ok) {\n window.location.assign(data.redirect_url || '/admin/organizations')\n return\n }\n\n const errorMessage = data.errors ? JSON.stringify(data.errors) : 'An error occurred. Please try again.'\n log({\n title: isEdit ? 'Failed to update organization' : 'Failed to create organization',\n className: 'AdminOrganizationForm',\n context: { submitPath, isEdit, organizationId: organization.id },\n values: { status: resp.status, errors: data.errors },\n severity: 'ERROR',\n })\n setError(errorMessage)\n setSaving(false)\n } catch (e) {\n log({\n title: isEdit ? 'Unexpected error updating organization' : 'Unexpected error creating organization',\n className: 'AdminOrganizationForm',\n context: { submitPath, isEdit, organizationId: organization.id },\n exceptionText: e.message,\n severity: 'ERROR',\n })\n setError('An unexpected error occurred. Please try again.')\n setSaving(false)\n }\n }\n\n return (\n
\n \n \n {isEdit ? `Edit ${organization.name || 'Organization'}` : 'New Organization'}\n \n\n {error && {error}}\n\n \n setName(e.target.value)}\n required\n sx={{ flex: '1 1 200px' }}\n />\n \n EMR\n \n \n \n\n \n setPracticeId(e.target.value)}\n sx={{ flex: '1 1 200px' }}\n />\n \n Time Zone\n \n \n \n\n setAllowedUsernames(e.target.value)}\n fullWidth\n multiline\n minRows={2}\n placeholder=\"Comma-separated provider usernames: nweiner1, nweiner2, etc.\"\n sx={{ mb: 3 }}\n />\n\n \n \n \n )\n}\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4\"\n}), 'Person');","import React from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport {\n Box, Button, Typography, Link, Alert,\n Accordion, AccordionSummary, AccordionDetails,\n Table, TableHead, TableBody, TableRow, TableCell, TableContainer, Paper, Chip,\n} from '@mui/material'\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore'\nimport PersonIcon from '@mui/icons-material/Person'\nimport theme from '../../theme'\n\nexport default function AdminOrganizationsList({ organizations = [], newOrgPath = '', csrfToken = '' }) {\n return (\n
\n \n {organizations.map(org => (\n \n }>\n \n {org.name}\n }\n label={org.userCount}\n size=\"small\"\n sx={{ mr: 2 }}\n />\n \n \n \n EHR: {org.emr}\n Time Zone: {org.timeZone}\n {org.onboardingError && (\n \n Onboarding incomplete: {org.onboardingError}\n \n )}\n {/* Redirect-based POST so the Rails flash renders on reload */}\n \n \n \n \n \n {org.name} Users\n \n \n \n \n \n NAME\n TYPE\n ROLE\n ACTIONS\n \n \n \n {org.users.map(u => (\n \n {u.name}\n {u.type}\n {u.role}\n \n {u.editable && (\n \n Edit\n \n )}\n \n \n ))}\n \n
\n \n \n \n \n ))}\n {newOrgPath && (\n \n \n \n )}\n \n \n )\n}\n","import React, { useState } from 'react'\nimport {\n Box, Typography, TextField, Button, Select, MenuItem, FormControl,\n InputLabel, FormControlLabel, Checkbox, Divider, Alert, Autocomplete,\n} from '@mui/material'\nimport FormPageCard from '../../reusableComponents/FormPageCard'\nimport useFormSubmit from '../../reusableComponents/useFormSubmit'\n\nexport default function AdminUserEditForm({\n user = {},\n userId,\n departments = [],\n assignedDepartments = [],\n providerGroupings = [],\n isCurrentUser = false,\n isRoot = false,\n submitPath,\n csrfToken = '',\n}) {\n const [firstName, setFirstName] = useState(user.firstName || '')\n const [lastName, setLastName] = useState(user.lastName || '')\n const [email, setEmail] = useState(user.email || '')\n const [providerGroupingId, setProviderGroupingId] = useState(user.providerGroupingId || '')\n const [ssoAccessPermitted, setSsoAccessPermitted] = useState(!!user.ssoAccessPermitted)\n const [admin, setAdmin] = useState(!!user.admin)\n const [medicalAssistant, setMedicalAssistant] = useState(!!user.medicalAssistant)\n const [billable, setBillable] = useState(!!user.billable)\n const [shadowUser, setShadowUser] = useState(!!user.shadowUser)\n const [selectedDepts, setSelectedDepts] = useState(assignedDepartments)\n\n const { error, saving, handleSubmit } = useFormSubmit({\n submitPath,\n csrfToken,\n method: 'PATCH',\n onBuildBody: () => ({\n user: {\n first_name: firstName,\n last_name: lastName,\n email,\n provider_grouping_id: providerGroupingId || null,\n sso_access_permitted: ssoAccessPermitted,\n admin,\n department_ids: selectedDepts.map(d => d.id),\n ...(isRoot && { medical_assistant: medicalAssistant, billable, shadow_user: shadowUser }),\n },\n }),\n onSuccess: () => window.location.assign('/admin/users'),\n })\n\n const displayName = isCurrentUser\n ? 'Edit Your Account'\n : `Edit ${user.firstName || ''} ${user.lastName || ''}'s Account`\n\n return (\n
\n {displayName}\n \n {!isCurrentUser && Change this user's account information.}\n\n {error && {error}}\n\n \n \n setFirstName(e.target.value)}\n sx={{ flex: '1 1 200px' }}\n />\n setLastName(e.target.value)}\n sx={{ flex: '1 1 200px' }}\n />\n \n \n setEmail(e.target.value)}\n type=\"email\"\n sx={{ flex: '1 1 200px' }}\n />\n \n Provider Group\n \n \n \n\n User Permissions\n \n setSsoAccessPermitted(e.target.checked)} />}\n label=\"User can access Avhana?\"\n />\n setAdmin(e.target.checked)} />}\n label=\"Admin privileges?\"\n />\n \n\n {isRoot && (\n <>\n \n \n Root-only fields\n \n \n setMedicalAssistant(e.target.checked)} />}\n label=\"Medical Assistant\"\n />\n setBillable(e.target.checked)} />}\n label=\"Billable\"\n />\n setShadowUser(e.target.checked)} />}\n label=\"Shadow User\"\n />\n \n >\n )}\n\n Departments\n opt.name || ''}\n value={selectedDepts}\n onChange={(_, val) => setSelectedDepts(val)}\n isOptionEqualToValue={(opt, val) => opt.id === val?.id}\n renderInput={params => }\n sx={{ mb: 3 }}\n />\n\n \n \n \n )\n}\n","import React from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport {\n Box, Typography, Button, Link,\n TableContainer, Table, TableHead, TableBody, TableRow, TableCell, Paper,\n} from '@mui/material'\nimport theme from '../../theme'\n\nexport default function AdminUserShow({ userName = '', versions = [], backPath = '/admin/users' }) {\n return (\n
\n \n {userName}'s history\n \n ← Back\n \n \n \n \n \n Event\n Type\n ID\n Time\n \n \n \n {versions.map((v, i) => (\n \n {v.event}\n {v.itemType}\n {v.itemId}\n {v.createdAt}\n \n ))}\n \n
\n \n \n \n )\n}\n","import React from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport {\n Box, Typography, TableContainer, Table, TableHead, TableRow, TableCell,\n TableBody, Button, Link, Card, CardContent,\n} from '@mui/material'\nimport theme from '../../theme'\n\nexport default function AdminUsersList({ users = [], orgName = '', newUserPath = '' }) {\n return (\n
\n \n
\n \n \n \n Manage {orgName} Users\n \n {newUserPath && (\n \n )}\n \n \n \n \n NAME\n TYPE\n ROLE\n ACTIONS\n \n \n \n {users.map(user => (\n \n {user.name}\n {user.type}\n {user.role}\n \n {user.editable && (\n \n )}\n \n \n ))}\n \n
\n \n \n
\n \n )\n}\n","import React from 'react'\nimport { func, bool } from 'prop-types'\nimport CloseIcon from '@mui/icons-material/Close'\nimport Chip from '@mui/material/Chip'\n\nimport { Styles, Tag as TagType } from '../athenaTypes'\n\nconst propTypes = {\n tag: TagType.isRequired,\n removeTagHandler: func.isRequired,\n styles: Styles.isRequired,\n notProduction: bool.isRequired,\n}\n\nconst Tag = ({ tag, removeTagHandler, styles, notProduction }) => {\n if (notProduction) {\n return (\n
{}}\n deleteIcon={\n { e.stopPropagation(); removeTagHandler(e, tag) }} />\n }\n />\n )\n }\n return \n}\n\nTag.propTypes = propTypes\n\nexport default Tag\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","import defineProperty from \"./defineProperty.js\";\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nexport { _objectSpread2 as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nexport { _createClass as default };","function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };","function _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, _getPrototypeOf(t);\n}\nexport { _getPrototypeOf as default };","function _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {\n return !!t;\n })();\n}\nexport { _isNativeReflectConstruct as default };","import _typeof from \"./typeof.js\";\nimport assertThisInitialized from \"./assertThisInitialized.js\";\nfunction _possibleConstructorReturn(t, e) {\n if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e;\n if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return assertThisInitialized(t);\n}\nexport { _possibleConstructorReturn as default };","function _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n}\nexport { _assertThisInitialized as default };","function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nexport { _arrayLikeToArray as default };","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;\n }\n}\nexport { _unsupportedIterableToArray as default };","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nfunction _toConsumableArray(r) {\n return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread();\n}\nexport { _toConsumableArray as default };","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nfunction _arrayWithoutHoles(r) {\n if (Array.isArray(r)) return arrayLikeToArray(r);\n}\nexport { _arrayWithoutHoles as default };","function _iterableToArray(r) {\n if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);\n}\nexport { _iterableToArray as default };","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _nonIterableSpread as default };","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nfunction _slicedToArray(r, e) {\n return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();\n}\nexport { _slicedToArray as default };","function _arrayWithHoles(r) {\n if (Array.isArray(r)) return r;\n}\nexport { _arrayWithHoles as default };","function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}\nexport { _iterableToArrayLimit as default };","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _nonIterableRest as default };","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nfunction _objectWithoutProperties(e, t) {\n if (null == e) return {};\n var o,\n r,\n i = objectWithoutPropertiesLoose(e, t);\n if (Object.getOwnPropertySymbols) {\n var n = Object.getOwnPropertySymbols(e);\n for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);\n }\n return i;\n}\nexport { _objectWithoutProperties as default };","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };","import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport { jsx, keyframes, css as css$2 } from '@emotion/react';\nimport _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';\nimport _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';\nimport _typeof from '@babel/runtime/helpers/esm/typeof';\nimport _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';\nimport _defineProperty from '@babel/runtime/helpers/esm/defineProperty';\nimport { useContext, useRef, useState, useMemo, useCallback, createContext } from 'react';\nimport { createPortal } from 'react-dom';\nimport { autoUpdate } from '@floating-ui/dom';\nimport useLayoutEffect from 'use-isomorphic-layout-effect';\n\nvar _excluded$4 = [\"className\", \"clearValue\", \"cx\", \"getStyles\", \"getClassNames\", \"getValue\", \"hasValue\", \"isMulti\", \"isRtl\", \"options\", \"selectOption\", \"selectProps\", \"setValue\", \"theme\"];\n// ==============================\n// NO OP\n// ==============================\n\nvar noop = function noop() {};\n\n// ==============================\n// Class Name Prefixer\n// ==============================\n\n/**\n String representation of component state for styling with class names.\n\n Expects an array of strings OR a string/object pair:\n - className(['comp', 'comp-arg', 'comp-arg-2'])\n @returns 'react-select__comp react-select__comp-arg react-select__comp-arg-2'\n - className('comp', { some: true, state: false })\n @returns 'react-select__comp react-select__comp--some'\n*/\nfunction applyPrefixToName(prefix, name) {\n if (!name) {\n return prefix;\n } else if (name[0] === '-') {\n return prefix + name;\n } else {\n return prefix + '__' + name;\n }\n}\nfunction classNames(prefix, state) {\n for (var _len = arguments.length, classNameList = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n classNameList[_key - 2] = arguments[_key];\n }\n var arr = [].concat(classNameList);\n if (state && prefix) {\n for (var key in state) {\n if (state.hasOwnProperty(key) && state[key]) {\n arr.push(\"\".concat(applyPrefixToName(prefix, key)));\n }\n }\n }\n return arr.filter(function (i) {\n return i;\n }).map(function (i) {\n return String(i).trim();\n }).join(' ');\n}\n// ==============================\n// Clean Value\n// ==============================\n\nvar cleanValue = function cleanValue(value) {\n if (isArray(value)) return value.filter(Boolean);\n if (_typeof(value) === 'object' && value !== null) return [value];\n return [];\n};\n\n// ==============================\n// Clean Common Props\n// ==============================\n\nvar cleanCommonProps = function cleanCommonProps(props) {\n //className\n props.className;\n props.clearValue;\n props.cx;\n props.getStyles;\n props.getClassNames;\n props.getValue;\n props.hasValue;\n props.isMulti;\n props.isRtl;\n props.options;\n props.selectOption;\n props.selectProps;\n props.setValue;\n props.theme;\n var innerProps = _objectWithoutProperties(props, _excluded$4);\n return _objectSpread({}, innerProps);\n};\n\n// ==============================\n// Get Style Props\n// ==============================\n\nvar getStyleProps = function getStyleProps(props, name, classNamesState) {\n var cx = props.cx,\n getStyles = props.getStyles,\n getClassNames = props.getClassNames,\n className = props.className;\n return {\n css: getStyles(name, props),\n className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className)\n };\n};\n\n// ==============================\n// Handle Input Change\n// ==============================\n\nfunction handleInputChange(inputValue, actionMeta, onInputChange) {\n if (onInputChange) {\n var _newValue = onInputChange(inputValue, actionMeta);\n if (typeof _newValue === 'string') return _newValue;\n }\n return inputValue;\n}\n\n// ==============================\n// Scroll Helpers\n// ==============================\n\nfunction isDocumentElement(el) {\n return [document.documentElement, document.body, window].indexOf(el) > -1;\n}\n\n// Normalized Scroll Top\n// ------------------------------\n\nfunction normalizedHeight(el) {\n if (isDocumentElement(el)) {\n return window.innerHeight;\n }\n return el.clientHeight;\n}\n\n// Normalized scrollTo & scrollTop\n// ------------------------------\n\nfunction getScrollTop(el) {\n if (isDocumentElement(el)) {\n return window.pageYOffset;\n }\n return el.scrollTop;\n}\nfunction scrollTo(el, top) {\n // with a scroll distance, we perform scroll on the element\n if (isDocumentElement(el)) {\n window.scrollTo(0, top);\n return;\n }\n el.scrollTop = top;\n}\n\n// Get Scroll Parent\n// ------------------------------\n\nfunction getScrollParent(element) {\n var style = getComputedStyle(element);\n var excludeStaticParent = style.position === 'absolute';\n var overflowRx = /(auto|scroll)/;\n if (style.position === 'fixed') return document.documentElement;\n for (var parent = element; parent = parent.parentElement;) {\n style = getComputedStyle(parent);\n if (excludeStaticParent && style.position === 'static') {\n continue;\n }\n if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent;\n }\n }\n return document.documentElement;\n}\n\n// Animated Scroll To\n// ------------------------------\n\n/**\n @param t: time (elapsed)\n @param b: initial value\n @param c: amount of change\n @param d: duration\n*/\nfunction easeOutCubic(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n}\nfunction animatedScrollTo(element, to) {\n var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;\n var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;\n var start = getScrollTop(element);\n var change = to - start;\n var increment = 10;\n var currentTime = 0;\n function animateScroll() {\n currentTime += increment;\n var val = easeOutCubic(currentTime, start, change, duration);\n scrollTo(element, val);\n if (currentTime < duration) {\n window.requestAnimationFrame(animateScroll);\n } else {\n callback(element);\n }\n }\n animateScroll();\n}\n\n// Scroll Into View\n// ------------------------------\n\nfunction scrollIntoView(menuEl, focusedEl) {\n var menuRect = menuEl.getBoundingClientRect();\n var focusedRect = focusedEl.getBoundingClientRect();\n var overScroll = focusedEl.offsetHeight / 3;\n if (focusedRect.bottom + overScroll > menuRect.bottom) {\n scrollTo(menuEl, Math.min(focusedEl.offsetTop + focusedEl.clientHeight - menuEl.offsetHeight + overScroll, menuEl.scrollHeight));\n } else if (focusedRect.top - overScroll < menuRect.top) {\n scrollTo(menuEl, Math.max(focusedEl.offsetTop - overScroll, 0));\n }\n}\n\n// ==============================\n// Get bounding client object\n// ==============================\n\n// cannot get keys using array notation with DOMRect\nfunction getBoundingClientObj(element) {\n var rect = element.getBoundingClientRect();\n return {\n bottom: rect.bottom,\n height: rect.height,\n left: rect.left,\n right: rect.right,\n top: rect.top,\n width: rect.width\n };\n}\n\n// ==============================\n// Touch Capability Detector\n// ==============================\n\nfunction isTouchCapable() {\n try {\n document.createEvent('TouchEvent');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n// ==============================\n// Mobile Device Detector\n// ==============================\n\nfunction isMobileDevice() {\n try {\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n } catch (e) {\n return false;\n }\n}\n\n// ==============================\n// Passive Event Detector\n// ==============================\n\n// https://github.com/rafgraph/detect-it/blob/main/src/index.ts#L19-L36\nvar passiveOptionAccessed = false;\nvar options = {\n get passive() {\n return passiveOptionAccessed = true;\n }\n};\n// check for SSR\nvar w = typeof window !== 'undefined' ? window : {};\nif (w.addEventListener && w.removeEventListener) {\n w.addEventListener('p', noop, options);\n w.removeEventListener('p', noop, false);\n}\nvar supportsPassiveEvents = passiveOptionAccessed;\nfunction notNullish(item) {\n return item != null;\n}\nfunction isArray(arg) {\n return Array.isArray(arg);\n}\nfunction valueTernary(isMulti, multiValue, singleValue) {\n return isMulti ? multiValue : singleValue;\n}\nfunction singleValueAsValue(singleValue) {\n return singleValue;\n}\nfunction multiValueAsValue(multiValue) {\n return multiValue;\n}\nvar removeProps = function removeProps(propsObj) {\n for (var _len2 = arguments.length, properties = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n properties[_key2 - 1] = arguments[_key2];\n }\n var propsMap = Object.entries(propsObj).filter(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 1),\n key = _ref2[0];\n return !properties.includes(key);\n });\n return propsMap.reduce(function (newProps, _ref3) {\n var _ref4 = _slicedToArray(_ref3, 2),\n key = _ref4[0],\n val = _ref4[1];\n newProps[key] = val;\n return newProps;\n }, {});\n};\n\nvar _excluded$3 = [\"children\", \"innerProps\"],\n _excluded2$1 = [\"children\", \"innerProps\"];\nfunction getMenuPlacement(_ref) {\n var preferredMaxHeight = _ref.maxHeight,\n menuEl = _ref.menuEl,\n minHeight = _ref.minHeight,\n preferredPlacement = _ref.placement,\n shouldScroll = _ref.shouldScroll,\n isFixedPosition = _ref.isFixedPosition,\n controlHeight = _ref.controlHeight;\n var scrollParent = getScrollParent(menuEl);\n var defaultState = {\n placement: 'bottom',\n maxHeight: preferredMaxHeight\n };\n\n // something went wrong, return default state\n if (!menuEl || !menuEl.offsetParent) return defaultState;\n\n // we can't trust `scrollParent.scrollHeight` --> it may increase when\n // the menu is rendered\n var _scrollParent$getBoun = scrollParent.getBoundingClientRect(),\n scrollHeight = _scrollParent$getBoun.height;\n var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(),\n menuBottom = _menuEl$getBoundingCl.bottom,\n menuHeight = _menuEl$getBoundingCl.height,\n menuTop = _menuEl$getBoundingCl.top;\n var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(),\n containerTop = _menuEl$offsetParent$.top;\n var viewHeight = isFixedPosition ? window.innerHeight : normalizedHeight(scrollParent);\n var scrollTop = getScrollTop(scrollParent);\n var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10);\n var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10);\n var viewSpaceAbove = containerTop - marginTop;\n var viewSpaceBelow = viewHeight - menuTop;\n var scrollSpaceAbove = viewSpaceAbove + scrollTop;\n var scrollSpaceBelow = scrollHeight - scrollTop - menuTop;\n var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom;\n var scrollUp = scrollTop + menuTop - marginTop;\n var scrollDuration = 160;\n switch (preferredPlacement) {\n case 'auto':\n case 'bottom':\n // 1: the menu will fit, do nothing\n if (viewSpaceBelow >= menuHeight) {\n return {\n placement: 'bottom',\n maxHeight: preferredMaxHeight\n };\n }\n\n // 2: the menu will fit, if scrolled\n if (scrollSpaceBelow >= menuHeight && !isFixedPosition) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollDown, scrollDuration);\n }\n return {\n placement: 'bottom',\n maxHeight: preferredMaxHeight\n };\n }\n\n // 3: the menu will fit, if constrained\n if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollDown, scrollDuration);\n }\n\n // we want to provide as much of the menu as possible to the user,\n // so give them whatever is available below rather than the minHeight.\n var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom;\n return {\n placement: 'bottom',\n maxHeight: constrainedHeight\n };\n }\n\n // 4. Forked beviour when there isn't enough space below\n\n // AUTO: flip the menu, render above\n if (preferredPlacement === 'auto' || isFixedPosition) {\n // may need to be constrained after flipping\n var _constrainedHeight = preferredMaxHeight;\n var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove;\n if (spaceAbove >= minHeight) {\n _constrainedHeight = Math.min(spaceAbove - marginBottom - controlHeight, preferredMaxHeight);\n }\n return {\n placement: 'top',\n maxHeight: _constrainedHeight\n };\n }\n\n // BOTTOM: allow browser to increase scrollable area and immediately set scroll\n if (preferredPlacement === 'bottom') {\n if (shouldScroll) {\n scrollTo(scrollParent, scrollDown);\n }\n return {\n placement: 'bottom',\n maxHeight: preferredMaxHeight\n };\n }\n break;\n case 'top':\n // 1: the menu will fit, do nothing\n if (viewSpaceAbove >= menuHeight) {\n return {\n placement: 'top',\n maxHeight: preferredMaxHeight\n };\n }\n\n // 2: the menu will fit, if scrolled\n if (scrollSpaceAbove >= menuHeight && !isFixedPosition) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollUp, scrollDuration);\n }\n return {\n placement: 'top',\n maxHeight: preferredMaxHeight\n };\n }\n\n // 3: the menu will fit, if constrained\n if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {\n var _constrainedHeight2 = preferredMaxHeight;\n\n // we want to provide as much of the menu as possible to the user,\n // so give them whatever is available below rather than the minHeight.\n if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {\n _constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop;\n }\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollUp, scrollDuration);\n }\n return {\n placement: 'top',\n maxHeight: _constrainedHeight2\n };\n }\n\n // 4. not enough space, the browser WILL NOT increase scrollable area when\n // absolutely positioned element rendered above the viewport (only below).\n // Flip the menu, render below\n return {\n placement: 'bottom',\n maxHeight: preferredMaxHeight\n };\n default:\n throw new Error(\"Invalid placement provided \\\"\".concat(preferredPlacement, \"\\\".\"));\n }\n return defaultState;\n}\n\n// Menu Component\n// ------------------------------\n\nfunction alignToControl(placement) {\n var placementToCSSProp = {\n bottom: 'top',\n top: 'bottom'\n };\n return placement ? placementToCSSProp[placement] : 'bottom';\n}\nvar coercePlacement = function coercePlacement(p) {\n return p === 'auto' ? 'bottom' : p;\n};\nvar menuCSS = function menuCSS(_ref2, unstyled) {\n var _objectSpread2;\n var placement = _ref2.placement,\n _ref2$theme = _ref2.theme,\n borderRadius = _ref2$theme.borderRadius,\n spacing = _ref2$theme.spacing,\n colors = _ref2$theme.colors;\n return _objectSpread((_objectSpread2 = {\n label: 'menu'\n }, _defineProperty(_objectSpread2, alignToControl(placement), '100%'), _defineProperty(_objectSpread2, \"position\", 'absolute'), _defineProperty(_objectSpread2, \"width\", '100%'), _defineProperty(_objectSpread2, \"zIndex\", 1), _objectSpread2), unstyled ? {} : {\n backgroundColor: colors.neutral0,\n borderRadius: borderRadius,\n boxShadow: '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)',\n marginBottom: spacing.menuGutter,\n marginTop: spacing.menuGutter\n });\n};\nvar PortalPlacementContext = /*#__PURE__*/createContext(null);\n\n// NOTE: internal only\nvar MenuPlacer = function MenuPlacer(props) {\n var children = props.children,\n minMenuHeight = props.minMenuHeight,\n maxMenuHeight = props.maxMenuHeight,\n menuPlacement = props.menuPlacement,\n menuPosition = props.menuPosition,\n menuShouldScrollIntoView = props.menuShouldScrollIntoView,\n theme = props.theme;\n var _ref3 = useContext(PortalPlacementContext) || {},\n setPortalPlacement = _ref3.setPortalPlacement;\n var ref = useRef(null);\n var _useState = useState(maxMenuHeight),\n _useState2 = _slicedToArray(_useState, 2),\n maxHeight = _useState2[0],\n setMaxHeight = _useState2[1];\n var _useState3 = useState(null),\n _useState4 = _slicedToArray(_useState3, 2),\n placement = _useState4[0],\n setPlacement = _useState4[1];\n var controlHeight = theme.spacing.controlHeight;\n useLayoutEffect(function () {\n var menuEl = ref.current;\n if (!menuEl) return;\n\n // DO NOT scroll if position is fixed\n var isFixedPosition = menuPosition === 'fixed';\n var shouldScroll = menuShouldScrollIntoView && !isFixedPosition;\n var state = getMenuPlacement({\n maxHeight: maxMenuHeight,\n menuEl: menuEl,\n minHeight: minMenuHeight,\n placement: menuPlacement,\n shouldScroll: shouldScroll,\n isFixedPosition: isFixedPosition,\n controlHeight: controlHeight\n });\n setMaxHeight(state.maxHeight);\n setPlacement(state.placement);\n setPortalPlacement === null || setPortalPlacement === void 0 ? void 0 : setPortalPlacement(state.placement);\n }, [maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, setPortalPlacement, controlHeight]);\n return children({\n ref: ref,\n placerProps: _objectSpread(_objectSpread({}, props), {}, {\n placement: placement || coercePlacement(menuPlacement),\n maxHeight: maxHeight\n })\n });\n};\nvar Menu = function Menu(props) {\n var children = props.children,\n innerRef = props.innerRef,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'menu', {\n menu: true\n }), {\n ref: innerRef\n }, innerProps), children);\n};\nvar Menu$1 = Menu;\n\n// ==============================\n// Menu List\n// ==============================\n\nvar menuListCSS = function menuListCSS(_ref4, unstyled) {\n var maxHeight = _ref4.maxHeight,\n baseUnit = _ref4.theme.spacing.baseUnit;\n return _objectSpread({\n maxHeight: maxHeight,\n overflowY: 'auto',\n position: 'relative',\n // required for offset[Height, Top] > keyboard scroll\n WebkitOverflowScrolling: 'touch'\n }, unstyled ? {} : {\n paddingBottom: baseUnit,\n paddingTop: baseUnit\n });\n};\nvar MenuList = function MenuList(props) {\n var children = props.children,\n innerProps = props.innerProps,\n innerRef = props.innerRef,\n isMulti = props.isMulti;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'menuList', {\n 'menu-list': true,\n 'menu-list--is-multi': isMulti\n }), {\n ref: innerRef\n }, innerProps), children);\n};\n\n// ==============================\n// Menu Notices\n// ==============================\n\nvar noticeCSS = function noticeCSS(_ref5, unstyled) {\n var _ref5$theme = _ref5.theme,\n baseUnit = _ref5$theme.spacing.baseUnit,\n colors = _ref5$theme.colors;\n return _objectSpread({\n textAlign: 'center'\n }, unstyled ? {} : {\n color: colors.neutral40,\n padding: \"\".concat(baseUnit * 2, \"px \").concat(baseUnit * 3, \"px\")\n });\n};\nvar noOptionsMessageCSS = noticeCSS;\nvar loadingMessageCSS = noticeCSS;\nvar NoOptionsMessage = function NoOptionsMessage(_ref6) {\n var _ref6$children = _ref6.children,\n children = _ref6$children === void 0 ? 'No options' : _ref6$children,\n innerProps = _ref6.innerProps,\n restProps = _objectWithoutProperties(_ref6, _excluded$3);\n return jsx(\"div\", _extends({}, getStyleProps(_objectSpread(_objectSpread({}, restProps), {}, {\n children: children,\n innerProps: innerProps\n }), 'noOptionsMessage', {\n 'menu-notice': true,\n 'menu-notice--no-options': true\n }), innerProps), children);\n};\nvar LoadingMessage = function LoadingMessage(_ref7) {\n var _ref7$children = _ref7.children,\n children = _ref7$children === void 0 ? 'Loading...' : _ref7$children,\n innerProps = _ref7.innerProps,\n restProps = _objectWithoutProperties(_ref7, _excluded2$1);\n return jsx(\"div\", _extends({}, getStyleProps(_objectSpread(_objectSpread({}, restProps), {}, {\n children: children,\n innerProps: innerProps\n }), 'loadingMessage', {\n 'menu-notice': true,\n 'menu-notice--loading': true\n }), innerProps), children);\n};\n\n// ==============================\n// Menu Portal\n// ==============================\n\nvar menuPortalCSS = function menuPortalCSS(_ref8) {\n var rect = _ref8.rect,\n offset = _ref8.offset,\n position = _ref8.position;\n return {\n left: rect.left,\n position: position,\n top: offset,\n width: rect.width,\n zIndex: 1\n };\n};\nvar MenuPortal = function MenuPortal(props) {\n var appendTo = props.appendTo,\n children = props.children,\n controlElement = props.controlElement,\n innerProps = props.innerProps,\n menuPlacement = props.menuPlacement,\n menuPosition = props.menuPosition;\n var menuPortalRef = useRef(null);\n var cleanupRef = useRef(null);\n var _useState5 = useState(coercePlacement(menuPlacement)),\n _useState6 = _slicedToArray(_useState5, 2),\n placement = _useState6[0],\n setPortalPlacement = _useState6[1];\n var portalPlacementContext = useMemo(function () {\n return {\n setPortalPlacement: setPortalPlacement\n };\n }, []);\n var _useState7 = useState(null),\n _useState8 = _slicedToArray(_useState7, 2),\n computedPosition = _useState8[0],\n setComputedPosition = _useState8[1];\n var updateComputedPosition = useCallback(function () {\n if (!controlElement) return;\n var rect = getBoundingClientObj(controlElement);\n var scrollDistance = menuPosition === 'fixed' ? 0 : window.pageYOffset;\n var offset = rect[placement] + scrollDistance;\n if (offset !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset) || rect.left !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left) || rect.width !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width)) {\n setComputedPosition({\n offset: offset,\n rect: rect\n });\n }\n }, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width]);\n useLayoutEffect(function () {\n updateComputedPosition();\n }, [updateComputedPosition]);\n var runAutoUpdate = useCallback(function () {\n if (typeof cleanupRef.current === 'function') {\n cleanupRef.current();\n cleanupRef.current = null;\n }\n if (controlElement && menuPortalRef.current) {\n cleanupRef.current = autoUpdate(controlElement, menuPortalRef.current, updateComputedPosition, {\n elementResize: 'ResizeObserver' in window\n });\n }\n }, [controlElement, updateComputedPosition]);\n useLayoutEffect(function () {\n runAutoUpdate();\n }, [runAutoUpdate]);\n var setMenuPortalElement = useCallback(function (menuPortalElement) {\n menuPortalRef.current = menuPortalElement;\n runAutoUpdate();\n }, [runAutoUpdate]);\n\n // bail early if required elements aren't present\n if (!appendTo && menuPosition !== 'fixed' || !computedPosition) return null;\n\n // same wrapper element whether fixed or portalled\n var menuWrapper = jsx(\"div\", _extends({\n ref: setMenuPortalElement\n }, getStyleProps(_objectSpread(_objectSpread({}, props), {}, {\n offset: computedPosition.offset,\n position: menuPosition,\n rect: computedPosition.rect\n }), 'menuPortal', {\n 'menu-portal': true\n }), innerProps), children);\n return jsx(PortalPlacementContext.Provider, {\n value: portalPlacementContext\n }, appendTo ? /*#__PURE__*/createPortal(menuWrapper, appendTo) : menuWrapper);\n};\n\n// ==============================\n// Root Container\n// ==============================\n\nvar containerCSS = function containerCSS(_ref) {\n var isDisabled = _ref.isDisabled,\n isRtl = _ref.isRtl;\n return {\n label: 'container',\n direction: isRtl ? 'rtl' : undefined,\n pointerEvents: isDisabled ? 'none' : undefined,\n // cancel mouse events when disabled\n position: 'relative'\n };\n};\nvar SelectContainer = function SelectContainer(props) {\n var children = props.children,\n innerProps = props.innerProps,\n isDisabled = props.isDisabled,\n isRtl = props.isRtl;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'container', {\n '--is-disabled': isDisabled,\n '--is-rtl': isRtl\n }), innerProps), children);\n};\n\n// ==============================\n// Value Container\n// ==============================\n\nvar valueContainerCSS = function valueContainerCSS(_ref2, unstyled) {\n var spacing = _ref2.theme.spacing,\n isMulti = _ref2.isMulti,\n hasValue = _ref2.hasValue,\n controlShouldRenderValue = _ref2.selectProps.controlShouldRenderValue;\n return _objectSpread({\n alignItems: 'center',\n display: isMulti && hasValue && controlShouldRenderValue ? 'flex' : 'grid',\n flex: 1,\n flexWrap: 'wrap',\n WebkitOverflowScrolling: 'touch',\n position: 'relative',\n overflow: 'hidden'\n }, unstyled ? {} : {\n padding: \"\".concat(spacing.baseUnit / 2, \"px \").concat(spacing.baseUnit * 2, \"px\")\n });\n};\nvar ValueContainer = function ValueContainer(props) {\n var children = props.children,\n innerProps = props.innerProps,\n isMulti = props.isMulti,\n hasValue = props.hasValue;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'valueContainer', {\n 'value-container': true,\n 'value-container--is-multi': isMulti,\n 'value-container--has-value': hasValue\n }), innerProps), children);\n};\n\n// ==============================\n// Indicator Container\n// ==============================\n\nvar indicatorsContainerCSS = function indicatorsContainerCSS() {\n return {\n alignItems: 'center',\n alignSelf: 'stretch',\n display: 'flex',\n flexShrink: 0\n };\n};\nvar IndicatorsContainer = function IndicatorsContainer(props) {\n var children = props.children,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'indicatorsContainer', {\n indicators: true\n }), innerProps), children);\n};\n\nvar _templateObject;\nvar _excluded$2 = [\"size\"],\n _excluded2 = [\"innerProps\", \"isRtl\", \"size\"];\nfunction _EMOTION_STRINGIFIED_CSS_ERROR__() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\n\n// ==============================\n// Dropdown & Clear Icons\n// ==============================\nvar _ref2 = process.env.NODE_ENV === \"production\" ? {\n name: \"8mmkcg\",\n styles: \"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0\"\n} : {\n name: \"tj5bde-Svg\",\n styles: \"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;label:Svg;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgSlNYLCBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3gsIGtleWZyYW1lcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuaW1wb3J0IHtcbiAgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWUsXG4gIENTU09iamVjdFdpdGhMYWJlbCxcbiAgR3JvdXBCYXNlLFxufSBmcm9tICcuLi90eXBlcyc7XG5pbXBvcnQgeyBnZXRTdHlsZVByb3BzIH0gZnJvbSAnLi4vdXRpbHMnO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgSWNvbnNcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBTdmcgPSAoe1xuICBzaXplLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzdmcnXSAmIHsgc2l6ZTogbnVtYmVyIH0pID0+IChcbiAgPHN2Z1xuICAgIGhlaWdodD17c2l6ZX1cbiAgICB3aWR0aD17c2l6ZX1cbiAgICB2aWV3Qm94PVwiMCAwIDIwIDIwXCJcbiAgICBhcmlhLWhpZGRlbj1cInRydWVcIlxuICAgIGZvY3VzYWJsZT1cImZhbHNlXCJcbiAgICBjc3M9e3tcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgZmlsbDogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBsaW5lSGVpZ2h0OiAxLFxuICAgICAgc3Ryb2tlOiAnY3VycmVudENvbG9yJyxcbiAgICAgIHN0cm9rZVdpZHRoOiAwLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IHR5cGUgQ3Jvc3NJY29uUHJvcHMgPSBKU1guSW50cmluc2ljRWxlbWVudHNbJ3N2ZyddICYgeyBzaXplPzogbnVtYmVyIH07XG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBDcm9zc0ljb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNMTQuMzQ4IDE0Ljg0OWMtMC40NjkgMC40NjktMS4yMjkgMC40NjktMS42OTcgMGwtMi42NTEtMy4wMzAtMi42NTEgMy4wMjljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDAtMC40NjktMC40NjktMC40NjktMS4yMjkgMC0xLjY5N2wyLjc1OC0zLjE1LTIuNzU5LTMuMTUyYy0wLjQ2OS0wLjQ2OS0wLjQ2OS0xLjIyOCAwLTEuNjk3czEuMjI4LTAuNDY5IDEuNjk3IDBsMi42NTIgMy4wMzEgMi42NTEtMy4wMzFjMC40NjktMC40NjkgMS4yMjgtMC40NjkgMS42OTcgMHMwLjQ2OSAxLjIyOSAwIDEuNjk3bC0yLjc1OCAzLjE1MiAyLjc1OCAzLjE1YzAuNDY5IDAuNDY5IDAuNDY5IDEuMjI5IDAgMS42OTh6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuZXhwb3J0IHR5cGUgRG93bkNoZXZyb25Qcm9wcyA9IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snc3ZnJ10gJiB7IHNpemU/OiBudW1iZXIgfTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogRG93bkNoZXZyb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNNC41MTYgNy41NDhjMC40MzYtMC40NDYgMS4wNDMtMC40ODEgMS41NzYgMGwzLjkwOCAzLjc0NyAzLjkwOC0zLjc0N2MwLjUzMy0wLjQ4MSAxLjE0MS0wLjQ0NiAxLjU3NCAwIDAuNDM2IDAuNDQ1IDAuNDA4IDEuMTk3IDAgMS42MTUtMC40MDYgMC40MTgtNC42OTUgNC41MDItNC42OTUgNC41MDItMC4yMTcgMC4yMjMtMC41MDIgMC4zMzUtMC43ODcgMC4zMzVzLTAuNTctMC4xMTItMC43ODktMC4zMzVjMCAwLTQuMjg3LTQuMDg0LTQuNjk1LTQuNTAycy0wLjQzNi0xLjE3IDAtMS42MTV6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgQnV0dG9uc1xuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbmV4cG9ydCBpbnRlcmZhY2UgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxcbiAgT3B0aW9uID0gdW5rbm93bixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4gPSBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+ID0gR3JvdXBCYXNlPE9wdGlvbj5cbj4gZXh0ZW5kcyBDb21tb25Qcm9wc0FuZENsYXNzTmFtZTxPcHRpb24sIElzTXVsdGksIEdyb3VwPiB7XG4gIC8qKiBUaGUgY2hpbGRyZW4gdG8gYmUgcmVuZGVyZWQgaW5zaWRlIHRoZSBpbmRpY2F0b3IuICovXG4gIGNoaWxkcmVuPzogUmVhY3ROb2RlO1xuICAvKiogUHJvcHMgdGhhdCB3aWxsIGJlIHBhc3NlZCBvbiB0byB0aGUgY2hpbGRyZW4uICovXG4gIGlubmVyUHJvcHM6IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snZGl2J107XG4gIC8qKiBUaGUgZm9jdXNlZCBzdGF0ZSBvZiB0aGUgc2VsZWN0LiAqL1xuICBpc0ZvY3VzZWQ6IGJvb2xlYW47XG4gIGlzRGlzYWJsZWQ6IGJvb2xlYW47XG59XG5cbmNvbnN0IGJhc2VDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgdGhlbWU6IHtcbiAgICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICAgIGNvbG9ycyxcbiAgICB9LFxuICB9OlxuICAgIHwgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuICAgIHwgQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvckNvbnRhaW5lcicsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcbiAgLi4uKHVuc3R5bGVkXG4gICAgPyB7fVxuICAgIDoge1xuICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgICAgICAgJzpob3Zlcic6IHtcbiAgICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw4MCA6IGNvbG9ycy5uZXV0cmFsNDAsXG4gICAgICAgIH0sXG4gICAgICB9KSxcbn0pO1xuXG5leHBvcnQgY29uc3QgZHJvcGRvd25JbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IERyb3Bkb3duSW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnZHJvcGRvd25JbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2Ryb3Bkb3duLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8RG93bkNoZXZyb24gLz59XG4gICAgPC9kaXY+XG4gICk7XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIENsZWFySW5kaWNhdG9yUHJvcHM8XG4gIE9wdGlvbiA9IHVua25vd24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuID0gYm9vbGVhbixcbiAgR3JvdXAgZXh0ZW5kcyBHcm91cEJhc2U8T3B0aW9uPiA9IEdyb3VwQmFzZTxPcHRpb24+XG4+IGV4dGVuZHMgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWU8T3B0aW9uLCBJc011bHRpLCBHcm91cD4ge1xuICAvKiogVGhlIGNoaWxkcmVuIHRvIGJlIHJlbmRlcmVkIGluc2lkZSB0aGUgaW5kaWNhdG9yLiAqL1xuICBjaGlsZHJlbj86IFJlYWN0Tm9kZTtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xufVxuXG5leHBvcnQgY29uc3QgY2xlYXJJbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IENsZWFySW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnY2xlYXJJbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2NsZWFyLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5leHBvcnQgaW50ZXJmYWNlIEluZGljYXRvclNlcGFyYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgaXNEaXNhYmxlZDogYm9vbGVhbjtcbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpbm5lclByb3BzPzogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ107XG59XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0Rpc2FibGVkLFxuICAgIHRoZW1lOiB7XG4gICAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gICAgICBjb2xvcnMsXG4gICAgfSxcbiAgfTogSW5kaWNhdG9yU2VwYXJhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4sXG4gIHVuc3R5bGVkOiBib29sZWFuXG4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdpbmRpY2F0b3JTZXBhcmF0b3InLFxuICBhbGlnblNlbGY6ICdzdHJldGNoJyxcbiAgd2lkdGg6IDEsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgYmFja2dyb3VuZENvbG9yOiBpc0Rpc2FibGVkID8gY29sb3JzLm5ldXRyYWwxMCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIG1hcmdpbkJvdHRvbTogYmFzZVVuaXQgKiAyLFxuICAgICAgICBtYXJnaW5Ub3A6IGJhc2VVbml0ICogMixcbiAgICAgIH0pLFxufSk7XG5cbmV4cG9ydCBjb25zdCBJbmRpY2F0b3JTZXBhcmF0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBJbmRpY2F0b3JTZXBhcmF0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgey4uLmdldFN0eWxlUHJvcHMocHJvcHMsICdpbmRpY2F0b3JTZXBhcmF0b3InLCB7XG4gICAgICAgICdpbmRpY2F0b3Itc2VwYXJhdG9yJzogdHJ1ZSxcbiAgICAgIH0pfVxuICAgIC8+XG4gICk7XG59O1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIExvYWRpbmdcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBsb2FkaW5nRG90QW5pbWF0aW9ucyA9IGtleWZyYW1lc2BcbiAgMCUsIDgwJSwgMTAwJSB7IG9wYWNpdHk6IDA7IH1cbiAgNDAlIHsgb3BhY2l0eTogMTsgfVxuYDtcblxuZXhwb3J0IGNvbnN0IGxvYWRpbmdJbmRpY2F0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgc2l6ZSxcbiAgICB0aGVtZToge1xuICAgICAgY29sb3JzLFxuICAgICAgc3BhY2luZzogeyBiYXNlVW5pdCB9LFxuICAgIH0sXG4gIH06IExvYWRpbmdJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2xvYWRpbmdJbmRpY2F0b3InLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHRyYW5zaXRpb246ICdjb2xvciAxNTBtcycsXG4gIGFsaWduU2VsZjogJ2NlbnRlcicsXG4gIGZvbnRTaXplOiBzaXplLFxuICBsaW5lSGVpZ2h0OiAxLFxuICBtYXJnaW5SaWdodDogc2l6ZSxcbiAgdGV4dEFsaWduOiAnY2VudGVyJyxcbiAgdmVydGljYWxBbGlnbjogJ21pZGRsZScsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICAgICAgICBwYWRkaW5nOiBiYXNlVW5pdCAqIDIsXG4gICAgICB9KSxcbn0pO1xuXG5pbnRlcmZhY2UgTG9hZGluZ0RvdFByb3BzIHtcbiAgZGVsYXk6IG51bWJlcjtcbiAgb2Zmc2V0OiBib29sZWFuO1xufVxuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogTG9hZGluZ0RvdFByb3BzKSA9PiAoXG4gIDxzcGFuXG4gICAgY3NzPXt7XG4gICAgICBhbmltYXRpb246IGAke2xvYWRpbmdEb3RBbmltYXRpb25zfSAxcyBlYXNlLWluLW91dCAke2RlbGF5fW1zIGluZmluaXRlO2AsXG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6ICdjdXJyZW50Q29sb3InLFxuICAgICAgYm9yZGVyUmFkaXVzOiAnMWVtJyxcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgbWFyZ2luTGVmdDogb2Zmc2V0ID8gJzFlbScgOiB1bmRlZmluZWQsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCBpbnRlcmZhY2UgTG9hZGluZ0luZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpc0Rpc2FibGVkOiBib29sZWFuO1xuICAvKiogU2V0IHNpemUgb2YgdGhlIGNvbnRhaW5lci4gKi9cbiAgc2l6ZTogbnVtYmVyO1xufVxuZXhwb3J0IGNvbnN0IExvYWRpbmdJbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpbm5lclByb3BzLFxuICBpc1J0bCxcbiAgc2l6ZSA9IDQsXG4gIC4uLnJlc3RQcm9wc1xufTogTG9hZGluZ0luZGljYXRvclByb3BzPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+KSA9PiB7XG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgey4uLmdldFN0eWxlUHJvcHMoXG4gICAgICAgIHsgLi4ucmVzdFByb3BzLCBpbm5lclByb3BzLCBpc1J0bCwgc2l6ZSB9LFxuICAgICAgICAnbG9hZGluZ0luZGljYXRvcicsXG4gICAgICAgIHtcbiAgICAgICAgICBpbmRpY2F0b3I6IHRydWUsXG4gICAgICAgICAgJ2xvYWRpbmctaW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXswfSBvZmZzZXQ9e2lzUnRsfSAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezE2MH0gb2Zmc2V0IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MzIwfSBvZmZzZXQ9eyFpc1J0bH0gLz5cbiAgICA8L2Rpdj5cbiAgKTtcbn07XG4iXX0= */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__\n};\nvar Svg = function Svg(_ref) {\n var size = _ref.size,\n props = _objectWithoutProperties(_ref, _excluded$2);\n return jsx(\"svg\", _extends({\n height: size,\n width: size,\n viewBox: \"0 0 20 20\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n css: _ref2\n }, props));\n};\nvar CrossIcon = function CrossIcon(props) {\n return jsx(Svg, _extends({\n size: 20\n }, props), jsx(\"path\", {\n d: \"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n }));\n};\nvar DownChevron = function DownChevron(props) {\n return jsx(Svg, _extends({\n size: 20\n }, props), jsx(\"path\", {\n d: \"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\"\n }));\n};\n\n// ==============================\n// Dropdown & Clear Buttons\n// ==============================\n\nvar baseCSS = function baseCSS(_ref3, unstyled) {\n var isFocused = _ref3.isFocused,\n _ref3$theme = _ref3.theme,\n baseUnit = _ref3$theme.spacing.baseUnit,\n colors = _ref3$theme.colors;\n return _objectSpread({\n label: 'indicatorContainer',\n display: 'flex',\n transition: 'color 150ms'\n }, unstyled ? {} : {\n color: isFocused ? colors.neutral60 : colors.neutral20,\n padding: baseUnit * 2,\n ':hover': {\n color: isFocused ? colors.neutral80 : colors.neutral40\n }\n });\n};\nvar dropdownIndicatorCSS = baseCSS;\nvar DropdownIndicator = function DropdownIndicator(props) {\n var children = props.children,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'dropdownIndicator', {\n indicator: true,\n 'dropdown-indicator': true\n }), innerProps), children || jsx(DownChevron, null));\n};\nvar clearIndicatorCSS = baseCSS;\nvar ClearIndicator = function ClearIndicator(props) {\n var children = props.children,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'clearIndicator', {\n indicator: true,\n 'clear-indicator': true\n }), innerProps), children || jsx(CrossIcon, null));\n};\n\n// ==============================\n// Separator\n// ==============================\n\nvar indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref4, unstyled) {\n var isDisabled = _ref4.isDisabled,\n _ref4$theme = _ref4.theme,\n baseUnit = _ref4$theme.spacing.baseUnit,\n colors = _ref4$theme.colors;\n return _objectSpread({\n label: 'indicatorSeparator',\n alignSelf: 'stretch',\n width: 1\n }, unstyled ? {} : {\n backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20,\n marginBottom: baseUnit * 2,\n marginTop: baseUnit * 2\n });\n};\nvar IndicatorSeparator = function IndicatorSeparator(props) {\n var innerProps = props.innerProps;\n return jsx(\"span\", _extends({}, innerProps, getStyleProps(props, 'indicatorSeparator', {\n 'indicator-separator': true\n })));\n};\n\n// ==============================\n// Loading\n// ==============================\n\nvar loadingDotAnimations = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral([\"\\n 0%, 80%, 100% { opacity: 0; }\\n 40% { opacity: 1; }\\n\"])));\nvar loadingIndicatorCSS = function loadingIndicatorCSS(_ref5, unstyled) {\n var isFocused = _ref5.isFocused,\n size = _ref5.size,\n _ref5$theme = _ref5.theme,\n colors = _ref5$theme.colors,\n baseUnit = _ref5$theme.spacing.baseUnit;\n return _objectSpread({\n label: 'loadingIndicator',\n display: 'flex',\n transition: 'color 150ms',\n alignSelf: 'center',\n fontSize: size,\n lineHeight: 1,\n marginRight: size,\n textAlign: 'center',\n verticalAlign: 'middle'\n }, unstyled ? {} : {\n color: isFocused ? colors.neutral60 : colors.neutral20,\n padding: baseUnit * 2\n });\n};\nvar LoadingDot = function LoadingDot(_ref6) {\n var delay = _ref6.delay,\n offset = _ref6.offset;\n return jsx(\"span\", {\n css: /*#__PURE__*/css$2({\n animation: \"\".concat(loadingDotAnimations, \" 1s ease-in-out \").concat(delay, \"ms infinite;\"),\n backgroundColor: 'currentColor',\n borderRadius: '1em',\n display: 'inline-block',\n marginLeft: offset ? '1em' : undefined,\n height: '1em',\n verticalAlign: 'top',\n width: '1em'\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:LoadingDot;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1RSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgSlNYLCBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3gsIGtleWZyYW1lcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuaW1wb3J0IHtcbiAgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWUsXG4gIENTU09iamVjdFdpdGhMYWJlbCxcbiAgR3JvdXBCYXNlLFxufSBmcm9tICcuLi90eXBlcyc7XG5pbXBvcnQgeyBnZXRTdHlsZVByb3BzIH0gZnJvbSAnLi4vdXRpbHMnO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgSWNvbnNcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBTdmcgPSAoe1xuICBzaXplLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzdmcnXSAmIHsgc2l6ZTogbnVtYmVyIH0pID0+IChcbiAgPHN2Z1xuICAgIGhlaWdodD17c2l6ZX1cbiAgICB3aWR0aD17c2l6ZX1cbiAgICB2aWV3Qm94PVwiMCAwIDIwIDIwXCJcbiAgICBhcmlhLWhpZGRlbj1cInRydWVcIlxuICAgIGZvY3VzYWJsZT1cImZhbHNlXCJcbiAgICBjc3M9e3tcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgZmlsbDogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBsaW5lSGVpZ2h0OiAxLFxuICAgICAgc3Ryb2tlOiAnY3VycmVudENvbG9yJyxcbiAgICAgIHN0cm9rZVdpZHRoOiAwLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IHR5cGUgQ3Jvc3NJY29uUHJvcHMgPSBKU1guSW50cmluc2ljRWxlbWVudHNbJ3N2ZyddICYgeyBzaXplPzogbnVtYmVyIH07XG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBDcm9zc0ljb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNMTQuMzQ4IDE0Ljg0OWMtMC40NjkgMC40NjktMS4yMjkgMC40NjktMS42OTcgMGwtMi42NTEtMy4wMzAtMi42NTEgMy4wMjljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDAtMC40NjktMC40NjktMC40NjktMS4yMjkgMC0xLjY5N2wyLjc1OC0zLjE1LTIuNzU5LTMuMTUyYy0wLjQ2OS0wLjQ2OS0wLjQ2OS0xLjIyOCAwLTEuNjk3czEuMjI4LTAuNDY5IDEuNjk3IDBsMi42NTIgMy4wMzEgMi42NTEtMy4wMzFjMC40NjktMC40NjkgMS4yMjgtMC40NjkgMS42OTcgMHMwLjQ2OSAxLjIyOSAwIDEuNjk3bC0yLjc1OCAzLjE1MiAyLjc1OCAzLjE1YzAuNDY5IDAuNDY5IDAuNDY5IDEuMjI5IDAgMS42OTh6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuZXhwb3J0IHR5cGUgRG93bkNoZXZyb25Qcm9wcyA9IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snc3ZnJ10gJiB7IHNpemU/OiBudW1iZXIgfTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogRG93bkNoZXZyb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNNC41MTYgNy41NDhjMC40MzYtMC40NDYgMS4wNDMtMC40ODEgMS41NzYgMGwzLjkwOCAzLjc0NyAzLjkwOC0zLjc0N2MwLjUzMy0wLjQ4MSAxLjE0MS0wLjQ0NiAxLjU3NCAwIDAuNDM2IDAuNDQ1IDAuNDA4IDEuMTk3IDAgMS42MTUtMC40MDYgMC40MTgtNC42OTUgNC41MDItNC42OTUgNC41MDItMC4yMTcgMC4yMjMtMC41MDIgMC4zMzUtMC43ODcgMC4zMzVzLTAuNTctMC4xMTItMC43ODktMC4zMzVjMCAwLTQuMjg3LTQuMDg0LTQuNjk1LTQuNTAycy0wLjQzNi0xLjE3IDAtMS42MTV6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgQnV0dG9uc1xuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbmV4cG9ydCBpbnRlcmZhY2UgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxcbiAgT3B0aW9uID0gdW5rbm93bixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4gPSBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+ID0gR3JvdXBCYXNlPE9wdGlvbj5cbj4gZXh0ZW5kcyBDb21tb25Qcm9wc0FuZENsYXNzTmFtZTxPcHRpb24sIElzTXVsdGksIEdyb3VwPiB7XG4gIC8qKiBUaGUgY2hpbGRyZW4gdG8gYmUgcmVuZGVyZWQgaW5zaWRlIHRoZSBpbmRpY2F0b3IuICovXG4gIGNoaWxkcmVuPzogUmVhY3ROb2RlO1xuICAvKiogUHJvcHMgdGhhdCB3aWxsIGJlIHBhc3NlZCBvbiB0byB0aGUgY2hpbGRyZW4uICovXG4gIGlubmVyUHJvcHM6IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snZGl2J107XG4gIC8qKiBUaGUgZm9jdXNlZCBzdGF0ZSBvZiB0aGUgc2VsZWN0LiAqL1xuICBpc0ZvY3VzZWQ6IGJvb2xlYW47XG4gIGlzRGlzYWJsZWQ6IGJvb2xlYW47XG59XG5cbmNvbnN0IGJhc2VDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgdGhlbWU6IHtcbiAgICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICAgIGNvbG9ycyxcbiAgICB9LFxuICB9OlxuICAgIHwgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuICAgIHwgQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvckNvbnRhaW5lcicsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcbiAgLi4uKHVuc3R5bGVkXG4gICAgPyB7fVxuICAgIDoge1xuICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgICAgICAgJzpob3Zlcic6IHtcbiAgICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw4MCA6IGNvbG9ycy5uZXV0cmFsNDAsXG4gICAgICAgIH0sXG4gICAgICB9KSxcbn0pO1xuXG5leHBvcnQgY29uc3QgZHJvcGRvd25JbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IERyb3Bkb3duSW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnZHJvcGRvd25JbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2Ryb3Bkb3duLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8RG93bkNoZXZyb24gLz59XG4gICAgPC9kaXY+XG4gICk7XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIENsZWFySW5kaWNhdG9yUHJvcHM8XG4gIE9wdGlvbiA9IHVua25vd24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuID0gYm9vbGVhbixcbiAgR3JvdXAgZXh0ZW5kcyBHcm91cEJhc2U8T3B0aW9uPiA9IEdyb3VwQmFzZTxPcHRpb24+XG4+IGV4dGVuZHMgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWU8T3B0aW9uLCBJc011bHRpLCBHcm91cD4ge1xuICAvKiogVGhlIGNoaWxkcmVuIHRvIGJlIHJlbmRlcmVkIGluc2lkZSB0aGUgaW5kaWNhdG9yLiAqL1xuICBjaGlsZHJlbj86IFJlYWN0Tm9kZTtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xufVxuXG5leHBvcnQgY29uc3QgY2xlYXJJbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IENsZWFySW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnY2xlYXJJbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2NsZWFyLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5leHBvcnQgaW50ZXJmYWNlIEluZGljYXRvclNlcGFyYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgaXNEaXNhYmxlZDogYm9vbGVhbjtcbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpbm5lclByb3BzPzogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ107XG59XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0Rpc2FibGVkLFxuICAgIHRoZW1lOiB7XG4gICAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gICAgICBjb2xvcnMsXG4gICAgfSxcbiAgfTogSW5kaWNhdG9yU2VwYXJhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4sXG4gIHVuc3R5bGVkOiBib29sZWFuXG4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdpbmRpY2F0b3JTZXBhcmF0b3InLFxuICBhbGlnblNlbGY6ICdzdHJldGNoJyxcbiAgd2lkdGg6IDEsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgYmFja2dyb3VuZENvbG9yOiBpc0Rpc2FibGVkID8gY29sb3JzLm5ldXRyYWwxMCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIG1hcmdpbkJvdHRvbTogYmFzZVVuaXQgKiAyLFxuICAgICAgICBtYXJnaW5Ub3A6IGJhc2VVbml0ICogMixcbiAgICAgIH0pLFxufSk7XG5cbmV4cG9ydCBjb25zdCBJbmRpY2F0b3JTZXBhcmF0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBJbmRpY2F0b3JTZXBhcmF0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgey4uLmdldFN0eWxlUHJvcHMocHJvcHMsICdpbmRpY2F0b3JTZXBhcmF0b3InLCB7XG4gICAgICAgICdpbmRpY2F0b3Itc2VwYXJhdG9yJzogdHJ1ZSxcbiAgICAgIH0pfVxuICAgIC8+XG4gICk7XG59O1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIExvYWRpbmdcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBsb2FkaW5nRG90QW5pbWF0aW9ucyA9IGtleWZyYW1lc2BcbiAgMCUsIDgwJSwgMTAwJSB7IG9wYWNpdHk6IDA7IH1cbiAgNDAlIHsgb3BhY2l0eTogMTsgfVxuYDtcblxuZXhwb3J0IGNvbnN0IGxvYWRpbmdJbmRpY2F0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgc2l6ZSxcbiAgICB0aGVtZToge1xuICAgICAgY29sb3JzLFxuICAgICAgc3BhY2luZzogeyBiYXNlVW5pdCB9LFxuICAgIH0sXG4gIH06IExvYWRpbmdJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2xvYWRpbmdJbmRpY2F0b3InLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHRyYW5zaXRpb246ICdjb2xvciAxNTBtcycsXG4gIGFsaWduU2VsZjogJ2NlbnRlcicsXG4gIGZvbnRTaXplOiBzaXplLFxuICBsaW5lSGVpZ2h0OiAxLFxuICBtYXJnaW5SaWdodDogc2l6ZSxcbiAgdGV4dEFsaWduOiAnY2VudGVyJyxcbiAgdmVydGljYWxBbGlnbjogJ21pZGRsZScsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICAgICAgICBwYWRkaW5nOiBiYXNlVW5pdCAqIDIsXG4gICAgICB9KSxcbn0pO1xuXG5pbnRlcmZhY2UgTG9hZGluZ0RvdFByb3BzIHtcbiAgZGVsYXk6IG51bWJlcjtcbiAgb2Zmc2V0OiBib29sZWFuO1xufVxuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogTG9hZGluZ0RvdFByb3BzKSA9PiAoXG4gIDxzcGFuXG4gICAgY3NzPXt7XG4gICAgICBhbmltYXRpb246IGAke2xvYWRpbmdEb3RBbmltYXRpb25zfSAxcyBlYXNlLWluLW91dCAke2RlbGF5fW1zIGluZmluaXRlO2AsXG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6ICdjdXJyZW50Q29sb3InLFxuICAgICAgYm9yZGVyUmFkaXVzOiAnMWVtJyxcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgbWFyZ2luTGVmdDogb2Zmc2V0ID8gJzFlbScgOiB1bmRlZmluZWQsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCBpbnRlcmZhY2UgTG9hZGluZ0luZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpc0Rpc2FibGVkOiBib29sZWFuO1xuICAvKiogU2V0IHNpemUgb2YgdGhlIGNvbnRhaW5lci4gKi9cbiAgc2l6ZTogbnVtYmVyO1xufVxuZXhwb3J0IGNvbnN0IExvYWRpbmdJbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpbm5lclByb3BzLFxuICBpc1J0bCxcbiAgc2l6ZSA9IDQsXG4gIC4uLnJlc3RQcm9wc1xufTogTG9hZGluZ0luZGljYXRvclByb3BzPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+KSA9PiB7XG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgey4uLmdldFN0eWxlUHJvcHMoXG4gICAgICAgIHsgLi4ucmVzdFByb3BzLCBpbm5lclByb3BzLCBpc1J0bCwgc2l6ZSB9LFxuICAgICAgICAnbG9hZGluZ0luZGljYXRvcicsXG4gICAgICAgIHtcbiAgICAgICAgICBpbmRpY2F0b3I6IHRydWUsXG4gICAgICAgICAgJ2xvYWRpbmctaW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXswfSBvZmZzZXQ9e2lzUnRsfSAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezE2MH0gb2Zmc2V0IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MzIwfSBvZmZzZXQ9eyFpc1J0bH0gLz5cbiAgICA8L2Rpdj5cbiAgKTtcbn07XG4iXX0= */\")\n });\n};\nvar LoadingIndicator = function LoadingIndicator(_ref7) {\n var innerProps = _ref7.innerProps,\n isRtl = _ref7.isRtl,\n _ref7$size = _ref7.size,\n size = _ref7$size === void 0 ? 4 : _ref7$size,\n restProps = _objectWithoutProperties(_ref7, _excluded2);\n return jsx(\"div\", _extends({}, getStyleProps(_objectSpread(_objectSpread({}, restProps), {}, {\n innerProps: innerProps,\n isRtl: isRtl,\n size: size\n }), 'loadingIndicator', {\n indicator: true,\n 'loading-indicator': true\n }), innerProps), jsx(LoadingDot, {\n delay: 0,\n offset: isRtl\n }), jsx(LoadingDot, {\n delay: 160,\n offset: true\n }), jsx(LoadingDot, {\n delay: 320,\n offset: !isRtl\n }));\n};\n\nvar css$1 = function css(_ref, unstyled) {\n var isDisabled = _ref.isDisabled,\n isFocused = _ref.isFocused,\n _ref$theme = _ref.theme,\n colors = _ref$theme.colors,\n borderRadius = _ref$theme.borderRadius,\n spacing = _ref$theme.spacing;\n return _objectSpread({\n label: 'control',\n alignItems: 'center',\n cursor: 'default',\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n minHeight: spacing.controlHeight,\n outline: '0 !important',\n position: 'relative',\n transition: 'all 100ms'\n }, unstyled ? {} : {\n backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0,\n borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20,\n borderRadius: borderRadius,\n borderStyle: 'solid',\n borderWidth: 1,\n boxShadow: isFocused ? \"0 0 0 1px \".concat(colors.primary) : undefined,\n '&:hover': {\n borderColor: isFocused ? colors.primary : colors.neutral30\n }\n });\n};\nvar Control = function Control(props) {\n var children = props.children,\n isDisabled = props.isDisabled,\n isFocused = props.isFocused,\n innerRef = props.innerRef,\n innerProps = props.innerProps,\n menuIsOpen = props.menuIsOpen;\n return jsx(\"div\", _extends({\n ref: innerRef\n }, getStyleProps(props, 'control', {\n control: true,\n 'control--is-disabled': isDisabled,\n 'control--is-focused': isFocused,\n 'control--menu-is-open': menuIsOpen\n }), innerProps, {\n \"aria-disabled\": isDisabled || undefined\n }), children);\n};\nvar Control$1 = Control;\n\nvar _excluded$1 = [\"data\"];\nvar groupCSS = function groupCSS(_ref, unstyled) {\n var spacing = _ref.theme.spacing;\n return unstyled ? {} : {\n paddingBottom: spacing.baseUnit * 2,\n paddingTop: spacing.baseUnit * 2\n };\n};\nvar Group = function Group(props) {\n var children = props.children,\n cx = props.cx,\n getStyles = props.getStyles,\n getClassNames = props.getClassNames,\n Heading = props.Heading,\n headingProps = props.headingProps,\n innerProps = props.innerProps,\n label = props.label,\n theme = props.theme,\n selectProps = props.selectProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'group', {\n group: true\n }), innerProps), jsx(Heading, _extends({}, headingProps, {\n selectProps: selectProps,\n theme: theme,\n getStyles: getStyles,\n getClassNames: getClassNames,\n cx: cx\n }), label), jsx(\"div\", null, children));\n};\nvar groupHeadingCSS = function groupHeadingCSS(_ref2, unstyled) {\n var _ref2$theme = _ref2.theme,\n colors = _ref2$theme.colors,\n spacing = _ref2$theme.spacing;\n return _objectSpread({\n label: 'group',\n cursor: 'default',\n display: 'block'\n }, unstyled ? {} : {\n color: colors.neutral40,\n fontSize: '75%',\n fontWeight: 500,\n marginBottom: '0.25em',\n paddingLeft: spacing.baseUnit * 3,\n paddingRight: spacing.baseUnit * 3,\n textTransform: 'uppercase'\n });\n};\nvar GroupHeading = function GroupHeading(props) {\n var _cleanCommonProps = cleanCommonProps(props);\n _cleanCommonProps.data;\n var innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$1);\n return jsx(\"div\", _extends({}, getStyleProps(props, 'groupHeading', {\n 'group-heading': true\n }), innerProps));\n};\nvar Group$1 = Group;\n\nvar _excluded = [\"innerRef\", \"isDisabled\", \"isHidden\", \"inputClassName\"];\nvar inputCSS = function inputCSS(_ref, unstyled) {\n var isDisabled = _ref.isDisabled,\n value = _ref.value,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return _objectSpread(_objectSpread({\n visibility: isDisabled ? 'hidden' : 'visible',\n // force css to recompute when value change due to @emotion bug.\n // We can remove it whenever the bug is fixed.\n transform: value ? 'translateZ(0)' : ''\n }, containerStyle), unstyled ? {} : {\n margin: spacing.baseUnit / 2,\n paddingBottom: spacing.baseUnit / 2,\n paddingTop: spacing.baseUnit / 2,\n color: colors.neutral80\n });\n};\nvar spacingStyle = {\n gridArea: '1 / 2',\n font: 'inherit',\n minWidth: '2px',\n border: 0,\n margin: 0,\n outline: 0,\n padding: 0\n};\nvar containerStyle = {\n flex: '1 1 auto',\n display: 'inline-grid',\n gridArea: '1 / 1 / 2 / 3',\n gridTemplateColumns: '0 min-content',\n '&:after': _objectSpread({\n content: 'attr(data-value) \" \"',\n visibility: 'hidden',\n whiteSpace: 'pre'\n }, spacingStyle)\n};\nvar inputStyle = function inputStyle(isHidden) {\n return _objectSpread({\n label: 'input',\n color: 'inherit',\n background: 0,\n opacity: isHidden ? 0 : 1,\n width: '100%'\n }, spacingStyle);\n};\nvar Input = function Input(props) {\n var cx = props.cx,\n value = props.value;\n var _cleanCommonProps = cleanCommonProps(props),\n innerRef = _cleanCommonProps.innerRef,\n isDisabled = _cleanCommonProps.isDisabled,\n isHidden = _cleanCommonProps.isHidden,\n inputClassName = _cleanCommonProps.inputClassName,\n innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded);\n return jsx(\"div\", _extends({}, getStyleProps(props, 'input', {\n 'input-container': true\n }), {\n \"data-value\": value || ''\n }), jsx(\"input\", _extends({\n className: cx({\n input: true\n }, inputClassName),\n ref: innerRef,\n style: inputStyle(isHidden),\n disabled: isDisabled\n }, innerProps)));\n};\nvar Input$1 = Input;\n\nvar multiValueCSS = function multiValueCSS(_ref, unstyled) {\n var _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n borderRadius = _ref$theme.borderRadius,\n colors = _ref$theme.colors;\n return _objectSpread({\n label: 'multiValue',\n display: 'flex',\n minWidth: 0\n }, unstyled ? {} : {\n backgroundColor: colors.neutral10,\n borderRadius: borderRadius / 2,\n margin: spacing.baseUnit / 2\n });\n};\nvar multiValueLabelCSS = function multiValueLabelCSS(_ref2, unstyled) {\n var _ref2$theme = _ref2.theme,\n borderRadius = _ref2$theme.borderRadius,\n colors = _ref2$theme.colors,\n cropWithEllipsis = _ref2.cropWithEllipsis;\n return _objectSpread({\n overflow: 'hidden',\n textOverflow: cropWithEllipsis || cropWithEllipsis === undefined ? 'ellipsis' : undefined,\n whiteSpace: 'nowrap'\n }, unstyled ? {} : {\n borderRadius: borderRadius / 2,\n color: colors.neutral80,\n fontSize: '85%',\n padding: 3,\n paddingLeft: 6\n });\n};\nvar multiValueRemoveCSS = function multiValueRemoveCSS(_ref3, unstyled) {\n var _ref3$theme = _ref3.theme,\n spacing = _ref3$theme.spacing,\n borderRadius = _ref3$theme.borderRadius,\n colors = _ref3$theme.colors,\n isFocused = _ref3.isFocused;\n return _objectSpread({\n alignItems: 'center',\n display: 'flex'\n }, unstyled ? {} : {\n borderRadius: borderRadius / 2,\n backgroundColor: isFocused ? colors.dangerLight : undefined,\n paddingLeft: spacing.baseUnit,\n paddingRight: spacing.baseUnit,\n ':hover': {\n backgroundColor: colors.dangerLight,\n color: colors.danger\n }\n });\n};\nvar MultiValueGeneric = function MultiValueGeneric(_ref4) {\n var children = _ref4.children,\n innerProps = _ref4.innerProps;\n return jsx(\"div\", innerProps, children);\n};\nvar MultiValueContainer = MultiValueGeneric;\nvar MultiValueLabel = MultiValueGeneric;\nfunction MultiValueRemove(_ref5) {\n var children = _ref5.children,\n innerProps = _ref5.innerProps;\n return jsx(\"div\", _extends({\n role: \"button\"\n }, innerProps), children || jsx(CrossIcon, {\n size: 14\n }));\n}\nvar MultiValue = function MultiValue(props) {\n var children = props.children,\n components = props.components,\n data = props.data,\n innerProps = props.innerProps,\n isDisabled = props.isDisabled,\n removeProps = props.removeProps,\n selectProps = props.selectProps;\n var Container = components.Container,\n Label = components.Label,\n Remove = components.Remove;\n return jsx(Container, {\n data: data,\n innerProps: _objectSpread(_objectSpread({}, getStyleProps(props, 'multiValue', {\n 'multi-value': true,\n 'multi-value--is-disabled': isDisabled\n })), innerProps),\n selectProps: selectProps\n }, jsx(Label, {\n data: data,\n innerProps: _objectSpread({}, getStyleProps(props, 'multiValueLabel', {\n 'multi-value__label': true\n })),\n selectProps: selectProps\n }, children), jsx(Remove, {\n data: data,\n innerProps: _objectSpread(_objectSpread({}, getStyleProps(props, 'multiValueRemove', {\n 'multi-value__remove': true\n })), {}, {\n 'aria-label': \"Remove \".concat(children || 'option')\n }, removeProps),\n selectProps: selectProps\n }));\n};\nvar MultiValue$1 = MultiValue;\n\nvar optionCSS = function optionCSS(_ref, unstyled) {\n var isDisabled = _ref.isDisabled,\n isFocused = _ref.isFocused,\n isSelected = _ref.isSelected,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return _objectSpread({\n label: 'option',\n cursor: 'default',\n display: 'block',\n fontSize: 'inherit',\n width: '100%',\n userSelect: 'none',\n WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)'\n }, unstyled ? {} : {\n backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : 'transparent',\n color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : 'inherit',\n padding: \"\".concat(spacing.baseUnit * 2, \"px \").concat(spacing.baseUnit * 3, \"px\"),\n // provide some affordance on touch devices\n ':active': {\n backgroundColor: !isDisabled ? isSelected ? colors.primary : colors.primary50 : undefined\n }\n });\n};\nvar Option = function Option(props) {\n var children = props.children,\n isDisabled = props.isDisabled,\n isFocused = props.isFocused,\n isSelected = props.isSelected,\n innerRef = props.innerRef,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'option', {\n option: true,\n 'option--is-disabled': isDisabled,\n 'option--is-focused': isFocused,\n 'option--is-selected': isSelected\n }), {\n ref: innerRef,\n \"aria-disabled\": isDisabled\n }, innerProps), children);\n};\nvar Option$1 = Option;\n\nvar placeholderCSS = function placeholderCSS(_ref, unstyled) {\n var _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return _objectSpread({\n label: 'placeholder',\n gridArea: '1 / 1 / 2 / 3'\n }, unstyled ? {} : {\n color: colors.neutral50,\n marginLeft: spacing.baseUnit / 2,\n marginRight: spacing.baseUnit / 2\n });\n};\nvar Placeholder = function Placeholder(props) {\n var children = props.children,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'placeholder', {\n placeholder: true\n }), innerProps), children);\n};\nvar Placeholder$1 = Placeholder;\n\nvar css = function css(_ref, unstyled) {\n var isDisabled = _ref.isDisabled,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return _objectSpread({\n label: 'singleValue',\n gridArea: '1 / 1 / 2 / 3',\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n }, unstyled ? {} : {\n color: isDisabled ? colors.neutral40 : colors.neutral80,\n marginLeft: spacing.baseUnit / 2,\n marginRight: spacing.baseUnit / 2\n });\n};\nvar SingleValue = function SingleValue(props) {\n var children = props.children,\n isDisabled = props.isDisabled,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({}, getStyleProps(props, 'singleValue', {\n 'single-value': true,\n 'single-value--is-disabled': isDisabled\n }), innerProps), children);\n};\nvar SingleValue$1 = SingleValue;\n\nvar components = {\n ClearIndicator: ClearIndicator,\n Control: Control$1,\n DropdownIndicator: DropdownIndicator,\n DownChevron: DownChevron,\n CrossIcon: CrossIcon,\n Group: Group$1,\n GroupHeading: GroupHeading,\n IndicatorsContainer: IndicatorsContainer,\n IndicatorSeparator: IndicatorSeparator,\n Input: Input$1,\n LoadingIndicator: LoadingIndicator,\n Menu: Menu$1,\n MenuList: MenuList,\n MenuPortal: MenuPortal,\n LoadingMessage: LoadingMessage,\n NoOptionsMessage: NoOptionsMessage,\n MultiValue: MultiValue$1,\n MultiValueContainer: MultiValueContainer,\n MultiValueLabel: MultiValueLabel,\n MultiValueRemove: MultiValueRemove,\n Option: Option$1,\n Placeholder: Placeholder$1,\n SelectContainer: SelectContainer,\n SingleValue: SingleValue$1,\n ValueContainer: ValueContainer\n};\nvar defaultComponents = function defaultComponents(props) {\n return _objectSpread(_objectSpread({}, components), props.components);\n};\n\nexport { isMobileDevice as A, multiValueAsValue as B, singleValueAsValue as C, valueTernary as D, classNames as E, defaultComponents as F, isDocumentElement as G, cleanValue as H, scrollIntoView as I, noop as J, notNullish as K, handleInputChange as L, MenuPlacer as M, clearIndicatorCSS as a, containerCSS as b, components as c, css$1 as d, dropdownIndicatorCSS as e, groupHeadingCSS as f, groupCSS as g, indicatorSeparatorCSS as h, indicatorsContainerCSS as i, inputCSS as j, loadingMessageCSS as k, loadingIndicatorCSS as l, menuCSS as m, menuListCSS as n, menuPortalCSS as o, multiValueCSS as p, multiValueLabelCSS as q, removeProps as r, supportsPassiveEvents as s, multiValueRemoveCSS as t, noOptionsMessageCSS as u, optionCSS as v, placeholderCSS as w, css as x, valueContainerCSS as y, isTouchCapable as z };\n","function _taggedTemplateLiteral(e, t) {\n return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {\n raw: {\n value: Object.freeze(t)\n }\n }));\n}\nexport { _taggedTemplateLiteral as default };","var safeIsNaN = Number.isNaN ||\n function ponyfill(value) {\n return typeof value === 'number' && value !== value;\n };\nfunction isEqual(first, second) {\n if (first === second) {\n return true;\n }\n if (safeIsNaN(first) && safeIsNaN(second)) {\n return true;\n }\n return false;\n}\nfunction areInputsEqual(newInputs, lastInputs) {\n if (newInputs.length !== lastInputs.length) {\n return false;\n }\n for (var i = 0; i < newInputs.length; i++) {\n if (!isEqual(newInputs[i], lastInputs[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction memoizeOne(resultFn, isEqual) {\n if (isEqual === void 0) { isEqual = areInputsEqual; }\n var cache = null;\n function memoized() {\n var newArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n newArgs[_i] = arguments[_i];\n }\n if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) {\n return cache.lastResult;\n }\n var lastResult = resultFn.apply(this, newArgs);\n cache = {\n lastResult: lastResult,\n lastArgs: newArgs,\n lastThis: this,\n };\n return lastResult;\n }\n memoized.clear = function clear() {\n cache = null;\n };\n return memoized;\n}\n\nexport { memoizeOne as default };\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\nimport _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';\nimport _createClass from '@babel/runtime/helpers/esm/createClass';\nimport _inherits from '@babel/runtime/helpers/esm/inherits';\nimport _createSuper from '@babel/runtime/helpers/esm/createSuper';\nimport _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';\nimport * as React from 'react';\nimport { useMemo, Fragment, useRef, useCallback, useEffect, Component } from 'react';\nimport { r as removeProps, s as supportsPassiveEvents, a as clearIndicatorCSS, b as containerCSS, d as css$1, e as dropdownIndicatorCSS, g as groupCSS, f as groupHeadingCSS, i as indicatorsContainerCSS, h as indicatorSeparatorCSS, j as inputCSS, l as loadingIndicatorCSS, k as loadingMessageCSS, m as menuCSS, n as menuListCSS, o as menuPortalCSS, p as multiValueCSS, q as multiValueLabelCSS, t as multiValueRemoveCSS, u as noOptionsMessageCSS, v as optionCSS, w as placeholderCSS, x as css$2, y as valueContainerCSS, z as isTouchCapable, A as isMobileDevice, B as multiValueAsValue, C as singleValueAsValue, D as valueTernary, E as classNames, F as defaultComponents, G as isDocumentElement, H as cleanValue, I as scrollIntoView, J as noop, M as MenuPlacer, K as notNullish } from './index-641ee5b8.esm.js';\nimport { jsx, css } from '@emotion/react';\nimport memoizeOne from 'memoize-one';\nimport _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';\n\nfunction _EMOTION_STRINGIFIED_CSS_ERROR__$2() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\n\n// Assistive text to describe visual elements. Hidden for sighted users.\nvar _ref = process.env.NODE_ENV === \"production\" ? {\n name: \"7pg0cj-a11yText\",\n styles: \"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap\"\n} : {\n name: \"1f43avz-a11yText-A11yText\",\n styles: \"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;label:A11yText;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkExMXlUZXh0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPSSIsImZpbGUiOiJBMTF5VGV4dC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IEpTWCB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLy8gQXNzaXN0aXZlIHRleHQgdG8gZGVzY3JpYmUgdmlzdWFsIGVsZW1lbnRzLiBIaWRkZW4gZm9yIHNpZ2h0ZWQgdXNlcnMuXG5jb25zdCBBMTF5VGV4dCA9IChwcm9wczogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ10pID0+IChcbiAgPHNwYW5cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAnYTExeVRleHQnLFxuICAgICAgekluZGV4OiA5OTk5LFxuICAgICAgYm9yZGVyOiAwLFxuICAgICAgY2xpcDogJ3JlY3QoMXB4LCAxcHgsIDFweCwgMXB4KScsXG4gICAgICBoZWlnaHQ6IDEsXG4gICAgICB3aWR0aDogMSxcbiAgICAgIHBvc2l0aW9uOiAnYWJzb2x1dGUnLFxuICAgICAgb3ZlcmZsb3c6ICdoaWRkZW4nLFxuICAgICAgcGFkZGluZzogMCxcbiAgICAgIHdoaXRlU3BhY2U6ICdub3dyYXAnLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IGRlZmF1bHQgQTExeVRleHQ7XG4iXX0= */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2\n};\nvar A11yText = function A11yText(props) {\n return jsx(\"span\", _extends({\n css: _ref\n }, props));\n};\nvar A11yText$1 = A11yText;\n\nvar defaultAriaLiveMessages = {\n guidance: function guidance(props) {\n var isSearchable = props.isSearchable,\n isMulti = props.isMulti,\n tabSelectsValue = props.tabSelectsValue,\n context = props.context,\n isInitialFocus = props.isInitialFocus;\n switch (context) {\n case 'menu':\n return \"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu\".concat(tabSelectsValue ? ', press Tab to select the option and exit the menu' : '', \".\");\n case 'input':\n return isInitialFocus ? \"\".concat(props['aria-label'] || 'Select', \" is focused \").concat(isSearchable ? ',type to refine list' : '', \", press Down to open the menu, \").concat(isMulti ? ' press left to focus selected values' : '') : '';\n case 'value':\n return 'Use left and right to toggle between focused values, press Backspace to remove the currently focused value';\n default:\n return '';\n }\n },\n onChange: function onChange(props) {\n var action = props.action,\n _props$label = props.label,\n label = _props$label === void 0 ? '' : _props$label,\n labels = props.labels,\n isDisabled = props.isDisabled;\n switch (action) {\n case 'deselect-option':\n case 'pop-value':\n case 'remove-value':\n return \"option \".concat(label, \", deselected.\");\n case 'clear':\n return 'All selected options have been cleared.';\n case 'initial-input-focus':\n return \"option\".concat(labels.length > 1 ? 's' : '', \" \").concat(labels.join(','), \", selected.\");\n case 'select-option':\n return isDisabled ? \"option \".concat(label, \" is disabled. Select another option.\") : \"option \".concat(label, \", selected.\");\n default:\n return '';\n }\n },\n onFocus: function onFocus(props) {\n var context = props.context,\n focused = props.focused,\n options = props.options,\n _props$label2 = props.label,\n label = _props$label2 === void 0 ? '' : _props$label2,\n selectValue = props.selectValue,\n isDisabled = props.isDisabled,\n isSelected = props.isSelected,\n isAppleDevice = props.isAppleDevice;\n var getArrayIndex = function getArrayIndex(arr, item) {\n return arr && arr.length ? \"\".concat(arr.indexOf(item) + 1, \" of \").concat(arr.length) : '';\n };\n if (context === 'value' && selectValue) {\n return \"value \".concat(label, \" focused, \").concat(getArrayIndex(selectValue, focused), \".\");\n }\n if (context === 'menu' && isAppleDevice) {\n var disabled = isDisabled ? ' disabled' : '';\n var status = \"\".concat(isSelected ? ' selected' : '').concat(disabled);\n return \"\".concat(label).concat(status, \", \").concat(getArrayIndex(options, focused), \".\");\n }\n return '';\n },\n onFilter: function onFilter(props) {\n var inputValue = props.inputValue,\n resultsMessage = props.resultsMessage;\n return \"\".concat(resultsMessage).concat(inputValue ? ' for search term ' + inputValue : '', \".\");\n }\n};\n\nvar LiveRegion = function LiveRegion(props) {\n var ariaSelection = props.ariaSelection,\n focusedOption = props.focusedOption,\n focusedValue = props.focusedValue,\n focusableOptions = props.focusableOptions,\n isFocused = props.isFocused,\n selectValue = props.selectValue,\n selectProps = props.selectProps,\n id = props.id,\n isAppleDevice = props.isAppleDevice;\n var ariaLiveMessages = selectProps.ariaLiveMessages,\n getOptionLabel = selectProps.getOptionLabel,\n inputValue = selectProps.inputValue,\n isMulti = selectProps.isMulti,\n isOptionDisabled = selectProps.isOptionDisabled,\n isSearchable = selectProps.isSearchable,\n menuIsOpen = selectProps.menuIsOpen,\n options = selectProps.options,\n screenReaderStatus = selectProps.screenReaderStatus,\n tabSelectsValue = selectProps.tabSelectsValue,\n isLoading = selectProps.isLoading;\n var ariaLabel = selectProps['aria-label'];\n var ariaLive = selectProps['aria-live'];\n\n // Update aria live message configuration when prop changes\n var messages = useMemo(function () {\n return _objectSpread(_objectSpread({}, defaultAriaLiveMessages), ariaLiveMessages || {});\n }, [ariaLiveMessages]);\n\n // Update aria live selected option when prop changes\n var ariaSelected = useMemo(function () {\n var message = '';\n if (ariaSelection && messages.onChange) {\n var option = ariaSelection.option,\n selectedOptions = ariaSelection.options,\n removedValue = ariaSelection.removedValue,\n removedValues = ariaSelection.removedValues,\n value = ariaSelection.value;\n // select-option when !isMulti does not return option so we assume selected option is value\n var asOption = function asOption(val) {\n return !Array.isArray(val) ? val : null;\n };\n\n // If there is just one item from the action then get its label\n var selected = removedValue || option || asOption(value);\n var label = selected ? getOptionLabel(selected) : '';\n\n // If there are multiple items from the action then return an array of labels\n var multiSelected = selectedOptions || removedValues || undefined;\n var labels = multiSelected ? multiSelected.map(getOptionLabel) : [];\n var onChangeProps = _objectSpread({\n // multiSelected items are usually items that have already been selected\n // or set by the user as a default value so we assume they are not disabled\n isDisabled: selected && isOptionDisabled(selected, selectValue),\n label: label,\n labels: labels\n }, ariaSelection);\n message = messages.onChange(onChangeProps);\n }\n return message;\n }, [ariaSelection, messages, isOptionDisabled, selectValue, getOptionLabel]);\n var ariaFocused = useMemo(function () {\n var focusMsg = '';\n var focused = focusedOption || focusedValue;\n var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption));\n if (focused && messages.onFocus) {\n var onFocusProps = {\n focused: focused,\n label: getOptionLabel(focused),\n isDisabled: isOptionDisabled(focused, selectValue),\n isSelected: isSelected,\n options: focusableOptions,\n context: focused === focusedOption ? 'menu' : 'value',\n selectValue: selectValue,\n isAppleDevice: isAppleDevice\n };\n focusMsg = messages.onFocus(onFocusProps);\n }\n return focusMsg;\n }, [focusedOption, focusedValue, getOptionLabel, isOptionDisabled, messages, focusableOptions, selectValue, isAppleDevice]);\n var ariaResults = useMemo(function () {\n var resultsMsg = '';\n if (menuIsOpen && options.length && !isLoading && messages.onFilter) {\n var resultsMessage = screenReaderStatus({\n count: focusableOptions.length\n });\n resultsMsg = messages.onFilter({\n inputValue: inputValue,\n resultsMessage: resultsMessage\n });\n }\n return resultsMsg;\n }, [focusableOptions, inputValue, menuIsOpen, messages, options, screenReaderStatus, isLoading]);\n var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus';\n var ariaGuidance = useMemo(function () {\n var guidanceMsg = '';\n if (messages.guidance) {\n var context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';\n guidanceMsg = messages.guidance({\n 'aria-label': ariaLabel,\n context: context,\n isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),\n isMulti: isMulti,\n isSearchable: isSearchable,\n tabSelectsValue: tabSelectsValue,\n isInitialFocus: isInitialFocus\n });\n }\n return guidanceMsg;\n }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);\n var ScreenReaderText = jsx(Fragment, null, jsx(\"span\", {\n id: \"aria-selection\"\n }, ariaSelected), jsx(\"span\", {\n id: \"aria-focused\"\n }, ariaFocused), jsx(\"span\", {\n id: \"aria-results\"\n }, ariaResults), jsx(\"span\", {\n id: \"aria-guidance\"\n }, ariaGuidance));\n return jsx(Fragment, null, jsx(A11yText$1, {\n id: id\n }, isInitialFocus && ScreenReaderText), jsx(A11yText$1, {\n \"aria-live\": ariaLive,\n \"aria-atomic\": \"false\",\n \"aria-relevant\": \"additions text\",\n role: \"log\"\n }, isFocused && !isInitialFocus && ScreenReaderText));\n};\nvar LiveRegion$1 = LiveRegion;\n\nvar diacritics = [{\n base: 'A',\n letters: \"A\\u24B6\\uFF21\\xC0\\xC1\\xC2\\u1EA6\\u1EA4\\u1EAA\\u1EA8\\xC3\\u0100\\u0102\\u1EB0\\u1EAE\\u1EB4\\u1EB2\\u0226\\u01E0\\xC4\\u01DE\\u1EA2\\xC5\\u01FA\\u01CD\\u0200\\u0202\\u1EA0\\u1EAC\\u1EB6\\u1E00\\u0104\\u023A\\u2C6F\"\n}, {\n base: 'AA',\n letters: \"\\uA732\"\n}, {\n base: 'AE',\n letters: \"\\xC6\\u01FC\\u01E2\"\n}, {\n base: 'AO',\n letters: \"\\uA734\"\n}, {\n base: 'AU',\n letters: \"\\uA736\"\n}, {\n base: 'AV',\n letters: \"\\uA738\\uA73A\"\n}, {\n base: 'AY',\n letters: \"\\uA73C\"\n}, {\n base: 'B',\n letters: \"B\\u24B7\\uFF22\\u1E02\\u1E04\\u1E06\\u0243\\u0182\\u0181\"\n}, {\n base: 'C',\n letters: \"C\\u24B8\\uFF23\\u0106\\u0108\\u010A\\u010C\\xC7\\u1E08\\u0187\\u023B\\uA73E\"\n}, {\n base: 'D',\n letters: \"D\\u24B9\\uFF24\\u1E0A\\u010E\\u1E0C\\u1E10\\u1E12\\u1E0E\\u0110\\u018B\\u018A\\u0189\\uA779\"\n}, {\n base: 'DZ',\n letters: \"\\u01F1\\u01C4\"\n}, {\n base: 'Dz',\n letters: \"\\u01F2\\u01C5\"\n}, {\n base: 'E',\n letters: \"E\\u24BA\\uFF25\\xC8\\xC9\\xCA\\u1EC0\\u1EBE\\u1EC4\\u1EC2\\u1EBC\\u0112\\u1E14\\u1E16\\u0114\\u0116\\xCB\\u1EBA\\u011A\\u0204\\u0206\\u1EB8\\u1EC6\\u0228\\u1E1C\\u0118\\u1E18\\u1E1A\\u0190\\u018E\"\n}, {\n base: 'F',\n letters: \"F\\u24BB\\uFF26\\u1E1E\\u0191\\uA77B\"\n}, {\n base: 'G',\n letters: \"G\\u24BC\\uFF27\\u01F4\\u011C\\u1E20\\u011E\\u0120\\u01E6\\u0122\\u01E4\\u0193\\uA7A0\\uA77D\\uA77E\"\n}, {\n base: 'H',\n letters: \"H\\u24BD\\uFF28\\u0124\\u1E22\\u1E26\\u021E\\u1E24\\u1E28\\u1E2A\\u0126\\u2C67\\u2C75\\uA78D\"\n}, {\n base: 'I',\n letters: \"I\\u24BE\\uFF29\\xCC\\xCD\\xCE\\u0128\\u012A\\u012C\\u0130\\xCF\\u1E2E\\u1EC8\\u01CF\\u0208\\u020A\\u1ECA\\u012E\\u1E2C\\u0197\"\n}, {\n base: 'J',\n letters: \"J\\u24BF\\uFF2A\\u0134\\u0248\"\n}, {\n base: 'K',\n letters: \"K\\u24C0\\uFF2B\\u1E30\\u01E8\\u1E32\\u0136\\u1E34\\u0198\\u2C69\\uA740\\uA742\\uA744\\uA7A2\"\n}, {\n base: 'L',\n letters: \"L\\u24C1\\uFF2C\\u013F\\u0139\\u013D\\u1E36\\u1E38\\u013B\\u1E3C\\u1E3A\\u0141\\u023D\\u2C62\\u2C60\\uA748\\uA746\\uA780\"\n}, {\n base: 'LJ',\n letters: \"\\u01C7\"\n}, {\n base: 'Lj',\n letters: \"\\u01C8\"\n}, {\n base: 'M',\n letters: \"M\\u24C2\\uFF2D\\u1E3E\\u1E40\\u1E42\\u2C6E\\u019C\"\n}, {\n base: 'N',\n letters: \"N\\u24C3\\uFF2E\\u01F8\\u0143\\xD1\\u1E44\\u0147\\u1E46\\u0145\\u1E4A\\u1E48\\u0220\\u019D\\uA790\\uA7A4\"\n}, {\n base: 'NJ',\n letters: \"\\u01CA\"\n}, {\n base: 'Nj',\n letters: \"\\u01CB\"\n}, {\n base: 'O',\n letters: \"O\\u24C4\\uFF2F\\xD2\\xD3\\xD4\\u1ED2\\u1ED0\\u1ED6\\u1ED4\\xD5\\u1E4C\\u022C\\u1E4E\\u014C\\u1E50\\u1E52\\u014E\\u022E\\u0230\\xD6\\u022A\\u1ECE\\u0150\\u01D1\\u020C\\u020E\\u01A0\\u1EDC\\u1EDA\\u1EE0\\u1EDE\\u1EE2\\u1ECC\\u1ED8\\u01EA\\u01EC\\xD8\\u01FE\\u0186\\u019F\\uA74A\\uA74C\"\n}, {\n base: 'OI',\n letters: \"\\u01A2\"\n}, {\n base: 'OO',\n letters: \"\\uA74E\"\n}, {\n base: 'OU',\n letters: \"\\u0222\"\n}, {\n base: 'P',\n letters: \"P\\u24C5\\uFF30\\u1E54\\u1E56\\u01A4\\u2C63\\uA750\\uA752\\uA754\"\n}, {\n base: 'Q',\n letters: \"Q\\u24C6\\uFF31\\uA756\\uA758\\u024A\"\n}, {\n base: 'R',\n letters: \"R\\u24C7\\uFF32\\u0154\\u1E58\\u0158\\u0210\\u0212\\u1E5A\\u1E5C\\u0156\\u1E5E\\u024C\\u2C64\\uA75A\\uA7A6\\uA782\"\n}, {\n base: 'S',\n letters: \"S\\u24C8\\uFF33\\u1E9E\\u015A\\u1E64\\u015C\\u1E60\\u0160\\u1E66\\u1E62\\u1E68\\u0218\\u015E\\u2C7E\\uA7A8\\uA784\"\n}, {\n base: 'T',\n letters: \"T\\u24C9\\uFF34\\u1E6A\\u0164\\u1E6C\\u021A\\u0162\\u1E70\\u1E6E\\u0166\\u01AC\\u01AE\\u023E\\uA786\"\n}, {\n base: 'TZ',\n letters: \"\\uA728\"\n}, {\n base: 'U',\n letters: \"U\\u24CA\\uFF35\\xD9\\xDA\\xDB\\u0168\\u1E78\\u016A\\u1E7A\\u016C\\xDC\\u01DB\\u01D7\\u01D5\\u01D9\\u1EE6\\u016E\\u0170\\u01D3\\u0214\\u0216\\u01AF\\u1EEA\\u1EE8\\u1EEE\\u1EEC\\u1EF0\\u1EE4\\u1E72\\u0172\\u1E76\\u1E74\\u0244\"\n}, {\n base: 'V',\n letters: \"V\\u24CB\\uFF36\\u1E7C\\u1E7E\\u01B2\\uA75E\\u0245\"\n}, {\n base: 'VY',\n letters: \"\\uA760\"\n}, {\n base: 'W',\n letters: \"W\\u24CC\\uFF37\\u1E80\\u1E82\\u0174\\u1E86\\u1E84\\u1E88\\u2C72\"\n}, {\n base: 'X',\n letters: \"X\\u24CD\\uFF38\\u1E8A\\u1E8C\"\n}, {\n base: 'Y',\n letters: \"Y\\u24CE\\uFF39\\u1EF2\\xDD\\u0176\\u1EF8\\u0232\\u1E8E\\u0178\\u1EF6\\u1EF4\\u01B3\\u024E\\u1EFE\"\n}, {\n base: 'Z',\n letters: \"Z\\u24CF\\uFF3A\\u0179\\u1E90\\u017B\\u017D\\u1E92\\u1E94\\u01B5\\u0224\\u2C7F\\u2C6B\\uA762\"\n}, {\n base: 'a',\n letters: \"a\\u24D0\\uFF41\\u1E9A\\xE0\\xE1\\xE2\\u1EA7\\u1EA5\\u1EAB\\u1EA9\\xE3\\u0101\\u0103\\u1EB1\\u1EAF\\u1EB5\\u1EB3\\u0227\\u01E1\\xE4\\u01DF\\u1EA3\\xE5\\u01FB\\u01CE\\u0201\\u0203\\u1EA1\\u1EAD\\u1EB7\\u1E01\\u0105\\u2C65\\u0250\"\n}, {\n base: 'aa',\n letters: \"\\uA733\"\n}, {\n base: 'ae',\n letters: \"\\xE6\\u01FD\\u01E3\"\n}, {\n base: 'ao',\n letters: \"\\uA735\"\n}, {\n base: 'au',\n letters: \"\\uA737\"\n}, {\n base: 'av',\n letters: \"\\uA739\\uA73B\"\n}, {\n base: 'ay',\n letters: \"\\uA73D\"\n}, {\n base: 'b',\n letters: \"b\\u24D1\\uFF42\\u1E03\\u1E05\\u1E07\\u0180\\u0183\\u0253\"\n}, {\n base: 'c',\n letters: \"c\\u24D2\\uFF43\\u0107\\u0109\\u010B\\u010D\\xE7\\u1E09\\u0188\\u023C\\uA73F\\u2184\"\n}, {\n base: 'd',\n letters: \"d\\u24D3\\uFF44\\u1E0B\\u010F\\u1E0D\\u1E11\\u1E13\\u1E0F\\u0111\\u018C\\u0256\\u0257\\uA77A\"\n}, {\n base: 'dz',\n letters: \"\\u01F3\\u01C6\"\n}, {\n base: 'e',\n letters: \"e\\u24D4\\uFF45\\xE8\\xE9\\xEA\\u1EC1\\u1EBF\\u1EC5\\u1EC3\\u1EBD\\u0113\\u1E15\\u1E17\\u0115\\u0117\\xEB\\u1EBB\\u011B\\u0205\\u0207\\u1EB9\\u1EC7\\u0229\\u1E1D\\u0119\\u1E19\\u1E1B\\u0247\\u025B\\u01DD\"\n}, {\n base: 'f',\n letters: \"f\\u24D5\\uFF46\\u1E1F\\u0192\\uA77C\"\n}, {\n base: 'g',\n letters: \"g\\u24D6\\uFF47\\u01F5\\u011D\\u1E21\\u011F\\u0121\\u01E7\\u0123\\u01E5\\u0260\\uA7A1\\u1D79\\uA77F\"\n}, {\n base: 'h',\n letters: \"h\\u24D7\\uFF48\\u0125\\u1E23\\u1E27\\u021F\\u1E25\\u1E29\\u1E2B\\u1E96\\u0127\\u2C68\\u2C76\\u0265\"\n}, {\n base: 'hv',\n letters: \"\\u0195\"\n}, {\n base: 'i',\n letters: \"i\\u24D8\\uFF49\\xEC\\xED\\xEE\\u0129\\u012B\\u012D\\xEF\\u1E2F\\u1EC9\\u01D0\\u0209\\u020B\\u1ECB\\u012F\\u1E2D\\u0268\\u0131\"\n}, {\n base: 'j',\n letters: \"j\\u24D9\\uFF4A\\u0135\\u01F0\\u0249\"\n}, {\n base: 'k',\n letters: \"k\\u24DA\\uFF4B\\u1E31\\u01E9\\u1E33\\u0137\\u1E35\\u0199\\u2C6A\\uA741\\uA743\\uA745\\uA7A3\"\n}, {\n base: 'l',\n letters: \"l\\u24DB\\uFF4C\\u0140\\u013A\\u013E\\u1E37\\u1E39\\u013C\\u1E3D\\u1E3B\\u017F\\u0142\\u019A\\u026B\\u2C61\\uA749\\uA781\\uA747\"\n}, {\n base: 'lj',\n letters: \"\\u01C9\"\n}, {\n base: 'm',\n letters: \"m\\u24DC\\uFF4D\\u1E3F\\u1E41\\u1E43\\u0271\\u026F\"\n}, {\n base: 'n',\n letters: \"n\\u24DD\\uFF4E\\u01F9\\u0144\\xF1\\u1E45\\u0148\\u1E47\\u0146\\u1E4B\\u1E49\\u019E\\u0272\\u0149\\uA791\\uA7A5\"\n}, {\n base: 'nj',\n letters: \"\\u01CC\"\n}, {\n base: 'o',\n letters: \"o\\u24DE\\uFF4F\\xF2\\xF3\\xF4\\u1ED3\\u1ED1\\u1ED7\\u1ED5\\xF5\\u1E4D\\u022D\\u1E4F\\u014D\\u1E51\\u1E53\\u014F\\u022F\\u0231\\xF6\\u022B\\u1ECF\\u0151\\u01D2\\u020D\\u020F\\u01A1\\u1EDD\\u1EDB\\u1EE1\\u1EDF\\u1EE3\\u1ECD\\u1ED9\\u01EB\\u01ED\\xF8\\u01FF\\u0254\\uA74B\\uA74D\\u0275\"\n}, {\n base: 'oi',\n letters: \"\\u01A3\"\n}, {\n base: 'ou',\n letters: \"\\u0223\"\n}, {\n base: 'oo',\n letters: \"\\uA74F\"\n}, {\n base: 'p',\n letters: \"p\\u24DF\\uFF50\\u1E55\\u1E57\\u01A5\\u1D7D\\uA751\\uA753\\uA755\"\n}, {\n base: 'q',\n letters: \"q\\u24E0\\uFF51\\u024B\\uA757\\uA759\"\n}, {\n base: 'r',\n letters: \"r\\u24E1\\uFF52\\u0155\\u1E59\\u0159\\u0211\\u0213\\u1E5B\\u1E5D\\u0157\\u1E5F\\u024D\\u027D\\uA75B\\uA7A7\\uA783\"\n}, {\n base: 's',\n letters: \"s\\u24E2\\uFF53\\xDF\\u015B\\u1E65\\u015D\\u1E61\\u0161\\u1E67\\u1E63\\u1E69\\u0219\\u015F\\u023F\\uA7A9\\uA785\\u1E9B\"\n}, {\n base: 't',\n letters: \"t\\u24E3\\uFF54\\u1E6B\\u1E97\\u0165\\u1E6D\\u021B\\u0163\\u1E71\\u1E6F\\u0167\\u01AD\\u0288\\u2C66\\uA787\"\n}, {\n base: 'tz',\n letters: \"\\uA729\"\n}, {\n base: 'u',\n letters: \"u\\u24E4\\uFF55\\xF9\\xFA\\xFB\\u0169\\u1E79\\u016B\\u1E7B\\u016D\\xFC\\u01DC\\u01D8\\u01D6\\u01DA\\u1EE7\\u016F\\u0171\\u01D4\\u0215\\u0217\\u01B0\\u1EEB\\u1EE9\\u1EEF\\u1EED\\u1EF1\\u1EE5\\u1E73\\u0173\\u1E77\\u1E75\\u0289\"\n}, {\n base: 'v',\n letters: \"v\\u24E5\\uFF56\\u1E7D\\u1E7F\\u028B\\uA75F\\u028C\"\n}, {\n base: 'vy',\n letters: \"\\uA761\"\n}, {\n base: 'w',\n letters: \"w\\u24E6\\uFF57\\u1E81\\u1E83\\u0175\\u1E87\\u1E85\\u1E98\\u1E89\\u2C73\"\n}, {\n base: 'x',\n letters: \"x\\u24E7\\uFF58\\u1E8B\\u1E8D\"\n}, {\n base: 'y',\n letters: \"y\\u24E8\\uFF59\\u1EF3\\xFD\\u0177\\u1EF9\\u0233\\u1E8F\\xFF\\u1EF7\\u1E99\\u1EF5\\u01B4\\u024F\\u1EFF\"\n}, {\n base: 'z',\n letters: \"z\\u24E9\\uFF5A\\u017A\\u1E91\\u017C\\u017E\\u1E93\\u1E95\\u01B6\\u0225\\u0240\\u2C6C\\uA763\"\n}];\nvar anyDiacritic = new RegExp('[' + diacritics.map(function (d) {\n return d.letters;\n}).join('') + ']', 'g');\nvar diacriticToBase = {};\nfor (var i = 0; i < diacritics.length; i++) {\n var diacritic = diacritics[i];\n for (var j = 0; j < diacritic.letters.length; j++) {\n diacriticToBase[diacritic.letters[j]] = diacritic.base;\n }\n}\nvar stripDiacritics = function stripDiacritics(str) {\n return str.replace(anyDiacritic, function (match) {\n return diacriticToBase[match];\n });\n};\n\nvar memoizedStripDiacriticsForInput = memoizeOne(stripDiacritics);\nvar trimString = function trimString(str) {\n return str.replace(/^\\s+|\\s+$/g, '');\n};\nvar defaultStringify = function defaultStringify(option) {\n return \"\".concat(option.label, \" \").concat(option.value);\n};\nvar createFilter = function createFilter(config) {\n return function (option, rawInput) {\n // eslint-disable-next-line no-underscore-dangle\n if (option.data.__isNew__) return true;\n var _ignoreCase$ignoreAcc = _objectSpread({\n ignoreCase: true,\n ignoreAccents: true,\n stringify: defaultStringify,\n trim: true,\n matchFrom: 'any'\n }, config),\n ignoreCase = _ignoreCase$ignoreAcc.ignoreCase,\n ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents,\n stringify = _ignoreCase$ignoreAcc.stringify,\n trim = _ignoreCase$ignoreAcc.trim,\n matchFrom = _ignoreCase$ignoreAcc.matchFrom;\n var input = trim ? trimString(rawInput) : rawInput;\n var candidate = trim ? trimString(stringify(option)) : stringify(option);\n if (ignoreCase) {\n input = input.toLowerCase();\n candidate = candidate.toLowerCase();\n }\n if (ignoreAccents) {\n input = memoizedStripDiacriticsForInput(input);\n candidate = stripDiacritics(candidate);\n }\n return matchFrom === 'start' ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;\n };\n};\n\nvar _excluded = [\"innerRef\"];\nfunction DummyInput(_ref) {\n var innerRef = _ref.innerRef,\n props = _objectWithoutProperties(_ref, _excluded);\n // Remove animation props not meant for HTML elements\n var filteredProps = removeProps(props, 'onExited', 'in', 'enter', 'exit', 'appear');\n return jsx(\"input\", _extends({\n ref: innerRef\n }, filteredProps, {\n css: /*#__PURE__*/css({\n label: 'dummyInput',\n // get rid of any default styles\n background: 0,\n border: 0,\n // important! this hides the flashing cursor\n caretColor: 'transparent',\n fontSize: 'inherit',\n gridArea: '1 / 1 / 2 / 3',\n outline: 0,\n padding: 0,\n // important! without `width` browsers won't allow focus\n width: 1,\n // remove cursor on desktop\n color: 'transparent',\n // remove cursor on mobile whilst maintaining \"scroll into view\" behaviour\n left: -100,\n opacity: 0,\n position: 'relative',\n transform: 'scale(.01)'\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:DummyInput;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkR1bW15SW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCTSIsImZpbGUiOiJEdW1teUlucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgSlNYLCBSZWYgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5pbXBvcnQgeyByZW1vdmVQcm9wcyB9IGZyb20gJy4uL3V0aWxzJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gRHVtbXlJbnB1dCh7XG4gIGlubmVyUmVmLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydpbnB1dCddICYge1xuICByZWFkb25seSBpbm5lclJlZjogUmVmPEhUTUxJbnB1dEVsZW1lbnQ+O1xufSkge1xuICAvLyBSZW1vdmUgYW5pbWF0aW9uIHByb3BzIG5vdCBtZWFudCBmb3IgSFRNTCBlbGVtZW50c1xuICBjb25zdCBmaWx0ZXJlZFByb3BzID0gcmVtb3ZlUHJvcHMoXG4gICAgcHJvcHMsXG4gICAgJ29uRXhpdGVkJyxcbiAgICAnaW4nLFxuICAgICdlbnRlcicsXG4gICAgJ2V4aXQnLFxuICAgICdhcHBlYXInXG4gICk7XG5cbiAgcmV0dXJuIChcbiAgICA8aW5wdXRcbiAgICAgIHJlZj17aW5uZXJSZWZ9XG4gICAgICB7Li4uZmlsdGVyZWRQcm9wc31cbiAgICAgIGNzcz17e1xuICAgICAgICBsYWJlbDogJ2R1bW15SW5wdXQnLFxuICAgICAgICAvLyBnZXQgcmlkIG9mIGFueSBkZWZhdWx0IHN0eWxlc1xuICAgICAgICBiYWNrZ3JvdW5kOiAwLFxuICAgICAgICBib3JkZXI6IDAsXG4gICAgICAgIC8vIGltcG9ydGFudCEgdGhpcyBoaWRlcyB0aGUgZmxhc2hpbmcgY3Vyc29yXG4gICAgICAgIGNhcmV0Q29sb3I6ICd0cmFuc3BhcmVudCcsXG4gICAgICAgIGZvbnRTaXplOiAnaW5oZXJpdCcsXG4gICAgICAgIGdyaWRBcmVhOiAnMSAvIDEgLyAyIC8gMycsXG4gICAgICAgIG91dGxpbmU6IDAsXG4gICAgICAgIHBhZGRpbmc6IDAsXG4gICAgICAgIC8vIGltcG9ydGFudCEgd2l0aG91dCBgd2lkdGhgIGJyb3dzZXJzIHdvbid0IGFsbG93IGZvY3VzXG4gICAgICAgIHdpZHRoOiAxLFxuXG4gICAgICAgIC8vIHJlbW92ZSBjdXJzb3Igb24gZGVza3RvcFxuICAgICAgICBjb2xvcjogJ3RyYW5zcGFyZW50JyxcblxuICAgICAgICAvLyByZW1vdmUgY3Vyc29yIG9uIG1vYmlsZSB3aGlsc3QgbWFpbnRhaW5pbmcgXCJzY3JvbGwgaW50byB2aWV3XCIgYmVoYXZpb3VyXG4gICAgICAgIGxlZnQ6IC0xMDAsXG4gICAgICAgIG9wYWNpdHk6IDAsXG4gICAgICAgIHBvc2l0aW9uOiAncmVsYXRpdmUnLFxuICAgICAgICB0cmFuc2Zvcm06ICdzY2FsZSguMDEpJyxcbiAgICAgIH19XG4gICAgLz5cbiAgKTtcbn1cbiJdfQ== */\")\n }));\n}\n\nvar cancelScroll = function cancelScroll(event) {\n if (event.cancelable) event.preventDefault();\n event.stopPropagation();\n};\nfunction useScrollCapture(_ref) {\n var isEnabled = _ref.isEnabled,\n onBottomArrive = _ref.onBottomArrive,\n onBottomLeave = _ref.onBottomLeave,\n onTopArrive = _ref.onTopArrive,\n onTopLeave = _ref.onTopLeave;\n var isBottom = useRef(false);\n var isTop = useRef(false);\n var touchStart = useRef(0);\n var scrollTarget = useRef(null);\n var handleEventDelta = useCallback(function (event, delta) {\n if (scrollTarget.current === null) return;\n var _scrollTarget$current = scrollTarget.current,\n scrollTop = _scrollTarget$current.scrollTop,\n scrollHeight = _scrollTarget$current.scrollHeight,\n clientHeight = _scrollTarget$current.clientHeight;\n var target = scrollTarget.current;\n var isDeltaPositive = delta > 0;\n var availableScroll = scrollHeight - clientHeight - scrollTop;\n var shouldCancelScroll = false;\n\n // reset bottom/top flags\n if (availableScroll > delta && isBottom.current) {\n if (onBottomLeave) onBottomLeave(event);\n isBottom.current = false;\n }\n if (isDeltaPositive && isTop.current) {\n if (onTopLeave) onTopLeave(event);\n isTop.current = false;\n }\n\n // bottom limit\n if (isDeltaPositive && delta > availableScroll) {\n if (onBottomArrive && !isBottom.current) {\n onBottomArrive(event);\n }\n target.scrollTop = scrollHeight;\n shouldCancelScroll = true;\n isBottom.current = true;\n\n // top limit\n } else if (!isDeltaPositive && -delta > scrollTop) {\n if (onTopArrive && !isTop.current) {\n onTopArrive(event);\n }\n target.scrollTop = 0;\n shouldCancelScroll = true;\n isTop.current = true;\n }\n\n // cancel scroll\n if (shouldCancelScroll) {\n cancelScroll(event);\n }\n }, [onBottomArrive, onBottomLeave, onTopArrive, onTopLeave]);\n var onWheel = useCallback(function (event) {\n handleEventDelta(event, event.deltaY);\n }, [handleEventDelta]);\n var onTouchStart = useCallback(function (event) {\n // set touch start so we can calculate touchmove delta\n touchStart.current = event.changedTouches[0].clientY;\n }, []);\n var onTouchMove = useCallback(function (event) {\n var deltaY = touchStart.current - event.changedTouches[0].clientY;\n handleEventDelta(event, deltaY);\n }, [handleEventDelta]);\n var startListening = useCallback(function (el) {\n // bail early if no element is available to attach to\n if (!el) return;\n var notPassive = supportsPassiveEvents ? {\n passive: false\n } : false;\n el.addEventListener('wheel', onWheel, notPassive);\n el.addEventListener('touchstart', onTouchStart, notPassive);\n el.addEventListener('touchmove', onTouchMove, notPassive);\n }, [onTouchMove, onTouchStart, onWheel]);\n var stopListening = useCallback(function (el) {\n // bail early if no element is available to detach from\n if (!el) return;\n el.removeEventListener('wheel', onWheel, false);\n el.removeEventListener('touchstart', onTouchStart, false);\n el.removeEventListener('touchmove', onTouchMove, false);\n }, [onTouchMove, onTouchStart, onWheel]);\n useEffect(function () {\n if (!isEnabled) return;\n var element = scrollTarget.current;\n startListening(element);\n return function () {\n stopListening(element);\n };\n }, [isEnabled, startListening, stopListening]);\n return function (element) {\n scrollTarget.current = element;\n };\n}\n\nvar STYLE_KEYS = ['boxSizing', 'height', 'overflow', 'paddingRight', 'position'];\nvar LOCK_STYLES = {\n boxSizing: 'border-box',\n // account for possible declaration `width: 100%;` on body\n overflow: 'hidden',\n position: 'relative',\n height: '100%'\n};\nfunction preventTouchMove(e) {\n if (e.cancelable) e.preventDefault();\n}\nfunction allowTouchMove(e) {\n e.stopPropagation();\n}\nfunction preventInertiaScroll() {\n var top = this.scrollTop;\n var totalScroll = this.scrollHeight;\n var currentScroll = top + this.offsetHeight;\n if (top === 0) {\n this.scrollTop = 1;\n } else if (currentScroll === totalScroll) {\n this.scrollTop = top - 1;\n }\n}\n\n// `ontouchstart` check works on most browsers\n// `maxTouchPoints` works on IE10/11 and Surface\nfunction isTouchDevice() {\n return 'ontouchstart' in window || navigator.maxTouchPoints;\n}\nvar canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\nvar activeScrollLocks = 0;\nvar listenerOptions = {\n capture: false,\n passive: false\n};\nfunction useScrollLock(_ref) {\n var isEnabled = _ref.isEnabled,\n _ref$accountForScroll = _ref.accountForScrollbars,\n accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;\n var originalStyles = useRef({});\n var scrollTarget = useRef(null);\n var addScrollLock = useCallback(function (touchScrollTarget) {\n if (!canUseDOM) return;\n var target = document.body;\n var targetStyle = target && target.style;\n if (accountForScrollbars) {\n // store any styles already applied to the body\n STYLE_KEYS.forEach(function (key) {\n var val = targetStyle && targetStyle[key];\n originalStyles.current[key] = val;\n });\n }\n\n // apply the lock styles and padding if this is the first scroll lock\n if (accountForScrollbars && activeScrollLocks < 1) {\n var currentPadding = parseInt(originalStyles.current.paddingRight, 10) || 0;\n var clientWidth = document.body ? document.body.clientWidth : 0;\n var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;\n Object.keys(LOCK_STYLES).forEach(function (key) {\n var val = LOCK_STYLES[key];\n if (targetStyle) {\n targetStyle[key] = val;\n }\n });\n if (targetStyle) {\n targetStyle.paddingRight = \"\".concat(adjustedPadding, \"px\");\n }\n }\n\n // account for touch devices\n if (target && isTouchDevice()) {\n // Mobile Safari ignores { overflow: hidden } declaration on the body.\n target.addEventListener('touchmove', preventTouchMove, listenerOptions);\n\n // Allow scroll on provided target\n if (touchScrollTarget) {\n touchScrollTarget.addEventListener('touchstart', preventInertiaScroll, listenerOptions);\n touchScrollTarget.addEventListener('touchmove', allowTouchMove, listenerOptions);\n }\n }\n\n // increment active scroll locks\n activeScrollLocks += 1;\n }, [accountForScrollbars]);\n var removeScrollLock = useCallback(function (touchScrollTarget) {\n if (!canUseDOM) return;\n var target = document.body;\n var targetStyle = target && target.style;\n\n // safely decrement active scroll locks\n activeScrollLocks = Math.max(activeScrollLocks - 1, 0);\n\n // reapply original body styles, if any\n if (accountForScrollbars && activeScrollLocks < 1) {\n STYLE_KEYS.forEach(function (key) {\n var val = originalStyles.current[key];\n if (targetStyle) {\n targetStyle[key] = val;\n }\n });\n }\n\n // remove touch listeners\n if (target && isTouchDevice()) {\n target.removeEventListener('touchmove', preventTouchMove, listenerOptions);\n if (touchScrollTarget) {\n touchScrollTarget.removeEventListener('touchstart', preventInertiaScroll, listenerOptions);\n touchScrollTarget.removeEventListener('touchmove', allowTouchMove, listenerOptions);\n }\n }\n }, [accountForScrollbars]);\n useEffect(function () {\n if (!isEnabled) return;\n var element = scrollTarget.current;\n addScrollLock(element);\n return function () {\n removeScrollLock(element);\n };\n }, [isEnabled, addScrollLock, removeScrollLock]);\n return function (element) {\n scrollTarget.current = element;\n };\n}\n\nfunction _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\nvar blurSelectInput = function blurSelectInput(event) {\n var element = event.target;\n return element.ownerDocument.activeElement && element.ownerDocument.activeElement.blur();\n};\nvar _ref2$1 = process.env.NODE_ENV === \"production\" ? {\n name: \"1kfdb0e\",\n styles: \"position:fixed;left:0;bottom:0;right:0;top:0\"\n} : {\n name: \"bp8cua-ScrollManager\",\n styles: \"position:fixed;left:0;bottom:0;right:0;top:0;label:ScrollManager;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNjcm9sbE1hbmFnZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9EVSIsImZpbGUiOiJTY3JvbGxNYW5hZ2VyLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgRnJhZ21lbnQsIFJlYWN0RWxlbWVudCwgUmVmQ2FsbGJhY2ssIE1vdXNlRXZlbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlU2Nyb2xsQ2FwdHVyZSBmcm9tICcuL3VzZVNjcm9sbENhcHR1cmUnO1xuaW1wb3J0IHVzZVNjcm9sbExvY2sgZnJvbSAnLi91c2VTY3JvbGxMb2NrJztcblxuaW50ZXJmYWNlIFByb3BzIHtcbiAgcmVhZG9ubHkgY2hpbGRyZW46IChyZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PikgPT4gUmVhY3RFbGVtZW50O1xuICByZWFkb25seSBsb2NrRW5hYmxlZDogYm9vbGVhbjtcbiAgcmVhZG9ubHkgY2FwdHVyZUVuYWJsZWQ6IGJvb2xlYW47XG4gIHJlYWRvbmx5IG9uQm90dG9tQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Cb3R0b21MZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG4gIHJlYWRvbmx5IG9uVG9wQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Ub3BMZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG59XG5cbmNvbnN0IGJsdXJTZWxlY3RJbnB1dCA9IChldmVudDogTW91c2VFdmVudDxIVE1MRGl2RWxlbWVudD4pID0+IHtcbiAgY29uc3QgZWxlbWVudCA9IGV2ZW50LnRhcmdldCBhcyBIVE1MRGl2RWxlbWVudDtcbiAgcmV0dXJuIChcbiAgICBlbGVtZW50Lm93bmVyRG9jdW1lbnQuYWN0aXZlRWxlbWVudCAmJlxuICAgIChlbGVtZW50Lm93bmVyRG9jdW1lbnQuYWN0aXZlRWxlbWVudCBhcyBIVE1MRWxlbWVudCkuYmx1cigpXG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBTY3JvbGxNYW5hZ2VyKHtcbiAgY2hpbGRyZW4sXG4gIGxvY2tFbmFibGVkLFxuICBjYXB0dXJlRW5hYmxlZCA9IHRydWUsXG4gIG9uQm90dG9tQXJyaXZlLFxuICBvbkJvdHRvbUxlYXZlLFxuICBvblRvcEFycml2ZSxcbiAgb25Ub3BMZWF2ZSxcbn06IFByb3BzKSB7XG4gIGNvbnN0IHNldFNjcm9sbENhcHR1cmVUYXJnZXQgPSB1c2VTY3JvbGxDYXB0dXJlKHtcbiAgICBpc0VuYWJsZWQ6IGNhcHR1cmVFbmFibGVkLFxuICAgIG9uQm90dG9tQXJyaXZlLFxuICAgIG9uQm90dG9tTGVhdmUsXG4gICAgb25Ub3BBcnJpdmUsXG4gICAgb25Ub3BMZWF2ZSxcbiAgfSk7XG4gIGNvbnN0IHNldFNjcm9sbExvY2tUYXJnZXQgPSB1c2VTY3JvbGxMb2NrKHsgaXNFbmFibGVkOiBsb2NrRW5hYmxlZCB9KTtcblxuICBjb25zdCB0YXJnZXRSZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PiA9IChlbGVtZW50KSA9PiB7XG4gICAgc2V0U2Nyb2xsQ2FwdHVyZVRhcmdldChlbGVtZW50KTtcbiAgICBzZXRTY3JvbGxMb2NrVGFyZ2V0KGVsZW1lbnQpO1xuICB9O1xuXG4gIHJldHVybiAoXG4gICAgPEZyYWdtZW50PlxuICAgICAge2xvY2tFbmFibGVkICYmIChcbiAgICAgICAgPGRpdlxuICAgICAgICAgIG9uQ2xpY2s9e2JsdXJTZWxlY3RJbnB1dH1cbiAgICAgICAgICBjc3M9e3sgcG9zaXRpb246ICdmaXhlZCcsIGxlZnQ6IDAsIGJvdHRvbTogMCwgcmlnaHQ6IDAsIHRvcDogMCB9fVxuICAgICAgICAvPlxuICAgICAgKX1cbiAgICAgIHtjaGlsZHJlbih0YXJnZXRSZWYpfVxuICAgIDwvRnJhZ21lbnQ+XG4gICk7XG59XG4iXX0= */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1\n};\nfunction ScrollManager(_ref) {\n var children = _ref.children,\n lockEnabled = _ref.lockEnabled,\n _ref$captureEnabled = _ref.captureEnabled,\n captureEnabled = _ref$captureEnabled === void 0 ? true : _ref$captureEnabled,\n onBottomArrive = _ref.onBottomArrive,\n onBottomLeave = _ref.onBottomLeave,\n onTopArrive = _ref.onTopArrive,\n onTopLeave = _ref.onTopLeave;\n var setScrollCaptureTarget = useScrollCapture({\n isEnabled: captureEnabled,\n onBottomArrive: onBottomArrive,\n onBottomLeave: onBottomLeave,\n onTopArrive: onTopArrive,\n onTopLeave: onTopLeave\n });\n var setScrollLockTarget = useScrollLock({\n isEnabled: lockEnabled\n });\n var targetRef = function targetRef(element) {\n setScrollCaptureTarget(element);\n setScrollLockTarget(element);\n };\n return jsx(Fragment, null, lockEnabled && jsx(\"div\", {\n onClick: blurSelectInput,\n css: _ref2$1\n }), children(targetRef));\n}\n\nfunction _EMOTION_STRINGIFIED_CSS_ERROR__() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\nvar _ref2 = process.env.NODE_ENV === \"production\" ? {\n name: \"1a0ro4n-requiredInput\",\n styles: \"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%\"\n} : {\n name: \"5kkxb2-requiredInput-RequiredInput\",\n styles: \"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%;label:RequiredInput;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlJlcXVpcmVkSW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNJIiwiZmlsZSI6IlJlcXVpcmVkSW5wdXQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBGb2N1c0V2ZW50SGFuZGxlciwgRnVuY3Rpb25Db21wb25lbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmNvbnN0IFJlcXVpcmVkSW5wdXQ6IEZ1bmN0aW9uQ29tcG9uZW50PHtcbiAgcmVhZG9ubHkgbmFtZT86IHN0cmluZztcbiAgcmVhZG9ubHkgb25Gb2N1czogRm9jdXNFdmVudEhhbmRsZXI8SFRNTElucHV0RWxlbWVudD47XG59PiA9ICh7IG5hbWUsIG9uRm9jdXMgfSkgPT4gKFxuICA8aW5wdXRcbiAgICByZXF1aXJlZFxuICAgIG5hbWU9e25hbWV9XG4gICAgdGFiSW5kZXg9ey0xfVxuICAgIGFyaWEtaGlkZGVuPVwidHJ1ZVwiXG4gICAgb25Gb2N1cz17b25Gb2N1c31cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAncmVxdWlyZWRJbnB1dCcsXG4gICAgICBvcGFjaXR5OiAwLFxuICAgICAgcG9pbnRlckV2ZW50czogJ25vbmUnLFxuICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsXG4gICAgICBib3R0b206IDAsXG4gICAgICBsZWZ0OiAwLFxuICAgICAgcmlnaHQ6IDAsXG4gICAgICB3aWR0aDogJzEwMCUnLFxuICAgIH19XG4gICAgLy8gUHJldmVudCBgU3dpdGNoaW5nIGZyb20gdW5jb250cm9sbGVkIHRvIGNvbnRyb2xsZWRgIGVycm9yXG4gICAgdmFsdWU9XCJcIlxuICAgIG9uQ2hhbmdlPXsoKSA9PiB7fX1cbiAgLz5cbik7XG5cbmV4cG9ydCBkZWZhdWx0IFJlcXVpcmVkSW5wdXQ7XG4iXX0= */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__\n};\nvar RequiredInput = function RequiredInput(_ref) {\n var name = _ref.name,\n onFocus = _ref.onFocus;\n return jsx(\"input\", {\n required: true,\n name: name,\n tabIndex: -1,\n \"aria-hidden\": \"true\",\n onFocus: onFocus,\n css: _ref2\n // Prevent `Switching from uncontrolled to controlled` error\n ,\n value: \"\",\n onChange: function onChange() {}\n });\n};\nvar RequiredInput$1 = RequiredInput;\n\n/// \n\nfunction testPlatform(re) {\n var _window$navigator$use;\n return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;\n}\nfunction isIPhone() {\n return testPlatform(/^iPhone/i);\n}\nfunction isMac() {\n return testPlatform(/^Mac/i);\n}\nfunction isIPad() {\n return testPlatform(/^iPad/i) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n isMac() && navigator.maxTouchPoints > 1;\n}\nfunction isIOS() {\n return isIPhone() || isIPad();\n}\nfunction isAppleDevice() {\n return isMac() || isIOS();\n}\n\nvar formatGroupLabel = function formatGroupLabel(group) {\n return group.label;\n};\nvar getOptionLabel$1 = function getOptionLabel(option) {\n return option.label;\n};\nvar getOptionValue$1 = function getOptionValue(option) {\n return option.value;\n};\nvar isOptionDisabled = function isOptionDisabled(option) {\n return !!option.isDisabled;\n};\n\nvar defaultStyles = {\n clearIndicator: clearIndicatorCSS,\n container: containerCSS,\n control: css$1,\n dropdownIndicator: dropdownIndicatorCSS,\n group: groupCSS,\n groupHeading: groupHeadingCSS,\n indicatorsContainer: indicatorsContainerCSS,\n indicatorSeparator: indicatorSeparatorCSS,\n input: inputCSS,\n loadingIndicator: loadingIndicatorCSS,\n loadingMessage: loadingMessageCSS,\n menu: menuCSS,\n menuList: menuListCSS,\n menuPortal: menuPortalCSS,\n multiValue: multiValueCSS,\n multiValueLabel: multiValueLabelCSS,\n multiValueRemove: multiValueRemoveCSS,\n noOptionsMessage: noOptionsMessageCSS,\n option: optionCSS,\n placeholder: placeholderCSS,\n singleValue: css$2,\n valueContainer: valueContainerCSS\n};\n// Merge Utility\n// Allows consumers to extend a base Select with additional styles\n\nfunction mergeStyles(source) {\n var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // initialize with source styles\n var styles = _objectSpread({}, source);\n\n // massage in target styles\n Object.keys(target).forEach(function (keyAsString) {\n var key = keyAsString;\n if (source[key]) {\n styles[key] = function (rsCss, props) {\n return target[key](source[key](rsCss, props), props);\n };\n } else {\n styles[key] = target[key];\n }\n });\n return styles;\n}\n\nvar colors = {\n primary: '#2684FF',\n primary75: '#4C9AFF',\n primary50: '#B2D4FF',\n primary25: '#DEEBFF',\n danger: '#DE350B',\n dangerLight: '#FFBDAD',\n neutral0: 'hsl(0, 0%, 100%)',\n neutral5: 'hsl(0, 0%, 95%)',\n neutral10: 'hsl(0, 0%, 90%)',\n neutral20: 'hsl(0, 0%, 80%)',\n neutral30: 'hsl(0, 0%, 70%)',\n neutral40: 'hsl(0, 0%, 60%)',\n neutral50: 'hsl(0, 0%, 50%)',\n neutral60: 'hsl(0, 0%, 40%)',\n neutral70: 'hsl(0, 0%, 30%)',\n neutral80: 'hsl(0, 0%, 20%)',\n neutral90: 'hsl(0, 0%, 10%)'\n};\nvar borderRadius = 4;\n// Used to calculate consistent margin/padding on elements\nvar baseUnit = 4;\n// The minimum height of the control\nvar controlHeight = 38;\n// The amount of space between the control and menu */\nvar menuGutter = baseUnit * 2;\nvar spacing = {\n baseUnit: baseUnit,\n controlHeight: controlHeight,\n menuGutter: menuGutter\n};\nvar defaultTheme = {\n borderRadius: borderRadius,\n colors: colors,\n spacing: spacing\n};\n\nvar defaultProps = {\n 'aria-live': 'polite',\n backspaceRemovesValue: true,\n blurInputOnSelect: isTouchCapable(),\n captureMenuScroll: !isTouchCapable(),\n classNames: {},\n closeMenuOnSelect: true,\n closeMenuOnScroll: false,\n components: {},\n controlShouldRenderValue: true,\n escapeClearsValue: false,\n filterOption: createFilter(),\n formatGroupLabel: formatGroupLabel,\n getOptionLabel: getOptionLabel$1,\n getOptionValue: getOptionValue$1,\n isDisabled: false,\n isLoading: false,\n isMulti: false,\n isRtl: false,\n isSearchable: true,\n isOptionDisabled: isOptionDisabled,\n loadingMessage: function loadingMessage() {\n return 'Loading...';\n },\n maxMenuHeight: 300,\n minMenuHeight: 140,\n menuIsOpen: false,\n menuPlacement: 'bottom',\n menuPosition: 'absolute',\n menuShouldBlockScroll: false,\n menuShouldScrollIntoView: !isMobileDevice(),\n noOptionsMessage: function noOptionsMessage() {\n return 'No options';\n },\n openMenuOnFocus: false,\n openMenuOnClick: true,\n options: [],\n pageSize: 5,\n placeholder: 'Select...',\n screenReaderStatus: function screenReaderStatus(_ref) {\n var count = _ref.count;\n return \"\".concat(count, \" result\").concat(count !== 1 ? 's' : '', \" available\");\n },\n styles: {},\n tabIndex: 0,\n tabSelectsValue: true,\n unstyled: false\n};\nfunction toCategorizedOption(props, option, selectValue, index) {\n var isDisabled = _isOptionDisabled(props, option, selectValue);\n var isSelected = _isOptionSelected(props, option, selectValue);\n var label = getOptionLabel(props, option);\n var value = getOptionValue(props, option);\n return {\n type: 'option',\n data: option,\n isDisabled: isDisabled,\n isSelected: isSelected,\n label: label,\n value: value,\n index: index\n };\n}\nfunction buildCategorizedOptions(props, selectValue) {\n return props.options.map(function (groupOrOption, groupOrOptionIndex) {\n if ('options' in groupOrOption) {\n var categorizedOptions = groupOrOption.options.map(function (option, optionIndex) {\n return toCategorizedOption(props, option, selectValue, optionIndex);\n }).filter(function (categorizedOption) {\n return isFocusable(props, categorizedOption);\n });\n return categorizedOptions.length > 0 ? {\n type: 'group',\n data: groupOrOption,\n options: categorizedOptions,\n index: groupOrOptionIndex\n } : undefined;\n }\n var categorizedOption = toCategorizedOption(props, groupOrOption, selectValue, groupOrOptionIndex);\n return isFocusable(props, categorizedOption) ? categorizedOption : undefined;\n }).filter(notNullish);\n}\nfunction buildFocusableOptionsFromCategorizedOptions(categorizedOptions) {\n return categorizedOptions.reduce(function (optionsAccumulator, categorizedOption) {\n if (categorizedOption.type === 'group') {\n optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function (option) {\n return option.data;\n })));\n } else {\n optionsAccumulator.push(categorizedOption.data);\n }\n return optionsAccumulator;\n }, []);\n}\nfunction buildFocusableOptionsWithIds(categorizedOptions, optionId) {\n return categorizedOptions.reduce(function (optionsAccumulator, categorizedOption) {\n if (categorizedOption.type === 'group') {\n optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function (option) {\n return {\n data: option.data,\n id: \"\".concat(optionId, \"-\").concat(categorizedOption.index, \"-\").concat(option.index)\n };\n })));\n } else {\n optionsAccumulator.push({\n data: categorizedOption.data,\n id: \"\".concat(optionId, \"-\").concat(categorizedOption.index)\n });\n }\n return optionsAccumulator;\n }, []);\n}\nfunction buildFocusableOptions(props, selectValue) {\n return buildFocusableOptionsFromCategorizedOptions(buildCategorizedOptions(props, selectValue));\n}\nfunction isFocusable(props, categorizedOption) {\n var _props$inputValue = props.inputValue,\n inputValue = _props$inputValue === void 0 ? '' : _props$inputValue;\n var data = categorizedOption.data,\n isSelected = categorizedOption.isSelected,\n label = categorizedOption.label,\n value = categorizedOption.value;\n return (!shouldHideSelectedOptions(props) || !isSelected) && _filterOption(props, {\n label: label,\n value: value,\n data: data\n }, inputValue);\n}\nfunction getNextFocusedValue(state, nextSelectValue) {\n var focusedValue = state.focusedValue,\n lastSelectValue = state.selectValue;\n var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);\n if (lastFocusedIndex > -1) {\n var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);\n if (nextFocusedIndex > -1) {\n // the focused value is still in the selectValue, return it\n return focusedValue;\n } else if (lastFocusedIndex < nextSelectValue.length) {\n // the focusedValue is not present in the next selectValue array by\n // reference, so return the new value at the same index\n return nextSelectValue[lastFocusedIndex];\n }\n }\n return null;\n}\nfunction getNextFocusedOption(state, options) {\n var lastFocusedOption = state.focusedOption;\n return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];\n}\nvar getFocusedOptionId = function getFocusedOptionId(focusableOptionsWithIds, focusedOption) {\n var _focusableOptionsWith;\n var focusedOptionId = (_focusableOptionsWith = focusableOptionsWithIds.find(function (option) {\n return option.data === focusedOption;\n })) === null || _focusableOptionsWith === void 0 ? void 0 : _focusableOptionsWith.id;\n return focusedOptionId || null;\n};\nvar getOptionLabel = function getOptionLabel(props, data) {\n return props.getOptionLabel(data);\n};\nvar getOptionValue = function getOptionValue(props, data) {\n return props.getOptionValue(data);\n};\nfunction _isOptionDisabled(props, option, selectValue) {\n return typeof props.isOptionDisabled === 'function' ? props.isOptionDisabled(option, selectValue) : false;\n}\nfunction _isOptionSelected(props, option, selectValue) {\n if (selectValue.indexOf(option) > -1) return true;\n if (typeof props.isOptionSelected === 'function') {\n return props.isOptionSelected(option, selectValue);\n }\n var candidate = getOptionValue(props, option);\n return selectValue.some(function (i) {\n return getOptionValue(props, i) === candidate;\n });\n}\nfunction _filterOption(props, option, inputValue) {\n return props.filterOption ? props.filterOption(option, inputValue) : true;\n}\nvar shouldHideSelectedOptions = function shouldHideSelectedOptions(props) {\n var hideSelectedOptions = props.hideSelectedOptions,\n isMulti = props.isMulti;\n if (hideSelectedOptions === undefined) return isMulti;\n return hideSelectedOptions;\n};\nvar instanceId = 1;\nvar Select = /*#__PURE__*/function (_Component) {\n _inherits(Select, _Component);\n var _super = _createSuper(Select);\n // Misc. Instance Properties\n // ------------------------------\n\n // TODO\n\n // Refs\n // ------------------------------\n\n // Lifecycle\n // ------------------------------\n\n function Select(_props) {\n var _this;\n _classCallCheck(this, Select);\n _this = _super.call(this, _props);\n _this.state = {\n ariaSelection: null,\n focusedOption: null,\n focusedOptionId: null,\n focusableOptionsWithIds: [],\n focusedValue: null,\n inputIsHidden: false,\n isFocused: false,\n selectValue: [],\n clearFocusValueOnUpdate: false,\n prevWasFocused: false,\n inputIsHiddenAfterUpdate: undefined,\n prevProps: undefined,\n instancePrefix: '',\n isAppleDevice: false\n };\n _this.blockOptionHover = false;\n _this.isComposing = false;\n _this.commonProps = void 0;\n _this.initialTouchX = 0;\n _this.initialTouchY = 0;\n _this.openAfterFocus = false;\n _this.scrollToFocusedOptionOnUpdate = false;\n _this.userIsDragging = void 0;\n _this.controlRef = null;\n _this.getControlRef = function (ref) {\n _this.controlRef = ref;\n };\n _this.focusedOptionRef = null;\n _this.getFocusedOptionRef = function (ref) {\n _this.focusedOptionRef = ref;\n };\n _this.menuListRef = null;\n _this.getMenuListRef = function (ref) {\n _this.menuListRef = ref;\n };\n _this.inputRef = null;\n _this.getInputRef = function (ref) {\n _this.inputRef = ref;\n };\n _this.focus = _this.focusInput;\n _this.blur = _this.blurInput;\n _this.onChange = function (newValue, actionMeta) {\n var _this$props = _this.props,\n onChange = _this$props.onChange,\n name = _this$props.name;\n actionMeta.name = name;\n _this.ariaOnChange(newValue, actionMeta);\n onChange(newValue, actionMeta);\n };\n _this.setValue = function (newValue, action, option) {\n var _this$props2 = _this.props,\n closeMenuOnSelect = _this$props2.closeMenuOnSelect,\n isMulti = _this$props2.isMulti,\n inputValue = _this$props2.inputValue;\n _this.onInputChange('', {\n action: 'set-value',\n prevInputValue: inputValue\n });\n if (closeMenuOnSelect) {\n _this.setState({\n inputIsHiddenAfterUpdate: !isMulti\n });\n _this.onMenuClose();\n }\n // when the select value should change, we should reset focusedValue\n _this.setState({\n clearFocusValueOnUpdate: true\n });\n _this.onChange(newValue, {\n action: action,\n option: option\n });\n };\n _this.selectOption = function (newValue) {\n var _this$props3 = _this.props,\n blurInputOnSelect = _this$props3.blurInputOnSelect,\n isMulti = _this$props3.isMulti,\n name = _this$props3.name;\n var selectValue = _this.state.selectValue;\n var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);\n var isDisabled = _this.isOptionDisabled(newValue, selectValue);\n if (deselected) {\n var candidate = _this.getOptionValue(newValue);\n _this.setValue(multiValueAsValue(selectValue.filter(function (i) {\n return _this.getOptionValue(i) !== candidate;\n })), 'deselect-option', newValue);\n } else if (!isDisabled) {\n // Select option if option is not disabled\n if (isMulti) {\n _this.setValue(multiValueAsValue([].concat(_toConsumableArray(selectValue), [newValue])), 'select-option', newValue);\n } else {\n _this.setValue(singleValueAsValue(newValue), 'select-option');\n }\n } else {\n _this.ariaOnChange(singleValueAsValue(newValue), {\n action: 'select-option',\n option: newValue,\n name: name\n });\n return;\n }\n if (blurInputOnSelect) {\n _this.blurInput();\n }\n };\n _this.removeValue = function (removedValue) {\n var isMulti = _this.props.isMulti;\n var selectValue = _this.state.selectValue;\n var candidate = _this.getOptionValue(removedValue);\n var newValueArray = selectValue.filter(function (i) {\n return _this.getOptionValue(i) !== candidate;\n });\n var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);\n _this.onChange(newValue, {\n action: 'remove-value',\n removedValue: removedValue\n });\n _this.focusInput();\n };\n _this.clearValue = function () {\n var selectValue = _this.state.selectValue;\n _this.onChange(valueTernary(_this.props.isMulti, [], null), {\n action: 'clear',\n removedValues: selectValue\n });\n };\n _this.popValue = function () {\n var isMulti = _this.props.isMulti;\n var selectValue = _this.state.selectValue;\n var lastSelectedValue = selectValue[selectValue.length - 1];\n var newValueArray = selectValue.slice(0, selectValue.length - 1);\n var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);\n if (lastSelectedValue) {\n _this.onChange(newValue, {\n action: 'pop-value',\n removedValue: lastSelectedValue\n });\n }\n };\n _this.getFocusedOptionId = function (focusedOption) {\n return getFocusedOptionId(_this.state.focusableOptionsWithIds, focusedOption);\n };\n _this.getFocusableOptionsWithIds = function () {\n return buildFocusableOptionsWithIds(buildCategorizedOptions(_this.props, _this.state.selectValue), _this.getElementId('option'));\n };\n _this.getValue = function () {\n return _this.state.selectValue;\n };\n _this.cx = function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return classNames.apply(void 0, [_this.props.classNamePrefix].concat(args));\n };\n _this.getOptionLabel = function (data) {\n return getOptionLabel(_this.props, data);\n };\n _this.getOptionValue = function (data) {\n return getOptionValue(_this.props, data);\n };\n _this.getStyles = function (key, props) {\n var unstyled = _this.props.unstyled;\n var base = defaultStyles[key](props, unstyled);\n base.boxSizing = 'border-box';\n var custom = _this.props.styles[key];\n return custom ? custom(base, props) : base;\n };\n _this.getClassNames = function (key, props) {\n var _this$props$className, _this$props$className2;\n return (_this$props$className = (_this$props$className2 = _this.props.classNames)[key]) === null || _this$props$className === void 0 ? void 0 : _this$props$className.call(_this$props$className2, props);\n };\n _this.getElementId = function (element) {\n return \"\".concat(_this.state.instancePrefix, \"-\").concat(element);\n };\n _this.getComponents = function () {\n return defaultComponents(_this.props);\n };\n _this.buildCategorizedOptions = function () {\n return buildCategorizedOptions(_this.props, _this.state.selectValue);\n };\n _this.getCategorizedOptions = function () {\n return _this.props.menuIsOpen ? _this.buildCategorizedOptions() : [];\n };\n _this.buildFocusableOptions = function () {\n return buildFocusableOptionsFromCategorizedOptions(_this.buildCategorizedOptions());\n };\n _this.getFocusableOptions = function () {\n return _this.props.menuIsOpen ? _this.buildFocusableOptions() : [];\n };\n _this.ariaOnChange = function (value, actionMeta) {\n _this.setState({\n ariaSelection: _objectSpread({\n value: value\n }, actionMeta)\n });\n };\n _this.onMenuMouseDown = function (event) {\n if (event.button !== 0) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n _this.focusInput();\n };\n _this.onMenuMouseMove = function (event) {\n _this.blockOptionHover = false;\n };\n _this.onControlMouseDown = function (event) {\n // Event captured by dropdown indicator\n if (event.defaultPrevented) {\n return;\n }\n var openMenuOnClick = _this.props.openMenuOnClick;\n if (!_this.state.isFocused) {\n if (openMenuOnClick) {\n _this.openAfterFocus = true;\n }\n _this.focusInput();\n } else if (!_this.props.menuIsOpen) {\n if (openMenuOnClick) {\n _this.openMenu('first');\n }\n } else {\n if (event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {\n _this.onMenuClose();\n }\n }\n if (event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {\n event.preventDefault();\n }\n };\n _this.onDropdownIndicatorMouseDown = function (event) {\n // ignore mouse events that weren't triggered by the primary button\n if (event && event.type === 'mousedown' && event.button !== 0) {\n return;\n }\n if (_this.props.isDisabled) return;\n var _this$props4 = _this.props,\n isMulti = _this$props4.isMulti,\n menuIsOpen = _this$props4.menuIsOpen;\n _this.focusInput();\n if (menuIsOpen) {\n _this.setState({\n inputIsHiddenAfterUpdate: !isMulti\n });\n _this.onMenuClose();\n } else {\n _this.openMenu('first');\n }\n event.preventDefault();\n };\n _this.onClearIndicatorMouseDown = function (event) {\n // ignore mouse events that weren't triggered by the primary button\n if (event && event.type === 'mousedown' && event.button !== 0) {\n return;\n }\n _this.clearValue();\n event.preventDefault();\n _this.openAfterFocus = false;\n if (event.type === 'touchend') {\n _this.focusInput();\n } else {\n setTimeout(function () {\n return _this.focusInput();\n });\n }\n };\n _this.onScroll = function (event) {\n if (typeof _this.props.closeMenuOnScroll === 'boolean') {\n if (event.target instanceof HTMLElement && isDocumentElement(event.target)) {\n _this.props.onMenuClose();\n }\n } else if (typeof _this.props.closeMenuOnScroll === 'function') {\n if (_this.props.closeMenuOnScroll(event)) {\n _this.props.onMenuClose();\n }\n }\n };\n _this.onCompositionStart = function () {\n _this.isComposing = true;\n };\n _this.onCompositionEnd = function () {\n _this.isComposing = false;\n };\n _this.onTouchStart = function (_ref2) {\n var touches = _ref2.touches;\n var touch = touches && touches.item(0);\n if (!touch) {\n return;\n }\n _this.initialTouchX = touch.clientX;\n _this.initialTouchY = touch.clientY;\n _this.userIsDragging = false;\n };\n _this.onTouchMove = function (_ref3) {\n var touches = _ref3.touches;\n var touch = touches && touches.item(0);\n if (!touch) {\n return;\n }\n var deltaX = Math.abs(touch.clientX - _this.initialTouchX);\n var deltaY = Math.abs(touch.clientY - _this.initialTouchY);\n var moveThreshold = 5;\n _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;\n };\n _this.onTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n\n // close the menu if the user taps outside\n // we're checking on event.target here instead of event.currentTarget, because we want to assert information\n // on events on child elements, not the document (which we've attached this handler to).\n if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {\n _this.blurInput();\n }\n\n // reset move vars\n _this.initialTouchX = 0;\n _this.initialTouchY = 0;\n };\n _this.onControlTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n _this.onControlMouseDown(event);\n };\n _this.onClearIndicatorTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n _this.onClearIndicatorMouseDown(event);\n };\n _this.onDropdownIndicatorTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n _this.onDropdownIndicatorMouseDown(event);\n };\n _this.handleInputChange = function (event) {\n var prevInputValue = _this.props.inputValue;\n var inputValue = event.currentTarget.value;\n _this.setState({\n inputIsHiddenAfterUpdate: false\n });\n _this.onInputChange(inputValue, {\n action: 'input-change',\n prevInputValue: prevInputValue\n });\n if (!_this.props.menuIsOpen) {\n _this.onMenuOpen();\n }\n };\n _this.onInputFocus = function (event) {\n if (_this.props.onFocus) {\n _this.props.onFocus(event);\n }\n _this.setState({\n inputIsHiddenAfterUpdate: false,\n isFocused: true\n });\n if (_this.openAfterFocus || _this.props.openMenuOnFocus) {\n _this.openMenu('first');\n }\n _this.openAfterFocus = false;\n };\n _this.onInputBlur = function (event) {\n var prevInputValue = _this.props.inputValue;\n if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {\n _this.inputRef.focus();\n return;\n }\n if (_this.props.onBlur) {\n _this.props.onBlur(event);\n }\n _this.onInputChange('', {\n action: 'input-blur',\n prevInputValue: prevInputValue\n });\n _this.onMenuClose();\n _this.setState({\n focusedValue: null,\n isFocused: false\n });\n };\n _this.onOptionHover = function (focusedOption) {\n if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {\n return;\n }\n var options = _this.getFocusableOptions();\n var focusedOptionIndex = options.indexOf(focusedOption);\n _this.setState({\n focusedOption: focusedOption,\n focusedOptionId: focusedOptionIndex > -1 ? _this.getFocusedOptionId(focusedOption) : null\n });\n };\n _this.shouldHideSelectedOptions = function () {\n return shouldHideSelectedOptions(_this.props);\n };\n _this.onValueInputFocus = function (e) {\n e.preventDefault();\n e.stopPropagation();\n _this.focus();\n };\n _this.onKeyDown = function (event) {\n var _this$props5 = _this.props,\n isMulti = _this$props5.isMulti,\n backspaceRemovesValue = _this$props5.backspaceRemovesValue,\n escapeClearsValue = _this$props5.escapeClearsValue,\n inputValue = _this$props5.inputValue,\n isClearable = _this$props5.isClearable,\n isDisabled = _this$props5.isDisabled,\n menuIsOpen = _this$props5.menuIsOpen,\n onKeyDown = _this$props5.onKeyDown,\n tabSelectsValue = _this$props5.tabSelectsValue,\n openMenuOnFocus = _this$props5.openMenuOnFocus;\n var _this$state = _this.state,\n focusedOption = _this$state.focusedOption,\n focusedValue = _this$state.focusedValue,\n selectValue = _this$state.selectValue;\n if (isDisabled) return;\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n if (event.defaultPrevented) {\n return;\n }\n }\n\n // Block option hover events when the user has just pressed a key\n _this.blockOptionHover = true;\n switch (event.key) {\n case 'ArrowLeft':\n if (!isMulti || inputValue) return;\n _this.focusValue('previous');\n break;\n case 'ArrowRight':\n if (!isMulti || inputValue) return;\n _this.focusValue('next');\n break;\n case 'Delete':\n case 'Backspace':\n if (inputValue) return;\n if (focusedValue) {\n _this.removeValue(focusedValue);\n } else {\n if (!backspaceRemovesValue) return;\n if (isMulti) {\n _this.popValue();\n } else if (isClearable) {\n _this.clearValue();\n }\n }\n break;\n case 'Tab':\n if (_this.isComposing) return;\n if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption ||\n // don't capture the event if the menu opens on focus and the focused\n // option is already selected; it breaks the flow of navigation\n openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {\n return;\n }\n _this.selectOption(focusedOption);\n break;\n case 'Enter':\n if (event.keyCode === 229) {\n // ignore the keydown event from an Input Method Editor(IME)\n // ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode\n break;\n }\n if (menuIsOpen) {\n if (!focusedOption) return;\n if (_this.isComposing) return;\n _this.selectOption(focusedOption);\n break;\n }\n return;\n case 'Escape':\n if (menuIsOpen) {\n _this.setState({\n inputIsHiddenAfterUpdate: false\n });\n _this.onInputChange('', {\n action: 'menu-close',\n prevInputValue: inputValue\n });\n _this.onMenuClose();\n } else if (isClearable && escapeClearsValue) {\n _this.clearValue();\n }\n break;\n case ' ':\n // space\n if (inputValue) {\n return;\n }\n if (!menuIsOpen) {\n _this.openMenu('first');\n break;\n }\n if (!focusedOption) return;\n _this.selectOption(focusedOption);\n break;\n case 'ArrowUp':\n if (menuIsOpen) {\n _this.focusOption('up');\n } else {\n _this.openMenu('last');\n }\n break;\n case 'ArrowDown':\n if (menuIsOpen) {\n _this.focusOption('down');\n } else {\n _this.openMenu('first');\n }\n break;\n case 'PageUp':\n if (!menuIsOpen) return;\n _this.focusOption('pageup');\n break;\n case 'PageDown':\n if (!menuIsOpen) return;\n _this.focusOption('pagedown');\n break;\n case 'Home':\n if (!menuIsOpen) return;\n _this.focusOption('first');\n break;\n case 'End':\n if (!menuIsOpen) return;\n _this.focusOption('last');\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n _this.state.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);\n _this.state.selectValue = cleanValue(_props.value);\n // Set focusedOption if menuIsOpen is set on init (e.g. defaultMenuIsOpen)\n if (_props.menuIsOpen && _this.state.selectValue.length) {\n var focusableOptionsWithIds = _this.getFocusableOptionsWithIds();\n var focusableOptions = _this.buildFocusableOptions();\n var optionIndex = focusableOptions.indexOf(_this.state.selectValue[0]);\n _this.state.focusableOptionsWithIds = focusableOptionsWithIds;\n _this.state.focusedOption = focusableOptions[optionIndex];\n _this.state.focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusableOptions[optionIndex]);\n }\n return _this;\n }\n _createClass(Select, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.startListeningComposition();\n this.startListeningToTouch();\n if (this.props.closeMenuOnScroll && document && document.addEventListener) {\n // Listen to all scroll events, and filter them out inside of 'onScroll'\n document.addEventListener('scroll', this.onScroll, true);\n }\n if (this.props.autoFocus) {\n this.focusInput();\n }\n\n // Scroll focusedOption into view if menuIsOpen is set on mount (e.g. defaultMenuIsOpen)\n if (this.props.menuIsOpen && this.state.focusedOption && this.menuListRef && this.focusedOptionRef) {\n scrollIntoView(this.menuListRef, this.focusedOptionRef);\n }\n if (isAppleDevice()) {\n // eslint-disable-next-line react/no-did-mount-set-state\n this.setState({\n isAppleDevice: true\n });\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var _this$props6 = this.props,\n isDisabled = _this$props6.isDisabled,\n menuIsOpen = _this$props6.menuIsOpen;\n var isFocused = this.state.isFocused;\n if (\n // ensure focus is restored correctly when the control becomes enabled\n isFocused && !isDisabled && prevProps.isDisabled ||\n // ensure focus is on the Input when the menu opens\n isFocused && menuIsOpen && !prevProps.menuIsOpen) {\n this.focusInput();\n }\n if (isFocused && isDisabled && !prevProps.isDisabled) {\n // ensure select state gets blurred in case Select is programmatically disabled while focused\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({\n isFocused: false\n }, this.onMenuClose);\n } else if (!isFocused && !isDisabled && prevProps.isDisabled && this.inputRef === document.activeElement) {\n // ensure select state gets focused in case Select is programatically re-enabled while focused (Firefox)\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({\n isFocused: true\n });\n }\n\n // scroll the focused option into view if necessary\n if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {\n scrollIntoView(this.menuListRef, this.focusedOptionRef);\n this.scrollToFocusedOptionOnUpdate = false;\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.stopListeningComposition();\n this.stopListeningToTouch();\n document.removeEventListener('scroll', this.onScroll, true);\n }\n\n // ==============================\n // Consumer Handlers\n // ==============================\n }, {\n key: \"onMenuOpen\",\n value: function onMenuOpen() {\n this.props.onMenuOpen();\n }\n }, {\n key: \"onMenuClose\",\n value: function onMenuClose() {\n this.onInputChange('', {\n action: 'menu-close',\n prevInputValue: this.props.inputValue\n });\n this.props.onMenuClose();\n }\n }, {\n key: \"onInputChange\",\n value: function onInputChange(newValue, actionMeta) {\n this.props.onInputChange(newValue, actionMeta);\n }\n\n // ==============================\n // Methods\n // ==============================\n }, {\n key: \"focusInput\",\n value: function focusInput() {\n if (!this.inputRef) return;\n this.inputRef.focus();\n }\n }, {\n key: \"blurInput\",\n value: function blurInput() {\n if (!this.inputRef) return;\n this.inputRef.blur();\n }\n\n // aliased for consumers\n }, {\n key: \"openMenu\",\n value: function openMenu(focusOption) {\n var _this2 = this;\n var _this$state2 = this.state,\n selectValue = _this$state2.selectValue,\n isFocused = _this$state2.isFocused;\n var focusableOptions = this.buildFocusableOptions();\n var openAtIndex = focusOption === 'first' ? 0 : focusableOptions.length - 1;\n if (!this.props.isMulti) {\n var selectedIndex = focusableOptions.indexOf(selectValue[0]);\n if (selectedIndex > -1) {\n openAtIndex = selectedIndex;\n }\n }\n\n // only scroll if the menu isn't already open\n this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);\n this.setState({\n inputIsHiddenAfterUpdate: false,\n focusedValue: null,\n focusedOption: focusableOptions[openAtIndex],\n focusedOptionId: this.getFocusedOptionId(focusableOptions[openAtIndex])\n }, function () {\n return _this2.onMenuOpen();\n });\n }\n }, {\n key: \"focusValue\",\n value: function focusValue(direction) {\n var _this$state3 = this.state,\n selectValue = _this$state3.selectValue,\n focusedValue = _this$state3.focusedValue;\n\n // Only multiselects support value focusing\n if (!this.props.isMulti) return;\n this.setState({\n focusedOption: null\n });\n var focusedIndex = selectValue.indexOf(focusedValue);\n if (!focusedValue) {\n focusedIndex = -1;\n }\n var lastIndex = selectValue.length - 1;\n var nextFocus = -1;\n if (!selectValue.length) return;\n switch (direction) {\n case 'previous':\n if (focusedIndex === 0) {\n // don't cycle from the start to the end\n nextFocus = 0;\n } else if (focusedIndex === -1) {\n // if nothing is focused, focus the last value first\n nextFocus = lastIndex;\n } else {\n nextFocus = focusedIndex - 1;\n }\n break;\n case 'next':\n if (focusedIndex > -1 && focusedIndex < lastIndex) {\n nextFocus = focusedIndex + 1;\n }\n break;\n }\n this.setState({\n inputIsHidden: nextFocus !== -1,\n focusedValue: selectValue[nextFocus]\n });\n }\n }, {\n key: \"focusOption\",\n value: function focusOption() {\n var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'first';\n var pageSize = this.props.pageSize;\n var focusedOption = this.state.focusedOption;\n var options = this.getFocusableOptions();\n if (!options.length) return;\n var nextFocus = 0; // handles 'first'\n var focusedIndex = options.indexOf(focusedOption);\n if (!focusedOption) {\n focusedIndex = -1;\n }\n if (direction === 'up') {\n nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;\n } else if (direction === 'down') {\n nextFocus = (focusedIndex + 1) % options.length;\n } else if (direction === 'pageup') {\n nextFocus = focusedIndex - pageSize;\n if (nextFocus < 0) nextFocus = 0;\n } else if (direction === 'pagedown') {\n nextFocus = focusedIndex + pageSize;\n if (nextFocus > options.length - 1) nextFocus = options.length - 1;\n } else if (direction === 'last') {\n nextFocus = options.length - 1;\n }\n this.scrollToFocusedOptionOnUpdate = true;\n this.setState({\n focusedOption: options[nextFocus],\n focusedValue: null,\n focusedOptionId: this.getFocusedOptionId(options[nextFocus])\n });\n }\n }, {\n key: \"getTheme\",\n value:\n // ==============================\n // Getters\n // ==============================\n\n function getTheme() {\n // Use the default theme if there are no customisations.\n if (!this.props.theme) {\n return defaultTheme;\n }\n // If the theme prop is a function, assume the function\n // knows how to merge the passed-in default theme with\n // its own modifications.\n if (typeof this.props.theme === 'function') {\n return this.props.theme(defaultTheme);\n }\n // Otherwise, if a plain theme object was passed in,\n // overlay it with the default theme.\n return _objectSpread(_objectSpread({}, defaultTheme), this.props.theme);\n }\n }, {\n key: \"getCommonProps\",\n value: function getCommonProps() {\n var clearValue = this.clearValue,\n cx = this.cx,\n getStyles = this.getStyles,\n getClassNames = this.getClassNames,\n getValue = this.getValue,\n selectOption = this.selectOption,\n setValue = this.setValue,\n props = this.props;\n var isMulti = props.isMulti,\n isRtl = props.isRtl,\n options = props.options;\n var hasValue = this.hasValue();\n return {\n clearValue: clearValue,\n cx: cx,\n getStyles: getStyles,\n getClassNames: getClassNames,\n getValue: getValue,\n hasValue: hasValue,\n isMulti: isMulti,\n isRtl: isRtl,\n options: options,\n selectOption: selectOption,\n selectProps: props,\n setValue: setValue,\n theme: this.getTheme()\n };\n }\n }, {\n key: \"hasValue\",\n value: function hasValue() {\n var selectValue = this.state.selectValue;\n return selectValue.length > 0;\n }\n }, {\n key: \"hasOptions\",\n value: function hasOptions() {\n return !!this.getFocusableOptions().length;\n }\n }, {\n key: \"isClearable\",\n value: function isClearable() {\n var _this$props7 = this.props,\n isClearable = _this$props7.isClearable,\n isMulti = _this$props7.isMulti;\n\n // single select, by default, IS NOT clearable\n // multi select, by default, IS clearable\n if (isClearable === undefined) return isMulti;\n return isClearable;\n }\n }, {\n key: \"isOptionDisabled\",\n value: function isOptionDisabled(option, selectValue) {\n return _isOptionDisabled(this.props, option, selectValue);\n }\n }, {\n key: \"isOptionSelected\",\n value: function isOptionSelected(option, selectValue) {\n return _isOptionSelected(this.props, option, selectValue);\n }\n }, {\n key: \"filterOption\",\n value: function filterOption(option, inputValue) {\n return _filterOption(this.props, option, inputValue);\n }\n }, {\n key: \"formatOptionLabel\",\n value: function formatOptionLabel(data, context) {\n if (typeof this.props.formatOptionLabel === 'function') {\n var _inputValue = this.props.inputValue;\n var _selectValue = this.state.selectValue;\n return this.props.formatOptionLabel(data, {\n context: context,\n inputValue: _inputValue,\n selectValue: _selectValue\n });\n } else {\n return this.getOptionLabel(data);\n }\n }\n }, {\n key: \"formatGroupLabel\",\n value: function formatGroupLabel(data) {\n return this.props.formatGroupLabel(data);\n }\n\n // ==============================\n // Mouse Handlers\n // ==============================\n }, {\n key: \"startListeningComposition\",\n value:\n // ==============================\n // Composition Handlers\n // ==============================\n\n function startListeningComposition() {\n if (document && document.addEventListener) {\n document.addEventListener('compositionstart', this.onCompositionStart, false);\n document.addEventListener('compositionend', this.onCompositionEnd, false);\n }\n }\n }, {\n key: \"stopListeningComposition\",\n value: function stopListeningComposition() {\n if (document && document.removeEventListener) {\n document.removeEventListener('compositionstart', this.onCompositionStart);\n document.removeEventListener('compositionend', this.onCompositionEnd);\n }\n }\n }, {\n key: \"startListeningToTouch\",\n value:\n // ==============================\n // Touch Handlers\n // ==============================\n\n function startListeningToTouch() {\n if (document && document.addEventListener) {\n document.addEventListener('touchstart', this.onTouchStart, false);\n document.addEventListener('touchmove', this.onTouchMove, false);\n document.addEventListener('touchend', this.onTouchEnd, false);\n }\n }\n }, {\n key: \"stopListeningToTouch\",\n value: function stopListeningToTouch() {\n if (document && document.removeEventListener) {\n document.removeEventListener('touchstart', this.onTouchStart);\n document.removeEventListener('touchmove', this.onTouchMove);\n document.removeEventListener('touchend', this.onTouchEnd);\n }\n }\n }, {\n key: \"renderInput\",\n value:\n // ==============================\n // Renderers\n // ==============================\n function renderInput() {\n var _this$props8 = this.props,\n isDisabled = _this$props8.isDisabled,\n isSearchable = _this$props8.isSearchable,\n inputId = _this$props8.inputId,\n inputValue = _this$props8.inputValue,\n tabIndex = _this$props8.tabIndex,\n form = _this$props8.form,\n menuIsOpen = _this$props8.menuIsOpen,\n required = _this$props8.required;\n var _this$getComponents = this.getComponents(),\n Input = _this$getComponents.Input;\n var _this$state4 = this.state,\n inputIsHidden = _this$state4.inputIsHidden,\n ariaSelection = _this$state4.ariaSelection;\n var commonProps = this.commonProps;\n var id = inputId || this.getElementId('input');\n\n // aria attributes makes the JSX \"noisy\", separated for clarity\n var ariaAttributes = _objectSpread(_objectSpread(_objectSpread({\n 'aria-autocomplete': 'list',\n 'aria-expanded': menuIsOpen,\n 'aria-haspopup': true,\n 'aria-errormessage': this.props['aria-errormessage'],\n 'aria-invalid': this.props['aria-invalid'],\n 'aria-label': this.props['aria-label'],\n 'aria-labelledby': this.props['aria-labelledby'],\n 'aria-required': required,\n role: 'combobox',\n 'aria-activedescendant': this.state.isAppleDevice ? undefined : this.state.focusedOptionId || ''\n }, menuIsOpen && {\n 'aria-controls': this.getElementId('listbox')\n }), !isSearchable && {\n 'aria-readonly': true\n }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {\n 'aria-describedby': this.getElementId('live-region')\n } : {\n 'aria-describedby': this.getElementId('placeholder')\n });\n if (!isSearchable) {\n // use a dummy input to maintain focus/blur functionality\n return /*#__PURE__*/React.createElement(DummyInput, _extends({\n id: id,\n innerRef: this.getInputRef,\n onBlur: this.onInputBlur,\n onChange: noop,\n onFocus: this.onInputFocus,\n disabled: isDisabled,\n tabIndex: tabIndex,\n inputMode: \"none\",\n form: form,\n value: \"\"\n }, ariaAttributes));\n }\n return /*#__PURE__*/React.createElement(Input, _extends({}, commonProps, {\n autoCapitalize: \"none\",\n autoComplete: \"off\",\n autoCorrect: \"off\",\n id: id,\n innerRef: this.getInputRef,\n isDisabled: isDisabled,\n isHidden: inputIsHidden,\n onBlur: this.onInputBlur,\n onChange: this.handleInputChange,\n onFocus: this.onInputFocus,\n spellCheck: \"false\",\n tabIndex: tabIndex,\n form: form,\n type: \"text\",\n value: inputValue\n }, ariaAttributes));\n }\n }, {\n key: \"renderPlaceholderOrValue\",\n value: function renderPlaceholderOrValue() {\n var _this3 = this;\n var _this$getComponents2 = this.getComponents(),\n MultiValue = _this$getComponents2.MultiValue,\n MultiValueContainer = _this$getComponents2.MultiValueContainer,\n MultiValueLabel = _this$getComponents2.MultiValueLabel,\n MultiValueRemove = _this$getComponents2.MultiValueRemove,\n SingleValue = _this$getComponents2.SingleValue,\n Placeholder = _this$getComponents2.Placeholder;\n var commonProps = this.commonProps;\n var _this$props9 = this.props,\n controlShouldRenderValue = _this$props9.controlShouldRenderValue,\n isDisabled = _this$props9.isDisabled,\n isMulti = _this$props9.isMulti,\n inputValue = _this$props9.inputValue,\n placeholder = _this$props9.placeholder;\n var _this$state5 = this.state,\n selectValue = _this$state5.selectValue,\n focusedValue = _this$state5.focusedValue,\n isFocused = _this$state5.isFocused;\n if (!this.hasValue() || !controlShouldRenderValue) {\n return inputValue ? null : /*#__PURE__*/React.createElement(Placeholder, _extends({}, commonProps, {\n key: \"placeholder\",\n isDisabled: isDisabled,\n isFocused: isFocused,\n innerProps: {\n id: this.getElementId('placeholder')\n }\n }), placeholder);\n }\n if (isMulti) {\n return selectValue.map(function (opt, index) {\n var isOptionFocused = opt === focusedValue;\n var key = \"\".concat(_this3.getOptionLabel(opt), \"-\").concat(_this3.getOptionValue(opt));\n return /*#__PURE__*/React.createElement(MultiValue, _extends({}, commonProps, {\n components: {\n Container: MultiValueContainer,\n Label: MultiValueLabel,\n Remove: MultiValueRemove\n },\n isFocused: isOptionFocused,\n isDisabled: isDisabled,\n key: key,\n index: index,\n removeProps: {\n onClick: function onClick() {\n return _this3.removeValue(opt);\n },\n onTouchEnd: function onTouchEnd() {\n return _this3.removeValue(opt);\n },\n onMouseDown: function onMouseDown(e) {\n e.preventDefault();\n }\n },\n data: opt\n }), _this3.formatOptionLabel(opt, 'value'));\n });\n }\n if (inputValue) {\n return null;\n }\n var singleValue = selectValue[0];\n return /*#__PURE__*/React.createElement(SingleValue, _extends({}, commonProps, {\n data: singleValue,\n isDisabled: isDisabled\n }), this.formatOptionLabel(singleValue, 'value'));\n }\n }, {\n key: \"renderClearIndicator\",\n value: function renderClearIndicator() {\n var _this$getComponents3 = this.getComponents(),\n ClearIndicator = _this$getComponents3.ClearIndicator;\n var commonProps = this.commonProps;\n var _this$props10 = this.props,\n isDisabled = _this$props10.isDisabled,\n isLoading = _this$props10.isLoading;\n var isFocused = this.state.isFocused;\n if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {\n return null;\n }\n var innerProps = {\n onMouseDown: this.onClearIndicatorMouseDown,\n onTouchEnd: this.onClearIndicatorTouchEnd,\n 'aria-hidden': 'true'\n };\n return /*#__PURE__*/React.createElement(ClearIndicator, _extends({}, commonProps, {\n innerProps: innerProps,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderLoadingIndicator\",\n value: function renderLoadingIndicator() {\n var _this$getComponents4 = this.getComponents(),\n LoadingIndicator = _this$getComponents4.LoadingIndicator;\n var commonProps = this.commonProps;\n var _this$props11 = this.props,\n isDisabled = _this$props11.isDisabled,\n isLoading = _this$props11.isLoading;\n var isFocused = this.state.isFocused;\n if (!LoadingIndicator || !isLoading) return null;\n var innerProps = {\n 'aria-hidden': 'true'\n };\n return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({}, commonProps, {\n innerProps: innerProps,\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderIndicatorSeparator\",\n value: function renderIndicatorSeparator() {\n var _this$getComponents5 = this.getComponents(),\n DropdownIndicator = _this$getComponents5.DropdownIndicator,\n IndicatorSeparator = _this$getComponents5.IndicatorSeparator;\n\n // separator doesn't make sense without the dropdown indicator\n if (!DropdownIndicator || !IndicatorSeparator) return null;\n var commonProps = this.commonProps;\n var isDisabled = this.props.isDisabled;\n var isFocused = this.state.isFocused;\n return /*#__PURE__*/React.createElement(IndicatorSeparator, _extends({}, commonProps, {\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderDropdownIndicator\",\n value: function renderDropdownIndicator() {\n var _this$getComponents6 = this.getComponents(),\n DropdownIndicator = _this$getComponents6.DropdownIndicator;\n if (!DropdownIndicator) return null;\n var commonProps = this.commonProps;\n var isDisabled = this.props.isDisabled;\n var isFocused = this.state.isFocused;\n var innerProps = {\n onMouseDown: this.onDropdownIndicatorMouseDown,\n onTouchEnd: this.onDropdownIndicatorTouchEnd,\n 'aria-hidden': 'true'\n };\n return /*#__PURE__*/React.createElement(DropdownIndicator, _extends({}, commonProps, {\n innerProps: innerProps,\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderMenu\",\n value: function renderMenu() {\n var _this4 = this;\n var _this$getComponents7 = this.getComponents(),\n Group = _this$getComponents7.Group,\n GroupHeading = _this$getComponents7.GroupHeading,\n Menu = _this$getComponents7.Menu,\n MenuList = _this$getComponents7.MenuList,\n MenuPortal = _this$getComponents7.MenuPortal,\n LoadingMessage = _this$getComponents7.LoadingMessage,\n NoOptionsMessage = _this$getComponents7.NoOptionsMessage,\n Option = _this$getComponents7.Option;\n var commonProps = this.commonProps;\n var focusedOption = this.state.focusedOption;\n var _this$props12 = this.props,\n captureMenuScroll = _this$props12.captureMenuScroll,\n inputValue = _this$props12.inputValue,\n isLoading = _this$props12.isLoading,\n loadingMessage = _this$props12.loadingMessage,\n minMenuHeight = _this$props12.minMenuHeight,\n maxMenuHeight = _this$props12.maxMenuHeight,\n menuIsOpen = _this$props12.menuIsOpen,\n menuPlacement = _this$props12.menuPlacement,\n menuPosition = _this$props12.menuPosition,\n menuPortalTarget = _this$props12.menuPortalTarget,\n menuShouldBlockScroll = _this$props12.menuShouldBlockScroll,\n menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView,\n noOptionsMessage = _this$props12.noOptionsMessage,\n onMenuScrollToTop = _this$props12.onMenuScrollToTop,\n onMenuScrollToBottom = _this$props12.onMenuScrollToBottom;\n if (!menuIsOpen) return null;\n\n // TODO: Internal Option Type here\n var render = function render(props, id) {\n var type = props.type,\n data = props.data,\n isDisabled = props.isDisabled,\n isSelected = props.isSelected,\n label = props.label,\n value = props.value;\n var isFocused = focusedOption === data;\n var onHover = isDisabled ? undefined : function () {\n return _this4.onOptionHover(data);\n };\n var onSelect = isDisabled ? undefined : function () {\n return _this4.selectOption(data);\n };\n var optionId = \"\".concat(_this4.getElementId('option'), \"-\").concat(id);\n var innerProps = {\n id: optionId,\n onClick: onSelect,\n onMouseMove: onHover,\n onMouseOver: onHover,\n tabIndex: -1,\n role: 'option',\n 'aria-selected': _this4.state.isAppleDevice ? undefined : isSelected // is not supported on Apple devices\n };\n\n return /*#__PURE__*/React.createElement(Option, _extends({}, commonProps, {\n innerProps: innerProps,\n data: data,\n isDisabled: isDisabled,\n isSelected: isSelected,\n key: optionId,\n label: label,\n type: type,\n value: value,\n isFocused: isFocused,\n innerRef: isFocused ? _this4.getFocusedOptionRef : undefined\n }), _this4.formatOptionLabel(props.data, 'menu'));\n };\n var menuUI;\n if (this.hasOptions()) {\n menuUI = this.getCategorizedOptions().map(function (item) {\n if (item.type === 'group') {\n var _data = item.data,\n options = item.options,\n groupIndex = item.index;\n var groupId = \"\".concat(_this4.getElementId('group'), \"-\").concat(groupIndex);\n var headingId = \"\".concat(groupId, \"-heading\");\n return /*#__PURE__*/React.createElement(Group, _extends({}, commonProps, {\n key: groupId,\n data: _data,\n options: options,\n Heading: GroupHeading,\n headingProps: {\n id: headingId,\n data: item.data\n },\n label: _this4.formatGroupLabel(item.data)\n }), item.options.map(function (option) {\n return render(option, \"\".concat(groupIndex, \"-\").concat(option.index));\n }));\n } else if (item.type === 'option') {\n return render(item, \"\".concat(item.index));\n }\n });\n } else if (isLoading) {\n var message = loadingMessage({\n inputValue: inputValue\n });\n if (message === null) return null;\n menuUI = /*#__PURE__*/React.createElement(LoadingMessage, commonProps, message);\n } else {\n var _message = noOptionsMessage({\n inputValue: inputValue\n });\n if (_message === null) return null;\n menuUI = /*#__PURE__*/React.createElement(NoOptionsMessage, commonProps, _message);\n }\n var menuPlacementProps = {\n minMenuHeight: minMenuHeight,\n maxMenuHeight: maxMenuHeight,\n menuPlacement: menuPlacement,\n menuPosition: menuPosition,\n menuShouldScrollIntoView: menuShouldScrollIntoView\n };\n var menuElement = /*#__PURE__*/React.createElement(MenuPlacer, _extends({}, commonProps, menuPlacementProps), function (_ref4) {\n var ref = _ref4.ref,\n _ref4$placerProps = _ref4.placerProps,\n placement = _ref4$placerProps.placement,\n maxHeight = _ref4$placerProps.maxHeight;\n return /*#__PURE__*/React.createElement(Menu, _extends({}, commonProps, menuPlacementProps, {\n innerRef: ref,\n innerProps: {\n onMouseDown: _this4.onMenuMouseDown,\n onMouseMove: _this4.onMenuMouseMove\n },\n isLoading: isLoading,\n placement: placement\n }), /*#__PURE__*/React.createElement(ScrollManager, {\n captureEnabled: captureMenuScroll,\n onTopArrive: onMenuScrollToTop,\n onBottomArrive: onMenuScrollToBottom,\n lockEnabled: menuShouldBlockScroll\n }, function (scrollTargetRef) {\n return /*#__PURE__*/React.createElement(MenuList, _extends({}, commonProps, {\n innerRef: function innerRef(instance) {\n _this4.getMenuListRef(instance);\n scrollTargetRef(instance);\n },\n innerProps: {\n role: 'listbox',\n 'aria-multiselectable': commonProps.isMulti,\n id: _this4.getElementId('listbox')\n },\n isLoading: isLoading,\n maxHeight: maxHeight,\n focusedOption: focusedOption\n }), menuUI);\n }));\n });\n\n // positioning behaviour is almost identical for portalled and fixed,\n // so we use the same component. the actual portalling logic is forked\n // within the component based on `menuPosition`\n return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React.createElement(MenuPortal, _extends({}, commonProps, {\n appendTo: menuPortalTarget,\n controlElement: this.controlRef,\n menuPlacement: menuPlacement,\n menuPosition: menuPosition\n }), menuElement) : menuElement;\n }\n }, {\n key: \"renderFormField\",\n value: function renderFormField() {\n var _this5 = this;\n var _this$props13 = this.props,\n delimiter = _this$props13.delimiter,\n isDisabled = _this$props13.isDisabled,\n isMulti = _this$props13.isMulti,\n name = _this$props13.name,\n required = _this$props13.required;\n var selectValue = this.state.selectValue;\n if (required && !this.hasValue() && !isDisabled) {\n return /*#__PURE__*/React.createElement(RequiredInput$1, {\n name: name,\n onFocus: this.onValueInputFocus\n });\n }\n if (!name || isDisabled) return;\n if (isMulti) {\n if (delimiter) {\n var value = selectValue.map(function (opt) {\n return _this5.getOptionValue(opt);\n }).join(delimiter);\n return /*#__PURE__*/React.createElement(\"input\", {\n name: name,\n type: \"hidden\",\n value: value\n });\n } else {\n var input = selectValue.length > 0 ? selectValue.map(function (opt, i) {\n return /*#__PURE__*/React.createElement(\"input\", {\n key: \"i-\".concat(i),\n name: name,\n type: \"hidden\",\n value: _this5.getOptionValue(opt)\n });\n }) : /*#__PURE__*/React.createElement(\"input\", {\n name: name,\n type: \"hidden\",\n value: \"\"\n });\n return /*#__PURE__*/React.createElement(\"div\", null, input);\n }\n } else {\n var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : '';\n return /*#__PURE__*/React.createElement(\"input\", {\n name: name,\n type: \"hidden\",\n value: _value\n });\n }\n }\n }, {\n key: \"renderLiveRegion\",\n value: function renderLiveRegion() {\n var commonProps = this.commonProps;\n var _this$state6 = this.state,\n ariaSelection = _this$state6.ariaSelection,\n focusedOption = _this$state6.focusedOption,\n focusedValue = _this$state6.focusedValue,\n isFocused = _this$state6.isFocused,\n selectValue = _this$state6.selectValue;\n var focusableOptions = this.getFocusableOptions();\n return /*#__PURE__*/React.createElement(LiveRegion$1, _extends({}, commonProps, {\n id: this.getElementId('live-region'),\n ariaSelection: ariaSelection,\n focusedOption: focusedOption,\n focusedValue: focusedValue,\n isFocused: isFocused,\n selectValue: selectValue,\n focusableOptions: focusableOptions,\n isAppleDevice: this.state.isAppleDevice\n }));\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$getComponents8 = this.getComponents(),\n Control = _this$getComponents8.Control,\n IndicatorsContainer = _this$getComponents8.IndicatorsContainer,\n SelectContainer = _this$getComponents8.SelectContainer,\n ValueContainer = _this$getComponents8.ValueContainer;\n var _this$props14 = this.props,\n className = _this$props14.className,\n id = _this$props14.id,\n isDisabled = _this$props14.isDisabled,\n menuIsOpen = _this$props14.menuIsOpen;\n var isFocused = this.state.isFocused;\n var commonProps = this.commonProps = this.getCommonProps();\n return /*#__PURE__*/React.createElement(SelectContainer, _extends({}, commonProps, {\n className: className,\n innerProps: {\n id: id,\n onKeyDown: this.onKeyDown\n },\n isDisabled: isDisabled,\n isFocused: isFocused\n }), this.renderLiveRegion(), /*#__PURE__*/React.createElement(Control, _extends({}, commonProps, {\n innerRef: this.getControlRef,\n innerProps: {\n onMouseDown: this.onControlMouseDown,\n onTouchEnd: this.onControlTouchEnd\n },\n isDisabled: isDisabled,\n isFocused: isFocused,\n menuIsOpen: menuIsOpen\n }), /*#__PURE__*/React.createElement(ValueContainer, _extends({}, commonProps, {\n isDisabled: isDisabled\n }), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, commonProps, {\n isDisabled: isDisabled\n }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(props, state) {\n var prevProps = state.prevProps,\n clearFocusValueOnUpdate = state.clearFocusValueOnUpdate,\n inputIsHiddenAfterUpdate = state.inputIsHiddenAfterUpdate,\n ariaSelection = state.ariaSelection,\n isFocused = state.isFocused,\n prevWasFocused = state.prevWasFocused,\n instancePrefix = state.instancePrefix;\n var options = props.options,\n value = props.value,\n menuIsOpen = props.menuIsOpen,\n inputValue = props.inputValue,\n isMulti = props.isMulti;\n var selectValue = cleanValue(value);\n var newMenuOptionsState = {};\n if (prevProps && (value !== prevProps.value || options !== prevProps.options || menuIsOpen !== prevProps.menuIsOpen || inputValue !== prevProps.inputValue)) {\n var focusableOptions = menuIsOpen ? buildFocusableOptions(props, selectValue) : [];\n var focusableOptionsWithIds = menuIsOpen ? buildFocusableOptionsWithIds(buildCategorizedOptions(props, selectValue), \"\".concat(instancePrefix, \"-option\")) : [];\n var focusedValue = clearFocusValueOnUpdate ? getNextFocusedValue(state, selectValue) : null;\n var focusedOption = getNextFocusedOption(state, focusableOptions);\n var focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusedOption);\n newMenuOptionsState = {\n selectValue: selectValue,\n focusedOption: focusedOption,\n focusedOptionId: focusedOptionId,\n focusableOptionsWithIds: focusableOptionsWithIds,\n focusedValue: focusedValue,\n clearFocusValueOnUpdate: false\n };\n }\n // some updates should toggle the state of the input visibility\n var newInputIsHiddenState = inputIsHiddenAfterUpdate != null && props !== prevProps ? {\n inputIsHidden: inputIsHiddenAfterUpdate,\n inputIsHiddenAfterUpdate: undefined\n } : {};\n var newAriaSelection = ariaSelection;\n var hasKeptFocus = isFocused && prevWasFocused;\n if (isFocused && !hasKeptFocus) {\n // If `value` or `defaultValue` props are not empty then announce them\n // when the Select is initially focused\n newAriaSelection = {\n value: valueTernary(isMulti, selectValue, selectValue[0] || null),\n options: selectValue,\n action: 'initial-input-focus'\n };\n hasKeptFocus = !prevWasFocused;\n }\n\n // If the 'initial-input-focus' action has been set already\n // then reset the ariaSelection to null\n if ((ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus') {\n newAriaSelection = null;\n }\n return _objectSpread(_objectSpread(_objectSpread({}, newMenuOptionsState), newInputIsHiddenState), {}, {\n prevProps: props,\n ariaSelection: newAriaSelection,\n prevWasFocused: hasKeptFocus\n });\n }\n }]);\n return Select;\n}(Component);\nSelect.defaultProps = defaultProps;\n\nexport { Select as S, defaultProps as a, getOptionLabel$1 as b, createFilter as c, defaultTheme as d, getOptionValue$1 as g, mergeStyles as m };\n","import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inherits(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e && setPrototypeOf(t, e);\n}\nexport { _inherits as default };","import getPrototypeOf from \"./getPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn.js\";\nfunction _createSuper(t) {\n var r = isNativeReflectConstruct();\n return function () {\n var e,\n o = getPrototypeOf(t);\n if (r) {\n var s = getPrototypeOf(this).constructor;\n e = Reflect.construct(o, arguments, s);\n } else e = o.apply(this, arguments);\n return possibleConstructorReturn(this, e);\n };\n}\nexport { _createSuper as default };","function _classCallCheck(a, n) {\n if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");\n}\nexport { _classCallCheck as default };","import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\nimport _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';\nimport _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';\nimport { useState, useCallback } from 'react';\n\nvar _excluded = [\"defaultInputValue\", \"defaultMenuIsOpen\", \"defaultValue\", \"inputValue\", \"menuIsOpen\", \"onChange\", \"onInputChange\", \"onMenuClose\", \"onMenuOpen\", \"value\"];\nfunction useStateManager(_ref) {\n var _ref$defaultInputValu = _ref.defaultInputValue,\n defaultInputValue = _ref$defaultInputValu === void 0 ? '' : _ref$defaultInputValu,\n _ref$defaultMenuIsOpe = _ref.defaultMenuIsOpen,\n defaultMenuIsOpen = _ref$defaultMenuIsOpe === void 0 ? false : _ref$defaultMenuIsOpe,\n _ref$defaultValue = _ref.defaultValue,\n defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue,\n propsInputValue = _ref.inputValue,\n propsMenuIsOpen = _ref.menuIsOpen,\n propsOnChange = _ref.onChange,\n propsOnInputChange = _ref.onInputChange,\n propsOnMenuClose = _ref.onMenuClose,\n propsOnMenuOpen = _ref.onMenuOpen,\n propsValue = _ref.value,\n restSelectProps = _objectWithoutProperties(_ref, _excluded);\n var _useState = useState(propsInputValue !== undefined ? propsInputValue : defaultInputValue),\n _useState2 = _slicedToArray(_useState, 2),\n stateInputValue = _useState2[0],\n setStateInputValue = _useState2[1];\n var _useState3 = useState(propsMenuIsOpen !== undefined ? propsMenuIsOpen : defaultMenuIsOpen),\n _useState4 = _slicedToArray(_useState3, 2),\n stateMenuIsOpen = _useState4[0],\n setStateMenuIsOpen = _useState4[1];\n var _useState5 = useState(propsValue !== undefined ? propsValue : defaultValue),\n _useState6 = _slicedToArray(_useState5, 2),\n stateValue = _useState6[0],\n setStateValue = _useState6[1];\n var onChange = useCallback(function (value, actionMeta) {\n if (typeof propsOnChange === 'function') {\n propsOnChange(value, actionMeta);\n }\n setStateValue(value);\n }, [propsOnChange]);\n var onInputChange = useCallback(function (value, actionMeta) {\n var newValue;\n if (typeof propsOnInputChange === 'function') {\n newValue = propsOnInputChange(value, actionMeta);\n }\n setStateInputValue(newValue !== undefined ? newValue : value);\n }, [propsOnInputChange]);\n var onMenuOpen = useCallback(function () {\n if (typeof propsOnMenuOpen === 'function') {\n propsOnMenuOpen();\n }\n setStateMenuIsOpen(true);\n }, [propsOnMenuOpen]);\n var onMenuClose = useCallback(function () {\n if (typeof propsOnMenuClose === 'function') {\n propsOnMenuClose();\n }\n setStateMenuIsOpen(false);\n }, [propsOnMenuClose]);\n var inputValue = propsInputValue !== undefined ? propsInputValue : stateInputValue;\n var menuIsOpen = propsMenuIsOpen !== undefined ? propsMenuIsOpen : stateMenuIsOpen;\n var value = propsValue !== undefined ? propsValue : stateValue;\n return _objectSpread(_objectSpread({}, restSelectProps), {}, {\n inputValue: inputValue,\n menuIsOpen: menuIsOpen,\n onChange: onChange,\n onInputChange: onInputChange,\n onMenuClose: onMenuClose,\n onMenuOpen: onMenuOpen,\n value: value\n });\n}\n\nexport { useStateManager as u };\n","import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\nimport _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';\nimport _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';\nimport { useMemo, useCallback } from 'react';\nimport { H as cleanValue, D as valueTernary } from './index-641ee5b8.esm.js';\nimport { g as getOptionValue, b as getOptionLabel } from './Select-ef7c0426.esm.js';\n\nvar _excluded = [\"allowCreateWhileLoading\", \"createOptionPosition\", \"formatCreateLabel\", \"isValidNewOption\", \"getNewOptionData\", \"onCreateOption\", \"options\", \"onChange\"];\nvar compareOption = function compareOption() {\n var inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var option = arguments.length > 1 ? arguments[1] : undefined;\n var accessors = arguments.length > 2 ? arguments[2] : undefined;\n var candidate = String(inputValue).toLowerCase();\n var optionValue = String(accessors.getOptionValue(option)).toLowerCase();\n var optionLabel = String(accessors.getOptionLabel(option)).toLowerCase();\n return optionValue === candidate || optionLabel === candidate;\n};\nvar builtins = {\n formatCreateLabel: function formatCreateLabel(inputValue) {\n return \"Create \\\"\".concat(inputValue, \"\\\"\");\n },\n isValidNewOption: function isValidNewOption(inputValue, selectValue, selectOptions, accessors) {\n return !(!inputValue || selectValue.some(function (option) {\n return compareOption(inputValue, option, accessors);\n }) || selectOptions.some(function (option) {\n return compareOption(inputValue, option, accessors);\n }));\n },\n getNewOptionData: function getNewOptionData(inputValue, optionLabel) {\n return {\n label: optionLabel,\n value: inputValue,\n __isNew__: true\n };\n }\n};\nfunction useCreatable(_ref) {\n var _ref$allowCreateWhile = _ref.allowCreateWhileLoading,\n allowCreateWhileLoading = _ref$allowCreateWhile === void 0 ? false : _ref$allowCreateWhile,\n _ref$createOptionPosi = _ref.createOptionPosition,\n createOptionPosition = _ref$createOptionPosi === void 0 ? 'last' : _ref$createOptionPosi,\n _ref$formatCreateLabe = _ref.formatCreateLabel,\n formatCreateLabel = _ref$formatCreateLabe === void 0 ? builtins.formatCreateLabel : _ref$formatCreateLabe,\n _ref$isValidNewOption = _ref.isValidNewOption,\n isValidNewOption = _ref$isValidNewOption === void 0 ? builtins.isValidNewOption : _ref$isValidNewOption,\n _ref$getNewOptionData = _ref.getNewOptionData,\n getNewOptionData = _ref$getNewOptionData === void 0 ? builtins.getNewOptionData : _ref$getNewOptionData,\n onCreateOption = _ref.onCreateOption,\n _ref$options = _ref.options,\n propsOptions = _ref$options === void 0 ? [] : _ref$options,\n propsOnChange = _ref.onChange,\n restSelectProps = _objectWithoutProperties(_ref, _excluded);\n var _restSelectProps$getO = restSelectProps.getOptionValue,\n getOptionValue$1 = _restSelectProps$getO === void 0 ? getOptionValue : _restSelectProps$getO,\n _restSelectProps$getO2 = restSelectProps.getOptionLabel,\n getOptionLabel$1 = _restSelectProps$getO2 === void 0 ? getOptionLabel : _restSelectProps$getO2,\n inputValue = restSelectProps.inputValue,\n isLoading = restSelectProps.isLoading,\n isMulti = restSelectProps.isMulti,\n value = restSelectProps.value,\n name = restSelectProps.name;\n var newOption = useMemo(function () {\n return isValidNewOption(inputValue, cleanValue(value), propsOptions, {\n getOptionValue: getOptionValue$1,\n getOptionLabel: getOptionLabel$1\n }) ? getNewOptionData(inputValue, formatCreateLabel(inputValue)) : undefined;\n }, [formatCreateLabel, getNewOptionData, getOptionLabel$1, getOptionValue$1, inputValue, isValidNewOption, propsOptions, value]);\n var options = useMemo(function () {\n return (allowCreateWhileLoading || !isLoading) && newOption ? createOptionPosition === 'first' ? [newOption].concat(_toConsumableArray(propsOptions)) : [].concat(_toConsumableArray(propsOptions), [newOption]) : propsOptions;\n }, [allowCreateWhileLoading, createOptionPosition, isLoading, newOption, propsOptions]);\n var onChange = useCallback(function (newValue, actionMeta) {\n if (actionMeta.action !== 'select-option') {\n return propsOnChange(newValue, actionMeta);\n }\n var valueArray = Array.isArray(newValue) ? newValue : [newValue];\n if (valueArray[valueArray.length - 1] === newOption) {\n if (onCreateOption) onCreateOption(inputValue);else {\n var newOptionData = getNewOptionData(inputValue, inputValue);\n var newActionMeta = {\n action: 'create-option',\n name: name,\n option: newOptionData\n };\n propsOnChange(valueTernary(isMulti, [].concat(_toConsumableArray(cleanValue(value)), [newOptionData]), newOptionData), newActionMeta);\n }\n return;\n }\n propsOnChange(newValue, actionMeta);\n }, [getNewOptionData, inputValue, isMulti, name, newOption, onCreateOption, propsOnChange, value]);\n return _objectSpread(_objectSpread({}, restSelectProps), {}, {\n options: options,\n onChange: onChange\n });\n}\n\nexport { useCreatable as u };\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport * as React from 'react';\nimport { forwardRef } from 'react';\nimport { S as Select } from '../../dist/Select-ef7c0426.esm.js';\nimport { u as useStateManager } from '../../dist/useStateManager-7e1e8489.esm.js';\nimport { u as useCreatable } from '../../dist/useCreatable-09aaeb9a.esm.js';\nexport { u as useCreatable } from '../../dist/useCreatable-09aaeb9a.esm.js';\nimport '@babel/runtime/helpers/objectSpread2';\nimport '@babel/runtime/helpers/classCallCheck';\nimport '@babel/runtime/helpers/createClass';\nimport '@babel/runtime/helpers/inherits';\nimport '@babel/runtime/helpers/createSuper';\nimport '@babel/runtime/helpers/toConsumableArray';\nimport '../../dist/index-641ee5b8.esm.js';\nimport '@emotion/react';\nimport '@babel/runtime/helpers/slicedToArray';\nimport '@babel/runtime/helpers/objectWithoutProperties';\nimport '@babel/runtime/helpers/typeof';\nimport '@babel/runtime/helpers/taggedTemplateLiteral';\nimport '@babel/runtime/helpers/defineProperty';\nimport 'react-dom';\nimport '@floating-ui/dom';\nimport 'use-isomorphic-layout-effect';\nimport 'memoize-one';\n\nvar CreatableSelect = /*#__PURE__*/forwardRef(function (props, ref) {\n var creatableProps = useStateManager(props);\n var selectProps = useCreatable(creatableProps);\n return /*#__PURE__*/React.createElement(Select, _extends({\n ref: ref\n }, selectProps));\n});\nvar CreatableSelect$1 = CreatableSelect;\n\nexport { CreatableSelect$1 as default };\n","import React, { useState } from 'react'\nimport CreatableSelect from 'react-select/creatable'\nimport PropTypes from 'prop-types'\nimport { Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Button } from '@mui/material'\n\nconst TagSelect = ({ parentHandler, ruleTags: initialRuleTags, tags }) => {\n const [selectedOption, setSelectedOption] = useState(null)\n const [ruleTags, setRuleTags] = useState(initialRuleTags)\n const [allTags] = useState(tags)\n const [inputValue, setInputValue] = useState('')\n const [isDialogOpen, setDialogOpen] = useState(false)\n const [newTag, setNewTag] = useState('')\n\n const handleChange = (option, actionMeta) => {\n if (actionMeta.action === 'create-option') {\n setNewTag(option.label)\n setDialogOpen(true)\n } else {\n setSelectedOption(option)\n setRuleTags([...ruleTags, option])\n parentHandler({ id: option.value, name: option.label })\n }\n }\n\n const handleInputChange = (newInput) => {\n setInputValue(newInput)\n }\n\n const handleDialogClose = () => {\n setDialogOpen(false)\n setInputValue('')\n }\n\n const handleDialogConfirm = () => {\n const newTagObj = {\n id: null,\n name: newTag,\n }\n setRuleTags([...ruleTags, newTagObj])\n parentHandler({ id: newTagObj.id, name: newTagObj.name })\n setDialogOpen(false)\n setInputValue('')\n }\n\n const tagOptions = () => allTags.map((t) => ({\n value: t.id,\n label: t.name,\n }))\n\n return (\n \n \n \n
\n )\n}\n\nconst TAG = PropTypes.shape({\n id: PropTypes.number,\n name: PropTypes.string,\n})\n\nTagSelect.propTypes = {\n parentHandler: PropTypes.func.isRequired,\n ruleTags: PropTypes.arrayOf(TAG).isRequired,\n tags: PropTypes.arrayOf(TAG).isRequired,\n}\n\nexport default TagSelect","import React, { useState } from 'react'\nimport Box from '@mui/material/Box'\nimport Checkbox from '@mui/material/Checkbox'\nimport FormControlLabel from '@mui/material/FormControlLabel'\n\nimport { Rule as RuleType } from '../athenaTypes'\n\nconst propTypes = {\n rule: RuleType.isRequired,\n}\n\nconst EncounterTypeToggles = ({ rule }) => {\n const [encounterTypes, setEncounterTypes] = useState(rule.encounter_type)\n\n const handleChange = (event) => {\n const encounterType = event.target.name\n const index = encounterTypes.indexOf(encounterType)\n let newEncounterTypes\n if (index === -1) {\n newEncounterTypes = [...encounterTypes, encounterType]\n } else {\n newEncounterTypes = encounterTypes.filter((e) => e !== encounterType)\n }\n setEncounterTypes(newEncounterTypes)\n $.ajax({\n method: 'put',\n url: `/root/rules/${rule.id}/encounter_types`,\n data: { encounter_type: newEncounterTypes },\n })\n .done(() => null)\n .fail((err) => {\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n flash.error('Error updating the encounter types.')\n console.error(err)\n }\n })\n }\n\n return (\n \n \n Encounter Type\n \n \n \n }\n />\n \n }\n />\n \n }\n />\n \n \n )\n}\n\nEncounterTypeToggles.propTypes = propTypes\nexport default EncounterTypeToggles\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport dayjs from '../utilities/dayjs'\nimport { Grid } from '@mui/material'\n\nconst MigrationToggle = ({ lastMigrated = null, status, onClick }) => {\n const migratedMessage = lastMigrated ? (\n \n Last migrated:\n {' '}\n {dayjs(lastMigrated).fromNow()}\n
\n ) : null\n let statusMessage\n if (status === \"deployed\") {\n statusMessage = In production
\n } else if (status === \"ready\" && lastMigrated) {\n statusMessage = Sending updated rule to production
\n } else if (status === \"testing\") {\n statusMessage = Not in production
\n }\n return (\n \n \n {statusMessage}\n {migratedMessage}\n \n \n \n \n \n )\n}\n\nMigrationToggle.propTypes = {\n status: PropTypes.oneOf([\"testing\", \"ready\", \"deployed\"]).isRequired,\n onClick: PropTypes.func.isRequired,\n lastMigrated: PropTypes.string\n}\n\nexport default MigrationToggle\n","import React, { useState, useRef, useContext, useEffect } from 'react'\nimport { bool, func, number } from 'prop-types'\nimport { path } from 'ramda'\nimport Box from '@mui/material/Box'\nimport Tag from './Tag'\nimport TagSelect from '../tags/TagSelect'\nimport EncounterTypeToggles from './EncounterTypeToggles'\nimport { Rule as RuleType, Tags, Styles } from '../athenaTypes'\nimport MigrationToggle from './MigrationToggle'\nimport { RuleContext } from './avhanaRulesList'\nimport PropTypes from 'prop-types'\nimport SelectableUUID from '../components/SelectableUUID'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport Switch from '@mui/material/Switch'\nimport EditIcon from '@mui/icons-material/Edit'\nimport Accordion from '@mui/material/Accordion'\nimport AccordionSummary from '@mui/material/AccordionSummary'\nimport AccordionDetails from '@mui/material/AccordionDetails'\n\nconst propTypes = {\n rule: RuleType.isRequired,\n toggleRule: func.isRequired,\n toggleMigrationStatus: func.isRequired,\n tags: Tags.isRequired,\n style: Styles.isRequired,\n index: number.isRequired,\n isStaging: bool.isRequired,\n notProduction: bool.isRequired,\n updateRuleTags: func.isRequired,\n}\n\nconst styles = {\n collapsibleHeader: {\n lineHeight: '2em',\n padding: '1.5em 1em',\n },\n chipContainer: {\n paddingLeft: '0.5em',\n },\n chip: {\n backgroundColor: '#f2f2f2',\n fontSize: '12px',\n },\n ruleNameSpan: {\n paddingLeft: '1em',\n fontSize: '17px',\n },\n noPadding: { padding: '0' },\n}\n\nconst Rule = ({ rule, style, tags, toggleRule, toggleMigrationStatus, index, isStaging, notProduction, updateRuleTags }) => {\n const [ruleTags, setRuleTags] = useState(rule.tags)\n const [isExpanded, setIsExpanded] = useState(false)\n const { setSize } = useContext(RuleContext)\n const accordionRef = useRef()\n const body = useRef()\n\n useEffect(() => {\n setRuleTags(rule.tags)\n }, [rule.tags])\n\n useEffect(() => {\n if (typeof setSize !== 'function') return\n const el = accordionRef.current\n if (!el) return\n\n if (typeof ResizeObserver === 'undefined') {\n // Fallback for environments without ResizeObserver (e.g. jsdom): measure once per toggle\n if (typeof el.getBoundingClientRect === 'function') {\n setSize(index, el.getBoundingClientRect().height)\n }\n return\n }\n\n const observer = new ResizeObserver((entries) => {\n const height = entries[0]?.contentRect?.height ?? el.getBoundingClientRect().height\n setSize(index, height)\n })\n observer.observe(el)\n return () => observer.disconnect()\n }, [index, isExpanded, setSize])\n\n const handleClick = () => {\n setIsExpanded((prev) => !prev)\n }\n\n const tagHandler = (tag) => {\n setRuleTags((prevTags) => [...prevTags, tag])\n $.ajax({\n method: 'put',\n url: `/root/rules/${rule.id}/tags/${tag.id}/add`,\n data: {name: tag.name}\n })\n .done(() => {\n const newTags = [...ruleTags, tag]\n setRuleTags(newTags)\n updateRuleTags(rule.id, newTags) // <-- update parent\n })\n .fail((err) => {\n if (checkTimeout(err)) {\n redirectToLogin()\n } else {\n window.flash.error(\n 'Error tagging your rule. Contact support@amalgamrx.com if you need further assistance.'\n )\n console.error(err)\n }\n })\n }\n\n const removeTagHandler = (event, tag) => {\n $.ajax({\n method: 'put',\n url: `/root/rules/${rule.id}/tags/${tag.id}/remove`,\n })\n .done(() => {\n const newTags = ruleTags.filter((t) => t.id !== tag.id)\n setRuleTags(newTags)\n updateRuleTags(rule.id, newTags)\n })\n .fail((err) => {\n if (checkTimeout(err)) {\n redirectToLogin()\n } else {\n window.flash.error(\n 'Error removing the tag from your rule. Contact support@amalgamrx.com if you need further assistance.'\n )\n console.error(err)\n }\n })\n }\n\n const doToggleRule = (event) => {\n toggleRule(rule.id, event.target.checked)\n }\n\n const showRuleTags = ruleTags.map((t) => (\n \n ))\n\n const editRuleLink = (\n \n \n \n )\n\n let orderPreferenceDefaultLink\n const orders = path(['order_preference_reference', 'options', 'orders'], rule)\n if (orders) {\n orderPreferenceDefaultLink = (\n \n )\n } else {\n orderPreferenceDefaultLink = (\n \n Add Default Order Preference\n \n )\n }\n return (\n \n handleClick()}\n disableGutters\n elevation={1}\n square\n sx={{ margin: 0, '&:before': { display: 'none' } }}\n >\n \n \n
\n \n \n \n \n {rule.default_display_code || rule.source}\n \n {rule.name}\n
\n \n {/* use shared component to keep selection behavior consistent */}\n \n
\n \n \n {showRuleTags}\n \n \n \n \n \n }\n />\n \n \n
\n \n \n \n \n \n \n {editRuleLink}\n \n {notProduction && (\n \n )}\n \n \n Action\n \n {rule.action}\n \n \n \n Description\n \n {rule.description}\n \n \n \n Rule UUID\n \n {rule.uuid}\n \n \n \n {orderPreferenceDefaultLink}\n \n {isStaging && (\n toggleMigrationStatus(rule.id)}\n />\n )}\n \n \n \n \n
\n \n \n \n )\n}\n\nRule.propTypes = propTypes\n\nexport default Rule","import React from 'react'\nimport { bool, func } from 'prop-types'\nimport { VariableSizeList as List } from 'react-window'\nimport AutoSizer from 'react-virtualized-auto-sizer'\n\n// eslint-disable-next-line import/no-cycle\nimport Rule from './Rule'\nimport { Rules, Tags } from '../athenaTypes'\n\nconst propTypes = {\n displayedRules: Rules.isRequired,\n turnRuleOnOff: func.isRequired,\n toggleMigrationStatus: func.isRequired,\n tags: Tags.isRequired,\n isStaging: bool.isRequired,\n notProduction: bool.isRequired,\n}\n\nexport const RuleContext = React.createContext({})\n\nconst RulesList = ({ displayedRules, tags, turnRuleOnOff, toggleMigrationStatus, isStaging, notProduction, updateRuleTags }) => {\n const listRef = React.useRef()\n const sizeMap = React.useRef({})\n const setSize = React.useCallback((index, size) => {\n sizeMap.current = { ...sizeMap.current, [index]: size }\n listRef.current.resetAfterIndex(index)\n }, [])\n const getSize = React.useCallback((index) => sizeMap.current[index] || 140, [])\n\n const innerElementType = React.forwardRef((props, ref) => (\n \n ))\n\n const toggleRule = (id, state) => turnRuleOnOff(id, state)\n\n const buildRule = ({ index, style }) => {\n const rule = displayedRules[index]\n return (\n \n )\n }\n return (\n \n \n {({ width }) => (\n \n {buildRule}\n
\n )}\n \n \n )\n}\n\nRulesList.propTypes = propTypes\n\nexport default RulesList\n","import Chip from '@mui/material/Chip'\nimport Box from '@mui/material/Box'\nimport React, { Component } from 'react'\nimport { descend, sortWith, prop } from 'ramda'\nimport { bool } from 'prop-types'\nimport TextField from '@mui/material/TextField'\nimport RulesList from './avhanaRulesList'\nimport { Rules, Tags, Sources } from '../athenaTypes'\nimport ExpandableCheckboxList from '../reusableComponents/expandableCheckboxList'\n\nconst UUIDV4_REGEXP = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i\n\n// validate prop types\nconst propTypes = {\n rules: Rules.isRequired,\n tags: Tags.isRequired,\n sources: Sources.isRequired,\n isStaging: bool.isRequired,\n notProduction: bool.isRequired,\n}\n\n// function to create JSX for filter criteria chips on top of page\nconst createCriteriaChips = (state) => {\n const ruleSourcesCriteria =\n state.checkedRuleSources.length > 0\n ? state.checkedRuleSources\n : ['All Rule Sources']\n const diseaseTagCriteria =\n state.checkedDiseaseTags.length > 0\n ? state.checkedDiseaseTags\n : ['All Tags']\n const textCriteria =\n state.textQuery.length > 0 ? [`Contains text '${state.textQuery}'`] : []\n\n const criteria = ruleSourcesCriteria.concat(diseaseTagCriteria, textCriteria)\n\n const criteriaChips = _.map(criteria, (name, i) => (\n \n ))\n\n return criteriaChips\n}\n\n/* eslint-disable import/prefer-default-export */\nexport const filterFunction = (\n rule,\n textQuery,\n diseaseTagFilters,\n ruleSourceFilters\n) => {\n const isObsolete = rule.tags.some((t) => t.name === 'Obsolete')\n const isFilteringObsolete = diseaseTagFilters.includes('Obsolete')\n\n // Hide obsolete rules unless \"obsolete\" is explicitly selected\n if (isObsolete && !isFilteringObsolete) {\n return false\n }\n\n let diseaseTagFiltersPresentOnCurrentRule\n let ruleSourceFiltersPresentOnCurrentRule\n\n // filter rule source if some are selected otherwise display all\n if (ruleSourceFilters.length > 0) {\n ruleSourceFiltersPresentOnCurrentRule = ruleSourceFilters.includes(\n rule.source\n )\n } else {\n ruleSourceFiltersPresentOnCurrentRule = true\n }\n\n // filter disease tags if some are selected otherwise display all\n if (diseaseTagFilters.length > 0) {\n const tagsOnThisRule = rule.tags.map((t) => t.name)\n diseaseTagFiltersPresentOnCurrentRule =\n _.intersection(diseaseTagFilters, tagsOnThisRule).length > 0\n } else {\n diseaseTagFiltersPresentOnCurrentRule = true\n }\n\n // filter on text present in rule description\n const lowerCaseTextQuery = textQuery.toLowerCase().trim()\n\n const textQueryOnCurrentRule =\n (rule.description &&\n rule.description.toLowerCase().includes(lowerCaseTextQuery)) ||\n (rule.name && rule.name.toLowerCase().includes(lowerCaseTextQuery)) ||\n (rule.default_display_code &&\n rule.default_display_code.toLowerCase().includes(lowerCaseTextQuery)) ||\n (UUIDV4_REGEXP.test(textQuery) &&\n rule.uuid.toLowerCase() === lowerCaseTextQuery)\n\n return (\n ruleSourceFiltersPresentOnCurrentRule &&\n diseaseTagFiltersPresentOnCurrentRule &&\n textQueryOnCurrentRule\n )\n}\n\nconst sortRules = sortWith([\n descend(prop('updated_at')),\n])\n\n// React RulesFilter class\nclass RulesFilter extends Component {\n /**\n * @prop rules -> array of objects, all Rule records\n * @prop tags -> all tags\n */\n\n constructor(props) {\n super(props)\n this.state = {\n displayedRules: [],\n allRules: [],\n checkedRuleSources: [],\n checkedDiseaseTags: [],\n textQuery: '',\n showAllRulesSoures: false,\n showAllDiseaseTags: false,\n filterText: '',\n }\n\n this.filterOnCheck = this.filterOnCheck.bind(this)\n this.turnRuleOnOff = this.turnRuleOnOff.bind(this)\n this.toggleMigrationStatus = this.toggleMigrationStatus.bind(this)\n this.filterOnText = this.filterOnText.bind(this)\n this.handleFilterTextChange = this.handleFilterTextChange.bind(this)\n }\n\n componentDidMount() {\n const { rules } = this.props\n const defaultVisibleRules = rules.filter(\n (rule) => !rule.tags.some((t) => t.name === 'Obsolete')\n )\n this.setState({\n displayedRules: sortRules(defaultVisibleRules),\n allRules: rules,\n })\n }\n \n\n handleFilterTextChange(event) {\n const { checkedDiseaseTags, checkedRuleSources } = this.state\n const filterText = event.target.value\n \n this.setState({ filterText }, () => {\n this.updateRulesFilterState(checkedRuleSources, checkedDiseaseTags, filterText)\n })\n }\n\n turnRuleOnOff(ruleId, active) {\n $.ajax({\n method: 'put',\n url: `/root/rules/${ruleId}/turn_on_off_rule`,\n data: { active },\n })\n .done(() => {\n const { allRules } = this.state\n const foundRule = allRules.find(r => r.id === ruleId)\n try {\n foundRule.active = active\n this.setState({ allRules })\n } catch (e) {\n console.error(\"Unable to update rule active status\")\n }\n })\n .fail((err) => {\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n flash.error(\n 'Error updating your rule. Contact support@amalgamrx.com if you need further assistance.'\n )\n console.error(err)\n }\n })\n }\n\n toggleMigrationStatus(ruleId) {\n $.ajax({\n method: 'post',\n url: `/root/rules/${ruleId}/toggle_ready`,\n })\n .done(() => {\n const { allRules } = this.state\n const foundRule = allRules.find((r) => r.id === ruleId)\n try {\n foundRule.migration_status = \"ready\"\n this.setState({ allRules })\n } catch(e) {\n console.error('Unable to toggle migration status')\n }\n })\n .fail((err) => {\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n flash.error(\n 'Error updating your migration status. Contact support@amalgamrx.com if you need further assistance.'\n )\n console.error(err)\n }\n })\n }\n\n buildFilterPanel() {\n const { sources, tags } = this.props\n\n const filteredTagNames = tags.map((t) => t.name)\n const filteredSources = sources\n \n return (\n \n )\n }\n\n filterOnText(event) {\n const { checkedDiseaseTags, checkedRuleSources } = this.state\n // need to use this to access these vars within setTimeout scope\n const textQuery = event.target.value\n\n clearTimeout(this.timer)\n this.timer = setTimeout(() => {\n this.updateRulesFilterState(\n checkedDiseaseTags,\n checkedRuleSources,\n textQuery\n )\n }, 300)\n }\n\n filterOnCheck(event) {\n const { checkedDiseaseTags, checkedRuleSources, textQuery } = this.state\n const checkName = event.target.name\n const checkType = event.target.dataset.type\n\n let ruleSourceFilters = checkedRuleSources\n let diseaseTagFilters = checkedDiseaseTags\n\n if (event.target.checked) {\n if (checkType === 'source') {\n ruleSourceFilters.push(checkName) // handle sources\n } else if (checkType === 'disease') {\n diseaseTagFilters.push(checkName) // handle disease tags\n }\n } else if (checkType === 'source') {\n ruleSourceFilters = _.reject(ruleSourceFilters, (f) => f === checkName)\n } else if (checkType === 'disease') {\n diseaseTagFilters = _.reject(diseaseTagFilters, (f) => f === checkName)\n }\n\n this.updateRulesFilterState(ruleSourceFilters, diseaseTagFilters, textQuery)\n }\n\n updateRulesFilterState(ruleSourceFilters, diseaseTagFilters, textQuery) {\n const { allRules } = this.state\n const displayedRules = sortRules(\n allRules.filter((rule) =>\n filterFunction(rule, textQuery, diseaseTagFilters, ruleSourceFilters)\n )\n )\n\n this.setState({\n displayedRules,\n checkedRuleSources: ruleSourceFilters,\n checkedDiseaseTags: diseaseTagFilters,\n textQuery,\n })\n }\n\n updateRuleTags = (ruleId, newTags) => {\n this.setState((prevState) => {\n const allRules = prevState.allRules.map((r) =>\n r.id === ruleId ? { ...r, tags: newTags } : r\n )\n const displayedRules = prevState.displayedRules.map((r) =>\n r.id === ruleId ? { ...r, tags: newTags } : r\n )\n return { allRules, displayedRules }\n })\n }\n\n render() {\n const { tags, isStaging, notProduction } = this.props\n const { displayedRules } = this.state\n const facetFilter = this.buildFilterPanel()\n\n const rulesBox = (\n \n )\n const displayedRulesCount = displayedRules.length\n const filterCriteriaChips = createCriteriaChips(this.state)\n\n return (\n \n \n \n {facetFilter}\n \n \n \n \n \n \n Showing guidelines for:\n \n {filterCriteriaChips}\n \n \n \n {`${displayedRulesCount} ${pluralize(\n 'guideline',\n displayedRulesCount\n )}`}\n \n {` ${pluralize('meet', displayedRulesCount)} this criteria.`}\n \n \n {rulesBox}\n \n \n )\n }\n}\n\nRulesFilter.propTypes = propTypes\n\nexport default RulesFilter\n","import React, { useState } from 'react'\nimport log from '../../utilities/logger'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport Divider from '@mui/material/Divider'\nimport Button from '@mui/material/Button'\nimport Box from '@mui/material/Box'\n\nexport default function Backfill() {\n const [file, setFile] = useState(undefined)\n const handleFileSelect = (event) => {\n setFile(event.target.files[0])\n }\n\n const handleFileSubmit = (event) => {\n const formData = new FormData()\n formData.append(\"file\", file)\n event.preventDefault()\n const call = { \n method: 'post',\n url: '/root/backfill/backfill_csv',\n contentType: false,\n processData: false,\n data: formData,\n enctype: 'multipart/form-data'\n }\n $.ajax(call)\n .done(() => {\n flash.success('Backfill patient csv successfully imported')\n })\n .fail((error) => {\n const errorMsg = error.responseJSON?.errors || 'Unknown error'\n const { data, ...callWithoutData } = call\n log({ title: 'Failed to import backfill patient CSV', className: 'Backfill', values: { call: callWithoutData, error: errorMsg } })\n flash.error(`Error importing your backfill patient. ${errorMsg}`)\n console.error(error)\n })\n }\n const handleBackfillStart = (event) => {\n event.preventDefault()\n $.ajax({\n method: 'post',\n url: '/root/backfill/backfill_start',\n contentType: false,\n processData: false,\n enctype: 'multipart/form-data'\n })\n flash.success(\"Backfill process started\", 50000)\n }\n\n return (\n \n )\n}","import React, { useState, useEffect, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport { DataGrid } from '@mui/x-data-grid'\nimport {\n Box,\n Button,\n FormControl,\n FormControlLabel,\n Checkbox,\n InputLabel,\n Select,\n MenuItem,\n Alert,\n Snackbar,\n Typography,\n Paper,\n Dialog,\n DialogTitle,\n DialogContent,\n DialogActions,\n TextField,\n} from '@mui/material'\nimport LoadingSkeleton from '../../loadingSkeleton/LoadingSkeleton'\nimport EditCareCenter from './editCareCenter'\n\nconst propTypes = {\n programs: PropTypes.arrayOf(PropTypes.string).isRequired,\n}\n\nconst COLUMN_WIDTHS = {\n NAME: 300,\n DEFAULT: 125,\n}\n\nconst calculateDayOffset = (date) => {\n const today = new Date()\n today.setHours(0, 0, 0, 0)\n const selected = new Date(date)\n selected.setHours(0, 0, 0, 0)\n return Math.round((selected - today) / (1000 * 60 * 60 * 24))\n}\n\nconst ShowCareCenters = ({ programs }) => {\n const [data, setData] = useState([])\n const [error, setError] = useState(null)\n const [loading, setLoading] = useState(true)\n const [selectedCareCenter, setSelectedCareCenter] = useState(null)\n const [rowSelectionModel, setRowSelectionModel] = useState([])\n const [selectedProgram, setSelectedProgram] = useState('')\n const [bulkUpdating, setBulkUpdating] = useState(false)\n const [snackbar, setSnackbar] = useState({ open: false, message: '', severity: 'success' })\n const [dialogOpen, setDialogOpen] = useState(false)\n const [dialogAction, setDialogAction] = useState(null)\n const [backfillStartDate, setBackfillStartDate] = useState('')\n const [backfillEndDate, setBackfillEndDate] = useState('')\n const [hardStop, setHardStop] = useState(false)\n\n const handleEdit = (careCenter) => setSelectedCareCenter(careCenter)\n\n const columns = React.useMemo(() => [\n { field: 'name', headerName: 'Name', width: COLUMN_WIDTHS.NAME },\n { field: 'organizationId', headerName: 'Organization ID', width: COLUMN_WIDTHS.DEFAULT },\n { field: 'providerGroupingId', headerName: 'Provider grouping ID', width: COLUMN_WIDTHS.DEFAULT },\n { field: 'phoneNumber', headerName: 'Number', width: COLUMN_WIDTHS.DEFAULT, filterable: false },\n { field: 'departmentKey', headerName: 'Department Key', width: COLUMN_WIDTHS.DEFAULT },\n {\n field: 'approvals',\n headerName: 'Approvals',\n width: COLUMN_WIDTHS.DEFAULT,\n renderCell: (params) => {\n try {\n const approvals = typeof params.value === 'string' ? JSON.parse(params.value) : params.value\n if (!approvals || Object.keys(approvals).length === 0) {\n return None\n }\n return (\n \n {Object.entries(approvals).map(([key, val]) => (\n \n {key}\n \n ))}\n \n )\n } catch (e) {\n return {params.value || 'None'}\n }\n }\n },\n {\n field: 'edit',\n headerName: 'Edit',\n filterable: false,\n width: COLUMN_WIDTHS.DEFAULT,\n renderCell: (params) => (\n \n ),\n },\n ], [])\n\n useEffect(() => {\n fetchCareCenters()\n }, [])\n\n const fetchCareCenters = () => {\n $.ajax({\n method: 'GET',\n url: '/root/care_center_list',\n dataType: 'json',\n contentType: 'application/json',\n })\n .done((response) => {\n setData(response.care_centers)\n setLoading(false)\n })\n .fail((errors) => {\n setError(errors)\n setLoading(false)\n })\n }\n\n const handleOpenDialog = (action) => {\n setDialogAction(action)\n setSelectedProgram('')\n setBackfillStartDate('')\n setBackfillEndDate('')\n setHardStop(false)\n setDialogOpen(true)\n }\n\n const handleCloseDialog = () => {\n setDialogOpen(false)\n setDialogAction(null)\n setSelectedProgram('')\n setBackfillStartDate('')\n setBackfillEndDate('')\n setHardStop(false)\n }\n\n const handleBulkApproveDisapprove = (isApprove) => {\n if (!selectedProgram) {\n setSnackbar({ open: true, message: 'Please select a program', severity: 'warning' })\n return\n }\n\n setBulkUpdating(true)\n\n $.ajax({\n method: 'POST',\n url: '/root/care_center/bulk_update',\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n care_center_ids: rowSelectionModel,\n program: selectedProgram,\n active: isApprove.toString(),\n hard_stop: (!isApprove && hardStop).toString()\n }),\n })\n .done((response) => {\n const successCount = response.results.filter(r => r.success).length\n const failCount = response.results.filter(r => !r.success).length\n const actionWord = isApprove ? 'approved' : 'disapproved'\n const message = `Successfully ${actionWord} ${successCount} care center(s) for ${selectedProgram}` +\n (failCount > 0 ? `. ${failCount} failed.` : '')\n\n setSnackbar({ open: true, message, severity: failCount > 0 ? 'warning' : 'success' })\n fetchCareCenters()\n setRowSelectionModel([])\n handleCloseDialog()\n })\n .fail((error) => {\n const message = error.responseJSON?.error || `Bulk ${dialogAction} failed`\n setSnackbar({ open: true, message, severity: 'error' })\n })\n .always(() => setBulkUpdating(false))\n }\n\n const handleBackfillSubmit = () => {\n if (!backfillStartDate || !backfillEndDate) {\n setSnackbar({ open: true, message: 'Please select both start and end dates', severity: 'warning' })\n return\n }\n if (new Date(backfillStartDate) >= new Date(backfillEndDate)) {\n setSnackbar({ open: true, message: 'Start date must be before end date', severity: 'warning' })\n return\n }\n\n const startOfRange = calculateDayOffset(backfillStartDate)\n const endOfRange = calculateDayOffset(backfillEndDate)\n\n setBulkUpdating(true)\n\n $.ajax({\n method: 'POST',\n url: '/root/care_center/bulk_backfill_appointments',\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n care_center_ids: rowSelectionModel,\n start_of_range: startOfRange,\n end_of_range: endOfRange,\n }),\n })\n .done((response) => {\n const successCount = response.successfully_enqueued_care_centers?.length || 0\n const failCount = response.failed_care_centers?.length || 0\n const message = `Successfully queued backfill for ${successCount} care center(s)` +\n (failCount > 0 ? `. ${failCount} failed.` : '')\n\n setSnackbar({ open: true, message, severity: failCount > 0 ? 'warning' : 'success' })\n setRowSelectionModel([])\n handleCloseDialog()\n })\n .fail((error) => {\n const message = error.responseJSON?.error || 'Bulk backfill failed'\n setSnackbar({ open: true, message, severity: 'error' })\n })\n .always(() => setBulkUpdating(false))\n }\n\n const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }))\n\n const handleSelectionModelChange = useCallback((newSelection) => {\n setRowSelectionModel(newSelection)\n }, [])\n\n const isApproveAction = dialogAction === 'approve'\n\n return (\n \n {selectedCareCenter ? (\n
\n ) : (\n
\n {loading ? (\n
\n ) : (\n
\n {rowSelectionModel.length > 0 && (\n \n \n {rowSelectionModel.length} care center(s) selected\n \n \n \n \n \n )}\n\n row.id}\n autoHeight\n initialState={{\n pagination: { paginationModel: { pageSize: 50, page: 0 } },\n }}\n pageSizeOptions={[25, 50, 100]}\n checkboxSelection\n rowSelectionModel={rowSelectionModel}\n onRowSelectionModelChange={handleSelectionModelChange}\n disableRowSelectionOnClick\n keepNonExistentRowsSelected\n sx={{ '& *': { pointerEvents: 'auto !important' } }}\n />\n \n )}\n
\n )}\n\n {/* Approve / Disapprove Dialog */}\n
\n\n {/* Backfill Dialog */}\n
\n\n
\n \n {snackbar.message}\n \n \n
\n )\n}\n\nShowCareCenters.propTypes = propTypes\n\nexport default ShowCareCenters","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport TextField from '@mui/material/TextField'\nimport Button from '@mui/material/Button'\n\nconst propTypes = {\n organizations: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n id: PropTypes.number.isRequired,\n })\n ).isRequired\n}\n\nconst CreateCareCenter = ({ organizations }) => {\n const [name, setName] = useState('')\n const [phoneNumber, setPhoneNumber] = useState('')\n const [departmentIds, setDepartmentIds] = useState('')\n const [departmentKey, setDepartmentKey] = useState('')\n const [organization, setOrganization] = useState('')\n const [providerGroupingOptions, setProviderGroupingOptions] = useState([])\n const [providerGrouping, setProviderGrouping] = useState('')\n\n const handleOrganizationChange = (event, value) => {\n const organizationId = value ? value.id : ''\n setOrganization(organizationId)\n\n if (organizationId) {\n $.ajax({\n method: 'GET',\n url: '/root/provider_grouping_finder',\n data: { organization_id: organizationId }\n })\n .done((response) => {\n setProviderGroupingOptions(Array.isArray(response.provider_groupings) ? response.provider_groupings : [])\n })\n .fail((error) => {\n flash.error(`Error fetching Provider Groupings. ${error.responseJSON.error}`, 5000)\n console.error(error)\n })\n } else {\n setProviderGroupingOptions([])\n }\n }\n\n const handleSubmit = event => {\n event.preventDefault()\n const formData = new FormData()\n formData.append(\"name\", name)\n formData.append(\"phone_number\", phoneNumber)\n formData.append(\"organization_id\", organization)\n formData.append(\"department_ids\", departmentIds)\n formData.append('provider_grouping_id', providerGrouping)\n formData.append('department_key', departmentKey)\n\n $.ajax({\n method: 'POST',\n url: '/root/care_center/create',\n contentType: false,\n processData: false,\n data: formData,\n })\n .done(() => {\n flash.success('Care Center successfully Created', 50000)\n })\n .fail((error) => {\n flash.error(`Error creating your Care Center. ${error.responseJSON.error}`, 50000)\n console.error(error)\n })\n }\n \n return (\n \n );\n}\n\nCreateCareCenter.propTypes = propTypes\n\nexport default CreateCareCenter","\nimport React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport TextField from '@mui/material/TextField'\nimport Button from '@mui/material/Button'\nimport JsonEditorComponent from '../JsonEditorComponent'\n\nconst propTypes = {\n careCenter: PropTypes.shape({\n id: PropTypes.number.isRequired,\n name: PropTypes.string.isRequired,\n phoneNumber: PropTypes.string.isRequired,\n departmentIds: PropTypes.arrayOf(PropTypes.number).isRequired,\n approvals: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,\n organizationId: PropTypes.number.isRequired,\n providerGroupingId: PropTypes.number,\n departmentKey: PropTypes.string,\n }).isRequired,\n}\n\nconst EditCareCenter = ({ careCenter }) => {\n const [name, setName] = useState(careCenter.name)\n const [phoneNumber, setPhoneNumber] = useState(careCenter.phoneNumber)\n const [departmentIds, setDepartmentIds] = useState(careCenter.departmentIds)\n const [approvals, setApprovals] = useState(careCenter.approvals)\n const [departmentKey, setDepartmentKey] = useState(careCenter.departmentKey)\n const [providerGroupingId, setProviderGroupingId] = useState(careCenter.providerGroupingId)\n\n const handleApprovalsChange = (updatedJson) => {\n setApprovals(updatedJson)\n }\n\n const handleSubmit = event => {\n event.preventDefault()\n const formData = new FormData()\n formData.append(\"id\", careCenter.id)\n formData.append(\"name\", name)\n formData.append(\"phone_number\", phoneNumber)\n formData.append(\"department_ids\", departmentIds)\n formData.append(\"department_key\", departmentKey)\n formData.append(\"provider_grouping_id\", providerGroupingId)\n // Stringify the approvals JSON for submission\n formData.append(\"approvals\", typeof approvals === 'string' ? approvals : JSON.stringify(approvals))\n\n $.ajax({\n method: 'POST',\n url: `/root/care_center/update`,\n contentType: false,\n processData: false,\n data: formData,\n })\n .done(() => {\n flash.success(`Care Center id: ${careCenter.id} successfully updated`, 50000)\n setTimeout(() => {\n window.location.reload()\n }, 2000)\n })\n .fail((error) => {\n flash.error(`Error updating your Care Center id: ${careCenter.id}. ${error.responseJSON.error}`, 50000)\n console.error(error)\n })\n }\n\n return (\n \n )\n}\n\nEditCareCenter.propTypes = propTypes\n\nexport default EditCareCenter","import React, { useState } from 'react'\nimport log from '../../utilities/logger'\n\nconst FLASH_MESSAGE_TIMEOUT = 50000\n\nexport default function CareCenter() {\n const [file, setFile] = useState(undefined)\n const handleFileSelect = (event) => {\n setFile(event.target.files[0])\n }\n\n const handleFileSubmit = (event) => {\n const formData = new FormData()\n formData.append(\"file\", file)\n event.preventDefault()\n const call = { \n method: 'post',\n url: '/root/care_center/care_center_csv',\n contentType: false,\n processData: false,\n dataType: 'json',\n data: formData,\n enctype: 'multipart/form-data'\n }\n $.ajax(call)\n .done(() => {\n flash.success('Care Center csv successfully imported', FLASH_MESSAGE_TIMEOUT)\n })\n .fail((error) => {\n flash.error(`Error importing your care center. ${error.responseJSON?.errors}`, FLASH_MESSAGE_TIMEOUT)\n log({ title: 'Failed to import care center CSV', className: 'CareCenter', values: { status: error.status, response: error.responseJSON } })\n console.error(error)\n })\n }\n\n return (\n <>\n \n >\n )\n}","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z\"\n}), 'AttachFile');","\nimport React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Tabs, Tab, Box, Card, CardContent, Typography, Divider } from '@mui/material'\nimport EditNoteIcon from '@mui/icons-material/EditNote'\nimport AddBoxIcon from '@mui/icons-material/AddBox'\nimport AttachFileIcon from '@mui/icons-material/AttachFile'\nimport AssignmentIcon from '@mui/icons-material/Assignment'\nimport ShowCareCenters from './ShowCareCenters'\nimport CreateCareCenter from './createCareCenter'\nimport CareCenterImport from './import'\nimport CollectionUploader from '../collection/CollectionUploader'\n\n\nconst propTypes = {\n organizations: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n id: PropTypes.number.isRequired,\n })\n ).isRequired,\n programs: PropTypes.arrayOf(PropTypes.string).isRequired,\n}\n\nconst Dashboard = ({ organizations, programs }) => {\n const [activeTab, setActiveTab] = useState('viewEdit')\n\n const handleChange = (event, newValue) => {\n setActiveTab(newValue)\n }\n\n const renderContent = () => {\n switch (activeTab) {\n case 'viewEdit':\n return \n case 'create':\n return \n case 'import':\n return \n case 'collection':\n return (\n {\n console.log('Care Center collection upload successful:', result)\n }}\n onError={(error) => {\n console.error('Care Center collection upload failed:', error)\n }}\n />\n )\n default:\n return \n }\n }\n\n return (\n \n
\n \n Care Centers\n \n \n \n } iconPosition=\"start\" label=\"View/Edit\" value=\"viewEdit\" />\n } iconPosition=\"start\" label=\"Create Care Center\" value=\"create\" />\n } iconPosition=\"start\" label=\"Import\" value=\"import\" />\n } iconPosition=\"start\" label=\"Collection Upload\" value=\"collection\" />\n \n \n \n {renderContent()}\n \n \n \n
\n )\n}\n\nDashboard.propTypes = propTypes\n\nexport default Dashboard","import React, { useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport Checkbox from '@mui/material/Checkbox'\nimport Button from '@mui/material/Button'\nimport DeleteIcon from '@mui/icons-material/Delete'\n\nconst BulkActions = React.memo(({ selectedIds = [], totalCount = 0, onSelectAll, onBulkDelete }) => {\n const selectedCount = selectedIds.length\n const allSelected = totalCount > 0 && selectedCount === totalCount\n\n const handleBulkDelete = useCallback(() => {\n if (selectedCount === 0) { return }\n const confirmMessage = `Are you sure you want to delete ${selectedCount} selected collection${selectedCount > 1 ? 's' : ''}?`\n if (!window.confirm(confirmMessage)) { return }\n\n if (onBulkDelete) {\n onBulkDelete(selectedIds)\n } else {\n const csrfToken = document.querySelector('meta[name=\"csrf-token\"]')?.getAttribute('content')\n const form = document.createElement('form')\n form.method = 'POST'\n form.action = '/root/collection/bulk_delete'\n\n const methodInput = document.createElement('input')\n methodInput.type = 'hidden'\n methodInput.name = '_method'\n methodInput.value = 'DELETE'\n form.appendChild(methodInput)\n\n if (csrfToken) {\n const csrfInput = document.createElement('input')\n csrfInput.type = 'hidden'\n csrfInput.name = 'authenticity_token'\n csrfInput.value = csrfToken\n form.appendChild(csrfInput)\n }\n\n selectedIds.forEach(id => {\n const input = document.createElement('input')\n input.type = 'hidden'\n input.name = 'collection_ids[]'\n input.value = id\n form.appendChild(input)\n })\n\n document.body.appendChild(form)\n form.submit()\n }\n }, [selectedCount, selectedIds, onBulkDelete])\n\n return (\n 0 ? 'transparent' : 'divider',\n bgcolor: selectedCount > 0 ? 'action.hover' : 'transparent',\n borderRadius: 1\n }}\n >\n 0 && !allSelected}\n onChange={(e) => onSelectAll && onSelectAll(e.target.checked)}\n />\n }\n label={selectedCount > 0 ? `${selectedCount} selected` : 'Select All'}\n sx={{ m: 0 }}\n />\n\n {selectedCount > 0 && (\n }\n onClick={handleBulkDelete}\n >\n Delete Selected\n \n )}\n \n )\n})\n\nBulkActions.propTypes = {\n selectedIds: PropTypes.arrayOf(PropTypes.string),\n totalCount: PropTypes.number,\n onSelectAll: PropTypes.func,\n onBulkDelete: PropTypes.func\n}\n\nexport default BulkActions\n","import React, { useEffect, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport TextField from '@mui/material/TextField'\nimport MenuItem from '@mui/material/MenuItem'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport Checkbox from '@mui/material/Checkbox'\nimport Button from '@mui/material/Button'\nimport Alert from '@mui/material/Alert'\nimport Grid from '@mui/material/Grid'\n\nconst normalizeStatus = (value) => (value === 'OFF' ? 'OFF' : 'ACTIVE')\n\nconst buildInitialFormData = (collection) => ({\n name: collection?.name || '',\n category: collection?.category || '',\n entity_class: collection?.entity_class || '',\n entity_id: collection?.entity_id || '',\n details: typeof collection?.details === 'object' ? JSON.stringify(collection.details, null, 2) : (collection?.details || ''),\n subscription: collection?.subscription || false\n})\n\nconst buildScopeMessage = ({ isShadowRestricted, currentOrganizationName, currentOrganizationId }) => {\n if (!isShadowRestricted) {\n return 'Organization scope: root users can create collections for any organization.'\n }\n\n return `Organization scope: shadow users can only use the current organization (${currentOrganizationName || 'Current Organization'}${currentOrganizationId ? `, ID ${currentOrganizationId}` : ''}).`\n}\n\nconst FormErrorsAlert = ({ errorMessages }) => {\n if (errorMessages.length === 0) {\n return null\n }\n\n return (\n \n {errorMessages.map((msg, i) => {msg}
)}\n \n )\n}\n\nconst ScopeAlert = ({ isShadowRestricted, currentOrganizationName, currentOrganizationId }) => (\n \n {buildScopeMessage({ isShadowRestricted, currentOrganizationName, currentOrganizationId })}\n \n)\n\nconst CategoryField = ({ isEditing, isSubscription, formData, handleChange, localErrors }) => {\n if (isEditing) {\n return (\n \n )\n }\n\n return (\n \n )\n}\n\nconst NameField = ({ isSubscription, formData, handleChange, localErrors }) => {\n if (isSubscription) {\n return (\n \n \n \n \n )\n }\n\n return (\n \n )\n}\n\nconst EntityClassField = ({ isEditing, formData, handleChange, localErrors }) => {\n if (isEditing) {\n return \n }\n\n return (\n \n )\n}\n\nconst EntityIdField = ({ isEditing, formData, handleChange, localErrors, lockEntityIdToCurrentOrg }) => {\n if (isEditing) {\n return \n }\n\n return (\n \n )\n}\n\nconst DetailsField = ({ isEditing, formData, handleChange, localErrors }) => {\n if (isEditing) {\n return (\n \n )\n }\n\n return (\n \n )\n}\n\nconst CollectionForm = ({\n collection = null,\n entityClasses = [],\n collectionTypes = [],\n csrfToken = '',\n errors = {},\n accessScope = {}\n}) => {\n const isEditing = !!collection?.id\n\n const [formData, setFormData] = useState(buildInitialFormData(collection))\n const [localErrors, setLocalErrors] = useState(errors)\n const isShadowRestricted = accessScope?.shadowRestricted === true\n const currentOrganizationId = accessScope?.currentOrganizationId\n const currentOrganizationName = accessScope?.currentOrganizationName\n const isOrganizationEntity = formData.entity_class === 'Organization'\n const lockEntityIdToCurrentOrg = !isEditing && isShadowRestricted && isOrganizationEntity\n\n useEffect(() => {\n if (lockEntityIdToCurrentOrg && currentOrganizationId) {\n setFormData(prev => ({ ...prev, entity_id: String(currentOrganizationId) }))\n }\n }, [lockEntityIdToCurrentOrg, currentOrganizationId])\n\n const isSubscription = formData.subscription === true\n\n const handleChange = (e) => {\n const { name, value, type, checked } = e.target\n const key = name.match(/^collection\\[(.+)\\]$/)?.[1] || name\n const val = type === 'checkbox' ? checked : value\n setFormData(prev => ({ ...prev, [key]: val }))\n if (localErrors[key]) { setLocalErrors(prev => ({ ...prev, [key]: null })) }\n }\n\n const handleSubscriptionChange = (e) => {\n const checked = e.target.checked\n setFormData(prev => ({\n ...prev,\n subscription: checked,\n name: checked ? normalizeStatus(prev.name) : prev.name\n }))\n }\n\n const actionUrl = isEditing ? `/root/collection/${collection.id}` : '/root/collection'\n const errorMessages = Object.values(localErrors).filter(Boolean).flat()\n\n return (\n \n \n \n \n {isEditing ? 'Edit Collection' : 'Add New Collection'}\n \n\n \n\n \n\n \n \n {isEditing && }\n\n \n \n \n \n\n \n \n \n\n \n \n \n }\n label=\"Subscription\"\n />\n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n \n \n \n \n \n \n )\n}\n\nCollectionForm.propTypes = {\n collection: PropTypes.shape({\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n name: PropTypes.string,\n category: PropTypes.string,\n entity_class: PropTypes.string,\n entity_id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n details: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n subscription: PropTypes.bool\n }),\n entityClasses: PropTypes.array,\n collectionTypes: PropTypes.array,\n csrfToken: PropTypes.string,\n errors: PropTypes.object,\n accessScope: PropTypes.shape({\n isRoot: PropTypes.bool,\n shadowRestricted: PropTypes.bool,\n currentOrganizationId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n currentOrganizationName: PropTypes.string\n })\n}\n\nexport default CollectionForm\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z\"\n}), 'ArrowBack');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z\"\n}), 'Info');","import React, { useState, useEffect, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport Button from '@mui/material/Button'\nimport Alert from '@mui/material/Alert'\nimport TextField from '@mui/material/TextField'\nimport MenuItem from '@mui/material/MenuItem'\nimport Grid from '@mui/material/Grid'\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport Chip from '@mui/material/Chip'\nimport CircularProgress from '@mui/material/CircularProgress'\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack'\nimport CloudUploadIcon from '@mui/icons-material/CloudUpload'\nimport InfoIcon from '@mui/icons-material/Info'\nimport UploadFileIcon from '@mui/icons-material/UploadFile'\n\nconst JSON_MIME_TYPE = 'application/json'\n\nconst buildColumnComments = (commentsArray) => {\n const commentsObj = {}\n if (!Array.isArray(commentsArray)) {\n return commentsObj\n }\n\n commentsArray.forEach((item) => {\n if (item.csv_column && item.comment) {\n commentsObj[item.csv_column] = item.comment\n }\n })\n\n return commentsObj\n}\n\nconst validateImportInputs = ({ selectedEntityType, selectedFile }) => {\n if (!selectedEntityType) {\n return 'Please select an entity type.'\n }\n if (!selectedFile) {\n return 'Please select a CSV file.'\n }\n return null\n}\n\nconst buildImportFormData = ({ csrfToken, selectedEntityType, selectedFile }) => {\n const formData = new FormData()\n formData.append('authenticity_token', csrfToken)\n formData.append('entity_type', selectedEntityType)\n formData.append('csv_file', selectedFile)\n return formData\n}\n\nconst parseImportResponse = async (response) => {\n const isJson = response.headers.get('content-type')?.includes(JSON_MIME_TYPE)\n if (isJson) {\n return response.json()\n }\n\n return { type: 'error', message: `Unexpected response (${response.status})` }\n}\n\nconst buildImportResult = ({ response, data }) => {\n if (response.ok && data.success) {\n return { type: data.type || 'success', message: data.message || 'Import completed.' }\n }\n\n return {\n type: data.type || 'error',\n message: data.message || data.error || data.errors || `Import failed (${response.status}).`\n }\n}\n\nconst CollectionImport = ({\n supportedTypes = [],\n typesWithCsvColumns = {},\n typesWithColumnComments = {},\n csrfToken = '',\n accessScope = {}\n}) => {\n const [selectedEntityType, setSelectedEntityType] = useState('')\n const [selectedFile, setSelectedFile] = useState(null)\n const [requiredColumns, setRequiredColumns] = useState([])\n const [columnComments, setColumnComments] = useState({})\n const [isSubmitting, setIsSubmitting] = useState(false)\n const [importResult, setImportResult] = useState(null)\n const fileInputRef = useRef(null)\n const isShadowRestricted = accessScope?.shadowRestricted === true\n const currentOrganizationId = accessScope?.currentOrganizationId\n const currentOrganizationName = accessScope?.currentOrganizationName\n\n useEffect(() => {\n if (selectedEntityType && typesWithCsvColumns[selectedEntityType]) {\n setRequiredColumns(typesWithCsvColumns[selectedEntityType])\n const commentsArray = typesWithColumnComments[selectedEntityType] || []\n setColumnComments(buildColumnComments(commentsArray))\n } else {\n setRequiredColumns([])\n setColumnComments({})\n }\n }, [selectedEntityType, typesWithCsvColumns, typesWithColumnComments])\n\n const handleSubmit = async (e) => {\n e.preventDefault()\n setImportResult(null)\n\n const validationMessage = validateImportInputs({ selectedEntityType, selectedFile })\n if (validationMessage) {\n setImportResult({ type: 'error', message: validationMessage })\n return\n }\n\n setIsSubmitting(true)\n\n try {\n const formData = buildImportFormData({ csrfToken, selectedEntityType, selectedFile })\n\n const response = await fetch('/root/collection/process_import.json', {\n method: 'POST',\n body: formData,\n credentials: 'same-origin',\n headers: { Accept: JSON_MIME_TYPE, 'X-Requested-With': 'XMLHttpRequest' }\n })\n\n const data = await parseImportResponse(response)\n setImportResult(buildImportResult({ response, data }))\n } catch (error) {\n setImportResult({ type: 'error', message: `Error importing CSV: ${error.message}` })\n } finally {\n setIsSubmitting(false)\n }\n }\n\n const resultSeverity = (type) => {\n if (type === 'success') { return 'success' }\n if (type === 'warning') { return 'warning' }\n return 'error'\n }\n\n return (\n \n \n } href=\"/root/collection\" color=\"inherit\">\n Back to Collections\n \n Import Collections from CSV\n \n\n \n {/* Import Form */}\n \n \n \n \n CSV Import Configuration\n \n\n {importResult && (\n \n {importResult.message}\n \n )}\n\n \n {isShadowRestricted\n ? `Organization scope: imports are restricted to your current organization (${currentOrganizationName || 'Current Organization'}${currentOrganizationId ? `, ID ${currentOrganizationId}` : ''}). Organization IDs in CSV are ignored for lookups.`\n : 'Organization scope: root users can import across all organizations and use organization IDs from CSV.'}\n \n\n \n \n {/* Entity Type */}\n \n setSelectedEntityType(e.target.value)}\n >\n \n {supportedTypes.map(type => (\n \n ))}\n \n \n\n {/* File Input */}\n \n }\n fullWidth\n >\n {selectedFile ? selectedFile.name : 'Choose CSV File'}\n setSelectedFile(e.target.files[0] || null)}\n />\n \n \n\n {/* Required Columns */}\n {requiredColumns.length > 0 && (\n \n \n Required Columns\n \n Your CSV must contain the following columns (in any order):\n \n \n {requiredColumns.map((col, i) => (\n \n \n {columnComments[col] && (\n — {columnComments[col]}\n )}\n \n ))}\n
\n \n \n )}\n\n {/* Submit */}\n \n : null}\n >\n {isSubmitting ? 'Importing...' : 'Import CSV'}\n \n \n \n \n \n \n \n \n\n {/* Instructions */}\n \n \n \n \n Import Instructions\n \n \n {[\n ['Choose Entity Type', 'Select the type of entities you\\'re importing'],\n ['CSV Format', 'File must be in CSV format with headers'],\n ['Required Columns', 'Column names will be shown after selecting entity type'],\n ['Data Validation', 'Invalid rows will be skipped with error messages']\n ].map(([title, desc]) => (\n \n {title}\n {desc}\n \n ))}\n
\n \n \n \n \n \n )\n}\n\nCollectionImport.propTypes = {\n supportedTypes: PropTypes.array,\n typesWithCsvColumns: PropTypes.object,\n typesWithColumnComments: PropTypes.object,\n csrfToken: PropTypes.string,\n accessScope: PropTypes.shape({\n isRoot: PropTypes.bool,\n shadowRestricted: PropTypes.bool,\n currentOrganizationId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n currentOrganizationName: PropTypes.string\n })\n}\n\nexport default CollectionImport\n","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getPaginationUtilityClass(slot) {\n return generateUtilityClass('MuiPagination', slot);\n}\nconst paginationClasses = generateUtilityClasses('MuiPagination', ['root', 'ul', 'outlined', 'text']);\nexport default paginationClasses;","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getPaginationItemUtilityClass(slot) {\n return generateUtilityClass('MuiPaginationItem', slot);\n}\nconst paginationItemClasses = generateUtilityClasses('MuiPaginationItem', ['root', 'page', 'sizeSmall', 'sizeLarge', 'text', 'textPrimary', 'textSecondary', 'outlined', 'outlinedPrimary', 'outlinedSecondary', 'rounded', 'ellipsis', 'firstLast', 'previousNext', 'focusVisible', 'disabled', 'selected', 'icon', 'colorPrimary', 'colorSecondary']);\nexport default paginationItemClasses;","'use client';\n\nimport * as React from 'react';\nimport createSvgIcon from \"../../utils/createSvgIcon.js\";\n\n/**\n * @ignore - internal component.\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"\n}), 'NavigateBefore');","'use client';\n\nimport * as React from 'react';\nimport createSvgIcon from \"../../utils/createSvgIcon.js\";\n\n/**\n * @ignore - internal component.\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"\n}), 'NavigateNext');","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { alpha } from '@mui/system/colorManipulator';\nimport { useRtl } from '@mui/system/RtlProvider';\nimport paginationItemClasses, { getPaginationItemUtilityClass } from \"./paginationItemClasses.js\";\nimport ButtonBase from \"../ButtonBase/index.js\";\nimport capitalize from \"../utils/capitalize.js\";\nimport createSimplePaletteValueFilter from \"../utils/createSimplePaletteValueFilter.js\";\nimport FirstPageIcon from \"../internal/svg-icons/FirstPage.js\";\nimport LastPageIcon from \"../internal/svg-icons/LastPage.js\";\nimport NavigateBeforeIcon from \"../internal/svg-icons/NavigateBefore.js\";\nimport NavigateNextIcon from \"../internal/svg-icons/NavigateNext.js\";\nimport useSlot from \"../utils/useSlot.js\";\nimport { styled } from \"../zero-styled/index.js\";\nimport memoTheme from \"../utils/memoTheme.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst overridesResolver = (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, styles[ownerState.variant], styles[`size${capitalize(ownerState.size)}`], ownerState.variant === 'text' && styles[`text${capitalize(ownerState.color)}`], ownerState.variant === 'outlined' && styles[`outlined${capitalize(ownerState.color)}`], ownerState.shape === 'rounded' && styles.rounded, ownerState.type === 'page' && styles.page, (ownerState.type === 'start-ellipsis' || ownerState.type === 'end-ellipsis') && styles.ellipsis, (ownerState.type === 'previous' || ownerState.type === 'next') && styles.previousNext, (ownerState.type === 'first' || ownerState.type === 'last') && styles.firstLast];\n};\nconst useUtilityClasses = ownerState => {\n const {\n classes,\n color,\n disabled,\n selected,\n size,\n shape,\n type,\n variant\n } = ownerState;\n const slots = {\n root: ['root', `size${capitalize(size)}`, variant, shape, color !== 'standard' && `color${capitalize(color)}`, color !== 'standard' && `${variant}${capitalize(color)}`, disabled && 'disabled', selected && 'selected', {\n page: 'page',\n first: 'firstLast',\n last: 'firstLast',\n 'start-ellipsis': 'ellipsis',\n 'end-ellipsis': 'ellipsis',\n previous: 'previousNext',\n next: 'previousNext'\n }[type]],\n icon: ['icon']\n };\n return composeClasses(slots, getPaginationItemUtilityClass, classes);\n};\nconst PaginationItemEllipsis = styled('div', {\n name: 'MuiPaginationItem',\n slot: 'Root',\n overridesResolver\n})(memoTheme(({\n theme\n}) => ({\n ...theme.typography.body2,\n borderRadius: 32 / 2,\n textAlign: 'center',\n boxSizing: 'border-box',\n minWidth: 32,\n padding: '0 6px',\n margin: '0 3px',\n color: (theme.vars || theme).palette.text.primary,\n height: 'auto',\n [`&.${paginationItemClasses.disabled}`]: {\n opacity: (theme.vars || theme).palette.action.disabledOpacity\n },\n variants: [{\n props: {\n size: 'small'\n },\n style: {\n minWidth: 26,\n borderRadius: 26 / 2,\n margin: '0 1px',\n padding: '0 4px'\n }\n }, {\n props: {\n size: 'large'\n },\n style: {\n minWidth: 40,\n borderRadius: 40 / 2,\n padding: '0 10px',\n fontSize: theme.typography.pxToRem(15)\n }\n }]\n})));\nconst PaginationItemPage = styled(ButtonBase, {\n name: 'MuiPaginationItem',\n slot: 'Root',\n overridesResolver\n})(memoTheme(({\n theme\n}) => ({\n ...theme.typography.body2,\n borderRadius: 32 / 2,\n textAlign: 'center',\n boxSizing: 'border-box',\n minWidth: 32,\n height: 32,\n padding: '0 6px',\n margin: '0 3px',\n color: (theme.vars || theme).palette.text.primary,\n [`&.${paginationItemClasses.focusVisible}`]: {\n backgroundColor: (theme.vars || theme).palette.action.focus\n },\n [`&.${paginationItemClasses.disabled}`]: {\n opacity: (theme.vars || theme).palette.action.disabledOpacity\n },\n transition: theme.transitions.create(['color', 'background-color'], {\n duration: theme.transitions.duration.short\n }),\n '&:hover': {\n backgroundColor: (theme.vars || theme).palette.action.hover,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: 'transparent'\n }\n },\n [`&.${paginationItemClasses.selected}`]: {\n backgroundColor: (theme.vars || theme).palette.action.selected,\n '&:hover': {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.selectedChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : alpha(theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: (theme.vars || theme).palette.action.selected\n }\n },\n [`&.${paginationItemClasses.focusVisible}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.selectedChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : alpha(theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity)\n },\n [`&.${paginationItemClasses.disabled}`]: {\n opacity: 1,\n color: (theme.vars || theme).palette.action.disabled,\n backgroundColor: (theme.vars || theme).palette.action.selected\n }\n },\n variants: [{\n props: {\n size: 'small'\n },\n style: {\n minWidth: 26,\n height: 26,\n borderRadius: 26 / 2,\n margin: '0 1px',\n padding: '0 4px'\n }\n }, {\n props: {\n size: 'large'\n },\n style: {\n minWidth: 40,\n height: 40,\n borderRadius: 40 / 2,\n padding: '0 10px',\n fontSize: theme.typography.pxToRem(15)\n }\n }, {\n props: {\n shape: 'rounded'\n },\n style: {\n borderRadius: (theme.vars || theme).shape.borderRadius\n }\n }, {\n props: {\n variant: 'outlined'\n },\n style: {\n border: theme.vars ? `1px solid rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : `1px solid ${theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'}`,\n [`&.${paginationItemClasses.selected}`]: {\n [`&.${paginationItemClasses.disabled}`]: {\n borderColor: (theme.vars || theme).palette.action.disabledBackground,\n color: (theme.vars || theme).palette.action.disabled\n }\n }\n }\n }, {\n props: {\n variant: 'text'\n },\n style: {\n [`&.${paginationItemClasses.selected}`]: {\n [`&.${paginationItemClasses.disabled}`]: {\n color: (theme.vars || theme).palette.action.disabled\n }\n }\n }\n }, ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter(['dark', 'contrastText'])).map(([color]) => ({\n props: {\n variant: 'text',\n color\n },\n style: {\n [`&.${paginationItemClasses.selected}`]: {\n color: (theme.vars || theme).palette[color].contrastText,\n backgroundColor: (theme.vars || theme).palette[color].main,\n '&:hover': {\n backgroundColor: (theme.vars || theme).palette[color].dark,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: (theme.vars || theme).palette[color].main\n }\n },\n [`&.${paginationItemClasses.focusVisible}`]: {\n backgroundColor: (theme.vars || theme).palette[color].dark\n },\n [`&.${paginationItemClasses.disabled}`]: {\n color: (theme.vars || theme).palette.action.disabled\n }\n }\n }\n })), ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter(['light'])).map(([color]) => ({\n props: {\n variant: 'outlined',\n color\n },\n style: {\n [`&.${paginationItemClasses.selected}`]: {\n color: (theme.vars || theme).palette[color].main,\n border: `1px solid ${theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / 0.5)` : alpha(theme.palette[color].main, 0.5)}`,\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.activatedOpacity})` : alpha(theme.palette[color].main, theme.palette.action.activatedOpacity),\n '&:hover': {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / calc(${theme.vars.palette.action.activatedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : alpha(theme.palette[color].main, theme.palette.action.activatedOpacity + theme.palette.action.focusOpacity),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: 'transparent'\n }\n },\n [`&.${paginationItemClasses.focusVisible}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / calc(${theme.vars.palette.action.activatedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : alpha(theme.palette[color].main, theme.palette.action.activatedOpacity + theme.palette.action.focusOpacity)\n }\n }\n }\n }))]\n})));\nconst PaginationItemPageIcon = styled('div', {\n name: 'MuiPaginationItem',\n slot: 'Icon',\n overridesResolver: (props, styles) => styles.icon\n})(memoTheme(({\n theme\n}) => ({\n fontSize: theme.typography.pxToRem(20),\n margin: '0 -8px',\n variants: [{\n props: {\n size: 'small'\n },\n style: {\n fontSize: theme.typography.pxToRem(18)\n }\n }, {\n props: {\n size: 'large'\n },\n style: {\n fontSize: theme.typography.pxToRem(22)\n }\n }]\n})));\nconst PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiPaginationItem'\n });\n const {\n className,\n color = 'standard',\n component,\n components = {},\n disabled = false,\n page,\n selected = false,\n shape = 'circular',\n size = 'medium',\n slots = {},\n slotProps = {},\n type = 'page',\n variant = 'text',\n ...other\n } = props;\n const ownerState = {\n ...props,\n color,\n disabled,\n selected,\n shape,\n size,\n type,\n variant\n };\n const isRtl = useRtl();\n const classes = useUtilityClasses(ownerState);\n const externalForwardedProps = {\n slots: {\n previous: slots.previous ?? components.previous,\n next: slots.next ?? components.next,\n first: slots.first ?? components.first,\n last: slots.last ?? components.last\n },\n slotProps\n };\n const [PreviousSlot, previousSlotProps] = useSlot('previous', {\n elementType: NavigateBeforeIcon,\n externalForwardedProps,\n ownerState\n });\n const [NextSlot, nextSlotProps] = useSlot('next', {\n elementType: NavigateNextIcon,\n externalForwardedProps,\n ownerState\n });\n const [FirstSlot, firstSlotProps] = useSlot('first', {\n elementType: FirstPageIcon,\n externalForwardedProps,\n ownerState\n });\n const [LastSlot, lastSlotProps] = useSlot('last', {\n elementType: LastPageIcon,\n externalForwardedProps,\n ownerState\n });\n const rtlAwareType = isRtl ? {\n previous: 'next',\n next: 'previous',\n first: 'last',\n last: 'first'\n }[type] : type;\n const IconSlot = {\n previous: PreviousSlot,\n next: NextSlot,\n first: FirstSlot,\n last: LastSlot\n }[rtlAwareType];\n const iconSlotProps = {\n previous: previousSlotProps,\n next: nextSlotProps,\n first: firstSlotProps,\n last: lastSlotProps\n }[rtlAwareType];\n return type === 'start-ellipsis' || type === 'end-ellipsis' ? /*#__PURE__*/_jsx(PaginationItemEllipsis, {\n ref: ref,\n ownerState: ownerState,\n className: clsx(classes.root, className),\n children: \"\\u2026\"\n }) : /*#__PURE__*/_jsxs(PaginationItemPage, {\n ref: ref,\n ownerState: ownerState,\n component: component,\n disabled: disabled,\n className: clsx(classes.root, className),\n ...other,\n children: [type === 'page' && page, IconSlot ? /*#__PURE__*/_jsx(PaginationItemPageIcon, {\n ...iconSlotProps,\n className: classes.icon,\n as: IconSlot\n }) : null]\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? PaginationItem.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * @ignore\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The active color.\n * It supports both default and custom theme colors, which can be added as shown in the\n * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).\n * @default 'standard'\n */\n color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'standard']), PropTypes.string]),\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * The components used for each slot inside.\n *\n * This prop is an alias for the `slots` prop.\n * It's recommended to use the `slots` prop instead.\n *\n * @default {}\n * @deprecated use the `slots` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.\n */\n components: PropTypes.shape({\n first: PropTypes.elementType,\n last: PropTypes.elementType,\n next: PropTypes.elementType,\n previous: PropTypes.elementType\n }),\n /**\n * If `true`, the component is disabled.\n * @default false\n */\n disabled: PropTypes.bool,\n /**\n * The current page number.\n */\n page: PropTypes.node,\n /**\n * If `true` the pagination item is selected.\n * @default false\n */\n selected: PropTypes.bool,\n /**\n * The shape of the pagination item.\n * @default 'circular'\n */\n shape: PropTypes.oneOf(['circular', 'rounded']),\n /**\n * The size of the component.\n * @default 'medium'\n */\n size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),\n /**\n * The props used for each slot inside.\n * @default {}\n */\n slotProps: PropTypes.shape({\n first: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n last: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n next: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n previous: PropTypes.oneOfType([PropTypes.func, PropTypes.object])\n }),\n /**\n * The components used for each slot inside.\n * @default {}\n */\n slots: PropTypes.shape({\n first: PropTypes.elementType,\n last: PropTypes.elementType,\n next: PropTypes.elementType,\n previous: PropTypes.elementType\n }),\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n /**\n * The type of pagination item.\n * @default 'page'\n */\n type: PropTypes.oneOf(['end-ellipsis', 'first', 'last', 'next', 'page', 'previous', 'start-ellipsis']),\n /**\n * The variant to use.\n * @default 'text'\n */\n variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['outlined', 'text']), PropTypes.string])\n} : void 0;\nexport default PaginationItem;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport integerPropType from '@mui/utils/integerPropType';\nimport { getPaginationUtilityClass } from \"./paginationClasses.js\";\nimport usePagination from \"../usePagination/index.js\";\nimport PaginationItem from \"../PaginationItem/index.js\";\nimport { styled } from \"../zero-styled/index.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n classes,\n variant\n } = ownerState;\n const slots = {\n root: ['root', variant],\n ul: ['ul']\n };\n return composeClasses(slots, getPaginationUtilityClass, classes);\n};\nconst PaginationRoot = styled('nav', {\n name: 'MuiPagination',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, styles[ownerState.variant]];\n }\n})({});\nconst PaginationUl = styled('ul', {\n name: 'MuiPagination',\n slot: 'Ul',\n overridesResolver: (props, styles) => styles.ul\n})({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n padding: 0,\n margin: 0,\n listStyle: 'none'\n});\nfunction defaultGetAriaLabel(type, page, selected) {\n if (type === 'page') {\n return `${selected ? '' : 'Go to '}page ${page}`;\n }\n return `Go to ${type} page`;\n}\nconst Pagination = /*#__PURE__*/React.forwardRef(function Pagination(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiPagination'\n });\n const {\n boundaryCount = 1,\n className,\n color = 'standard',\n count = 1,\n defaultPage = 1,\n disabled = false,\n getItemAriaLabel = defaultGetAriaLabel,\n hideNextButton = false,\n hidePrevButton = false,\n onChange,\n page,\n renderItem = item => /*#__PURE__*/_jsx(PaginationItem, {\n ...item\n }),\n shape = 'circular',\n showFirstButton = false,\n showLastButton = false,\n siblingCount = 1,\n size = 'medium',\n variant = 'text',\n ...other\n } = props;\n const {\n items\n } = usePagination({\n ...props,\n componentName: 'Pagination'\n });\n const ownerState = {\n ...props,\n boundaryCount,\n color,\n count,\n defaultPage,\n disabled,\n getItemAriaLabel,\n hideNextButton,\n hidePrevButton,\n renderItem,\n shape,\n showFirstButton,\n showLastButton,\n siblingCount,\n size,\n variant\n };\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(PaginationRoot, {\n \"aria-label\": \"pagination navigation\",\n className: clsx(classes.root, className),\n ownerState: ownerState,\n ref: ref,\n ...other,\n children: /*#__PURE__*/_jsx(PaginationUl, {\n className: classes.ul,\n ownerState: ownerState,\n children: items.map((item, index) => /*#__PURE__*/_jsx(\"li\", {\n children: renderItem({\n ...item,\n color,\n 'aria-label': getItemAriaLabel(item.type, item.page, item.selected),\n shape,\n size,\n variant\n })\n }, index))\n })\n });\n});\n\n// @default tags synced with default values from usePagination\n\nprocess.env.NODE_ENV !== \"production\" ? Pagination.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * Number of always visible pages at the beginning and end.\n * @default 1\n */\n boundaryCount: integerPropType,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The active color.\n * It supports both default and custom theme colors, which can be added as shown in the\n * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).\n * @default 'standard'\n */\n color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'standard']), PropTypes.string]),\n /**\n * The total number of pages.\n * @default 1\n */\n count: integerPropType,\n /**\n * The page selected by default when the component is uncontrolled.\n * @default 1\n */\n defaultPage: integerPropType,\n /**\n * If `true`, the component is disabled.\n * @default false\n */\n disabled: PropTypes.bool,\n /**\n * Accepts a function which returns a string value that provides a user-friendly name for the current page.\n * This is important for screen reader users.\n *\n * For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).\n * @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.\n * @param {number | null} page The page number to format.\n * @param {boolean} selected If true, the current page is selected.\n * @returns {string}\n */\n getItemAriaLabel: PropTypes.func,\n /**\n * If `true`, hide the next-page button.\n * @default false\n */\n hideNextButton: PropTypes.bool,\n /**\n * If `true`, hide the previous-page button.\n * @default false\n */\n hidePrevButton: PropTypes.bool,\n /**\n * Callback fired when the page is changed.\n *\n * @param {React.ChangeEvent} event The event source of the callback.\n * @param {number} page The page selected.\n */\n onChange: PropTypes.func,\n /**\n * The current page. Unlike `TablePagination`, which starts numbering from `0`, this pagination starts from `1`.\n */\n page: integerPropType,\n /**\n * Render the item.\n * @param {PaginationRenderItemParams} params The props to spread on a PaginationItem.\n * @returns {ReactNode}\n * @default (item) => \n */\n renderItem: PropTypes.func,\n /**\n * The shape of the pagination items.\n * @default 'circular'\n */\n shape: PropTypes.oneOf(['circular', 'rounded']),\n /**\n * If `true`, show the first-page button.\n * @default false\n */\n showFirstButton: PropTypes.bool,\n /**\n * If `true`, show the last-page button.\n * @default false\n */\n showLastButton: PropTypes.bool,\n /**\n * Number of always visible pages before and after the current page.\n * @default 1\n */\n siblingCount: integerPropType,\n /**\n * The size of the component.\n * @default 'medium'\n */\n size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n /**\n * The variant to use.\n * @default 'text'\n */\n variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['outlined', 'text']), PropTypes.string])\n} : void 0;\nexport default Pagination;","'use client';\n\nimport useControlled from '@mui/utils/useControlled';\nexport default function usePagination(props = {}) {\n // keep default values in sync with @default tags in Pagination.propTypes\n const {\n boundaryCount = 1,\n componentName = 'usePagination',\n count = 1,\n defaultPage = 1,\n disabled = false,\n hideNextButton = false,\n hidePrevButton = false,\n onChange: handleChange,\n page: pageProp,\n showFirstButton = false,\n showLastButton = false,\n siblingCount = 1,\n ...other\n } = props;\n const [page, setPageState] = useControlled({\n controlled: pageProp,\n default: defaultPage,\n name: componentName,\n state: 'page'\n });\n const handleClick = (event, value) => {\n if (!pageProp) {\n setPageState(value);\n }\n if (handleChange) {\n handleChange(event, value);\n }\n };\n\n // https://dev.to/namirsab/comment/2050\n const range = (start, end) => {\n const length = end - start + 1;\n return Array.from({\n length\n }, (_, i) => start + i);\n };\n const startPages = range(1, Math.min(boundaryCount, count));\n const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);\n const siblingsStart = Math.max(Math.min(\n // Natural start\n page - siblingCount,\n // Lower boundary when page is high\n count - boundaryCount - siblingCount * 2 - 1),\n // Greater than startPages\n boundaryCount + 2);\n const siblingsEnd = Math.min(Math.max(\n // Natural end\n page + siblingCount,\n // Upper boundary when page is low\n boundaryCount + siblingCount * 2 + 2),\n // Less than endPages\n count - boundaryCount - 1);\n\n // Basic list of items to render\n // for example itemList = ['first', 'previous', 1, 'ellipsis', 4, 5, 6, 'ellipsis', 10, 'next', 'last']\n const itemList = [...(showFirstButton ? ['first'] : []), ...(hidePrevButton ? [] : ['previous']), ...startPages,\n // Start ellipsis\n // eslint-disable-next-line no-nested-ternary\n ...(siblingsStart > boundaryCount + 2 ? ['start-ellipsis'] : boundaryCount + 1 < count - boundaryCount ? [boundaryCount + 1] : []),\n // Sibling pages\n ...range(siblingsStart, siblingsEnd),\n // End ellipsis\n // eslint-disable-next-line no-nested-ternary\n ...(siblingsEnd < count - boundaryCount - 1 ? ['end-ellipsis'] : count - boundaryCount > boundaryCount ? [count - boundaryCount] : []), ...endPages, ...(hideNextButton ? [] : ['next']), ...(showLastButton ? ['last'] : [])];\n\n // Map the button type to its page number\n const buttonPage = type => {\n switch (type) {\n case 'first':\n return 1;\n case 'previous':\n return page - 1;\n case 'next':\n return page + 1;\n case 'last':\n return count;\n default:\n return null;\n }\n };\n\n // Convert the basic item list to PaginationItem props objects\n const items = itemList.map(item => {\n return typeof item === 'number' ? {\n onClick: event => {\n handleClick(event, item);\n },\n type: 'page',\n page: item,\n selected: item === page,\n disabled,\n 'aria-current': item === page ? 'page' : undefined\n } : {\n onClick: event => {\n handleClick(event, buttonPage(item));\n },\n type: item,\n page: buttonPage(item),\n selected: false,\n disabled: disabled || !item.includes('ellipsis') && (item === 'next' || item === 'last' ? page >= count : page <= 1)\n };\n });\n return {\n items,\n ...other\n };\n}","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z\"\n}), 'Upload');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z\"\n}), 'Download');","import React, { useState, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport Button from '@mui/material/Button'\nimport Alert from '@mui/material/Alert'\nimport Pagination from '@mui/material/Pagination'\nimport AddIcon from '@mui/icons-material/Add'\nimport UploadIcon from '@mui/icons-material/Upload'\nimport DownloadIcon from '@mui/icons-material/Download'\nimport SearchAndFilters from './SearchAndFilters'\nimport BulkActions from './BulkActions'\nimport CollectionsTable from './CollectionsTable'\n\nconst JSON_MIME_TYPE = 'application/json'\n\nconst buildCollectionsParams = ({ filters, pageNumber, perPage, showSubscriptionFilter, isShadowRestricted }) => {\n const params = new URLSearchParams({ format: 'json', page: String(pageNumber), per_page: String(perPage) })\n if (filters.search?.length >= 1) {\n params.append('search', filters.search)\n }\n if (filters.typeFilter) {\n params.append('filter_type', filters.typeFilter)\n }\n if (filters.entityFilter) {\n params.append('filter_entity_class', filters.entityFilter)\n }\n if (showSubscriptionFilter && filters.subscriptionFilter) {\n params.append('filter_subscription', filters.subscriptionFilter)\n } else if (isShadowRestricted) {\n params.append('filter_subscription', 'subscriptions')\n } else {\n // Intentionally omit filter_subscription for the unfiltered root view.\n }\n return params\n}\n\nconst requestCollections = async (params, signal) => {\n const response = await fetch(`/root/collection?${params}`, {\n headers: { Accept: JSON_MIME_TYPE, 'X-Requested-With': 'XMLHttpRequest' },\n credentials: 'same-origin',\n signal\n })\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}`)\n }\n return response.json()\n}\n\nconst clearLoading = (setLoading) => {\n if (setLoading) {\n setLoading(false)\n }\n}\n\nconst startLoading = (setLoading) => {\n if (setLoading) {\n setLoading(true)\n }\n}\n\nconst buildScopeMessage = ({ isShadowRestricted, currentOrganizationName, currentOrganizationId }) => {\n if (isShadowRestricted) {\n return `Organization scope: shadow users can only access collections for ${currentOrganizationName || 'Current Organization'}${currentOrganizationId ? ` (ID ${currentOrganizationId})` : ''}.`\n }\n\n return 'Organization scope: root users can access collections across all organizations.'\n}\n\nconst scopeAlertSeverity = (isShadowRestricted) => {\n if (isShadowRestricted) {\n return 'info'\n }\n\n return 'success'\n}\n\nconst initialSubscriptionValue = ({ isShadowRestricted, initialSubscriptionFilter }) => {\n if (isShadowRestricted) {\n return 'subscriptions'\n }\n\n return initialSubscriptionFilter\n}\n\nconst renderFeedbackAlert = (feedback) => {\n if (!feedback) {\n return null\n }\n\n return (\n \n {feedback.message}\n \n )\n}\n\nconst renderPagination = ({ totalPages, page, onChange }) => {\n if (totalPages <= 1) {\n return null\n }\n\n return (\n \n \n \n )\n}\n\nconst CollectionIndex = ({\n initialCollections = [],\n collectionTypes = [],\n entityClasses = [],\n initialSearch = '',\n initialTypeFilter = '',\n initialEntityFilter = '',\n initialSubscriptionFilter = '',\n filteredCount = 0,\n totalCount = 0,\n page = 1,\n perPage = 25,\n totalPages = 1,\n accessScope = {}\n}) => {\n const [selectedIds, setSelectedIds] = useState([])\n const [tableCollections, setTableCollections] = useState(initialCollections)\n const [filterOptions, setFilterOptions] = useState({\n collectionTypes,\n entityClasses\n })\n const [counts, setCounts] = useState({ filtered: filteredCount, total: totalCount })\n const [feedback, setFeedback] = useState(null)\n const [pagination, setPagination] = useState({ page, perPage, totalPages })\n const isShadowRestricted = accessScope?.shadowRestricted === true\n const showSubscriptionFilter = !isShadowRestricted\n const currentOrganizationId = accessScope?.currentOrganizationId\n const currentOrganizationName = accessScope?.currentOrganizationName\n const [activeFilters, setActiveFilters] = useState({\n search: initialSearch,\n typeFilter: initialTypeFilter,\n entityFilter: initialEntityFilter,\n subscriptionFilter: initialSubscriptionValue({ isShadowRestricted, initialSubscriptionFilter })\n })\n const scopeMessage = buildScopeMessage({ isShadowRestricted, currentOrganizationName, currentOrganizationId })\n\n const fetchCollections = useCallback(async ({ filters, pageNumber = 1, setLoading } = {}) => {\n startLoading(setLoading)\n let timeoutId\n\n try {\n const params = buildCollectionsParams({ filters, pageNumber, perPage: pagination.perPage, showSubscriptionFilter, isShadowRestricted })\n const controller = new AbortController()\n timeoutId = setTimeout(() => controller.abort(), 10000)\n\n const data = await requestCollections(params, controller.signal)\n\n setTableCollections(data.collections || [])\n setCounts({ filtered: data.filtered_count || 0, total: data.total_count || 0 })\n setFilterOptions({\n collectionTypes: data.collection_types || [],\n entityClasses: data.entity_classes || []\n })\n setPagination({\n page: data.page || pageNumber,\n perPage: data.per_page || pagination.perPage,\n totalPages: data.total_pages || 1\n })\n setFeedback(null)\n document.dispatchEvent(new CustomEvent('collections:updated', { detail: data }))\n } catch (error) {\n if (error.name !== 'AbortError') {\n window.logError && window.logError('Search error', error, {}, 'CollectionIndex')\n }\n setFeedback({ severity: 'error', message: 'Unable to refresh collections. Please try again.' })\n } finally {\n clearTimeout(timeoutId)\n clearLoading(setLoading)\n }\n }, [isShadowRestricted, pagination.perPage, showSubscriptionFilter])\n\n const handleSearch = useCallback(async ({ search, typeFilter, entityFilter, subscriptionFilter, setLoading }) => {\n const nextFilters = { search, typeFilter, entityFilter, subscriptionFilter }\n setActiveFilters(nextFilters)\n await fetchCollections({ filters: nextFilters, pageNumber: 1, setLoading })\n }, [fetchCollections])\n\n const handlePageChange = useCallback(async (_event, nextPage) => {\n setSelectedIds([])\n await fetchCollections({ filters: activeFilters, pageNumber: nextPage })\n }, [activeFilters, fetchCollections])\n\n const handleSelectAll = useCallback((checked) => {\n setSelectedIds(checked ? tableCollections.map(c => String(c.id)) : [])\n }, [tableCollections])\n\n const handleBulkDelete = useCallback(async (ids) => {\n const csrfToken = document.querySelector('meta[name=\"csrf-token\"]')?.getAttribute('content')\n try {\n const body = new URLSearchParams({ _method: 'DELETE', authenticity_token: csrfToken })\n ids.forEach(id => body.append('collection_ids[]', id))\n\n const response = await fetch('/root/collection/bulk_delete', {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: JSON_MIME_TYPE, 'X-Requested-With': 'XMLHttpRequest' },\n credentials: 'same-origin',\n body\n })\n const data = await response.json()\n if (data.success) {\n setSelectedIds([])\n await fetchCollections({ filters: activeFilters, pageNumber: pagination.page })\n setFeedback({ severity: 'success', message: `Deleted ${data.deleted_count} collection${data.deleted_count === 1 ? '' : 's'}.` })\n } else {\n setFeedback({ severity: 'error', message: data.error || 'Failed to delete collections' })\n }\n } catch (error) {\n window.logError && window.logError('Bulk delete error', error, {}, 'CollectionIndex')\n setFeedback({ severity: 'error', message: 'An error occurred while deleting collections' })\n }\n }, [activeFilters, fetchCollections, pagination.page])\n\n return (\n \n Collections Management\n\n \n {scopeMessage}\n \n\n {renderFeedbackAlert(feedback)}\n\n \n \n {/* Action Buttons */}\n \n } href=\"/root/collection/new\">\n Add New Collection\n \n } href=\"/root/collection/import_csv\">\n Import CSV\n \n } href=\"/root/collection/export_csv.csv\">\n Export CSV\n \n \n\n {/* Search & Filters */}\n \n\n {/* Bulk Actions */}\n \n\n {/* Table */}\n \n\n {renderPagination({ totalPages: pagination.totalPages, page: pagination.page, onChange: handlePageChange })}\n \n \n \n )\n}\n\nCollectionIndex.propTypes = {\n initialCollections: PropTypes.array,\n collectionTypes: PropTypes.array,\n entityClasses: PropTypes.array,\n initialSearch: PropTypes.string,\n initialTypeFilter: PropTypes.string,\n initialEntityFilter: PropTypes.string,\n initialSubscriptionFilter: PropTypes.string,\n filteredCount: PropTypes.number,\n totalCount: PropTypes.number,\n page: PropTypes.number,\n perPage: PropTypes.number,\n totalPages: PropTypes.number,\n accessScope: PropTypes.shape({\n isRoot: PropTypes.bool,\n shadowRestricted: PropTypes.bool,\n currentOrganizationId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n currentOrganizationName: PropTypes.string\n })\n}\n\nexport default CollectionIndex\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8\"\n}), 'RadioButtonUnchecked');","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport Button from '@mui/material/Button'\nimport Alert from '@mui/material/Alert'\nimport IconButton from '@mui/material/IconButton'\nimport TextField from '@mui/material/TextField'\nimport MenuItem from '@mui/material/MenuItem'\nimport Grid from '@mui/material/Grid'\nimport Chip from '@mui/material/Chip'\nimport EditIcon from '@mui/icons-material/Edit'\nimport SaveIcon from '@mui/icons-material/Save'\nimport CancelIcon from '@mui/icons-material/Cancel'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport CheckCircleIcon from '@mui/icons-material/CheckCircle'\nimport RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked'\n\nconst normalizeStatus = (v) => (v === 'OFF' ? 'OFF' : 'ACTIVE')\n\nconst formatDate = (ds) => {\n if (!ds) { return '' }\n return new Date(ds).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' })\n}\n\nconst formatDetails = (details) => {\n if (!details) { return 'None' }\n try {\n return typeof details === 'object' ? JSON.stringify(details, null, 2) : JSON.stringify(JSON.parse(details), null, 2)\n } catch {\n return String(details)\n }\n}\n\nconst scopeMessage = ({ isShadowRestricted, currentOrganizationName, currentOrganizationId }) => {\n if (!isShadowRestricted) {\n return 'Organization scope: root users can access collections across all organizations.'\n }\n\n return `Organization scope: shadow users can only access collections for ${currentOrganizationName || 'Current Organization'}${currentOrganizationId ? ` (ID ${currentOrganizationId})` : ''}.`\n}\n\nconst EmptyCollectionState = () => (\n \n Error: No collection data loaded\n \n \n)\n\nconst InlineEditForm = ({\n isStatusCollection,\n editName,\n setEditName,\n isSaving,\n onSave,\n onCancel,\n}) => (\n \n \n \n {isStatusCollection ? (\n setEditName(e.target.value)}\n autoFocus\n >\n \n \n \n ) : (\n setEditName(e.target.value)}\n autoFocus\n />\n )}\n \n \n } disabled={isSaving}>\n {isSaving ? 'Saving...' : 'Save'}\n \n } onClick={onCancel} disabled={isSaving}>\n Cancel\n \n \n \n \n)\n\nconst CollectionDetailsGrid = ({ collection, entityInfo, isStatusCollection }) => (\n \n \n \n {isStatusCollection ? 'Status' : 'Collection Name'}\n \n \n {isStatusCollection ? normalizeStatus(collection.name) : collection.name}\n \n \n\n \n Collection Type\n {collection.category}\n \n\n \n Entity\n {entityInfo || `${collection.entity_class} #${collection.entity_id}`}\n \n\n \n Entity Class\n {collection.entity_class}\n \n\n \n Entity ID\n {collection.entity_id}\n \n\n \n Subscription\n {collection.subscription\n ? } label=\"Active\" color=\"success\" size=\"small\" />\n : } label=\"Inactive\" size=\"small\" />}\n \n\n \n Last Updated\n {formatDate(collection.updated_at)}\n \n\n \n Details\n \n {formatDetails(collection.details)}\n \n \n \n)\n\nconst CollectionShow = ({ collection = {}, entityInfo = '', csrfToken = '', accessScope = {} }) => {\n const isStatusCollection = collection.subscription === true\n const isShadowRestricted = accessScope?.shadowRestricted === true\n const currentOrganizationId = accessScope?.currentOrganizationId\n const currentOrganizationName = accessScope?.currentOrganizationName\n\n const [isEditing, setIsEditing] = useState(false)\n const [editName, setEditName] = useState(isStatusCollection ? normalizeStatus(collection.name) : (collection.name || ''))\n const [isSubscribed, setIsSubscribed] = useState(collection.subscription || false)\n const [isSaving, setIsSaving] = useState(false)\n\n const handleSave = async (e) => {\n e.preventDefault()\n setIsSaving(true)\n try {\n const formData = new FormData()\n formData.append('_method', 'PATCH')\n formData.append('authenticity_token', csrfToken)\n formData.append('collection[name]', editName)\n formData.append('collection[subscription]', isSubscribed)\n\n const response = await fetch(`/root/collection/${collection.id}`, {\n method: 'POST',\n body: formData,\n credentials: 'same-origin',\n headers: { 'X-Requested-With': 'XMLHttpRequest' }\n })\n\n if (response.ok) {\n setIsEditing(false)\n window.location.reload()\n } else {\n alert('Failed to update collection')\n }\n } catch (error) {\n alert('Error saving collection: ' + error.message)\n } finally {\n setIsSaving(false)\n }\n }\n\n const handleDelete = () => {\n if (!window.confirm(`Are you sure you want to delete '${collection.name}'?`)) return\n const form = document.createElement('form')\n form.method = 'POST'\n form.action = `/root/collection/${collection.id}`\n const methodInput = document.createElement('input')\n methodInput.type = 'hidden'; methodInput.name = '_method'; methodInput.value = 'DELETE'\n const csrfInput = document.createElement('input')\n csrfInput.type = 'hidden'; csrfInput.name = 'authenticity_token'; csrfInput.value = csrfToken\n form.appendChild(methodInput); form.appendChild(csrfInput)\n document.body.appendChild(form); form.submit()\n }\n\n const handleCancelEdit = () => {\n setIsEditing(false)\n setEditName(isStatusCollection ? normalizeStatus(collection.name) : collection.name)\n }\n\n if (!collection.id) {\n return \n }\n\n return (\n \n \n Collection Details\n \n \n \n } onClick={handleDelete}>Delete\n \n \n\n \n \n \n {scopeMessage({ isShadowRestricted, currentOrganizationName, currentOrganizationId })}\n \n\n {/* Title */}\n \n \n {collection.category} — {collection.name}\n \n {!isEditing && (\n setIsEditing(true)} title=\"Edit name\">\n \n \n )}\n \n\n {isEditing && (\n \n )}\n\n \n \n \n \n )\n}\n\nCollectionShow.propTypes = {\n collection: PropTypes.shape({\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n name: PropTypes.string,\n category: PropTypes.string,\n entity_class: PropTypes.string,\n entity_id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n details: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n subscription: PropTypes.bool,\n updated_at: PropTypes.string\n }),\n entityInfo: PropTypes.string,\n csrfToken: PropTypes.string,\n accessScope: PropTypes.shape({\n isRoot: PropTypes.bool,\n shadowRestricted: PropTypes.bool,\n currentOrganizationId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n currentOrganizationName: PropTypes.string\n })\n}\n\nexport default CollectionShow\n","import React, { useState, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Typography from '@mui/material/Typography'\nimport Button from '@mui/material/Button'\nimport Alert from '@mui/material/Alert'\nimport CircularProgress from '@mui/material/CircularProgress'\nimport UploadFileIcon from '@mui/icons-material/UploadFile'\n\nconst COLLECTION_CSV_ENDPOINT = '/root/collection/collection_csv'\nconst DEFAULT_REQUIRED_HEADERS = ['name', 'category', 'entity_class']\nconst DEFAULT_ACCESS_SCOPE = { isRoot: false, shadowRestricted: false }\nconst INVALID_CSV_FILE_MESSAGE = 'Please select a valid CSV file'\n\nconst buildDefaultConfig = (pageType) => ({\n page_type: pageType,\n upload_endpoint: COLLECTION_CSV_ENDPOINT,\n required_headers: DEFAULT_REQUIRED_HEADERS,\n access_scope: DEFAULT_ACCESS_SCOPE,\n})\n\nconst CollectionUploader = ({ pageType = 'default', onSuccess, onError }) => {\n const [config, setConfig] = useState(null)\n const [file, setFile] = useState(null)\n const [loading, setLoading] = useState(false)\n const [uploadStatus, setUploadStatus] = useState(null)\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n const response = await fetch(`/root/collection/component_config?page_type=${pageType}`)\n if (response.ok) {\n setConfig(await response.json())\n } else {\n setConfig(buildDefaultConfig(pageType))\n }\n } catch {\n setConfig(buildDefaultConfig(pageType))\n }\n }\n fetchConfig()\n }, [pageType])\n\n const handleFileChange = (e) => {\n const f = e.target.files[0]\n if (!f) { setFile(null); return }\n if (f.type === 'text/csv' || f.name.toLowerCase().endsWith('.csv')) {\n setFile(f)\n setUploadStatus(null)\n } else {\n setUploadStatus({ type: 'error', message: INVALID_CSV_FILE_MESSAGE })\n setFile(null)\n if (onError) onError(INVALID_CSV_FILE_MESSAGE)\n }\n }\n\n const handleUpload = async () => {\n if (!file || !config) { return }\n setLoading(true)\n setUploadStatus(null)\n\n const formData = new FormData()\n formData.append('file', file)\n formData.append('page_type', pageType)\n\n try {\n const response = await fetch(COLLECTION_CSV_ENDPOINT, {\n method: 'POST',\n headers: { 'X-CSRF-Token': document.querySelector('meta[name=\"csrf-token\"]')?.getAttribute('content') },\n body: formData\n })\n const result = await response.json()\n if (!response.ok || !result.success) {\n setUploadStatus({ type: 'error', message: result.errors || `Upload failed (${response.status})` })\n if (onError) onError(result.errors || 'Upload failed')\n } else {\n setUploadStatus({ type: 'success', message: 'CSV uploaded and processed successfully!' })\n setFile(null)\n if (onSuccess) onSuccess(result)\n }\n } catch (error) {\n setUploadStatus({ type: 'error', message: 'Network error during upload' })\n if (onError) onError('Network error during upload')\n } finally {\n setLoading(false)\n }\n }\n\n if (!config) {\n return Loading uploader...\n }\n\n return (\n \n Upload {config.page_type} Collection CSV\n\n \n } disabled={loading}>\n Choose CSV File\n \n \n {file && Selected: {file.name}}\n \n\n {file && (\n \n )}\n\n {config.required_headers && (\n \n Required CSV Headers:\n \n {config.required_headers.join(', ')}\n \n \n {config?.access_scope?.shadowRestricted\n ? `Scope: imports are restricted to your current organization${config?.access_scope?.currentOrganizationId ? ` (ID ${config.access_scope.currentOrganizationId})` : ''}; CSV organization IDs are ignored for lookups.`\n : 'Scope: root users can import across all organizations using CSV organization IDs.'}\n \n \n )}\n\n {uploadStatus && (\n \n {uploadStatus.message}\n \n )}\n \n )\n}\n\nCollectionUploader.propTypes = {\n pageType: PropTypes.string,\n onSuccess: PropTypes.func,\n onError: PropTypes.func\n}\n\nexport default CollectionUploader\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3\"\n}), 'Visibility');","import React, { useState, useEffect, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Table from '@mui/material/Table'\nimport TableBody from '@mui/material/TableBody'\nimport TableCell from '@mui/material/TableCell'\nimport TableHead from '@mui/material/TableHead'\nimport TableRow from '@mui/material/TableRow'\nimport Typography from '@mui/material/Typography'\nimport IconButton from '@mui/material/IconButton'\nimport Checkbox from '@mui/material/Checkbox'\nimport VisibilityIcon from '@mui/icons-material/Visibility'\nimport DeleteIcon from '@mui/icons-material/Delete'\n\nconst renderEntityId = (value) => (\n \n {value || '--'}\n \n)\n\nconst renderDetails = (details) => (\n \n {details ? `${JSON.stringify(details).substring(0, 50)}...` : '--'}\n \n)\n\nconst SubscriptionHeaderCells = () => (\n <>\n Rule UUID\n Rule Name\n Entity Class\n Entity ID\n Status\n >\n)\n\nconst StandardHeaderCells = () => (\n <>\n Category\n Name\n Entity Class\n Entity ID\n Details\n >\n)\n\nconst SubscriptionRowCells = ({ collection }) => (\n <>\n \n {collection.rule_uuid || collection.category || 'N/A'}\n \n {collection.rule_name || '--'}\n {collection.entity_class || '--'}\n {renderEntityId(collection.entity_id)}\n {renderEntityId(collection.status || collection.name)}\n >\n)\n\nconst StandardRowCells = ({ collection }) => (\n <>\n \n {collection.category || 'N/A'}\n \n {collection.name || ''}\n {collection.entity_class || '--'}\n {renderEntityId(collection.entity_id)}\n {renderDetails(collection.details)}\n >\n)\n\nSubscriptionRowCells.propTypes = {\n collection: PropTypes.object.isRequired\n}\n\nStandardRowCells.propTypes = {\n collection: PropTypes.object.isRequired\n}\n\nconst CollectionRow = ({ collection, showSubscriptionLayout, selectedIds, onRowCheck, formatDate }) => (\n \n \n onRowCheck(collection.id, e.target.checked)}\n />\n \n {showSubscriptionLayout ? (\n \n ) : (\n \n )}\n {formatDate(collection.updated_at)}\n \n \n \n \n \n \n \n \n \n \n \n)\n\nCollectionRow.propTypes = {\n collection: PropTypes.object.isRequired,\n showSubscriptionLayout: PropTypes.bool.isRequired,\n selectedIds: PropTypes.arrayOf(PropTypes.string).isRequired,\n onRowCheck: PropTypes.func.isRequired,\n formatDate: PropTypes.func.isRequired\n}\n\nconst CollectionsTable = React.memo(({\n initialCollections = [],\n filteredCount = 0,\n totalCount = 0,\n selectedIds,\n onSelectionChange\n}) => {\n const [collections, setCollections] = useState(initialCollections)\n const [counts, setCounts] = useState({ filtered: filteredCount, total: totalCount })\n\n const handleSearchUpdate = useCallback((event) => {\n setCollections(event.detail.collections || [])\n setCounts({\n filtered: event.detail.filtered_count || 0,\n total: event.detail.total_count || 0\n })\n }, [])\n\n useEffect(() => {\n document.addEventListener('collections:updated', handleSearchUpdate)\n return () => document.removeEventListener('collections:updated', handleSearchUpdate)\n }, [handleSearchUpdate])\n\n const formatDate = (dateString) => {\n if (!dateString) { return '' }\n return new Date(dateString).toLocaleDateString('en-US')\n }\n\n const handleRowCheck = (id, checked) => {\n if (!onSelectionChange) { return }\n onSelectionChange(checked\n ? [...selectedIds, String(id)]\n : selectedIds.filter(s => s !== String(id))\n )\n }\n\n const showSubscriptionLayout = collections.length > 0 && collections.every((c) => c.subscription === true)\n\n return (\n \n \n Showing {counts.filtered} of {counts.total} collections\n \n\n \n \n \n \n {showSubscriptionLayout ? (\n \n ) : (\n \n )}\n Updated\n View\n Delete\n \n \n \n {collections.length === 0 ? (\n \n \n \n No collections found. Try adjusting your search filters or create a new collection.\n \n \n \n ) : collections.map((collection) => (\n \n ))}\n \n
\n \n )\n})\n\nCollectionsTable.propTypes = {\n initialCollections: PropTypes.array,\n filteredCount: PropTypes.number,\n totalCount: PropTypes.number,\n selectedIds: PropTypes.arrayOf(PropTypes.string).isRequired,\n onSelectionChange: PropTypes.func.isRequired\n}\n\nexport default CollectionsTable\n","import React, { useState, useEffect, useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Grid from '@mui/material/Grid'\nimport TextField from '@mui/material/TextField'\nimport MenuItem from '@mui/material/MenuItem'\nimport Button from '@mui/material/Button'\nimport CircularProgress from '@mui/material/CircularProgress'\nimport FormControl from '@mui/material/FormControl'\nimport FormLabel from '@mui/material/FormLabel'\nimport Radio from '@mui/material/Radio'\nimport RadioGroup from '@mui/material/RadioGroup'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport ClearIcon from '@mui/icons-material/Clear'\n\nconst SearchAndFilters = ({\n initialSearch = '',\n initialTypeFilter = '',\n initialEntityFilter = '',\n initialSubscriptionFilter = '',\n showSubscriptionFilter = true,\n collectionTypes = [],\n entityClasses = [],\n onSearchChange\n}) => {\n const safeInitialSearch = initialSearch ?? ''\n const safeInitialTypeFilter = initialTypeFilter ?? ''\n const safeInitialEntityFilter = initialEntityFilter ?? ''\n const safeInitialSubscriptionFilter = initialSubscriptionFilter ?? ''\n\n const [searchQuery, setSearchQuery] = useState(safeInitialSearch)\n const [typeFilter, setTypeFilter] = useState(safeInitialTypeFilter)\n const [entityFilter, setEntityFilter] = useState(safeInitialEntityFilter)\n const [subscriptionFilter, setSubscriptionFilter] = useState(safeInitialSubscriptionFilter)\n const [loading, setLoading] = useState(false)\n\n const debouncedSearch = useCallback(() => {\n if (onSearchChange) {\n onSearchChange({ search: searchQuery, typeFilter, entityFilter, subscriptionFilter, setLoading })\n }\n }, [searchQuery, typeFilter, entityFilter, subscriptionFilter, onSearchChange])\n\n useEffect(() => {\n const timer = setTimeout(debouncedSearch, 300)\n return () => clearTimeout(timer)\n }, [debouncedSearch])\n\n const clearAllFilters = useCallback(() => {\n setSearchQuery('')\n setTypeFilter('')\n setEntityFilter('')\n if (showSubscriptionFilter) {\n setSubscriptionFilter('')\n }\n }, [showSubscriptionFilter])\n\n const hasFilters = useMemo(\n () => String(searchQuery ?? '').trim() || typeFilter || entityFilter || (showSubscriptionFilter && subscriptionFilter),\n [searchQuery, typeFilter, entityFilter, subscriptionFilter, showSubscriptionFilter]\n )\n\n return (\n \n \n \n setSearchQuery(e.target.value)}\n InputProps={{\n endAdornment: loading ? : null\n }}\n />\n \n\n \n setTypeFilter(e.target.value)}\n >\n \n {collectionTypes.map(type => (\n \n ))}\n \n \n\n \n setEntityFilter(e.target.value)}\n >\n \n {entityClasses.map(cls => (\n \n ))}\n \n \n\n {showSubscriptionFilter && (\n \n \n Subscription Filter\n setSubscriptionFilter(e.target.value)}\n >\n } label=\"All\" />\n } label=\"Subscriptions only\" />\n } label=\"Non-subscriptions only\" />\n \n \n \n )}\n\n {hasFilters && (\n \n }\n onClick={clearAllFilters}\n color=\"inherit\"\n >\n Clear Filters\n \n \n )}\n \n \n )\n}\n\nSearchAndFilters.propTypes = {\n initialSearch: PropTypes.string,\n initialTypeFilter: PropTypes.string,\n initialEntityFilter: PropTypes.string,\n initialSubscriptionFilter: PropTypes.string,\n showSubscriptionFilter: PropTypes.bool,\n collectionTypes: PropTypes.array,\n entityClasses: PropTypes.array,\n onSearchChange: PropTypes.func\n}\n\nexport default SearchAndFilters\n","import React, { useState } from 'react'\nimport { FormControl, InputLabel, MenuItem, Select, Card, CardContent, Typography, Divider } from '@mui/material'\nimport Backfill from '../backfill/index'\nimport Enrollments from '../enrollment/index'\nimport MedEquivalency from '../MmeCalculation/index'\nimport CareCenter from '../careCenter/import'\nimport ExternalRule from '../externalRule/index'\nimport UserPgImport from '../user/index'\n\n\n\nconst ImportUi = () => {\n const [selectedOption, setSelectedOption] = useState('')\n\n const handleOptionChange = (event) => {\n setSelectedOption(event.target.value)\n }\n\n const renderSelectedComponent = () => {\n if (selectedOption === 'backfill') {\n return \n }\n if (selectedOption === 'enrollments') {\n return \n }\n if (selectedOption === 'medequivalency') {\n return \n }\n if (selectedOption === 'carecenter') {\n return \n }\n if (selectedOption === 'externalrule') {\n return \n }\n if (selectedOption === 'user') {\n return \n }\n return null\n }\n\n return (\n \n
\n \n Import Dashboard\n \n Please select which tool you want to use\n \n Select an option\n \n \n {renderSelectedComponent()}\n \n \n
\n )\n}\n\nexport default ImportUi\n","import React from 'react'\nimport TableBody from '@mui/material/TableBody'\nimport TableCell from '@mui/material/TableCell'\nimport TableRow from '@mui/material/TableRow'\n\nconst Body = ({ data }) => \n (\n <>\n \n {data.map((row) => (\n \n {row.description}\n {row.code}\n \n ))}\n \n >\n )\n\nexport default Body\n","import React from 'react'\nimport TableHead from '@mui/material/TableHead'\nimport TableRow from '@mui/material/TableRow'\nimport TableCell from '@mui/material/TableCell'\n\n// Create header for Diagnosis Code Table\n\nconst Header = () => (\n \n \n \n \n Description\n
\n \n \n \n Code\n
\n \n \n \n)\n\nexport default Header\n","import React from 'react'\nimport TableContainer from '@mui/material/TableContainer'\nimport MUITable from '@mui/material/Table'\nimport Header from './Header'\nimport Body from './Body'\n\nconst Table = ({ data }) => (\n <>\n \n \n \n \n \n \n >\n)\n\nexport default Table","import React, { useState, useEffect } from 'react'\nimport Select from '@mui/material/Select'\nimport MenuItem from '@mui/material/MenuItem'\nimport Box from '@mui/material/Box'\nimport FormControl from '@mui/material/FormControl'\nimport InputLabel from '@mui/material/InputLabel'\nimport TextField from '@mui/material/TextField'\nimport Alert from '@mui/material/Alert'\nimport Snackbar from '@mui/material/Snackbar'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport Table from './Table'\nimport log from '../../utilities/logger'\n\nconst DiagnosisCodes = () => {\n const searchParams = (new URL(window.location.href)).searchParams\n const orderParam = searchParams.get('order')\n const insuranceParam = searchParams.get('insurance')\n const cardUuidParam = searchParams.get('card_uuid')\n const [orderList, setOrderList] = useState([])\n const [order, setOrder] = useState('')\n const [data, setData] = useState([])\n const [filteredData, setFilteredData] = useState([])\n const [searchQuery, setSearchQuery] = useState('')\n const [flashMessage, setFlashMessage] = useState({ open: false, message: '', severity: 'error' })\n\n const showFlashMessage = (message, severity = 'error') => {\n setFlashMessage({ open: true, message, severity })\n }\n\n const hideFlashMessage = () => {\n setFlashMessage({ ...flashMessage, open: false })\n }\n const buildUrl = (selectedOrder) => {\n const urlParams = new URLSearchParams()\n if (selectedOrder) urlParams.set('order', selectedOrder)\n if (insuranceParam) urlParams.set('insurance', insuranceParam)\n if (cardUuidParam) urlParams.set('card_uuid', cardUuidParam)\n return `/diagnosis_codes?${urlParams.toString()}`\n }\n\n const sortDataByDescription = (data) => data.sort((a, b) => {\n if (a.description < b.description) { return -1 }\n if (a.description > b.description) { return 1 }\n return 0\n })\n\n useEffect(() => {\n const call = {\n method: 'get',\n url: '/order_list',\n dataType: 'json',\n contentType: 'application/json',\n data: { insurance_value_set: insuranceParam }\n }\n $.ajax(call)\n .done((response) => {\n setOrderList(response)\n if (orderParam && response.includes(orderParam)) setOrder(orderParam)\n })\n .fail((error) => {\n const errorMessage = 'Failed to fetch order list. Please try refreshing the page.'\n log({ title: 'Failed to fetch order list', className: 'DiagnosisCodes', values: { call, error } })\n console.error(error)\n showFlashMessage(errorMessage)\n })\n\n const call2 = {\n method: 'get',\n url: '/codes',\n dataType: 'json',\n contentType: 'application/json',\n data: { order: orderParam, insurance_value_set: insuranceParam }\n }\n\n $.ajax(call2)\n .done((response) => {\n const sortedData = sortDataByDescription(response)\n setData(sortedData)\n setFilteredData(sortedData)\n })\n .fail((error) => {\n const errorMessage = 'Failed to load diagnosis codes. Please check your connection and try again.'\n log({ title: 'Failed to fetch sorted order description', className: 'DiagnosisCodes', values: { call: call2, error } })\n console.error(error)\n showFlashMessage(errorMessage)\n })\n }, [])\n\n const handleOrderChange = (event) => {\n const selectedOrder = event.target.value\n setOrder(selectedOrder)\n const call = \n {\n method: 'get',\n url: '/codes',\n dataType: 'json',\n contentType: 'application/json',\n data: { order: selectedOrder, insurance_value_set: insuranceParam }\n }\n $.ajax(call)\n .done((response) => {\n window.history.pushState({}, '', buildUrl(selectedOrder))\n const sortedData = sortDataByDescription(response)\n setData(sortedData)\n setFilteredData(sortedData)\n })\n .fail((error) => {\n const errorMessage = 'Failed to load codes for selected order. Please try selecting a different order.'\n log({ title: 'error getting codes for order change', className: 'DiagnosisCodes', values: { call, error } })\n console.error(error)\n showFlashMessage(errorMessage)\n })\n }\n\n const handleSearch = (query) => {\n if (query.trim() === '') {\n setFilteredData(data)\n } else {\n const filtered = data.filter(\n (item) =>\n item.description.toLowerCase().includes(query) ||\n item.code.toLowerCase().includes(query)\n )\n setFilteredData(filtered)\n }\n }\n\n useEffect(() => {\n const delayDebounceFn = setTimeout(() => {\n handleSearch(searchQuery.toLowerCase())\n }, 300)\n\n return () => clearTimeout(delayDebounceFn)\n }, [searchQuery, data])\n\n return (\n \n
\n \n Lab Coverage Codes\n \n \n Lab Order\n \n \n \n setSearchQuery(e.target.value)}\n />\n \n \n {/* Flash Message Snackbar */}\n \n \n {flashMessage.message}\n \n \n \n \n
\n )\n}\n\nexport default DiagnosisCodes\n","import React from 'react'\n\nconst DRCHRONO_BUTTON_IMG = 'https://www.drchrono.com/site_media/images/logos/drchrono-api-button02.e417f2079bf4.png'\n\nexport default function EhrLogin({ authorizationUrl }) {\n return (\n \n
\n
Sign in with DrChrono
\n
\n
Click the button below to authorize DrChrono users to get connected to Avhana Health app
\n {authorizationUrl && (\n
\n
\n \n )}\n
\n
\n )\n}\n","import React from 'react'\n\nexport default function EhrLoginSuccess() {\n return (\n \n
\n
Successfully authenticated with DrChrono
\n \n
\n )\n}\n","import React, { useState } from 'react'\nimport {\n Box,\n Typography,\n FormControl,\n InputLabel,\n Select,\n MenuItem,\n Button,\n Alert\n} from '@mui/material'\nimport log from '../../utilities/logger'\n\nexport default function Enrollment() {\n const [file, setFile] = useState(undefined)\n const [selectedOption, setSelectedOption] = useState('')\n const [message, setMessage] = useState('')\n const [messageType, setMessageType] = useState('')\n const [isLoading, setIsLoading] = useState(false)\n\n const handleFileSelect = (event) => {\n setFile(event.target.files[0])\n setMessage('')\n }\n\n const handleOptionChange = (event) => {\n setSelectedOption(event.target.value)\n setMessage('')\n }\n\n const showMessage = (text, type) => {\n setMessage(text)\n setMessageType(type)\n setTimeout(() => {\n setMessage('')\n setMessageType('')\n }, 5000)\n }\n\n const checkInput = () => {\n if (!file) {\n showMessage('Please select a file to upload', 'error')\n return false\n }\n if (!selectedOption) {\n showMessage('Please select an import type', 'error')\n return false\n }\n return true\n }\n\n const handleFileSubmit = async (event) => {\n event.preventDefault()\n if (!checkInput()) { return }\n\n setIsLoading(true)\n \n try {\n const formData = new FormData()\n formData.append(\"file\", file)\n formData.append(\"type\", selectedOption)\n const call = { \n method: 'post',\n url: '/root/enrollments/enrollment_csv',\n contentType: false,\n processData: false,\n data: formData,\n enctype: 'multipart/form-data'\n }\n $.ajax(call)\n .done(() => {\n flash.success(`Enrollment (${selectedOption}) successfully imported!`)\n setIsLoading(false)\n })\n .fail((error) => {\n const errorMsg = error.responseJSON?.errors || 'Unknown error'\n const { data, ...callWithoutData } = call\n log({ title: `Failed to import enrollment CSV`, className: 'Enrollment', values: { call: callWithoutData, error: errorMsg }, context: { selectedOption } })\n flash.error(`Error importing your ${selectedOption} file. ${errorMsg}`)\n console.error(error)\n setIsLoading(false)\n })\n } catch (error) {\n log({ title: 'Unexpected error importing enrollment CSV', className: 'Enrollment', values: { error }, context: { selectedOption } })\n showMessage(`Error importing your enrollment. ${error.message}`, 'error')\n console.error(error)\n setIsLoading(false)\n }\n }\n\n return (\n \n \n Enrollment Import (CSV)\n \n\n {message && (\n \n {message}\n \n )}\n\n \n Import Type\n \n \n\n \n \n Select CSV File\n \n \n \n\n \n \n )\n}","import React, { useState } from 'react'\nimport { FormControl, InputLabel, MenuItem, Select, Typography, Box } from '@mui/material'\nimport $ from 'jquery'\nimport log from '../../utilities/logger'\n\nexport default function ExternalRule() {\n const [file, setFile] = useState(undefined)\n const [selectedOption, setSelectedOption] = useState('')\n const [subscriptionOptions, setSubscriptionOptions] = useState([])\n const [selectedSubscription, setSelectedSubscription] = useState({})\n\n const handleOptionChange = (event) => {\n const { value } = event.target\n setSelectedOption(event.target.value)\n if (value === 'Default') {\n // Fetch default sources and title\n const optionsCall = {\n method: 'get',\n url: '/root/external_rule/external_rule_subscription_options',\n dataType: 'json'\n }\n $.ajax(optionsCall)\n .done((response) => {\n setSubscriptionOptions(response.externalRuleSubscriptions || [])\n })\n .fail((error) => {\n log({ title: 'Failed to fetch external rule subscription options', className: 'ExternalRule', values: { call: optionsCall, error } })\n window.flash.error(`Error fetching default sources and title. ${error.responseJSON?.errors}`, 5000)\n console.error(error)\n })\n } else {\n setSubscriptionOptions([])\n }\n }\n\n const handleFileSelect = (event) => {\n setFile(event.target.files[0])\n }\n\n const checkInput = () => {\n if (!file) {\n log({ title: 'Validation failed: no file selected for external rule import', className: 'ExternalRule' })\n window.flash.error('Please select a file to upload', 5000)\n return false\n }\n if (!selectedOption) {\n log({ title: 'Validation failed: no import type selected for external rule', className: 'ExternalRule' })\n window.flash.error('Please select an option', 5000)\n return false\n }\n return true\n }\n\n const handleFileSubmit = (event) => {\n event.preventDefault()\n if (!checkInput()) {\n return\n }\n const formData = new FormData()\n formData.append(\"file\", file)\n formData.append(\"type\", selectedOption)\n formData.append(\"subscription\", JSON.stringify(selectedSubscription))\n const importCall = { \n method: 'post',\n url: '/root/external_rule/external_rule_csv',\n contentType: false,\n processData: false,\n data: formData,\n enctype: 'multipart/form-data'\n }\n $.ajax(importCall)\n .done(() => {\n flash.success('External rule csv successfully imported')\n })\n .fail((error) => {\n const errorMsg = error.responseJSON?.errors || 'Unknown error'\n const { data, ...callWithoutData } = importCall\n log({ title: 'Failed to import external rule CSV', className: 'ExternalRule', values: { call: callWithoutData, error: errorMsg }, context: { selectedOption } })\n flash.error(`Error importing your External rule. ${errorMsg}`)\n console.error(error)\n })\n }\n\n return (\n <>\n \n >\n )\n}","import React from 'react'\n\nconst SUPPORT_EMAIL = 'support@amalgamrx.com'\n\nexport default function ErrorPage({ message, showContactLink, closeWindow }) {\n return (\n \n
\n
{message}
\n
\n {showContactLink && (\n
\n )}\n {closeWindow &&
You can close this window.
}\n
\n )\n}\n","import React, { useState } from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Alert from '@mui/material/Alert';\nimport Typography from '@mui/material/Typography';\nimport theme from '../../theme/index';\nimport logo from '../../../assets/images/RGB_Amalgam@3x.png';\n\nconst LOGO_URL = logo;\n\nexport default function GoogleMfaForm({ userName, showQr, qrUri, submitPath, csrfToken, flashAlert }) {\n const [mfaCode, setMfaCode] = useState('');\n\n return (\n \n \n {flashAlert && (\n {flashAlert}\n )}\n \n \n \n \n \n \n Welcome {userName}\n \n {showQr && qrUri && (\n \n \n \n )}\n \n \n setMfaCode(e.target.value)}\n inputProps={{ maxLength: 6 }}\n fullWidth\n sx={{ mb: 2 }}\n autoFocus\n />\n \n \n \n \n \n \n );\n}\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2M11 16l4-4-4-4v3H1v2h10z\"\n}), 'Input');","import React, { useState } from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\nimport Box from '@mui/material/Box'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport TextField from '@mui/material/TextField'\nimport Button from '@mui/material/Button'\nimport Alert from '@mui/material/Alert'\nimport InputIcon from '@mui/icons-material/Input'\nimport PropTypes from 'prop-types'\nimport theme from '../../theme/index'\nimport logo from '../../../assets/images/RGB_Amalgam@3x.png'\n\nconst propTypes = {\n csrfToken: PropTypes.string.isRequired,\n sessionsPath: PropTypes.string.isRequired,\n flashError: PropTypes.string,\n isDevelopment: PropTypes.bool,\n}\n\nconst DEV_LOGINS = [\n { label: 'Allscripts Medici Login', login: 'j@medici.com' },\n { label: 'Nweiner Athena Login', login: 'nweiner1' },\n { label: 'Athena Admin Login', login: 'athena@test.com' },\n { label: 'Athena Root Login', login: 'noah@avhana.com' },\n { label: 'Epic Login', login: 'epic@test.com' },\n { label: 'Cerner Login', login: 'cerner@test.com' },\n { label: 'Modernizing Medicine Admin Login', login: 'modmed@test.com' },\n { label: 'DrChrono Admin Login', login: 'drchrono@test.com' },\n]\n\nconst LoginForm = ({ csrfToken, sessionsPath, flashError = null, isDevelopment = false }) => {\n const [login, setLogin] = useState('')\n const [password, setPassword] = useState('')\n\n const handleSubmit = (e) => {\n e.preventDefault()\n const form = e.currentTarget\n form.submit()\n }\n\n return (\n \n \n \n {flashError && (\n \n {flashError}\n \n )}\n \n \n
\n \n \n \n Welcome
\n \n {/* Standard HTML form so submission works with Rails session auth */}\n \n \n \n \n \n {isDevelopment && (\n \n \n {DEV_LOGINS.map(({ label, login: devLogin }) => (\n - \n \n
\n ))}\n
\n \n )}\n \n )\n}\n\nLoginForm.propTypes = propTypes\n\nexport default LoginForm\n\nconst mountLogin = () => {\n const node = document.getElementById('login-react-mount')\n if (!node) { return }\n const { createRoot } = require('react-dom/client')\n const root = createRoot(node)\n root.render(\n \n )\n}\n\ndocument.addEventListener('DOMContentLoaded', mountLogin)\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z\"\n}), 'Home');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M3 14h4v-4H3zm0 5h4v-4H3zM3 9h4V5H3zm5 5h13v-4H8zm0 5h13v-4H8zM8 5v4h13V5z\"\n}), 'ViewList');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5\"\n}), 'Group');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"m18 7-1.41-1.41-6.34 6.34 1.41 1.41zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12zM.41 13.41 6 19l1.41-1.41L1.83 12z\"\n}), 'DoneAll');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M16.5 12c1.38 0 2.49-1.12 2.49-2.5S17.88 7 16.5 7 14 8.12 14 9.5s1.12 2.5 2.5 2.5M9 11c1.66 0 2.99-1.34 2.99-3S10.66 5 9 5 6 6.34 6 8s1.34 3 3 3m7.5 3c-1.83 0-5.5.92-5.5 2.75V19h11v-2.25c0-1.83-3.67-2.75-5.5-2.75M9 13c-2.33 0-7 1.17-7 3.5V19h7v-2.25c0-.85.33-2.34 2.37-3.47C10.5 13.1 9.66 13 9 13\"\n}), 'SupervisorAccount');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8\"\n}), 'AddCircleOutline');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M9 17H7v-7h2zm4 0h-2V7h2zm4 0h-2v-4h2z\"\n}), 'InsertChart');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m-9-2V7H4v3H1v2h3v3h2v-3h3v-2zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4\"\n}), 'PersonAdd');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M3 17v-2c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2v2c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2M3 7v2c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2\"\n}), 'ViewStream');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 9h-4v4h-2v-4H9V9h4V5h2v4h4z\"\n}), 'LibraryAdd');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon([/*#__PURE__*/_jsx(\"circle\", {\n cx: \"7.2\",\n cy: \"14.4\",\n r: \"3.2\"\n}, \"0\"), /*#__PURE__*/_jsx(\"circle\", {\n cx: \"14.8\",\n cy: \"18\",\n r: \"2\"\n}, \"1\"), /*#__PURE__*/_jsx(\"circle\", {\n cx: \"15.2\",\n cy: \"8.8\",\n r: \"4.8\"\n}, \"2\")], 'BubbleChart');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M21 3H3c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.11-.9-2-2-2m0 14H3V5h18zm-5-7v2h-3v3h-2v-3H8v-2h3V7h2v3z\"\n}), 'AddToQueue');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3zm-3-7V3.5L18.5 9z\"\n}), 'NoteAdd');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"m21.41 11.58-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58s1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41s-.23-1.06-.59-1.42M5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7\"\n}), 'LocalOffer');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M13 13v8h8v-8zM3 21h8v-8H3zM3 3v8h8V3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66z\"\n}), 'Widgets');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-7 3c1.93 0 3.5 1.57 3.5 3.5S13.93 13 12 13s-3.5-1.57-3.5-3.5S10.07 6 12 6m7 13H5v-.23c0-.62.28-1.2.76-1.58C7.47 15.82 9.64 15 12 15s4.53.82 6.24 2.19c.48.38.76.97.76 1.58z\"\n}), 'AccountBox');","import React from 'react'\nimport PropTypes from 'prop-types'\nimport { ThemeProvider } from '@mui/material/styles'\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemIcon from '@mui/material/ListItemIcon'\nimport Tooltip from '@mui/material/Tooltip'\nimport HomeIcon from '@mui/icons-material/Home'\nimport SearchIcon from '@mui/icons-material/Search'\nimport ViewListIcon from '@mui/icons-material/ViewList'\nimport GroupIcon from '@mui/icons-material/Group'\nimport DoneAllIcon from '@mui/icons-material/DoneAll'\nimport SupervisorAccountIcon from '@mui/icons-material/SupervisorAccount'\nimport AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'\nimport InsertChartIcon from '@mui/icons-material/InsertChart'\nimport PersonAddIcon from '@mui/icons-material/PersonAdd'\nimport AddBoxIcon from '@mui/icons-material/AddBox'\nimport ViewStreamIcon from '@mui/icons-material/ViewStream'\nimport LibraryAddIcon from '@mui/icons-material/LibraryAdd'\nimport BubbleChartIcon from '@mui/icons-material/BubbleChart'\nimport AddToQueueIcon from '@mui/icons-material/AddToQueue'\nimport NoteAddIcon from '@mui/icons-material/NoteAdd'\nimport AddIcon from '@mui/icons-material/Add'\nimport LocalOfferIcon from '@mui/icons-material/LocalOffer'\nimport WidgetsIcon from '@mui/icons-material/Widgets'\nimport AccountBoxIcon from '@mui/icons-material/AccountBox'\nimport theme from '../../theme/index'\nimport UserMenu from '../../userMenu/userMenu'\nimport logo from '../../../assets/images/ICO_Amalgam@3x.png'\n\nconst NavLink = ({ icon, label, href }) => (\n \n \n \n \n {icon}\n \n \n \n \n)\n\nNavLink.propTypes = {\n icon: PropTypes.element.isRequired,\n label: PropTypes.string.isRequired,\n href: PropTypes.string.isRequired,\n}\n\nconst propTypes = {\n isAdmin: PropTypes.bool.isRequired,\n isRoot: PropTypes.bool.isRequired,\n emr: PropTypes.string.isRequired,\n avhanaEnv: PropTypes.string.isRequired,\n railsEnv: PropTypes.string.isRequired,\n isShadowUser: PropTypes.bool.isRequired,\n canApplySubscriptionVersion: PropTypes.bool.isRequired,\n manageStaffAccess: PropTypes.bool.isRequired,\n usePrevisitPlanning: PropTypes.bool.isRequired,\n canCreateUsers: PropTypes.bool.isRequired,\n showNotificationBell: PropTypes.bool.isRequired,\n showUserMenu: PropTypes.bool.isRequired,\n currentUserId: PropTypes.number,\n currentUserInitials: PropTypes.string,\n currentUserName: PropTypes.string,\n currentUserOrganization: PropTypes.string,\n orgId: PropTypes.number,\n}\n\nconst CERNER = 'cerner'\nconst DR_CHRONO = 'dr_chrono'\nconst ATHENA = 'athena'\nconst ALLSCRIPTS = 'allscripts'\nconst MOD_MED = 'mod_med'\n\nconst isNonRootAthenaFamily = ({ isRoot, emr }) => !isRoot && [ATHENA, ALLSCRIPTS, MOD_MED].includes(emr)\n\nconst renderCernerAndDrChronoAdminHome = ({ isAdmin, emr }) => {\n if (!isAdmin || ![CERNER, DR_CHRONO].includes(emr)) {\n return null\n }\n\n return } label=\"Recommendations\" href=\"/\" />\n}\n\nconst renderDrChronoSignInLink = ({ isAdmin, emr, isDevelopmentOrTest, isStaging }) => {\n if (!isAdmin || emr !== DR_CHRONO) {\n return null\n }\n\n if (!(isDevelopmentOrTest || isStaging)) {\n return null\n }\n\n return } label=\"Sign in with DrChrono\" href=\"/dr_chrono/oauth2/ehr_login\" />\n}\n\nconst renderAthenaFamilyNonRootAdminLinks = ({ isRoot, emr, isProduction }) => {\n if (!isNonRootAthenaFamily({ isRoot, emr })) {\n return null\n }\n\n return (\n <>\n } label=\"Pre-Visit Planning\" href=\"/\" />\n {!isProduction && emr === ATHENA && (\n } label=\"Patient Search\" href=\"/patient_search\" />\n )}\n >\n )\n}\n\nconst renderNonRootAdminLinks = ({ isAdmin, isRoot, emr, isStaging, manageStaffAccess, usePrevisitPlanning, isProduction }) => {\n if (!isAdmin || isRoot) {\n return null\n }\n\n return (\n <>\n } label=\"Manage My Guidelines\" href=\"/admin/rules\" />\n } label=\"View Users\" href=\"/admin/users\" />\n {emr === ATHENA && isStaging && (\n } label=\"Refresh Staging Patient\" href=\"/patient_search/refresh\" />\n )}\n {manageStaffAccess && (\n } label=\"Manage Staff Access\" href=\"/admin/users/pending_users\" />\n )}\n {usePrevisitPlanning && (\n <>\n } label=\"Join Care Team\" href=\"/admin/care_teams\" />\n } label=\"Create New Care Team\" href=\"/admin/care_teams/new\" />\n >\n )}\n {isProduction && (\n } label=\"Avhana Reporting\" href=\"/analytics/reports\" />\n )}\n >\n )\n}\n\nconst renderRootOnlyLinks = ({ isRoot, isProduction }) => {\n if (!isRoot) {\n return null\n }\n\n return (\n <>\n } label=\"View/Edit Users\" href=\"/admin/users\" />\n } label=\"New Organization\" href=\"/admin/organizations/new\" />\n } label=\"View Rules\" href=\"/root/rules\" />\n {!isProduction && (\n } label=\"New Rule\" href=\"/root/rules/new\" />\n )}\n } label=\"List of Athena Measure Stats\" href=\"/root/athena/measure_stats\" />\n } label=\"New Athena Measure Stat\" href=\"/root/athena/measure_stats/new\" />\n } label=\"Value Sets\" href=\"/root/value_sets\" />\n } label=\"Collections\" href=\"/root/collection\" />\n } label=\"Import Dashboard\" href=\"/dashboard/import\" />\n } label=\"Care Center Dashboard\" href=\"/root/care_center\" />\n } label=\"Provider Groups\" href=\"/root/provider_grouping\" />\n } label=\"Manage Tags\" href=\"/root/tags\" />\n >\n )\n}\n\nconst renderShadowCollectionsLink = ({ isRoot, isShadowUser }) => {\n if (isRoot || !isShadowUser) {\n return null\n }\n\n return } label=\"Collections\" href=\"/root/collection\" />\n}\n\nconst renderNotificationBell = ({ isShadowUser, canApplySubscriptionVersion, showNotificationBell }) => {\n if (!isShadowUser || !canApplySubscriptionVersion || !showNotificationBell) {\n return null\n }\n\n return (\n \n \n \n )\n}\n\nconst renderUserMenu = ({ isRoot, isAdmin, showUserMenu, currentUserId, currentUserInitials }) => {\n if (!(isRoot || isAdmin) || !showUserMenu || !currentUserId) {\n return null\n }\n\n return (\n \n \n
\n )\n}\n\nconst parseOptionalInt = (value) => {\n if (!value) {\n return null\n }\n\n return parseInt(value, 10)\n}\n\nconst SideNav = ({\n isAdmin, isRoot, emr, avhanaEnv, railsEnv,\n isShadowUser, canApplySubscriptionVersion,\n manageStaffAccess, usePrevisitPlanning, canCreateUsers,\n showNotificationBell, showUserMenu,\n currentUserId = null, currentUserInitials = '', currentUserName = '',\n currentUserOrganization = '', orgId = null,\n}) => {\n const isProduction = avhanaEnv === 'production'\n const isStaging = avhanaEnv === 'staging'\n const isDevelopmentOrTest = railsEnv === 'development' || railsEnv === 'test'\n\n return (\n \n \n
\n

\n
\n
\n {renderCernerAndDrChronoAdminHome({ isAdmin, emr })}\n {renderDrChronoSignInLink({ isAdmin, emr, isDevelopmentOrTest, isStaging })}\n {renderAthenaFamilyNonRootAdminLinks({ isRoot, emr, isProduction })}\n {renderNonRootAdminLinks({ isAdmin, isRoot, emr, isStaging, manageStaffAccess, usePrevisitPlanning, isProduction })}\n {(isRoot || (isAdmin && canCreateUsers)) && (\n } label=\"New User\" href=\"/admin/users/new\" />\n )}\n {renderRootOnlyLinks({ isRoot, isProduction })}\n {renderShadowCollectionsLink({ isRoot, isShadowUser })}\n {renderNotificationBell({ isShadowUser, canApplySubscriptionVersion, showNotificationBell })}\n
\n\n {renderUserMenu({ isRoot, isAdmin, showUserMenu, currentUserId, currentUserInitials })}\n
\n \n )\n}\n\nSideNav.propTypes = propTypes\n\nexport default SideNav\n\nconst mountSideNav = () => {\n const node = document.getElementById('side-nav-mount')\n if (!node) { return }\n const d = node.dataset\n const { createRoot } = require('react-dom/client')\n // Set window.CurrentUser so legacy components (AthenaOrderPrefTypeahead etc.) can access it\n window.CurrentUser = {\n id: parseOptionalInt(d.currentUserId),\n name: d.currentUserName || '',\n organization: d.currentUserOrganization || '',\n organization_id: parseOptionalInt(d.orgId),\n }\n\n const root = createRoot(node)\n root.render(\n \n )\n}\n\ndocument.addEventListener('DOMContentLoaded', mountSideNav)\n","import React from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Button from '@mui/material/Button';\nimport Typography from '@mui/material/Typography';\nimport theme from '../../theme/index';\nimport logo from '../../../assets/images/RGB_Amalgam@3x.png';\n\nconst LOGO_URL = logo;\n\nexport default function SplashPage({ message }) {\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2m6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1z\"\n}), 'Notifications');","import React, { useState, useEffect, useCallback } from 'react'\nimport {\n Badge,\n IconButton,\n Menu,\n MenuItem,\n Typography,\n Box,\n Divider,\n Button,\n CircularProgress,\n ListItemText,\n ListItemIcon,\n} from '@mui/material'\nimport NotificationsIcon from '@mui/icons-material/Notifications'\nimport CheckCircleIcon from '@mui/icons-material/CheckCircle'\nimport CloseIcon from '@mui/icons-material/Close'\nimport AssignmentIcon from '@mui/icons-material/Assignment'\nimport dayjs from '../../utilities/dayjs'\n\nconst NotificationBell = () => {\n const [anchorEl, setAnchorEl] = useState(null)\n const [notifications, setNotifications] = useState([])\n const [unreadCount, setUnreadCount] = useState(0)\n const [loading, setLoading] = useState(false)\n\n const open = Boolean(anchorEl)\n\n const fetchNotifications = useCallback(() => {\n setLoading(true)\n $.ajax({\n method: 'GET',\n url: '/user_notifications',\n dataType: 'json',\n })\n .done((response) => {\n setNotifications(response.notifications || [])\n setUnreadCount(response.unread_count || 0)\n })\n .fail(() => {\n // Silent fail - notifications are not critical\n })\n .always(() => {\n setLoading(false)\n })\n }, [])\n\n const fetchUnreadCount = useCallback(() => {\n $.ajax({\n method: 'GET',\n url: '/user_notifications/unread_count',\n dataType: 'json',\n })\n .done((response) => {\n setUnreadCount(response.unread_count || 0)\n })\n .fail(() => {\n // Silent fail - notifications are not critical\n })\n }, [])\n\n useEffect(() => {\n fetchUnreadCount()\n const interval = setInterval(fetchUnreadCount, 60000)\n return () => clearInterval(interval)\n }, [fetchUnreadCount])\n\n const handleClick = (event) => {\n setAnchorEl(event.currentTarget)\n fetchNotifications()\n }\n\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n const handleMarkAsRead = (notificationId, event) => {\n event.stopPropagation()\n $.ajax({\n method: 'PUT',\n url: `/user_notifications/${notificationId}/mark_as_read`,\n dataType: 'json',\n })\n .done(() => {\n setNotifications((prev) =>\n prev.map((n) =>\n n.id === notificationId ? { ...n, read: true, read_at: new Date().toISOString() } : n\n )\n )\n setUnreadCount((prev) => Math.max(0, prev - 1))\n })\n .fail(() => {\n window.flash.error('Failed to mark notification as read')\n })\n }\n\n const handleDismiss = (notificationId, event) => {\n event.stopPropagation()\n $.ajax({\n method: 'DELETE',\n url: `/user_notifications/${notificationId}/dismiss`,\n dataType: 'json',\n })\n .done(() => {\n const notification = notifications.find((n) => n.id === notificationId)\n setNotifications((prev) => prev.filter((n) => n.id !== notificationId))\n if (notification && !notification.read) {\n setUnreadCount((prev) => Math.max(0, prev - 1))\n }\n })\n .fail(() => {\n window.flash.error('Failed to dismiss notification')\n })\n }\n\n const handleMarkAllAsRead = () => {\n $.ajax({\n method: 'PUT',\n url: '/user_notifications/mark_all_as_read',\n dataType: 'json',\n })\n .done(() => {\n setNotifications((prev) =>\n prev.map((n) => ({ ...n, read: true, read_at: new Date().toISOString() }))\n )\n setUnreadCount(0)\n })\n .fail(() => {\n window.flash.error('Failed to mark all notifications as read')\n })\n }\n\n const handleNotificationClick = (notification) => {\n if (!notification.read) {\n // Use fetch with keepalive to ensure the request completes even if the page navigates away\n const csrfToken = document.querySelector('meta[name=\"csrf-token\"]')?.getAttribute('content')\n fetch(`/user_notifications/${notification.id}/mark_as_read`, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRF-Token': csrfToken,\n },\n keepalive: true,\n })\n }\n handleClose()\n if (notification.link) {\n window.location.href = notification.link\n }\n }\n\n const getNotificationIcon = (notificationType) => {\n switch (notificationType) {\n case 'subscription_version_submitted':\n case 'subscription_version_applied':\n return \n default:\n return \n }\n }\n\n const formatDate = (dateString) => {\n if (!dateString) { return '' }\n return dayjs(dateString).fromNow()\n }\n\n return (\n <>\n \n \n \n \n \n\n \n >\n )\n}\n\nexport default NotificationBell\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3m-3 11H8v-5h8zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m-1-9H6v4h12z\"\n}), 'Print');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 2c-4.97 0-9 4.03-9 9 0 4.17 2.84 7.67 6.69 8.69L12 22l2.31-2.31C18.16 18.67 21 15.17 21 11c0-4.97-4.03-9-9-9m0 2c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3m0 14.3c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22\"\n}), 'PersonPin');","import React from 'react'\nimport Box from '@mui/material/Box'\nimport CardContent from '@mui/material/CardContent'\nimport PersonPinIcon from '@mui/icons-material/PersonPin'\nimport dayjs from '../utilities/dayjs'\n\nexport default class Appointment extends React.Component {\n\n render() {\n const props = this.props\n const { apt, isFiltered } = props\n\n const emrPatientId = apt.emr_patient_id\n const department = apt.department\n const departmentId = department ? department.emr_department_id : undefined\n\n const parseAptTime = (aptTime, format) => dayjs(aptTime).utcOffset(props.timeZoneOffset).format(format)\n const aptTime = parseAptTime(apt.appointment_time, 'h:mm a')\n const aptDate = parseAptTime(apt.appointment_time, 'M/D')\n\n let cssClasses = 'apt-card card button'\n if (apt.id === props.activeAppointmentId) {\n cssClasses += ' blue-bkg white-text z-depth-0'\n } else if (isFiltered) {\n cssClasses += ' filtered-appointment'\n } else {\n cssClasses += ' white'\n }\n\n return (\n \n
\n \n \n {aptTime}
\n \n \n {apt.patient_full_name}
\n \n\n {!isFiltered && renderPatientDetails(apt, props.emr)}\n {!isFiltered && renderAptProviderName(apt.user, props.currentUser)}\n {!isFiltered && renderEncounterDetails(apt)}\n\n \n {`${apt.duration} min - ${apt.reason}`}
\n \n\n {!isFiltered && renderInsuranceDetails(apt.patient)}\n {!isFiltered && renderActionCount(apt)}\n \n \n
\n )\n }\n}\n\nconst renderAptProviderName = (user, currentUser) => {\n let aptProviderName\n\n if (currentUser.medical_assistant) {\n aptProviderName =\n (\n \n \n {user.full_name}\n \n )\n }\n\n return aptProviderName\n}\n\nconst renderAptDate = (aptDate) => {\n return (\n \n {aptDate}
\n \n )\n}\n\nconst renderPatientDetails = (apt, emr) => {\n const patient = apt.patient\n const ageFormattedText = formatAge(patient)\n const sex = patient ? patient.sex.charAt(0) : 'gender not found'\n const emrPatientIdDisplay = formatEmrPatientId(apt.emr_patient_id, patient, emr)\n\n const patientDetails = (\n \n \n {`${ageFormattedText} ${sex}`}{emrPatientIdDisplay}\n
\n \n )\n\n return patientDetails\n}\n\n// TODO test this when js tests work again\nconst formatAge = (patient) => {\n let ageFormattedText\n\n if (patient) {\n const birthDate = patient.birthdate\n if (patient.age === 0) {\n const monthsOld = dayjs().diff(dayjs(birthDate), 'months')\n ageFormattedText = `${monthsOld}mo `\n } else if (patient.age <= 3) {\n const leftOverMonths = dayjs().diff(dayjs(birthDate), 'months') % 12\n ageFormattedText = `${patient.age}y${leftOverMonths}mo `\n } else if (patient.age >= 3) {\n ageFormattedText = `${patient.age}yo `\n }\n }\n ageFormattedText = ageFormattedText ? ageFormattedText : 'age not found '\n\n return ageFormattedText\n}\n\nconst formatEmrPatientId = (emrPatientId, patient, emr) => {\n let emrPatientIdDisplay = ' | '\n\n if (emr === 'allscripts' && patient.mrn) {\n emrPatientIdDisplay += patient.mrn\n } else if (emrPatientId) {\n emrPatientIdDisplay += emrPatientId\n } else {\n emrPatientIdDisplay += 'emr patient id not found'\n }\n\n return emrPatientIdDisplay\n}\n\nconst renderEncounterDetails = (apt) => {\n const encounterStatus = getEncounterStatusText(apt.encounter, apt.appointment_status)\n\n const encounterDetails = (\n \n {encounterStatus}
\n \n )\n\n return encounterDetails\n}\n\nconst renderInsuranceDetails = (patient) => {\n let planName\n\n if (patient && patient.insurance_policy) {\n planName = patient.insurance_policy.plan_name\n } else {\n planName = 'No insurance found'\n }\n\n const insuranceDetails = (\n \n {planName}
\n \n )\n\n return insuranceDetails\n}\n\nconst renderActionCount = ({ actions: count }) => {\n const actionCount = (\n \n {count + ' action(s)'}
\n \n )\n\n return actionCount\n}\n","import React from 'react'\nimport Box from '@mui/material/Box'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Appointment from './Appointment.jsx'\n\nconst renderAppointments = (props) => {\n const appointmentsList = Array.isArray(props.appointmentsList) ? props.appointmentsList : []\n const emr = props.emr\n const orgId = props.organizationId\n const aptTypesBlacklist = props.aptTypesBlacklist\n const timeZoneOffset = props.timeZoneOffset\n const getRecommendations = props.getRecommendations\n const activeAppointmentId = props.activeAppointment && props.activeAppointment.id\n const appointments = appointmentsList.map((apt, index) => {\n // for react joyride\n let appointmentCardClassName = '.apt-card'\n if (index === 0) {\n appointmentCardClassName = '.apt-card-react-joyride'\n }\n const isFiltered = _.includes(aptTypesBlacklist, apt.reason) || apt.has_queued_orders\n\n let aptCard\n if (apt.patient_id) {\n aptCard = (\n \n )\n } else {\n console.error('renderAppointments error', { context: `error on appointment ${apt.id}` })\n aptCard = (\n \n \n \n {`The data for Patient #${apt.emr_patient_id} is invalid.`}
\n \n Verify that the patient's birthdate and sex exist.\n If you have further questions contact support@amalgamrx.com\n
\n \n \n \n )\n }\n\n return aptCard\n })\n\n return appointments\n}\n\nconst AppointmentsTable = props => (\n \n {renderAppointments(props)}\n
\n)\n\nexport default AppointmentsTable\n","import MenuItem from '@mui/material/MenuItem'\nimport { ThemeProvider, createTheme, styled } from '@mui/material/styles'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { Select } from '@mui/material'\n\nconst CareTeamSelector = (props) => {\n const muiTheme = createTheme({\n palette: {\n primary: { main: '#1684F9' },\n },\n })\n\n const careTeams = _.map(props.careTeams, ct => (\n \n ))\n\n const StyledSelect = styled(Select)({ \n paddingLeft: '15px',\n })\n\n return (\n \n \n \n {careTeams}\n \n
\n \n )\n}\n\nCareTeamSelector.propTypes = {\n careTeams: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n name: PropTypes.string,\n })),\n careTeamChangeHandler: PropTypes.func,\n selectedCareTeam: PropTypes.string,\n}\n\nexport default CareTeamSelector\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6z\"\n}), 'KeyboardArrowLeft');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z\"\n}), 'KeyboardArrowRight');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M9 11H7v2h2zm4 0h-2v2h2zm4 0h-2v2h2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V9h14z\"\n}), 'DateRange');","import React from 'react'\nimport Box from '@mui/material/Box'\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft'\nimport KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'\nimport DateRangeIcon from '@mui/icons-material/DateRange'\n\nexport default class DateNavigator extends React.Component {\n render() {\n return (\n \n \n\n \n {this.props.selectedMomentDate.format('ddd M/D')}\n \n \n\n \n \n )\n }\n}\n","// src/helpers.ts\nfunction isOfType(type) {\n return (value) => typeof value === type;\n}\nvar isFunction = isOfType(\"function\");\nvar isNull = (value) => {\n return value === null;\n};\nvar isRegex = (value) => {\n return Object.prototype.toString.call(value).slice(8, -1) === \"RegExp\";\n};\nvar isObject = (value) => {\n return !isUndefined(value) && !isNull(value) && (isFunction(value) || typeof value === \"object\");\n};\nvar isUndefined = isOfType(\"undefined\");\n\n// src/index.ts\nfunction equalArray(left, right) {\n const { length } = left;\n if (length !== right.length) {\n return false;\n }\n for (let index = length; index-- !== 0; ) {\n if (!equal(left[index], right[index])) {\n return false;\n }\n }\n return true;\n}\nfunction equalArrayBuffer(left, right) {\n if (left.byteLength !== right.byteLength) {\n return false;\n }\n const view1 = new DataView(left.buffer);\n const view2 = new DataView(right.buffer);\n let index = left.byteLength;\n while (index--) {\n if (view1.getUint8(index) !== view2.getUint8(index)) {\n return false;\n }\n }\n return true;\n}\nfunction equalMap(left, right) {\n if (left.size !== right.size) {\n return false;\n }\n for (const index of left.entries()) {\n if (!right.has(index[0])) {\n return false;\n }\n }\n for (const index of left.entries()) {\n if (!equal(index[1], right.get(index[0]))) {\n return false;\n }\n }\n return true;\n}\nfunction equalSet(left, right) {\n if (left.size !== right.size) {\n return false;\n }\n for (const index of left.entries()) {\n if (!right.has(index[0])) {\n return false;\n }\n }\n return true;\n}\nfunction equal(left, right) {\n if (left === right) {\n return true;\n }\n if (left && isObject(left) && right && isObject(right)) {\n if (left.constructor !== right.constructor) {\n return false;\n }\n if (Array.isArray(left) && Array.isArray(right)) {\n return equalArray(left, right);\n }\n if (left instanceof Map && right instanceof Map) {\n return equalMap(left, right);\n }\n if (left instanceof Set && right instanceof Set) {\n return equalSet(left, right);\n }\n if (ArrayBuffer.isView(left) && ArrayBuffer.isView(right)) {\n return equalArrayBuffer(left, right);\n }\n if (isRegex(left) && isRegex(right)) {\n return left.source === right.source && left.flags === right.flags;\n }\n if (left.valueOf !== Object.prototype.valueOf) {\n return left.valueOf() === right.valueOf();\n }\n if (left.toString !== Object.prototype.toString) {\n return left.toString() === right.toString();\n }\n const leftKeys = Object.keys(left);\n const rightKeys = Object.keys(right);\n if (leftKeys.length !== rightKeys.length) {\n return false;\n }\n for (let index = leftKeys.length; index-- !== 0; ) {\n if (!Object.prototype.hasOwnProperty.call(right, leftKeys[index])) {\n return false;\n }\n }\n for (let index = leftKeys.length; index-- !== 0; ) {\n const key = leftKeys[index];\n if (key === \"_owner\" && left.$$typeof) {\n continue;\n }\n if (!equal(left[key], right[key])) {\n return false;\n }\n }\n return true;\n }\n if (Number.isNaN(left) && Number.isNaN(right)) {\n return true;\n }\n return left === right;\n}\nexport {\n equal as default\n};\n//# sourceMappingURL=index.mjs.map","// src/helpers.ts\nvar objectTypes = [\n \"Array\",\n \"ArrayBuffer\",\n \"AsyncFunction\",\n \"AsyncGenerator\",\n \"AsyncGeneratorFunction\",\n \"Date\",\n \"Error\",\n \"Function\",\n \"Generator\",\n \"GeneratorFunction\",\n \"HTMLElement\",\n \"Map\",\n \"Object\",\n \"Promise\",\n \"RegExp\",\n \"Set\",\n \"WeakMap\",\n \"WeakSet\"\n];\nvar primitiveTypes = [\n \"bigint\",\n \"boolean\",\n \"null\",\n \"number\",\n \"string\",\n \"symbol\",\n \"undefined\"\n];\nfunction getObjectType(value) {\n const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);\n if (/HTML\\w+Element/.test(objectTypeName)) {\n return \"HTMLElement\";\n }\n if (isObjectType(objectTypeName)) {\n return objectTypeName;\n }\n return void 0;\n}\nfunction isObjectOfType(type) {\n return (value) => getObjectType(value) === type;\n}\nfunction isObjectType(name) {\n return objectTypes.includes(name);\n}\nfunction isOfType(type) {\n return (value) => typeof value === type;\n}\nfunction isPrimitiveType(name) {\n return primitiveTypes.includes(name);\n}\n\n// src/index.ts\nvar DOM_PROPERTIES_TO_CHECK = [\n \"innerHTML\",\n \"ownerDocument\",\n \"style\",\n \"attributes\",\n \"nodeValue\"\n];\nfunction is(value) {\n if (value === null) {\n return \"null\";\n }\n switch (typeof value) {\n case \"bigint\":\n return \"bigint\";\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n case \"symbol\":\n return \"symbol\";\n case \"undefined\":\n return \"undefined\";\n default:\n }\n if (is.array(value)) {\n return \"Array\";\n }\n if (is.plainFunction(value)) {\n return \"Function\";\n }\n const tagType = getObjectType(value);\n if (tagType) {\n return tagType;\n }\n return \"Object\";\n}\nis.array = Array.isArray;\nis.arrayOf = (target, predicate) => {\n if (!is.array(target) && !is.function(predicate)) {\n return false;\n }\n return target.every((d) => predicate(d));\n};\nis.asyncGeneratorFunction = (value) => getObjectType(value) === \"AsyncGeneratorFunction\";\nis.asyncFunction = isObjectOfType(\"AsyncFunction\");\nis.bigint = isOfType(\"bigint\");\nis.boolean = (value) => {\n return value === true || value === false;\n};\nis.date = isObjectOfType(\"Date\");\nis.defined = (value) => !is.undefined(value);\nis.domElement = (value) => {\n return is.object(value) && !is.plainObject(value) && value.nodeType === 1 && is.string(value.nodeName) && DOM_PROPERTIES_TO_CHECK.every((property) => property in value);\n};\nis.empty = (value) => {\n return is.string(value) && value.length === 0 || is.array(value) && value.length === 0 || is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0 || is.set(value) && value.size === 0 || is.map(value) && value.size === 0;\n};\nis.error = isObjectOfType(\"Error\");\nis.function = isOfType(\"function\");\nis.generator = (value) => {\n return is.iterable(value) && is.function(value.next) && is.function(value.throw);\n};\nis.generatorFunction = isObjectOfType(\"GeneratorFunction\");\nis.instanceOf = (instance, class_) => {\n if (!instance || !class_) {\n return false;\n }\n return Object.getPrototypeOf(instance) === class_.prototype;\n};\nis.iterable = (value) => {\n return !is.nullOrUndefined(value) && is.function(value[Symbol.iterator]);\n};\nis.map = isObjectOfType(\"Map\");\nis.nan = (value) => {\n return Number.isNaN(value);\n};\nis.null = (value) => {\n return value === null;\n};\nis.nullOrUndefined = (value) => {\n return is.null(value) || is.undefined(value);\n};\nis.number = (value) => {\n return isOfType(\"number\")(value) && !is.nan(value);\n};\nis.numericString = (value) => {\n return is.string(value) && value.length > 0 && !Number.isNaN(Number(value));\n};\nis.object = (value) => {\n return !is.nullOrUndefined(value) && (is.function(value) || typeof value === \"object\");\n};\nis.oneOf = (target, value) => {\n if (!is.array(target)) {\n return false;\n }\n return target.indexOf(value) > -1;\n};\nis.plainFunction = isObjectOfType(\"Function\");\nis.plainObject = (value) => {\n if (getObjectType(value) !== \"Object\") {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === null || prototype === Object.getPrototypeOf({});\n};\nis.primitive = (value) => is.null(value) || isPrimitiveType(typeof value);\nis.promise = isObjectOfType(\"Promise\");\nis.propertyOf = (target, key, predicate) => {\n if (!is.object(target) || !key) {\n return false;\n }\n const value = target[key];\n if (is.function(predicate)) {\n return predicate(value);\n }\n return is.defined(value);\n};\nis.regexp = isObjectOfType(\"RegExp\");\nis.set = isObjectOfType(\"Set\");\nis.string = isOfType(\"string\");\nis.symbol = isOfType(\"symbol\");\nis.undefined = isOfType(\"undefined\");\nis.weakMap = isObjectOfType(\"WeakMap\");\nis.weakSet = isObjectOfType(\"WeakSet\");\nvar src_default = is;\nexport {\n src_default as default\n};\n//# sourceMappingURL=index.mjs.map","// src/helpers.ts\nvar objectTypes = [\n \"Array\",\n \"ArrayBuffer\",\n \"AsyncFunction\",\n \"AsyncGenerator\",\n \"AsyncGeneratorFunction\",\n \"Date\",\n \"Error\",\n \"Function\",\n \"Generator\",\n \"GeneratorFunction\",\n \"HTMLElement\",\n \"Map\",\n \"Object\",\n \"Promise\",\n \"RegExp\",\n \"Set\",\n \"WeakMap\",\n \"WeakSet\"\n];\nvar primitiveTypes = [\n \"bigint\",\n \"boolean\",\n \"null\",\n \"number\",\n \"string\",\n \"symbol\",\n \"undefined\"\n];\nfunction getObjectType(value) {\n const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);\n if (/HTML\\w+Element/.test(objectTypeName)) {\n return \"HTMLElement\";\n }\n if (isObjectType(objectTypeName)) {\n return objectTypeName;\n }\n return void 0;\n}\nfunction isObjectOfType(type) {\n return (value) => getObjectType(value) === type;\n}\nfunction isObjectType(name) {\n return objectTypes.includes(name);\n}\nfunction isOfType(type) {\n return (value) => typeof value === type;\n}\nfunction isPrimitiveType(name) {\n return primitiveTypes.includes(name);\n}\n\n// src/index.ts\nvar DOM_PROPERTIES_TO_CHECK = [\n \"innerHTML\",\n \"ownerDocument\",\n \"style\",\n \"attributes\",\n \"nodeValue\"\n];\nfunction is(value) {\n if (value === null) {\n return \"null\";\n }\n switch (typeof value) {\n case \"bigint\":\n return \"bigint\";\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n case \"symbol\":\n return \"symbol\";\n case \"undefined\":\n return \"undefined\";\n default:\n }\n if (is.array(value)) {\n return \"Array\";\n }\n if (is.plainFunction(value)) {\n return \"Function\";\n }\n const tagType = getObjectType(value);\n if (tagType) {\n return tagType;\n }\n return \"Object\";\n}\nis.array = Array.isArray;\nis.arrayOf = (target, predicate) => {\n if (!is.array(target) && !is.function(predicate)) {\n return false;\n }\n return target.every((d) => predicate(d));\n};\nis.asyncGeneratorFunction = (value) => getObjectType(value) === \"AsyncGeneratorFunction\";\nis.asyncFunction = isObjectOfType(\"AsyncFunction\");\nis.bigint = isOfType(\"bigint\");\nis.boolean = (value) => {\n return value === true || value === false;\n};\nis.date = isObjectOfType(\"Date\");\nis.defined = (value) => !is.undefined(value);\nis.domElement = (value) => {\n return is.object(value) && !is.plainObject(value) && value.nodeType === 1 && is.string(value.nodeName) && DOM_PROPERTIES_TO_CHECK.every((property) => property in value);\n};\nis.empty = (value) => {\n return is.string(value) && value.length === 0 || is.array(value) && value.length === 0 || is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0 || is.set(value) && value.size === 0 || is.map(value) && value.size === 0;\n};\nis.error = isObjectOfType(\"Error\");\nis.function = isOfType(\"function\");\nis.generator = (value) => {\n return is.iterable(value) && is.function(value.next) && is.function(value.throw);\n};\nis.generatorFunction = isObjectOfType(\"GeneratorFunction\");\nis.instanceOf = (instance, class_) => {\n if (!instance || !class_) {\n return false;\n }\n return Object.getPrototypeOf(instance) === class_.prototype;\n};\nis.iterable = (value) => {\n return !is.nullOrUndefined(value) && is.function(value[Symbol.iterator]);\n};\nis.map = isObjectOfType(\"Map\");\nis.nan = (value) => {\n return Number.isNaN(value);\n};\nis.null = (value) => {\n return value === null;\n};\nis.nullOrUndefined = (value) => {\n return is.null(value) || is.undefined(value);\n};\nis.number = (value) => {\n return isOfType(\"number\")(value) && !is.nan(value);\n};\nis.numericString = (value) => {\n return is.string(value) && value.length > 0 && !Number.isNaN(Number(value));\n};\nis.object = (value) => {\n return !is.nullOrUndefined(value) && (is.function(value) || typeof value === \"object\");\n};\nis.oneOf = (target, value) => {\n if (!is.array(target)) {\n return false;\n }\n return target.indexOf(value) > -1;\n};\nis.plainFunction = isObjectOfType(\"Function\");\nis.plainObject = (value) => {\n if (getObjectType(value) !== \"Object\") {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === null || prototype === Object.getPrototypeOf({});\n};\nis.primitive = (value) => is.null(value) || isPrimitiveType(typeof value);\nis.promise = isObjectOfType(\"Promise\");\nis.propertyOf = (target, key, predicate) => {\n if (!is.object(target) || !key) {\n return false;\n }\n const value = target[key];\n if (is.function(predicate)) {\n return predicate(value);\n }\n return is.defined(value);\n};\nis.regexp = isObjectOfType(\"RegExp\");\nis.set = isObjectOfType(\"Set\");\nis.string = isOfType(\"string\");\nis.symbol = isOfType(\"symbol\");\nis.undefined = isOfType(\"undefined\");\nis.weakMap = isObjectOfType(\"WeakMap\");\nis.weakSet = isObjectOfType(\"WeakSet\");\nvar src_default = is;\nexport {\n src_default as default\n};\n//# sourceMappingURL=index.mjs.map","// src/index.ts\nimport equal2 from \"@gilbarbara/deep-equal\";\nimport is2 from \"is-lite\";\n\n// src/helpers.ts\nimport equal from \"@gilbarbara/deep-equal\";\nimport is from \"is-lite\";\nfunction canHaveLength(...arguments_) {\n return arguments_.every((d) => is.string(d) || is.array(d) || is.plainObject(d));\n}\nfunction checkEquality(left, right, value) {\n if (!isSameType(left, right)) {\n return false;\n }\n if ([left, right].every(is.array)) {\n return !left.some(hasValue(value)) && right.some(hasValue(value));\n }\n if ([left, right].every(is.plainObject)) {\n return !Object.entries(left).some(hasEntry(value)) && Object.entries(right).some(hasEntry(value));\n }\n return right === value;\n}\nfunction compareNumbers(previousData, data, options) {\n const { actual, key, previous, type } = options;\n const left = nested(previousData, key);\n const right = nested(data, key);\n let changed = [left, right].every(is.number) && (type === \"increased\" ? left < right : left > right);\n if (!is.undefined(actual)) {\n changed = changed && right === actual;\n }\n if (!is.undefined(previous)) {\n changed = changed && left === previous;\n }\n return changed;\n}\nfunction compareValues(previousData, data, options) {\n const { key, type, value } = options;\n const left = nested(previousData, key);\n const right = nested(data, key);\n const primary = type === \"added\" ? left : right;\n const secondary = type === \"added\" ? right : left;\n if (!is.nullOrUndefined(value)) {\n if (is.defined(primary)) {\n if (is.array(primary) || is.plainObject(primary)) {\n return checkEquality(primary, secondary, value);\n }\n } else {\n return equal(secondary, value);\n }\n return false;\n }\n if ([left, right].every(is.array)) {\n return !secondary.every(isEqualPredicate(primary));\n }\n if ([left, right].every(is.plainObject)) {\n return hasExtraKeys(Object.keys(primary), Object.keys(secondary));\n }\n return ![left, right].every((d) => is.primitive(d) && is.defined(d)) && (type === \"added\" ? !is.defined(left) && is.defined(right) : is.defined(left) && !is.defined(right));\n}\nfunction getIterables(previousData, data, { key } = {}) {\n let left = nested(previousData, key);\n let right = nested(data, key);\n if (!isSameType(left, right)) {\n throw new TypeError(\"Inputs have different types\");\n }\n if (!canHaveLength(left, right)) {\n throw new TypeError(\"Inputs don't have length\");\n }\n if ([left, right].every(is.plainObject)) {\n left = Object.keys(left);\n right = Object.keys(right);\n }\n return [left, right];\n}\nfunction hasEntry(input) {\n return ([key, value]) => {\n if (is.array(input)) {\n return equal(input, value) || input.some((d) => equal(d, value) || is.array(value) && isEqualPredicate(value)(d));\n }\n if (is.plainObject(input) && input[key]) {\n return !!input[key] && equal(input[key], value);\n }\n return equal(input, value);\n };\n}\nfunction hasExtraKeys(left, right) {\n return right.some((d) => !left.includes(d));\n}\nfunction hasValue(input) {\n return (value) => {\n if (is.array(input)) {\n return input.some((d) => equal(d, value) || is.array(value) && isEqualPredicate(value)(d));\n }\n return equal(input, value);\n };\n}\nfunction includesOrEqualsTo(previousValue, value) {\n return is.array(previousValue) ? previousValue.some((d) => equal(d, value)) : equal(previousValue, value);\n}\nfunction isEqualPredicate(data) {\n return (value) => data.some((d) => equal(d, value));\n}\nfunction isSameType(...arguments_) {\n return arguments_.every(is.array) || arguments_.every(is.number) || arguments_.every(is.plainObject) || arguments_.every(is.string);\n}\nfunction nested(data, property) {\n if (is.plainObject(data) || is.array(data)) {\n if (is.string(property)) {\n const props = property.split(\".\");\n return props.reduce((acc, d) => acc && acc[d], data);\n }\n if (is.number(property)) {\n return data[property];\n }\n return data;\n }\n return data;\n}\n\n// src/index.ts\nfunction treeChanges(previousData, data) {\n if ([previousData, data].some(is2.nullOrUndefined)) {\n throw new Error(\"Missing required parameters\");\n }\n if (![previousData, data].every((d) => is2.plainObject(d) || is2.array(d))) {\n throw new Error(\"Expected plain objects or array\");\n }\n const added = (key, value) => {\n try {\n return compareValues(previousData, data, { key, type: \"added\", value });\n } catch {\n return false;\n }\n };\n const changed = (key, actual, previous) => {\n try {\n const left = nested(previousData, key);\n const right = nested(data, key);\n const hasActual = is2.defined(actual);\n const hasPrevious = is2.defined(previous);\n if (hasActual || hasPrevious) {\n const leftComparator = hasPrevious ? includesOrEqualsTo(previous, left) : !includesOrEqualsTo(actual, left);\n const rightComparator = includesOrEqualsTo(actual, right);\n return leftComparator && rightComparator;\n }\n if ([left, right].every(is2.array) || [left, right].every(is2.plainObject)) {\n return !equal2(left, right);\n }\n return left !== right;\n } catch {\n return false;\n }\n };\n const changedFrom = (key, previous, actual) => {\n if (!is2.defined(key)) {\n return false;\n }\n try {\n const left = nested(previousData, key);\n const right = nested(data, key);\n const hasActual = is2.defined(actual);\n return includesOrEqualsTo(previous, left) && (hasActual ? includesOrEqualsTo(actual, right) : !hasActual);\n } catch {\n return false;\n }\n };\n const decreased = (key, actual, previous) => {\n if (!is2.defined(key)) {\n return false;\n }\n try {\n return compareNumbers(previousData, data, { key, actual, previous, type: \"decreased\" });\n } catch {\n return false;\n }\n };\n const emptied = (key) => {\n try {\n const [left, right] = getIterables(previousData, data, { key });\n return !!left.length && !right.length;\n } catch {\n return false;\n }\n };\n const filled = (key) => {\n try {\n const [left, right] = getIterables(previousData, data, { key });\n return !left.length && !!right.length;\n } catch {\n return false;\n }\n };\n const increased = (key, actual, previous) => {\n if (!is2.defined(key)) {\n return false;\n }\n try {\n return compareNumbers(previousData, data, { key, actual, previous, type: \"increased\" });\n } catch {\n return false;\n }\n };\n const removed = (key, value) => {\n try {\n return compareValues(previousData, data, { key, type: \"removed\", value });\n } catch {\n return false;\n }\n };\n return { added, changed, changedFrom, decreased, emptied, filled, increased, removed };\n}\nexport {\n treeChanges as default\n};\n//# sourceMappingURL=index.mjs.map","/**!\n * @fileOverview Kickass library to create and place poppers near their reference elements.\n * @version 1.16.1\n * @license\n * Copyright (c) 2016 Federico Zivolo and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nvar isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';\n\nvar timeoutDuration = function () {\n var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];\n for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {\n if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {\n return 1;\n }\n }\n return 0;\n}();\n\nfunction microtaskDebounce(fn) {\n var called = false;\n return function () {\n if (called) {\n return;\n }\n called = true;\n window.Promise.resolve().then(function () {\n called = false;\n fn();\n });\n };\n}\n\nfunction taskDebounce(fn) {\n var scheduled = false;\n return function () {\n if (!scheduled) {\n scheduled = true;\n setTimeout(function () {\n scheduled = false;\n fn();\n }, timeoutDuration);\n }\n };\n}\n\nvar supportsMicroTasks = isBrowser && window.Promise;\n\n/**\n* Create a debounced version of a method, that's asynchronously deferred\n* but called in the minimum time possible.\n*\n* @method\n* @memberof Popper.Utils\n* @argument {Function} fn\n* @returns {Function}\n*/\nvar debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;\n\n/**\n * Check if the given variable is a function\n * @method\n * @memberof Popper.Utils\n * @argument {Any} functionToCheck - variable to check\n * @returns {Boolean} answer to: is a function?\n */\nfunction isFunction(functionToCheck) {\n var getType = {};\n return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';\n}\n\n/**\n * Get CSS computed property of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Eement} element\n * @argument {String} property\n */\nfunction getStyleComputedProperty(element, property) {\n if (element.nodeType !== 1) {\n return [];\n }\n // NOTE: 1 DOM access here\n var window = element.ownerDocument.defaultView;\n var css = window.getComputedStyle(element, null);\n return property ? css[property] : css;\n}\n\n/**\n * Returns the parentNode or the host of the element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} parent\n */\nfunction getParentNode(element) {\n if (element.nodeName === 'HTML') {\n return element;\n }\n return element.parentNode || element.host;\n}\n\n/**\n * Returns the scrolling parent of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} scroll parent\n */\nfunction getScrollParent(element) {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n if (!element) {\n return document.body;\n }\n\n switch (element.nodeName) {\n case 'HTML':\n case 'BODY':\n return element.ownerDocument.body;\n case '#document':\n return element.body;\n }\n\n // Firefox want us to check `-x` and `-y` variations as well\n\n var _getStyleComputedProp = getStyleComputedProperty(element),\n overflow = _getStyleComputedProp.overflow,\n overflowX = _getStyleComputedProp.overflowX,\n overflowY = _getStyleComputedProp.overflowY;\n\n if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {\n return element;\n }\n\n return getScrollParent(getParentNode(element));\n}\n\n/**\n * Returns the reference node of the reference object, or the reference object itself.\n * @method\n * @memberof Popper.Utils\n * @param {Element|Object} reference - the reference element (the popper will be relative to this)\n * @returns {Element} parent\n */\nfunction getReferenceNode(reference) {\n return reference && reference.referenceNode ? reference.referenceNode : reference;\n}\n\nvar isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);\nvar isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);\n\n/**\n * Determines if the browser is Internet Explorer\n * @method\n * @memberof Popper.Utils\n * @param {Number} version to check\n * @returns {Boolean} isIE\n */\nfunction isIE(version) {\n if (version === 11) {\n return isIE11;\n }\n if (version === 10) {\n return isIE10;\n }\n return isIE11 || isIE10;\n}\n\n/**\n * Returns the offset parent of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} offset parent\n */\nfunction getOffsetParent(element) {\n if (!element) {\n return document.documentElement;\n }\n\n var noOffsetParent = isIE(10) ? document.body : null;\n\n // NOTE: 1 DOM access here\n var offsetParent = element.offsetParent || null;\n // Skip hidden elements which don't have an offsetParent\n while (offsetParent === noOffsetParent && element.nextElementSibling) {\n offsetParent = (element = element.nextElementSibling).offsetParent;\n }\n\n var nodeName = offsetParent && offsetParent.nodeName;\n\n if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {\n return element ? element.ownerDocument.documentElement : document.documentElement;\n }\n\n // .offsetParent will return the closest TH, TD or TABLE in case\n // no offsetParent is present, I hate this job...\n if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {\n return getOffsetParent(offsetParent);\n }\n\n return offsetParent;\n}\n\nfunction isOffsetContainer(element) {\n var nodeName = element.nodeName;\n\n if (nodeName === 'BODY') {\n return false;\n }\n return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;\n}\n\n/**\n * Finds the root node (document, shadowDOM root) of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} node\n * @returns {Element} root node\n */\nfunction getRoot(node) {\n if (node.parentNode !== null) {\n return getRoot(node.parentNode);\n }\n\n return node;\n}\n\n/**\n * Finds the offset parent common to the two provided nodes\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element1\n * @argument {Element} element2\n * @returns {Element} common offset parent\n */\nfunction findCommonOffsetParent(element1, element2) {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {\n return document.documentElement;\n }\n\n // Here we make sure to give as \"start\" the element that comes first in the DOM\n var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;\n var start = order ? element1 : element2;\n var end = order ? element2 : element1;\n\n // Get common ancestor container\n var range = document.createRange();\n range.setStart(start, 0);\n range.setEnd(end, 0);\n var commonAncestorContainer = range.commonAncestorContainer;\n\n // Both nodes are inside #document\n\n if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {\n if (isOffsetContainer(commonAncestorContainer)) {\n return commonAncestorContainer;\n }\n\n return getOffsetParent(commonAncestorContainer);\n }\n\n // one of the nodes is inside shadowDOM, find which one\n var element1root = getRoot(element1);\n if (element1root.host) {\n return findCommonOffsetParent(element1root.host, element2);\n } else {\n return findCommonOffsetParent(element1, getRoot(element2).host);\n }\n}\n\n/**\n * Gets the scroll value of the given element in the given side (top and left)\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @argument {String} side `top` or `left`\n * @returns {number} amount of scrolled pixels\n */\nfunction getScroll(element) {\n var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';\n\n var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';\n var nodeName = element.nodeName;\n\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n var html = element.ownerDocument.documentElement;\n var scrollingElement = element.ownerDocument.scrollingElement || html;\n return scrollingElement[upperSide];\n }\n\n return element[upperSide];\n}\n\n/*\n * Sum or subtract the element scroll values (left and top) from a given rect object\n * @method\n * @memberof Popper.Utils\n * @param {Object} rect - Rect object you want to change\n * @param {HTMLElement} element - The element from the function reads the scroll values\n * @param {Boolean} subtract - set to true if you want to subtract the scroll values\n * @return {Object} rect - The modifier rect object\n */\nfunction includeScroll(rect, element) {\n var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var scrollTop = getScroll(element, 'top');\n var scrollLeft = getScroll(element, 'left');\n var modifier = subtract ? -1 : 1;\n rect.top += scrollTop * modifier;\n rect.bottom += scrollTop * modifier;\n rect.left += scrollLeft * modifier;\n rect.right += scrollLeft * modifier;\n return rect;\n}\n\n/*\n * Helper to detect borders of a given element\n * @method\n * @memberof Popper.Utils\n * @param {CSSStyleDeclaration} styles\n * Result of `getStyleComputedProperty` on the given element\n * @param {String} axis - `x` or `y`\n * @return {number} borders - The borders size of the given axis\n */\n\nfunction getBordersSize(styles, axis) {\n var sideA = axis === 'x' ? 'Left' : 'Top';\n var sideB = sideA === 'Left' ? 'Right' : 'Bottom';\n\n return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);\n}\n\nfunction getSize(axis, body, html, computedStyle) {\n return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);\n}\n\nfunction getWindowSizes(document) {\n var body = document.body;\n var html = document.documentElement;\n var computedStyle = isIE(10) && getComputedStyle(html);\n\n return {\n height: getSize('Height', body, html, computedStyle),\n width: getSize('Width', body, html, computedStyle)\n };\n}\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\n\n\n\n\nvar defineProperty = function (obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n};\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\n/**\n * Given element offsets, generate an output similar to getBoundingClientRect\n * @method\n * @memberof Popper.Utils\n * @argument {Object} offsets\n * @returns {Object} ClientRect like output\n */\nfunction getClientRect(offsets) {\n return _extends({}, offsets, {\n right: offsets.left + offsets.width,\n bottom: offsets.top + offsets.height\n });\n}\n\n/**\n * Get bounding client rect of given element\n * @method\n * @memberof Popper.Utils\n * @param {HTMLElement} element\n * @return {Object} client rect\n */\nfunction getBoundingClientRect(element) {\n var rect = {};\n\n // IE10 10 FIX: Please, don't ask, the element isn't\n // considered in DOM in some circumstances...\n // This isn't reproducible in IE10 compatibility mode of IE11\n try {\n if (isIE(10)) {\n rect = element.getBoundingClientRect();\n var scrollTop = getScroll(element, 'top');\n var scrollLeft = getScroll(element, 'left');\n rect.top += scrollTop;\n rect.left += scrollLeft;\n rect.bottom += scrollTop;\n rect.right += scrollLeft;\n } else {\n rect = element.getBoundingClientRect();\n }\n } catch (e) {}\n\n var result = {\n left: rect.left,\n top: rect.top,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top\n };\n\n // subtract scrollbar size from sizes\n var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};\n var width = sizes.width || element.clientWidth || result.width;\n var height = sizes.height || element.clientHeight || result.height;\n\n var horizScrollbar = element.offsetWidth - width;\n var vertScrollbar = element.offsetHeight - height;\n\n // if an hypothetical scrollbar is detected, we must be sure it's not a `border`\n // we make this check conditional for performance reasons\n if (horizScrollbar || vertScrollbar) {\n var styles = getStyleComputedProperty(element);\n horizScrollbar -= getBordersSize(styles, 'x');\n vertScrollbar -= getBordersSize(styles, 'y');\n\n result.width -= horizScrollbar;\n result.height -= vertScrollbar;\n }\n\n return getClientRect(result);\n}\n\nfunction getOffsetRectRelativeToArbitraryNode(children, parent) {\n var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var isIE10 = isIE(10);\n var isHTML = parent.nodeName === 'HTML';\n var childrenRect = getBoundingClientRect(children);\n var parentRect = getBoundingClientRect(parent);\n var scrollParent = getScrollParent(children);\n\n var styles = getStyleComputedProperty(parent);\n var borderTopWidth = parseFloat(styles.borderTopWidth);\n var borderLeftWidth = parseFloat(styles.borderLeftWidth);\n\n // In cases where the parent is fixed, we must ignore negative scroll in offset calc\n if (fixedPosition && isHTML) {\n parentRect.top = Math.max(parentRect.top, 0);\n parentRect.left = Math.max(parentRect.left, 0);\n }\n var offsets = getClientRect({\n top: childrenRect.top - parentRect.top - borderTopWidth,\n left: childrenRect.left - parentRect.left - borderLeftWidth,\n width: childrenRect.width,\n height: childrenRect.height\n });\n offsets.marginTop = 0;\n offsets.marginLeft = 0;\n\n // Subtract margins of documentElement in case it's being used as parent\n // we do this only on HTML because it's the only element that behaves\n // differently when margins are applied to it. The margins are included in\n // the box of the documentElement, in the other cases not.\n if (!isIE10 && isHTML) {\n var marginTop = parseFloat(styles.marginTop);\n var marginLeft = parseFloat(styles.marginLeft);\n\n offsets.top -= borderTopWidth - marginTop;\n offsets.bottom -= borderTopWidth - marginTop;\n offsets.left -= borderLeftWidth - marginLeft;\n offsets.right -= borderLeftWidth - marginLeft;\n\n // Attach marginTop and marginLeft because in some circumstances we may need them\n offsets.marginTop = marginTop;\n offsets.marginLeft = marginLeft;\n }\n\n if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {\n offsets = includeScroll(offsets, parent);\n }\n\n return offsets;\n}\n\nfunction getViewportOffsetRectRelativeToArtbitraryNode(element) {\n var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var html = element.ownerDocument.documentElement;\n var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);\n var width = Math.max(html.clientWidth, window.innerWidth || 0);\n var height = Math.max(html.clientHeight, window.innerHeight || 0);\n\n var scrollTop = !excludeScroll ? getScroll(html) : 0;\n var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;\n\n var offset = {\n top: scrollTop - relativeOffset.top + relativeOffset.marginTop,\n left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,\n width: width,\n height: height\n };\n\n return getClientRect(offset);\n}\n\n/**\n * Check if the given element is fixed or is inside a fixed parent\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @argument {Element} customContainer\n * @returns {Boolean} answer to \"isFixed?\"\n */\nfunction isFixed(element) {\n var nodeName = element.nodeName;\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n return false;\n }\n if (getStyleComputedProperty(element, 'position') === 'fixed') {\n return true;\n }\n var parentNode = getParentNode(element);\n if (!parentNode) {\n return false;\n }\n return isFixed(parentNode);\n}\n\n/**\n * Finds the first parent of an element that has a transformed property defined\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} first transformed parent or documentElement\n */\n\nfunction getFixedPositionOffsetParent(element) {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element || !element.parentElement || isIE()) {\n return document.documentElement;\n }\n var el = element.parentElement;\n while (el && getStyleComputedProperty(el, 'transform') === 'none') {\n el = el.parentElement;\n }\n return el || document.documentElement;\n}\n\n/**\n * Computed the boundaries limits and return them\n * @method\n * @memberof Popper.Utils\n * @param {HTMLElement} popper\n * @param {HTMLElement} reference\n * @param {number} padding\n * @param {HTMLElement} boundariesElement - Element used to define the boundaries\n * @param {Boolean} fixedPosition - Is in fixed position mode\n * @returns {Object} Coordinates of the boundaries\n */\nfunction getBoundaries(popper, reference, padding, boundariesElement) {\n var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // NOTE: 1 DOM access here\n\n var boundaries = { top: 0, left: 0 };\n var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));\n\n // Handle viewport case\n if (boundariesElement === 'viewport') {\n boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);\n } else {\n // Handle other cases based on DOM element used as boundaries\n var boundariesNode = void 0;\n if (boundariesElement === 'scrollParent') {\n boundariesNode = getScrollParent(getParentNode(reference));\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = popper.ownerDocument.documentElement;\n }\n } else if (boundariesElement === 'window') {\n boundariesNode = popper.ownerDocument.documentElement;\n } else {\n boundariesNode = boundariesElement;\n }\n\n var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);\n\n // In case of HTML, we need a different computation\n if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {\n var _getWindowSizes = getWindowSizes(popper.ownerDocument),\n height = _getWindowSizes.height,\n width = _getWindowSizes.width;\n\n boundaries.top += offsets.top - offsets.marginTop;\n boundaries.bottom = height + offsets.top;\n boundaries.left += offsets.left - offsets.marginLeft;\n boundaries.right = width + offsets.left;\n } else {\n // for all the other DOM elements, this one is good\n boundaries = offsets;\n }\n }\n\n // Add paddings\n padding = padding || 0;\n var isPaddingNumber = typeof padding === 'number';\n boundaries.left += isPaddingNumber ? padding : padding.left || 0;\n boundaries.top += isPaddingNumber ? padding : padding.top || 0;\n boundaries.right -= isPaddingNumber ? padding : padding.right || 0;\n boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;\n\n return boundaries;\n}\n\nfunction getArea(_ref) {\n var width = _ref.width,\n height = _ref.height;\n\n return width * height;\n}\n\n/**\n * Utility used to transform the `auto` placement to the placement with more\n * available space.\n * @method\n * @memberof Popper.Utils\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {\n var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;\n\n if (placement.indexOf('auto') === -1) {\n return placement;\n }\n\n var boundaries = getBoundaries(popper, reference, padding, boundariesElement);\n\n var rects = {\n top: {\n width: boundaries.width,\n height: refRect.top - boundaries.top\n },\n right: {\n width: boundaries.right - refRect.right,\n height: boundaries.height\n },\n bottom: {\n width: boundaries.width,\n height: boundaries.bottom - refRect.bottom\n },\n left: {\n width: refRect.left - boundaries.left,\n height: boundaries.height\n }\n };\n\n var sortedAreas = Object.keys(rects).map(function (key) {\n return _extends({\n key: key\n }, rects[key], {\n area: getArea(rects[key])\n });\n }).sort(function (a, b) {\n return b.area - a.area;\n });\n\n var filteredAreas = sortedAreas.filter(function (_ref2) {\n var width = _ref2.width,\n height = _ref2.height;\n return width >= popper.clientWidth && height >= popper.clientHeight;\n });\n\n var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;\n\n var variation = placement.split('-')[1];\n\n return computedPlacement + (variation ? '-' + variation : '');\n}\n\n/**\n * Get offsets to the reference element\n * @method\n * @memberof Popper.Utils\n * @param {Object} state\n * @param {Element} popper - the popper element\n * @param {Element} reference - the reference element (the popper will be relative to this)\n * @param {Element} fixedPosition - is in fixed position mode\n * @returns {Object} An object containing the offsets which will be applied to the popper\n */\nfunction getReferenceOffsets(state, popper, reference) {\n var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));\n return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);\n}\n\n/**\n * Get the outer sizes of the given element (offset size + margins)\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Object} object containing width and height properties\n */\nfunction getOuterSizes(element) {\n var window = element.ownerDocument.defaultView;\n var styles = window.getComputedStyle(element);\n var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);\n var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);\n var result = {\n width: element.offsetWidth + y,\n height: element.offsetHeight + x\n };\n return result;\n}\n\n/**\n * Get the opposite placement of the given one\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement\n * @returns {String} flipped placement\n */\nfunction getOppositePlacement(placement) {\n var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}\n\n/**\n * Get offsets to the popper\n * @method\n * @memberof Popper.Utils\n * @param {Object} position - CSS position the Popper will get applied\n * @param {HTMLElement} popper - the popper element\n * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)\n * @param {String} placement - one of the valid placement options\n * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper\n */\nfunction getPopperOffsets(popper, referenceOffsets, placement) {\n placement = placement.split('-')[0];\n\n // Get popper node sizes\n var popperRect = getOuterSizes(popper);\n\n // Add position, width and height to our offsets object\n var popperOffsets = {\n width: popperRect.width,\n height: popperRect.height\n };\n\n // depending by the popper placement we have to compute its offsets slightly differently\n var isHoriz = ['right', 'left'].indexOf(placement) !== -1;\n var mainSide = isHoriz ? 'top' : 'left';\n var secondarySide = isHoriz ? 'left' : 'top';\n var measurement = isHoriz ? 'height' : 'width';\n var secondaryMeasurement = !isHoriz ? 'height' : 'width';\n\n popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;\n if (placement === secondarySide) {\n popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];\n } else {\n popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];\n }\n\n return popperOffsets;\n}\n\n/**\n * Mimics the `find` method of Array\n * @method\n * @memberof Popper.Utils\n * @argument {Array} arr\n * @argument prop\n * @argument value\n * @returns index or -1\n */\nfunction find(arr, check) {\n // use native find if supported\n if (Array.prototype.find) {\n return arr.find(check);\n }\n\n // use `filter` to obtain the same behavior of `find`\n return arr.filter(check)[0];\n}\n\n/**\n * Return the index of the matching object\n * @method\n * @memberof Popper.Utils\n * @argument {Array} arr\n * @argument prop\n * @argument value\n * @returns index or -1\n */\nfunction findIndex(arr, prop, value) {\n // use native findIndex if supported\n if (Array.prototype.findIndex) {\n return arr.findIndex(function (cur) {\n return cur[prop] === value;\n });\n }\n\n // use `find` + `indexOf` if `findIndex` isn't supported\n var match = find(arr, function (obj) {\n return obj[prop] === value;\n });\n return arr.indexOf(match);\n}\n\n/**\n * Loop trough the list of modifiers and run them in order,\n * each of them will then edit the data object.\n * @method\n * @memberof Popper.Utils\n * @param {dataObject} data\n * @param {Array} modifiers\n * @param {String} ends - Optional modifier name used as stopper\n * @returns {dataObject}\n */\nfunction runModifiers(modifiers, data, ends) {\n var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));\n\n modifiersToRun.forEach(function (modifier) {\n if (modifier['function']) {\n // eslint-disable-line dot-notation\n console.warn('`modifier.function` is deprecated, use `modifier.fn`!');\n }\n var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation\n if (modifier.enabled && isFunction(fn)) {\n // Add properties to offsets to make them a complete clientRect object\n // we do this before each modifier to make sure the previous one doesn't\n // mess with these values\n data.offsets.popper = getClientRect(data.offsets.popper);\n data.offsets.reference = getClientRect(data.offsets.reference);\n\n data = fn(data, modifier);\n }\n });\n\n return data;\n}\n\n/**\n * Updates the position of the popper, computing the new offsets and applying\n * the new style.
\n * Prefer `scheduleUpdate` over `update` because of performance reasons.\n * @method\n * @memberof Popper\n */\nfunction update() {\n // if popper is destroyed, don't perform any further update\n if (this.state.isDestroyed) {\n return;\n }\n\n var data = {\n instance: this,\n styles: {},\n arrowStyles: {},\n attributes: {},\n flipped: false,\n offsets: {}\n };\n\n // compute reference element offsets\n data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);\n\n // compute auto placement, store placement inside the data object,\n // modifiers will be able to edit `placement` if needed\n // and refer to originalPlacement to know the original value\n data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);\n\n // store the computed placement inside `originalPlacement`\n data.originalPlacement = data.placement;\n\n data.positionFixed = this.options.positionFixed;\n\n // compute the popper offsets\n data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);\n\n data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';\n\n // run the modifiers\n data = runModifiers(this.modifiers, data);\n\n // the first `update` will call `onCreate` callback\n // the other ones will call `onUpdate` callback\n if (!this.state.isCreated) {\n this.state.isCreated = true;\n this.options.onCreate(data);\n } else {\n this.options.onUpdate(data);\n }\n}\n\n/**\n * Helper used to know if the given modifier is enabled.\n * @method\n * @memberof Popper.Utils\n * @returns {Boolean}\n */\nfunction isModifierEnabled(modifiers, modifierName) {\n return modifiers.some(function (_ref) {\n var name = _ref.name,\n enabled = _ref.enabled;\n return enabled && name === modifierName;\n });\n}\n\n/**\n * Get the prefixed supported property name\n * @method\n * @memberof Popper.Utils\n * @argument {String} property (camelCase)\n * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)\n */\nfunction getSupportedPropertyName(property) {\n var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];\n var upperProp = property.charAt(0).toUpperCase() + property.slice(1);\n\n for (var i = 0; i < prefixes.length; i++) {\n var prefix = prefixes[i];\n var toCheck = prefix ? '' + prefix + upperProp : property;\n if (typeof document.body.style[toCheck] !== 'undefined') {\n return toCheck;\n }\n }\n return null;\n}\n\n/**\n * Destroys the popper.\n * @method\n * @memberof Popper\n */\nfunction destroy() {\n this.state.isDestroyed = true;\n\n // touch DOM only if `applyStyle` modifier is enabled\n if (isModifierEnabled(this.modifiers, 'applyStyle')) {\n this.popper.removeAttribute('x-placement');\n this.popper.style.position = '';\n this.popper.style.top = '';\n this.popper.style.left = '';\n this.popper.style.right = '';\n this.popper.style.bottom = '';\n this.popper.style.willChange = '';\n this.popper.style[getSupportedPropertyName('transform')] = '';\n }\n\n this.disableEventListeners();\n\n // remove the popper if user explicitly asked for the deletion on destroy\n // do not use `remove` because IE11 doesn't support it\n if (this.options.removeOnDestroy) {\n this.popper.parentNode.removeChild(this.popper);\n }\n return this;\n}\n\n/**\n * Get the window associated with the element\n * @argument {Element} element\n * @returns {Window}\n */\nfunction getWindow(element) {\n var ownerDocument = element.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView : window;\n}\n\nfunction attachToScrollParents(scrollParent, event, callback, scrollParents) {\n var isBody = scrollParent.nodeName === 'BODY';\n var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;\n target.addEventListener(event, callback, { passive: true });\n\n if (!isBody) {\n attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);\n }\n scrollParents.push(target);\n}\n\n/**\n * Setup needed event listeners used to update the popper position\n * @method\n * @memberof Popper.Utils\n * @private\n */\nfunction setupEventListeners(reference, options, state, updateBound) {\n // Resize event listener on window\n state.updateBound = updateBound;\n getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });\n\n // Scroll event listener on scroll parents\n var scrollElement = getScrollParent(reference);\n attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);\n state.scrollElement = scrollElement;\n state.eventsEnabled = true;\n\n return state;\n}\n\n/**\n * It will add resize/scroll events and start recalculating\n * position of the popper element when they are triggered.\n * @method\n * @memberof Popper\n */\nfunction enableEventListeners() {\n if (!this.state.eventsEnabled) {\n this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);\n }\n}\n\n/**\n * Remove event listeners used to update the popper position\n * @method\n * @memberof Popper.Utils\n * @private\n */\nfunction removeEventListeners(reference, state) {\n // Remove resize event listener on window\n getWindow(reference).removeEventListener('resize', state.updateBound);\n\n // Remove scroll event listener on scroll parents\n state.scrollParents.forEach(function (target) {\n target.removeEventListener('scroll', state.updateBound);\n });\n\n // Reset state\n state.updateBound = null;\n state.scrollParents = [];\n state.scrollElement = null;\n state.eventsEnabled = false;\n return state;\n}\n\n/**\n * It will remove resize/scroll events and won't recalculate popper position\n * when they are triggered. It also won't trigger `onUpdate` callback anymore,\n * unless you call `update` method manually.\n * @method\n * @memberof Popper\n */\nfunction disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}\n\n/**\n * Tells if a given input is a number\n * @method\n * @memberof Popper.Utils\n * @param {*} input to check\n * @return {Boolean}\n */\nfunction isNumeric(n) {\n return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);\n}\n\n/**\n * Set the style to the given popper\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element - Element to apply the style to\n * @argument {Object} styles\n * Object with a list of properties and values which will be applied to the element\n */\nfunction setStyles(element, styles) {\n Object.keys(styles).forEach(function (prop) {\n var unit = '';\n // add unit if the value is numeric and is one of the following\n if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {\n unit = 'px';\n }\n element.style[prop] = styles[prop] + unit;\n });\n}\n\n/**\n * Set the attributes to the given popper\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element - Element to apply the attributes to\n * @argument {Object} styles\n * Object with a list of properties and values which will be applied to the element\n */\nfunction setAttributes(element, attributes) {\n Object.keys(attributes).forEach(function (prop) {\n var value = attributes[prop];\n if (value !== false) {\n element.setAttribute(prop, attributes[prop]);\n } else {\n element.removeAttribute(prop);\n }\n });\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} data.styles - List of style properties - values to apply to popper element\n * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The same data object\n */\nfunction applyStyle(data) {\n // any property present in `data.styles` will be applied to the popper,\n // in this way we can make the 3rd party modifiers add custom styles to it\n // Be aware, modifiers could override the properties defined in the previous\n // lines of this modifier!\n setStyles(data.instance.popper, data.styles);\n\n // any property present in `data.attributes` will be applied to the popper,\n // they will be set as HTML attributes of the element\n setAttributes(data.instance.popper, data.attributes);\n\n // if arrowElement is defined and arrowStyles has some properties\n if (data.arrowElement && Object.keys(data.arrowStyles).length) {\n setStyles(data.arrowElement, data.arrowStyles);\n }\n\n return data;\n}\n\n/**\n * Set the x-placement attribute before everything else because it could be used\n * to add margins to the popper margins needs to be calculated to get the\n * correct popper offsets.\n * @method\n * @memberof Popper.modifiers\n * @param {HTMLElement} reference - The reference element used to position the popper\n * @param {HTMLElement} popper - The HTML element used as popper\n * @param {Object} options - Popper.js options\n */\nfunction applyStyleOnLoad(reference, popper, options, modifierOptions, state) {\n // compute reference element offsets\n var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);\n\n // compute auto placement, store placement inside the data object,\n // modifiers will be able to edit `placement` if needed\n // and refer to originalPlacement to know the original value\n var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);\n\n popper.setAttribute('x-placement', placement);\n\n // Apply `position` to popper before anything else because\n // without the position applied we can't guarantee correct computations\n setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });\n\n return options;\n}\n\n/**\n * @function\n * @memberof Popper.Utils\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Boolean} shouldRound - If the offsets should be rounded at all\n * @returns {Object} The popper's position offsets rounded\n *\n * The tale of pixel-perfect positioning. It's still not 100% perfect, but as\n * good as it can be within reason.\n * Discussion here: https://github.com/FezVrasta/popper.js/pull/715\n *\n * Low DPI screens cause a popper to be blurry if not using full pixels (Safari\n * as well on High DPI screens).\n *\n * Firefox prefers no rounding for positioning and does not have blurriness on\n * high DPI screens.\n *\n * Only horizontal placement and left/right values need to be considered.\n */\nfunction getRoundedOffsets(data, shouldRound) {\n var _data$offsets = data.offsets,\n popper = _data$offsets.popper,\n reference = _data$offsets.reference;\n var round = Math.round,\n floor = Math.floor;\n\n var noRound = function noRound(v) {\n return v;\n };\n\n var referenceWidth = round(reference.width);\n var popperWidth = round(popper.width);\n\n var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;\n var isVariation = data.placement.indexOf('-') !== -1;\n var sameWidthParity = referenceWidth % 2 === popperWidth % 2;\n var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;\n\n var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;\n var verticalToInteger = !shouldRound ? noRound : round;\n\n return {\n left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),\n top: verticalToInteger(popper.top),\n bottom: verticalToInteger(popper.bottom),\n right: horizontalToInteger(popper.right)\n };\n}\n\nvar isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction computeStyle(data, options) {\n var x = options.x,\n y = options.y;\n var popper = data.offsets.popper;\n\n // Remove this legacy support in Popper.js v2\n\n var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {\n return modifier.name === 'applyStyle';\n }).gpuAcceleration;\n if (legacyGpuAccelerationOption !== undefined) {\n console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');\n }\n var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;\n\n var offsetParent = getOffsetParent(data.instance.popper);\n var offsetParentRect = getBoundingClientRect(offsetParent);\n\n // Styles\n var styles = {\n position: popper.position\n };\n\n var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);\n\n var sideA = x === 'bottom' ? 'top' : 'bottom';\n var sideB = y === 'right' ? 'left' : 'right';\n\n // if gpuAcceleration is set to `true` and transform is supported,\n // we use `translate3d` to apply the position to the popper we\n // automatically use the supported prefixed version if needed\n var prefixedProperty = getSupportedPropertyName('transform');\n\n // now, let's make a step back and look at this code closely (wtf?)\n // If the content of the popper grows once it's been positioned, it\n // may happen that the popper gets misplaced because of the new content\n // overflowing its reference element\n // To avoid this problem, we provide two options (x and y), which allow\n // the consumer to define the offset origin.\n // If we position a popper on top of a reference element, we can set\n // `x` to `top` to make the popper grow towards its top instead of\n // its bottom.\n var left = void 0,\n top = void 0;\n if (sideA === 'bottom') {\n // when offsetParent is the positioning is relative to the bottom of the screen (excluding the scrollbar)\n // and not the bottom of the html element\n if (offsetParent.nodeName === 'HTML') {\n top = -offsetParent.clientHeight + offsets.bottom;\n } else {\n top = -offsetParentRect.height + offsets.bottom;\n }\n } else {\n top = offsets.top;\n }\n if (sideB === 'right') {\n if (offsetParent.nodeName === 'HTML') {\n left = -offsetParent.clientWidth + offsets.right;\n } else {\n left = -offsetParentRect.width + offsets.right;\n }\n } else {\n left = offsets.left;\n }\n if (gpuAcceleration && prefixedProperty) {\n styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';\n styles[sideA] = 0;\n styles[sideB] = 0;\n styles.willChange = 'transform';\n } else {\n // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties\n var invertTop = sideA === 'bottom' ? -1 : 1;\n var invertLeft = sideB === 'right' ? -1 : 1;\n styles[sideA] = top * invertTop;\n styles[sideB] = left * invertLeft;\n styles.willChange = sideA + ', ' + sideB;\n }\n\n // Attributes\n var attributes = {\n 'x-placement': data.placement\n };\n\n // Update `data` attributes, styles and arrowStyles\n data.attributes = _extends({}, attributes, data.attributes);\n data.styles = _extends({}, styles, data.styles);\n data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);\n\n return data;\n}\n\n/**\n * Helper used to know if the given modifier depends from another one.
\n * It checks if the needed modifier is listed and enabled.\n * @method\n * @memberof Popper.Utils\n * @param {Array} modifiers - list of modifiers\n * @param {String} requestingName - name of requesting modifier\n * @param {String} requestedName - name of requested modifier\n * @returns {Boolean}\n */\nfunction isModifierRequired(modifiers, requestingName, requestedName) {\n var requesting = find(modifiers, function (_ref) {\n var name = _ref.name;\n return name === requestingName;\n });\n\n var isRequired = !!requesting && modifiers.some(function (modifier) {\n return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;\n });\n\n if (!isRequired) {\n var _requesting = '`' + requestingName + '`';\n var requested = '`' + requestedName + '`';\n console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');\n }\n return isRequired;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction arrow(data, options) {\n var _data$offsets$arrow;\n\n // arrow depends on keepTogether in order to work\n if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {\n return data;\n }\n\n var arrowElement = options.element;\n\n // if arrowElement is a string, suppose it's a CSS selector\n if (typeof arrowElement === 'string') {\n arrowElement = data.instance.popper.querySelector(arrowElement);\n\n // if arrowElement is not found, don't run the modifier\n if (!arrowElement) {\n return data;\n }\n } else {\n // if the arrowElement isn't a query selector we must check that the\n // provided DOM node is child of its popper node\n if (!data.instance.popper.contains(arrowElement)) {\n console.warn('WARNING: `arrow.element` must be child of its popper element!');\n return data;\n }\n }\n\n var placement = data.placement.split('-')[0];\n var _data$offsets = data.offsets,\n popper = _data$offsets.popper,\n reference = _data$offsets.reference;\n\n var isVertical = ['left', 'right'].indexOf(placement) !== -1;\n\n var len = isVertical ? 'height' : 'width';\n var sideCapitalized = isVertical ? 'Top' : 'Left';\n var side = sideCapitalized.toLowerCase();\n var altSide = isVertical ? 'left' : 'top';\n var opSide = isVertical ? 'bottom' : 'right';\n var arrowElementSize = getOuterSizes(arrowElement)[len];\n\n //\n // extends keepTogether behavior making sure the popper and its\n // reference have enough pixels in conjunction\n //\n\n // top/left side\n if (reference[opSide] - arrowElementSize < popper[side]) {\n data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);\n }\n // bottom/right side\n if (reference[side] + arrowElementSize > popper[opSide]) {\n data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];\n }\n data.offsets.popper = getClientRect(data.offsets.popper);\n\n // compute center of the popper\n var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;\n\n // Compute the sideValue using the updated popper offsets\n // take popper margin in account because we don't have this info available\n var css = getStyleComputedProperty(data.instance.popper);\n var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);\n var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);\n var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;\n\n // prevent arrowElement from being placed not contiguously to its popper\n sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);\n\n data.arrowElement = arrowElement;\n data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);\n\n return data;\n}\n\n/**\n * Get the opposite placement variation of the given one\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement variation\n * @returns {String} flipped placement variation\n */\nfunction getOppositeVariation(variation) {\n if (variation === 'end') {\n return 'start';\n } else if (variation === 'start') {\n return 'end';\n }\n return variation;\n}\n\n/**\n * List of accepted placements to use as values of the `placement` option.
\n * Valid placements are:\n * - `auto`\n * - `top`\n * - `right`\n * - `bottom`\n * - `left`\n *\n * Each placement can have a variation from this list:\n * - `-start`\n * - `-end`\n *\n * Variations are interpreted easily if you think of them as the left to right\n * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`\n * is right.
\n * Vertically (`left` and `right`), `start` is top and `end` is bottom.\n *\n * Some valid examples are:\n * - `top-end` (on top of reference, right aligned)\n * - `right-start` (on right of reference, top aligned)\n * - `bottom` (on bottom, centered)\n * - `auto-end` (on the side with more space available, alignment depends by placement)\n *\n * @static\n * @type {Array}\n * @enum {String}\n * @readonly\n * @method placements\n * @memberof Popper\n */\nvar placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];\n\n// Get rid of `auto` `auto-start` and `auto-end`\nvar validPlacements = placements.slice(3);\n\n/**\n * Given an initial placement, returns all the subsequent placements\n * clockwise (or counter-clockwise).\n *\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement - A valid placement (it accepts variations)\n * @argument {Boolean} counter - Set to true to walk the placements counterclockwise\n * @returns {Array} placements including their variations\n */\nfunction clockwise(placement) {\n var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var index = validPlacements.indexOf(placement);\n var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));\n return counter ? arr.reverse() : arr;\n}\n\nvar BEHAVIORS = {\n FLIP: 'flip',\n CLOCKWISE: 'clockwise',\n COUNTERCLOCKWISE: 'counterclockwise'\n};\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction flip(data, options) {\n // if `inner` modifier is enabled, we can't use the `flip` modifier\n if (isModifierEnabled(data.instance.modifiers, 'inner')) {\n return data;\n }\n\n if (data.flipped && data.placement === data.originalPlacement) {\n // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides\n return data;\n }\n\n var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);\n\n var placement = data.placement.split('-')[0];\n var placementOpposite = getOppositePlacement(placement);\n var variation = data.placement.split('-')[1] || '';\n\n var flipOrder = [];\n\n switch (options.behavior) {\n case BEHAVIORS.FLIP:\n flipOrder = [placement, placementOpposite];\n break;\n case BEHAVIORS.CLOCKWISE:\n flipOrder = clockwise(placement);\n break;\n case BEHAVIORS.COUNTERCLOCKWISE:\n flipOrder = clockwise(placement, true);\n break;\n default:\n flipOrder = options.behavior;\n }\n\n flipOrder.forEach(function (step, index) {\n if (placement !== step || flipOrder.length === index + 1) {\n return data;\n }\n\n placement = data.placement.split('-')[0];\n placementOpposite = getOppositePlacement(placement);\n\n var popperOffsets = data.offsets.popper;\n var refOffsets = data.offsets.reference;\n\n // using floor because the reference offsets may contain decimals we are not going to consider here\n var floor = Math.floor;\n var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);\n\n var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);\n var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);\n var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);\n var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);\n\n var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;\n\n // flip the variation if required\n var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;\n\n // flips variation if reference element overflows boundaries\n var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);\n\n // flips variation if popper content overflows boundaries\n var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);\n\n var flippedVariation = flippedVariationByRef || flippedVariationByContent;\n\n if (overlapsRef || overflowsBoundaries || flippedVariation) {\n // this boolean to detect any flip loop\n data.flipped = true;\n\n if (overlapsRef || overflowsBoundaries) {\n placement = flipOrder[index + 1];\n }\n\n if (flippedVariation) {\n variation = getOppositeVariation(variation);\n }\n\n data.placement = placement + (variation ? '-' + variation : '');\n\n // this object contains `position`, we want to preserve it along with\n // any additional property we may add in the future\n data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));\n\n data = runModifiers(data.instance.modifiers, data, 'flip');\n }\n });\n return data;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction keepTogether(data) {\n var _data$offsets = data.offsets,\n popper = _data$offsets.popper,\n reference = _data$offsets.reference;\n\n var placement = data.placement.split('-')[0];\n var floor = Math.floor;\n var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;\n var side = isVertical ? 'right' : 'bottom';\n var opSide = isVertical ? 'left' : 'top';\n var measurement = isVertical ? 'width' : 'height';\n\n if (popper[side] < floor(reference[opSide])) {\n data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];\n }\n if (popper[opSide] > floor(reference[side])) {\n data.offsets.popper[opSide] = floor(reference[side]);\n }\n\n return data;\n}\n\n/**\n * Converts a string containing value + unit into a px value number\n * @function\n * @memberof {modifiers~offset}\n * @private\n * @argument {String} str - Value + unit string\n * @argument {String} measurement - `height` or `width`\n * @argument {Object} popperOffsets\n * @argument {Object} referenceOffsets\n * @returns {Number|String}\n * Value in pixels, or original string if no values were extracted\n */\nfunction toValue(str, measurement, popperOffsets, referenceOffsets) {\n // separate value from unit\n var split = str.match(/((?:\\-|\\+)?\\d*\\.?\\d*)(.*)/);\n var value = +split[1];\n var unit = split[2];\n\n // If it's not a number it's an operator, I guess\n if (!value) {\n return str;\n }\n\n if (unit.indexOf('%') === 0) {\n var element = void 0;\n switch (unit) {\n case '%p':\n element = popperOffsets;\n break;\n case '%':\n case '%r':\n default:\n element = referenceOffsets;\n }\n\n var rect = getClientRect(element);\n return rect[measurement] / 100 * value;\n } else if (unit === 'vh' || unit === 'vw') {\n // if is a vh or vw, we calculate the size based on the viewport\n var size = void 0;\n if (unit === 'vh') {\n size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n } else {\n size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n }\n return size / 100 * value;\n } else {\n // if is an explicit pixel unit, we get rid of the unit and keep the value\n // if is an implicit unit, it's px, and we return just the value\n return value;\n }\n}\n\n/**\n * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.\n * @function\n * @memberof {modifiers~offset}\n * @private\n * @argument {String} offset\n * @argument {Object} popperOffsets\n * @argument {Object} referenceOffsets\n * @argument {String} basePlacement\n * @returns {Array} a two cells array with x and y offsets in numbers\n */\nfunction parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {\n var offsets = [0, 0];\n\n // Use height if placement is left or right and index is 0 otherwise use width\n // in this way the first offset will use an axis and the second one\n // will use the other one\n var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;\n\n // Split the offset string to obtain a list of values and operands\n // The regex addresses values with the plus or minus sign in front (+10, -20, etc)\n var fragments = offset.split(/(\\+|\\-)/).map(function (frag) {\n return frag.trim();\n });\n\n // Detect if the offset string contains a pair of values or a single one\n // they could be separated by comma or space\n var divider = fragments.indexOf(find(fragments, function (frag) {\n return frag.search(/,|\\s/) !== -1;\n }));\n\n if (fragments[divider] && fragments[divider].indexOf(',') === -1) {\n console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');\n }\n\n // If divider is found, we divide the list of values and operands to divide\n // them by ofset X and Y.\n var splitRegex = /\\s*,\\s*|\\s+/;\n var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];\n\n // Convert the values with units to absolute pixels to allow our computations\n ops = ops.map(function (op, index) {\n // Most of the units rely on the orientation of the popper\n var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';\n var mergeWithPrevious = false;\n return op\n // This aggregates any `+` or `-` sign that aren't considered operators\n // e.g.: 10 + +5 => [10, +, +5]\n .reduce(function (a, b) {\n if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {\n a[a.length - 1] = b;\n mergeWithPrevious = true;\n return a;\n } else if (mergeWithPrevious) {\n a[a.length - 1] += b;\n mergeWithPrevious = false;\n return a;\n } else {\n return a.concat(b);\n }\n }, [])\n // Here we convert the string values into number values (in px)\n .map(function (str) {\n return toValue(str, measurement, popperOffsets, referenceOffsets);\n });\n });\n\n // Loop trough the offsets arrays and execute the operations\n ops.forEach(function (op, index) {\n op.forEach(function (frag, index2) {\n if (isNumeric(frag)) {\n offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);\n }\n });\n });\n return offsets;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @argument {Number|String} options.offset=0\n * The offset value as described in the modifier description\n * @returns {Object} The data object, properly modified\n */\nfunction offset(data, _ref) {\n var offset = _ref.offset;\n var placement = data.placement,\n _data$offsets = data.offsets,\n popper = _data$offsets.popper,\n reference = _data$offsets.reference;\n\n var basePlacement = placement.split('-')[0];\n\n var offsets = void 0;\n if (isNumeric(+offset)) {\n offsets = [+offset, 0];\n } else {\n offsets = parseOffset(offset, popper, reference, basePlacement);\n }\n\n if (basePlacement === 'left') {\n popper.top += offsets[0];\n popper.left -= offsets[1];\n } else if (basePlacement === 'right') {\n popper.top += offsets[0];\n popper.left += offsets[1];\n } else if (basePlacement === 'top') {\n popper.left += offsets[0];\n popper.top -= offsets[1];\n } else if (basePlacement === 'bottom') {\n popper.left += offsets[0];\n popper.top += offsets[1];\n }\n\n data.popper = popper;\n return data;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction preventOverflow(data, options) {\n var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);\n\n // If offsetParent is the reference element, we really want to\n // go one step up and use the next offsetParent as reference to\n // avoid to make this modifier completely useless and look like broken\n if (data.instance.reference === boundariesElement) {\n boundariesElement = getOffsetParent(boundariesElement);\n }\n\n // NOTE: DOM access here\n // resets the popper's position so that the document size can be calculated excluding\n // the size of the popper element itself\n var transformProp = getSupportedPropertyName('transform');\n var popperStyles = data.instance.popper.style; // assignment to help minification\n var top = popperStyles.top,\n left = popperStyles.left,\n transform = popperStyles[transformProp];\n\n popperStyles.top = '';\n popperStyles.left = '';\n popperStyles[transformProp] = '';\n\n var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);\n\n // NOTE: DOM access here\n // restores the original style properties after the offsets have been computed\n popperStyles.top = top;\n popperStyles.left = left;\n popperStyles[transformProp] = transform;\n\n options.boundaries = boundaries;\n\n var order = options.priority;\n var popper = data.offsets.popper;\n\n var check = {\n primary: function primary(placement) {\n var value = popper[placement];\n if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {\n value = Math.max(popper[placement], boundaries[placement]);\n }\n return defineProperty({}, placement, value);\n },\n secondary: function secondary(placement) {\n var mainSide = placement === 'right' ? 'left' : 'top';\n var value = popper[mainSide];\n if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {\n value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));\n }\n return defineProperty({}, mainSide, value);\n }\n };\n\n order.forEach(function (placement) {\n var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';\n popper = _extends({}, popper, check[side](placement));\n });\n\n data.offsets.popper = popper;\n\n return data;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction shift(data) {\n var placement = data.placement;\n var basePlacement = placement.split('-')[0];\n var shiftvariation = placement.split('-')[1];\n\n // if shift shiftvariation is specified, run the modifier\n if (shiftvariation) {\n var _data$offsets = data.offsets,\n reference = _data$offsets.reference,\n popper = _data$offsets.popper;\n\n var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;\n var side = isVertical ? 'left' : 'top';\n var measurement = isVertical ? 'width' : 'height';\n\n var shiftOffsets = {\n start: defineProperty({}, side, reference[side]),\n end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])\n };\n\n data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);\n }\n\n return data;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction hide(data) {\n if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {\n return data;\n }\n\n var refRect = data.offsets.reference;\n var bound = find(data.instance.modifiers, function (modifier) {\n return modifier.name === 'preventOverflow';\n }).boundaries;\n\n if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === true) {\n return data;\n }\n\n data.hide = true;\n data.attributes['x-out-of-boundaries'] = '';\n } else {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === false) {\n return data;\n }\n\n data.hide = false;\n data.attributes['x-out-of-boundaries'] = false;\n }\n\n return data;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nfunction inner(data) {\n var placement = data.placement;\n var basePlacement = placement.split('-')[0];\n var _data$offsets = data.offsets,\n popper = _data$offsets.popper,\n reference = _data$offsets.reference;\n\n var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;\n\n var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;\n\n popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);\n\n data.placement = getOppositePlacement(placement);\n data.offsets.popper = getClientRect(popper);\n\n return data;\n}\n\n/**\n * Modifier function, each modifier can have a function of this type assigned\n * to its `fn` property.
\n * These functions will be called on each update, this means that you must\n * make sure they are performant enough to avoid performance bottlenecks.\n *\n * @function ModifierFn\n * @argument {dataObject} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {dataObject} The data object, properly modified\n */\n\n/**\n * Modifiers are plugins used to alter the behavior of your poppers.
\n * Popper.js uses a set of 9 modifiers to provide all the basic functionalities\n * needed by the library.\n *\n * Usually you don't want to override the `order`, `fn` and `onLoad` props.\n * All the other properties are configurations that could be tweaked.\n * @namespace modifiers\n */\nvar modifiers = {\n /**\n * Modifier used to shift the popper on the start or end of its reference\n * element.
\n * It will read the variation of the `placement` property.
\n * It can be one either `-end` or `-start`.\n * @memberof modifiers\n * @inner\n */\n shift: {\n /** @prop {number} order=100 - Index used to define the order of execution */\n order: 100,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: shift\n },\n\n /**\n * The `offset` modifier can shift your popper on both its axis.\n *\n * It accepts the following units:\n * - `px` or unit-less, interpreted as pixels\n * - `%` or `%r`, percentage relative to the length of the reference element\n * - `%p`, percentage relative to the length of the popper element\n * - `vw`, CSS viewport width unit\n * - `vh`, CSS viewport height unit\n *\n * For length is intended the main axis relative to the placement of the popper.
\n * This means that if the placement is `top` or `bottom`, the length will be the\n * `width`. In case of `left` or `right`, it will be the `height`.\n *\n * You can provide a single value (as `Number` or `String`), or a pair of values\n * as `String` divided by a comma or one (or more) white spaces.
\n * The latter is a deprecated method because it leads to confusion and will be\n * removed in v2.
\n * Additionally, it accepts additions and subtractions between different units.\n * Note that multiplications and divisions aren't supported.\n *\n * Valid examples are:\n * ```\n * 10\n * '10%'\n * '10, 10'\n * '10%, 10'\n * '10 + 10%'\n * '10 - 5vh + 3%'\n * '-10px + 5vh, 5px - 6%'\n * ```\n * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap\n * > with their reference element, unfortunately, you will have to disable the `flip` modifier.\n * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).\n *\n * @memberof modifiers\n * @inner\n */\n offset: {\n /** @prop {number} order=200 - Index used to define the order of execution */\n order: 200,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: offset,\n /** @prop {Number|String} offset=0\n * The offset value as described in the modifier description\n */\n offset: 0\n },\n\n /**\n * Modifier used to prevent the popper from being positioned outside the boundary.\n *\n * A scenario exists where the reference itself is not within the boundaries.
\n * We can say it has \"escaped the boundaries\" — or just \"escaped\".
\n * In this case we need to decide whether the popper should either:\n *\n * - detach from the reference and remain \"trapped\" in the boundaries, or\n * - if it should ignore the boundary and \"escape with its reference\"\n *\n * When `escapeWithReference` is set to`true` and reference is completely\n * outside its boundaries, the popper will overflow (or completely leave)\n * the boundaries in order to remain attached to the edge of the reference.\n *\n * @memberof modifiers\n * @inner\n */\n preventOverflow: {\n /** @prop {number} order=300 - Index used to define the order of execution */\n order: 300,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: preventOverflow,\n /**\n * @prop {Array} [priority=['left','right','top','bottom']]\n * Popper will try to prevent overflow following these priorities by default,\n * then, it could overflow on the left and on top of the `boundariesElement`\n */\n priority: ['left', 'right', 'top', 'bottom'],\n /**\n * @prop {number} padding=5\n * Amount of pixel used to define a minimum distance between the boundaries\n * and the popper. This makes sure the popper always has a little padding\n * between the edges of its container\n */\n padding: 5,\n /**\n * @prop {String|HTMLElement} boundariesElement='scrollParent'\n * Boundaries used by the modifier. Can be `scrollParent`, `window`,\n * `viewport` or any DOM element.\n */\n boundariesElement: 'scrollParent'\n },\n\n /**\n * Modifier used to make sure the reference and its popper stay near each other\n * without leaving any gap between the two. Especially useful when the arrow is\n * enabled and you want to ensure that it points to its reference element.\n * It cares only about the first axis. You can still have poppers with margin\n * between the popper and its reference element.\n * @memberof modifiers\n * @inner\n */\n keepTogether: {\n /** @prop {number} order=400 - Index used to define the order of execution */\n order: 400,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: keepTogether\n },\n\n /**\n * This modifier is used to move the `arrowElement` of the popper to make\n * sure it is positioned between the reference element and its popper element.\n * It will read the outer size of the `arrowElement` node to detect how many\n * pixels of conjunction are needed.\n *\n * It has no effect if no `arrowElement` is provided.\n * @memberof modifiers\n * @inner\n */\n arrow: {\n /** @prop {number} order=500 - Index used to define the order of execution */\n order: 500,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: arrow,\n /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */\n element: '[x-arrow]'\n },\n\n /**\n * Modifier used to flip the popper's placement when it starts to overlap its\n * reference element.\n *\n * Requires the `preventOverflow` modifier before it in order to work.\n *\n * **NOTE:** this modifier will interrupt the current update cycle and will\n * restart it if it detects the need to flip the placement.\n * @memberof modifiers\n * @inner\n */\n flip: {\n /** @prop {number} order=600 - Index used to define the order of execution */\n order: 600,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: flip,\n /**\n * @prop {String|Array} behavior='flip'\n * The behavior used to change the popper's placement. It can be one of\n * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid\n * placements (with optional variations)\n */\n behavior: 'flip',\n /**\n * @prop {number} padding=5\n * The popper will flip if it hits the edges of the `boundariesElement`\n */\n padding: 5,\n /**\n * @prop {String|HTMLElement} boundariesElement='viewport'\n * The element which will define the boundaries of the popper position.\n * The popper will never be placed outside of the defined boundaries\n * (except if `keepTogether` is enabled)\n */\n boundariesElement: 'viewport',\n /**\n * @prop {Boolean} flipVariations=false\n * The popper will switch placement variation between `-start` and `-end` when\n * the reference element overlaps its boundaries.\n *\n * The original placement should have a set variation.\n */\n flipVariations: false,\n /**\n * @prop {Boolean} flipVariationsByContent=false\n * The popper will switch placement variation between `-start` and `-end` when\n * the popper element overlaps its reference boundaries.\n *\n * The original placement should have a set variation.\n */\n flipVariationsByContent: false\n },\n\n /**\n * Modifier used to make the popper flow toward the inner of the reference element.\n * By default, when this modifier is disabled, the popper will be placed outside\n * the reference element.\n * @memberof modifiers\n * @inner\n */\n inner: {\n /** @prop {number} order=700 - Index used to define the order of execution */\n order: 700,\n /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */\n enabled: false,\n /** @prop {ModifierFn} */\n fn: inner\n },\n\n /**\n * Modifier used to hide the popper when its reference element is outside of the\n * popper boundaries. It will set a `x-out-of-boundaries` attribute which can\n * be used to hide with a CSS selector the popper when its reference is\n * out of boundaries.\n *\n * Requires the `preventOverflow` modifier before it in order to work.\n * @memberof modifiers\n * @inner\n */\n hide: {\n /** @prop {number} order=800 - Index used to define the order of execution */\n order: 800,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: hide\n },\n\n /**\n * Computes the style that will be applied to the popper element to gets\n * properly positioned.\n *\n * Note that this modifier will not touch the DOM, it just prepares the styles\n * so that `applyStyle` modifier can apply it. This separation is useful\n * in case you need to replace `applyStyle` with a custom implementation.\n *\n * This modifier has `850` as `order` value to maintain backward compatibility\n * with previous versions of Popper.js. Expect the modifiers ordering method\n * to change in future major versions of the library.\n *\n * @memberof modifiers\n * @inner\n */\n computeStyle: {\n /** @prop {number} order=850 - Index used to define the order of execution */\n order: 850,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: computeStyle,\n /**\n * @prop {Boolean} gpuAcceleration=true\n * If true, it uses the CSS 3D transformation to position the popper.\n * Otherwise, it will use the `top` and `left` properties\n */\n gpuAcceleration: true,\n /**\n * @prop {string} [x='bottom']\n * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.\n * Change this if your popper should grow in a direction different from `bottom`\n */\n x: 'bottom',\n /**\n * @prop {string} [x='left']\n * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.\n * Change this if your popper should grow in a direction different from `right`\n */\n y: 'right'\n },\n\n /**\n * Applies the computed styles to the popper element.\n *\n * All the DOM manipulations are limited to this modifier. This is useful in case\n * you want to integrate Popper.js inside a framework or view library and you\n * want to delegate all the DOM manipulations to it.\n *\n * Note that if you disable this modifier, you must make sure the popper element\n * has its position set to `absolute` before Popper.js can do its work!\n *\n * Just disable this modifier and define your own to achieve the desired effect.\n *\n * @memberof modifiers\n * @inner\n */\n applyStyle: {\n /** @prop {number} order=900 - Index used to define the order of execution */\n order: 900,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: applyStyle,\n /** @prop {Function} */\n onLoad: applyStyleOnLoad,\n /**\n * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier\n * @prop {Boolean} gpuAcceleration=true\n * If true, it uses the CSS 3D transformation to position the popper.\n * Otherwise, it will use the `top` and `left` properties\n */\n gpuAcceleration: undefined\n }\n};\n\n/**\n * The `dataObject` is an object containing all the information used by Popper.js.\n * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.\n * @name dataObject\n * @property {Object} data.instance The Popper.js instance\n * @property {String} data.placement Placement applied to popper\n * @property {String} data.originalPlacement Placement originally defined on init\n * @property {Boolean} data.flipped True if popper has been flipped by flip modifier\n * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper\n * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier\n * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)\n * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)\n * @property {Object} data.boundaries Offsets of the popper boundaries\n * @property {Object} data.offsets The measurements of popper, reference and arrow elements\n * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values\n * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values\n * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0\n */\n\n/**\n * Default options provided to Popper.js constructor.
\n * These can be overridden using the `options` argument of Popper.js.
\n * To override an option, simply pass an object with the same\n * structure of the `options` object, as the 3rd argument. For example:\n * ```\n * new Popper(ref, pop, {\n * modifiers: {\n * preventOverflow: { enabled: false }\n * }\n * })\n * ```\n * @type {Object}\n * @static\n * @memberof Popper\n */\nvar Defaults = {\n /**\n * Popper's placement.\n * @prop {Popper.placements} placement='bottom'\n */\n placement: 'bottom',\n\n /**\n * Set this to true if you want popper to position it self in 'fixed' mode\n * @prop {Boolean} positionFixed=false\n */\n positionFixed: false,\n\n /**\n * Whether events (resize, scroll) are initially enabled.\n * @prop {Boolean} eventsEnabled=true\n */\n eventsEnabled: true,\n\n /**\n * Set to true if you want to automatically remove the popper when\n * you call the `destroy` method.\n * @prop {Boolean} removeOnDestroy=false\n */\n removeOnDestroy: false,\n\n /**\n * Callback called when the popper is created.
\n * By default, it is set to no-op.
\n * Access Popper.js instance with `data.instance`.\n * @prop {onCreate}\n */\n onCreate: function onCreate() {},\n\n /**\n * Callback called when the popper is updated. This callback is not called\n * on the initialization/creation of the popper, but only on subsequent\n * updates.
\n * By default, it is set to no-op.
\n * Access Popper.js instance with `data.instance`.\n * @prop {onUpdate}\n */\n onUpdate: function onUpdate() {},\n\n /**\n * List of modifiers used to modify the offsets before they are applied to the popper.\n * They provide most of the functionalities of Popper.js.\n * @prop {modifiers}\n */\n modifiers: modifiers\n};\n\n/**\n * @callback onCreate\n * @param {dataObject} data\n */\n\n/**\n * @callback onUpdate\n * @param {dataObject} data\n */\n\n// Utils\n// Methods\nvar Popper = function () {\n /**\n * Creates a new Popper.js instance.\n * @class Popper\n * @param {Element|referenceObject} reference - The reference element used to position the popper\n * @param {Element} popper - The HTML / XML element used as the popper\n * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)\n * @return {Object} instance - The generated Popper.js instance\n */\n function Popper(reference, popper) {\n var _this = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n classCallCheck(this, Popper);\n\n this.scheduleUpdate = function () {\n return requestAnimationFrame(_this.update);\n };\n\n // make update() debounced, so that it only runs at most once-per-tick\n this.update = debounce(this.update.bind(this));\n\n // with {} we create a new object with the options inside it\n this.options = _extends({}, Popper.Defaults, options);\n\n // init state\n this.state = {\n isDestroyed: false,\n isCreated: false,\n scrollParents: []\n };\n\n // get reference and popper elements (allow jQuery wrappers)\n this.reference = reference && reference.jquery ? reference[0] : reference;\n this.popper = popper && popper.jquery ? popper[0] : popper;\n\n // Deep merge modifiers options\n this.options.modifiers = {};\n Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {\n _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});\n });\n\n // Refactoring modifiers' list (Object => Array)\n this.modifiers = Object.keys(this.options.modifiers).map(function (name) {\n return _extends({\n name: name\n }, _this.options.modifiers[name]);\n })\n // sort the modifiers by order\n .sort(function (a, b) {\n return a.order - b.order;\n });\n\n // modifiers have the ability to execute arbitrary code when Popper.js get inited\n // such code is executed in the same order of its modifier\n // they could add new properties to their options configuration\n // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!\n this.modifiers.forEach(function (modifierOptions) {\n if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {\n modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);\n }\n });\n\n // fire the first update to position the popper in the right place\n this.update();\n\n var eventsEnabled = this.options.eventsEnabled;\n if (eventsEnabled) {\n // setup event listeners, they will take care of update the position in specific situations\n this.enableEventListeners();\n }\n\n this.state.eventsEnabled = eventsEnabled;\n }\n\n // We can't use class properties because they don't get listed in the\n // class prototype and break stuff like Sinon stubs\n\n\n createClass(Popper, [{\n key: 'update',\n value: function update$$1() {\n return update.call(this);\n }\n }, {\n key: 'destroy',\n value: function destroy$$1() {\n return destroy.call(this);\n }\n }, {\n key: 'enableEventListeners',\n value: function enableEventListeners$$1() {\n return enableEventListeners.call(this);\n }\n }, {\n key: 'disableEventListeners',\n value: function disableEventListeners$$1() {\n return disableEventListeners.call(this);\n }\n\n /**\n * Schedules an update. It will run on the next UI update available.\n * @method scheduleUpdate\n * @memberof Popper\n */\n\n\n /**\n * Collection of utilities useful when writing custom modifiers.\n * Starting from version 1.7, this method is available only if you\n * include `popper-utils.js` before `popper.js`.\n *\n * **DEPRECATION**: This way to access PopperUtils is deprecated\n * and will be removed in v2! Use the PopperUtils module directly instead.\n * Due to the high instability of the methods contained in Utils, we can't\n * guarantee them to follow semver. Use them at your own risk!\n * @static\n * @private\n * @type {Object}\n * @deprecated since version 1.8\n * @member Utils\n * @memberof Popper\n */\n\n }]);\n return Popper;\n}();\n\n/**\n * The `referenceObject` is an object that provides an interface compatible with Popper.js\n * and lets you use it as replacement of a real DOM node.
\n * You can use this method to position a popper relatively to a set of coordinates\n * in case you don't have a DOM node to use as reference.\n *\n * ```\n * new Popper(referenceObject, popperNode);\n * ```\n *\n * NB: This feature isn't supported in Internet Explorer 10.\n * @name referenceObject\n * @property {Function} data.getBoundingClientRect\n * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.\n * @property {number} data.clientWidth\n * An ES6 getter that will return the width of the virtual reference element.\n * @property {number} data.clientHeight\n * An ES6 getter that will return the height of the virtual reference element.\n */\n\n\nPopper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;\nPopper.placements = placements;\nPopper.Defaults = Defaults;\n\nexport default Popper;\n//# sourceMappingURL=popper.js.map\n","var DOM_PROPERTIES_TO_CHECK = [\n 'innerHTML',\n 'ownerDocument',\n 'style',\n 'attributes',\n 'nodeValue',\n];\nvar objectTypes = [\n 'Array',\n 'ArrayBuffer',\n 'AsyncFunction',\n 'AsyncGenerator',\n 'AsyncGeneratorFunction',\n 'Date',\n 'Error',\n 'Function',\n 'Generator',\n 'GeneratorFunction',\n 'HTMLElement',\n 'Map',\n 'Object',\n 'Promise',\n 'RegExp',\n 'Set',\n 'WeakMap',\n 'WeakSet',\n];\nvar primitiveTypes = [\n 'bigint',\n 'boolean',\n 'null',\n 'number',\n 'string',\n 'symbol',\n 'undefined',\n];\nexport function getObjectType(value) {\n var objectTypeName = Object.prototype.toString.call(value).slice(8, -1);\n if (/HTML\\w+Element/.test(objectTypeName)) {\n return 'HTMLElement';\n }\n if (isObjectType(objectTypeName)) {\n return objectTypeName;\n }\n return undefined;\n}\nfunction isObjectOfType(type) {\n return function (value) { return getObjectType(value) === type; };\n}\nfunction isObjectType(name) {\n return objectTypes.includes(name);\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isOfType(type) {\n return function (value) { return typeof value === type; };\n}\nfunction isPrimitiveType(name) {\n return primitiveTypes.includes(name);\n}\nfunction is(value) {\n if (value === null) {\n return 'null';\n }\n switch (typeof value) {\n case 'bigint':\n return 'bigint';\n case 'boolean':\n return 'boolean';\n case 'number':\n return 'number';\n case 'string':\n return 'string';\n case 'symbol':\n return 'symbol';\n case 'undefined':\n return 'undefined';\n default:\n }\n if (is.array(value)) {\n return 'Array';\n }\n if (is.plainFunction(value)) {\n return 'Function';\n }\n var tagType = getObjectType(value);\n /* istanbul ignore else */\n if (tagType) {\n return tagType;\n }\n /* istanbul ignore next */\n return 'Object';\n}\nis.array = Array.isArray;\nis.arrayOf = function (target, predicate) {\n if (!is.array(target) && !is.function(predicate)) {\n return false;\n }\n return target.every(function (d) { return predicate(d); });\n};\nis.asyncGeneratorFunction = function (value) {\n return getObjectType(value) === 'AsyncGeneratorFunction';\n};\n// eslint-disable-next-line @typescript-eslint/ban-types\nis.asyncFunction = isObjectOfType('AsyncFunction');\nis.bigint = isOfType('bigint');\nis.boolean = function (value) {\n return value === true || value === false;\n};\nis.date = isObjectOfType('Date');\nis.defined = function (value) { return !is.undefined(value); };\nis.domElement = function (value) {\n return (is.object(value) &&\n !is.plainObject(value) &&\n value.nodeType === 1 &&\n is.string(value.nodeName) &&\n DOM_PROPERTIES_TO_CHECK.every(function (property) { return property in value; }));\n};\nis.empty = function (value) {\n return ((is.string(value) && value.length === 0) ||\n (is.array(value) && value.length === 0) ||\n (is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0) ||\n (is.set(value) && value.size === 0) ||\n (is.map(value) && value.size === 0));\n};\nis.error = isObjectOfType('Error');\n// eslint-disable-next-line @typescript-eslint/ban-types\nis.function = isOfType('function');\nis.generator = function (value) {\n return (is.iterable(value) &&\n is.function(value.next) &&\n is.function(value.throw));\n};\nis.generatorFunction = isObjectOfType('GeneratorFunction');\nis.instanceOf = function (instance, class_) {\n if (!instance || !class_) {\n return false;\n }\n return Object.getPrototypeOf(instance) === class_.prototype;\n};\nis.iterable = function (value) {\n return (!is.nullOrUndefined(value) && is.function(value[Symbol.iterator]));\n};\nis.map = isObjectOfType('Map');\nis.nan = function (value) {\n return Number.isNaN(value);\n};\nis.null = function (value) {\n return value === null;\n};\nis.nullOrUndefined = function (value) {\n return is.null(value) || is.undefined(value);\n};\nis.number = function (value) {\n return isOfType('number')(value) && !is.nan(value);\n};\nis.numericString = function (value) {\n return is.string(value) && value.length > 0 && !Number.isNaN(Number(value));\n};\n// eslint-disable-next-line @typescript-eslint/ban-types\nis.object = function (value) {\n return !is.nullOrUndefined(value) && (is.function(value) || typeof value === 'object');\n};\nis.oneOf = function (target, value) {\n if (!is.array(target)) {\n return false;\n }\n // eslint-disable-next-line unicorn/prefer-includes\n return target.indexOf(value) > -1;\n};\n// eslint-disable-next-line @typescript-eslint/ban-types\nis.plainFunction = isObjectOfType('Function');\nis.plainObject = function (value) {\n if (getObjectType(value) !== 'Object') {\n return false;\n }\n var prototype = Object.getPrototypeOf(value);\n return prototype === null || prototype === Object.getPrototypeOf({});\n};\nis.primitive = function (value) {\n return is.null(value) || isPrimitiveType(typeof value);\n};\nis.promise = isObjectOfType('Promise');\nis.propertyOf = function (target, key, predicate) {\n if (!is.object(target) || !key) {\n return false;\n }\n var value = target[key];\n if (is.function(predicate)) {\n return predicate(value);\n }\n return is.defined(value);\n};\nis.regexp = isObjectOfType('RegExp');\nis.set = isObjectOfType('Set');\nis.string = isOfType('string');\nis.symbol = isOfType('symbol');\nis.undefined = isOfType('undefined');\nis.weakMap = isObjectOfType('WeakMap');\nis.weakSet = isObjectOfType('WeakSet');\nexport * from './types';\nexport default is;\n//# sourceMappingURL=index.js.map","// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isOfType(type) {\n return function (value) { return typeof value === type; };\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport var isFunction = isOfType('function');\nexport var isNull = function (value) {\n return value === null;\n};\nexport var isRegex = function (value) {\n return Object.prototype.toString.call(value).slice(8, -1) === 'RegExp';\n};\nexport var isObject = function (value) {\n return !isUndefined(value) && !isNull(value) && (isFunction(value) || typeof value === 'object');\n};\nexport var isUndefined = isOfType('undefined');\n//# sourceMappingURL=helpers.js.map","var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nimport { isObject, isRegex } from './helpers';\nfunction equalArray(left, right) {\n var length = left.length;\n if (length !== right.length) {\n return false;\n }\n for (var index = length; index-- !== 0;) {\n if (!equal(left[index], right[index])) {\n return false;\n }\n }\n return true;\n}\nfunction equalArrayBuffer(left, right) {\n if (left.byteLength !== right.byteLength) {\n return false;\n }\n var view1 = new DataView(left.buffer);\n var view2 = new DataView(right.buffer);\n var index = left.byteLength;\n while (index--) {\n if (view1.getUint8(index) !== view2.getUint8(index)) {\n return false;\n }\n }\n return true;\n}\nfunction equalMap(left, right) {\n var e_1, _a, e_2, _b;\n if (left.size !== right.size) {\n return false;\n }\n try {\n for (var _c = __values(left.entries()), _d = _c.next(); !_d.done; _d = _c.next()) {\n var index = _d.value;\n if (!right.has(index[0])) {\n return false;\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n try {\n for (var _e = __values(left.entries()), _f = _e.next(); !_f.done; _f = _e.next()) {\n var index = _f.value;\n if (!equal(index[1], right.get(index[0]))) {\n return false;\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n }\n finally { if (e_2) throw e_2.error; }\n }\n return true;\n}\nfunction equalSet(left, right) {\n var e_3, _a;\n if (left.size !== right.size) {\n return false;\n }\n try {\n for (var _b = __values(left.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var index = _c.value;\n if (!right.has(index[0])) {\n return false;\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n return true;\n}\nexport default function equal(left, right) {\n if (left === right) {\n return true;\n }\n if (left && isObject(left) && right && isObject(right)) {\n if (left.constructor !== right.constructor) {\n return false;\n }\n if (Array.isArray(left) && Array.isArray(right)) {\n return equalArray(left, right);\n }\n if (left instanceof Map && right instanceof Map) {\n return equalMap(left, right);\n }\n if (left instanceof Set && right instanceof Set) {\n return equalSet(left, right);\n }\n if (ArrayBuffer.isView(left) && ArrayBuffer.isView(right)) {\n return equalArrayBuffer(left, right);\n }\n if (isRegex(left) && isRegex(right)) {\n return left.source === right.source && left.flags === right.flags;\n }\n if (left.valueOf !== Object.prototype.valueOf) {\n return left.valueOf() === right.valueOf();\n }\n if (left.toString !== Object.prototype.toString) {\n return left.toString() === right.toString();\n }\n var leftKeys = Object.keys(left);\n var rightKeys = Object.keys(right);\n if (leftKeys.length !== rightKeys.length) {\n return false;\n }\n for (var index = leftKeys.length; index-- !== 0;) {\n if (!Object.prototype.hasOwnProperty.call(right, leftKeys[index])) {\n return false;\n }\n }\n for (var index = leftKeys.length; index-- !== 0;) {\n var key = leftKeys[index];\n if (key === '_owner' && left.$$typeof) {\n // React-specific: avoid traversing React elements' _owner.\n // _owner contains circular references\n // and is not needed when comparing the actual elements (and not their owners)\n // eslint-disable-next-line no-continue\n continue;\n }\n if (!equal(left[key], right[key])) {\n return false;\n }\n }\n return true;\n }\n if (Number.isNaN(left) && Number.isNaN(right)) {\n return true;\n }\n return left === right;\n}\n//# sourceMappingURL=index.js.map","import equal from '@gilbarbara/deep-equal';\nimport is from 'is-lite';\nexport function canHaveLength() {\n var arguments_ = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n arguments_[_i] = arguments[_i];\n }\n return arguments_.every(function (d) { return is.string(d) || is.array(d) || is.plainObject(d); });\n}\nexport function checkEquality(left, right, value) {\n if (!isSameType(left, right)) {\n return false;\n }\n if ([left, right].every(is.array)) {\n return !left.some(hasValue(value)) && right.some(hasValue(value));\n }\n /* istanbul ignore else */\n if ([left, right].every(is.plainObject)) {\n return (!Object.entries(left).some(hasEntry(value)) && Object.entries(right).some(hasEntry(value)));\n }\n return right === value;\n}\nexport function compareNumbers(previousData, data, options) {\n var actual = options.actual, key = options.key, previous = options.previous, type = options.type;\n var left = nested(previousData, key);\n var right = nested(data, key);\n var changed = [left, right].every(is.number) && (type === 'increased' ? left < right : left > right);\n if (!is.undefined(actual)) {\n changed = changed && right === actual;\n }\n if (!is.undefined(previous)) {\n changed = changed && left === previous;\n }\n return changed;\n}\nexport function compareValues(previousData, data, options) {\n var key = options.key, type = options.type, value = options.value;\n var left = nested(previousData, key);\n var right = nested(data, key);\n var primary = type === 'added' ? left : right;\n var secondary = type === 'added' ? right : left;\n // console.log({ primary, secondary });\n if (!is.nullOrUndefined(value)) {\n if (is.defined(primary)) {\n // check if nested data matches\n if (is.array(primary) || is.plainObject(primary)) {\n return checkEquality(primary, secondary, value);\n }\n }\n else {\n return equal(secondary, value);\n }\n return false;\n }\n if ([left, right].every(is.array)) {\n return !secondary.every(isEqualPredicate(primary));\n }\n if ([left, right].every(is.plainObject)) {\n return hasExtraKeys(Object.keys(primary), Object.keys(secondary));\n }\n return (![left, right].every(function (d) { return is.primitive(d) && is.defined(d); }) &&\n (type === 'added'\n ? !is.defined(left) && is.defined(right)\n : is.defined(left) && !is.defined(right)));\n}\nexport function getIterables(previousData, data, _a) {\n var _b = _a === void 0 ? {} : _a, key = _b.key;\n var left = nested(previousData, key);\n var right = nested(data, key);\n if (!isSameType(left, right)) {\n throw new TypeError('Inputs have different types');\n }\n if (!canHaveLength(left, right)) {\n throw new TypeError(\"Inputs don't have length\");\n }\n if ([left, right].every(is.plainObject)) {\n left = Object.keys(left);\n right = Object.keys(right);\n }\n return [left, right];\n}\nexport function hasEntry(input) {\n return function (_a) {\n var key = _a[0], value = _a[1];\n if (is.array(input)) {\n return (equal(input, value) ||\n input.some(function (d) { return equal(d, value) || (is.array(value) && isEqualPredicate(value)(d)); }));\n }\n /* istanbul ignore else */\n if (is.plainObject(input) && input[key]) {\n return !!input[key] && equal(input[key], value);\n }\n return equal(input, value);\n };\n}\nexport function hasExtraKeys(left, right) {\n return right.some(function (d) { return !left.includes(d); });\n}\nexport function hasValue(input) {\n return function (value) {\n if (is.array(input)) {\n return input.some(function (d) { return equal(d, value) || (is.array(value) && isEqualPredicate(value)(d)); });\n }\n return equal(input, value);\n };\n}\nexport function includesOrEqualsTo(previousValue, value) {\n return is.array(previousValue)\n ? previousValue.some(function (d) { return equal(d, value); })\n : equal(previousValue, value);\n}\nexport function isEqualPredicate(data) {\n return function (value) { return data.some(function (d) { return equal(d, value); }); };\n}\nexport function isSameType() {\n var arguments_ = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n arguments_[_i] = arguments[_i];\n }\n return (arguments_.every(is.array) ||\n arguments_.every(is.number) ||\n arguments_.every(is.plainObject) ||\n arguments_.every(is.string));\n}\nexport function nested(data, property) {\n /* istanbul ignore else */\n if (is.plainObject(data) || is.array(data)) {\n /* istanbul ignore else */\n if (is.string(property)) {\n var props = property.split('.');\n return props.reduce(function (acc, d) { return acc && acc[d]; }, data);\n }\n /* istanbul ignore else */\n if (is.number(property)) {\n return data[property];\n }\n return data;\n }\n return data;\n}\n//# sourceMappingURL=helpers.js.map","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Popper from 'popper.js';\nimport deepmerge from 'deepmerge';\nimport is from 'is-lite';\nimport treeChanges from 'tree-changes';\nimport ReactDOM from 'react-dom';\n\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n}\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\nfunction _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = _objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n}\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return _assertThisInitialized(self);\n}\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return _possibleConstructorReturn(this, result);\n };\n}\nfunction _toPrimitive(input, hint) {\n if (typeof input !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\nfunction _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return typeof key === \"symbol\" ? key : String(key);\n}\n\nvar DEFAULTS = {flip:{padding:20},preventOverflow:{padding:10}};\n\nvar VALIDATOR_ARG_ERROR_MESSAGE='The typeValidator argument must be a function '+'with the signature function(props, propName, componentName).';var MESSAGE_ARG_ERROR_MESSAGE='The error message is optional, but must be a string if provided.';function propIsRequired(condition,props,propName,componentName){if(typeof condition==='boolean'){return condition;}if(typeof condition==='function'){return condition(props,propName,componentName);}if(Boolean(condition)===true){return Boolean(condition);}return false;}function propExists(props,propName){return Object.hasOwnProperty.call(props,propName);}function missingPropError(props,propName,componentName,message){if(message){return new Error(message);}return new Error(\"Required \".concat(props[propName],\" `\").concat(propName,\"` was not specified in `\").concat(componentName,\"`.\"));}function guardAgainstInvalidArgTypes(typeValidator,message){if(typeof typeValidator!=='function'){throw new TypeError(VALIDATOR_ARG_ERROR_MESSAGE);}if(Boolean(message)&&typeof message!=='string'){throw new TypeError(MESSAGE_ARG_ERROR_MESSAGE);}}function isRequiredIf(typeValidator,condition,message){guardAgainstInvalidArgTypes(typeValidator,message);return function(props,propName,componentName){for(var _len=arguments.length,rest=new Array(_len>3?_len-3:0),_key=3;_key<_len;_key++){rest[_key-3]=arguments[_key];}if(propIsRequired(condition,props,propName,componentName)){if(propExists(props,propName)){return typeValidator.apply(void 0,[props,propName,componentName].concat(rest));}return missingPropError(props,propName,componentName,message);}// Is not required, so just run typeValidator.\nreturn typeValidator.apply(void 0,[props,propName,componentName].concat(rest));};}\n\nvar STATUS = {INIT:'init',IDLE:'idle',OPENING:'opening',OPEN:'open',CLOSING:'closing',ERROR:'error'};\n\nvar isReact16=ReactDOM.createPortal!==undefined;function canUseDOM(){return !!(typeof window!=='undefined'&&window.document&&window.document.createElement);}function isMobile(){return 'ontouchstart'in window&&/Mobi/.test(navigator.userAgent);}/**\n * Log method calls if debug is enabled\n *\n * @private\n * @param {Object} arg\n * @param {string} arg.title - The title the logger was called from\n * @param {Object|Array} [arg.data] - The data to be logged\n * @param {boolean} [arg.warn] - If true, the message will be a warning\n * @param {boolean} [arg.debug] - Nothing will be logged unless debug is true\n */function log(_ref){var title=_ref.title,data=_ref.data,_ref$warn=_ref.warn,warn=_ref$warn===void 0?false:_ref$warn,_ref$debug=_ref.debug,debug=_ref$debug===void 0?false:_ref$debug;/* eslint-disable no-console */var logFn=warn?console.warn||console.error:console.log;if(debug&&title&&data){console.groupCollapsed(\"%creact-floater: \".concat(title),'color: #9b00ff; font-weight: bold; font-size: 12px;');if(Array.isArray(data)){data.forEach(function(d){if(is.plainObject(d)&&d.key){logFn.apply(console,[d.key,d.value]);}else {logFn.apply(console,[d]);}});}else {logFn.apply(console,[data]);}console.groupEnd();}/* eslint-enable */}function on(element,event,cb){var capture=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;element.addEventListener(event,cb,capture);}function off(element,event,cb){var capture=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;element.removeEventListener(event,cb,capture);}function once(element,event,cb){var capture=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var _nextCB;// eslint-disable-next-line prefer-const\n_nextCB=function nextCB(e){cb(e);off(element,event,_nextCB);};on(element,event,_nextCB,capture);}function noop(){}\n\nvar ReactFloaterPortal=/*#__PURE__*/function(_React$Component){_inherits(ReactFloaterPortal,_React$Component);var _super=_createSuper(ReactFloaterPortal);function ReactFloaterPortal(){_classCallCheck(this,ReactFloaterPortal);return _super.apply(this,arguments);}_createClass(ReactFloaterPortal,[{key:\"componentDidMount\",value:function componentDidMount(){if(!canUseDOM())return;if(!this.node){this.appendNode();}if(!isReact16){this.renderPortal();}}},{key:\"componentDidUpdate\",value:function componentDidUpdate(){if(!canUseDOM())return;if(!isReact16){this.renderPortal();}}},{key:\"componentWillUnmount\",value:function componentWillUnmount(){if(!canUseDOM()||!this.node)return;if(!isReact16){ReactDOM.unmountComponentAtNode(this.node);}if(this.node&&this.node.parentNode===document.body){document.body.removeChild(this.node);this.node=undefined;}}},{key:\"appendNode\",value:function appendNode(){var _this$props=this.props,id=_this$props.id,zIndex=_this$props.zIndex;if(!this.node){this.node=document.createElement('div');/* istanbul ignore else */if(id){this.node.id=id;}if(zIndex){this.node.style.zIndex=zIndex;}document.body.appendChild(this.node);}}},{key:\"renderPortal\",value:function renderPortal(){if(!canUseDOM())return null;var _this$props2=this.props,children=_this$props2.children,setRef=_this$props2.setRef;if(!this.node){this.appendNode();}/* istanbul ignore else */if(isReact16){return/*#__PURE__*/ReactDOM.createPortal(children,this.node);}var portal=ReactDOM.unstable_renderSubtreeIntoContainer(this,children.length>1?/*#__PURE__*/React.createElement(\"div\",null,children):children[0],this.node);setRef(portal);return null;}},{key:\"renderReact16\",value:function renderReact16(){var _this$props3=this.props,hasChildren=_this$props3.hasChildren,placement=_this$props3.placement,target=_this$props3.target;if(!hasChildren){if(target||placement==='center'){return this.renderPortal();}return null;}return this.renderPortal();}},{key:\"render\",value:function render(){if(!isReact16){return null;}return this.renderReact16();}}]);return ReactFloaterPortal;}(React.Component);_defineProperty(ReactFloaterPortal,\"propTypes\",{children:PropTypes.oneOfType([PropTypes.element,PropTypes.array]),hasChildren:PropTypes.bool,id:PropTypes.oneOfType([PropTypes.string,PropTypes.number]),placement:PropTypes.string,setRef:PropTypes.func.isRequired,target:PropTypes.oneOfType([PropTypes.object,PropTypes.string]),zIndex:PropTypes.number});\n\nvar FloaterArrow=/*#__PURE__*/function(_React$Component){_inherits(FloaterArrow,_React$Component);var _super=_createSuper(FloaterArrow);function FloaterArrow(){_classCallCheck(this,FloaterArrow);return _super.apply(this,arguments);}_createClass(FloaterArrow,[{key:\"parentStyle\",get:function get(){var _this$props=this.props,placement=_this$props.placement,styles=_this$props.styles;var length=styles.arrow.length;var arrow={pointerEvents:'none',position:'absolute',width:'100%'};/* istanbul ignore else */if(placement.startsWith('top')){arrow.bottom=0;arrow.left=0;arrow.right=0;arrow.height=length;}else if(placement.startsWith('bottom')){arrow.left=0;arrow.right=0;arrow.top=0;arrow.height=length;}else if(placement.startsWith('left')){arrow.right=0;arrow.top=0;arrow.bottom=0;}else if(placement.startsWith('right')){arrow.left=0;arrow.top=0;}return arrow;}},{key:\"render\",value:function render(){var _this$props2=this.props,placement=_this$props2.placement,setArrowRef=_this$props2.setArrowRef,styles=_this$props2.styles;var _styles$arrow=styles.arrow,color=_styles$arrow.color,display=_styles$arrow.display,length=_styles$arrow.length,margin=_styles$arrow.margin,position=_styles$arrow.position,spread=_styles$arrow.spread;var arrowStyles={display:display,position:position};var points;var x=spread;var y=length;/* istanbul ignore else */if(placement.startsWith('top')){points=\"0,0 \".concat(x/2,\",\").concat(y,\" \").concat(x,\",0\");arrowStyles.bottom=0;arrowStyles.marginLeft=margin;arrowStyles.marginRight=margin;}else if(placement.startsWith('bottom')){points=\"\".concat(x,\",\").concat(y,\" \").concat(x/2,\",0 0,\").concat(y);arrowStyles.top=0;arrowStyles.marginLeft=margin;arrowStyles.marginRight=margin;}else if(placement.startsWith('left')){y=spread;x=length;points=\"0,0 \".concat(x,\",\").concat(y/2,\" 0,\").concat(y);arrowStyles.right=0;arrowStyles.marginTop=margin;arrowStyles.marginBottom=margin;}else if(placement.startsWith('right')){y=spread;x=length;points=\"\".concat(x,\",\").concat(y,\" \").concat(x,\",0 0,\").concat(y/2);arrowStyles.left=0;arrowStyles.marginTop=margin;arrowStyles.marginBottom=margin;}return/*#__PURE__*/React.createElement(\"div\",{className:\"__floater__arrow\",style:this.parentStyle},/*#__PURE__*/React.createElement(\"span\",{ref:setArrowRef,style:arrowStyles},/*#__PURE__*/React.createElement(\"svg\",{width:x,height:y,version:\"1.1\",xmlns:\"http://www.w3.org/2000/svg\"},/*#__PURE__*/React.createElement(\"polygon\",{points:points,fill:color}))));}}]);return FloaterArrow;}(React.Component);_defineProperty(FloaterArrow,\"propTypes\",{placement:PropTypes.string.isRequired,setArrowRef:PropTypes.func.isRequired,styles:PropTypes.object.isRequired});\n\nvar _excluded$1=[\"color\",\"height\",\"width\"];function FloaterCloseBtn(_ref){var handleClick=_ref.handleClick,styles=_ref.styles;var color=styles.color,height=styles.height,width=styles.width,style=_objectWithoutProperties(styles,_excluded$1);return/*#__PURE__*/React.createElement(\"button\",{\"aria-label\":\"close\",onClick:handleClick,style:style,type:\"button\"},/*#__PURE__*/React.createElement(\"svg\",{width:\"\".concat(width,\"px\"),height:\"\".concat(height,\"px\"),viewBox:\"0 0 18 18\",version:\"1.1\",xmlns:\"http://www.w3.org/2000/svg\",preserveAspectRatio:\"xMidYMid\"},/*#__PURE__*/React.createElement(\"g\",null,/*#__PURE__*/React.createElement(\"path\",{d:\"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z\",fill:color}))));}FloaterCloseBtn.propTypes={handleClick:PropTypes.func.isRequired,styles:PropTypes.object.isRequired};\n\nfunction FloaterContainer(_ref){var content=_ref.content,footer=_ref.footer,handleClick=_ref.handleClick,open=_ref.open,positionWrapper=_ref.positionWrapper,showCloseButton=_ref.showCloseButton,title=_ref.title,styles=_ref.styles;var output={content:/*#__PURE__*/React.isValidElement(content)?content:/*#__PURE__*/React.createElement(\"div\",{className:\"__floater__content\",style:styles.content},content)};if(title){output.title=/*#__PURE__*/React.isValidElement(title)?title:/*#__PURE__*/React.createElement(\"div\",{className:\"__floater__title\",style:styles.title},title);}if(footer){output.footer=/*#__PURE__*/React.isValidElement(footer)?footer:/*#__PURE__*/React.createElement(\"div\",{className:\"__floater__footer\",style:styles.footer},footer);}if((showCloseButton||positionWrapper)&&!is[\"boolean\"](open)){output.close=/*#__PURE__*/React.createElement(FloaterCloseBtn,{styles:styles.close,handleClick:handleClick});}return/*#__PURE__*/React.createElement(\"div\",{className:\"__floater__container\",style:styles.container},output.close,output.title,output.content,output.footer);}FloaterContainer.propTypes={content:PropTypes.node.isRequired,footer:PropTypes.node,handleClick:PropTypes.func.isRequired,open:PropTypes.bool,positionWrapper:PropTypes.bool.isRequired,showCloseButton:PropTypes.bool.isRequired,styles:PropTypes.object.isRequired,title:PropTypes.node};\n\nvar Floater=/*#__PURE__*/function(_React$Component){_inherits(Floater,_React$Component);var _super=_createSuper(Floater);function Floater(){_classCallCheck(this,Floater);return _super.apply(this,arguments);}_createClass(Floater,[{key:\"style\",get:function get(){var _this$props=this.props,disableAnimation=_this$props.disableAnimation,component=_this$props.component,placement=_this$props.placement,hideArrow=_this$props.hideArrow,status=_this$props.status,styles=_this$props.styles;var length=styles.arrow.length,floater=styles.floater,floaterCentered=styles.floaterCentered,floaterClosing=styles.floaterClosing,floaterOpening=styles.floaterOpening,floaterWithAnimation=styles.floaterWithAnimation,floaterWithComponent=styles.floaterWithComponent;var element={};if(!hideArrow){if(placement.startsWith('top')){element.padding=\"0 0 \".concat(length,\"px\");}else if(placement.startsWith('bottom')){element.padding=\"\".concat(length,\"px 0 0\");}else if(placement.startsWith('left')){element.padding=\"0 \".concat(length,\"px 0 0\");}else if(placement.startsWith('right')){element.padding=\"0 0 0 \".concat(length,\"px\");}}if([STATUS.OPENING,STATUS.OPEN].indexOf(status)!==-1){element=_objectSpread2(_objectSpread2({},element),floaterOpening);}if(status===STATUS.CLOSING){element=_objectSpread2(_objectSpread2({},element),floaterClosing);}if(status===STATUS.OPEN&&!disableAnimation){element=_objectSpread2(_objectSpread2({},element),floaterWithAnimation);}if(placement==='center'){element=_objectSpread2(_objectSpread2({},element),floaterCentered);}if(component){element=_objectSpread2(_objectSpread2({},element),floaterWithComponent);}return _objectSpread2(_objectSpread2({},floater),element);}},{key:\"render\",value:function render(){var _this$props2=this.props,component=_this$props2.component,closeFn=_this$props2.handleClick,hideArrow=_this$props2.hideArrow,setFloaterRef=_this$props2.setFloaterRef,status=_this$props2.status;var output={};var classes=['__floater'];if(component){if(/*#__PURE__*/React.isValidElement(component)){output.content=/*#__PURE__*/React.cloneElement(component,{closeFn:closeFn});}else {output.content=component({closeFn:closeFn});}}else {output.content=/*#__PURE__*/React.createElement(FloaterContainer,this.props);}if(status===STATUS.OPEN){classes.push('__floater__open');}if(!hideArrow){output.arrow=/*#__PURE__*/React.createElement(FloaterArrow,this.props);}return/*#__PURE__*/React.createElement(\"div\",{ref:setFloaterRef,className:classes.join(' '),style:this.style},/*#__PURE__*/React.createElement(\"div\",{className:\"__floater__body\"},output.content,output.arrow));}}]);return Floater;}(React.Component);_defineProperty(Floater,\"propTypes\",{component:PropTypes.oneOfType([PropTypes.func,PropTypes.element]),content:PropTypes.node,disableAnimation:PropTypes.bool.isRequired,footer:PropTypes.node,handleClick:PropTypes.func.isRequired,hideArrow:PropTypes.bool.isRequired,open:PropTypes.bool,placement:PropTypes.string.isRequired,positionWrapper:PropTypes.bool.isRequired,setArrowRef:PropTypes.func.isRequired,setFloaterRef:PropTypes.func.isRequired,showCloseButton:PropTypes.bool,status:PropTypes.string.isRequired,styles:PropTypes.object.isRequired,title:PropTypes.node});\n\nvar ReactFloaterWrapper=/*#__PURE__*/function(_React$Component){_inherits(ReactFloaterWrapper,_React$Component);var _super=_createSuper(ReactFloaterWrapper);function ReactFloaterWrapper(){_classCallCheck(this,ReactFloaterWrapper);return _super.apply(this,arguments);}_createClass(ReactFloaterWrapper,[{key:\"render\",value:function render(){var _this$props=this.props,children=_this$props.children,handleClick=_this$props.handleClick,handleMouseEnter=_this$props.handleMouseEnter,handleMouseLeave=_this$props.handleMouseLeave,setChildRef=_this$props.setChildRef,setWrapperRef=_this$props.setWrapperRef,style=_this$props.style,styles=_this$props.styles;var element;/* istanbul ignore else */if(children){if(React.Children.count(children)===1){if(!/*#__PURE__*/React.isValidElement(children)){element=/*#__PURE__*/React.createElement(\"span\",null,children);}else {var refProp=is[\"function\"](children.type)?'innerRef':'ref';element=/*#__PURE__*/React.cloneElement(React.Children.only(children),_defineProperty({},refProp,setChildRef));}}else {element=children;}}if(!element){return null;}return/*#__PURE__*/React.createElement(\"span\",{ref:setWrapperRef,style:_objectSpread2(_objectSpread2({},styles),style),onClick:handleClick,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave},element);}}]);return ReactFloaterWrapper;}(React.Component);_defineProperty(ReactFloaterWrapper,\"propTypes\",{children:PropTypes.node,handleClick:PropTypes.func.isRequired,handleMouseEnter:PropTypes.func.isRequired,handleMouseLeave:PropTypes.func.isRequired,setChildRef:PropTypes.func.isRequired,setWrapperRef:PropTypes.func.isRequired,style:PropTypes.object,styles:PropTypes.object.isRequired});\n\nvar defaultOptions={zIndex:100};function getStyles(styles){var options=deepmerge(defaultOptions,styles.options||{});return {wrapper:{cursor:'help',display:'inline-flex',flexDirection:'column',zIndex:options.zIndex},wrapperPosition:{left:-1000,position:'absolute',top:-1000,visibility:'hidden'},floater:{display:'inline-block',filter:'drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))',maxWidth:300,opacity:0,position:'relative',transition:'opacity 0.3s',visibility:'hidden',zIndex:options.zIndex},floaterOpening:{opacity:1,visibility:'visible'},floaterWithAnimation:{opacity:1,transition:'opacity 0.3s, transform 0.2s',visibility:'visible'},floaterWithComponent:{maxWidth:'100%'},floaterClosing:{opacity:0,visibility:'visible'},floaterCentered:{left:'50%',position:'fixed',top:'50%',transform:'translate(-50%, -50%)'},container:{backgroundColor:'#fff',color:'#666',minHeight:60,minWidth:200,padding:20,position:'relative',zIndex:10},title:{borderBottom:'1px solid #555',color:'#555',fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:'transparent',border:0,borderRadius:0,color:'#555',fontSize:0,height:15,outline:'none',padding:10,position:'absolute',right:0,top:0,width:15,WebkitAppearance:'none'},footer:{borderTop:'1px solid #ccc',fontSize:13,marginTop:10,paddingTop:5},arrow:{color:'#fff',display:'inline-flex',length:16,margin:8,position:'absolute',spread:32},options:options};}\n\nvar _excluded=[\"arrow\",\"flip\",\"offset\"];var POSITIONING_PROPS=['position','top','right','bottom','left'];var ReactFloater=/*#__PURE__*/function(_React$Component){_inherits(ReactFloater,_React$Component);var _super=_createSuper(ReactFloater);function ReactFloater(props){var _this;_classCallCheck(this,ReactFloater);_this=_super.call(this,props);/* istanbul ignore else */_defineProperty(_assertThisInitialized(_this),\"setArrowRef\",function(ref){_this.arrowRef=ref;});_defineProperty(_assertThisInitialized(_this),\"setChildRef\",function(ref){_this.childRef=ref;});_defineProperty(_assertThisInitialized(_this),\"setFloaterRef\",function(ref){_this.floaterRef=ref;});_defineProperty(_assertThisInitialized(_this),\"setWrapperRef\",function(ref){_this.wrapperRef=ref;});_defineProperty(_assertThisInitialized(_this),\"handleTransitionEnd\",function(){var status=_this.state.status;var callback=_this.props.callback;/* istanbul ignore else */if(_this.wrapperPopper){_this.wrapperPopper.instance.update();}_this.setState({status:status===STATUS.OPENING?STATUS.OPEN:STATUS.IDLE},function(){var newStatus=_this.state.status;callback(newStatus===STATUS.OPEN?'open':'close',_this.props);});});_defineProperty(_assertThisInitialized(_this),\"handleClick\",function(){var _this$props=_this.props,event=_this$props.event,open=_this$props.open;if(is[\"boolean\"](open))return;var _this$state=_this.state,positionWrapper=_this$state.positionWrapper,status=_this$state.status;/* istanbul ignore else */if(_this.event==='click'||_this.event==='hover'&&positionWrapper){log({title:'click',data:[{event:event,status:status===STATUS.OPEN?'closing':'opening'}],debug:_this.debug});_this.toggle();}});_defineProperty(_assertThisInitialized(_this),\"handleMouseEnter\",function(){var _this$props2=_this.props,event=_this$props2.event,open=_this$props2.open;if(is[\"boolean\"](open)||isMobile())return;var status=_this.state.status;/* istanbul ignore else */if(_this.event==='hover'&&status===STATUS.IDLE){log({title:'mouseEnter',data:[{key:'originalEvent',value:event}],debug:_this.debug});clearTimeout(_this.eventDelayTimeout);_this.toggle();}});_defineProperty(_assertThisInitialized(_this),\"handleMouseLeave\",function(){var _this$props3=_this.props,event=_this$props3.event,eventDelay=_this$props3.eventDelay,open=_this$props3.open;if(is[\"boolean\"](open)||isMobile())return;var _this$state2=_this.state,status=_this$state2.status,positionWrapper=_this$state2.positionWrapper;/* istanbul ignore else */if(_this.event==='hover'){log({title:'mouseLeave',data:[{key:'originalEvent',value:event}],debug:_this.debug});if(!eventDelay){_this.toggle(STATUS.IDLE);}else if([STATUS.OPENING,STATUS.OPEN].indexOf(status)!==-1&&!positionWrapper&&!_this.eventDelayTimeout){_this.eventDelayTimeout=setTimeout(function(){delete _this.eventDelayTimeout;_this.toggle();},eventDelay*1000);}}});_this.state={currentPlacement:props.placement,needsUpdate:false,positionWrapper:props.wrapperOptions.position&&!!props.target,status:STATUS.INIT,statusWrapper:STATUS.INIT};_this._isMounted=false;_this.hasMounted=false;if(canUseDOM()){window.addEventListener('load',function(){if(_this.popper){_this.popper.instance.update();}if(_this.wrapperPopper){_this.wrapperPopper.instance.update();}});}return _this;}_createClass(ReactFloater,[{key:\"componentDidMount\",value:function componentDidMount(){if(!canUseDOM())return;var positionWrapper=this.state.positionWrapper;var _this$props5=this.props,children=_this$props5.children,open=_this$props5.open,target=_this$props5.target;this._isMounted=true;log({title:'init',data:{hasChildren:!!children,hasTarget:!!target,isControlled:is[\"boolean\"](open),positionWrapper:positionWrapper,target:this.target,floater:this.floaterRef},debug:this.debug});if(!this.hasMounted){this.initPopper();this.hasMounted=true;}if(!children&&target&&!is[\"boolean\"](open));}},{key:\"componentDidUpdate\",value:function componentDidUpdate(prevProps,prevState){if(!canUseDOM())return;var _this$props6=this.props,autoOpen=_this$props6.autoOpen,open=_this$props6.open,target=_this$props6.target,wrapperOptions=_this$props6.wrapperOptions;var _treeChanges=treeChanges(prevState,this.state),changedFrom=_treeChanges.changedFrom,changed=_treeChanges.changed;if(prevProps.open!==open){var forceStatus;// always follow `open` in controlled mode\nif(is[\"boolean\"](open)){forceStatus=open?STATUS.OPENING:STATUS.CLOSING;}this.toggle(forceStatus);}if(prevProps.wrapperOptions.position!==wrapperOptions.position||prevProps.target!==target){this.changeWrapperPosition(this.props);}if(changed('status',STATUS.IDLE)&&open){this.toggle(STATUS.OPEN);}else if(changedFrom('status',STATUS.INIT,STATUS.IDLE)&&autoOpen){this.toggle(STATUS.OPEN);}if(this.popper&&changed('status',STATUS.OPENING)){this.popper.instance.update();}if(this.floaterRef&&(changed('status',STATUS.OPENING)||changed('status',STATUS.CLOSING))){once(this.floaterRef,'transitionend',this.handleTransitionEnd);}if(changed('needsUpdate',true)){this.rebuildPopper();}}},{key:\"componentWillUnmount\",value:function componentWillUnmount(){if(!canUseDOM())return;this._isMounted=false;if(this.popper){this.popper.instance.destroy();}if(this.wrapperPopper){this.wrapperPopper.instance.destroy();}}},{key:\"initPopper\",value:function initPopper(){var _this2=this;var target=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.target;var positionWrapper=this.state.positionWrapper;var _this$props7=this.props,disableFlip=_this$props7.disableFlip,getPopper=_this$props7.getPopper,hideArrow=_this$props7.hideArrow,offset=_this$props7.offset,placement=_this$props7.placement,wrapperOptions=_this$props7.wrapperOptions;var flipBehavior=placement==='top'||placement==='bottom'?'flip':['right','bottom-end','top-end','left','top-start','bottom-start'];/* istanbul ignore else */if(placement==='center'){this.setState({status:STATUS.IDLE});}else if(target&&this.floaterRef){var _this$options=this.options,arrow=_this$options.arrow,flip=_this$options.flip,offsetOptions=_this$options.offset,rest=_objectWithoutProperties(_this$options,_excluded);new Popper(target,this.floaterRef,{placement:placement,modifiers:_objectSpread2({arrow:_objectSpread2({enabled:!hideArrow,element:this.arrowRef},arrow),flip:_objectSpread2({enabled:!disableFlip,behavior:flipBehavior},flip),offset:_objectSpread2({offset:\"0, \".concat(offset,\"px\")},offsetOptions)},rest),onCreate:function onCreate(data){var _this2$floaterRef;_this2.popper=data;if(!((_this2$floaterRef=_this2.floaterRef)!==null&&_this2$floaterRef!==void 0&&_this2$floaterRef.isConnected)){_this2.setState({needsUpdate:true});return;}getPopper(data,'floater');if(_this2._isMounted){_this2.setState({currentPlacement:data.placement,status:STATUS.IDLE});}if(placement!==data.placement){setTimeout(function(){data.instance.update();},1);}},onUpdate:function onUpdate(data){_this2.popper=data;var currentPlacement=_this2.state.currentPlacement;if(_this2._isMounted&&data.placement!==currentPlacement){_this2.setState({currentPlacement:data.placement});}}});}if(positionWrapper){var wrapperOffset=!is.undefined(wrapperOptions.offset)?wrapperOptions.offset:0;new Popper(this.target,this.wrapperRef,{placement:wrapperOptions.placement||placement,modifiers:{arrow:{enabled:false},offset:{offset:\"0, \".concat(wrapperOffset,\"px\")},flip:{enabled:false}},onCreate:function onCreate(data){_this2.wrapperPopper=data;if(_this2._isMounted){_this2.setState({statusWrapper:STATUS.IDLE});}getPopper(data,'wrapper');if(placement!==data.placement){setTimeout(function(){data.instance.update();},1);}}});}}},{key:\"rebuildPopper\",value:function rebuildPopper(){var _this3=this;this.floaterRefInterval=setInterval(function(){var _this3$floaterRef;if((_this3$floaterRef=_this3.floaterRef)!==null&&_this3$floaterRef!==void 0&&_this3$floaterRef.isConnected){clearInterval(_this3.floaterRefInterval);_this3.setState({needsUpdate:false});_this3.initPopper();}},50);}},{key:\"changeWrapperPosition\",value:function changeWrapperPosition(_ref){var target=_ref.target,wrapperOptions=_ref.wrapperOptions;this.setState({positionWrapper:wrapperOptions.position&&!!target});}},{key:\"toggle\",value:function toggle(forceStatus){var status=this.state.status;var nextStatus=status===STATUS.OPEN?STATUS.CLOSING:STATUS.OPENING;if(!is.undefined(forceStatus)){nextStatus=forceStatus;}this.setState({status:nextStatus});}},{key:\"debug\",get:function get(){var debug=this.props.debug;return debug||canUseDOM()&&'ReactFloaterDebug'in window&&!!window.ReactFloaterDebug;}},{key:\"event\",get:function get(){var _this$props8=this.props,disableHoverToClick=_this$props8.disableHoverToClick,event=_this$props8.event;if(event==='hover'&&isMobile()&&!disableHoverToClick){return 'click';}return event;}},{key:\"options\",get:function get(){var options=this.props.options;return deepmerge(DEFAULTS,options||{});}},{key:\"styles\",get:function get(){var _this4=this;var _this$state3=this.state,status=_this$state3.status,positionWrapper=_this$state3.positionWrapper,statusWrapper=_this$state3.statusWrapper;var styles=this.props.styles;var nextStyles=deepmerge(getStyles(styles),styles);if(positionWrapper){var wrapperStyles;if(!([STATUS.IDLE].indexOf(status)!==-1)||!([STATUS.IDLE].indexOf(statusWrapper)!==-1)){wrapperStyles=nextStyles.wrapperPosition;}else {wrapperStyles=this.wrapperPopper.styles;}nextStyles.wrapper=_objectSpread2(_objectSpread2({},nextStyles.wrapper),wrapperStyles);}/* istanbul ignore else */if(this.target){var targetStyles=window.getComputedStyle(this.target);/* istanbul ignore else */if(this.wrapperStyles){nextStyles.wrapper=_objectSpread2(_objectSpread2({},nextStyles.wrapper),this.wrapperStyles);}else if(!(['relative','static'].indexOf(targetStyles.position)!==-1)){this.wrapperStyles={};if(!positionWrapper){POSITIONING_PROPS.forEach(function(d){_this4.wrapperStyles[d]=targetStyles[d];});nextStyles.wrapper=_objectSpread2(_objectSpread2({},nextStyles.wrapper),this.wrapperStyles);this.target.style.position='relative';this.target.style.top='auto';this.target.style.right='auto';this.target.style.bottom='auto';this.target.style.left='auto';}}}return nextStyles;}},{key:\"target\",get:function get(){if(!canUseDOM())return null;var target=this.props.target;if(target){if(is.domElement(target)){return target;}return document.querySelector(target);}return this.childRef||this.wrapperRef;}},{key:\"render\",value:function render(){var _this$state4=this.state,currentPlacement=_this$state4.currentPlacement,positionWrapper=_this$state4.positionWrapper,status=_this$state4.status;var _this$props9=this.props,children=_this$props9.children,component=_this$props9.component,content=_this$props9.content,disableAnimation=_this$props9.disableAnimation,footer=_this$props9.footer,hideArrow=_this$props9.hideArrow,id=_this$props9.id,open=_this$props9.open,showCloseButton=_this$props9.showCloseButton,style=_this$props9.style,target=_this$props9.target,title=_this$props9.title;var wrapper=/*#__PURE__*/React.createElement(ReactFloaterWrapper,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:style,styles:this.styles.wrapper},children);var output={};if(positionWrapper){output.wrapperInPortal=wrapper;}else {output.wrapperAsChildren=wrapper;}return/*#__PURE__*/React.createElement(\"span\",null,/*#__PURE__*/React.createElement(ReactFloaterPortal,{hasChildren:!!children,id:id,placement:currentPlacement,setRef:this.setFloaterRef,target:target,zIndex:this.styles.options.zIndex},/*#__PURE__*/React.createElement(Floater,{component:component,content:content,disableAnimation:disableAnimation,footer:footer,handleClick:this.handleClick,hideArrow:hideArrow||currentPlacement==='center',open:open,placement:currentPlacement,positionWrapper:positionWrapper,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:showCloseButton,status:status,styles:this.styles,title:title}),output.wrapperInPortal),output.wrapperAsChildren);}}]);return ReactFloater;}(React.Component);_defineProperty(ReactFloater,\"propTypes\",{autoOpen:PropTypes.bool,callback:PropTypes.func,children:PropTypes.node,component:isRequiredIf(PropTypes.oneOfType([PropTypes.func,PropTypes.element]),function(props){return !props.content;}),content:isRequiredIf(PropTypes.node,function(props){return !props.component;}),debug:PropTypes.bool,disableAnimation:PropTypes.bool,disableFlip:PropTypes.bool,disableHoverToClick:PropTypes.bool,event:PropTypes.oneOf(['hover','click']),eventDelay:PropTypes.number,footer:PropTypes.node,getPopper:PropTypes.func,hideArrow:PropTypes.bool,id:PropTypes.oneOfType([PropTypes.string,PropTypes.number]),offset:PropTypes.number,open:PropTypes.bool,options:PropTypes.object,placement:PropTypes.oneOf(['top','top-start','top-end','bottom','bottom-start','bottom-end','left','left-start','left-end','right','right-start','right-end','auto','center']),showCloseButton:PropTypes.bool,style:PropTypes.object,styles:PropTypes.object,target:PropTypes.oneOfType([PropTypes.object,PropTypes.string]),title:PropTypes.node,wrapperOptions:PropTypes.shape({offset:PropTypes.number,placement:PropTypes.oneOf(['top','top-start','top-end','bottom','bottom-start','bottom-end','left','left-start','left-end','right','right-start','right-end','auto']),position:PropTypes.bool})});_defineProperty(ReactFloater,\"defaultProps\",{autoOpen:false,callback:noop,debug:false,disableAnimation:false,disableFlip:false,disableHoverToClick:false,event:'click',eventDelay:0.4,getPopper:noop,hideArrow:false,offset:15,placement:'bottom',showCloseButton:false,styles:{},target:null,wrapperOptions:{position:false}});\n\nexport { ReactFloater as default };\n","import equal from '@gilbarbara/deep-equal';\nimport is from 'is-lite';\nimport { compareNumbers, compareValues, getIterables, includesOrEqualsTo, nested } from './helpers';\nexport default function treeChanges(previousData, data) {\n if ([previousData, data].some(is.nullOrUndefined)) {\n throw new Error('Missing required parameters');\n }\n if (![previousData, data].every(function (d) { return is.plainObject(d) || is.array(d); })) {\n throw new Error('Expected plain objects or array');\n }\n var added = function (key, value) {\n try {\n return compareValues(previousData, data, { key: key, type: 'added', value: value });\n }\n catch (_a) {\n /* istanbul ignore next */\n return false;\n }\n };\n var changed = function (key, actual, previous) {\n try {\n var left = nested(previousData, key);\n var right = nested(data, key);\n var hasActual = is.defined(actual);\n var hasPrevious = is.defined(previous);\n if (hasActual || hasPrevious) {\n var leftComparator = hasPrevious\n ? includesOrEqualsTo(previous, left)\n : !includesOrEqualsTo(actual, left);\n var rightComparator = includesOrEqualsTo(actual, right);\n return leftComparator && rightComparator;\n }\n if ([left, right].every(is.array) || [left, right].every(is.plainObject)) {\n return !equal(left, right);\n }\n return left !== right;\n }\n catch (_a) {\n /* istanbul ignore next */\n return false;\n }\n };\n var changedFrom = function (key, previous, actual) {\n if (!is.defined(key)) {\n return false;\n }\n try {\n var left = nested(previousData, key);\n var right = nested(data, key);\n var hasActual = is.defined(actual);\n return (includesOrEqualsTo(previous, left) &&\n (hasActual ? includesOrEqualsTo(actual, right) : !hasActual));\n }\n catch (_a) {\n /* istanbul ignore next */\n return false;\n }\n };\n /**\n * @deprecated\n * Use \"changed\" instead\n */\n var changedTo = function (key, actual) {\n if (!is.defined(key)) {\n return false;\n }\n /* istanbul ignore next */\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('`changedTo` is deprecated! Replace it with `change`');\n }\n return changed(key, actual);\n };\n var decreased = function (key, actual, previous) {\n if (!is.defined(key)) {\n return false;\n }\n try {\n return compareNumbers(previousData, data, { key: key, actual: actual, previous: previous, type: 'decreased' });\n }\n catch (_a) {\n /* istanbul ignore next */\n return false;\n }\n };\n var emptied = function (key) {\n try {\n var _a = getIterables(previousData, data, { key: key }), left = _a[0], right = _a[1];\n return !!left.length && !right.length;\n }\n catch (_b) {\n /* istanbul ignore next */\n return false;\n }\n };\n var filled = function (key) {\n try {\n var _a = getIterables(previousData, data, { key: key }), left = _a[0], right = _a[1];\n return !left.length && !!right.length;\n }\n catch (_b) {\n /* istanbul ignore next */\n return false;\n }\n };\n var increased = function (key, actual, previous) {\n if (!is.defined(key)) {\n return false;\n }\n try {\n return compareNumbers(previousData, data, { key: key, actual: actual, previous: previous, type: 'increased' });\n }\n catch (_a) {\n /* istanbul ignore next */\n return false;\n }\n };\n var removed = function (key, value) {\n try {\n return compareValues(previousData, data, { key: key, type: 'removed', value: value });\n }\n catch (_a) {\n /* istanbul ignore next */\n return false;\n }\n };\n return { added: added, changed: changed, changedFrom: changedFrom, changedTo: changedTo, decreased: decreased, emptied: emptied, filled: filled, increased: increased, removed: removed };\n}\nexport * from './types';\n//# sourceMappingURL=index.js.map","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n\n// src/literals/index.ts\nvar ACTIONS = {\n INIT: \"init\",\n START: \"start\",\n STOP: \"stop\",\n RESET: \"reset\",\n PREV: \"prev\",\n NEXT: \"next\",\n GO: \"go\",\n CLOSE: \"close\",\n SKIP: \"skip\",\n UPDATE: \"update\"\n};\nvar EVENTS = {\n TOUR_START: \"tour:start\",\n STEP_BEFORE: \"step:before\",\n BEACON: \"beacon\",\n TOOLTIP: \"tooltip\",\n STEP_AFTER: \"step:after\",\n TOUR_END: \"tour:end\",\n TOUR_STATUS: \"tour:status\",\n TARGET_NOT_FOUND: \"error:target_not_found\",\n ERROR: \"error\"\n};\nvar LIFECYCLE = {\n INIT: \"init\",\n READY: \"ready\",\n BEACON: \"beacon\",\n TOOLTIP: \"tooltip\",\n COMPLETE: \"complete\",\n ERROR: \"error\"\n};\nvar ORIGIN = {\n BUTTON_CLOSE: \"button_close\",\n BUTTON_PRIMARY: \"button_primary\",\n KEYBOARD: \"keyboard\",\n OVERLAY: \"overlay\"\n};\nvar STATUS = {\n IDLE: \"idle\",\n READY: \"ready\",\n WAITING: \"waiting\",\n RUNNING: \"running\",\n PAUSED: \"paused\",\n SKIPPED: \"skipped\",\n FINISHED: \"finished\",\n ERROR: \"error\"\n};\n\n// src/components/index.tsx\nimport * as React9 from \"react\";\nimport isEqual from \"@gilbarbara/deep-equal\";\nimport is6 from \"is-lite\";\nimport treeChanges3 from \"tree-changes\";\n\n// src/modules/dom.ts\nimport scroll from \"scroll\";\nimport scrollParent from \"scrollparent\";\nfunction canUseDOM() {\n var _a;\n return !!(typeof window !== \"undefined\" && ((_a = window.document) == null ? void 0 : _a.createElement));\n}\nfunction getClientRect(element) {\n if (!element) {\n return null;\n }\n return element.getBoundingClientRect();\n}\nfunction getDocumentHeight(median = false) {\n const { body, documentElement } = document;\n if (!body || !documentElement) {\n return 0;\n }\n if (median) {\n const heights = [\n body.scrollHeight,\n body.offsetHeight,\n documentElement.clientHeight,\n documentElement.scrollHeight,\n documentElement.offsetHeight\n ].sort((a, b) => a - b);\n const middle = Math.floor(heights.length / 2);\n if (heights.length % 2 === 0) {\n return (heights[middle - 1] + heights[middle]) / 2;\n }\n return heights[middle];\n }\n return Math.max(\n body.scrollHeight,\n body.offsetHeight,\n documentElement.clientHeight,\n documentElement.scrollHeight,\n documentElement.offsetHeight\n );\n}\nfunction getElement(element) {\n if (typeof element === \"string\") {\n try {\n return document.querySelector(element);\n } catch (error) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(error);\n }\n return null;\n }\n }\n return element;\n}\nfunction getStyleComputedProperty(el) {\n if (!el || el.nodeType !== 1) {\n return null;\n }\n return getComputedStyle(el);\n}\nfunction getScrollParent(element, skipFix, forListener) {\n if (!element) {\n return scrollDocument();\n }\n const parent = scrollParent(element);\n if (parent) {\n if (parent.isSameNode(scrollDocument())) {\n if (forListener) {\n return document;\n }\n return scrollDocument();\n }\n const hasScrolling = parent.scrollHeight > parent.offsetHeight;\n if (!hasScrolling && !skipFix) {\n parent.style.overflow = \"initial\";\n return scrollDocument();\n }\n }\n return parent;\n}\nfunction hasCustomScrollParent(element, skipFix) {\n if (!element) {\n return false;\n }\n const parent = getScrollParent(element, skipFix);\n return parent ? !parent.isSameNode(scrollDocument()) : false;\n}\nfunction hasCustomOffsetParent(element) {\n return element.offsetParent !== document.body;\n}\nfunction hasPosition(el, type = \"fixed\") {\n if (!el || !(el instanceof HTMLElement)) {\n return false;\n }\n const { nodeName } = el;\n const styles = getStyleComputedProperty(el);\n if (nodeName === \"BODY\" || nodeName === \"HTML\") {\n return false;\n }\n if (styles && styles.position === type) {\n return true;\n }\n if (!el.parentNode) {\n return false;\n }\n return hasPosition(el.parentNode, type);\n}\nfunction isElementVisible(element) {\n var _a;\n if (!element) {\n return false;\n }\n let parentElement = element;\n while (parentElement) {\n if (parentElement === document.body) {\n break;\n }\n if (parentElement instanceof HTMLElement) {\n const { display, visibility } = getComputedStyle(parentElement);\n if (display === \"none\" || visibility === \"hidden\") {\n return false;\n }\n }\n parentElement = (_a = parentElement.parentElement) != null ? _a : null;\n }\n return true;\n}\nfunction getElementPosition(element, offset, skipFix) {\n var _a, _b, _c;\n const elementRect = getClientRect(element);\n const parent = getScrollParent(element, skipFix);\n const hasScrollParent = hasCustomScrollParent(element, skipFix);\n const isFixedTarget = hasPosition(element);\n let parentTop = 0;\n let top = (_a = elementRect == null ? void 0 : elementRect.top) != null ? _a : 0;\n if (hasScrollParent && isFixedTarget) {\n const offsetTop = (_b = element == null ? void 0 : element.offsetTop) != null ? _b : 0;\n const parentScrollTop = (_c = parent == null ? void 0 : parent.scrollTop) != null ? _c : 0;\n top = offsetTop - parentScrollTop;\n } else if (parent instanceof HTMLElement) {\n parentTop = parent.scrollTop;\n if (!hasScrollParent && !hasPosition(element)) {\n top += parentTop;\n }\n if (!parent.isSameNode(scrollDocument())) {\n top += scrollDocument().scrollTop;\n }\n }\n return Math.floor(top - offset);\n}\nfunction getScrollTo(element, offset, skipFix) {\n var _a;\n if (!element) {\n return 0;\n }\n const { offsetTop = 0, scrollTop = 0 } = (_a = scrollParent(element)) != null ? _a : {};\n let top = element.getBoundingClientRect().top + scrollTop;\n if (!!offsetTop && (hasCustomScrollParent(element, skipFix) || hasCustomOffsetParent(element))) {\n top -= offsetTop;\n }\n const output = Math.floor(top - offset);\n return output < 0 ? 0 : output;\n}\nfunction scrollDocument() {\n var _a;\n return (_a = document.scrollingElement) != null ? _a : document.documentElement;\n}\nfunction scrollTo(value, options) {\n const { duration, element } = options;\n return new Promise((resolve, reject) => {\n const { scrollTop } = element;\n const limit = value > scrollTop ? value - scrollTop : scrollTop - value;\n scroll.top(element, value, { duration: limit < 100 ? 50 : duration }, (error) => {\n if (error && error.message !== \"Element already at target scroll position\") {\n return reject(error);\n }\n return resolve();\n });\n });\n}\n\n// src/modules/helpers.tsx\nimport { cloneElement, isValidElement } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport innerText from \"react-innertext\";\nimport is from \"is-lite\";\nvar isReact16 = createPortal !== void 0;\nfunction getBrowser(userAgent = navigator.userAgent) {\n let browser = userAgent;\n if (typeof window === \"undefined\") {\n browser = \"node\";\n } else if (document.documentMode) {\n browser = \"ie\";\n } else if (/Edge/.test(userAgent)) {\n browser = \"edge\";\n } else if (Boolean(window.opera) || userAgent.includes(\" OPR/\")) {\n browser = \"opera\";\n } else if (typeof window.InstallTrigger !== \"undefined\") {\n browser = \"firefox\";\n } else if (window.chrome) {\n browser = \"chrome\";\n } else if (/(Version\\/([\\d._]+).*Safari|CriOS|FxiOS| Mobile\\/)/.test(userAgent)) {\n browser = \"safari\";\n }\n return browser;\n}\nfunction getObjectType(value) {\n return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();\n}\nfunction getReactNodeText(input, options = {}) {\n const { defaultValue, step, steps } = options;\n let text = innerText(input);\n if (!text) {\n if (isValidElement(input) && !Object.values(input.props).length && getObjectType(input.type) === \"function\") {\n const component = input.type({});\n text = getReactNodeText(component, options);\n } else {\n text = innerText(defaultValue);\n }\n } else if ((text.includes(\"{step}\") || text.includes(\"{steps}\")) && step && steps) {\n text = text.replace(\"{step}\", step.toString()).replace(\"{steps}\", steps.toString());\n }\n return text;\n}\nfunction hasValidKeys(object, keys) {\n if (!is.plainObject(object) || !is.array(keys)) {\n return false;\n }\n return Object.keys(object).every((d) => keys.includes(d));\n}\nfunction hexToRGB(hex) {\n const shorthandRegex = /^#?([\\da-f])([\\da-f])([\\da-f])$/i;\n const properHex = hex.replace(shorthandRegex, (_m, r, g, b) => r + r + g + g + b + b);\n const result = /^#?([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i.exec(properHex);\n return result ? [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)] : [];\n}\nfunction hideBeacon(step) {\n return step.disableBeacon || step.placement === \"center\";\n}\nfunction isLegacy() {\n return ![\"chrome\", \"safari\", \"firefox\", \"opera\"].includes(getBrowser());\n}\nfunction log({ data, debug = false, title, warn = false }) {\n const logFn = warn ? console.warn || console.error : console.log;\n if (debug) {\n if (title && data) {\n console.groupCollapsed(\n `%creact-joyride: ${title}`,\n \"color: #ff0044; font-weight: bold; font-size: 12px;\"\n );\n if (Array.isArray(data)) {\n data.forEach((d) => {\n if (is.plainObject(d) && d.key) {\n logFn.apply(console, [d.key, d.value]);\n } else {\n logFn.apply(console, [d]);\n }\n });\n } else {\n logFn.apply(console, [data]);\n }\n console.groupEnd();\n } else {\n console.error(\"Missing title or data props\");\n }\n }\n}\nfunction noop() {\n return void 0;\n}\nfunction objectKeys(input) {\n return Object.keys(input);\n}\nfunction omit(input, ...filter) {\n if (!is.plainObject(input)) {\n throw new TypeError(\"Expected an object\");\n }\n const output = {};\n for (const key in input) {\n if ({}.hasOwnProperty.call(input, key)) {\n if (!filter.includes(key)) {\n output[key] = input[key];\n }\n }\n }\n return output;\n}\nfunction pick(input, ...filter) {\n if (!is.plainObject(input)) {\n throw new TypeError(\"Expected an object\");\n }\n if (!filter.length) {\n return input;\n }\n const output = {};\n for (const key in input) {\n if ({}.hasOwnProperty.call(input, key)) {\n if (filter.includes(key)) {\n output[key] = input[key];\n }\n }\n }\n return output;\n}\nfunction replaceLocaleContent(input, step, steps) {\n const replacer = (text) => text.replace(\"{step}\", String(step)).replace(\"{steps}\", String(steps));\n if (getObjectType(input) === \"string\") {\n return replacer(input);\n }\n if (!isValidElement(input)) {\n return input;\n }\n const { children } = input.props;\n if (getObjectType(children) === \"string\" && children.includes(\"{step}\")) {\n return cloneElement(input, {\n children: replacer(children)\n });\n }\n if (Array.isArray(children)) {\n return cloneElement(input, {\n children: children.map((child) => {\n if (typeof child === \"string\") {\n return replacer(child);\n }\n return replaceLocaleContent(child, step, steps);\n })\n });\n }\n if (getObjectType(input.type) === \"function\" && !Object.values(input.props).length) {\n const component = input.type({});\n return replaceLocaleContent(component, step, steps);\n }\n return input;\n}\nfunction shouldScroll(options) {\n const { isFirstStep, lifecycle, previousLifecycle, scrollToFirstStep, step, target } = options;\n return !step.disableScrolling && (!isFirstStep || scrollToFirstStep || lifecycle === LIFECYCLE.TOOLTIP) && step.placement !== \"center\" && (!step.isFixed || !hasPosition(target)) && // fixed steps don't need to scroll\n previousLifecycle !== lifecycle && [LIFECYCLE.BEACON, LIFECYCLE.TOOLTIP].includes(lifecycle);\n}\n\n// src/modules/step.ts\nimport deepmerge2 from \"deepmerge\";\nimport is2 from \"is-lite\";\n\n// src/defaults.ts\nvar defaultFloaterProps = {\n options: {\n preventOverflow: {\n boundariesElement: \"scrollParent\"\n }\n },\n wrapperOptions: {\n offset: -18,\n position: true\n }\n};\nvar defaultLocale = {\n back: \"Back\",\n close: \"Close\",\n last: \"Last\",\n next: \"Next\",\n nextLabelWithProgress: \"Next (Step {step} of {steps})\",\n open: \"Open the dialog\",\n skip: \"Skip\"\n};\nvar defaultStep = {\n event: \"click\",\n placement: \"bottom\",\n offset: 10,\n disableBeacon: false,\n disableCloseOnEsc: false,\n disableOverlay: false,\n disableOverlayClose: false,\n disableScrollParentFix: false,\n disableScrolling: false,\n hideBackButton: false,\n hideCloseButton: false,\n hideFooter: false,\n isFixed: false,\n locale: defaultLocale,\n showProgress: false,\n showSkipButton: false,\n spotlightClicks: false,\n spotlightPadding: 10\n};\nvar defaultProps = {\n continuous: false,\n debug: false,\n disableCloseOnEsc: false,\n disableOverlay: false,\n disableOverlayClose: false,\n disableScrolling: false,\n disableScrollParentFix: false,\n getHelpers: noop(),\n hideBackButton: false,\n run: true,\n scrollOffset: 20,\n scrollDuration: 300,\n scrollToFirstStep: false,\n showSkipButton: false,\n showProgress: false,\n spotlightClicks: false,\n spotlightPadding: 10,\n steps: []\n};\n\n// src/styles.ts\nimport deepmerge from \"deepmerge\";\nvar defaultOptions = {\n arrowColor: \"#fff\",\n backgroundColor: \"#fff\",\n beaconSize: 36,\n overlayColor: \"rgba(0, 0, 0, 0.5)\",\n primaryColor: \"#f04\",\n spotlightShadow: \"0 0 15px rgba(0, 0, 0, 0.5)\",\n textColor: \"#333\",\n width: 380,\n zIndex: 100\n};\nvar buttonBase = {\n backgroundColor: \"transparent\",\n border: 0,\n borderRadius: 0,\n color: \"#555\",\n cursor: \"pointer\",\n fontSize: 16,\n lineHeight: 1,\n padding: 8,\n WebkitAppearance: \"none\"\n};\nvar spotlight = {\n borderRadius: 4,\n position: \"absolute\"\n};\nfunction getStyles(props, step) {\n var _a, _b, _c, _d, _e;\n const { floaterProps, styles } = props;\n const mergedFloaterProps = deepmerge((_a = step.floaterProps) != null ? _a : {}, floaterProps != null ? floaterProps : {});\n const mergedStyles = deepmerge(styles != null ? styles : {}, (_b = step.styles) != null ? _b : {});\n const options = deepmerge(defaultOptions, mergedStyles.options || {});\n const hideBeacon2 = step.placement === \"center\" || step.disableBeacon;\n let { width } = options;\n if (window.innerWidth > 480) {\n width = 380;\n }\n if (\"width\" in options) {\n width = typeof options.width === \"number\" && window.innerWidth < options.width ? window.innerWidth - 30 : options.width;\n }\n const overlay = {\n bottom: 0,\n left: 0,\n overflow: \"hidden\",\n position: \"absolute\",\n right: 0,\n top: 0,\n zIndex: options.zIndex\n };\n const defaultStyles = {\n beacon: {\n ...buttonBase,\n display: hideBeacon2 ? \"none\" : \"inline-block\",\n height: options.beaconSize,\n position: \"relative\",\n width: options.beaconSize,\n zIndex: options.zIndex\n },\n beaconInner: {\n animation: \"joyride-beacon-inner 1.2s infinite ease-in-out\",\n backgroundColor: options.primaryColor,\n borderRadius: \"50%\",\n display: \"block\",\n height: \"50%\",\n left: \"50%\",\n opacity: 0.7,\n position: \"absolute\",\n top: \"50%\",\n transform: \"translate(-50%, -50%)\",\n width: \"50%\"\n },\n beaconOuter: {\n animation: \"joyride-beacon-outer 1.2s infinite ease-in-out\",\n backgroundColor: `rgba(${hexToRGB(options.primaryColor).join(\",\")}, 0.2)`,\n border: `2px solid ${options.primaryColor}`,\n borderRadius: \"50%\",\n boxSizing: \"border-box\",\n display: \"block\",\n height: \"100%\",\n left: 0,\n opacity: 0.9,\n position: \"absolute\",\n top: 0,\n transformOrigin: \"center\",\n width: \"100%\"\n },\n tooltip: {\n backgroundColor: options.backgroundColor,\n borderRadius: 5,\n boxSizing: \"border-box\",\n color: options.textColor,\n fontSize: 16,\n maxWidth: \"100%\",\n padding: 15,\n position: \"relative\",\n width\n },\n tooltipContainer: {\n lineHeight: 1.4,\n textAlign: \"center\"\n },\n tooltipTitle: {\n fontSize: 18,\n margin: 0\n },\n tooltipContent: {\n padding: \"20px 10px\"\n },\n tooltipFooter: {\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"flex-end\",\n marginTop: 15\n },\n tooltipFooterSpacer: {\n flex: 1\n },\n buttonNext: {\n ...buttonBase,\n backgroundColor: options.primaryColor,\n borderRadius: 4,\n color: \"#fff\"\n },\n buttonBack: {\n ...buttonBase,\n color: options.primaryColor,\n marginLeft: \"auto\",\n marginRight: 5\n },\n buttonClose: {\n ...buttonBase,\n color: options.textColor,\n height: 14,\n padding: 15,\n position: \"absolute\",\n right: 0,\n top: 0,\n width: 14\n },\n buttonSkip: {\n ...buttonBase,\n color: options.textColor,\n fontSize: 14\n },\n overlay: {\n ...overlay,\n backgroundColor: options.overlayColor,\n mixBlendMode: \"hard-light\"\n },\n overlayLegacy: {\n ...overlay\n },\n overlayLegacyCenter: {\n ...overlay,\n backgroundColor: options.overlayColor\n },\n spotlight: {\n ...spotlight,\n backgroundColor: \"gray\"\n },\n spotlightLegacy: {\n ...spotlight,\n boxShadow: `0 0 0 9999px ${options.overlayColor}, ${options.spotlightShadow}`\n },\n floaterStyles: {\n arrow: {\n color: (_e = (_d = (_c = mergedFloaterProps == null ? void 0 : mergedFloaterProps.styles) == null ? void 0 : _c.arrow) == null ? void 0 : _d.color) != null ? _e : options.arrowColor\n },\n options: {\n zIndex: options.zIndex + 100\n }\n },\n options\n };\n return deepmerge(defaultStyles, mergedStyles);\n}\n\n// src/modules/step.ts\nfunction getTourProps(props) {\n return pick(\n props,\n \"beaconComponent\",\n \"disableCloseOnEsc\",\n \"disableOverlay\",\n \"disableOverlayClose\",\n \"disableScrolling\",\n \"disableScrollParentFix\",\n \"floaterProps\",\n \"hideBackButton\",\n \"hideCloseButton\",\n \"locale\",\n \"showProgress\",\n \"showSkipButton\",\n \"spotlightClicks\",\n \"spotlightPadding\",\n \"styles\",\n \"tooltipComponent\"\n );\n}\nfunction getMergedStep(props, currentStep) {\n var _a, _b, _c, _d, _e, _f;\n const step = currentStep != null ? currentStep : {};\n const mergedStep = deepmerge2.all([defaultStep, getTourProps(props), step], {\n isMergeableObject: is2.plainObject\n });\n const mergedStyles = getStyles(props, mergedStep);\n const scrollParent2 = hasCustomScrollParent(\n getElement(mergedStep.target),\n mergedStep.disableScrollParentFix\n );\n const floaterProps = deepmerge2.all([\n defaultFloaterProps,\n (_a = props.floaterProps) != null ? _a : {},\n (_b = mergedStep.floaterProps) != null ? _b : {}\n ]);\n floaterProps.offset = mergedStep.offset;\n floaterProps.styles = deepmerge2((_c = floaterProps.styles) != null ? _c : {}, mergedStyles.floaterStyles);\n floaterProps.offset += (_e = (_d = props.spotlightPadding) != null ? _d : mergedStep.spotlightPadding) != null ? _e : 0;\n if (mergedStep.placementBeacon && floaterProps.wrapperOptions) {\n floaterProps.wrapperOptions.placement = mergedStep.placementBeacon;\n }\n if (scrollParent2 && floaterProps.options.preventOverflow) {\n floaterProps.options.preventOverflow.boundariesElement = \"window\";\n }\n return {\n ...mergedStep,\n locale: deepmerge2.all([defaultLocale, (_f = props.locale) != null ? _f : {}, mergedStep.locale || {}]),\n floaterProps,\n styles: omit(mergedStyles, \"floaterStyles\")\n };\n}\nfunction validateStep(step, debug = false) {\n if (!is2.plainObject(step)) {\n log({\n title: \"validateStep\",\n data: \"step must be an object\",\n warn: true,\n debug\n });\n return false;\n }\n if (!step.target) {\n log({\n title: \"validateStep\",\n data: \"target is missing from the step\",\n warn: true,\n debug\n });\n return false;\n }\n return true;\n}\nfunction validateSteps(steps, debug = false) {\n if (!is2.array(steps)) {\n log({\n title: \"validateSteps\",\n data: \"steps must be an array\",\n warn: true,\n debug\n });\n return false;\n }\n return steps.every((d) => validateStep(d, debug));\n}\n\n// src/modules/store.ts\nimport is3 from \"is-lite\";\nvar defaultState = {\n action: \"init\",\n controlled: false,\n index: 0,\n lifecycle: LIFECYCLE.INIT,\n origin: null,\n size: 0,\n status: STATUS.IDLE\n};\nvar validKeys = objectKeys(omit(defaultState, \"controlled\", \"size\"));\nvar Store = class {\n constructor(options) {\n __publicField(this, \"beaconPopper\");\n __publicField(this, \"tooltipPopper\");\n __publicField(this, \"data\", /* @__PURE__ */ new Map());\n __publicField(this, \"listener\");\n __publicField(this, \"store\", /* @__PURE__ */ new Map());\n __publicField(this, \"addListener\", (listener) => {\n this.listener = listener;\n });\n __publicField(this, \"setSteps\", (steps) => {\n const { size, status } = this.getState();\n const state = {\n size: steps.length,\n status\n };\n this.data.set(\"steps\", steps);\n if (status === STATUS.WAITING && !size && steps.length) {\n state.status = STATUS.RUNNING;\n }\n this.setState(state);\n });\n __publicField(this, \"getPopper\", (name) => {\n if (name === \"beacon\") {\n return this.beaconPopper;\n }\n return this.tooltipPopper;\n });\n __publicField(this, \"setPopper\", (name, popper) => {\n if (name === \"beacon\") {\n this.beaconPopper = popper;\n } else {\n this.tooltipPopper = popper;\n }\n });\n __publicField(this, \"cleanupPoppers\", () => {\n this.beaconPopper = null;\n this.tooltipPopper = null;\n });\n __publicField(this, \"close\", (origin = null) => {\n const { index, status } = this.getState();\n if (status !== STATUS.RUNNING) {\n return;\n }\n this.setState({\n ...this.getNextState({ action: ACTIONS.CLOSE, index: index + 1, origin })\n });\n });\n __publicField(this, \"go\", (nextIndex) => {\n const { controlled, status } = this.getState();\n if (controlled || status !== STATUS.RUNNING) {\n return;\n }\n const step = this.getSteps()[nextIndex];\n this.setState({\n ...this.getNextState({ action: ACTIONS.GO, index: nextIndex }),\n status: step ? status : STATUS.FINISHED\n });\n });\n __publicField(this, \"info\", () => this.getState());\n __publicField(this, \"next\", () => {\n const { index, status } = this.getState();\n if (status !== STATUS.RUNNING) {\n return;\n }\n this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index + 1 }));\n });\n __publicField(this, \"open\", () => {\n const { status } = this.getState();\n if (status !== STATUS.RUNNING) {\n return;\n }\n this.setState({\n ...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP })\n });\n });\n __publicField(this, \"prev\", () => {\n const { index, status } = this.getState();\n if (status !== STATUS.RUNNING) {\n return;\n }\n this.setState({\n ...this.getNextState({ action: ACTIONS.PREV, index: index - 1 })\n });\n });\n __publicField(this, \"reset\", (restart = false) => {\n const { controlled } = this.getState();\n if (controlled) {\n return;\n }\n this.setState({\n ...this.getNextState({ action: ACTIONS.RESET, index: 0 }),\n status: restart ? STATUS.RUNNING : STATUS.READY\n });\n });\n __publicField(this, \"skip\", () => {\n const { status } = this.getState();\n if (status !== STATUS.RUNNING) {\n return;\n }\n this.setState({\n action: ACTIONS.SKIP,\n lifecycle: LIFECYCLE.INIT,\n status: STATUS.SKIPPED\n });\n });\n __publicField(this, \"start\", (nextIndex) => {\n const { index, size } = this.getState();\n this.setState({\n ...this.getNextState(\n {\n action: ACTIONS.START,\n index: is3.number(nextIndex) ? nextIndex : index\n },\n true\n ),\n status: size ? STATUS.RUNNING : STATUS.WAITING\n });\n });\n __publicField(this, \"stop\", (advance = false) => {\n const { index, status } = this.getState();\n if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {\n return;\n }\n this.setState({\n ...this.getNextState({ action: ACTIONS.STOP, index: index + (advance ? 1 : 0) }),\n status: STATUS.PAUSED\n });\n });\n __publicField(this, \"update\", (state) => {\n var _a, _b;\n if (!hasValidKeys(state, validKeys)) {\n throw new Error(`State is not valid. Valid keys: ${validKeys.join(\", \")}`);\n }\n this.setState({\n ...this.getNextState(\n {\n ...this.getState(),\n ...state,\n action: (_a = state.action) != null ? _a : ACTIONS.UPDATE,\n origin: (_b = state.origin) != null ? _b : null\n },\n true\n )\n });\n });\n const { continuous = false, stepIndex, steps = [] } = options != null ? options : {};\n this.setState(\n {\n action: ACTIONS.INIT,\n controlled: is3.number(stepIndex),\n continuous,\n index: is3.number(stepIndex) ? stepIndex : 0,\n lifecycle: LIFECYCLE.INIT,\n origin: null,\n status: steps.length ? STATUS.READY : STATUS.IDLE\n },\n true\n );\n this.beaconPopper = null;\n this.tooltipPopper = null;\n this.listener = null;\n this.setSteps(steps);\n }\n getState() {\n if (!this.store.size) {\n return { ...defaultState };\n }\n return {\n action: this.store.get(\"action\") || \"\",\n controlled: this.store.get(\"controlled\") || false,\n index: parseInt(this.store.get(\"index\"), 10),\n lifecycle: this.store.get(\"lifecycle\") || \"\",\n origin: this.store.get(\"origin\") || null,\n size: this.store.get(\"size\") || 0,\n status: this.store.get(\"status\") || \"\"\n };\n }\n getNextState(state, force = false) {\n var _a, _b, _c, _d, _e;\n const { action, controlled, index, size, status } = this.getState();\n const newIndex = is3.number(state.index) ? state.index : index;\n const nextIndex = controlled && !force ? index : Math.min(Math.max(newIndex, 0), size);\n return {\n action: (_a = state.action) != null ? _a : action,\n controlled,\n index: nextIndex,\n lifecycle: (_b = state.lifecycle) != null ? _b : LIFECYCLE.INIT,\n origin: (_c = state.origin) != null ? _c : null,\n size: (_d = state.size) != null ? _d : size,\n status: nextIndex === size ? STATUS.FINISHED : (_e = state.status) != null ? _e : status\n };\n }\n getSteps() {\n const steps = this.data.get(\"steps\");\n return Array.isArray(steps) ? steps : [];\n }\n hasUpdatedState(oldState) {\n const before = JSON.stringify(oldState);\n const after = JSON.stringify(this.getState());\n return before !== after;\n }\n setState(nextState, initial = false) {\n const state = this.getState();\n const {\n action,\n index,\n lifecycle,\n origin = null,\n size,\n status\n } = {\n ...state,\n ...nextState\n };\n this.store.set(\"action\", action);\n this.store.set(\"index\", index);\n this.store.set(\"lifecycle\", lifecycle);\n this.store.set(\"origin\", origin);\n this.store.set(\"size\", size);\n this.store.set(\"status\", status);\n if (initial) {\n this.store.set(\"controlled\", nextState.controlled);\n this.store.set(\"continuous\", nextState.continuous);\n }\n if (this.listener && this.hasUpdatedState(state)) {\n this.listener(this.getState());\n }\n }\n getHelpers() {\n return {\n close: this.close,\n go: this.go,\n info: this.info,\n next: this.next,\n open: this.open,\n prev: this.prev,\n reset: this.reset,\n skip: this.skip\n };\n }\n};\nfunction createStore(options) {\n return new Store(options);\n}\n\n// src/components/Overlay.tsx\nimport * as React2 from \"react\";\nimport treeChanges from \"tree-changes\";\n\n// src/components/Spotlight.tsx\nimport * as React from \"react\";\nfunction JoyrideSpotlight({ styles }) {\n return /* @__PURE__ */ React.createElement(\n \"div\",\n {\n key: \"JoyrideSpotlight\",\n className: \"react-joyride__spotlight\",\n \"data-test-id\": \"spotlight\",\n style: styles\n }\n );\n}\nvar Spotlight_default = JoyrideSpotlight;\n\n// src/components/Overlay.tsx\nvar JoyrideOverlay = class extends React2.Component {\n constructor() {\n super(...arguments);\n __publicField(this, \"isActive\", false);\n __publicField(this, \"resizeTimeout\");\n __publicField(this, \"scrollTimeout\");\n __publicField(this, \"scrollParent\");\n __publicField(this, \"state\", {\n isScrolling: false,\n mouseOverSpotlight: false,\n showSpotlight: true\n });\n __publicField(this, \"hideSpotlight\", () => {\n const { continuous, disableOverlay, lifecycle } = this.props;\n const hiddenLifecycles = [\n LIFECYCLE.INIT,\n LIFECYCLE.BEACON,\n LIFECYCLE.COMPLETE,\n LIFECYCLE.ERROR\n ];\n return disableOverlay || (continuous ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP);\n });\n __publicField(this, \"handleMouseMove\", (event) => {\n const { mouseOverSpotlight } = this.state;\n const { height, left, position, top, width } = this.spotlightStyles;\n const offsetY = position === \"fixed\" ? event.clientY : event.pageY;\n const offsetX = position === \"fixed\" ? event.clientX : event.pageX;\n const inSpotlightHeight = offsetY >= top && offsetY <= top + height;\n const inSpotlightWidth = offsetX >= left && offsetX <= left + width;\n const inSpotlight = inSpotlightWidth && inSpotlightHeight;\n if (inSpotlight !== mouseOverSpotlight) {\n this.updateState({ mouseOverSpotlight: inSpotlight });\n }\n });\n __publicField(this, \"handleScroll\", () => {\n const { target } = this.props;\n const element = getElement(target);\n if (this.scrollParent !== document) {\n const { isScrolling } = this.state;\n if (!isScrolling) {\n this.updateState({ isScrolling: true, showSpotlight: false });\n }\n clearTimeout(this.scrollTimeout);\n this.scrollTimeout = window.setTimeout(() => {\n this.updateState({ isScrolling: false, showSpotlight: true });\n }, 50);\n } else if (hasPosition(element, \"sticky\")) {\n this.updateState({});\n }\n });\n __publicField(this, \"handleResize\", () => {\n clearTimeout(this.resizeTimeout);\n this.resizeTimeout = window.setTimeout(() => {\n if (!this.isActive) {\n return;\n }\n this.forceUpdate();\n }, 100);\n });\n }\n componentDidMount() {\n const { debug, disableScrolling, disableScrollParentFix = false, target } = this.props;\n const element = getElement(target);\n this.scrollParent = getScrollParent(element != null ? element : document.body, disableScrollParentFix, true);\n this.isActive = true;\n if (process.env.NODE_ENV !== \"production\") {\n if (!disableScrolling && hasCustomScrollParent(element, true)) {\n log({\n title: \"step has a custom scroll parent and can cause trouble with scrolling\",\n data: [{ key: \"parent\", value: this.scrollParent }],\n debug\n });\n }\n }\n window.addEventListener(\"resize\", this.handleResize);\n }\n componentDidUpdate(previousProps) {\n var _a;\n const { disableScrollParentFix, lifecycle, spotlightClicks, target } = this.props;\n const { changed } = treeChanges(previousProps, this.props);\n if (changed(\"target\") || changed(\"disableScrollParentFix\")) {\n const element = getElement(target);\n this.scrollParent = getScrollParent(element != null ? element : document.body, disableScrollParentFix, true);\n }\n if (changed(\"lifecycle\", LIFECYCLE.TOOLTIP)) {\n (_a = this.scrollParent) == null ? void 0 : _a.addEventListener(\"scroll\", this.handleScroll, { passive: true });\n setTimeout(() => {\n const { isScrolling } = this.state;\n if (!isScrolling) {\n this.updateState({ showSpotlight: true });\n }\n }, 100);\n }\n if (changed(\"spotlightClicks\") || changed(\"disableOverlay\") || changed(\"lifecycle\")) {\n if (spotlightClicks && lifecycle === LIFECYCLE.TOOLTIP) {\n window.addEventListener(\"mousemove\", this.handleMouseMove, false);\n } else if (lifecycle !== LIFECYCLE.TOOLTIP) {\n window.removeEventListener(\"mousemove\", this.handleMouseMove);\n }\n }\n }\n componentWillUnmount() {\n var _a;\n this.isActive = false;\n window.removeEventListener(\"mousemove\", this.handleMouseMove);\n window.removeEventListener(\"resize\", this.handleResize);\n clearTimeout(this.resizeTimeout);\n clearTimeout(this.scrollTimeout);\n (_a = this.scrollParent) == null ? void 0 : _a.removeEventListener(\"scroll\", this.handleScroll);\n }\n get overlayStyles() {\n const { mouseOverSpotlight } = this.state;\n const { disableOverlayClose, placement, styles } = this.props;\n let baseStyles = styles.overlay;\n if (isLegacy()) {\n baseStyles = placement === \"center\" ? styles.overlayLegacyCenter : styles.overlayLegacy;\n }\n return {\n cursor: disableOverlayClose ? \"default\" : \"pointer\",\n height: getDocumentHeight(),\n pointerEvents: mouseOverSpotlight ? \"none\" : \"auto\",\n ...baseStyles\n };\n }\n get spotlightStyles() {\n var _a, _b, _c;\n const { showSpotlight } = this.state;\n const {\n disableScrollParentFix = false,\n spotlightClicks,\n spotlightPadding = 0,\n styles,\n target\n } = this.props;\n const element = getElement(target);\n const elementRect = getClientRect(element);\n const isFixedTarget = hasPosition(element);\n const top = getElementPosition(element, spotlightPadding, disableScrollParentFix);\n return {\n ...isLegacy() ? styles.spotlightLegacy : styles.spotlight,\n height: Math.round(((_a = elementRect == null ? void 0 : elementRect.height) != null ? _a : 0) + spotlightPadding * 2),\n left: Math.round(((_b = elementRect == null ? void 0 : elementRect.left) != null ? _b : 0) - spotlightPadding),\n opacity: showSpotlight ? 1 : 0,\n pointerEvents: spotlightClicks ? \"none\" : \"auto\",\n position: isFixedTarget ? \"fixed\" : \"absolute\",\n top,\n transition: \"opacity 0.2s\",\n width: Math.round(((_c = elementRect == null ? void 0 : elementRect.width) != null ? _c : 0) + spotlightPadding * 2)\n };\n }\n updateState(state) {\n if (!this.isActive) {\n return;\n }\n this.setState((previousState) => ({ ...previousState, ...state }));\n }\n render() {\n const { showSpotlight } = this.state;\n const { onClickOverlay, placement } = this.props;\n const { hideSpotlight, overlayStyles, spotlightStyles } = this;\n if (hideSpotlight()) {\n return null;\n }\n let spotlight2 = placement !== \"center\" && showSpotlight && /* @__PURE__ */ React2.createElement(Spotlight_default, { styles: spotlightStyles });\n if (getBrowser() === \"safari\") {\n const { mixBlendMode, zIndex, ...safariOverlay } = overlayStyles;\n spotlight2 = /* @__PURE__ */ React2.createElement(\"div\", { style: { ...safariOverlay } }, spotlight2);\n delete overlayStyles.backgroundColor;\n }\n return /* @__PURE__ */ React2.createElement(\n \"div\",\n {\n className: \"react-joyride__overlay\",\n \"data-test-id\": \"overlay\",\n onClick: onClickOverlay,\n role: \"presentation\",\n style: overlayStyles\n },\n spotlight2\n );\n }\n};\n\n// src/components/Portal.tsx\nimport * as React3 from \"react\";\nimport * as ReactDOM from \"react-dom\";\nvar JoyridePortal = class extends React3.Component {\n constructor() {\n super(...arguments);\n __publicField(this, \"node\", null);\n }\n componentDidMount() {\n const { id } = this.props;\n if (!canUseDOM()) {\n return;\n }\n this.node = document.createElement(\"div\");\n this.node.id = id;\n document.body.appendChild(this.node);\n if (!isReact16) {\n this.renderReact15();\n }\n }\n componentDidUpdate() {\n if (!canUseDOM()) {\n return;\n }\n if (!isReact16) {\n this.renderReact15();\n }\n }\n componentWillUnmount() {\n if (!canUseDOM() || !this.node) {\n return;\n }\n if (!isReact16) {\n ReactDOM.unmountComponentAtNode(this.node);\n }\n if (this.node.parentNode === document.body) {\n document.body.removeChild(this.node);\n this.node = null;\n }\n }\n renderReact15() {\n if (!canUseDOM()) {\n return;\n }\n const { children } = this.props;\n if (this.node) {\n ReactDOM.unstable_renderSubtreeIntoContainer(this, children, this.node);\n }\n }\n renderReact16() {\n if (!canUseDOM() || !isReact16) {\n return null;\n }\n const { children } = this.props;\n if (!this.node) {\n return null;\n }\n return ReactDOM.createPortal(children, this.node);\n }\n render() {\n if (!isReact16) {\n return null;\n }\n return this.renderReact16();\n }\n};\n\n// src/components/Step.tsx\nimport * as React8 from \"react\";\nimport Floater from \"react-floater\";\nimport is5 from \"is-lite\";\nimport treeChanges2 from \"tree-changes\";\n\n// src/modules/scope.ts\nvar Scope = class {\n constructor(element, options) {\n __publicField(this, \"element\");\n __publicField(this, \"options\");\n __publicField(this, \"canBeTabbed\", (element) => {\n const { tabIndex } = element;\n if (tabIndex === null || tabIndex < 0) {\n return false;\n }\n return this.canHaveFocus(element);\n });\n __publicField(this, \"canHaveFocus\", (element) => {\n const validTabNodes = /input|select|textarea|button|object/;\n const nodeName = element.nodeName.toLowerCase();\n const isValid = validTabNodes.test(nodeName) && !element.getAttribute(\"disabled\") || nodeName === \"a\" && !!element.getAttribute(\"href\");\n return isValid && this.isVisible(element);\n });\n __publicField(this, \"findValidTabElements\", () => [].slice.call(this.element.querySelectorAll(\"*\"), 0).filter(this.canBeTabbed));\n __publicField(this, \"handleKeyDown\", (event) => {\n const { code = \"Tab\" } = this.options;\n if (event.code === code) {\n this.interceptTab(event);\n }\n });\n __publicField(this, \"interceptTab\", (event) => {\n event.preventDefault();\n const elements = this.findValidTabElements();\n const { shiftKey } = event;\n if (!elements.length) {\n return;\n }\n let x = document.activeElement ? elements.indexOf(document.activeElement) : 0;\n if (x === -1 || !shiftKey && x + 1 === elements.length) {\n x = 0;\n } else if (shiftKey && x === 0) {\n x = elements.length - 1;\n } else {\n x += shiftKey ? -1 : 1;\n }\n elements[x].focus();\n });\n // eslint-disable-next-line class-methods-use-this\n __publicField(this, \"isHidden\", (element) => {\n const noSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;\n const style = window.getComputedStyle(element);\n if (noSize && !element.innerHTML) {\n return true;\n }\n return noSize && style.getPropertyValue(\"overflow\") !== \"visible\" || style.getPropertyValue(\"display\") === \"none\";\n });\n __publicField(this, \"isVisible\", (element) => {\n let parentElement = element;\n while (parentElement) {\n if (parentElement instanceof HTMLElement) {\n if (parentElement === document.body) {\n break;\n }\n if (this.isHidden(parentElement)) {\n return false;\n }\n parentElement = parentElement.parentNode;\n }\n }\n return true;\n });\n __publicField(this, \"removeScope\", () => {\n window.removeEventListener(\"keydown\", this.handleKeyDown);\n });\n __publicField(this, \"checkFocus\", (target) => {\n if (document.activeElement !== target) {\n target.focus();\n window.requestAnimationFrame(() => this.checkFocus(target));\n }\n });\n __publicField(this, \"setFocus\", () => {\n const { selector } = this.options;\n if (!selector) {\n return;\n }\n const target = this.element.querySelector(selector);\n if (target) {\n window.requestAnimationFrame(() => this.checkFocus(target));\n }\n });\n if (!(element instanceof HTMLElement)) {\n throw new TypeError(\"Invalid parameter: element must be an HTMLElement\");\n }\n this.element = element;\n this.options = options;\n window.addEventListener(\"keydown\", this.handleKeyDown, false);\n this.setFocus();\n }\n};\n\n// src/components/Beacon.tsx\nimport * as React4 from \"react\";\nimport is4 from \"is-lite\";\nvar JoyrideBeacon = class extends React4.Component {\n constructor(props) {\n super(props);\n __publicField(this, \"beacon\", null);\n __publicField(this, \"setBeaconRef\", (c) => {\n this.beacon = c;\n });\n if (props.beaconComponent) {\n return;\n }\n const head = document.head || document.getElementsByTagName(\"head\")[0];\n const style = document.createElement(\"style\");\n style.id = \"joyride-beacon-animation\";\n if (props.nonce) {\n style.setAttribute(\"nonce\", props.nonce);\n }\n const css = `\n @keyframes joyride-beacon-inner {\n 20% {\n opacity: 0.9;\n }\n \n 90% {\n opacity: 0.7;\n }\n }\n \n @keyframes joyride-beacon-outer {\n 0% {\n transform: scale(1);\n }\n \n 45% {\n opacity: 0.7;\n transform: scale(0.75);\n }\n \n 100% {\n opacity: 0.9;\n transform: scale(1);\n }\n }\n `;\n style.appendChild(document.createTextNode(css));\n head.appendChild(style);\n }\n componentDidMount() {\n const { shouldFocus } = this.props;\n if (process.env.NODE_ENV !== \"production\") {\n if (!is4.domElement(this.beacon)) {\n console.warn(\"beacon is not a valid DOM element\");\n }\n }\n setTimeout(() => {\n if (is4.domElement(this.beacon) && shouldFocus) {\n this.beacon.focus();\n }\n }, 0);\n }\n componentWillUnmount() {\n const style = document.getElementById(\"joyride-beacon-animation\");\n if (style == null ? void 0 : style.parentNode) {\n style.parentNode.removeChild(style);\n }\n }\n render() {\n const {\n beaconComponent,\n continuous,\n index,\n isLastStep,\n locale,\n onClickOrHover,\n size,\n step,\n styles\n } = this.props;\n const title = getReactNodeText(locale.open);\n const sharedProps = {\n \"aria-label\": title,\n onClick: onClickOrHover,\n onMouseEnter: onClickOrHover,\n ref: this.setBeaconRef,\n title\n };\n let component;\n if (beaconComponent) {\n const BeaconComponent = beaconComponent;\n component = /* @__PURE__ */ React4.createElement(\n BeaconComponent,\n {\n continuous,\n index,\n isLastStep,\n size,\n step,\n ...sharedProps\n }\n );\n } else {\n component = /* @__PURE__ */ React4.createElement(\n \"button\",\n {\n key: \"JoyrideBeacon\",\n className: \"react-joyride__beacon\",\n \"data-test-id\": \"button-beacon\",\n style: styles.beacon,\n type: \"button\",\n ...sharedProps\n },\n /* @__PURE__ */ React4.createElement(\"span\", { style: styles.beaconInner }),\n /* @__PURE__ */ React4.createElement(\"span\", { style: styles.beaconOuter })\n );\n }\n return component;\n }\n};\n\n// src/components/Tooltip/index.tsx\nimport * as React7 from \"react\";\n\n// src/components/Tooltip/Container.tsx\nimport * as React6 from \"react\";\n\n// src/components/Tooltip/CloseButton.tsx\nimport React5 from \"react\";\nfunction JoyrideTooltipCloseButton({ styles, ...props }) {\n const { color, height, width, ...style } = styles;\n return /* @__PURE__ */ React5.createElement(\"button\", { style, type: \"button\", ...props }, /* @__PURE__ */ React5.createElement(\n \"svg\",\n {\n height: typeof height === \"number\" ? `${height}px` : height,\n preserveAspectRatio: \"xMidYMid\",\n version: \"1.1\",\n viewBox: \"0 0 18 18\",\n width: typeof width === \"number\" ? `${width}px` : width,\n xmlns: \"http://www.w3.org/2000/svg\"\n },\n /* @__PURE__ */ React5.createElement(\"g\", null, /* @__PURE__ */ React5.createElement(\n \"path\",\n {\n d: \"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z\",\n fill: color\n }\n ))\n ));\n}\nvar CloseButton_default = JoyrideTooltipCloseButton;\n\n// src/components/Tooltip/Container.tsx\nfunction JoyrideTooltipContainer(props) {\n const { backProps, closeProps, index, isLastStep, primaryProps, skipProps, step, tooltipProps } = props;\n const { content, hideBackButton, hideCloseButton, hideFooter, showSkipButton, styles, title } = step;\n const output = {};\n output.primary = /* @__PURE__ */ React6.createElement(\n \"button\",\n {\n \"data-test-id\": \"button-primary\",\n style: styles.buttonNext,\n type: \"button\",\n ...primaryProps\n }\n );\n if (showSkipButton && !isLastStep) {\n output.skip = /* @__PURE__ */ React6.createElement(\n \"button\",\n {\n \"aria-live\": \"off\",\n \"data-test-id\": \"button-skip\",\n style: styles.buttonSkip,\n type: \"button\",\n ...skipProps\n }\n );\n }\n if (!hideBackButton && index > 0) {\n output.back = /* @__PURE__ */ React6.createElement(\"button\", { \"data-test-id\": \"button-back\", style: styles.buttonBack, type: \"button\", ...backProps });\n }\n output.close = !hideCloseButton && /* @__PURE__ */ React6.createElement(CloseButton_default, { \"data-test-id\": \"button-close\", styles: styles.buttonClose, ...closeProps });\n return /* @__PURE__ */ React6.createElement(\n \"div\",\n {\n key: \"JoyrideTooltip\",\n \"aria-label\": getReactNodeText(title != null ? title : content),\n className: \"react-joyride__tooltip\",\n style: styles.tooltip,\n ...tooltipProps\n },\n /* @__PURE__ */ React6.createElement(\"div\", { style: styles.tooltipContainer }, title && /* @__PURE__ */ React6.createElement(\"h1\", { \"aria-label\": getReactNodeText(title), style: styles.tooltipTitle }, title), /* @__PURE__ */ React6.createElement(\"div\", { style: styles.tooltipContent }, content)),\n !hideFooter && /* @__PURE__ */ React6.createElement(\"div\", { style: styles.tooltipFooter }, /* @__PURE__ */ React6.createElement(\"div\", { style: styles.tooltipFooterSpacer }, output.skip), output.back, output.primary),\n output.close\n );\n}\nvar Container_default = JoyrideTooltipContainer;\n\n// src/components/Tooltip/index.tsx\nvar JoyrideTooltip = class extends React7.Component {\n constructor() {\n super(...arguments);\n __publicField(this, \"handleClickBack\", (event) => {\n event.preventDefault();\n const { helpers } = this.props;\n helpers.prev();\n });\n __publicField(this, \"handleClickClose\", (event) => {\n event.preventDefault();\n const { helpers } = this.props;\n helpers.close(\"button_close\");\n });\n __publicField(this, \"handleClickPrimary\", (event) => {\n event.preventDefault();\n const { continuous, helpers } = this.props;\n if (!continuous) {\n helpers.close(\"button_primary\");\n return;\n }\n helpers.next();\n });\n __publicField(this, \"handleClickSkip\", (event) => {\n event.preventDefault();\n const { helpers } = this.props;\n helpers.skip();\n });\n __publicField(this, \"getElementsProps\", () => {\n const { continuous, index, isLastStep, setTooltipRef, size, step } = this.props;\n const { back, close, last, next, nextLabelWithProgress, skip } = step.locale;\n const backText = getReactNodeText(back);\n const closeText = getReactNodeText(close);\n const lastText = getReactNodeText(last);\n const nextText = getReactNodeText(next);\n const skipText = getReactNodeText(skip);\n let primary = close;\n let primaryText = closeText;\n if (continuous) {\n primary = next;\n primaryText = nextText;\n if (step.showProgress && !isLastStep) {\n const labelWithProgress = getReactNodeText(nextLabelWithProgress, {\n step: index + 1,\n steps: size\n });\n primary = replaceLocaleContent(nextLabelWithProgress, index + 1, size);\n primaryText = labelWithProgress;\n }\n if (isLastStep) {\n primary = last;\n primaryText = lastText;\n }\n }\n return {\n backProps: {\n \"aria-label\": backText,\n children: back,\n \"data-action\": \"back\",\n onClick: this.handleClickBack,\n role: \"button\",\n title: backText\n },\n closeProps: {\n \"aria-label\": closeText,\n children: close,\n \"data-action\": \"close\",\n onClick: this.handleClickClose,\n role: \"button\",\n title: closeText\n },\n primaryProps: {\n \"aria-label\": primaryText,\n children: primary,\n \"data-action\": \"primary\",\n onClick: this.handleClickPrimary,\n role: \"button\",\n title: primaryText\n },\n skipProps: {\n \"aria-label\": skipText,\n children: skip,\n \"data-action\": \"skip\",\n onClick: this.handleClickSkip,\n role: \"button\",\n title: skipText\n },\n tooltipProps: {\n \"aria-modal\": true,\n ref: setTooltipRef,\n role: \"alertdialog\"\n }\n };\n });\n }\n render() {\n const { continuous, index, isLastStep, setTooltipRef, size, step } = this.props;\n const { beaconComponent, tooltipComponent, ...cleanStep } = step;\n let component;\n if (tooltipComponent) {\n const renderProps = {\n ...this.getElementsProps(),\n continuous,\n index,\n isLastStep,\n size,\n step: cleanStep,\n setTooltipRef\n };\n const TooltipComponent = tooltipComponent;\n component = /* @__PURE__ */ React7.createElement(TooltipComponent, { ...renderProps });\n } else {\n component = /* @__PURE__ */ React7.createElement(\n Container_default,\n {\n ...this.getElementsProps(),\n continuous,\n index,\n isLastStep,\n size,\n step\n }\n );\n }\n return component;\n }\n};\n\n// src/components/Step.tsx\nvar JoyrideStep = class extends React8.Component {\n constructor() {\n super(...arguments);\n __publicField(this, \"scope\", null);\n __publicField(this, \"tooltip\", null);\n /**\n * Beacon click/hover event listener\n */\n __publicField(this, \"handleClickHoverBeacon\", (event) => {\n const { step, store } = this.props;\n if (event.type === \"mouseenter\" && step.event !== \"hover\") {\n return;\n }\n store.update({ lifecycle: LIFECYCLE.TOOLTIP });\n });\n __publicField(this, \"setTooltipRef\", (element) => {\n this.tooltip = element;\n });\n __publicField(this, \"setPopper\", (popper, type) => {\n var _a;\n const { action, lifecycle, step, store } = this.props;\n if (type === \"wrapper\") {\n store.setPopper(\"beacon\", popper);\n } else {\n store.setPopper(\"tooltip\", popper);\n }\n if (store.getPopper(\"beacon\") && (store.getPopper(\"tooltip\") || step.placement === \"center\") && lifecycle === LIFECYCLE.INIT) {\n store.update({\n action,\n lifecycle: LIFECYCLE.READY\n });\n }\n if ((_a = step.floaterProps) == null ? void 0 : _a.getPopper) {\n step.floaterProps.getPopper(popper, type);\n }\n });\n __publicField(this, \"renderTooltip\", (renderProps) => {\n const { continuous, helpers, index, size, step } = this.props;\n return /* @__PURE__ */ React8.createElement(\n JoyrideTooltip,\n {\n continuous,\n helpers,\n index,\n isLastStep: index + 1 === size,\n setTooltipRef: this.setTooltipRef,\n size,\n step,\n ...renderProps\n }\n );\n });\n }\n componentDidMount() {\n const { debug, index } = this.props;\n log({\n title: `step:${index}`,\n data: [{ key: \"props\", value: this.props }],\n debug\n });\n }\n componentDidUpdate(previousProps) {\n var _a;\n const {\n action,\n callback,\n continuous,\n controlled,\n debug,\n helpers,\n index,\n lifecycle,\n shouldScroll: shouldScroll2,\n status,\n step,\n store\n } = this.props;\n const { changed, changedFrom } = treeChanges2(previousProps, this.props);\n const state = helpers.info();\n const skipBeacon = continuous && action !== ACTIONS.CLOSE && (index > 0 || action === ACTIONS.PREV);\n const hasStoreChanged = changed(\"action\") || changed(\"index\") || changed(\"lifecycle\") || changed(\"status\");\n const isInitial = changedFrom(\"lifecycle\", [LIFECYCLE.TOOLTIP, LIFECYCLE.INIT], LIFECYCLE.INIT);\n const isAfterAction = changed(\"action\", [\n ACTIONS.NEXT,\n ACTIONS.PREV,\n ACTIONS.SKIP,\n ACTIONS.CLOSE\n ]);\n const isControlled = controlled && index === previousProps.index;\n if (isAfterAction && (isInitial || isControlled)) {\n callback({\n ...state,\n index: previousProps.index,\n lifecycle: LIFECYCLE.COMPLETE,\n step: previousProps.step,\n type: EVENTS.STEP_AFTER\n });\n }\n if (step.placement === \"center\" && status === STATUS.RUNNING && changed(\"index\") && action !== ACTIONS.START && lifecycle === LIFECYCLE.INIT) {\n store.update({ lifecycle: LIFECYCLE.READY });\n }\n if (hasStoreChanged) {\n const element = getElement(step.target);\n const elementExists = !!element;\n const hasRenderedTarget = elementExists && isElementVisible(element);\n if (hasRenderedTarget) {\n if (changedFrom(\"status\", STATUS.READY, STATUS.RUNNING) || changedFrom(\"lifecycle\", LIFECYCLE.INIT, LIFECYCLE.READY)) {\n callback({\n ...state,\n step,\n type: EVENTS.STEP_BEFORE\n });\n }\n } else {\n console.warn(elementExists ? \"Target not visible\" : \"Target not mounted\", step);\n callback({\n ...state,\n type: EVENTS.TARGET_NOT_FOUND,\n step\n });\n if (!controlled) {\n store.update({ index: index + (action === ACTIONS.PREV ? -1 : 1) });\n }\n }\n }\n if (changedFrom(\"lifecycle\", LIFECYCLE.INIT, LIFECYCLE.READY)) {\n store.update({\n lifecycle: hideBeacon(step) || skipBeacon ? LIFECYCLE.TOOLTIP : LIFECYCLE.BEACON\n });\n }\n if (changed(\"index\")) {\n log({\n title: `step:${lifecycle}`,\n data: [{ key: \"props\", value: this.props }],\n debug\n });\n }\n if (changed(\"lifecycle\", LIFECYCLE.BEACON)) {\n callback({\n ...state,\n step,\n type: EVENTS.BEACON\n });\n }\n if (changed(\"lifecycle\", LIFECYCLE.TOOLTIP)) {\n callback({\n ...state,\n step,\n type: EVENTS.TOOLTIP\n });\n if (shouldScroll2 && this.tooltip) {\n this.scope = new Scope(this.tooltip, { selector: \"[data-action=primary]\" });\n this.scope.setFocus();\n }\n }\n if (changedFrom(\"lifecycle\", [LIFECYCLE.TOOLTIP, LIFECYCLE.INIT], LIFECYCLE.INIT)) {\n (_a = this.scope) == null ? void 0 : _a.removeScope();\n store.cleanupPoppers();\n }\n }\n componentWillUnmount() {\n var _a;\n (_a = this.scope) == null ? void 0 : _a.removeScope();\n }\n get open() {\n const { lifecycle, step } = this.props;\n return hideBeacon(step) || lifecycle === LIFECYCLE.TOOLTIP;\n }\n render() {\n const { continuous, debug, index, nonce, shouldScroll: shouldScroll2, size, step } = this.props;\n const target = getElement(step.target);\n if (!validateStep(step) || !is5.domElement(target)) {\n return null;\n }\n return /* @__PURE__ */ React8.createElement(\"div\", { key: `JoyrideStep-${index}`, className: \"react-joyride__step\" }, /* @__PURE__ */ React8.createElement(\n Floater,\n {\n ...step.floaterProps,\n component: this.renderTooltip,\n debug,\n getPopper: this.setPopper,\n id: `react-joyride-step-${index}`,\n open: this.open,\n placement: step.placement,\n target: step.target\n },\n /* @__PURE__ */ React8.createElement(\n JoyrideBeacon,\n {\n beaconComponent: step.beaconComponent,\n continuous,\n index,\n isLastStep: index + 1 === size,\n locale: step.locale,\n nonce,\n onClickOrHover: this.handleClickHoverBeacon,\n shouldFocus: shouldScroll2,\n size,\n step,\n styles: step.styles\n }\n )\n ));\n }\n};\n\n// src/components/index.tsx\nvar Joyride = class extends React9.Component {\n constructor(props) {\n super(props);\n __publicField(this, \"helpers\");\n __publicField(this, \"store\");\n /**\n * Trigger the callback.\n */\n __publicField(this, \"callback\", (data) => {\n const { callback } = this.props;\n if (is6.function(callback)) {\n callback(data);\n }\n });\n /**\n * Keydown event listener\n */\n __publicField(this, \"handleKeyboard\", (event) => {\n const { index, lifecycle } = this.state;\n const { steps } = this.props;\n const step = steps[index];\n if (lifecycle === LIFECYCLE.TOOLTIP) {\n if (event.code === \"Escape\" && step && !step.disableCloseOnEsc) {\n this.store.close(\"keyboard\");\n }\n }\n });\n __publicField(this, \"handleClickOverlay\", () => {\n const { index } = this.state;\n const { steps } = this.props;\n const step = getMergedStep(this.props, steps[index]);\n if (!step.disableOverlayClose) {\n this.helpers.close(\"overlay\");\n }\n });\n /**\n * Sync the store with the component's state\n */\n __publicField(this, \"syncState\", (state) => {\n this.setState(state);\n });\n const { debug, getHelpers, run = true, stepIndex } = props;\n this.store = createStore({\n ...props,\n controlled: run && is6.number(stepIndex)\n });\n this.helpers = this.store.getHelpers();\n const { addListener } = this.store;\n log({\n title: \"init\",\n data: [\n { key: \"props\", value: this.props },\n { key: \"state\", value: this.state }\n ],\n debug\n });\n addListener(this.syncState);\n if (getHelpers) {\n getHelpers(this.helpers);\n }\n this.state = this.store.getState();\n }\n componentDidMount() {\n if (!canUseDOM()) {\n return;\n }\n const { debug, disableCloseOnEsc, run, steps } = this.props;\n const { start } = this.store;\n if (validateSteps(steps, debug) && run) {\n start();\n }\n if (!disableCloseOnEsc) {\n document.body.addEventListener(\"keydown\", this.handleKeyboard, { passive: true });\n }\n }\n componentDidUpdate(previousProps, previousState) {\n if (!canUseDOM()) {\n return;\n }\n const { action, controlled, index, status } = this.state;\n const { debug, run, stepIndex, steps } = this.props;\n const { stepIndex: previousStepIndex, steps: previousSteps } = previousProps;\n const { reset, setSteps, start, stop, update } = this.store;\n const { changed: changedProps } = treeChanges3(previousProps, this.props);\n const { changed, changedFrom } = treeChanges3(previousState, this.state);\n const step = getMergedStep(this.props, steps[index]);\n const stepsChanged = !isEqual(previousSteps, steps);\n const stepIndexChanged = is6.number(stepIndex) && changedProps(\"stepIndex\");\n const target = getElement(step.target);\n if (stepsChanged) {\n if (validateSteps(steps, debug)) {\n setSteps(steps);\n } else {\n console.warn(\"Steps are not valid\", steps);\n }\n }\n if (changedProps(\"run\")) {\n if (run) {\n start(stepIndex);\n } else {\n stop();\n }\n }\n if (stepIndexChanged) {\n let nextAction = is6.number(previousStepIndex) && previousStepIndex < stepIndex ? ACTIONS.NEXT : ACTIONS.PREV;\n if (action === ACTIONS.STOP) {\n nextAction = ACTIONS.START;\n }\n if (![STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {\n update({\n action: action === ACTIONS.CLOSE ? ACTIONS.CLOSE : nextAction,\n index: stepIndex,\n lifecycle: LIFECYCLE.INIT\n });\n }\n }\n if (!controlled && status === STATUS.RUNNING && index === 0 && !target) {\n this.store.update({ index: index + 1 });\n this.callback({\n ...this.state,\n type: EVENTS.TARGET_NOT_FOUND,\n step\n });\n }\n const callbackData = {\n ...this.state,\n index,\n step\n };\n const isAfterAction = changed(\"action\", [\n ACTIONS.NEXT,\n ACTIONS.PREV,\n ACTIONS.SKIP,\n ACTIONS.CLOSE\n ]);\n if (isAfterAction && changed(\"status\", STATUS.PAUSED)) {\n const previousStep = getMergedStep(this.props, steps[previousState.index]);\n this.callback({\n ...callbackData,\n index: previousState.index,\n lifecycle: LIFECYCLE.COMPLETE,\n step: previousStep,\n type: EVENTS.STEP_AFTER\n });\n }\n if (changed(\"status\", [STATUS.FINISHED, STATUS.SKIPPED])) {\n const previousStep = getMergedStep(this.props, steps[previousState.index]);\n if (!controlled) {\n this.callback({\n ...callbackData,\n index: previousState.index,\n lifecycle: LIFECYCLE.COMPLETE,\n step: previousStep,\n type: EVENTS.STEP_AFTER\n });\n }\n this.callback({\n ...callbackData,\n type: EVENTS.TOUR_END,\n // Return the last step when the tour is finished\n step: previousStep,\n index: previousState.index\n });\n reset();\n } else if (changedFrom(\"status\", [STATUS.IDLE, STATUS.READY], STATUS.RUNNING)) {\n this.callback({\n ...callbackData,\n type: EVENTS.TOUR_START\n });\n } else if (changed(\"status\") || changed(\"action\", ACTIONS.RESET)) {\n this.callback({\n ...callbackData,\n type: EVENTS.TOUR_STATUS\n });\n }\n this.scrollToStep(previousState);\n }\n componentWillUnmount() {\n const { disableCloseOnEsc } = this.props;\n if (!disableCloseOnEsc) {\n document.body.removeEventListener(\"keydown\", this.handleKeyboard);\n }\n }\n scrollToStep(previousState) {\n const { index, lifecycle, status } = this.state;\n const {\n debug,\n disableScrollParentFix = false,\n scrollDuration,\n scrollOffset = 20,\n scrollToFirstStep = false,\n steps\n } = this.props;\n const step = getMergedStep(this.props, steps[index]);\n const target = getElement(step.target);\n const shouldScrollToStep = shouldScroll({\n isFirstStep: index === 0,\n lifecycle,\n previousLifecycle: previousState.lifecycle,\n scrollToFirstStep,\n step,\n target\n });\n if (status === STATUS.RUNNING && shouldScrollToStep) {\n const hasCustomScroll = hasCustomScrollParent(target, disableScrollParentFix);\n const scrollParent2 = getScrollParent(target, disableScrollParentFix);\n let scrollY = Math.floor(getScrollTo(target, scrollOffset, disableScrollParentFix)) || 0;\n log({\n title: \"scrollToStep\",\n data: [\n { key: \"index\", value: index },\n { key: \"lifecycle\", value: lifecycle },\n { key: \"status\", value: status }\n ],\n debug\n });\n const beaconPopper = this.store.getPopper(\"beacon\");\n const tooltipPopper = this.store.getPopper(\"tooltip\");\n if (lifecycle === LIFECYCLE.BEACON && beaconPopper) {\n const { offsets, placement } = beaconPopper;\n if (![\"bottom\"].includes(placement) && !hasCustomScroll) {\n scrollY = Math.floor(offsets.popper.top - scrollOffset);\n }\n } else if (lifecycle === LIFECYCLE.TOOLTIP && tooltipPopper) {\n const { flipped, offsets, placement } = tooltipPopper;\n if ([\"top\", \"right\", \"left\"].includes(placement) && !flipped && !hasCustomScroll) {\n scrollY = Math.floor(offsets.popper.top - scrollOffset);\n } else {\n scrollY -= step.spotlightPadding;\n }\n }\n scrollY = scrollY >= 0 ? scrollY : 0;\n if (status === STATUS.RUNNING) {\n scrollTo(scrollY, { element: scrollParent2, duration: scrollDuration }).then(\n () => {\n setTimeout(() => {\n var _a;\n (_a = this.store.getPopper(\"tooltip\")) == null ? void 0 : _a.instance.update();\n }, 10);\n }\n );\n }\n }\n }\n render() {\n if (!canUseDOM()) {\n return null;\n }\n const { index, lifecycle, status } = this.state;\n const {\n continuous = false,\n debug = false,\n nonce,\n scrollToFirstStep = false,\n steps\n } = this.props;\n const isRunning = status === STATUS.RUNNING;\n const content = {};\n if (isRunning && steps[index]) {\n const step = getMergedStep(this.props, steps[index]);\n content.step = /* @__PURE__ */ React9.createElement(\n JoyrideStep,\n {\n ...this.state,\n callback: this.callback,\n continuous,\n debug,\n helpers: this.helpers,\n nonce,\n shouldScroll: !step.disableScrolling && (index !== 0 || scrollToFirstStep),\n step,\n store: this.store\n }\n );\n content.overlay = /* @__PURE__ */ React9.createElement(JoyridePortal, { id: \"react-joyride-portal\" }, /* @__PURE__ */ React9.createElement(\n JoyrideOverlay,\n {\n ...step,\n continuous,\n debug,\n lifecycle,\n onClickOverlay: this.handleClickOverlay\n }\n ));\n }\n return /* @__PURE__ */ React9.createElement(\"div\", { className: \"react-joyride\" }, content.step, content.overlay);\n }\n};\n__publicField(Joyride, \"defaultProps\", defaultProps);\nvar components_default = Joyride;\nexport {\n ACTIONS,\n EVENTS,\n LIFECYCLE,\n ORIGIN,\n STATUS,\n components_default as default\n};\n//# sourceMappingURL=index.mjs.map","export const steps = [\n {\n title: 'Patient Schedule',\n text: 'This is the list of patients scheduled with your provider\\'s care team for the day selected. This list is organized by the time of visit.',\n selector: '.apt-card.card.blue-bkg.white-text',\n position: 'top',\n type: 'hover',\n name: 'patient-schedule',\n },\n {\n title: 'Mini Chart',\n text: 'This is the patient\\'s minichart. It\\'s a curated list of clinical information pulled from your EHR and is designed to help you with pre visit planning.',\n selector: '.fixed-mini-chart-column',\n position: 'left',\n type: 'hover',\n name: 'mini-chart',\n },\n {\n title: 'Patient-Specific Pre-Visit Planning',\n text: 'This section of Avhana contains patient-specific pre-visit planning features to help you with charting the encounter ahead of time.',\n selector: '.recommendation-box',\n position: 'right',\n type: 'hover',\n name: 'previsit-planning-center-panel',\n },\n {\n title: 'Recommendations',\n text: 'Select the recommendations tab to view the list of Avhana interventions that apply for this patient. You can queue these follow up actions to be submitted when the patient checks in by selecting the Order button.',\n selector: '.recs-tab',\n position: 'top',\n type: 'hover',\n name: 'recommendations-tab',\n },\n {\n title: 'Problems & Notes',\n text: 'Select the problems & notes tabs to queue up notes and documentation. Diagnosis notes will be recorded in the encounter assessment when the patient checks in and Assessment and HPI notes will be recorded in their corresponding sections within the encounter.',\n selector: '.doc-tab',\n position: 'left',\n type: 'hover',\n name: 'documentation-tab',\n },\n {\n title: 'Onboarding Video',\n text: 'If you still feel lost use this link to access an onboarding video we created just for you: https://youtu.be/OyNvP1Iszyg',\n selector: '.apt-card',\n position: 'center',\n type: 'hover',\n name: 'onboarding-video',\n }\n]\n","import React from 'react'\nimport Joyride from 'react-joyride'\nimport { steps } from './steps'\n\nexport default class PreVisitWalkthrough extends React.Component {\n constructor(props) {\n super(props)\n this.state = { run: this.shouldRunTour() }\n }\n\n shouldRunTour() {\n try {\n return sessionStorage.getItem('finishedTour') !== 'true'\n } catch (error) {\n return true\n }\n }\n\n joyrideCallback = (data) => {\n try {\n if (data.type === 'finished') {\n // store if tour finished so we don't show again in same session\n sessionStorage.setItem('finishedTour', 'true')\n this.setState({ run: false })\n }\n } catch (error) {\n console.error(error, { context: 'joyride callback failure' })\n }\n }\n\n render() {\n return (\n \n \n
\n )\n }\n}\n","import PropTypes from 'prop-types'\nimport React from 'react'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport DatePicker from 'react-datepicker'\nimport dayjs from '../utilities/dayjs'\nimport PrintIcon from '@mui/icons-material/Print'\n\nimport AppointmentsTable from './AppointmentsTable'\nimport PatientBox from './PatientBox'\nimport LoadingSkeleton from '../loadingSkeleton/LoadingSkeleton'\nimport CareTeamSelector from './CareTeamSelector'\nimport DateNavigator from './DateNavigator'\nimport PreVisitWalkthrough from '../onboarding/PreVisitWalkthrough'\nimport log from '../utilities/logger'\n\n/**\n * @class PreVisitDashboard This is the main component for the Appointments page\n * and is where we handle the first load and subsequent reloads of the Appointments\n * page\n * @prop appointmentIdFromSso Appointment id from SSO\n * @prop appointmentDateFromSso Appointment date from SSO\n * @prop currentOrganization A serialized organization\n * @prop currentUser A serialized user\n * @prop timeZoneOffset Time zone offset\n * @prop emr A string specifying the emr of the current user\n */\n\nclass PreVisitDashboard extends React.Component {\n /**\n * @attribute selectedDate A string either yesterday, today, or tomorrow\n * @attribute appointmentsList An array of appointment objects\n * @attribute loading A boolean flag for loading state\n * @attribute emr A string of current user's emr\n */\n\n constructor(props) {\n super(props)\n this.state = {\n selectedMomentDate: dayjs(),\n appointmentsList: [],\n loading: true,\n emr: '',\n selectedEmrPatientId: '',\n emrDepartmentId: '',\n organizationId: '',\n activeAppointment: null,\n prebuilt: true,\n careTeam: '',\n calendarOpen: false,\n }\n this.searchForNewAppointments = this.searchForNewAppointments.bind(this)\n this.getRecommendations = this.getRecommendations.bind(this)\n this.dateChange = this.dateChange.bind(this)\n this.toggleCalendar = this.toggleCalendar.bind(this)\n this.handleDatepickerClose = this.handleDatepickerClose.bind(this)\n this.setUpdatedActiveAppointment = this.setUpdatedActiveAppointment.bind(\n this\n )\n this.setActiveAppointment = this.setActiveAppointment.bind(this)\n this.setNearestAppointment = this.setNearestAppointment.bind(this)\n this.updateActiveAppointment = this.updateActiveAppointment.bind(this)\n this.careTeamChangeHandler = this.careTeamChangeHandler.bind(this)\n this.debouncedApptsSearch = _.debounce(this.searchForNewAppointments, 1000)\n }\n\n /**\n * @method componentDidMount call appointments/ and populate appoinments\n * dashboard on initial load of page\n */\n componentDidMount() {\n const {\n emr,\n currentOrganization,\n currentUser: { care_team },\n timeZoneOffset,\n } = this.props\n\n const careTeam = care_team ? care_team.id : null\n const { id: organizationId, appointmentSmartFilter } = currentOrganization\n const aptTypesBlacklist = appointmentSmartFilter\n ? appointmentSmartFilter.appointment_types\n : []\n\n const avhanaHostUrl = process.env.AVHANA_HOST_URL\n console.log('avhana host url', avhanaHostUrl)\n\n // set states for default page load of appointments\n this.setState({\n aptTypesBlacklist,\n careTeam,\n emr,\n organizationId,\n selectedMomentDate: dayjs(),\n timeZoneOffset,\n })\n\n // day is in format \"YYYY-MM-DD\" whether it comes from props or moment\n let parsedMomentDate\n let stringDate\n if (this.props.appointmentDateFromSso) {\n parsedMomentDate = dayjs(this.props.appointmentDateFromSso, 'YYYY-MM-DD')\n stringDate = this.props.appointmentDateFromSso\n } else {\n parsedMomentDate = dayjs()\n stringDate = parsedMomentDate.format('YYYY-MM-DD')\n }\n\n // Init datepicker state (react-datepicker controlled via calendarOpen state).\n const element = null // formerly M.Datepicker target — no longer needed\n // make call to populate dashboard on first load\n $.get('/appointments', { date: stringDate })\n .done((appointments) => {\n const normalizedAppointments = Array.isArray(appointments)\n ? appointments\n : []\n this.setState({ appointmentsList: normalizedAppointments })\n if (normalizedAppointments.length === 0) {\n return\n }\n\n if (!this.props.appointmentIdFromSso) {\n this.setNearestAppointment(normalizedAppointments)\n return\n }\n\n const appointmentFromSso = _.find(normalizedAppointments, (apt) => {\n return apt.id === this.props.appointmentIdFromSso\n })\n\n if (!appointmentFromSso) {\n log({\n title: 'Appointments load Error',\n className: 'PreVisitDashboard',\n context: {\n appointmentIdFromSso: this.props.appointmentIdFromSso,\n message: `appointment ${this.props.appointmentIdFromSso}`,\n },\n severity: 'error',\n })\n this.setNearestAppointment(normalizedAppointments)\n return\n }\n\n const emrDepartmentId = appointmentFromSso.department\n ? appointmentFromSso.department.emr_department_id\n : undefined\n this.setState({\n selectedEmrPatientId: appointmentFromSso.emr_patient_id,\n emrDepartmentId,\n activeAppointment: appointmentFromSso,\n selectedMomentDate: parsedMomentDate,\n prebuilt: 'true',\n })\n })\n .always((data) => this.setState({ loading: false }))\n .fail((errors) => {\n if (checkTimeout(errors) === true) {\n redirectToLogin()\n } else {\n flash.notice(\n 'There was a problem loading appointments. ' +\n 'Contact support@amalgamrx.com for further assistance.'\n )\n log({\n title: 'Appointments load Error',\n className: 'PreVisitDashboard',\n context: { endpoint: '/appointments', phase: 'initial-load' },\n values: { errors },\n severity: 'error',\n })\n console.error({\n name: 'Apointments load Error',\n message: 'Appointment load error',\n })\n }\n })\n }\n\n /**\n * @method componentDidUpdate\n */\n componentDidUpdate() {\n // set active apt card in the view\n const activeCard = document.getElementsByClassName(\n 'apt-card card blue-bkg white-text'\n )[0]\n if (activeCard) {\n activeCard.scrollIntoView()\n }\n }\n\n searchForNewAppointments() {\n const params = {\n date: this.state.selectedMomentDate.format('YYYY-MM-DD'),\n }\n $.get('/appointments', params)\n .done((appointments) => {\n const normalizedAppointments = Array.isArray(appointments)\n ? appointments\n : []\n this.setState({ appointmentsList: normalizedAppointments })\n if (normalizedAppointments.length > 0) {\n this.setNearestAppointment(normalizedAppointments)\n } else {\n this.setState({\n selectedEmrPatientId: undefined,\n emrDepartmentId: undefined,\n activeAppointment: undefined,\n })\n }\n })\n .always((data) => this.setState({ loading: false }))\n .fail((errors) => {\n if (checkTimeout(errors) === true) {\n redirectToLogin()\n } else {\n flash.notice(\n 'There was a problem loading appointments. ' +\n 'Contact support@amalgamrx.com for further assistance.'\n )\n log({\n title: 'Appointments Load Error',\n className: 'PreVisitDashboard',\n context: { endpoint: '/appointments', phase: 'search' },\n values: { errors },\n severity: 'error',\n })\n console.error(errors, { context: 'Appointments Load Error' })\n }\n })\n }\n\n departmentId(appointment) {\n if (appointment.department) {\n return appointment.department.emr_department_id\n } else {\n return ''\n }\n }\n\n // updates activeAppointment and active appointment in appointmentsList\n // used by pull previous documentation that receives an updated active appointment\n setUpdatedActiveAppointment(activeAppointment) {\n const appointmentsList = this.state.appointmentsList\n const activeAppointmentToUpdate = _.find(\n appointmentsList,\n (appointment) => appointment.id === activeAppointment.id\n )\n if (activeAppointmentToUpdate) {\n Object.assign(activeAppointmentToUpdate, activeAppointment)\n }\n\n this.setState({ activeAppointment, appointmentsList })\n }\n\n setActiveAppointment(appointment) {\n this.setState({\n selectedEmrPatientId: appointment.emr_patient_id,\n emrDepartmentId: this.departmentId(appointment),\n activeAppointment: appointment,\n })\n }\n\n setNearestAppointment(appointments) {\n let appointment = _.find(appointments, (apt) => {\n // this function compares the appointment time to now and returns the appointment\n // within 30 minutes of now\n // moment.diff() accepts a time and compares it to now, and the second\n // parameter defines the unit returned.\n return Math.abs(dayjs().diff(dayjs(apt.appointment_time), 'minutes')) <= 30\n })\n if (!appointment) {\n appointment = appointments[0]\n }\n\n this.setState({\n selectedEmrPatientId: appointment.emr_patient_id,\n emrDepartmentId: this.departmentId(appointment),\n activeAppointment: appointment,\n })\n }\n\n updateActiveAppointment(appointmentId) {\n const cachedActiveAppointment = { ...this.state.activeAppointment }\n\n const activeAppointmentWhenReloading = {\n ...this.state.activeAppointment,\n planned_diagnoses: ['reloading'],\n }\n this.setState({ activeAppointment: activeAppointmentWhenReloading })\n\n $.get(`/appointments/${appointmentId}`, { prebuilt: 'false' })\n .done((activeAppointment) => {\n const appointmentsList = this.state.appointmentsList\n const aptToUpdate = _.find(\n appointmentsList,\n (apt) => apt.id === activeAppointment.id\n )\n if (aptToUpdate) {\n Object.assign(aptToUpdate, activeAppointment)\n }\n this.setState({ activeAppointment, appointmentsList })\n })\n .fail((errors) => {\n this.setState({ activeAppointment: cachedActiveAppointment })\n log({\n title: 'Problem list refresh failed',\n className: 'PreVisitDashboard',\n context: { appointmentId },\n values: { errors },\n severity: 'error',\n })\n console.error(errors, { context: 'Problem list refresh failed' })\n flash.error(\n 'There was a problem pulling the latest problem list for this patient.' +\n 'Please contact support@amalgamrx.com for further assistance.'\n )\n })\n }\n\n getRecommendations(event) {\n // pass in active card id here and set activeCard (id) state\n // set prebuilt to true expect on sso to previsit page\n this.setState({\n selectedEmrPatientId: event.emrPatientId,\n emrDepartmentId: event.departmentId,\n activeAppointment: event.apt,\n prebuilt: true,\n })\n }\n\n dateChange(event) {\n const currentMomentDate = this.state.selectedMomentDate\n\n let newMomentDate\n if (event.target.id === 'add-day') {\n newMomentDate = currentMomentDate.add(1, 'day')\n } else if (event.target.id === 'subtract-day') {\n newMomentDate = currentMomentDate.subtract(1, 'day')\n }\n\n this.setState({ selectedMomentDate: newMomentDate, loading: true })\n // debounce appts search until the user has stopped searching ahead/behind\n event.persist()\n this.debouncedApptsSearch(event)\n }\n\n toggleCalendar() {\n this.setState(prev => ({ calendarOpen: !prev.calendarOpen }))\n }\n\n handleDatepickerClose(date) {\n if (!date) return\n const newDate = dayjs(date)\n this.setState({ selectedMomentDate: newDate, loading: true, calendarOpen: false }, () => {\n this.debouncedApptsSearch()\n })\n }\n\n careTeamChangeHandler(event, index, value) {\n const newCareTeamId = value\n $.post(`/care_teams/${newCareTeamId}/users?id=${this.props.currentUser.id}`)\n .done((response) => {\n this.setState({ careTeam: newCareTeamId, loading: true })\n event.persist()\n this.debouncedApptsSearch(event)\n })\n .fail((error) => {\n if (checkTimeout(error) === true) {\n redirectToLogin()\n } else {\n this.setState({\n alertText: 'There was an error joining the care team you selected',\n })\n log({\n title: 'CareTeamPicker Error',\n className: 'PreVisitDashboard',\n context: { newCareTeamId },\n values: { error },\n severity: 'error',\n })\n console.error(error, { context: 'CareTeamPicker Error' })\n }\n })\n }\n\n render() {\n // view logic allscripts only print schedule button\n let printSchedButton\n if (this.props.emr === 'allscripts') {\n printSchedButton = (\n \n }\n >\n Print Schedule\n \n \n )\n }\n // view logic for appointments table show\n let appointmentsTable\n if (this.state.loading) {\n appointmentsTable = \n } else if (this.state.appointmentsList.length > 0) {\n appointmentsTable = (\n \n
\n {printSchedButton}\n
\n )\n } else {\n appointmentsTable = (\n \n
\n There are either no appointments for this date, or you are not a\n member of a care team. Select a care team in the dropdown menu above\n and get started with pre-visit planning.\n
\n
\n )\n }\n\n let patientBox\n if (this.state.selectedEmrPatientId) {\n patientBox = (\n \n )\n }\n\n let careTeamSelector\n if (this.props.currentUser.medical_assistant) {\n careTeamSelector = (\n \n )\n }\n\n let onboardingWalkthrough\n const finishedTour = sessionStorage.getItem('finishedTour')\n if (\n this.props.currentUser.total_logins_count < 3 &&\n finishedTour !== 'true' &&\n this.state.emr != 'allscripts'\n ) {\n onboardingWalkthrough = \n }\n return (\n \n {onboardingWalkthrough}\n \n \n
\n {this.state.calendarOpen && (\n
\n \n
\n )}\n
\n {careTeamSelector}\n \n
\n \n {appointmentsTable}\n \n \n {patientBox}\n \n )\n }\n}\n\nPreVisitDashboard.propTypes = {\n currentOrganization: PropTypes.shape({\n id: PropTypes.number,\n appointmentSmartFilter: PropTypes.shape({\n appointment_types: PropTypes.arrayOf(PropTypes.string),\n }),\n }).isRequired,\n currentUser: PropTypes.shape({\n care_team: PropTypes.shape({\n id: PropTypes.number,\n }),\n }).isRequired,\n emr: PropTypes.string.isRequired,\n timeZoneOffset: PropTypes.string.isRequired,\n}\n\nexport default PreVisitDashboard\n\n","import React, { useEffect, useState } from 'react'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport TextField from '@mui/material/TextField'\nimport Tooltip from \"@mui/material/Tooltip\"\nimport Button from '@mui/material/Button'\nimport PropTypes from 'prop-types'\nimport log from '../../utilities/logger'\n\nconst propTypes = {\n organizations: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n id: PropTypes.number.isRequired,\n })\n ).isRequired\n}\n\nconst CopyOrderPreferenceAndSubs = ({ organizations }) => {\n const [organization, setOrganization] = useState('')\n const [sourceOrganization, setSourceOrganization] = useState(null)\n const [targetOrganization, setTargetOrganization] = useState(null)\n const [sourceProviderGroupingOptions, setSourceProviderGroupingOptions] = useState([])\n const [targetProviderGroupingOptions, setTargetProviderGroupingOptions] = useState([])\n const [sourceProviderGrouping, setSourceProviderGrouping] = useState(null)\n const [targetProviderGrouping, setTargetProviderGrouping] = useState(null)\n\n useEffect(() => {\n if (sourceOrganization) {\n const sourceCall = {\n method: 'get',\n url: '/root/provider_grouping_finder',\n dataType: 'json',\n contentType: 'application/json',\n data: { organization_id: sourceOrganization.id },\n }\n $.ajax(sourceCall)\n .done((response) => {\n setSourceProviderGroupingOptions(Array.isArray(response.provider_groupings) ? response.provider_groupings : [])\n })\n .fail((error) => {\n log({ title: 'Failed to fetch source provider groupings', className: 'CopyOrderPreferenceAndSubs', values: { call: sourceCall, error }, context: { sourceOrganization } })\n window.flash.error(`Error fetching Provider Groupings. ${error.responseJSON?.error}`, 5000)\n console.error(error)\n })\n }\n }, [sourceOrganization])\n\n useEffect(() => {\n if (targetOrganization) {\n const targetCall = {\n method: 'get',\n url: '/root/provider_grouping_finder',\n dataType: 'json',\n contentType: 'application/json',\n data: { organization_id: targetOrganization.id },\n }\n $.ajax(targetCall)\n .done((response) => {\n setTargetProviderGroupingOptions(Array.isArray(response.provider_groupings) ? response.provider_groupings : [])\n })\n .fail((error) => {\n log({ title: 'Failed to fetch target provider groupings', className: 'CopyOrderPreferenceAndSubs', values: { call: targetCall, error }, context: { targetOrganization } })\n window.flash.error(`Error fetching Provider Groupings. ${error.responseJSON?.error}`, 5000)\n console.error(error)\n })\n }\n }, [targetOrganization])\n\n const handleSubmit = () => {\n const copyCall = {\n method: 'POST',\n url: '/root/provider_grouping/copy_order_preferences_and_subscriptions',\n data: {\n source_provider_grouping_id: sourceProviderGrouping?.id,\n target_provider_grouping_id: targetProviderGrouping?.id,\n source_organization_id: sourceOrganization?.id,\n target_organization_id: targetOrganization?.id\n }\n }\n $.ajax(copyCall)\n .done(() => {\n flash.success('Order Preferences and Subscriptions successfully copied', 5000)\n })\n .fail((error) => {\n log({ title: 'Failed to copy order preferences and subscriptions', className: 'CopyOrderPreferenceAndSubs', values: { call: copyCall, error }, context: { sourceProviderGrouping, targetProviderGrouping } })\n window.flash.error(`Error copying Order Preferences and Subscriptions. ${error.responseJSON?.error}`, 5000)\n console.error(error)\n })\n }\n\n return (\n \n )\n}\n\nCopyOrderPreferenceAndSubs.propTypes = propTypes\n\nexport default CopyOrderPreferenceAndSubs\n","import React, { useState, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport Tooltip from \"@mui/material/Tooltip\"\nimport Autocomplete from '@mui/material/Autocomplete'\nimport TextField from '@mui/material/TextField'\nimport Checkbox from '@mui/material/Checkbox'\nimport { Button } from '@mui/material'\nimport log from '../../utilities/logger'\nimport FormControlLabel from '@mui/material/FormControlLabel'\n\nconst propTypes = {\n organizations: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n id: PropTypes.number.isRequired,\n })\n ).isRequired\n}\n\nconst CreateProviderGrouping = ({ organizations }) => {\n const [name, setName] = useState('')\n const [organization, setOrganization] = useState('')\n const [sourceOrganization, setSourceOrganization] = useState('')\n const [providerGroupingOptions, setProviderGroupingOptions] = useState([])\n const [sourceProviderGrouping, setSourceProviderGrouping] = useState('')\n const [copyOrderPrefsAndSubs, setcopyOrderPrefsAndSubs] = useState(false)\n\n const handleSubmit = event => {\n event.preventDefault()\n if (!name || !organization) {\n log({ title: 'Validation failed: missing required fields on create provider grouping', className: 'CreateProviderGrouping', context: { name, organization } })\n window.flash.error('Please fill in all required fields', 5000)\n return // Stop further submission logic\n }\n const formData = new FormData()\n formData.append(\"name\", name)\n formData.append(\"organization_id\", organization)\n formData.append(\"source_organization_id\", sourceOrganization)\n formData.append(\"source_provider_grouping_id\", sourceProviderGrouping.id)\n\n const createCall = { \n method: 'POST',\n url: '/root/provider_grouping/create',\n contentType: false,\n processData: false,\n data: formData\n }\n $.ajax(createCall)\n .done(() => {\n flash.success(`Provider Grouping '${name}' was successfully Created`)\n setTimeout(() => {\n window.location.reload()\n }, 2000)\n })\n .fail((error) => {\n const errorMsg = error.responseJSON?.error || 'Unknown error'\n const { data, ...callWithoutData } = createCall\n log({ title: 'Failed to create provider grouping', className: 'CreateProviderGrouping', values: { call: callWithoutData, error: errorMsg }, context: { name, organization } })\n flash.error(`Error creating your Provider Grouping. ${errorMsg}`)\n console.error(error)\n })\n }\n\n useEffect(() => {\n if (sourceOrganization) {\n const call = {\n method: 'get',\n url: '/root/provider_grouping_finder',\n dataType: 'json',\n contentType: 'application/json',\n data: { organization_id: sourceOrganization },\n }\n $.ajax(call)\n .done((response) => {\n setProviderGroupingOptions(Array.isArray(response.provider_groupings) ? response.provider_groupings : [])\n })\n .fail((error) => {\n log({ title: 'Failed to fetch provider groupings for source org', className: 'CreateProviderGrouping', values: { call, error }, context: { sourceOrganization } })\n window.flash.error(`Error fetching Provider Groupings. ${error.responseJSON?.error}`, 5000)\n console.error(error)\n })\n }\n}\n, [sourceOrganization])\n\n return (\n \n )\n}\n\nCreateProviderGrouping.propTypes = propTypes\n\nexport default CreateProviderGrouping","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Tabs, Tab, Box, Card, CardContent, Typography, Divider } from '@mui/material'\nimport EditNoteIcon from '@mui/icons-material/EditNote'\nimport AddBoxIcon from '@mui/icons-material/AddBox'\nimport CreateProviderGrouping from './createProviderGrouping'\nimport CopyOrderPreferenceAndSubs from './copyOrderPreferenceAndSubs'\n\nconst propTypes = {\n organizations: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n id: PropTypes.number.isRequired,\n })\n ).isRequired\n}\n\nconst Dashboard = ({ organizations }) => {\n const [activeTab, setActiveTab] = useState('create')\n\n const handleChange = (event, newValue) => {\n setActiveTab(newValue)\n }\n\n const renderContent = () => {\n switch (activeTab) {\n case 'create':\n return \n case 'edit':\n return \n default:\n return \n }\n }\n\n return (\n \n
\n \n Create Provider Group\n \n \n \n } iconPosition=\"start\" label=\"Create Provider Group\" value=\"create\" />\n } iconPosition=\"start\" label=\"Copy Order Preference And Subs\" value=\"edit\" />\n \n \n \n {renderContent()}\n \n \n \n
\n )\n}\n\nDashboard.propTypes = propTypes\n\nexport default Dashboard","import React, { useState } from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Alert from '@mui/material/Alert';\nimport Link from '@mui/material/Link';\nimport Select from '@mui/material/Select';\nimport MenuItem from '@mui/material/MenuItem';\nimport InputLabel from '@mui/material/InputLabel';\nimport FormControl from '@mui/material/FormControl';\nimport Autocomplete from '@mui/material/Autocomplete';\nimport theme from '../../theme/index';\n\nexport default function AthenaMeasureStatsForm({\n measureStat,\n submitPath,\n csrfToken,\n backPath,\n isNew,\n ruleGroupingOptions = [],\n measureShortNameOptions = [],\n ruleOptions = [],\n}) {\n const [fields, setFields] = useState({\n measureid: measureStat?.measureid || '',\n measureshortname: measureStat?.measureshortname || '',\n uuid: measureStat?.uuid || '',\n ruleGrouping: measureStat?.ruleGrouping || '',\n });\n const [error, setError] = useState(null);\n const [saving, setSaving] = useState(false);\n\n const handleChange = (e) => {\n const { name, value } = e.target;\n setFields((prev) => ({ ...prev, [name]: value }));\n };\n\n const selectedRule = ruleOptions.find((r) => r.uuid === fields.uuid) || null;\n\n const handleRuleChange = (_e, rule) => {\n setFields((prev) => ({ ...prev, uuid: rule?.uuid || '' }));\n };\n\n const handleSubmit = async (e) => {\n e.preventDefault();\n if (isNew && !fields.uuid) {\n setError('Select a rule for this measure stat.');\n return;\n }\n setSaving(true);\n setError(null);\n try {\n const resp = await fetch(submitPath, {\n method: isNew ? 'POST' : 'PUT',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRF-Token': csrfToken,\n },\n body: JSON.stringify({\n athena_measure_stat: {\n measureid: fields.measureid,\n measureshortname: fields.measureshortname,\n uuid: fields.uuid,\n rule_grouping: fields.ruleGrouping,\n },\n }),\n });\n if (resp.ok) {\n window.location.assign(backPath || '/root/athena/measure_stats');\n } else {\n const data = await resp.json().catch(() => ({}));\n setError(data.message || 'Failed to update measure stat.');\n }\n } catch {\n setError('Network error. Please try again.');\n } finally {\n setSaving(false);\n }\n };\n\n return (\n \n \n \n \n {backPath && (\n \n ← Back\n \n )}\n {isNew ? 'New Athena Measure Stat' : 'Update Athena Measure Stat'}\n \n {isNew ? 'Create a new measure stat.' : 'Update measure short name, measure id, and rule grouping.'}\n \n {error && {error}}\n \n \n \n setFields((prev) => ({ ...prev, measureshortname: value || '' }))}\n inputValue={fields.measureshortname}\n onInputChange={(_e, value) => setFields((prev) => ({ ...prev, measureshortname: value }))}\n sx={{ flex: '1 1 200px' }}\n renderInput={(params) => (\n \n )}\n />\n \n \n opt.name}\n getOptionKey={(opt) => opt.uuid}\n isOptionEqualToValue={(opt, val) => opt.uuid === val.uuid}\n renderOption={(props, opt) => {\n const { key, ...optionProps } = props;\n return (\n \n \n {opt.name}\n {opt.uuid}\n \n \n );\n }}\n disabled={!isNew}\n renderInput={(params) => (\n \n )}\n />\n \n \n \n \n \n \n Rule Grouping\n \n \n \n \n \n \n \n \n \n );\n}\n","import React from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport Button from '@mui/material/Button';\nimport Table from '@mui/material/Table';\nimport TableHead from '@mui/material/TableHead';\nimport TableBody from '@mui/material/TableBody';\nimport TableRow from '@mui/material/TableRow';\nimport TableCell from '@mui/material/TableCell';\nimport theme from '../../theme/index';\n\nexport default function AthenaMeasureStatsList({ measureStats, newPath }) {\n return (\n \n \n \n \n \n Athena Measure Stats\n\n {newPath && (\n \n )}\n \n \n \n \n MEASURE NAME\n MEASURE ID\n RULE NAME\n RULE UUID\n RULE GROUPING\n ACTION\n \n \n \n {(measureStats || []).map((ms) => (\n \n {ms.measureshortname}\n {ms.measureid}\n {ms.ruleName}\n {ms.uuid}\n {ms.ruleGrouping}\n \n \n \n \n ))}\n \n
\n \n \n \n \n );\n}\n","import React from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport Table from '@mui/material/Table';\nimport TableHead from '@mui/material/TableHead';\nimport TableBody from '@mui/material/TableBody';\nimport TableRow from '@mui/material/TableRow';\nimport TableCell from '@mui/material/TableCell';\nimport theme from '../../theme/index';\n\nexport default function OrderPreferenceReferencesList({ orderPreferenceReferences }) {\n return (\n \n \n \n \n Order Preferences\n \n \n \n RULE\n OPTIONS\n \n \n \n {(orderPreferenceReferences || []).map((opr, idx) => (\n \n {opr.rule}\n {opr.options}\n \n ))}\n \n
\n \n \n \n \n );\n}\n","import React, { useState } from 'react';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Link from '@mui/material/Link';\nimport Radio from '@mui/material/Radio';\nimport RadioGroup from '@mui/material/RadioGroup';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport FormLabel from '@mui/material/FormLabel';\nimport Divider from '@mui/material/Divider';\nimport Alert from '@mui/material/Alert';\n\nimport RuleFormTag from '../tags/ruleFormTag';\nimport RuleTypeOptions from '../rules/RuleTypeOptions';\nimport ValueSetAutocomplete from './rules/ValueSetAutocomplete';\nimport InsuranceValueSetAutocomplete from './rules/InsuranceValueSetAutocomplete';\nimport AlternativeMedicationAutocomplete from './rules/AlternativeMedicationAutocomplete';\nimport ChildFilterAutocomplete from './rules/ChildFilterAutocomplete';\nimport OrderCoverage from './rules/OrderCoverage';\n\n// ── Shared form header: navigation, title, description, errors ──────────────\nfunction RuleFormHeader({ backPath, ruleDetailsPath, isEdit, errors }) {\n return (\n <>\n {(backPath || ruleDetailsPath) && (\n \n {backPath && ← Back}\n {ruleDetailsPath && Rule Details}\n \n )}\n \n {isEdit ? 'Update Rule' : 'New Rule'}\n \n \n {isEdit ? 'Update rule name, description, and source' : 'Create a new rule'}\n \n {errors?.length > 0 && (\n \n \n {errors.map((msg, i) => - {msg}
)}\n
\n \n )}\n >\n );\n}\n\n// ── Action + Description fields shared by Guideline and MedSub sections ──────\nfunction RuleActionDescriptionFields({ rule }) {\n return (\n <>\n \n \n \n \n \n \n >\n );\n}\n\n// ── Tag + RuleTypeOptions fields shared by Guideline and MedSub sections ─────\nfunction RuleTagTypeFields({ notProduction, tags, tagsOnRule, ruleTypes, ruleType, orderPreferences, orderSet, targetValueSetName, formType }) {\n return (\n <>\n {notProduction && (\n \n \n \n )}\n \n \n \n >\n );\n}\n\n// ── Shared child-rule filters section ──────────────────────────────────────\nfunction ChildRuleFiltersSection({ rule, specialtyOptions, insuranceOptions }) {\n return (\n \n \n Child Rule Filters\n \n \n Configure filters to control when this child rule fires.\n Inclusion and exclusion filters are mutually exclusive.\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n\n// ── Guideline form section ─────────────────────────────────────────────────\nfunction GuidelineSection({\n rule, tags, tagsOnRule, ruleTypes, ruleType, orderPreferences, orderSet,\n targetValueSetName, formType, notProduction, isChildRule, specialtyOptions, insuranceOptions,\n}) {\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n {isChildRule && (\n \n )}\n >\n );\n}\n\n// ── Medication substitution form section ───────────────────────────────────\nfunction MedSubSection({\n rule, valueSetNames, insuranceValueSetNames, tags, tagsOnRule,\n ruleTypes, ruleType, orderPreferences, orderSet, targetValueSetName,\n formType, notProduction, alternativeMedication, organizationId,\n isChildRule, specialtyOptions, insuranceOptions,\n}) {\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Medication Pricing Table\n \n \n \n \n \n \n \n {isChildRule && (\n \n )}\n >\n );\n}\n\n// ── Main RootRuleForm component ────────────────────────────────────────────\nexport default function RootRuleForm(props) {\n const {\n rule,\n currentRule,\n valueSetRule,\n valueSetNames,\n insuranceValueSetNames,\n tags,\n tagsOnRule,\n ruleTypes,\n ruleType,\n orderPreferences,\n orderSet,\n targetValueSetName,\n formType: initialFormType,\n specialtyOptions,\n insuranceOptions,\n isEdit,\n isChildRule,\n toggleDisabled,\n notProduction,\n alternativeMedication,\n organizationId,\n submitPath,\n csrfToken,\n backPath,\n ruleDetailsPath,\n errors,\n } = props;\n\n const [formType, setFormType] = useState(initialFormType || 'guideline');\n\n // Order coverage form is fully self-contained — render it standalone\n if (formType === 'order_coverage') {\n return (\n \n \n \n \n {!isChildRule && !toggleDisabled && (\n \n Form Type\n setFormType(e.target.value)}\n >\n } label=\"Guideline\" />\n } label=\"Medication Substitution\" />\n } label=\"Order Coverage\" />\n \n \n )}\n \n \n \n \n );\n }\n\n return (\n \n \n \n \n\n \n \n {isEdit && }\n \n\n {/* Form type selector */}\n {!isChildRule && (\n \n Form Type\n !toggleDisabled && setFormType(e.target.value)}\n >\n }\n label=\"Guideline\"\n />\n }\n label=\"Medication Substitution\"\n />\n }\n label=\"Order Coverage\"\n />\n \n \n )}\n\n {isChildRule && (\n \n Inherited Rule Configuration\n \n )}\n\n {/* Form sections */}\n {formType === 'guideline' && (\n \n )}\n\n {formType === 'medication_substitution' && (\n \n )}\n\n \n \n \n \n \n \n \n );\n}\n","import React, { useState } from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport Button from '@mui/material/Button';\nimport Link from '@mui/material/Link';\nimport TextField from '@mui/material/TextField';\nimport Chip from '@mui/material/Chip';\nimport Divider from '@mui/material/Divider';\nimport theme from '../../theme/index';\n\nfunction RuleField({ label, value }) {\n if (!value && value !== 0) { return null; }\n return (\n \n \n {label}:\n \n {value}\n \n );\n}\n\nfunction ChildRuleFilters({ rule }) {\n const filters = [\n { label: 'Specialty Inclusion', value: rule.specialtyInclusion },\n { label: 'Specialty Exclusion', value: rule.specialtyExclusion },\n { label: 'Insurance Inclusion', value: rule.insuranceValueSet },\n { label: 'Insurance Exclusion', value: rule.insuranceExclusion },\n { label: 'External Rule Inclusion', value: rule.externalRuleInclusion },\n { label: 'External Rule Exclusion', value: rule.externalRuleExclusion },\n ].filter((f) => f.value);\n\n if (!filters.length) { return null; }\n return (\n \n Child Rule Filters:\n {filters.map((f) => (\n \n ))}\n \n );\n}\n\nexport default function RootRuleShow({\n rule,\n childRules,\n backPath,\n editPath,\n editOrderPreferencePath,\n newOrderPreferencePath,\n hasDefaultOrderPreference,\n createChildRulePath,\n csrfToken,\n}) {\n const [childRuleSuffix, setChildRuleSuffix] = useState('');\n\n return (\n \n \n \n \n {/* Navigation row */}\n \n \n ← Back to Rules\n Edit\n \n \n {hasDefaultOrderPreference ? (\n Edit Default Order Preference\n ) : (\n Add Default Order Preference\n )}\n \n \n\n {/* Rule header */}\n \n \n {rule.name}\n {rule.isChildRule && (\n \n ↳ Child Rule of:\n {rule.parentRuleName && rule.parentRulePath ? (\n {rule.parentRuleName}\n ) : (\n Parent rule not found\n )}\n \n )}\n {rule.isChildRule && (\n \n Parent UUID: {rule.parentRuleUuid}\n \n )}\n \n\n {/* Create child rule form */}\n {rule.isParentRule && createChildRulePath && (\n \n \n setChildRuleSuffix(e.target.value)}\n />\n \n \n )}\n \n\n {/* Rule fields */}\n \n \n \n \n {rule.isChildRule && }\n \n\n {/* Child rules list */}\n {rule.isParentRule && childRules?.length > 0 && (\n <>\n \n Child Rules\n \n {childRules.map((child) => (\n \n \n \n {child.name}\n \n \n UUID: {child.uuid}\n \n \n \n {child.hasFilters && }\n \n \n \n \n ))}\n \n >\n )}\n \n \n \n \n );\n}\n","import React, { useState } from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Alert from '@mui/material/Alert';\nimport Link from '@mui/material/Link';\nimport theme from '../../theme/index';\n\nexport default function RootValueSetEditForm({ valueSet, submitPath, csrfToken, backPath }) {\n const [fields, setFields] = useState({\n valueSetName: valueSet?.valueSetName || '',\n description: valueSet?.description || '',\n code: valueSet?.code || '',\n codeSystem: valueSet?.codeSystem || '',\n });\n const [error, setError] = useState(null);\n const [saving, setSaving] = useState(false);\n\n const handleChange = (e) => {\n const { name, value } = e.target;\n setFields((prev) => ({ ...prev, [name]: value }));\n };\n\n const handleSubmit = async (e) => {\n e.preventDefault();\n setSaving(true);\n setError(null);\n try {\n const resp = await fetch(submitPath, {\n method: 'PUT',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRF-Token': csrfToken,\n },\n body: JSON.stringify({\n value_set: {\n value_set_name: fields.valueSetName,\n description: fields.description,\n code: fields.code,\n code_system: fields.codeSystem,\n },\n }),\n });\n if (resp.redirected) {\n window.location.assign(resp.url);\n } else if (resp.ok) {\n window.location.assign(backPath || '/root/value_sets');\n } else {\n setError('Failed to update value set. Please try again.');\n }\n } catch {\n setError('Network error. Please try again.');\n } finally {\n setSaving(false);\n }\n };\n\n return (\n \n \n \n \n {backPath && (\n \n ← Back\n \n )}\n Edit Value Set\n {error && {error}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n","import React, { useState } from 'react';\nimport { ThemeProvider } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Alert from '@mui/material/Alert';\nimport theme from '../../theme/index';\nimport NewValueSet from '../NewValueSet/index';\n\nexport default function RootValueSetNewForm({ submitPath, csrfToken, flashError }) {\n const [valueSetName, setValueSetName] = useState('');\n const [error, setError] = useState(flashError || null);\n\n return (\n \n \n \n \n Add New Value Sets\n {error && {error}}\n \n \n \n setValueSetName(e.target.value)}\n fullWidth\n variant=\"standard\"\n />\n \n {/* Hidden field that NewValueSet/index writes selected value sets to via jQuery */}\n \n \n \n \n \n \n \n \n \n \n );\n}\n","import React, { useState, useEffect, useMemo } from 'react'\nimport { TextField } from '@mui/material'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport { debounce } from 'lodash'\n\nexport default function AcceptedValueSetAutocomplete({ target_value_set_name, onTargetValueSetNameChange }) {\n const [options, setOptions] = useState([])\n // Controlled by the parent so the value survives switching between rule type editors\n const value = target_value_set_name || ''\n const setValue = onTargetValueSetNameChange\n\n useEffect(() => {\n const hiddenInput = document.querySelector('input[name=\"rule[target_value_set_name]\"]')\n if (hiddenInput) {\n hiddenInput.value = value || ''\n }\n }, [value])\n\n const searchValueSets = useMemo(() => debounce((query) => {\n if (query.length >= 3) {\n $.ajax({\n method: 'GET',\n url: '/root/value_sets_name_search',\n data: { query },\n })\n .done((response) => {\n setOptions(response)\n })\n .fail((error) => {\n console.error(error)\n })\n } else {\n setOptions([])\n }\n }, 300), [])\n\n const getOptionLabel = (option) => option\n\n return (\n <>\n (\n \n )}\n value={value}\n inputValue={value}\n onInputChange={(_event, newInputValue) => {\n setValue(newInputValue)\n searchValueSets(newInputValue)\n }}\n onChange={(_event, newValue) => setValue(newValue || '')}\n />\n \n >\n )\n}\n","import PropTypes from 'prop-types'\nimport React, { useState } from 'react'\nimport { algoliasearch } from 'algoliasearch'\nimport Autocomplete from '@mui/material/Autocomplete'\n\nimport { TextField } from '@mui/material'\n\nconst propTypes = {\n alternative_medication: PropTypes.string.isRequired,\n organization_id: PropTypes.number.isRequired,\n}\n\nconst AlternativeMedicationAutocomplete = ({\n alternative_medication,\n organization_id,\n}) => {\n const [options, setOptions] = useState([])\n const [alternativeMedication, setAlternativeMedication] = useState(\n alternative_medication\n )\n\n const getOptionLabel = (option) => option\n\n const getDict = (query) => {\n const client = algoliasearch(\n 'Q5ZBLQF81V',\n 'df6aba0fce0130170bd701c1b4089506'\n )\n\n const queries = [\n {\n indexName: 'AthenaOrderCode',\n query,\n hitsPerPage: 35,\n },\n {\n indexName: 'AthenaOrderSet',\n query,\n hitsPerPage: 5,\n filters: `organization_id=${organization_id}`,\n },\n ]\n\n const searchCallback = (content) => {\n const orderCodesResults = content.results[0]\n const orderSetsResults = content.results[1]\n\n if (\n orderCodesResults.hits.length > 0 ||\n orderSetsResults.hits.length > 0\n ) {\n const orderSetNames = orderSetsResults.hits.map((hit) => hit.name)\n const orderCodesNames = orderCodesResults.hits.map((hit) => hit.name)\n const newOptions = orderSetNames.concat(orderCodesNames)\n setOptions(newOptions)\n }\n }\n\n client.search({ requests: queries })\n .then(searchCallback)\n .catch((err) => {\n if (err) {\n console.error(err)\n }\n })\n }\n\n const handleChange = (event) => {\n const { value } = event.target\n getDict(value)\n }\n\n return (\n <>\n (\n \n )}\n value={alternativeMedication}\n filterSelectedOptions\n onChange={(_event, value, reason) => {\n if (reason === 'selectOption') {\n setAlternativeMedication(value)\n }\n }}\n />\n \n >\n )\n}\n\nAlternativeMedicationAutocomplete.propTypes = propTypes\n\nexport default AlternativeMedicationAutocomplete\n","import React, { useState } from 'react'\nimport { TextField } from '@mui/material'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport PropTypes from 'prop-types'\n\nexport default function ChildFilterAutocomplete({ name, label, helperText = '', options, initialValue = '', pairedFieldId = null }) {\n const [value, setValue] = useState(initialValue || '')\n\n const handleChange = (_event, newValue) => {\n setValue(newValue || '')\n \n // Clear the paired field if a value is selected (mutual exclusivity)\n if (newValue && pairedFieldId) {\n const pairedField = document.getElementById(pairedFieldId)\n if (pairedField) {\n // Trigger React state update if it's a React component\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set\n nativeInputValueSetter.call(pairedField, '')\n pairedField.dispatchEvent(new Event('input', { bubbles: true }))\n }\n }\n }\n\n return (\n <>\n option || ''}\n value={value}\n onChange={handleChange}\n onInputChange={(_event, newInputValue) => setValue(newInputValue || '')}\n renderInput={(params) => (\n \n )}\n />\n \n >\n );\n}\n\nChildFilterAutocomplete.propTypes = {\n name: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n helperText: PropTypes.string,\n options: PropTypes.arrayOf(PropTypes.string).isRequired,\n initialValue: PropTypes.string,\n pairedFieldId: PropTypes.string\n}\n\n\n","import React, { useState } from 'react'\nimport Autocomplete from '@mui/material/Autocomplete'\n\nimport { TextField, Chip } from '@mui/material'\n\nconst InsuranceValueSetAutocomplete = (props) => {\n const [options, setOptions] = useState([])\n const [values, setValues] = useState(props.insurance_value_set_names)\n\n const handleChange = (event) => {\n const { value } = event.target\n if (value.length >= 3) {\n $.ajax({\n method: 'GET',\n url: '/root/value_sets_name_search',\n data: { query: value, code_system: \"INSURANCE\" }\n })\n .done((response) => {\n setOptions(response)\n })\n .fail((error) => {\n console.error(error)\n })\n } else {\n setOptions([])\n }\n }\n\n const getOptionLabel = (option) => option\n\n return (\n <>\n (\n \n )}\n value={values}\n filterSelectedOptions\n renderTags={(_, getTagProps) => {\n return values.map((name, index) => (\n {\n setValues(values.filter((v) => v !== name))\n }}\n />\n ))\n }}\n onChange={(_event, value, reason) => {\n if (reason === 'selectOption') {\n const v = value[value.length - 1]\n setValues([...values, v])\n }\n }}\n />\n \n >\n )\n}\n\nexport default InsuranceValueSetAutocomplete","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import React, { useState, useRef } from 'react'\nimport { v4 as uuidv4 } from 'uuid'\nimport { Autocomplete, TextField, Chip, Grid, Typography, Box, Alert, Button } from '@mui/material'\nimport PropTypes from 'prop-types'\nimport RuleFormTag from '../../tags/ruleFormTag'\n\nexport default function OrderCoverage({ \n rule, \n valueSetRule, \n initialInsuranceValueSetNames = [], \n tagsOptions, \n initialRuleTags = [], \n notProduction,\n specialtyOptions = [],\n insuranceOptions = []\n}) {\n const editRule = !!rule\n const ruleLink = 'https://app.avhana.com/diagnosis_codes?insurance={insurance_value_set}&order={order_value_set}&card_uuid={card_uuid}'\n const uuid = editRule ? rule.uuid : uuidv4()\n const ruleCategory = \"order_coverage\"\n const ruleType = \"order_coverage\"\n const active = \"false\"\n const medicationSubstitution = \"false\"\n\n const [name, setName] = useState(editRule ? rule.name : '')\n const [action, setAction] = useState(editRule ? rule.action : '')\n const [description, setDescription] = useState(editRule ? rule.description : '')\n const [source, setSource] = useState(editRule ? rule.source : '')\n const [link, setLink] = useState(editRule ? rule.link : ruleLink)\n \n const [orderValueSetOptions, setOrderValueSetOptions] = useState([])\n const [orderValueSetName, setOrderValueSetName] = useState(editRule ? valueSetRule.value_set_name : null)\n \n const [diagnosisValueSetOptions, setDiagnosisValueSetOptions] = useState([])\n const [diagnosisValueSetName, setDiagnosisValueSetName] = useState(editRule ? valueSetRule.diagnosis_value_set_name : null)\n \n const [clinicalProviderValueSetOptions, setClinicalProviderValueSetOptions] = useState([])\n const [clinicalProviderValueSetName, setClinicalProviderValueSetName] = useState(editRule ? valueSetRule.clinical_provider_value_set_name : null)\n \n const [insuranceValueSetSearchOptions, setInsuranceValueSetSearchOptions] = useState([])\n const [insuranceValueSetNames, setInsuranceValueSetNames] = useState(editRule ? initialInsuranceValueSetNames : [])\n\n const showChildFilters = editRule && (rule.is_child_rule || rule.parent_rule_uuid)\n \n const [specialtyInclusion, setSpecialtyInclusion] = useState(editRule ? rule.specialty_inclusion : null)\n const [specialtyExclusion, setSpecialtyExclusion] = useState(editRule ? rule.specialty_exclusion : null)\n \n const [childInsuranceInclusion, setChildInsuranceInclusion] = useState(editRule ? rule.insurance_value_set : null)\n const [childInsuranceExclusion, setChildInsuranceExclusion] = useState(editRule ? rule.insurance_exclusion : null)\n \n const [externalRuleInclusion, setExternalRuleInclusion] = useState(editRule ? rule.external_rule_inclusion : '')\n const [externalRuleExclusion, setExternalRuleExclusion] = useState(editRule ? rule.external_rule_exclusion : '')\n\n const [filterErrors, setFilterErrors] = useState({\n specialty: null,\n insurance: null,\n externalRule: null\n })\n \n const ruleFormTagRef = useRef(null)\n\n // Validate that inclusion and exclusion filters are mutually exclusive\n const validateFilters = () => {\n const errors = {\n specialty: null,\n insurance: null,\n externalRule: null\n }\n \n if (specialtyInclusion && specialtyExclusion) {\n errors.specialty = \"Specialty inclusion and exclusion filters are mutually exclusive. Please select only one.\"\n }\n \n if (childInsuranceInclusion && childInsuranceExclusion) {\n errors.insurance = \"Insurance inclusion and exclusion filters are mutually exclusive. Please select only one.\"\n }\n \n if (externalRuleInclusion && externalRuleExclusion) {\n errors.externalRule = \"External rule inclusion and exclusion filters are mutually exclusive. Please select only one.\"\n }\n \n setFilterErrors(errors)\n return !errors.specialty && !errors.insurance && !errors.externalRule\n }\n\n const handleAutocompleteSearch = (value, codeSystem, setOptionsCallback) => {\n if (value.length >= 3) {\n $.ajax({\n method: 'GET',\n url: '/root/value_sets_name_search',\n data: { query: value, code_system: codeSystem },\n })\n .done((response) => {\n setOptionsCallback(response)\n })\n .fail((error) => {\n console.error(error)\n })\n } else {\n setOptionsCallback([])\n }\n }\n\n const handleOrderValueSetChange = (e) => handleAutocompleteSearch(e.target.value, \"ATHENA_ORDER_TYPE\", setOrderValueSetOptions)\n const handleDiagnosisValueSetChange = (e) => handleAutocompleteSearch(e.target.value, \"ICD10CM\", setDiagnosisValueSetOptions)\n const handleInsuranceValueSetChange = (e) => handleAutocompleteSearch(e.target.value, \"INSURANCE\", setInsuranceValueSetSearchOptions)\n const handleClinicalProviderValueSetChange = (e) => handleAutocompleteSearch(e.target.value, \"ATHENA_CLINICAL_PROVIDER\", setClinicalProviderValueSetOptions)\n \n const getOptionLabel = (option) => option\n\n const createRule = (formData) => {\n $.ajax({\n method: 'POST',\n url: '/root/rules',\n contentType: false,\n processData: false,\n data: formData,\n })\n .done((response) => {\n if (response.rule_id) {\n window.location.href = `/root/rules/${response.rule_id}`\n } else {\n console.error('rule_id not found in response')\n }\n })\n .fail((error) => {\n console.error(`Error creating your order coverage rule. ${error}`)\n })\n }\n\n const updateRule = (formData) => {\n $.ajax({\n method: 'PUT',\n url: `/root/rules/${rule.id}`,\n contentType: false,\n processData: false,\n data: formData,\n })\n .done(() => {\n window.location.href = `/root/rules`\n })\n .fail((error) => {\n console.error(`Error updating your order coverage rule ${rule.id}. ${error}`)\n })\n }\n\n const handleSubmit = event => {\n event.preventDefault()\n \n // Validate child filters before submission\n if (showChildFilters && !validateFilters()) {\n return\n }\n \n const formData = new FormData()\n formData.append(\"rule[name]\", name)\n formData.append(\"rule[rule_action]\", action)\n formData.append(\"rule[description]\", description)\n formData.append(\"rule[source]\", source)\n formData.append(\"rule[link]\", link)\n formData.append(\"rule[rule_type]\", ruleType)\n formData.append(\"rule[active]\", active)\n formData.append(\"rule[medication_substitution]\", medicationSubstitution)\n formData.append(\"rule[uuid]\", uuid)\n formData.append(\"rule[rule_category]\", ruleCategory)\n formData.append(\"rule[order_value_set_name]\", orderValueSetName)\n formData.append(\"rule[diagnosis_value_set_name]\", diagnosisValueSetName)\n formData.append(\"rule[clinical_provider_value_set_name]\", clinicalProviderValueSetName)\n formData.append(\"rule[insurance_value_set_names]\", insuranceValueSetNames)\n if (showChildFilters) {\n if (specialtyInclusion) formData.append(\"rule[specialty_inclusion]\", specialtyInclusion)\n if (specialtyExclusion) formData.append(\"rule[specialty_exclusion]\", specialtyExclusion)\n if (childInsuranceInclusion) formData.append(\"rule[insurance_value_set]\", childInsuranceInclusion)\n if (childInsuranceExclusion) formData.append(\"rule[insurance_exclusion]\", childInsuranceExclusion)\n if (externalRuleInclusion) formData.append(\"rule[external_rule_inclusion]\", externalRuleInclusion)\n if (externalRuleExclusion) formData.append(\"rule[external_rule_exclusion]\", externalRuleExclusion)\n }\n\n if (ruleFormTagRef.current) {\n const { ruleTags, additions, removals } = ruleFormTagRef.current.getTagsData()\n formData.append(\"rule[tags]\", JSON.stringify({ tags: ruleTags, add_tags: additions, remove_tags: removals }))\n }\n\n if (valueSetRule) {\n updateRule(formData)\n } else {\n createRule(formData)\n }\n }\n\n return (\n \n )\n}\n\nconst TAG = PropTypes.shape({\n id: PropTypes.number,\n name: PropTypes.string,\n})\n\nOrderCoverage.propTypes = {\n rule: PropTypes.object,\n valueSetRule: PropTypes.object,\n initialInsuranceValueSetNames: PropTypes.arrayOf(PropTypes.string),\n initialRuleTags: PropTypes.arrayOf(TAG),\n tagsOptions: PropTypes.arrayOf(TAG).isRequired,\n notProduction: PropTypes.bool.isRequired,\n specialtyOptions: PropTypes.arrayOf(PropTypes.string),\n insuranceOptions: PropTypes.arrayOf(PropTypes.string)\n}","import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport AthenaOrderPrefTypeaheadBasic from '../reusableComponents/AthenaOrderPrefTypeaheadBasic'\n\nclass OrderPreferenceReferenceForm extends Component {\n constructor(props) {\n super(props)\n this.state = {\n orderFields: {},\n }\n\n this.handleSubmit = this.handleSubmit.bind(this)\n this.optionSelected = this.optionSelected.bind(this)\n }\n\n handleSubmit(evt) {\n const { crudMethod, ruleId, id } = this.props\n const { orderFields } = this.state\n evt.preventDefault()\n evt.stopPropagation()\n\n const url = crudMethod === 'post'\n ? `/root/rules/${ruleId}/order_preference_references`\n : `/root/rules/${ruleId}/order_preference_references/${id}`\n\n $.ajax({\n method: crudMethod,\n url,\n data: {\n order_preference_reference: {\n order: orderFields,\n },\n },\n })\n .done(() => {\n window.flash.success('Successfully updated!', 50000)\n })\n .fail((err) => {\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n flash.error('Error updating your Order Preference Reference. Contact support@amalgamrx.com if you need further assistance.')\n console.error(err)\n }\n })\n }\n\n optionSelected(typeaheadObject) {\n const newOrderFields = {\n order_name: typeaheadObject.name,\n order_type: typeaheadObject.order_type,\n order_type_id: typeaheadObject.ordertypeid,\n }\n\n this.setState({ orderFields: newOrderFields })\n }\n\n render() {\n return (\n \n )\n }\n}\n\nOrderPreferenceReferenceForm.propTypes = {\n crudMethod: PropTypes.string.isRequired,\n ruleId: PropTypes.number.isRequired,\n id: PropTypes.number,\n}\n\nOrderPreferenceReferenceForm.defaultProps = {\n id: null,\n}\n\nOrderPreferenceReferenceForm.propTypes = {\n crudMethod: PropTypes.string,\n id: PropTypes.number,\n ruleId: PropTypes.number,\n}\n\nexport default OrderPreferenceReferenceForm\n\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport OrderPreferenceReferenceForm from '../../../orderPreferenceReference/orderPreferenceReferenceForm'\n\nconst OrderPreferenceRefPage = ({ crudMethod, id = null, ruleId, ruleName, backPath }) => (\n \n
\n
\n
Back\n
\n {crudMethod === 'post'\n ? `Create A New Order Preference ${ruleName}`\n : `Edit The Default Order Preference for ${ruleName}`}\n
\n {crudMethod === 'put' && (\n
Editing does NOT update or change at the organization level\n )}\n
\n
\n
\n
\n)\n\nOrderPreferenceRefPage.propTypes = {\n crudMethod: PropTypes.string.isRequired,\n id: PropTypes.number,\n ruleId: PropTypes.number.isRequired,\n ruleName: PropTypes.string.isRequired,\n backPath: PropTypes.string.isRequired,\n}\n\nexport default OrderPreferenceRefPage\n","import React, { useState } from 'react'\nimport { Chip, TextField } from '@mui/material'\nimport Autocomplete from '@mui/material/Autocomplete'\n\nexport default function ValueSetAutocomplete(props) {\n const [options, setOptions] = useState([])\n const [values, setValues] = useState(props.value_set_names)\n\n const handleChange = (event) => {\n const { value } = event.target\n if (value.length >= 3) {\n $.ajax({\n method: 'GET',\n url: '/root/value_sets_name_search',\n data: { query: value },\n })\n .done((response) => {\n setOptions(response)\n })\n .fail((error) => {\n console.error(error)\n })\n } else {\n setOptions([])\n }\n }\n\n const getOptionLabel = (option) => option\n\n return (\n <>\n (\n \n )}\n value={values}\n filterSelectedOptions\n renderTags={(_, getTagProps) => {\n return values.map((name, index) => (\n {\n setValues(values.filter((v) => v !== name))\n }}\n />\n ))\n }}\n onChange={(_event, value, reason) => {\n if (reason === 'selectOption') {\n // Internal value list for autocomplete is a list we can't prune.\n // Just get last value.\n const v = value[value.length - 1]\n setValues([...values, v])\n }\n }}\n />\n \n >\n )\n}\n","import React, { useRef, useState, useCallback, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { Grid, IconButton, Box } from '@mui/material'\nimport { Clear as ClearIcon } from '@mui/icons-material'\nimport TextField from '@mui/material/TextField'\n\nconst propTypes = {\n action: PropTypes.string,\n defaultAction: PropTypes.string,\n updateAction: PropTypes.func.isRequired,\n ordersEnabledUi: PropTypes.bool.isRequired,\n}\n\nconst isBlank = (value) => value === '' || value === null || value === undefined\n\nconst ActionEditor = ({ editableAction, handleBlur, handleChange, defaultAction, textarea }) => (\n \n)\n\nconst ActionDisplay = ({\n displayAction,\n isUsingDefault,\n defaultAction,\n ordersEnabledUi,\n handleClick,\n handleKeyDown,\n handleClear,\n}) => (\n \n \n {displayAction || 'Click to add action...'}\n
\n {!isUsingDefault && ordersEnabledUi && (\n \n \n \n )}\n \n)\n\nconst Action = ({ action='', defaultAction='', updateAction, ordersEnabledUi }) => {\n const [editing, setEditing] = useState(isBlank(action) && !defaultAction)\n const [editableAction, setEditableAction] = useState(action || '')\n const textarea = useRef(null)\n\n // Derive from local state so clear takes effect immediately, before the prop updates\n const isUsingDefault = isBlank(editableAction)\n const displayAction = isUsingDefault ? defaultAction : editableAction\n\n useEffect(() => {\n setEditableAction(action || '')\n }, [action])\n\n const openEditor = useCallback(() => {\n if (!ordersEnabledUi) {\n setEditing(false)\n return\n }\n\n setEditing(true)\n setTimeout(() => textarea.current?.focus(), 300)\n }, [ordersEnabledUi])\n\n const handleClick = (event) => {\n if (editing) {\n return\n }\n\n event.preventDefault()\n openEditor()\n }\n\n const handleClear = (event) => {\n event.stopPropagation()\n setEditableAction('')\n updateAction('')\n setEditing(false)\n }\n\n const handleBlur = () => {\n setEditing(false)\n updateAction(editableAction)\n }\n\n const handleChange = (event) => {\n setEditableAction(event.target.value)\n }\n\n const handleKeyDown = (event) => {\n if (event.key !== 'Enter' || editing) {\n return\n }\n\n event.preventDefault()\n openEditor()\n }\n\n const content = editing\n ? (\n \n )\n : (\n \n )\n\n return (\n \n \n Action\n \n \n { content }\n \n \n )\n}\n\nAction.propTypes = propTypes\n\nActionEditor.propTypes = {\n editableAction: PropTypes.string.isRequired,\n handleBlur: PropTypes.func.isRequired,\n handleChange: PropTypes.func.isRequired,\n defaultAction: PropTypes.string,\n textarea: PropTypes.any,\n}\n\nActionDisplay.propTypes = {\n displayAction: PropTypes.string,\n isUsingDefault: PropTypes.bool.isRequired,\n defaultAction: PropTypes.string,\n ordersEnabledUi: PropTypes.bool.isRequired,\n handleClick: PropTypes.func.isRequired,\n handleKeyDown: PropTypes.func.isRequired,\n handleClear: PropTypes.func.isRequired,\n}\n\nexport default Action\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport * as R from 'ramda'\n\nconst AddOrderButton = ({ orderPreference, sviOrderPreferenceCallback, sviOrderPreference = null }) => {\n const ordersPath = R.lensPath(['options', 'orders'])\n const orders = R.view(ordersPath, orderPreference) || []\n \n const onClick = () => {\n const lastOrder = orders[orders.length - 1]\n if (lastOrder && !lastOrder.order_name && !lastOrder.order_type_id && !lastOrder.order_type) return\n const updatedOrderPreference = R.set(ordersPath, [...orders, {}], orderPreference)\n \n // Always pass the updated preference that includes the svi context\n sviOrderPreferenceCallback(updatedOrderPreference.options)\n }\n \n return \n}\n\nAddOrderButton.propTypes = {\n orderPreference: PropTypes.shape({\n options: PropTypes.shape({\n selections: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n orders: PropTypes.arrayOf(PropTypes.shape({})),\n }),\n }).isRequired,\n sviOrderPreferenceCallback: PropTypes.func.isRequired,\n sviOrderPreference: PropTypes.shape({\n options: PropTypes.shape({\n orders: PropTypes.arrayOf(PropTypes.shape()),\n order_set: PropTypes.bool\n })\n })\n}\n\nexport default AddOrderButton","import React, { useState, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport { path } from 'ramda'\nimport { RuleContext } from './rulesList'\nimport FormControl from '@mui/material/FormControl'\nimport InputLabel from '@mui/material/InputLabel'\nimport Select from '@mui/material/Select'\nimport MenuItem from '@mui/material/MenuItem'\nimport Chip from '@mui/material/Chip'\nimport Box from '@mui/material/Box'\nimport Accordion from '@mui/material/Accordion'\nimport AccordionSummary from '@mui/material/AccordionSummary'\nimport AccordionDetails from '@mui/material/AccordionDetails'\nimport Button from '@mui/material/Button'\nimport Dialog from '@mui/material/Dialog'\nimport DialogTitle from '@mui/material/DialogTitle'\nimport DialogContent from '@mui/material/DialogContent'\nimport DialogActions from '@mui/material/DialogActions'\nimport Typography from '@mui/material/Typography'\nimport CircularProgress from '@mui/material/CircularProgress'\nimport Table from '@mui/material/Table'\nimport TableBody from '@mui/material/TableBody'\nimport TableCell from '@mui/material/TableCell'\nimport TableContainer from '@mui/material/TableContainer'\nimport TableHead from '@mui/material/TableHead'\nimport TableRow from '@mui/material/TableRow'\n\nimport AllscriptsOrderPrefTypeahead from '../../reusableComponents/AllscriptsOrderPrefTypeahead'\nimport DiagnosisTypeahead from '../../reusableComponents/DiagnosisTypeahead'\nimport { Rule, Styles } from '../../athenaTypes'\n\nconst propTypes = {\n rule: Rule.isRequired,\n sviSubscriptionCallback: PropTypes.func.isRequired,\n style: Styles.isRequired,\n updateSviOrderPreferenceState: PropTypes.func.isRequired,\n orgId: PropTypes.number,\n orgName: PropTypes.string,\n isShadowMode: PropTypes.bool,\n}\n\nconst styles = {\n collapsibleHeader: {\n lineHeight: '2em',\n padding: '1.5em 1em',\n },\n chipContainer: {\n paddingLeft: '0.5em',\n },\n chip: {\n backgroundColor: '#f2f2f2',\n fontSize: '12px',\n },\n ruleNameSpan: {\n paddingLeft: '1em',\n fontSize: '17px',\n },\n noPadding: { padding: '0' },\n}\n\nconst DEFAULT_ORDER_DISPLAY_TEXT = 'No follow up action is currently associated with this guideline'\n\nconst getOrderDisplayTextFromRule = (rule) => {\n const orderPrefName = path(['order_preference', 'options', 'entry_name'], rule)\n return orderPrefName ? `Order ${orderPrefName}` : DEFAULT_ORDER_DISPLAY_TEXT\n}\n\nconst getDiagnosisNameFromRule = (rule) => {\n const diagnosisNameFromDb = path(['order_preference', 'options', 'diagnosis_name'], rule)\n return diagnosisNameFromDb || path(['snomed_diagnosis_name'], rule)\n}\n\nconst CurrentDiagnosisDisplay = ({ ruleType, diagnosisName }) => {\n if (ruleType === 'remove') {\n return null\n }\n\n return (\n \n \n Orders using diagnosis code\n {' '}\n {diagnosisName}\n \n \n )\n}\n\nconst PreferenceSection = ({ rule, updateDiagnosisName, updateOrderPrefName, updateSviOrderPreferenceState }) => {\n const orderPreference = rule.order_preference\n if (!orderPreference) {\n return (\n \n \n Follow Up Action
\n \n \n {DEFAULT_ORDER_DISPLAY_TEXT}
\n \n \n )\n }\n\n return (\n \n
\n \n Follow Up Action
\n \n \n \n \n \n
\n \n Diagnosis
\n \n \n \n \n \n
\n )\n}\n\nconst ShadowCollectionsButton = ({ isShadowMode, hasSubscription, onClick }) => {\n if (!isShadowMode) {\n return null\n }\n\n return (\n \n \n \n )\n}\n\nconst SubscriptionCollectionsDialog = ({\n open,\n onClose,\n ruleUuid,\n orgName,\n collectionsLoading,\n collectionsError,\n subscriptionCollections,\n}) => {\n const hasCollections = !collectionsLoading && !collectionsError && subscriptionCollections.length > 0\n const showEmptyState = !collectionsLoading && !collectionsError && subscriptionCollections.length === 0\n\n return (\n \n )\n}\n\nconst AllscriptsRule = ({ rule, sviSubscriptionCallback, style, index, updateSviOrderPreferenceState, orgId = null, orgName = '', isShadowMode = false }) => {\n const [orderDisplayText, setOrderDisplayText] = useState(DEFAULT_ORDER_DISPLAY_TEXT)\n const [diagnosisName, setDiagnosisName] = useState('')\n const [isExpanded, setIsExpanded] = useState(false)\n const [collectionsDialogOpen, setCollectionsDialogOpen] = useState(false)\n const [collectionsLoading, setCollectionsLoading] = useState(false)\n const [collectionsError, setCollectionsError] = useState('')\n const [subscriptionCollections, setSubscriptionCollections] = useState([])\n const hasSubscription = Boolean(rule.subscription?.id)\n const { setSize } = React.useContext(RuleContext)\n const header = React.useRef()\n const body = React.useRef()\n\n const handleClick = () => {\n setIsExpanded(prev => !prev)\n setTimeout(() => {\n const headerHeight = header.current?.getBoundingClientRect().height ?? 0\n const bodyHeight = body.current?.getBoundingClientRect().height ?? 0\n const newHeight = bodyHeight > 100\n ? headerHeight + bodyHeight + 20\n : headerHeight\n setSize(index, newHeight)\n }, 300)\n }\n\n React.useEffect(() => {\n setOrderDisplayText(getOrderDisplayTextFromRule(rule))\n setDiagnosisName(getDiagnosisNameFromRule(rule))\n })\n\n const updateOrderPrefName = (_, newOrderPrefOption) => {\n const orderPrefName = path(['entry_name'], newOrderPrefOption)\n setOrderDisplayText(orderPrefName ? `Order ${orderPrefName}` : DEFAULT_ORDER_DISPLAY_TEXT)\n }\n\n const updateDiagnosisName = (_, diagnosisNameObject) => {\n setDiagnosisName(diagnosisNameObject.diagnosis_name)\n }\n\n const handleSelect = ({ target }) => {\n const subscriptionId = rule.subscription.id\n const activeSilent = target.value\n sviSubscriptionCallback(subscriptionId, activeSilent)\n }\n\n const fetchSubscriptionCollections = useCallback(async () => {\n setCollectionsLoading(true)\n setCollectionsError('')\n try {\n const response = await fetch(`/admin/rules/subscribed_collections_for_rule?rule_uuid=${encodeURIComponent(rule.uuid)}`, {\n headers: {\n Accept: 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n },\n credentials: 'same-origin',\n })\n\n const data = await response.json()\n if (!response.ok) {\n throw new Error(data?.error || `Request failed with status ${response.status}`)\n }\n\n setSubscriptionCollections(Array.isArray(data.collections) ? data.collections : [])\n } catch (error) {\n setCollectionsError(error.message || 'Unable to load collections')\n setSubscriptionCollections([])\n } finally {\n setCollectionsLoading(false)\n }\n }, [rule.uuid])\n\n const openCollectionsDialog = async () => {\n setCollectionsDialogOpen(true)\n await fetchSubscriptionCollections()\n }\n\n const sourceTag = \n const ruleTags = rule.tags.map((t) => (\n \n ))\n\n return (\n \n handleClick()}\n disableGutters\n elevation={1}\n square\n sx={{ margin: 0, '&:before': { display: 'none' } }}\n >\n \n \n \n \n \n \n {rule.defaultDisplayCode || rule.source}\n {rule.name}\n \n \n {orderDisplayText}\n \n \n \n {ruleTags}\n {sourceTag}\n \n \n \n e.stopPropagation()}>\n \n Active Mode\n \n \n \n \n
\n \n \n \n \n \n\n setCollectionsDialogOpen(false)}\n ruleUuid={rule.uuid}\n orgName={orgName}\n collectionsLoading={collectionsLoading}\n collectionsError={collectionsError}\n subscriptionCollections={subscriptionCollections}\n />\n \n )\n}\n\nAllscriptsRule.propTypes = propTypes\n\nexport default AllscriptsRule\n","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'\nimport RadioButtons from '../../reusableComponents/RadioButtons'\nimport log from '../../utilities/logger'\n\nconst BulkRuleSubscriptionStatus = ({ subscriptionIds, displayedRulesCount, pgId }) => {\n const [showModal, setShowModal] = useState(false)\n const [selectedStatus, setSelectedStatus] = useState('')\n const [showConfirmation, setShowConfirmation] = useState(false)\n\n const handleOpenModal = () => {\n setShowConfirmation(false)\n setShowModal(true)\n }\n\n const handleCloseModal = () => {\n setShowModal(false)\n }\n\n const handleSelectChange = (value) => {\n setSelectedStatus(value)\n setShowConfirmation(true)\n }\n\n const bulkUpdateSubscriptionStatus = async () => {\n const call = {\n method: 'put',\n url: '/update_many_subscription_version_items',\n data: { subscription_ids: subscriptionIds, active_silent: selectedStatus, provider_grouping_id: pgId },\n }\n try {\n $.ajax(call).done((data) => {\n setShowModal(false)\n flash.success(`${data.subscription_count} subscriptions have been updated to status: ${selectedStatus}`, 30000)\n setTimeout(() => {\n window.location.reload()\n }, 2000)\n }).fail((error) => {\n const msg = 'Error updating your subscriptions. Contact support@amalgamrx.com if you need further assistance.'\n log({ title: msg, className: 'BulkRuleSubscriptionStatus', values: { call, error }, context: { selectedStatus, pgId } })\n window.flash.error(msg)\n console.error(error)\n })\n } catch (error) {\n const msg = 'Error updating your subscriptions. Contact support@amalgamrx.com if you need further assistance.'\n log({ title: msg, className: 'BulkRuleSubscriptionStatus', values: { error }, context: { selectedStatus, pgId } })\n window.flash.error(msg)\n console.error(error)\n }\n }\n\n const handleConfirmation = (confirm) => {\n if (confirm) {\n bulkUpdateSubscriptionStatus()\n }\n setShowConfirmation(false)\n }\n\n return (\n {/* ✅ removed grid layout, added margin for spacing */}\n
\n\n {showModal && (\n
\n )}\n
\n )\n}\n\nBulkRuleSubscriptionStatus.propTypes = {\n subscriptionIds: PropTypes.arrayOf(PropTypes.number).isRequired,\n displayedRulesCount: PropTypes.number.isRequired,\n pgId: PropTypes.number.isRequired,\n}\n\nexport default BulkRuleSubscriptionStatus","import React from 'react'\nimport PropTypes from 'prop-types'\n\nimport { Collapse, Grid } from '@mui/material'\n\nconst CardBody = ({ open, children, bodyRef, ruleId }) => (\n \n \n {children}\n \n \n)\n\nCardBody.propTypes = {\n open: PropTypes.bool.isRequired,\n children: PropTypes.arrayOf(PropTypes.node).isRequired,\n bodyRef: PropTypes.func.isRequired,\n ruleId: PropTypes.number.isRequired,\n}\n\nexport default CardBody\n","import React from 'react'\nimport PropTypes from 'prop-types'\n\nimport { Grid } from '@mui/material'\n\nconst CardHeader = ({ handleClick, children, ruleId }) => (\n \n { children }\n \n)\n\nCardHeader.propTypes = {\n children: PropTypes.arrayOf(PropTypes.element).isRequired,\n handleClick: PropTypes.func.isRequired,\n ruleId: PropTypes.number.isRequired,\n}\n\nexport default CardHeader\n","import React, { useRef, useState, useCallback, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport _ from 'lodash'\nimport { Grid, IconButton, Box } from '@mui/material'\nimport { Clear as ClearIcon } from '@mui/icons-material'\nimport TextField from '@mui/material/TextField'\n\nconst propTypes = {\n description: PropTypes.string,\n defaultDescription: PropTypes.string,\n updateDescription: PropTypes.func.isRequired,\n ordersEnabledUi: PropTypes.bool.isRequired,\n}\n\n\nconst Description = ({ description='', defaultDescription='', updateDescription, ordersEnabledUi }) => {\n const [editing, setEditing] = useState((description === '' || description === null) && !defaultDescription)\n const [editableDescription, setEditableDescription] = useState(description || '')\n const textarea = useRef(null)\n const inputRef = useRef(null)\n\n // Derive from local state so clear takes effect immediately, before the prop updates\n const isUsingDefault = !editableDescription || editableDescription === '' || editableDescription === null\n const displayDescription = isUsingDefault ? defaultDescription : editableDescription\n\n // Sync local state with prop when prop changes\n useEffect(() => {\n setEditableDescription(description || '')\n }, [description])\n\n const toggleAndFocus = () => {\n if (ordersEnabledUi) {\n setEditing(true)\n inputRef.current?.focus()\n } else {\n setEditing(false)\n }\n }\n\n const handleClick = (event) => {\n if (!editing) {\n event.preventDefault()\n toggleAndFocus()\n }\n }\n\n const handleClear = (event) => {\n event.stopPropagation()\n setEditableDescription('')\n updateDescription('')\n setEditing(false)\n }\n const saveDescription = (desc) => {\n updateDescription(desc)\n }\n\n const autosave = useCallback(_.debounce((desc) => { saveDescription(desc) }, 1000), [])\n\n const handleBlur = () => {\n setEditing(false)\n saveDescription(editableDescription)\n }\n\n const handleChange = (event) => {\n setEditableDescription(event.target.value)\n // autosave(event.target.value)\n }\n\n const handleKeyDown = (event) => {\n if (event.keyCode === 13 && !editing) {\n // User hit enter key\n event.preventDefault()\n toggleAndFocus()\n }\n }\n\n const content = editing ? (\n \n ) : (\n \n \n {displayDescription || 'Click to add description...'}\n
\n {!isUsingDefault && ordersEnabledUi && (\n \n \n \n )}\n \n )\n\n return (\n \n \n Description\n \n \n { content }\n \n \n )\n}\n\nDescription.propTypes = propTypes\nexport default Description\n","import React from 'react'\nimport PropTypes from 'prop-types'\n\nconst Diagnosis = ({ diagnosis = '', ruleType = '' }) => {\n if (ruleType === 'remove' || !diagnosis) {\n return null\n }\n\n return (\n \n Orders using diagnosis code\n {' '}\n {diagnosis}\n \n )\n}\n\nDiagnosis.propTypes = {\n diagnosis: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([null])]),\n ruleType: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([null])]),\n}\n\nexport default Diagnosis\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport { Grid } from '@mui/material'\n\nconst DiagnosisInput = ({ children }) => (\n \n \n Diagnosis
\n \n \n {children}\n \n \n)\n\nDiagnosisInput.propTypes = {\n children: PropTypes.element.isRequired\n}\n\nexport default DiagnosisInput\n","import React from 'react'\nimport PropTypes from 'prop-types'\n\nimport { FormGroup, FormControlLabel, Switch } from '@mui/material'\nimport { styled } from '@mui/material/styles'\n\nconst StyledSwitch = styled(Switch)({\n '& .MuiSwitch-thumb': {\n '&:before': {\n display: 'none',\n },\n height: '18px',\n width: '18px',\n paddingLeft: 0,\n },\n})\n\nconst DuplicateMedicationToggle = ({ checked, onChange }) => (\n \n \n )}\n label=\"do not duplicate past meds\"\n labelPlacement=\"end\"\n />\n \n)\n\nDuplicateMedicationToggle.propTypes = {\n checked: PropTypes.bool.isRequired,\n onChange: PropTypes.func.isRequired\n}\n\nexport default DuplicateMedicationToggle\n","import React, { useState, useRef } from 'react' \nimport PropTypes from 'prop-types' \n\nconst propTypes = {\n orderPreference: PropTypes.object, // Pass the specific order preference object\n sviOrderPreferenceCallback: PropTypes.func.isRequired,\n orderIndex: PropTypes.number.isRequired,\n} \n\nconst EditOrderPreferenceButton = ({ orderIndex, orderPreference, sviOrderPreferenceCallback }) => {\n const [editing, setEditing] = useState(false) \n const options = orderPreference?.options\n const orders = options?.orders\n\n const [facilityId, setFacilityId] = useState(orders?.[orderIndex]?.facility_id || '') \n const [noteToLab, setNoteToLab] = useState(orders?.[orderIndex]?.note_to_lab || '') \n\n const facilityIdInput = useRef(null) \n const noteToLabInput = useRef(null) \n\n const handleEditClick = () => {\n setEditing(true) \n } \n\n const handleSaveClick = () => {\n \n const updatedOrder = {\n ...orderPreference.options.orders[orderIndex],\n facility_id: facilityId,\n note_to_lab: noteToLab\n }\n\n const updatedOrders = [\n ...orderPreference.options.orders\n ]\n updatedOrders[orderIndex] = updatedOrder\n const updatedOptions = {\n ...orderPreference.options,\n orders: updatedOrders\n }\n \n sviOrderPreferenceCallback(updatedOptions) \n\n setEditing(true) \n } \n\n return (\n \n ) \n} \n\nEditOrderPreferenceButton.propTypes = propTypes \n\nexport default EditOrderPreferenceButton\n","import React from 'react'\nimport PropTypes from 'prop-types'\n\nconst propTypes = {\n href: PropTypes.string,\n}\n\nconst ExternalLink = ({ href = '' }) => (\n \n Link to rule source\n \n)\n\nExternalLink.propTypes = propTypes\n\nexport default ExternalLink\n","import React from 'react'\nimport PropTypes from 'prop-types'\n\nconst FollowupAction = ({ followUpActions }) => {\n if (Array.isArray(followUpActions)) {\n return (\n \n {followUpActions.map((followUpAction, i) => (\n
0\n ? followUpAction\n : `followup-${i}`\n }\n >\n {followUpAction}\n
\n ))}\n
\n )\n }\n return {followUpActions}
\n}\n\nFollowupAction.propTypes = {\n followUpActions: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]).isRequired,\n}\n\nexport default FollowupAction\n","import React from 'react'\nimport PropTypes from 'prop-types'\n\nimport { Grid } from '@mui/material'\n\nconst FollowupActionInput = ({ children }) => (\n \n \n Follow Up Action(s)
\n \n \n {children}\n \n \n)\n\nFollowupActionInput.propTypes = {\n children: PropTypes.arrayOf(PropTypes.node).isRequired\n}\n\nexport default FollowupActionInput\n","import PropTypes from 'prop-types'\nimport React, { Component } from 'react'\nimport { algoliasearch } from 'algoliasearch'\nimport { InputAdornment, TextField } from '@mui/material'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport SearchIcon from '@mui/icons-material/Search'\nimport * as R from 'ramda'\n\nconst propTypes = {\n orderIndex: PropTypes.number,\n orderPreference: PropTypes.shape({\n id: PropTypes.number,\n options: PropTypes.shape({\n orders: PropTypes.arrayOf(\n PropTypes.shape({\n order_type: PropTypes.string,\n })\n ),\n }),\n }).isRequired,\n rec: PropTypes.shape({\n id: PropTypes.number,\n options: PropTypes.shape({\n orders: PropTypes.arrayOf(\n PropTypes.shape({\n order_type: PropTypes.string,\n })\n ),\n }),\n }),\n updateOrderPref: PropTypes.bool.isRequired,\n updateSviOrderPreferenceState: PropTypes.func.isRequired,\n orderAnything: PropTypes.bool,\n submitOrder: PropTypes.func,\n columns: PropTypes.string,\n style: PropTypes.shape({}),\n showHelperText: PropTypes.bool\n}\n\nconst defaultProps = {\n columns: '8',\n style: {},\n submitOrder: null,\n orderAnything: null,\n rec: null,\n orderIndex: 0,\n showHelperText: true\n}\n\n/**\n * @function formatTypeaheadData uses obj from algolia creates proper display text for typeahead\n */\nconst formatTypeaheadData = (obj) => {\n if (obj.order_set) {\n return `(${obj.orders.length}) ${obj.name}`\n }\n return obj.name\n}\n\n/**\n * This component takes in values from the options column on an OrderPreference\n * and implements Typeahead so user can change the order pref.\n * @prop {pref} an OrderPreference ActiveRecord\n */\nexport default class EpicOrderPrefTypeahead extends Component {\n constructor(props) {\n super(props)\n this.state = {\n orderType: '',\n options: [],\n prevOptions: [],\n }\n\n this.handleChange = this.handleChange.bind(this)\n this.clearInput = this.clearInput.bind(this)\n this.clearState = this.clearState.bind(this)\n this.optionSelected = this.optionSelected.bind(this)\n }\n\n componentDidMount() {\n // If you have the rec, use it, otherwise fall back to OP\n // This also happens in optionSelected method\n let orderType\n const { rec, orderPreference } = this.props\n try {\n if (rec) {\n orderType = rec.options.orders[0].order_type\n } else {\n orderType = orderPreference.options.orders[0].order_type\n }\n } catch (e) {\n orderType = ''\n }\n\n this.setState({ orderType })\n }\n\n /**\n * @method getDict fires onChange of the Typeahead\n * @param {text} user input text from Typeahead\n * TODO Using Athena algolia credentials for now. Update with Epic data source.\n */\n getDict(text) {\n const client = algoliasearch(\n 'Q5ZBLQF81V',\n 'df6aba0fce0130170bd701c1b4089506'\n )\n const { orderType } = this.state\n // Can do stricter ordering by changing the ranking order on algolia to put filters\n // first (before typo, geo, etc.). See here: https://www.algolia.com/doc/guides/relevance/ranking#ranking-formula-a-tie-breaking-algorithm\n const queries = [\n {\n indexName: 'EpicOrderCode',\n query: text,\n hitsPerPage: 35,\n optionalFacetFilters: [`order_type:${orderType}`],\n }\n ]\n\n client.search({ requests: queries })\n .then((content) => {\n this.searchCallback(content)\n })\n .catch((err) => {\n if (err) {\n console.error(err)\n return\n }\n })\n }\n\n /**\n * @method searchCallback callback invoked upon successful search; updates state for typeahead options\n * @param {content} content results returned from search\n */\n searchCallback(content) {\n const orderCodesResults = content.results[0]\n const orderSetsResults = content.results[1]\n\n if (\n orderCodesResults.hits.length > 0\n ) {\n const options = orderCodesResults.hits\n this.setState({ prevOptions: this.state.options, options })\n }\n }\n\n /**\n * @method handleChange clears existing timer and sets new timer\n * with getDict\n * @param {event} event with value of Typeahead input\n */\n handleChange(event) {\n // need to use this to access these vars within setTimeout scope\n const { value } = event.target\n clearTimeout(this.timer)\n this.timer = setTimeout(() => {\n this.getDict(value)\n }, 300)\n }\n\n clearState() {\n this.setState({ options: [] })\n }\n\n /**\n * @method clearInput clears input on typeahead and sets cursor focus to search input\n */\n clearInput() {\n this.clearState()\n this.input.focus()\n }\n\n /**\n * @method optionSelected fires when a Typeahead choice is selected\n * and update the order preference in Rails for that OrderPreference id\n * or change state\n * @param {opt} object from the array of order options in the Typeahead -\n */\n optionSelected(name) {\n const { prevOptions, options } = this.state\n let order = options.find((o) => o.name === name)\n if (!order) {\n order = prevOptions.find((o) => o.name === name)\n }\n order = {\n order_name: order.name,\n order_type_id: order.ordertypeid,\n order_type: order.order_type\n }\n // only set order set id if we do in fact have an order set not an OrderCode\n const orderSetId = order.order_set ? order.objectID : null\n const {\n rec,\n orderPreference,\n orderAnything,\n updateOrderPref,\n submitOrder,\n updateSviOrderPreferenceState,\n orderIndex\n } = this.props\n\n const recId = rec ? rec.id : null\n\n // controller will update order pref based on updateOrderPref boolean\n // updates the recommendation either way in updateRecInDb unless updateRecInDb is false\n // passes back opt in proper format to be set in top level state\n if (!orderAnything) {\n const orderLens = R.lensPath(['options', 'orders', orderIndex])\n const updatedOrderPreference = R.set(orderLens, order, orderPreference)\n const data = JSON.stringify({\n ...updatedOrderPreference,\n rec_id: recId,\n order_set_id: orderSetId,\n })\n\n if (updateOrderPref) {\n // AJAX call to update organization order preference in db if flag set\n $.ajax({\n method: 'put',\n url: `/admin/order_preferences/${orderPreference.id}`,\n dataType: 'json',\n contentType: 'application/json',\n data,\n })\n .done((response) => {\n this.setState(response.orders[0])\n flash.success('Order changed successfully', 50000)\n updateSviOrderPreferenceState(updatedOrderPreference)\n })\n .fail((error) => {\n flash.error('Order could not be changed.')\n console.error(error, {\n context: `EpicOrderPrefTypeahead update order pref error message: ${error.responseText}`,\n })\n })\n } else {\n // AJAX call to update organization order preference in db if flag set\n $.ajax({\n method: 'put',\n url: '/recommendations/update',\n dataType: 'json',\n contentType: 'application/json',\n data\n })\n .done((response) => {\n this.setState(response.orders[0])\n updateSviOrderPreferenceState(updatedOrderPreference)\n flash.success('Order changed successfully', 50000)\n })\n .fail((error) => {\n flash.error('Order could not be changed.')\n console.error(error, {\n context: `EpicOrderPrefTypeahead update order pref error message: ${error.responseText}`,\n })\n })\n }\n } else {\n this.setState({ ...newOptions.orders[0] })\n updateOptions(recId, newOptions)\n // submit order on select instead on submit button for the DX pre planning section\n if (submitOrder) {\n submitOrder()\n }\n }\n }\n\n render() {\n const { orderAnything, orderPreference, orderIndex, showHelperText } = this.props\n const { options } = this.state\n\n let helperText\n if (!orderAnything && showHelperText) {\n helperText = (\n \n Use the search box above to change the order for this guideline.\n
\n )\n }\n\n const path = R.lensPath(['options', 'orders', orderIndex, 'order_name'])\n const orderName = R.view(path, orderPreference) || ''\n return (\n <>\n formatTypeaheadData(o))}\n style={{\n paddingLeft: '2.25em',\n paddingRight: '2.25em'\n }}\n renderInput={(params) => (\n \n \n \n ),\n }}\n onChange={this.handleChange}\n label=\"Search orders here\"\n />\n )}\n onChange={(_event, value, reason) => {\n if (reason === 'selectOption') {\n this.optionSelected(value)\n }\n }}\n id=\"autocomplete\"\n />\n {helperText}\n >\n )\n }\n}\n\nEpicOrderPrefTypeahead.propTypes = propTypes\nEpicOrderPrefTypeahead.defaultProps = defaultProps\n","import PropTypes from 'prop-types'\nimport React, { Component } from 'react'\nimport { algoliasearch } from 'algoliasearch'\nimport { InputAdornment, TextField } from '@mui/material'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport SearchIcon from '@mui/icons-material/Search'\nimport * as R from 'ramda'\n\nconst propTypes = {\n orderIndex: PropTypes.number,\n orderPreference: PropTypes.shape({\n id: PropTypes.number,\n options: PropTypes.shape({\n orders: PropTypes.arrayOf(\n PropTypes.shape({\n order_type: PropTypes.string,\n })\n ),\n }),\n }).isRequired,\n rec: PropTypes.shape({\n id: PropTypes.number,\n options: PropTypes.shape({\n orders: PropTypes.arrayOf(\n PropTypes.shape({\n order_type: PropTypes.string,\n })\n ),\n }),\n }),\n updateOrderPref: PropTypes.bool.isRequired,\n updateSviOrderPreferenceState: PropTypes.func.isRequired,\n orderAnything: PropTypes.bool,\n submitOrder: PropTypes.func,\n columns: PropTypes.string,\n style: PropTypes.shape({}),\n showHelperText: PropTypes.bool\n}\n\nconst defaultProps = {\n columns: '8',\n style: {},\n submitOrder: null,\n orderAnything: null,\n rec: null,\n orderIndex: 0,\n showHelperText: true\n}\n\n/**\n * @function formatTypeaheadData uses obj from algolia creates proper display text for typeahead\n */\nconst formatTypeaheadData = (obj) => {\n if (obj.order_set) {\n return `(${obj.orders.length}) ${obj.name}`\n }\n return obj.name\n}\n\n/**\n * This component takes in values from the options column on an OrderPreference\n * and implements Typeahead so user can change the order pref.\n * @prop {pref} an OrderPreference ActiveRecord\n */\nexport default class CernerOrderPrefTypeahead extends Component {\n constructor(props) {\n super(props)\n this.state = {\n orderType: '',\n options: [],\n prevOptions: [],\n }\n\n this.handleChange = this.handleChange.bind(this)\n this.clearInput = this.clearInput.bind(this)\n this.clearState = this.clearState.bind(this)\n this.optionSelected = this.optionSelected.bind(this)\n }\n\n componentDidMount() {\n // If you have the rec, use it, otherwise fall back to OP\n // This also happens in optionSelected method\n let orderType\n const { rec, orderPreference } = this.props\n try {\n if (rec) {\n orderType = rec.options.orders[0].order_type\n } else {\n orderType = orderPreference.options.orders[0].order_type\n }\n } catch (e) {\n orderType = ''\n }\n\n this.setState({ orderType })\n }\n\n /**\n * @method getDict fires onChange of the Typeahead\n * @param {text} user input text from Typeahead\n * TODO Using Athena algolia credentials for now. Update with Cerner data source.\n */\n getDict(text) {\n const client = algoliasearch(\n 'Q5ZBLQF81V',\n 'df6aba0fce0130170bd701c1b4089506'\n )\n const { orderType } = this.state\n // Can do stricter ordering by changing the ranking order on algolia to put filters\n // first (before typo, geo, etc.). See here: https://www.algolia.com/doc/guides/relevance/ranking#ranking-formula-a-tie-breaking-algorithm\n const queries = [\n {\n indexName: 'CernerOrderCode',\n query: text,\n hitsPerPage: 35,\n optionalFacetFilters: [`order_type:${orderType}`],\n }\n ]\n\n client.search({ requests: queries })\n .then((content) => {\n this.searchCallback(content)\n })\n .catch((err) => {\n if (err) {\n console.error(err)\n return\n }\n })\n }\n\n /**\n * @method searchCallback callback invoked upon successful search; updates state for typeahead options\n * @param {content} content results returned from search\n */\n searchCallback(content) {\n const orderCodesResults = content.results[0]\n const orderSetsResults = content.results[1]\n\n if (\n orderCodesResults.hits.length > 0\n ) {\n const options = orderCodesResults.hits\n this.setState({ prevOptions: this.state.options, options })\n }\n }\n\n /**\n * @method handleChange clears existing timer and sets new timer\n * with getDict\n * @param {event} event with value of Typeahead input\n */\n handleChange(event) {\n // need to use this to access these vars within setTimeout scope\n const { value } = event.target\n clearTimeout(this.timer)\n this.timer = setTimeout(() => {\n this.getDict(value)\n }, 300)\n }\n\n clearState() {\n this.setState({ options: [] })\n }\n\n /**\n * @method clearInput clears input on typeahead and sets cursor focus to search input\n */\n clearInput() {\n this.clearState()\n this.input.focus()\n }\n\n /**\n * @method optionSelected fires when a Typeahead choice is selected\n * and update the order preference in Rails for that OrderPreference id\n * or change state\n * @param {opt} object from the array of order options in the Typeahead -\n */\n optionSelected(name) {\n const { prevOptions, options } = this.state\n let order = options.find((o) => o.name === name)\n if (!order) {\n order = prevOptions.find((o) => o.name === name)\n }\n order = {\n order_name: order.name,\n order_type_id: order.ordertypeid,\n order_type: order.order_type\n }\n // only set order set id if we do in fact have an order set not an OrderCode\n const orderSetId = order.order_set ? order.objectID : null\n const {\n rec,\n orderPreference,\n orderAnything,\n updateOrderPref,\n submitOrder,\n updateSviOrderPreferenceState,\n orderIndex\n } = this.props\n\n const recId = rec ? rec.id : null\n\n // controller will update order pref based on updateOrderPref boolean\n // updates the recommendation either way in updateRecInDb unless updateRecInDb is false\n // passes back opt in proper format to be set in top level state\n if (!orderAnything) {\n const orderLens = R.lensPath(['options', 'orders', orderIndex])\n const updatedOrderPreference = R.set(orderLens, order, orderPreference) \n const data = JSON.stringify({\n ...updatedOrderPreference,\n rec_id: recId,\n order_set_id: orderSetId,\n })\n\n if (updateOrderPref) {\n // AJAX call to update organization order preference in db if flag set\n $.ajax({\n method: 'put',\n url: `/admin/order_preferences/${orderPreference.id}`,\n dataType: 'json',\n contentType: 'application/json',\n data,\n })\n .done((response) => {\n this.setState(response.orders[0])\n flash.success('Order changed successfully', 50000)\n updateSviOrderPreferenceState(updatedOrderPreference)\n })\n .fail((error) => {\n flash.error('Order could not be changed.')\n console.error(error, {\n context: `CernerOrderPrefTypeahead update order pref error message: ${error.responseText}`,\n })\n })\n } else {\n // AJAX call to update organization order preference in db if flag set\n $.ajax({\n method: 'put',\n url: '/recommendations/update',\n dataType: 'json',\n contentType: 'application/json',\n data\n })\n .done((response) => {\n this.setState(response.orders[0])\n updateSviOrderPreferenceState(updatedOrderPreference)\n flash.success('Order changed successfully', 50000)\n })\n .fail((error) => {\n flash.error('Order could not be changed.')\n console.error(error, {\n context: `CernerOrderPrefTypeahead update order pref error message: ${error.responseText}`,\n })\n })\n }\n } else {\n this.setState({ ...newOptions.orders[0] })\n updateOptions(recId, newOptions)\n // submit order on select instead on submit button for the DX pre planning section\n if (submitOrder) {\n submitOrder()\n }\n }\n }\n\n render() {\n const { orderAnything, orderPreference, orderIndex, showHelperText } = this.props\n const { options } = this.state\n\n let helperText\n if (!orderAnything && showHelperText) {\n helperText = (\n \n Use the search box above to change the order for this guideline.\n
\n )\n }\n\n const path = R.lensPath(['options', 'orders', orderIndex, 'order_name'])\n const orderName = R.view(path, orderPreference) || ''\n return (\n <>\n formatTypeaheadData(o))}\n style={{ \n paddingLeft: '2.25em',\n paddingRight: '2.25em'\n }}\n renderInput={(params) => (\n \n \n \n ),\n }}\n onChange={this.handleChange}\n label=\"Search orders here\"\n />\n )}\n onChange={(_event, value, reason) => {\n if (reason === 'selectOption') {\n this.optionSelected(value)\n }\n }}\n id=\"autocomplete\"\n />\n {helperText}\n >\n )\n }\n}\n\nCernerOrderPrefTypeahead.propTypes = propTypes\nCernerOrderPrefTypeahead.defaultProps = defaultProps","import React, { useState, useEffect, useContext, useCallback } from 'react'\n\nimport { Grid, Paper, Divider, Chip, Button, Dialog, DialogTitle, DialogContent, DialogActions, Typography, CircularProgress, Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material'\nimport { styled } from '@mui/material/styles'\nimport { path, pathOr } from 'ramda'\nimport PropTypes from 'prop-types'\n\nimport { OrdersDisabledEmr, Rule as RuleType } from '../../athenaTypes'\n\n// eslint-disable-next-line import/no-cycle\nimport { RuleContext } from './rulesList'\nimport Action from './Action'\nimport AthenaOrderPrefTypeahead from '../../reusableComponents/AthenaOrderPrefTypeahead'\nimport EpicOrderPrefTypeahead from '../../reusableComponents/EpicOrderPrefTypeahead'\nimport CernerOrderPrefTypeahead from '../../reusableComponents/CernerOrderPrefTypeahead'\nimport AddOrderButton from './AddOrderButton'\nimport CardBody from './CardBody'\nimport CardHeader from './CardHeader'\nimport Description from './Description'\nimport Diagnosis from './Diagnosis'\nimport DiagnosisInput from './DiagnosisInput'\nimport DiagnosisTypeahead from '../../reusableComponents/DiagnosisTypeahead'\nimport ExternalLink from './ExternalLink'\nimport FollowupAction from './FollowupAction'\nimport FollowupActionInput from './FollowupActionInput'\nimport OrderNameInput from './OrderNameInput'\nimport OrderPreferenceList from './OrderPreferenceList'\nimport RemoveOrderButton from './RemoveOrderButton'\nimport EditOrderPreferenceButton from './EditOrderPreferenceButton'\nimport RuleName from './RuleName'\nimport RuleSource from './RuleSource'\nimport RuleSubscriptionStatus from './RuleSubscriptionStatus'\nimport ToggleComboOrderButton from './ToggleComboOrderButton'\nimport UUID from './UUID'\nimport SelectableUUID from '../SelectableUUID'\nimport log from '../../utilities/logger'\n\n/* Constants to avoid magic numbers/strings */\nconst CARD_BASE_HEIGHT = 180\nconst DEFAULT_ORDER_DISPLAY_TEXT = 'No follow up action is currently associated with this guideline'\n\nconst PAPER_PADDING = '1em 1.5em'\nconst PAPER_HEIGHT = '99%'\n\nconst DIVIDER_MARGIN_TOP = '0.5em'\nconst DIVIDER_MARGIN_BOTTOM = '1em'\n\nconst CHIP_TOP = 12\nconst CHIP_RIGHT = 50\nconst CHIP_BG = 'rgba(106, 50, 159, 0.8)'\nconst CHIP_COLOR = '#fff'\n\n// EMR to Typeahead component mapping\nconst ORDER_TYPEAHEAD_MAP = {\n athena: AthenaOrderPrefTypeahead,\n epic: EpicOrderPrefTypeahead,\n cerner: CernerOrderPrefTypeahead,\n}\n\nconst firstDefined = (...values) => {\n for (const val of values) {\n if (val !== null && val !== undefined) {\n return val;\n }\n }\n return values[values.length - 1]\n};\n\n\nconst StyledPaper = styled(Paper)(({ theme }) => ({\n backgroundColor: theme.palette.background.paper,\n padding: PAPER_PADDING,\n height: PAPER_HEIGHT,\n}))\n\nconst StyledDivider = styled(Divider)(({ theme }) => ({\n maxWidth: '100%',\n marginTop: DIVIDER_MARGIN_TOP,\n marginBottom: DIVIDER_MARGIN_BOTTOM,\n}))\n\nconst propTypes = {\n index: PropTypes.number.isRequired,\n open: PropTypes.bool.isRequired,\n rule: RuleType.isRequired,\n setOpenId: PropTypes.func.isRequired,\n toggleStepTherapy: PropTypes.func.isRequired,\n sviSubscriptionCallback: PropTypes.func.isRequired,\n updateSviOrderPreferenceState: PropTypes.func.isRequired,\n emr: PropTypes.string.isRequired,\n subscriptionVersionId: PropTypes.number,\n setSubscriptionVersionId: PropTypes.func,\n orgId: PropTypes.number,\n orgName: PropTypes.string,\n isShadowMode: PropTypes.bool,\n}\n\nconst PENDING_RULE_STYLE = {\n border: '2px solid rgba(106, 50, 159, 0.8)',\n boxShadow: '0 0 6px rgba(106, 50, 159, 0.5)',\n borderRadius: '10px',\n transition: 'box-shadow 0.3s ease, border 0.3s ease'\n}\n\nconst getRuleCardStyle = (rule) => (\n rule.subscription_version_item ? PENDING_RULE_STYLE : {}\n)\n\nconst getSubscriptionStatus = (rule) => (\n rule.subscription ? rule.subscription_version_item?.active_silent || rule.subscription.active_silent : 'off'\n)\n\nconst getRuleAction = (rule, ordersEnabled) => {\n if (!ordersEnabled) {\n return rule.action\n }\n\n // Local override only; blank falls back to the root rule default in the Action component\n return firstDefined(rule.subscription_version_item?.action, rule.order_preference?.action)\n}\n\nconst getRuleDescription = (rule, ordersEnabled) => {\n if (!ordersEnabled) {\n return rule.description\n }\n\n // Local override only; blank falls back to the root rule default in the Description component\n return firstDefined(rule.subscription_version_item?.description, rule.order_preference?.description)\n}\n\nconst PendingSubscriptionChip = ({ show }) => {\n if (!show) {\n return null\n }\n\n return (\n \n )\n}\n\nconst RuleUuidDisplay = ({ ordersEnabled, uuid }) => {\n if (ordersEnabled) {\n return \n }\n\n return Rule UUID:{` ${uuid}`}
\n}\n\nconst RuleOrderSummary = ({ ordersEnabled, orderDisplayText, ruleType, diagnosis }) => {\n if (!ordersEnabled) {\n return null\n }\n\n return (\n <>\n \n \n \n \n \n \n \n >\n )\n}\n\nconst ShadowCollectionsButton = ({ isShadowMode, hasSubscription, onClick }) => {\n if (!isShadowMode) {\n return null\n }\n\n return (\n \n \n \n )\n}\n\nconst SubscriptionCollectionsDialog = ({\n open,\n onClose,\n ruleUuid,\n orgName,\n collectionsLoading,\n collectionsError,\n subscriptionCollections,\n}) => {\n const hasCollections = !collectionsLoading && !collectionsError && subscriptionCollections.length > 0\n const showEmptyState = !collectionsLoading && !collectionsError && subscriptionCollections.length === 0\n\n return (\n \n )\n}\n\nconst OrdersEditorSection = ({\n ordersEnabled,\n orders,\n OrderTypeahead,\n sourcePreference,\n setOrderDisplayText,\n updateSviOrderPreferenceState,\n subscriptionVersionId,\n setSubscriptionVersionId,\n sviOrderPreferenceCallback,\n rule,\n updateDiagnosis,\n}) => {\n if (!ordersEnabled) {\n return null\n }\n\n return (\n <>\n \n {orders.map((order, index) => (\n \n \n \n \n \n
\n ))}\n {orders.length === 0 && (\n \n )}\n \n \n \n \n \n \n \n \n {rule.rule_type === 'add' && (\n \n \n \n )}\n >\n )\n}\n\nconst MaterialUIRule = ({\n index,\n open,\n rule,\n setOpenId,\n toggleStepTherapy,\n sviSubscriptionCallback,\n updateSviOrderPreferenceState,\n emr,\n subscriptionVersionId,\n setSubscriptionVersionId,\n orgId = null,\n orgName = '',\n isShadowMode = false,\n}) => {\n const [diagnosis, setDiagnosis] = useState('')\n const [orderDisplayText, setOrderDisplayText] = useState(DEFAULT_ORDER_DISPLAY_TEXT)\n const [collectionsDialogOpen, setCollectionsDialogOpen] = useState(false)\n const [collectionsLoading, setCollectionsLoading] = useState(false)\n const [collectionsError, setCollectionsError] = useState('')\n const [subscriptionCollections, setSubscriptionCollections] = useState([])\n const hasSubscription = Boolean(rule.subscription?.id)\n const subscriptionVersionMethod = subscriptionVersionId ? 'put' : 'post'\n const subscriptionVersionCall = subscriptionVersionId ? `/subscription_versions/${subscriptionVersionId}` : '/subscription_versions'\n const sviOrderPreference = rule.subscription_version_item?.order_preference\n\n // Single source of truth for order preference - prefer subscription-version-item when present\n const sourcePreference = sviOrderPreference || rule.order_preference\n const orders = pathOr([], ['options', 'orders'], sourcePreference)\n const OrderTypeahead = ORDER_TYPEAHEAD_MAP[emr]\n const ordersEnabled = !OrdersDisabledEmr.includes(emr)\n\n // Using orderSet and source of truth to determine Single Order, Multiple Order, or Combo Order\n const updateOrderDisplayText = () => {\n const orderPrefNames = pathOr([], ['options', 'orders'], sourcePreference).map(o => o.order_name);\n const orderPrefAction = path(['action'], sourcePreference);\n const rawOrderSet = path(['options', 'order_set'], sourcePreference);\n // Normalize order_set to a boolean: true only if it's the boolean true or the string 'true'\n const orderSet = rawOrderSet === true || rawOrderSet === 'true';\n const orderingMode = path(['options', 'orders', 0, 'ordering_mode'], sourcePreference);\n const rules = [\n { cond: orderSet && orderPrefNames.length >= 2, text: ['Combo Order Selected'] },\n { cond: !orderSet && orderPrefNames.length === 1 && orderPrefNames[0], text: ['Single Order Option Selected', `Order ${orderPrefNames[0]}`] },\n { cond: !orderSet && orderPrefNames.length > 1, text: ['Multiple Order Options Selected'] },\n { cond: orderingMode && orderPrefNames.length > 0, text: [`${orderingMode} ${orderPrefNames[0]}`] },\n { cond: rule.rule_type === 'documentation', text: [orderPrefAction || rule.action] },\n ];\n\n const matchedRule = rules.find(r => r.cond);\n setOrderDisplayText(matchedRule?.text || [DEFAULT_ORDER_DISPLAY_TEXT]);\n };\n\n\n const sviOrderPreferenceCallback = (options) => {\n $.ajax({\n method: subscriptionVersionMethod,\n url: subscriptionVersionCall,\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n id: subscriptionVersionId,\n subscription_version_item: {\n order_preference_id: rule.order_preference.id,\n order_preference: {\n id: rule.order_preference.id,\n options\n }\n }\n })\n })\n .done((response) => {\n // Check if the subscription version was deleted (changes reverted)\n if (response.deleted || response.subscription_version_id === null) {\n // Clear the subscription version ID since it was deleted\n if (setSubscriptionVersionId) {\n setSubscriptionVersionId(null)\n }\n // Backend deleted the SVI for this guideline; clear per-guideline pending UI.\n updateSviOrderPreferenceState(\n { ...rule.order_preference, options: options },\n null,\n true,\n )\n } else {\n updateSviOrderPreferenceState(\n { ...rule.order_preference, options: options },\n subscriptionVersionMethod === 'post' ? response.subscription_version_id : null,\n )\n }\n })\n .fail((error) => {\n const msg = 'There was an issue updating the order preference'\n log({ title: msg, className: 'MaterialUIRule', values: { error }, context: { ruleId: rule.id, subscriptionVersionId } })\n window.flash.error(msg)\n console.error(msg, error)\n });\n }\n\n const updateDiagnosis = () => {\n const orderPreferenceDiagnosis = path(\n ['order_preference', 'options', 'diagnosis_name'],\n rule\n )\n\n let newDiagnosis = rule.snomed_diagnosis_name\n if (orderPreferenceDiagnosis) {\n newDiagnosis = orderPreferenceDiagnosis\n } else if (path(['order_preference', 'options', 'order_set'], rule)) {\n newDiagnosis = 'order set diagnosis codes'\n }\n\n setDiagnosis(newDiagnosis)\n }\n\n useEffect(() => {\n updateOrderDisplayText()\n updateDiagnosis()\n }, [])\n\n const handleSelect = ({ target }) => {\n const subscriptionId = path(['subscription', 'id'], rule)\n const activeSilent = target.value\n if (subscriptionId) {\n sviSubscriptionCallback(subscriptionId, activeSilent)\n }\n }\n\n const { setSize } = useContext(RuleContext)\n\n const fetchSubscriptionCollections = useCallback(async () => {\n setCollectionsLoading(true)\n setCollectionsError('')\n try {\n const response = await fetch(`/admin/rules/subscribed_collections_for_rule?rule_uuid=${encodeURIComponent(rule.uuid)}`, {\n headers: {\n Accept: 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n },\n credentials: 'same-origin',\n })\n\n const data = await response.json()\n if (!response.ok) {\n throw new Error(data?.error || `Request failed with status ${response.status}`)\n }\n\n setSubscriptionCollections(Array.isArray(data.collections) ? data.collections : [])\n } catch (error) {\n setCollectionsError(error.message || 'Unable to load collections')\n setSubscriptionCollections([])\n } finally {\n setCollectionsLoading(false)\n }\n }, [rule.uuid])\n\n const openCollectionsDialog = async () => {\n setCollectionsDialogOpen(true)\n await fetchSubscriptionCollections()\n }\n\n const handleActionUpdate = (newAction) => {\n if (!ordersEnabled) {\n return\n }\n\n const call = {\n method: subscriptionVersionMethod,\n url: subscriptionVersionCall,\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n subscription_version_item: {\n action: newAction,\n order_preference_id: rule.order_preference.id,\n rule_id: rule.id,\n subscription_version_id: subscriptionVersionId\n }\n })\n }\n\n $.ajax(call)\n .done((response) => {\n if (response.deleted || response.subscription_version_id === null) {\n if (setSubscriptionVersionId) {\n setSubscriptionVersionId(null)\n }\n updateSviOrderPreferenceState({ ...rule.order_preference, action: newAction }, null, true)\n } else {\n updateSviOrderPreferenceState({ ...rule.order_preference, action: newAction },\n subscriptionVersionMethod === 'post' ? response.subscription_version_id : null,\n )\n }\n })\n .fail((error) => {\n const msg = 'There was an issue submitting the action update'\n log({ title: msg, className: 'MaterialUIRule', values: { error, call } })\n window.flash.error(msg)\n console.error(msg, error)\n })\n }\n\n const handleDescriptionUpdate = (newDescription) => {\n if (!ordersEnabled) {\n return\n }\n\n const call = {\n method: subscriptionVersionMethod,\n url: subscriptionVersionCall,\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n subscription_version_item: {\n description: newDescription,\n order_preference_id: rule.order_preference.id,\n rule_id: rule.id,\n subscription_version_id: subscriptionVersionId\n }\n })\n }\n\n $.ajax(call)\n .done((response) => {\n if (response.deleted || response.subscription_version_id === null) {\n if (setSubscriptionVersionId) {\n setSubscriptionVersionId(null)\n }\n updateSviOrderPreferenceState({ ...rule.order_preference, description: newDescription }, null, true)\n } else {\n updateSviOrderPreferenceState({ ...rule.order_preference, description: newDescription },\n subscriptionVersionMethod === 'post' ? response.subscription_version_id : null,\n )\n }\n })\n .fail((error) => {\n const title = 'There was an issue submitting the Description update'\n log({ title, className: 'MaterialUIRule', values: { error, call } })\n window.flash.error(title)\n console.error(title, error)\n })\n }\n\n const bodyRef = useCallback((node) => {\n if (node !== null) {\n setSize(index, CARD_BASE_HEIGHT + node.getBoundingClientRect().height)\n }\n }, [])\n\n const handleClick = (event) => {\n // Toggle body unless interacting with select field.\n const { classList } = event.target\n if (classList && !classList.contains(\"Mui-selected\")) {\n if (open) {\n setOpenId(null)\n setSize(index, CARD_BASE_HEIGHT)\n } else {\n setOpenId(rule.id)\n }\n }\n }\n\n return (\n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n\n setCollectionsDialogOpen(false)}\n ruleUuid={rule.uuid}\n orgName={orgName}\n collectionsLoading={collectionsLoading}\n collectionsError={collectionsError}\n subscriptionCollections={subscriptionCollections}\n />\n \n )\n}\n\nMaterialUIRule.propTypes = propTypes\nexport default MaterialUIRule","import React, { useState, useEffect } from 'react'\nimport { TextField, IconButton, Box } from '@mui/material'\nimport { Edit as EditIcon, Save as SaveIcon, Cancel as CancelIcon } from '@mui/icons-material'\nimport PropTypes from 'prop-types'\n\nconst propTypes = {\n orderPreference: PropTypes.shape({\n options: PropTypes.shape({\n orders: PropTypes.arrayOf(PropTypes.shape({\n order_name: PropTypes.string,\n original_order_name: PropTypes.string,\n })),\n }),\n }).isRequired,\n orderIndex: PropTypes.number.isRequired,\n sviOrderPreferenceCallback: PropTypes.func.isRequired,\n}\n\nconst OrderNameInput = ({ orderPreference, orderIndex, sviOrderPreferenceCallback }) => {\n const [isEditing, setIsEditing] = useState(false)\n const [customName, setCustomName] = useState('')\n const [originalName, setOriginalName] = useState('')\n\n const order = orderPreference?.options?.orders?.[orderIndex]\n \n useEffect(() => {\n if (order) {\n setCustomName(order.order_name || '')\n setOriginalName(order.original_order_name || order.order_name || '')\n }\n }, [orderPreference, orderIndex])\n\n const handleEdit = () => {\n setIsEditing(true)\n }\n\n const handleSave = () => {\n if (!order || !orderPreference?.options?.orders) { return }\n\n const trimmedName = customName.trim()\n if (!trimmedName) {\n setCustomName(order?.order_name || '')\n setIsEditing(false)\n return\n }\n\n const updatedOptions = { ...orderPreference.options }\n updatedOptions.orders = [...updatedOptions.orders]\n updatedOptions.orders[orderIndex] = {\n ...updatedOptions.orders[orderIndex],\n order_name: trimmedName, \n original_order_name: order.original_order_name || order.order_name\n }\n\n sviOrderPreferenceCallback(updatedOptions)\n setIsEditing(false)\n }\n\n const handleCancel = () => {\n setCustomName(order?.order_name || '')\n setIsEditing(false)\n }\n\n const handleReset = () => {\n if (!order || !orderPreference?.options?.orders) { return }\n\n const updatedOptions = { ...orderPreference.options }\n updatedOptions.orders = [...updatedOptions.orders]\n \n // Reset to original name if available\n const resetName = order.original_order_name || order.order_name\n updatedOptions.orders[orderIndex] = {\n ...updatedOptions.orders[orderIndex],\n order_name: resetName\n }\n\n // Remove original_order_name if we're resetting to it\n if (order.original_order_name) {\n delete updatedOptions.orders[orderIndex].original_order_name\n }\n\n sviOrderPreferenceCallback(updatedOptions)\n setCustomName(resetName)\n }\n\n const handleKeyPress = (event) => {\n if (event.key === 'Enter') {\n handleSave()\n } else if (event.key === 'Escape') {\n handleCancel()\n }\n }\n\n if (!order) { return null }\n\n return (\n \n {isEditing ? (\n <>\n setCustomName(e.target.value)}\n onKeyDown={handleKeyPress}\n label=\"Custom Order Name\"\n size=\"small\"\n fullWidth\n autoFocus\n helperText={originalName && originalName !== customName ? `Original: ${originalName}` : ''}\n sx={{\n '& .MuiOutlinedInput-root': {\n paddingLeft: '12px',\n '&.Mui-focused': {\n '& .MuiInputBase-input': {\n borderBottom: 'none !important',\n boxShadow: 'none !important',\n },\n '& input[type=\"text\"]': {\n borderBottom: 'none !important',\n boxShadow: 'none !important',\n }\n }\n },\n \n }}\n />\n \n \n \n \n \n \n >\n ) : (\n <>\n \n \n Display Name: {order.order_name}\n \n {order.original_order_name && order.original_order_name !== order.order_name && (\n \n Original: {order.original_order_name}\n \n )}\n \n \n \n \n {order.original_order_name && order.original_order_name !== order.order_name && (\n \n \n \n )}\n >\n )}\n \n )\n}\n\nOrderNameInput.propTypes = propTypes\nexport default OrderNameInput","import React, { useState } from 'react'\nimport { arrayOf, bool, shape, string } from 'prop-types'\nimport AthenaOrderPrefTypeaheadBasic from '../../reusableComponents/AthenaOrderPrefTypeaheadBasic'\n\nconst propTypes = {\n order_preferences: arrayOf(\n shape({\n name: string,\n order_type: string,\n ordertypeid: string,\n })\n ),\n order_set: bool,\n selections: bool\n}\n\nconst OrderPreferenceList = ({ order_preferences = [], order_set = false, selections = false }) => {\n const [orderPreferences, setOrderPreferences] = useState(order_preferences)\n const [getSelections, setSelections] = useState(selections || false)\n const [orderSet, setOrderSet] = useState(order_set || false)\n\n const deleteOrderPreference = (index) => {\n const newOrderPreferences = orderPreferences.filter(\n (op, i) => i !== index\n )\n if (newOrderPreferences.length <= 1) setSelections(false)\n setOrderPreferences(newOrderPreferences)\n }\n\n const addOrderPreference = () => {\n if (!getSelections) setSelections(true)\n \n // Check if the last order preference is empty (blank)\n\n const lastOrderPreference = orderPreferences.length > 0 ? orderPreferences[orderPreferences.length - 1] : null\n const isLastEntryEmpty = !lastOrderPreference || \n (!lastOrderPreference.order_name && \n !lastOrderPreference.order_type_id && \n !lastOrderPreference.order_type)\n \n // Only add a new entry if there are no order preferences or the last one is not empty\n if (orderPreferences.length === 0 || !isLastEntryEmpty) {\n setOrderPreferences([...orderPreferences, {}])\n }\n }\n\n const toggleComboOrder = () => {\n const firstOrder = orderPreferences.slice(0, 1)\n if (orderSet) {\n setOrderPreferences(firstOrder)\n } else {\n setSelections(false)\n setOrderPreferences([...firstOrder, {}])\n }\n setOrderSet(!orderSet)\n }\n\n\n const optionSelected = ({ name, order_type, ordertypeid }, index) => {\n const newOrderPreference = {\n order_name: name,\n order_type_id: ordertypeid,\n order_type\n }\n const newOrderPreferences =\n orderPreferences.length > 0\n ? orderPreferences.map((o, i) => (i === index ? newOrderPreference : o))\n : [newOrderPreference]\n setOrderPreferences(newOrderPreferences)\n }\n\n return (\n \n )\n}\n\nOrderPreferenceList.propTypes = propTypes\n\nexport default OrderPreferenceList\n","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { path, pathOr } from 'ramda'\nimport { Grid, InputLabel, MenuItem, Select } from '@mui/material'\nimport log from '../../utilities/logger'\nimport { styled } from '@mui/material/styles'\n\n\nconst propTypes = {\n pref: PropTypes.shape().isRequired,\n dropdownOptions: PropTypes.arrayOf(PropTypes.string).isRequired,\n}\n\nconst StyledGrid = styled(Grid)({\n marginTop: '1em', \n marginBottom: '1em'\n})\n\nconst StyledInputLabel = styled(InputLabel)({\n marginBottom: '1em'\n})\n\nconst StyledSelect = styled(Select)({\n minWidth: '200px'\n})\n\nconst OrderingModeDropdown = ({ pref, dropdownOptions }) => {\n const rawOrderSet = path(['options', 'order_set'], pref)\n const orderSet = rawOrderSet === true || rawOrderSet === 'true'\n const orderType = path(['options', 'orders', 0, 'order_type'], pref)\n\n if (orderSet || orderType !== 'vaccination') {\n return null\n }\n\n const initialOrderingMode = pathOr('Administer', ['options', 'orders', 0, 'ordering_mode'], pref)\n const [orderingMode, setOrderingMode] = useState(initialOrderingMode)\n\n const updateOrderingMode = ({ target: { value } }) => {\n const options = {\n orders: [{ ordering_mode: value }]\n }\n\n const data = JSON.stringify({\n ...pref,\n options,\n })\n \n const call = {\n method: 'put',\n url: `/admin/order_preferences/${pref.id}`,\n dataType: 'json',\n contentType: 'application/json',\n data\n }\n $.ajax(call)\n .done((response) => {\n setOrderingMode(response.orders[0].ordering_mode)\n })\n .fail((error) => {\n log({ title: 'Failed to update ordering mode', className: 'OrderingModeDropdown', values: { call, error } })\n console.error(error.responseText)\n })\n }\n\n const menuItems = dropdownOptions.map((option) => (\n \n ))\n\n return (\n \n \n Select Ordering Mode\n \n \n \n {menuItems}\n \n \n \n )\n}\n\nOrderingModeDropdown.propTypes = propTypes\n\nexport default OrderingModeDropdown\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport * as R from 'ramda'\n\nconst RemoveOrderButton = ({ orderIndex, orderPreference, sviOrderPreferenceCallback }) => {\n const onClick = () => {\n const ordersLens = R.lensPath(['options', 'orders'])\n const orderSetLens = R.lensPath(['options', 'order_set'])\n const orders = R.view(ordersLens, orderPreference)\n const updatedOrders = orders.filter((_, index) => index !== orderIndex)\n let updatedOrderPreference = R.set(ordersLens, updatedOrders, orderPreference)\n if (updatedOrders.length <= 1) {\n // Disable selections and combo mode when only 1 or 0 orders remain\n updatedOrderPreference = R.set(orderSetLens, false, updatedOrderPreference)\n }\n sviOrderPreferenceCallback(updatedOrderPreference.options)\n }\n\n return (\n \n )\n}\n\nRemoveOrderButton.propTypes = {\n orderIndex: PropTypes.number.isRequired,\n orderPreference: PropTypes.shape({\n options: PropTypes.shape({\n order_set: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n orders: PropTypes.arrayOf(PropTypes.shape({}))\n })\n }).isRequired,\n sviOrderPreferenceCallback: PropTypes.func.isRequired,\n}\n\nexport default RemoveOrderButton","import React from 'react'\nimport PropTypes from 'prop-types'\nimport { Grid, ListItemText } from '@mui/material'\n\n\n\nconst RuleName = ({ name }) => {\n return (\n \n \n \n )\n}\n\nRuleName.propTypes = {\n name: PropTypes.string.isRequired\n}\n\nexport default RuleName\n","import React from 'react'\nimport { Grid, ListItemText } from '@mui/material'\nimport { styled } from '@mui/material/styles'\nimport PropTypes from 'prop-types'\n\nconst StyledListItemText = styled(ListItemText)(() => ({\n primary: {\n fontWeight: 'bold',\n }\n}))\n\nconst RuleSource = ({ source }) => (\n \n \n \n)\n\nRuleSource.propTypes = {\n source: PropTypes.string.isRequired\n}\n\nexport default RuleSource\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport { Grid, InputLabel } from '@mui/material'\nimport { styled } from '@mui/material/styles'\n\nconst StyledGrid = styled(Grid)(() => ({\n position: 'relative',\n display: 'flex'\n}))\n\nconst RadioButtonContainer = styled('div')(() => ({\n display: 'flex',\n flexDirection: 'column',\n gap: '8px',\n marginTop: '4px'\n}))\n\nconst RadioButtonLabel = styled('label')(() => ({\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer'\n}))\n\nconst RuleSubscriptionStatus = ({ status, onChange, ruleId }) => {\n const modes = [\n { value: 'off', label: 'Off' },\n { value: 'silent', label: 'Silent' },\n { value: 'active', label: 'Active' }\n ]\n\n const handleRadioChange = (event) => {\n event.stopPropagation()\n const value = event.target.value\n // Create an event-like object that exactly matches what Material-UI Select's onChange provides\n const syntheticEvent = {\n target: {\n value: value\n }\n }\n onChange(syntheticEvent)\n }\n\n const handleContainerClick = (event) => {\n event.stopPropagation()\n }\n\n return (\n \n \n \n Current Mode:\n \n \n \n {modes.map((mode) => (\n \n \n {mode.label}\n \n ))}\n \n \n \n \n )\n}\n\n\nRuleSubscriptionStatus.propTypes = {\n status: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n ruleId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n}\n\nexport default RuleSubscriptionStatus\n","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Box, Select, MenuItem, FormControl, InputLabel } from '@mui/material'\nimport SwitchAndAddRuleType from './switchAndAddRuleType'\nimport AcceptedValueSetAutocomplete from '../root/rules/AcceptedValueSetAutocomplete'\n\nconst RuleTypeOptions = ({ ruleTypeOptions, ruleType = '', orderPreferences, orderSet = false, targetValueSetName = '', formType = '' }) => {\n const [selectedRuleType, setSelectedRuleType] = useState(ruleType || '')\n // Shared across editors so switching rule type doesn't discard an edited target value set\n const [targetValueSet, setTargetValueSet] = useState(targetValueSetName || '')\n\n const handleRuleTypeChange = (newRuleType) => {\n setSelectedRuleType(newRuleType)\n }\n\n return (\n \n
\n Rule Type\n \n \n {['add', 'switch', 'questionnaire'].includes(selectedRuleType) && (\n
\n )}\n {['advisory', 'remove'].includes(selectedRuleType) && formType === 'guideline' && (\n
\n \n \n )}\n
\n
\n )\n}\n\nRuleTypeOptions.propTypes = {\n ruleTypeOptions: PropTypes.arrayOf(\n PropTypes.arrayOf(PropTypes.string.isRequired)\n ).isRequired,\n ruleType: PropTypes.string,\n orderPreferences: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n order_type: PropTypes.string,\n ordertypeid: PropTypes.string,\n })\n ).isRequired,\n orderSet: PropTypes.bool,\n targetValueSetName: PropTypes.string,\n formType: PropTypes.string,\n}\n\nexport default RuleTypeOptions","const defaultGenerator = componentName => componentName;\nconst createClassNameGenerator = () => {\n let generate = defaultGenerator;\n return {\n configure(generator) {\n generate = generator;\n },\n generate(componentName) {\n return generate(componentName);\n },\n reset() {\n generate = defaultGenerator;\n }\n };\n};\nconst ClassNameGenerator = createClassNameGenerator();\nexport default ClassNameGenerator;","import ClassNameGenerator from \"../ClassNameGenerator/index.js\";\nexport const globalStateClasses = {\n active: 'active',\n checked: 'checked',\n completed: 'completed',\n disabled: 'disabled',\n error: 'error',\n expanded: 'expanded',\n focused: 'focused',\n focusVisible: 'focusVisible',\n open: 'open',\n readOnly: 'readOnly',\n required: 'required',\n selected: 'selected'\n};\nexport default function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {\n const globalStateClass = globalStateClasses[slot];\n return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;\n}\nexport function isGlobalState(slot) {\n return globalStateClasses[slot] !== undefined;\n}","import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport deepmerge from '@mui/utils/deepmerge';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nimport composeClasses from '@mui/utils/composeClasses';\nimport systemStyled from \"../styled/index.js\";\nimport useThemePropsSystem from \"../useThemeProps/index.js\";\nimport { extendSxProp } from \"../styleFunctionSx/index.js\";\nimport createTheme from \"../createTheme/index.js\";\nimport { handleBreakpoints, mergeBreakpointsInOrder, resolveBreakpointValues } from \"../breakpoints/index.js\";\nimport { createUnarySpacing, getValue } from \"../spacing/index.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst defaultTheme = createTheme();\n// widening Theme to any so that the consumer can own the theme structure.\nconst defaultCreateStyledComponent = systemStyled('div', {\n name: 'MuiStack',\n slot: 'Root',\n overridesResolver: (props, styles) => styles.root\n});\nfunction useThemePropsDefault(props) {\n return useThemePropsSystem({\n props,\n name: 'MuiStack',\n defaultTheme\n });\n}\n\n/**\n * Return an array with the separator React element interspersed between\n * each React node of the input children.\n *\n * > joinChildren([1,2,3], 0)\n * [1,0,2,0,3]\n */\nfunction joinChildren(children, separator) {\n const childrenArray = React.Children.toArray(children).filter(Boolean);\n return childrenArray.reduce((output, child, index) => {\n output.push(child);\n if (index < childrenArray.length - 1) {\n output.push(/*#__PURE__*/React.cloneElement(separator, {\n key: `separator-${index}`\n }));\n }\n return output;\n }, []);\n}\nconst getSideFromDirection = direction => {\n return {\n row: 'Left',\n 'row-reverse': 'Right',\n column: 'Top',\n 'column-reverse': 'Bottom'\n }[direction];\n};\nexport const style = ({\n ownerState,\n theme\n}) => {\n let styles = {\n display: 'flex',\n flexDirection: 'column',\n ...handleBreakpoints({\n theme\n }, resolveBreakpointValues({\n values: ownerState.direction,\n breakpoints: theme.breakpoints.values\n }), propValue => ({\n flexDirection: propValue\n }))\n };\n if (ownerState.spacing) {\n const transformer = createUnarySpacing(theme);\n const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {\n if (typeof ownerState.spacing === 'object' && ownerState.spacing[breakpoint] != null || typeof ownerState.direction === 'object' && ownerState.direction[breakpoint] != null) {\n acc[breakpoint] = true;\n }\n return acc;\n }, {});\n const directionValues = resolveBreakpointValues({\n values: ownerState.direction,\n base\n });\n const spacingValues = resolveBreakpointValues({\n values: ownerState.spacing,\n base\n });\n if (typeof directionValues === 'object') {\n Object.keys(directionValues).forEach((breakpoint, index, breakpoints) => {\n const directionValue = directionValues[breakpoint];\n if (!directionValue) {\n const previousDirectionValue = index > 0 ? directionValues[breakpoints[index - 1]] : 'column';\n directionValues[breakpoint] = previousDirectionValue;\n }\n });\n }\n const styleFromPropValue = (propValue, breakpoint) => {\n if (ownerState.useFlexGap) {\n return {\n gap: getValue(transformer, propValue)\n };\n }\n return {\n // The useFlexGap={false} implement relies on each child to give up control of the margin.\n // We need to reset the margin to avoid double spacing.\n '& > :not(style):not(style)': {\n margin: 0\n },\n '& > :not(style) ~ :not(style)': {\n [`margin${getSideFromDirection(breakpoint ? directionValues[breakpoint] : ownerState.direction)}`]: getValue(transformer, propValue)\n }\n };\n };\n styles = deepmerge(styles, handleBreakpoints({\n theme\n }, spacingValues, styleFromPropValue));\n }\n styles = mergeBreakpointsInOrder(theme.breakpoints, styles);\n return styles;\n};\nexport default function createStack(options = {}) {\n const {\n // This will allow adding custom styled fn (for example for custom sx style function)\n createStyledComponent = defaultCreateStyledComponent,\n useThemeProps = useThemePropsDefault,\n componentName = 'MuiStack'\n } = options;\n const useUtilityClasses = () => {\n const slots = {\n root: ['root']\n };\n return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});\n };\n const StackRoot = createStyledComponent(style);\n const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {\n const themeProps = useThemeProps(inProps);\n const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.\n const {\n component = 'div',\n direction = 'column',\n spacing = 0,\n divider,\n children,\n className,\n useFlexGap = false,\n ...other\n } = props;\n const ownerState = {\n direction,\n spacing,\n useFlexGap\n };\n const classes = useUtilityClasses();\n return /*#__PURE__*/_jsx(StackRoot, {\n as: component,\n ownerState: ownerState,\n ref: ref,\n className: clsx(classes.root, className),\n ...other,\n children: divider ? joinChildren(children, divider) : children\n });\n });\n process.env.NODE_ENV !== \"production\" ? Stack.propTypes /* remove-proptypes */ = {\n children: PropTypes.node,\n direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),\n divider: PropTypes.node,\n spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n } : void 0;\n return Stack;\n}","'use client';\n\nimport getThemeProps from \"./getThemeProps.js\";\nimport useTheme from \"../useTheme/index.js\";\nexport default function useThemeProps({\n props,\n name,\n defaultTheme,\n themeId\n}) {\n let theme = useTheme(defaultTheme);\n if (themeId) {\n theme = theme[themeId] || theme;\n }\n return getThemeProps({\n theme,\n name,\n props\n });\n}","'use client';\n\nimport PropTypes from 'prop-types';\nimport { createStack } from '@mui/system';\nimport styled from \"../styles/styled.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nconst Stack = createStack({\n createStyledComponent: styled('div', {\n name: 'MuiStack',\n slot: 'Root',\n overridesResolver: (props, styles) => styles.root\n }),\n useThemeProps: inProps => useDefaultProps({\n props: inProps,\n name: 'MuiStack'\n })\n});\nprocess.env.NODE_ENV !== \"production\" ? Stack.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * Defines the `flex-direction` style property.\n * It is applied for all screen sizes.\n * @default 'column'\n */\n direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),\n /**\n * Add an element between each child.\n */\n divider: PropTypes.node,\n /**\n * Defines the space between immediate children.\n * @default 0\n */\n spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),\n /**\n * The system prop, which allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n /**\n * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.\n *\n * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),\n * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.\n *\n * To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.\n * @default false\n */\n useFlexGap: PropTypes.bool\n} : void 0;\nexport default Stack;","/* eslint no-restricted-syntax: 0, prefer-template: 0, guard-for-in: 0\n ---\n These rules are preventing the performance optimizations below.\n */\n\n/**\n * Compose classes from multiple sources.\n *\n * @example\n * ```tsx\n * const slots = {\n * root: ['root', 'primary'],\n * label: ['label'],\n * };\n *\n * const getUtilityClass = (slot) => `MuiButton-${slot}`;\n *\n * const classes = {\n * root: 'my-root-class',\n * };\n *\n * const output = composeClasses(slots, getUtilityClass, classes);\n * // {\n * // root: 'MuiButton-root MuiButton-primary my-root-class',\n * // label: 'MuiButton-label',\n * // }\n * ```\n *\n * @param slots a list of classes for each possible slot\n * @param getUtilityClass a function to resolve the class based on the slot name\n * @param classes the input classes from props\n * @returns the resolved classes for all slots\n */\nexport default function composeClasses(slots, getUtilityClass, classes = undefined) {\n const output = {};\n for (const slotName in slots) {\n const slot = slots[slotName];\n let buffer = '';\n let start = true;\n for (let i = 0; i < slot.length; i += 1) {\n const value = slot[i];\n if (value) {\n buffer += (start === true ? '' : ' ') + getUtilityClass(value);\n start = false;\n if (classes && classes[value]) {\n buffer += ' ' + classes[value];\n }\n }\n }\n output[slotName] = buffer;\n }\n return output;\n}","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z\"\n}), 'ExpandLess');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2m-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9\"\n}), 'SettingsBackupRestore');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M16.54 11 13 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41zM11 7H2v2h9zm10 6.41L19.59 12 17 14.59 14.41 12 13 13.41 15.59 16 13 18.59 14.41 20 17 17.41 19.59 20 21 18.59 18.41 16zM11 15H2v2h9z\"\n}), 'Rule');","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z\"\n}), 'Send');","import React, { useState, useEffect, useCallback, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { \n Dialog, \n DialogTitle, \n DialogContent, \n DialogActions, \n Button, \n TextField, \n CircularProgress, \n Box, \n Stack, \n Typography,\n Paper,\n List,\n ListItem,\n ListItemText,\n Collapse,\n Tooltip,\n IconButton,\n Fade,\n Chip,\n Alert\n} from '@mui/material'\nimport { \n Close as CloseIcon,\n Edit as EditIcon,\n Send as SendIcon,\n Rule as RuleIcon,\n ExpandMore as ExpandMoreIcon,\n ExpandLess as ExpandLessIcon,\n CheckCircle as CheckCircleIcon,\n SettingsBackupRestore as RevertIcon\n} from '@mui/icons-material'\nimport log from '../../utilities/logger'\n\n// Utility functions\nconst parseOrderPreference = (orderPreference) => {\n try {\n const parsed = typeof orderPreference === 'string'\n ? JSON.parse(orderPreference)\n : orderPreference\n\n // Handle both formats: { options: {...} } and direct {...}\n const options = parsed?.options || parsed\n const orders = options?.orders || []\n const orderSet = options?.order_set ?? false\n const selections = options?.selections ?? false\n const orderNames = (Array.isArray(orders) ? orders : []).map(o => o?.order_name).filter(Boolean)\n\n return {\n orderNames,\n order_set: orderSet,\n selections\n }\n } catch (e) {\n return {\n orderNames: [],\n order_set: false,\n selections: false\n }\n }\n}\n\nconst getActiveState = (item) => {\n if (item.active === true) { return 'active' }\n if (item.silent === true) { return 'silent' }\n if (item.active === false && item.silent === false) { return 'off' }\n return null\n}\n\nconst formatDate = (dateString) => {\n return new Date(dateString).toLocaleDateString()\n}\n\n// add a reusable two-line clamp style\nconst twoLineClamp = {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n}\n\n// Helper: format order preference summary using MaterialUIRule logic\nconst formatOrderPrefSummary = (op) => {\n if (!op) { return null }\n \n const { orderNames, order_set } = parseOrderPreference(op)\n \n // No orders\n if (orderNames.length === 0) {\n return 'No follow up action'\n }\n \n // Combo order (order_set true with 2+ orders)\n if (order_set && orderNames.length >= 2) {\n return `Combo Order Selected (${orderNames.length} orders)`\n }\n \n // Single order\n if (orderNames.length === 1) {\n return `Single Order`\n }\n \n // Multiple orders without order_set\n if (!order_set && orderNames.length > 1) {\n return `Multiple Order Options (${orderNames.length} orders)`\n }\n \n // Fallback\n return `${orderNames.length} order(s)`\n}\n\n// Helper: compare order preferences deeply\nconst orderPrefsEqual = (op1, op2) => {\n if (!op1 && !op2) { return true }\n if (!op1 || !op2) { return false }\n \n const parsed1 = parseOrderPreference(op1)\n const parsed2 = parseOrderPreference(op2)\n \n return (\n parsed1.orderNames.length === parsed2.orderNames.length &&\n parsed1.order_set === parsed2.order_set &&\n parsed1.selections === parsed2.selections &&\n parsed1.orderNames.every((name, i) => name === parsed2.orderNames[i])\n )\n}\n\n// Helper: normalize active/silent values for display\nconst normalizeActiveSilent = (val) => {\n if (!val && val !== '') { return null }\n const v = String(val)\n if (v === 'active') { return 'active' }\n if (v === 'silent') { return 'silent' }\n if (v === 'off') { return 'off' }\n return v\n}\n\n// Helper: check if an item has any actual changes compared to original values\nconst hasItemChanges = (item, original_active_silent, original_order_preference, original_order_names, current_order_names, original_description, original_action) => {\n const activeState = getActiveState(item)\n const originalActiveLabel = normalizeActiveSilent(original_active_silent)\n\n const currentOrderPref = item.order_preference\n const originalOrderPref = original_order_preference\n\n const hasActiveSilentChange = originalActiveLabel !== activeState && (originalActiveLabel || activeState)\n const hasOrderNamesChange = original_order_names && current_order_names && \n (original_order_names.length !== current_order_names.length || \n !original_order_names.every((name, i) => name === current_order_names[i]))\n const hasOrderPrefChange = !orderPrefsEqual(originalOrderPref, currentOrderPref) && (originalOrderPref || currentOrderPref)\n const hasDescriptionChange = (item.description !== undefined && item.description !== null) && original_description !== item.description\n const hasActionChange = (item.action !== undefined && item.action !== null) && original_action !== item.action\n \n return hasActiveSilentChange || hasOrderPrefChange || hasOrderNamesChange || hasDescriptionChange || hasActionChange\n}\n\n// Helper: render original -> current inline pair (only if different)\nconst OriginalToCurrent = ({ label, original, current, formatter, showOrderDetails }) => {\n // Don't show if current is null/undefined (field wasn't modified)\n if (current === undefined || current === null) { return null }\n \n const origVal = original === undefined || original === null ? null : (formatter ? formatter(original) : String(original))\n const curVal = formatter ? formatter(current) : String(current)\n\n // Don't show if they're the same (no change)\n if (origVal === curVal) { return null }\n\n // Parse order details if this is order preference\n let origOrders = []\n let curOrders = []\n if (showOrderDetails) {\n if (original) {\n const parsed = parseOrderPreference(original)\n origOrders = parsed.orderNames\n }\n if (current) {\n const parsed = parseOrderPreference(current)\n curOrders = parsed.orderNames\n }\n }\n\n return (\n \n \n \n {label}:\n \n \n \n {origVal || 'None'}\n \n \n →\n \n \n {curVal || 'None'}\n \n \n \n \n {showOrderDetails && (origOrders.length > 0 || curOrders.length > 0) && (\n \n {origOrders.length > 0 && (\n \n \n Original Orders:\n \n {origOrders.map((orderName, idx) => (\n \n • {orderName}\n \n ))}\n \n )}\n {curOrders.length > 0 && (\n \n \n New Orders:\n \n {curOrders.map((orderName, idx) => (\n \n • {orderName}\n \n ))}\n \n )}\n \n )}\n \n )\n}\n\n// Sub-components\nconst StatusCard = ({ status, itemsCount, onToggleGuidelines, showGuidelines }) => (\n \n \n \n \n Current Status\n \n \n \n \n \n Pending Guideline Count\n \n \n \n \n {showGuidelines ? : }\n \n \n \n \n \n)\n\nconst SaveIndicator = ({ isSaved, isSaving }) => {\n if (isSaving) {\n return (\n \n \n \n Saving...\n \n \n )\n }\n\n if (isSaved) {\n return (\n \n \n \n Saved\n \n \n )\n }\n\n return null\n}\n\nconst GuidelineItem = ({ item, ruleName, index, isLast, onRemove, removing, original_active_silent, original_order_preference, original_order_names, current_order_names, original_description, original_action }) => {\n const activeState = getActiveState(item)\n const originalActiveLabel = normalizeActiveSilent(original_active_silent)\n\n const currentOrderPref = item.order_preference\n const originalOrderPref = original_order_preference\n\n // Calculate hasOrderNamesChange for conditional rendering in JSX\n const hasOrderNamesChange = original_order_names && current_order_names && \n (original_order_names.length !== current_order_names.length || \n !original_order_names.every((name, i) => name === current_order_names[i]))\n\n // Use the shared helper function to check if there are any changes\n const hasAnyChanges = hasItemChanges(item, original_active_silent, original_order_preference, original_order_names, current_order_names, original_description, original_action)\n\n return (\n \n \n Rule Name: {ruleName}\n \n }\n secondaryTypographyProps={{ component: 'div' }}\n secondary={\n \n {hasAnyChanges ? (\n \n \n\n {hasOrderNamesChange && (\n \n )}\n\n \n\n \n\n \n \n ) : (\n \n No changes detected\n \n )}\n\n \n Created: {formatDate(item.created_at)} | Updated: {formatDate(item.updated_at)}\n \n \n }\n />\n \n \n onRemove(item.id)}\n disabled={removing}\n size=\"small\"\n sx={{\n color: 'error.main',\n backgroundColor: 'rgba(244, 67, 54, 0.04)',\n border: '1px solid rgba(244, 67, 54, 0.12)',\n '&:hover': {\n backgroundColor: 'rgba(244, 67, 54, 0.08)',\n borderColor: 'error.main'\n },\n '&:disabled': {\n opacity: 0.6\n }\n }}\n >\n {removing ? (\n \n ) : (\n \n )}\n \n \n \n \n )\n}\n\nconst GuidelinesList = ({ items, showGuidelines, onRemoveItem, removingItemId }) => {\n const removedItemIdsRef = useRef(new Set())\n\n useEffect(() => {\n items.forEach(({ item, original_active_silent, original_order_preference, original_order_names, current_order_names, original_description, original_action }) => {\n if (\n !removedItemIdsRef.current.has(item.id) &&\n !hasItemChanges(item, original_active_silent, original_order_preference, original_order_names, current_order_names, original_description, original_action)\n ) {\n removedItemIdsRef.current.add(item.id)\n onRemoveItem(item.id)\n }\n })\n }, [items, onRemoveItem])\n\n return (\n \n \n \n \n \n Pending Guidelines ({items.length})\n \n \n \n {items.map(({ item, rule_name, original_active_silent, original_order_preference, original_order_names, current_order_names, original_description, original_action }, index) => (\n \n ))}\n
\n \n \n )\n}\n\nconst FormFields = ({ formData, onFieldChange, onBlur, isSaving, isSaved, errors, isStaging }) => (\n \n \n \n \n Client Requestor{!isStaging ? ' *' : ''}\n \n onFieldChange('client_requestor', e.target.value)}\n onBlur={onBlur}\n fullWidth\n multiline\n rows={2}\n placeholder=\"Enter client requestor...\"\n error={!!errors.client_requestor}\n helperText={errors.client_requestor}\n sx={{\n '& .MuiOutlinedInput-root': {\n borderRadius: 2,\n '&:hover fieldset': { borderColor: 'primary.main' }\n }\n }}\n />\n \n \n \n \n \n Reasons{!isStaging ? ' *' : ''}\n \n \n \n onFieldChange('reasons', e.target.value)}\n onBlur={onBlur}\n fullWidth\n multiline\n rows={3}\n placeholder=\"Enter reasons for this version...\"\n error={!!errors.reasons}\n helperText={errors.reasons}\n sx={{\n '& .MuiOutlinedInput-root': {\n borderRadius: 2,\n '&:hover fieldset': { borderColor: 'primary.main' }\n }\n }}\n />\n \n\n \n \n \n Notes\n \n onFieldChange('notes', e.target.value)}\n onBlur={onBlur}\n fullWidth\n multiline\n rows={3}\n placeholder=\"Add any additional notes...\"\n sx={{\n '& .MuiOutlinedInput-root': {\n borderRadius: 2,\n '&:hover fieldset': { borderColor: 'primary.main' }\n }\n }}\n />\n \n \n)\n\nFormFields.propTypes = {\n formData: PropTypes.object.isRequired,\n onFieldChange: PropTypes.func.isRequired,\n onBlur: PropTypes.func.isRequired,\n isSaving: PropTypes.bool,\n isSaved: PropTypes.bool,\n errors: PropTypes.object,\n isStaging: PropTypes.bool\n}\n\nconst LoadingState = () => (\n \n \n \n Loading subscription details...\n \n \n)\n\nconst EmptyState = () => (\n \n \n No subscription version data available\n \n \n Please try refreshing or contact support if the issue persists.\n \n \n)\n\n// Main component\nconst SubscriptionVersionManager = ({ subscriptionVersionId, pgId, removeSviCallback, setSubscriptionVersionId, refreshCounter, isStaging }) => {\n const [open, setOpen] = useState(false)\n const [loading, setLoading] = useState(true) // Start with loading true to prevent flash\n const [submitting, setSubmitting] = useState(false)\n const [error, setError] = useState(null)\n const [showGuidelines, setShowGuidelines] = useState(false)\n const [removingItemId, setRemovingItemId] = useState(null)\n const [isSaving, setIsSaving] = useState(false)\n const [isSaved, setIsSaved] = useState(false)\n const [errors, setErrors] = useState({})\n const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false)\n \n const [subscriptionVersion, setSubscriptionVersion] = useState(null)\n const [subscriptionVersionItems, setSubscriptionVersionItems] = useState([])\n const [formData, setFormData] = useState({\n reasons: '',\n notes: '',\n client_requestor: ''\n })\n\n const itemsCount = subscriptionVersionItems.length\n const isPending = subscriptionVersion?.status === 'pending'\n\n // Save metadata function\n const saveMetadata = useCallback(() => {\n const versionId = subscriptionVersion?.id || subscriptionVersionId\n if (!hasUnsavedChanges || !versionId) { return }\n \n setIsSaving(true)\n setHasUnsavedChanges(false)\n const call = {\n method: 'PUT',\n url: `/subscription_versions/${versionId}`,\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n subscription_version: {\n reasons: formData.reasons,\n notes: formData.notes,\n client_requestor: formData.client_requestor\n }\n })\n }\n $.ajax(call)\n .done(() => {\n setIsSaved(true)\n setTimeout(() => setIsSaved(false), 3000)\n setIsSaving(false)\n // Silent refresh to avoid flicker and preserve form inputs\n fetchData({ silent: true, preserveForm: true })\n })\n .fail((error) => {\n log({ title: 'Failed to save changes', className: 'SubscriptionVersionManager', values: { call, error } })\n flash.error('Failed to save changes')\n setIsSaving(false)\n setHasUnsavedChanges(true)\n })\n }, [hasUnsavedChanges, subscriptionVersion?.id, subscriptionVersionId, formData])\n\n const fetchData = useCallback((opts = {}) => {\n if (!pgId) { return }\n\n const { silent = false, preserveForm = false } = opts\n if (!silent) setLoading(true)\n setError(null)\n \n const call = {\n method: 'GET',\n url: `/subscription_versions/show`,\n data: { provider_grouping_id: pgId },\n dataType: 'json'\n }\n $.ajax(call)\n .done((response) => {\n const version = response?.subscription_version\n setSubscriptionVersion(version || null)\n setSubscriptionVersionItems(response?.subscription_version_items || [])\n if (!version && subscriptionVersionId && setSubscriptionVersionId) {\n setSubscriptionVersionId(null, { skipRefresh: true })\n }\n // If parent subscriptionVersionId is cleared but backend still has a version,\n // restore it so subsequent edits use PUT instead of POST.\n if (version && !subscriptionVersionId && setSubscriptionVersionId) {\n setSubscriptionVersionId(version.id, { skipRefresh: true })\n }\n if (!preserveForm) {\n setFormData({\n reasons: version?.reasons || '',\n notes: version?.notes || '',\n client_requestor: version?.client_requestor || ''\n })\n }\n if (!silent) setLoading(false)\n })\n .fail((err) => {\n const errorText = 'Failed to fetch subscription version info'\n log({ title: errorText, className: 'SubscriptionVersionManager', values: { call, err } })\n console.error(errorText, err)\n setError(errorText)\n if (!silent) setLoading(false)\n })\n }, [pgId, setSubscriptionVersionId, subscriptionVersionId])\n\n useEffect(() => {\n if (pgId) {\n fetchData()\n }\n }, [pgId])\n\n useEffect(() => {\n if (open) {\n fetchData()\n }\n }, [open])\n\n // Re-fetch when subscriptionVersionId changes (triggered by parent after mode change or order selection)\n useEffect(() => {\n if (subscriptionVersionId && pgId) {\n fetchData()\n }\n }, [subscriptionVersionId])\n\n // Re-fetch when refreshCounter changes (triggered by parent after mode change or order selection)\n useEffect(() => {\n if (refreshCounter > 0 && pgId) {\n fetchData()\n }\n }, [refreshCounter])\n\n const handleOpen = useCallback((e) => {\n if (e) {\n e.stopPropagation()\n }\n setOpen(true)\n }, [])\n \n const handleClose = useCallback(() => {\n setOpen(false)\n setShowGuidelines(false)\n setErrors({})\n }, [])\n\n const handleToggleGuidelines = useCallback(() => {\n setShowGuidelines(prev => !prev)\n }, [])\n\n const handleFieldChange = useCallback((name, value) => {\n setFormData(prev => ({ ...prev, [name]: value }))\n setHasUnsavedChanges(true)\n setErrors(prev => ({ ...prev, [name]: '' }))\n }, [])\n\n const handleBlur = useCallback(() => {\n if (hasUnsavedChanges) {\n saveMetadata()\n }\n }, [hasUnsavedChanges, saveMetadata])\n\n const validateForm = () => {\n if (isStaging) { return true }\n const newErrors = {}\n if (!formData.reasons.trim()) {\n newErrors.reasons = 'Reasons is required'\n }\n if (!formData.client_requestor.trim()) {\n newErrors.client_requestor = 'Client Requestor is required'\n }\n setErrors(newErrors)\n return Object.keys(newErrors).length === 0\n }\n\n const handleSubmit = useCallback(() => {\n if (!validateForm()) {\n flash.error('Please fill in all required fields')\n return\n }\n\n const versionId = subscriptionVersion?.id || subscriptionVersionId\n if (!versionId) {\n log({ title: 'Cannot submit: subscription version ID is missing.', className: 'SubscriptionVersionManager' })\n flash.error('Cannot submit: subscription version ID is missing.')\n return\n }\n\n setSubmitting(true)\n const call = {\n method: 'PUT',\n url: `/submit_subscription_version`,\n data: { \n id: versionId,\n subscription_version: {\n reasons: formData.reasons,\n notes: formData.notes,\n client_requestor: formData.client_requestor,\n }\n },\n dataType: 'json'\n }\n $.ajax(call)\n .done(() => {\n flash.success('Subscription version submitted successfully.')\n setSubmitting(false)\n handleClose()\n fetchData()\n })\n .fail((err) => {\n log({ title: 'Failed to submit subscription version', className: 'SubscriptionVersionManager', values: { call, err } })\n flash.error('Failed to submit subscription version.')\n setSubmitting(false)\n })\n }, [subscriptionVersion?.id, subscriptionVersionId, formData, handleClose, fetchData])\n\n const handleApply = useCallback(() => {\n const versionId = subscriptionVersion?.id || subscriptionVersionId\n if (!versionId) {\n log({ title: 'Cannot approve: subscription version ID is missing', className: 'SubscriptionVersionManager' })\n flash.error('Cannot approve: subscription version ID is missing.')\n return\n }\n setSubmitting(true)\n const call = {\n method: 'PUT',\n url: `/apply_subscription_version`,\n data: { id: versionId },\n dataType: 'json'\n }\n $.ajax(call)\n .done(() => {\n flash.success('Subscription version approved successfully.')\n window.location.reload()\n })\n .fail(() => {\n log({ title: 'Failed to approve subscription version', className: 'SubscriptionVersionManager', values: { call } })\n flash.error('Failed to approve subscription version.')\n setSubmitting(false)\n })\n }, [subscriptionVersion?.id, subscriptionVersionId])\n\n const handleRemoveItem = useCallback((itemId) => {\n const versionId = subscriptionVersion?.id || subscriptionVersionId\n if (!versionId) {\n log({ title: 'Cannot submit: subscription version ID is missing', className: 'SubscriptionVersionManager' })\n flash.error('Cannot submit: subscription version ID is missing.')\n return\n }\n setRemovingItemId(itemId)\n const call = {\n method: 'PUT',\n url: '/remove_subscription_version_item',\n data: { \n id: itemId,\n subscription_version_id: versionId \n },\n dataType: 'json'\n }\n $.ajax(call)\n .done((response) => {\n flash.success('Item removed successfully.')\n removeSviCallback(response.rule_id)\n if (response.deleted || response.subscription_version_id === null) {\n if (setSubscriptionVersionId) {\n setSubscriptionVersionId(null)\n }\n }\n fetchData()\n })\n .fail((xhr) => {\n const errorMessage = xhr.responseJSON?.message || 'Failed to revert guideline.'\n log({ title: errorMessage, className: 'SubscriptionVersionManager', severity: 'ERROR', values: { call, xhr } })\n flash.error(errorMessage)\n })\n .always(() => {\n setRemovingItemId(null)\n })\n }, [subscriptionVersion?.id, subscriptionVersionId, fetchData, removeSviCallback, setSubscriptionVersionId])\n\n const canSubmit = () => {\n if (!isPending || itemsCount === 0) { return false }\n if (isStaging) { return true }\n return formData.reasons.trim() !== '' && formData.client_requestor.trim() !== ''\n }\n\n const renderDialogContent = () => {\n if (loading) { return }\n if (error || !subscriptionVersion) {\n return \n }\n return (\n \n \n\n {subscriptionVersion.status === 'submitted' && (\n \n This version has been submitted for approval. You can still make edits, but it will return to PENDING status and require re-submission.\n \n )}\n\n \n\n \n \n )\n }\n\n if (itemsCount === 0) {\n return null\n }\n\n const submitTooltip = (() => {\n if (subscriptionVersion?.status === 'submitted') { return '' }\n if (!canSubmit()) {\n return isStaging\n ? 'At least one pending guideline is required to submit'\n : 'Fill in required fields and ensure at least one guideline is present'\n }\n return ''\n })()\n\n return (\n <>\n \n \n \n \n \n \n {itemsCount} {itemsCount === 1 ? 'Guideline' : 'Guidelines'} Pending\n \n \n Click to manage\n \n \n \n \n \n\n {loading ? (\n \n \n \n Loading...\n \n \n ) : (\n \n \n \n \n Client Requestor\n \n \n {formData.client_requestor || (\n \n Not specified yet\n \n )}\n \n\n \n Reasons\n \n \n {formData.reasons || (\n \n Not specified yet\n \n )}\n \n \n\n \n \n \n \n \n \n \n )}\n \n\n \n >\n )\n}\n\nSubscriptionVersionManager.propTypes = {\n subscriptionVersionId: PropTypes.number,\n pgId: PropTypes.number.isRequired,\n removeSviCallback: PropTypes.func.isRequired,\n setSubscriptionVersionId: PropTypes.func,\n refreshCounter: PropTypes.number,\n isStaging: PropTypes.bool\n}\n\nexport default SubscriptionVersionManager","import React from 'react'\nimport PropTypes from 'prop-types'\nimport * as R from 'ramda'\n\nconst ToggleComboOrderButton = ({ orderPreference, sviOrderPreferenceCallback }) => {\n const orderSetPath = R.lensPath(['options', 'order_set'])\n const rawOrderSet = R.view(orderSetPath, orderPreference)\n const orderSet = rawOrderSet === true || rawOrderSet === 'true'\n const orders = R.view(R.lensPath(['options', 'orders']), orderPreference) || []\n const orderLength = orders.length\n\n const onClick = () => {\n const updatedOrderPreference = R.set(orderSetPath, !orderSet, orderPreference)\n sviOrderPreferenceCallback(updatedOrderPreference.options)\n }\n\n // Only show buttons when toggling is meaningful\n if (orderSet) {\n return \n }\n\n if (!orderSet && orderLength > 1) {\n return \n }\n\n // Don't render anything if order_set = false and only one order\n return null\n}\n\nToggleComboOrderButton.propTypes = {\n orderPreference: PropTypes.shape({\n options: PropTypes.shape({\n order_set: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n orders: PropTypes.arrayOf(PropTypes.shape({})),\n }),\n }).isRequired,\n sviOrderPreferenceCallback: PropTypes.func.isRequired,\n}\n\nexport default ToggleComboOrderButton","import React from 'react'\nimport PropTypes from 'prop-types'\n\nimport { Grid } from '@mui/material'\n\nconst UUID = ({ uuid }) => { \n\n return (\n \n \n Rule UUID\n \n \n {uuid}\n \n \n )\n}\n\nUUID.propTypes = {\n uuid: PropTypes.string.isRequired\n}\n\nexport default UUID\n","import Chip from '@mui/material/Chip'\nimport Box from '@mui/material/Box'\nimport PropTypes from 'prop-types'\nimport React, { Component } from 'react'\nimport _ from 'lodash'\nimport { descend, prop, sortWith } from 'ramda'\n\nimport ExpandableCheckboxList from '../../reusableComponents/expandableCheckboxList'\nimport LoadingSkeleton from '../../loadingSkeleton/LoadingSkeleton'\nimport RulesList from './rulesList'\nimport BulkRuleSubscriptionStatus from './BulkRuleSubscriptionStatus'\nimport SubscriptionVersionManager from './SubscriptionVersionManager'\nimport log from '../../utilities/logger'\nimport FormControl from '@mui/material/FormControl'\nimport InputLabel from '@mui/material/InputLabel'\nimport Select from '@mui/material/Select'\nimport MenuItem from '@mui/material/MenuItem'\nimport Checkbox from '@mui/material/Checkbox'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport TextField from '@mui/material/TextField'\n\nconst UUIDV4_REGEXP = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i\n\n// validate prop types\nconst propTypes = {\n allActiveRules: PropTypes.arrayOf(PropTypes.shape()).isRequired,\n emr: PropTypes.string.isRequired,\n orgId: PropTypes.number,\n orgName: PropTypes.string,\n pgId: PropTypes.number.isRequired,\n isStaging: PropTypes.bool.isRequired,\n providerGroups: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number,\n name: PropTypes.string,\n })\n ).isRequired,\n sources: PropTypes.arrayOf(PropTypes.string).isRequired,\n tags: PropTypes.arrayOf(PropTypes.string).isRequired,\n subscriptionVersionId: PropTypes.number,\n isShadowMode: PropTypes.bool,\n}\n\nconst defaultProps = {\n orgId: null,\n orgName: '',\n subscriptionVersionId: null,\n isShadowMode: false,\n}\n\n// function to create JSX for filter criteria chips on top of page\nconst createCriteriaChips = (state) => {\n const ruleSourcesCriteria =\n state.checkedRuleSources.length > 0\n ? state.checkedRuleSources\n : ['All Rule Sources']\n const diseaseTagCriteria =\n state.checkedDiseaseTags.length > 0\n ? state.checkedDiseaseTags\n : ['All Tags']\n const currentModeCriteria =\n state.checkedCurrentModes.length > 0\n ? state.checkedCurrentModes\n : ['All Current Modes']\n const textCriteria =\n state.textQuery.length > 0 ? [`Contains text '${state.textQuery}'`] : []\n\n const criteria = ruleSourcesCriteria.concat(diseaseTagCriteria, currentModeCriteria, textCriteria)\n\n return criteria.map((name) => (\n \n ))\n}\n\nexport const filterFunction = (\n rule,\n textQuery,\n diseaseTagFilters,\n ruleSourceFilters,\n currentModeFilters,\n hideInactiveSubscriptions,\n showTestingRules,\n) => {\n let diseaseTagFiltersPresentOnCurrentRule\n let ruleSourceFiltersPresentOnCurrentRule\n let currentModeFiltersPresentOnCurrentRule\n\n // filter rule source if some are selected otherwise display all\n if (ruleSourceFilters.length > 0) {\n ruleSourceFiltersPresentOnCurrentRule = ruleSourceFilters.includes(\n rule.source\n )\n } else {\n ruleSourceFiltersPresentOnCurrentRule = true\n }\n\n // filter disease tags if some are selected otherwise display all\n if (diseaseTagFilters.length > 0) {\n const tagsOnThisRule = rule.tags.map((t) => t.name)\n diseaseTagFiltersPresentOnCurrentRule =\n _.intersection(diseaseTagFilters, tagsOnThisRule).length > 0\n } else {\n diseaseTagFiltersPresentOnCurrentRule = true\n }\n\n // filter current mode if some are selected otherwise display all\n if (currentModeFilters.length > 0) {\n const currentMode = rule.subscription ? rule.subscription.active_silent : 'off'\n currentModeFiltersPresentOnCurrentRule = currentModeFilters.includes(currentMode)\n } else {\n currentModeFiltersPresentOnCurrentRule = true\n }\n\n // filter on text present in rule description\n const lowerCaseTextQuery = textQuery.toLowerCase().trim()\n\n const textQueryOnCurrentRule =\n (rule.description &&\n rule.description.toLowerCase().includes(lowerCaseTextQuery)) ||\n (rule.name && rule.name.toLowerCase().includes(lowerCaseTextQuery)) ||\n (rule.default_display_code &&\n rule.default_display_code.toLowerCase().includes(lowerCaseTextQuery)) ||\n (UUIDV4_REGEXP.test(textQuery) &&\n rule.uuid.toLowerCase() === lowerCaseTextQuery)\n \n // filter on subscription on or off\n const subscriptionBool = hideInactiveSubscriptions\n ? rule.subscription && rule.subscription.active_silent !== 'off'\n : true\n\n // filter on migration_status testing\n const migrationStatusBool = !showTestingRules \n ? rule.subscription && rule.migration_status === 'testing'\n : true \n\n return (\n subscriptionBool &&\n migrationStatusBool &&\n ruleSourceFiltersPresentOnCurrentRule &&\n diseaseTagFiltersPresentOnCurrentRule &&\n currentModeFiltersPresentOnCurrentRule &&\n textQueryOnCurrentRule\n )\n}\n\n\nconst sortRules = sortWith([\n descend(prop('updated_at')),\n])\n\n// React RulesFilter class\nexport default class RulesFilter extends Component {\n /**\n * @prop orgId -> avhana organization id\n * @prop allActiveRuless -> array of objects, all Rule records\n * @prop tags -> all tags present on allActiveRules\n * @prop sources -> all sources present on allActiveRules\n * @prop isStaging -> only show guideline on staging\n * \n */\n\n constructor(props) {\n super(props)\n const { allActiveRules, pgId, subscriptionVersionId } = props\n const rulesWithActiveSubscriptions = allActiveRules\n .filter((r) => (r.subscription && r.subscription.active_silent !== 'off') || r.subscription_version_item)\n .sort(sortRules)\n\n const rulesWithTestingStatus = allActiveRules\n .filter((r) => r.migration_status === 'testing')\n .sort(sortRules)\n\n this.state = {\n displayedRules: rulesWithActiveSubscriptions,\n allRules: allActiveRules,\n checkedRuleSources: [],\n checkedDiseaseTags: [],\n checkedCurrentModes: [],\n textQuery: '',\n showAllRulesSources: false,\n showAllDiseaseTags: false,\n hideInactiveSubscriptions: true,\n providerGroupId: pgId,\n showTestingRules: rulesWithTestingStatus,\n isFiltered: false,\n subscriptionVersionId: subscriptionVersionId,\n refreshCounter: 0,\n }\n\n this.filterOnCheck = this.filterOnCheck.bind(this)\n this.sviSubscriptionCallback = this.sviSubscriptionCallback.bind(this)\n this.updateSviSubscriptionState = this.updateSviSubscriptionState.bind(this)\n this.removeSviCallback = this.removeSviCallback.bind(this)\n this.toggleStepTherapy = this.toggleStepTherapy.bind(this)\n this.toggleUIActive = this.toggleUIActive.bind(this)\n this.setSubscriptionVersionId = this.setSubscriptionVersionId.bind(this)\n this.triggerRefresh = this.triggerRefresh.bind(this)\n\n // this.switchDescription = this.switchDescription.bind(this)\n this.updateSviOrderPreferenceState = this.updateSviOrderPreferenceState.bind(this)\n this.filterOnText = this.filterOnText.bind(this)\n this.showHideRules = this.showHideRules.bind(this)\n this.showMigrationStatus = this.showMigrationStatus.bind(this)\n this.updateProviderGroupForSubsAndOps = this.updateProviderGroupForSubsAndOps.bind(\n this\n )\n }\n\n // Derived getters for subscription version API calls\n get subscriptionVersionMethod() {\n return this.state.subscriptionVersionId ? 'put' : 'post'\n }\n\n get subscriptionVersionCall() {\n return this.state.subscriptionVersionId \n ? `/subscription_versions/${this.state.subscriptionVersionId}` \n : '/subscription_versions'\n }\n\n setSubscriptionVersionId(id, options = {}) {\n const { skipRefresh = false } = options\n this.setState((prevState) => {\n const nextId = id ?? null\n if (prevState.subscriptionVersionId === nextId) {\n return null\n }\n\n return {\n subscriptionVersionId: nextId,\n refreshCounter: skipRefresh ? prevState.refreshCounter : prevState.refreshCounter + 1,\n }\n })\n }\n\n triggerRefresh() {\n this.setState((prevState) => ({ refreshCounter: prevState.refreshCounter + 1 }))\n }\n\n // Updates the UI state for an OrderPreference that may or may not have an SVI.\n // When `clearSvi` is true, we remove `subscription_version_item` for the matching rule so\n // \"Pending\" chip and styling are cleared when backend reverts changes.\n updateSviOrderPreferenceState(orderPreference, newSubscriptionVersionId = null, clearSvi = false) {\n const { allRules } = this.state\n if (!orderPreference || typeof orderPreference !== 'object' || !('id' in orderPreference)) return\n const foundRule = allRules.find((r) => r.order_preference?.id === orderPreference.id)\n\n if (!foundRule) {\n log({ title: 'Unable to find rule for order preference update', className: 'RulesFilter', values: { orderPreferenceId: orderPreference.id } })\n console.error('Unable to find rule for order preference update', orderPreference.id)\n window.flash.error('Failed to update order preference. Please refresh the page and try again.')\n return\n }\n try {\n foundRule.order_preference = orderPreference\n\n if (clearSvi) {\n foundRule.subscription_version_item = null\n this.setState({ allRules })\n return\n }\n \n const existingSvi = foundRule.subscription_version_item || {}\n const newSvi = {\n ...existingSvi,\n order_preference: orderPreference,\n }\n \n if ('action' in orderPreference) {\n newSvi.action = orderPreference.action\n }\n \n if ('description' in orderPreference) {\n newSvi.description = orderPreference.description\n }\n \n foundRule.subscription_version_item = newSvi\n this.setState({ allRules })\n // Trigger refresh of SubscriptionVersionManager via subscriptionVersionId change or refreshCounter bump\n if (newSubscriptionVersionId) {\n this.setSubscriptionVersionId(newSubscriptionVersionId)\n } else if (this.state.subscriptionVersionId) {\n this.triggerRefresh()\n }\n }\n catch (e) {\n log({ title: 'Unable to update order preference state', className: 'RulesFilter', values: { e } })\n console.error('Unable to update order preference')\n }\n }\n\n sviSubscriptionCallback(subscriptionId, activeSilent) {\n const sviCall = {\n method: this.subscriptionVersionMethod,\n url: this.subscriptionVersionCall,\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n id: this.state.subscriptionVersionId,\n subscription_version_item: {\n subscription_id: subscriptionId,\n active_silent: activeSilent,\n }\n })\n }\n $.ajax(sviCall)\n .done((data) => {\n const isDeleted =\n data?.deleted || data?.subscription_version_id === null\n\n if (isDeleted) {\n // Backend removed the SVI because changes reverted to original.\n this.removeSviCallback(data.rule_id)\n this.setSubscriptionVersionId(null)\n window.flash.success('Changes reverted to original state.')\n return\n }\n\n this.updateSviSubscriptionState(data.rule_id, activeSilent)\n // Always call setSubscriptionVersionId to trigger refresh of SubscriptionVersionManager\n if (data.subscription_version_id) {\n this.setSubscriptionVersionId(data.subscription_version_id)\n }\n window.flash.success(`Subscription ${activeSilent} successfully added to item.`)\n })\n .fail((err) => {\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n const msg = 'Error updating your subscription. Contact support@amalgamrx.com if you need further assistance.'\n log({ title: msg, className: 'RulesFilter', values: { call: sviCall, err } })\n window.flash.error(msg)\n console.error(err)\n }\n })\n }\n\n updateSviSubscriptionState(ruleId, activeSilent) {\n // update UI here\n const { allRules } = this.state\n const foundRule = allRules.find((r) => r.id === ruleId)\n foundRule.subscription_version_item = {\n ...(foundRule.subscription_version_item || {}),\n active_silent: activeSilent,\n }\n this.setState({ allRules })\n }\n\n toggleStepTherapy(ruleId, orderPreference, useStepTherapy) {\n const updatedOrderPreference = {\n ...orderPreference,\n step_therapy: useStepTherapy,\n }\n\n const stepTherapyCall = {\n method: this.subscriptionVersionMethod,\n url: this.subscriptionVersionCall,\n dataType: 'json',\n contentType: 'application/json',\n data: JSON.stringify({\n subscription_version_item: {\n order_preference: updatedOrderPreference,\n step_therapy: useStepTherapy,\n }\n })\n }\n $.ajax(stepTherapyCall)\n .done((data) => {\n this.updateSviOrderPreferenceState(updatedOrderPreference)\n // Update subscriptionVersionId in state if it was null\n if (data.subscription_version_id && this.state.subscriptionVersionId === null) {\n this.setSubscriptionVersionId(data.subscription_version_id)\n }\n })\n .fail((err) => {\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n const msg = 'Error updating your order preference. Contact support@amalgamrx.com if you need further assistance.'\n log({ title: msg, className: 'RulesFilter', values: { call: stepTherapyCall, err } })\n window.flash.error(msg)\n console.error(err)\n }\n })\n }\n\n toggleUIActive(ruleId) {\n const { allActiveRules } = this.props\n const rule = allActiveRules.find((r) => r.id === ruleId)\n if (rule) {\n rule.uiActive = !rule.uiActive\n }\n }\n\n updateProviderGroupForSubsAndOps(event) {\n const newPgId = event.target.value\n const {\n checkedRuleSources,\n checkedDiseaseTags,\n checkedCurrentModes,\n textQuery,\n hideInactiveSubscriptions,\n showTestingRules,\n } = this.state\n\n this.setState({ loading: true })\n\n // First update the user's provider grouping\n const updatePgCall = { url: '/admin/rules/update_users_pg', data: { provider_grouping_id: newPgId } }\n $.get(updatePgCall.url, updatePgCall.data)\n .done(() => {\n // Then fetch new rules for the selected provider group\n const fetchRulesCall = { url: '/admin/rules/get_subscriptions_and_order_preferences_for_provider_group', data: { provider_grouping_id: newPgId } }\n $.get(fetchRulesCall.url, fetchRulesCall.data)\n .done((response) => {\n // Parse response if it's a JSON string, otherwise use as-is\n const newRules = typeof response === 'string' ? JSON.parse(response) : response\n\n // Apply existing filters to the new rules\n const displayedRules = newRules.filter((rule) =>\n filterFunction(\n rule,\n textQuery,\n checkedDiseaseTags,\n checkedRuleSources,\n checkedCurrentModes,\n hideInactiveSubscriptions,\n showTestingRules\n )\n )\n\n // Only update providerGroupId after successful data fetch\n this.setState({\n allRules: newRules,\n displayedRules,\n loading: false,\n providerGroupId: parseInt(newPgId, 10),\n })\n })\n .fail((err) => {\n this.setState({ loading: false })\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n log({ title: 'There was a problem loading rules', className: 'RulesFilter', values: { call: fetchRulesCall, err } })\n window.flash.error('There was a problem loading rules. Contact support@amalgamrx.com for further assistance.')\n console.error(err)\n }\n })\n })\n .fail((err) => {\n this.setState({ loading: false })\n if (checkTimeout(err) === true) {\n redirectToLogin()\n } else {\n log({ title: 'There was a problem updating provider group', className: 'RulesFilter', values: { call: updatePgCall, err } })\n window.flash.error('There was a problem. Contact support@amalgamrx.com for further assistance.')\n console.error(err)\n }\n })\n }\n\n // callback to remove subscription version item from rule in state\n removeSviCallback(ruleId) {\n const { allRules } = this.state\n const foundRule = allRules.find((r) => r.id === ruleId)\n foundRule.subscription_version_item = null\n this.setState({ allRules })\n }\n\n buildFilterPanel() {\n const { sources, tags, isStaging } = this.props\n const currentModeOptions = [\n { name: 'off', displayName: 'Off' },\n { name: 'silent', displayName: 'Silent' },\n { name: 'active', displayName: 'Active' }\n ]\n \n return (\n \n )\n }\n\n filterOnText(event) {\n const {\n checkedDiseaseTags,\n checkedRuleSources,\n checkedCurrentModes,\n hideInactiveSubscriptions,\n showTestingRules,\n } = this.state\n // need to use this to access these vars within setTimeout scope\n this.text = event.target.value\n\n clearTimeout(this.timer)\n this.timer = setTimeout(() => {\n this.updateRulesFilterState(\n checkedRuleSources,\n checkedDiseaseTags,\n this.text,\n hideInactiveSubscriptions,\n showTestingRules,\n checkedCurrentModes,\n )\n }, 300)\n }\n\n filterOnCheck(event) {\n const { hideInactiveSubscriptions, textQuery, showTestingRules} = this.state\n let {\n checkedRuleSources: ruleSourceFilters,\n checkedDiseaseTags: diseaseTagFilters,\n checkedCurrentModes: currentModeFilters,\n } = this.state\n const checkName = event.target.name\n const checkType = event.target.dataset.type\n\n if (event.target.checked && checkType === 'source') {\n ruleSourceFilters.push(checkName)\n } else if (event.target.checked && checkType === 'disease') {\n diseaseTagFilters.push(checkName)\n } else if (event.target.checked && checkType === 'currentmode') {\n if (checkName === 'All') {\n currentModeFilters = []\n } else {\n currentModeFilters = currentModeFilters.filter(mode => mode !== 'All')\n currentModeFilters.push(checkName)\n }\n } else if (!event.target.checked && checkType === 'source') {\n ruleSourceFilters = _.reject(ruleSourceFilters, (f) => f === checkName)\n } else if (!event.target.checked && checkType === 'disease') {\n diseaseTagFilters = _.reject(diseaseTagFilters, (f) => f === checkName)\n } else if (!event.target.checked && checkType === 'currentmode') {\n if (checkName === 'All') {\n const checkedModeCheckboxes = document.querySelectorAll('input[data-type=\"currentmode\"]:not([name=\"All\"]):checked')\n currentModeFilters = Array.from(checkedModeCheckboxes).map(cb => cb.name)\n } else {\n currentModeFilters = _.reject(currentModeFilters, (f) => f === checkName)\n }\n }\n\n this.updateRulesFilterState(\n ruleSourceFilters,\n diseaseTagFilters,\n textQuery,\n hideInactiveSubscriptions,\n showTestingRules,\n currentModeFilters\n )\n }\n\n showHideRules(event) {\n const { textQuery, checkedDiseaseTags, checkedRuleSources, showTestingRules, checkedCurrentModes } = this.state\n const hideInactiveSubscriptions = !event.target.checked\n this.setState({ hideInactiveSubscriptions })\n this.updateRulesFilterState(\n checkedRuleSources,\n checkedDiseaseTags,\n textQuery,\n hideInactiveSubscriptions,\n showTestingRules,\n checkedCurrentModes\n )\n }\n\n showMigrationStatus(event) {\n const { textQuery, checkedDiseaseTags, checkedRuleSources, hideInactiveSubscriptions, checkedCurrentModes } = this.state\n const showTestingRules = !event.target.checked\n this.setState({ showTestingRules })\n this.updateRulesFilterState(\n checkedRuleSources,\n checkedDiseaseTags,\n textQuery,\n hideInactiveSubscriptions,\n showTestingRules,\n checkedCurrentModes\n )\n }\n\n updateRulesFilterState(\n ruleSourceFilters,\n diseaseTagFilters,\n textQuery,\n hideInactiveSubscriptions,\n showTestingRules,\n currentModeFilters\n ) {\n const { allRules } = this.state\n\n const displayedRules = allRules.filter((rule) =>\n filterFunction(\n rule,\n textQuery,\n diseaseTagFilters,\n ruleSourceFilters,\n currentModeFilters,\n hideInactiveSubscriptions,\n showTestingRules\n )\n )\n\n const isFiltered = \n ruleSourceFilters.length > 0 ||\n diseaseTagFilters.length > 0 ||\n currentModeFilters.length > 0 ||\n textQuery.length > 0 ||\n !hideInactiveSubscriptions ||\n !showTestingRules;\n\n this.setState({\n displayedRules,\n checkedRuleSources: ruleSourceFilters,\n checkedDiseaseTags: diseaseTagFilters,\n checkedCurrentModes: currentModeFilters,\n textQuery,\n isFiltered,\n })\n }\n\n render() {\n const { providerGroups, orgId, orgName, emr, isShadowMode } = this.props\n const { displayedRules, loading, isFiltered, subscriptionVersionId, providerGroupId } = this.state\n \n const facetFilter = this.buildFilterPanel()\n let rulesBox\n const displayedRulesCount = displayedRules.length\n\n // Sort provider groups alphabetically for consistent ordering\n const sortedProviderGroups = [...providerGroups].sort((a, b) => \n a.name.localeCompare(b.name)\n )\n\n const providerGroupOptions = sortedProviderGroups.map((group) => (\n \n ))\n\n if (loading) {\n rulesBox = \n } else {\n const rulesWithHeadings = displayedRules\n\n rulesBox = (\n \n )\n }\n\n return (\n \n \n {facetFilter}\n \n \n \n \n Provider Group\n \n \n \n \n \n \n
\n \n \n \n \n Showing guidelines for:\n \n {createCriteriaChips(this.state)}\n \n\n \n \n \n {`${displayedRulesCount} ${pluralize(\n 'guideline',\n displayedRulesCount\n )}`}\n \n {` ${pluralize('meet', displayedRulesCount)} this criteria.`}\n
\n\n {isFiltered && (\n rule.subscription?.id ?? null\n )}\n displayedRulesCount={displayedRulesCount}\n pgId={providerGroupId}\n />\n )}\n \n \n \n \n {rulesBox}\n \n \n \n )\n }\n}\n\nRulesFilter.propTypes = propTypes\nRulesFilter.defaultProps = defaultProps","import React, { forwardRef, useCallback, useRef, useState, useMemo } from 'react'\nimport PropTypes, { func, oneOfType, string, arrayOf } from 'prop-types'\nimport { VariableSizeList } from 'react-window'\nimport AutoSizer from 'react-virtualized-auto-sizer'\nimport { ListSubheader } from '@mui/material'\n\n// eslint-disable-next-line import/no-cycle\nimport Rule from './Rule'\n// eslint-disable-next-line import/no-cycle\nimport AllscriptsRule from './AllscriptsRule'\n// eslint-disable-next-line import/no-cycle\nimport MaterialUIRule from './MaterialUIRule'\n\nimport { EMR, RuleCategory, Rule as RuleType } from '../../athenaTypes'\n\nconst propTypes = {\n category: RuleCategory.isRequired,\n displayedRules: arrayOf(oneOfType([RuleType, string])).isRequired,\n emr: EMR.isRequired,\n orgId: PropTypes.number,\n orgName: PropTypes.string,\n isShadowMode: PropTypes.bool,\n toggleStepTherapy: func.isRequired,\n sviSubscriptionCallback: func.isRequired,\n updateSviOrderPreferenceState: func.isRequired,\n subscriptionVersionId: oneOfType([string, PropTypes.number]),\n setSubscriptionVersionId: func,\n}\n\nexport const RuleContext = React.createContext({})\n\nconst InnerElement = forwardRef(({ style, ...rest }, ref) => (\n \n))\n\nconst RulesList = ({\n category,\n displayedRules,\n emr,\n orgId = null,\n orgName = '',\n isShadowMode = false,\n toggleStepTherapy,\n sviSubscriptionCallback,\n updateSviOrderPreferenceState,\n subscriptionVersionId = null,\n setSubscriptionVersionId,\n}) => {\n const DEFAULT_ITEM_HEIGHT = category === 'Previsit' ? 166 : 148\n const listRef = useRef()\n const sizeMap = useRef({})\n\n const setSize = useCallback((index, size) => {\n const newSizes = Object.assign(\n {},\n ...Object.keys(sizeMap.current).map((i) => ({\n [i]: DEFAULT_ITEM_HEIGHT,\n }))\n )\n sizeMap.current = { ...newSizes, [index]: size }\n listRef.current.resetAfterIndex(0)\n }, [DEFAULT_ITEM_HEIGHT])\n\n const getSize = useCallback(\n (index) => sizeMap.current[index] || DEFAULT_ITEM_HEIGHT,\n [DEFAULT_ITEM_HEIGHT]\n )\n\n const [openId, setOpenId] = useState(null)\n const RuleComponent = useMemo(\n () => (emr !== 'allscripts' ? MaterialUIRule : AllscriptsRule),\n [emr]\n )\n\n const buildRule = ({ index, style }) => {\n const rule = displayedRules[index]\n if (typeof rule === 'object') {\n return (\n \n \n
\n )\n }\n return (\n \n \n {rule}
\n \n
\n )\n }\n\n return (\n \n
\n \n {({ width }) => (\n \n {buildRule}\n \n )}\n \n \n
\n )\n}\n\nRulesList.propTypes = propTypes\n\nexport default RulesList\n","import React, { useState, useEffect } from 'react'\nimport { arrayOf, bool, func, shape, string } from 'prop-types'\nimport { TextField } from '@mui/material'\nimport Autocomplete from '@mui/material/Autocomplete'\nimport { debounce } from 'lodash'\nimport AthenaOrderPrefTypeaheadBasic from '../../reusableComponents/AthenaOrderPrefTypeaheadBasic'\nimport log from '../../utilities/logger'\n\nconst propTypes = {\n orderPreferences: arrayOf(\n shape({\n name: string,\n order_type: string,\n ordertypeid: string,\n })\n ),\n orderSet: bool,\n targetValueSetName: string,\n onTargetValueSetNameChange: func,\n formType: string,\n}\n\nconst switchAndAddRuleType = ({ orderPreferences: initialOrderPreferences = [], orderSet: initialOrderSet = false, targetValueSetName = '', onTargetValueSetNameChange, formType = '' }) => {\n const [orderPreferences, setOrderPreferences] = useState(initialOrderPreferences)\n const [orderSet, setOrderSet] = useState(initialOrderSet || false)\n const [options, setOptions] = useState([])\n // Controlled by the parent so the value survives switching between rule type editors\n const value = targetValueSetName\n const setValue = onTargetValueSetNameChange\n\n useEffect(() => {\n const hiddenInput = document.querySelector('input[name=\"rule[target_value_set_name]\"]')\n if (hiddenInput) {\n hiddenInput.value = value || ''\n }\n }, [value])\n\n const handleChange = debounce((event) => {\n const { value } = event.target\n if (value.length >= 3) {\n const call = {\n method: 'GET',\n url: '/root/value_sets_name_search',\n data: { query: value },\n }\n $.ajax(call)\n .done((response) => {\n setOptions(response)\n })\n .fail((error) => {\n log({ title: 'Failed to search value sets by name', className: 'switchAndAddRuleType', values: { call, error }, context: { query: value } })\n console.error(error)\n })\n } else {\n setOptions([])\n }\n }, 300)\n\n const getOptionLabel = (option) => option\n\n const addOrderPreference = () => {\n setOrderPreferences([...orderPreferences, {}])\n }\n\n const deleteOrderPreference = (index) => {\n const newOrderPreferences = orderPreferences.filter((_, i) => i !== index)\n setOrderPreferences(newOrderPreferences)\n }\n\n const toggleComboOrder = () => {\n setOrderSet(!orderSet)\n }\n\n const optionSelected = (option, index) => {\n const newOrderPreference = {\n order_name: option.name,\n order_type_id: option.ordertypeid,\n order_type: option.order_type\n }\n const updated = orderPreferences.map((o, i) => (i === index ? newOrderPreference : o))\n setOrderPreferences(updated)\n }\n\nreturn (\n \n
\n {orderPreferences.map((op, index) => (\n
\n
optionSelected(option, index)}\n column=\"12\"\n orderName={op.order_name}\n />\n \n {orderSet && orderPreferences.length > 0 && (\n
Combo Order
\n )}\n
\n
\n \n ))}\n\n {orderPreferences.length === 0 && (\n
\n
{\n setOrderPreferences([{\n order_name: option.name,\n order_type_id: option.ordertypeid,\n order_type: option.order_type\n }])\n }}\n column=\"12\"\n />\n \n )}\n\n
\n \n \n \n
\n\n
\n
\n
\n \n {(formType === 'guideline') && (\n
\n )}\n
\n)\n}\n\nswitchAndAddRuleType.propTypes = propTypes\n\nexport default switchAndAddRuleType","import React from 'react'\nimport PropTypes from 'prop-types'\nimport {\n Card, CardContent, CardActions, Typography,\n Table, TableHead, TableBody, TableRow, TableCell, TableContainer, Paper,\n} from '@mui/material'\n\nexport default function CareTeamCard({ careTeam, renderUserAction, cardActions }) {\n return (\n \n \n {careTeam.name}\n {careTeam.isMember && (\n \n You are currently a member of this care team\n \n )}\n \n \n \n \n NAME\n TYPE\n ROLE\n ACTIONS\n \n \n \n {careTeam.users.map(u => (\n \n {u.name}\n {u.type}\n {u.role}\n {renderUserAction(u, careTeam)}\n \n ))}\n \n
\n \n \n {cardActions && {cardActions}}\n \n )\n}\n\nCareTeamCard.propTypes = {\n careTeam: PropTypes.shape({\n id: PropTypes.number.isRequired,\n name: PropTypes.string.isRequired,\n isMember: PropTypes.bool,\n users: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.number.isRequired,\n name: PropTypes.string,\n type: PropTypes.string,\n role: PropTypes.string,\n })),\n }).isRequired,\n renderUserAction: PropTypes.func.isRequired,\n cardActions: PropTypes.node,\n}\n","import { FlashAuto } from '@mui/icons-material'\nimport React, { useState } from 'react' \n\nconst StagingPatientForm = () => {\n const [emrId, setEmrId] = useState('') \n\n const handleInputChange = (event) => {\n setEmrId(event.target.value) \n } \n\n const handleSubmit = (event) => {\n event.preventDefault() \n\n const formData = new FormData()\n formData.append(\"emrId\", emrId)\n\n $.ajax({\n method: 'post',\n url: 'patient_search/patient_refresh/emr_patient_id',\n contentType: false,\n processData: false,\n data: formData,\n enctype: 'application/x-www-form-urlencoded'\n })\n .done((result) => {\n flash.success(`Staging Patient ${emrId} Created`, 50000)\n setEmrId('')\n })\n .fail((error) => {\n console.error('Error:', error)\n flash.error(`There was an error creating staging patient ${emrId}. Please make sure you have the correct EMR Patient ID.`)\n })\n } \n\n return (\n \n \n
\n ) \n} \n\nexport default StagingPatientForm \n","import React, { useState, useEffect } from 'react'\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material'\n\nconst MigrateTagsButton = () => {\n const [migrationCount, setMigrationCount] = useState(0)\n const [isDialogOpen, setDialogOpen] = useState(false)\n const [disabled, setDisabled] = useState(false)\n\n useEffect(() => {\n const fetchMigrationCount = () => {\n $.ajax({\n method: 'get',\n url: '/root/tag_migration_count',\n dataType: 'json',\n contentType: 'application/json',\n })\n .done((response) => {\n setMigrationCount(response.message)\n setDisabled(response.message === 0)\n })\n .fail((error) => {\n console.error(error)\n })\n }\n\n fetchMigrationCount()\n }, [])\n\n const handleMigration = () => {\n setDisabled(true)\n $.ajax({\n method: 'post',\n url: '/root/tags/migrate_tags',\n dataType: 'json',\n contentType: 'application/json',\n })\n .done((response) => {\n console.log(response)\n })\n .fail((error) => {\n console.error(error)\n })\n \n setDialogOpen(false)\n }\n \n const handleButtonClick = () => {\n setDialogOpen(true)\n }\n\n const handleCancel = () => {\n setDialogOpen(false)\n }\n\n return (\n <>\n \n \n\n \n
\n >\n )\n}\n\nexport default MigrateTagsButton","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { DataGrid } from '@mui/x-data-grid'\nimport { Box, TextField, IconButton, Button, Tooltip, Typography, Dialog, DialogActions, DialogContent, DialogTitle, Card, CardContent } from '@mui/material'\nimport { Edit as EditIcon, Delete as DeleteIcon } from '@mui/icons-material'\nimport MigrateTagsButton from './MigrateTagsButton'\n\nconst TagDialog = ({ notProduction, open, title, content, onClose, onConfirm, confirmText = 'Confirm' }) => (\n \n)\n\nconst propTypes = {\n tags: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n id: PropTypes.number.isRequired,\n rule_count: PropTypes.number.isRequired,\n })\n ).isRequired,\n notProduction: PropTypes.bool.isRequired,\n}\n\nconst TagsDisplay = ({ tags, notProduction }) => {\n const [openDialog, setOpenDialog] = useState({ type: null, tag: null })\n const [tagName, setTagName] = useState('')\n\n const handleOpenDialog = (type, tag = null) => {\n setTagName(tag?.name || '')\n setOpenDialog({ type, tag })\n }\n\n const handleCloseDialog = () => setOpenDialog({ type: null, tag: null })\n\n const handleRequest = (method, data) => {\n $.ajax({ method, url: '/root/tags', data })\n .done((response) => {\n flash.success(response.message, 5000)\n handleCloseDialog()\n setTimeout(() => window.location.reload(), 1000)\n })\n .fail((error) => flash.error(`Error: ${error.responseJSON.error}`, 5000))\n }\n\n const handleCreateTag = () => handleRequest('post', { name: tagName })\n\n const handleEditTag = () => handleRequest('put', { id: openDialog.tag.id, new_name: tagName })\n\n const handleDeleteTag = () => handleRequest('put', { id: openDialog.tag.id, deleted: true })\n\n const columns = [\n { field: 'name', headerName: 'Tag Name', width: 500 },\n { field: 'rule_count', headerName: 'Rule Count', width: 400 },\n ...(notProduction ? [{\n field: 'actions',\n headerName: 'Actions',\n filterable: false,\n width: 200,\n renderCell: (params) => (\n \n \n handleOpenDialog('edit', params.row)}>\n \n \n \n \n handleOpenDialog('delete', params.row)}>\n \n \n \n \n ),\n }] : [])\n ]\n\n return (\n \n \n \n {notProduction &&\n \n \n \n \n }\n \n row.id} initialState={{ pagination: { paginationModel: { pageSize: 50, page: 0 } } }} autoHeight />\n \n\n {openDialog.type === 'create' && (\n setTagName(e.target.value)} sx={{ width: '500px', '& input': { marginLeft: '8px !important' } }} />} \n onClose={handleCloseDialog} \n onConfirm={handleCreateTag} \n confirmText=\"Create\" \n />\n )}\n\n {openDialog.type === 'edit' && (\n setTagName(e.target.value)} sx={{ '& input': { marginLeft: '8px !important' } }} />} \n onClose={handleCloseDialog} \n onConfirm={handleEditTag} \n confirmText=\"Confirm\" \n />\n )}\n\n {openDialog.type === 'delete' && (\n Are you sure you want to delete tag \"{openDialog.tag?.name}\"? It has {openDialog.tag?.rule_count} rules.} \n onClose={handleCloseDialog} \n onConfirm={handleDeleteTag} \n confirmText=\"Delete\" \n />\n )}\n \n \n
\n )\n}\n\nTagsDisplay.propTypes = propTypes\n\nexport default TagsDisplay","import React, { useState, useImperativeHandle, forwardRef } from 'react'\nimport { Autocomplete, TextField, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Button, Chip, Box } from '@mui/material'\nimport PropTypes from 'prop-types'\n\nconst RuleFormTag = forwardRef(({ tagsOptions, initialRuleTags = [] }, ref) => {\n const [ruleTags, setRuleTags] = useState(initialRuleTags || [])\n const [inputValue, setInputValue] = useState('')\n const [isDialogOpen, setDialogOpen] = useState(false)\n const [newTag, setNewTag] = useState('')\n const [additions, setAdditions] = useState([])\n const [removals, setRemovals] = useState([])\n\n useImperativeHandle(ref, () => ({\n getTagsData: () => ({\n ruleTags,\n additions,\n removals,\n }),\n }))\n\n const handleChange = (event, value) => {\n const option = value[value.length - 1]\n if (option && option.inputValue) {\n setNewTag(option.inputValue)\n setDialogOpen(true)\n } else {\n setRuleTags(value)\n if (initialRuleTags === null) {\n setAdditions(value)\n setRemovals([])\n } else {\n setAdditions(value.filter(tag => !initialRuleTags.some(t => t.id === tag.id)))\n setRemovals(initialRuleTags.filter(tag => !value.some(t => t.id === tag.id)))\n }\n }\n }\n\n const handleInputChange = (event, newInputValue) => {\n setInputValue(newInputValue)\n }\n\n const handleDialogClose = () => {\n setDialogOpen(false)\n setInputValue('')\n }\n\n const handleDialogConfirm = () => {\n const newTagObj = { id: null, name: newTag }\n setRuleTags([...ruleTags, newTagObj])\n setAdditions([...additions, newTagObj])\n setDialogOpen(false)\n setInputValue('')\n }\n\n const handleTagDelete = (tag) => {\n setRuleTags(ruleTags.filter(t => t.id !== tag.id))\n if (initialRuleTags.some(t => t.id === tag.id)) {\n setRemovals([...removals, tag])\n } else {\n setAdditions(additions.filter(t => t.id !== tag.id))\n }\n }\n\n const tagOptions = () => tagsOptions\n .filter(option => !additions.some(addition => addition.id === option.id))\n .map((t) => ({ value: t.id, label: t.name, id: t.id, name: t.name }))\n\n return (\n \n option.name || option}\n renderTags={(value, getTagProps) =>\n value.map((option, index) => (\n handleTagDelete(option)}\n />\n ))\n }\n renderInput={(params) => (\n \n )}\n filterOptions={(options, params) => {\n const filtered = options.filter(option => option.name.toLowerCase().includes(params.inputValue.toLowerCase()))\n if (params.inputValue !== '' && !filtered.some(option => option.name.toLowerCase() === params.inputValue.toLowerCase())) {\n filtered.push({\n inputValue: params.inputValue,\n name: `Create Tag \"${params.inputValue}\"`,\n })\n }\n return filtered\n }}\n />\n \n \n \n )\n})\n\nconst TAG = PropTypes.shape({\n id: PropTypes.number,\n name: PropTypes.string,\n})\n\nRuleFormTag.propTypes = {\n initialRuleTags: PropTypes.arrayOf(TAG),\n tagsOptions: PropTypes.arrayOf(TAG).isRequired,\n}\n\nexport default RuleFormTag","import React, { useState, useEffect } from 'react'\nimport { InputLabel, MenuItem, Select, FormControl } from '@mui/material'\nimport { styled } from '@mui/material/styles'\nimport PropTypes from 'prop-types'\n\nconst propTypes = {\n organizations: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n id: PropTypes.number,\n })\n ).isRequired,\n userOrganization: PropTypes.shape({\n name: PropTypes.string,\n id: PropTypes.number,\n }),\n userProviderGrouping: PropTypes.shape({\n name: PropTypes.string,\n id: PropTypes.number,\n }),\n onOrganizationChange: PropTypes.func,\n onProviderGroupingChange: PropTypes.func,\n}\n\nconst StyledSelect = styled(Select)({\n minWidth: '200px',\n})\n\nconst MENU_PROPS = {\n variant: 'menu',\n transitionDuration: 0,\n}\n\nconst ProviderGroupingFinder = ({ organizations, userOrganization = null, userProviderGrouping = null, onOrganizationChange = null, onProviderGroupingChange = null }) => {\n const [selectedOrganization, setSelectedOrganization] = useState(userOrganization?.id || '')\n const [selectedPg, setSelectedPg] = useState('')\n const [pgData, setPgData] = useState([])\n\n useEffect(() => {\n if (userOrganization?.id) {\n $.ajax({\n method: 'get',\n url: '/admin/provider_grouping_search',\n dataType: 'json',\n contentType: 'application/json',\n data: { org: userOrganization.id }\n })\n .done((response) => {\n setPgData(response)\n // Set the provider grouping value only after data is loaded\n if (userProviderGrouping?.id) {\n setSelectedPg(userProviderGrouping.id)\n if (onProviderGroupingChange) onProviderGroupingChange(userProviderGrouping.id)\n }\n })\n .fail((error) => {\n console.error(error)\n })\n }\n }, [userOrganization?.id, userProviderGrouping?.id])\n\n const handleOrganizationChange = (event) => {\n const newOrganization = event.target.value\n setSelectedOrganization(newOrganization)\n if (onOrganizationChange) onOrganizationChange(newOrganization)\n\n // Clear the selected provider grouping when organization changes\n setSelectedPg('')\n if (onProviderGroupingChange) onProviderGroupingChange('')\n \n $.ajax({\n method: 'get',\n url: '/admin/provider_grouping_search',\n dataType: 'json',\n contentType: 'application/json',\n data: { org: newOrganization }\n })\n .done((response) => {\n setPgData(response)\n })\n .fail((error) => {\n console.error(error)\n }) \n }\n\n const handlePgChange = (event) => {\n setSelectedPg(event.target.value)\n if (onProviderGroupingChange) onProviderGroupingChange(event.target.value)\n }\n\n return (\n <>\n \n \n Organization\n \n {organizations.map((org) => (\n \n ))}\n \n \n \n Provider Group\n \n {pgData.map((pg) => (\n \n ))}\n \n \n
\n \n \n >\n )\n}\n\nProviderGroupingFinder.propTypes = propTypes\n\nexport default ProviderGroupingFinder","import React, { useState } from 'react'\nimport { Box, Button, Typography, Input, Alert, Snackbar } from '@mui/material'\nimport { CloudUpload } from '@mui/icons-material'\nimport log from '../../utilities/logger'\n\nexport default function UserPgImport() {\n const [file, setFile] = useState(undefined)\n const [notification, setNotification] = useState({ open: false, message: '', severity: 'info' })\n\n const showNotification = (message, severity = 'info') => {\n setNotification({ open: true, message, severity })\n }\n\n const handleCloseNotification = () => {\n setNotification({ ...notification, open: false })\n }\n\n const handleFileSelect = (event) => {\n setFile(event.target.files[0])\n }\n\n const handleFileSubmit = async (event) => {\n event.preventDefault()\n \n const formData = new FormData()\n formData.append(\"file\", file)\n \n try {\n const response = await fetch('/users/provider_grouping_csv', {\n method: 'POST',\n body: formData,\n })\n\n if (!response.ok) {\n const contentType = response.headers.get('content-type')\n let errorMessage = \"Unknown error\"\n \n if (contentType && contentType.includes('application/json')) {\n const errorData = await response.json()\n errorMessage = errorData.errors || errorData.error || errorData.message || JSON.stringify(errorData) || errorMessage\n } else {\n const text = await response.text().catch(() => null)\n errorMessage = text || `Server error: ${response.status} ${response.statusText}`\n }\n \n throw new Error(errorMessage)\n }\n\n showNotification('User csv successfully imported', 'success')\n \n } catch (error) {\n log({ title: \"Failed to import user provider groupings CSV\", className: 'UserPgImport', values: { error }, context: { fileName: file?.name } })\n showNotification(`Error importing User's provider_groupings. ${error.message}`, 'error')\n console.error(error)\n }\n }\n\n return (\n <>\n \n {/* Your existing form content */}\n \n User Import (CSV)\n \n\n \n \n Upload a CSV file to update users' provider grouping assignments.\n \n \n CSV must contain these 2 columns:\n \n \n emr_user_name,target_provider_grouping_id\n \n \n \n \n \n \n {file && (\n \n {file.name}\n \n )}\n \n \n \n \n\n \n \n {notification.message}\n \n \n >\n )\n}","import React from 'react'\nimport PropTypes from 'prop-types'\nimport TextField from '@mui/material/TextField'\nimport FormControl from '@mui/material/FormControl'\nimport InputLabel from '@mui/material/InputLabel'\nimport Select from '@mui/material/Select'\nimport MenuItem from '@mui/material/MenuItem'\nimport RadioButtons from '../reusableComponents/RadioButtons.jsx'\n\nconst UserFormStep1 = (props) => {\n // for practice selector\n const practiceOptions = _.map(props.organizations, org => (\n \n ))\n\n // for provider group selector\n let selectedOrg = null\n if (props.isAdmin) {\n selectedOrg = _.find(props.organizations, { id: props.defaultOrganizationId })\n } else {\n selectedOrg = _.find(props.organizations, { id: parseInt(props.organizationId, 10) })\n }\n\n let providerGroupOptions = []\n if (selectedOrg) {\n providerGroupOptions = _.map(selectedOrg.provider_groupings, group => (\n \n ))\n }\n\n let providerGroupSelectSection\n if (providerGroupOptions.length > 0) {\n providerGroupSelectSection = (\n \n Provider group\n \n \n )\n }\n\n return (\n \n \n\n \n\n \n\n \n\n \n Practice\n \n \n\n {providerGroupSelectSection}\n\n \n
\n\n )\n}\n\nUserFormStep1.propTypes = {\n defaultOrganizationId: PropTypes.string,\n defaultProviderGroupingId: PropTypes.string,\n email: PropTypes.string,\n emrUserName: PropTypes.string,\n firstName: PropTypes.string,\n handleInputChange: PropTypes.func,\n handleOrgSelect: PropTypes.func,\n handleProviderGroupSelect: PropTypes.func,\n isAdmin: PropTypes.bool,\n lastName: PropTypes.string,\n medicalAssistant: PropTypes.bool,\n organizationId: PropTypes.string,\n organizations: PropTypes.arrayOf(PropTypes.object),\n providerGroupingId: PropTypes.string,\n updateMedicalAssistantBoolean: PropTypes.func,\n}\n\nexport default UserFormStep1\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport Checkbox from '@mui/material/Checkbox'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport DepartmentsTypeahead from '../reusableComponents/DepartmentsTypeahead'\n\nconst DEPARTMENT = PropTypes.shape({\n name: PropTypes.string,\n id: PropTypes.id,\n})\n\nconst propTypes = {\n departments: PropTypes.arrayOf(DEPARTMENT).isRequired,\n allDepartments: PropTypes.arrayOf(DEPARTMENT).isRequired,\n onOptionSelected: PropTypes.func.isRequired,\n handleClick: PropTypes.func.isRequired,\n}\n\nexport default class UserFormStep2 extends React.Component {\n constructor(props) {\n super(props)\n this.handleOptionSelected = this.handleOptionSelected.bind(this)\n this.typeahead = null\n }\n\n handleOptionSelected(option) {\n const { onOptionSelected } = this.props\n onOptionSelected(option)\n this.typeahead.typeahead.setEntryText('')\n }\n\n render() {\n const {\n departments, allDepartments, handleClick,\n } = this.props\n const departmentsList = departments.map((dept) => (\n \n \n }\n label={dept.name}\n />\n
\n ))\n const options = allDepartments.filter((d) => departments.findIndex((dept) => dept.id !== d.id))\n\n return (\n \n
\n { this.typeahead = el }}\n onOptionSelected={this.handleOptionSelected}\n options={options}\n />\n
\n
\n {departmentsList}\n
\n
\n )\n }\n}\n\nUserFormStep2.propTypes = propTypes\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport DatePicker from 'react-datepicker'\n\nconst UserFormStep3 = props => (\n \n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n \n
\n
\n)\n\nUserFormStep3.propTypes = {\n billable: PropTypes.bool,\n updateCheckBox: PropTypes.func,\n ssoAccessPermitted: PropTypes.bool,\n admin: PropTypes.bool,\n goLiveDate: PropTypes.instanceOf(Date),\n handleDateChange: PropTypes.func,\n}\n\nexport default UserFormStep3\n","import React from 'react'\nimport dayjs from '../utilities/dayjs'\nimport { ajaxFail } from '../utilities/auth'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport CardContent from '@mui/material/CardContent'\nimport Typography from '@mui/material/Typography'\nimport Divider from '@mui/material/Divider'\n\nimport UserFormStep1 from './userFormStep1.jsx'\nimport UserFormStep2 from './userFormStep2.jsx'\nimport UserFormStep3 from './userFormStep3.jsx'\n\nexport const joinTerms = (terms) => {\n if (terms === null || terms === undefined) throw new Error(\"not an array\")\n if (terms.hasOwnProperty('length') && terms.length < 2) throw new Error(\"has less than two terms\")\n if (terms.length === 2) {\n return terms.join(' and ')\n }\n return `${terms.slice(0, terms.length - 1).join(', ')}, and ${terms[terms.length - 1]}`\n}\n\nexport const parseErrorMessage = (error) => {\n const { responseJSON } = error\n if (responseJSON === null || responseJSON === undefined) {\n return 'Submit error. Try again'\n }\n const keys = Object.keys(responseJSON)\n // This could be more robust, but we're assuming this is just to handle\n // uniqueness constraints.\n if (keys.length === 1) {\n return `${keys[0]} has already been taken.`\n }\n return `${joinTerms(keys)} have already been taken.`\n}\n\nconst validateNoBlanks = (fields) => {\n const valid = !(_.findKey(fields, el => el === '' ))\n if (!valid) {\n window.flash.error('All fields must be completed.')\n return false\n }\n return true\n}\n\nexport default class UserFormStateMachine extends React.Component {\n constructor(props) {\n super(props)\n this.state = {\n step: 1,\n firstName: '',\n lastName: '',\n emrUserName: '',\n email: '',\n medicalAssistant: true,\n billable: false,\n ssoAccessPermitted: true,\n admin: false,\n departmentsList: [],\n organizationId: props.isAdmin ? props.defaultOrganizationId : '',\n providerGroupingId: props.isAdmin ? props.defaultProviderGroupingId : '',\n goLiveDate: dayjs(),\n }\n this.updateMedicalAssistantBoolean = this.updateMedicalAssistantBoolean.bind(this)\n this.saveAndContinue = this.saveAndContinue.bind(this)\n this.updateCheckBox = this.updateCheckBox.bind(this)\n this.decrementCounter = this.decrementCounter.bind(this)\n this.handleInputChange = this.handleInputChange.bind(this)\n this.typeaheadOptionSelected = this.typeaheadOptionSelected.bind(this)\n this.handleProviderGroupSelect = this.handleProviderGroupSelect.bind(this)\n this.handleOrgSelect = this.handleOrgSelect.bind(this)\n this.handleDateChange = this.handleDateChange.bind(this)\n this.handleDepartmentClick = this.handleDepartmentClick.bind(this)\n }\n\n handleInputChange (event) {\n const fieldKey = event.target.id\n let newState = {}\n newState[fieldKey] = event.target.value\n this.setState(newState)\n }\n\n updateMedicalAssistantBoolean (formEl) {\n const boolean = (formEl.value === 'true') ? true : false\n this.setState({ medicalAssistant: boolean })\n }\n\n updateCheckBox (event) {\n const fieldKey = event.target.id\n let newState = {}\n newState[fieldKey] = !this.state[fieldKey]\n this.setState(newState)\n }\n\n handleOrgSelect(event) {\n const orgId = event.target.value\n this.setState({ organizationId: orgId })\n }\n\n handleProviderGroupSelect(event) {\n const providerGroupingId = event.target.value\n this.setState({ providerGroupingId })\n }\n \n handleDateChange(date) {\n this.setState({ goLiveDate: date ? dayjs(date) : dayjs() })\n }\n\n handleDepartmentClick(event) {\n const element = event.target.parentNode\n const name = element.dataset.key\n this.setState({ departmentsList: this.state.departmentsList.filter(dept => dept.name !== name) })\n }\n\n submitData() {\n const department_ids = _.map(this.state.departmentsList, 'objectID')\n const user = {\n first_name: this.state.firstName,\n last_name: this.state.lastName,\n emr_user_name: this.state.emrUserName.toLowerCase().replace(/ /g,''),\n email: this.state.email,\n medical_assistant: this.state.medicalAssistant,\n billable: this.state.billable,\n sso_access_permitted: this.state.ssoAccessPermitted,\n admin: this.state.admin,\n organization_id: this.state.organizationId,\n provider_grouping_id: this.state.providerGroupingId,\n go_live_date: dayjs(this.state.goLiveDate).format(),\n department_ids\n }\n\n $.post('/admin/users/add', { user })\n .done(response => { this.incrementCounter() })\n .fail(error => {\n if (window.checkTimeout(error) === true) {\n redirectToLogin()\n } else {\n const message = parseErrorMessage(error)\n window.flash.error(message)\n }\n })\n }\n\n saveAndContinue(event) {\n if (this.state.step === 1) {\n if (validateNoBlanks(_.pick(this.state, ['firstName', 'lastName', 'emrUserName', 'organizationId'])) === false) return\n const username = this.state.emrUserName.toLowerCase().replace(/ /g, '')\n this.verifyEmrUserName(username).then(({ username_valid }) => {\n if (!username_valid && !this.state.medicalAssistant) {\n window.flash.error('This EMR username is not valid.')\n return\n }\n this.verifyUserDoesNotExist(username).then(({ user_exist }) => {\n if (!user_exist) {\n this.incrementCounter()\n } else {\n window.flash.error('This user already exists.')\n }\n })\n })\n } else if (this.state.step === 3) {\n this.submitData()\n } else {\n this.incrementCounter()\n }\n }\n\n incrementCounter () {\n this.setState({ step: this.state.step + 1 })\n }\n\n decrementCounter () {\n this.setState({ step: this.state.step - 1 })\n }\n\n /**\n * @method optionSelected fires when a Typeahead choice is selected\n * and makes AJAX call to update the order preference in Rails for that OrderPreference id\n * or change state\n * @param {opt} object from the array of order options in the Typeahead -\n */\n typeaheadOptionSelected(opt) {\n const departmentsList = this.state.departmentsList\n departmentsList.push(opt)\n this.setState({ departmentsList })\n }\n\n\n verifyUserDoesNotExist(userName) {\n return $.post('/admin/users/verify_user_does_not_exist', { user: { emr_user_name: userName, organization_id: this.state.organizationId } })\n .done(() => true)\n .fail((error) => ajaxFail(error, 'This user already exists.'))\n }\n\n verifyEmrUserName(userName) {\n return $.post('/admin/users/verify_emr_user_name', { user: { emr_user_name: userName, organization_id: this.state.organizationId } })\n .done(() => true)\n .fail((error) => {\n if (window.checkTimeout(error) === true) {\n redirectToLogin()\n } else {\n }\n return false\n })\n }\n\n render() {\n let step\n switch (this.state.step) {\n case 1:\n step = \n break\n\n case 2:\n const activeOrganization = this.props.organizations.find(o => o.id === parseInt(this.state.organizationId))\n const allDepartments = activeOrganization.departments\n step = (\n \n )\n\n break\n\n case 3:\n step = \n\n break\n\n case 4:\n step = (\n \n
{`${this.state.firstName} ${this.state.lastName} has been created`}
\n {this.state.medicalAssistant === false &&\n
{`A care team called \"${this.state.firstName} ${this.state.lastName} Care Team\" has been created ${this.state.departmentsList[0] ? `in the ${this.state.departmentsList[0]}` : 'without a'} department.`} Click here to edit that care team.
\n }\n
\n )\n break\n }\n\n let buttons\n if (this.state.step === 4) {\n buttons =\n (\n \n
)\n } else {\n buttons =\n (\n \n \n
)\n }\n\n return(\n \n
\n \n Create a new Avhana user\n \n \n { step }\n
\n { buttons }\n \n \n
\n )\n }\n}\n\n","function replaceClassName(origClass, classToRemove) {\n return origClass.replace(new RegExp(\"(^|\\\\s)\" + classToRemove + \"(?:\\\\s|$)\", 'g'), '$1').replace(/\\s+/g, ' ').replace(/^\\s*|\\s*$/g, '');\n}\n/**\n * Removes a CSS class from a given element.\n * \n * @param element the element\n * @param className the CSS class name\n */\n\n\nexport default function removeClass(element, className) {\n if (element.classList) {\n element.classList.remove(className);\n } else if (typeof element.className === 'string') {\n element.className = replaceClassName(element.className, className);\n } else {\n element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));\n }\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport PropTypes from 'prop-types';\nimport addOneClass from 'dom-helpers/addClass';\nimport removeOneClass from 'dom-helpers/removeClass';\nimport React from 'react';\nimport Transition from './Transition';\nimport { classNamesShape } from './utils/PropTypes';\nimport { forceReflow } from './utils/reflow';\n\nvar _addClass = function addClass(node, classes) {\n return node && classes && classes.split(' ').forEach(function (c) {\n return addOneClass(node, c);\n });\n};\n\nvar removeClass = function removeClass(node, classes) {\n return node && classes && classes.split(' ').forEach(function (c) {\n return removeOneClass(node, c);\n });\n};\n/**\n * A transition component inspired by the excellent\n * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should\n * use it if you're using CSS transitions or animations. It's built upon the\n * [`Transition`](https://reactcommunity.org/react-transition-group/transition)\n * component, so it inherits all of its props.\n *\n * `CSSTransition` applies a pair of class names during the `appear`, `enter`,\n * and `exit` states of the transition. The first class is applied and then a\n * second `*-active` class in order to activate the CSS transition. After the\n * transition, matching `*-done` class names are applied to persist the\n * transition state.\n *\n * ```jsx\n * function App() {\n * const [inProp, setInProp] = useState(false);\n * return (\n * \n *
\n * \n * {\"I'll receive my-node-* classes\"}\n *
\n * \n *
\n *
\n * );\n * }\n * ```\n *\n * When the `in` prop is set to `true`, the child component will first receive\n * the class `example-enter`, then the `example-enter-active` will be added in\n * the next tick. `CSSTransition` [forces a\n * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)\n * between before adding the `example-enter-active`. This is an important trick\n * because it allows us to transition between `example-enter` and\n * `example-enter-active` even though they were added immediately one after\n * another. Most notably, this is what makes it possible for us to animate\n * _appearance_.\n *\n * ```css\n * .my-node-enter {\n * opacity: 0;\n * }\n * .my-node-enter-active {\n * opacity: 1;\n * transition: opacity 200ms;\n * }\n * .my-node-exit {\n * opacity: 1;\n * }\n * .my-node-exit-active {\n * opacity: 0;\n * transition: opacity 200ms;\n * }\n * ```\n *\n * `*-active` classes represent which styles you want to animate **to**, so it's\n * important to add `transition` declaration only to them, otherwise transitions\n * might not behave as intended! This might not be obvious when the transitions\n * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in\n * the example above (minus `transition`), but it becomes apparent in more\n * complex transitions.\n *\n * **Note**: If you're using the\n * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)\n * prop, make sure to define styles for `.appear-*` classes as well.\n */\n\n\nvar CSSTransition = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(CSSTransition, _React$Component);\n\n function CSSTransition() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n _this.appliedClasses = {\n appear: {},\n enter: {},\n exit: {}\n };\n\n _this.onEnter = function (maybeNode, maybeAppearing) {\n var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),\n node = _this$resolveArgument[0],\n appearing = _this$resolveArgument[1];\n\n _this.removeClasses(node, 'exit');\n\n _this.addClass(node, appearing ? 'appear' : 'enter', 'base');\n\n if (_this.props.onEnter) {\n _this.props.onEnter(maybeNode, maybeAppearing);\n }\n };\n\n _this.onEntering = function (maybeNode, maybeAppearing) {\n var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),\n node = _this$resolveArgument2[0],\n appearing = _this$resolveArgument2[1];\n\n var type = appearing ? 'appear' : 'enter';\n\n _this.addClass(node, type, 'active');\n\n if (_this.props.onEntering) {\n _this.props.onEntering(maybeNode, maybeAppearing);\n }\n };\n\n _this.onEntered = function (maybeNode, maybeAppearing) {\n var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),\n node = _this$resolveArgument3[0],\n appearing = _this$resolveArgument3[1];\n\n var type = appearing ? 'appear' : 'enter';\n\n _this.removeClasses(node, type);\n\n _this.addClass(node, type, 'done');\n\n if (_this.props.onEntered) {\n _this.props.onEntered(maybeNode, maybeAppearing);\n }\n };\n\n _this.onExit = function (maybeNode) {\n var _this$resolveArgument4 = _this.resolveArguments(maybeNode),\n node = _this$resolveArgument4[0];\n\n _this.removeClasses(node, 'appear');\n\n _this.removeClasses(node, 'enter');\n\n _this.addClass(node, 'exit', 'base');\n\n if (_this.props.onExit) {\n _this.props.onExit(maybeNode);\n }\n };\n\n _this.onExiting = function (maybeNode) {\n var _this$resolveArgument5 = _this.resolveArguments(maybeNode),\n node = _this$resolveArgument5[0];\n\n _this.addClass(node, 'exit', 'active');\n\n if (_this.props.onExiting) {\n _this.props.onExiting(maybeNode);\n }\n };\n\n _this.onExited = function (maybeNode) {\n var _this$resolveArgument6 = _this.resolveArguments(maybeNode),\n node = _this$resolveArgument6[0];\n\n _this.removeClasses(node, 'exit');\n\n _this.addClass(node, 'exit', 'done');\n\n if (_this.props.onExited) {\n _this.props.onExited(maybeNode);\n }\n };\n\n _this.resolveArguments = function (maybeNode, maybeAppearing) {\n return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`\n : [maybeNode, maybeAppearing];\n };\n\n _this.getClassNames = function (type) {\n var classNames = _this.props.classNames;\n var isStringClassNames = typeof classNames === 'string';\n var prefix = isStringClassNames && classNames ? classNames + \"-\" : '';\n var baseClassName = isStringClassNames ? \"\" + prefix + type : classNames[type];\n var activeClassName = isStringClassNames ? baseClassName + \"-active\" : classNames[type + \"Active\"];\n var doneClassName = isStringClassNames ? baseClassName + \"-done\" : classNames[type + \"Done\"];\n return {\n baseClassName: baseClassName,\n activeClassName: activeClassName,\n doneClassName: doneClassName\n };\n };\n\n return _this;\n }\n\n var _proto = CSSTransition.prototype;\n\n _proto.addClass = function addClass(node, type, phase) {\n var className = this.getClassNames(type)[phase + \"ClassName\"];\n\n var _this$getClassNames = this.getClassNames('enter'),\n doneClassName = _this$getClassNames.doneClassName;\n\n if (type === 'appear' && phase === 'done' && doneClassName) {\n className += \" \" + doneClassName;\n } // This is to force a repaint,\n // which is necessary in order to transition styles when adding a class name.\n\n\n if (phase === 'active') {\n if (node) forceReflow(node);\n }\n\n if (className) {\n this.appliedClasses[type][phase] = className;\n\n _addClass(node, className);\n }\n };\n\n _proto.removeClasses = function removeClasses(node, type) {\n var _this$appliedClasses$ = this.appliedClasses[type],\n baseClassName = _this$appliedClasses$.base,\n activeClassName = _this$appliedClasses$.active,\n doneClassName = _this$appliedClasses$.done;\n this.appliedClasses[type] = {};\n\n if (baseClassName) {\n removeClass(node, baseClassName);\n }\n\n if (activeClassName) {\n removeClass(node, activeClassName);\n }\n\n if (doneClassName) {\n removeClass(node, doneClassName);\n }\n };\n\n _proto.render = function render() {\n var _this$props = this.props,\n _ = _this$props.classNames,\n props = _objectWithoutPropertiesLoose(_this$props, [\"classNames\"]);\n\n return /*#__PURE__*/React.createElement(Transition, _extends({}, props, {\n onEnter: this.onEnter,\n onEntered: this.onEntered,\n onEntering: this.onEntering,\n onExit: this.onExit,\n onExiting: this.onExiting,\n onExited: this.onExited\n }));\n };\n\n return CSSTransition;\n}(React.Component);\n\nCSSTransition.defaultProps = {\n classNames: ''\n};\nCSSTransition.propTypes = process.env.NODE_ENV !== \"production\" ? _extends({}, Transition.propTypes, {\n /**\n * The animation classNames applied to the component as it appears, enters,\n * exits or has finished the transition. A single name can be provided, which\n * will be suffixed for each stage, e.g. `classNames=\"fade\"` applies:\n *\n * - `fade-appear`, `fade-appear-active`, `fade-appear-done`\n * - `fade-enter`, `fade-enter-active`, `fade-enter-done`\n * - `fade-exit`, `fade-exit-active`, `fade-exit-done`\n *\n * A few details to note about how these classes are applied:\n *\n * 1. They are _joined_ with the ones that are already defined on the child\n * component, so if you want to add some base styles, you can use\n * `className` without worrying that it will be overridden.\n *\n * 2. If the transition component mounts with `in={false}`, no classes are\n * applied yet. You might be expecting `*-exit-done`, but if you think\n * about it, a component cannot finish exiting if it hasn't entered yet.\n *\n * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This\n * allows you to define different behavior for when appearing is done and\n * when regular entering is done, using selectors like\n * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply\n * an epic entrance animation when element first appears in the DOM using\n * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can\n * simply use `fade-enter-done` for defining both cases.\n *\n * Each individual classNames can also be specified independently like:\n *\n * ```js\n * classNames={{\n * appear: 'my-appear',\n * appearActive: 'my-active-appear',\n * appearDone: 'my-done-appear',\n * enter: 'my-enter',\n * enterActive: 'my-active-enter',\n * enterDone: 'my-done-enter',\n * exit: 'my-exit',\n * exitActive: 'my-active-exit',\n * exitDone: 'my-done-exit',\n * }}\n * ```\n *\n * If you want to set these classes using CSS Modules:\n *\n * ```js\n * import styles from './styles.css';\n * ```\n *\n * you might want to use camelCase in your CSS file, that way could simply\n * spread them instead of listing them one by one:\n *\n * ```js\n * classNames={{ ...styles }}\n * ```\n *\n * @type {string | {\n * appear?: string,\n * appearActive?: string,\n * appearDone?: string,\n * enter?: string,\n * enterActive?: string,\n * enterDone?: string,\n * exit?: string,\n * exitActive?: string,\n * exitDone?: string,\n * }}\n */\n classNames: classNamesShape,\n\n /**\n * A `` callback fired immediately after the 'enter' or 'appear' class is\n * applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEnter: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'enter-active' or\n * 'appear-active' class is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEntering: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'enter' or\n * 'appear' classes are **removed** and the `done` class is added to the DOM node.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEntered: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'exit' class is\n * applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement)\n */\n onExit: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'exit-active' is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement)\n */\n onExiting: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'exit' classes\n * are **removed** and the `exit-done` class is added to the DOM node.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement)\n */\n onExited: PropTypes.func\n}) : {};\nexport default CSSTransition;","import hasClass from './hasClass';\n/**\n * Adds a CSS class to a given element.\n * \n * @param element the element\n * @param className the CSS class name\n */\n\nexport default function addClass(element, className) {\n if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + \" \" + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + \" \" + className);\n}","/**\n * Checks if a given element has a CSS class.\n * \n * @param element the element\n * @param className the CSS class name\n */\nexport default function hasClass(element, className) {\n if (element.classList) return !!className && element.classList.contains(className);\n return (\" \" + (element.className.baseVal || element.className) + \" \").indexOf(\" \" + className + \" \") !== -1;\n}","// global guid\n\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport jQuery from 'jquery'\nimport CloseIcon from '@mui/icons-material/Close'\nimport Box from '@mui/material/Box'\nimport { CSSTransition, TransitionGroup } from 'react-transition-group'\n\nconst DEFAULT_FLASH_TIMEOUT_MS = 50000\n\nconst deleteCookie = (name) => {\n document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:01 GMT ;domain=.avhana.com;path=/`\n document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:01 GMT ;`\n}\n\nconst getFlashFromCookie = () => {\n let data = null\n if (document.cookie && document.cookie.search('flash') !== -1) {\n const cookies = document.cookie.split(';')\n const name = 'flash'\n let cookieValue = null\n\n for (let i = 0; i < cookies.length; i += 1) {\n const cookie = jQuery.trim(cookies[i])\n if (cookie.substring(0, name.length + 1) === `${name}=`) {\n // fixes problems with Rails escaping.\n cookieValue = decodeURIComponent(cookie.substring(name.length + 1).replace(/\\+/g, '%20'))\n if (cookieValue.length > 0) break // there might be empty \"flash=\" cookies\n }\n }\n if (cookieValue) { deleteCookie('flash') }\n try {\n data = JSON.parse(cookieValue)\n } catch (e) {\n console.error(e)\n }\n }\n\n return data\n}\n\nclass FlashMessages extends React.Component {\n constructor(props) {\n super(props)\n this.state = { messages: [] }\n }\n\n componentDidMount() {\n window.flash = this\n $(document).on('ready page:change', this.handleFlashMessagesHeader.bind(this))\n $(document).on(\"ajax:complete\", () => {\n this.handleFlashMessagesHeader()\n })\n }\n\n error(message, timeout) {\n return this.showMessage('error', message, timeout)\n }\n\n success(message, timeout) {\n return this.showMessage('success', message, timeout)\n }\n\n notice(message, timeout) {\n return this.showMessage('notice', message, timeout)\n }\n\n alert(message, timeout) {\n return this.showMessage('alert', message, timeout)\n }\n\n showMessage(type, message, timeout) {\n const flashMessage = { type, message, timeout, id: guid() }\n const flashTimeout = timeout || DEFAULT_FLASH_TIMEOUT_MS\n this.setState({ messages: [flashMessage] })\n setTimeout(() => { this.setState({ messages: [] }) }, flashTimeout)\n return flashMessage\n }\n\n handleFlashMessagesHeader() {\n const jsonMessages = getFlashFromCookie()\n if (jsonMessages) {\n jsonMessages.forEach((messageHash) => {\n const type = messageHash[0]\n const message = messageHash[1]\n this.showMessage(type, message)\n })\n }\n }\n\n dismissMessage(message) {\n const { messages } = this.state\n _.remove(messages, message)\n deleteCookie('flash')\n this.setState({ messages })\n }\n\n render() {\n const { messages } = this.state\n const flashMessages = messages.map((flash, index) => (\n \n \n {flash.message}\n \n this.dismissMessage(flash)}\n sx={{ cursor: 'pointer', verticalAlign: 'middle' }}\n />\n \n \n \n ))\n\n return (\n \n \n {flashMessages}\n \n
\n )\n }\n}\n\nconst documentReady = () => {\n const reactNode = document.getElementById('flash_messages')\n if (reactNode) {\n ReactDOM.render(, reactNode)\n }\n}\n\ndocument.addEventListener('DOMContentLoaded', documentReady)\n","export default function determineQueuedRecTitle(rec) {\n let recOptions = {}\n if (rec) {\n recOptions = rec.options || {}\n }\n\n let title = ''\n // Add Order, Prescribe or Administer depending on if vaccine\n const isOrderSet = recOptions.order_set === true || recOptions.order_set === 'true'\n if (recOptions.orders && !isOrderSet) {\n if (recOptions.orders[0][\"order_type\"] === 'vaccination') {\n if (recOptions.orders[0].ordering_mode) {\n title = recOptions.orders[0].ordering_mode + ' '\n } else {\n title = 'Administer '\n }\n }\n }\n\n if (isOrderSet) {\n title += recOptions.name\n } else if (recOptions.orders) {\n title += recOptions.orders[0].order_name\n } else if (rec.rule && rec.rule.rule_type === 'documentation') {\n title = rec.rule.action.substr(rec.rule.action.indexOf(' ') + 1)\n } else {\n title += recOptions.entry_name\n }\n\n return title\n}\n","import React from 'react'\n\nconst LoadingSkeleton = () => (\n \n)\n\nexport default LoadingSkeleton\n","import React from 'react'\nimport ReactDOM from 'react-dom'\nimport NotificationBell from '../components/notifications/NotificationBell'\n\nconst mountNotificationBell = () => {\n const reactNode = document.getElementById('notification-bell-mount')\n \n if (reactNode) {\n ReactDOM.render(\n ,\n reactNode\n )\n }\n}\n\n// Mount when DOM is ready\ndocument.addEventListener('DOMContentLoaded', mountNotificationBell)\n","\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z\"\n}), 'Refresh');","/**\n * The MIT License (MIT)\n *\n * Copyright (c) 2017 Jakub Beneš \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nimport ReactDOM from 'react-dom';\nimport getCaretCoordinates from 'textarea-caret';\nimport CustomEvent from 'custom-event';\nimport React from 'react';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _typeof2(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof2 = function _typeof2(obj) {\n return typeof obj;\n };\n } else {\n _typeof2 = function _typeof2(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof2(obj);\n}\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nvar KEY_CODES = {\n ESC: 27,\n UP: 38,\n DOWN: 40,\n LEFT: 37,\n RIGHT: 39,\n ENTER: 13,\n TAB: 9\n}; // This is self-made key shortcuts manager, used for caching key strokes\n\nvar Listener = function Listener() {\n var _this = this;\n\n _classCallCheck(this, Listener);\n\n this.startListen = function (ref) {\n if (!ref) return;\n ref.addEventListener(\"keydown\", _this.f);\n };\n\n this.stopListen = function (ref) {\n if (!ref) return;\n ref.removeEventListener(\"keydown\", _this.f);\n };\n\n this.add = function (keyCodes, fn) {\n var keyCode = keyCodes;\n if (typeof keyCode !== \"object\") keyCode = [keyCode];\n _this.listeners[_this.index] = {\n keyCode: keyCode,\n fn: fn\n };\n return _this.index++;\n };\n\n this.remove = function (id) {\n delete _this.listeners[id];\n };\n\n this.removeAll = function () {\n _this.listeners = {};\n _this.index = 1;\n };\n\n this.index = 1;\n this.listeners = {};\n\n this.f = function (e) {\n if (!e) return;\n var code = e.keyCode || e.which;\n Object.values(_this.listeners).forEach(function (_ref) {\n var keyCode = _ref.keyCode,\n fn = _ref.fn;\n\n if (keyCode.includes(code)) {\n e.stopPropagation();\n e.preventDefault();\n fn(e);\n }\n });\n };\n};\n\nvar Listeners = new Listener();\n\nvar Item =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(Item, _React$Component);\n\n function Item() {\n var _getPrototypeOf2;\n\n var _this;\n\n _classCallCheck(this, Item);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Item)).call.apply(_getPrototypeOf2, [this].concat(args)));\n\n _this.selectItem = function () {\n var _this$props = _this.props,\n item = _this$props.item,\n onSelectHandler = _this$props.onSelectHandler;\n onSelectHandler(item);\n };\n\n return _this;\n }\n\n _createClass(Item, [{\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps) {\n if (this.props.item !== nextProps.item || this.props.selected !== nextProps.selected || this.props.style !== nextProps.style || this.props.className !== nextProps.className) {\n return true;\n }\n\n return false;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var _this$props2 = this.props,\n Component = _this$props2.component,\n style = _this$props2.style,\n onClickHandler = _this$props2.onClickHandler,\n item = _this$props2.item,\n selected = _this$props2.selected,\n className = _this$props2.className,\n innerRef = _this$props2.innerRef;\n return React.createElement(\"li\", {\n className: \"rta__item \".concat(selected === true ? \"rta__item--selected\" : \"\", \" \").concat(className || \"\"),\n style: style\n }, React.createElement(\"div\", {\n className: \"rta__entity \".concat(selected === true ? \"rta__entity--selected\" : \"\"),\n role: \"button\",\n tabIndex: 0,\n onClick: onClickHandler,\n onFocus: this.selectItem,\n onMouseEnter: this.selectItem,\n onTouchStart: function onTouchStart() {\n _this2.clicked = true;\n\n _this2.selectItem();\n },\n onTouchEnd: function onTouchEnd(e) {\n e.preventDefault();\n\n if (_this2.clicked) {\n onClickHandler(e);\n }\n },\n onTouchMove: function onTouchMove() {\n _this2.clicked = false;\n },\n onTouchCancel: function onTouchCancel() {\n _this2.clicked = false;\n }\n /* $FlowFixMe */\n ,\n ref: innerRef\n }, React.createElement(Component, {\n selected: selected,\n entity: item\n })));\n }\n }]);\n\n return Item;\n}(React.Component);\n\nvar List =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(List, _React$Component);\n\n function List() {\n var _getPrototypeOf2;\n\n var _this;\n\n _classCallCheck(this, List);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(List)).call.apply(_getPrototypeOf2, [this].concat(args)));\n _this.state = {\n selectedItem: null\n };\n _this.cachedIdOfItems = new Map();\n\n _this.onPressEnter = function (e) {\n if (typeof e !== \"undefined\") {\n e.preventDefault();\n }\n\n var values = _this.props.values;\n\n _this.modifyText(values[_this.getPositionInList()]);\n };\n\n _this.getPositionInList = function () {\n var values = _this.props.values;\n var selectedItem = _this.state.selectedItem;\n if (!selectedItem) return 0;\n return values.findIndex(function (a) {\n return _this.getId(a) === _this.getId(selectedItem);\n });\n };\n\n _this.getId = function (item) {\n if (_this.cachedIdOfItems.has(item)) {\n // $FlowFixMe\n return _this.cachedIdOfItems.get(item);\n }\n\n var textToReplace = _this.props.getTextToReplace(item);\n\n var computeId = function computeId() {\n if (textToReplace) {\n if (textToReplace.key) {\n return textToReplace.key;\n }\n\n if (typeof item === \"string\" || !item.key) {\n return textToReplace.text;\n }\n }\n\n if (!item.key) {\n throw new Error(\"Item \".concat(JSON.stringify(item), \" has to have defined \\\"key\\\" property\"));\n } // $FlowFixMe\n\n\n return item.key;\n };\n\n var id = computeId();\n\n _this.cachedIdOfItems.set(item, id);\n\n return id;\n };\n\n _this.listeners = [];\n _this.itemsRef = {};\n\n _this.modifyText = function (value) {\n if (!value) return;\n var onSelect = _this.props.onSelect;\n onSelect(value);\n };\n\n _this.selectItem = function (item) {\n var keyboard = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var onItemHighlighted = _this.props.onItemHighlighted;\n if (_this.state.selectedItem === item) return;\n\n _this.setState({\n selectedItem: item\n }, function () {\n onItemHighlighted(item);\n\n if (keyboard) {\n _this.props.dropdownScroll(_this.itemsRef[_this.getId(item)]);\n }\n });\n };\n\n _this.scroll = function (e) {\n e.preventDefault();\n var values = _this.props.values;\n var code = e.keyCode || e.which;\n\n var oldPosition = _this.getPositionInList();\n\n var newPosition;\n\n switch (code) {\n case KEY_CODES.DOWN:\n newPosition = oldPosition + 1;\n break;\n\n case KEY_CODES.UP:\n newPosition = oldPosition - 1;\n break;\n\n default:\n newPosition = oldPosition;\n break;\n }\n\n newPosition = (newPosition % values.length + values.length) % values.length; // eslint-disable-line\n\n _this.selectItem(values[newPosition], [KEY_CODES.DOWN, KEY_CODES.UP].includes(code));\n };\n\n _this.isSelected = function (item) {\n var selectedItem = _this.state.selectedItem;\n if (!selectedItem) return false;\n return _this.getId(selectedItem) === _this.getId(item);\n };\n\n return _this;\n }\n\n _createClass(List, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.listeners.push(Listeners.add([KEY_CODES.DOWN, KEY_CODES.UP], this.scroll), Listeners.add([KEY_CODES.ENTER, KEY_CODES.TAB], this.onPressEnter));\n var values = this.props.values;\n if (values && values[0]) this.selectItem(values[0]);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(_ref) {\n var _this2 = this;\n\n var oldValues = _ref.values;\n var values = this.props.values;\n var oldValuesSerialized = oldValues.map(function (val) {\n return _this2.getId(val);\n }).join(\"\");\n var newValuesSerialized = values.map(function (val) {\n return _this2.getId(val);\n }).join(\"\");\n\n if (oldValuesSerialized !== newValuesSerialized && values && values[0]) {\n this.selectItem(values[0]);\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n var listener;\n\n while (this.listeners.length) {\n listener = this.listeners.pop();\n Listeners.remove(listener);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n var _this$props = this.props,\n values = _this$props.values,\n component = _this$props.component,\n style = _this$props.style,\n itemClassName = _this$props.itemClassName,\n className = _this$props.className,\n itemStyle = _this$props.itemStyle;\n return React.createElement(\"ul\", {\n className: \"rta__list \".concat(className || \"\"),\n style: style\n }, values.map(function (item) {\n return React.createElement(Item, {\n key: _this3.getId(item),\n innerRef: function innerRef(ref) {\n _this3.itemsRef[_this3.getId(item)] = ref;\n },\n selected: _this3.isSelected(item),\n item: item,\n className: itemClassName,\n style: itemStyle,\n onClickHandler: _this3.onPressEnter,\n onSelectHandler: _this3.selectItem,\n component: component\n });\n }));\n }\n }]);\n\n return List;\n}(React.Component);\n\nfunction defaultScrollToItem(container, item) {\n var itemHeight = parseInt(getComputedStyle(item).getPropertyValue(\"height\"), 10);\n var containerHight = parseInt(getComputedStyle(container).getPropertyValue(\"height\"), 10) - itemHeight;\n var itemOffsetTop = item.offsetTop;\n var actualScrollTop = container.scrollTop;\n\n if (itemOffsetTop < actualScrollTop + containerHight && actualScrollTop < itemOffsetTop) {\n return;\n } // eslint-disable-next-line\n\n\n container.scrollTop = itemOffsetTop;\n}\n\nvar DEFAULT_CARET_POSITION = \"next\";\nvar POSITION_CONFIGURATION = {\n X: {\n LEFT: \"rta__autocomplete--left\",\n RIGHT: \"rta__autocomplete--right\"\n },\n Y: {\n TOP: \"rta__autocomplete--top\",\n BOTTOM: \"rta__autocomplete--bottom\"\n }\n};\n\nvar errorMessage = function errorMessage(message) {\n return console.error(\"RTA: dataProvider fails: \".concat(message, \"\\n \\nCheck the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues\"));\n};\n\nvar reservedRegexChars = [\".\", \"^\", \"$\", \"*\", \"+\", \"-\", \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", \"\\\\\", \"|\"];\n\nvar escapeRegex = function escapeRegex(text) {\n return _toConsumableArray(text).map(function (character) {\n return reservedRegexChars.includes(character) ? \"\\\\\".concat(character) : character;\n }).join(\"\");\n}; // The main purpose of this component is to figure out to which side the autocomplete should be opened\n\n\nvar Autocomplete =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(Autocomplete, _React$Component);\n\n function Autocomplete() {\n _classCallCheck(this, Autocomplete);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Autocomplete).apply(this, arguments));\n }\n\n _createClass(Autocomplete, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var boundariesElement = this.props.boundariesElement;\n\n if (typeof boundariesElement === \"string\") {\n var elem = document.querySelector(boundariesElement);\n\n if (!elem) {\n throw new Error(\"RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.\");\n }\n\n this.containerElem = elem;\n } else if (boundariesElement instanceof HTMLElement) {\n this.containerElem = boundariesElement;\n } else {\n throw new Error(\"RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.\");\n }\n\n if (!this.containerElem || !this.containerElem.contains(this.ref)) {\n if (process.env.NODE_ENV !== \"test\") {\n throw new Error(\"RTA: Invalid prop boundariesElement: it has to be one of the parents of the RTA.\");\n }\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n var _this$ref$classList, _this$ref$classList2;\n\n var top = this.props.top || 0;\n var left = this.props.left || 0;\n var usedClasses = [];\n var unusedClasses = [];\n var topPosition = 0;\n var leftPosition = 0;\n var containerBounds = this.containerElem.getBoundingClientRect();\n var dropdownBounds = this.ref.getBoundingClientRect();\n var textareaBounds = this.props.textareaRef.getBoundingClientRect();\n var computedStyle = window.getComputedStyle(this.ref);\n var marginTop = parseInt(computedStyle.getPropertyValue(\"margin-top\"), 10);\n var marginBottom = parseInt(computedStyle.getPropertyValue(\"margin-bottom\"), 10);\n var marginLeft = parseInt(computedStyle.getPropertyValue(\"margin-left\"), 10);\n var marginRight = parseInt(computedStyle.getPropertyValue(\"margin-right\"), 10);\n var dropdownBottom = marginTop + marginBottom + textareaBounds.top + top + dropdownBounds.height;\n var dropdownRight = marginLeft + marginRight + textareaBounds.left + left + dropdownBounds.width;\n\n if (dropdownRight > containerBounds.right && textareaBounds.left + left > dropdownBounds.width) {\n leftPosition = left - dropdownBounds.width;\n usedClasses.push(POSITION_CONFIGURATION.X.LEFT);\n unusedClasses.push(POSITION_CONFIGURATION.X.RIGHT);\n } else {\n leftPosition = left;\n usedClasses.push(POSITION_CONFIGURATION.X.RIGHT);\n unusedClasses.push(POSITION_CONFIGURATION.X.LEFT);\n }\n\n if (dropdownBottom > containerBounds.bottom && textareaBounds.top + top > dropdownBounds.height) {\n topPosition = top - dropdownBounds.height;\n usedClasses.push(POSITION_CONFIGURATION.Y.TOP);\n unusedClasses.push(POSITION_CONFIGURATION.Y.BOTTOM);\n } else {\n topPosition = top;\n usedClasses.push(POSITION_CONFIGURATION.Y.BOTTOM);\n unusedClasses.push(POSITION_CONFIGURATION.Y.TOP);\n }\n\n if (this.props.renderToBody) {\n topPosition += textareaBounds.top;\n leftPosition += textareaBounds.left;\n }\n\n this.ref.style.top = \"\".concat(topPosition, \"px\");\n this.ref.style.left = \"\".concat(leftPosition, \"px\");\n\n (_this$ref$classList = this.ref.classList).remove.apply(_this$ref$classList, unusedClasses);\n\n (_this$ref$classList2 = this.ref.classList).add.apply(_this$ref$classList2, usedClasses);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this = this;\n\n var _this$props = this.props,\n style = _this$props.style,\n className = _this$props.className,\n innerRef = _this$props.innerRef,\n children = _this$props.children,\n renderToBody = _this$props.renderToBody;\n var body = document.body;\n var autocompleteContainer = React.createElement(\"div\", {\n ref: function ref(_ref) {\n // $FlowFixMe\n _this.ref = _ref; // $FlowFixMe\n\n innerRef(_ref);\n },\n className: \"rta__autocomplete \".concat(className || \"\"),\n style: style\n }, children);\n return renderToBody && body !== null ? ReactDOM.createPortal(autocompleteContainer, body) : autocompleteContainer;\n }\n }]);\n\n return Autocomplete;\n}(React.Component);\n\nvar ReactTextareaAutocomplete =\n/*#__PURE__*/\nfunction (_React$Component2) {\n _inherits(ReactTextareaAutocomplete, _React$Component2);\n\n function ReactTextareaAutocomplete(_props) {\n var _this2;\n\n _classCallCheck(this, ReactTextareaAutocomplete);\n\n _this2 = _possibleConstructorReturn(this, _getPrototypeOf(ReactTextareaAutocomplete).call(this, _props));\n _this2.state = {\n top: null,\n left: null,\n currentTrigger: null,\n actualToken: \"\",\n data: null,\n value: \"\",\n dataLoading: false,\n selectionEnd: 0,\n component: null,\n textToReplace: null\n };\n\n _this2.escListenerInit = function () {\n if (!_this2.escListener) {\n _this2.escListener = Listeners.add(KEY_CODES.ESC, _this2._closeAutocomplete);\n }\n };\n\n _this2.escListenerDestroy = function () {\n if (_this2.escListener) {\n Listeners.remove(_this2.escListener);\n _this2.escListener = null;\n }\n };\n\n _this2.getSelectionPosition = function () {\n if (!_this2.textareaRef) return null;\n return {\n selectionStart: _this2.textareaRef.selectionStart,\n selectionEnd: _this2.textareaRef.selectionEnd\n };\n };\n\n _this2.getSelectedText = function () {\n if (!_this2.textareaRef) return null;\n var _this2$textareaRef = _this2.textareaRef,\n selectionStart = _this2$textareaRef.selectionStart,\n selectionEnd = _this2$textareaRef.selectionEnd;\n if (selectionStart === selectionEnd) return null;\n return _this2.state.value.substr(selectionStart, selectionEnd - selectionStart);\n };\n\n _this2.setCaretPosition = function () {\n var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n if (!_this2.textareaRef) return;\n\n _this2.textareaRef.focus();\n\n _this2.textareaRef.setSelectionRange(position, position);\n };\n\n _this2.getCaretPosition = function () {\n if (!_this2.textareaRef) {\n return 0;\n }\n\n var position = _this2.textareaRef.selectionEnd;\n return position;\n };\n\n _this2._handleCaretChange = function (e) {\n var cleanLastTrigger = function cleanLastTrigger() {\n var beforeHandle = _this2.getCaretPosition() - 1;\n _this2.lastTrigger = _this2.lastTrigger ? beforeHandle : 0;\n };\n\n if (e.type === \"keydown\") {\n // $FlowFixMe\n var code = e.keyCode || e.which;\n\n switch (code) {\n case KEY_CODES.UP:\n case KEY_CODES.DOWN:\n if (!_this2._isAutocompleteOpen()) {\n cleanLastTrigger();\n }\n\n break;\n\n case KEY_CODES.LEFT:\n case KEY_CODES.RIGHT:\n cleanLastTrigger();\n break;\n\n default:\n }\n\n return;\n }\n\n cleanLastTrigger();\n };\n\n _this2._onSelect = function (item) {\n var _this2$state = _this2.state,\n selectionEnd = _this2$state.selectionEnd,\n currentTrigger = _this2$state.currentTrigger,\n textareaValue = _this2$state.value;\n var onItemSelected = _this2.props.onItemSelected;\n if (!currentTrigger) return;\n\n var getTextToReplaceForCurrentTrigger = _this2._getTextToReplace(currentTrigger);\n\n if (!getTextToReplaceForCurrentTrigger) {\n _this2._closeAutocomplete();\n\n return;\n }\n\n var newToken = getTextToReplaceForCurrentTrigger(item);\n\n if (!newToken) {\n _this2._closeAutocomplete();\n\n return;\n }\n\n if (onItemSelected) {\n onItemSelected({\n currentTrigger: currentTrigger,\n item: item\n });\n }\n\n var computeCaretPosition = function computeCaretPosition(position, token, startToken) {\n switch (position) {\n case \"start\":\n return startToken;\n\n case \"next\":\n case \"end\":\n return startToken + token.length;\n\n default:\n if (!Number.isInteger(position)) {\n throw new Error('RTA: caretPosition should be \"start\", \"next\", \"end\" or number.');\n }\n\n return position;\n }\n };\n\n var textToModify = textareaValue.slice(0, selectionEnd);\n /**\n * It's important to escape the currentTrigger char for chars like [, (,...\n * This is a ridiculous dark magic, basically we found position of the last current token (from current trigger) and then we replace the text from that position (calculating the offset)\n */\n\n var escapedCurrentTrigger = escapeRegex(currentTrigger);\n var triggerOffset = textToModify.length - textToModify.lastIndexOf(currentTrigger);\n var startOfTokenPosition = textToModify.search(new RegExp(\"(?!\".concat(escapedCurrentTrigger, \")$\"))) - triggerOffset; // we add space after emoji is selected if a caret position is next\n\n var newTokenString = newToken.caretPosition === \"next\" ? \"\".concat(newToken.text, \" \") : newToken.text;\n var newCaretPosition = computeCaretPosition(newToken.caretPosition, newTokenString, startOfTokenPosition);\n var modifiedText = textToModify.substring(0, startOfTokenPosition) + newTokenString;\n var newValue = textareaValue.replace(textToModify, modifiedText); // set the new textarea value and after that set the caret back to its position\n\n _this2.setState({\n value: newValue,\n dataLoading: false\n }, function () {\n var insertedTrigger = _this2.tokenRegExpEnding.exec(newTokenString);\n\n var insertedTriggerModifier = insertedTrigger ? insertedTrigger[0].length : 1;\n _this2.lastTrigger = newCaretPosition ? newCaretPosition - insertedTriggerModifier : newCaretPosition;\n _this2.textareaRef.value = newValue;\n _this2.textareaRef.selectionEnd = newCaretPosition;\n\n _this2._changeHandler();\n\n var scrollTop = _this2.textareaRef.scrollTop;\n\n _this2.setCaretPosition(newCaretPosition);\n /*\n Chrome does not maintain scroll position\n Relevant discussion https://github.com/webscopeio/react-textarea-autocomplete/pull/97\n */\n\n\n if (window.chrome) {\n _this2.textareaRef.scrollTop = scrollTop;\n }\n });\n };\n\n _this2._getTextToReplace = function (currentTrigger) {\n var triggerSettings = _this2.props.trigger[currentTrigger];\n if (!currentTrigger || !triggerSettings) return null;\n var output = triggerSettings.output;\n return function (item) {\n if (typeof item === \"object\" && (!output || typeof output !== \"function\")) {\n throw new Error('Output functor is not defined! If you are using items as object you have to define \"output\" function. https://github.com/webscopeio/react-textarea-autocomplete#trigger-type');\n }\n\n if (output) {\n var textToReplace = output(item, currentTrigger);\n\n if (textToReplace === undefined || typeof textToReplace === \"number\") {\n throw new Error(\"Output functor should return string or object in shape {text: string, caretPosition: string | number}.\\nGot \\\"\".concat(String(textToReplace), \"\\\". Check the implementation for trigger \\\"\").concat(currentTrigger, \"\\\"\\n\\nSee https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information.\\n\"));\n }\n\n if (textToReplace === null) return null;\n\n if (typeof textToReplace === \"string\") {\n return {\n text: textToReplace,\n caretPosition: DEFAULT_CARET_POSITION\n };\n }\n\n if (!textToReplace.text && typeof textToReplace.text !== 'string') {\n throw new Error(\"Output \\\"text\\\" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger \\\"\".concat(currentTrigger, \"\\\"\\n\"));\n }\n\n if (!textToReplace.caretPosition) {\n throw new Error(\"Output \\\"caretPosition\\\" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger \\\"\".concat(currentTrigger, \"\\\"\\n\"));\n }\n\n return textToReplace;\n }\n\n if (typeof item !== \"string\") {\n throw new Error(\"Output item should be string\\n\");\n }\n\n return {\n text: \"\".concat(currentTrigger).concat(item).concat(currentTrigger),\n caretPosition: DEFAULT_CARET_POSITION\n };\n };\n };\n\n _this2._getCurrentTriggerSettings = function () {\n var currentTrigger = _this2.state.currentTrigger;\n if (!currentTrigger) return null;\n return _this2.props.trigger[currentTrigger];\n };\n\n _this2._getValuesFromProvider = function () {\n var _this2$state2 = _this2.state,\n currentTrigger = _this2$state2.currentTrigger,\n actualToken = _this2$state2.actualToken;\n\n var triggerSettings = _this2._getCurrentTriggerSettings();\n\n if (!currentTrigger || !triggerSettings) {\n return;\n }\n\n var dataProvider = triggerSettings.dataProvider,\n component = triggerSettings.component;\n\n if (typeof dataProvider !== \"function\") {\n throw new Error(\"Trigger provider has to be a function!\");\n }\n\n _this2.setState({\n dataLoading: true\n });\n\n var providedData = dataProvider(actualToken);\n\n if (!(providedData instanceof Promise)) {\n providedData = Promise.resolve(providedData);\n }\n\n providedData.then(function (data) {\n if (!Array.isArray(data)) {\n throw new Error(\"Trigger provider has to provide an array!\");\n }\n\n if (typeof component !== \"function\") {\n throw new Error(\"Component should be defined!\");\n } // throw away if we resolved old trigger\n\n\n if (currentTrigger !== _this2.state.currentTrigger) return; // if we haven't resolved any data let's close the autocomplete\n\n if (!data.length) {\n _this2._closeAutocomplete();\n\n return;\n }\n\n _this2.setState({\n dataLoading: false,\n data: data,\n component: component\n });\n }).catch(function (e) {\n return errorMessage(e.message);\n });\n };\n\n _this2._getSuggestions = function () {\n var _this2$state3 = _this2.state,\n currentTrigger = _this2$state3.currentTrigger,\n data = _this2$state3.data;\n if (!currentTrigger || !data || data && !data.length) return null;\n return data;\n };\n\n _this2._createRegExp = function () {\n var trigger = _this2.props.trigger; // negative lookahead to match only the trigger + the actual token = \"bladhwd:adawd:word test\" => \":word\"\n // https://stackoverflow.com/a/8057827/2719917\n\n _this2.tokenRegExp = new RegExp(\"(\".concat(Object.keys(trigger) // the sort is important for multi-char combos as \"/kick\", \"/\"\n .sort(function (a, b) {\n if (a < b) {\n return 1;\n }\n\n if (a > b) {\n return -1;\n }\n\n return 0;\n }).map(function (a) {\n return escapeRegex(a);\n }).join(\"|\"), \")((?:(?!\\\\1)[^\\\\s])*$)\"));\n _this2.tokenRegExpEnding = new RegExp(\"(\".concat(Object.keys(trigger) // the sort is important for multi-char combos as \"/kick\", \"/\"\n .sort(function (a, b) {\n if (a < b) {\n return 1;\n }\n\n if (a > b) {\n return -1;\n }\n\n return 0;\n }).map(function (a) {\n return escapeRegex(a);\n }).join(\"|\"), \")$\"));\n };\n\n _this2._closeAutocomplete = function () {\n var currentTrigger = _this2.state.currentTrigger;\n\n _this2.escListenerDestroy();\n\n _this2.setState({\n data: null,\n dataLoading: false,\n currentTrigger: null\n }, function () {\n if (currentTrigger) _this2._onItemHighlightedHandler(null);\n });\n };\n\n _this2._cleanUpProps = function () {\n var props = _objectSpread({}, _this2.props);\n\n var notSafe = [\"loadingComponent\", \"boundariesElement\", \"containerStyle\", \"minChar\", \"scrollToItem\", \"ref\", \"innerRef\", \"onChange\", \"onCaretPositionChange\", \"className\", \"value\", \"trigger\", \"listStyle\", \"itemStyle\", \"containerStyle\", \"loaderStyle\", \"className\", \"containerClassName\", \"listClassName\", \"itemClassName\", \"loaderClassName\", \"dropdownStyle\", \"dropdownClassName\", \"movePopupAsYouType\", \"textAreaComponent\", \"renderToBody\", \"onItemSelected\", \"onItemHighlighted\"]; // eslint-disable-next-line\n\n for (var prop in props) {\n if (notSafe.includes(prop)) delete props[prop];\n }\n\n return props;\n };\n\n _this2._changeHandler = function (e) {\n var _this2$props = _this2.props,\n trigger = _this2$props.trigger,\n onChange = _this2$props.onChange,\n minChar = _this2$props.minChar,\n onCaretPositionChange = _this2$props.onCaretPositionChange,\n movePopupAsYouType = _this2$props.movePopupAsYouType;\n var _this2$state4 = _this2.state,\n top = _this2$state4.top,\n left = _this2$state4.left;\n var event = e;\n\n if (!event) {\n // fire onChange event after successful selection\n event = new CustomEvent(\"change\", {\n bubbles: true\n });\n\n _this2.textareaRef.dispatchEvent(event);\n }\n\n var textarea = event.target || _this2.textareaRef; // fallback to support Shadow DOM\n\n var selectionEnd = textarea.selectionEnd;\n var value = textarea.value;\n _this2.lastValueBubbledEvent = value;\n\n if (onChange && event) {\n event.persist && event.persist();\n onChange(new Proxy(event, {\n get: function get(original, prop, receiver) {\n if (prop === \"target\") {\n return textarea;\n }\n\n return Reflect.get(original, prop, receiver);\n }\n }));\n }\n\n if (onCaretPositionChange) {\n var caretPosition = _this2.getCaretPosition();\n\n onCaretPositionChange(caretPosition);\n }\n\n _this2.setState({\n value: value\n });\n\n var setTopLeft = function setTopLeft() {\n var _getCaretCoordinates = getCaretCoordinates(textarea, selectionEnd),\n newTop = _getCaretCoordinates.top,\n newLeft = _getCaretCoordinates.left;\n\n _this2.setState({\n // make position relative to textarea\n top: newTop - _this2.textareaRef.scrollTop || 0,\n left: newLeft\n });\n };\n\n var cleanLastTrigger = function cleanLastTrigger(triggerLength) {\n _this2.lastTrigger = selectionEnd - triggerLength;\n\n _this2._closeAutocomplete();\n\n setTopLeft();\n };\n\n if (selectionEnd <= _this2.lastTrigger) {\n var _affectedTextareaValue = value.slice(0, selectionEnd);\n\n var _newTrigger = _this2.tokenRegExp.exec(_affectedTextareaValue);\n\n cleanLastTrigger(_newTrigger ? _newTrigger[0].length : 0);\n }\n\n var affectedTextareaValue = value.slice(_this2.lastTrigger, selectionEnd);\n\n var tokenMatch = _this2.tokenRegExp.exec(affectedTextareaValue);\n\n var lastToken = tokenMatch && tokenMatch[0];\n var currentTrigger = tokenMatch && tokenMatch[1] || null;\n var currentTriggerLength = currentTrigger ? currentTrigger.length - 1 : 0; // with this approach we want to know if the user just inserted a new trigger sequence\n\n var newTrigger = _this2.tokenRegExpEnding.exec(affectedTextareaValue);\n\n if (newTrigger) {\n cleanLastTrigger(newTrigger[0].length);\n } else if (!_this2._isAutocompleteOpen()) {\n _this2._closeAutocomplete();\n }\n /*\n if we lost the trigger token or there is no following character we want to close\n the autocomplete\n */\n\n\n if ((!lastToken || lastToken.length <= minChar + currentTriggerLength) && ( // check if our current trigger disallows whitespace\n _this2.state.currentTrigger && !trigger[_this2.state.currentTrigger].allowWhitespace || !_this2.state.currentTrigger)) {\n _this2._closeAutocomplete();\n\n return;\n }\n /**\n * This code has to be sync that is the reason why we obtain the currentTrigger\n * from currentTrigger not this.state.currentTrigger\n *\n * Check if the currently typed token has to be afterWhitespace, or not.\n *\n * This setting means that there has to be whitespace before the token (on it has to be the the first character typed into textarea)\n */\n\n\n if (currentTrigger && trigger[currentTrigger].afterWhitespace && !/\\s/.test(value[selectionEnd - lastToken.length - 1]) && value[selectionEnd - lastToken.length - 1] !== undefined) {\n _this2._closeAutocomplete();\n\n return;\n }\n /**\n If our current trigger allows whitespace\n get the correct token for DataProvider, so we need to construct new RegExp\n */\n\n\n if (_this2.state.currentTrigger && trigger[_this2.state.currentTrigger].allowWhitespace) {\n tokenMatch = new RegExp(\"\".concat(escapeRegex(_this2.state.currentTrigger), \".*$\")).exec(value.slice(0, selectionEnd));\n lastToken = tokenMatch && tokenMatch[0];\n\n if (!lastToken) {\n _this2._closeAutocomplete();\n\n return;\n }\n\n currentTrigger = Object.keys(trigger).find(function (a) {\n return a.slice(0, currentTriggerLength + 1) === lastToken.slice(0, currentTriggerLength + 1);\n }) || null;\n }\n\n var actualToken = lastToken.slice(1); // if trigger is not configured step out from the function, otherwise proceed\n\n if (!currentTrigger) {\n return;\n }\n\n if (movePopupAsYouType || top === null && left === null || // if the trigger got changed, let's reposition the autocomplete\n _this2.state.currentTrigger !== currentTrigger) {\n setTopLeft();\n }\n\n _this2.escListenerInit();\n\n var textToReplace = _this2._getTextToReplace(currentTrigger);\n\n _this2.setState({\n selectionEnd: selectionEnd,\n currentTrigger: currentTrigger,\n textToReplace: textToReplace,\n actualToken: actualToken\n }, function () {\n try {\n _this2._getValuesFromProvider();\n } catch (err) {\n errorMessage(err.message);\n }\n });\n };\n\n _this2._selectHandler = function (e) {\n var _this2$props2 = _this2.props,\n onCaretPositionChange = _this2$props2.onCaretPositionChange,\n onSelect = _this2$props2.onSelect;\n\n if (onCaretPositionChange) {\n var caretPosition = _this2.getCaretPosition();\n\n onCaretPositionChange(caretPosition);\n }\n\n if (onSelect) {\n e.persist();\n onSelect(e);\n }\n };\n\n _this2._shouldStayOpen = function (e) {\n var el = e.relatedTarget; // IE11 doesn't know about `relatedTarget` // https://stackoverflow.com/a/49325196/2719917\n\n if (el === null) {\n el = document.activeElement;\n }\n\n if (_this2.dropdownRef && el instanceof Node && _this2.dropdownRef.contains(el)) {\n return true;\n }\n\n return false;\n };\n\n _this2._onClick = function (e) {\n var onClick = _this2.props.onClick;\n\n if (onClick) {\n e.persist();\n onClick(e);\n }\n\n if (_this2._shouldStayOpen(e)) {\n return;\n }\n\n _this2._closeAutocomplete();\n };\n\n _this2._onBlur = function (e) {\n var onBlur = _this2.props.onBlur;\n\n if (onBlur) {\n e.persist();\n onBlur(e);\n }\n\n if (_this2._shouldStayOpen(e)) {\n return;\n }\n\n _this2._closeAutocomplete();\n };\n\n _this2._onScrollHandler = function () {\n _this2._closeAutocomplete();\n };\n\n _this2._onItemHighlightedHandler = function (item) {\n var onItemHighlighted = _this2.props.onItemHighlighted;\n var currentTrigger = _this2.state.currentTrigger;\n\n if (onItemHighlighted) {\n if (typeof onItemHighlighted === \"function\") {\n onItemHighlighted({\n currentTrigger: currentTrigger,\n item: item\n });\n } else {\n throw new Error(\"`onItemHighlighted` has to be a function\");\n }\n }\n };\n\n _this2._dropdownScroll = function (item) {\n var scrollToItem = _this2.props.scrollToItem;\n if (!scrollToItem) return;\n\n if (scrollToItem === true) {\n defaultScrollToItem(_this2.dropdownRef, item);\n return;\n }\n\n if (typeof scrollToItem !== \"function\" || scrollToItem.length !== 2) {\n throw new Error(\"`scrollToItem` has to be boolean (true for default implementation) or function with two parameters: container, item.\");\n }\n\n scrollToItem(_this2.dropdownRef, item);\n };\n\n _this2._isAutocompleteOpen = function () {\n var _this2$state5 = _this2.state,\n dataLoading = _this2$state5.dataLoading,\n currentTrigger = _this2$state5.currentTrigger;\n\n var suggestionData = _this2._getSuggestions();\n\n return !!((dataLoading || suggestionData) && currentTrigger);\n };\n\n _this2._textareaRef = function (ref) {\n // $FlowFixMe - ref is actually a `?HTMLTextAreaElement`\n _this2.props.innerRef && _this2.props.innerRef(ref);\n _this2.textareaRef = ref;\n };\n\n _this2.lastTrigger = 0;\n _this2.escListener = null;\n var _this2$props3 = _this2.props,\n loadingComponent = _this2$props3.loadingComponent,\n _trigger = _this2$props3.trigger,\n _value = _this2$props3.value;\n if (_value) _this2.state.value = _value;\n\n _this2._createRegExp();\n\n if (!loadingComponent) {\n throw new Error(\"RTA: loadingComponent is not defined\");\n }\n\n if (!_trigger) {\n throw new Error(\"RTA: trigger is not defined\");\n }\n\n return _this2;\n }\n\n _createClass(ReactTextareaAutocomplete, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n Listeners.startListen(this.textareaRef); // handle caret change\n\n this.textareaRef && this.textareaRef.addEventListener(\"focus\", this._handleCaretChange);\n this.textareaRef && this.textareaRef.addEventListener(\"click\", this._handleCaretChange);\n this.textareaRef && this.textareaRef.addEventListener(\"keydown\", this._handleCaretChange);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(_ref2) {\n var oldTrigger = _ref2.trigger,\n oldValue = _ref2.value;\n var _this$props2 = this.props,\n trigger = _this$props2.trigger,\n value = _this$props2.value;\n\n if (Object.keys(trigger).join(\"\") !== Object.keys(oldTrigger).join(\"\")) {\n this._createRegExp();\n }\n\n if (oldValue !== value && this.lastValueBubbledEvent !== value) {\n this.lastTrigger = 0;\n\n this._changeHandler();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.escListenerDestroy();\n Listeners.stopListen(this.textareaRef); // handle caret change\n\n this.textareaRef && this.textareaRef.removeEventListener(\"focus\", this._handleCaretChange);\n this.textareaRef && this.textareaRef.removeEventListener(\"click\", this._handleCaretChange);\n this.textareaRef && this.textareaRef.removeEventListener(\"keydown\", this._handleCaretChange);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n var _this$props3 = this.props,\n Loader = _this$props3.loadingComponent,\n style = _this$props3.style,\n className = _this$props3.className,\n listStyle = _this$props3.listStyle,\n itemStyle = _this$props3.itemStyle,\n boundariesElement = _this$props3.boundariesElement,\n movePopupAsYouType = _this$props3.movePopupAsYouType,\n listClassName = _this$props3.listClassName,\n itemClassName = _this$props3.itemClassName,\n dropdownClassName = _this$props3.dropdownClassName,\n dropdownStyle = _this$props3.dropdownStyle,\n containerStyle = _this$props3.containerStyle,\n containerClassName = _this$props3.containerClassName,\n loaderStyle = _this$props3.loaderStyle,\n loaderClassName = _this$props3.loaderClassName,\n textAreaComponent = _this$props3.textAreaComponent,\n renderToBody = _this$props3.renderToBody;\n var _this$state = this.state,\n left = _this$state.left,\n top = _this$state.top,\n dataLoading = _this$state.dataLoading,\n component = _this$state.component,\n value = _this$state.value,\n textToReplace = _this$state.textToReplace;\n\n var isAutocompleteOpen = this._isAutocompleteOpen();\n\n var suggestionData = this._getSuggestions();\n\n var extraAttrs = {};\n var TextAreaComponent;\n\n if (textAreaComponent.component) {\n TextAreaComponent = textAreaComponent.component;\n extraAttrs[textAreaComponent.ref] = this._textareaRef;\n } else {\n TextAreaComponent = textAreaComponent;\n extraAttrs.ref = this._textareaRef;\n }\n\n return React.createElement(\"div\", {\n className: \"rta \".concat(dataLoading === true ? \"rta--loading\" : \"\", \" \").concat(containerClassName || \"\"),\n style: containerStyle\n }, React.createElement(TextAreaComponent, Object.assign({}, this._cleanUpProps(), {\n className: \"rta__textarea \".concat(className || \"\"),\n onChange: this._changeHandler,\n onSelect: this._selectHandler,\n onScroll: this._onScrollHandler,\n onClick: // The textarea itself is outside the autoselect dropdown.\n this._onClick,\n onBlur: this._onBlur,\n value: value,\n style: style\n }, extraAttrs)), isAutocompleteOpen && React.createElement(Autocomplete, {\n innerRef: function innerRef(ref) {\n // $FlowFixMe\n _this3.dropdownRef = ref;\n },\n top: top,\n left: left,\n style: dropdownStyle,\n className: dropdownClassName,\n movePopupAsYouType: movePopupAsYouType,\n boundariesElement: boundariesElement,\n textareaRef: this.textareaRef,\n renderToBody: renderToBody\n }, suggestionData && component && textToReplace && React.createElement(List, {\n values: suggestionData,\n component: component,\n style: listStyle,\n className: listClassName,\n itemClassName: itemClassName,\n itemStyle: itemStyle,\n getTextToReplace: textToReplace,\n onItemHighlighted: this._onItemHighlightedHandler,\n onSelect: this._onSelect,\n dropdownScroll: this._dropdownScroll\n }), dataLoading && React.createElement(\"div\", {\n className: \"rta__loader \".concat(suggestionData !== null ? \"rta__loader--suggestion-data\" : \"rta__loader--empty-suggestion-data\", \" \").concat(loaderClassName || \"\"),\n style: loaderStyle\n }, React.createElement(Loader, {\n data: suggestionData\n }))));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(_ref3) {\n var value = _ref3.value;\n if (value === null || value === undefined) return null;\n return {\n value: value\n };\n }\n }]);\n\n return ReactTextareaAutocomplete;\n}(React.Component);\n\nReactTextareaAutocomplete.defaultProps = {\n movePopupAsYouType: false,\n value: null,\n minChar: 1,\n boundariesElement: \"body\",\n scrollToItem: true,\n textAreaComponent: \"textarea\",\n renderToBody: false\n};\n\nexport default ReactTextareaAutocomplete;\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import React from 'react';\n\n// basically Exclude[\"ref\"], string>\n\nvar updateRef = function updateRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n return;\n }\n ref.current = value;\n};\nvar useComposedRef = function useComposedRef(libRef, userRef) {\n var prevUserRef = React.useRef();\n return React.useCallback(function (instance) {\n libRef.current = instance;\n if (prevUserRef.current) {\n updateRef(prevUserRef.current, null);\n }\n prevUserRef.current = userRef;\n if (!userRef) {\n return;\n }\n updateRef(userRef, instance);\n }, [userRef]);\n};\n\nexport { useComposedRef as default };\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport * as React from 'react';\nimport useLatest from 'use-latest';\nimport useComposedRef from 'use-composed-ref';\n\nvar HIDDEN_TEXTAREA_STYLE = {\n 'min-height': '0',\n 'max-height': 'none',\n height: '0',\n visibility: 'hidden',\n overflow: 'hidden',\n position: 'absolute',\n 'z-index': '-1000',\n top: '0',\n right: '0',\n display: 'block'\n};\nvar forceHiddenStyles = function forceHiddenStyles(node) {\n Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function (key) {\n node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');\n });\n};\nvar forceHiddenStyles$1 = forceHiddenStyles;\n\nvar hiddenTextarea = null;\nvar getHeight = function getHeight(node, sizingData) {\n var height = node.scrollHeight;\n if (sizingData.sizingStyle.boxSizing === 'border-box') {\n // border-box: add border, since height = content + padding + border\n return height + sizingData.borderSize;\n }\n\n // remove padding, since height = content\n return height - sizingData.paddingSize;\n};\nfunction calculateNodeHeight(sizingData, value, minRows, maxRows) {\n if (minRows === void 0) {\n minRows = 1;\n }\n if (maxRows === void 0) {\n maxRows = Infinity;\n }\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement('textarea');\n hiddenTextarea.setAttribute('tabindex', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n forceHiddenStyles$1(hiddenTextarea);\n }\n if (hiddenTextarea.parentNode === null) {\n document.body.appendChild(hiddenTextarea);\n }\n var paddingSize = sizingData.paddingSize,\n borderSize = sizingData.borderSize,\n sizingStyle = sizingData.sizingStyle;\n var boxSizing = sizingStyle.boxSizing;\n Object.keys(sizingStyle).forEach(function (_key) {\n var key = _key;\n hiddenTextarea.style[key] = sizingStyle[key];\n });\n forceHiddenStyles$1(hiddenTextarea);\n hiddenTextarea.value = value;\n var height = getHeight(hiddenTextarea, sizingData);\n // Double set and calc due to Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1795904\n hiddenTextarea.value = value;\n height = getHeight(hiddenTextarea, sizingData);\n\n // measure height of a textarea with a single row\n hiddenTextarea.value = 'x';\n var rowHeight = hiddenTextarea.scrollHeight - paddingSize;\n var minHeight = rowHeight * minRows;\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n height = Math.max(minHeight, height);\n var maxHeight = rowHeight * maxRows;\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n height = Math.min(maxHeight, height);\n return [height, rowHeight];\n}\n\nvar noop = function noop() {};\nvar pick = function pick(props, obj) {\n return props.reduce(function (acc, prop) {\n acc[prop] = obj[prop];\n return acc;\n }, {});\n};\n\nvar SIZING_STYLE = ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth', 'boxSizing', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'letterSpacing', 'lineHeight', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop',\n// non-standard\n'tabSize', 'textIndent',\n// non-standard\n'textRendering', 'textTransform', 'width', 'wordBreak', 'wordSpacing', 'scrollbarGutter'];\nvar isIE = !!document.documentElement.currentStyle ;\nvar getSizingData = function getSizingData(node) {\n var style = window.getComputedStyle(node);\n if (style === null) {\n return null;\n }\n var sizingStyle = pick(SIZING_STYLE, style);\n var boxSizing = sizingStyle.boxSizing;\n\n // probably node is detached from DOM, can't read computed dimensions\n if (boxSizing === '') {\n return null;\n }\n\n // IE (Edge has already correct behaviour) returns content width as computed width\n // so we need to add manually padding and border widths\n if (isIE && boxSizing === 'border-box') {\n sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(sizingStyle.borderRightWidth) + parseFloat(sizingStyle.borderLeftWidth) + parseFloat(sizingStyle.paddingRight) + parseFloat(sizingStyle.paddingLeft) + 'px';\n }\n var paddingSize = parseFloat(sizingStyle.paddingBottom) + parseFloat(sizingStyle.paddingTop);\n var borderSize = parseFloat(sizingStyle.borderBottomWidth) + parseFloat(sizingStyle.borderTopWidth);\n return {\n sizingStyle: sizingStyle,\n paddingSize: paddingSize,\n borderSize: borderSize\n };\n};\nvar getSizingData$1 = getSizingData;\n\nfunction useListener(target, type, listener) {\n var latestListener = useLatest(listener);\n React.useLayoutEffect(function () {\n var handler = function handler(ev) {\n return latestListener.current(ev);\n };\n // might happen if document.fonts is not defined, for instance\n if (!target) {\n return;\n }\n target.addEventListener(type, handler);\n return function () {\n return target.removeEventListener(type, handler);\n };\n }, []);\n}\nvar useFormResetListener = function useFormResetListener(libRef, listener) {\n useListener(document.body, 'reset', function (ev) {\n if (libRef.current.form === ev.target) {\n listener(ev);\n }\n });\n};\nvar useWindowResizeListener = function useWindowResizeListener(listener) {\n useListener(window, 'resize', listener);\n};\nvar useFontsLoadedListener = function useFontsLoadedListener(listener) {\n useListener(document.fonts, 'loadingdone', listener);\n};\n\nvar _excluded = [\"cacheMeasurements\", \"maxRows\", \"minRows\", \"onChange\", \"onHeightChange\"];\nvar TextareaAutosize = function TextareaAutosize(_ref, userRef) {\n var cacheMeasurements = _ref.cacheMeasurements,\n maxRows = _ref.maxRows,\n minRows = _ref.minRows,\n _ref$onChange = _ref.onChange,\n onChange = _ref$onChange === void 0 ? noop : _ref$onChange,\n _ref$onHeightChange = _ref.onHeightChange,\n onHeightChange = _ref$onHeightChange === void 0 ? noop : _ref$onHeightChange,\n props = _objectWithoutPropertiesLoose(_ref, _excluded);\n var isControlled = props.value !== undefined;\n var libRef = React.useRef(null);\n var ref = useComposedRef(libRef, userRef);\n var heightRef = React.useRef(0);\n var measurementsCacheRef = React.useRef();\n var resizeTextarea = function resizeTextarea() {\n var node = libRef.current;\n var nodeSizingData = cacheMeasurements && measurementsCacheRef.current ? measurementsCacheRef.current : getSizingData$1(node);\n if (!nodeSizingData) {\n return;\n }\n measurementsCacheRef.current = nodeSizingData;\n var _calculateNodeHeight = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', minRows, maxRows),\n height = _calculateNodeHeight[0],\n rowHeight = _calculateNodeHeight[1];\n if (heightRef.current !== height) {\n heightRef.current = height;\n node.style.setProperty('height', height + \"px\", 'important');\n onHeightChange(height, {\n rowHeight: rowHeight\n });\n }\n };\n var handleChange = function handleChange(event) {\n if (!isControlled) {\n resizeTextarea();\n }\n onChange(event);\n };\n {\n React.useLayoutEffect(resizeTextarea);\n useFormResetListener(libRef, function () {\n if (!isControlled) {\n var currentValue = libRef.current.value;\n requestAnimationFrame(function () {\n var node = libRef.current;\n if (node && currentValue !== node.value) {\n resizeTextarea();\n }\n });\n }\n });\n useWindowResizeListener(resizeTextarea);\n useFontsLoadedListener(resizeTextarea);\n return /*#__PURE__*/React.createElement(\"textarea\", _extends({}, props, {\n onChange: handleChange,\n ref: ref\n }));\n }\n};\nvar index = /* #__PURE__ */React.forwardRef(TextareaAutosize);\n\nexport { index as default };\n","import React from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\n\nvar useLatest = function useLatest(value) {\n var ref = React.useRef(value);\n useIsomorphicLayoutEffect(function () {\n ref.current = value;\n });\n return ref;\n};\n\nexport { useLatest as default };\n","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };","import React from 'react'\nimport ReactTextareaAutocomplete from '@webscopeio/react-textarea-autocomplete'\nimport PropTypes from 'prop-types'\nimport TextareaAutosize from 'react-textarea-autosize'\nimport Box from '@mui/material/Box'\nimport dayjs from '../utilities/dayjs'\nimport MarkdownParser from '../reusableComponents/MarkdownParser.jsx'\n\nconst Item = ({ entity: { shortcut, expansion }}) => {shortcut}: {expansion}
\nconst Loading = ({ data }) => Loading
\n\nconst ResizeTextArea = React.forwardRef((props, ref) => (\n \n))\n\nexport default function DashboardDiagnosisNote(props) {\n const diagnosis = props.plannedDiagnosis.diagnosis\n\n const previousProblemListNote =\n diagnosis.problem_list_note || 'No problem list note could be found'\n\n const pastEncounter = props.pastEncounter || {}\n const pastEncounterDetails = pastEncounter.details || {}\n const pastEncounterDiagnoses = pastEncounterDetails.diagnoses || []\n const matchingPastDiagnosis = pastEncounterDiagnoses.find(\n d => d.snomedcode === diagnosis.snomed\n ) || {}\n const previousEncounterNote =\n matchingPastDiagnosis.note || 'No prior encounter note could be found'\n\n const noteDisplaySection = determineNoteDisplaySection(props)\n\n return (\n \n
\n
\n Problem List\n
\n
\n \n
\n
\n Previous Encounter\n
\n
\n \n
\n
\n Add a Note\n
\n
{noteDisplaySection}
\n
\n
\n )\n}\n\nconst determineNoteDisplaySection = ({ plannedDiagnosis, ...props }) => {\n let noteDisplaySection\n if (plannedDiagnosis.status === 'diagnosis sent') {\n const sentTimestamp = dayjs(plannedDiagnosis.updated_at).format('MM/D/YYYY')\n noteDisplaySection = (\n \n
\n {plannedDiagnosis.note}\n
\n
\n {`sent to the EHR on ${sentTimestamp}`}\n \n
\n )\n } else if (plannedDiagnosis.status === 'diagnosis queued') {\n noteDisplaySection = (\n \n
\n {plannedDiagnosis.note}\n
\n
\n {`sending to patient's next appointment with ${plannedDiagnosis.sending_to_provider}`}\n \n
\n )\n } else {\n const { currentUser: { text_macros: textMacros } } = props\n const ua = window.navigator.userAgent\n const usingIE = ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0\n noteDisplaySection =\n usingIE ? (\n